@sma1lboy/rove 0.9.310-nightly.20261128 → 0.9.310
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/{chunk-rrtbrnsm.js → chunk-06cpc990.js} +1 -1
- package/dist/cli/chunk-0ccgkp9z.js +2 -0
- package/dist/cli/{chunk-qjq62kcb.js → chunk-0mdzphdz.js} +1 -1
- package/dist/cli/chunk-0rfd9c8r.js +9 -0
- package/dist/cli/{chunk-n7wa2g9g.js → chunk-0rfkgmns.js} +1 -1
- package/dist/cli/{chunk-0gdrrkeb.js → chunk-0x3vfkz9.js} +1 -1
- package/dist/cli/chunk-0xn13zhr.js +2 -0
- package/dist/cli/{chunk-aw9y2ecv.js → chunk-11vgtrm4.js} +1 -1
- package/dist/cli/{chunk-7akh6mpq.js → chunk-12qq8r81.js} +1 -1
- package/dist/cli/chunk-140pf8yx.js +77 -0
- package/dist/cli/chunk-152tg65q.js +2 -0
- package/dist/cli/chunk-17b3wpdk.js +2 -0
- package/dist/cli/chunk-1thazzyj.js +2 -0
- package/dist/cli/chunk-1wpwxcg9.js +3 -0
- package/dist/cli/chunk-22knrp3g.js +2 -0
- package/dist/cli/{chunk-xpf5znba.js → chunk-29ftjs96.js} +1 -1
- package/dist/cli/{chunk-v73jr6d3.js → chunk-2vk65d66.js} +1 -1
- package/dist/cli/{chunk-0pd79pqm.js → chunk-361acgxq.js} +1 -1
- package/dist/cli/{chunk-7qqg543d.js → chunk-36qsn2v8.js} +1 -1
- package/dist/cli/{chunk-8vhda57t.js → chunk-39txvrcs.js} +1 -1
- package/dist/cli/{chunk-ndjs6pfx.js → chunk-3d6caevx.js} +1 -1
- package/dist/cli/chunk-3fzrgjxr.js +13 -0
- package/dist/cli/{chunk-vr3hz387.js → chunk-3kraw5fh.js} +1 -1
- package/dist/cli/chunk-3vhhs2ye.js +2 -0
- package/dist/cli/chunk-3wkjeqt5.js +19 -0
- package/dist/cli/{chunk-th94kgx8.js → chunk-3yd8nyv6.js} +2 -2
- package/dist/cli/chunk-451z1265.js +19 -0
- package/dist/cli/chunk-4csg29es.js +3 -0
- package/dist/cli/chunk-4g1466qe.js +2 -0
- package/dist/cli/{chunk-d527kp0a.js → chunk-4y536nwm.js} +1 -1
- package/dist/cli/chunk-599msv9a.js +2 -0
- package/dist/cli/{chunk-94v7fkbx.js → chunk-5jevazzh.js} +2 -2
- package/dist/cli/chunk-5p2hhjje.js +3 -0
- package/dist/cli/{chunk-e5rhtk39.js → chunk-5sb5cgsx.js} +1 -1
- package/dist/cli/{chunk-7za2saew.js → chunk-65nm1v5h.js} +1 -1
- package/dist/cli/{chunk-bccq9wmd.js → chunk-69cqwz53.js} +1 -1
- package/dist/cli/{chunk-t0m58ycm.js → chunk-6f6b9zxx.js} +1 -1
- package/dist/cli/{chunk-f3bfy4jj.js → chunk-6qp32yje.js} +1 -1
- package/dist/cli/{chunk-zren8xsj.js → chunk-6t1yxx9x.js} +1 -1
- package/dist/cli/{chunk-nsscv6nb.js → chunk-76snhsy7.js} +1 -1
- package/dist/cli/{chunk-9avew3w0.js → chunk-7709m234.js} +1 -1
- package/dist/cli/{chunk-br2ehnve.js → chunk-7fw390kp.js} +1 -1
- package/dist/cli/{chunk-9h9kbx1m.js → chunk-7vassnhs.js} +3 -3
- package/dist/cli/chunk-887ysmy5.js +2 -0
- package/dist/cli/{chunk-bp4wst6z.js → chunk-89xz7kc8.js} +1 -1
- package/dist/cli/chunk-8akyzrjc.js +2 -0
- package/dist/cli/chunk-8byrmc70.js +3 -0
- package/dist/cli/{chunk-ys6md651.js → chunk-8ca4esh6.js} +1 -1
- package/dist/cli/{chunk-vf138rbf.js → chunk-8y9de8mg.js} +2 -2
- package/dist/cli/chunk-96wm6gt4.js +7 -0
- package/dist/cli/{chunk-2d0yz3mg.js → chunk-97fhq6zk.js} +1 -1
- package/dist/cli/chunk-9qye1syf.js +3 -0
- package/dist/cli/{chunk-e6wjt3e2.js → chunk-a2m6sk0n.js} +1 -1
- package/dist/cli/chunk-a2rxzyy4.js +2 -0
- package/dist/cli/chunk-asnjgz5a.js +4 -0
- package/dist/cli/chunk-aterhn60.js +3 -0
- package/dist/cli/chunk-ay3c35g5.js +2 -0
- package/dist/cli/{chunk-1kf56h0r.js → chunk-b3nrywgm.js} +1 -1
- package/dist/cli/{chunk-fg8d4z6c.js → chunk-bche07fb.js} +1 -1
- package/dist/cli/{chunk-5nwcwk6x.js → chunk-bsprr76b.js} +1 -1
- package/dist/cli/{chunk-jpc5yh8e.js → chunk-bwgtbaex.js} +1 -1
- package/dist/cli/chunk-bxabhkaq.js +21 -0
- package/dist/cli/{chunk-se483mcw.js → chunk-bz3p5vp1.js} +3 -3
- package/dist/cli/chunk-bzqjk9fb.js +3 -0
- package/dist/cli/chunk-c4c03wnz.js +3 -0
- package/dist/cli/{chunk-kqb8dd6n.js → chunk-cjzyc7cn.js} +12 -10
- package/dist/cli/{chunk-b550dwkd.js → chunk-cq4fym60.js} +1 -1
- package/dist/cli/{chunk-6d49rhme.js → chunk-cqazrkzw.js} +1 -1
- package/dist/cli/{chunk-vnp1k7ek.js → chunk-d3sgpjj6.js} +1 -1
- package/dist/cli/{chunk-rzem07e4.js → chunk-d5gtdecq.js} +1 -1
- package/dist/cli/chunk-de89aagk.js +6 -0
- package/dist/cli/chunk-ecdnw5xe.js +70 -0
- package/dist/cli/{chunk-sgnm8v1a.js → chunk-ehssspvr.js} +1 -1
- package/dist/cli/{chunk-ytrktnmv.js → chunk-emzt8crt.js} +1 -1
- package/dist/cli/{chunk-pnv7anct.js → chunk-ene2k7kb.js} +1 -1
- package/dist/cli/{chunk-a5p8fvpv.js → chunk-ep7abg35.js} +1 -1
- package/dist/cli/{chunk-7h5xfs5r.js → chunk-etj5h8hg.js} +2 -2
- package/dist/cli/chunk-ex2qtjt3.js +3 -0
- package/dist/cli/chunk-expgczbc.js +2 -0
- package/dist/cli/{chunk-9bq5e4fm.js → chunk-ez623zqp.js} +1 -1
- package/dist/cli/chunk-fads90r0.js +2 -0
- package/dist/cli/chunk-fdajxdht.js +2 -0
- package/dist/cli/{chunk-rbfah7j1.js → chunk-fwrpg1q9.js} +1 -1
- package/dist/cli/{chunk-mq9ng0qf.js → chunk-fyxfgkrw.js} +1 -1
- package/dist/cli/{chunk-b8xsf17w.js → chunk-fzc40zx7.js} +1 -1
- package/dist/cli/{chunk-s2wr6rc2.js → chunk-fzkq16qb.js} +1 -1
- package/dist/cli/chunk-g9qssqb7.js +2 -0
- package/dist/cli/{chunk-ekp98v7y.js → chunk-gf37e6ty.js} +1 -1
- package/dist/cli/chunk-gfsgk1n8.js +2 -0
- package/dist/cli/{chunk-8gy5m5s9.js → chunk-gvxchzch.js} +2 -2
- package/dist/cli/chunk-gxwy1r9a.js +382 -0
- package/dist/cli/{chunk-0ceg9qrt.js → chunk-hedp76tw.js} +1 -1
- package/dist/cli/{chunk-xttwk07t.js → chunk-hvz45y6d.js} +1 -1
- package/dist/cli/chunk-hwckecfa.js +2 -0
- package/dist/cli/{chunk-r987rn4r.js → chunk-j0s13v56.js} +1 -1
- package/dist/cli/chunk-j25b1ggg.js +2 -0
- package/dist/cli/{chunk-mapwzp5d.js → chunk-j6g8jmke.js} +2 -2
- package/dist/cli/chunk-j8r8q5z8.js +8 -0
- package/dist/cli/chunk-jgkjfqm9.js +4 -0
- package/dist/cli/{chunk-fexbzt63.js → chunk-jpa26n83.js} +1 -1
- package/dist/cli/chunk-jx3zndsh.js +2 -0
- package/dist/cli/chunk-jykxdtad.js +3 -0
- package/dist/cli/{chunk-73a9kk03.js → chunk-jyrmdx8f.js} +1 -1
- package/dist/cli/{chunk-fkz86c53.js → chunk-k1pk159f.js} +1 -1
- package/dist/cli/{chunk-4q5gbyhd.js → chunk-kmfas00z.js} +1 -1
- package/dist/cli/{chunk-szdzakrk.js → chunk-kpq28cbh.js} +1 -1
- package/dist/cli/chunk-kzcd7vdj.js +189 -0
- package/dist/cli/chunk-m0kprsxc.js +2 -0
- package/dist/cli/chunk-m932h3dx.js +30 -0
- package/dist/cli/{chunk-r5c51qqp.js → chunk-mp535p99.js} +1 -1
- package/dist/cli/chunk-mpmsc9s5.js +2 -0
- package/dist/cli/{chunk-dmb3y33d.js → chunk-n9d40jze.js} +1 -1
- package/dist/cli/{chunk-0b9dhq9b.js → chunk-navavqt2.js} +1 -1
- package/dist/cli/chunk-nf7pks44.js +2 -0
- package/dist/cli/chunk-pgaf0wqj.js +2 -0
- package/dist/cli/chunk-pp771snb.js +3 -0
- package/dist/cli/{chunk-3k56eqyb.js → chunk-pw0fvd64.js} +2 -2
- package/dist/cli/{chunk-55h581rc.js → chunk-qbmdpbdg.js} +1 -1
- package/dist/cli/chunk-qe7m3bwf.js +2 -0
- package/dist/cli/{chunk-6x4h80aw.js → chunk-qsfc7q9h.js} +1 -1
- package/dist/cli/chunk-r9n3asjx.js +2 -0
- package/dist/cli/{chunk-7v2m50tf.js → chunk-rr97z89e.js} +1 -1
- package/dist/cli/{chunk-sae6zcnq.js → chunk-rt4bsvd5.js} +1 -1
- package/dist/cli/chunk-sd3e5htq.js +2 -0
- package/dist/cli/{chunk-rzskspr8.js → chunk-spr6z826.js} +1 -1
- package/dist/cli/{chunk-jmx0vbra.js → chunk-t2f0xqyk.js} +2 -2
- package/dist/cli/chunk-t9vpmnbc.js +7 -0
- package/dist/cli/{chunk-mwnx6dk0.js → chunk-teq8p5rp.js} +4 -4
- package/dist/cli/{chunk-ebd4hnwk.js → chunk-tswzvtsy.js} +1 -1
- package/dist/cli/chunk-tzhfek18.js +34 -0
- package/dist/cli/{chunk-b4fqpvf8.js → chunk-v29v0cgd.js} +1 -1
- package/dist/cli/chunk-v2vs5nzx.js +2 -0
- package/dist/cli/{chunk-brk45qrp.js → chunk-v72qzktg.js} +1 -1
- package/dist/cli/chunk-vg3tyctk.js +2 -0
- package/dist/cli/chunk-vpy8tvfy.js +6 -0
- package/dist/cli/{chunk-eh7gh2nd.js → chunk-w3dpq6aj.js} +3 -3
- package/dist/cli/chunk-w70anvs6.js +3 -0
- package/dist/cli/chunk-wcjpanrw.js +51 -0
- package/dist/cli/{chunk-ay4k354s.js → chunk-wjmte4f0.js} +1 -1
- package/dist/cli/chunk-wth84cjn.js +3 -0
- package/dist/cli/chunk-wx3pr38x.js +2 -0
- package/dist/cli/{chunk-zw0k97mj.js → chunk-xc2zndmb.js} +1 -1
- package/dist/cli/chunk-xff3eqbv.js +2 -0
- package/dist/cli/chunk-xq2tazj5.js +2 -0
- package/dist/cli/{chunk-wdsbprdp.js → chunk-y4bhq88n.js} +1 -1
- package/dist/cli/{chunk-a833bpk3.js → chunk-y6eqz5pa.js} +1 -1
- package/dist/cli/{chunk-mm9rcced.js → chunk-ydxq51g3.js} +1 -1
- package/dist/cli/{chunk-nkgfr338.js → chunk-yg74j7kp.js} +1 -1
- package/dist/cli/{chunk-gpsj28xq.js → chunk-ygdxgp8r.js} +1 -1
- package/dist/cli/{chunk-h9hve3q0.js → chunk-ymmzwv5w.js} +2 -2
- package/dist/cli/{chunk-g883a7np.js → chunk-yn7y3epg.js} +1 -1
- package/dist/cli/chunk-ynwk3ep3.js +2 -0
- package/dist/cli/chunk-ypbh8ra4.js +8 -0
- package/dist/cli/{chunk-243dk7qd.js → chunk-z343ngx6.js} +1 -1
- package/dist/cli/{chunk-tdxr7vsr.js → chunk-z3cje8hk.js} +1 -1
- package/dist/cli/{chunk-q11wjx9d.js → chunk-z4nk2g47.js} +1 -1
- package/dist/cli/{chunk-18jk12bw.js → chunk-z6k53zqj.js} +1 -1
- package/dist/cli/chunk-z7dzpnyt.js +2 -0
- package/dist/cli/{chunk-h3fhg0k6.js → chunk-z98zs1h3.js} +2 -2
- package/dist/cli/chunk-z9c475xb.js +1 -0
- package/dist/cli/chunk-zg76y0bt.js +2 -0
- package/dist/cli/{chunk-sxpb2rv2.js → chunk-zgmnse5q.js} +1 -1
- package/dist/cli/chunk-zknvzer3.js +3 -0
- package/dist/cli/{chunk-1tqdxper.js → chunk-zpwg3eh0.js} +1 -1
- package/dist/cli/{chunk-e62x3fgv.js → chunk-zswn8skz.js} +1 -1
- package/dist/cli/index.js +7 -7
- package/dist/cli/pty-host-node.mjs +1 -1
- package/dist/cli/rove-run.js +1 -1
- package/dist/cli/rove.js +5 -5
- package/dist/completions/rove.bash +5 -3
- package/dist/completions/rove.fish +6 -2
- package/dist/completions/rove.zsh +5 -3
- package/dist/skills/rove/SKILL.md +21 -1
- package/dist/skills/rove/references/api-flags.md +21 -7
- package/dist/web/assets/index-BWayUsdy.css +1 -0
- package/dist/web/assets/index-D7OcIn1Q.js +113 -0
- package/dist/web/assets/term-mount-CSGanVNa.js +94 -0
- package/dist/web/index.html +2 -2
- package/dist/web/relay/index.html +12 -12
- package/dist/web/relay-client/assets/index-B307rVpU.js +264 -0
- package/dist/web/relay-client/assets/index-T6nIyGrP.css +1 -0
- package/dist/web/relay-client/index.html +2 -2
- package/package.json +7 -7
- package/dist/cli/chunk-0ft14bvv.js +0 -2
- package/dist/cli/chunk-0fymskqv.js +0 -2
- package/dist/cli/chunk-0x5c0fps.js +0 -2
- package/dist/cli/chunk-1z684jqw.js +0 -7
- package/dist/cli/chunk-22zaracj.js +0 -2
- package/dist/cli/chunk-35bm2hhp.js +0 -3
- package/dist/cli/chunk-43z1kjw1.js +0 -34
- package/dist/cli/chunk-452h1mje.js +0 -4
- package/dist/cli/chunk-4bje4rs5.js +0 -2
- package/dist/cli/chunk-4nwydt5r.js +0 -70
- package/dist/cli/chunk-5fn27ykb.js +0 -3
- package/dist/cli/chunk-686h761b.js +0 -2
- package/dist/cli/chunk-6ev3tb6p.js +0 -2
- package/dist/cli/chunk-6rpzvsp9.js +0 -2
- package/dist/cli/chunk-6rtxkaq4.js +0 -62
- package/dist/cli/chunk-7q0tgnka.js +0 -2
- package/dist/cli/chunk-7xzsssdb.js +0 -2
- package/dist/cli/chunk-7yx30m9p.js +0 -2
- package/dist/cli/chunk-88c4frwd.js +0 -2
- package/dist/cli/chunk-8jp0h0cb.js +0 -3
- package/dist/cli/chunk-9hkf3fxt.js +0 -2
- package/dist/cli/chunk-9tfh7fm8.js +0 -2
- package/dist/cli/chunk-a1cdvvjj.js +0 -3
- package/dist/cli/chunk-b926z6ts.js +0 -3
- package/dist/cli/chunk-c9c6yczz.js +0 -3
- package/dist/cli/chunk-cq5bvzpw.js +0 -2
- package/dist/cli/chunk-dsqcwtw5.js +0 -5
- package/dist/cli/chunk-e3d8k6yn.js +0 -173
- package/dist/cli/chunk-ea6nmvhb.js +0 -6
- package/dist/cli/chunk-en31v4c6.js +0 -2
- package/dist/cli/chunk-ex4q79hw.js +0 -4
- package/dist/cli/chunk-f7h3mzk0.js +0 -3
- package/dist/cli/chunk-feq3nytk.js +0 -3
- package/dist/cli/chunk-g2brwxbt.js +0 -2
- package/dist/cli/chunk-g6wzch69.js +0 -162
- package/dist/cli/chunk-gpdrhahv.js +0 -2
- package/dist/cli/chunk-h0yvntcq.js +0 -3
- package/dist/cli/chunk-hy1pkmfa.js +0 -2
- package/dist/cli/chunk-jrrq9k1b.js +0 -212
- package/dist/cli/chunk-khfwvz0g.js +0 -2
- package/dist/cli/chunk-kknejavp.js +0 -2
- package/dist/cli/chunk-m00ftggk.js +0 -11
- package/dist/cli/chunk-mktg22yf.js +0 -13
- package/dist/cli/chunk-mxr7n23g.js +0 -2
- package/dist/cli/chunk-nr7gk1r6.js +0 -2
- package/dist/cli/chunk-p90ne1pc.js +0 -4
- package/dist/cli/chunk-pmfkzjj4.js +0 -2
- package/dist/cli/chunk-qwkgksrt.js +0 -2
- package/dist/cli/chunk-r1zy756y.js +0 -2
- package/dist/cli/chunk-rf82fyrx.js +0 -2
- package/dist/cli/chunk-rv0c3aje.js +0 -2
- package/dist/cli/chunk-s0y3qw79.js +0 -2
- package/dist/cli/chunk-tm6vvy5t.js +0 -3
- package/dist/cli/chunk-tsyz1xr8.js +0 -2
- package/dist/cli/chunk-vfc9k4b9.js +0 -5
- package/dist/cli/chunk-wgyhtgeq.js +0 -2
- package/dist/cli/chunk-yecvqy0c.js +0 -2
- package/dist/cli/chunk-yz9erpjc.js +0 -2
- package/dist/cli/chunk-zhjd9pvc.js +0 -2
- package/dist/cli/chunk-zmk4q05h.js +0 -2
- package/dist/cli/chunk-zwbnsf1p.js +0 -8
- package/dist/cli/chunk-zy7m8fm9.js +0 -2
- package/dist/web/assets/index-BJEFhpXi.css +0 -1
- package/dist/web/assets/index-D7VnKpGY.js +0 -100
- package/dist/web/assets/term-mount-DBU4rcMr.js +0 -94
- package/dist/web/relay-client/assets/index-D9PRsWzW.js +0 -251
- package/dist/web/relay-client/assets/index-Dk042dEU.css +0 -1
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,o)=>(o=n==null?{}:e(i(n)),l(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function d(){return localStorage.getItem(m)}function f(e){localStorage.setItem(m,e)}function p(){localStorage.removeItem(m)}var m,h=o((()=>{if(m=`rove.bridge.token`,typeof window<`u`){let e=new URLSearchParams(window.location.hash.slice(1)).get(`token`);e&&(localStorage.setItem(m,e),history.replaceState(null,``,window.location.pathname+window.location.search))}}));h();var g=s((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ee=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function j(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function M(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,M(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+A(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(ee,`$&/`)+`/`),M(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ee,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+A(a,u),c+=M(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+A(a,u++),c+=M(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return M(j(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function N(e,t,n){if(e==null)return e;var r=[],i=0;return M(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function P(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var F=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},I={map:N,forEach:function(e,t,n){N(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return N(e,function(){t++}),t},toArray:function(e){return N(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=I,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:P}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,F)}catch(e){F(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),_=s(((e,t)=>{t.exports=g()})),v=s((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&A(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,ee=k.port2;k.port1.onmessage=D,O=function(){ee.postMessage(null)}}else O=function(){_(D,0)};function A(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,A(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),y=s(((e,t)=>{t.exports=v()})),b=s((e=>{var t=_();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.8`})),x=s(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=b()})),S=s((e=>{var t=y(),n=_(),r=x();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),b=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),ee=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function j(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var M=Symbol.for(`react.client.reference`);function N(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===M?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case b:return`Profiler`;case v:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?N(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return N(e(t))}catch{}}return null}var P=Array.isArray,F=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L={pending:!1,data:null,method:null,action:null},R=[],te=-1;function ne(e){return{current:e}}function re(e){0>te||(e.current=R[te],R[te]=null,te--)}function ie(e,t){te++,R[te]=e.current,e.current=t}var ae=ne(null),z=ne(null),oe=ne(null),se=ne(null);function ce(e,t){switch(ie(oe,t),ie(z,e),ie(ae,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Gd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Gd(t),e=Kd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}re(ae),ie(ae,e)}function le(){re(ae),re(z),re(oe)}function ue(e){e.memoizedState!==null&&ie(se,e);var t=ae.current,n=Kd(t,e.type);t!==n&&(ie(z,e),ie(ae,n))}function de(e){z.current===e&&(re(ae),re(z)),se.current===e&&(re(se),np._currentValue=L)}var B,fe;function pe(e){if(B===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);B=t&&t[1]||``,fe=-1<e.stack.indexOf(`
|
|
2
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
3
|
+
`+B+e+fe}var me=!1;function V(e,t){if(!e||me)return``;me=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
4
|
+
`),l=s.split(`
|
|
5
|
+
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
6
|
+
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{me=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?pe(n):``}function he(e,t){switch(e.tag){case 26:case 27:case 5:return pe(e.type);case 16:return pe(`Lazy`);case 13:return e.child!==t&&t!==null?pe(`Suspense Fallback`):pe(`Suspense`);case 19:return pe(`SuspenseList`);case 0:case 15:return V(e.type,!1);case 11:return V(e.type.render,!1);case 1:return V(e.type,!0);case 31:return pe(`Activity`);default:return``}}function ge(e){try{var t=``,n=null;do t+=he(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
7
|
+
Error generating stack: `+e.message+`
|
|
8
|
+
`+e.stack}}var _e=Object.prototype.hasOwnProperty,ve=t.unstable_scheduleCallback,ye=t.unstable_cancelCallback,be=t.unstable_shouldYield,xe=t.unstable_requestPaint,Se=t.unstable_now,Ce=t.unstable_getCurrentPriorityLevel,we=t.unstable_ImmediatePriority,Te=t.unstable_UserBlockingPriority,H=t.unstable_NormalPriority,Ee=t.unstable_LowPriority,De=t.unstable_IdlePriority,Oe=t.log,ke=t.unstable_setDisableYieldValue,Ae=null,je=null;function Me(e){if(typeof Oe==`function`&&ke(e),je&&typeof je.setStrictMode==`function`)try{je.setStrictMode(Ae,e)}catch{}}var Ne=Math.clz32?Math.clz32:Ie,Pe=Math.log,Fe=Math.LN2;function Ie(e){return e>>>=0,e===0?32:31-(Pe(e)/Fe|0)|0}var Le=256,Re=262144,ze=4194304;function Be(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ve(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Be(n))):i=Be(o):i=Be(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Be(n))):i=Be(o)):i=Be(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function He(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ue(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function We(){var e=ze;return ze<<=1,!(ze&62914560)&&(ze=4194304),e}function Ge(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ke(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function qe(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Ne(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Je(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Je(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ne(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ye(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ne(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Xe(e,t){var n=t&-t;return n=n&42?1:Ze(n),(n&(e.suspendedLanes|t))===0?n:0}function Ze(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Qe(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function $e(){var e=I.p;return e===0?(e=window.event,e===void 0?32:vp(e.type)):e}function et(e,t){var n=I.p;try{return I.p=e,t()}finally{I.p=n}}var tt=Math.random().toString(36).slice(2),nt=`__reactFiber$`+tt,rt=`__reactProps$`+tt,it=`__reactContainer$`+tt,at=`__reactEvents$`+tt,ot=`__reactListeners$`+tt,st=`__reactHandles$`+tt,ct=`__reactResources$`+tt,lt=`__reactMarker$`+tt;function ut(e){delete e[nt],delete e[rt],delete e[at],delete e[ot],delete e[st]}function dt(e){var t=e[nt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[it]||n[nt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=hf(e);e!==null;){if(n=e[nt])return n;e=hf(e)}return t}e=n,n=e.parentNode}return null}function ft(e){if(e=e[nt]||e[it]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function pt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function mt(e){var t=e[ct];return t||=e[ct]={hoistableStyles:new Map,hoistableScripts:new Map},t}function ht(e){e[lt]=!0}var gt=new Set,_t={};function vt(e,t){yt(e,t),yt(e+`Capture`,t)}function yt(e,t){for(_t[e]=t,e=0;e<t.length;e++)gt.add(t[e])}var bt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),xt={},St={};function Ct(e){return _e.call(St,e)?!0:_e.call(xt,e)?!1:bt.test(e)?St[e]=!0:(xt[e]=!0,!1)}function wt(e,t,n){if(Ct(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}}function Tt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Et(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Dt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Ot(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function kt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function At(e){if(!e._valueTracker){var t=Ot(e)?`checked`:`value`;e._valueTracker=kt(e,t,``+e[t])}}function jt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Ot(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function Mt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Nt=/[\n"\\]/g;function Pt(e){return e.replace(Nt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Ft(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Dt(t)):e.value!==``+Dt(t)&&(e.value=``+Dt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Lt(e,o,Dt(n)):Lt(e,o,Dt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Dt(s):e.removeAttribute(`name`)}function It(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){At(e);return}n=n==null?``:``+Dt(n),t=t==null?n:``+Dt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),At(e)}function Lt(e,t,n){t===`number`&&Mt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Rt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Dt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function zt(e,t,n){if(t!=null&&(t=``+Dt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Dt(n)}function Bt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(P(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Dt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),At(e)}function Vt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ht=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Ut(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Ht.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Wt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Ut(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Ut(e,o,t[o])}function Gt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Kt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),qt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Jt(e){return qt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Yt(){}var Xt=null;function Zt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Qt=null,$t=null;function en(e){var t=ft(e);if(t&&(e=t.stateNode)){var n=e[rt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Ft(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Pt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[rt]||null;if(!a)throw Error(i(90));Ft(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&jt(r)}break a;case`textarea`:zt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Rt(e,!!n.multiple,t,!1)}}}var tn=!1;function nn(e,t,n){if(tn)return e(t,n);tn=!0;try{return e(t)}finally{if(tn=!1,(Qt!==null||$t!==null)&&(xu(),Qt&&(t=Qt,e=$t,$t=Qt=null,en(t),e)))for(t=0;t<e.length;t++)en(e[t])}}function rn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[rt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var an=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),on=!1;if(an)try{var sn={};Object.defineProperty(sn,"passive",{get:function(){on=!0}}),window.addEventListener(`test`,sn,sn),window.removeEventListener(`test`,sn,sn)}catch{on=!1}var cn=null,ln=null,un=null;function dn(){if(un)return un;var e,t=ln,n=t.length,r,i=`value`in cn?cn.value:cn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return un=i.slice(e,1<r?1-r:void 0)}function fn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function pn(){return!0}function mn(){return!1}function hn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?pn:mn,this.isPropagationStopped=mn,this}return f(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=pn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=pn)},persist:function(){},isPersistent:pn}),t}var gn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_n=hn(gn),U=f({},gn,{view:0,detail:0}),vn=hn(U),W,yn,bn,xn=f({},U,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==bn&&(bn&&e.type===`mousemove`?(W=e.screenX-bn.screenX,yn=e.screenY-bn.screenY):yn=W=0,bn=e),W)},movementY:function(e){return`movementY`in e?e.movementY:yn}}),Sn=hn(xn),Cn=hn(f({},xn,{dataTransfer:0})),G=hn(f({},U,{relatedTarget:0})),wn=hn(f({},gn,{animationName:0,elapsedTime:0,pseudoElement:0})),Tn=hn(f({},gn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),En=hn(f({},gn,{data:0})),Dn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},On={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},kn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function An(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=kn[e])?!!t[e]:!1}function jn(){return An}var Mn=hn(f({},U,{key:function(e){if(e.key){var t=Dn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=fn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?On[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jn,charCode:function(e){return e.type===`keypress`?fn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?fn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Nn=hn(f({},xn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Pn=hn(f({},U,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jn})),Fn=hn(f({},gn,{propertyName:0,elapsedTime:0,pseudoElement:0})),In=hn(f({},xn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Ln=hn(f({},gn,{newState:0,oldState:0})),Rn=[9,13,27,32],zn=an&&`CompositionEvent`in window,Bn=null;an&&`documentMode`in document&&(Bn=document.documentMode);var Vn=an&&`TextEvent`in window&&!Bn,Hn=an&&(!zn||Bn&&8<Bn&&11>=Bn),Un=` `,Wn=!1;function Gn(e,t){switch(e){case`keyup`:return Rn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Kn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var qn=!1;function Jn(e,t){switch(e){case`compositionend`:return Kn(t);case`keypress`:return t.which===32?(Wn=!0,Un):null;case`textInput`:return e=t.data,e===Un&&Wn?null:e;default:return null}}function Yn(e,t){if(qn)return e===`compositionend`||!zn&&Gn(e,t)?(e=dn(),un=ln=cn=null,qn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Hn&&t.locale!==`ko`?null:t.data;default:return null}}var Xn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Zn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Xn[e.type]:t===`textarea`}function Qn(e,t,n,r){Qt?$t?$t.push(r):$t=[r]:Qt=r,t=kd(t,`onChange`),0<t.length&&(n=new _n(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var $n=null,er=null;function tr(e){xd(e,0)}function nr(e){if(jt(pt(e)))return e}function rr(e,t){if(e===`change`)return t}var ir=!1;if(an){var ar;if(an){var or=`oninput`in document;if(!or){var sr=document.createElement(`div`);sr.setAttribute(`oninput`,`return;`),or=typeof sr.oninput==`function`}ar=or}else ar=!1;ir=ar&&(!document.documentMode||9<document.documentMode)}function cr(){$n&&($n.detachEvent(`onpropertychange`,lr),er=$n=null)}function lr(e){if(e.propertyName===`value`&&nr(er)){var t=[];Qn(t,er,e,Zt(e)),nn(tr,t)}}function ur(e,t,n){e===`focusin`?(cr(),$n=t,er=n,$n.attachEvent(`onpropertychange`,lr)):e===`focusout`&&cr()}function dr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return nr(er)}function fr(e,t){if(e===`click`)return nr(t)}function pr(e,t){if(e===`input`||e===`change`)return nr(t)}function mr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var hr=typeof Object.is==`function`?Object.is:mr;function gr(e,t){if(hr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!_e.call(t,i)||!hr(e[i],t[i]))return!1}return!0}function _r(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function vr(e,t){var n=_r(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=_r(n)}}function yr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?yr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function br(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Mt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Mt(e.document)}return t}function xr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Sr=an&&`documentMode`in document&&11>=document.documentMode,Cr=null,wr=null,Tr=null,Er=!1;function Dr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Er||Cr==null||Cr!==Mt(r)||(r=Cr,`selectionStart`in r&&xr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Tr&&gr(Tr,r)||(Tr=r,r=kd(wr,`onSelect`),0<r.length&&(t=new _n(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Cr)))}function Or(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var kr={animationend:Or(`Animation`,`AnimationEnd`),animationiteration:Or(`Animation`,`AnimationIteration`),animationstart:Or(`Animation`,`AnimationStart`),transitionrun:Or(`Transition`,`TransitionRun`),transitionstart:Or(`Transition`,`TransitionStart`),transitioncancel:Or(`Transition`,`TransitionCancel`),transitionend:Or(`Transition`,`TransitionEnd`)},Ar={},jr={};an&&(jr=document.createElement(`div`).style,`AnimationEvent`in window||(delete kr.animationend.animation,delete kr.animationiteration.animation,delete kr.animationstart.animation),`TransitionEvent`in window||delete kr.transitionend.transition);function Mr(e){if(Ar[e])return Ar[e];if(!kr[e])return e;var t=kr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in jr)return Ar[e]=t[n];return e}var Nr=Mr(`animationend`),Pr=Mr(`animationiteration`),Fr=Mr(`animationstart`),Ir=Mr(`transitionrun`),Lr=Mr(`transitionstart`),Rr=Mr(`transitioncancel`),zr=Mr(`transitionend`),Br=new Map,Vr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Vr.push(`scrollEnd`);function Hr(e,t){Br.set(e,t),vt(t,[e])}var Ur=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Wr=[],Gr=0,Kr=0;function qr(){for(var e=Gr,t=Kr=Gr=0;t<e;){var n=Wr[t];Wr[t++]=null;var r=Wr[t];Wr[t++]=null;var i=Wr[t];Wr[t++]=null;var a=Wr[t];if(Wr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Zr(n,i,a)}}function Jr(e,t,n,r){Wr[Gr++]=e,Wr[Gr++]=t,Wr[Gr++]=n,Wr[Gr++]=r,Kr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Yr(e,t,n,r){return Jr(e,t,n,r),Qr(e)}function Xr(e,t){return Jr(e,null,null,t),Qr(e)}function Zr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Ne(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Qr(e){if(50<fu)throw fu=0,pu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var $r={};function ei(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ti(e,t,n,r){return new ei(e,t,n,r)}function ni(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ri(e,t){var n=e.alternate;return n===null?(n=ti(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ii(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ai(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ni(e)&&(s=1);else if(typeof e==`string`)s=qf(e,n,ae.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=ti(31,n,t,a),e.elementType=k,e.lanes=o,e;case g:return oi(n.children,a,o,t);case v:s=8,a|=24;break;case b:return e=ti(12,n,t,a|2),e.elementType=b,e.lanes=o,e;case T:return e=ti(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=ti(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ti(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function oi(e,t,n,r){return e=ti(7,e,r,t),e.lanes=n,e}function si(e,t,n){return e=ti(6,e,null,t),e.lanes=n,e}function ci(e){var t=ti(18,null,null,0);return t.stateNode=e,t}function li(e,t,n){return t=ti(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ui=new WeakMap;function di(e,t){if(typeof e==`object`&&e){var n=ui.get(e);return n===void 0?(t={value:e,source:t,stack:ge(t)},ui.set(e,t),t):n}return{value:e,source:t,stack:ge(t)}}var fi=[],pi=0,mi=null,hi=0,K=[],gi=0,_i=null,vi=1,yi=``;function bi(e,t){fi[pi++]=hi,fi[pi++]=mi,mi=e,hi=t}function q(e,t,n){K[gi++]=vi,K[gi++]=yi,K[gi++]=_i,_i=e;var r=vi;e=yi;var i=32-Ne(r)-1;r&=~(1<<i),n+=1;var a=32-Ne(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,vi=1<<32-Ne(t)+i|n<<i|r,yi=a+e}else vi=1<<a|n<<i|r,yi=e}function xi(e){e.return!==null&&(bi(e,1),q(e,1,0))}function Si(e){for(;e===mi;)mi=fi[--pi],fi[pi]=null,hi=fi[--pi],fi[pi]=null;for(;e===_i;)_i=K[--gi],K[gi]=null,yi=K[--gi],K[gi]=null,vi=K[--gi],K[gi]=null}function Ci(e,t){K[gi++]=vi,K[gi++]=yi,K[gi++]=_i,vi=t.id,yi=t.overflow,_i=e}var wi=null,Ti=null,Ei=!1,Di=null,Oi=!1,ki=Error(i(519));function Ai(e){throw Fi(di(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ki}function ji(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[nt]=e,t[rt]=r,n){case`dialog`:Sd(`cancel`,t),Sd(`close`,t);break;case`iframe`:case`object`:case`embed`:Sd(`load`,t);break;case`video`:case`audio`:for(n=0;n<yd.length;n++)Sd(yd[n],t);break;case`source`:Sd(`error`,t);break;case`img`:case`image`:case`link`:Sd(`error`,t),Sd(`load`,t);break;case`details`:Sd(`toggle`,t);break;case`input`:Sd(`invalid`,t),It(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Sd(`invalid`,t);break;case`textarea`:Sd(`invalid`,t),Bt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Fd(t.textContent,n)?(r.popover!=null&&(Sd(`beforetoggle`,t),Sd(`toggle`,t)),r.onScroll!=null&&Sd(`scroll`,t),r.onScrollEnd!=null&&Sd(`scrollend`,t),r.onClick!=null&&(t.onclick=Yt),t=!0):t=!1,t||Ai(e,!0)}function Mi(e){for(wi=e.return;wi;)switch(wi.tag){case 5:case 31:case 13:Oi=!1;return;case 27:case 3:Oi=!0;return;default:wi=wi.return}}function J(e){if(e!==wi)return!1;if(!Ei)return Mi(e),Ei=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||qd(e.type,e.memoizedProps)),n=!n),n&&Ti&&Ai(e),Mi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ti=mf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ti=mf(e)}else t===27?(t=Ti,tf(e.type)?(e=pf,pf=null,Ti=e):Ti=t):Ti=wi?ff(e.stateNode.nextSibling):null;return!0}function Ni(){Ti=wi=null,Ei=!1}function Pi(){var e=Di;return e!==null&&(Ql===null?Ql=e:Ql.push.apply(Ql,e),Di=null),e}function Fi(e){Di===null?Di=[e]:Di.push(e)}var Ii=ne(null),Li=null,Ri=null;function zi(e,t,n){ie(Ii,t._currentValue),t._currentValue=n}function Bi(e){e._currentValue=Ii.current,re(Ii)}function Vi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Hi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Vi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Vi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Ui(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;hr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===se.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[np]:e.push(np))}a=a.return}e!==null&&Hi(t,e,n,r),t.flags|=262144}function Wi(e){for(e=e.firstContext;e!==null;){if(!hr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Gi(e){Li=e,Ri=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ki(e){return Ji(Li,e)}function qi(e,t){return Li===null&&Gi(e),Ji(e,t)}function Ji(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ri===null){if(e===null)throw Error(i(308));Ri=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ri=Ri.next=t;return n}var Yi=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Xi=t.unstable_scheduleCallback,Zi=t.unstable_NormalPriority,Qi={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function $i(){return{controller:new Yi,data:new Map,refCount:0}}function ea(e){e.refCount--,e.refCount===0&&Xi(Zi,function(){e.controller.abort()})}var ta=null,na=0,ra=0,ia=null;function aa(e,t){if(ta===null){var n=ta=[];na=0,ra=pd(),ia={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return na++,t.then(oa,oa),t}function oa(){if(--na===0&&ta!==null){ia!==null&&(ia.status=`fulfilled`);var e=ta;ta=null,ra=0,ia=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function sa(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var ca=F.S;F.S=function(e,t){tu=Se(),typeof t==`object`&&t&&typeof t.then==`function`&&aa(e,t),ca!==null&&ca(e,t)};var la=ne(null);function ua(){var e=la.current;return e===null?Il.pooledCache:e}function da(e,t){t===null?ie(la,la.current):ie(la,t.pool)}function fa(){var e=ua();return e===null?null:{parent:Qi._currentValue,pool:e}}var pa=Error(i(460)),ma=Error(i(474)),ha=Error(i(542)),ga={then:function(){}};function _a(e){return e=e.status,e===`fulfilled`||e===`rejected`}function va(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Yt,Yt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Sa(e),e;default:if(typeof t.status==`string`)t.then(Yt,Yt);else{if(e=Il,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Sa(e),e}throw ba=t,pa}}function ya(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(ba=e,pa):e}}var ba=null;function xa(){if(ba===null)throw Error(i(459));var e=ba;return ba=null,e}function Sa(e){if(e===pa||e===ha)throw Error(i(483))}var Ca=null,wa=0;function Ta(e){var t=wa;return wa+=1,Ca===null&&(Ca=[]),va(Ca,e,t)}function Ea(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Da(e,t){throw t.$$typeof===p?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Oa(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=ri(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=si(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===g?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&ya(i)===t.type)?(t=a(t,n.props),Ea(t,n),t.return=e,t):(t=ai(n.type,n.key,n.props,null,e.mode,r),Ea(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=li(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=oi(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=si(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case m:return n=ai(t.type,t.key,t.props,null,e.mode,n),Ea(n,t),n.return=e,n;case h:return t=li(t,e.mode,n),t.return=e,t;case O:return t=ya(t),f(e,t,n)}if(P(t)||j(t))return t=oi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Ta(t),n);if(t.$$typeof===C)return f(e,qi(e,t),n);Da(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case m:return n.key===i?l(e,t,n,r):null;case h:return n.key===i?u(e,t,n,r):null;case O:return n=ya(n),p(e,t,n,r)}if(P(n)||j(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Ta(n),r);if(n.$$typeof===C)return p(e,t,qi(e,n),r);Da(e,n)}return null}function _(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case m:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case h:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=ya(r),_(e,t,n,r,i)}if(P(r)||j(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return _(e,t,n,Ta(r),i);if(r.$$typeof===C)return _(e,t,n,qi(t,r),i);Da(t,r)}return null}function v(i,a,s,c){for(var l=null,u=null,d=a,m=a=0,h=null;d!==null&&m<s.length;m++){d.index>m?(h=d,d=null):h=d.sibling;var g=p(i,d,s[m],c);if(g===null){d===null&&(d=h);break}e&&d&&g.alternate===null&&t(i,d),a=o(g,a,m),u===null?l=g:u.sibling=g,u=g,d=h}if(m===s.length)return n(i,d),Ei&&bi(i,m),l;if(d===null){for(;m<s.length;m++)d=f(i,s[m],c),d!==null&&(a=o(d,a,m),u===null?l=d:u.sibling=d,u=d);return Ei&&bi(i,m),l}for(d=r(d);m<s.length;m++)h=_(d,i,m,s[m],c),h!==null&&(e&&h.alternate!==null&&d.delete(h.key===null?m:h.key),a=o(h,a,m),u===null?l=h:u.sibling=h,u=h);return e&&d.forEach(function(e){return t(i,e)}),Ei&&bi(i,m),l}function y(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,m=s,h=s=0,g=null,v=c.next();m!==null&&!v.done;h++,v=c.next()){m.index>h?(g=m,m=null):g=m.sibling;var y=p(a,m,v.value,l);if(y===null){m===null&&(m=g);break}e&&m&&y.alternate===null&&t(a,m),s=o(y,s,h),d===null?u=y:d.sibling=y,d=y,m=g}if(v.done)return n(a,m),Ei&&bi(a,h),u;if(m===null){for(;!v.done;h++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return Ei&&bi(a,h),u}for(m=r(m);!v.done;h++,v=c.next())v=_(m,a,h,v.value,l),v!==null&&(e&&v.alternate!==null&&m.delete(v.key===null?h:v.key),s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return e&&m.forEach(function(e){return t(a,e)}),Ei&&bi(a,h),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===g&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case m:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===g){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&ya(l)===r.type){n(e,r.sibling),c=a(r,o.props),Ea(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===g?(c=oi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ai(o.type,o.key,o.props,null,e.mode,c),Ea(c,o),c.return=e,e=c)}return s(e);case h:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=li(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=ya(o),b(e,r,o,c)}if(P(o))return v(e,r,o,c);if(j(o)){if(l=j(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Ta(o),c);if(o.$$typeof===C)return b(e,r,qi(e,o),c);Da(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=si(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{wa=0;var i=b(e,t,n,r);return Ca=null,i}catch(t){if(t===pa||t===ha)throw t;var a=ti(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var ka=Oa(!0),Aa=Oa(!1),ja=!1;function Ma(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Na(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Pa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Fa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Fl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Qr(e),Zr(e,null,n),t}return Jr(e,r,t,n),Qr(e)}function Ia(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ye(e,n)}}function La(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ra=!1;function za(){if(Ra){var e=ia;if(e!==null)throw e}}function Ba(e,t,n,r){Ra=!1;var i=e.updateQueue;ja=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(Rl&p)===p:(r&p)===p){p!==0&&p===ra&&(Ra=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:ja=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Kl|=o,e.lanes=o,e.memoizedState=d}}function Va(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ha(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Va(n[e],t)}var Ua=ne(null),Wa=ne(0);function Ga(e,t){e=Wl,ie(Wa,e),ie(Ua,t),Wl=e|t.baseLanes}function Ka(){ie(Wa,Wl),ie(Ua,Ua.current)}function qa(){Wl=Wa.current,re(Ua),re(Wa)}var Ja=ne(null),Ya=null;function Xa(e){var t=e.alternate;ie(to,to.current&1),ie(Ja,e),Ya===null&&(t===null||Ua.current!==null||t.memoizedState!==null)&&(Ya=e)}function Za(e){ie(to,to.current),ie(Ja,e),Ya===null&&(Ya=e)}function Qa(e){e.tag===22?(ie(to,to.current),ie(Ja,e),Ya===null&&(Ya=e)):$a(e)}function $a(){ie(to,to.current),ie(Ja,Ja.current)}function eo(e){re(Ja),Ya===e&&(Ya=null),re(to)}var to=ne(0);function no(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||lf(n)||uf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ro=0,io=null,ao=null,oo=null,so=!1,co=!1,lo=!1,uo=0,fo=0,po=null,mo=0;function ho(){throw Error(i(321))}function go(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!hr(e[n],t[n]))return!1;return!0}function _o(e,t,n,r,i,a){return ro=a,io=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,F.H=e===null||e.memoizedState===null?Ns:Ps,lo=!1,a=n(r,i),lo=!1,co&&(a=yo(t,n,r,i)),vo(e),a}function vo(e){F.H=Ms;var t=ao!==null&&ao.next!==null;if(ro=0,oo=ao=io=null,so=!1,fo=0,po=null,t)throw Error(i(300));e===null||Zs||(e=e.dependencies,e!==null&&Wi(e)&&(Zs=!0))}function yo(e,t,n,r){io=e;var a=0;do{if(co&&(po=null),fo=0,co=!1,25<=a)throw Error(i(301));if(a+=1,oo=ao=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}F.H=Fs,o=t(n,r)}while(co);return o}function bo(){var e=F.H,t=e.useState()[0];return t=typeof t.then==`function`?Eo(t):t,e=e.useState()[0],(ao===null?null:ao.memoizedState)!==e&&(io.flags|=1024),t}function xo(){var e=uo!==0;return uo=0,e}function So(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Y(e){if(so){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}so=!1}ro=0,oo=ao=io=null,co=!1,fo=uo=0,po=null}function Co(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return oo===null?io.memoizedState=oo=e:oo=oo.next=e,oo}function wo(){if(ao===null){var e=io.alternate;e=e===null?null:e.memoizedState}else e=ao.next;var t=oo===null?io.memoizedState:oo.next;if(t!==null)oo=t,ao=e;else{if(e===null)throw io.alternate===null?Error(i(467)):Error(i(310));ao=e,e={memoizedState:ao.memoizedState,baseState:ao.baseState,baseQueue:ao.baseQueue,queue:ao.queue,next:null},oo===null?io.memoizedState=oo=e:oo=oo.next=e}return oo}function To(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Eo(e){var t=fo;return fo+=1,po===null&&(po=[]),e=va(po,e,t),t=io,(oo===null?t.memoizedState:oo.next)===null&&(t=t.alternate,F.H=t===null||t.memoizedState===null?Ns:Ps),e}function Do(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Eo(e);if(e.$$typeof===C)return Ki(e)}throw Error(i(438,String(e)))}function Oo(e){var t=null,n=io.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=io.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=To(),io.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=ee;return t.index++,n}function ko(e,t){return typeof t==`function`?t(e):t}function Ao(e){return jo(wo(),ao,e)}function jo(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(ro&f)===f:(Rl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ra&&(d=!0);else if((ro&p)===p){u=u.next,p===ra&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,io.lanes|=p,Kl|=p;f=u.action,lo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,io.lanes|=f,Kl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!hr(o,e.memoizedState)&&(Zs=!0,d&&(n=ia,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Mo(e){var t=wo(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);hr(o,t.memoizedState)||(Zs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function No(e,t,n){var r=io,a=wo(),o=Ei;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!hr((ao||a).memoizedState,n);if(s&&(a.memoizedState=n,Zs=!0),a=a.queue,is(Io.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||oo!==null&&oo.memoizedState.tag&1){if(r.flags|=2048,$o(9,{destroy:void 0},Fo.bind(null,r,a,n,t),null),Il===null)throw Error(i(349));o||ro&127||Po(r,t,n)}return n}function Po(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=io.updateQueue,t===null?(t=To(),io.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Fo(e,t,n,r){t.value=n,t.getSnapshot=r,Lo(t)&&Ro(e)}function Io(e,t,n){return n(function(){Lo(t)&&Ro(e)})}function Lo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!hr(e,n)}catch{return!0}}function Ro(e){var t=Xr(e,2);t!==null&&gu(t,e,2)}function zo(e){var t=Co();if(typeof e==`function`){var n=e;if(e=n(),lo){Me(!0);try{n()}finally{Me(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ko,lastRenderedState:e},t}function Bo(e,t,n,r){return e.baseState=n,jo(e,ao,typeof r==`function`?r:ko)}function Vo(e,t,n,r,a){if(ks(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};F.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Ho(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Ho(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=F.T,o={};F.T=o;try{var s=n(i,r),c=F.S;c!==null&&c(o,s),Uo(e,t,s)}catch(n){Go(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),F.T=a}}else try{a=n(i,r),Uo(e,t,a)}catch(n){Go(e,t,n)}}function Uo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Wo(e,t,n)},function(n){return Go(e,t,n)}):Wo(e,t,n)}function Wo(e,t,n){t.status=`fulfilled`,t.value=n,Ko(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Ho(e,n)))}function Go(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Ko(t),t=t.next;while(t!==r)}e.action=null}function Ko(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function qo(e,t){return t}function Jo(e,t){if(Ei){var n=Il.formState;if(n!==null){a:{var r=io;if(Ei){if(Ti){b:{for(var i=Ti,a=Oi;i.nodeType!==8;){if(!a){i=null;break b}if(i=ff(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ti=ff(i.nextSibling),r=i.data===`F!`;break a}}Ai(r)}r=!1}r&&(t=n[0])}}return n=Co(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qo,lastRenderedState:t},n.queue=r,n=Es.bind(null,io,r),r.dispatch=n,r=zo(!1),a=Os.bind(null,io,!1,r.queue),r=Co(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Vo.bind(null,io,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Yo(e){return Xo(wo(),ao,e)}function Xo(e,t,n){if(t=jo(e,t,qo)[0],e=Ao(ko)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Eo(t)}catch(e){throw e===pa?ha:e}else r=t;t=wo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(io.flags|=2048,$o(9,{destroy:void 0},Zo.bind(null,i,n),null)),[r,a,e]}function Zo(e,t){e.action=t}function Qo(e){var t=wo(),n=ao;if(n!==null)return Xo(t,n,e);wo(),t=t.memoizedState,n=wo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function $o(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=io.updateQueue,t===null&&(t=To(),io.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function es(){return wo().memoizedState}function ts(e,t,n,r){var i=Co();io.flags|=e,i.memoizedState=$o(1|t,{destroy:void 0},n,r===void 0?null:r)}function ns(e,t,n,r){var i=wo();r=r===void 0?null:r;var a=i.memoizedState.inst;ao!==null&&r!==null&&go(r,ao.memoizedState.deps)?i.memoizedState=$o(t,a,n,r):(io.flags|=e,i.memoizedState=$o(1|t,a,n,r))}function rs(e,t){ts(8390656,8,e,t)}function is(e,t){ns(2048,8,e,t)}function as(e){io.flags|=4;var t=io.updateQueue;if(t===null)t=To(),io.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function os(e){var t=wo().memoizedState;return as({ref:t,nextImpl:e}),function(){if(Fl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function ss(e,t){return ns(4,2,e,t)}function cs(e,t){return ns(4,4,e,t)}function ls(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function us(e,t,n){n=n==null?null:n.concat([e]),ns(4,4,ls.bind(null,t,e),n)}function ds(){}function fs(e,t){var n=wo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&go(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ps(e,t){var n=wo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&go(t,r[1]))return r[0];if(r=e(),lo){Me(!0);try{e()}finally{Me(!1)}}return n.memoizedState=[r,t],r}function ms(e,t,n){return n===void 0||ro&1073741824&&!(Rl&261930)?e.memoizedState=t:(e.memoizedState=n,e=hu(),io.lanes|=e,Kl|=e,n)}function hs(e,t,n,r){return hr(n,t)?n:Ua.current===null?!(ro&42)||ro&1073741824&&!(Rl&261930)?(Zs=!0,e.memoizedState=n):(e=hu(),io.lanes|=e,Kl|=e,t):(e=ms(e,n,r),hr(e,t)||(Zs=!0),e)}function gs(e,t,n,r,i){var a=I.p;I.p=a!==0&&8>a?a:8;var o=F.T,s={};F.T=s,Os(e,!1,t,n);try{var c=i(),l=F.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ds(e,t,sa(c,r),mu(e)):Ds(e,t,r,mu(e))}catch(n){Ds(e,t,{then:function(){},status:`rejected`,reason:n},mu())}finally{I.p=a,o!==null&&s.types!==null&&(o.types=s.types),F.T=o}}function _s(){}function vs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=ys(e).queue;gs(e,a,t,L,n===null?_s:function(){return bs(e),n(r)})}function ys(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:L,baseState:L,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ko,lastRenderedState:L},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ko,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function bs(e){var t=ys(e);t.next===null&&(t=e.alternate.memoizedState),Ds(e,t.next.queue,{},mu())}function xs(){return Ki(np)}function Ss(){return wo().memoizedState}function Cs(){return wo().memoizedState}function ws(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=mu();e=Pa(n);var r=Fa(t,e,n);r!==null&&(gu(r,t,n),Ia(r,t,n)),t={cache:$i()},e.payload=t;return}t=t.return}}function Ts(e,t,n){var r=mu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},ks(e)?As(t,n):(n=Yr(e,t,n,r),n!==null&&(gu(n,e,r),js(n,t,r)))}function Es(e,t,n){Ds(e,t,n,mu())}function Ds(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(ks(e))As(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,hr(s,o))return Jr(e,t,i,0),Il===null&&qr(),!1}catch{}if(n=Yr(e,t,i,r),n!==null)return gu(n,e,r),js(n,t,r),!0}return!1}function Os(e,t,n,r){if(r={lane:2,revertLane:pd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},ks(e)){if(t)throw Error(i(479))}else t=Yr(e,n,r,2),t!==null&&gu(t,e,2)}function ks(e){var t=e.alternate;return e===io||t!==null&&t===io}function As(e,t){co=so=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function js(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ye(e,n)}}var Ms={readContext:Ki,use:Do,useCallback:ho,useContext:ho,useEffect:ho,useImperativeHandle:ho,useLayoutEffect:ho,useInsertionEffect:ho,useMemo:ho,useReducer:ho,useRef:ho,useState:ho,useDebugValue:ho,useDeferredValue:ho,useTransition:ho,useSyncExternalStore:ho,useId:ho,useHostTransitionStatus:ho,useFormState:ho,useActionState:ho,useOptimistic:ho,useMemoCache:ho,useCacheRefresh:ho};Ms.useEffectEvent=ho;var Ns={readContext:Ki,use:Do,useCallback:function(e,t){return Co().memoizedState=[e,t===void 0?null:t],e},useContext:Ki,useEffect:rs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ts(4194308,4,ls.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ts(4194308,4,e,t)},useInsertionEffect:function(e,t){ts(4,2,e,t)},useMemo:function(e,t){var n=Co();t=t===void 0?null:t;var r=e();if(lo){Me(!0);try{e()}finally{Me(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Co();if(n!==void 0){var i=n(t);if(lo){Me(!0);try{n(t)}finally{Me(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ts.bind(null,io,e),[r.memoizedState,e]},useRef:function(e){var t=Co();return e={current:e},t.memoizedState=e},useState:function(e){e=zo(e);var t=e.queue,n=Es.bind(null,io,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ds,useDeferredValue:function(e,t){return ms(Co(),e,t)},useTransition:function(){var e=zo(!1);return e=gs.bind(null,io,e.queue,!0,!1),Co().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=io,a=Co();if(Ei){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Il===null)throw Error(i(349));Rl&127||Po(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,rs(Io.bind(null,r,o,e),[e]),r.flags|=2048,$o(9,{destroy:void 0},Fo.bind(null,r,o,n,t),null),n},useId:function(){var e=Co(),t=Il.identifierPrefix;if(Ei){var n=yi,r=vi;n=(r&~(1<<32-Ne(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=uo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=mo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:xs,useFormState:Jo,useActionState:Jo,useOptimistic:function(e){var t=Co();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Os.bind(null,io,!0,n),n.dispatch=t,[e,t]},useMemoCache:Oo,useCacheRefresh:function(){return Co().memoizedState=ws.bind(null,io)},useEffectEvent:function(e){var t=Co(),n={impl:e};return t.memoizedState=n,function(){if(Fl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Ps={readContext:Ki,use:Do,useCallback:fs,useContext:Ki,useEffect:is,useImperativeHandle:us,useInsertionEffect:ss,useLayoutEffect:cs,useMemo:ps,useReducer:Ao,useRef:es,useState:function(){return Ao(ko)},useDebugValue:ds,useDeferredValue:function(e,t){return hs(wo(),ao.memoizedState,e,t)},useTransition:function(){var e=Ao(ko)[0],t=wo().memoizedState;return[typeof e==`boolean`?e:Eo(e),t]},useSyncExternalStore:No,useId:Ss,useHostTransitionStatus:xs,useFormState:Yo,useActionState:Yo,useOptimistic:function(e,t){return Bo(wo(),ao,e,t)},useMemoCache:Oo,useCacheRefresh:Cs};Ps.useEffectEvent=os;var Fs={readContext:Ki,use:Do,useCallback:fs,useContext:Ki,useEffect:is,useImperativeHandle:us,useInsertionEffect:ss,useLayoutEffect:cs,useMemo:ps,useReducer:Mo,useRef:es,useState:function(){return Mo(ko)},useDebugValue:ds,useDeferredValue:function(e,t){var n=wo();return ao===null?ms(n,e,t):hs(n,ao.memoizedState,e,t)},useTransition:function(){var e=Mo(ko)[0],t=wo().memoizedState;return[typeof e==`boolean`?e:Eo(e),t]},useSyncExternalStore:No,useId:Ss,useHostTransitionStatus:xs,useFormState:Qo,useActionState:Qo,useOptimistic:function(e,t){var n=wo();return ao===null?(n.baseState=e,[e,n.queue.dispatch]):Bo(n,ao,e,t)},useMemoCache:Oo,useCacheRefresh:Cs};Fs.useEffectEvent=os;function Is(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:f({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ls={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=mu(),i=Pa(r);i.payload=t,n!=null&&(i.callback=n),t=Fa(e,i,r),t!==null&&(gu(t,e,r),Ia(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=mu(),i=Pa(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Fa(e,i,r),t!==null&&(gu(t,e,r),Ia(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=mu(),r=Pa(n);r.tag=2,t!=null&&(r.callback=t),t=Fa(e,r,n),t!==null&&(gu(t,e,n),Ia(t,e,n))}};function Rs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!gr(n,r)||!gr(i,a):!0}function zs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ls.enqueueReplaceState(t,t.state,null)}function Bs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=f({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Vs(e){Ur(e)}function Hs(e){console.error(e)}function Us(e){Ur(e)}function Ws(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Gs(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Ks(e,t,n){return n=Pa(n),n.tag=3,n.payload={element:null},n.callback=function(){Ws(e,t)},n}function qs(e){return e=Pa(e),e.tag=3,e}function Js(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Gs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Gs(t,n,r),typeof i!=`function`&&(iu===null?iu=new Set([this]):iu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Ys(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Ui(t,n,a,!0),n=Ja.current,n!==null){switch(n.tag){case 31:case 13:return Ya===null?Ou():n.alternate===null&&Gl===0&&(Gl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===ga?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),qu(e,r,a)),!1;case 22:return n.flags|=65536,r===ga?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),qu(e,r,a)),!1}throw Error(i(435,n.tag))}return qu(e,r,a),Ou(),!1}if(Ei)return t=Ja.current,t===null?(r!==ki&&(t=Error(i(423),{cause:r}),Fi(di(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=di(r,n),a=Ks(e.stateNode,r,a),La(e,a),Gl!==4&&(Gl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==ki&&(e=Error(i(422),{cause:r}),Fi(di(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=di(o,n),Zl===null?Zl=[o]:Zl.push(o),Gl!==4&&(Gl=2),t===null)return!0;r=di(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Ks(n.stateNode,r,e),La(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(iu===null||!iu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=qs(a),Js(a,e,n,r),La(n,a),!1}n=n.return}while(n!==null);return!1}var Xs=Error(i(461)),Zs=!1;function Qs(e,t,n,r){t.child=e===null?Aa(t,null,n,r):ka(t,e.child,n,r)}function $s(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Gi(t),r=_o(e,t,n,o,a,i),s=xo(),e!==null&&!Zs?(So(e,t,i),Cc(e,t,i)):(Ei&&s&&xi(t),t.flags|=1,Qs(e,t,r,i),t.child)}function ec(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ni(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,tc(e,t,a,r,i)):(e=ai(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!wc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?gr:n,n(o,r)&&e.ref===t.ref)return Cc(e,t,i)}return t.flags|=1,e=ri(a,r),e.ref=t.ref,e.return=t,t.child=e}function tc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(gr(a,r)&&e.ref===t.ref){if(Zs=!1,t.pendingProps=r=a,wc(e,i))e.flags&131072&&(Zs=!0);else return t.lanes=e.lanes,Cc(e,t,i)}}return lc(e,t,n,r,i)}function nc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return ic(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&da(t,a===null?null:a.cachePool),a===null?Ka():Ga(t,a),Qa(t);else return r=t.lanes=536870912,ic(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&da(t,null),Ka(),$a(t)):(da(t,a.cachePool),Ga(t,a),$a(t),t.memoizedState=null);return Qs(e,t,i,n),t.child}function rc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ic(e,t,n,r,i){var a=ua();return a=a===null?null:{parent:Qi._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&da(t,null),Ka(),Qa(t),e!==null&&Ui(e,t,r,!0),t.childLanes=i,null}function ac(e,t){return t=vc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function oc(e,t,n){return ka(t,e.child,null,n),e=ac(t,t.pendingProps),e.flags|=2,eo(t),t.memoizedState=null,e}function sc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(Ei){if(r.mode===`hidden`)return e=ac(t,r),t.lanes=536870912,rc(null,e);if(Za(t),(e=Ti)?(e=cf(e,Oi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_i===null?null:{id:vi,overflow:yi},retryLane:536870912,hydrationErrors:null},n=ci(e),n.return=t,t.child=n,wi=t,Ti=null)):e=null,e===null)throw Ai(t);return t.lanes=536870912,null}return ac(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Za(t),a){if(t.flags&256)t.flags&=-257,t=oc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Zs||Ui(e,t,n,!1),a=(n&e.childLanes)!==0,Zs||a){if(r=Il,r!==null&&(s=Xe(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Xr(e,s),gu(r,e,s),Xs;Ou(),t=oc(e,t,n)}else e=o.treeContext,Ti=ff(s.nextSibling),wi=t,Ei=!0,Di=null,Oi=!1,e!==null&&Ci(t,e),t=ac(t,r),t.flags|=4096;return t}return e=ri(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function cc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function lc(e,t,n,r,i){return Gi(t),n=_o(e,t,n,r,void 0,i),r=xo(),e!==null&&!Zs?(So(e,t,i),Cc(e,t,i)):(Ei&&r&&xi(t),t.flags|=1,Qs(e,t,n,i),t.child)}function uc(e,t,n,r,i,a){return Gi(t),t.updateQueue=null,n=yo(t,r,n,i),vo(e),r=xo(),e!==null&&!Zs?(So(e,t,a),Cc(e,t,a)):(Ei&&r&&xi(t),t.flags|=1,Qs(e,t,n,a),t.child)}function dc(e,t,n,r,i){if(Gi(t),t.stateNode===null){var a=$r,o=n.contextType;typeof o==`object`&&o&&(a=Ki(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ls,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ma(t),o=n.contextType,a.context=typeof o==`object`&&o?Ki(o):$r,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Is(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Ls.enqueueReplaceState(a,a.state,null),Ba(t,r,a,i),za(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Bs(n,s);a.props=c;var l=a.context,u=n.contextType;o=$r,typeof u==`object`&&u&&(o=Ki(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&zs(t,a,r,o),ja=!1;var f=t.memoizedState;a.state=f,Ba(t,r,a,i),za(),l=t.memoizedState,s||f!==l||ja?(typeof d==`function`&&(Is(t,n,d,r),l=t.memoizedState),(c=ja||Rs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Na(e,t),o=t.memoizedProps,u=Bs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=$r,typeof l==`object`&&l&&(c=Ki(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&zs(t,a,r,c),ja=!1,f=t.memoizedState,a.state=f,Ba(t,r,a,i),za();var p=t.memoizedState;o!==d||f!==p||ja||e!==null&&e.dependencies!==null&&Wi(e.dependencies)?(typeof s==`function`&&(Is(t,n,s,r),p=t.memoizedState),(u=ja||Rs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Wi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,cc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=ka(t,e.child,null,i),t.child=ka(t,null,n,i)):Qs(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Cc(e,t,i),e}function fc(e,t,n,r){return Ni(),t.flags|=256,Qs(e,t,n,r),t.child}var pc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function mc(e){return{baseLanes:e,cachePool:fa()}}function hc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Yl),e}function gc(e,t,n){var r=t.pendingProps,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(to.current&2)),s&&(a=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(Ei){if(a?Xa(t):$a(t),(e=Ti)?(e=cf(e,Oi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_i===null?null:{id:vi,overflow:yi},retryLane:536870912,hydrationErrors:null},n=ci(e),n.return=t,t.child=n,wi=t,Ti=null)):e=null,e===null)throw Ai(t);return uf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?($a(t),a=t.mode,c=vc({mode:`hidden`,children:c},a),r=oi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=mc(n),r.childLanes=hc(e,s,n),t.memoizedState=pc,rc(null,r)):(Xa(t),_c(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(Xa(t),t.flags&=-257,t=yc(e,t,n)):t.memoizedState===null?($a(t),c=r.fallback,a=t.mode,r=vc({mode:`visible`,children:r.children},a),c=oi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,ka(t,e.child,null,n),r=t.child,r.memoizedState=mc(n),r.childLanes=hc(e,s,n),t.memoizedState=pc,t=rc(null,r)):($a(t),t.child=e.child,t.flags|=128,t=null);else if(Xa(t),uf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Fi({value:r,source:null,stack:null}),t=yc(e,t,n)}else if(Zs||Ui(e,t,n,!1),s=(n&e.childLanes)!==0,Zs||s){if(s=Il,s!==null&&(r=Xe(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Xr(e,r),gu(s,e,r),Xs;lf(c)||Ou(),t=yc(e,t,n)}else lf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ti=ff(c.nextSibling),wi=t,Ei=!0,Di=null,Oi=!1,e!==null&&Ci(t,e),t=_c(t,r.children),t.flags|=4096);return t}return a?($a(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ri(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=oi(c,a,n,null),c.flags|=2):c=ri(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,rc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=mc(n):(a=c.cachePool,a===null?a=fa():(l=Qi._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=hc(e,s,n),t.memoizedState=pc,rc(e.child,r)):(Xa(t),n=e.child,e=n.sibling,n=ri(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function _c(e,t){return t=vc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function vc(e,t){return e=ti(22,e,null,t),e.lanes=0,e}function yc(e,t,n){return ka(t,e.child,null,n),e=_c(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function bc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Vi(e.return,t,n)}function xc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Sc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=to.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,ie(to,o),Qs(e,t,r,n),r=Ei?hi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&bc(e,n,t);else if(e.tag===19)bc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&no(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),xc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&no(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}xc(t,!0,n,null,a,r);break;case`together`:xc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Cc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Kl|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Ui(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ri(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ri(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function wc(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Wi(e)))}function Tc(e,t,n){switch(t.tag){case 3:ce(t,t.stateNode.containerInfo),zi(t,Qi,e.memoizedState.cache),Ni();break;case 27:case 5:ue(t);break;case 4:ce(t,t.stateNode.containerInfo);break;case 10:zi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Za(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Xa(t),e=Cc(e,t,n),e===null?null:e.sibling):gc(e,t,n):(Xa(t),t.flags|=128,null);Xa(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(Ui(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Sc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ie(to,to.current),r)break;return null;case 22:return t.lanes=0,nc(e,t,n,t.pendingProps);case 24:zi(t,Qi,e.memoizedState.cache)}return Cc(e,t,n)}function Ec(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Zs=!0;else{if(!wc(e,n)&&!(t.flags&128))return Zs=!1,Tc(e,t,n);Zs=!!(e.flags&131072)}}else Zs=!1,Ei&&t.flags&1048576&&q(t,hi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ya(t.elementType),t.type=e,typeof e==`function`)ni(e)?(r=Bs(e,r),t.tag=1,t=dc(null,t,e,r,n)):(t.tag=0,t=lc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=$s(null,t,e,r,n);break a}if(a===D){t.tag=14,t=ec(null,t,e,r,n);break a}}throw t=N(e)||e,Error(i(306,t,``))}}return t;case 0:return lc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Bs(r,t.pendingProps),dc(e,t,r,a,n);case 3:a:{if(ce(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Na(e,t),Ba(t,r,null,n);var s=t.memoizedState;if(r=s.cache,zi(t,Qi,r),r!==o.cache&&Hi(t,[Qi],n,!0),za(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=fc(e,t,r,n);break a}if(r!==a){a=di(Error(i(424)),t),Fi(a),t=fc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Ti=ff(e.firstChild),wi=t,Ei=!0,Di=null,Oi=!0,n=Aa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ni(),r===a){t=Cc(e,t,n);break a}Qs(e,t,r,n)}t=t.child}return t;case 26:return cc(e,t),e===null?(n=Nf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ei||(n=t.type,e=t.pendingProps,r=Wd(oe.current).createElement(n),r[nt]=t,r[rt]=e,Rd(r,n,e),ht(r),t.stateNode=r):t.memoizedState=Nf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ue(t),e===null&&Ei&&(r=t.stateNode=gf(t.type,t.pendingProps,oe.current),wi=t,Oi=!0,a=Ti,tf(t.type)?(pf=a,Ti=ff(r.firstChild)):Ti=a),Qs(e,t,t.pendingProps.children,n),cc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ei&&((a=r=Ti)&&(r=of(r,t.type,t.pendingProps,Oi),r===null?a=!1:(t.stateNode=r,wi=t,Ti=ff(r.firstChild),Oi=!1,a=!0)),a||Ai(t)),ue(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,qd(a,o)?r=null:s!==null&&qd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=_o(e,t,bo,null,null,n),np._currentValue=a),cc(e,t),Qs(e,t,r,n),t.child;case 6:return e===null&&Ei&&((e=n=Ti)&&(n=sf(n,t.pendingProps,Oi),n===null?e=!1:(t.stateNode=n,wi=t,Ti=null,e=!0)),e||Ai(t)),null;case 13:return gc(e,t,n);case 4:return ce(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ka(t,null,r,n):Qs(e,t,r,n),t.child;case 11:return $s(e,t,t.type,t.pendingProps,n);case 7:return Qs(e,t,t.pendingProps,n),t.child;case 8:return Qs(e,t,t.pendingProps.children,n),t.child;case 12:return Qs(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,zi(t,t.type,r.value),Qs(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Gi(t),a=Ki(a),r=r(a),t.flags|=1,Qs(e,t,r,n),t.child;case 14:return ec(e,t,t.type,t.pendingProps,n);case 15:return tc(e,t,t.type,t.pendingProps,n);case 19:return Sc(e,t,n);case 31:return sc(e,t,n);case 22:return nc(e,t,n,t.pendingProps);case 24:return Gi(t),r=Ki(Qi),e===null?(a=ua(),a===null&&(a=Il,o=$i(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Ma(t),zi(t,Qi,a)):((e.lanes&n)!==0&&(Na(e,t),Ba(t,null,null,n),za()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,zi(t,Qi,r),r!==a.cache&&Hi(t,[Qi],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),zi(t,Qi,r))),Qs(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Dc(e){e.flags|=4}function Oc(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Tu())e.flags|=8192;else throw ba=ga,ma}}else e.flags&=-16777217}function kc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Jf(t)){if(Tu())e.flags|=8192;else throw ba=ga,ma}}function Ac(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:We(),e.lanes|=t,Xl|=t)}function jc(e,t){if(!Ei)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Mc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Nc(e,t,n){var r=t.pendingProps;switch(Si(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mc(t),null;case 1:return Mc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Bi(Qi),le(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(J(t)?Dc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Pi())),Mc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Dc(t),o===null?(Mc(t),Oc(t,a,null,r,n)):(Mc(t),kc(t,o))):o?o===e.memoizedState?(Mc(t),t.flags&=-16777217):(Dc(t),Mc(t),kc(t,o)):(e=e.memoizedProps,e!==r&&Dc(t),Mc(t),Oc(t,a,e,r,n)),null;case 27:if(de(t),n=oe.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Dc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Mc(t),null}e=ae.current,J(t)?ji(t,e):(e=gf(a,r,n),t.stateNode=e,Dc(t))}return Mc(t),null;case 5:if(de(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Dc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Mc(t),null}if(o=ae.current,J(t))ji(t,o);else{var s=Wd(oe.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[nt]=t,o[rt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Rd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Dc(t)}}return Mc(t),Oc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Dc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=oe.current,J(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=wi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[nt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Fd(e.nodeValue,n)),e||Ai(t,!0)}else e=Wd(e).createTextNode(r),e[nt]=t,t.stateNode=e}return Mc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=J(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[nt]=t}else Ni(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Mc(t),e=!1}else n=Pi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(eo(t),t):(eo(t),null);if(t.flags&128)throw Error(i(558))}return Mc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=J(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[nt]=t}else Ni(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Mc(t),a=!1}else a=Pi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(eo(t),t):(eo(t),null)}return eo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Ac(t,t.updateQueue),Mc(t),null);case 4:return le(),e===null&&Td(t.stateNode.containerInfo),Mc(t),null;case 10:return Bi(t.type),Mc(t),null;case 19:if(re(to),r=t.memoizedState,r===null)return Mc(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)jc(r,!1);else{if(Gl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=no(e),o!==null){for(t.flags|=128,jc(r,!1),e=o.updateQueue,t.updateQueue=e,Ac(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ii(n,e),n=n.sibling;return ie(to,to.current&1|2),Ei&&bi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Se()>nu&&(t.flags|=128,a=!0,jc(r,!1),t.lanes=4194304)}}else{if(!a){if(e=no(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Ac(t,e),jc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Ei)return Mc(t),null}else 2*Se()-r.renderingStartTime>nu&&n!==536870912&&(t.flags|=128,a=!0,jc(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Mc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Se(),e.sibling=null,n=to.current,ie(to,a?n&1|2:n&1),Ei&&bi(t,r.treeForkCount),e);case 22:case 23:return eo(t),qa(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Mc(t),t.subtreeFlags&6&&(t.flags|=8192)):Mc(t),n=t.updateQueue,n!==null&&Ac(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&re(la),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Bi(Qi),Mc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Pc(e,t){switch(Si(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Bi(Qi),le(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return de(t),null;case 31:if(t.memoizedState!==null){if(eo(t),t.alternate===null)throw Error(i(340));Ni()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(eo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ni()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return re(to),null;case 4:return le(),null;case 10:return Bi(t.type),null;case 22:case 23:return eo(t),qa(),e!==null&&re(la),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Bi(Qi),null;case 25:return null;default:return null}}function Fc(e,t){switch(Si(t),t.tag){case 3:Bi(Qi),le();break;case 26:case 27:case 5:de(t);break;case 4:le();break;case 31:t.memoizedState!==null&&eo(t);break;case 13:eo(t);break;case 19:re(to);break;case 10:Bi(t.type);break;case 22:case 23:eo(t),qa(),e!==null&&re(la);break;case 24:Bi(Qi)}}function Ic(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Ku(t,t.return,e)}}function Lc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Ku(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Ku(t,t.return,e)}}function Rc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ha(t,n)}catch(t){Ku(e,e.return,t)}}}function zc(e,t,n){n.props=Bs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Ku(e,t,n)}}function Bc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Ku(e,t,n)}}function Vc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Ku(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Ku(e,t,n)}else n.current=null}}function Hc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Ku(e,e.return,t)}}function Uc(e,t,n){try{var r=e.stateNode;zd(r,e.type,n,t),r[rt]=t}catch(t){Ku(e,e.return,t)}}function Wc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&tf(e.type)||e.tag===4}function Gc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Wc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&tf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Kc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Yt));else if(r!==4&&(r===27&&tf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Kc(e,t,n),e=e.sibling;e!==null;)Kc(e,t,n),e=e.sibling}function qc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&tf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(qc(e,t,n),e=e.sibling;e!==null;)qc(e,t,n),e=e.sibling}function Jc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Rd(t,r,n),t[nt]=e,t[rt]=n}catch(t){Ku(e,e.return,t)}}var Yc=!1,Xc=!1,Zc=!1,Qc=typeof WeakSet==`function`?WeakSet:Set,$c=null;function el(e,t){if(e=e.containerInfo,Hd=dp,e=br(e),xr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Ud={focusedElem:e,selectionRange:n},dp=!1,$c=t;$c!==null;)if(t=$c,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,$c=e;else for(;$c!==null;){switch(t=$c,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Bs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Ku(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)af(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:af(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,$c=e;break}$c=t.return}}function tl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:gl(e,n),r&4&&Ic(5,n);break;case 1:if(gl(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Ku(n,n.return,e)}else{var i=Bs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Ku(n,n.return,e)}}}r&64&&Rc(n),r&512&&Bc(n,n.return);break;case 3:if(gl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Ha(e,t)}catch(e){Ku(n,n.return,e)}}break;case 27:t===null&&r&4&&Jc(n);case 26:case 5:gl(e,n),t===null&&r&4&&Hc(n),r&512&&Bc(n,n.return);break;case 12:gl(e,n);break;case 31:gl(e,n),r&4&&sl(e,n);break;case 13:gl(e,n),r&4&&cl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Xu.bind(null,n),df(e,n))));break;case 22:if(r=n.memoizedState!==null||Yc,!r){t=t!==null&&t.memoizedState!==null||Xc,i=Yc;var a=Xc;Yc=r,(Xc=t)&&!a?vl(e,n,!!(n.subtreeFlags&8772)):gl(e,n),Yc=i,Xc=a}break;case 30:break;default:gl(e,n)}}function nl(e){var t=e.alternate;t!==null&&(e.alternate=null,nl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ut(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var rl=null,il=!1;function al(e,t,n){for(n=n.child;n!==null;)ol(e,t,n),n=n.sibling}function ol(e,t,n){if(je&&typeof je.onCommitFiberUnmount==`function`)try{je.onCommitFiberUnmount(Ae,n)}catch{}switch(n.tag){case 26:Xc||Vc(n,t),al(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Xc||Vc(n,t);var r=rl,i=il;tf(n.type)&&(rl=n.stateNode,il=!1),al(e,t,n),_f(n.stateNode),rl=r,il=i;break;case 5:Xc||Vc(n,t);case 6:if(r=rl,i=il,rl=null,al(e,t,n),rl=r,il=i,rl!==null){if(il)try{(rl.nodeType===9?rl.body:rl.nodeName===`HTML`?rl.ownerDocument.body:rl).removeChild(n.stateNode)}catch(e){Ku(n,t,e)}else try{rl.removeChild(n.stateNode)}catch(e){Ku(n,t,e)}}break;case 18:rl!==null&&(il?(e=rl,nf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Ip(e)):nf(rl,n.stateNode));break;case 4:r=rl,i=il,rl=n.stateNode.containerInfo,il=!0,al(e,t,n),rl=r,il=i;break;case 0:case 11:case 14:case 15:Lc(2,n,t),Xc||Lc(4,n,t),al(e,t,n);break;case 1:Xc||(Vc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&zc(n,t,r)),al(e,t,n);break;case 21:al(e,t,n);break;case 22:Xc=(r=Xc)||n.memoizedState!==null,al(e,t,n),Xc=r;break;default:al(e,t,n)}}function sl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ip(e)}catch(e){Ku(t,t.return,e)}}}function cl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ip(e)}catch(e){Ku(t,t.return,e)}}function ll(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Qc),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Qc),t;default:throw Error(i(435,e.tag))}}function ul(e,t){var n=ll(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Zu.bind(null,e,t);t.then(r,r)}})}function dl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(tf(c.type)){rl=c.stateNode,il=!1;break a}break;case 5:rl=c.stateNode,il=!1;break a;case 3:case 4:rl=c.stateNode.containerInfo,il=!0;break a}c=c.return}if(rl===null)throw Error(i(160));ol(o,s,a),rl=null,il=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)pl(t,e),t=t.sibling}var fl=null;function pl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:dl(t,e),ml(e),r&4&&(Lc(3,e,e.return),Ic(3,e),Lc(5,e,e.return));break;case 1:dl(t,e),ml(e),r&512&&(Xc||n===null||Vc(n,n.return)),r&64&&Yc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=fl;if(dl(t,e),ml(e),r&512&&(Xc||n===null||Vc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null){if(r===null){if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[lt]||o[nt]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Rd(o,r,n),o[nt]=e,ht(o),r=o;break a;case`link`:var s=Gf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Rd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Gf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Rd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[nt]=e,ht(o),r=o}e.stateNode=r}else Kf(a,e.type,e.stateNode)}else e.stateNode=Bf(a,r,e.memoizedProps)}else o===r?r===null&&e.stateNode!==null&&Uc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Kf(a,e.type,e.stateNode):Bf(a,r,e.memoizedProps))}break;case 27:dl(t,e),ml(e),r&512&&(Xc||n===null||Vc(n,n.return)),n!==null&&r&4&&Uc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(dl(t,e),ml(e),r&512&&(Xc||n===null||Vc(n,n.return)),e.flags&32){a=e.stateNode;try{Vt(a,``)}catch(t){Ku(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Uc(e,a,n===null?a:n.memoizedProps)),r&1024&&(Zc=!0);break;case 6:if(dl(t,e),ml(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Ku(e,e.return,t)}}break;case 3:if(Wf=null,a=fl,fl=bf(t.containerInfo),dl(t,e),fl=a,ml(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Ip(t.containerInfo)}catch(t){Ku(e,e.return,t)}Zc&&(Zc=!1,hl(e));break;case 4:r=fl,fl=bf(e.stateNode.containerInfo),dl(t,e),ml(e),fl=r;break;case 12:dl(t,e),ml(e);break;case 31:dl(t,e),ml(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ul(e,r)));break;case 13:dl(t,e),ml(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(eu=Se()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ul(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Yc,d=Xc;if(Yc=u||a,Xc=d||l,dl(t,e),Xc=d,Yc=u,ml(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Yc||Xc||_l(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Ku(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Ku(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?rf(m,!0):rf(l.stateNode,!1)}catch(e){Ku(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,ul(e,n))));break;case 19:dl(t,e),ml(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ul(e,r)));break;case 30:break;case 21:break;default:dl(t,e),ml(e)}}function ml(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Wc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;qc(e,Gc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Vt(o,``),n.flags&=-33),qc(e,Gc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Kc(e,Gc(e),s);break;default:throw Error(i(161))}}catch(t){Ku(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function hl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;hl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function gl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)tl(e,t.alternate,t),t=t.sibling}function _l(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Lc(4,t,t.return),_l(t);break;case 1:Vc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&zc(t,t.return,n),_l(t);break;case 27:_f(t.stateNode);case 26:case 5:Vc(t,t.return),_l(t);break;case 22:t.memoizedState===null&&_l(t);break;case 30:_l(t);break;default:_l(t)}e=e.sibling}}function vl(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:vl(i,a,n),Ic(4,a);break;case 1:if(vl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Ku(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Va(c[i],s)}catch(e){Ku(r,r.return,e)}}n&&o&64&&Rc(a),Bc(a,a.return);break;case 27:Jc(a);case 26:case 5:vl(i,a,n),n&&r===null&&o&4&&Hc(a),Bc(a,a.return);break;case 12:vl(i,a,n);break;case 31:vl(i,a,n),n&&o&4&&sl(i,a);break;case 13:vl(i,a,n),n&&o&4&&cl(i,a);break;case 22:a.memoizedState===null&&vl(i,a,n),Bc(a,a.return);break;case 30:break;default:vl(i,a,n)}t=t.sibling}}function yl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ea(n))}function bl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ea(e))}function xl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Sl(e,t,n,r),t=t.sibling}function Sl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:xl(e,t,n,r),i&2048&&Ic(9,t);break;case 1:xl(e,t,n,r);break;case 3:xl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ea(e)));break;case 12:if(i&2048){xl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Ku(t,t.return,e)}}else xl(e,t,n,r);break;case 31:xl(e,t,n,r);break;case 13:xl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?xl(e,t,n,r):(a._visibility|=2,Cl(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?xl(e,t,n,r):wl(e,t),i&2048&&yl(o,t);break;case 24:xl(e,t,n,r),i&2048&&bl(t.alternate,t);break;default:xl(e,t,n,r)}}function Cl(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Cl(a,o,s,c,i),Ic(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Cl(a,o,s,c,i)):u._visibility&2?Cl(a,o,s,c,i):wl(a,o),i&&l&2048&&yl(o.alternate,o);break;case 24:Cl(a,o,s,c,i),i&&l&2048&&bl(o.alternate,o);break;default:Cl(a,o,s,c,i)}t=t.sibling}}function wl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:wl(n,r),i&2048&&yl(r.alternate,r);break;case 24:wl(n,r),i&2048&&bl(r.alternate,r);break;default:wl(n,r)}t=t.sibling}}var Tl=8192;function El(e,t,n){if(e.subtreeFlags&Tl)for(e=e.child;e!==null;)Dl(e,t,n),e=e.sibling}function Dl(e,t,n){switch(e.tag){case 26:El(e,t,n),e.flags&Tl&&e.memoizedState!==null&&Yf(n,fl,e.memoizedState,e.memoizedProps);break;case 5:El(e,t,n);break;case 3:case 4:var r=fl;fl=bf(e.stateNode.containerInfo),El(e,t,n),fl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Tl,Tl=16777216,El(e,t,n),Tl=r):El(e,t,n));break;default:El(e,t,n)}}function Ol(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function kl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];$c=r,Ml(r,e)}Ol(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Al(e),e=e.sibling}function Al(e){switch(e.tag){case 0:case 11:case 15:kl(e),e.flags&2048&&Lc(9,e,e.return);break;case 3:kl(e);break;case 12:kl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,jl(e)):kl(e);break;default:kl(e)}}function jl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];$c=r,Ml(r,e)}Ol(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Lc(8,t,t.return),jl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,jl(t));break;default:jl(t)}e=e.sibling}}function Ml(e,t){for(;$c!==null;){var n=$c;switch(n.tag){case 0:case 11:case 15:Lc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ea(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,$c=r;else a:for(n=e;$c!==null;){r=$c;var i=r.sibling,a=r.return;if(nl(r),r===n){$c=null;break a}if(i!==null){i.return=a,$c=i;break a}$c=a}}}var Nl={getCacheForType:function(e){var t=Ki(Qi),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ki(Qi).controller.signal}},Pl=typeof WeakMap==`function`?WeakMap:Map,Fl=0,Il=null,Ll=null,Rl=0,zl=0,Bl=null,Vl=!1,Hl=!1,Ul=!1,Wl=0,Gl=0,Kl=0,ql=0,Jl=0,Yl=0,Xl=0,Zl=null,Ql=null,$l=!1,eu=0,tu=0,nu=1/0,ru=null,iu=null,au=0,ou=null,su=null,cu=0,lu=0,uu=null,du=null,fu=0,pu=null;function mu(){return Fl&2&&Rl!==0?Rl&-Rl:F.T===null?$e():pd()}function hu(){if(Yl===0){if(!(Rl&536870912)||Ei){var e=Re;Re<<=1,!(Re&3932160)&&(Re=262144),Yl=e}else Yl=536870912}return e=Ja.current,e!==null&&(e.flags|=32),Yl}function gu(e,t,n){(e===Il&&(zl===2||zl===9)||e.cancelPendingCommit!==null)&&(Cu(e,0),bu(e,Rl,Yl,!1)),Ke(e,n),(!(Fl&2)||e!==Il)&&(e===Il&&(!(Fl&2)&&(ql|=n),Gl===4&&bu(e,Rl,Yl,!1)),ad(e))}function _u(e,t,n){if(Fl&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||He(e,t),a=r?ju(e,t):ku(e,t,!0),o=r;do{if(a===0){Hl&&!r&&bu(e,t,0,!1);break}if(n=e.current.alternate,o&&!yu(n)){a=ku(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=Zl;var l=c.current.memoizedState.isDehydrated;if(l&&(Cu(c,s).flags|=256),s=ku(c,s,!1),s!==2){if(Ul&&!l){c.errorRecoveryDisabledLanes|=o,ql|=o,a=4;break a}o=Ql,Ql=a,o!==null&&(Ql===null?Ql=o:Ql.push.apply(Ql,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Cu(e,0),bu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:bu(r,t,Yl,!Vl);break a;case 2:Ql=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=eu+300-Se(),10<a)){if(bu(r,t,Yl,!Vl),Ve(r,0,!0)!==0)break a;cu=t,r.timeoutHandle=Xd(vu.bind(null,r,n,Ql,ru,$l,t,Yl,ql,Xl,Vl,o,`Throttled`,-0,0),a);break a}vu(r,n,Ql,ru,$l,t,Yl,ql,Xl,Vl,o,null,-0,0)}break}while(1);ad(e)}function vu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Yt},Dl(t,a,d);var m=(a&62914560)===a?eu-Se():(a&4194048)===a?tu-Se():0;if(m=Zf(d,m),m!==null){cu=a,e.cancelPendingCommit=m(Ru.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),bu(e,a,o,!l);return}}Ru(e,t,a,n,r,i,o,s,c)}function yu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!hr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function bu(e,t,n,r){t&=~Jl,t&=~ql,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ne(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Je(e,n,t)}function xu(){return Fl&6?!0:(od(0,!1),!1)}function Su(){if(Ll!==null){if(zl===0)var e=Ll.return;else e=Ll,Ri=Li=null,Y(e),Ca=null,wa=0,e=Ll;for(;e!==null;)Fc(e.alternate,e),e=e.return;Ll=null}}function Cu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Zd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),cu=0,Su(),Il=e,Ll=n=ri(e.current,null),Rl=t,zl=0,Bl=null,Vl=!1,Hl=He(e,t),Ul=!1,Xl=Yl=Jl=ql=Kl=Gl=0,Ql=Zl=null,$l=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Ne(r),a=1<<i;t|=e[i],r&=~a}return Wl=t,qr(),n}function wu(e,t){io=null,F.H=Ms,t===pa||t===ha?(t=xa(),zl=3):t===ma?(t=xa(),zl=4):zl=t===Xs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Bl=t,Ll===null&&(Gl=1,Ws(e,di(t,e.current)))}function Tu(){var e=Ja.current;return e===null?!0:(Rl&4194048)===Rl?Ya===null:(Rl&62914560)===Rl||Rl&536870912?e===Ya:!1}function Eu(){var e=F.H;return F.H=Ms,e===null?Ms:e}function Du(){var e=F.A;return F.A=Nl,e}function Ou(){Gl=4,Vl||(Rl&4194048)!==Rl&&Ja.current!==null||(Hl=!0),!(Kl&134217727)&&!(ql&134217727)||Il===null||bu(Il,Rl,Yl,!1)}function ku(e,t,n){var r=Fl;Fl|=2;var i=Eu(),a=Du();(Il!==e||Rl!==t)&&(ru=null,Cu(e,t)),t=!1;var o=Gl;a:do try{if(zl!==0&&Ll!==null){var s=Ll,c=Bl;switch(zl){case 8:Su(),o=6;break a;case 3:case 2:case 9:case 6:Ja.current===null&&(t=!0);var l=zl;if(zl=0,Bl=null,Fu(e,s,c,l),n&&Hl){o=0;break a}break;default:l=zl,zl=0,Bl=null,Fu(e,s,c,l)}}Au(),o=Gl;break}catch(t){wu(e,t)}while(1);return t&&e.shellSuspendCounter++,Ri=Li=null,Fl=r,F.H=i,F.A=a,Ll===null&&(Il=null,Rl=0,qr()),o}function Au(){for(;Ll!==null;)Nu(Ll)}function ju(e,t){var n=Fl;Fl|=2;var r=Eu(),a=Du();Il!==e||Rl!==t?(ru=null,nu=Se()+500,Cu(e,t)):Hl=He(e,t);a:do try{if(zl!==0&&Ll!==null){t=Ll;var o=Bl;b:switch(zl){case 1:zl=0,Bl=null,Fu(e,t,o,1);break;case 2:case 9:if(_a(o)){zl=0,Bl=null,Pu(t);break}t=function(){zl!==2&&zl!==9||Il!==e||(zl=7),ad(e)},o.then(t,t);break a;case 3:zl=7;break a;case 4:zl=5;break a;case 7:_a(o)?(zl=0,Bl=null,Pu(t)):(zl=0,Bl=null,Fu(e,t,o,7));break;case 5:var s=null;switch(Ll.tag){case 26:s=Ll.memoizedState;case 5:case 27:var c=Ll;if(s?Jf(s):c.stateNode.complete){zl=0,Bl=null;var l=c.sibling;if(l!==null)Ll=l;else{var u=c.return;u===null?Ll=null:(Ll=u,Iu(u))}break b}}zl=0,Bl=null,Fu(e,t,o,5);break;case 6:zl=0,Bl=null,Fu(e,t,o,6);break;case 8:Su(),Gl=6;break a;default:throw Error(i(462))}}Mu();break}catch(t){wu(e,t)}while(1);return Ri=Li=null,F.H=r,F.A=a,Fl=n,Ll===null?(Il=null,Rl=0,qr(),Gl):0}function Mu(){for(;Ll!==null&&!be();)Nu(Ll)}function Nu(e){var t=Ec(e.alternate,e,Wl);e.memoizedProps=e.pendingProps,t===null?Iu(e):Ll=t}function Pu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=uc(n,t,t.pendingProps,t.type,void 0,Rl);break;case 11:t=uc(n,t,t.pendingProps,t.type.render,t.ref,Rl);break;case 5:Y(t);default:Fc(n,t),t=Ll=ii(t,Wl),t=Ec(n,t,Wl)}e.memoizedProps=e.pendingProps,t===null?Iu(e):Ll=t}function Fu(e,t,n,r){Ri=Li=null,Y(t),Ca=null,wa=0;var i=t.return;try{if(Ys(e,i,t,n,Rl)){Gl=1,Ws(e,di(n,e.current)),Ll=null;return}}catch(t){if(i!==null)throw Ll=i,t;Gl=1,Ws(e,di(n,e.current)),Ll=null;return}t.flags&32768?(Ei||r===1?e=!0:Hl||Rl&536870912?e=!1:(Vl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Ja.current,r!==null&&r.tag===13&&(r.flags|=16384))),Lu(t,e)):Iu(t)}function Iu(e){var t=e;do{if(t.flags&32768){Lu(t,Vl);return}e=t.return;var n=Nc(t.alternate,t,Wl);if(n!==null){Ll=n;return}if(t=t.sibling,t!==null){Ll=t;return}Ll=t=e}while(t!==null);Gl===0&&(Gl=5)}function Lu(e,t){do{var n=Pc(e.alternate,e);if(n!==null){n.flags&=32767,Ll=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ll=e;return}Ll=e=n}while(e!==null);Gl=6,Ll=null}function Ru(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Uu();while(au!==0);if(Fl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Kr,qe(e,n,o,s,c,l),e===Il&&(Ll=Il=null,Rl=0),su=t,ou=e,cu=n,lu=o,uu=a,du=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Qu(H,function(){return Wu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=F.T,F.T=null,a=I.p,I.p=2,s=Fl,Fl|=4;try{el(e,t,n)}finally{Fl=s,I.p=a,F.T=r}}au=1,zu(),Bu(),Vu()}}function zu(){if(au===1){au=0;var e=ou,t=su,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=F.T,F.T=null;var r=I.p;I.p=2;var i=Fl;Fl|=4;try{pl(t,e);var a=Ud,o=br(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&yr(s.ownerDocument.documentElement,s)){if(c!==null&&xr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=vr(s,h),v=vr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}dp=!!Hd,Ud=Hd=null}finally{Fl=i,I.p=r,F.T=n}}e.current=t,au=2}}function Bu(){if(au===2){au=0;var e=ou,t=su,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=F.T,F.T=null;var r=I.p;I.p=2;var i=Fl;Fl|=4;try{tl(e,t.alternate,t)}finally{Fl=i,I.p=r,F.T=n}}au=3}}function Vu(){if(au===4||au===3){au=0,xe();var e=ou,t=su,n=cu,r=du;t.subtreeFlags&10256||t.flags&10256?au=5:(au=0,su=ou=null,Hu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(iu=null),Qe(n),t=t.stateNode,je&&typeof je.onCommitFiberRoot==`function`)try{je.onCommitFiberRoot(Ae,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=F.T,i=I.p,I.p=2,F.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{F.T=t,I.p=i}}cu&3&&Uu(),ad(e),i=e.pendingLanes,n&261930&&i&42?e===pu?fu++:(fu=0,pu=e):fu=0,od(0,!1)}}function Hu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ea(t)))}function Uu(){return zu(),Bu(),Vu(),Wu()}function Wu(){if(au!==5)return!1;var e=ou,t=lu;lu=0;var n=Qe(cu),r=F.T,a=I.p;try{I.p=32>n?32:n,F.T=null,n=uu,uu=null;var o=ou,s=cu;if(au=0,su=ou=null,cu=0,Fl&6)throw Error(i(331));var c=Fl;if(Fl|=4,Al(o.current),Sl(o,o.current,s,n),Fl=c,od(0,!1),je&&typeof je.onPostCommitFiberRoot==`function`)try{je.onPostCommitFiberRoot(Ae,o)}catch{}return!0}finally{I.p=a,F.T=r,Hu(e,t)}}function Gu(e,t,n){t=di(n,t),t=Ks(e.stateNode,t,2),e=Fa(e,t,2),e!==null&&(Ke(e,2),ad(e))}function Ku(e,t,n){if(e.tag===3)Gu(e,e,n);else for(;t!==null;){if(t.tag===3){Gu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(iu===null||!iu.has(r))){e=di(n,e),n=qs(2),r=Fa(t,n,2),r!==null&&(Js(n,r,t,e),Ke(r,2),ad(r));break}}t=t.return}}function qu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Pl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Ul=!0,i.add(n),e=Ju.bind(null,e,t,n),t.then(e,e))}function Ju(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Il===e&&(Rl&n)===n&&(Gl===4||Gl===3&&(Rl&62914560)===Rl&&300>Se()-eu?!(Fl&2)&&Cu(e,0):Jl|=n,Xl===Rl&&(Xl=0)),ad(e)}function Yu(e,t){t===0&&(t=We()),e=Xr(e,t),e!==null&&(Ke(e,t),ad(e))}function Xu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Yu(e,n)}function Zu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Yu(e,n)}function Qu(e,t){return ve(e,t)}var $u=null,ed=null,td=!1,nd=!1,rd=!1,id=0;function ad(e){e!==ed&&e.next===null&&(ed===null?$u=ed=e:ed=ed.next=e),nd=!0,td||(td=!0,fd())}function od(e,t){if(!rd&&nd){rd=!0;do for(var n=!1,r=$u;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ne(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,dd(r,a))}else a=Rl,a=Ve(r,r===Il?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||He(r,a)||(n=!0,dd(r,a))}r=r.next}while(n);rd=!1}}function sd(){cd()}function cd(){nd=td=!1;var e=0;id!==0&&Yd()&&(e=id);for(var t=Se(),n=null,r=$u;r!==null;){var i=r.next,a=ld(r,t);a===0?(r.next=null,n===null?$u=i:n.next=i,i===null&&(ed=n)):(n=r,(e!==0||a&3)&&(nd=!0)),r=i}au!==0&&au!==5||od(e,!1),id!==0&&(id=0)}function ld(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ne(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ue(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Il,n=Rl,n=Ve(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(zl===2||zl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&ye(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||He(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&ye(r),Qe(n)){case 2:case 8:n=Te;break;case 32:n=H;break;case 268435456:n=De;break;default:n=H}return r=ud.bind(null,e),n=ve(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&ye(r),e.callbackPriority=2,e.callbackNode=null,2}function ud(e,t){if(au!==0&&au!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Uu()&&e.callbackNode!==n)return null;var r=Rl;return r=Ve(e,e===Il?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(_u(e,r,t),ld(e,Se()),e.callbackNode!=null&&e.callbackNode===n?ud.bind(null,e):null)}function dd(e,t){if(Uu())return null;_u(e,t,!0)}function fd(){$d(function(){Fl&6?ve(we,sd):cd()})}function pd(){if(id===0){var e=ra;e===0&&(e=Le,Le<<=1,!(Le&261888)&&(Le=256)),id=e}return id}function md(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Jt(``+e)}function hd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function gd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=md((i[rt]||null).action),o=r.submitter;o&&(t=(t=o[rt]||null)?md(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new _n(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(id!==0){var e=o?hd(i,o):new FormData(i);vs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?hd(i,o):new FormData(i),vs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var _d=0;_d<Vr.length;_d++){var vd=Vr[_d];Hr(vd.toLowerCase(),`on`+(vd[0].toUpperCase()+vd.slice(1)))}Hr(Nr,`onAnimationEnd`),Hr(Pr,`onAnimationIteration`),Hr(Fr,`onAnimationStart`),Hr(`dblclick`,`onDoubleClick`),Hr(`focusin`,`onFocus`),Hr(`focusout`,`onBlur`),Hr(Ir,`onTransitionRun`),Hr(Lr,`onTransitionStart`),Hr(Rr,`onTransitionCancel`),Hr(zr,`onTransitionEnd`),yt(`onMouseEnter`,[`mouseout`,`mouseover`]),yt(`onMouseLeave`,[`mouseout`,`mouseover`]),yt(`onPointerEnter`,[`pointerout`,`pointerover`]),yt(`onPointerLeave`,[`pointerout`,`pointerover`]),vt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),vt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),vt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),vt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),vt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),vt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var yd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),bd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(yd));function xd(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Ur(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Ur(e)}i.currentTarget=null,a=c}}}}function Sd(e,t){var n=t[at];n===void 0&&(n=t[at]=new Set);var r=e+`__bubble`;n.has(r)||(Ed(t,e,2,!1),n.add(r))}function Cd(e,t,n){var r=0;t&&(r|=4),Ed(n,e,r,t)}var wd=`_reactListening`+Math.random().toString(36).slice(2);function Td(e){if(!e[wd]){e[wd]=!0,gt.forEach(function(t){t!==`selectionchange`&&(bd.has(t)||Cd(t,!1,e),Cd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[wd]||(t[wd]=!0,Cd(`selectionchange`,!1,t))}}function Ed(e,t,n,r){switch(vp(t)){case 2:var i=fp;break;case 8:i=pp;break;default:i=mp}n=i.bind(null,t,n,e),i=void 0,!on||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Dd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=dt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}nn(function(){var r=a,i=Zt(n),s=[];a:{var c=Br.get(e);if(c!==void 0){var l=_n,u=e;switch(e){case`keypress`:if(fn(n)===0)break a;case`keydown`:case`keyup`:l=Mn;break;case`focusin`:u=`focus`,l=G;break;case`focusout`:u=`blur`,l=G;break;case`beforeblur`:case`afterblur`:l=G;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Sn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Cn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Pn;break;case Nr:case Pr:case Fr:l=wn;break;case zr:l=Fn;break;case`scroll`:case`scrollend`:l=vn;break;case`wheel`:l=In;break;case`copy`:case`cut`:case`paste`:l=Tn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Nn;break;case`toggle`:case`beforetoggle`:l=Ln}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=rn(m,p),g!=null&&d.push(Od(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==Xt&&(u=n.relatedTarget||n.fromElement)&&(dt(u)||u[it]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?dt(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=Sn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Nn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:pt(l),h=u==null?c:pt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,dt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Ad,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&jd(s,c,l,d,!1),u!==null&&f!==null&&jd(s,f,u,d,!0)}}a:{if(c=r?pt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=rr;else if(Zn(c)){if(ir)v=pr;else{v=dr;var y=ur}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Gt(r.elementType)&&(v=rr):v=fr;if(v&&=v(e,r)){Qn(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Lt(c,`number`,c.value)}switch(y=r?pt(r):window,e){case`focusin`:(Zn(y)||y.contentEditable===`true`)&&(Cr=y,wr=r,Tr=null);break;case`focusout`:Tr=wr=Cr=null;break;case`mousedown`:Er=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Er=!1,Dr(s,n,i);break;case`selectionchange`:if(Sr)break;case`keydown`:case`keyup`:Dr(s,n,i)}var b;if(zn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else qn?Gn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Hn&&n.locale!==`ko`&&(qn||x!==`onCompositionStart`?x===`onCompositionEnd`&&qn&&(b=dn()):(cn=i,ln=`value`in cn?cn.value:cn.textContent,qn=!0)),y=kd(r,x),0<y.length&&(x=new En(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Kn(n),b!==null&&(x.data=b)))),(b=Vn?Jn(e,n):Yn(e,n))&&(x=kd(r,`onBeforeInput`),0<x.length&&(y=new En(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),gd(s,e,r,n,i)}xd(s,t)})}function Od(e,t,n){return{instance:e,listener:t,currentTarget:n}}function kd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=rn(e,n),i!=null&&r.unshift(Od(e,i,a)),i=rn(e,t),i!=null&&r.push(Od(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ad(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function jd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=rn(n,a),l!=null&&o.unshift(Od(n,l,c))):i||(l=rn(n,a),l!=null&&o.push(Od(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Md=/\r\n?/g,Nd=/\u0000|\uFFFD/g;function Pd(e){return(typeof e==`string`?e:``+e).replace(Md,`
|
|
9
|
+
`).replace(Nd,``)}function Fd(e,t){return t=Pd(t),Pd(e)===t}function Id(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Vt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Vt(e,``+r);break;case`className`:Tt(e,`class`,r);break;case`tabIndex`:Tt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Tt(e,n,r);break;case`style`:Wt(e,r,o);break;case`data`:if(t!==`object`){Tt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Jt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&Id(e,t,`name`,a.name,a,null),Id(e,t,`formEncType`,a.formEncType,a,null),Id(e,t,`formMethod`,a.formMethod,a,null),Id(e,t,`formTarget`,a.formTarget,a,null)):(Id(e,t,`encType`,a.encType,a,null),Id(e,t,`method`,a.method,a,null),Id(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Jt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`onScroll`:r!=null&&Sd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Sd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Jt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Sd(`beforetoggle`,e),Sd(`toggle`,e),wt(e,`popover`,r);break;case`xlinkActuate`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Et(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Et(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Et(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:wt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Kt.get(n)||n,wt(e,n,r))}}function Ld(e,t,n,r,a,o){switch(n){case`style`:Wt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Vt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Vt(e,``+r);break;case`onScroll`:r!=null&&Sd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Sd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!_t.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[rt]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):wt(e,n,r)}}}function Rd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Sd(`error`,e),Sd(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Id(e,t,o,s,n,null)}}a&&Id(e,t,`srcSet`,n.srcSet,n,null),r&&Id(e,t,`src`,n.src,n,null);return;case`input`:Sd(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Id(e,t,r,d,n,null)}}It(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Sd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Id(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Rt(e,!!r,n,!0):Rt(e,!!r,t,!1);return;case`textarea`:for(s in Sd(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Id(e,t,s,c,n,null)}Bt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Id(e,t,l,r,n,null)}return;case`dialog`:Sd(`beforetoggle`,e),Sd(`toggle`,e),Sd(`cancel`,e),Sd(`close`,e);break;case`iframe`:case`object`:Sd(`load`,e);break;case`video`:case`audio`:for(r=0;r<yd.length;r++)Sd(yd[r],e);break;case`image`:Sd(`error`,e),Sd(`load`,e);break;case`details`:Sd(`toggle`,e);break;case`embed`:case`source`:case`link`:Sd(`error`,e),Sd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Id(e,t,u,r,n,null)}return;default:if(Gt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Ld(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Id(e,t,c,r,n,null))}function zd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Id(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Id(e,t,p,m,r,f)}}Ft(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Id(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Id(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Rt(e,!!n,n?[]:``,!1):Rt(e,!!n,t,!0)):Rt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Id(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Id(e,t,s,a,r,o)}zt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Id(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Id(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Id(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Id(e,t,u,p,r,m)}return;default:if(Gt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Ld(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Ld(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Id(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Id(e,t,f,p,r,m)}function Bd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Vd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Bd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Bd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Hd=null,Ud=null;function Wd(e){return e.nodeType===9?e:e.ownerDocument}function Gd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Kd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function qd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Jd=null;function Yd(){var e=window.event;return e&&e.type===`popstate`?e!==Jd&&(Jd=e,!0):(Jd=null,!1)}var Xd=typeof setTimeout==`function`?setTimeout:void 0,Zd=typeof clearTimeout==`function`?clearTimeout:void 0,Qd=typeof Promise==`function`?Promise:void 0,$d=typeof queueMicrotask==`function`?queueMicrotask:Qd===void 0?Xd:function(e){return Qd.resolve(null).then(e).catch(ef)};function ef(e){setTimeout(function(){throw e})}function tf(e){return e===`head`}function nf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Ip(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_f(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_f(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[lt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_f(e.ownerDocument.body)}n=i}while(n);Ip(t)}function rf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function af(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:af(n),ut(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function of(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[lt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=ff(e.nextSibling),e===null)break}return null}function sf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=ff(e.nextSibling),e===null))return null;return e}function cf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=ff(e.nextSibling),e===null))return null;return e}function lf(e){return e.data===`$?`||e.data===`$~`}function uf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function df(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function ff(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var pf=null;function mf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return ff(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function hf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function gf(e,t,n){switch(t=Wd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function _f(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ut(e)}var vf=new Map,yf=new Set;function bf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var xf=I.d;I.d={f:Sf,r:Cf,D:Ef,C:Df,L:Of,m:kf,X:jf,S:Af,M:Mf};function Sf(){var e=xf.f(),t=xu();return e||t}function Cf(e){var t=ft(e);t!==null&&t.tag===5&&t.type===`form`?bs(t):xf.r(e)}var wf=typeof document>`u`?null:document;function Tf(e,t,n){var r=wf;if(r&&typeof t==`string`&&t){var i=Pt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),yf.has(i)||(yf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Rd(t,`link`,e),ht(t),r.head.appendChild(t)))}}function Ef(e){xf.D(e),Tf(`dns-prefetch`,e,null)}function Df(e,t){xf.C(e,t),Tf(`preconnect`,e,t)}function Of(e,t,n){xf.L(e,t,n);var r=wf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Pt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Pt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Pt(n.imageSizes)+`"]`)):i+=`[href="`+Pt(e)+`"]`;var a=i;switch(t){case`style`:a=Pf(e);break;case`script`:a=Rf(e)}vf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Ff(a))||t===`script`&&r.querySelector(zf(a))||(t=r.createElement(`link`),Rd(t,`link`,e),ht(t),r.head.appendChild(t)))}}function kf(e,t){xf.m(e,t);var n=wf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Pt(r)+`"][href="`+Pt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rf(e)}if(!vf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),vf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zf(a)))return}r=n.createElement(`link`),Rd(r,`link`,e),ht(r),n.head.appendChild(r)}}}function Af(e,t,n){xf.S(e,t,n);var r=wf;if(r&&e){var i=mt(r).hoistableStyles,a=Pf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Ff(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vf.get(a))&&Hf(e,n);var c=o=r.createElement(`link`);ht(c),Rd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jf(e,t){xf.X(e,t);var n=wf;if(n&&e){var r=mt(n).hoistableScripts,i=Rf(e),a=r.get(i);a||(a=n.querySelector(zf(i)),a||(e=f({src:e,async:!0},t),(t=vf.get(i))&&Uf(e,t),a=n.createElement(`script`),ht(a),Rd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mf(e,t){xf.M(e,t);var n=wf;if(n&&e){var r=mt(n).hoistableScripts,i=Rf(e),a=r.get(i);a||(a=n.querySelector(zf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=vf.get(i))&&Uf(e,t),a=n.createElement(`script`),ht(a),Rd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nf(e,t,n,r){var a=(a=oe.current)?bf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Pf(n.href),n=mt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pf(n.href);var o=mt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Ff(e)))&&!o._p&&(s.instance=o,s.state.loading=5),vf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vf.set(e,n),o||Lf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Rf(n),n=mt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Pf(e){return`href="`+Pt(e)+`"`}function Ff(e){return`link[rel="stylesheet"][`+e+`]`}function If(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Lf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Rd(t,`link`,n),ht(t),e.head.appendChild(t))}function Rf(e){return`[src="`+Pt(e)+`"]`}function zf(e){return`script[async]`+e}function Bf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Pt(n.href)+`"]`);if(r)return t.instance=r,ht(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),ht(r),Rd(r,`style`,a),Vf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Pf(n.href);var o=e.querySelector(Ff(a));if(o)return t.state.loading|=4,t.instance=o,ht(o),o;r=If(n),(a=vf.get(a))&&Hf(r,a),o=(e.ownerDocument||e).createElement(`link`),ht(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Rd(o,`link`,r),t.state.loading|=4,Vf(o,n.precedence,e),t.instance=o;case`script`:return o=Rf(n.src),(a=e.querySelector(zf(o)))?(t.instance=a,ht(a),a):(r=n,(a=vf.get(o))&&(r=f({},n),Uf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),ht(a),Rd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vf(r,n.precedence,e));return t.instance}function Vf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Hf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Uf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Wf=null;function Gf(e,t,n){if(Wf===null){var r=new Map,i=Wf=new Map;i.set(n,r)}else i=Wf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[lt]||a[nt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Kf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Yf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pf(r.href),a=t.querySelector(Ff(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Qf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,ht(a);return}a=t.ownerDocument||t,r=If(r),(i=vf.get(i))&&Hf(r,i),a=a.createElement(`link`),ht(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Rd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Qf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Xf=0;function Zf(e,t){return e.stylesheets&&e.count===0&&ep(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ep(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Xf===0&&(Xf=62500*Vd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ep(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Xf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Qf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ep(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var $f=null;function ep(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,$f=new Map,t.forEach(tp,e),$f=null,Qf.call(e))}function tp(e,t){if(!(t.state.loading&4)){var n=$f.get(e);if(n)var r=n.get(null);else{n=new Map,$f.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Qf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var np={$$typeof:C,Provider:null,Consumer:null,_currentValue:L,_currentValue2:L,_threadCount:0};function rp(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ge(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ge(0),this.hiddenUpdates=Ge(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ip(e,t,n,r,i,a,o,s,c,l,u,d){return e=new rp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ti(3,null,null,t),e.current=a,a.stateNode=e,t=$i(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ma(a),e}function ap(e){return e?(e=$r,e):$r}function op(e,t,n,r,i,a){i=ap(i),r.context===null?r.context=i:r.pendingContext=i,r=Pa(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Fa(e,r,t),n!==null&&(gu(n,e,t),Ia(n,e,t))}function sp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function cp(e,t){sp(e,t),(e=e.alternate)&&sp(e,t)}function lp(e){if(e.tag===13||e.tag===31){var t=Xr(e,67108864);t!==null&&gu(t,e,67108864),cp(e,67108864)}}function up(e){if(e.tag===13||e.tag===31){var t=mu();t=Ze(t);var n=Xr(e,t);n!==null&&gu(n,e,t),cp(e,t)}}var dp=!0;function fp(e,t,n,r){var i=F.T;F.T=null;var a=I.p;try{I.p=2,mp(e,t,n,r)}finally{I.p=a,F.T=i}}function pp(e,t,n,r){var i=F.T;F.T=null;var a=I.p;try{I.p=8,mp(e,t,n,r)}finally{I.p=a,F.T=i}}function mp(e,t,n,r){if(dp){var i=hp(r);if(i===null)Dd(e,t,r,gp,n),Ep(e,r);else if(Op(i,e,t,n,r))r.stopPropagation();else if(Ep(e,r),t&4&&-1<Tp.indexOf(e)){for(;i!==null;){var a=ft(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Be(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ne(o);s.entanglements[1]|=c,o&=~c}ad(a),!(Fl&6)&&(nu=Se()+500,od(0,!1))}}break;case 31:case 13:s=Xr(a,2),s!==null&&gu(s,a,2),xu(),cp(a,2)}if(a=hp(r),a===null&&Dd(e,t,r,gp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Dd(e,t,r,null,n)}}function hp(e){return e=Zt(e),_p(e)}var gp=null;function _p(e){if(gp=null,e=dt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return gp=e,null}function vp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Ce()){case we:return 2;case Te:return 8;case H:case Ee:return 32;case De:return 268435456;default:return 32}default:return 32}}var yp=!1,bp=null,xp=null,Sp=null,Cp=new Map,X=new Map,wp=[],Tp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Ep(e,t){switch(e){case`focusin`:case`focusout`:bp=null;break;case`dragenter`:case`dragleave`:xp=null;break;case`mouseover`:case`mouseout`:Sp=null;break;case`pointerover`:case`pointerout`:Cp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:X.delete(t.pointerId)}}function Dp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=ft(t),t!==null&&lp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Op(e,t,n,r,i){switch(t){case`focusin`:return bp=Dp(bp,e,t,n,r,i),!0;case`dragenter`:return xp=Dp(xp,e,t,n,r,i),!0;case`mouseover`:return Sp=Dp(Sp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Cp.set(a,Dp(Cp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,X.set(a,Dp(X.get(a)||null,e,t,n,r,i)),!0}return!1}function kp(e){var t=dt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,et(e.priority,function(){up(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,et(e.priority,function(){up(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ap(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=hp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Xt=r,n.target.dispatchEvent(r),Xt=null}else return t=ft(n),t!==null&&lp(t),e.blockedOn=n,!1;t.shift()}return!0}function jp(e,t,n){Ap(e)&&n.delete(t)}function Mp(){yp=!1,bp!==null&&Ap(bp)&&(bp=null),xp!==null&&Ap(xp)&&(xp=null),Sp!==null&&Ap(Sp)&&(Sp=null),Cp.forEach(jp),X.forEach(jp)}function Np(e,n){e.blockedOn===n&&(e.blockedOn=null,yp||(yp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Mp)))}var Pp=null;function Fp(e){Pp!==e&&(Pp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Pp===e&&(Pp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(_p(r||n)===null)continue;break}var a=ft(n);a!==null&&(e.splice(t,3),t-=3,vs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Ip(e){function t(t){return Np(t,e)}bp!==null&&Np(bp,e),xp!==null&&Np(xp,e),Sp!==null&&Np(Sp,e),Cp.forEach(t),X.forEach(t);for(var n=0;n<wp.length;n++){var r=wp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<wp.length&&(n=wp[0],n.blockedOn===null);)kp(n),n.blockedOn===null&&wp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[rt]||null;if(typeof a==`function`)o||Fp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[rt]||null)s=o.formAction;else if(_p(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Fp(n)}}}function Lp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Rp(e){this._internalRoot=e}zp.prototype.render=Rp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;op(n,mu(),e,t,null,null)},zp.prototype.unmount=Rp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;op(e.current,2,null,e,null,null),xu(),t[it]=null}};function zp(e){this._internalRoot=e}zp.prototype.unstable_scheduleHydration=function(e){if(e){var t=$e();e={blockedOn:null,target:e,priority:t};for(var n=0;n<wp.length&&t!==0&&t<wp[n].priority;n++);wp.splice(n,0,e),n===0&&kp(e)}};var Bp=n.version;if(Bp!==`19.2.8`)throw Error(i(527,Bp,`19.2.8`));I.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var Vp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:F,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Hp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hp.isDisabled&&Hp.supportsFiber)try{Ae=Hp.inject(Vp),je=Hp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Vs,s=Hs,c=Us;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ip(e,1,!1,null,null,n,r,null,o,s,c,Lp),e[it]=t.current,Td(e),new Rp(t)}})),C=s(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=S()})),w=o((()=>{}));function T(e){return e.focusedPane===`sidebar`?`sidebar`:e.hasSelection||e.hasOpenPage?`content`:`sidebar`}var E,D=o((()=>{w(),E=70}));function O(e){let t=e,n=new Set;return{get:()=>t,set(e){if(!Object.is(e,t)){t=e;for(let e of n)e()}},subscribe(e){return n.add(e),()=>n.delete(e)}}}function k(e){return(0,ee.useSyncExternalStore)(e.subscribe,e.get,e.get)}var ee,A=o((()=>{ee=u(_(),1)}));function j(){try{return sessionStorage.getItem(P)}catch{return null}}function M(){let e=N.findIndex(e=>e===F),t=N[(e+1)%N.length];F=t;try{sessionStorage.setItem(P,t)}catch{}return t}var N,P,F,I=o((()=>{N=[`orbit`,`comet`,`rings`,`starlings`],P=`rove.web.lastSky`,F=j()}));function L(e,t){let n=e.filter(e=>e.rare&&!e.children);if(n.length===0)return[...e];let r=e.filter(e=>!n.includes(e)),i={label:t,section:`more`,children:n.map(({section:e,...t})=>t)},a=r.findIndex(e=>e.section===`danger`);return a<0?[...r,i]:[...r.slice(0,a),i,...r.slice(a)]}function R(e,t){for(let n of e){if(n.binding===t)return n;let e=n.children&&R(n.children,t);if(e)return e}}function te(e,t){let n=null;try{n=t(JSON.parse(sessionStorage.getItem(e)??`null`))}catch{}let r=O(n);return r.subscribe(()=>{try{let t=r.get();t===null?sessionStorage.removeItem(e):sessionStorage.setItem(e,JSON.stringify(t))}catch{}}),r}function ne(){try{let e=JSON.parse(sessionStorage.getItem(ye)??`null`);return e&&typeof e==`object`?e:null}catch{return null}}function re(e,t,n,r,i){ie({...e?{repo:e}:{},...t?{baseBranch:t}:{},...n?{machine:n}:{},...r?{prompt:r}:{},...i?{ungrouped:!0}:{}})}function ie(e){V.set(null),B.set(null),be.set({...e,sky:M()})}function ae(){let e=new URLSearchParams(window.location.search),t=e.get(`prompt`);if(t===null)return;let n=e.get(`repo`)??void 0;e.delete(`prompt`),e.delete(`repo`);let r=e.toString();history.replaceState(null,``,`${window.location.pathname}${r?`?${r}`:``}${window.location.hash}`),re(n,void 0,void 0,t)}function z(e,t=`info`,n,r){if(pe.get().some(n=>n.text===e&&n.tone===t&&!n.leaving))return;let i=xe++;pe.set([...pe.get(),{id:i,text:e,tone:t,...n?{action:n}:{}}].slice(-3)),window.setTimeout(()=>se(i),r??(n?Ce:Se))}function oe(){return typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches}function se(e){if(!pe.get().some(t=>t.id===e&&!t.leaving))return;let t=()=>pe.set(pe.get().filter(t=>t.id!==e));if(oe()){t();return}pe.set(pe.get().map(t=>t.id===e?{...t,leaving:!0}:t)),window.setTimeout(t,140)}function ce(){B.set(null)}function le(){we.get()!==`drag`&&(Te!==null&&window.clearTimeout(Te),we.set(`slide`),Te=window.setTimeout(()=>we.set(null),240))}function ue(e){Te!==null&&window.clearTimeout(Te),Te=null,we.set(e?`drag`:null)}var de,B,fe,pe,me,V,he,ge,_e,ve,ye,be,xe,Se,Ce,we,Te,H=o((()=>{I(),A(),de=O(null),B=O(null),fe=null,B.subscribe(()=>{let e=document.activeElement;if(B.get()!==null){!fe&&e instanceof HTMLElement&&!e.closest(`.dialog`)&&(fe=e);return}let t=fe;fe=null,window.setTimeout(()=>{t?.isConnected&&(!document.activeElement||document.activeElement===document.body)&&t.focus()},0)}),pe=O([]),me=[`worktrees`,`update`,`kanban`,`routines`,`issues`,`mods`,`compare`,`usage`,`sessions`],V=te(`rove.web.page`,e=>me.find(t=>t===e)??null),he=O(null),ge=te(`rove.web.compareGroup`,e=>typeof e==`string`?e:null),_e=te(`rove.web.sessionsRepo`,e=>typeof e==`string`?e:null),ve=O(null),ye=`rove.web.newSession`,be=O(ne()),be.subscribe(()=>{try{let e=be.get();if(!e)return sessionStorage.removeItem(ye);let{prompt:t,...n}=e;sessionStorage.setItem(ye,JSON.stringify(n))}catch{}}),xe=1,Se=4e3,Ce=8e3,we=O(null),Te=null}));function Ee(e){V.set(e),Ie()}function De(e){ge.set(e),Ee(`compare`)}function Oe(e){_e.set(e),Ee(`sessions`)}function ke(){return(0,je.useSyncExternalStore)(e=>{let t=ze();return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>ze().matches,()=>!1)}function Ae(e,t,n){return T({focusedPane:e,hasSelection:t,hasOpenPage:n})}var je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He=o((()=>{D(),je=u(_(),1),A(),H(),Me=`(max-width: ${E*8-1}px)`,Ne=O(`sidebar`),Pe=O(0),Fe=Ne.get(),Ne.subscribe(()=>{let e=Ne.get();Fe===`workspace`&&e===`sidebar`&&Pe.set(Pe.get()+1),Fe=e}),Ie=()=>Ne.set(`workspace`),Le=()=>Ne.set(`sidebar`),ze=()=>(Re??=window.matchMedia(Me),Re),Be=()=>ze().matches,Ve=e=>{let t=ze();return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}})),Ue=C();He(),A();var We=10,Ge=200,Ke=`input, textarea, select, [contenteditable]`,qe=`[data-back-panel]`,Je=O(null),Ye=e=>t=>{if(t)return t.dataset.backPanel=``,t.addEventListener(`backswipe`,e),()=>{delete t.dataset.backPanel,t.removeEventListener(`backswipe`,e)}};function Xe(e){return e.closest(qe)||(e.closest(`dialog`)||Ne.get()!==`workspace`?null:document.querySelector(`.app > main`))}var Ze=(e,t)=>e>0&&e>Math.abs(t),Qe=(e,t,n)=>e>=t/3||e>=40&&n<250;function $e(e){for(let t=e;t;t=t.parentElement)if(t.scrollWidth>t.clientWidth&&/auto|scroll/.test(getComputedStyle(t).overflowX))return!0;return!1}function et(){let e=null,t=(e,t,n)=>{let r=()=>{n?e.matches(qe)?e.dispatchEvent(new Event(`backswipe`)):Le():e.style.removeProperty(`--back-x`),Je.set(null)},i=n?e.offsetWidth:0;e.style.setProperty(`--back-x`,`${i}px`);let a=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;e.animate({translate:[`${t}px`,`${i}px`]},{duration:a?0:Ge,easing:`cubic-bezier(0.2, 0, 0, 1)`}).finished.then(r,r)};document.addEventListener(`touchstart`,t=>{let{target:n}=t;if(e=null,Je.get()||t.touches.length!==1||!Be()||!(n instanceof Element)||n.closest(Ke)||$e(n))return;let r=Xe(n);r&&(e={panel:r,x:t.touches[0].clientX,y:t.touches[0].clientY,at:t.timeStamp,dx:0,on:!1})},{passive:!0}),document.addEventListener(`touchmove`,t=>{if(!e)return;let n=t.touches[0].clientX-e.x;if(!e.on){let r=t.touches[0].clientY-e.y;if(Math.hypot(n,r)<We)return;if(t.touches.length!==1||!Ze(n,r)||!document.getSelection()?.isCollapsed){e=null;return}e.on=!0,Je.set(e.panel.matches(qe)?`panel`:`app`)}t.preventDefault(),t.stopPropagation(),e.dx=Math.max(0,n),e.panel.style.setProperty(`--back-x`,`${e.dx}px`)},{capture:!0,passive:!1});let n=n=>{let r=e;if(e=null,!r?.on)return;let i=n.type===`touchend`&&Qe(r.dx,window.innerWidth,n.timeStamp-r.at);t(r.panel,r.dx,i)};document.addEventListener(`touchend`,n),document.addEventListener(`touchcancel`,n)}var tt=c({en:()=>nt,zh:()=>rt}),nt,rt,it=o((()=>{nt={artifact:{preview:`preview`,source:`source`,open:`[ open ]`,loading:`Loading…`,tooLarge:`Too large to preview ({size}); the source view reads it as text.`,notPreviewable:`This file cannot be previewed.`,gone:`The file is gone.`,failed:`Could not read the file: {error}`}},rt={artifact:{preview:`预览`,source:`源码`,open:`[ 打开 ]`,loading:`加载中…`,tooLarge:`文件太大,无法预览({size});可在源码视图中按文本查看。`,notPreviewable:`这个文件无法预览。`,gone:`文件已不存在。`,failed:`无法读取文件:{error}`}}})),at=c({en:()=>ot,zh:()=>st}),ot,st,ct=o((()=>{ot={compare:{title:`Compare attempts`,menu:`Compare attempts`,severalEngines:`[ compare engines ]`,oneEngine:`[ one engine ]`,needsPrompt:`Compare runs the prompt, so it needs one`,empty:`No attempts left in this round.`,noReply:`no reply yet`,noChanges:`no changes`,status:{working:`working`,waiting:`waiting for you`,error:`needs a look`,done:`done`,idle:`idle`},files:`files: {count}`,attempts:`attempts: {count}`,moreLines:`[ {count} more lines in the diff ]`,kept:`kept`,strip:`[ compare ]`,stackLabel:`Stacked tasks`,landBottom:`[ land bottom ]`,landBottomPhone:`Land bottom`,terminal:`[ terminal ]`,diff:`[ diff ]`,keep:`Keep this one`,unkeep:`[ unkeep ]`,keptToast:`kept {title}`,unkeptToast:`no longer kept: {title}`,keepFailed:`could not mark it kept: {error}`,archiveTitle:`Archive the other attempts?`,archiveBody:`Hides the other {count} from the rail and closes their sessions. Their worktrees and branches stay.`,archiveConfirm:`Archive`,archiveBusyTitle:`Some attempts are still working`,archiveBusyBody:`Archive them anyway? They are stopped; their worktrees and branches stay.`,archiveBusyConfirm:`Archive anyway`,archived:`archived {count} attempts`,archivedOne:`archived 1 attempt`,archiveFailed:`could not archive: {error}`}},st={compare:{title:`对比方案`,menu:`对比方案`,severalEngines:`[ 多引擎对比 ]`,oneEngine:`[ 单引擎 ]`,needsPrompt:`对比要运行提示词,请先写一个`,empty:`这一轮没有剩下的方案。`,noReply:`还没有回复`,noChanges:`没有改动`,status:{working:`运行中`,waiting:`等你处理`,error:`需要看一眼`,done:`已完成`,idle:`空闲`},files:`文件:{count}`,attempts:`方案:{count}`,moreLines:`[ diff 里还有 {count} 行 ]`,kept:`已保留`,strip:`[ 对比 ]`,stackLabel:`堆叠任务`,landBottom:`[ 合并底部 ]`,landBottomPhone:`合并底部`,terminal:`[ 终端 ]`,diff:`[ diff ]`,keep:`保留这个`,unkeep:`[ 取消保留 ]`,keptToast:`已保留 {title}`,unkeptToast:`已取消保留:{title}`,keepFailed:`无法标记保留:{error}`,archiveTitle:`归档其他方案?`,archiveBody:`把其余 {count} 个从侧栏收起,并结束它们的会话。worktree 和分支都保留。`,archiveConfirm:`归档`,archiveBusyTitle:`有方案还在运行`,archiveBusyBody:`仍要归档吗?它们会被停掉,worktree 和分支都保留。`,archiveBusyConfirm:`仍然归档`,archived:`已归档 {count} 个方案`,archivedOne:`已归档 1 个方案`,archiveFailed:`无法归档:{error}`}}})),lt=c({en:()=>ut,zh:()=>dt}),ut,dt,ft=o((()=>{ut={context:{used:`{percent} used`,usedTokens:`{tokens} used`,loading:`Reading context…`,none:`No context reading for this conversation: its engine records none, or it has not answered yet.`,failed:`Couldn't read context: {error}`,probing:`Reading what fills it…`,more:`+{count} more`,part:{system:`System prompt & tools`,system_prompt:`System prompt`,system_tools:`System tools`,mcp_tools:`MCP tools`,mcp_instructions:`MCP server instructions`,mcp_tools_deferred:`MCP tools (deferred)`,system_tools_deferred:`System tools (deferred)`,custom_agents:`Custom agents`,memory_files:`Memory files`,skills:`Skills`,messages:`Messages`,used:`Used`,free:`Free space`}}},dt={context:{used:`已用 {percent}`,usedTokens:`已用 {tokens}`,loading:`正在读取上下文…`,none:`这个会话没有上下文读数:它的引擎不记录,或者还没回复过。`,failed:`读取上下文失败:{error}`,probing:`正在读取构成…`,more:`另有 {count} 项`,part:{system:`系统提示与工具`,system_prompt:`系统提示`,system_tools:`系统工具`,mcp_tools:`MCP 工具`,mcp_instructions:`MCP 服务器说明`,mcp_tools_deferred:`MCP 工具(按需加载)`,system_tools_deferred:`系统工具(按需加载)`,custom_agents:`自定义 agent`,memory_files:`记忆文件`,skills:`技能`,messages:`消息`,used:`已用`,free:`剩余空间`}}}})),pt=c({en:()=>mt,zh:()=>ht}),mt,ht,gt=o((()=>{mt={dialog:{cancel:`Cancel`,save:`Save`,close:`Close`},crash:{title:`This page hit an error. Copy the report below before reloading.`,copy:`Copy report`,copied:`Copied`,reload:`Reload`},updatePrompt:{title:`Rove {version} is available`,body:`This computer runs {current}. Update installs the new version on it.`,yes:`Update`,later:`Not now`,skip:`Skip this version`},whatsNew:{title:`What's new`,continue:`Continue`,openRelease:`Open release notes`,keys:`q / esc`},menu:{cancel:`Cancel`,closeTab:`Close tab`,newChat:`New conversation`,newChatPick:`New conversation with…`,retryEdit:`Retry with edited prompt…`,retryNoPrompt:`This task has no stored prompt`,startNow:`Start now`,cancelStart:`Cancel scheduled start`,continueEngine:`Continue in another engine…`,newShell:`New shell`,newChatNoFolder:`New conversation (no folder)`,renameTab:`Rename tab`,splitRight:`Split right`,splitDown:`Split down`,renamePane:`Rename pane`,closePane:`Close pane`,newTask:`New task`,rename:`Rename`,pin:`Pin`,unpin:`Unpin`,setStatus:`Set status`,copy:`Copy`,copyWhat:{id:`Task ID`,branch:`Branch name`,path:`Worktree path`},renameBranch:`Rename branch`,changeEngine:`Change engine`,land:`Land into base branch`,delete:`Delete`,removeSession:`Remove session`,archiveMany:`Archive {count} sessions`,archivedMany:`Archived {count} sessions`,archiveManyBusy:`These are still working or waiting on you:`,removeMany:`Remove {count} sessions`,removedMany:`Removed {count} sessions`,removeManyTitle:`Remove {count} sessions?`,removeManyBody:`Ends each session, closes its tabs and removes its worktree folder. Git branches stay; a child moves up to its parent's place.`,removeManyDirtyTitle:`Some worktrees have uncommitted changes`,removeManyDirtyBody:`Removing them anyway loses those changes:`,viewSessions:`View all sessions`,more:`More`,copied:`copied {text}`,copyFailed:`the browser refused the clipboard`,nothingToCopy:`this task has no {what} yet`,what:{id:`id`,branch:`branch`,path:`worktree path`}},confirm:{closeTabTitle:`Close "{tab}"?`,closeTabBody:`Stops the session in this tab. The task and its worktree stay.`,closePaneTitle:`Close "{pane}"?`,closePaneBody:`The engine session in this pane ends. The tab's other panes stay.`,delete:`delete`,forceDelete:`force delete`},newTask:{title:`new task`,repo:`project`,engine:`engine`,notReady:`not installed or not signed in`,taskTitle:`title`,titlePlaceholder:`optional; derived from the prompt otherwise`,prompt:`first message`,promptPlaceholder:`optional; ⌘↵ creates`,create:`create`,needRepo:`pick a project first`},newChat:{title:`new conversation`,prompt:`first message`,start:`start`,promptPlaceholder:`optional; empty opens the engine without a message`},newSession:{title:`New session`,tagline:`Pick a project and a model, then describe the task. The session starts with your first message.`,placeholder:`Describe a task or ask a question`,start:`Start session`,later:`Start later…`,laterConfirm:`Start later`,laterPlaceholder:`22:30 · tomorrow 9:00 · +30m`,laterBad:`That is not a time ahead. Try 22:30, tomorrow 9:00 or +2h.`,laterSet:`Starts at {time}. Until then it waits under Routines, where you can cancel it.`,retryArchiveTitle:`Archive "{title}"?`,retryArchiveBody:`The retry has started. Archive the original? Its session is closed; nothing is deleted.`,needRepo:`Pick a project first`,needPrompt:`Describe the task first`,repo:`Project`,repoSearch:`Search projects or type a path`,repoEmpty:`No matching project`,noFolder:`No folder`,chooseFolder:`Choose folder`,openFolder:`+ Open folder…`,openFolderHeading:`Open folder`,folderFilter:`Paste a path or filter folders…`,folderUse:`Use "{name}"`,folderBack:`← Back`,folderParent:`parent`,folderGit:`git`,folderEmpty:`No subfolders`,folderHint:`← up · → open · enter select · esc back`,cloneRow:`Clone {source}`,cloning:`Cloning {source}`,githubGroup:`Your GitHub repositories`,githubLoading:`Reading your GitHub repositories…`,branch:`Branch`,branchSearch:`Search branches`,branches:`Branches`,branchName:`Branch name, shared by every repo`,branchNamePlaceholder:`derived from the prompt`,primary:`primary`,repoCount:`{count} repos: the first is the primary`,branchEmpty:`No matching branch`,model:`Model`,modelHeading:`Model for this session`,engine:`Engine`,shell:`Shell`,shellPlaceholder:`A command to run first, or leave empty for a plain terminal`,shellOneLine:`A shell command is one line`,modelDefault:`Default`,more:`More`,attach:`Attach`,attachHint:`Add files to the first message; you can also paste or drop them on the prompt`,removeAttachment:`Remove {name}`,worktree:`Worktree`,worktreeOn:`Runs in its own worktree and branch. Click to run in the project's checkout instead`,worktreeOff:`Runs in the project's checkout as it is, on its current branch. Click for a worktree`,worktreeMulti:`A task across several repos always gets a worktree in each`,worktreeNoGit:`Not a git repository: the session runs in the folder itself`,worktreeRemoteRequired:`An agent running on that machine, or a repo it still has to clone, always gets a worktree`,plainMulti:`A folder without git can't join a task across several repos`,machine:`Machine`,thisMachine:`This machine`,machineAuto:`Auto`,machineAutoNote:`Starts on the least busy machine that has this project.`,startedOn:`Started on {machine}`,retry:`Retry`,agentPlace:`Agent runs on`,agentHereNote:`Uses this machine's engines and sign-in. Only the files and commands are on {machine}.`,agentThereNote:`The engine runs on {machine}, so it must be installed and signed in there.`,cloneRowOn:`Clone {source} on {machine}`,cloningOn:`Cloning {source} on {machine}`,startingOn:`Starting the task on {machine}`,engineMissing:`{engine} · not installed`,engineMissingOn:`{engine} is not installed on {machine}. Install it there, or pick another engine.`,repoSearchRemote:`Search or type owner/repo`,remoteOffline:`{machine} is offline`,remoteOutdated:`{machine} runs a Rove too old to list its projects`,remoteFailed:`Could not read {machine}'s projects: {message}`,remoteNone:`{machine} has no projects yet. Type owner/repo to clone one there`,remoteLoading:`Reading {machine}'s projects…`,branchTypeRef:`Type a branch or ref to start from`,branchRemoteDefault:`Its current branch`},sessions:{title:`Sessions`,active:`Active`,archived:`Archived`,allProjects:`all projects`,emptyActive:`No sessions here. Start one from New task.`,emptyArchived:`Nothing archived here. Archive a session from its row menu.`,keys:`tab project · a archived · enter open · q close`},search:{tasks:`Tasks`,archived:`{repo} · archived, pick to unarchive`,commands:`Commands`,inConversations:`In conversations`,searching:`searching…`,none:`Nothing said matches “{query}”.`,you:`you`,agent:`agent`,truncated:`Stopped early to stay fast; add a word to narrow it.`,skipped:`{count} task(s) not searched: another machine's, or an engine Rove cannot read.`},taskops:{publishTitle:`publish to the remote`,publishBody:`{branch} lives on {host}. Push it from there and open a pull request?`,publishButton:`push & open PR`,publishedPr:`pushed {branch} — PR {url}`,publishedNoPr:`pushed {branch}, but no PR: {reason}`,set:`set`,retire:`delete`,close:`close`,moveHint:`j/k move · enter or esc done`,fixSent:`asked the agent to fix the failing checks`,forkNeedsMessage:`a message is required to fork a task`,forkLeftBehind:`Started from the last commit — uncommitted work stays in the original task ({reason})`,forkBranch:`fork from branch`,openedExternal:`opened in the Mac's app`}},ht={dialog:{cancel:`取消`,save:`保存`,close:`关闭`},crash:{title:`页面出错了。刷新前先把下面的报告复制下来。`,copy:`复制报告`,copied:`已复制`,reload:`刷新`},updatePrompt:{title:`Rove {version} 可以更新了`,body:`这台电脑运行的是 {current}。点更新会在它上面安装新版本。`,yes:`更新`,later:`暂不`,skip:`跳过这个版本`},whatsNew:{title:`更新内容`,continue:`继续`,openRelease:`打开发布说明`,keys:`q / esc`},menu:{cancel:`取消`,closeTab:`关闭该标签页`,newChat:`新建会话`,newChatPick:`选择引擎新建会话…`,retryEdit:`改提示词后重试…`,retryNoPrompt:`这个任务没有保存的提示词`,startNow:`立即启动`,cancelStart:`取消定时启动`,continueEngine:`换个引擎继续…`,newShell:`新建终端`,newChatNoFolder:`新建会话(无文件夹)`,renameTab:`重命名标签页`,splitRight:`向右分屏`,splitDown:`向下分屏`,renamePane:`重命名分屏`,closePane:`关闭分屏`,newTask:`新建任务`,rename:`重命名`,pin:`置顶`,unpin:`取消置顶`,setStatus:`设置状态`,copy:`复制`,copyWhat:{id:`任务 ID`,branch:`分支名`,path:`worktree 路径`},renameBranch:`重命名分支`,changeEngine:`切换引擎`,land:`合入基础分支`,delete:`删除`,removeSession:`移除会话`,archiveMany:`归档 {count} 个会话`,archivedMany:`已归档 {count} 个会话`,archiveManyBusy:`这些会话还在运行或在等你:`,removeMany:`移除 {count} 个会话`,removedMany:`已移除 {count} 个会话`,removeManyTitle:`移除 {count} 个会话?`,removeManyBody:`结束每个会话,关闭它的标签页,并删除它的 worktree 文件夹。git 分支会保留;子会话会上移到父会话的位置。`,removeManyDirtyTitle:`有些 worktree 还有未提交的改动`,removeManyDirtyBody:`仍然移除会丢掉这些改动:`,viewSessions:`查看全部会话`,more:`更多`,copied:`已复制 {text}`,copyFailed:`浏览器拒绝了剪贴板访问`,nothingToCopy:`这个任务还没有{what}`,what:{id:`ID`,branch:`分支`,path:`worktree 路径`}},confirm:{closeTabTitle:`关闭「{tab}」?`,closeTabBody:`停止这个标签里的会话。任务和它的 worktree 会保留。`,closePaneTitle:`关闭「{pane}」?`,closePaneBody:`这个分屏里的引擎会话会结束。标签里的其他分屏会保留。`,delete:`删除`,forceDelete:`强制删除`},newTask:{title:`新建任务`,repo:`项目`,engine:`引擎`,notReady:`未安装或未登录`,taskTitle:`标题`,titlePlaceholder:`可选;不填就从第一条消息生成`,prompt:`第一条消息`,promptPlaceholder:`可选;⌘↵ 创建`,create:`创建`,needRepo:`先选一个项目`},newChat:{title:`新建会话`,prompt:`第一条消息`,start:`开始`,promptPlaceholder:`可选;留空则直接打开引擎,不发消息`},newSession:{title:`新会话`,tagline:`选好项目和模型,再描述任务。会话从你的第一条消息开始。`,placeholder:`描述一个任务,或提个问题`,start:`开始会话`,later:`稍后启动…`,laterConfirm:`稍后启动`,laterPlaceholder:`22:30 · 明天 9:00 · +30m`,laterBad:`这不是一个未来的时间。试试 22:30、明天 9:00 或 +2h。`,laterSet:`{time} 启动。在那之前它列在「例行任务」里,可以在那里取消。`,retryArchiveTitle:`归档「{title}」?`,retryArchiveBody:`重试已经开始。要把原来的会话归档吗?它的进程会结束,不会删除任何东西。`,needRepo:`先选一个项目`,needPrompt:`先描述一下任务`,repo:`项目`,repoSearch:`搜索项目,或输入路径`,repoEmpty:`没有匹配的项目`,noFolder:`无文件夹`,chooseFolder:`选择文件夹`,openFolder:`+ 打开文件夹…`,openFolderHeading:`打开文件夹`,folderFilter:`粘贴路径或过滤文件夹…`,folderUse:`使用「{name}」`,folderBack:`← 返回`,folderParent:`上级目录`,folderGit:`git`,folderEmpty:`没有子文件夹`,folderHint:`← 上一级 · → 进入 · enter 选定 · esc 返回`,cloneRow:`克隆 {source}`,cloning:`正在克隆 {source}`,githubGroup:`你的 GitHub 仓库`,githubLoading:`正在读取你的 GitHub 仓库…`,branch:`分支`,branchSearch:`搜索分支`,branches:`分支`,branchName:`分支名,所有仓库共用`,branchNamePlaceholder:`不填就从提示词生成`,primary:`主仓库`,repoCount:`{count} 个仓库,第一个是主仓库`,branchEmpty:`没有匹配的分支`,model:`模型`,modelHeading:`本次会话的模型`,engine:`引擎`,shell:`Shell`,shellPlaceholder:`先运行的命令,留空就只开一个终端`,shellOneLine:`Shell 命令只能写一行`,modelDefault:`默认`,more:`更多`,attach:`附件`,attachHint:`给第一条消息加文件;也可以直接粘贴或拖到输入框里`,removeAttachment:`移除 {name}`,worktree:`Worktree`,worktreeOn:`在独立的 worktree 和分支里运行。点击改为直接在项目目录里运行`,worktreeOff:`直接在项目目录里运行,用它当前的分支。点击改为独立 worktree`,worktreeMulti:`跨多个仓库的任务每个仓库都会有 worktree`,worktreeNoGit:`不是 git 仓库:会话直接在这个文件夹里运行`,worktreeRemoteRequired:`agent 跑在那台机器上,或仓库还要先克隆时,总会建 worktree`,plainMulti:`没有 git 的文件夹不能加入跨多个仓库的任务`,machine:`机器`,thisMachine:`本机`,machineAuto:`自动`,machineAutoNote:`在有这个项目、且最空闲的机器上启动。`,startedOn:`已在 {machine} 上启动`,retry:`重试`,agentPlace:`agent 运行在`,agentHereNote:`用本机的引擎和登录,只有文件和命令在 {machine} 上。`,agentThereNote:`引擎在 {machine} 上运行,那边要装好并登录。`,cloneRowOn:`在 {machine} 上克隆 {source}`,cloningOn:`正在 {machine} 上克隆 {source}`,startingOn:`正在 {machine} 上启动任务`,engineMissing:`{engine} · 未安装`,engineMissingOn:`{machine} 上没有安装 {engine}。在那台机器上装好,或者换一个引擎。`,repoSearchRemote:`搜索,或输入 owner/repo`,remoteOffline:`{machine} 已离线`,remoteOutdated:`{machine} 上的 Rove 太旧,列不出它的项目`,remoteFailed:`读不到 {machine} 上的项目:{message}`,remoteNone:`{machine} 上还没有项目。输入 owner/repo 就能在那里克隆`,remoteLoading:`正在读取 {machine} 上的项目…`,branchTypeRef:`输入要基于的分支或 ref`,branchRemoteDefault:`它当前的分支`},sessions:{title:`会话`,active:`进行中`,archived:`已归档`,allProjects:`全部项目`,emptyActive:`这里还没有会话。从「新建任务」开始一个。`,emptyArchived:`这里没有已归档的会话。在会话的右键菜单里归档。`,keys:`tab 切换项目 · a 已归档 · enter 打开 · q 关闭`},search:{tasks:`任务`,archived:`{repo} · 已归档,选中即恢复`,commands:`命令`,inConversations:`在对话里`,searching:`搜索中…`,none:`没有说过「{query}」。`,you:`你`,agent:`agent`,truncated:`为了快提前停了;多加一个词缩小范围。`,skipped:`有 {count} 个任务没搜:在别的机器上,或 Rove 读不了它的引擎记录。`},taskops:{publishTitle:`推送到远端`,publishBody:`{branch} 在 {host} 上。要从那台机器推送它并开一个 PR 吗?`,publishButton:`推送并开 PR`,publishedPr:`已推送 {branch} — PR {url}`,publishedNoPr:`已推送 {branch},但没开成 PR:{reason}`,set:`设置`,retire:`删除`,close:`关闭`,moveHint:`j/k 移动 · enter 或 esc 完成`,fixSent:`已请 agent 修复失败的检查`,forkNeedsMessage:`fork 任务需要填写消息`,forkLeftBehind:`已从最近一次提交开始——未提交的改动留在原任务里({reason})`,forkBranch:`基于分支`,openedExternal:`已在 Mac 上用系统应用打开`}}})),_t=c({en:()=>vt,zh:()=>yt}),vt,yt,bt=o((()=>{vt={machines:{title:`Machines`,open:`[ machines ]`,none:"No other machines registered. Add one with `rove machine add`.",newHere:`[ new task here ]`,tasks:`[ tasks ]`,repos:`[ repos ]`,hide:`[ hide ]`,noTasks:`no tasks`,noRepos:`no repos`,loading:`…`,reposFailed:`couldn't read its repos: {message}`,update:`[ update rove ]`,updating:`updating… this can take a few minutes`,updated:`updated: v{from} → v{to}`,upToDate:`already on the newest build of this machine's channel (v{to})`,updateFailed:`couldn't update it: {message}`,reason:{refused:`ssh was refused (nothing is listening or a firewall is in the way)`,timeout:`ssh timed out`,"host-key-changed":`its ssh host key changed; check it, then update known_hosts`,"host-key-unverified":`its ssh host key is not known yet; connect once by hand to trust it`,"auth-denied":`ssh refused the login (no key or password accepted)`,unresolved:`its hostname does not resolve`,"ssh-failed":`ssh failed`,"no-rove":`rove is not installed there`,"no-daemon":`its rove daemon is not running`,"bad-status":`it answered with something rove could not read`,handshake:`the link came up but the handshake failed`,"no-forwarding":`ssh forwarding is disabled there`,lost:`the link dropped; reconnecting`}}},yt={machines:{title:`机器`,open:`[ 机器 ]`,none:"没有注册其他机器。用 `rove machine add` 添加。",newHere:`[ 在这台新建任务 ]`,tasks:`[ 任务 ]`,repos:`[ 仓库 ]`,hide:`[ 收起 ]`,noTasks:`没有任务`,noRepos:`没有仓库`,loading:`…`,reposFailed:`读不到它的仓库:{message}`,update:`[ 更新 rove ]`,updating:`正在更新…可能要几分钟`,updated:`已更新:v{from} → v{to}`,upToDate:`已经是这台机器所在通道的最新版(v{to})`,updateFailed:`更新失败:{message}`,reason:{refused:`ssh 被拒绝(没有进程在监听,或被防火墙挡住)`,timeout:`ssh 超时`,"host-key-changed":`它的 ssh 主机密钥变了;确认无误后更新 known_hosts`,"host-key-unverified":`还不认识它的 ssh 主机密钥;先手动连一次以信任它`,"auth-denied":`ssh 拒绝了登录(没有被接受的密钥或密码)`,unresolved:`它的主机名解析不了`,"ssh-failed":`ssh 失败`,"no-rove":`那里没有安装 rove`,"no-daemon":`它的 rove 守护进程没在运行`,"bad-status":`它返回了 rove 读不懂的内容`,handshake:`链路通了但握手失败`,"no-forwarding":`那里禁用了 ssh 端口转发`,lost:`链路断了;正在重连`}}}})),xt=c({en:()=>St,zh:()=>Ct}),St,Ct,wt=o((()=>{St={files:{autoFix:{on:`[ auto-fix CI ]`,off:`[ turn off ]`,count:`auto-fix {n}/{max}`,stopped:`auto-fix stopped {n}/{max}`,hint:`When checks fail on a new push and the agent is idle, send it the failing logs. At most once per push, 3 times in all, then it stops and tells your Inbox.`},stripCreate:`[ create PR ]`,stripFixCi:`[ fix CI ]`,stripConflicts:`[ resolve conflicts ]`,stripComments:`[ address comments ]`,stripArchive:`[ archive ]`,stripFilled:`prompt is in the input; edit it and press Enter`,stripNoEngine:`No engine session open in this task — nowhere to put the prompt.`,stripUnavailable:`couldn't read the PR's checks: {detail}`,stripNothing:`nothing to ask the agent about right now`,openPort:`[ open :{port} ]`,checks:{title:`checks`,summary:`{pass}/{total} passed`,failed:`{count} failed`,running:`{count} running`,none:`no checks`,refresh:`[ refresh ]`,loading:`…`,unavailable:`couldn't read the PR: {detail}`,log:`[ log ]`,hideLog:`[ hide ]`,noLog:`no log excerpt for this job`,logUnavailable:`couldn't read the log: {detail}`,more:`{count} more not shown`,took:`{duration}`,tookAgo:`{duration} · {age} ago`,finishedAgo:`{age} ago`,runningFor:`running {elapsed}`},merge:{draft:`draft`,conflicts:`conflicts`,behind:`behind base`,unstable:`checks not passing`,blocked:`blocked`,clean:`mergeable`,approved:`approved`,changes:`changes requested`,reviewRequired:`review required`},stripCommit:`[ commit ]`,prRequested:`asked the agent to create the PR`,remoteNoExternal:`this file is on {host}; open it there`,mentionNoEngine:`No engine session open in this task — nothing to mention into.`,menu:{attach:`Attach as context`,diff:`Open diff`,copy:`Copy`,copyRelative:`Relative path`,copyAbsolute:`Absolute path`,copyName:`Filename`,openExternal:`Open in the Mac's app`,reveal:`Show in Finder`,terminal:`Open in terminal`},landTodos:`{count} todo(s) on this task are still unchecked.`,emptyAll:`(empty worktree)`,truncated:`Only the first {count} files are listed.`,state:{conflict:`conflict`,deleted:`deleted`,modified:`modified`,untracked:`untracked`,added:`added`,renamed:`renamed`}},preview:{loading:`loading…`,whole:`whole worktree`,unknown:`nothing to show`,binary:`binary file — not shown as text`,empty:`no changes`,noHunks:`no text changes ({kind})`,modeFile:`[ file ]`,modeDiff:`[ diff ]`,askInChat:`ask in chat`,askInChatHint:`Put the selected lines in the engine's prompt`,sent:`sent {count} notes to the engine`,sentOne:`sent 1 note to the engine`,notSent:`notes not sent: {reason}`},review:{comment:`comment`,range:`range`,count:`{count} comments`,countOne:`1 comment`,send:`send {count}`,sending:`sending…`,edit:`edit`,drop:`drop`,moved:`moved`,movedHint:`The code under this comment changed since it was written.`,show:`Show in the diff`,noteOn:`note on {location}`,noteEditOn:`edit note on {location}`,noteAdd:`[ add note ]`,noteSave:`[ save note ]`,noteCancel:`[ cancel ]`,fold:`Fold {path}`,unfold:`Unfold {path}`,foldAll:`fold all`,unfoldAll:`unfold all`,ignoreWs:`[ ws ]`,ignoreWsHint:`Hide whitespace-only changes (git diff -w)`,viewed:`[ viewed ]`,markViewed:`Mark {path} viewed`,viewedOn:`[x] viewed`,unmarkViewed:`Unmark {path} viewed`,totals:`{files} files · +{added} −{removed}`,totalsOne:`1 file · +{added} −{removed}`,viewedCount:`{done}/{files} viewed`,nextFile:`[ next file ]`,nextComment:`[ next comment ]`,scopeMenu:`{base} → {scope} ▾`,compareAgainst:`Compare against {base}…`,baseDefault:`task base`,baseBranch:`branch`,baseRemote:`remote`,baseTag:`tag`,basePlaceholder:`branch, tag or commit`,shape:{effort:`effort {n}/5`,lockfile:`{count} lockfile`,lockfiles:`{count} lockfiles`,generated:`{count} generated`,tests:`{count} tests`,config:`{count} config`,docs:`{count} docs`,source:`{count} source`},scopeWorking:`Uncommitted changes`,scopeBranch:`Committed changes`,scopeTask:`All changes`,lineClipped:`… {count} more characters`,notSupported:`This bridge is older than the page and can't do that; restart it.`},panel:{tabs:`Browser tabs`,files:`Files`,chat:`Chat`,diff:`Diff`,browser:`Browser`,quota:`Context`,resize:`Drag to resize the panel, double-click to reset`,new:`New tab`,close:`Close`,expand:`Expand the side panel`,restore:`Restore the side panel size`,closeOthers:`Close others`,resizeSplit:`Drag to resize, double-click to reset the widths`},browser:{address:`Address`,placeholder:`https://… or localhost:3000`,back:`Back`,forward:`Forward`,reload:`Reload`,openTab:`Open in a new tab`,invalid:`That is not a web address; only http and https pages open here.`,outside:`Only files inside this task's directory open here.`,empty:`Enter a web address, or a local dev server.`,emptyPorts:`Enter a web address. A dev server started in this task is listed here.`,noFrame:`Only https pages open here; this address uses plain http. Use ↗ to open it in a new tab.`,self:`That address is Rove itself, which can't be framed. Use ↗ to open it in a new tab.`,refuses:`{host} doesn't allow being shown inside another page.`,unreachable:`{host} can't be reached from here.`,remote:`{host} runs on the Rove machine, not on this one.`,annotate:`Mark up this page`,pen:`Pen`,box:`Box`,text:`Text`,undo:`Undo the last mark`,addToChat:`Add to chat`,annotateDone:`Stop marking`,noEngine:`Open an agent session in this task first; the picture goes into its prompt.`,captureFailed:`Couldn't take a picture of the page: {error}`,handToAgent:`Hand to agent`,takeControl:`Agent · Take control`,handedToAgent:`Handed {id} to agent`,handedToHuman:`Took control of {id}`}},Ct={files:{autoFix:{on:`[ 自动修复 CI ]`,off:`[ 关闭 ]`,count:`自动修复 {n}/{max}`,stopped:`自动修复已停止 {n}/{max}`,hint:`检查在新提交上失败且代理空闲时,自动把失败日志发给它。每次提交最多一次、总共 3 次,之后停止并通知收件箱。`},stripCreate:`[ 创建 PR ]`,stripFixCi:`[ 修复 CI ]`,stripConflicts:`[ 解决冲突 ]`,stripComments:`[ 处理评论 ]`,stripArchive:`[ 归档 ]`,stripFilled:`提示词已放进输入框,修改后按 Enter 发送`,stripNoEngine:`这个任务没有打开的引擎会话,提示词无处可放。`,stripUnavailable:`读不到 PR 的检查结果:{detail}`,stripNothing:`现在没有需要让代理处理的事`,openPort:`[ 打开 :{port} ]`,checks:{title:`检查`,summary:`{pass}/{total} 通过`,failed:`{count} 个失败`,running:`{count} 个进行中`,none:`没有检查`,refresh:`[ 刷新 ]`,loading:`…`,unavailable:`读不到这个 PR:{detail}`,log:`[ 日志 ]`,hideLog:`[ 收起 ]`,noLog:`这个作业没有日志摘录`,logUnavailable:`读不到日志:{detail}`,more:`还有 {count} 个未显示`,took:`{duration}`,tookAgo:`{duration} · {age}前`,finishedAgo:`{age}前`,runningFor:`已运行 {elapsed}`},merge:{draft:`草稿`,conflicts:`有冲突`,behind:`落后于基线`,unstable:`检查未通过`,blocked:`被阻塞`,clean:`可合并`,approved:`已批准`,changes:`要求修改`,reviewRequired:`需要评审`},stripCommit:`[ 提交 ]`,prRequested:`已让代理去创建 PR`,remoteNoExternal:`这个文件在 {host} 上,请到那台机器上打开`,mentionNoEngine:`这个任务没有打开的引擎会话——没有地方可以提及。`,menu:{attach:`作为上下文附加`,diff:`打开 diff`,copy:`复制`,copyRelative:`相对路径`,copyAbsolute:`绝对路径`,copyName:`文件名`,openExternal:`用 Mac 上的应用打开`,reveal:`在 Finder 中显示`,terminal:`在终端中打开`},landTodos:`此任务还有 {count} 条待办未完成。`,emptyAll:`(空工作区)`,truncated:`只列出了前 {count} 个文件。`,state:{conflict:`有冲突`,deleted:`已删除`,modified:`已修改`,untracked:`未跟踪`,added:`已新增`,renamed:`已重命名`}},preview:{loading:`加载中…`,whole:`整个工作区`,unknown:`没有可显示的内容`,binary:`二进制文件——不以文本显示`,empty:`没有变更`,noHunks:`没有文本变更({kind})`,modeFile:`[ 文件 ]`,modeDiff:`[ 差异 ]`,askInChat:`在对话里问`,askInChatHint:`把选中的几行放进引擎的输入框`,sent:`已把 {count} 条批注发给引擎`,sentOne:`已把 1 条批注发给引擎`,notSent:`批注没有发出:{reason}`},review:{comment:`批注`,range:`选范围`,count:`{count} 条批注`,countOne:`1 条批注`,send:`发送 {count} 条`,sending:`发送中…`,edit:`编辑`,drop:`删除`,moved:`已移位`,movedHint:`这条批注下面的代码在写下之后变了。`,show:`在差异里定位`,noteOn:`批注 {location}`,noteEditOn:`编辑批注 {location}`,noteAdd:`[ 添加批注 ]`,noteSave:`[ 保存批注 ]`,noteCancel:`[ 取消 ]`,fold:`折叠 {path}`,unfold:`展开 {path}`,foldAll:`全部折叠`,unfoldAll:`全部展开`,ignoreWs:`[ ws ]`,ignoreWsHint:`隐藏仅空白的改动 (git diff -w)`,viewed:`[ 已看 ]`,markViewed:`标记 {path} 为已看`,viewedOn:`[x] 已看`,unmarkViewed:`取消 {path} 的已看`,totals:`{files} 个文件 · +{added} −{removed}`,totalsOne:`1 个文件 · +{added} −{removed}`,viewedCount:`已看 {done}/{files}`,nextFile:`[ 下个文件 ]`,nextComment:`[ 下条评论 ]`,scopeMenu:`{base} → {scope} ▾`,compareAgainst:`对比基准:{base}…`,baseDefault:`任务基准`,baseBranch:`分支`,baseRemote:`远程`,baseTag:`标签`,basePlaceholder:`分支、标签或提交`,shape:{effort:`评审量 {n}/5`,lockfile:`{count} 个锁文件`,lockfiles:`{count} 个锁文件`,generated:`{count} 个生成文件`,tests:`{count} 个测试`,config:`{count} 个配置`,docs:`{count} 个文档`,source:`{count} 个源码`},scopeWorking:`未提交的改动`,scopeBranch:`已提交的改动`,scopeTask:`全部改动`,lineClipped:`…还有 {count} 个字符`,notSupported:`这个 bridge 比页面旧,做不了这个;请重启它。`},panel:{tabs:`浏览器标签页`,files:`文件`,chat:`对话`,diff:`差异`,browser:`浏览器`,quota:`上下文`,resize:`拖动调整侧边栏宽度,双击复位`,new:`新建标签页`,close:`关闭`,expand:`展开侧边栏`,restore:`还原侧边栏大小`,closeOthers:`关闭其他`,resizeSplit:`拖动调整宽度,双击恢复默认宽度`},browser:{address:`地址`,placeholder:`https://… 或 localhost:3000`,back:`后退`,forward:`前进`,reload:`刷新`,openTab:`在新标签页打开`,invalid:`这不是网页地址;这里只能打开 http 和 https 页面。`,outside:`这里只能打开这个任务目录里的文件。`,empty:`输入网页地址,或本地开发服务器的地址。`,emptyPorts:`输入网页地址。在这个任务里启动的开发服务器会列在这里。`,noFrame:`这里只能打开 https 页面;这个地址用的是 http。点 ↗ 在新标签页打开。`,self:`这个地址就是 Rove 本身,不能嵌入。点 ↗ 在新标签页打开。`,refuses:`{host} 不允许嵌入其他页面。`,unreachable:`从这里访问不到 {host}。`,remote:`{host} 运行在 Rove 所在的机器上,不在这台设备上。`,annotate:`在页面上标注`,pen:`画笔`,box:`方框`,text:`文字`,undo:`撤销上一笔`,addToChat:`加到对话`,annotateDone:`结束标注`,noEngine:`先在这个任务里打开一个 agent 会话;截图会进它的输入框。`,captureFailed:`没能截下这个页面:{error}`,handToAgent:`交给代理`,takeControl:`代理控制中 · 接管`,handedToAgent:`已将 {id} 交给代理`,handedToHuman:`已接管 {id}`}}})),Tt=c({en:()=>Et,zh:()=>Dt}),Et,Dt,Ot=o((()=>{Et={quote:{action:`[ quote ]`,title:`Put the selection in the prompt as a quote`,atMenu:`The agent is waiting on a choice. Answer it first, then quote.`,notReady:`The agent's prompt is not taking pasted text yet. Try again in a moment.`},snippets:{empty:`No snippets yet.`,name:`Name`,namePlaceholder:`review`,text:`Text`,textPlaceholder:`Review this change for bugs and missing tests.`,add:`[ add ]`,save:`[ save ]`,edit:`[ edit ]`,cancel:`[ cancel ]`,remove:`[ remove ]`,removed:`Removed @{name}`,badName:`A name is letters, digits, - or _, up to 32.`,phone:{add:`Add snippet`,save:`Save`,cancel:`Cancel`,remove:`Delete snippet`}}},Dt={quote:{action:`[ 引用 ]`,title:`把选中的内容作为引用放进提示词`,atMenu:`agent 正在等你做选择。先回答它,再引用。`,notReady:`agent 的输入框暂时还不接受粘贴。稍等一下再试。`},snippets:{empty:`还没有片段。`,name:`名称`,namePlaceholder:`review`,text:`内容`,textPlaceholder:`检查这次改动有没有 bug,有没有漏掉的测试。`,add:`[ 添加 ]`,save:`[ 保存 ]`,edit:`[ 编辑 ]`,cancel:`[ 取消 ]`,remove:`[ 删除 ]`,removed:`已删除 @{name}`,badName:`名称只能是字母、数字、- 或 _,最长 32 位。`,phone:{add:`添加片段`,save:`保存`,cancel:`取消`,remove:`删除片段`}}}})),kt=c({en:()=>At,zh:()=>jt}),At,jt,Mt=o((()=>{At={rail:{markNotice:`Task rows now start with the engine's icon. Change it in Settings → Appearance.`,markNoticeUndo:`Old look`,inbox:`inbox {count}`,empty:`no tasks yet`,skillCue:`skill missing`,newTask:`New task`,update:`Update`,settings:`Settings`,noProject:`Ungrouped`,connector:{weixin:`WeChat`,lark:`Lark`,inbox:`External messages`},expandGroup:`Expand {name}`,collapseGroup:`Collapse {name}`,reconnecting:`reconnecting`,extensions:`Extensions`,addExtension:`Add extension`,newTaskMode:{worktree:`worktree`,folder:`folder`},lastOpened:`Last opened`,state:{needs:`needs you`,working:`working`,ready:`ready`,idle:`idle`},extraRepos:`{count} more repos in this task`,extraReposOne:`1 more repo in this task`,todos:`{done} of {total} todos done`,todosOne:`{done} of 1 todo done`,startsAt:`Starts {time}`,pr:{state:{open:`open`,merged:`merged`,closed:`closed`},many:`{count} PRs in this task and its children`,checks:{conflict:`conflicts with its base`,failing:`checks failing`,passing:`checks passing`,pending:`checks running`}},searchPlaceholder:`fuzzy filter`,engineSwitched:`Engine → {engine} (applies on reopen)`,engineSwitchFailed:`could not switch engine: {error}`},inbox:{title:`inbox`,hints:`↑↓ move · enter open · d ack · esc close`,attention:`attention`,recent:`recent`,empty:`no pending attention`,send:`Send`,openTab:`[ open ]`,noOutput:`no output yet`,outputUnreadable:`couldn't read this tab's output`,replyPlaceholder:`reply to this session`,gateKept:`Saved; the engine isn't running and will get it with its next message.`,gateAnswer:`Answer`,phone:{title:`Inbox`,empty:`Nothing needs you right now.`,ackAll:`Ack all`,ack:`Ack`,open:`Open`,reply:`Reply`},state:{done:`done`,needsInput:`needs input`,error:`error`,rateLimited:`rate limited`,dead:`engine exited`,restored:`restored after restart`,routineFailed:`routine needs you`,decision:`needs a decision`,reportMissing:`report missing`}}},jt={rail:{markNotice:`任务行现在以引擎图标开头。可在设置 → 外观里更改。`,markNoticeUndo:`换回旧样式`,inbox:`收件箱 {count}`,empty:`还没有任务`,skillCue:`缺少技能`,newTask:`新建任务`,update:`更新`,settings:`设置`,noProject:`未分组`,connector:{weixin:`微信`,lark:`飞书`,inbox:`外部消息`},expandGroup:`展开{name}`,collapseGroup:`收起{name}`,reconnecting:`重连中`,extensions:`扩展`,addExtension:`添加扩展`,newTaskMode:{worktree:`worktree`,folder:`文件夹`},lastOpened:`上次打开`,state:{needs:`等你处理`,working:`进行中`,ready:`待收尾`,idle:`空闲`},extraRepos:`这个任务还含 {count} 个仓库`,extraReposOne:`这个任务还含 1 个仓库`,todos:`{done}/{total} 条待办已完成`,todosOne:`{done}/1 条待办已完成`,startsAt:`{time} 启动`,pr:{state:{open:`进行中`,merged:`已合并`,closed:`已关闭`},many:`这个任务及子任务共 {count} 个 PR`,checks:{conflict:`与基础分支冲突`,failing:`检查未通过`,passing:`检查已通过`,pending:`检查进行中`}},searchPlaceholder:`模糊搜索`,engineSwitched:`引擎 → {engine}(重新打开后生效)`,engineSwitchFailed:`切换引擎失败:{error}`},inbox:{title:`收件箱`,hints:`↑↓ 移动 · enter 打开 · d 已阅 · esc 关闭`,attention:`待处理`,recent:`最近使用`,empty:`暂无待处理`,send:`发送`,openTab:`[ 打开 ]`,noOutput:`还没有输出`,outputUnreadable:`读不到这个标签页的输出`,replyPlaceholder:`回复这个会话`,gateKept:`已记下;引擎没在运行,下次发消息时一并送达。`,gateAnswer:`回答`,phone:{title:`收件箱`,empty:`现在没有需要你处理的。`,ackAll:`全部已阅`,ack:`已阅`,open:`打开`,reply:`回复`},state:{done:`完成`,needsInput:`需要输入`,error:`出错`,rateLimited:`限流`,dead:`引擎已退出`,restored:`重启后已恢复`,routineFailed:`例行任务需要处理`,decision:`等你决定`,reportMissing:`未回报`}}}})),Nt=c({en:()=>Pt,zh:()=>Ft}),Pt,Ft,It=o((()=>{Pt={reviewQueue:{sourceIssues:`[ issues ]`,sourceReviews:`[ PRs waiting on me ]`,palette:`Review queue`,title:`PRs waiting on me`,empty:`No open PR asks for your review in your projects.`,other:`{count} more in projects Rove doesn't know.`,draft:`draft`,fork:`fork`,checksPassing:`checks passing`,checksFailing:`checks failing`,checksPending:`checks running`,start:`[ review ]`,preparing:`Fetching #{number}…`,failed:`Could not start the review of #{number}: {error}`,gh:{missing:"The `gh` CLI is not installed or not on PATH.",unauthenticated:"`gh` is not signed in: run `gh auth login` on this Mac.",failed:`GitHub could not be read just now. Press r to retry.`},prompt:`Review pull request #{number} in {repo}: {title}
|
|
10
|
+
{url}
|
|
11
|
+
|
|
12
|
+
This worktree is at the PR's head ({head}, going into {base}). Read the change against {base} (git diff origin/{base}...HEAD), then tell me what you find: bugs, risks, missing tests, anything unclear. Do not push, comment on or approve the PR; report here.`}},Ft={reviewQueue:{sourceIssues:`[ 议题 ]`,sourceReviews:`[ 等我评审的 PR ]`,palette:`评审队列`,title:`等我评审的 PR`,empty:`你的项目里没有等你评审的 PR。`,other:`另有 {count} 个在 Rove 不认识的项目里。`,draft:`草稿`,fork:`fork`,checksPassing:`检查通过`,checksFailing:`检查未通过`,checksPending:`检查进行中`,start:`[ 评审 ]`,preparing:`正在获取 #{number}…`,failed:`无法开始评审 #{number}:{error}`,gh:{missing:"没有安装 `gh` 命令行,或不在 PATH 中。",unauthenticated:"`gh` 未登录:请在这台 Mac 上运行 `gh auth login`。",failed:`暂时读不到 GitHub。按 r 重试。`},prompt:`评审 {repo} 的拉取请求 #{number}:{title}
|
|
13
|
+
{url}
|
|
14
|
+
|
|
15
|
+
这个 worktree 在该 PR 的头部({head},合入 {base})。对照 {base} 阅读改动(git diff origin/{base}...HEAD),然后告诉我你的发现:bug、风险、缺失的测试、不清楚的地方。不要推送、评论或批准这个 PR;在这里汇报。`}}})),Lt=c({en:()=>Rt,zh:()=>zt}),Rt,zt,Bt=o((()=>{Rt={runLog:{title:`Runs`,all:`all`,outcome:{ok:`ok`,blocked:`blocked`,failed:`failed`,skipped:`skipped`},source:{schedule:`schedule`,manual:`manual`,webhook:`webhook`,event:`event`},blocked:{"task-missing":`task is gone`,"awaiting-owner":`waiting on a decision`,"report-missing":`last run never reported`,quota:`rate limited`,"engine-error":`engine error`,"engine-dead":`engine stopped`,"awaiting-permission":`waiting on a permission`,busy:`still working`},blockedRun:`blocked: {reason}`,empty:`No runs match.`,more:`+{count} more`}},zt={runLog:{title:`运行记录`,all:`全部`,outcome:{ok:`成功`,blocked:`受阻`,failed:`失败`,skipped:`跳过`},source:{schedule:`定时`,manual:`手动`,webhook:`Webhook`,event:`事件`},blocked:{"task-missing":`任务已不存在`,"awaiting-owner":`等你做决定`,"report-missing":`上次运行没有汇报`,quota:`触发限流`,"engine-error":`引擎出错`,"engine-dead":`引擎已停止`,"awaiting-permission":`等你授权`,busy:`仍在运行`},blockedRun:`受阻:{reason}`,empty:`没有符合条件的运行。`,more:`另有 {count} 条`}}})),Vt,Ht,Ut=o((()=>{Vt={groupColours:`Colours`,groupTasks:`Tasks and panes`,taskColorsNote:`Gives each task its own hue on the working border and in the list.`,colorblindNote:`Shows added and removed lines in blue and red instead of green and red.`,workingBorderNote:`The pane's border while the selected task is working.`,railGroup:`Task list`,railGroupProject:`By project`,railGroupState:`By state`,statusMark:`Task status`,statusMarkEngine:`Engine icon`,statusMarkBoth:`Icon and dots`,statusMarkDots:`Dots only`,previewWorking:`Working`,previewDone:`Finished, unread`,previewIdle:`Idle`,previewWaiting:`Waiting for you`,previewBroken:`Broken`,previewTitle:`Fix the login redirect`,themePackageNote:`A theme package is a folder in the themes directory. Here it can also change layout and components; the TUI draws its colours. Edits show after a hard refresh.`,themeLastError:`Last error in {theme}`,themeSwitchDefault:`Switch to the default theme`,themeErrorBadge:`Theme package error`,themeErrorDetails:`Details`,themeInvalidHeading:`Themes that did not load:`},Ht={groupColours:`颜色`,groupTasks:`任务与面板`,taskColorsNote:`让每个任务在工作边框和列表里有自己的色调。`,colorblindNote:`新增和删除的行用蓝色和红色,而不是绿色和红色。`,workingBorderNote:`所选任务工作时,面板边框的样子。`,railGroup:`任务列表`,railGroupProject:`按项目`,railGroupState:`按状态`,statusMark:`任务状态`,statusMarkEngine:`引擎图标`,statusMarkBoth:`图标加点阵`,statusMarkDots:`只有点阵`,previewWorking:`正在跑`,previewDone:`完成未读`,previewIdle:`空闲`,previewWaiting:`等你回答`,previewBroken:`出错`,previewTitle:`修复登录跳转`,themePackageNote:`主题包是主题目录里的一个文件夹。在这里它还能改布局和组件;TUI 只画它的配色。改完硬刷新就能看到。`,themeLastError:`{theme} 最近一次错误`,themeSwitchDefault:`切回默认主题`,themeErrorBadge:`主题包出错`,themeErrorDetails:`查看详情`,themeInvalidHeading:`没能加载的主题:`}})),Wt,Gt,Kt=o((()=>{Wt={githubDescription:`Clone, push and open PRs on every machine with one GitHub account`,phone:`Phone`,phoneHint:`Open Rove on your phone, no VPN or tunnel to set up.`,phoneTitle:`Pair a phone`,phoneNote:`Scan with the phone's camera or the Rove iPhone app. It connects through Rove's relay, end-to-end encrypted.`,phoneShow:`Show QR code`,phoneHide:`Done`,phoneMaking:`Making a code`,phoneQrAlt:`QR code that pairs a phone with this computer`,phoneSecret:`Anyone who scans this code gets in, so show it only to your own phone.`,phoneDevice:`Scan it within 15 minutes. The phone pairs as {device} and shows in the list below once it connects, where you can forget it.`,phoneCopy:`Copy link`,phoneCopied:`Link copied`,phoneFailed:`Couldn't make a pairing code: {error}`,phoneUnknown:`Phone`,phoneConnected:`Connected now`,phoneLastSeen:`Last seen {time}`,phonePairedOn:`paired {date}`,phoneForget:`Forget`,phoneForgetBody:`This phone is signed out and its code stops working. To use it again, pair it again.`,phoneForgetFailed:`Couldn't forget the phone: {error}`,chat:`Chat`,chatHint:`Apps you can message Rove from. What you send goes to your own agent on this machine.`,chatSince:`Connected since {date}`,chatBot:`Bot`,chatAgent:`Session`,chatOpen:`Open`,chatAgentNotYet:`Starts with the first message`,chatAdd:`+ Add`,chatEdit:`Edit`,chatConnecting:`Connecting…`,chatNotConnected:`Not connected`,chatRunInTerminal:`Run {command} in a terminal on this machine.`,chatAllowed:`Allowed`,chatYou:`You`,chatYouNamed:`You ({name})`,chatAllowAdd:`Their id, then Enter`,chatRemove:`Remove {id}`,chatTone:`Tone`,chatDisconnectBody:`{name} stops reaching your agent on this machine. The agent's session stays. To connect again, run {command}.`,weixinName:`WeChat`,weixinDescription:`Talk to your own agent and check on tasks from your phone`,larkName:`Lark`,larkDescription:`DM or @ your own agent from Lark`,connect:`Connect`,disconnect:`Disconnect`,disconnectBody:`Signs this machine's gh out of GitHub, for every tool that uses gh and not only Rove. Other machines keep their own sign-ins.`,machines:`Machines`,thisMachine:`This machine`,machinesHint:`Each machine signs in to GitHub by itself. The mark says whether it uses the same account as this one.`,refresh:`Check again`,refreshing:`Checking…`,useRove:`Use Rove's account`,loginThere:`Log in there`,codeHint:`Enter this code at GitHub (click the code to copy it)`,openGithub:`Open github.com/login/device`,codeCopied:`Code copied`,syncing:`Signed in. Bringing the other machines along…`,loginFailed:`Sign-in failed: {error}`,dismiss:`Dismiss`,loading:`checking…`,markSame:`✓ same account`,markDifferent:`⚠ @{login}`,markSignedOut:`✗ signed out`,markNoGh:`gh is not installed`,markOutdated:`Rove there is outdated`,markOffline:`offline`,markDenied:`refuses credential changes`,markFailed:`could not check`,detail:`git over {protocol} · SSH key {ssh}`,synced:`{machine} now uses @{login}`,inbox:`Inbox`,inboxHint:`An end-to-end encrypted address outside agents can post to. Each message shows up under External messages in the sidebar, and starts an agent only if its token allows it; the relay in between can't read it.`,inboxTitle:`Encrypted inbox`,inboxNote:`Give a token to an agent you trust, like Grok Bot. What it sends reaches an agent only marked as untrusted.`,inboxNew:`New token`,inboxAddress:`Address`,inboxKey:`Key`,inboxToken:`Token`,inboxNone:`No tokens yet. The address is made with the first one.`,inboxRotate:`Rotate`,inboxRotateBody:`Makes a new address and key. Every sender stops reaching you until you give them the new ones. Tokens stay.`,inboxRotated:`New address made`,inboxRate:`Rate`,inboxRateValue:`{rate}, bursts of {burst}`,inboxDaily:`{daily} a day`,inboxExpires:`expires {date}`,inboxLastUsed:`Last used`,inboxNever:`Never`,inboxDay:`Last 24h`,inboxDayValue:`{accepted} delivered · {rejected} refused`,inboxRecent:`Recent`,inboxAccepted:`delivered`,inboxRefused:`refused: {reason}`,inboxRevoke:`Revoke`,inboxRevokeBody:`{name} stops working at once; whoever holds it gets 401.`,inboxMissingRoutine:`Its routine was deleted`,inboxFailed:`Couldn't load the inbox: {error}`,inboxDialogTitle:`New inbox token`,inboxName:`Name`,inboxId:`ID`,inboxIdAuto:`made from the name; lowercase letters, digits, - and _`,inboxPickRoutine:`What its messages can do`,inboxDeliverOnly:`Only show them to me`,inboxStartsAgent:`May start an agent`,inboxStartsRoutine:`May start routine: {name}`,inboxKeeps:`Shown only`,inboxBurst:`Burst`,inboxExpiry:`Expires`,inboxExpiryNever:`Never`,inboxExpiryDays:`In {days} days`,inboxCreate:`Create token`,inboxCreatedTitle:`Token {name}`,inboxCreated:`This is the only time the token is shown. Copy what you need before you close this.`,inboxCommand:`Try it`,inboxCopy:`Copy`,inboxCopied:`Copied`,inboxCopyPrompt:`Copy prompt for the agent`,inboxCopyPromptNote:`The prompt has everything the agent needs to send: installing age, the envelope, the limits and how to retry.`,inboxDone:`Done`},Gt={githubDescription:`用同一个 GitHub 账号在每台机器上克隆、推送和开 PR`,phone:`手机`,phoneHint:`在手机上打开 Rove,不用装 VPN,也不用配隧道。`,phoneTitle:`配对手机`,phoneNote:`用手机相机或 Rove iPhone App 扫码。连接经过 Rove 的中继,端到端加密。`,phoneShow:`显示二维码`,phoneHide:`完成`,phoneMaking:`正在生成`,phoneQrAlt:`把手机和这台电脑配对的二维码`,phoneSecret:`谁扫到这个码谁就能进来,只给你自己的手机看。`,phoneDevice:`请在 15 分钟内扫码。手机会以 {device} 的名字配对,连上之后出现在下方列表里,可以在那里移除。`,phoneCopy:`复制链接`,phoneCopied:`链接已复制`,phoneFailed:`生成配对码失败:{error}`,phoneUnknown:`手机`,phoneConnected:`当前在线`,phoneLastSeen:`上次在线 {time}`,phonePairedOn:`{date} 配对`,phoneForget:`移除`,phoneForgetBody:`这台手机会被登出,它的配对码也随之失效。要再用,重新配对即可。`,phoneForgetFailed:`移除手机失败:{error}`,chat:`聊天`,chatHint:`能给 Rove 发消息的应用。你发的消息会交给这台机器上你自己的智能体。`,chatSince:`{date} 起已连接`,chatBot:`机器人`,chatAgent:`会话`,chatOpen:`打开`,chatAgentNotYet:`收到第一条消息时开始`,chatAdd:`+ 添加`,chatEdit:`修改`,chatConnecting:`正在连接…`,chatNotConnected:`未连接`,chatRunInTerminal:`在这台机器的终端里运行 {command}。`,chatAllowed:`允许`,chatYou:`你`,chatYouNamed:`你({name})`,chatAllowAdd:`输入 id 后回车`,chatRemove:`移除 {id}`,chatTone:`语气`,chatDisconnectBody:`{name}的消息将不再交给这台机器上的智能体。智能体的会话会保留。要重新连接,运行 {command}。`,weixinName:`微信`,weixinDescription:`在手机上和你自己的智能体对话、查看任务`,larkName:`飞书 Lark`,larkDescription:`在飞书里私聊或 @ 你自己的智能体`,connect:`连接`,disconnect:`断开`,disconnectBody:`把这台机器的 gh 从 GitHub 退出登录,所有用 gh 的工具都会受影响,不只是 Rove。其他机器保持各自的登录。`,machines:`机器`,thisMachine:`本机`,machinesHint:`每台机器各自登录 GitHub。右边的标记表示它和本机用的是不是同一个账号。`,refresh:`重新检查`,refreshing:`检查中…`,useRove:`使用 Rove 的账号`,loginThere:`在那里登录`,codeHint:`到 GitHub 输入这个验证码(点击验证码可复制)`,openGithub:`打开 github.com/login/device`,codeCopied:`验证码已复制`,syncing:`已登录,正在同步其他机器…`,loginFailed:`登录失败:{error}`,dismiss:`关闭`,loading:`检查中…`,markSame:`✓ 同一账号`,markDifferent:`⚠ @{login}`,markSignedOut:`✗ 未登录`,markNoGh:`未安装 gh`,markOutdated:`那边的 Rove 版本过旧`,markOffline:`离线`,markDenied:`拒绝修改凭据`,markFailed:`无法检查`,detail:`git 走 {protocol} · SSH 密钥 {ssh}`,synced:`{machine} 现在使用 @{login}`,inbox:`收件箱`,inboxHint:`一个端到端加密的地址,外部 agent 可以往里投消息。每条消息出现在侧栏的「外部消息」里,只有 token 允许时才会启动 agent;中间的中继读不到内容。`,inboxTitle:`加密收件箱`,inboxNote:`把 token 交给你信任的 agent,比如 Grok Bot。它发来的内容交给 agent 时都会标明不可信。`,inboxNew:`新建 token`,inboxAddress:`地址`,inboxKey:`公钥`,inboxToken:`Token`,inboxNone:`还没有 token。建第一个时会一起生成地址。`,inboxRotate:`轮换`,inboxRotateBody:`生成新的地址和公钥。在你把新的交给发送方之前,所有发送方都投不进来。token 保留。`,inboxRotated:`已生成新地址`,inboxRate:`频率`,inboxRateValue:`{rate},突发 {burst} 条`,inboxDaily:`每天 {daily} 条`,inboxExpires:`{date} 过期`,inboxLastUsed:`最后使用`,inboxNever:`从未`,inboxDay:`最近 24 小时`,inboxDayValue:`收下 {accepted} · 拒绝 {rejected}`,inboxRecent:`最近投递`,inboxAccepted:`已收下`,inboxRefused:`拒绝:{reason}`,inboxRevoke:`吊销`,inboxRevokeBody:`{name} 立即失效;拿着它的发送方会收到 401。`,inboxMissingRoutine:`它的例行任务已被删除`,inboxFailed:`无法读取收件箱:{error}`,inboxDialogTitle:`新建收件箱 token`,inboxName:`名字`,inboxId:`ID`,inboxIdAuto:`留空按名字生成;小写字母、数字、- 和 _`,inboxPickRoutine:`它的消息能做什么`,inboxDeliverOnly:`只给我看`,inboxStartsAgent:`可以启动 agent`,inboxStartsRoutine:`可以启动例行任务:{name}`,inboxKeeps:`只展示`,inboxBurst:`突发`,inboxExpiry:`过期`,inboxExpiryNever:`不过期`,inboxExpiryDays:`{days} 天后`,inboxCreate:`创建 token`,inboxCreatedTitle:`Token {name}`,inboxCreated:`token 只在这里显示这一次。关掉之前把需要的都复制下来。`,inboxCommand:`试一下`,inboxCopy:`复制`,inboxCopied:`已复制`,inboxCopyPrompt:`复制给 agent 的提示词`,inboxCopyPromptNote:`提示词里有对方发送所需的一切:安装 age、信封格式、频率限制和重试方式。`,inboxDone:`完成`}})),qt=c({en:()=>Jt,zh:()=>Yt}),Jt,Yt,Xt=o((()=>{Ut(),Kt(),Jt={settings:{title:`Settings`,open:`settings`,sections:{connectors:`Connectors`,appearance:`Appearance`,notifications:`Notifications`,snippets:`Snippets`,about:`About`,voice:`Voice`},groups:{preferences:`Preferences`,agents:`Agents and tools`,more:`More`},pages:{general:`Language, layout, and where Rove opens files and creates worktrees.`,appearance:`Theme, colours, and how tasks and panes look.`,notifications:`When Rove tells you a task finished or needs you.`,keys:`Rebind chords in your own file, and how the prefix guide behaves.`,engines:`The coding agents Rove can start, and how it plugs into them.`,autoRouting:`What each depth tier starts, and who picks the tier.`,voice:`Dictation: the recognizer that turns what you say into prompts.`,connectors:`Accounts Rove uses, and apps you can message it from.`,plugins:`Built-in pages and registered plugins.`,about:`Versions, updates, and this browser.`,feedback:`Send a note to the Rove team.`,dev:`Experimental switches, restarts and resets.`,snippets:`Prompt text you reuse. Type @name in a prompt to insert it.`},loadFailed:`Couldn't load this: {error}`,retry:`Retry`,connectors:Wt,general:{groupInterface:`Interface`,tuiKeyHints:`Show shortcut reminders in the Rove terminal interface.`,groupFiles:`Worktrees`,groupTerminal:`Terminal`,tabStrip:`Tab strip`,scrollback:`Scrollback`},appearance:Vt,notifications:{toastNote:`A popup in the corner of this page.`,volume:`Chime volume`},about:{groupRove:`Rove`,computer:`Computer`,daemon:`Daemon`,daemonCurrent:`rove {version}, same build as this page`,daemonStale:"rove {version} is out of date; run `rove daemon restart`",updates:`Updates`,browser:`This browser`,browserHint:`Forget this browser's token. A login token is revoked on the host too.`,access:`Access`,signIn:`Sign-in`,signInMode:{open:`None`,password:`Password`,token:`Token link`},signInHint:{open:`A browser on this computer opens Rove with no link or password. Phones and other computers still need a token.`,password:`A browser without a token signs in with the password. Token links keep working.`,token:`Only the link rove printed, or a device token, gets in. Password sign-in is off.`},passwordSet:`Set a password`,passwordChange:`Change the password`,passwordHint:`At least {min} characters. It is stored hashed on this computer.`,passwordField:`New password`,passwordSave:`Save`,signOut:`Sign out`},engines:{enabled:`Offer {name} when picking an engine`,default:`Make {name} the default engine`,namePlaceholder:`Display name (blank = default)`,rename:`Rename`,reset:`Reset to defaults`,remove:`Remove engine`,save:`Save`,cancel:`Cancel`},plugins:{builtIn:`Built in`,builtInHint:`First-party pages. Turning one off removes its entry from the rail.`,registered:`Registered plugins`,empty:`No other plugins registered.`,linked:`linked`,unsupportedPlatform:`unsupported platform`,turnOn:`Install {name}`},feedback:{hint:"Files a public GitHub issue on the Rove repo, through `gh` on the machine running rove. Without a signed-in `gh` you get a prefilled link to open instead.",kindLabel:`Kind`,kindBug:`Bug`,kindIdea:`Idea`,kindQuestion:`Question`,prompt:`What went wrong, or what would you like Rove to do?`,draft:`Draft the issue`,fileAsIs:`File as-is`,note:`An agent adds your version and logs, shows you the draft and files it once you say OK. File as-is posts it now, titled by its first line.`,sent:`Filed issue #{number}`,notFiled:`Not filed yet. {hint}`,openLink:`Open the prefilled issue`,report:`Report a problem with an agent`,reportFailed:`Could not start the conversation.`,reportPrompt:"You are helping the user report a problem with Rove itself (not their own project) as a GitHub issue. First ask what they were doing and what felt wrong: one to three short questions, one at a time. Then collect context: run `rove --version` and `rove daemon status`, and read the last ~50 lines of `${ROVE_HOME_DIR:-$HOME}/.rove/daemon.log` only if the problem could involve the daemon. Draft an issue title and body (what happened, what they expected, steps, relevant output) and show it to the user. Only after they say OK, file it with a heredoc: `rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'` followed by the body and `EOF`. Then share the issue URL. If it prints a prefilled link instead (gh missing or signed out), give the user that link and tell them to run `gh auth login`.",reportGiven:`The user already wrote this, marked as {kind}. Start from it and ask only what it leaves out:
|
|
16
|
+
|
|
17
|
+
{text}`}},prefs:{languageHint:`Display language, shared with the TUI.`,soundHint:`chime, plus a desktop notification while this tab is in the background`,soundVolumeHint:`Plays the new level when you pick it.`,push:`Notify when this page is closed`,pushHint:`This browser gets a notification when a task finishes, needs you or fails, even with no Rove page open. Follows the cross-task switch.`,pushUnsupported:`This browser can't receive push here: it needs https (or localhost), and on iPhone/iPad the page added to the home screen.`,pushBlocked:`Notifications are blocked for this site; allow them in the browser's site settings.`,pushFailed:`Couldn't turn it on: {error}`,editInTui:`Edit it in the TUI.`,tierModel:`model`,tierEdit:`Edit`,tierEffort:`Reasoning effort`,classifierConnection:`Classifier connection`,unset:`(none)`,modeAuto:`Auto (follow the browser)`,themePreviewHint:`Point at a theme to see this page in it; click to keep it. The TUI follows.`,themeUser:`yours`,themePackage:`pkg`,themeInstalled:`Installed`,themeMoreHint:`Not installed yet: point to preview, click to install and switch.`,themeBrowse:`Browse {count} more from rove.run`,themeHide:`Hide themes from rove.run`,themeGet:`get`,themeInstalling:`installing…`,themeInstallFailed:`failed, retry`,themeTerminals:`From your terminals`,themeTerminalsHint:`Detected on this machine: point to preview, click to import and switch.`,themeImport:`import`,themeSync:`sync`,themeImporting:`importing…`,themeImportFailed:`failed, retry`,themeAgent:`Make one with an agent`,themeAgentHint:`opens a Scratch session; reopen Settings to see what it wrote.`,themeAgentFailed:`couldn't open the session; try again.`,themeAgentPrompt:"Make me a new Rove color theme. Ask me first what look I want, unless I already said. Save it as one JSON file in {dir} (for example {dir}/my-theme.json); the file name is the theme's name. The format is in https://github.com/sma1lboy/rove/blob/main/docs/themes.md and the JSON schema is https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/theme.schema.json. Start from https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove-core/src/theme/claude.json, give each color slot a { dark, light } pair, and keep text readable on every background. When it's saved, run `rove theme list` to check it loads, then tell me the name: it appears in Settings → Appearance.",resetButton:`Reset`,resetHint:`Clears this Mac's saved settings and task list, restarts the Rove daemon, then reloads this page. Worktrees on disk and engine session history are not touched.`,resetBody:`Wipes ~/.config/rove/state.json and ~/.rove/tasks.json and restarts the daemon, then reloads this page with an empty task list. Worktrees on disk and engine session history are NOT touched.`,restartButton:`Restart`,restartHint:`Stops the Rove daemon and starts a fresh one; this page reconnects on its own. Running engine sessions live in the PTY host and survive it.`,restartBody:`Stops the Rove daemon and starts a fresh one, picking up daemon edits. This page reconnects in a few seconds. Running engine sessions survive.`,keysYaml:`The file is read on the Mac; changes apply when you come back to this page.`},keys:{editHint:`Click a key to record a new one, then press the key you want. To put it behind the prefix, press the prefix key first. The × removes it.`,reset:`Reset`,recordFor:`Record a key for {name}`,removeFor:`Remove the key for {name}`,pluginNoTask:`Select a task before using a plugin chord.`,pluginChords:`Plugin chords`,agent:`Change them with an agent`,agentHint:`opens a Scratch session; reopen Settings to see what it changed.`,agentFailed:`couldn't open the session; try again.`,agentPrompt:"Change my Rove keybindings. Ask me first what I want changed, unless I already said. Edit {path} (create it if it is missing; keep existing entries and comments you were not asked to change). The format, every binding id and its default chord are in https://github.com/sma1lboy/rove/blob/main/docs/KEYBINDINGS.md (see Customizing). Only use binding ids listed there; a direct override replaces that binding's whole chord list, and null unbinds. The file must stay valid YAML: check it parses (for example with `ruby -ryaml -e 'YAML.load_file(ARGV[0])' {path}` or any YAML parser you have). Rove reloads it live, and unknown ids or invalid chords are ignored with a warning, so when you are done tell me what you changed and ask me to reopen Settings → Keybindings: it lists every applied override and every warning."},pages:{attachTooLarge:`{name} is larger than 500 MB`,new:`[ new ]`,newRoutine:`New routine`,newCard:`New issue`,deleteIssue:`Delete issue`,routinePause:`[ pause ]`,routineEnable:`[ enable ]`,delete:`[ delete ]`,routinesNeedYou:`NEEDS YOU`,routinesActive:`ACTIVE`,routinesPaused:`PAUSED`,routinesFilter:`Trigger mode`,routinesFilterAll:`All`,routinesFilterSchedule:`Schedule`,routinesFilterEvent:`Event`,laterStarts:`LATER`,laterCancel:`[ cancel ]`,laterFailed:`Did not start: {error}`,laterCancelFailed:`Could not cancel the start: {error}`,phone:{runNow:`Run now`,pause:`Pause`,enable:`Enable`,more:`More actions`,changeEngine:`Change engine`,deleteRoutine:`Delete routine`,lastRun:`Last run`,script:`Script`,prompt:`Prompt`,precheck:`Precheck`,responses:`Responses`,noResponses:`No run has reported back yet.`,viewNotes:`View release notes`,updateTo:`Update to v{version}`},routineTrigger:`Trigger`,routineEvents:`Events`,routineWebhook:`Webhook`,routineSchedule:`Schedule`,routineNext:`Next run`,routineProject:`Project`,routineDelivers:`Delivers to`,routineEngine:`Engine`,routineChangeEngine:`[ change ]`,routinePrompt:`PROMPT`,routineScript:`SCRIPT`,cronDown:`Decrease {field}`,cronUp:`Increase {field}`,storySave:`save`,storySaveStart:`save & start`,storyStart:`start`,attachHintTouch:`paste a path / a screenshot → inserts an image placeholder`}},Yt={settings:{title:`设置`,open:`设置`,sections:{connectors:`连接器`,appearance:`外观`,notifications:`通知`,snippets:`片段`,about:`关于`,voice:`语音`},groups:{preferences:`偏好`,agents:`智能体与工具`,more:`更多`},pages:{general:`语言、布局,以及 Rove 在哪里打开文件、创建 worktree。`,appearance:`主题、颜色,以及任务和面板的外观。`,notifications:`任务完成或需要你时,Rove 怎么提醒。`,keys:`在你自己的文件里重绑快捷键,以及前缀引导的行为。`,engines:`Rove 能启动的编码智能体,以及它如何接入它们。`,autoRouting:`每个深度档位启动什么,以及由谁选择档位。`,voice:`口述:把你说的话变成提示词的识别器。`,connectors:`Rove 使用的账号,以及能给它发消息的应用。`,plugins:`内置页面和已注册的插件。`,about:`版本、更新,以及此浏览器。`,feedback:`给 Rove 团队留一条意见。`,dev:`实验开关、重启和重置。`,snippets:`常用的提示词文本。在提示词里输入 @名称 即可插入。`},loadFailed:`没能读取:{error}`,retry:`重试`,connectors:Gt,general:{groupInterface:`界面`,tuiKeyHints:`在 Rove 终端界面显示快捷键提示。`,groupFiles:`Worktree`,groupTerminal:`终端`,tabStrip:`标签栏`,scrollback:`回滚行数`},appearance:Ht,notifications:{toastNote:`本页角落里的弹出提示。`,volume:`提示音音量`},about:{groupRove:`Rove`,computer:`电脑`,daemon:`守护进程`,daemonCurrent:`rove {version},与本页同一版本`,daemonStale:"rove {version} 版本过旧;运行 `rove daemon restart`",updates:`更新`,browser:`此浏览器`,browserHint:`忘掉此浏览器的令牌。登录得到的令牌也会在主机上吊销。`,access:`访问`,signIn:`登录方式`,signInMode:{open:`免登录`,password:`密码`,token:`Token 链接`},signInHint:{open:`本机浏览器不用链接或密码就能打开 Rove。手机和其他电脑仍然需要 token。`,password:`没有 token 的浏览器用密码登录。Token 链接照常可用。`,token:`只有 rove 打印的链接或设备 token 能进。密码登录关闭。`},passwordSet:`设置密码`,passwordChange:`修改密码`,passwordHint:`至少 {min} 个字符。以哈希形式存在本机。`,passwordField:`新密码`,passwordSave:`保存`,signOut:`退出登录`},engines:{enabled:`选引擎时列出 {name}`,default:`把 {name} 设为默认引擎`,namePlaceholder:`显示名称(留空 = 默认)`,rename:`重命名`,reset:`恢复默认`,remove:`移除引擎`,save:`保存`,cancel:`取消`},plugins:{builtIn:`内置`,builtInHint:`官方页面。关掉后,它在侧栏的入口会消失。`,registered:`已注册的插件`,empty:`没有其他已注册的插件。`,linked:`已链接`,unsupportedPlatform:`平台不支持`,turnOn:`安装 {name}`},feedback:{hint:"通过运行 rove 那台机器上的 `gh`,在 Rove 仓库提一个公开的 GitHub issue。没有登录 `gh` 时会给你一条预填好的链接。",kindLabel:`类型`,kindBug:`缺陷`,kindIdea:`想法`,kindQuestion:`问题`,prompt:`哪里不对,或者你想让 Rove 做什么?`,draft:`起草 issue`,fileAsIs:`直接提交`,note:`agent 会补上版本和日志,把草稿给你看,你说可以才提交。「直接提交」会马上提交,第一行当标题。`,sent:`已提交 issue #{number}`,notFiled:`还没提交。{hint}`,openLink:`打开预填好的 issue`,report:`让 agent 帮我报告问题`,reportFailed:`没能开始对话。`,reportPrompt:"你在帮用户把 Rove 本身的问题(不是他们自己项目的问题)提成一个 GitHub issue。先问清楚他们当时在做什么、哪里不对劲:一到三个简短的问题,一次问一个。然后收集上下文:运行 `rove --version` 和 `rove daemon status`,只有问题可能和 daemon 有关时才读 `${ROVE_HOME_DIR:-$HOME}/.rove/daemon.log` 的最后约 50 行。起草 issue 的标题和正文(发生了什么、期望什么、复现步骤、相关输出)并展示给用户。用户确认之后才提交,用 heredoc:`rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'`,接正文,最后一行 `EOF`。然后把 issue 链接发给用户。如果输出的是预填链接(没装 gh 或没登录),把链接给用户,并告诉他运行 `gh auth login`。",reportGiven:`用户已经写了下面这段,标记为 {kind}。从这段开始,只问它没说清的部分:
|
|
18
|
+
|
|
19
|
+
{text}`}},prefs:{languageHint:`显示语言,与 TUI 共用同一设置。`,soundHint:`提示音;本页在后台时另发桌面通知`,soundVolumeHint:`选中后会播放新音量。`,push:`页面关闭时也通知`,pushHint:`任务完成、需要你或出错时,即使没有打开任何 Rove 页面,这个浏览器也会收到通知。跟随「跨任务通知」开关。`,pushUnsupported:`这个浏览器在这里收不到推送:需要 https(或 localhost),iPhone/iPad 上还要先把页面添加到主屏幕。`,pushBlocked:`这个网站的通知被浏览器屏蔽了,去浏览器的网站设置里允许。`,pushFailed:`没能开启:{error}`,editInTui:`请在 TUI 中编辑`,tierModel:`模型`,tierEdit:`编辑`,tierEffort:`推理强度`,classifierConnection:`分类器连接`,unset:`(无)`,modeAuto:`自动(跟随浏览器)`,themePreviewHint:`鼠标指向一个主题,整页就换成它看看;点一下就定下来。TUI 也会跟着换。`,themeUser:`自装`,themePackage:`包`,themeInstalled:`已安装`,themeMoreHint:`尚未安装:指向即预览,点一下安装并切换。`,themeBrowse:`浏览 rove.run 上的另外 {count} 个主题`,themeHide:`收起 rove.run 的主题`,themeGet:`安装`,themeInstalling:`安装中…`,themeInstallFailed:`失败,重试`,themeTerminals:`从本机终端导入`,themeTerminalsHint:`在本机检测到:指向即预览,点一下导入并切换。`,themeImport:`导入`,themeSync:`同步`,themeImporting:`导入中…`,themeImportFailed:`失败,重试`,themeAgent:`让 agent 做一个`,themeAgentHint:`会开一个 Scratch 会话;做好后重新打开设置就能看到。`,themeAgentFailed:`会话没打开,再试一次。`,themeAgentPrompt:"帮我做一个新的 Rove 配色主题。先问我想要什么风格,除非我已经说过。把它存成 {dir} 下的一个 JSON 文件(比如 {dir}/my-theme.json),文件名就是主题名。格式说明见 https://github.com/sma1lboy/rove/blob/main/docs/themes.md,JSON schema 是 https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/theme.schema.json。以 https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove-core/src/theme/claude.json 为起点,每个颜色槽都给 { dark, light } 两个值,并保证文字在每种背景上都看得清。存好后运行 `rove theme list` 确认能加载,然后告诉我主题名:它会出现在 设置 → 外观 里。",resetButton:`重置`,resetHint:`清空这台 Mac 上保存的设置和任务列表,重启 Rove 守护进程,然后刷新本页。磁盘上的工作树和引擎会话历史不受影响。`,resetBody:`清空 ~/.config/rove/state.json 和 ~/.rove/tasks.json 并重启守护进程,然后刷新本页,任务列表为空。磁盘上的工作树和引擎会话历史不会被动。`,restartButton:`重启`,restartHint:`停止 Rove 守护进程并启动新的进程,本页会自动重连。运行中的引擎会话在 PTY 宿主里,不受影响。`,restartBody:`停止 Rove 守护进程并启动新的进程,载入守护进程的改动。本页几秒后自动重连,运行中的引擎会话不受影响。`,keysYaml:`该文件在 Mac 上读取,改动会在你回到本页时生效。`},keys:{editHint:`点一个按键开始录入,再按你想要的键。想放到 prefix 后面,就先按 prefix 键。× 是删掉它。`,reset:`恢复默认`,recordFor:`为「{name}」录入按键`,removeFor:`删掉「{name}」的按键`,pluginNoTask:`使用插件快捷键前请先选中一个任务。`,pluginChords:`插件快捷键`,agent:`让 agent 来改`,agentHint:`会开一个 Scratch 会话;改好后重新打开设置就能看到。`,agentFailed:`会话没打开,再试一次。`,agentPrompt:"帮我改 Rove 的快捷键。先问我想改什么,除非我已经说过。编辑 {path}(不存在就新建;没让你改的条目和注释都保留)。格式、每个 binding id 及其默认按键见 https://github.com/sma1lboy/rove/blob/main/docs/KEYBINDINGS.md(Customizing 一节)。只用那里列出的 binding id;直接覆盖会替换该 binding 的整个按键列表,null 表示解绑。文件必须保持合法 YAML:确认它能解析(比如 `ruby -ryaml -e 'YAML.load_file(ARGV[0])' {path}`,或任何你有的 YAML 解析器)。Rove 会实时重新加载它,未知 id 或无效按键会被忽略并给出警告,所以改完后告诉我改了什么,并请我重新打开 设置 → 快捷键:那里会列出所有生效的覆盖和所有警告。"},pages:{attachTooLarge:`{name} 超过 500 MB`,new:`[ 新建 ]`,newRoutine:`新建例行任务`,newCard:`新建议题`,deleteIssue:`删除议题`,routinePause:`[ 暂停 ]`,routineEnable:`[ 启用 ]`,delete:`[ 删除 ]`,routinesNeedYou:`需要处理`,routinesActive:`运行中`,routinesPaused:`已暂停`,routinesFilter:`触发类型`,routinesFilterAll:`全部`,routinesFilterSchedule:`定时`,routinesFilterEvent:`事件`,laterStarts:`稍后启动`,laterCancel:`[ 取消 ]`,laterFailed:`没有启动:{error}`,laterCancelFailed:`取消失败:{error}`,phone:{runNow:`立即运行`,pause:`暂停`,enable:`启用`,more:`更多操作`,changeEngine:`更换引擎`,deleteRoutine:`删除例行任务`,lastRun:`上次运行`,script:`脚本`,prompt:`提示词`,precheck:`预检`,responses:`回报`,noResponses:`还没有运行回报。`,viewNotes:`查看发布说明`,updateTo:`更新到 v{version}`},routineTrigger:`触发方式`,routineEvents:`事件源`,routineWebhook:`Webhook`,routineSchedule:`调度`,routineNext:`下次执行`,routineProject:`项目`,routineDelivers:`投递到`,routineEngine:`引擎`,routineChangeEngine:`[ 更换 ]`,routinePrompt:`提示词`,routineScript:`脚本`,cronDown:`减小{field}`,cronUp:`增大{field}`,storySave:`保存`,storySaveStart:`保存并启动`,storyStart:`启动`,attachHintTouch:`粘贴路径 / 截图 → 插入图片占位行`}}})),Zt=c({en:()=>Qt,zh:()=>$t}),Qt,$t,en=o((()=>{Qt={transcript:{you:`You`,agent:`Agent`,system:`System`,copy:`[ copy ]`,copied:`Copied`,export:`[ export .md ]`,findPlaceholder:`Find in this conversation`,findCount:`{at} / {total}`,findNone:`no match`,prev:`[ prev ]`,next:`[ next ]`,older:`[ load earlier ]`,loading:`Reading the conversation…`,empty:`Nothing said yet.`,failed:`failed`,tools:`{count} tool calls`,toolsFailed:`{count} failed`,error:`Could not read the conversation: {error}`,retry:`[ retry ]`,noHistory:`This engine keeps no history Rove can read. Showing its terminal tail.`,tail:`Terminal tail`}},$t={transcript:{you:`你`,agent:`智能体`,system:`系统`,copy:`[ 复制 ]`,copied:`已复制`,export:`[ 导出 .md ]`,findPlaceholder:`在这段对话中查找`,findCount:`{at} / {total}`,findNone:`没有匹配`,prev:`[ 上一个 ]`,next:`[ 下一个 ]`,older:`[ 加载更早 ]`,loading:`正在读取对话…`,empty:`还没有对话内容。`,failed:`失败`,tools:`{count} 次工具调用`,toolsFailed:`{count} 次失败`,error:`读不到这段对话:{error}`,retry:`[ 重试 ]`,noHistory:`这个引擎没有 Rove 能读取的历史记录,显示的是它的终端末尾。`,tail:`终端末尾`}}})),tn=c({en:()=>nn,zh:()=>rn}),nn,rn,an=o((()=>{nn={usage:{title:`Usage`,receipt:`Usage receipt`,total:`Total tokens`,thanks:`Thank you, burn again soon`,open:`Open usage`,range:`last {days} days · tokens are input + output`,perDay:`Per day`,byModel:`By engine and model`,topTasks:`Top tasks`,quota:`Quota`,turns:`{count} turns`,turnsOne:`1 turn`,loading:`Loading…`,empty:`No turns recorded in this window.`,failed:`Could not read usage: {error}`,cutoff:`The daemon returns at most {count} turns: {day} and earlier are partial.`,noReader:`{engines}: no turn reader, so their work is not counted here.`,removedTask:`(removed task)`,full:`at this pace full around {time}, before it resets`,lasts:`at this pace it lasts until the reset`}},rn={usage:{title:`用量`,receipt:`用量小票`,total:`合计 token`,thanks:`谢谢惠顾,欢迎再烧`,open:`打开用量`,range:`最近 {days} 天 · token 为输入加输出`,perDay:`按天`,byModel:`按引擎和模型`,topTasks:`用量最高的任务`,quota:`额度`,turns:`{count} 轮`,turnsOne:`1 轮`,loading:`加载中…`,empty:`这段时间没有记录到任何一轮。`,failed:`无法读取用量:{error}`,cutoff:`守护进程最多返回 {count} 轮:{day} 及更早的数据不完整。`,noReader:`{engines}:没有轮次读取器,这里不统计它们的工作。`,removedTask:`(已删除的任务)`,full:`按当前速度约 {time} 用完,早于重置时间`,lasts:`按当前速度可撑到重置`}}})),on=c({en:()=>sn,zh:()=>cn}),sn,cn,ln=o((()=>{sn={voice:{say:`Say`,stop:`Stop {time}`,release:`Release {time}`,working:`Hearing…`,hint:`Dictate: tap to start and stop, or hold to talk and let go`,slideToEdit:`Slide up to edit`,tipEdit:`Let go to edit`,hold:`Hold to talk`,holdOrType:`Hold to talk, tap to type`,sending:`Sending what you said…`,failed:`Dictation failed: {error}`,learned:`Learned {pairs}`,learnedPair:`{spoken} → {term}`,undo:`undo`,unlearned:`Forgotten`,unlearnFailed:`Couldn't undo: the voice sidecar isn't answering`,setup:{dictation:`Dictation`,backend:{off:`Off`,local:`On this Mac`,cloud:`Cloud`},unavailable:`This Rove cannot set up dictation`,offHint:`The mic is hidden. Nothing runs in the background.`,localNeeded:`Install the model below; the mic shows once it is ready.`,localInstalling:`Installing the model; the mic shows once it is ready.`,cloudNeeded:`Save an endpoint below to turn dictation on.`,ready:`{model} · ready`,starting:`Starting…`,localTitle:`Whisper large-v3`,localHint:`Runs on this Mac's GPU, about 3.5 GB to download. Audio never leaves the Mac.`,install:`Install`,installing:`Installing…`,installed:`Installed, about 4 GB on disk.`,failed:`Install failed: {line}`,uninstall:`Uninstall`,uninstallAsk:`Remove the model?`,cancel:`Cancel`,cloudTitle:`Cloud endpoint`,cloudHint:`Any OpenAI-compatible /audio/transcriptions service. The audio and your terms go there; the key stays on the Mac.`,baseURL:`Base URL`,model:`Model`,apiKey:`API key`,keySaved:`Saved; leave empty to keep it`,save:`Save`,saveAndUse:`Save and use`,forget:`Forget`,forgetAsk:`Remove the endpoint and its key?`}}},cn={voice:{say:`说`,stop:`停 {time}`,release:`松手 {time}`,working:`在听…`,hint:`口述:点一下开始、再点一下结束,或按住说话、松手结束`,slideToEdit:`上滑编辑`,tipEdit:`松手编辑`,hold:`按住说话`,holdOrType:`按住说话,轻点打字`,sending:`正在发送刚才说的话…`,failed:`口述失败:{error}`,learned:`记住了 {pairs}`,learnedPair:`{spoken} → {term}`,undo:`撤销`,unlearned:`已撤销`,unlearnFailed:`没能撤销:语音服务没有响应`,setup:{dictation:`语音输入`,backend:{off:`关闭`,local:`本机`,cloud:`云端`},unavailable:`这个 Rove 无法设置语音输入`,offHint:`不显示麦克风,后台也不运行任何东西。`,localNeeded:`在下面安装模型,就绪后显示麦克风。`,localInstalling:`正在安装模型,就绪后显示麦克风。`,cloudNeeded:`在下面保存一个服务地址后开启。`,ready:`{model} · 就绪`,starting:`启动中…`,localTitle:`Whisper large-v3`,localHint:`在这台 Mac 的 GPU 上运行,约需下载 3.5 GB。音频不离开这台 Mac。`,install:`安装`,installing:`安装中…`,installed:`已安装,约占 4 GB 磁盘。`,failed:`安装失败:{line}`,uninstall:`卸载`,uninstallAsk:`删除模型?`,cancel:`取消`,cloudTitle:`云端服务`,cloudHint:`任何兼容 OpenAI /audio/transcriptions 的服务。音频和你的术语会发到那里;密钥只存在这台 Mac 上。`,baseURL:`Base URL`,model:`模型`,apiKey:`API 密钥`,keySaved:`已保存;留空则保留原密钥`,save:`保存`,saveAndUse:`保存并使用`,forget:`删除`,forgetAsk:`删除这个服务地址和密钥?`}}}})),un=c({en:()=>dn,zh:()=>fn}),dn,fn,pn=o((()=>{dn={workspace:{pickTask:`pick a task on the left`,noTabs:`no open sessions in this task`,external:{toAgent:`[ give to an agent ]`},archived:`Archived`,archivedNote:`no live terminal; unarchive to reopen it`,startEngine:`Start {engine}`,startSession:`Start session`,tabNotLive:`this tab has no running session`,restored:`restored session, read-only until reopened`,exited:`session ended (exit {code})`,exitedNoCode:`session ended`,attachFailed:`could not open this session: {message}`,reopen:`Reopen session`,reopening:`Reopening…`,reopenFailed:`could not reopen this session: {message}`,engineExited:`engine exited (code {code})`,engineExitedNoCode:`engine exited`,retry:`Retry`,engineSettings:`Settings → Engines`,usageLimitUntil:`usage limit reached — rove resumes this task at {time}`,resumeQuota:`resume now`,resumingQuota:`resuming…`,usageLimit:`usage limit reached`,dismiss:`Dismiss`,openTask:`Open`},tab:{shell:`shell`,engine:`engine`},firstRun:{title:`All your coding agents, in one place`,body:`When one runs out of quota, switch the task to another. Agents talk to each other directly, and every task gets its own worktree and branch.`,start:`Start your first task`,engineFound:`Agent installed: {list}`,engineMissing:`No coding agent is installed on this computer`,engineFix:`Set up an agent`,loginFound:`Signed in: {list}`,loginUnknown:`Ready to run, sign-in not checked: {list}`,loginMissing:`Not signed in: {list}`,loginWaiting:`Sign in to an agent`,loginFix:`Sign in to {name}`,loginFixTouch:`To sign in, run {command} in a terminal on the computer Rove runs on.`,projectFound:`Project: {name}`,projectMissing:`No project picked yet`,projectFix:`Pick a project`},status:{connecting:`connecting`,retrying:`reconnecting, attempt {count}`,retry:`retry now`,backlog:`Backlog`,inProgress:`In progress`,inReview:`In review`,done:`Done`,canceled:`Canceled`,error:`Error`},connect:{title:`open the link rove printed`,body:"Run `rove --web` and open the link it prints, or paste it here.",placeholder:`http://127.0.0.1:7878/#token=…`,submit:`connect`,invalid:"that is not a `rove --web` link",failing:"can't reach rove. Is `rove --web` still running? After `--rotate-token`, open the new link.",forget:`forget this link`,notConnected:`not connected to rove — reconnecting (the view refreshes on its own)`},relay:{unpaired:"open the relay link that `rove --web --preset relay` printed on your computer",connecting:`connecting to your computer through the relay…`,loading:`loading rove…`,offline:"your computer is not answering on this relay. Is `rove --web --preset relay` still running? After `--rotate-relay`, open the new link. Reload to retry.",failed:`can't reach your computer through the relay ({error}). Reload to retry.`,switchComputer:`switch computer or pair again`,details:`details`,copy:`copy details`,copied:`copied`,detail:{relay:`relay`,code:`pairing code`,error:`error`,close:`closed with`,hint:`likely cause`,at:`failed at`,lastOk:`last connected`,never:`never on this device`}},login:{title:`sign in`,body:`Enter this Rove's password.`,field:`password`,submit:`sign in`,checking:`checking…`,wrong:`that did not work`,locked:`too many tries from here; try again in {minutes} min`,lockedHost:"password login is locked; run `rove --web --unlock` on the host",unreachable:"can't reach rove. Is `rove --web` still running?"},layout:{splitTooSmall:`Not enough room to split here`,railFold:`Fold the task list`,navBack:`Back`,navForward:`Forward`,railUnfold:`Unfold the task list`,dropUploading:`Uploading {name}…`,pasteNoImage:`No image on this browser's clipboard`,pasteNoAccess:`Can't read this browser's clipboard: {error}`,pasteNeedsHttps:`the page needs https or localhost`,refreshRove:`Refresh Rove`,refreshConfirm:`Rove will restart the daemon and reconnect. Your running sessions will keep going.`,refreshVersions:`bridge {bridge} · daemon {daemon}`,unknownVersion:`unknown`,refreshTimeout:"The daemon did not come back on the new build in time; check `rove daemon status`",railResize:`Drag to resize the task list, click to fold it, double-click to reset`,composerPlaceholder:`Message the agent`,composerAttach:`Attach a file`,composerDrop:`Drop to attach`,composerNotSent:`Not sent: {reason}`,composerOldBridge:`This Mac's rove --web is older than this page; restart it to send from here.`,composerAtMenu:`The agent is waiting on a choice. Answer it with the 1–4 and ⏎ keys below; your message is kept.`,termKeys:`Terminal keys`,termKeyUp:`Up arrow`,termKeyDown:`Down arrow`,termKeyLeft:`Left arrow`,termKeyRight:`Right arrow`,termKeyInterrupt:`Ctrl+C, interrupt`,termKeyEnter:`Enter`,termKeyMore:`More keys`,termKeyHideKeyboard:`Hide keyboard`,narrowTerminal:`Terminal`,narrowViews:`Views`}},fn={workspace:{pickTask:`从左边选一个任务`,noTabs:`这个任务没有打开的会话`,external:{toAgent:`[ 交给 agent 分析 ]`},archived:`已归档`,archivedNote:`没有在运行的终端,取消归档后重新打开`,startEngine:`启动 {engine}`,startSession:`启动会话`,tabNotLive:`这个标签没有在运行的会话`,restored:`已恢复的会话,重新打开前只读`,exited:`会话已结束(退出码 {code})`,exitedNoCode:`会话已结束`,attachFailed:`打不开这个会话:{message}`,reopen:`重新打开会话`,reopening:`正在重新打开…`,reopenFailed:`重新打开失败:{message}`,engineExited:`引擎已退出(退出码 {code})`,engineExitedNoCode:`引擎已退出`,retry:`重试`,engineSettings:`设置 → 引擎`,usageLimitUntil:`已达到用量上限 —— rove 会在 {time} 自动继续这个任务`,resumeQuota:`现在继续`,resumingQuota:`正在继续…`,usageLimit:`已达到用量上限`,dismiss:`忽略`,openTask:`打开`},tab:{shell:`终端`,engine:`引擎`},firstRun:{title:`所有编程 agent,都在一个地方`,body:`一个额度用完了,换另一个接着干;agent 之间直接对话。每个任务有独立的 worktree 和分支,互不覆盖。`,start:`开始第一个任务`,engineFound:`已安装 agent:{list}`,engineMissing:`这台电脑上还没有安装编程 agent`,engineFix:`设置 agent`,loginFound:`已登录:{list}`,loginUnknown:`可以运行,登录状态读不到:{list}`,loginMissing:`还没登录:{list}`,loginWaiting:`登录一个 agent`,loginFix:`登录 {name}`,loginFixTouch:`要登录,请在运行 Rove 的那台电脑的终端里运行 {command}。`,projectFound:`项目:{name}`,projectMissing:`还没有选项目`,projectFix:`选一个项目`},status:{connecting:`连接中`,retrying:`重连中,第 {count} 次`,retry:`立即重试`,backlog:`待办`,inProgress:`进行中`,inReview:`待评审`,done:`已完成`,canceled:`已取消`,error:`出错`},connect:{title:`打开 rove 打印的链接`,body:"运行 `rove --web`,打开它打印的链接,或者把链接粘贴到这里。",placeholder:`http://127.0.0.1:7878/#token=…`,submit:`连接`,invalid:"这不是 `rove --web` 打印的链接",failing:"连不上 rove。`rove --web` 还在运行吗?用过 `--rotate-token` 的话,请打开新的链接。",forget:`忘掉这个链接`,notConnected:`没有连上 rove,正在重连(连上后这里会自动刷新)`},relay:{unpaired:"打开电脑上 `rove --web --preset relay` 打印的 relay 链接",connecting:`正在通过 relay 连接你的电脑…`,loading:`正在加载 rove…`,offline:"你的电脑没有在这个 relay 上应答。`rove --web --preset relay` 还在运行吗?用过 `--rotate-relay` 的话,请打开新的链接。刷新重试。",failed:`无法通过 relay 连到你的电脑({error})。刷新重试。`,switchComputer:`换一台电脑或重新配对`,details:`详情`,copy:`复制详情`,copied:`已复制`,detail:{relay:`relay`,code:`配对码`,error:`错误`,close:`关闭码`,hint:`可能原因`,at:`失败时间`,lastOk:`上次连上`,never:`这台设备从未连上`}},login:{title:`登录`,body:`输入这台 Rove 的密码。`,field:`密码`,submit:`登录`,checking:`验证中…`,wrong:`登录失败`,locked:`这里尝试次数过多;{minutes} 分钟后再试`,lockedHost:"密码登录已锁定;在主机上运行 `rove --web --unlock`",unreachable:"连不上 rove。`rove --web` 还在运行吗?"},layout:{splitTooSmall:`这里放不下分屏了`,railFold:`折叠任务列表`,navBack:`后退`,navForward:`前进`,railUnfold:`展开任务列表`,dropUploading:`正在上传 {name}…`,pasteNoImage:`浏览器剪贴板里没有图片`,pasteNoAccess:`读不到浏览器剪贴板:{error}`,pasteNeedsHttps:`页面要走 https 或 localhost`,refreshRove:`刷新 Rove`,refreshConfirm:`Rove 会重启守护进程并重新连接。正在运行的会话会继续。`,refreshVersions:`桥接服务 {bridge} · 守护进程 {daemon}`,unknownVersion:`版本未知`,refreshTimeout:"守护进程没能及时以新版本重新上线,请检查 `rove daemon status`",railResize:`拖动调整任务列表宽度,单击折叠,双击还原`,composerPlaceholder:`给 agent 发消息`,composerAttach:`附加文件`,composerDrop:`松手即可附加`,composerNotSent:`没发出去:{reason}`,composerOldBridge:`这台 Mac 上的 rove --web 比页面旧,重启它之后才能从这里发送。`,composerAtMenu:`agent 正在等你选择。用下方的 1–4 和 ⏎ 键回答;你的消息已保留。`,termKeys:`终端按键`,termKeyUp:`上方向键`,termKeyDown:`下方向键`,termKeyLeft:`左方向键`,termKeyRight:`右方向键`,termKeyInterrupt:`Ctrl+C 中断`,termKeyEnter:`回车`,termKeyMore:`更多按键`,termKeyHideKeyboard:`收起键盘`,narrowTerminal:`终端`,narrowViews:`视图`}}}));function mn(){try{let e=JSON.parse(localStorage.getItem(`rove.prefs`)??`null`);if(e&&typeof e==`object`&&`prefs`in e){let t=e.prefs;if(t&&typeof t==`object`&&`locale`in t&&(t.locale===`en`||t.locale===`zh`))return t.locale}}catch{}return globalThis.navigator?.language?.toLowerCase().startsWith(`zh`)?`zh`:`en`}function hn(){let e=typeof document>`u`?void 0:document.documentElement;e&&(e.lang=Cn.get()===`zh`?`zh-CN`:`en`)}function gn(e,t){let n=e;for(let e of t.split(`.`)){if(!n||typeof n!=`object`||!(e in n))return;n=Reflect.get(n,e)}return typeof n==`string`?n:void 0}function _n(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}function U(e,t){let n=t?.count===1?`${e}One`:null;return _n((n&&(gn(Sn[Cn.get()],n)??gn(bn,n))||gn(Sn[Cn.get()],e))??gn(bn,e)??e,t)}function vn(e,t,n){return _n(gn(e[Cn.get()],t)??gn(e.en,t)??t,n)}function W(){return k(Cn)}var yn,bn,xn,Sn,Cn,G=o((()=>{A(),it(),ct(),ft(),gt(),bt(),wt(),Ot(),Mt(),It(),Bt(),Xt(),en(),an(),ln(),pn(),yn=[kt,un,pt,xt,qt,at,Tt,Lt,tn,Zt,_t,tt,Nt,lt,on],bn=Object.assign({},...yn.map(e=>e.en)),xn=Object.assign({},...yn.map(e=>e.zh)),Sn={en:bn,zh:xn},Cn=O(mn()),hn(),Cn.subscribe(hn)}));G();function wn(e){let t=e.trim(),n=t.indexOf(`#`),r=n>=0?new URLSearchParams(t.slice(n+1)).get(`token`):t;return r&&/^[A-Za-z0-9_-]{43}$/.test(r)?r:null}var Tn=(...e)=>e.filter(Boolean).join(` `),En,Dn,On,kn,An,jn,Mn,Nn,Pn=o((()=>{En=`border-hairline backdrop-blur-md backdrop-saturate-150 [box-shadow:inset_0_1px_0_color-mix(in_srgb,white_14%,transparent),var(--shadow-popover)] opaque:backdrop-filter-none`,Dn={neutral:`border-[color-mix(in_srgb,var(--ink)_12%,transparent)] bg-[color-mix(in_srgb,var(--inset)_60%,transparent)] opaque:bg-inset`,on:`border-accent bg-[color-mix(in_srgb,var(--inset)_60%,transparent)] opaque:bg-inset`},On=(e=`neutral`)=>`${En} ${Dn[e]}`,kn=`rounded-[12px]`,An=`rounded-[14px]`,jn=`transition-transform duration-120 active:scale-95 motion-reduce:transition-none motion-reduce:active:scale-none`,Mn=`enabled:hover:bg-[linear-gradient(var(--hover),var(--hover))]`,Nn=`group-enabled/glass:group-hover/glass:bg-[linear-gradient(var(--hover),var(--hover))]`})),Fn,In,Ln,Rn,zn,Bn,Vn,Hn,Un,Wn,Gn,Kn,qn,Jn,Yn,Xn,Zn,Qn,$n,er,tr,nr,rr,ir,ar,or,sr,cr,lr,ur,dr,fr,pr,mr,hr,gr,_r,vr,yr,br,xr,Sr,Cr,wr,Tr,Er,Dr,Or,kr,Ar,jr,Mr,Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,Vr,Hr,Ur=o((()=>{Pn(),Fn={railRight:`rail-open:[border-right:var(--hairline)_solid_var(--line-faint)]`,panelLeft:`wide:[border-left:var(--hairline)_solid_var(--line-faint)] panel-expanded:[border-left:0]`,dividerBefore:`before:absolute before:inset-y-0 before:left-[calc(var(--divider)/2)] before:[border-left:var(--hairline)_solid_var(--line-faint)] before:content-[''] hover:before:border-l-line-active active:before:border-l-line-active`},In=`text-meta leading-[inherit]`,Ln=`font-normal normal-nums`,Rn=`touch:relative touch:after:absolute touch:after:content-['']`,zn=`flex h-full flex-col`,Bn=e=>[`app relative grid min-h-0 flex-1 grid-rows-[1fr_auto] transition-[grid-template-columns] duration-220 ease-snap motion-reduce:transition-none`,e.surface?`is-narrow narrow-${e.surface} grid-cols-[minmax(0,1fr)]`:e.panel?`grid-cols-[var(--rail-w,minmax(220px,280px))_minmax(0,1fr)_minmax(0,var(--panel-w,33%))]`:`grid-cols-[var(--rail-w,minmax(220px,280px))_1fr]`,e.expanded?`is-panel-expanded`:``,e.folded?`is-rail-folded`:``,e.peek?`is-rail-peek`:``,e.dragging?`is-dragging transition-none`:``].join(` `),Vn=[`relative narrow-content:hidden narrow-back:col-1 narrow-back:row-1 touch:select-none touch:touch-callout-none`,`wide:overflow-x-clip wide:pt-8.5 wide:[&>:not([data-grip])]:min-w-(--rail-open-w)`,`rail-open:bg-sidebar ${Fn.railRight}`,`rail-folded:absolute rail-folded:inset-y-1.5 rail-folded:left-1.5 rail-folded:z-6 rail-folded:col-1 rail-folded:row-1 rail-folded:box-border rail-folded:w-(--rail-open-w) rail-folded:-translate-x-[calc(100%+12px)] rail-folded:rounded-md rail-folded:border-hairline rail-folded:border-line rail-folded:bg-surface rail-folded:shadow-none rail-folded:transition-[translate] rail-folded:duration-200 rail-folded:ease-snap rail-folded:motion-reduce:transition-none rail-folded:[&>:not([data-grip])]:min-w-0`,`rail-peek:translate-none rail-peek:shadow-dialog`].join(` `),Hn=`rail-folded:col-2 panel-expanded:invisible panel-expanded:col-2 narrow-sidebar:hidden narrow-content:motion-safe:animate-push-in narrow-back:motion-safe:animate-push-in narrow-back:z-1 narrow-back:col-1 narrow-back:translate-x-(--back-x) narrow-back:bg-paper narrow-back:shadow-dialog`,Un=`${Fn.panelLeft} rail-folded:col-3 panel-expanded:z-2 panel-expanded:col-[2/-1] panel-expanded:bg-paper panel-expanded:pl-2`,Wn=`${Rn} touch:after:-inset-x-1.5 touch:after:-inset-y-3`,Gn=e=>`shortcut-badge absolute top-1/2 z-8 -translate-y-1/2 cursor-pointer rounded-sm border-hairline border-accent bg-surface px-1.25 py-px text-meta text-accent ${e?`right-full mr-1.5`:`right-1`}`,Kn=`relative min-w-0 flex-1`,qn={left:[`[border-left:var(--hairline)_solid_var(--line)]`,`[border-left:var(--hairline)_solid_var(--accent)]`],top:[`[border-top:var(--hairline)_solid_var(--line)]`,`[border-top:var(--hairline)_solid_var(--accent)]`]},Jn=(e,t)=>qn[e][+!!t],Yn=(e,t)=>{let n=`split-leaf absolute box-border flex min-h-0 min-w-0 ${t.active?`is-active`:``} ${e!==null&&e!==`rule`?`pt-5`:``}`,r=t.active?`border-accent`:``;return e===`box`?`${n} rounded-[calc(var(--radius)-1px)] border-hairline ${t.active?`border-accent`:`border-line`}`:e===`line`?`${n} ${t.left?Jn(`left`,t.active):``} ${t.top?Jn(`top`,t.active):``} ${t.left||t.top?r:``}`:e===`rail`?`${n} ${Jn(`left`,t.active)} ${r} ${t.top?`[--mt:6px]`:``}`:e===`rule`?`${n} ${Jn(`top`,t.active)} ${r} ${t.left?`[--ml:8px]`:``}`:n},Xn=(e,t)=>`absolute right-2 z-3 bg-paper px-1 font-mono text-meta ${Ln} ${e?`-top-2`:`top-0.5`} ${t?`text-accent`:`text-subtle`}`,Zn=`mx-0.5 mb-1.5 keyboard:mb-0 hidden gap-2 keyboard:gap-0 overflow-x-auto scrollbar-none rounded-[14px] px-px py-0.5 touch:flex ${On()}`,Qn={off:`bg-transparent text-ink`,on:`bg-accent-soft text-accent`,hint:`relative bg-transparent text-accent after:absolute after:top-2 after:right-2 after:size-1.5 after:rounded-full after:bg-accent after:content-['']`},$n=e=>`h-11 min-w-11 touch-manipulation [flex:1_1_0] ${kn} px-0.5 py-0 font-mono text-[15px] ${Ln} ${jn} active:bg-[color-mix(in_srgb,var(--ink)_14%,transparent)] ${Qn[e]}`,er=`prefix-guide fixed bottom-19 left-[calc(var(--rail-w,0px)+12px)] z-40 max-h-[60vh] w-[min(560px,calc(100vw-var(--rail-w,0px)-24px))] overflow-y-auto rounded-sm border-hairline border-line bg-surface px-3 py-2 text-meta shadow-popover motion-safe:animate-rise-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-sink-out`,tr=`min-w-[3ch] text-accent`,nr=`mb-1.5 flex justify-between gap-4`,rr=`columns-[2_220px] gap-x-5`,ir=`mb-2 break-inside-avoid`,ar=`flex w-full gap-2.5 px-0 py-px text-left text-ink enabled:hover:bg-hover disabled:cursor-default touch:py-2.5`,or=`mx-0 my-2 overflow-x-hidden overflow-y-auto scrollbar-none`,sr=e=>`flex w-full min-w-0 justify-between gap-4 rounded-sm px-1.5 py-0.75 text-left font-mono text-meta ${Ln} whitespace-pre text-ink touch:py-2.5 ${e?`is-selected bg-hover`:``}`,cr=`min-w-0 overflow-hidden text-ellipsis`,lr=`w-full rounded-none border-0 [border-bottom:var(--hairline)_solid_var(--line)] bg-transparent px-1.5 py-2 font-mono text-meta font-normal normal-nums text-ink focus-visible:outline-none`,ur=`flex justify-between gap-4`,dr=`flex flex-col items-end ${In}`,fr=`mt-2 max-h-[52vh] overflow-y-auto`,pr=`mb-2.5`,mr=`m-0 mb-1 font-sans text-meta font-bold normal-nums text-accent`,hr=`flex gap-3 py-px ${In}`,gr=`min-w-[14ch] text-ink`,_r=`keys-only fixed bottom-[34px] left-[calc(var(--rail-w,0px)+12px)] z-40 min-w-55 rounded-sm border-hairline border-line bg-surface px-3 py-2 font-mono text-meta ${Ln} text-ink shadow-popover`,vr=e=>`mb-0.5 ${e?`motion-safe:[animation:sink-out_140ms_ease-in_var(--hud-out,3860ms)_forwards]`:`motion-safe:[animation:rise-in_140ms_ease-out,sink-out_140ms_ease-in_var(--hud-out,3860ms)_forwards]`}`,yr=`m-auto font-mono text-meta ${Ln} text-subtle`,br=`${yr} flex flex-col items-center gap-3 [&_p]:m-0`,xr=`workspace isolate row-1 flex min-h-0 min-w-0 flex-col gap-1.5 px-1 pt-2 pb-1 keyboard:pb-0`,Sr=`flex min-h-0 flex-1 overflow-hidden rounded-md border-hairline border-transparent bg-paper narrow:rounded-none narrow:border-0`,Cr=`working-flow:border-transparent working-flow:[background:linear-gradient(var(--paper),var(--paper))_0_0/100%_100%_padding-box,linear-gradient(90deg,var(--line),var(--task-ink,var(--focus)),var(--line),var(--task-ink,var(--focus)),var(--line))_0_0/300%_100%_border-box] working-flow:motion-safe:animate-flow-border`,wr=`relative flex min-w-0 flex-1 flex-col`,Tr=`relative flex min-h-0 min-w-0 flex-1 flex-col`,Er=`term-host relative min-h-0 min-w-0 flex-1 touch-none overflow-clip`,Dr=`pointer-events-none absolute inset-0 z-5 h-full w-full`,Or=`relative h-full [&.is-leaving]:pointer-events-none [&.is-leaving]:absolute [&.is-leaving]:inset-0 [&.is-leaving]:z-6`,kr=`pointer-events-none absolute inset-0 z-1 overflow-hidden [&_pre]:m-0 [&_pre>div>div]:overflow-hidden [&_pre>div>div]:[height:var(--row-h,1.15em)] [&_pre>div>div]:[line-height:var(--row-h,1.15em)]`,Ar=e=>`absolute right-2.5 bottom-2.5 z-5 flex max-w-[calc(100%-20px)] flex-wrap items-center gap-x-3 gap-y-1 rounded-sm border-hairline border-line bg-inset px-2.5 py-1.25 font-mono text-meta ${Ln} ${e?`text-error`:`text-muted`} [&_.link:disabled]:pointer-events-none [&_.link:disabled]:opacity-60 [&_button]:whitespace-nowrap`,jr=`col-span-full touch:[&_.link]:after:inset-[-2px_-6px_-4px] flex min-w-0 items-center gap-2 [border-top:var(--hairline)_solid_var(--line)] bg-surface px-3 py-1 font-mono text-meta ${Ln} whitespace-nowrap text-muted`,Mr=e=>`size-1.5 rounded-full ${e?`bg-warning`:`bg-subtle`}`,Nr=`grid min-w-0 grid-cols-[auto_minmax(2rem,1fr)_auto] gap-x-2.5 gap-y-1 pt-2 pb-1 font-sans whitespace-nowrap text-meta text-subtle normal-nums`,Pr=`col-span-3 grid cursor-pointer grid-cols-subgrid items-center text-left hover:text-ink`,Fr={ok:`text-muted`,warn:`text-warning`,crit:`text-error`},Ir={ok:`text-success`,warn:`text-warning`,crit:`text-error`},Lr=e=>`relative h-0.75 overflow-hidden rounded-full bg-[color-mix(in_srgb,currentColor_18%,transparent)] after:absolute after:inset-y-0 after:left-0 after:w-(--fill) after:rounded-full after:bg-current after:content-[''] ${Ir[e]??Ir.ok}`,Rr=`font-mono text-title font-bold normal-nums tracking-[0.02em] whitespace-nowrap narrow:text-[22px]`,zr=`text-accent`,Br=`grid h-full place-items-center p-6`,Vr=`flex w-[min(460px,100%)] flex-col gap-3 rounded-md border-hairline border-line bg-surface p-6 [&_p]:m-0`,Hr=`flex flex-col gap-2 p-3.5 text-left font-sans text-meta ${Ln} leading-[1.5]`}));Ur();var Wr=`flex-none fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.25]`,Gr=(e={})=>`relative grid cursor-pointer place-items-center rounded-sm border-none p-0 disabled:cursor-default disabled:opacity-35 [&_svg]:fill-none [&_svg]:stroke-current [&_svg]:[stroke-linecap:round] [&_svg]:[stroke-linejoin:round] [&_svg]:[stroke-width:1.25] touch:after:absolute touch:after:-inset-x-px touch:after:-top-2 touch:after:-bottom-1.25 touch:after:content-[''] touch:first:after:-left-2 ${e.tool?`size-5.5 flex-none`:`size-6.5`} ${e.tool||e.small?`[&_svg]:size-3.5`:`[&_svg]:size-4`} ${e.on?`bg-accent-soft text-accent`:`bg-transparent text-subtle enabled:hover:bg-hover enabled:hover:text-ink`}`,Kr=`absolute top-2 left-[calc(--spacing(2)+var(--shell-inset-left,0px))] z-7 flex items-center gap-0.5`,qr=`flex min-w-0 items-center gap-0.5 font-mono text-meta/body transition-padding-left duration-220 ease-snap motion-reduce:transition-none rail-folded:min-h-6.5 rail-folded:pl-[calc(--spacing(23)+var(--shell-inset-left,0px))]`,Jr=`[&.is-resizing_iframe]:pointer-events-none`,Yr=e=>`side-panel ${Un} relative row-1 flex min-h-0 min-w-0 flex-col ${Jr} ${e?`flex-1 p-0`:`pt-2 pr-1 pb-1 pl-0`}`,Xr=`grid min-h-0 flex-1 grid-rows-[minmax(0,1fr)] [--divider:5px] ${Jr}`,Zr=`side-col row-1 flex min-h-0 min-w-0 flex-col`,Qr=e=>`side-head flex min-h-6.5 min-w-0 wide:min-h-8 rail-folded:panel-expanded:in-[.side-col:first-child]:pl-[calc(--spacing(23)+var(--shell-inset-left,0px))] items-center gap-0.5 pb-1.5 font-mono text-meta normal-nums ${e?`px-2 pt-0`:`narrow:px-2 narrow:pt-0`}`,$r=`min-w-0 flex-1 truncate px-2 text-ink`,ei=`flex min-w-0 flex-1 items-center gap-0.5`,ti=`scrollbar-none flex min-w-0 gap-0.5 overflow-x-auto`,ni=e=>`group/ptab relative flex min-w-12 max-w-40 items-center hover:text-ink ${e.active?`is-active text-ink`:`text-muted`} ${e.compact&&!e.active?`max-w-24 flex-none`:`flex-initial`}`,ri=e=>`flex min-w-0 cursor-pointer items-center gap-1.5 border-none bg-transparent py-1 pl-1.5 text-inherit [font:inherit] ${e?`pr-0.5`:`pr-1.5`}`,ii=`truncate`,ai=e=>`touch:relative size-4 flex-none cursor-pointer rounded-xs border-none p-0 font-mono text-title leading-none text-subtle hover:bg-hover hover:text-ink touch:after:absolute touch:after:-inset-1.5 touch:after:-left-1 touch:after:content-[''] ${e?`mr-0.5 bg-transparent`:`absolute top-1/2 right-0.5 -translate-y-1/2 bg-paper opacity-0 group-hover/ptab:opacity-100 focus-visible:opacity-100 [@media(hover:none)]:opacity-100`}`,oi=`ml-auto flex gap-0.5`,si=`relative row-1 cursor-col-resize touch-none ${Fn.dividerBefore} after:absolute after:inset-x-[-3px] after:inset-y-0 after:content-['']`,ci=`side-view flex min-h-0 min-w-0 flex-1 flex-col [&[hidden]]:hidden`,li=`m-auto flex max-w-[44ch] flex-col items-center gap-2.5 p-4 text-center font-mono text-meta leading-[1.5] text-subtle normal-nums`,ui=`flex min-h-0 flex-1 flex-col gap-1.5`,di=`flex items-center gap-0.5 [&_svg]:flex-none`,fi=`mx-0.5 min-w-0 flex-1 rounded-sm border-none bg-inset px-2 py-1 text-ink [font-size:var(--fs-meta)] focus:bg-hover focus:outline-none aria-invalid:text-muted`,pi=`relative flex min-h-0 min-w-0 flex-1`,mi=`absolute inset-0 size-full cursor-crosshair touch-none fill-none stroke-accent [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:2.5]`,hi=s((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),K=u(s(((e,t)=>{t.exports=hi()}))(),1),gi=`inline-flex items-center justify-center rounded-sm border-hairline px-3.5 py-1.5 text-center font-sans text-meta not-italic normal-nums no-underline active:scale-97 motion-reduce:active:scale-none disabled:cursor-default disabled:opacity-50 touch:min-h-10 focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`,_i=`${gi} border-line bg-inset hover:border-line-active hover:bg-menu`,vi=({danger:e=!1,secondary:t=!1}={})=>t?`${_i} text-ink`:`${gi} border-transparent font-semibold text-paper ${e?`bg-error`:`bg-accent`}`,yi={link:`link text-accent hover:underline`,filled:vi(),danger:vi({danger:!0}),action:vi({secondary:!0}),actionDanger:`${_i} text-error`,floating:`whitespace-nowrap rounded-sm border-hairline border-line-active bg-surface px-2 py-0.5 font-mono text-meta text-ink shadow-popover`,row:``,pill:`inline-flex flex-none items-center gap-1.5 whitespace-nowrap font-mono text-meta text-muted hover:text-ink aria-[current=true]:text-accent`,icon:Gr({small:!0}),iconOn:Gr({small:!0,on:!0}),card:`flex min-w-0 flex-col gap-1.5 rounded-sm border-hairline p-1.5 text-left focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`},bi={roomy:`relative touch:after:absolute touch:after:content-[''] touch:after:-inset-x-1.5 touch:after:-inset-y-3`,tight:`relative touch:after:absolute touch:after:content-[''] touch:after:-inset-x-0.75 touch:after:-inset-y-0.5`,none:``};function q({variant:e=`link`,hit:t=e===`link`?`roomy`:`none`,className:n,type:r=`button`,...i}){return(0,K.jsx)(`button`,{type:r,className:Tn(yi[e],bi[t],n),...i})}var xi=`mx-2.5 my-3 font-mono text-meta text-subtle`,Si=`font-sans text-meta text-subtle`,Ci=`m-0 max-h-[38vh] overflow-auto rounded-sm border-hairline border-line bg-paper px-3 py-2.5 font-mono text-meta leading-[1.5] whitespace-pre-wrap wrap-anywhere`,wi=e=>`flex w-full flex-col gap-0.5 rounded-sm px-2.5 py-1.5 text-left focus-visible:bg-accent-soft focus-visible:outline-none ${e?`bg-accent-soft`:``}`,Ti=`mx-0 mt-1 mb-0 max-h-47 list-none overflow-y-auto rounded-sm border-hairline border-line bg-inset p-0.5 font-mono text-meta`,Ei=e=>`block w-full cursor-pointer overflow-hidden rounded-[calc(var(--radius-sm)-2px)] px-2 py-0.75 text-left text-ellipsis whitespace-nowrap [font:inherit] touch:py-2.5 ${e.cursor?`bg-hover`:``} ${e.accent?`text-accent`:e.cursor?`text-ink`:`text-muted`}`,Di=`m-0 font-sans text-meta font-medium normal-nums`,Oi=`link text-accent hover:underline touch-hit`,ki=`rounded-sm border-hairline border-line bg-transparent text-ink placeholder:text-subtle focus-visible:border-line-active focus-visible:outline-none`,Ai=`${ki} font-mono text-meta font-normal normal-nums`,ji=`${Ai} w-full px-2.5 py-2`,Mi=`actions flex items-center justify-end gap-3.5 w-narrow:grid w-narrow:auto-cols-fr w-narrow:grid-flow-col w-narrow:items-stretch w-narrow:gap-2.5 w-narrow:[&>:is(a,button)]:inline-flex w-narrow:[&>:is(a,button)]:min-h-11! w-narrow:[&>:is(a,button)]:items-center w-narrow:[&>:is(a,button)]:justify-center w-narrow:[&>:is(a,button)]:px-3.5 w-narrow:[&>:is(a,button)]:py-1.5 w-narrow:[&>:is(a,button)]:text-center w-narrow:[&>:is(a,button)]:text-body w-narrow:[&>.link]:rounded-sm w-narrow:[&>.link]:border-hairline w-narrow:[&>.link]:border-line w-narrow:[&>.link]:bg-inset w-narrow:[&>.link]:text-ink w-narrow:[&>.link]:no-underline! w-narrow:[&>.link]:active:scale-97 w-narrow:[&>.link]:motion-reduce:active:scale-none`,J=u(_(),1);Ur();function Ni({failing:e=!1}){W();let[t,n]=(0,J.useState)(``),[r,i]=(0,J.useState)(!1);return(0,K.jsx)(`div`,{className:Br,children:(0,K.jsxs)(`form`,{className:Vr,onSubmit:e=>{e.preventDefault();let n=wn(t);if(!n){i(!0);return}f(n),window.location.reload()},children:[(0,K.jsxs)(`span`,{className:Rr,children:[(0,K.jsx)(`span`,{className:zr,children:`[`}),` rove `,(0,K.jsx)(`span`,{className:zr,children:`]`})]}),(0,K.jsx)(`h1`,{className:`${Di} text-muted`,children:U(`connect.title`)}),(0,K.jsx)(`p`,{className:e?`text-error`:`text-muted`,children:U(e?`connect.failing`:`connect.body`)}),(0,K.jsx)(`input`,{className:ji,autoFocus:!0,spellCheck:!1,placeholder:U(`connect.placeholder`),value:t,onChange:e=>{n(e.target.value),i(!1)}}),r&&(0,K.jsx)(`p`,{className:`text-error`,children:U(`connect.invalid`)}),(0,K.jsxs)(`div`,{className:Mi,children:[e&&(0,K.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>{p(),window.location.reload()},children:U(`connect.forget`)}),(0,K.jsx)(`button`,{type:`submit`,className:vi(),children:U(`connect.submit`)})]})]})})}var Pi=`max-h-(--field-max) transition-[height] duration-140 ease-snap motion-reduce:transition-none`;function Fi(e,t){let n=e.style;if(!e.offsetParent)return void n.removeProperty(`height`);let r=e.offsetHeight,i=e.getBoundingClientRect().top,a=e.scrollTop;n.transition=`none`,n.height=`auto`;let o=e.offsetHeight-e.clientHeight;n.height=`${Math.max(e.getBoundingClientRect().height,e.scrollHeight+o)}px`;let s=e.offsetHeight,c=e.scrollHeight>e.clientHeight+1;n.overflowY=c?``:`hidden`;let l=Math.abs(e.getBoundingClientRect().top-i)>.5;if(t&&s!==r){n.height=`${r}px`,e.scrollTop=l||c?a:0,e.offsetHeight,n.transition=``,n.height=`${s}px`;return}n.transition=``,e.scrollTop=a}function Ii(e,t){let n=(0,J.useRef)(null),r=(0,J.useRef)(!1);(0,J.useLayoutEffect)(()=>{n.current&&Fi(n.current,r.current),r.current=!0},[e]);let i=(0,J.useRef)(t);return i.current=t,(0,J.useCallback)(e=>{n.current=e;let t=i.current;typeof t==`function`?t(e):t&&(t.current=e)},[])}var Li=`flex flex-col gap-1.5`,Ri=`font-sans text-meta font-normal normal-nums text-muted`,zi=`${Pi} min-h-24 leading-[1.45]`,Bi=`flex flex-wrap gap-1.5`,Vi=(e=!1,t=!1)=>`rounded-sm border-hairline px-2.5 py-1 font-mono text-meta font-normal not-italic normal-nums ${e?`border-accent bg-accent-soft text-ink`:`border-line hover:bg-hover ${t?`text-subtle`:`text-muted`}`}`,Hi=`m-0 list-none p-0`,Ui=`overlay fixed inset-0 z-20 grid justify-items-center [align-items:start] bg-(--scrim) pt-[12vh] motion-safe:animate-fade-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-fade-out short:pt-3`,Wi=`${Ui} w-narrow:bottom-auto w-narrow:h-(--vvh,100%) w-narrow:[align-items:end] w-narrow:pt-3 w-narrow:pb-(--dialog-lift,18vh) keyboard:[--dialog-lift:12px]`,Gi=(e=!1)=>`dialog static m-0 flex max-h-[76vh] ${e?`w-[min(620px,calc(100vw-32px))]`:`w-[min(440px,calc(100vw-32px))]`} flex-col gap-3 rounded-md border-hairline border-line bg-surface px-5 py-4.5 text-inherit shadow-dialog focus:outline-none motion-safe:animate-rise-in [.is-leaving_&]:animate-sink-out w-narrow:motion-safe:animate-sheet-in w-narrow:[.is-leaving_&]:animate-sheet-out short:max-h-[calc(100dvh-24px)] short:px-4 short:py-3 keyboard:max-h-[calc(var(--vvh,100dvh)-24px)]`,Ki=`flex items-center justify-between gap-3`,qi=`m-0 min-w-0 font-sans text-title leading-[1.4] font-semibold normal-nums text-ink wrap-anywhere`,Ji=`grid size-6 place-items-center -my-1 mr-[-6px] ml-0 rounded-sm text-display leading-none text-muted hover:bg-inset hover:text-ink focus-visible:bg-inset focus-visible:text-ink touch:relative touch:after:absolute touch:after:-inset-2.5 touch:after:content-['']`,Yi=`dialog-body -m-0.5 flex min-h-0 flex-col gap-3 overflow-y-auto p-0.5 [&_p]:m-0 [&>.actions]:sticky [&>.actions]:-bottom-0.5 [&>.actions]:bg-surface [.dialog-body+div>&]:mt-3.5`,Xi=(e=!1)=>`menu fixed z-30 flex max-h-[calc(100vh-16px)] ${e?`min-w-40`:`min-w-50`} origin-top-left flex-col overflow-y-auto rounded-md border-hairline border-line bg-surface p-1 shadow-popover motion-safe:animate-menu-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-sink-out`,Zi=e=>`flex items-baseline justify-between gap-6 rounded-[calc(var(--radius)-4px)] px-2.5 py-1.25 text-left text-body leading-[inherit] touch:py-2.5 ${e.danger&&e.selected?`bg-error text-paper`:e.selected||e.open?`bg-hover`:``} ${e.danger&&!e.selected?`text-error`:``} ${e.selected?`forced-colors:outline-2 forced-colors:-outline-offset-2 forced-colors:outline-[Highlight] forced-colors:outline-solid`:``}`,Qi=`font-mono text-meta normal-nums`,$i=e=>`${Qi} ${e.danger&&e.selected?`text-inherit`:e.selected?`text-muted`:`text-subtle`} touch:hidden!`,ea=e=>`${Qi} ${e?`text-ink`:`text-subtle`}`,ta=`${Qi} text-accent`,na=`fixed right-3.5 bottom-8.5 z-40 flex flex-col gap-1.5 narrow:pointer-events-none narrow:top-12 narrow:bottom-auto narrow:left-3.5 narrow:items-end narrow:*:pointer-events-auto`,ra=`flex cursor-default items-baseline gap-x-3`,ia=`min-w-0 flex-1`,aa=`flex-none whitespace-nowrap font-mono`,oa=e=>`toast max-w-105 cursor-pointer rounded-sm border-hairline border-line bg-inset px-3 py-1.5 text-left font-sans text-meta normal-nums wrap-anywhere ${e?`text-error`:`text-ink`} motion-safe:animate-rise-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-sink-out`,sa=`text-subtle`,ca=`flex items-baseline justify-between gap-3 pr-2`,la=`mt-1`,ua=`m-0 flex list-none flex-col gap-0.5 p-0`,da=`flex-none font-mono text-meta font-normal normal-nums min-w-13.5 text-right text-subtle`,fa=`group-hover/card:invisible group-focus-within/card:invisible`,pa=`flex min-w-0 flex-1 flex-col gap-0.5`,ma=`row-title truncate leading-4.5`,ha=`truncate font-mono text-meta leading-4 font-normal normal-nums text-subtle`,ga=`group/card relative flex`,_a=`min-w-0 flex-1`;G(),He(),Pn();var va=`fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round]`;function ya(e){return(0,K.jsx)(`button`,{type:`button`,className:`pointer-events-auto relative grid flex-none cursor-pointer place-items-center size-11 ${kn} ${On()} ${Mn} text-ink ${jn}`,"data-nav":e.kind,"aria-label":e.label,title:e.label,onClick:e.onClick,children:e.children})}var ba=`pointer-events-auto relative grid h-full w-13 flex-none cursor-pointer place-items-center text-ink first:rounded-l-[13px] last:rounded-r-[13px] ${Mn} ${jn}`;function xa(e){return(0,K.jsxs)(`div`,{className:`pointer-events-auto relative flex h-13 flex-none items-center ${An} ${On()}`,"data-bar-capsule":!0,children:[(0,K.jsx)(`button`,{type:`button`,className:ba,"aria-label":e.settings.label,title:e.settings.label,onClick:e.settings.onClick,children:e.settings.glyph}),(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`h-6 w-(--hairline) flex-none bg-[color-mix(in_srgb,var(--ink)_14%,transparent)]`}),(0,K.jsxs)(`button`,{type:`button`,className:ba,"data-nav":`inbox`,"aria-label":e.inbox.label,title:e.inbox.label,onClick:e.inbox.onClick,children:[(0,K.jsx)(Ta,{}),e.inbox.count>0&&(0,K.jsx)(wa,{count:e.inbox.count})]})]})}var Sa={back:`M10 3 5 8l5 5`,close:`M4 4l8 8M12 4 4 12`};function Ca(e){return(0,K.jsx)(ya,{size:`nav`,kind:e.kind,label:e.label,onClick:e.onClick,children:(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`size-5.5 ${va} [stroke-width:1.5]`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:Sa[e.kind]})})})}function wa({count:e}){return(0,K.jsx)(`span`,{className:`absolute -top-1 -right-1.5 z-1 grid h-4.5 min-w-4.5 place-items-center rounded-full bg-accent px-1 font-sans text-[12px] leading-none font-semibold text-paper normal-nums motion-safe:animate-pop`,children:e>99?`99+`:e},e)}function Ta(){return(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`size-5.5 ${va} [stroke-width:1.6]`,"aria-hidden":`true`,children:[(0,K.jsx)(`path`,{d:`M22 12h-6l-2 3h-4l-2-3H2`}),(0,K.jsx)(`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`})]})}function Ea(){return(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`size-5.5 ${va} [stroke-width:1.5]`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:`M8 3v10M3 8h10`})})}function Da({onClick:e}){let t=ke(),n=U(`dialog.close`);return t?(0,K.jsx)(Ca,{kind:`close`,label:n,onClick:e}):(0,K.jsx)(`button`,{type:`button`,className:Ji,"aria-label":n,title:n,onClick:e,children:`×`})}var Oa={row:`min-h-6.5 touch:min-h-10 narrow:min-h-13`,file:`min-h-6 font-mono text-meta touch:min-h-10 narrow:min-h-11`,"file-narrow":`min-h-9 font-mono text-meta`,pane:`min-h-5.5 touch:min-h-10 narrow:min-h-11`},ka=`bg-hover cursor-grabbing scale-[1.02] motion-reduce:scale-none`;function Aa(e){let t=e.stack?`flex-col items-stretch gap-0.5 px-2.5 py-1.5`:`items-center gap-2 px-2 py-0.75`,n=e.lifted?ka:e.moving?`bg-accent-soft`:e.selected?`bg-menu`:`hover:bg-hover data-menu-open:bg-hover`;return`relative flex w-full rounded-sm text-left ${e.lifted?``:`active:scale-97 motion-reduce:active:scale-none`} ${e.grab&&!e.lifted?`cursor-grab`:``} ${t} ${Oa[e.size??`row`]} ${n}`}var ja=`row-title min-w-0 flex-1 truncate`,Ma=`row-title min-w-0 flex-auto truncate text-(length:--fs-title)`,Na=`running-shimmer:bg-[linear-gradient(90deg,var(--ink)_0%,var(--ink)_35%,var(--accent)_50%,var(--ink)_65%,var(--ink)_100%)] running-shimmer:bg-size-[300%_100%] running-shimmer:bg-clip-text running-shimmer:text-transparent running-shimmer:animate-shimmer`,Pa=`w-[1ch] flex-none text-center font-mono`,Fa=`grid w-[2ch] flex-none place-items-center font-mono text-subtle`,Ia=`flex flex-none gap-1.5 font-mono text-meta`;G(),H();var La=e=>e.charAt(0).toUpperCase()+e.slice(1);function Ra(e){return e instanceof Error?e.message:String(e)}function za(e){W();let t=(0,J.useRef)(null),n=e.onClose??ce;return(0,J.useEffect)(()=>{t.current&&!t.current.contains(document.activeElement)&&t.current.focus();let e=e=>{e.key===`Escape`&&(e.preventDefault(),n())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,K.jsx)(`div`,{className:Wi,onMouseDown:e=>e.target===e.currentTarget&&n(),children:(0,K.jsxs)(`dialog`,{ref:t,tabIndex:-1,open:!0,className:Gi(e.wide),"aria-label":e.title,children:[(0,K.jsxs)(`div`,{className:Ki,children:[(0,K.jsx)(`h1`,{className:qi,children:e.title}),(0,K.jsx)(Da,{onClick:n})]}),e.children]})})}function Ba(){let[e,t]=(0,J.useState)(!1),[n,r]=(0,J.useState)(null);return{busy:e,error:n,setError:r,submit:async e=>{t(!0),r(null);try{await e(),ce()}catch(e){r(Ra(e))}finally{t(!1)}}}}function Va(e){let[t,n]=(0,J.useState)(e.initial??``),r=Ii(t),{busy:i,error:a,submit:o}=Ba();return(0,K.jsx)(za,{title:e.title,children:(0,K.jsxs)(`form`,{className:Yi,onSubmit:n=>{n.preventDefault(),(t.trim()||e.allowEmpty)&&o(()=>e.onSubmit(t.trim()))},children:[e.multiline?(0,K.jsx)(`textarea`,{ref:r,className:`${ji} ${zi}`,"aria-label":e.title,autoFocus:!0,rows:4,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},onFocus:e=>e.currentTarget.setSelectionRange(t.length,t.length)}):(0,K.jsx)(`input`,{className:ji,"aria-label":e.title,autoFocus:!0,spellCheck:!1,value:t,onChange:e=>n(e.target.value),onFocus:e=>e.currentTarget.select()}),a&&(0,K.jsx)(`p`,{className:`text-error`,children:a}),(0,K.jsx)(Wa,{busy:i,submitLabel:e.submitLabel})]})})}function Ha(e){let{busy:t,error:n,setError:r,submit:i}=Ba(),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1),d=(0,J.useRef)(null);(0,J.useEffect)(()=>d.current?.focus(),[]);let f=t=>void i(async()=>{try{a&&e.escalate?await e.escalate.run(l):await(t&&e.secondary?e.secondary.onConfirm():e.onConfirm())}catch(n){throw!a&&e.escalate?.when(n)&&(o(!0),c(n),u(t),r(Ra(n))),n}});return(0,K.jsx)(za,{title:a&&e.escalate?.title||e.title,children:(0,K.jsxs)(`div`,{className:Yi,children:[(0,K.jsx)(`p`,{className:`whitespace-pre-line text-muted`,children:a&&e.escalate?.body?e.escalate.body(s):e.body}),n&&!(a&&e.escalate?.body)&&(0,K.jsx)(`p`,{className:`text-error`,children:n}),(0,K.jsxs)(`div`,{className:Mi,children:[(0,K.jsx)(`button`,{type:`button`,className:Oi,onClick:ce,children:U(`dialog.cancel`)}),e.secondary&&!a&&(0,K.jsx)(`button`,{type:`button`,className:vi({danger:!0}),disabled:t,onClick:()=>f(!0),children:La(e.secondary.label)}),(0,K.jsx)(`button`,{ref:d,type:`button`,className:vi({danger:!0}),disabled:t,onClick:()=>f(!1),children:La(a&&e.escalate?e.escalate.label:e.confirmLabel)})]})]})})}function Ua(e){let t=Math.max(0,e.choices.findIndex(t=>t.value===e.current)),[n,r]=(0,J.useState)(t),{busy:i,error:a,submit:o}=Ba(),s=t=>void o(()=>e.onPick(t));return(0,J.useEffect)(()=>{let t=t=>{if(t.key===`ArrowDown`||t.key===`j`)r(t=>Math.min(e.choices.length-1,t+1));else if(t.key===`ArrowUp`||t.key===`k`)r(e=>Math.max(0,e-1));else if(t.key===`Enter`){let t=e.choices[n];t&&s(t.value)}else return;t.preventDefault()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)}),(0,K.jsx)(za,{title:e.title,children:(0,K.jsxs)(`div`,{className:Yi,children:[(0,K.jsx)(`ul`,{className:Hi,children:e.choices.map((t,a)=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":t.value===e.current,disabled:i,className:Aa({selected:a===n}),onMouseEnter:()=>r(a),onClick:()=>s(t.value),children:[(0,K.jsx)(`span`,{className:`${Pa} text-accent`,children:t.value===e.current?`●`:` `}),(0,K.jsx)(`span`,{className:ja,children:t.label})]})},t.value))}),a&&(0,K.jsx)(`p`,{className:`text-error`,children:a})]})})}function Wa({busy:e,submitLabel:t}){return(0,K.jsxs)(`div`,{className:Mi,children:[(0,K.jsx)(`button`,{type:`button`,className:Oi,onClick:ce,children:U(`dialog.cancel`)}),(0,K.jsx)(`button`,{type:`submit`,className:vi(),disabled:e,children:La(t)})]})}function Ga(e,t){let n=window.setInterval(()=>{(typeof document>`u`||document.visibilityState===`visible`)&&t()},e),r=()=>{document.visibilityState===`visible`&&t()};return document.addEventListener(`visibilitychange`,r),()=>{window.clearInterval(n),document.removeEventListener(`visibilitychange`,r)}}var Ka={cancel:`Cancel`,failureHint:"Run `{command}` for diagnosis and next steps.",toastFailureHint:`Next: run rove doctor`,loading:`Loading…`,create:`create`,confirm:`Confirm`,paneCrash:{title:`This pane crashed`,hint:`The error was logged to client.log. Retry, or restart Rove if it keeps happening.`,regionTitle:`The {region} hit an error`,regionHint:"The rest of Rove keeps working. Retry below; if it persists, inspect client.log and run `rove doctor`.",retry:`[ retry ]`,region:{sidebar:`task list`,workspace:`workspace`,files:`file tree`,page:`page`}},rename:{defaultTitle:`Rename task`,defaultFieldLabel:`TITLE`,footerHint:`enter {submitLabel} · esc cancel`,defaultSubmitLabel:`rename`},prompt:{fieldLabel:`input`,submitLabel:`submit`}},qa={cancel:`取消`,failureHint:"运行 `{command}` 查看诊断和后续步骤。",toastFailureHint:`下一步:运行 rove doctor`,loading:`加载中…`,create:`创建`,confirm:`确认`,paneCrash:{title:`此面板已崩溃`,hint:`错误已记录到 client.log。可重试;若反复出现请重启 Rove。`,regionTitle:`{region}出错了`,regionHint:"Rove 的其余部分仍可正常使用。请在下方重试;若问题持续,请查看 client.log 并运行 `rove doctor`。",retry:`[ 重试 ]`,region:{sidebar:`任务列表`,workspace:`工作区`,files:`文件树`,page:`页面`}},rename:{defaultTitle:`重命名任务`,defaultFieldLabel:`名称`,footerHint:`enter {submitLabel} · esc 取消`,defaultSubmitLabel:`重命名`},prompt:{fieldLabel:`输入`,submitLabel:`提交`}},Ja={fix:{hint:"{count} finding(s) above have a known fix — run `{command}` to review them one by one",none:`fix: nothing to fix — no known remediation applies to this report`,header:`fixes — each one asks before running:`,willRun:`will run: {command}`,confirmPrompt:`apply this fix? [y/N] `,done:`✓ done`,failed:`✗ exited with code {code}; inspect the command output above, then rerun rove doctor`,skipped:`· skipped`,nonInteractive:`no interactive terminal — nothing was executed; run the commands above yourself`,manualHeader:`manual steps — doctor prints these but never runs them:`,daemonRestartWhy:`safe to run: engine sessions live in the separate PTY host and survive a daemon restart`,daemonStale:`restart the daemon — it is running an older build than this CLI`,daemonDown:`start the daemon — it is not running`,hooksDown:`restart the daemon to re-establish the engine hook channel`,inspectStale:`restart the daemon — it predates the hook-channel check`,skillInstallWhy:`safe to run: installs skill files only; re-running is idempotent`,skillMissing:`install the Rove agent skill`,skillStale:`update the Rove agent skill to the version this build expects`,spawnHelper:`restore the exec bit on node-pty's spawn-helper — every node-pty PTY spawn fails without it`,spawnHelperWhy:"safe to run: chmod on two prebuilt binaries; idempotent, and `bun install` does the same",resetWhy:`stops the daemon, the PTY host, and every live session — not undoable, so doctor only prints it`,resetDaemonWedged:`the daemon process is alive but unreachable (wedged)`,resetPty:`the PTY host process is alive but its socket is unreachable (wedged)`,resetPtyStale:`the PTY host is still running an older build than the one you launched`,resetLegacy:`pre-v0.8 tmux sessions are still holding processes and memory`,orphans:`{count} process(es) outlived the PTY session that spawned them and are still running`,orphansWhy:`kills processes, which is not undoable — and a task you backgrounded on purpose looks the same; read the list, then run it yourself`,engineTabs:`engine tabs may hold a stale daemon socket path`,engineTabsAction:`close and reopen the affected engine tabs in the TUI`,engineTabsWhy:`kills that tab's live engine session — your call, not doctor's`,staleInstall:`the install this Rove runs from no longer exists on disk`,staleInstallAction:`npm install -g @sma1lboy/rove, then relaunch Rove`,staleInstallWhy:`doctor cannot reinstall Rove over the running process — a human has to, then relaunch`,humanOnlyWhy:`doctor does not install software or log in to accounts for you`,git:`git is not on PATH`,gitAction:`install git with your OS package manager`,noEngine:`no usable engine — no engine CLI is both installed and logged in`,noEngineAction:`install an engine CLI (claude, codex, copilot, or kimi) and log in`,noEngineLogin:`no usable engine — an engine CLI is installed but not signed in`,noEngineLoginAction:`run one of the installed engine CLIs ({list}) in a shell and complete its login`,windowsNode:`Node.js is missing — the Windows PTY host cannot start`,windowsNodeAction:`install Node.js from https://nodejs.org`,staleBun:`the Bun running Rove is older than this build supports — terminals will not paint`,staleBunAction:"upgrade Bun (`bun upgrade`, `brew upgrade bun`, or `npm install -g bun@latest`), then relaunch Rove"}},Ya={fix:{hint:"上面有 {count} 项发现存在已知修法 — 运行 `{command}` 逐条查看",none:`fix: 无可修项 — 本次报告没有匹配到已知修法`,header:`修复项 — 每一条都会先询问再执行:`,willRun:`将执行: {command}`,confirmPrompt:`执行这条修复吗? [y/N] `,done:`✓ 完成`,failed:`✗ 退出码 {code};请检查上方命令输出,再运行 rove doctor`,skipped:`· 已跳过`,nonInteractive:`没有交互终端 — 未执行任何命令; 请自行运行上面的命令`,manualHeader:`人工步骤 — doctor 只打印, 永远不会替你执行:`,daemonRestartWhy:`可安全执行: 引擎会话在独立的 PTY host 里, daemon 重启后仍然存活`,daemonStale:`重启 daemon — 它运行的构建比当前 CLI 旧`,daemonDown:`启动 daemon — 它当前没有在运行`,hooksDown:`重启 daemon 以重建引擎 hook 通道`,inspectStale:`重启 daemon — 它的版本早于 hook 通道检查`,skillInstallWhy:`可安全执行: 只写入 skill 文件; 重复运行是幂等的`,skillMissing:`安装 Rove agent skill`,skillStale:`把 Rove agent skill 更新到当前构建期望的版本`,spawnHelper:`恢复 node-pty spawn-helper 的可执行位 — 缺了它 node-pty 的每次 PTY 启动都会失败`,spawnHelperWhy:"可安全执行: 只对两个预编译二进制做 chmod; 幂等, `bun install` 也会做同样的事",resetWhy:`会停掉 daemon、PTY host 和所有活动会话 — 不可撤销, 所以 doctor 只打印`,resetDaemonWedged:`daemon 进程存活但无法连接 (卡死)`,resetPty:`PTY host 进程存活但 socket 无法连接 (卡死)`,resetPtyStale:`PTY host 仍在跑比你启动的版本更旧的构建`,resetLegacy:`v0.8 之前的 tmux 会话仍占用进程和内存`,orphans:`有 {count} 个进程比启动它们的 PTY 会话活得更久, 现在还在运行`,orphansWhy:`会杀进程, 不可撤销 — 而且你故意放后台的任务看起来一模一样; 先看清单, 再自己执行`,engineTabs:`引擎 tab 可能持有过期的 daemon socket 路径`,engineTabsAction:`在 TUI 里关闭并重开受影响的引擎 tab`,engineTabsWhy:`会杀掉该 tab 的活动引擎会话 — 由你决定, doctor 不代劳`,staleInstall:`当前 Rove 所在的安装已从磁盘删除`,staleInstallAction:`npm install -g @sma1lboy/rove, 然后重新启动 Rove`,staleInstallWhy:`doctor 无法在运行中的进程上重装 Rove — 需要人工重装后重新启动`,humanOnlyWhy:`doctor 不会替你安装软件或登录账号`,git:`PATH 上找不到 git`,gitAction:`用你的系统包管理器安装 git`,noEngine:`没有可用引擎 — 没有任何引擎 CLI 同时满足已安装且已登录`,noEngineAction:`安装任一引擎 CLI(claude、codex、copilot 或 kimi)并登录`,noEngineLogin:`没有可用引擎 — 引擎 CLI 已安装, 但没有登录`,noEngineLoginAction:`在 shell 里运行已安装的引擎 CLI({list})之一并完成登录`,windowsNode:`缺少 Node.js — Windows PTY host 无法启动`,windowsNodeAction:`从 https://nodejs.org 安装 Node.js`,staleBun:`运行 Rove 的 Bun 版本低于本构建的要求 — 终端不会有任何输出`,staleBunAction:"升级 Bun (`bun upgrade` / `brew upgrade bun` / `npm install -g bun@latest`), 然后重新启动 Rove"}},Xa={mentionNoEngine:`No engine session in this task — nothing to mention into. Open one with ctrl+t.`,tabs:{all:`All`,changes:`Changes`},actions:{diffAll:`[D] diff everything`,treeView:`[t] tree view`,listView:`[t] list view`},legend:{changes:`M modified · A added · D deleted · ? untracked`},scope:{working:`scope: working tree`,branch:`scope: vs {base}`,toggleHint:`b to toggle`,noBase:`no base ref for branch scope (no origin/HEAD, main or master)`},empty:{noTask:`(no task — press n to create)`,noFiles:`(empty worktree)`,noChanges:`(no changes — clean worktree)`,noMatches:`(no file name or text matches)`},dotHidden:`dot files hidden · . to show`,search:{placeholder:`file names and text`,searchingText:`searching text…`},error:{retryHint:`press r to retry`,notGitRepo:"not a git repository — run `git init` here, or open a task in a repo",pathMissing:`the worktree directory is gone — reopen the task to re-create it`,permissionDenied:`permission denied reading the worktree — check the directory's owner and mode`,gitNotInstalled:`git is not on PATH — install it with your OS package manager`,gitFailed:"git command failed; run `git status` in this worktree to diagnose"},toast:{prOnTargetBranch:`Already on the target branch ({branch}) — ask the agent to create the PR from a task branch`,noPausedOperation:`Nothing to resolve — no merge, rebase or cherry-pick is paused here`,conflictReadFailed:`Git could not read the conflicted files. Run git status in this worktree, then retry.`,conflictSendFailed:`Could not send the conflict prompt. Open an engine tab in this task, then retry.`,ciNoFailingChecks:`No failing check logs to read — the run may have expired, or the checks are no longer red`,ciChecksUnavailable:"gh could not read this PR's checks: {detail}. Run `gh auth status`, then retry."}},Za={mentionNoEngine:`这个任务没有引擎会话——没有地方可以提及。用 ctrl+t 开一个。`,tabs:{all:`全部`,changes:`改动`},actions:{diffAll:`[D] 查看全部改动`,treeView:`[t] 树状视图`,listView:`[t] 列表视图`},legend:{changes:`M 已修改 · A 已添加 · D 已删除 · ? 未跟踪`},scope:{working:`范围:工作区改动`,branch:`范围:对比 {base}`,toggleHint:`按 b 切换`,noBase:`分支范围没有基准 ref(没有 origin/HEAD、main 或 master)`},empty:{noTask:`(暂无任务 — 按 n 创建)`,noFiles:`(worktree 为空)`,noChanges:`(无改动 — worktree 干净)`,noMatches:`(没有匹配的文件名或内容)`},dotHidden:`已隐藏以点开头的文件 · 按 . 显示`,search:{placeholder:`文件名和内容`,searchingText:`正在搜索内容…`},error:{retryHint:`按 r 重试`,notGitRepo:"不是 git 仓库——在这里执行 `git init`,或改为打开仓库里的任务",pathMissing:`worktree 目录已不存在——重新打开该任务会重建它`,permissionDenied:`读取 worktree 时权限不足——请检查该目录的属主和权限`,gitNotInstalled:`PATH 上找不到 git——请用系统包管理器安装`,gitFailed:"git 命令失败;请在此 worktree 运行 `git status` 诊断"},toast:{prOnTargetBranch:`当前就在目标分支({branch})— 请在任务分支上让 agent 创建 PR`,noPausedOperation:`没有要解决的冲突——这里没有暂停中的合并、变基或拣选`,conflictReadFailed:`Git 无法读取冲突文件。请在此 worktree 运行 git status,然后重试。`,conflictSendFailed:`无法发送冲突提示。请在此任务中打开一个引擎标签页,然后重试。`,ciNoFailingChecks:`没有可读的失败检查日志——运行记录可能已过期,或检查已不再是红的`,ciChecksUnavailable:"gh 读不到这个 PR 的检查状态:{detail}。请运行 `gh auth status`,然后重试。"}},Qa={retryHint:`Correct the field above, then choose Create again.`,title:`New task`,legend:`{enter} · tab complete/fields · ctrl+[ ] mode · ctrl+e engine · esc cancel`,enterCreate:`enter create`,hero:`Pick a project and an engine, then describe the task. It starts with your first message.`,chipWorktree:`Worktree`,chipProject:`Project`,noFolder:`No folder`,chooseFolder:`Choose folder`,enterNext:`enter next field`,enterSelect:`enter select`,tabs:{existing:`For Existing`,clone:`For New Repo`,adopt:`Adopt Worktree`},field:{mode:`MODE`,tier:`DEPTH`,engine:`ENGINE`,effort:`EFFORT`,repo:`REPO`,openFolder:`OPEN FOLDER`,fromBranch:`FROM BRANCH`,prompt:`FIRST MESSAGE`,extras:`ALSO INCLUDE`,gitUrl:`GIT URL`,parentDir:`PARENT DIR`,folderName:`FOLDER NAME`,baseBranch:`BASE BRANCH`,adoptFilter:`FILTER (PATH GLOB)`,opens:`OPENS`},intent:{task:`a new task worktree`,project:`the project itself`},placeholder:{folderName:`auto from url`,adoptFilter:`* — type e.g. feature-* to narrow`,prompt:`Describe a task or ask a question (optional)`,searchFolders:`Search folders...`,filterFolders:`Paste a path or filter folders...`},hint:{modeCycle:`ctrl+[ ]`,engineCycle:`ctrl+e`,remembered:`(remembered — next clone defaults to this dir)`,currentDir:`(current dir)`,noBranchesFound:`(no local branches found — typed text will be used as ref)`,noMatchBranch:`(no match — typed text will be used as ref)`,scanningWorktrees:`scanning worktrees…`,extrasNone:`(none — enter picks a repo; the first is the primary)`,extrasPicked:`{count} more repo(s) in this task`},picker:{moreAbove:`↑ {count} more`,moreBelow:`↓ {count} more`,recent:`Recent`,openFolder:`+ Open folder…`,parentFolder:`parent`,gitBadge:`git`,useFolder:`Use "{name}"`,backToFolders:`← Back`,noFolders:`No subfolders`,browseHint:`h/← back · l/→ open · enter select · esc return`},scroll:{moreAbove:`↑ {count} more rows`,moreBelow:`↓ {count} more rows`},open:{failed:`Couldn't open the project: {error}`},adopt:{repoLine:`repo: {path}`,repoNone:`(none)`,noUnlinked:`no unlinked worktrees — every git worktree here is already a task`,noMatch:`no worktrees match the filter`,hintSelected:`{count} selected · enter toggles · ctrl+a all · Create imports`,hintDefault:`enter toggles · ctrl+a all · Create imports the highlighted row`,summaryAll:`Adopted {count} worktree(s)`,summaryPartial:`Adopted {done}/{total} worktrees — the rest failed (see log)`,summaryNone:`Couldn't adopt any worktree: {error}`},clone:{progressFallback:`Cloning…`,progressInto:`Cloning into {target}…`},button:{create:`Create`,cloning:`Cloning…`},error:{gitUrlRequired:`git URL is required`,gitUrlInvalid:`does not look like a git URL: {url}`,folderRequired:`folder name is required`,folderHasSeparator:`folder name cannot contain path separators`,parentRequired:`parent directory is required`,parentNotFound:`parent directory does not exist: {path}`,parentNotDir:`not a directory: {path}`,targetExists:`target already exists: {path}`,cloneFailed:`git clone failed: {error}`,noAdoptable:`no adoptable worktrees to import`,repoAmbiguous:`more than one saved repo is named {name} — pick the one you mean from the list`,tierUnavailable:`{tier} points at engine {engine}, which is not available here — retarget it in Settings → Auto routing`}},$a={retryHint:`请修正上方字段,然后再次选择创建。`,title:`新建任务`,legend:`{enter} · tab 补全/切字段 · ctrl+[ ] 切模式 · ctrl+e 引擎 · esc 取消`,enterCreate:`enter 创建`,hero:`选好项目和引擎,再描述任务。任务从你的第一条消息开始。`,chipWorktree:`工作树`,chipProject:`项目`,noFolder:`无文件夹`,chooseFolder:`选择文件夹`,enterNext:`enter 下一个字段`,enterSelect:`enter 选中`,tabs:{existing:`已有仓库`,clone:`克隆新仓库`,adopt:`接管 Worktree`},field:{mode:`模式`,tier:`深度`,engine:`引擎`,effort:`推理强度`,repo:`仓库`,openFolder:`打开文件夹`,fromBranch:`基准分支`,prompt:`第一条消息`,extras:`同时包含`,gitUrl:`git 地址`,parentDir:`父目录`,folderName:`文件夹名`,baseBranch:`基准分支`,adoptFilter:`过滤(路径 glob)`,opens:`打开`},intent:{task:`新建任务 worktree`,project:`项目本身`},placeholder:{folderName:`自动从地址推导`,adoptFilter:`* — 输入如 feature-* 来缩小范围`,prompt:`描述一个任务,或提个问题(可选)`,searchFolders:`搜索文件夹…`,filterFolders:`粘贴路径或过滤文件夹…`},hint:{modeCycle:`ctrl+[ ]`,engineCycle:`ctrl+e`,remembered:`(已记住 — 下次克隆默认使用此目录)`,currentDir:`(当前目录)`,noBranchesFound:`(未找到本地分支 — 将直接使用输入文本作为 ref)`,noMatchBranch:`(无匹配 — 将直接使用输入文本作为 ref)`,scanningWorktrees:`正在扫描 worktree…`,extrasNone:`(未选 — 回车选一个仓库,第一个是主仓库)`,extrasPicked:`任务里另含 {count} 个仓库`},picker:{moreAbove:`↑ 还有 {count} 项`,moreBelow:`↓ 还有 {count} 项`,recent:`最近使用`,openFolder:`+ 打开文件夹…`,parentFolder:`上级目录`,gitBadge:`git`,useFolder:`使用「{name}」`,backToFolders:`← 返回`,noFolders:`没有子文件夹`,browseHint:`h/← 后退 · l/→ 进入 · enter 确定 · esc 返回`},scroll:{moreAbove:`↑ 上方还有 {count} 行`,moreBelow:`↓ 下方还有 {count} 行`},open:{failed:`无法打开项目:{error}`},adopt:{repoLine:`仓库:{path}`,repoNone:`(无)`,noUnlinked:`没有未关联的 worktree — 此仓库所有 git worktree 均已是任务`,noMatch:`没有 worktree 匹配此过滤条件`,hintSelected:`已选 {count} 项 · enter 切换选中 · ctrl+a 全选 · 创建 导入`,hintDefault:`enter 切换选中 · ctrl+a 全选 · 创建 将导入高亮行`,summaryAll:`已接管 {count} 个 worktree`,summaryPartial:`已接管 {done}/{total} 个 worktree — 其余失败(详见日志)`,summaryNone:`没有 worktree 接管成功:{error}`},clone:{progressFallback:`克隆中…`,progressInto:`正在克隆到 {target}…`},button:{create:`创建`,cloning:`克隆中…`},error:{gitUrlRequired:`git 地址不能为空`,gitUrlInvalid:`不像是有效的 git 地址:{url}`,folderRequired:`文件夹名不能为空`,folderHasSeparator:`文件夹名不能包含路径分隔符`,parentRequired:`父目录不能为空`,parentNotFound:`父目录不存在:{path}`,parentNotDir:`不是目录:{path}`,targetExists:`目标路径已存在:{path}`,cloneFailed:`git clone 失败:{error}`,noAdoptable:`没有可接管的 worktree`,repoAmbiguous:`有多个已保存仓库都叫 {name} — 请从列表中选择你要的那个`,tierUnavailable:`{tier} 指向的引擎 {engine} 在这台机器上不可用——去 设置 → 自动路由 重新指定`}},eo={engineTitle:`Engine and account`,engineChecking:`Checking installed engines and accounts…`,engineReady:`✓ Ready to start a task`,engineMissing:`No usable engine yet`,engineUsable:`✓ {engine}: ready`,engineSignedOut:`! {engine}: installed, not signed in`,engineSetup:"Install an engine using docs.rove.run/rove/engines, then run its CLI and sign in. Run `rove doctor --fix` to check setup; Settings → Engines lists integrations.",engineContinue:`❯ Continue to optional setup`,engineLegend:`enter continue · esc skip optional setup`,quickStart:`Start a task with a prompt`,quickIntent:`Creates an isolated worktree and branch. Use {key} for the full task dialog.`,tabShared:`New conversations share this task’s files`,tabIsolated:`{key}: new task, isolated worktree`,title:`Welcome to Rove`,subtitle:`Managed tasks get isolated worktrees and branches. Directory and project tasks reuse existing files.`,completionsLabel:`Shell completions for {shell}`,completionsExplain:`Tab-completes rove subcommands. One line is added to your shell config.`,skillLabel:`Rove agent skill`,skillExplain:`Lets the coding agents on this machine drive Rove themselves: start tasks, read other sessions, message them.`,optionYes:`Install`,recommended:`recommended`,stepCounter:`{n} / {total}`,optionNo:`Not now`,queued:`Queued — installs when you quit Rove`,skillInstalled:`Installed for {engines}`,skillFailed:`Install failed: {reason}`,skillNoEngines:`No coding agent here takes the skill`,skipped:`Skipped`,installFailed:`! {item} failed: {reason}. Retry: {command} (or quit Rove again).`,legend:`↑↓ select · enter confirm · esc close`,keysTitle:`Keyboard basics`,keysBare:`Bare keys act in the focused pane — {nav} moves, {open} opens.`,keysOnePress:`A few one-press chords are Rove's own — {newTab} new tab, {focusNext} next pane.`,keysPrefix:`{prefix} opens the command map — hold it a beat and a guide appears.`,keysHelp:`{help} shows the full live reference anytime.`,keysNext:`Next: Settings → Engines lists every engine and installs its activity hooks.`,keysLegend:`enter finish`,appliedCompletions:`✓ completions hooked into {path} (takes effect in new shells)`,keptCompletions:`· {path} already has a completions block — left untouched`},to={engineTitle:`引擎与账户`,engineChecking:`正在检查引擎与账户…`,engineReady:`✓ 可以开始任务`,engineMissing:`还没有可用的引擎`,engineUsable:`✓ {engine}:可用`,engineSignedOut:`! {engine}:已安装,未登录`,engineSetup:"从 docs.rove.run/rove/engines 安装引擎,然后运行其 CLI 并登录。运行 `rove doctor --fix` 检查配置;设置 → 引擎 可查看集成。",engineContinue:`❯ 继续可选设置`,engineLegend:`enter 继续 · esc 跳过可选设置`,quickStart:`输入提示词开始任务`,quickIntent:`创建独立 worktree 和分支。按 {key} 打开完整任务对话框。`,tabShared:`新对话共享当前任务的文件`,tabIsolated:`{key}:新建任务,使用独立 worktree`,title:`欢迎使用 Rove`,subtitle:`托管任务使用独立的 worktree 和分支;目录与项目任务复用现有文件。`,completionsLabel:`{shell} 的 shell 补全`,completionsExplain:`让 rove 子命令支持 Tab 补全,会在你的 shell 配置里加一行。`,skillLabel:`Rove agent skill`,skillExplain:`让本机的编码 agent 自己操作 Rove:开任务、读其他会话、给它们发消息。`,optionYes:`安装`,recommended:`推荐`,stepCounter:`{n} / {total}`,optionNo:`跳过`,queued:`已排队 — 退出 Rove 后安装`,skillInstalled:`已为 {engines} 安装`,skillFailed:`安装失败:{reason}`,skillNoEngines:`这台机器上没有能装 skill 的编码 agent`,skipped:`已跳过`,installFailed:`! {item} 安装失败:{reason}。重试:{command}(或再次退出 Rove)。`,legend:`↑↓ 选择 · enter 确认 · esc 关闭`,keysTitle:`键盘基础`,keysBare:`裸键作用于当前聚焦面板 — {nav} 移动,{open} 打开。`,keysOnePress:`少量单次快捷键属于 Rove 自己 — {newTab} 新标签页,{focusNext} 切换面板。`,keysPrefix:`{prefix} 打开命令层 — 按住稍等会出现命令指南。`,keysHelp:`随时按 {help} 查看完整的实时键位表。`,keysNext:`接下来:设置 → 引擎 里列出每个引擎,并可在那里安装它们的活动钩子。`,keysLegend:`enter 完成`,appliedCompletions:`✓ 补全已写入 {path}(新开的 shell 生效)`,keptCompletions:`· {path} 里已有补全配置 — 未改动`},no={title:`Quick task · {repoLabel}`,promptLabel:`PROMPT`,promptPlaceholder:`what should this task do?`,attemptsLabel:`ATTEMPTS`,engineLabel:`ENGINE`,branchLabel:`BRANCH`,legend:`enter create · tab fields · ctrl+e engine · ctrl+v attach · esc cancel`,startedRound:`Started {count} attempts`,roundPartial:`Started {ok}/{count} attempts — {failed} failed`},ro={title:`快速任务 · {repoLabel}`,promptLabel:`提示词`,promptPlaceholder:`这个任务要做什么?`,attemptsLabel:`尝试次数`,engineLabel:`引擎`,branchLabel:`分支`,legend:`enter 创建 · tab 切换字段 · ctrl+e 引擎 · ctrl+v 附件 · esc 取消`,startedRound:`已启动 {count} 个尝试`,roundPartial:`已启动 {ok}/{count} 个尝试 —— {failed} 个失败`},io={cancel:`cancel`,forgetProjectTitle:`Remove project "{title}"?`,forgetProjectBody:"Forgets it from the projects list. The repo, its branches, worktrees and the sessions under it stay — re-add it with `rove add`.",forgetProjectConfirm:`remove`,deleteTitle:`Remove session "{title}"?`,deleteTitleDir:`Remove session "{title}"?`,deleteBodyDir:`Ends this session and closes all its tabs. Nothing on disk changes: the folder and its files stay.`,deleteBodyTask:`Ends this session, closes all its tabs and removes its worktree folder. The git branch stays.`,deleteBodyTaskBranch:`Ends this session, closes all its tabs and removes its worktree folder, and its git branch if it is merged. An unmerged branch stays.`,deleteConfirm:`remove`,childrenTitle:`"{title}" has {count} child tasks`,childrenBody:`Promote moves them up one level and keeps their worktrees and sessions. Remove with children removes them too.`,childrenPromote:`promote children`,childrenCascade:`remove with children`,archiveChildrenBody:`Promote moves them up one level and keeps them running. Archive with children hides them too and ends their sessions.`,archiveChildrenAll:`archive with children`,forceDeleteTitle:`"{title}" has uncommitted changes`,forceDeleteConfirm:`force remove`,legacyAdoptTitle:`Remove {count} sessions Rove added by itself?`,legacyAdoptBody:`An older Rove added a session whenever a worktree was created outside it. It no longer does. These look like leftovers:
|
|
20
|
+
{list}
|
|
21
|
+
|
|
22
|
+
An agent can list them, remove the ones you confirm, and take out any old Rove worktree hook still in your settings.`,legacyAdoptMore:`… and {count} more`,legacyAdoptClean:`ask an agent`,legacyAdoptLater:`not now`,legacyAdoptNever:`don't ask again`,legacyAdoptSessionTitle:`Remove leftover sessions`,legacyAdoptPrompt:`An older Rove version added sessions to the sidebar by itself whenever a git worktree was created outside Rove. These look like leftovers:
|
|
23
|
+
|
|
24
|
+
{list}
|
|
25
|
+
|
|
26
|
+
Show me this list and ask which ones to remove, then wait for my answer. For each one I confirm, first run \`git -C <path> status --short\`. If it has uncommitted changes, tell me and ask again. Otherwise run \`rove api delete --task-id <id> --wait\`. Remove nothing I did not confirm, and never pass --force.
|
|
27
|
+
|
|
28
|
+
Then look for the hook that older version installed. Check my engine settings files, both the global ones and the ones in each repo above, for any hook whose command runs \`rove hook worktree-created\`. Show me each entry you find and its file, and remove it only after I confirm. Leave every other hook as it is.`,legacyAdoptFailed:`Couldn't start the cleanup session: {message}`},ao={cancel:`取消`,forgetProjectTitle:`从列表中移除项目「{title}」?`,forgetProjectBody:"把它从项目列表里移除。仓库、分支、worktree 以及它下面的会话都会保留,之后可以用 `rove add` 重新加回来。",forgetProjectConfirm:`移除`,deleteTitle:`移除会话「{title}」?`,deleteTitleDir:`移除会话「{title}」?`,deleteBodyDir:`结束这个会话,关闭它的所有标签页。磁盘上什么都不动:文件夹和里面的文件都会保留。`,deleteBodyTask:`结束这个会话,关闭它的所有标签页,并删除它的 worktree 文件夹。git 分支会保留。`,deleteBodyTaskBranch:`结束这个会话,关闭它的所有标签页,删除它的 worktree 文件夹,以及已合并的 git 分支。未合并的分支会保留。`,deleteConfirm:`移除`,childrenTitle:`「{title}」有 {count} 个子任务`,childrenBody:`提升会把它们上移一级,并保留它们的 worktree 和会话。连同子任务移除会把它们一并移除。`,childrenPromote:`提升子任务`,childrenCascade:`连同子任务移除`,archiveChildrenBody:`提升会把它们上移一级,并让它们继续运行。连同子任务归档会把它们一并隐藏,并结束它们的会话。`,archiveChildrenAll:`连同子任务归档`,forceDeleteTitle:`「{title}」有未提交的改动`,forceDeleteConfirm:`强制移除`,legacyAdoptTitle:`移除 {count} 个 Rove 自己加进来的会话?`,legacyAdoptBody:`旧版 Rove 会在别处创建 worktree 时自动加一个会话,现在已经不会了。下面这些看起来是当时留下的:
|
|
29
|
+
{list}
|
|
30
|
+
|
|
31
|
+
可以交给 agent:它先列出来,你确认哪些就删哪些,并把设置里还留着的旧版 Rove worktree hook 一起清掉。`,legacyAdoptMore:`……还有 {count} 个`,legacyAdoptClean:`交给 agent`,legacyAdoptLater:`以后再说`,legacyAdoptNever:`不再提示`,legacyAdoptSessionTitle:`移除残留会话`,legacyAdoptPrompt:`旧版 Rove 会在 Rove 之外创建 git worktree 时自动往侧栏加会话。下面这些看起来是当时留下的:
|
|
32
|
+
|
|
33
|
+
{list}
|
|
34
|
+
|
|
35
|
+
先把这份清单给我看,问我要删哪些,然后等我回答。对我确认的每一个,先运行 \`git -C <path> status --short\`;有未提交的改动就告诉我并再问一次,没有就运行 \`rove api delete --task-id <id> --wait\`。我没确认的一个都不要删,也不要加 --force。
|
|
36
|
+
|
|
37
|
+
然后找一下那个旧版本装的 hook。检查我的引擎设置文件,包括全局的和上面每个仓库里的,找命令里运行 \`rove hook worktree-created\` 的 hook。把找到的每一条连同所在文件给我看,我确认后再删。其他 hook 一律不动。`,legacyAdoptFailed:`清理会话没能启动:{message}`},oo={open:`Open`,collapseChildren:`Collapse children`,expandChildren:`Expand children`,newChat:`New conversation`,newShell:`New shell`,continueEngine:`Continue in another engine…`,newScratchChat:`New conversation (no folder)`,newTask:`New task`,newTaskFromBranch:`New task from this branch`,forgetProject:`Remove project`,fieldNotes:`Field notes`,rename:`Rename`,pin:`Pin`,unpin:`Unpin`,reorder:`Reorder row`,moveToTop:`Move to top`,moveProjectUp:`Move up`,moveProjectDown:`Move down`,runAgain:`Run again`,setStatus:`Set status`,moveToProject:`Move session to…`,copy:`Copy`,more:`More`,copyId:`Copy task ID`,copyBranch:`Copy branch name`,copyPath:`Copy path`,openEditor:`Open in editor`,renameBranch:`Rename branch`,changeEngine:`Change engine`,fixChecks:`Fix failing checks`,rerunChecks:`Re-run failed checks`,syncBase:`Sync with base`,resolveConflicts:`Resolve conflicts`,abortOperation:`Abort paused merge or rebase`,land:`Land into base branch`,muteNotifications:`Mute notifications`,unmuteNotifications:`Unmute notifications`,archive:`Archive`,unarchive:`Unarchive`,delete:`Remove session`},so={open:`打开`,collapseChildren:`折叠子任务`,expandChildren:`展开子任务`,newChat:`新建会话`,newShell:`新建终端`,continueEngine:`换个引擎继续…`,newScratchChat:`新建会话(无文件夹)`,newTask:`新建任务`,newTaskFromBranch:`基于此分支新建任务`,forgetProject:`移除项目`,fieldNotes:`现场笔记`,rename:`重命名`,pin:`置顶`,unpin:`取消置顶`,reorder:`重新排序`,moveToTop:`移到顶部`,moveProjectUp:`上移`,moveProjectDown:`下移`,runAgain:`重新运行`,setStatus:`设置状态`,moveToProject:`移动会话到…`,copy:`复制`,more:`更多`,copyId:`复制任务 ID`,copyBranch:`复制分支名`,copyPath:`复制路径`,openEditor:`在编辑器中打开`,renameBranch:`重命名分支`,changeEngine:`切换引擎`,fixChecks:`修复失败的检查`,rerunChecks:`重新运行失败的检查`,syncBase:`同步基础分支`,resolveConflicts:`让 agent 解决冲突`,abortOperation:`中止暂停的合并或变基`,land:`合入基础分支`,muteNotifications:`静音通知`,unmuteNotifications:`取消静音通知`,archive:`归档`,unarchive:`取消归档`,delete:`移除会话`},co={noDaemonWorktree:"No daemon running — can't create the worktree. Start it with `rove daemon restart`.",noEditor:`No editor found — set ROVE_OPEN_EDITOR (e.g. 'code', 'cursor', 'nvim')`,openWorktreeFailed:`Couldn't open worktree with {label}`,worktreeErrorDeleting:`This task is being deleted — it can't be opened`,worktreeErrorNotGit:"This project isn't a git repo yet — a task needs a git branch. Run `git init` (+ a first commit) in the project, then open the task. Non-git support is coming.",worktreeErrorGeneric:`Couldn't create the worktree: {message}`,noDiskSpace:`The disk is full, so the checkout could not be created. Free some space, then try again.`,scratchOpenFailed:`Couldn't open a scratch shell: {message}`,worktreeGoneTitle:`Worktree for "{title}" is gone`,worktreeGoneBody:`Closed {count} tab(s). The branch {branch} is still there — reopen the task to re-create its worktree.`,checksPassingTitle:`Checks passed for "{title}"`,checksFailingTitle:`Checks failed for "{title}"`,checksResolvedBody:`PR {pr} on {branch}`,copiedId:`Copied task ID {text}`,copiedTab:`Copied tab address {text}`,copiedSession:`Copied session ID {text}`,copiedBranch:`Copied branch {text}`,copiedPath:`Copied path {text}`,copyFailed:`Couldn't reach a clipboard — no clipboard command on PATH, and this terminal refused OSC 52.`,forgetProjectFailed:`Couldn't remove the project: {error}`,deleteFailed:`Couldn't delete "{title}": {error}`,createFailed:`Couldn't create the task: {error}`,engineStartFailed:`Task created; engine did not start`,engineStartRetry:`{error}. Press ⏎ on the task to retry.`,forkFailed:`Couldn't fork the task: {error}`,forkLeftBehind:`Started from the last commit — uncommitted work stays in the original task ({reason})`,childFailed:`Couldn't start the new conversation: {error}`,renameFailed:`Couldn't rename the task: {error}`,renameBranchFailed:`Couldn't rename the branch: {error}`,switchEngineFailed:`Couldn't switch the engine: {error}`,setStatusFailed:`Couldn't set the status: {error}`,pinFailed:`Couldn't change the pin: {error}`,moveFailed:`Couldn't move the task: {error}`,moveToProjectFailed:`Couldn't move the session: {error}`,movedToProject:`Moved to {project}`,issueChatFailed:`Couldn't start the issue chat: {error}`,inboxMarkReadFailed:`Couldn't mark it read: {error}`,inboxDismissFailed:`Couldn't dismiss it: {error}`,engineSwitched:`Engine → {engine} (applies on reopen)`,statusSet:`Status → {status}`},lo={noDaemonWorktree:"守护进程未运行——无法创建 worktree。请运行 `rove daemon restart` 启动它。",noEditor:`未找到编辑器——请设置 ROVE_OPEN_EDITOR(如 'code'、'cursor'、'nvim')`,openWorktreeFailed:`无法用 {label} 打开 worktree`,worktreeErrorDeleting:`该任务正在删除中——无法打开`,worktreeErrorNotGit:"该项目尚非 git 仓库——任务需要 git 分支。请在项目中执行 `git init`(+ 首次提交)后再打开任务。非 git 项目的支持即将推出。",worktreeErrorGeneric:`无法创建 worktree:{message}`,noDiskSpace:`磁盘空间不足,没法创建工作目录。清理出一些空间后再重试。`,scratchOpenFailed:`无法打开临时 Shell:{message}`,worktreeGoneTitle:`"{title}" 的 worktree 已消失`,worktreeGoneBody:`已关闭 {count} 个标签页。分支 {branch} 仍在——重新打开该任务会重建 worktree。`,checksPassingTitle:`「{title}」的 PR 检查已通过`,checksFailingTitle:`「{title}」的 PR 检查失败了`,checksResolvedBody:`PR {pr},分支 {branch}`,copiedId:`已复制任务 ID {text}`,copiedTab:`已复制标签页地址 {text}`,copiedSession:`已复制会话 ID {text}`,copiedBranch:`已复制分支 {text}`,copiedPath:`已复制路径 {text}`,copyFailed:`无法访问剪贴板——PATH 上没有剪贴板命令,这个终端也拒绝了 OSC 52。`,forgetProjectFailed:`移除项目失败:{error}`,deleteFailed:`删除「{title}」失败:{error}`,createFailed:`创建任务失败:{error}`,engineStartFailed:`任务已创建,引擎没有启动`,engineStartRetry:`{error}。在任务上按 ⏎ 重试。`,forkFailed:`fork 任务失败:{error}`,forkLeftBehind:`已从最近一次提交开始——未提交的改动留在原任务里({reason})`,childFailed:`无法开始新对话:{error}`,renameFailed:`重命名任务失败:{error}`,renameBranchFailed:`重命名分支失败:{error}`,switchEngineFailed:`切换引擎失败:{error}`,setStatusFailed:`设置状态失败:{error}`,pinFailed:`修改置顶状态失败:{error}`,moveFailed:`移动任务失败:{error}`,moveToProjectFailed:`移动会话失败:{error}`,movedToProject:`已移到 {project}`,issueChatFailed:`启动议题会话失败:{error}`,inboxMarkReadFailed:`标记为已读失败:{error}`,inboxDismissFailed:`忽略失败:{error}`,engineSwitched:`引擎 → {engine}(重新打开后生效)`,statusSet:`状态 → {status}`},uo={nav:{kanban:`Kanban`,automations:`Routines`,issues:`Issues`,mods:`Mods`},header:{scratch:`Ungrouped`,connector:{weixin:`WeChat`,lark:`Lark`,inbox:`External messages`}},search:{placeholder:`fuzzy filter`},sort:{label:`sort: {mode}`,hint:`Change the order (manual → newest → attention → name)`,reorderSwitched:`Reorder needs manual order — switched`,modes:{default:`manual`,recent:`newest`,attention:`attention`,name:`name`}},menu:oo,status:{backlog:`Backlog`,inProgress:`In progress`,inReview:`In review`,done:`Done`,canceled:`Canceled`,error:`Error`},setStatus:{title:`Set status`,current:`current`,footer:`↑↓ choose · enter set · esc cancel`},moveToProject:{title:`Move session to`,empty:"No other project yet — add one first, or run `rove api update --project PATH`",ungrouped:`Ungrouped`,footer:`↑↓ choose · enter move · esc cancel`},sync:{done:`Merged {base} into this worktree`,alreadyCurrent:`Already up to date with {base}`,conflict:`Merge conflict — resolve then commit: {files}`,dirty:`Commit the worktree's changes first, then sync: {files}`,failed:`Sync failed: {error}`},abortOp:{title:`Abort the {op}?`,body:`Git puts {branch} back where it was before the {op} started. Conflict resolutions made since then are lost.`,confirm:`Abort {op}`,done:`Aborted the {op} on {branch}`,failed:`Couldn't abort the {op}: {error}`},archive:{done:`Archived {title}`,restored:`Restored {title}`,busyTitle:`Archive while it's working?`,busyBody:`An engine in {title} is still working or waiting on you. Archiving stops it.`,busyConfirm:`Archive anyway`,failed:`Couldn't archive: {error}`,restoreFailed:`Couldn't restore: {error}`},rerun:{started:`Re-running failed checks`,none:`No failed checks to re-run`,external:`These checks didn't run on GitHub Actions; re-run them where they ran`,refused:`Re-run refused: {detail}`},changeEngine:{title:`Change engine`,current:`current`,effortLabel:`EFFORT`,noEffort:`engine default`,footer:{engine:`↑↓ engine`,effort:`←→ effort`,model:`tab model`,set:`enter set`,cancel:`esc cancel`}},engineModel:{label:`MODEL`,placeholder:`engine default`,loading:`listing models…`},tier:{swift:`swift`,standard:`standard`,deep:`deep`,manual:`manual`},tierDesc:{swift:`small, well-specified edits — the fastest, cheapest setting`,standard:`everyday feature work and bug fixes`,deep:`hard problems: unclear root causes, large refactors, design decisions`},runAgain:{title:`Run again`,source:`Brief from “{title}”`,hint:`Runs this brief again in a new task, on its own branch and worktree.`,confirm:`Run again`,footer:`↑↓ scroll · ←→ choose · enter run · esc cancel`},fieldNotes:{title:`Field notes`,empty:"No field notes for this repo yet — agents file one with `rove api note`.",loading:`Loading…`,footer:`↑↓ scroll · esc close`,footerDeletable:`↑↓ select · d delete · esc close`,confirmDelete:{title:`Delete this field note?`,body:`“{text}” stops being injected into new sessions on this repo. Nothing else changes.`}},confirm:io,renameBranch:{title:`Rename branch`,fieldLabel:`branch`},moveChip:` move`,recentJump:`Recent: {title}`,archivedHit:`{title} · archived, enter unarchives`,machine:{connecting:`connecting…`,offline:`offline`,unsupported:`unsupported`,mismatch:`protocol mismatch`,filesElsewhere:`on {host}`,filesHint:`{host} is unreachable right now; its files show here again when it reconnects.`,terminalElsewhere:`This task runs on {host}, which is unreachable right now.`,runsOn:`on {host}`,noTabs:`No tabs on {host} yet — prefix t opens one there.`},empty:{noMatchSearch:`No matching tasks — esc to clear.`,noActiveProject:`No active tasks for this project.`,noActive:`No active tasks — create one above.`},activity:{working:`working`,rateLimited:`rate limited`,permissionNeeded:`needs permission`,error:`error`,dead:`engine exited`},group:{waitingOnYou:`needs you`,landing:`ready to land`,readyForReview:`needs review`,working:`working`},subtitle:{noTracking:`no activity tracking`,materializing:`materializing`,deleting:`deleting`,deleteFailed:`delete failed`},reBranch:{title:`Set branch`,fieldLabel:`branch`,hintNoBranches:`(no local branches — type a new name)`,hintNoMatch:`(no match — enter renames to this branch)`,footer:`↑↓ pick · enter set · esc cancel`},toast:co},fo={nav:{kanban:`看板`,automations:`例行任务`,issues:`议题`,mods:`Mods`},header:{scratch:`未分组`,connector:{weixin:`微信`,lark:`飞书`,inbox:`外部消息`}},search:{placeholder:`模糊搜索`},sort:{label:`排序:{mode}`,hint:`切换排序(手动 → 最新 → 关注 → 名称)`,reorderSwitched:`调整顺序需手动排序,已切换`,modes:{default:`手动`,recent:`最新`,attention:`关注`,name:`名称`}},menu:so,status:{backlog:`待办`,inProgress:`进行中`,inReview:`待评审`,done:`已完成`,canceled:`已取消`,error:`出错`},setStatus:{title:`设置状态`,current:`当前`,footer:`↑↓ 选择 · enter 设置 · esc 取消`},moveToProject:{title:`移动会话到`,empty:"还没有其他项目——先添加一个,或运行 `rove api update --project PATH`",ungrouped:`未分组`,footer:`↑↓ 选择 · enter 移动 · esc 取消`},sync:{done:`已把 {base} 合并进该工作树`,alreadyCurrent:`已经和 {base} 同步`,conflict:`合并冲突——解决后提交:{files}`,dirty:`请先提交工作树里的改动,再同步:{files}`,failed:`同步失败:{error}`},abortOp:{title:`中止这次 {op}?`,body:`Git 会把 {branch} 恢复到 {op} 开始之前的状态,此后做过的冲突解决都会丢失。`,confirm:`中止 {op}`,done:`已中止 {branch} 上的 {op}`,failed:`无法中止 {op}:{error}`},archive:{done:`已归档 {title}`,restored:`已恢复 {title}`,busyTitle:`它还在工作,仍要归档?`,busyBody:`{title} 里有引擎仍在工作或在等你。归档会把它停掉。`,busyConfirm:`仍要归档`,failed:`归档失败:{error}`,restoreFailed:`恢复失败:{error}`},rerun:{started:`正在重新运行失败的检查`,none:`没有可重新运行的失败检查`,external:`这些检查不是在 GitHub Actions 上运行的,请到它们运行的地方重新运行`,refused:`无法重新运行:{detail}`},changeEngine:{title:`切换引擎`,current:`当前`,effortLabel:`推理强度`,noEffort:`引擎默认`,footer:{engine:`↑↓ 引擎`,effort:`←→ 强度`,model:`tab 模型`,set:`enter 设置`,cancel:`esc 取消`}},engineModel:{label:`模型`,placeholder:`引擎默认`,loading:`正在列出模型…`},tier:{swift:`轻快`,standard:`标准`,deep:`深入`,manual:`手动`},tierDesc:{swift:`小而明确的改动——最快、最省的一档`,standard:`日常的功能开发和修 bug`,deep:`难题:根因不明、大重构、设计决策`},runAgain:{title:`重新运行`,source:`来自任务「{title}」的指令`,hint:`在新任务里重新执行这段指令,新任务有自己的分支和工作树。`,confirm:`重新运行`,footer:`↑↓ 滚动 · ←→ 选择 · enter 运行 · esc 取消`},confirm:ao,renameBranch:{title:`重命名分支`,fieldLabel:`分支`},fieldNotes:{title:`现场笔记`,empty:"该仓库暂无现场笔记——agent 可用 `rove api note` 记录。",loading:`加载中…`,footer:`↑↓ 滚动 · esc 关闭`,footerDeletable:`↑↓ 选择 · d 删除 · esc 关闭`,confirmDelete:{title:`删除这条现场笔记?`,body:`「{text}」将不再注入该仓库的新会话。其他内容不受影响。`}},moveChip:` 移动`,recentJump:`最近:{title}`,archivedHit:`{title} · 已归档,回车恢复`,machine:{connecting:`连接中…`,offline:`离线`,unsupported:`不支持`,mismatch:`协议不兼容`,filesElsewhere:`在 {host} 上`,filesHint:`{host} 暂时连不上;重新连上后这里会再显示它的文件。`,terminalElsewhere:`这个任务跑在 {host} 上,暂时连不上。`,runsOn:`在 {host} 上`,noTabs:`{host} 上还没有 tab——按 prefix t 在那里新开一个。`},empty:{noMatchSearch:`无匹配任务——按 esc 清除。`,noActiveProject:`该项目暂无活跃任务。`,noActive:`暂无活跃任务——在上方新建。`},activity:{working:`运行中`,rateLimited:`请求受限`,permissionNeeded:`等待授权`,error:`错误`,dead:`引擎已退出`},group:{waitingOnYou:`等你处理`,landing:`可以合了`,readyForReview:`待你验收`,working:`运行中`},subtitle:{noTracking:`不跟踪活动`,materializing:`正在创建 worktree`,deleting:`正在删除`,deleteFailed:`删除失败`},reBranch:{title:`设置分支`,fieldLabel:`分支`,hintNoBranches:`(没有本地分支——输入新名称)`,hintNoMatch:`(无匹配——回车将分支重命名为此名)`,footer:`↑↓ 选择 · enter 设置 · esc 取消`},toast:lo},po={noTask:`(no task — press n to create)`,exited:`process exited — F5 restarts it`,engineExit:{title:`Engine exited`,titleCode:`Engine exited (code {code})`,retry:`Retry`,settings:`Settings → Engines`,another:`Another engine`,continueIn:`Continue in another engine`},usageLimit:{title:`Usage limit reached`,dismiss:`Dismiss`},restoring:`restoring session…`,recovery:{live:`Live process reattached`,relaunched:`Command relaunched in a new process. Any restored output is historical; check the engine to resume or continue your conversation.`,restored:`Historical screen restored; previous process ended. Restart and check the engine before continuing.`},tab:{groupTitle:`group {n}`,renameTitle:`Rename tab`,renameField:`TAB TITLE`,renameSubmit:`rename`,chooseEngineHint:`←/→ or h/l choose, enter confirm, esc cancel`,newChat:{title:`New conversation`,engine:`ENGINE`,destLabel:`DESTINATION`,destTab:`child task, same directory`,destFork:`fork a child task (new worktree)`,destScratch:`new scratch task ($HOME)`,ctxLabel:`CONTEXT`,ctxFresh:`fresh conversation`,ctxContinue:`continue this conversation`},cannotCloseLast:`Cannot close the only tab`,tabGone:`That tab is no longer there`,closeOthersTitle:`Close the other tabs?`,closeOthersBody:`Closing {count} · their sessions end, this tab stays open.`,closeOthersConfirm:`close tabs`,closeOthersCancel:`cancel`,menu:{rename:`Rename tab`,copyAddress:`Copy tab address`,copySessionId:`Copy session ID`,continueEngine:`Continue in another engine…`,closeOthers:`Close other tabs`,close:`Close tab`},nothingToFork:`No conversation in this tab to fork yet`,noSessionYet:`No conversation in this tab yet`,noSessionYetHint:`Send the engine a prompt; its session ID exists once the conversation starts.`,noTranscriptToHandOff:`{engine} keeps no readable transcript to hand over`},split:{renameTitle:`Rename split`,renameField:`SPLIT NAME`},scrolledBack:`↑ scrolled {lines}L`,scrollFirst:`[first]`,scrollLatest:`[latest]`,unavailable:{shellMissing:`terminal unavailable — the shell named by $SHELL isn't on this machine. Point $SHELL at one that exists, or unset it to fall back to the system default.`,spawnFailed:`terminal unavailable — the shell exited immediately. Its error is in ~/.rove/pty.log.`,retry:`F5 tries again`},reset:{title:`Reset terminal?`,body:`The running shell will be killed and a fresh one will spawn at the worktree. Any in-flight processes (vim, htop, paused jobs) end immediately.`}},mo={recovery:{live:`已重新连接仍在运行的进程`,relaunched:`命令已在新进程中重启。如有恢复的输出,它属于历史记录;请在引擎内确认会话恢复或继续操作。`,restored:`已恢复历史画面;原进程已结束。请重启并确认引擎状态后继续。`},noTask:`(无任务 —— 按 n 创建)`,exited:`进程已退出 —— 按 F5 重启`,engineExit:{title:`引擎已退出`,titleCode:`引擎已退出(退出码 {code})`,retry:`重试`,settings:`设置 → 引擎`,another:`换个引擎`,continueIn:`换个引擎继续`},usageLimit:{title:`已达到用量上限`,dismiss:`忽略`},restoring:`正在恢复会话…`,tab:{groupTitle:`group {n}`,renameTitle:`重命名标签页`,renameField:`标签页名称`,renameSubmit:`重命名`,chooseEngineHint:`←/→ 或 h/l 选择,enter 确认,esc 取消`,newChat:{title:`新建对话`,engine:`引擎`,destLabel:`落点`,destTab:`子任务,同一目录`,destFork:`fork 子任务(新 worktree)`,destScratch:`新临时任务($HOME)`,ctxLabel:`上下文`,ctxFresh:`全新对话`,ctxContinue:`接着当前对话`},cannotCloseLast:`无法关闭唯一的标签页`,tabGone:`这个标签页已经不在了`,closeOthersTitle:`关闭其他标签页?`,closeOthersBody:`将关闭 {count} 个,它们的会话会结束,只保留这个标签页。`,closeOthersConfirm:`关闭标签页`,closeOthersCancel:`取消`,menu:{rename:`重命名标签页`,copyAddress:`复制标签页地址`,copySessionId:`复制会话 ID`,continueEngine:`换个引擎继续…`,closeOthers:`关闭其他标签页`,close:`关闭标签页`},nothingToFork:`这个标签页还没有可派生的对话`,noSessionYet:`这个标签页还没有对话`,noSessionYetHint:`先给引擎发一条消息,对话开始后才有会话 ID。`,noTranscriptToHandOff:`{engine} 没有可读的对话记录,无法交接`},split:{renameTitle:`重命名分屏`,renameField:`分屏名称`},scrolledBack:`↑ 已回滚 {lines} 行`,scrollFirst:`[最早]`,scrollLatest:`[最新]`,unavailable:{shellMissing:`终端不可用 —— $SHELL 指向的 shell 在这台机器上不存在。请把 $SHELL 指向一个真实存在的 shell,或取消设置以回退到系统默认。`,spawnFailed:`终端不可用 —— shell 启动后立即退出。具体错误见 ~/.rove/pty.log。`,retry:`按 F5 重试`},reset:{title:`重置终端?`,body:`正在运行的 shell 会被杀掉并在 worktree 重新启动,进行中的进程(vim、htop、暂停的任务)会立即结束。`}},ho={pageTitle:`ROVE UPDATE`,closeHint:`q / esc close`,chip:`↑ {version}`,current:`current`,available:`v{version} available`,latest:`latest`,latestUnknown:`unknown — could not reach the registry`,registryRetry:`Check your connection, then close and reopen Update to retry.`,upToDate:`No newer release — nothing to install.`,releaseUrlUnavailable:`release URL unavailable; visit github.com/Sma1lboy/rove/releases`,statusReleaseOpened:`Opened release page in your browser.`,statusReleaseError:`Could not open release URL. Visit github.com/Sma1lboy/rove/releases in your browser.`,statusRunningUpdater:`Closing the TUI and running the updater in this terminal...`,loadingNotes:`Loading release notes...`,notesUnavailable:`Release notes are unavailable. Use Open release to view the GitHub release page.`,changesSectionHeader:`── changes from v{from} to v{to} ──`,otherClients:`Also in this release: {count} for other clients`,scopes:{ios:`Phone & iPhone app`,web:`Web`,tui:`Terminal (TUI)`,cli:`Command line`,daemon:`Background service`,android:`Android app`,other:`Other`},updateComplete:`Rove update complete. Relaunch Rove to use the new version.`,updateFailed:"Rove update failed with exit code {code}. Check the output above, then run `rove update` to retry.",pressAnyKey:`Press any key to close this update window.`,webRunning:`Running {command} …`,webInstalled:`Installed. Restart Rove to run v{latest}; this page reloads itself when it is back.`,webRestart:`Restart Rove`,webRestarting:`Restarting Rove… this page reloads itself when it is back.`,webStartFailed:`Could not start the updater: {error}`,actions:{updateNow:`Update now`,openRelease:`Open release`,close:`Close`,closeDetail:`return to the workspace`},whatsNew:{title:`WHAT'S NEW 🎉`,closeHint:`q / esc continue`,upgraded:`You're now on Rove v{to}, up from v{from}. Here's what changed.`,notesUnavailable:`Could not load the release notes — check your connection, or read them on GitHub.`,sourceHint:`release notes: {url}`},skew:{title:`⚠ DAEMON OUT OF DATE`,olderBuild:`an older build`,hint:`daemon is {daemon} — you launched v{clientVersion}. Press {keys} to refresh Rove onto the installed build`,hintNoKey:"daemon is {daemon} — you launched v{clientVersion}. Run `rove daemon restart`, then relaunch Rove"},refresh:{confirmTitle:`Refresh Rove?`,confirmBody:`Rove restarts the daemon and relaunches itself on the installed build. Running engine sessions live in the PTY host and keep going; open tabs come back.`,confirmLabel:`Refresh`,relaunching:`rove: restarting on the installed build...`,alreadyCurrent:`Rove and the daemon already run the same build — nothing to refresh.`,installGone:"This Rove was installed from a directory that no longer exists, so it cannot relaunch itself. Reinstall with `npm install -g @sma1lboy/rove`."},staleInstall:{title:`✕ ROVE INSTALL IS GONE`,hint:"this Rove is running from an install that no longer exists on disk, so it cannot start a daemon. Reinstall (`npm install -g @sma1lboy/rove`) and relaunch Rove"},versions:{pageTitle:`ROVE VERSIONS`,loading:`Loading releases...`,unavailable:`Could not fetch releases. Check your connection or wait for the rate limit, then reopen this page.`,tagCurrent:`current`,tagLatest:`latest`,tagBreaking:`breaking`,breakingWarning:"⚠ installing this crosses breaking version(s) {versions}. Rove will refuse to start until you run `rove reset`, which stops the daemon, the PTY host, and every live session. Tasks and worktrees are kept.",footerHint:`j/k select · enter install · q close`,closeHint:`q / esc close`}},go={pageTitle:`ROVE 更新`,closeHint:`q / esc 关闭`,chip:`↑ {version}`,current:`当前`,available:`有新版本 v{version}`,latest:`最新`,latestUnknown:`未知 —— 无法连接到 registry`,registryRetry:`请检查网络,然后关闭并重新打开更新页重试。`,upToDate:`没有更新的版本 —— 无需安装。`,releaseUrlUnavailable:`发布链接不可用;请访问 github.com/Sma1lboy/rove/releases`,statusReleaseOpened:`已在浏览器中打开发布说明页面。`,statusReleaseError:`无法打开发布链接。请在浏览器访问 github.com/Sma1lboy/rove/releases。`,statusRunningUpdater:`正在关闭 TUI,并在当前终端中运行更新程序……`,loadingNotes:`正在加载发布说明……`,notesUnavailable:`发布说明不可用。请使用「打开发布页」查看 GitHub 发布页面。`,changesSectionHeader:`── v{from} 至 v{to} 的变更 ──`,otherClients:`本版本还有 {count} 条其他客户端的更新`,scopes:{ios:`手机与 iPhone 应用`,web:`网页端`,tui:`终端 (TUI)`,cli:`命令行`,daemon:`后台服务`,android:`Android 应用`,other:`其他`},updateComplete:`Rove 更新完成。请重新启动 Rove 以使用新版本。`,updateFailed:"Rove 更新失败,退出码为 {code}。请检查上方输出,再运行 `rove update` 重试。",pressAnyKey:`按任意键关闭此更新窗口。`,webRunning:`正在运行 {command} …`,webInstalled:`已安装。重启 Rove 后运行 v{latest};恢复后页面会自动刷新。`,webRestart:`重启 Rove`,webRestarting:`正在重启 Rove… 恢复后页面会自动刷新。`,webStartFailed:`无法启动更新程序:{error}`,actions:{updateNow:`立即更新`,openRelease:`打开发布页`,close:`关闭`,closeDetail:`返回工作区`},whatsNew:{title:`更新内容 🎉`,closeHint:`q / esc 继续`,upgraded:`Rove 已从 v{from} 更新到 v{to},本次变更如下。`,notesUnavailable:`无法加载发布说明 —— 请检查网络连接,或到 GitHub 上查看。`,sourceHint:`发布说明:{url}`},skew:{title:`⚠ DAEMON 版本不一致`,olderBuild:`旧版本构建`,hint:`daemon 运行的是 {daemon},而你启动的是 v{clientVersion}。按 {keys} 可让 Rove 刷新到已安装的版本`,hintNoKey:"daemon 运行的是 {daemon},而你启动的是 v{clientVersion}。请运行 `rove daemon restart`,然后重新启动 Rove"},refresh:{confirmTitle:`刷新 Rove?`,confirmBody:`Rove 会重启 daemon,并以已安装的版本重新启动自身。正在运行的引擎会话由 PTY host 托管,不会中断;已打开的标签页会恢复。`,confirmLabel:`刷新`,relaunching:`rove:正在以已安装的版本重新启动……`,alreadyCurrent:`Rove 与 daemon 已经是同一个版本 —— 无需刷新。`,installGone:"当前 Rove 的安装目录已不存在,无法重新启动自身。请运行 `npm install -g @sma1lboy/rove` 重新安装。"},staleInstall:{title:`✕ ROVE 安装已不存在`,hint:"当前 Rove 运行自一份已从磁盘删除的安装,因此无法启动 daemon。请重新安装(`npm install -g @sma1lboy/rove`)并重新启动 Rove"},versions:{pageTitle:`ROVE 版本列表`,loading:`正在加载发布列表……`,unavailable:`无法获取发布列表。请检查网络或等待限流解除,然后重新打开本页。`,tagCurrent:`当前`,tagLatest:`最新`,tagBreaking:`breaking`,breakingWarning:"⚠ 安装该版本会跨过 breaking 版本 {versions}。更新后 Rove 会拒绝启动,直到你运行 `rove reset`——它会停掉 daemon、PTY host 和所有活动会话。任务和 worktree 会保留。",footerHint:`j/k 选择 · enter 安装 · q 关闭`,closeHint:`q / esc 关闭`}},_o={quit:{confirmTitle:`Quit Rove?`,confirmBody:`The daemon and task sessions keep running. This closes only the native workspace.`,confirmLabel:`Quit`},narrowBack:`Tasks`,noPreviousTask:`No previous task to go back to`,empty:{selectTask:`Select a task with a worktree`,noSessions:`No sessions here — press ⏎ to start {engine}, or ctrl+e to pick another`,noSessionsShell:`No sessions here — press ⏎ to start a shell, or ctrl+e to pick another`,externalToAgent:`Nothing ran on this message — press ⏎ to give it to an agent`,remoteUnsupported:`Hosted engine launch over SSH is not implemented — this task's worktree is on {host}`,archived:`Archived — no live terminal`,unarchive:`[ Unarchive ]`},welcome:{title:`Welcome to Rove`,tagline:`All your coding agents in one place: when one runs out of quota, switch the task to another, and agents talk to each other directly.`,worktreeExplain:`Managed tasks create isolated worktrees and branches. Directory and project tasks reuse existing files; tabs within a task share its directory.`,stepNew:`creates your first task — pick a repo, a base branch, an engine`,stepHelp:`shows every shortcut reachable from the current focus`,stepPrefix:`opens the command menu`,enginesFound:`✓ engines: {list}`,enginesSignedOut:`✗ installed but not signed in: {list} — run one of them in a shell and log in`,enginesMissing:`✗ no engine CLI found — install claude, codex, copilot, or kimi, then restart Rove`,gitMissing:`✗ git not found on PATH — Rove needs git to create worktrees`,doctorHint:"run `rove doctor` in a shell for the full diagnosis",docsHint:`docs: https://docs.rove.run`},attention:{none:`No available Inbox items`},inbox:{title:`INBOX`,chip:`inbox {count}`,empty:`No pending attention`,openHint:`enter open`,clearHint:`d ack`,clearAllHint:`D ack all`,more:`+{count} more`,section:{attention:`ATTENTION`,recent:`RECENT`},state:{done:`done`,needsInput:`needs input`,error:`error`,rateLimited:`rate limited`,running:`running`,dead:`engine exited`,restored:`restored after restart`,routineFailed:`routine needs you`,reportMissing:`report missing`,decisionNeeded:`decision needed`,gateAnswered:`answered · engine not running`},resumesAt:`resumes {time}`}},vo={quit:{confirmTitle:`退出 Rove?`,confirmBody:`守护进程和任务会话会继续运行,这里只关闭原生工作区。`,confirmLabel:`退出`},narrowBack:`任务`,noPreviousTask:`没有可以回去的上一个任务`,empty:{selectTask:`请选择一个带 worktree 的任务`,noSessions:`这里没有会话——按 ⏎ 启动 {engine},或按 ctrl+e 另选一个`,noSessionsShell:`这里没有会话——按 ⏎ 启动 shell,或按 ctrl+e 另选一个`,externalToAgent:`这条消息没有启动任何 agent——按 ⏎ 交给 agent 分析`,remoteUnsupported:`尚未实现通过 SSH 启动托管引擎——该任务的 worktree 在 {host} 上`,archived:`已归档——没有在运行的终端`,unarchive:`[ 取消归档 ]`},welcome:{title:`欢迎使用 Rove`,tagline:`所有编程 agent 都在一个地方:一个额度用完了,换另一个接着干;agent 之间直接对话,不用你传话。`,worktreeExplain:`托管任务创建独立的 worktree 和分支。目录与项目任务复用现有文件;同一任务内的标签页共享目录。`,stepNew:`创建你的第一个任务——选仓库、基础分支和引擎`,stepHelp:`查看当前焦点下的全部快捷键`,stepPrefix:`打开命令菜单`,enginesFound:`✓ 已检测到引擎:{list}`,enginesSignedOut:`✗ 已安装但未登录:{list}——请在 shell 里运行其中之一并完成登录`,enginesMissing:`✗ 未找到引擎 CLI——请安装 claude、codex、copilot 或 kimi 后重启 Rove`,gitMissing:`✗ PATH 上没有 git——Rove 需要 git 来创建 worktree`,doctorHint:"在 shell 里运行 `rove doctor` 查看完整诊断",docsHint:`文档:https://docs.rove.run`},attention:{none:`收件箱中没有可打开的项目`},inbox:{title:`收件箱`,chip:`收件箱 {count}`,empty:`暂无待处理`,openHint:`enter 打开`,clearHint:`d 已阅`,clearAllHint:`D 全部已阅`,more:`还有 {count} 条`,section:{attention:`待处理`,recent:`最近使用`},state:{done:`完成`,needsInput:`需要输入`,error:`出错`,rateLimited:`限流`,running:`进行中`,dead:`引擎已退出`,restored:`重启后已恢复`,routineFailed:`例行任务需要处理`,reportMissing:`未回报`,decisionNeeded:`等你决定`,gateAnswered:`已回答 · 引擎未运行`},resumesAt:`{time} 恢复`}},yo={title:`Worktrees`,loading:`Loading worktrees…`,noProjects:`No local projects known to Rove yet.`,loadFailed:`Could not read the worktrees: {message}`,noWorktrees:`No worktrees.`,badge:{roveManaged:`rove`,dirty:`dirty`,dirtyUnknown:`dirty?`,remoteOn:`on remote`,remoteOff:`not pushed`,remoteUnknown:`remote unknown`},verdict:{prOpen:`PR open`,prMerged:`merged (PR)`,inMain:`in main`,prClosed:`PR closed`,idle:`stale`},row:{detached:`(detached)`,created:`created {age} ago`},delete:{button:`Delete`,confirmTitle:`Delete worktree?`,confirmBody:`Delete the worktree for "{branch}"? This removes the working directory; the branch itself is kept.`,forceTitle:`Force delete worktree?`,forceBody:'"{branch}" has uncommitted, untracked, or gitignored work. Force delete removes the worktree, but the work is snapshotted first to a salvage ref — list them with `git for-each-ref refs/rove/salvage`. Force delete anyway?',forceReason:`Refused because: {reason}`,failed:`Failed to delete worktree: {error}`,residue:`Git deregistered the worktree, but couldn't delete {path} ({reason}). Rove is done with it — retrying won't help; delete the directory by hand if you want the space.`},land:{button:`Land`,confirmTitle:`Land branch?`,confirmBody:`Merge "{branch}" into {landedOn} ({commits} commits), then remove this worktree? The branch is kept. Conflicts abort with a file list.`,confirmBodyOne:`Merge "{branch}" into {landedOn} (1 commit), then remove this worktree? The branch is kept. Conflicts abort with a file list.`,noTask:`This worktree isn't tracked as a Rove task — nothing to land.`,conflict:`Land hit conflicts (merge aborted). Resolve by hand: {files}`,dirtyBase:"The base checkout has uncommitted changes — commit them, then land. Never `git stash` here: the stash stack lives in the repo's common dir and is shared by every linked worktree, so a stash can entangle other tasks' work.",failed:`Land failed: {error}`,refusal:{EMPTY_BRANCH:`Nothing to land: "{branch}" has no commits ahead of {landedOn}.`,EMPTY_BRANCH_DIRTY_WORKTREE:`Nothing to land yet: "{branch}" has no commits ahead of {landedOn}, but its worktree has uncommitted changes ({files}). Commit them there, then land.`,MISSING_REF:`"{branch}" is gone from the project: it was renamed or deleted outside Rove.`,DETACHED_HEAD:`The project checkout is not on a branch. Check one out there, then land.`,SAME_BRANCH:`The project checkout is already on "{branch}", so there is nothing to land it onto.`,UNBORN_BASE:`{landedOn} has no commits yet, so there is nothing to merge into. Make the first commit there, then land.`,UNREADABLE_BASE:`Could not read the project checkout. Is it still a git repository?`},done:`Landed "{branch}" onto {landedOn} ({commit}).`,worktreeKept:`Landed, but the worktree was kept: {reason}`,worktreePathStale:`Landed and removed the worktree, but the task still points at it: {reason}`,worktreeResidue:`Landed. Git deregistered the worktree, but couldn't delete {path} ({reason}) — delete the directory by hand if you want the space.`},hint:{}},bo={title:`工作树`,loading:`正在加载 worktree…`,noProjects:`Rove 还没有已知的本地项目。`,loadFailed:`读不到 worktree 列表:{message}`,noWorktrees:`没有 worktree。`,badge:{roveManaged:`rove`,dirty:`有改动`,dirtyUnknown:`改动未知`,remoteOn:`已推送`,remoteOff:`未推送`,remoteUnknown:`远端未知`},verdict:{prOpen:`PR 评审中`,prMerged:`已合入 (PR)`,inMain:`已在主分支`,prClosed:`PR 已关闭`,idle:`陈旧`},row:{detached:`(游离状态)`,created:`{age}前创建`},delete:{button:`删除`,confirmTitle:`删除 worktree?`,confirmBody:`确定删除 "{branch}" 对应的 worktree?工作目录会被移除,分支本身会保留。`,forceTitle:`强制删除 worktree?`,forceBody:'"{branch}" 存在未提交、未跟踪或被 gitignore 的改动。强制删除会移除 worktree,但这些改动会先被快照到一个 salvage ref——用 `git for-each-ref refs/rove/salvage` 可以列出它们。仍要强制删除吗?',forceReason:`拒绝原因:{reason}`,failed:`删除 worktree 失败:{error}`,residue:`Git 已注销该 worktree,但没能删掉 {path}({reason})。Rove 这边已经处理完了——重试没有用;想要回磁盘空间请手动删除该目录。`},land:{button:`合入`,confirmTitle:`合入分支?`,confirmBody:`把 "{branch}" 合入 {landedOn}({commits} 个提交),然后移除这个 worktree?分支会保留。冲突会中止并给出文件清单。`,confirmBodyOne:`把 "{branch}" 合入 {landedOn}(1 个提交),然后移除这个 worktree?分支会保留。冲突会中止并给出文件清单。`,noTask:`该 worktree 未作为 Rove 任务被跟踪——没有可合入的对象。`,conflict:`合入遇到冲突(已中止)。请手动解决:{files}`,dirtyBase:"基础检出有未提交改动——请先提交再合入。绝不要在这里 `git stash`:stash 栈存放在仓库的 common dir 中,该仓库所有 linked worktree 共享,一次 stash 可能纠缠其他任务的工作。",failed:`合入失败:{error}`,refusal:{EMPTY_BRANCH:`没有可合入的内容:"{branch}" 比 {landedOn} 没有多出任何提交。`,EMPTY_BRANCH_DIRTY_WORKTREE:`还没有可合入的内容:"{branch}" 比 {landedOn} 没有多出提交,但它的 worktree 里有未提交的改动({files})。先在那里提交,再合入。`,MISSING_REF:`项目里已经没有 "{branch}" 了:它在 Rove 之外被改名或删除。`,DETACHED_HEAD:`项目检出不在任何分支上。先在那里检出一个分支,再合入。`,SAME_BRANCH:`项目检出已经在 "{branch}" 上,没有可以合入的目标。`,UNBORN_BASE:`{landedOn} 还没有任何提交,没有可合入的目标。先在那里做第一次提交,再合入。`,UNREADABLE_BASE:`读不了项目检出。它还是 git 仓库吗?`},done:`已把 "{branch}" 合入 {landedOn}({commit})。`,worktreeKept:`已合入,但 worktree 保留了:{reason}`,worktreePathStale:`已合入并移除 worktree,但任务仍指向它:{reason}`,worktreeResidue:`已合入。Git 已注销该 worktree,但没能删掉 {path}({reason})——想要回磁盘空间请手动删除该目录。`},hint:{}};G();var xo={common:{en:Ka,zh:qa},doctor:{en:Ja,zh:Ya},files:{en:Xa,zh:Za},newTask:{en:Qa,zh:$a},onboarding:{en:eo,zh:to},quickTask:{en:no,zh:ro},tasks:{en:uo,zh:fo},terminal:{en:po,zh:mo},update:{en:ho,zh:go},workspace:{en:_o,zh:vo},worktrees:{en:yo,zh:bo}};function So(e,t){let n=e;for(let e of t.split(`.`)){if(!n||typeof n!=`object`||!(e in n))return;n=Reflect.get(n,e)}return typeof n==`string`?n:void 0}function Y(e,t,n){let r=xo[e],i=So(r[Cn.get()],t)??So(r.en,t)??t;return n?i.replace(/\{(\w+)\}/g,(e,t)=>String(n[t]??e)):i}G(),A(),H();var Co=O({stale:!1,daemonVersion:null,bridgeVersion:null}),wo=2e4;async function To(e){try{let t=await e.request(`daemon.info`);return Co.set({stale:t.stale,daemonVersion:t.daemonVersion,bridgeVersion:t.bridgeVersion}),t.stale}catch{return Co.get().stale}}function Eo(e){(0,J.useEffect)(()=>{let t=e.onOpen(()=>void To(e)),n=Ga(wo,()=>void To(e));return()=>{t(),n()}},[e])}function Do(e){if(!Co.get().stale){z(Y(`update`,`refresh.alreadyCurrent`),`error`);return}B.set((0,K.jsx)(Ha,{title:Y(`update`,`refresh.confirmTitle`),body:U(`layout.refreshConfirm`),confirmLabel:Y(`update`,`refresh.confirmLabel`),onConfirm:async()=>{await e.request(`daemon.restart`),z(Y(`update`,`refresh.relaunching`));for(let t=0;t<20;t++)if(await new Promise(e=>window.setTimeout(e,1e3)),!await To(e))return;throw Error(U(`layout.refreshTimeout`))}}))}var Oo=[`info`,`success`,`warning`,`error`,`muted`],ko=4e3,Ao=4e3,jo=/^[A-Za-z0-9._:-]{1,64}$/,Mo={box:new Set([`type`,`direction`,`gap`,`padding`,`border`,`children`]),text:new Set([`type`,`text`,`tone`,`bold`]),button:new Set([`type`,`key`,`label`,`tone`]),input:new Set([`type`,`key`,`placeholder`,`value`])};function No(e){return typeof e==`string`&&Oo.includes(e)}function Po(e){return e===0||e===1||e===2||e===3}var Fo=class extends Error{};function Io(e){let t=0,n=new Set,r=(e,i,a)=>{if(a>12)throw new Fo(`${i}: deeper than 12`);if(++t>400)throw new Fo(`more than 400 elements`);if(!e||typeof e!=`object`||Array.isArray(e))throw new Fo(`${i}: not an element`);let o=e,s=o.type;if(s!==`box`&&s!==`text`&&s!==`button`&&s!==`input`)throw new Fo(`${i}: unknown element ${JSON.stringify(s)}`);for(let e of Object.keys(o))if(!Mo[s].has(e))throw new Fo(`${i}: ${s} has no prop "${e}"`);if(o.tone!==void 0&&!No(o.tone))throw new Fo(`${i}: tone must be one of ${Oo.join(`, `)}`);if(s===`text`){if(typeof o.text!=`string`||o.text.length>4e3)throw new Fo(`${i}: text must be a string of at most ${ko} chars`);if(o.bold!==void 0&&typeof o.bold!=`boolean`)throw new Fo(`${i}: bold must be boolean`);return{type:s,text:o.text,...o.tone===void 0?{}:{tone:o.tone},...o.bold?{bold:!0}:{}}}if(s===`button`||s===`input`){if(typeof o.key!=`string`||!jo.test(o.key))throw new Fo(`${i}: bad ${s} key`);if(n.has(o.key))throw new Fo(`${i}: duplicate key "${o.key}"`);n.add(o.key)}if(s===`input`){for(let e of[`placeholder`,`value`]){let t=o[e];if(t!==void 0&&(typeof t!=`string`||t.length>4e3))throw new Fo(`${i}: ${e} must be a string of at most ${Ao} chars`)}return{type:s,key:o.key,...o.placeholder===void 0?{}:{placeholder:o.placeholder},...o.value===void 0?{}:{value:o.value}}}if(s===`button`){if(typeof o.label!=`string`||o.label.length===0||o.label.length>40)throw new Fo(`${i}: label must be 1-40 chars`);return{type:s,key:o.key,label:o.label,...o.tone===void 0?{}:{tone:o.tone}}}if(o.direction!==void 0&&o.direction!==`row`&&o.direction!==`column`)throw new Fo(`${i}: direction must be "row" or "column"`);for(let e of[`gap`,`padding`])if(o[e]!==void 0&&!Po(o[e]))throw new Fo(`${i}: ${e} must be 0-3`);if(o.border!==void 0&&typeof o.border!=`boolean`)throw new Fo(`${i}: border must be boolean`);if(!Array.isArray(o.children))throw new Fo(`${i}: box needs children`);return{type:s,...o.direction===void 0?{}:{direction:o.direction},...o.gap===void 0?{}:{gap:o.gap},...o.padding===void 0?{}:{padding:o.padding},...o.border?{border:!0}:{},children:o.children.map((e,t)=>r(e,`${i}.children[${t}]`,a+1))}};try{return{ok:!0,tree:r(e,`tree`,1)}}catch(e){if(e instanceof Fo)return{ok:!1,error:e.message};throw e}}function Lo(e){let t=e?.panes;if(!Array.isArray(t))return null;let n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=e;if(typeof t.plugin!=`string`||typeof t.id!=`string`||typeof t.title!=`string`)continue;let r=Io(t.tree);r.ok&&n.push({plugin:t.plugin,id:t.id,title:t.title,tree:r.tree})}return n}function Ro(e){let t=[],n=(e,r,i)=>{if(e.type===`button`||e.type===`input`)t.push({kind:e.type,plugin:r,pane:i,key:e.key});else if(e.type===`box`)for(let t of e.children)n(t,r,i)};for(let t of e)n(t.tree,t.plugin,t.id);return t}function zo(e,t){return e!==null&&t!==null&&e.plugin===t.plugin&&e.pane===t.pane&&e.key===t.key}function Bo(e,t){return e.find(e=>zo(e,t))??e[0]??null}function Vo(e,t,n){if(e.length===0)return null;let r=e.findIndex(e=>zo(e,t));return r<0?e[0]??null:e[(r+n+e.length)%e.length]??null}function Ho(e,t){if(!t)return e;let n=new Map(e.map(e=>[e.id,e]));for(let e of t.remove)n.delete(e);for(let e of t.upsert)n.set(e.id,e);return t.order?t.order.flatMap(e=>n.get(e)??[]):e.map(e=>n.get(e.id)??e)}function Uo(e,t){return{...e,rev:t.rev,tasks:Ho(e.tasks,t.tasks),...t.archived?{archived:Ho(e.archived??[],t.archived)}:{},...t.attention?{attention:t.attention}:{},...t.gates?{gates:t.gates}:{}}}function Wo(e){return!!e&&typeof e==`object`&&typeof e.from==`number`}function Go(e,t){if(!e)return!0;let n=e.toLowerCase(),r=t.toLowerCase(),i=0;for(let e=0;e<r.length&&i<n.length;e++)r.charCodeAt(e)===n.charCodeAt(i)&&i++;return i===n.length}var Ko=e=>e.kind===`dir`&&e.noProject===!0,qo=e=>e.split(/[\\/]/).filter(Boolean),Jo=e=>qo(e).pop()??e;function Yo(e,t,n=``){let r=Jo(e),i=t.filter(t=>(t.repo!==e||t.host!==n)&&Jo(t.repo)===r);if(i.length===0)return r;let a=e=>qo(e).slice(-2).join(`/`);return i.some(e=>e.host===n)?i.some(t=>t.host!==n&&a(t.repo)===a(e))&&n?`${n}:${a(e)}`:a(e):n?`${n}:${r}`:r}var Xo=e=>e.startsWith(`root:`)?null:e.split(`/`).slice(-2).join(`/`);function Zo(e,t){let n=Jo(e.repo),r=t.filter(t=>t!==e&&Jo(t.repo)===n);if(r.length===0)return n;let i=e.repoId,a=i?Xo(i):null;return i&&a?r.some(e=>e.repoId&&e.repoId!==i&&Xo(e.repoId)===a)?i:a:Yo(e.repo,[e,...r].map(e=>({repo:e.repo,host:``})))}var Qo=/\s+#\d+\/\d+$/,$o=(e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``)||e.id.localeCompare(t.id),es=e=>e.groupId?`${e.machine?.id??``}\0${e.groupId}`:null;function ts(e){let t=new Map;for(let n of e){let e=es(n);if(e===null)continue;let r=t.get(e);r?r.push(n):t.set(e,[n])}for(let[e,n]of t)n.length<2?t.delete(e):n.sort($o);return t}function ns(e){return(e[0]?.label??``).replace(Qo,``)}function rs(e){let t=e=>e.engine?.name??e.label,n=new Map;for(let r of e)n.set(t(r),(n.get(t(r))??0)+1);let r=new Map;return new Map(e.map(e=>{let i=t(e),a=(r.get(i)??0)+1;return r.set(i,a),[e.id,(n.get(i)??0)>1?`${i} #${a}`:i]}))}G();var is=[`default`,`recent`,`attention`,`name`],as={folded:new Set,opened:new Set},os=e=>{let t=Date.parse(e??``);return Number.isFinite(t)?t:0},ss=e=>os(e.updatedAt??e.createdAt),cs=e=>os(e.createdAt),ls=(e,t)=>cs(t)-cs(e)||t.id.localeCompare(e.id),us=(e,t)=>ss(t)-ss(e)||t.id.localeCompare(e.id),ds=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`}),fs={default:null,recent:ls,attention:(e,t)=>e.rank-t.rank||us(e,t),name:(e,t)=>ds.compare(e.label.trim(),t.label.trim())||e.id.localeCompare(t.id)},ps=`~scratch`,ms=e=>Ko(e);function hs(e,t){return[...e].sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).sort(vs(fs[t]))}function gs(e,t=`default`){let n=[...e].sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)),r=new Map;for(let e of n){let t=ms(e)?ps:e.repo,n=r.get(t);n?n.push(e):r.set(t,[e])}let i=fs[t],a=[...r].map(([e,t])=>{let n=t.sort(vs(i));if(e===`~scratch`&&t.every(ms))return{repo:``,label:U(`rail.noProject`),tasks:n,key:ps,noProject:!0};let r=t.find(e=>e.repoId)?.repoId;return{repo:e,label:Jo(e),tasks:n,...r?{repoId:r}:{}}});return[...a.filter(e=>e.noProject),...a.filter(e=>!e.noProject)]}var _s=e=>+!e.pinned,vs=e=>(t,n)=>_s(t)-_s(n)||(e?e(t,n):0);function ys(e,t){let n=new Set([e.id]);for(let r=e.parentTaskId;r!==void 0;r=t.get(r)?.parentTaskId){if(n.has(r))return r===e.id;n.add(r)}return!1}function bs(e){let t=new Map;for(let n of e)for(let e of n.tasks)t.set(e.id,e);let n=new Map,r=new Set;for(let e of t.values()){let i=e.parentTaskId;if(i===void 0||!t.has(i)||ys(e,t))continue;r.add(e.id);let a=n.get(i);a?a.push(e):n.set(i,[e])}return{children:n,nested:r}}function xs(e,t,n=[]){for(let r of e.get(t)??[])n.push(r.id),xs(e,r.id,n);return n}function Ss(e,t,n,r){return r.folded.has(e)?!0:r.opened.has(e)||t<=5?!1:r.selectedId===void 0||!n.includes(r.selectedId)}function Cs(e,t=``,n=as,r=0,i=!0){let a=t.trim(),o=(...e)=>e.some(e=>e!==``&&Go(a,e)),{children:s,nested:c}=bs(e),l=[];for(let t of e){let e=a===``||o(t.label),u=t.machine===void 0?{}:{machine:t.machine},d=t.key??t.repo,f=t=>e||o(t.label,t.title,t.branch,Jo(t.repo)),p=e=>f(e)||(s.get(e.id)??[]).some(p),m=(e,t,r,i=!1,o)=>{let c=r+1,l=t.machine?{machine:t.machine.id}:{},u=s.get(t.id),d=u?xs(s,t.id):[],m=u!==void 0&&a===``&&Ss(t.id,u.length,d,n);e.push({id:t.id,kind:`task`,task:t,depth:Math.min(c,3),...c>3?{level:c}:{},...u?{fold:{count:d.length,collapsed:m,descendantIds:d}}:{},...o===void 0?{}:{attempt:o},...l});let g=i||f(t);m||h(e,(u??[]).filter(e=>g||p(e)),r+1,g)},h=(e,t,n,r)=>{let a=i?ts(t):new Map,o=new Set;for(let i of t){let t=es(i),s=t===null?void 0:a.get(t);if(t===null||!s){m(e,i,n,r);continue}if(o.has(t))continue;o.add(t);let c=s[0];if(!c)continue;let l=n+1;e.push({id:`round:${c.machine?.id??``}:${c.groupId}`,kind:`round`,groupId:c.groupId??``,title:ns(s),tasks:s,depth:Math.min(l,3),...c.machine?{machine:c.machine.id}:{}});let u=rs(s);for(let t of s)m(e,t,n+1,r,u.get(t.id))}},g=[];h(g,t.tasks.filter(e=>!c.has(e.id)&&p(e)),r,!1),!(g.length===0&&!e)&&l.push({id:`project:${d}`,kind:`project`,repo:t.repo,label:t.label,...t.noProject?{noProject:!0}:{},...u},...g)}return l}function ws(e){let t=e.tasks.find(e=>e.connector)?.connector;return t===`weixin`||t===`lark`||t===`inbox`?U(`rail.connector.${t}`):null}var Ts=e=>Math.max(0,...e.tasks.map(cs));function Es(e){let t=e.tasks.filter(e=>!e.routine),n=e.remote.filter(e=>!e.routine),r=[...gs(t,e.sort).map(e=>({group:e})),...e.machines.flatMap(t=>gs(n.filter(e=>e.machine?.id===t.alias),e.sort).map(e=>({group:e,machine:t.alias})))],i=new Map;for(let e of r){let{repoId:t,repo:n}=e.group,r=e.group.noProject?ps:t??(e.machine===void 0?n:`${e.machine}\0${n}`),a=i.get(r);a?a.push(e):i.set(r,[e])}let a=fs[e.sort],o=new Map,s=[];for(let[e,t]of i){let n=t[0];if(!n)continue;let r=t.flatMap(e=>e.group.tasks),i=n.group.noProject===!0,c={repo:n.group.repo,label:i?n.group.label:``,key:e,tasks:t.length===1?n.group.tasks:r.sort(vs(a)),...n.group.repoId?{repoId:n.group.repoId}:{},...n.machine===void 0||i?{}:{machine:n.machine},...i?{noProject:!0}:{}};s.push(c);for(let e of t)o.set(e,c)}let c=new Map(s.map(e=>[e,e.noProject?e.label:ws(e)??Zo(e,s)])),l=s.map(e=>({...e,label:c.get(e)??e.label}));e.sort===`recent`&&l.sort((e,t)=>Ts(t)-Ts(e)),e.sort===`name`&&l.sort((e,t)=>ds.compare(e.label,t.label));let u=e=>Number(e.tasks.some(e=>e.connector!==void 0));return l.sort((e,t)=>u(e)-u(t)),l.sort((e,t)=>Number(t.noProject===!0)-Number(e.noProject===!0)),{rows:Cs(l,e.query,e.fold),groups:r.filter(e=>e.machine===void 0).map(e=>{let t=o.get(e);return{...e.group,label:(t&&c.get(t))??e.group.label}})}}function Ds(e){return e.title??e.engineName??(e.kind===`engine`?U(`tab.engine`):U(`tab.shell`))}function Os(e,t){if(t.size===0)return e;let n=!1;return e.filter(e=>e.kind===`project`||e.kind===`state`?(n=t.has(e.id),!0):!n)}var ks=(e,t)=>n=>({...n,tasks:n.tasks.map(n=>n.id===e?{...n,...t}:n)}),As=(e,t)=>n=>({...n,tasks:n.tasks.map(n=>n.id===e?{...n,title:t,label:n.label===n.title?t:n.label}:n)});function js(e,t){let n=new Set([t]);for(let t=!0;t;){t=!1;for(let r of e)r.parentTaskId&&n.has(r.parentTaskId)&&!n.has(r.id)&&(n.add(r.id),t=!0)}return n}var Ms=e=>e.order??e.rank;function Ns(e,t){let n=e.find(e=>e.id===t);if(!n||ms(n))return[...e];let r=Ms(n),i=e.filter(e=>e.repo===n.repo&&!ms(e)&&Ms(e)>r).sort((e,t)=>Ms(e)-Ms(t)),a=new Map(i.map((e,t)=>[e.id,r+(t+1)/(i.length+1)]));return e.map(e=>{let t=a.get(e.id);return t===void 0?e:{...e,order:t}})}var Ps=(e,t,n=!1)=>r=>{let i=t?Ns(r.tasks,e):r.archived??[],a=n?new Set([e]):js(i,e),o=i.find(t=>t.id===e)?.parentTaskId,s=i.filter(e=>a.has(e.id)).map(e=>({...e,archived:t})),c=i.filter(e=>!a.has(e.id)).map(t=>n&&t.parentTaskId===e?{...t,parentTaskId:o}:t);return t?{...r,tasks:c,archived:[...r.archived??[],...s]}:{...r,tasks:[...r.tasks,...s],archived:c}},Fs=(e,t)=>n=>{let r=[...n.tasks,...n.archived??[]],i=t?js(r,e):new Set([e]),a=r.find(t=>t.id===e)?.parentTaskId,o=t=>t.filter(e=>!i.has(e.id)).map(t=>t.parentTaskId===e?{...t,parentTaskId:a}:t);return{...n,tasks:o(Ns(n.tasks,e)),...n.archived?{archived:o(n.archived)}:{}}},Is={"task.pin":(e,t)=>ks(e,{pinned:t.pinned===!0}),"task.keep":(e,t)=>ks(e,{kept:t.kept===!0}),"task.setStatus":(e,t)=>ks(e,{status:t.status}),"task.rename":(e,t)=>As(e,String(t.title)),"task.archive":(e,t)=>Ps(e,t.archived===!0,t.promote===!0),"task.delete":(e,t)=>Fs(e,t.cascade===!0)};Object.keys(Is);function Ls(e,t){return Is[e]?.(String(t.taskId),t)??null}var Rs=new WeakMap,zs=200,Bs=e=>`client`in e?e.client:e,Vs=(e,t)=>t?`${e} ${JSON.stringify(t)}`:e;function Hs(e,t,n){return Rs.get(Bs(e))?.get(Vs(t,n))}function Us(e,t,n,r){let i=Bs(e),a=Rs.get(i)??new Map,o=Vs(t,n);a.delete(o),a.set(o,r),Rs.set(i,a);for(let e of a.keys()){if(a.size<=zs)break;a.delete(e)}return r}function Ws(e,t,n){return Bs(e).request(t,n).then(r=>Us(e,t,n,r))}I(),He(),A(),H();var Gs=`rove.web.selection`,Ks=`null`,qs=300;function Js(){try{let e=JSON.parse(localStorage.getItem(Gs)??`null`);if(e&&typeof e==`object`&&`taskId`in e&&typeof e.taskId==`string`)return{taskId:e.taskId,tabId:`tabId`in e&&typeof e.tabId==`string`?e.tabId:null}}catch{}return{taskId:null,tabId:null}}function Ys(e){if(!e||typeof e!=`object`||!(`taskIds`in e))return;let t=e.taskIds;return Array.isArray(t)?t.filter(e=>typeof e==`string`):void 0}function Xs(e){return!!e&&typeof e==`object`&&`tasks`in e&&Array.isArray(e.tasks)}var Zs=`rove.web.visits`,Qs=20;function $s(){try{let e=JSON.parse(localStorage.getItem(Zs)??`[]`);return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`&&typeof e.taskId==`string`):[]}catch{return[]}}function ec(e,t){if(t)return e?.tasks.find(e=>e.id===t)??e?.archived?.find(e=>e.id===t)}function tc(e,t,n){let r=(e,t)=>e.some(e=>e.id===t&&!e.deleting);return n!==null&&r(e,n)&&!r(t,n)}var nc=class{client;tasks=O(null);remote=O([]);tabs=O({});tabsSettled=O(!1);mods=O([]);installedMods=O(new Set);selection=O(Js());visits=O($s());tabTimer=null;tabsReadAt=-1/0;tabScope=new Set;tabSets=new Map;tabReads=new Map;syncing=null;served=null;edits=new Map;pendingSelect=null;selectIntent=0;provisioning=new Map;viewingSent=Ks;taskShown=!0;viewingExtras=()=>({});constructor(e){this.client=e,e.onOpen(()=>{this.resync(),this.viewingSent=Ks,this.reportViewing(),this.refreshMods(),Ws(e,`github.repos`).catch(()=>{})}),typeof document<`u`&&typeof document.addEventListener==`function`&&document.addEventListener(`visibilitychange`,()=>{this.reportViewing(),document.visibilityState===`visible`&&this.refreshMods()}),typeof window<`u`&&typeof window.addEventListener==`function`&&window.addEventListener(`pagehide`,()=>this.reportViewing(!0)),e.on(`tasks`,e=>{Xs(e)&&this.acceptTasks(e)}),e.on(`tasks.patch`,e=>{let t=this.served;t&&Wo(e)&&e.from===t.rev?this.acceptTasks(Uo(t,e)):this.resync()}),e.on(`tabs`,e=>this.scheduleTabRefresh(Ys(e))),e.on(`mods`,e=>this.mods.set(Lo(e)??[]))}resync(){return this.syncing??=this.client.request(`tasks.subscribe`,{patches:!0}).then(e=>this.acceptTasks(e)).catch(()=>{}).finally(()=>{this.syncing=null}),this.syncing}async refreshMods(){try{let{mods:e}=await this.client.request(`builtinMods.list`);this.installedMods.set(new Set(e.filter(e=>e.installed).map(e=>e.id)))}catch{}}onSelect=()=>{};setTaskShown(e){this.taskShown!==e&&(this.taskShown=e,this.reportViewing())}select(e,t=null){this.onSelect();let n=++this.selectIntent;if(this.tasks.get()?.tasks.find(t=>t.id===e)?.noWorktree){this.provisioning.has(e)?this.provisioning.set(e,{intent:n,tabId:t}):this.provisionThenSelect(e,{intent:n,tabId:t});return}this.commitSelection(e,t)}commitSelection(e,t){let n=this.tabs.get()[e]??[],r={taskId:e,tabId:t??rc(n)?.id??null};this.selection.set(r),localStorage.setItem(Gs,JSON.stringify(r));let i=[{...r,at:Date.now()},...this.visits.get().filter(e=>e.taskId!==r.taskId||e.tabId!==r.tabId)].slice(0,Qs);this.visits.set(i),localStorage.setItem(Zs,JSON.stringify(i)),this.reportViewing(),e in this.tabs.get()||this.scheduleTabRefresh([e])}reportViewing(e=!1){let{taskId:t,tabId:n}=this.selection.get(),r=e||typeof document<`u`&&document.visibilityState===`hidden`||!t||!this.taskShown?null:{taskId:t,...n?{tabId:n}:{},...this.viewingExtras()},i=JSON.stringify(r);i!==this.viewingSent&&(this.viewingSent=i,this.client.request(`ui.viewing`,r??{taskId:null}).catch(()=>{this.viewingSent===i&&(this.viewingSent=Ks)}))}async provisionThenSelect(e,t){this.provisioning.set(e,t);let n=!0;try{await this.client.request(`task.ensureWorktree`,{taskId:e})}catch(e){n=!1,z(e instanceof Error?e.message:String(e),`error`)}let r=this.provisioning.get(e)??t;this.provisioning.delete(e),n&&(this.markProvisioned(e),(this.tasks.get()?.tasks.some(t=>t.id===e)??!1)&&r.intent===this.selectIntent&&this.commitSelection(e,r.tabId))}markProvisioned(e){let t=this.tasks.get();if(!t)return;let n=t.tasks.map(t=>t.id===e?{...t,noWorktree:void 0}:t);this.tasks.set({...t,tasks:n})}selectWhenListed(e){this.tasks.get()?.tasks.some(t=>t.id===e)?this.select(e):this.pendingSelect=e}engineTarget(e){let{taskId:t,tabId:n}=this.selection.get(),r=t===e?this.tabs.get()[e]?.find(e=>e.id===n):void 0;return r?.kind===`engine`?{taskId:e,tabId:r.id}:{taskId:e}}async refreshTabsNow(e){await this.refreshTabs([e])}tabbedTasks(){let e=this.tasks.get(),t=e?.archived?.find(e=>e.id===this.selection.get().taskId);return[...e?.tasks??[],...t?[t]:[],...this.remote.get().filter(e=>!e.machine?.stale)]}act(e,t){let n=Ls(e,t),r=()=>this.client.request(e,t);return n?this.optimistic(n,r):r()}closeTab(e,t){return this.tabAct(e,`tab.close`,{taskId:e,tabId:t},e=>e.filter(e=>e.id!==t))}renameTab(e,t,n){return this.tabAct(e,`tab.rename`,{taskId:e,tabId:t,title:n},e=>e.map(e=>e.id===t?{...e,title:n}:e))}async tabAct(e,t,n,r){let i=this.tabs.get()[e];i&&(this.tabReads.set(e,(this.tabReads.get(e)??0)+1),this.tabs.set({...this.tabs.get(),[e]:r(i)}),this.reselectIfClosed(e));try{await this.client.request(t,n)}finally{await this.refreshTabs([e])}}async optimistic(e,t){this.edits.set(e,!1);let n=this.selection.get();this.served&&this.acceptTasks(this.served,!0);try{let n=await t();return this.edits.has(e)&&this.edits.set(e,!0),n}catch(t){throw this.edits.delete(e),this.served&&this.acceptTasks(this.served,!0),n.taskId!==null&&this.selection.get().taskId!==n.taskId&&ec(this.tasks.get(),n.taskId)&&this.commitSelection(n.taskId,n.tabId),t}}acceptTasks(e,t=!1){this.served=e;let n=e;for(let[e,r]of this.edits){let i=e(n);r&&!t&&i.tasks.length===n.tasks.length?this.edits.delete(e):n=i}let r=[...this.tasks.get()?.tasks??[],...this.remote.get()];this.remote.set(n.tasks.filter(e=>e.machine)),this.tasks.set({...n,tasks:n.tasks.filter(e=>!e.machine)}),tc(r,n.tasks,this.selection.get().taskId)&&this.leaveForNewTask(),this.pendingSelect&&n.tasks.some(e=>e.id===this.pendingSelect)&&(this.select(this.pendingSelect),this.pendingSelect=null);let i=this.tabbedTasks(),a=new Set(i.map(e=>e.id)),o=this.tabs.get();Object.keys(o).some(e=>!a.has(e))&&this.tabs.set(Object.fromEntries(Object.entries(o).filter(([e])=>a.has(e))));for(let e of this.tabSets.keys())a.has(e)||this.tabSets.delete(e);let s=i.filter(e=>{let t=Object.keys(e.tabStatus??{}).sort().join(` `);return this.tabSets.get(e.id)!==t&&(this.tabSets.set(e.id,t),!0)});s.length>0&&this.scheduleTabRefresh(s.map(e=>e.id))}leaveForNewTask(){let e=be.get(),t=Ne.get(),n={taskId:null,tabId:null};this.selection.set(n),localStorage.setItem(Gs,JSON.stringify(n)),this.reportViewing(),be.set(e??{ungrouped:!0,sky:M()}),Ne.set(t)}scheduleTabRefresh(e){if(!e)this.tabScope=null;else for(let t of e)this.tabScope?.add(t);if(this.tabTimer!==null)return;let t=Math.max(0,this.tabsReadAt+qs-Date.now());this.tabTimer=window.setTimeout(()=>{this.tabTimer=null,this.tabsReadAt=Date.now();let e=this.tabScope;this.tabScope=new Set,this.refreshTabs(e?[...e]:this.tabbedTasks().map(e=>e.id))},t)}async refreshTabs(e){await Promise.all(e.map(async e=>{let t=(this.tabReads.get(e)??0)+1;this.tabReads.set(e,t);let n;try{n=(await this.client.request(`task.tabs`,{taskId:e})).tabs}catch{return}this.tabReads.get(e)===t&&(this.tabs.set({...this.tabs.get(),[e]:n}),this.reselectIfClosed(e))})),this.tabsSettled.get()||this.tabsSettled.set(!0)}reselectIfClosed(e){let t=this.selection.get();t.taskId===e&&((this.tabs.get()[e]??[]).some(e=>e.id===t.tabId)||this.commitSelection(e,null))}};function rc(e){return e.find(e=>e.alive!==!1)??e[0]}A();function ic({model:e}){let t=k(e.selection),n=k(e.tasks),r=k(e.remote),i=ec(n,t.taskId)??r.find(e=>e.id===t.taskId),a=n?.attention.filter(e=>e.unread).length??0,o=`${a>0?`(${a}) `:``}${i?`${i.label} - `:``}rove`;return(0,J.useEffect)(()=>{document.title=o},[o]),null}var ac=[`sidebar`,`workspace`,`files`];function oc(e,t,n){let r=ac.filter(e=>e!==`files`||n.filesVisible),i=r.indexOf(e);if(i<0)return(t>0?r[r.length-1]:r[0])??null;let a=Math.min(Math.max(i+t,0),r.length-1);return a===i?null:r[a]??null}var sc=`.split-leaf.is-active textarea.xterm-helper-textarea`,cc={sidebar:[`.rail`,`.rail`],workspace:[`.workspace`,sc],files:[`.side-panel`,`.side-view:not([hidden]) :is([tabindex='0'], input)`]};function lc(){for(let e of document.querySelectorAll(sc))if(e.closest(`[data-stream]`)?.getClientRects().length)return e;return null}function uc(){let e=lc();return e?.focus(),e!==null}function dc(e){let t=oc(Object.keys(cc).find(e=>document.activeElement?.closest(cc[e][0]))??`sidebar`,e,{filesVisible:document.querySelector(cc.files[0])!==null});t&&document.querySelector(cc[t][1])?.focus()}var fc=[{id:`chat.tab.new`,scope:`workspace`,keys:[`ctrl+t`],category:`Workspace`,description:`New chat tab`,hint:{keys:`ctrl+t`},presentation:`onePress`},{id:`chat.tab.chooseEngine`,scope:`workspace`,keys:[`ctrl+e`],category:`Workspace`,description:`New conversation — engine/shell picker with destination + context toggles`,hint:{keys:`ctrl+e`},presentation:`onePress`},{id:`chat.tab.fork`,scope:`workspace`,keys:[],prefixKeys:[`c`],category:`Workspace`,description:`Fork this chat into a new tab (same Task directory, keeps the conversation)`,hint:{keys:`ctrl+a c`}},{id:`chat.fork.new`,scope:`workspace`,keys:[],prefixKeys:[`f`],category:`Workspace`,description:`Quick-fork: create child task seeded with current repo/branch/model`,hint:{keys:`ctrl+a f`}},{id:`chat.tab.close`,scope:`workspace`,keys:[`ctrl+w`],prefixKeys:[`w`],category:`Workspace`,description:`Close chat tab`,hint:{keys:`ctrl+w`},presentation:`onePress`},{id:`workspace.reopenSession`,scope:`workspace`,keys:[`return`],category:`Workspace`,description:`Reopen a session in a task whose tabs are all closed`,hint:{keys:`enter`},presentation:`onePress`},{id:`chat.tab.rename`,scope:`workspace`,keys:[`f2`],category:`Workspace`,description:`Rename active chat tab`,hint:{keys:`f2`},presentation:`onePress`},{id:`chat.tab.cycle-next`,scope:`workspace`,keys:[`ctrl+]`],category:`Workspace`,description:`Next chat tab`,hint:{keys:`ctrl+]`},presentation:`onePress`},{id:`chat.tab.cycle-prev`,scope:`workspace`,keys:[`ctrl+[`],category:`Workspace`,description:`Previous chat tab`,hint:{keys:`ctrl+[`},presentation:`onePress`},{id:`chat.tab.goto`,scope:`workspace`,keys:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`].map(e=>`ctrl+${e}`),category:`Workspace`,description:`Go to chat tab N`,hint:{keys:`ctrl+1-9`},presentation:`onePress`},{id:`workspace.split.right`,scope:`workspace`,keys:[`ctrl+\\`],category:`Workspace`,description:`Split right`,hint:{keys:`ctrl+\\`},presentation:`onePress`},{id:`workspace.split.down`,scope:`workspace`,keys:[`ctrl+=`],category:`Workspace`,description:`Split down`,hint:{keys:`ctrl+=`},presentation:`onePress`},{id:`workspace.split.focus-next`,scope:`workspace`,keys:[`f3`],category:`Workspace`,description:`Focus next split`,hint:{keys:`f3`},presentation:`onePress`},{id:`workspace.split.close`,scope:`workspace`,keys:[`ctrl+w`],prefixKeys:[`w`],category:`Workspace`,description:`Close active split (tab when unsplit)`,hint:{keys:`ctrl+w`},presentation:`onePress`},{id:`workspace.split.rename`,scope:`workspace`,keys:[`f2`],category:`Workspace`,description:`Rename active split (tab when unsplit)`,hint:{keys:`f2`},presentation:`onePress`}],pc=[{id:`files.nav`,scope:`files`,keys:[`j`,`k`,`down`,`up`],category:`Files`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`files.hierarchy`,scope:`files`,keys:[`h`,`l`,`left`,`right`],category:`Files`,description:`Collapse / expand tree level`,hint:{keys:`h/l`}},{id:`files.open`,scope:`files`,keys:[`return`],category:`Files`,description:`Open file in configured editor (diff when supported)`,hint:{keys:`enter`}},{id:`files.tab`,scope:`files`,keys:[`[`,`]`],category:`Files`,description:`Switch tab (cycle All / Changes)`,hint:{keys:`[/]`}},{id:`files.refresh`,scope:`files`,keys:[`r`],category:`Files`,description:`Refresh`,hint:{keys:`r`}},{id:`files.scope`,scope:`files`,keys:[`b`],category:`Files`,description:`Toggle Changes scope (working ↔ branch vs base)`,hint:{keys:`b`}},{id:`files.diff`,scope:`files`,keys:[`d`],category:`Files`,description:`Open read-only diff in a workspace tab`,hint:{keys:`d`}},{id:`files.diffAll`,scope:`files`,keys:[`shift+d`],category:`Files`,description:`Open the whole worktree's diff in one workspace tab`,hint:{keys:`D`}},{id:`files.openExternal`,scope:`files`,keys:[`o`],category:`Files`,description:`Open file in system default app (audio / video / pdf preview)`,hint:{keys:`o`}},{id:`files.mention`,scope:`files`,keys:[`a`],category:`Files`,description:`Inject @<path> mention into the engine pane`,hint:{keys:`a`}},{id:`files.search.enter`,scope:`files`,keys:[`/`],category:`Files`,description:`Search file names and text`,hint:{keys:`/`}},{id:`files.hidden`,scope:`files`,keys:[`.`],category:`Files`,description:`Show or hide dot files and folders on the All tab`,hint:{keys:`.`}},{id:`files.changesView`,scope:`files`,keys:[`t`],category:`Files`,description:`Show Changes as a folder tree or a flat list`,hint:{keys:`t`}},{id:`files.search.nav`,scope:`files`,keys:[`down`,`up`],category:`Files`,description:`Move highlight in file search results`},{id:`files.search.submit`,scope:`files`,keys:[`return`],category:`Files`,description:`Open the highlighted search result`},{id:`files.search.cancel`,scope:`files`,keys:[`escape`],category:`Files`,description:`Close file search`},{id:`files.createPR`,scope:`global`,keys:[],prefixKeys:[`p`,`shift+p`],category:`Files`,description:`Ask the agent to create a PR from the current task`},{id:`files.fixChecks`,scope:`global`,keys:[],prefixKeys:[`k`],category:`Files`,description:`Ask the agent to fix the failing PR checks`},{id:`files.syncBase`,scope:`global`,keys:[],prefixKeys:[`u`],category:`Files`,description:`Merge the base branch into this task's worktree`},{id:`diff.review.cursor`,scope:`workspace`,keys:[`j`,`k`,`down`,`up`],bareKeys:!0,category:`Diff review`,description:`Move the line cursor over the diff`,hint:{keys:`j/k`}},{id:`diff.review.range`,scope:`workspace`,keys:[`v`],bareKeys:!0,category:`Diff review`,description:`Toggle range anchor at the cursor`,hint:{keys:`v`}},{id:`diff.review.note`,scope:`workspace`,keys:[`c`],bareKeys:!0,category:`Diff review`,description:`Add a review note at the cursor`,hint:{keys:`c`}},{id:`diff.review.send`,scope:`workspace`,keys:[`s`],bareKeys:!0,category:`Diff review`,description:`Send all unsent review notes to the engine`,hint:{keys:`s`}},{id:`diff.review.drop`,scope:`workspace`,keys:[`x`],bareKeys:!0,category:`Diff review`,description:`Drop the review note the cursor sits inside`,hint:{keys:`x`}},{id:`diff.review.reload`,scope:`workspace`,keys:[`r`],bareKeys:!0,category:`Diff review`,description:`Reload the previewed file from disk`,hint:{keys:`r`}}],mc=[{id:`inbox.show`,scope:`global`,keys:[],prefixKeys:[`i`],category:`Global`,description:`Open Inbox`},{id:`inbox.nav`,scope:`inbox`,keys:[`j`,`k`,`down`,`up`],category:`Inbox`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`inbox.open`,scope:`inbox`,keys:[`return`],category:`Inbox`,description:`Open the selected Task and Terminal Tab`,hint:{keys:`enter`}},{id:`inbox.delete`,scope:`inbox`,keys:[`d`],category:`Inbox`,description:`Ack the selected Inbox item`,hint:{keys:`d`}},{id:`inbox.deleteAll`,scope:`inbox`,keys:[`shift+d`],category:`Inbox`,description:`Ack every ATTENTION item`,hint:{keys:`D`}}],hc=[{id:`palette.open`,scope:`global`,keys:[],prefixKeys:[`/`],category:`Global`,description:`Search commands`},{id:`help.open`,scope:`global`,keys:[`f1`],category:`Global`,description:`Show keybindings help`,hint:{keys:`F1`},presentation:`onePress`},{id:`task.new`,scope:`sidebar`,keys:[`n`],category:`Sidebar`,description:`New task`,hint:{keys:`n`}},{id:`task.new.global`,scope:`global`,keys:[],prefixKeys:[`n`],category:`Global`,description:`New task`},{id:`task.openEditor`,scope:`global`,keys:[],prefixKeys:[`o`],category:`Global`,description:`Open active Task directory in editor`},{id:`task.moveMode`,scope:`global`,keys:[],prefixKeys:[`m`],category:`Global`,description:`Reorder sidebar rows (then j/k)`},{id:`settings.open`,scope:`global`,keys:[],prefixKeys:[`,`],category:`Global`,description:`Open settings`},{id:`app.refresh`,scope:`global`,keys:[],prefixKeys:[`r`],category:`Global`,description:`Refresh Rove onto the installed build (after an update)`},{id:`settings.open.sidebar`,scope:`sidebar`,keys:[`s`],category:`Sidebar`,description:`Open settings`,hint:{keys:`s`}},{id:`worktrees.open.sidebar`,scope:`sidebar`,keys:[`x`],category:`Sidebar`,description:`Open worktrees`,hint:{keys:`x`}},{id:`kanban.open`,scope:`global`,keys:[],prefixKeys:[`1`],category:`Global`,description:`Open kanban (issues board)`},{id:`automations.open`,scope:`global`,keys:[],prefixKeys:[`2`],category:`Global`,description:`Open routines (scheduled tasks)`},{id:`workItems.open`,scope:`global`,keys:[],prefixKeys:[`3`],category:`Global`,description:`Open GitHub issues (external tracker)`},{id:`app.quit`,scope:`sidebar`,keys:[`q`,`ctrl+q`],category:`Sidebar`,description:`Quit (with confirm)`,hint:{keys:`q`}},{id:`focus.sidebar`,scope:`workspace`,keys:[`ctrl+q`],prefixKeys:[`q`],category:`Workspace`,description:`Back to sidebar (tasks)`,hint:{keys:`ctrl+q`},presentation:`onePress`},{id:`focus.previous`,scope:`global`,keys:[],prefixKeys:[`h`],category:`Navigation`,description:`Focus previous pane (files → workspace → sidebar)`},{id:`focus.next`,scope:`global`,keys:[`f4`],prefixKeys:[`l`],category:`Navigation`,description:`Focus next pane (sidebar → workspace → files)`,hint:{keys:`f4`},presentation:`onePress`},{id:`attention.next`,scope:`global`,keys:[`f7`],category:`Navigation`,description:`Jump to the next available Inbox item`,hint:{keys:`f7`},presentation:`onePress`},{id:`task.previous`,scope:`global`,keys:[],prefixKeys:[`tab`],category:`Navigation`,description:`Back to the previous task`},{id:`workspace.filesToggle`,scope:`global`,keys:[],prefixKeys:[`z`],category:`Navigation`,description:`Show or hide the Files pane`},{id:`view.redraw`,scope:`global`,keys:[],prefixKeys:[`r`],category:`Global`,description:`Redraw the screen`},{id:`sidebar.nav`,scope:`sidebar`,keys:[`j`,`k`,`down`,`up`],category:`Sidebar`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`sidebar.select`,scope:`sidebar`,keys:[`return`],category:`Sidebar`,description:`Open the selected task`,hint:{keys:`enter`}},{id:`sidebar.tree.open`,scope:`sidebar`,keys:[`l`,`space`],category:`Sidebar`,description:`Open the row under the cursor (a tab row enters its chat)`,hint:{keys:`l`}},{id:`sidebar.goto`,scope:`sidebar`,keys:[`g`,`shift+g`],category:`Sidebar`,description:`Top / bottom of list (gg or shift-G)`},{id:`sidebar.rename`,scope:`sidebar`,keys:[`r`],category:`Sidebar`,description:`Rename task`,hint:{keys:`r`}},{id:`sidebar.localMerge`,scope:`sidebar`,keys:[`shift+m`],category:`Sidebar`,description:`Reorder row (Shift+M, then j/k)`,hint:{keys:`M`}},{id:`sidebar.pin`,scope:`sidebar`,keys:[`shift+p`],category:`Sidebar`,description:`Pin / unpin task at top (Shift+P)`,hint:{keys:`P`}},{id:`sidebar.sort`,scope:`sidebar`,keys:[`t`],category:`Sidebar`,description:`Cycle task sort (default → recent → attention → name)`,hint:{keys:`t`}},{id:`sidebar.delete`,scope:`sidebar`,keys:[`d`],category:`Sidebar`,description:`Remove session (with confirm)`,hint:{keys:`d`}},{id:`sidebar.search.enter`,scope:`sidebar`,keys:[`/`],category:`Sidebar`,description:`Search tasks (fuzzy filter)`,hint:{keys:`/`}},{id:`sidebar.search.nav`,scope:`sidebar`,keys:[`down`,`up`],category:`Sidebar`,description:`Move highlight in search results`},{id:`sidebar.search.submit`,scope:`sidebar`,keys:[`return`],category:`Sidebar`,description:`Select search match and exit search`},{id:`sidebar.search.cancel`,scope:`sidebar`,keys:[`escape`],category:`Sidebar`,description:`Cancel search (restore prior selection)`},{id:`tasks.openWorktree`,scope:`sidebar`,keys:[`o`],category:`Tasks pane`,description:`Open selected Task directory in your editor`,hint:{keys:`o`}},{id:`tasks.renameBranch`,scope:`sidebar`,keys:[`b`],category:`Tasks pane`,description:`Rename the selected task's git branch`,hint:{keys:`b`}},{id:`tasks.cycleEngine`,scope:`sidebar`,keys:[`v`],category:`Tasks pane`,description:`Cycle engine vendor — applies on reopen`,hint:{keys:`v`}},{id:`tasks.update`,scope:`sidebar`,keys:[`u`],category:`Tasks pane`,description:`Open the update page — version check + release notes`,hint:{keys:`u`}},{id:`tasks.focusEngine`,scope:`sidebar`,keys:[`right`],category:`Tasks pane`,description:`Focus the engine pane of the current window`,hint:{keys:`→`}},...fc,...pc,...mc,{id:`terminal.scroll-up`,scope:`terminal`,keys:[`ctrl+pageup`],category:`Terminal`,description:`Scroll scrollback up`,hint:{keys:`ctrl+pgup`}},{id:`terminal.scroll-down`,scope:`terminal`,keys:[`ctrl+pagedown`],category:`Terminal`,description:`Scroll scrollback down`},{id:`terminal.reset`,scope:`terminal`,keys:[`f5`],category:`Terminal`,description:`Reset terminal — kill the current shell and respawn`,hint:{keys:`f5`},presentation:`onePress`}],gc={ctrl:`⌃`,control:`⌃`,alt:`⌥`,opt:`⌥`,option:`⌥`,shift:`⇧`,cmd:`⌘`,command:`⌘`,meta:`⌘`,super:`⌘`},_c={enter:`⏎`,return:`⏎`,esc:`⎋`,escape:`⎋`,space:`␣`,up:`↑`,down:`↓`,left:`←`,right:`→`,backspace:`⌫`,delete:`⌦`,del:`⌦`,pgup:`⇞`,pageup:`⇞`,pgdn:`⇟`,pagedown:`⇟`,home:`↖`,end:`↘`};function vc(e,t){if(e.includes(`/`))return e.split(`/`).map(e=>vc(e,t)).join(`/`);let n=e.toLowerCase();return n===`tab`?`tab`:_c[n]||(/^f\d{1,2}$/.test(n)?n.toUpperCase():t?/^[a-z]$/.test(n)?e.toUpperCase():e.replace(/[a-z]+/gi,e=>e.toUpperCase()):e)}function yc(e,t=`⌃A`){let n=e.trim();if(!n)return n;let r=/^prefix\s+(.+)$/i.exec(n);if(r){let e=r[1]??``;return`${t} ${e.includes(`+`)?yc(e,t):vc(e,!0)}`}let i=n.split(`+`);if(i.length===1)return vc(i[0]??``,!1);let a=i[i.length-1]??``;return`${i.slice(0,-1).map(e=>gc[e.toLowerCase().trim()]??e).join(``)} ${vc(a,!0)}`}A();var bc={path:``,exists:!1,rows:[],prefix:{key:`ctrl+a`,firstStrokes:[`ctrl+a`],timeoutMs:5e3},plugins:[],applied:[],warnings:[]},xc=O(bc),Sc=new Map(hc.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint&&{...e.hint}}]));function Cc(e){for(let e of hc){let t=Sc.get(e.id);if(!t)continue;let n=e;n.keys=[...t.keys],n.prefixKeys=t.prefixKeys&&[...t.prefixKeys],n.hint=t.hint&&{...t.hint}}for(let t of e.rows){let e=hc.find(e=>e.id===t.id);e&&(e.keys=[...t.keys],e.prefixKeys=t.prefixKeys&&[...t.prefixKeys],e.hint=t.hint&&{...t.hint})}xc.set(e)}async function wc(e){try{Cc(await e.request(`keybindings.get`))}catch{}}function Tc(e){let t=k(e.conn).hello;(0,J.useEffect)(()=>{if(!t)return;let n=()=>void wc(e);return n(),window.addEventListener(`focus`,n),()=>window.removeEventListener(`focus`,n)},[t,e])}var Ec=()=>xc.get().prefix.key,Dc=()=>{let e=Ec();return e===null?``:yc(e)};function Oc(e,t=`direct`){let n=hc.find(t=>t.id===e),r=t===`prefix`?n?.prefixKeys?.[0]:n?.keys[0];return r===void 0?void 0:yc(r)}var kc=e=>hc.find(t=>t.id===e)?.keys??[];function Ac(e){let t=Dc(),n=Oc(e,`prefix`);return t&&n?`${t} ${n}`:``}var jc=e=>Sc.get(e)?.prefixKeys??[];function Mc(e,t){let n=xc.get().rows.find(t=>t.id===e),r=Sc.get(e),i=t===`prefix`?n?.prefixKeys:n?.keys,a=t===`prefix`?r?.prefixKeys:r?.keys;return i&&JSON.stringify(i)!==JSON.stringify(a??[])?i:void 0}function Nc(e,t){for(let n of t){let t=e.find(e=>e.chord===n);if(t)return t}}function Pc(e){return!e.dialog&&e.page!==`worktrees`&&e.page!==`update`}var Fc=[];function Ic(e){Fc.push(e)}var Lc={workspace:`workspace`,sidebar:`sidebar`,files:`files`,terminal:`terminal`};function Rc(){let e=Fc.flatMap(e=>e()),t=new Set(e.filter(e=>!e.prefix).map(e=>e.id)),n=e.map(e=>{let t=Mc(e.id,e.prefix?`prefix`:`direct`);return t?{...e,chords:t}:e});for(let r of e){let e=r.prefix?Mc(r.id,`direct`):void 0;if(!e||e.length===0||t.has(r.id))continue;t.add(r.id);let i=hc.find(e=>e.id===r.id)?.scope??`global`;n.push({...r,prefix:!1,chords:e,...Lc[i]?{surface:Lc[i]}:{}})}return n}function zc(e,t){return!e.surface||e.surface===t||t===`terminal`&&e.surface===`workspace`}function Bc(e,t){return e.surface===t?0:e.surface?1:2}function Vc(){let e=document.activeElement;return e instanceof Element?e.closest(`.xterm`)?`terminal`:e.closest(`.rail`)?`sidebar`:e.closest(`.files`)?`files`:e.closest(`.workspace, .side-panel`)?`workspace`:null:null}function Hc(e,t){let n=new Set,r=new Set;for(let i of Rc())!zc(i,t)||i.live?.(e)===!1||(i.prefix?r:n).add(i.id);return{direct:n,prefix:r,inputPassthrough:t===`terminal`}}function Uc(){let e=new Set(Rc().map(e=>e.id));return hc.filter(t=>e.has(t.id))}A();var Wc=new Map,Gc=O(null);function Kc(e){return Wc.set(e.stream,e),()=>{Wc.get(e.stream)===e&&Wc.delete(e.stream),Gc.get()===e&&Gc.set(null)}}function qc(e){return Wc.get(e)}Ic(()=>[{id:`terminal.scroll-up`,chords:[`ctrl+pageup`],prefix:!1,surface:`terminal`,run:()=>Gc.get()?.scrollPages(-1)},{id:`terminal.scroll-down`,chords:[`ctrl+pagedown`],prefix:!1,surface:`terminal`,run:()=>Gc.get()?.scrollPages(1)},{id:`terminal.reset`,chords:[`f5`],prefix:!1,surface:`terminal`,run:()=>Gc.get()?.reset()}]),H();var Jc={INPUT:!0,TEXTAREA:!0,SELECT:!0},Yc=`.rail, .side-panel, dialog, [role=dialog], [role=menu], [role=listbox]`;function Xc(e){return!e||e.tagName===`BODY`||e.tagName===`HTML`?`none`:e.closest(`.xterm`)?`terminal`:Jc[e.tagName]===!0||e.isContentEditable?`field`:e.closest(Yc)?`pane`:`loose`}function Zc(e,t,n){return e.key!==`Escape`||e.defaultPrevented||e.isComposing||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||n.overlay||!n.terminal?!1:t===`none`||t===`loose`}function Qc(){(0,J.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`)return;let t=lc(),n=document.activeElement;if(!Zc(e,Xc(n instanceof HTMLElement?n:null),{overlay:B.get()!==null||de.get()!==null||V.get()!==null||be.get()!==null,terminal:t!==null}))return;let r=t?.closest(`[data-stream]`)?.dataset.stream,i=r?qc(r):void 0;!t||!i||(e.preventDefault(),t.focus(),i.input(`\x1B`))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}function $c(e){switch(e){case`permission_needed`:return{glyph:`?`,tone:`warning`,stateKey:`inbox.state.needsInput`};case`turn_complete`:return{glyph:`✓`,tone:`success`,stateKey:`inbox.state.done`};case`rate_limited`:return{glyph:`◷`,tone:`warning`,stateKey:`inbox.state.rateLimited`};case`dead`:return{glyph:`†`,tone:`attention`,stateKey:`inbox.state.dead`};case`restored`:return{glyph:`!`,tone:`attention`,stateKey:`inbox.state.restored`};case`decision_needed`:return{glyph:`?`,tone:`warning`,stateKey:`inbox.state.decision`};case`routine_failed`:return{glyph:`↻`,tone:`attention`,stateKey:`inbox.state.routineFailed`};case`report_missing`:return{glyph:`!`,tone:`warning`,stateKey:`inbox.state.reportMissing`};default:return{glyph:`!`,tone:`attention`,stateKey:`inbox.state.error`}}}function el(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let n=Math.round(t/60);if(n<60)return`${n}m`;let r=Math.round(n/60);return r<48?`${r}h`:`${Math.round(r/24)}d`}var tl=e=>e===`routine_failed`,nl=e=>`${e.taskId??``}:${e.tabId??``}`;function rl(e,t){let n=new Map(t.map((e,t)=>[e,t])),r=e=>+(e.state===`turn_complete`),i=e=>n.get(e.taskId??``)??2**53-1;return[...e].sort((e,t)=>r(e)-r(t)||e.at-t.at||i(e)-i(t)||nl(e).localeCompare(nl(t)))}function il(e,t,n){let r=new Set(t),i=rl(e,t).filter(e=>e.taskId===null||r.has(e.taskId));if(i.length===0)return null;let a=n.taskId===null?-1:i.findIndex(e=>nl(e)===nl(n));return a<0||i.length===1?i[0]??null:i[(a+1)%i.length]??null}function al(e,t){return t===`failed`?Array.isArray(e)?e:`unreadable`:t}function ol(e){let t=(e.terminal?.tail??[]).map(e=>e.trimEnd()),n=t.length;for(;n>0&&t[n-1]===``;)n--;let r=0;for(;r<n&&t[r]===``;)r++;return t.slice(Math.max(r,n-12),n)}H();async function sl(e,t,n=!1){let r=`attention.dismiss`,i;if(tl(t.state)){if(!t.automationId)return;r=`attention.dismissRoutine`,i={automationId:t.automationId}}else{if(t.gateId||t.state===`decision_needed`||t.state===`report_missing`&&!n||t.taskId===null)return;i={taskId:t.taskId,...t.tabId?{tabId:t.tabId}:{},...t.deliveryId?{deliveryId:t.deliveryId}:{}}}await e.client.request(r,i).catch(e=>z(String(e),`error`))}function cl(e,t){sl(e,t),ce(),he.set(t.automationId??null),V.set(`routines`)}G(),A(),H();var ll=6;function ul(e,t){if(!e)return{identity:t,project:``,label:t};let n=Jo(e.repo);return{identity:`${n} › ${e.label}`,project:n,label:e.label}}function dl(e){let t=k(e.tasks),n=k(e.visits),r=k(e.tabs),[i,a]=(0,J.useState)(Date.now());(0,J.useEffect)(()=>{let e=window.setInterval(()=>a(Date.now()),3e4);return()=>window.clearInterval(e)},[]);let o=new Map((t?.tasks??[]).map(e=>[e.id,e])),s=(e,t)=>e&&t&&r[e]?.find(e=>e.id===t)?.title||``,c=rl(t?.attention??[],t?.tasks.map(e=>e.id)??[]).map((e,t)=>{let n=e.taskId?o.get(e.taskId):void 0;return{key:`a${t}:${e.taskId}:${e.tabId}`,section:`attention`,taskId:e.taskId,tabId:e.tabId,...ul(n,e.label??e.taskId??``),subtitle:s(e.taskId,e.tabId)||n?.branch||``,at:e.at,attention:e}}),l=new Set(c.map(e=>`${e.taskId}:${e.tabId}`)),u=n.filter(e=>o.has(e.taskId)&&!l.has(`${e.taskId}:${e.tabId}`)).slice(0,ll).map(e=>({key:`r:${e.taskId}:${e.tabId}`,section:`recent`,taskId:e.taskId,tabId:e.tabId,...ul(o.get(e.taskId),e.taskId),subtitle:s(e.taskId,e.tabId)||o.get(e.taskId)?.branch||``,at:e.at})),d=[...c,...u],f=t=>{if(t.attention&&tl(t.attention.state))return cl(e,t.attention);t.attention&&sl(e,t.attention),t.taskId&&o.has(t.taskId)&&(e.select(t.taskId,t.tabId),ce())},p=()=>void Promise.all(c.map(t=>t.attention&&sl(e,t.attention,!0))),m=t=>t.attention&&void sl(e,t.attention,!0),h=e=>{let n=e.attention,r=e.taskId?o.get(e.taskId):void 0,i=n?.gateId?t?.gates?.find(e=>e.id===n.gateId&&e.status===`open`):void 0,a=e.tabId??i?.tabId??null;if(!(n&&r&&!r.machine&&!tl(n.state)&&(!n.gateId||i)&&(a||i)))return null;let s=n?.state===`permission_needed`||!!a&&r?.tabStatus?.[a]?.kind===`needs-input`,c=i?`gate`:n?.state===`dead`?`readonly`:s?`menu`:`reply`;return{id:`${e.taskId}:${e.tabId}:${n?.gateId??``}`,tabId:a,mode:c,gate:i}};return{attention:c,recent:u,cards:d,now:i,open:f,ack:m,ackAll:p,peekOf:h,menuOf:(e,t)=>{let n=h(e);return[...n?[{label:U(`inbox.phone.reply`),run:()=>t(n)}]:[],{label:U(`inbox.phone.open`),run:()=>f(e)},...e.attention?[{label:U(`inbox.phone.ack`),run:()=>m(e)}]:[]]}}}function fl(e,t){return hl?hl.fetch(e,t):fetch(e,t)}async function pl(e){if(!hl)return e;let t=await hl.fetch(e);return t.ok?URL.createObjectURL(new Blob([await t.arrayBuffer()],{type:`text/javascript`})):e}function ml(e,t){return hl?new hl.WebSocket(e,t):new WebSocket(e,t)}var hl,gl,_l=o((()=>{hl=Reflect.get(globalThis,`__roveRelay`),gl=hl!==void 0}));function vl(){return`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}/ws`}var yl,bl,xl,Sl,Cl,wl=o((()=>{h(),_l(),A(),yl=class extends Error{code;detail;constructor(e,t,n){super(t),this.code=e,this.detail=n}},bl=[500,1e3,2e3,4e3,8e3,15e3],xl=4e3,Sl=1e4,Cl=class{url;token;conn=O({state:`connecting`,hello:null,failures:0});ws=null;nextId=1;pending=new Map;listeners=new Map;openHooks=new Set;retryTimer=null;deadline=null;constructor(e,t){this.url=e,this.token=t}start(){this.connect();let e=()=>{document.visibilityState===`visible`&&this.checkNow()};document.addEventListener(`visibilitychange`,e),window.addEventListener(`online`,e),window.addEventListener(`pageshow`,e)}checkNow(){if(this.retryTimer!==null){this.retryNow();return}let e=this.ws;!e||this.conn.get().state!==`open`||this.deadline!==null||(this.armDeadline(e,xl),this.request(`hello`).then(()=>this.clearDeadline(),e=>{e instanceof yl&&e.code!==`NOT_CONNECTED`&&this.clearDeadline()}))}armDeadline(e,t){this.clearDeadline(),this.deadline=window.setTimeout(()=>this.lost(e),t)}clearDeadline(){this.deadline!==null&&window.clearTimeout(this.deadline),this.deadline=null}onOpen(e){return this.openHooks.add(e),this.conn.get().state===`open`&&e(),()=>this.openHooks.delete(e)}on(e,t){let n=this.listeners.get(e);return n||(n=new Set,this.listeners.set(e,n)),n.add(t),()=>n.delete(t)}request(e,t={},n){let r=this.ws;if(!r||r.readyState!==WebSocket.OPEN)return Promise.reject(new yl(`NOT_CONNECTED`,`not connected to rove`));let i=this.nextId++;return new Promise((a,o)=>{this.pending.set(i,{resolve:e=>a(e),reject:o,progress:n}),r.send(JSON.stringify({id:i,op:e,args:t}))})}connect(){this.retryTimer=null;let e=ml(this.url,this.token?[`rove.v1`,`rove.bearer.${this.token}`]:[`rove.v1`]);this.ws=e,this.armDeadline(e,Sl),e.onmessage=e=>this.receive(String(e.data)),e.onopen=()=>{this.request(`hello`,{userAgent:navigator.userAgent}).then(e=>{this.clearDeadline(),this.conn.set({state:`open`,hello:e,failures:0});for(let e of this.openHooks)e()},()=>this.lost(e))},e.onclose=t=>this.lost(e,t?.code)}lost(e,t){if(this.ws!==e)return;this.ws=null,this.clearDeadline(),e.onopen=null,e.onclose=null,e.onmessage=null,e.close();for(let e of this.pending.values())e.reject(new yl(`NOT_CONNECTED`,`connection lost`));if(this.pending.clear(),t===4401){p(),this.conn.set({state:`retrying`,hello:null,failures:2});return}let n=this.conn.get().failures+1;this.conn.set({state:`retrying`,hello:this.conn.get().hello,failures:n});let r=bl[Math.min(n-1,bl.length-1)];this.retryTimer=window.setTimeout(()=>this.connect(),r)}receive(e){let t;try{t=JSON.parse(e)}catch{return}if(!t||typeof t!=`object`)return;if(`event`in t&&typeof t.event==`string`){let e=`data`in t?t.data:void 0;if(t.event===`op.progress`){let t=e;typeof t?.id==`number`&&typeof t.line==`string`&&this.pending.get(t.id)?.progress?.(t.line);return}for(let n of this.listeners.get(t.event)??[])n(e);return}if(!(`id`in t)||typeof t.id!=`number`)return;let n=this.pending.get(t.id);if(!n)return;if(this.pending.delete(t.id),`ok`in t&&t.ok===!0){n.resolve(`result`in t?t.result:void 0);return}let r=`error`in t&&t.error&&typeof t.error==`object`?t.error:{},i=`code`in r&&typeof r.code==`string`?r.code:`INTERNAL`,a=`message`in r&&typeof r.message==`string`?r.message:i;n.reject(new yl(i,a,r))}retryNow(){this.retryTimer!==null&&(window.clearTimeout(this.retryTimer),this.connect())}}}));function Tl(e,t,n){return n&&n!==`leaf-1`?`${e}::${t}::${n}`:`${e}::${t}`}var El=o((()=>{})),Dl,Ol,kl,Al,jl=o((()=>{Dl=`modulepreload`,Ol=function(e){return`/relay-client/`+e},kl={},Al=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=function(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))},i=function(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href},a=document.getElementsByTagName(`link`),o=document.querySelector(`meta[property=csp-nonce]`),s=o?.nonce||o?.getAttribute(`nonce`);r=e(t.map(e=>{if(e=Ol(e,n),e=i(e),e in kl)return;kl[e]=!0;let t=e.endsWith(`.css`);for(let n=a.length-1;n>=0;n--){let r=a[n];if(r.href===e&&(!t||r.rel===`stylesheet`))return}let r=document.createElement(`link`);if(r.rel=t?`stylesheet`:Dl,t||(r.as=`script`),r.crossOrigin=``,r.href=e,s&&r.setAttribute(`nonce`,s),document.head.appendChild(r),t)return new Promise((t,n)=>{r.addEventListener(`load`,t),r.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${e}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})}}));function Ml(e){let t=e.toString(16);return t.length<2?`0`+t:t}function Nl(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Pl(e,t,n){return Math.max(t,Math.min(e,n))}function Fl(e){switch(e){case`&`:return`&`;case`<`:return`<`}return e}function Il(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function Ll(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function Rl(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&e.isOverline()===t.isOverline()&&e.isBlink()===t.isBlink()&&e.isInvisible()===t.isInvisible()&&e.isItalic()===t.isItalic()&&e.isDim()===t.isDim()&&e.isStrikethrough()===t.isStrikethrough()}var zl,Bl,Vl,Hl,Ul,Wl,Gl,Kl,ql,Jl,Yl,Xl,Zl,Ql,$l=o((()=>{zl=0,Bl=0,Vl=0,Hl=0,(e=>{function t(e,t,n,r){return r===void 0?`#${Ml(e)}${Ml(t)}${Ml(n)}`:`#${Ml(e)}${Ml(t)}${Ml(n)}${Ml(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(Ul||={}),(e=>{function t(e,t){if(Hl=(t.rgba&255)/255,Hl===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return zl=a+Math.round((n-a)*Hl),Bl=o+Math.round((r-o)*Hl),Vl=s+Math.round((i-s)*Hl),{css:Ul.toCss(zl,Bl,Vl),rgba:Ul.toRgba(zl,Bl,Vl)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=ql.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return Ul.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[zl,Bl,Vl]=ql.toChannels(t),{css:Ul.toCss(zl,Bl,Vl),rgba:t}}e.opaque=i;function a(e,t){return Hl=Math.round(t*255),[zl,Bl,Vl]=ql.toChannels(e.rgba),{css:Ul.toCss(zl,Bl,Vl,Hl),rgba:Ul.toRgba(zl,Bl,Vl,Hl)}}e.opacity=a;function o(e,t){return Hl=e.rgba&255,a(e,Hl*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(Wl||={}),(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return zl=parseInt(e.slice(1,2).repeat(2),16),Bl=parseInt(e.slice(2,3).repeat(2),16),Vl=parseInt(e.slice(3,4).repeat(2),16),Ul.toColor(zl,Bl,Vl);case 5:return zl=parseInt(e.slice(1,2).repeat(2),16),Bl=parseInt(e.slice(2,3).repeat(2),16),Vl=parseInt(e.slice(3,4).repeat(2),16),Hl=parseInt(e.slice(4,5).repeat(2),16),Ul.toColor(zl,Bl,Vl,Hl);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 r=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(r)return zl=parseInt(r[1]),Bl=parseInt(r[2]),Vl=parseInt(r[3]),Hl=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),Ul.toColor(zl,Bl,Vl,Hl);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[zl,Bl,Vl,Hl]=t.getImageData(0,0,1,1).data,Hl!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:Ul.toRgba(zl,Bl,Vl,Hl),css:e}}e.toColor=r})(Gl||={}),(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(Kl||={}),(e=>{function t(e,t){if(Hl=(t&255)/255,Hl===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return zl=a+Math.round((n-a)*Hl),Bl=o+Math.round((r-o)*Hl),Vl=s+Math.round((i-s)*Hl),Ul.toRgba(zl,Bl,Vl)}e.blend=t;function n(e,t,n){let a=Kl.relativeLuminance(e>>8),o=Kl.relativeLuminance(t>>8);if(Nl(a,o)<n){if(o<a){let o=r(e,t,n),s=Nl(a,Kl.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>Nl(a,Kl.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=Nl(a,Kl.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>Nl(a,Kl.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(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,l=Nl(Kl.relativeLuminance2(o,s,c),Kl.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=Nl(Kl.relativeLuminance2(o,s,c),Kl.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(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,l=Nl(Kl.relativeLuminance2(o,s,c),Kl.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=Nl(Kl.relativeLuminance2(o,s,c),Kl.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(ql||={}),Jl=Object.freeze((()=>{let e=[Gl.toColor(`#2e3436`),Gl.toColor(`#cc0000`),Gl.toColor(`#4e9a06`),Gl.toColor(`#c4a000`),Gl.toColor(`#3465a4`),Gl.toColor(`#75507b`),Gl.toColor(`#06989a`),Gl.toColor(`#d3d7cf`),Gl.toColor(`#555753`),Gl.toColor(`#ef2929`),Gl.toColor(`#8ae234`),Gl.toColor(`#fce94f`),Gl.toColor(`#729fcf`),Gl.toColor(`#ad7fa8`),Gl.toColor(`#34e2e2`),Gl.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:Ul.toCss(r,i,a),rgba:Ul.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:Ul.toCss(n,n,n),rgba:Ul.toRgba(n,n,n)})}return e})()),Yl=class{constructor(e){this._buffer=e}serialize(e,t){let n=this._buffer.getNullCell(),r=this._buffer.getNullCell(),i=n,a=e.start.y,o=e.end.y,s=e.start.x,c=e.end.x;this._beforeSerialize(o-a,a,o);for(let t=a;t<=o;t++){let a=this._buffer.getLine(t);if(a){let o=t===e.start.y?s:0,l=t===e.end.y?c:a.length;for(let e=o;e<l;e++){let o=a.getCell(e,i===n?r:n);if(!o){console.warn(`Can't get cell at row=${t}, col=${e}`);continue}this._nextCell(o,i,t,e),i=o}}this._rowEnd(t,t===o)}return this._afterSerialize(),this._serializeString(t)}_nextCell(e,t,n,r){}_rowEnd(e,t){}_beforeSerialize(e,t,n){}_afterSerialize(){}_serializeString(e){return``}},Xl=class extends Yl{constructor(e,t){super(e),this._terminal=t,this._rowIndex=0,this._allRows=[],this._allRowSeparators=[],this._currentRow=``,this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(e,t,n){this._allRows=Array(e),this._lastContentCursorRow=t,this._lastCursorRow=t,this._firstRow=t}_rowEnd(e,t){this._nullCellCount>0&&!Ll(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let n=``;if(!t){e-this._firstRow>=this._terminal.rows&&this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol,this._backgroundCell);let t=this._buffer.getLine(e),r=this._buffer.getLine(e+1);if(!r.isWrapped)n=`\r
|
|
38
|
+
`,this._lastCursorRow=e+1,this._lastCursorCol=0;else{n=``;let i=t.getCell(t.length-1,this._thisRowLastChar),a=t.getCell(t.length-2,this._thisRowLastSecondChar),o=r.getCell(0,this._nextRowFirstChar),s=o.getWidth()>1,c=!1;(o.getChars()&&s?this._nullCellCount<=1:this._nullCellCount<=0)&&((i.getChars()||i.getWidth()===0)&&Ll(i,o)&&(c=!0),s&&(a.getChars()||a.getWidth()===0)&&Ll(i,o)&&Ll(a,o)&&(c=!0)),c||(n=`-`.repeat(this._nullCellCount+1),n+=`\x1B[1D\x1B[1X`,this._nullCellCount>0&&(n+=`\x1B[A`,n+=`\x1B[${t.length-this._nullCellCount}C`,n+=`\x1B[${this._nullCellCount}X`,n+=`\x1B[${t.length-this._nullCellCount}D`,n+=`\x1B[B`),this._lastContentCursorRow=e+1,this._lastContentCursorCol=0,this._lastCursorRow=e+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=n,this._currentRow=``,this._nullCellCount=0}_diffStyle(e,t){let n=[],r=!Il(e,t),i=!Ll(e,t),a=!Rl(e,t);if(r||i||a){if(e.isAttributeDefault())t.isAttributeDefault()||n.push(0);else{if(r){let t=e.getFgColor();e.isFgRGB()?n.push(38,2,t>>>16&255,t>>>8&255,t&255):e.isFgPalette()?t>=16?n.push(38,5,t):n.push(t&8?90+(t&7):30+(t&7)):n.push(39)}if(i){let t=e.getBgColor();e.isBgRGB()?n.push(48,2,t>>>16&255,t>>>8&255,t&255):e.isBgPalette()?t>=16?n.push(48,5,t):n.push(t&8?100+(t&7):40+(t&7)):n.push(49)}a&&(e.isInverse()!==t.isInverse()&&n.push(e.isInverse()?7:27),e.isBold()!==t.isBold()&&n.push(e.isBold()?1:22),e.isUnderline()!==t.isUnderline()&&n.push(e.isUnderline()?4:24),e.isOverline()!==t.isOverline()&&n.push(e.isOverline()?53:55),e.isBlink()!==t.isBlink()&&n.push(e.isBlink()?5:25),e.isInvisible()!==t.isInvisible()&&n.push(e.isInvisible()?8:28),e.isItalic()!==t.isItalic()&&n.push(e.isItalic()?3:23),e.isDim()!==t.isDim()&&n.push(e.isDim()?2:22),e.isStrikethrough()!==t.isStrikethrough()&&n.push(e.isStrikethrough()?9:29))}}return n}_nextCell(e,t,n,r){if(e.getWidth()===0)return;let i=e.getChars()===``,a=this._diffStyle(e,this._cursorStyle);if(i?!Ll(this._cursorStyle,e):a.length>0){this._nullCellCount>0&&(Ll(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=r,this._currentRow+=`\x1B[${a.join(`;`)}m`;let e=this._buffer.getLine(n);e!==void 0&&(e.getCell(r,this._cursorStyle),this._cursorStyleRow=n,this._cursorStyleCol=r)}i?this._nullCellCount+=e.getWidth():(this._nullCellCount>0&&(Ll(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._currentRow+=e.getChars(),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=r+e.getWidth())}_serializeString(e){let t=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(t=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let n=``;for(let e=0;e<t;e++)n+=this._allRows[e],e+1<t&&(n+=this._allRowSeparators[e]);if(!e){let e=this._buffer.baseY+this._buffer.cursorY,t=this._buffer.cursorX;(e!==this._lastCursorRow||t!==this._lastCursorCol)&&((e=>{e>0?n+=`\x1B[${e}B`:e<0&&(n+=`\x1B[${-e}A`)})(e-this._lastCursorRow),(e=>{e>0?n+=`\x1B[${e}C`:e<0&&(n+=`\x1B[${-e}D`)})(t-this._lastCursorCol))}let r=this._terminal._core._inputHandler._curAttrData,i=this._diffStyle(r,this._cursorStyle);return i.length>0&&(n+=`\x1B[${i.join(`;`)}m`),n}},Zl=class{activate(e){this._terminal=e}_serializeBufferByScrollback(e,t,n){let r=t.length,i=n===void 0?r:Pl(n+e.rows,0,r);return this._serializeBufferByRange(e,t,{start:r-i,end:r-1},!1)}_serializeBufferByRange(e,t,n,r){return new Xl(t,e).serialize({start:{x:0,y:typeof n.start==`number`?n.start:n.start.line},end:{x:e.cols,y:typeof n.end==`number`?n.end:n.end.line}},r)}_serializeBufferAsHTML(e,t){let n=e.buffer.active,r=new Ql(n,e,t),i=t.onlySelection??!1,a=t.range;if(a)return r.serialize({start:{x:a.startCol,y:(a.startLine,a.startLine)},end:{x:e.cols,y:(a.endLine,a.endLine)}});if(!i){let i=n.length,a=t.scrollback,o=a===void 0?i:Pl(a+e.rows,0,i);return r.serialize({start:{x:0,y:i-o},end:{x:e.cols,y:i-1}})}let o=this._terminal?.getSelectionPosition();return o===void 0?``:r.serialize({start:{x:o.start.x,y:o.start.y},end:{x:o.end.x,y:o.end.y}})}_serializeModes(e){let t=``,n=e.modes;if(n.applicationCursorKeysMode&&(t+=`\x1B[?1h`),n.applicationKeypadMode&&(t+=`\x1B[?66h`),n.bracketedPasteMode&&(t+=`\x1B[?2004h`),n.insertMode&&(t+=`\x1B[4h`),n.originMode&&(t+=`\x1B[?6h`),n.reverseWraparoundMode&&(t+=`\x1B[?45h`),n.sendFocusMode&&(t+=`\x1B[?1004h`),n.wraparoundMode===!1&&(t+=`\x1B[?7l`),n.mouseTrackingMode!==`none`)switch(n.mouseTrackingMode){case`x10`:t+=`\x1B[?9h`;break;case`vt200`:t+=`\x1B[?1000h`;break;case`drag`:t+=`\x1B[?1002h`;break;case`any`:t+=`\x1B[?1003h`}return t}serialize(e){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);let t=e?.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,e.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,e?.scrollback);if(!e?.excludeAltBuffer&&this._terminal.buffer.active.type===`alternate`){let e=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);t+=`\x1B[?1049h\x1B[H${e}`}return e?.excludeModes||(t+=this._serializeModes(this._terminal)),t}serializeAsHTML(e){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);return this._serializeBufferAsHTML(this._terminal,e||{})}dispose(){}},Ql=class extends Yl{constructor(e,t,n){super(e),this._terminal=t,this._options=n,this._currentRow=``,this._htmlContent=``,this._ansiColors=t._core._themeService?t._core._themeService.colors.ansi:Jl}_padStart(e,t,n){return t>>=0,n??=` `,e.length>t?e:(t-=e.length,t>n.length&&(n+=n.repeat(t/n.length)),n.slice(0,t)+e)}_beforeSerialize(e,t,n){this._htmlContent+=`<html><body><!--StartFragment--><pre>`;let r=`#000000`,i=`#ffffff`;(this._options.includeGlobalBackground??!1)&&(r=this._terminal.options.theme?.foreground??`#ffffff`,i=this._terminal.options.theme?.background??`#000000`);let a=[];a.push(`color: `+r+`;`),a.push(`background-color: `+i+`;`),a.push(`font-family: `+this._terminal.options.fontFamily+`;`),a.push(`font-size: `+this._terminal.options.fontSize+`px;`),this._htmlContent+=`<div style='`+a.join(` `)+`'>`}_afterSerialize(){this._htmlContent+=`</div>`,this._htmlContent+=`</pre><!--EndFragment--></body></html>`}_rowEnd(e,t){this._htmlContent+=`<div><span>`+this._currentRow+`</span></div>`,this._currentRow=``}_getHexColor(e,t){let n=t?e.getFgColor():e.getBgColor();if(t?e.isFgRGB():e.isBgRGB())return`#`+[n>>16&255,n>>8&255,n&255].map(e=>this._padStart(e.toString(16),2,`0`)).join(``);if(t?e.isFgPalette():e.isBgPalette())return this._ansiColors[n].css}_diffStyle(e,t){let n=[],r=!Il(e,t),i=!Ll(e,t),a=!Rl(e,t);if(r||i||a){let t=this._getHexColor(e,!0);t&&n.push(`color: `+t+`;`);let r=this._getHexColor(e,!1);return r&&n.push(`background-color: `+r+`;`),e.isInverse()&&n.push(`color: #000000; background-color: #BFBFBF;`),e.isBold()&&n.push(`font-weight: bold;`),e.isUnderline()&&e.isOverline()?n.push(`text-decoration: overline underline;`):e.isUnderline()?n.push(`text-decoration: underline;`):e.isOverline()&&n.push(`text-decoration: overline;`),e.isBlink()&&n.push(`text-decoration: blink;`),e.isInvisible()&&n.push(`visibility: hidden;`),e.isItalic()&&n.push(`font-style: italic;`),e.isDim()&&n.push(`opacity: 0.5;`),e.isStrikethrough()&&n.push(`text-decoration: line-through;`),n}}_nextCell(e,t,n,r){if(e.getWidth()===0)return;let i=e.getChars()===``,a=this._diffStyle(e,t);a&&(this._currentRow+=a.length===0?`</span><span>`:`</span><span style='`+a.join(` `)+`'>`),i?this._currentRow+=` `:this._currentRow+=Fl(e.getChars())}_serializeString(){return this._htmlContent}}}));function eu(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}function tu(e){nu(e)||xu.onUnexpectedError(e)}function nu(e){return e instanceof Cu||e instanceof Error&&e.name===Su&&e.message===Su}function ru(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}function iu(e,t,n=0,r=e.length){let i=n,a=r;for(;i<a;){let n=Math.floor((i+a)/2);t(e[n])?i=n+1:a=n}return i-1}function au(e,t){return(n,r)=>t(e(n),e(r))}function ou(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}function su(e){Mu=e}function cu(e){return Mu?.trackDisposable(e),e}function lu(e){Mu?.markAsDisposed(e)}function uu(e,t){Mu?.setParent(e,t)}function du(e,t){if(Mu)for(let n of e)Mu.setParent(n,t)}function fu(e){if(Au.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function pu(...e){let t=mu(()=>fu(e));return du(e,t),t}function mu(e){let t=cu({dispose:ru(()=>{lu(t),e()})});return t}function hu(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var gu,_u,vu,yu,bu,xu,Su,Cu,wu,Tu,Eu,Du,Ou,ku,Au,ju,Mu,Nu,Pu,Fu,Iu,Lu,Ru,zu,Bu,Vu,Hu,Uu,Wu,Gu,Ku,qu,Ju,Yu,Xu,Zu,Qu,$u,ed,td,nd,rd,id,ad,od,sd,cd,ld,ud,dd,fd,pd=o((()=>{if(gu=[[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]],_u=[[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]],yu=class{constructor(){if(this.version=`6`,!vu){vu=new Uint8Array(65536),vu.fill(1),vu[0]=0,vu.fill(0,1,32),vu.fill(0,127,160),vu.fill(2,4352,4448),vu[9001]=2,vu[9002]=2,vu.fill(2,11904,42192),vu[12351]=1,vu.fill(2,44032,55204),vu.fill(2,63744,64256),vu.fill(2,65040,65050),vu.fill(2,65072,65136),vu.fill(2,65280,65377),vu.fill(2,65504,65511);for(let e=0;e<gu.length;++e)vu.fill(0,gu[e][0],gu[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?vu[e]:eu(e,_u)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=ad.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return ad.createPropertyValue(0,n,r)}},bu=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?wu.isErrorNoTelemetry(e)?new wu(e.message+`
|
|
39
|
+
|
|
40
|
+
`+e.stack):Error(e.message+`
|
|
41
|
+
|
|
42
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},xu=new bu,Su=`Canceled`,Cu=class extends Error{constructor(){super(Su),this.name=this.message}},wu=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},Tu=class e{constructor(e){this._array=e,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(e.assertInvariants){if(this._prevFindLastPredicate){for(let e of this._array)if(this._prevFindLastPredicate(e)&&!t(e))throw Error(`MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.`)}this._prevFindLastPredicate=t}let n=iu(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=n+1,n===-1?void 0:this._array[n]}},Tu.assertInvariants=!1,(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Eu||={}),Du=(e,t)=>e-t,Ou=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||Eu.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}},Ou.empty=new Ou(e=>{}),ku=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}},(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(Au||={}),ju=!1,Mu=null,Nu=class e{constructor(){this.livingDisposables=new Map}getDisposableData(t){let n=this.livingDisposables.get(t);return n||(n={parent:null,source:null,isSingleton:!1,value:t,idx:e.idx++},this.livingDisposables.set(t,n)),n}trackDisposable(e){let t=this.getDisposableData(e);t.source||=Error().stack}setParent(e,t){let n=this.getDisposableData(e);n.parent=t}markAsDisposed(e){this.livingDisposables.delete(e)}markAsSingleton(e){this.getDisposableData(e).isSingleton=!0}getRootParent(e,t){let n=t.get(e);if(n)return n;let r=e.parent?this.getRootParent(this.getDisposableData(e.parent),t):e;return t.set(e,r),r}getTrackedDisposables(){let e=new Map;return[...this.livingDisposables.entries()].filter(([,t])=>t.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(`
|
|
43
|
+
`).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new ku;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(`
|
|
44
|
+
`),e)}n.sort(au(e=>e.idx,Du));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;t<e.length;t++){let a=e[t];a=`(shared with ${i.get(e.slice(0,t+1).join(`
|
|
45
|
+
`)).size}/${n.length} leaks) at ${a}`;let o=ou([...i.get(e.slice(0,t).join(`
|
|
46
|
+
`))].map(e=>r(e)[t]),e=>e);delete o[e[t]];for(let[e,t]of Object.entries(o))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(a)}a+=`
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
==================== Leaking disposable ${o}/${n.length}: ${t.value.constructor.name} ====================
|
|
50
|
+
${s.join(`
|
|
51
|
+
`)}
|
|
52
|
+
============================================================
|
|
53
|
+
|
|
54
|
+
`}return n.length>e&&(a+=`
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
... and ${n.length-e} more leaking disposables
|
|
58
|
+
|
|
59
|
+
`),{leaks:n,details:a}}},Nu.idx=0,ju){let e=`__is_disposable_tracked__`;su(new class{trackDisposable(t){let n=Error(`Potentially leaked disposable`).stack;setTimeout(()=>{t[e]||console.log(n)},3e3)}setParent(t,n){if(t&&t!==Iu.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==Iu.None)try{t[e]=!0}catch{}}markAsSingleton(e){}})}if(Pu=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,cu(this)}dispose(){this._isDisposed||(lu(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{fu(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return uu(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),uu(e,null))}},Pu.DISABLE_DISPOSED_WARNING=!1,Fu=Pu,Iu=class{constructor(){this._store=new Fu,cu(this),uu(this._store,this)}dispose(){lu(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}},Iu.None=Object.freeze({dispose(){}}),Lu=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}},Lu.Undefined=new Lu(void 0),Ru=globalThis.performance&&typeof globalThis.performance.now==`function`,zu=class e{static create(t){return new e(t)}constructor(e){this._now=Ru&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},Bu=!1,Vu=!1,Hu=!1,(e=>{e.None=()=>Iu.None;function t(e){if(Hu){let{onDidAddListener:t}=e,n=Yu.create(),r=0;e.onDidAddListener=()=>{++r===2&&(console.warn(`snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here`),n.print()),t?.()}}}function n(e,t){return f(e,()=>{},0,void 0,!0,void 0,t)}e.defer=n;function r(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=r;function i(e,t,n){return u((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=i;function a(e,t,n){return u((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=a;function o(e,t,n){return u((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=o;function s(e){return e}e.signal=s;function c(...e){return(t,n=null,r)=>d(pu(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=c;function l(e,t,n,r){let a=n;return i(e,e=>(a=t(a,e),a),r)}e.reduce=l;function u(e,n){let r,i={onWillAddFirstListener(){r=e(a.fire,a)},onDidRemoveLastListener(){r?.dispose()}};n||t(i);let a=new rd(i);return n?.add(a),a.event}function d(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function f(e,n,r=100,i=!1,a=!1,o,s){let c,l,u,d=0,f,p={leakWarningThreshold:o,onWillAddFirstListener(){c=e(e=>{d++,l=n(l,e),i&&!u&&(m.fire(l),l=void 0),f=()=>{let e=l;l=void 0,u=void 0,(!i||d>1)&&m.fire(e),d=0},typeof r==`number`?(clearTimeout(u),u=setTimeout(f,r)):u===void 0&&(u=0,queueMicrotask(f))})},onWillRemoveListener(){a&&d>0&&f?.()},onDidRemoveLastListener(){f=void 0,c.dispose()}};s||t(p);let m=new rd(p);return s?.add(m),m.event}e.debounce=f;function p(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=p;function m(e,t=(e,t)=>e===t,n){let r=!0,i;return o(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=m;function h(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=h;function g(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new rd({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=g;function _(e,t){return(n,r,i)=>{let a=t(new y);return e(function(e){let t=a.evaluate(e);t!==v&&n.call(r,t)},void 0,i)}}e.chain=_;let v=Symbol(`HaltChainable`);class y{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:v),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:v}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===v)break;return e}}function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new rd({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=b;function x(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new rd({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=x;function S(e){return new Promise(t=>r(e)(t))}e.toPromise=S;function C(e){let t=new rd;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=C;function w(e,t){return e(e=>t.fire(e))}e.forward=w;function T(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=T;class E{constructor(e,n){this._observable=e,this._counter=0,this._hasChanged=!1;let r={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};n||t(r),this.emitter=new rd(r),n&&n.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function D(e,t){return new E(e,t).emitter.event}e.fromObservable=D;function O(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof Fu?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=O})(Uu||={}),Wu=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new zu,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}},Wu.all=new Set,Wu._idPool=0,Gu=Wu,Ku=-1,qu=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new Xu(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}},qu._idPool=1,Ju=qu,Yu=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
60
|
+
`).slice(2).join(`
|
|
61
|
+
`))}},Xu=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},Zu=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},Qu=0,$u=class{constructor(e){this.value=e,this.id=Qu++}},ed=2,td=(e,t)=>{if(e instanceof $u)t(e);else for(let n=0;n<e.length;n++){let r=e[n];r&&t(r)}},Bu){let e=[];setInterval(()=>{e.length!==0&&(console.warn(`[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:`),console.warn(e.join(`
|
|
62
|
+
`)),e.length=0)},3e3),nd=new FinalizationRegistry(t=>{typeof t==`string`&&e.push(t)})}rd=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Ku>0||this._options?.leakWarningThreshold?new Ju(e?.onListenerError??tu,this._options?.leakWarningThreshold??Ku):void 0,this._perfMon=this._options?._profName?new Gu(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Vu){let e=this._listeners;queueMicrotask(()=>{td(e,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new Zu(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||tu)(n),Iu.None}if(this._disposed)return Iu.None;t&&(e=e.bind(t));let r=new $u(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Yu.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof $u?(this._deliveryQueue??=new id,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=mu(()=>{nd?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof Fu?n.add(a):Array.isArray(n)&&n.push(a),nd){let e=Error().stack.split(`
|
|
63
|
+
`).slice(2,3).join(`
|
|
64
|
+
`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);nd.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*ed<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||tu;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof $u)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},id=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},ad=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new rd,this.onChange=this._onChange.event;let e=new yu;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return!!(e&1)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}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(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},od=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],sd=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],cd=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],ld=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]],dd=class{constructor(){if(this.version=`11`,!ud){ud=new Uint8Array(65536),ud.fill(1),ud[0]=0,ud.fill(0,1,32),ud.fill(0,127,160);for(let e=0;e<od.length;++e)ud.fill(0,od[e][0],od[e][1]+1);for(let e=0;e<cd.length;++e)ud.fill(2,cd[e][0],cd[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ud[e]:hu(e,sd)?0:hu(e,ld)?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=ad.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return ad.createPropertyValue(0,n,r)}},fd=class{activate(e){e.unicode.register(new dd)}dispose(){}}}));function md(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}function hd(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var gd,_d,vd,yd,bd=o((()=>{gd=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=_d.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}},_d=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!md(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),!(!n.isWrapped||o.indexOf(` `)!==-1)););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},vd=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/,yd=class{constructor(e=hd,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||vd;this._linkProvider=this._terminal.registerLinkProvider(new gd(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}}}));function xd(e){return e.replace(/\r?\n/g,`\r`)}function Sd(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function Cd(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function wd(e,t,n,r){e.stopPropagation(),e.clipboardData&&Td(e.clipboardData.getData(`text/plain`),t,n,r)}function Td(e,t,n,r){e=xd(e),e=Sd(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function Ed(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()}function Dd(e,t,n,r,i){Ed(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Od(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function kd(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((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}function Ad(e){return e[Ip]||[]}function jd(e){if(Lp.has(e))return Lp.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Md(t,e,r)};return t._id=e,Lp.set(e,t),t}function Md(e,t,n){t[Fp]===t?t[Ip].push({id:e,index:n}):(t[Ip]=[{id:e,index:n}],t[Fp]=t)}function Nd(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
65
|
+
|
|
66
|
+
WARNING: 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`)}}function Pd(e){Fd(e)||im.onUnexpectedError(e)}function Fd(e){return e instanceof om||e instanceof Error&&e.name===am&&e.message===am}function Id(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}function Ld(e,t,n=0,r=e.length){let i=n,a=r;for(;i<a;){let n=Math.floor((i+a)/2);t(e[n])?i=n+1:a=n}return i-1}function Rd(e,t=0){return e[e.length-(1+t)]}function zd(e,t){return(n,r)=>t(e(n),e(r))}function Bd(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}function Vd(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}function Hd(e){gm=e}function Ud(e){return gm?.trackDisposable(e),e}function Wd(e){gm?.markAsDisposed(e)}function Gd(e,t){gm?.setParent(e,t)}function Kd(e,t){if(gm)for(let n of e)gm.setParent(n,t)}function qd(e){return gm?.markAsSingleton(e),e}function Jd(e){if(mm.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function Yd(...e){let t=Xd(()=>Jd(e));return Kd(e,t),t}function Xd(e){let t=Ud({dispose:Vd(()=>{Wd(t),e()})});return t}function Zd(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}function Qd(e){return qm.INSTANCE.getZoomFactor(e)}function $d(){return $m}function ef(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return Eh.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(Ym)switch(t){case 59:return 85;case 60:if(ph)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(fh)return 57}else if(Xm&&(fh&&t===93||!fh&&t===92))return 57;return Th[t]||0}function tf(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!==`null`&&n.origin!==`null`&&t.origin!==n.origin)return null}catch{return null}return e.parent}function nf(e){return 55296<=e&&e<=56319}function rf(e){return 56320<=e&&e<=57343}function af(e,t){return(e-55296<<10)+(t-56320)+65536}function of(e){return sf(e,0)}function sf(e,t){switch(typeof e){case`object`:return e===null?cf(349,t):Array.isArray(e)?df(e,t):ff(e,t);case`string`:return uf(e,t);case`boolean`:return lf(e,t);case`number`:return cf(e,t);case`undefined`:return cf(937,t);default:return cf(617,t)}}function cf(e,t){return(t<<5)-t+e|0}function lf(e,t){return cf(e?433:863,t)}function uf(e,t){t=cf(149417,t);for(let n=0,r=e.length;n<r;n++)t=cf(e.charCodeAt(n),t);return t}function df(e,t){return t=cf(104579,t),e.reduce((e,t)=>sf(t,e),t)}function ff(e,t){return t=cf(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=uf(n,t),sf(e[n],t)),t)}function pf(e,t,n=32){let r=n-t,i=~((1<<r)-1);return(e<<t|(i&e)>>>r)>>>0}function mf(e,t=0,n=e.byteLength,r=0){for(let i=0;i<n;i++)e[t+i]=r}function hf(e,t,n=`0`){for(;e.length<t;)e=n+e;return e}function gf(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``):hf((e>>>0).toString(16),t/4)}function _f(e,t,n,r){return new Qh(e,t,n,r)}function vf(e,t){return function(n){return t(new Ih(e,n))}}function yf(e){return function(t){return e(new Nh(t))}}function bf(e){let t=e.getBoundingClientRect(),n=Gh(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}function xf(e){return typeof e==`number`?`${e}px`:e}function Sf(e){return new ag(e)}function Cf(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}function wf(e,t){let n=t-e;return function(t){return e+n*Df(t)}}function Tf(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}function Ef(e){return e**3}function Df(e){return 1-Ef(1-e)}function Of(e){let t={lazyRender:typeof e.lazyRender<`u`&&e.lazyRender,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<`u`&&e.scrollYToX,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`&&e.horizontalHasArrows,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,fh&&(t.className+=` mac`),t}function kf(e){let t=e.toString(16);return t.length<2?`0`+t:t}function Af(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function jf(e){return 57508<=e&&e<=57558}function Mf(e){return 9472<=e&&e<=9631}function Nf(e){return jf(e)||Mf(e)}function Pf(){return{css:{canvas:Ff(),cell:Ff()},device:{canvas:Ff(),cell:Ff(),char:{width:0,height:0,left:0,top:0}}}}function Ff(){return{width:0,height:0}}function If(e,t,n){for(;e.length<n;)e=t+e;return e}function Lf(){return new t_}function Rf(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]}function zf(e,t,n,r,i,a,o,s,c){if(!a)return;let l=Rf(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}function Bf(){if(!T_)return 0;let e=x_.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}function Vf(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return Wf(i,a,e,t,n,r)+Gf(a,t,n,r)+Kf(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,$f(Math.abs(i-e),Qf(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return $f(Uf(a>t?e:i,n)+(s-1)*n.cols+1+Hf(a>t?i:e,n),Qf(o,r))}function Hf(e,t){return e-1}function Uf(e,t){return t.cols-e}function Wf(e,t,n,r,i,a){return Gf(t,r,i,a).length===0?``:$f(Zf(e,t,e,t-Jf(t,i),!1,i).length,Qf(`D`,a))}function Gf(e,t,n,r){let i=e-Jf(e,n),a=t-Jf(t,n);return $f(Math.abs(i-a)-qf(e,t,n),Qf(Xf(e,t),r))}function Kf(e,t,n,r,i,a){let o;o=Gf(t,r,i,a).length>0?r-Jf(r,i):t;let s=r,c=Yf(e,t,n,r,i,a);return $f(Zf(e,o,n,s,c===`C`,i).length,Qf(c,a))}function qf(e,t,n){let r=0,i=e-Jf(e,n),a=t-Jf(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=Xf(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function Jf(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 Yf(e,t,n,r,i,a){let o;return o=Gf(n,r,i,a).length>0?r-Jf(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function Xf(e,t){return e>t?`A`:`B`}function Zf(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&s<a.buffer.lines.length;)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 Qf(e,t){let n=t?`O`:`[`;return Q.ESC+n+e}function $f(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}function ep(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)}function tp(e,t){if(e!==void 0)try{return Jg.toColor(e)}catch{}return t}function np(e,t,n,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(!a&&r>=s&&r<c){s+=u.length-1;continue}let d=0,f=op(u,d,t),p=1,m=0;for(;p<u.length;){let e=op(u,p,t),r=e-m,a=n-f,o=Math.min(r,a);u[d].copyCellsFrom(u[p],m,f,o,!1),f+=o,f===n&&(d++,f=0),m+=o,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,f++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(f,n,i);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}function rp(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}}function ip(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}function ap(e,t,n){let r=[],i=e.map((n,r)=>op(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;s<i;){if(i-s<n){r.push(i-s);break}a+=n;let c=op(e,o,t);a>c&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function op(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}function sp(e){return e===`block`||e===`underline`||e===`bar`}function cp(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&cp(e[r],t-1);return n}function lp(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|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}function up(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}function dp(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[3]!==0&&t[3]!==32)}function fp(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=$v.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),ey.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}}function pp(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}}function mp(e,t=16){let[n,r,i]=e;return`rgb:${pp(n,t)}/${pp(r,t)}/${pp(i,t)}`}function hp(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}function gp(e){return 0<=e&&e<256}function _p(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=+!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?i.key=t?Q.ESC+`OA`:Q.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?i.key=t?Q.ESC+`OD`:Q.ESC+`[D`:e.key===`UIKeyInputRightArrow`?i.key=t?Q.ESC+`OC`:Q.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(i.key=t?Q.ESC+`OB`:Q.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:Q.DEL,e.altKey&&(i.key=Q.ESC+i.key);break;case 9:if(e.shiftKey){i.key=Q.ESC+`[Z`;break}i.key=Q.HT,i.cancel=!0;break;case 13:i.key=e.altKey?Q.ESC+Q.CR:Q.CR,i.cancel=!0;break;case 27:i.key=Q.ESC,e.altKey&&(i.key=Q.ESC+Q.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;i.key=a?Q.ESC+`[1;`+(a+1)+`D`:t?Q.ESC+`OD`:Q.ESC+`[D`;break;case 39:if(e.metaKey)break;i.key=a?Q.ESC+`[1;`+(a+1)+`C`:t?Q.ESC+`OC`:Q.ESC+`[C`;break;case 38:if(e.metaKey)break;i.key=a?Q.ESC+`[1;`+(a+1)+`A`:t?Q.ESC+`OA`:Q.ESC+`[A`;break;case 40:if(e.metaKey)break;i.key=a?Q.ESC+`[1;`+(a+1)+`B`:t?Q.ESC+`OB`:Q.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=Q.ESC+`[2~`);break;case 46:i.key=a?Q.ESC+`[3;`+(a+1)+`~`:Q.ESC+`[3~`;break;case 36:i.key=a?Q.ESC+`[1;`+(a+1)+`H`:t?Q.ESC+`OH`:Q.ESC+`[H`;break;case 35:i.key=a?Q.ESC+`[1;`+(a+1)+`F`:t?Q.ESC+`OF`:Q.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:i.key=e.ctrlKey?Q.ESC+`[5;`+(a+1)+`~`:Q.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:i.key=e.ctrlKey?Q.ESC+`[6;`+(a+1)+`~`:Q.ESC+`[6~`;break;case 112:i.key=a?Q.ESC+`[1;`+(a+1)+`P`:Q.ESC+`OP`;break;case 113:i.key=a?Q.ESC+`[1;`+(a+1)+`Q`:Q.ESC+`OQ`;break;case 114:i.key=a?Q.ESC+`[1;`+(a+1)+`R`:Q.ESC+`OR`;break;case 115:i.key=a?Q.ESC+`[1;`+(a+1)+`S`:Q.ESC+`OS`;break;case 116:i.key=a?Q.ESC+`[15;`+(a+1)+`~`:Q.ESC+`[15~`;break;case 117:i.key=a?Q.ESC+`[17;`+(a+1)+`~`:Q.ESC+`[17~`;break;case 118:i.key=a?Q.ESC+`[18;`+(a+1)+`~`:Q.ESC+`[18~`;break;case 119:i.key=a?Q.ESC+`[19;`+(a+1)+`~`:Q.ESC+`[19~`;break;case 120:i.key=a?Q.ESC+`[20;`+(a+1)+`~`:Q.ESC+`[20~`;break;case 121:i.key=a?Q.ESC+`[21;`+(a+1)+`~`:Q.ESC+`[21~`;break;case 122:i.key=a?Q.ESC+`[23;`+(a+1)+`~`:Q.ESC+`[23~`;break;case 123:i.key=a?Q.ESC+`[24;`+(a+1)+`~`:Q.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=Q.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=Q.DEL:e.keyCode===219?i.key=Q.ESC:e.keyCode===220?i.key=Q.FS:e.keyCode===221&&(i.key=Q.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=hy[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=Q.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()),i.key=Q.ESC+n}else if(e.keyCode===32)i.key=Q.ESC+(e.ctrlKey?Q.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=Q.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=Q.US),e.key===`@`&&(i.key=Q.NUL))}return i}function vp(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}function yp(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var bp,xp,Sp,Cp,X,wp,Tp,Ep,Dp,Op,kp,Ap,jp,Mp,Np,Pp,Fp,Ip,Lp,Rp,zp,Bp,Vp,Hp,Up,Wp,Gp,Kp,qp,Jp,Yp,Xp,Zp,Qp,$p,em,tm,nm,rm,im,am,om,sm,cm,lm,um,dm,fm,pm,mm,hm,gm,_m,vm,ym,bm,xm,Sm,Cm,wm,Tm,Em,Dm,Om,km,Am,jm,Mm,Nm,Pm,Fm,Im,Lm,Rm,zm,Bm,Vm,Hm,Um,Wm,Z,Gm,Km,qm,Jm,Ym,Xm,Zm,Qm,$m,eh,th,nh,rh,ih,ah,oh,sh,ch,lh,uh,dh,fh,ph,mh,hh,gh,_h,vh,yh,bh,xh,Sh,Ch,wh,Th,Eh,Dh,Oh,kh,Ah,jh,Mh,Nh,Ph,Fh,Ih,Lh,Rh,zh,Bh,Vh,Hh,eee,Uh,Wh,tee,Gh,nee,ree,Kh,qh,Jh,Yh,Xh,Zh,iee,Qh,$h,eg,tg,ng,rg,ig,ag,og,sg,cg,lg,ug,dg,fg,pg,mg,hg,gg,_g,vg,yg,bg,xg,Sg,Cg,wg,Tg,Eg,Dg,Og,kg,Ag,jg,Mg,Ng,Pg,Fg,Ig,Lg,Q,Rg,zg,Bg,Vg,Hg,Ug,Wg,Gg,Kg,qg,Jg,Yg,Xg,Zg,Qg,$g,e_,t_,n_,r_,i_,a_,o_,s_,c_,l_,u_,d_,f_,p_,m_,h_,g_,__,v_,y_,b_,x_,S_,C_,w_,T_,E_,D_,O_,k_,A_,j_,M_,N_,P_,F_,I_,L_,R_,z_,B_,V_,H_,U_,W_,G_,K_,q_,J_,Y_,X_,Z_,Q_,$_,ev,tv,nv,rv,iv,av,ov,sv,cv,lv,uv,dv,fv,pv,mv,hv,gv,_v,vv,yv,bv,xv,Sv,Cv,wv,Tv,Ev,Dv,Ov,kv,Av,jv,Mv,Nv,Pv,Fv,Iv,Lv,Rv,zv,Bv,Vv,Hv,Uv,Wv,Gv,Kv,qv,Jv,Yv,Xv,Zv,Qv,$v,ey,ty,ny,ry,iy,ay,oy,sy,cy,ly,uy,dy,fy,py,my,hy,gy,_y,vy,yy,by,xy,Sy,Cy,wy,Ty,Ey,Dy,Oy,ky,Ay,jy,My,Ny,Py,Fy,Iy,Ly,Ry=o((()=>{if(bp=Object.defineProperty,xp=Object.getOwnPropertyDescriptor,Sp=(e,t)=>{for(var n in t)bp(e,n,{get:t[n],enumerable:!0})},Cp=(e,t,n,r)=>{for(var i=r>1?void 0:r?xp(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&bp(t,n,i),i},X=(e,t)=>(n,r)=>t(n,r,e),wp=`Terminal input`,Tp={get:()=>wp,set:e=>wp=e},Ep=`Too much output to announce, navigate to rows manually to read`,Dp={get:()=>Ep,set:e=>Ep=e},Op=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++]=(this._interim-55296)*1024+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++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},kp=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=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},Ap=``,jp=` `,Mp=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Np}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Np=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Pp=class e extends Mp{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Np,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Od(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Fp=`di$target`,Ip=`di$dependencies`,Lp=new Map,Rp=jd(`BufferService`),zp=jd(`CoreMouseService`),Bp=jd(`CoreService`),Vp=jd(`CharsetService`),Hp=jd(`InstantiationService`),Up=jd(`LogService`),Wp=jd(`OptionsService`),Gp=jd(`OscLinkService`),Kp=jd(`UnicodeService`),qp=jd(`DecorationService`),Jp=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){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new Pp,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Nd(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}},Jp=Cp([X(0,Rp),X(1,Wp),X(2,Gp)],Jp),Yp=jd(`CharSizeService`),Xp=jd(`CoreBrowserService`),Zp=jd(`MouseService`),Qp=jd(`RenderService`),$p=jd(`SelectionService`),em=jd(`CharacterJoinerService`),tm=jd(`ThemeService`),nm=jd(`LinkProviderService`),rm=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?sm.isErrorNoTelemetry(e)?new sm(e.message+`
|
|
67
|
+
|
|
68
|
+
`+e.stack):Error(e.message+`
|
|
69
|
+
|
|
70
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},im=new rm,am=`Canceled`,om=class extends Error{constructor(){super(am),this.name=this.message}},sm=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},cm=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}},lm=class e{constructor(e){this._array=e,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(e.assertInvariants){if(this._prevFindLastPredicate){for(let e of this._array)if(this._prevFindLastPredicate(e)&&!t(e))throw Error(`MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.`)}this._prevFindLastPredicate=t}let n=Ld(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=n+1,n===-1?void 0:this._array[n]}},lm.assertInvariants=!1,(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(um||={}),dm=(e,t)=>e-t,fm=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||um.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}},fm.empty=new fm(e=>{}),pm=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}},(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(mm||={}),hm=!1,gm=null,_m=class e{constructor(){this.livingDisposables=new Map}getDisposableData(t){let n=this.livingDisposables.get(t);return n||(n={parent:null,source:null,isSingleton:!1,value:t,idx:e.idx++},this.livingDisposables.set(t,n)),n}trackDisposable(e){let t=this.getDisposableData(e);t.source||=Error().stack}setParent(e,t){let n=this.getDisposableData(e);n.parent=t}markAsDisposed(e){this.livingDisposables.delete(e)}markAsSingleton(e){this.getDisposableData(e).isSingleton=!0}getRootParent(e,t){let n=t.get(e);if(n)return n;let r=e.parent?this.getRootParent(this.getDisposableData(e.parent),t):e;return t.set(e,r),r}getTrackedDisposables(){let e=new Map;return[...this.livingDisposables.entries()].filter(([,t])=>t.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(`
|
|
71
|
+
`).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new pm;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(`
|
|
72
|
+
`),e)}n.sort(zd(e=>e.idx,dm));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;t<e.length;t++){let a=e[t];a=`(shared with ${i.get(e.slice(0,t+1).join(`
|
|
73
|
+
`)).size}/${n.length} leaks) at ${a}`;let o=Bd([...i.get(e.slice(0,t).join(`
|
|
74
|
+
`))].map(e=>r(e)[t]),e=>e);delete o[e[t]];for(let[e,t]of Object.entries(o))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(a)}a+=`
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
==================== Leaking disposable ${o}/${n.length}: ${t.value.constructor.name} ====================
|
|
78
|
+
${s.join(`
|
|
79
|
+
`)}
|
|
80
|
+
============================================================
|
|
81
|
+
|
|
82
|
+
`}return n.length>e&&(a+=`
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
... and ${n.length-e} more leaking disposables
|
|
86
|
+
|
|
87
|
+
`),{leaks:n,details:a}}},_m.idx=0,hm){let e=`__is_disposable_tracked__`;Hd(new class{trackDisposable(t){let n=Error(`Potentially leaked disposable`).stack;setTimeout(()=>{t[e]||console.log(n)},3e3)}setParent(t,n){if(t&&t!==bm.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==bm.None)try{t[e]=!0}catch{}}markAsSingleton(e){}})}if(vm=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,Ud(this)}dispose(){this._isDisposed||(Wd(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Jd(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return Gd(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),Gd(e,null))}},vm.DISABLE_DISPOSED_WARNING=!1,ym=vm,bm=class{constructor(){this._store=new ym,Ud(this),Gd(this._store,this)}dispose(){Wd(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}},bm.None=Object.freeze({dispose(){}}),xm=class{constructor(){this._isDisposed=!1,Ud(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Gd(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Wd(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Gd(e,null),e}},Sm=typeof window==`object`?window:globalThis,Cm=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}},Cm.Undefined=new Cm(void 0),wm=Cm,Tm=class{constructor(){this._first=wm.Undefined,this._last=wm.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===wm.Undefined}clear(){let e=this._first;for(;e!==wm.Undefined;){let t=e.next;e.prev=wm.Undefined,e.next=wm.Undefined,e=t}this._first=wm.Undefined,this._last=wm.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new wm(e);if(this._first===wm.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==wm.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==wm.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==wm.Undefined&&e.next!==wm.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===wm.Undefined&&e.next===wm.Undefined?(this._first=wm.Undefined,this._last=wm.Undefined):e.next===wm.Undefined?(this._last=this._last.prev,this._last.next=wm.Undefined):e.prev===wm.Undefined&&(this._first=this._first.next,this._first.prev=wm.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==wm.Undefined;)yield e.element,e=e.next}},Em=globalThis.performance&&typeof globalThis.performance.now==`function`,Dm=class e{static create(t){return new e(t)}constructor(e){this._now=Em&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},Om=!1,km=!1,Am=!1,(e=>{e.None=()=>bm.None;function t(e){if(Am){let{onDidAddListener:t}=e,n=Lm.create(),r=0;e.onDidAddListener=()=>{++r===2&&(console.warn(`snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here`),n.print()),t?.()}}}function n(e,t){return f(e,()=>{},0,void 0,!0,void 0,t)}e.defer=n;function r(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=r;function i(e,t,n){return u((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=i;function a(e,t,n){return u((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=a;function o(e,t,n){return u((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=o;function s(e){return e}e.signal=s;function c(...e){return(t,n=null,r)=>d(Yd(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=c;function l(e,t,n,r){let a=n;return i(e,e=>(a=t(a,e),a),r)}e.reduce=l;function u(e,n){let r,i={onWillAddFirstListener(){r=e(a.fire,a)},onDidRemoveLastListener(){r?.dispose()}};n||t(i);let a=new Z(i);return n?.add(a),a.event}function d(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function f(e,n,r=100,i=!1,a=!1,o,s){let c,l,u,d=0,f,p={leakWarningThreshold:o,onWillAddFirstListener(){c=e(e=>{d++,l=n(l,e),i&&!u&&(m.fire(l),l=void 0),f=()=>{let e=l;l=void 0,u=void 0,(!i||d>1)&&m.fire(e),d=0},typeof r==`number`?(clearTimeout(u),u=setTimeout(f,r)):u===void 0&&(u=0,queueMicrotask(f))})},onWillRemoveListener(){a&&d>0&&f?.()},onDidRemoveLastListener(){f=void 0,c.dispose()}};s||t(p);let m=new Z(p);return s?.add(m),m.event}e.debounce=f;function p(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=p;function m(e,t=(e,t)=>e===t,n){let r=!0,i;return o(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=m;function h(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=h;function g(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new Z({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=g;function _(e,t){return(n,r,i)=>{let a=t(new y);return e(function(e){let t=a.evaluate(e);t!==v&&n.call(r,t)},void 0,i)}}e.chain=_;let v=Symbol(`HaltChainable`);class y{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:v),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:v}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===v)break;return e}}function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Z({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=b;function x(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Z({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=x;function S(e){return new Promise(t=>r(e)(t))}e.toPromise=S;function C(e){let t=new Z;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=C;function w(e,t){return e(e=>t.fire(e))}e.forward=w;function T(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=T;class E{constructor(e,n){this._observable=e,this._counter=0,this._hasChanged=!1;let r={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};n||t(r),this.emitter=new Z(r),n&&n.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function D(e,t){return new E(e,t).emitter.event}e.fromObservable=D;function O(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof ym?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=O})(jm||={}),Mm=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new Dm,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}},Mm.all=new Set,Mm._idPool=0,Nm=Mm,Pm=-1,Fm=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new Rm(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}},Fm._idPool=1,Im=Fm,Lm=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
88
|
+
`).slice(2).join(`
|
|
89
|
+
`))}},Rm=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},zm=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},Bm=0,Vm=class{constructor(e){this.value=e,this.id=Bm++}},Hm=2,Um=(e,t)=>{if(e instanceof Vm)t(e);else for(let n=0;n<e.length;n++){let r=e[n];r&&t(r)}},Om){let e=[];setInterval(()=>{e.length!==0&&(console.warn(`[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:`),console.warn(e.join(`
|
|
90
|
+
`)),e.length=0)},3e3),Wm=new FinalizationRegistry(t=>{typeof t==`string`&&e.push(t)})}if(Z=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Pm>0||this._options?.leakWarningThreshold?new Im(e?.onListenerError??Pd,this._options?.leakWarningThreshold??Pm):void 0,this._perfMon=this._options?._profName?new Nm(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(km){let e=this._listeners;queueMicrotask(()=>{Um(e,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new zm(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||Pd)(n),bm.None}if(this._disposed)return bm.None;t&&(e=e.bind(t));let r=new Vm(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Lm.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Vm?(this._deliveryQueue??=new Gm,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=Xd(()=>{Wm?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof ym?n.add(a):Array.isArray(n)&&n.push(a),Wm){let e=Error().stack.split(`
|
|
91
|
+
`).slice(2,3).join(`
|
|
92
|
+
`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);Wm.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Hm<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||Pd;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof Vm)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},Gm=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Km=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Z,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Z,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}},Km.INSTANCE=new Km,qm=Km,qm.INSTANCE.onDidChangeZoomLevel,qm.INSTANCE.onDidChangeFullscreen,Jm=typeof navigator==`object`?navigator.userAgent:``,Ym=Jm.indexOf(`Firefox`)>=0,Xm=Jm.indexOf(`AppleWebKit`)>=0,Zm=Jm.indexOf(`Chrome`)>=0,Qm=!Zm&&Jm.indexOf(`Safari`)>=0,Jm.indexOf(`Electron/`),Jm.indexOf(`Android`),$m=!1,typeof Sm.matchMedia==`function`){let e=Sm.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=Sm.matchMedia(`(display-mode: fullscreen)`);$m=e.matches,Zd(Sm,e,({matches:e})=>{$m&&t.matches||($m=e)})}if(eh=`en`,th=!1,nh=!1,rh=!1,ih=!1,ah=!1,oh=eh,ch=globalThis,typeof ch.vscode<`u`&&typeof ch.vscode.process<`u`?lh=ch.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(lh=process),uh=typeof lh?.versions?.electron==`string`&&lh?.type===`renderer`,typeof lh==`object`){th=lh.platform===`win32`,nh=lh.platform===`darwin`,rh=lh.platform===`linux`,rh&&lh.env.SNAP&&lh.env.SNAP_REVISION,lh.env.CI||lh.env.BUILD_ARTIFACTSTAGINGDIRECTORY,oh=eh;let e=lh.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,oh=t.resolvedLanguage||eh,t.languagePack?.translationsConfigFile}catch{}ih=!0}else typeof navigator==`object`&&!uh?(sh=navigator.userAgent,th=sh.indexOf(`Windows`)>=0,nh=sh.indexOf(`Macintosh`)>=0,(sh.indexOf(`Macintosh`)>=0||sh.indexOf(`iPad`)>=0||sh.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,rh=sh.indexOf(`Linux`)>=0,sh?.indexOf(`Mobi`),ah=!0,oh=globalThis._VSCODE_NLS_LANGUAGE||eh,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);dh=th,fh=nh,ph=rh,mh=ih,ah&&typeof ch.importScripts==`function`&&ch.origin,hh=sh,gh=oh,(e=>{function t(){return gh}e.value=t;function n(){return gh.length===2?gh===`en`:gh.length>=3&&gh[0]===`e`&&gh[1]===`n`&&gh[2]===`-`}e.isDefaultVariant=n;function r(){return gh===`en`}e.isDefault=r})(_h||={}),vh=typeof ch.postMessage==`function`&&!ch.importScripts,(()=>{if(vh){let e=[];ch.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),ch.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})(),yh=!!(hh&&hh.indexOf(`Chrome`)>=0),hh&&hh.indexOf(`Firefox`),!yh&&hh&&hh.indexOf(`Safari`),hh&&hh.indexOf(`Edg/`),hh&&hh.indexOf(`Android`),bh=typeof navigator==`object`?navigator:{},mh||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||bh&&bh.clipboard&&bh.clipboard.writeText,mh||bh&&bh.clipboard&&bh.clipboard.readText,mh||$d()||bh.keyboard,`ontouchstart`in Sm||bh.maxTouchPoints,Sm.PointerEvent&&(`ontouchstart`in Sm||navigator.maxTouchPoints),xh=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Sh=new xh,Ch=new xh,wh=new xh,Th=Array(230),(e=>{function t(e){return Sh.keyCodeToStr(e)}e.toString=t;function n(e){return Sh.strToKeyCode(e)}e.fromString=n;function r(e){return Ch.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return wh.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return Ch.strToKeyCode(e)||wh.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return Sh.keyCodeToStr(e)}e.toElectronAccelerator=o})(Eh||={}),Dh=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Oh([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Oh=class{constructor(e){if(e.length===0)throw Id(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=`;`),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}},kh=fh?256:2048,Ah=512,jh=1024,Mh=fh?2048:256,Nh=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.(`AltGraph`),this.keyCode=ef(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=kh),this.altKey&&(t|=Ah),this.shiftKey&&(t|=jh),this.metaKey&&(t|=Mh),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Dh(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Ph=new WeakMap,Fh=class{static getSameOriginWindowChain(e){let t=Ph.get(e);if(!t){t=[],Ph.set(e,t);let n=e,r;do r=tf(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let e of i){let i=e.window.deref();if(n+=i?.scrollY??0,r+=i?.scrollX??0,i===t||!e.iframeElement)break;let a=e.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},Ih=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type===`dblclick`&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX==`number`?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=Fh.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Lh=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(Zm){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let t=e,n=e,i=e.view?.devicePixelRatio||1;if(typeof t.wheelDeltaY<`u`)this.deltaY=r?t.wheelDeltaY/(120*i):t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<`u`&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type===`wheel`){let t=e;this.deltaY=t.deltaMode===t.DOM_DELTA_LINE?Ym&&!fh?-e.deltaY/3:-e.deltaY:-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)this.deltaX=Qm&&dh?-(t.wheelDeltaX/120):r?t.wheelDeltaX/(120*i):t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<`u`&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type===`wheel`){let t=e;this.deltaX=t.deltaMode===t.DOM_DELTA_LINE?Ym&&!fh?-e.deltaX/3:-e.deltaX:-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(this.deltaY=r?e.wheelDelta/(120*i):e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},Rh=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof Bh?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:jm.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Rh})})(zh||={}),Bh=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Rh:(this._emitter||=new Z,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},Vh=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new cm(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new cm(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Hh=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new cm(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=Xd(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})(),(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(eee||={}),Uh=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Z,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await jm.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}},Uh.EMPTY=Uh.fromArray([]),Wh=class e{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){let t=e.length;if(t===0)return;let n=this._buff,r=this._buffLen,i=this._leftoverHighSurrogate,a,o;for(i===0?(a=e.charCodeAt(0),o=0):(a=i,o=-1,i=0);;){let s=a;if(nf(a)){if(o+1<t){let t=e.charCodeAt(o+1);rf(t)?(o++,s=af(a,t)):s=65533}else{i=a;break}}else rf(a)&&(s=65533);if(r=this._push(n,r,s),o++,o<t)a=e.charCodeAt(o);else break}this._buffLen=r,this._leftoverHighSurrogate=i}_push(e,t,n){return n<128?e[t++]=n:n<2048?(e[t++]=192|(n&1984)>>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),gf(this._h0)+gf(this._h1)+gf(this._h2)+gf(this._h3)+gf(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,mf(this._buff,this._buffLen),this._buffLen>56&&(this._step(),mf(this._buff));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let t=e._bigBlock32,n=this._buffDV;for(let e=0;e<64;e+=4)t.setUint32(e,n.getUint32(e,!1),!1);for(let e=64;e<320;e+=4)t.setUint32(e,pf(t.getUint32(e-12,!1)^t.getUint32(e-32,!1)^t.getUint32(e-56,!1)^t.getUint32(e-64,!1),1),!1);let r=this._h0,i=this._h1,a=this._h2,o=this._h3,s=this._h4,c,l,u;for(let e=0;e<80;e++)e<20?(c=i&a|~i&o,l=1518500249):e<40?(c=i^a^o,l=1859775393):e<60?(c=i&a|i&o|a&o,l=2400959708):(c=i^a^o,l=3395469782),u=pf(r,5)+c+s+l+t.getUint32(e*4,!1)&4294967295,s=o,o=a,a=pf(i,30),i=r,r=u;this._h0=this._h0+r&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+a&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+s&4294967295}},Wh._bigBlock32=new DataView(new ArrayBuffer(320)),{registerWindow:tee,getWindow:Gh,getDocument:nee,getWindows:ree,getWindowsCount:Kh,getWindowId:qh,getWindowById:Jh,hasWindow:Yh,onDidRegisterWindow:Xh,onWillUnregisterWindow:Zh,onDidUnregisterWindow:iee}=function(){let e=new Map,t={window:Sm,disposables:new ym};e.set(Sm.vscodeWindowId,t);let n=new Z,r=new Z,i=new Z;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return bm.None;let a=new ym,o={window:t,disposables:a.add(new ym)};return e.set(t.vscodeWindowId,o),a.add(Xd(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(_f(t,ig.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:Sm},getDocument(e){return Gh(e).document}}}(),Qh=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}},$h=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=vf(Gh(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=yf(n)),_f(e,t,i,r)},tg=class extends Hh{constructor(e){super(),this.defaultTarget=e&&Gh(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},ng=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Pd(e)}}static sort(e,t){return t.priority-e.priority}},(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(ng.sort),a.shift().execute();r.set(i,!1)};eg=(t,r,a=0)=>{let o=qh(t),s=new ng(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})(),rg=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}},rg.None=new rg(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=of(n),a=r.get(i);if(a)a.users+=1;else{let o=new Z,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(Xd(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}},ig={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:Xm?`webkitAnimationStart`:`animationstart`,ANIMATION_END:Xm?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:Xm?`webkitAnimationIteration`:`animationiteration`},ag=class{constructor(e){this.domNode=e,this._maxWidth=``,this._width=``,this._height=``,this._top=``,this._left=``,this._bottom=``,this._right=``,this._paddingTop=``,this._paddingLeft=``,this._paddingBottom=``,this._paddingRight=``,this._fontFamily=``,this._fontWeight=``,this._fontSize=``,this._fontStyle=``,this._fontFeatureSettings=``,this._fontVariationSettings=``,this._textDecoration=``,this._lineHeight=``,this._letterSpacing=``,this._className=``,this._display=``,this._position=``,this._visibility=``,this._color=``,this._backgroundColor=``,this._layerHint=!1,this._contain=`none`,this._boxShadow=``}setMaxWidth(e){let t=xf(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=xf(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=xf(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=xf(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=xf(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=xf(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=xf(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=xf(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=xf(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=xf(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=xf(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=xf(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=xf(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=xf(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}},og=class{constructor(){this._hooks=new ym,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(Xd(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=Gh(e)}this._hooks.add(_f(a,ig.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(_f(a,ig.POINTER_UP,e=>this.stopMonitoring(!0)))}},(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(sg||={}),cg=class e extends bm{constructor(){super(),this.dispatched=!1,this.targets=new Tm,this.ignoreTargets=new Tm,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(jm.runAndSubscribe(Xh,({window:e,disposables:t})=>{t.add(_f(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(_f(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(_f(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:Sm,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=qd(new e),Xd(e.INSTANCE.targets.push(t))):bm.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=qd(new e),Xd(e.INSTANCE.ignoreTargets.push(t))):bm.None}static isTouchDevice(){return`ontouchstart`in Sm||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n<r;n++){let r=e.targetTouches.item(n);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let i=this.newGestureEvent(sg.Start,r.target);i.pageX=r.pageX,i.pageY=r.pageY,this.dispatchEvent(i)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let a=0,o=n.changedTouches.length;a<o;a++){let o=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn(`move of an UNKNOWN touch`,o);continue}let s=this.activeTouches[o.identifier],c=Date.now()-s.initialTimeStamp;if(c<e.HOLD_DELAY&&Math.abs(s.initialPageX-Rd(s.rollingPageX))<30&&Math.abs(s.initialPageY-Rd(s.rollingPageY))<30){let e=this.newGestureEvent(sg.Tap,s.initialTarget);e.pageX=Rd(s.rollingPageX),e.pageY=Rd(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-Rd(s.rollingPageX))<30&&Math.abs(s.initialPageY-Rd(s.rollingPageY))<30){let e=this.newGestureEvent(sg.Contextmenu,s.initialTarget);e.pageX=Rd(s.rollingPageX),e.pageY=Rd(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=Rd(s.rollingPageX),n=Rd(s.rollingPageY),i=Rd(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(sg.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===sg.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===sg.Change||t.type===sg.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=eg(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(sg.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn(`end of an UNKNOWN touch`,r);continue}let i=this.activeTouches[r.identifier],a=this.newGestureEvent(sg.Change,i.initialTarget);a.translationX=r.pageX-Rd(i.rollingPageX),a.translationY=r.pageY-Rd(i.rollingPageY),a.pageX=r.pageX,a.pageY=r.pageY,this.dispatchEvent(a),i.rollingPageX.length>3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}},cg.SCROLL_FRICTION=-.005,cg.HOLD_DELAY=700,cg.CLEAR_TAP_COUNT_TIME=400,Cp([Cf],cg,`isTouchDevice`,1),lg=cg,ug=class extends bm{onclick(e,t){this._register(_f(e,ig.CLICK,n=>t(new Ih(Gh(e),n))))}onmousedown(e,t){this._register(_f(e,ig.MOUSE_DOWN,n=>t(new Ih(Gh(e),n))))}onmouseover(e,t){this._register(_f(e,ig.MOUSE_OVER,n=>t(new Ih(Gh(e),n))))}onmouseleave(e,t){this._register(_f(e,ig.MOUSE_LEAVE,n=>t(new Ih(Gh(e),n))))}onkeydown(e,t){this._register(_f(e,ig.KEY_DOWN,e=>t(new Nh(e))))}onkeyup(e,t){this._register(_f(e,ig.KEY_UP,e=>t(new Nh(e))))}oninput(e,t){this._register(_f(e,ig.INPUT,t))}onblur(e,t){this._register(_f(e,ig.BLUR,t))}onfocus(e,t){this._register(_f(e,ig.FOCUS,t))}onchange(e,t){this._register(_f(e,ig.CHANGE,t))}ignoreGesture(e){return lg.ignoreTarget(e)}},dg=11,fg=class extends ug{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=dg+`px`,this.domNode.style.height=dg+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new og),this._register($h(this.bgDomNode,ig.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register($h(this.domNode,ig.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new tg),this._pointerdownScheduleRepeatTimer=this._register(new Vh)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Gh(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},pg=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},mg=class extends bm{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Z),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new pg(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new gg(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=gg.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},hg=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}},gg=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.duration=r,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,n){if(Math.abs(e-t)>2.5*n){let r,i;return e<t?(r=e+.75*n,i=t-.75*n):(r=e-.75*n,i=t+.75*n),Tf(wf(e,r),wf(i,t),.33)}return wf(e,t)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;return t<1?new hg(this.scrollLeft(t),this.scrollTop(t),!1):new hg(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){r+=10;let i=Date.now()-10;return new e(t,n,i,r)}},_g=class extends bm{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Vh)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3||this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?` fade`:``)))}},vg=140,yg=class extends ug{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new _g(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new og),this._shouldRender=!0,this.domNode=Sf(document.createElement(`div`)),this.domNode.setAttribute(`role`,`presentation`),this.domNode.setAttribute(`aria-hidden`,`true`),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition(`absolute`),this._register(_f(this.domNode.domNode,ig.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new fg(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=Sf(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(_f(this.slider.domNode,ig.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=bf(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(dh&&a>vg){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},bg=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},xg=class extends yg{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new bg(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:`horizontal`,scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Sg=class extends yg{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new bg(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:`vertical`,scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},Cg=500,wg=50,Tg=!0,Eg=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Dg=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,n=1,r=this._rear;do{let i=r===this._front?e:2**-n;if(e-=i,t+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}while(!0);return t<=.5}acceptStandardWheelEvent(e){if(Zm){let t=Qd(Gh(e.browserEvent));this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,n){let r=null,i=new Eg(e,t,n);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=i),i.score=this._computeScore(i,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}},Dg.INSTANCE=new Dg,Og=Dg,kg=class extends ug{constructor(e,t,n){super(),this._onScroll=this._register(new Z),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Z),this.onWillScroll=this._onWillScroll.event,this._options=Of(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Sg(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new xg(this._scrollable,this._options,r)),this._domNode=document.createElement(`div`),this._domNode.className=`xterm-scrollable-element `+this._options.className,this._domNode.setAttribute(`role`,`presentation`),this._domNode.style.position=`relative`,this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Sf(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Sf(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Sf(document.createElement(`div`)),this._topLeftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new Vh),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Jd(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,fh&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Lh(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Jd(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(_f(this._listenOnDomNode,ig.MOUSE_WHEEL,e=>{this._onMouseWheel(new Lh(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=Og.INSTANCE;Tg&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!fh&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=wg*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=wg*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(Tg&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Cg)}},Ag=class extends kg{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}},jg=class extends bm{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new Z),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new mg({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>eg(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Ag(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(jm.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Xd(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(Xd(()=>this._styleElement.remove())),this._register(jm.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(`
|
|
93
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}},jg=Cp([X(2,Rp),X(3,Xp),X(4,zp),X(5,tm),X(6,Wp),X(7,Qp)],jg),Mg=class extends bm{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(Xd(()=>{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.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),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()}},Mg=Cp([X(1,Rp),X(2,Xp),X(3,qp),X(4,Qp)],Mg),Ng=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)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){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,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}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)}},Pg={full:0,left:0,center:0,right:0},Fg={full:0,left:0,center:0,right:0},Ig={full:0,left:0,center:0,right:0},Lg=class extends bm{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new Ng,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),this._register(Xd(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw Error(`Ctx cannot be null`);this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),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())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange(`overviewRuler`,()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Fg.full=this._canvas.width,Fg.left=e,Fg.center=t,Fg.right=e,this._refreshDrawHeightConstants(),Ig.full=1,Ig.left=1,Ig.center=1+Fg.left,Ig.right=1+Fg.left+Fg.center}_refreshDrawHeightConstants(){Pg.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);Pg.left=t,Pg.center=t,Pg.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Pg.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Pg.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Pg.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Pg.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,this._renderRulerOutline();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}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Ig[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Pg[e.position||`full`]/2),Fg[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Pg[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}))}},Lg=Cp([X(2,Rp),X(3,qp),X(4,Qp),X(5,Wp),X(6,tm),X(7,Xp)],Lg),(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=`
|
|
94
|
+
`,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=``))(Q||={}),(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=``))(Rg||={}),(e=>e.ST=`${Q.ESC}\\`)(zg||={}),Bg=class{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=``}get isComposing(){return this._isComposing}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===20||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){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):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(`${Q.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)}}},Bg=Cp([X(2,Rp),X(3,Wp),X(4,Bp),X(5,Qp)],Bg),Vg=0,Hg=0,Ug=0,Wg=0,Gg={css:`#00000000`,rgba:0},(e=>{function t(e,t,n,r){return r===void 0?`#${kf(e)}${kf(t)}${kf(n)}`:`#${kf(e)}${kf(t)}${kf(n)}${kf(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(Kg||={}),(e=>{function t(e,t){if(Wg=(t.rgba&255)/255,Wg===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return Vg=a+Math.round((n-a)*Wg),Hg=o+Math.round((r-o)*Wg),Ug=s+Math.round((i-s)*Wg),{css:Kg.toCss(Vg,Hg,Ug),rgba:Kg.toRgba(Vg,Hg,Ug)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=Xg.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return Kg.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[Vg,Hg,Ug]=Xg.toChannels(t),{css:Kg.toCss(Vg,Hg,Ug),rgba:t}}e.opaque=i;function a(e,t){return Wg=Math.round(t*255),[Vg,Hg,Ug]=Xg.toChannels(e.rgba),{css:Kg.toCss(Vg,Hg,Ug,Wg),rgba:Kg.toRgba(Vg,Hg,Ug,Wg)}}e.opacity=a;function o(e,t){return Wg=e.rgba&255,a(e,Wg*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(qg||={}),(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return Vg=parseInt(e.slice(1,2).repeat(2),16),Hg=parseInt(e.slice(2,3).repeat(2),16),Ug=parseInt(e.slice(3,4).repeat(2),16),Kg.toColor(Vg,Hg,Ug);case 5:return Vg=parseInt(e.slice(1,2).repeat(2),16),Hg=parseInt(e.slice(2,3).repeat(2),16),Ug=parseInt(e.slice(3,4).repeat(2),16),Wg=parseInt(e.slice(4,5).repeat(2),16),Kg.toColor(Vg,Hg,Ug,Wg);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 r=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(r)return Vg=parseInt(r[1]),Hg=parseInt(r[2]),Ug=parseInt(r[3]),Wg=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),Kg.toColor(Vg,Hg,Ug,Wg);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[Vg,Hg,Ug,Wg]=t.getImageData(0,0,1,1).data,Wg!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:Kg.toRgba(Vg,Hg,Ug,Wg),css:e}}e.toColor=r})(Jg||={}),(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(Yg||={}),(e=>{function t(e,t){if(Wg=(t&255)/255,Wg===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return Vg=a+Math.round((n-a)*Wg),Hg=o+Math.round((r-o)*Wg),Ug=s+Math.round((i-s)*Wg),Kg.toRgba(Vg,Hg,Ug)}e.blend=t;function n(e,t,n){let a=Yg.relativeLuminance(e>>8),o=Yg.relativeLuminance(t>>8);if(Af(a,o)<n){if(o<a){let o=r(e,t,n),s=Af(a,Yg.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>Af(a,Yg.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=Af(a,Yg.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>Af(a,Yg.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(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,l=Af(Yg.relativeLuminance2(o,s,c),Yg.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=Af(Yg.relativeLuminance2(o,s,c),Yg.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(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,l=Af(Yg.relativeLuminance2(o,s,c),Yg.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=Af(Yg.relativeLuminance2(o,s,c),Yg.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(Xg||={}),Zg=class extends Mp{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()]}},Qg=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Pp}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,o=0,s=t.getFg(0),c=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!==s||this._workCell.bg!==c){if(e-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,o=a,s=this._workCell.fg,c=this._workCell.bg}a+=this._workCell.getChars().length||jp.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(e,t,n,r,i){let a=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(a)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let t=this._characterJoiners[e].handler(a);for(let e=0;e<t.length;e++)Qg._mergeRanges(o,t[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,o=e[r];if(o){for(let s=n;s<this._bufferService.cols;s++){let n=t.getWidth(s),c=t.getString(s).length||jp.length;if(n!==0){if(!i&&o[0]<=a&&(o[0]=s,i=!0),o[1]<=a){if(o[1]=s,o=e[++r],!o)break;o[0]<=a?(o[0]=s,i=!0):i=!1}a+=c}}o&&(o[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);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}},Qg=Cp([X(0,Rp)],Qg),$g=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 Pp,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,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,x=0,S=!1,C=0,w=!1,T=0,E=0,D=[],O=l!==-1&&u!==-1;for(let k=0;k<m;k++){e.loadCell(k,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let ee=!1,A=k>=E,j=k,M=this._workCell;if(f.length>0&&k===f[0][0]&&A){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)A&&=i===this._isCellInSelection(v,t);A&&=!n||a<r[0]||a>=r[1],A?(ee=!0,M=new Zg(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),j=r[1]-1,m=M.getWidth()):E=r[1]}let N=this._isCellInSelection(k,t),P=n&&k===a,F=O&&k>=l&&k<=u,I=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{I=!0});let L=M.getChars()||jp;if(L===` `&&(M.isUnderline()||M.isOverline())&&(L=`\xA0`),T=m*s-c.get(L,M.isBold(),M.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(N&&w||!N&&!w&&M.bg===y)&&(N&&w&&p.selectionForeground||M.fg===b)&&M.extended.ext===x&&F===S&&T===C&&!P&&!ee&&!I&&A){M.isInvisible()?_+=jp:_+=L,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=M.bg,b=M.fg,x=M.extended.ext,S=F,C=T,w=N,ee&&a>=k&&a<=j&&(a=k),!this._coreService.isCursorHidden&&P&&this._coreService.isCursorInitialized){if(D.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&D.push(`xterm-cursor-blink`),D.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:D.push(`xterm-cursor-outline`);break;case`block`:D.push(`xterm-cursor-block`);break;case`bar`:D.push(`xterm-cursor-bar`);break;case`underline`:D.push(`xterm-cursor-underline`)}}if(M.isBold()&&D.push(`xterm-bold`),M.isItalic()&&D.push(`xterm-italic`),M.isDim()&&D.push(`xterm-dim`),_=M.isInvisible()?jp:M.getChars()||jp,M.isUnderline()&&(D.push(`xterm-underline-${M.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!M.isUnderlineColorDefault())){if(M.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${Mp.toColorRGB(M.getUnderlineColor()).join(`,`)})`;else{let e=M.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&M.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}}M.isOverline()&&(D.push(`xterm-overline`),_===` `&&(_=`\xA0`)),M.isStrikethrough()&&D.push(`xterm-strikethrough`),F&&(h.style.textDecoration=`underline`);let R=M.getFgColor(),te=M.getFgColorMode(),ne=M.getBgColor(),re=M.getBgColorMode(),ie=!!M.isInverse();if(ie){let e=R;R=ne,ne=e;let t=te;te=re,re=t}let ae,z,oe=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{e.options.layer!==`top`&&oe||(e.backgroundColorRGB&&(re=50331648,ne=e.backgroundColorRGB.rgba>>8&16777215,ae=e.backgroundColorRGB),e.foregroundColorRGB&&(te=50331648,R=e.foregroundColorRGB.rgba>>8&16777215,z=e.foregroundColorRGB),oe=e.options.layer===`top`)}),!oe&&N&&(ae=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,ne=ae.rgba>>8&16777215,re=50331648,oe=!0,p.selectionForeground&&(te=50331648,R=p.selectionForeground.rgba>>8&16777215,z=p.selectionForeground)),oe&&D.push(`xterm-decoration-top`);let se;switch(re){case 16777216:case 33554432:se=p.ansi[ne],D.push(`xterm-bg-${ne}`);break;case 50331648:se=Kg.toColor(ne>>16,ne>>8&255,ne&255),this._addStyle(h,`background-color:#${If((ne>>>0).toString(16),`0`,6)}`);break;default:ie?(se=p.foreground,D.push(`xterm-bg-257`)):se=p.background}switch(ae||M.isDim()&&(ae=qg.multiplyOpacity(se,.5)),te){case 16777216:case 33554432:M.isBold()&&R<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(R+=8),this._applyMinimumContrast(h,se,p.ansi[R],M,ae,void 0)||D.push(`xterm-fg-${R}`);break;case 50331648:let e=Kg.toColor(R>>16&255,R>>8&255,R&255);this._applyMinimumContrast(h,se,e,M,ae,z)||this._addStyle(h,`color:#${If(R.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,se,p.foreground,M,ae,z)||ie&&D.push(`xterm-fg-257`)}D.length&&=(h.className=D.join(` `),0),!P&&!ee&&!I&&A?g++:h.textContent=_,T!==this.defaultSpacing&&(h.style.letterSpacing=`${T}px`),d.push(h),k=j}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||Nf(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=qg.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):!1}_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?!1: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]}},$g=Cp([X(1,em),X(2,Wp),X(3,Xp),X(4,Bp),X(5,qp),X(6,tm)],$g),e_=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}},t_=class{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]){this.clear();return}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);if(s>=e.rows||c<0){this.clear();return}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):!1}},n_=`xterm-dom-renderer-owner-`,r_=`xterm-rows`,i_=`xterm-fg-`,a_=`xterm-bg-`,o_=`xterm-focus`,s_=`xterm-selection`,c_=1,l_=class extends bm{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=c_++,this._rowElements=[],this._selectionRenderModel=Lf(),this.onRequestRedraw=this._register(new Z).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(r_),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(s_),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=Pf(),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=s.createInstance($g,document),this._element.classList.add(n_+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(Xd(()=>{this._element.classList.remove(n_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new e_(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} .${r_} 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} .${r_} { pointer-events: none; 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} .${r_} .xterm-dim { color: ${qg.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} .${r_}.${o_} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${r_}.${o_} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${r_}.${o_} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${r_} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${r_} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${r_} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${r_} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${r_} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${s_} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${s_} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${s_} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${i_}${n} { color: ${r.css}; }${this._terminalSelector} .${i_}${n}.xterm-dim { color: ${qg.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${a_}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${i_}257 { color: ${qg.opaque(e.background).css}; }${this._terminalSelector} .${i_}257.xterm-dim { color: ${qg.multiplyOpacity(qg.opaque(e.background),.5).css}; }${this._terminalSelector} .${a_}257 { 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(o_),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(o_),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||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,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._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??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`.${n_}${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))}}},l_=Cp([X(7,Hp),X(8,Yp),X(9,Wp),X(10,Rp),X(11,Bp),X(12,Xp),X(13,tm)],l_),u_=class extends bm{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Z),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new p_(this._optionsService))}catch{this._measureStrategy=this._register(new f_(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}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())}},u_=Cp([X(2,Wp)],u_),d_=class extends bm{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)}},f_=class extends d_{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}},p_=class extends d_{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}},m_=class extends bm{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new h_(this._window)),this._onDprChange=this._register(new Z),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Z),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(jm.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(_f(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(_f(this._textarea,`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}},h_=class extends bm{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new xm),this._onDprChange=this._register(new Z),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Xd(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=_f(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)}},g_=class extends bm{constructor(){super(),this.linkProviders=[],this._register(Xd(()=>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)}}}},__=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return zf(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=Rf(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])}}},__=Cp([X(0,Qp),X(1,Yp)],__),v_=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._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){this._runRefreshCallbacks();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),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},y_={},Sp(y_,{getSafariVersion:()=>Bf,isChromeOS:()=>j_,isFirefox:()=>C_,isIpad:()=>D_,isIphone:()=>O_,isLegacyEdge:()=>w_,isLinux:()=>A_,isMac:()=>E_,isNode:()=>b_,isSafari:()=>T_,isWindows:()=>k_}),b_=typeof process<`u`&&`title`in process,x_=b_?`node`:navigator.userAgent,S_=b_?`node`:navigator.platform,C_=x_.includes(`Firefox`),w_=x_.includes(`Edge`),T_=/^((?!chrome|android).)*safari/i.test(x_),E_=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(S_),D_=S_===`iPad`,O_=S_===`iPhone`,k_=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(S_),A_=S_.indexOf(`Linux`)>=0,j_=/\bCrOS\b/.test(x_),M_=class{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=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},N_=class extends M_{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},P_=class extends M_{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},F_=!b_&&`requestIdleCallback`in window?P_:N_,I_=class{constructor(){this._queue=new F_}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},L_=class extends bm{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new xm),this._pausedResizeTask=new I_,this._observerDisposable=this._register(new xm),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 Z),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Z),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Z),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Z),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new v_((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new R_(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Xd(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_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=Xd(()=>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){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}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()}},L_=Cp([X(2,Wp),X(3,Yp),X(4,Bp),X(5,qp),X(6,Rp),X(7,Xp),X(8,tm)],L_),R_=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}},z_=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.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?!1: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)}},B_=50,V_=15,H_=50,U_=500,W_=RegExp(`\xA0`,`g`),G_=class extends bm{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Pp,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Z),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Z),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Z),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Z),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 z_(this._bufferService),this._activeSelectionMode=0,this._register(Xd(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}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?!1: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(W_,` `)).join(k_?`\r
|
|
95
|
+
`:`
|
|
96
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),A_&&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?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1: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=ep(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):!1}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=Rf(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,-B_),B_),t/=B_,t/Math.abs(t)+Math.round(t*(V_-1)))}shouldForceSelection(e){return E_?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(),H_)}_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&&!(E_&&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){this.refresh(!0);return}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<U_&&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=Vf(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]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!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)}_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=ep(n,this._bufferService.cols)}},G_=Cp([X(3,Rp),X(4,Bp),X(5,Zp),X(6,Wp),X(7,Qp),X(8,Xp)],G_),K_=class{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={}}},q_=class{constructor(){this._color=new K_,this._css=new K_}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()}},J_=Object.freeze((()=>{let e=[Jg.toColor(`#2e3436`),Jg.toColor(`#cc0000`),Jg.toColor(`#4e9a06`),Jg.toColor(`#c4a000`),Jg.toColor(`#3465a4`),Jg.toColor(`#75507b`),Jg.toColor(`#06989a`),Jg.toColor(`#d3d7cf`),Jg.toColor(`#555753`),Jg.toColor(`#ef2929`),Jg.toColor(`#8ae234`),Jg.toColor(`#fce94f`),Jg.toColor(`#729fcf`),Jg.toColor(`#ad7fa8`),Jg.toColor(`#34e2e2`),Jg.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:Kg.toCss(r,i,a),rgba:Kg.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:Kg.toCss(n,n,n),rgba:Kg.toRgba(n,n,n)})}return e})()),Y_=Jg.toColor(`#ffffff`),X_=Jg.toColor(`#000000`),Z_=Jg.toColor(`#ffffff`),Q_=X_,$_={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},ev=Y_,tv=class extends bm{constructor(e){super(),this._optionsService=e,this._contrastCache=new q_,this._halfContrastCache=new q_,this._onChangeColors=this._register(new Z),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Y_,background:X_,cursor:Z_,cursorAccent:Q_,selectionForeground:void 0,selectionBackgroundTransparent:$_,selectionBackgroundOpaque:qg.blend(X_,$_),selectionInactiveBackgroundTransparent:$_,selectionInactiveBackgroundOpaque:qg.blend(X_,$_),scrollbarSliderBackground:qg.opacity(Y_,.2),scrollbarSliderHoverBackground:qg.opacity(Y_,.4),scrollbarSliderActiveBackground:qg.opacity(Y_,.5),overviewRulerBorder:Y_,ansi:J_.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)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=tp(e.foreground,Y_),t.background=tp(e.background,X_),t.cursor=qg.blend(t.background,tp(e.cursor,Z_)),t.cursorAccent=qg.blend(t.background,tp(e.cursorAccent,Q_)),t.selectionBackgroundTransparent=tp(e.selectionBackground,$_),t.selectionBackgroundOpaque=qg.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=tp(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=qg.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?tp(e.selectionForeground,Gg):void 0,t.selectionForeground===Gg&&(t.selectionForeground=void 0),qg.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=qg.opacity(t.selectionBackgroundTransparent,.3)),qg.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=qg.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=tp(e.scrollbarSliderBackground,qg.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=tp(e.scrollbarSliderHoverBackground,qg.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=tp(e.scrollbarSliderActiveBackground,qg.opacity(t.foreground,.5)),t.overviewRulerBorder=tp(e.overviewRulerBorder,ev),t.ansi=J_.slice(),t.ansi[0]=tp(e.black,J_[0]),t.ansi[1]=tp(e.red,J_[1]),t.ansi[2]=tp(e.green,J_[2]),t.ansi[3]=tp(e.yellow,J_[3]),t.ansi[4]=tp(e.blue,J_[4]),t.ansi[5]=tp(e.magenta,J_[5]),t.ansi[6]=tp(e.cyan,J_[6]),t.ansi[7]=tp(e.white,J_[7]),t.ansi[8]=tp(e.brightBlack,J_[8]),t.ansi[9]=tp(e.brightRed,J_[9]),t.ansi[10]=tp(e.brightGreen,J_[10]),t.ansi[11]=tp(e.brightYellow,J_[11]),t.ansi[12]=tp(e.brightBlue,J_[12]),t.ansi[13]=tp(e.brightMagenta,J_[13]),t.ansi[14]=tp(e.brightCyan,J_[14]),t.ansi[15]=tp(e.brightWhite,J_[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=tp(e.extendedAnsi[r],J_[r+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){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}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]}}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()}}},tv=Cp([X(0,Wp)],tv),nv=class{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)}},rv=class{constructor(){this._services=new nv,this._services.set(Hp,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=Ad(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._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},iv={trace:0,debug:1,info:2,warn:3,error:4,off:5},av=`xterm.js: `,ov=class extends bm{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=iv[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?``:av)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}},ov=Cp([X(0,Wp)],ov),sv=class extends bm{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Z),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Z),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Z),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}},cv=3,lv=Object.freeze(new Mp),uv=0,dv=2,fv=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*cv);let r=t||Pp.fromCharData([0,Ap,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*cv+0],n=t&2097151;return[this._data[e*cv+1],t&2097152?this._combined[e]:n?Od(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*cv+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*cv+0]=e|2097152|t[2]<<22):this._data[e*cv+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*cv+0]>>22}hasWidth(e){return this._data[e*cv+0]&12582912}getFg(e){return this._data[e*cv+1]}getBg(e){return this._data[e*cv+2]}hasContent(e){return this._data[e*cv+0]&4194303}getCodePoint(e){let t=this._data[e*cv+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*cv+0]&2097152}getString(e){let t=this._data[e*cv+0];return t&2097152?this._combined[e]:t&2097151?Od(t&2097151):``}isProtected(e){return this._data[e*cv+2]&536870912}loadCell(e,t){return uv=e*cv,t.content=this._data[uv+0],t.fg=this._data[uv+1],t.bg=this._data[uv+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*cv+0]=t.content,this._data[e*cv+1]=t.fg,this._data[e*cv+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*cv+0]=t|n<<22,this._data[e*cv+1]=r.fg,this._data[e*cv+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*cv+0];r&2097152?this._combined[e]+=Od(t):r&2097151?(this._combined[e]=Od(r&2097151)+Od(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*cv+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new Pp;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 Pp;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++;return}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 this._data.length*4*dv<this._data.buffer.byteLength;let n=e*cv;if(e>this.length){if(this._data.buffer.byteLength>=n*4)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,n*4*dv<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*dv<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);return}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 t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*cv+0]&4194303)return e+(this._data[e*cv+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*cv+0]&4194303||this._data[e*cv+2]&50331648)return e+(this._data[e*cv+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<cv;e++)this._data[(n+i)*cv+e]=a[(t+i)*cv+e];a[(t+i)*cv+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<cv;e++)this._data[(n+i)*cv+e]=a[(t+i)*cv+e];a[(t+i)*cv+2]&268435456&&(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[t*cv+0],n=e&2097151,a=e&2097152?this._combined[t]:n?Od(n):jp;if(i+=a,r)for(let e=0;e<a.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}},pv=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new Z),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Jd(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}},pv._nextId=1,mv=pv,hv={},gv=hv.B,hv[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:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},hv.A={"#":`£`},hv.B=void 0,hv[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},hv.C=hv[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},hv.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},hv.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},hv.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},hv.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},hv.E=hv[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},hv.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},hv.H=hv[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},hv[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`},_v=4294967295,vv=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=lv.clone(),this.savedCharset=gv,this.markers=[],this._nullCell=Pp.fromCharData([0,Ap,1,0]),this._whitespaceCell=Pp.fromCharData([0,jp,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new F_,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new sv(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 Np),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 Np),this._whitespaceCell}getBlankLine(e,t){return new fv(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 t=e+this._optionsService.rawOptions.scrollback;return t>_v?_v:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=lv);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 sv(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(lv),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 fv(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 fv(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=this._optionsService.rawOptions.reflowCursorLine,r=np(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(lv),n);if(r.length>0){let n=rp(this.lines,r);ip(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(lv),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new fv(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(lv),i=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e<o+c.length)continue}let l=c[c.length-1].getTrimmedLength(),u=ap(c,this._cols,e),d=u.length-c.length,f;f=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(lv,!0);p.push(e)}p.length>0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=op(c,Math.max(g,0),this._cols))}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],r);let v=d-f;for(;v-->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+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.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,r=n-1,o=0,s=i[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+a-1);l>=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);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+a-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.length=0,this._isClearing=!1}addMarker(e){let t=new mv(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)}},yv=class extends bm{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Z),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 vv(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new vv(!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)}},bv=2,xv=1,Sv=class extends bm{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Z),this.onResize=this._onResize.event,this._onScroll=this._register(new Z),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,bv),this.rows=Math.max(e.rawOptions.rows||0,xv),this.buffers=this._register(new yv(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}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){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}},Sv=Cp([X(0,Wp)],Sv),Cv={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:E_,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},wv=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],Tv=class extends bm{constructor(e){super(),this._onOptionChange=this._register(new Z),this.onOptionChange=this._onOptionChange.event;let t={...Cv};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Xd(()=>{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 Cv))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in Cv))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=Cv[e],!sp(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=Cv[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=wv.includes(t)?t:Cv[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={}}return t}},Ev=Object.freeze({insertMode:!1}),Dv=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Ov=class extends bm{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 Z),this.onData=this._onData.event,this._onUserInput=this._register(new Z),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Z),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Z),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=cp(Ev),this.decPrivateModes=cp(Dv)}reset(){this.modes=cp(Ev),this.decPrivateModes=cp(Dv)}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}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace(`sending binary (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}},Ov=Cp([X(0,Rp),X(1,Up),X(2,Wp)],Ov),kv={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!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}},Av=String.fromCharCode,jv={DEFAULT:e=>{let t=[lp(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${Av(t[0])}${Av(t[1])}${Av(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${lp(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${lp(e,!0)};${e.x};${e.y}${t}`}},Mv=class extends bm{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Z),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(kv))this.addProtocol(e,kv[e]);for(let e of Object.keys(jv))this.addEncoding(e,jv[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,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}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:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_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}},Mv=Cp([X(0,Rp),X(1,Bp),X(2,Wp)],Mv),Nv=[[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]],Pv=[[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]],Iv=class{constructor(){if(this.version=`6`,!Fv){Fv=new Uint8Array(65536),Fv.fill(1),Fv[0]=0,Fv.fill(0,1,32),Fv.fill(0,127,160),Fv.fill(2,4352,4448),Fv[9001]=2,Fv[9002]=2,Fv.fill(2,11904,42192),Fv[12351]=1,Fv.fill(2,44032,55204),Fv.fill(2,63744,64256),Fv.fill(2,65040,65050),Fv.fill(2,65072,65136),Fv.fill(2,65280,65377),Fv.fill(2,65504,65511);for(let e=0;e<Nv.length;++e)Fv.fill(0,Nv[e][0],Nv[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Fv[e]:up(e,Pv)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=Lv.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return Lv.createPropertyValue(0,n,r)}},Lv=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new Z,this.onChange=this._onChange.event;let e=new Iv;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return!!(e&1)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}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(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},Rv=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)}},zv=2147483647,Bv=256,Vv=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>Bv)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}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=+!!Array.isArray(t[0]);e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)n.addSubParam(r[e]);else n.addParam(r)}return n}clone(){let t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;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;return}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>zv?zv:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>zv?zv:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;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=this._subParamsIdx[t]&255;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 n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,zv):e}},Hv=[],Uv=class{constructor(){this._state=0,this._active=Hv,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=Hv}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=Hv,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Hv,!this._active.length)this._handlerFb(this._id,`START`);else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,kd(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(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){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+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)this._handlerFb(this._id,`END`,e);else{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&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);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}}this._active=Hv,this._id=-1,this._state=0}}},Wv=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+=kd(e,t,n),this._data.length>1e7&&(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}},Gv=[],Kv=class{constructor(){this._handlers=Object.create(null),this._active=Gv,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Gv}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=Gv,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Gv,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,kd(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{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&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);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}this._active=Gv,this._ident=0}},qv=new Vv,qv.addParam(0),Jv=class{constructor(e){this._handler=e,this._data=``,this._params=qv,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():qv,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=kd(e,t,n),this._data.length>1e7&&(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=qv,this._data=``,this._hitLimit=!1,e));return this._params=qv,this._data=``,this._hitLimit=!1,t}},Yv=class{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}},Xv=160,Zv=function(){let e=new Yv(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(Xv,0,2,0),e.add(Xv,8,5,8),e.add(Xv,6,0,6),e.add(Xv,11,0,11),e.add(Xv,13,13,13),e}(),Qv=class extends bm{constructor(e=Zv){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 Vv,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(Xd(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Uv),this._dcsParser=this._register(new Kv),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(e&255)),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=0,i=0,a=0,o;if(this._parseStack.state){if(this._parseStack.state===2)this._parseStack.state=0,a=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,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}}for(let n=a;n<t;++n){switch(r=e[n],i=this._transitions.table[this.currentState<<8|(r<160?r:Xv)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<Xv){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<Xv){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<Xv){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<Xv){this._printHandler(e,n,i),n=i-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],s=a?a.length-1:-1;for(;s>=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++n<t&&(r=e[n])>47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<0&&this._escHandlerFb(this._collect<<8|r),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|r,this._params);break;case 13:for(let i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r<Xv){this._dcsParser.put(e,n,i),n=i-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,n),o;r===27&&(i|=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 i=n+1;;i++)if(i>=t||(r=e[i])<32||r>127&&r<Xv){this._oscParser.put(e,n,i),n=i-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=i&15}}},$v=/^([\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})$/,ey=/^[\da-f]+$/,ty={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ny=131072,ry=10,iy=5e3,ay=0,oy=class extends bm{constructor(e,t,n,r,i,a,o,s,c=new Qv){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Op,this._utf8Decoder=new kp,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=lv.clone(),this._eraseAttrDataInternal=lv.clone(),this._onRequestBell=this._register(new Z),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Z),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Z),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Z),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Z),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Z),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Z),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Z),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Z),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Z),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Z),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Z),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Z),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 sy(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(Q.BEL,()=>this.bell()),this._parser.setExecuteHandler(Q.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Q.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Q.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Q.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Q.BS,()=>this.backspace()),this._parser.setExecuteHandler(Q.HT,()=>this.tab()),this._parser.setExecuteHandler(Q.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Q.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Rg.IND,()=>this.index()),this._parser.setExecuteHandler(Rg.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Rg.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Wv(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new Wv(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new Wv(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new Wv(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new Wv(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new Wv(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new Wv(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new Wv(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new Wv(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new Wv(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new Wv(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new Wv(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 hv)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 Jv((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_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<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),iy))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${iy} 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>ny&&(a=this._parseStack.position+ny)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<ny&&(this._parseBuffer=new Uint32Array(Math.min(e.length,ny))),o||this._dirtyRowTracker.clearRange(),e.length>ny)for(let t=a;t<e.length;t+=ny){let a=t+ny<e.length?t+ny: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({start:Math.min(c,this._bufferService.rows-1),end: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,l=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=Lv.extractWidth(t);let n=Lv.extractShouldJoin(t),m=n?Lv.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(Od(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,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),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof fv&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>!hp(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Jv(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Wv(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){this._restrictCursor(this._bufferService.cols);let n;switch(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:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{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(lv));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=Lv.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(Q.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(Q.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(Q.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(Q.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(Q.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,gv),this._charsetService.setgCharset(1,gv),this._charsetService.setgCharset(2,gv),this._charsetService.setgCharset(3,gv);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(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!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:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;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(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0)}return!0}requestMode(e,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${Q.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=Mp.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),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=lv.fg,e.bg=lv.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|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):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|=lv.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=lv.bg&16777215):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|=lv.fg&16777215,r.bg&=-67108864,r.bg|=lv.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Q.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Q.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(`${Q.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=lv.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.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!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(!hp(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(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${Q.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>ry&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>ry&&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(gp(n)){if(r===`?`)t.push({type:0,index:n});else{let e=fp(r);e&&t.push({type:1,index:n,color:e})}}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):!n.trim()&&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=fp(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]);gp(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,gv),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(ty[e[0]],hv[e[1]]||gv),!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=lv.clone(),this._eraseAttrDataInternal=lv.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Pp;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=e=>(this._coreService.triggerDataEvent(`${Q.ESC}${e}${Q.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},sy=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&&(ay=e,e=t,t=ay),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}},sy=Cp([X(0,Rp)],sy),cy=5e7,ly=12,uy=50,dy=class extends bm{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 Z),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;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>cy)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.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=>performance.now()-n>=ly?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,performance.now()-n>=ly)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>uy&&(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()}},fy=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)))}},fy=Cp([X(0,Rp)],fy),py=!1,my=class extends bm{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new xm),this._onBinary=this._register(new Z),this.onBinary=this._onBinary.event,this._onData=this._register(new Z),this.onData=this._onData.event,this._onLineFeed=this._register(new Z),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Z),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Z),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Z),this._instantiationService=new rv,this.optionsService=this._register(new Tv(e)),this._instantiationService.setService(Wp,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Sv)),this._instantiationService.setService(Rp,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(ov)),this._instantiationService.setService(Up,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Ov)),this._instantiationService.setService(Bp,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Mv)),this._instantiationService.setService(zp,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Lv)),this._instantiationService.setService(Kp,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Rv),this._instantiationService.setService(Vp,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(fy),this._instantiationService.setService(Gp,this._oscLinkService),this._inputHandler=this._register(new oy(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(jm.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(jm.forward(this._bufferService.onResize,this._onResize)),this._register(jm.forward(this.coreService.onData,this._onData)),this._register(jm.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new dy((e,t)=>this._inputHandler.parse(e,t))),this._register(jm.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Z),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]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!py&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),py=!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,bv),t=Math.max(t,xv),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){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(dp.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(dp(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Xd(()=>{for(let t of e)t.dispose()})}}},hy={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:[`'`,`"`]},gy=0,_y=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new F_,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new F_,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(gy=this._search(t),gy===-1)||this._getKey(this._array[gy])!==t)return!1;do if(this._array[gy]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(gy),!0;while(++gy<this._array.length&&this._getKey(this._array[gy])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(gy=this._search(e),!(gy<0||gy>=this._array.length)&&this._getKey(this._array[gy])===e))do yield this._array[gy];while(++gy<this._array.length&&this._getKey(this._array[gy])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(gy=this._search(e),!(gy<0||gy>=this._array.length)&&this._getKey(this._array[gy])===e))do t(this._array[gy]);while(++gy<this._array.length&&this._getKey(this._array[gy])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...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)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},vy=0,yy=0,by=class extends bm{constructor(){super(),this._decorations=new _y(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Z),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Z),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Xd(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new xy(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),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=>{vy=t.options.x??0,yy=vy+(t.options.width??1),e>=vy&&e<yy&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},xy=class extends ym{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Z),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Z),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`)}get backgroundColorRGB(){return this._cachedBg===null&&(this._cachedBg=this.options.backgroundColor?Jg.toColor(this.options.backgroundColor):void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this._cachedFg=this.options.foregroundColor?Jg.toColor(this.options.foregroundColor):void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Sy=1e3,Cy=class{constructor(e,t=Sy){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=performance.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=performance.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)}},wy=20,Ty=!1,Ey=class extends bm{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=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.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._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Cy(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);Ty?(this._accessibilityContainer.classList.add(`debug`),this._rowContainer.classList.add(`debug`),this._debugRootContainer=i.createElement(`div`),this._debugRootContainer.classList.add(`xterm`),this._debugRootContainer.appendChild(i.createTextNode(`------start a11y------`)),this._debugRootContainer.appendChild(this._accessibilityContainer),this._debugRootContainer.appendChild(i.createTextNode(`------end a11y------`)),this._terminal.element.insertAdjacentElement(`afterend`,this._debugRootContainer)):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(`
|
|
97
|
+
`))),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(_f(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Xd(()=>{Ty?this._debugRootContainer.remove():this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<wy+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
98
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===wy+1&&(this._liveRegion.textContent+=Dp.get())))}_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.textContent=`\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._alignRowWidth(s))}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=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}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){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}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]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}},Ey=Cp([X(1,Hp),X(2,Xp),X(3,Qp)],Ey),Dy=class extends bm{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 Z),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Z),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Xd(()=>{Jd(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(_f(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(_f(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(_f(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(_f(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_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){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}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&&vp(this._mouseDownLink.link,this._currentLink.link)&&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,Jd(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_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}}},Dy=Cp([X(1,Zp),X(2,Qp),X(3,Rp),X(4,nm)],Dy),Oy=class extends my{constructor(e={}){super(e),this._linkifier=this._register(new xm),this.browser=y_,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new xm),this._onCursorMove=this._register(new Z),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Z),this.onKey=this._onKey.event,this._onRender=this._register(new Z),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Z),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Z),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Z),this.onBell=this._onBell.event,this._onFocus=this._register(new Z),this._onBlur=this._register(new Z),this._onA11yCharEmitter=this._register(new Z),this._onA11yTabEmitter=this._register(new Z),this._onWillOpen=this._register(new Z),this._setup(),this._decorationService=this._instantiationService.createInstance(by),this._instantiationService.setService(qp,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(g_),this._instantiationService.setService(nm,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Jp)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),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(jm.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(jm.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(jm.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(jm.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(Xd(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}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}_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=qg.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${Q.ESC}]${n};${mp(r)}${zg.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=Kg.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=Kg.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(Ey,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.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(Q.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(_f(this.element,`copy`,e=>{this.hasSelection()&&Cd(e,this._selectionService)}));let e=e=>wd(e,this.textarea,this.coreService,this.optionsService);this._register(_f(this.textarea,`paste`,e)),this._register(_f(this.element,`paste`,e)),C_?this._register(_f(this.element,`mousedown`,e=>{e.button===2&&Dd(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(_f(this.element,`contextmenu`,e=>{Dd(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),A_&&this._register(_f(this.element,`auxclick`,e=>{e.button===1&&Ed(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(_f(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(_f(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(_f(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(_f(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(_f(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(_f(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(_f(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){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}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.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(_f(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);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,Tp.get()),j_||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._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(m_,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(Xp,this._coreBrowserService),this._register(_f(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(_f(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(u_,this._document,this._helperContainer),this._instantiationService.setService(Yp,this._charSizeService),this._themeService=this._instantiationService.createInstance(tv),this._instantiationService.setService(tm,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Qg),this._instantiationService.setService(em,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(L_,this.rows,this.screenElement)),this._instantiationService.setService(Qp,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(Bg,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(__),this._instantiationService.setService(Zp,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Dy,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),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._viewport=this._register(this._instantiationService.createInstance(jg,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(G_,this.element,this.screenElement,r)),this._instantiationService.setService($p,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(jm.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Mg,this.screenElement)),this._register(_f(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(Ey,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Lg,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Lg,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(l_,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=t.buttons&1?0:t.buttons&4?1:t.buttons&2?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&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1: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},i={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()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(_f(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(_f(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=Q.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{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){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){Td(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:!1}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&&this._customKeyEventHandler(e)===!1)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(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=_p(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)}if(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)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===Q.ETX||n.key===Q.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)return this.cancel(e,!0);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&&this._customKeyEventHandler(e)===!1)&&(yp(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)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)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(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){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}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(lv));this._onScroll.fire({position:this.buffer.ydisp}),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._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(Q.ESC+`[I`):this.coreService.triggerDataEvent(Q.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Q.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Q.ESC}[6;${r};${n}t`)}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}},ky=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)}},Ay=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 Pp)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},jy=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 Ay(t)}getNullCell(){return new Pp}},My=class extends bm{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Z),this.onBufferChange=this._onBufferChange.event,this._normal=new jy(this._core.buffers.normal,`normal`),this._alternate=new jy(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)}},Ny=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)}},Py=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}},Fy=[`cols`,`rows`],Iy=0,Ly=class extends bm{constructor(e){super(),this._core=this._register(new Oy(e)),this._addonManager=this._register(new ky),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(Fy.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 Ny(this._core),this._parser}get unicode(){return this._checkProposedApi(),new Py(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 My(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,synchronizedOutputMode:e.synchronizedOutput,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
|
|
99
|
+
`,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{get promptLabel(){return Tp.get()},set promptLabel(e){Tp.set(e)},get tooMuchOutput(){return Dp.get()},set tooMuchOutput(e){Dp.set(e)}}}_verifyIntegers(...e){for(Iy of e)if(Iy===1/0||isNaN(Iy)||Iy%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(Iy of e)if(Iy&&(Iy===1/0||isNaN(Iy)||Iy%1!=0||Iy<0))throw Error(`This API only accepts positive integers`)}}})),zy=o((()=>{}));function By(e,t){return e===`auto`?t?`dark`:`light`:e}function Vy(e,t,n){let r=e.find(e=>e.name===t)??e.find(e=>e.name===`claude`);return r?r[n]:null}function Hy(e,t){return(e.find(e=>e.name===t)??e.find(e=>e.name===`claude`))?.fontFamily??null}function Uy(e){return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function Wy(e){return`${Uy(e)}, "Rove Nerd Symbols", "JetBrains Mono", "IBM Plex Mono", "SF Mono", Menlo, Consolas, ui-monospace, monospace`}function Gy(e){return`${Uy(e)}, "Rove Nerd Symbols", "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace`}function Ky(e){let[t=0,n=0,r=0]=$y(e).map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r}function qy(e,t){let[n=0,r=0]=[Ky(e),Ky(t)].sort((e,t)=>t-e);return(n+.05)/(r+.05)}function Jy(e,t,n){let r=e=>t.every(t=>qy(e,t)>=n(t));if(r(e))return e;let i=$y(e),a=Ky(t[0])<.18?255:0;for(let e=.02;e<1;e+=.02){let t=i.map(t=>Math.round(t+(a-t)*e).toString(16).padStart(2,`0`)).join(``);if(r(`#${t}`))return`#${t}`}return a?`#ffffff`:`#000000`}function Yy(e){let t=[e.background,e.backgroundPanel,e.backgroundElement,e.backgroundMenu],n=Jy(e.diffLineNumber,t,()=>eb);return{muted:Jy(e.textMuted,t,e=>Math.max(eb,qy(n,e)*tb)),subtle:n}}function Xy(e,t){let[n=0,r=0,i=0]=$y(e).map(nb),a=Math.cbrt(.4122214708*n+.5363325363*r+.0514459929*i),o=Math.cbrt(.2119034982*n+.6806995451*r+.1073969566*i),s=Math.cbrt(.0883024619*n+.2817188376*r+.6299787005*i),c=.2104542553*a+.793617785*o-.0040720468*s+t,l=1.9779984951*a-2.428592205*o+.4505937099*s,u=.0259040371*a+.7827717662*o-.808675766*s,d=(c+.3963377774*l+.2158037573*u)**3,f=(c-.1055613458*l-.0638541728*u)**3,p=(c-.0894841775*l-1.291485548*u)**3;return`#${[4.0767416621*d-3.3077115913*f+.2309699292*p,-1.2684380046*d+2.6097574011*f-.3413193965*p,-.0041960863*d-.7034186147*f+1.707614701*p].map(e=>rb(e).toString(16).padStart(2,`0`)).join(``)}`}function Zy(e,t){let n=t.colorblind===`on`,r=Yy(e);return{"--paper":e.background,"--sidebar":ib(e.background),"--surface":e.backgroundPanel,"--inset":e.backgroundElement,"--menu":e.backgroundMenu,"--line":e.border,"--line-active":e.borderActive,"--line-subtle":e.borderSubtle,"--ink":e.text,"--muted":r.muted,"--subtle":r.subtle,"--accent":e.primary,"--error":e.error,"--success":e.success,"--warning":e.warning,"--info":e.info,"--merged":e.syntaxType,"--focus":e[t.focusAccent]??e.primary,"--diff-added":(n?e.diffAddedColorblind:e.diffAdded)??e.diffAdded,"--diff-removed":e.diffRemoved,"--diff-added-bg":(n?e.diffAddedBgColorblind:e.diffAddedBg)??e.diffAddedBg,"--diff-removed-bg":e.diffRemovedBg}}function Qy(e){return{background:e.background,foreground:e.text,cursor:e.cursor??e.primary,cursorAccent:e.background,selectionBackground:e.backgroundMenu,black:e.terminalBlack??e.background,red:e.terminalRed??e.error,green:e.terminalGreen??e.success,yellow:e.terminalYellow??e.warning,blue:e.terminalBlue??e.info,magenta:e.terminalMagenta??e.syntaxType,cyan:e.terminalCyan??e.secondary,white:e.terminalWhite??e.textMuted,brightBlack:e.terminalBrightBlack??e.diffLineNumber,brightRed:e.terminalBrightRed??e.error,brightGreen:e.terminalBrightGreen??e.success,brightYellow:e.terminalBrightYellow??e.warning,brightBlue:e.terminalBrightBlue??e.info,brightMagenta:e.terminalBrightMagenta??e.syntaxType,brightCyan:e.terminalBrightCyan??e.secondary,brightWhite:e.terminalBrightWhite??e.text}}var $y,eb,tb,nb,rb,ib,ab,ob,sb,cb=o((()=>{A(),$y=e=>[1,3,5].map(t=>Number.parseInt(e.slice(t,t+2),16)),eb=4.5,tb=1.1,nb=e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4},rb=e=>{let t=e<=.0031308?e*12.92:1.055*Math.max(e,0)**(1/2.4)-.055;return Math.round(Math.min(1,Math.max(0,t))*255)},ib=e=>Xy(e,Ky(e)<.18?-.01:-.008),ab=O(null),ob=O(null),sb=O(null)}));function lb(){try{let e=JSON.parse(localStorage.getItem(_b)??`null`);if(e&&typeof e==`object`&&`prefs`in e&&`themes`in e){let t=e;return{...t,prefs:{...vb,...t.prefs},loaded:!0}}}catch{}return{loaded:!1,prefs:vb,options:{},info:{editorCustomSet:!1,worktreeCustomPath:``},themes:[],glyphSets:{}}}function ub(e){(e.locale===`en`||e.locale===`zh`)&&Cn.set(e.locale)}function db(e){let t={loaded:!0,prefs:e.prefs,options:e.options,info:e.info,themes:e.themes,glyphSets:e.glyphSets};yb.set(t),ub(t.prefs),localStorage.setItem(_b,JSON.stringify(t))}async function fb(e){bb=e,db(await e.request(`prefs.get`))}async function pb(e,t,n){let r=yb.get();yb.set({...r,prefs:{...r.prefs,[t]:n}}),ub(yb.get().prefs);try{let r=await e.request(`prefs.set`,{key:t,value:n});db({...yb.get(),prefs:r.prefs})}catch(e){yb.set(r),ub(r.prefs),z(e instanceof Error?e.message:String(e),`error`)}}function mb(e,t){if(bb)return void pb(bb,e,t);let n=yb.get();yb.set({...n,prefs:{...n.prefs,[e]:t}})}function hb(){return k(yb)}function gb(e,t){let n=e.options[t];return Array.isArray(n)?n:[]}var _b,vb,yb,bb,xb=o((()=>{G(),A(),H(),_b=`rove.prefs`,vb={locale:`en`,theme:`claude`,themeMode:`dark`,transparent:!0,focusAccent:`primary`,splitStyle:`line`,railFold:`glyphs`,workingBorder:`flow`,taskColors:`on`,glyphSet:`braille`,colorblind:`off`,runningTitle:`shimmer`,statusMark:`both`,statusMarkNoticeSeen:!0,railSort:`recent`,railGroup:`project`,toast:!0,sound:!0,soundVolume:.4,crossTask:!0,finishedAlerts:!0,keyHints:!0,editorKind:`auto`,worktreeBase:`default`,scrollbackRows:1e3,tabStrip:`never`,prefixTap:`local`,remoteProjects:!1,autoStatus:!1,dispatcher:!1,updateChannel:`latest`,updateNotify:!0,permissionBypass:!0},yb=O(lb()),ub(yb.get().prefs),bb=null}));function Sb(e){e.setAttribute(`data-scrolling`,``),window.clearTimeout(wb.get(e)),wb.set(e,window.setTimeout(()=>e.removeAttribute(`data-scrolling`),Cb))}function aee(){document.addEventListener(`scroll`,e=>{let t=e.target instanceof Element?e.target:document.scrollingElement;t&&Sb(t)},{capture:!0,passive:!0})}var Cb,wb,Tb=o((()=>{Cb=900,wb=new WeakMap}));function oee(e){let t=e?[...Nb.slice(0,-1),Ab[0],kb]:Ab.filter(e=>jb.includes(e.id));return{first:t,rest:Ab.filter(e=>!t.includes(e))}}function see(e){if(e.length!==1)return e;let t=e.toUpperCase().charCodeAt(0);return t===32?`\0`:t===63?``:t>=64&&t<=95?String.fromCharCode(t&31):e}function Eb(e){return e.key!==`Enter`||!e.shiftKey||e.ctrlKey||e.metaKey||e.altKey?!1:!e.isComposing&&e.keyCode!==229}function Db(e){return e.type!==`keydown`||e.key.toLowerCase()!==`c`||e.altKey?null:e.metaKey||e.ctrlKey&&e.shiftKey?`copy`:e.ctrlKey?`interrupt-or-copy`:null}var Ob,kb,Ab,jb,Mb,Nb,Pb,Fb=o((()=>{Ob=(e,t,n)=>({id:e,cap:t,bytes:e=>`\x1b${e?`O`:`[`}${n}`}),kb={id:`enter`,cap:`⏎`,bytes:()=>`\r`},Ab=[{id:`esc`,cap:`esc`,bytes:()=>`\x1B`},{id:`tab`,cap:`tab`,bytes:()=>` `},{id:`backtab`,cap:`⇧tab`,bytes:()=>`\x1B[Z`},{id:`interrupt`,cap:`^C`,bytes:()=>``},Ob(`up`,`↑`,`A`),Ob(`down`,`↓`,`B`),Ob(`left`,`←`,`D`),Ob(`right`,`→`,`C`),kb],jb=[`esc`,`backtab`,`interrupt`,`up`,`down`,`enter`],Mb=e=>({id:`option-${e}`,cap:String(e),bytes:()=>String(e)}),Nb=[Mb(1),Mb(2),Mb(3),Mb(4),kb],Pb=`\x1B[27;2;13~`}));function Ib(e){let t=e.slice(e.indexOf(`;`)+1);if(!e.includes(`;`)||t===`?`||t===``)return null;try{return new TextDecoder(`utf-8`,{fatal:!0}).decode(Uint8Array.from(atob(t),e=>e.charCodeAt(0)))}catch{return null}}var Lb=o((()=>{}));function Rb(e,t=()=>performance.now()){let n=``,r=-1/0;return{key(){r=-1/0},press(){n=``},release(){r=t()},osc52(i){t()-r<Bb?n=i:e(i)},text:()=>n}}function zb(e,t,n,r,i){let a=Rb(e=>void r(e));e.attachCustomKeyEventHandler(t=>{if(t.type===`keydown`&&a.key(),Eb(t))return t.preventDefault(),t.type===`keydown`&&n.input(Pb),!1;if(t.type===`keydown`&&t.ctrlKey&&!t.metaKey&&!t.altKey&&!t.shiftKey&&t.key.toLowerCase()===`v`&&/Mac|iPhone|iPad/.test(navigator.platform))return i(),!1;let o=Db(t);if(!o)return!0;o===`copy`&&t.ctrlKey&&t.preventDefault();let s=e.getSelection()||(o===`copy`?a.text():``);return s.trim().length===0?o===`interrupt-or-copy`:(r(s),e.clearSelection(),!1)});let o=e=>e.button===0&&a.press(),s=e=>e.button===0&&a.release();t.addEventListener(`mousedown`,o),document.addEventListener(`mouseup`,s);let c=e.parser.registerOscHandler(52,e=>{let t=Ib(e);return t&&a.osc52(t),!0});return()=>{t.removeEventListener(`mousedown`,o),document.removeEventListener(`mouseup`,s),c.dispose()}}var Bb,Vb=o((()=>{Fb(),Lb(),Bb=500})),Hb,Ub,Wb,Gb,Kb,qb=o((()=>{He(),cb(),Hb=()=>Be()?14:13,Ub=(e,t)=>{let n=Ve(()=>{e.options.fontSize=Hb(),t()}),r=ob.subscribe(()=>{let n=ob.get()??Kb;e.options.fontFamily!==n&&(e.options.fontFamily=n,t())});return()=>{n(),r()}},Wb={background:`#141413`,foreground:`#eae7df`,cursor:`#cc785c`,cursorAccent:`#141413`,selectionBackground:`#33312e`,black:`#141413`,red:`#ec6f74`,green:`#9aca86`,yellow:`#e8c96b`,blue:`#61aaf2`,magenta:`#9b87f5`,cyan:`#d4967e`,white:`#a9a39a`,brightBlack:`#6b665f`,brightRed:`#ec6f74`,brightGreen:`#9aca86`,brightYellow:`#e8c96b`,brightBlue:`#61aaf2`,brightMagenta:`#9b87f5`,brightCyan:`#e0ab96`,brightWhite:`#eae7df`},Gb=`Rove Nerd Symbols`,Kb=[`"JetBrains Mono"`,`"${Gb}"`,`"SF Mono"`,`ui-monospace`,`Menlo`,`monospace`].join(`, `)}));function Jb(e,t,n){let r=null,i=null,a=null,o=()=>{let t=e.element?.querySelector(`.xterm-screen`);if(!r||!t||e.rows<=0||e.cols<=0)return;let n=document.createElement(`canvas`).getContext(`2d`);n&&(n.font=`${e.options.fontSize??13}px ${e.options.fontFamily??Kb}`);let i=n?.measureText(`W`).width??0;r.style.setProperty(`--row-h`,`${t.clientHeight/e.rows}px`),i>0&&(r.style.letterSpacing=`${t.clientWidth/e.cols-i}px`)},s=()=>{r?.remove(),r=null,i?.dispose(),i=null,a!==null&&window.clearTimeout(a),a=null};return{snapshot:()=>n.serializeAsHTML({scrollback:0,includeGlobalBackground:!0}),raise(n){s(),r=document.createElement(`div`),r.className=kr,r.innerHTML=n,r.style.backgroundColor=(ab.get()??Wb).background??``,t.append(r),o(),requestAnimationFrame(o),i=e.onResize(o),a=window.setTimeout(s,Yb)},lower:s,get raised(){return r!==null}}}var Yb,Xb=o((()=>{cb(),qb(),Ur(),Yb=1500}));function Zb(e,t){let n=Array.from(rx.segment(e),e=>e.segment),r=Array.from(rx.segment(t),e=>e.segment),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;let a=n.map(e=>/[\r\n]/.test(e)).lastIndexOf(!0)+1;return nx.repeat(n.length-Math.max(i,a))+r.slice(i).join(``)}function Qb(e){return e.length>0&&e.length<=ax&&!/[\r\n]/.test(e)}function $b(e,t,n,r){return!ix.test(e)||e===`insertText`&&t&&r===n+t?null:Zb(n,r)}function ex(e,t,n){return Zb(e+n.substring(t),n)}function tx(e,t,n=t=>e.onKey(t)){let r=e.textarea,i=e.element;if(!r||!i)return()=>{};let a=``,o=``,s=!1,c=``,l=0,u=!1,d=e=>{(e.keyCode===229||e.key===`Process`||e.key===`Unidentified`)&&(u=!0)},f=()=>{u=!1},p=()=>{o=r.value===a?a:``},m=n=>{let i=n;if(i.target===r){if(i.inputType===`insertFromPaste`)Qb(r.value)||(r.value=``);else if(u&&!s&&!i.isComposing&&i.inputType===`insertText`&&i.data){let n=i.data,r=!1,a=e.onData(e=>{r||=e.includes(n)});setTimeout(()=>{a.dispose(),r||t(n)},0)}else if(!i.isComposing&&!u){let e=$b(i.inputType,i.data,o,r.value);e!==null&&(i.stopImmediatePropagation(),e&&t(e))}a=o=r.value}},h=()=>{s=!0,c=r.value===a?a:``,l=r.value.length},g=()=>{s=!1;let[e,n]=[c,l];setTimeout(()=>{let i=s?``:ex(e,n,r.value);i&&t(i),a=o=r.value},0)},_=()=>{let{selectionStart:e,selectionEnd:n,value:i}=r;if(e===n||s||i!==a)return;let o=Zb(i,i.slice(0,e)+i.slice(n));o&&t(o)},v=()=>{!s&&r.value&&(r.value=``),a=o=r.value,u=!1};i.addEventListener(`keydown`,d,!0),i.addEventListener(`keyup`,f,!0),i.addEventListener(`beforeinput`,p,!0),i.addEventListener(`input`,m,!0),i.addEventListener(`compositionstart`,h,!0),i.addEventListener(`compositionend`,g),i.addEventListener(`paste`,_,!0),r.addEventListener(`blur`,v);let y=n(v);return()=>{i.removeEventListener(`keydown`,d,!0),i.removeEventListener(`keyup`,f,!0),i.removeEventListener(`beforeinput`,p,!0),i.removeEventListener(`input`,m,!0),i.removeEventListener(`compositionstart`,h,!0),i.removeEventListener(`compositionend`,g),i.removeEventListener(`paste`,_,!0),r.removeEventListener(`blur`,v),y.dispose()}}var nx,rx,ix,ax,cee=o((()=>{nx=``,rx=new Intl.Segmenter(void 0,{granularity:`grapheme`}),ix=/^(?:insertText|insertReplacementText|insertTranscription|delete\w+|history(?:Undo|Redo))$/,ax=500})),ox,sx,cx,lee=o((()=>{ox=2,sx=1,cx=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._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(ox,Math.floor(u/e.css.cell.width)),rows:Math.max(sx,Math.floor(l/e.css.cell.height))}}}})),lx,ux=o((()=>{lee(),lx=class extends cx{term;constructor(e){super(),this.term=e}proposeDimensions(){let e=super.proposeDimensions(),t=this.term.element,n=t?.parentElement,r=this.term._core?._renderService?.dimensions?.css.cell.width;if(!e||!t||!n||!r)return e;let i=getComputedStyle(t),a=Number.parseInt(getComputedStyle(n).width)-Number.parseInt(i.paddingLeft)-Number.parseInt(i.paddingRight);return{cols:Math.max(e.cols,Math.floor(a/r)),rows:e.rows}}}}));function dx(e){let t=new Map;for(let n of e.split(`,`)){let e=n.indexOf(`=`);e>0&&t.set(n.slice(0,e),n.slice(e+1))}return t}function fx(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}async function px(e){let t=new Blob([e]).stream().pipeThrough(new DecompressionStream(`deflate`));return new Uint8Array(await new Response(t).arrayBuffer())}async function mx(e,t){let n=fx(t);e.get(`o`)===`z`&&(n=await px(n));let r=e.get(`f`)??`32`;if(r===`100`)return createImageBitmap(new Blob([n],{type:`image/png`}));let i=Number(e.get(`s`)),a=Number(e.get(`v`)),o=r===`24`?3:r===`32`?4:0;if(!o||!(i>0&&a>0)||n.length<i*a*o)return null;let s=new Uint8ClampedArray(i*a*4);for(let e=0;e<i*a;e++)s[e*4]=n[e*o],s[e*4+1]=n[e*o+1],s[e*4+2]=n[e*o+2],s[e*4+3]=o===4?n[e*4+3]:255;return createImageBitmap(new ImageData(s,i,a))}function hx(e){if(e.codePointAt(0)!==1109742)return null;let t=[];for(let n of e.slice(2)){let e=Cx.get(n.codePointAt(0));if(e===void 0)break;t.push(e)}return t}function gx(e,t,n){let r=t[2]===void 0?e:(e|t[2]<<24)>>>0,i=n!==null&&n.id===r,a=t[0]??(i?n.row:0);return{id:r,row:a,col:t[1]??(i&&n.row===a?n.col+1:0)}}var _x,vx,yx,bx,xx,Sx,Cx,wx=o((()=>{_x=64,vx=33554432,yx=27,bx=new TextDecoder(`latin1`),xx=class{changed;images=new Map;apc=null;apcBytes=0;escPending=!1;upload=null;constructor(e){this.changed=e}push(e){let t=0;for(this.escPending&&e.length>0&&(this.escPending=!1,this.apc&&e[0]===92?(this.finish(),t=1):(this.apc=null,e[0]===95&&(this.apc=[],this.apcBytes=0,t=1)));t<e.length;){let n=e.indexOf(yx,t);if(this.apc){if(n===-1){this.append(e.subarray(t));return}if(this.append(e.subarray(t,n)),n+1>=e.length){this.escPending=!0;return}e[n+1]===92?this.finish():this.apc=null,t=n+2;continue}if(n===-1)return;if(n+1>=e.length){this.escPending=!0;return}e[n+1]===95?(this.apc=[],this.apcBytes=0,t=n+2):t=n+1}}append(e){!this.apc||e.length===0||(this.apcBytes+=e.length,this.apcBytes>vx?this.apc=null:this.apc.push(e.slice()))}finish(){let e=this.apc;if(this.apc=null,!e)return;let t=e.map(e=>bx.decode(e)).join(``);if(t[0]!==`G`)return;let n=t.indexOf(`;`),r=dx(n===-1?t.slice(1):t.slice(1,n));this.command(r,n===-1?``:t.slice(n+1))}command(e,t){if(this.upload&&[...e.keys()].every(e=>e===`m`||e===`q`)){if(this.upload.parts.push(t),e.get(`m`)!==`1`){let{keys:e,parts:t}=this.upload;this.upload=null,this.transmitted(e,t.join(``))}return}this.upload=null;let n=e.get(`a`)??`t`;if(n===`t`||n===`T`){if((e.get(`t`)??`d`)!==`d`)return;e.get(`m`)===`1`?this.upload={keys:e,parts:[t]}:this.transmitted(e,t)}else n===`p`?this.placed(e):n===`d`&&this.deleted(e)}entry(e){let t=this.images.get(e)??{cols:null,rows:null,bitmap:null};this.images.delete(e),this.images.set(e,t);for(let e of this.images.keys()){if(this.images.size<=_x)break;this.images.get(e)?.bitmap?.close(),this.images.delete(e)}return t}transmitted(e,t){let n=Number(e.get(`i`));if(!(n>0))return;let r=this.entry(n);e.get(`a`)===`T`&&this.placed(e),mx(e,t).then(e=>{if(e){if(this.images.get(n)!==r)return e.close();r.bitmap?.close(),r.bitmap=e,this.changed()}}).catch(()=>{})}placed(e){let t=Number(e.get(`i`));if(!(t>0)||e.get(`U`)!==`1`)return;let n=this.entry(t),r=Number(e.get(`c`)),i=Number(e.get(`r`));n.cols=r>0?r:null,n.rows=i>0?i:null,this.changed()}deleted(e){let t=e.get(`d`)??`a`;if(t!==`i`&&t!==`I`)return;let n=Number(e.get(`i`));this.images.get(n)?.bitmap?.close(),this.images.delete(n)&&this.changed()}dispose(){for(let e of this.images.values())e.bitmap?.close();this.images.clear()}},Sx=`305-305 30d-30e 310-310 312-312 33d-33f 346-346 34a-34c 350-352 357-357 35b-35b 363-36f 483-487
|
|
100
|
+
592-595 597-599 59c-5a1 5a8-5a9 5ab-5ac 5af-5af 5c4-5c4 610-617 657-65b 65d-65e 6d6-6dc 6df-6e2
|
|
101
|
+
6e4-6e4 6e7-6e8 6eb-6ec 730-730 732-733 735-736 73a-73a 73d-73d 73f-741 743-743 745-745 747-747
|
|
102
|
+
749-74a 7eb-7f1 7f3-7f3 816-819 81b-823 825-827 829-82d 951-951 953-954 f82-f83 f86-f87 135d-135f
|
|
103
|
+
17dd-17dd 193a-193a 1a17-1a17 1a75-1a7c 1b6b-1b6b 1b6d-1b73 1cd0-1cd2 1cda-1cdb 1ce0-1ce0 1dc0-1dc1 1dc3-1dc9 1dcb-1dcc
|
|
104
|
+
1dd1-1de6 1dfe-1dfe 20d0-20d1 20d4-20d7 20db-20dc 20e1-20e1 20e7-20e7 20e9-20e9 20f0-20f0 2cef-2cf1 2de0-2dff a66f-a66f
|
|
105
|
+
a67c-a67d a6f0-a6f1 a8e0-a8f1 aab0-aab0 aab2-aab3 aab7-aab8 aabe-aabf aac1-aac1 fe20-fe26 10a0f-10a0f 10a38-10a38 1d185-1d189
|
|
106
|
+
1d1aa-1d1ad 1d242-1d244`,Cx=(()=>{let e=new Map;for(let t of Sx.split(/\s+/)){let[n,r]=t.split(`-`).map(e=>Number.parseInt(e,16));for(let t=n;t<=r;t++)e.set(t,e.size)}return e})()}));function Tx(e){return e.isFgRGB()||e.isFgPalette()?e.getFgColor():0}function Ex(e){let t=e.buffer.active,n=t.getNullCell(),r=[];for(let i=0;i<e.rows;i++){let a=t.getLine(t.viewportY+i);if(!a?.translateToString(!1).includes(Ox))continue;let o=null,s=null;for(let t=0;t<e.cols;t++){a.getCell(t,n);let e=hx(n.getChars());if(!e){o=null,s=null;continue}let c=gx(Tx(n),e,o);s&&s.id===c.id&&s.row===c.row&&s.col+s.len===c.col?s.len++:(s={...c,x:t,y:i,len:1},r.push(s)),o=c}}return r}function Dx(e){let t=null,n=0,r=()=>{n||=requestAnimationFrame(a)},i=new xx(r),a=()=>{n=0;let r=e.element?.querySelector(`.xterm-screen`);if(!r||e.rows<=0||e.cols<=0)return;let a=Ex(e);if(a.length===0&&!t)return;t||(t=document.createElement(`canvas`),t.className=Dr,r.append(t));let o=window.devicePixelRatio||1,s=r.clientWidth,c=r.clientHeight;(t.width!==Math.round(s*o)||t.height!==Math.round(c*o))&&(t.width=Math.round(s*o),t.height=Math.round(c*o));let l=t.getContext(`2d`);if(!l)return;l.setTransform(o,0,0,o,0,0),l.clearRect(0,0,s,c);let u=s/e.cols,d=c/e.rows,f=e.options.theme?.background??`#000`;for(let e of a){let t=e.x*u,n=e.y*d,r=e.len*u;l.fillStyle=f,l.fillRect(t,n,r,d);let a=i.images.get(e.id),o=a?.bitmap;if(!o){l.fillStyle=`rgba(128, 128, 128, 0.14)`,l.fillRect(t,n,r,d);continue}let s=a.cols??Math.ceil(o.width/u),c=a.rows??Math.ceil(o.height/d),p=Math.min(s*u/o.width,c*d/o.height),m=o.width*p,h=o.height*p,g=t-e.col*u+(s*u-m)/2,_=n-e.row*d+(c*d-h)/2;l.save(),l.beginPath(),l.rect(t,n,r,d),l.clip(),l.drawImage(o,g,_,m,h),l.restore()}},o=[e.onRender(r),e.onResize(r),e.onScroll(r)];return{push:e=>i.push(e),dispose(){n&&cancelAnimationFrame(n);for(let e of o)e.dispose();t?.remove(),i.dispose()}}}var Ox,kx=o((()=>{wx(),Ur(),Ox=``}));function Ax(e){let t=0;return{forward(n){let r=(t>0?n.replace(Mx,``):n).replace(jx,``);r&&e(r)},replay(e){t++,e(()=>{t--})}}}var jx,Mx,Nx=o((()=>{jx=/\x1b\[\?[0-9;]*c|\x1b\[\??[0-9;]*\$y|\x1b\](?:10|11);[^\x07\x1b]*(?:\x07|\x1b\\)/g,Mx=/\x1b\[[?>=]?[0-9;]*(?:[cnRt]|\$y)|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1bP[^\x1b]*\x1b\\/g}));function Px(e){return e.alternateScreen||e.mouseTracking&&e.shift?`app`:`local`}function Fx(e,t,n,r){let i=t<0;return(e.mouseTracking?`\x1b[<${i?64:65};${Math.max(1,n)};${Math.max(1,r)}M`:`\x1b${e.applicationCursorKeys?`O`:`[`}${i?`A`:`B`}`.repeat(3)).repeat(Math.abs(t))}function Ix(e,t){let n=(Math.sign(e)===-Math.sign(t)?0:e)+t,r=Math.trunc(n)||0;return{lines:r,carry:n-r}}function Lx(e,t,n){let r=e.deltaMode===1?1:e.deltaMode===2?Math.max(1,n):1/Math.max(1,t);return e.deltaY*r}function Rx(e){if(e.deltaMode!==0)return!0;let t=Math.abs(e.wheelDeltaY??0);return t>0&&t%120==0&&Math.abs(e.deltaY)*2>t}function zx(e,t){let n=e+t,r=Math.sign(n)*Math.round(Math.abs(n))||0;return{lines:r,carry:n-r}}function Bx(e,t){return e>0&&t.viewportY>=t.baseY||e<0&&t.viewportY<=0?0:e}function Vx(e,t){let n=e*(1-Math.exp(-Math.max(0,t)/Gx));return Math.abs(e-n)<.02?e:n}function Hx(e,t,n){let r=Math.abs(t),i=Math.sign(t);if(!e||n-e.at>Kx||i!==e.sign)return{sign:i,at:n,peak:r,last:r,falling:0,coasting:!1};let a=r>e.last+Xx,o=a?0:e.falling+1,s=a?r:e.peak;return{sign:i,at:n,peak:s,last:r,falling:o,coasting:r<Yx&&o>=qx&&s>=r*Jx}}function Ux(e){return Math.max(0,e.baseY-e.viewportY)}function Wx(e,t){if(e===null||e<=0)return null;let n=Math.max(0,t.baseY-e);return n===t.viewportY?null:n}var Gx,Kx,qx,Jx,Yx,Xx,Zx=o((()=>{Gx=55,Kx=120,qx=4,Jx=3,Yx=3,Xx=1}));function Qx(e,t){let n=[t.black,t.red,t.green,t.yellow,t.blue,t.magenta,t.cyan,t.white,t.brightBlack,t.brightRed,t.brightGreen,t.brightYellow,t.brightBlue,t.brightMagenta,t.brightCyan,t.brightWhite];if(e<16)return n[e]??`#ffffff`;if(e>=232){let t=8+(e-232)*10;return`rgb(${t},${t},${t})`}let r=e-16,i=e=>e===0?0:55+e*40;return`rgb(${i(Math.floor(r/36))},${i(Math.floor(r/6)%6)},${i(r%6)})`}function $x(e,t){let n=t.foreground??`#ffffff`,r=t.background??`#000000`,i=n;if(!e.isFgDefault()){let n=e.getFgColor();i=e.isFgRGB()?`#${n.toString(16).padStart(6,`0`)}`:Qx(e.isBold()&&n<8?n+8:n,t)}let a=r;if(!e.isBgDefault()){let n=e.getBgColor();a=e.isBgRGB()?`#${n.toString(16).padStart(6,`0`)}`:Qx(n,t)}return e.isInverse()?{fg:a,bg:i}:{fg:i,bg:a}}function eS(e){let t={side:`top`,canvas:null,key:``},n={side:`bottom`,canvas:null,key:``},r=null,i=0;function a(t,n){let r=e.element?.querySelector(`.xterm-screen`);if(!r||e.cols<=0)return;t.canvas||(t.canvas=document.createElement(`canvas`),t.canvas.style.cssText=`position:absolute;left:0;pointer-events:none;display:none`);let i=t.canvas.getContext(`2d`);if(!i)return;t.canvas.parentElement!==r&&r.appendChild(t.canvas);let a=window.devicePixelRatio||1,o=r.clientWidth,s=Math.round(o*a),c=Math.round(n*a);(t.canvas.width!==s||t.canvas.height!==c)&&(t.canvas.width=s,t.canvas.height=c,t.key=``),t.canvas.style.width=`${o}px`,t.canvas.style.height=`${n}px`,t.canvas.style.top=t.side===`top`?`${-n}px`:`${n*e.rows}px`;let l=e.buffer.active,u=l.getLine(t.side===`top`?l.viewportY-1:l.viewportY+e.rows),d=e.options.theme??{},f=`${u?.translateToString(!1)??``}|${o}|${n}|${a}|${d.background}|${d.foreground}`;if(f===t.key||(t.key=f,i.setTransform(a,0,0,a,0,0),i.fillStyle=d.background??`#000000`,i.fillRect(0,0,o,n),!u))return;let p=o/e.cols,m=e.options.fontFamily??`monospace`,h=e.options.fontSize??13;i.textBaseline=`middle`;let g=l.getNullCell(),_=``;for(let t=0;t<e.cols;t++){u.getCell(t,g);let e=g.getWidth();if(e===0)continue;let{fg:r,bg:a}=$x(g,d);(!g.isBgDefault()||g.isInverse())&&(i.fillStyle=a,i.fillRect(t*p,0,p*e,n));let o=g.getChars();if(o===``||o===` `||g.isInvisible())continue;let s=`${g.isItalic()?`italic `:``}${g.isBold()?`bold `:``}${h}px ${m}`;s!==_&&(i.font=_=s),i.globalAlpha=g.isDim()?.5:1,i.fillStyle=r,i.fillText(o,t*p,n/2+.5),i.globalAlpha=1}}let o=(e,t,n,r)=>{let i=Math.max(0,r-n);t.style.clipPath=e.side===`top`?`inset(${i}px 0 0 0)`:`inset(0 0 ${i}px 0)`,t.style.display=``};return{show(e,s){if(e!==0&&(r=e>0?t:n),!r)return;let c=r===t?n:t;c.canvas&&(c.canvas.style.display=`none`),i=s,e!==0&&a(r,s),r.canvas&&o(r,r.canvas,Math.abs(e),s)},refresh(){r?.canvas&&r.canvas.style.display!==`none`&&a(r,i)},hide(){r=null,t.canvas&&(t.canvas.style.display=`none`),n.canvas&&(n.canvas.style.display=`none`)},transition(e){for(let r of[t,n])r.canvas&&(r.canvas.style.transition=e)},dispose(){t.canvas?.remove(),n.canvas?.remove()}}}var tS=o((()=>{}));function nS(e,t){let n=0,r=0,i=0,a=0,o=null,s=null,c=!1,l=()=>e.element?.querySelector(`.xterm-screen`)??null,u=()=>{let t=l();return t&&e.rows>0&&t.clientHeight/e.rows||oS},d=eS(e),f=()=>{c=!1;let e=l();if(!e)return;let t=u();e.style.transform=n===0?``:`translateY(${-n*t}px)`,n===0?e.style.transition===``?d.hide():d.show(0,t):d.show(-n*t,t)},p=e.onRender(()=>{c?f():d.refresh()}),m=()=>{c=!0,requestAnimationFrame(()=>{c&&f()})},h=()=>{s!==null&&window.clearTimeout(s),s=null;let e=l();e&&(e.style.transition=``),d.transition(``),n===0&&d.hide()},g=()=>{if(s===null)return;let e=l();e&&(n=-new DOMMatrix(getComputedStyle(e).transform).m42/u()),h()},_=()=>{o!==null&&window.clearTimeout(o),o=window.setTimeout(v,iS)};function v(){if(o!==null&&window.clearTimeout(o),o=null,n===0)return;let e=l();n=0,e&&(e.style.transition=`transform ${aS}ms ease-out`,d.transition(`clip-path ${aS}ms ease-out`),f(),s=window.setTimeout(h,130))}let y=r=>{if(r===0)return!0;g();let i=zx(n,r),a=e.buffer.active,o=a.viewportY;i.lines!==0&&(t(),e.scrollLines(i.lines));let s=i.lines!==0&&a.viewportY-o!==i.lines;return n=s?0:Bx(i.carry,a),m(),_(),!s&&n===i.carry},b=e=>{i=0;let t=Vx(r,e-a);a=e,r-=t,y(t)||(r=0),r!==0&&(i=requestAnimationFrame(b))},x=()=>{r=0,i&&cancelAnimationFrame(i),i=0},S=()=>{x(),o!==null&&window.clearTimeout(o),o=null,h(),n=0,f()};return{by:y,glide(e){Math.sign(e)!==Math.sign(r)&&(r=0),r+=e,i||=(a=performance.now(),requestAnimationFrame(b))},settle:v,reset:S,dispose(){p.dispose(),S(),d.dispose()}}}function rS(e,t,n){let r=null,i=0,a=e=>{if(e.ctrlKey||Math.abs(e.deltaX)>Math.abs(e.deltaY))return;let a=t.buffer.active.type===`alternate`,o=t.modes.mouseTrackingMode!==`none`;e.preventDefault(),e.stopPropagation();let s=t.element?.querySelector(`.xterm-screen`),c=s&&t.rows>0?s.clientHeight/t.rows:0,l=Lx(e,c||oS,t.rows);if(Px({alternateScreen:a,mouseTracking:o,shift:e.shiftKey})===`app`){n.reset();let r=Rx(e)?{lines:Math.sign(l)*sS,carry:0}:Ix(i,l);i=r.carry;let a=Math.max(-t.rows,Math.min(t.rows,r.lines));if(a===0)return;let c=s?.getBoundingClientRect(),u=c&&t.cols>0?Math.floor((e.clientX-c.left)/c.width*t.cols)+1:1,d=c&&t.rows>0?Math.floor((e.clientY-c.top)/c.height*t.rows)+1:1,f=t.modes.applicationCursorKeysMode;t.input(Fx({mouseTracking:o,applicationCursorKeys:f},a,u,d),!1);return}if(i=0,Rx(e)){r=null,n.glide(l);return}r=Hx(r,l*(c||oS),e.timeStamp),r.coasting?n.settle():n.by(l)};return e.addEventListener(`wheel`,a,{capture:!0,passive:!1}),()=>e.removeEventListener(`wheel`,a,{capture:!0})}var iS,aS,oS,sS,cS=o((()=>{tS(),Zx(),iS=140,aS=90,oS=15,sS=3}));function lS(e,t,n){let r=null,i=!1,a=e=>{r=e.touches.length===1?e.touches[0].clientY:null,i=!1},o=e=>{if(r===null||e.touches.length!==1)return;let{clientX:a,clientY:o}=e.touches[0];if(!i&&Math.abs(o-r)<uS)return;i=!0,e.preventDefault();let s=r-o;r=o;let c=t.element?.querySelector(`.xterm-screen`);if(Px({alternateScreen:t.buffer.active.type===`alternate`,mouseTracking:t.modes.mouseTrackingMode!==`none`,shift:!1})===`app`){c?.dispatchEvent(new WheelEvent(`wheel`,{deltaY:s,deltaMode:0,clientX:a,clientY:o,bubbles:!0,cancelable:!0}));return}let l=c&&t.rows>0?c.clientHeight/t.rows:0;n.by(s/(l||15))},s=()=>{r=null,n.settle()};return e.addEventListener(`touchstart`,a,{passive:!0}),e.addEventListener(`touchmove`,o,{passive:!1}),e.addEventListener(`touchend`,s),e.addEventListener(`touchcancel`,s),()=>{e.removeEventListener(`touchstart`,a),e.removeEventListener(`touchmove`,o),e.removeEventListener(`touchend`,s),e.removeEventListener(`touchcancel`,s)}}var uS,dS=o((()=>{Zx(),uS=6}));function fS(e){let t=new Set,n=()=>{for(let e of t)e()},r=e.onKey(n);return{onKey(e){return t.add(e),{dispose:()=>void t.delete(e)}},input(t){n(),e.input(t,!0)},dispose(){r.dispose(),t.clear()}}}var pS=o((()=>{}));function mS(e){hS(e)||DC.onUnexpectedError(e)}function hS(e){return e instanceof kC||e instanceof Error&&e.name===OC&&e.message===OC}function gS(e,t,n=0,r=e.length){let i=n,a=r;for(;i<a;){let n=Math.floor((i+a)/2);t(e[n])?i=n+1:a=n}return i-1}function _S(e,t){return(n,r)=>t(e(n),e(r))}function vS(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}function yS(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}function bS(e){RC=e}function xS(e){return RC?.trackDisposable(e),e}function SS(e){RC?.markAsDisposed(e)}function CS(e,t){RC?.setParent(e,t)}function uee(e,t){if(RC)for(let n of e)RC.setParent(n,t)}function wS(e){if(IC.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function TS(...e){let t=ES(()=>wS(e));return uee(e,t),t}function ES(e){let t=xS({dispose:yS(()=>{SS(t),e()})});return t}function dee(){if(!YC)return 0;let e=GC.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}function DS(e){let t=e.toString(16);return t.length<2?`0`+t:t}function OS(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function kS(e){if(!e)throw Error(`value must not be falsy`);return e}function AS(e){return 57508<=e&&e<=57558}function fee(e){return 57520<=e&&e<=57527}function pee(e){return 57344<=e&&e<=63743}function mee(e){return 9472<=e&&e<=9631}function hee(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}function gee(e,t,n,r){return t===1&&n>Math.ceil(r*1.5)&&e!==void 0&&e>255&&!hee(e)&&!AS(e)&&!pee(e)}function jS(e){return AS(e)||mee(e)}function _ee(){return{css:{canvas:MS(),cell:MS()},device:{canvas:MS(),cell:MS(),char:{width:0,height:0,left:0,top:0}}}}function MS(){return{width:0,height:0}}function NS(e,t,n=0){return(e-(Math.round(t)*2-n))%(Math.round(t)*2)}function PS(e,t,n,r,i,a,o,s){let c=_w[t];if(c)return FS(e,c,n,r,i,a),!0;let l=vw[t];if(l)return IS(e,l,n,r,i,a),!0;let u=yw[t];if(u)return LS(e,u,n,r,i,a,s),!0;let d=bw[t];return d?(RS(e,d,n,r,i,a,o,s),!0):!1}function FS(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)}}function IS(e,t,n,r,i,a){let o=xw.get(t);o||(o=new Map,xw.set(t,o));let s=e.fillStyle;if(typeof s!=`string`)throw Error(`Unexpected fillStyle type "${s}"`);let c=o.get(s);if(!c){let n=t[0].length,r=t.length,i=e.canvas.ownerDocument.createElement(`canvas`);i.width=n,i.height=r;let a=kS(i.getContext(`2d`)),l=new ImageData(n,r),u,d,f,p;if(s.startsWith(`#`))u=parseInt(s.slice(1,3),16),d=parseInt(s.slice(3,5),16),f=parseInt(s.slice(5,7),16),p=s.length>7&&parseInt(s.slice(7,9),16)||1;else if(s.startsWith(`rgba`))[u,d,f,p]=s.substring(5,s.length-1).split(`,`).map(e=>parseFloat(e));else throw Error(`Unexpected fillStyle color format "${s}" when drawing pattern glyph`);for(let e=0;e<r;e++)for(let r=0;r<n;r++)l.data[(e*n+r)*4]=u,l.data[(e*n+r)*4+1]=d,l.data[(e*n+r)*4+2]=f,l.data[(e*n+r)*4+3]=t[e][r]*(p*255);a.putImageData(l,0,0),c=kS(e.createPattern(i,null)),o.set(s,c)}e.fillStyle=c,e.fillRect(n,r,i,a)}function LS(e,t,n,r,i,a,o){e.strokeStyle=e.fillStyle;for(let[s,c]of Object.entries(t)){e.beginPath(),e.lineWidth=o*Number.parseInt(s);let t;t=typeof c==`function`?c(.15,.15/a*i):c;for(let s of t.split(` `)){let t=s[0],c=Sw[t];if(!c){console.error(`Could not find drawing instructions for "${t}"`);continue}let l=s.substring(1).split(`,`);!l[0]||!l[1]||c(e,BS(l,i,a,n,r,!0,o))}e.stroke(),e.closePath()}}function RS(e,t,n,r,i,a,o,s){let c=new Path2D;c.rect(n,r,i,a),e.clip(c),e.beginPath();let l=o/12;e.lineWidth=s*l;for(let o of t.d.split(` `)){let c=o[0],u=Sw[c];if(!u){console.error(`Could not find drawing instructions for "${c}"`);continue}let d=o.substring(1).split(`,`);!d[0]||!d[1]||u(e,BS(d,i,a,n,r,!1,s,(t.leftPadding??0)*(l/2),(t.rightPadding??0)*(l/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function zS(e,t,n=0){return Math.max(Math.min(e,t),n)}function BS(e,t,n,r,i,a,o,s=0,c=0){let l=e.map(e=>parseFloat(e)||parseInt(e));if(l.length<2)throw Error(`Too few arguments for instruction`);for(let e=0;e<l.length;e+=2)l[e]*=t-s*o-c*o,a&&l[e]!==0&&(l[e]=zS(Math.round(l[e]+.5)-.5,t,0)),l[e]+=r+s*o;for(let e=1;e<l.length;e+=2)l[e]*=n,a&&l[e]!==0&&(l[e]=zS(Math.round(l[e]+.5)-.5,n,0)),l[e]+=i;return l}function VS(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 HS(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function US(e,t,n){let r=e.createElement(`canvas`);return r.width=t,r.height=n,r}function WS(e,t,n,r,i,a,o,s){let c={foreground:a.foreground,background:a.background,cursor:tw,cursorAccent:tw,selectionForeground:tw,selectionBackgroundTransparent:tw,selectionBackgroundOpaque:tw,selectionInactiveBackgroundTransparent:tw,selectionInactiveBackgroundOpaque:tw,overviewRulerBorder:tw,scrollbarSliderBackground:tw,scrollbarSliderHoverBackground:tw,scrollbarSliderActiveBackground:tw,ansi:a.ansi.slice(),contrastCache:a.contrastCache,halfContrastCache:a.halfContrastCache};return{customGlyphs:i.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:s,letterSpacing:i.letterSpacing,lineHeight:i.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:r,fontFamily:i.fontFamily,fontSize:i.fontSize,fontWeight:i.fontWeight,fontWeightBold:i.fontWeightBold,allowTransparency:i.allowTransparency,drawBoldTextInBrightColors:i.drawBoldTextInBrightColors,minimumContrastRatio:i.minimumContrastRatio,colors:c}}function GS(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}function KS(e){return(e&50331648)==16777216||(e&50331648)==33554432}function qS(e,t,n,r,i,a,o,s,c){let l=WS(r,i,a,o,t,n,s,c);for(let t=0;t<iT.length;t++){let n=iT[t],r=n.ownedBy.indexOf(e);if(r>=0){if(GS(n.config,l))return n.atlas;n.ownedBy.length===1?(n.atlas.dispose(),iT.splice(t,1)):n.ownedBy.splice(r,1);break}}for(let t=0;t<iT.length;t++){let n=iT[t];if(GS(n.config,l))return n.ownedBy.push(e),n.atlas}let u=e._core,d={atlas:new nT(document,l,u.unicodeService),config:l,ownedBy:[e]};return iT.push(d),d.atlas}function JS(e){for(let t=0;t<iT.length;t++){let n=iT[t].ownedBy.indexOf(e);if(n!==-1){iT[t].ownedBy.length===1?(iT[t].atlas.dispose(),iT.splice(t,1)):iT[t].ownedBy.splice(n,1);break}}}function YS(e,t,n){let r=new t.ResizeObserver(t=>{let i=t.find(t=>t.target===e);if(!i)return;if(!(`devicePixelContentBoxSize`in i)){r?.disconnect(),r=void 0;return}let a=i.devicePixelContentBoxSize[0].inlineSize,o=i.devicePixelContentBoxSize[0].blockSize;a>0&&o>0&&n(a,o)});try{r.observe(e,{box:[`device-pixel-content-box`]})}catch{r.disconnect(),r=void 0}return ES(()=>r?.disconnect())}function XS(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function ZS(e,t,n){let r=kS(e.createProgram());if(e.attachShader(r,kS(QS(e,e.VERTEX_SHADER,t))),e.attachShader(r,kS(QS(e,e.FRAGMENT_SHADER,n))),e.linkProgram(r),e.getProgramParameter(r,e.LINK_STATUS))return r;console.error(e.getProgramInfoLog(r)),e.deleteProgram(r)}function QS(e,t,n){let r=kS(e.createShader(t));if(e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS))return r;console.error(e.getShaderInfoLog(r)),e.deleteShader(r)}function $S(e,t){let n=Math.min(e.length*2,t),r=new Float32Array(n);for(let t=0;t<e.length;t++)r[t]=e[t];return r}function eC(e){let t=``;for(let n=1;n<e;n++)t+=` else if (v_texpage == ${n}) { outColor = texture(u_texture[${n}], v_texcoord); }`;return`#version 300 es
|
|
107
|
+
precision lowp float;
|
|
108
|
+
|
|
109
|
+
in vec2 v_texcoord;
|
|
110
|
+
flat in int v_texpage;
|
|
111
|
+
|
|
112
|
+
uniform sampler2D u_texture[${e}];
|
|
113
|
+
|
|
114
|
+
out vec4 outColor;
|
|
115
|
+
|
|
116
|
+
void main() {
|
|
117
|
+
if (v_texpage == 0) {
|
|
118
|
+
outColor = texture(u_texture[0], v_texcoord);
|
|
119
|
+
} ${t}
|
|
120
|
+
}`}function tC(){return new yT}function nC(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}function rC(){return qT}function iC(e){return 55296<=e&&e<=56319}function aC(e){return 56320<=e&&e<=57343}function oC(e,t){return(e-55296<<10)+(t-56320)+65536}function sC(e){return cC(e,0)}function cC(e,t){switch(typeof e){case`object`:return e===null?lC(349,t):Array.isArray(e)?fC(e,t):pC(e,t);case`string`:return dC(e,t);case`boolean`:return uC(e,t);case`number`:return lC(e,t);case`undefined`:return lC(937,t);default:return lC(617,t)}}function lC(e,t){return(t<<5)-t+e|0}function uC(e,t){return lC(e?433:863,t)}function dC(e,t){t=lC(149417,t);for(let n=0,r=e.length;n<r;n++)t=lC(e.charCodeAt(n),t);return t}function fC(e,t){return t=lC(104579,t),e.reduce((e,t)=>cC(t,e),t)}function pC(e,t){return t=lC(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=dC(n,t),cC(e[n],t)),t)}function mC(e,t,n=32){let r=n-t,i=~((1<<r)-1);return(e<<t|(i&e)>>>r)>>>0}function hC(e,t=0,n=e.byteLength,r=0){for(let i=0;i<n;i++)e[t+i]=r}function gC(e,t,n=`0`){for(;e.length<t;)e=n+e;return e}function _C(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``):gC((e>>>0).toString(16),t/4)}function vC(e,t,n,r){return new xE(e,t,n,r)}function yC(e,t,n=0){return Math.max(Math.min(e,t),n)}function bC(e){if(OE.has(e))return OE.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);xC(t,e,r)};return t._id=e,OE.set(e,t),t}function xC(e,t,n){t[EE]===t?t[DE].push({id:e,index:n}):(t[DE]=[{id:e,index:n}],t[EE]=t)}var SC,CC,wC,TC,EC,DC,OC,kC,AC,jC,MC,NC,PC,FC,IC,LC,RC,zC,BC,VC,HC,UC,WC,GC,KC,qC,JC,YC,XC,ZC,QC,$C,ew,tw,nw,rw,iw,aw,ow,sw,cw,lw,uw,dw,fw,pw,mw,hw,gw,_w,vw,yw,bw,xw,Sw,Cw,ww,Tw,Ew,Dw,Ow,kw,Aw,jw,Mw,Nw,Pw,Fw,Iw,Lw,Rw,zw,Bw,Vw,Hw,Uw,Ww,Gw,Kw,qw,Jw,Yw,Xw,Zw,Qw,$w,eT,tT,nT,rT,iT,aT,oT,sT,cT,lT,uT,dT,fT,pT,mT,hT,gT,_T,vT,yT,bT,xT,ST,CT,wT,TT,ET,DT,OT,kT,AT,jT,MT,NT,PT,FT,IT,LT,RT,zT,BT,VT,HT,UT,WT,GT,KT,qT,JT,YT,XT,ZT,QT,$T,eE,tE,nE,rE,iE,aE,oE,sE,cE,lE,uE,dE,fE,pE,mE,hE,gE,_E,vee,vE,yE,yee,bE,bee,xee,See,Cee,wee,Tee,Eee,Dee,Oee,xE,SE,CE,wE,TE,EE,DE,OE,kE,AE,jE,ME,NE,kee=o((()=>{if(SC=Object.defineProperty,CC=Object.getOwnPropertyDescriptor,wC=(e,t,n,r)=>{for(var i=r>1?void 0:r?CC(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&SC(t,n,i),i},TC=(e,t)=>(n,r)=>t(n,r,e),EC=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?AC.isErrorNoTelemetry(e)?new AC(e.message+`
|
|
121
|
+
|
|
122
|
+
`+e.stack):Error(e.message+`
|
|
123
|
+
|
|
124
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},DC=new EC,OC=`Canceled`,kC=class extends Error{constructor(){super(OC),this.name=this.message}},AC=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},jC=class e{constructor(e){this._array=e,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(e.assertInvariants){if(this._prevFindLastPredicate){for(let e of this._array)if(this._prevFindLastPredicate(e)&&!t(e))throw Error(`MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.`)}this._prevFindLastPredicate=t}let n=gS(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=n+1,n===-1?void 0:this._array[n]}},jC.assertInvariants=!1,(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(MC||={}),NC=(e,t)=>e-t,PC=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||MC.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}},PC.empty=new PC(e=>{}),FC=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}},(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(IC||={}),LC=!1,RC=null,zC=class e{constructor(){this.livingDisposables=new Map}getDisposableData(t){let n=this.livingDisposables.get(t);return n||(n={parent:null,source:null,isSingleton:!1,value:t,idx:e.idx++},this.livingDisposables.set(t,n)),n}trackDisposable(e){let t=this.getDisposableData(e);t.source||=Error().stack}setParent(e,t){let n=this.getDisposableData(e);n.parent=t}markAsDisposed(e){this.livingDisposables.delete(e)}markAsSingleton(e){this.getDisposableData(e).isSingleton=!0}getRootParent(e,t){let n=t.get(e);if(n)return n;let r=e.parent?this.getRootParent(this.getDisposableData(e.parent),t):e;return t.set(e,r),r}getTrackedDisposables(){let e=new Map;return[...this.livingDisposables.entries()].filter(([,t])=>t.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(`
|
|
125
|
+
`).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new FC;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(`
|
|
126
|
+
`),e)}n.sort(_S(e=>e.idx,NC));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;t<e.length;t++){let a=e[t];a=`(shared with ${i.get(e.slice(0,t+1).join(`
|
|
127
|
+
`)).size}/${n.length} leaks) at ${a}`;let o=vS([...i.get(e.slice(0,t).join(`
|
|
128
|
+
`))].map(e=>r(e)[t]),e=>e);delete o[e[t]];for(let[e,t]of Object.entries(o))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(a)}a+=`
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
==================== Leaking disposable ${o}/${n.length}: ${t.value.constructor.name} ====================
|
|
132
|
+
${s.join(`
|
|
133
|
+
`)}
|
|
134
|
+
============================================================
|
|
135
|
+
|
|
136
|
+
`}return n.length>e&&(a+=`
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
... and ${n.length-e} more leaking disposables
|
|
140
|
+
|
|
141
|
+
`),{leaks:n,details:a}}},zC.idx=0,LC){let e=`__is_disposable_tracked__`;bS(new class{trackDisposable(t){let n=Error(`Potentially leaked disposable`).stack;setTimeout(()=>{t[e]||console.log(n)},3e3)}setParent(t,n){if(t&&t!==HC.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==HC.None)try{t[e]=!0}catch{}}markAsSingleton(e){}})}if(BC=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,xS(this)}dispose(){this._isDisposed||(SS(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{wS(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return CS(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),CS(e,null))}},BC.DISABLE_DISPOSED_WARNING=!1,VC=BC,HC=class{constructor(){this._store=new VC,xS(this),CS(this._store,this)}dispose(){SS(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}},HC.None=Object.freeze({dispose(){}}),UC=class{constructor(){this._isDisposed=!1,xS(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&CS(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,SS(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&CS(e,null),e}},WC=typeof process<`u`&&`title`in process,GC=WC?`node`:navigator.userAgent,KC=WC?`node`:navigator.platform,qC=GC.includes(`Firefox`),JC=GC.includes(`Edge`),YC=/^((?!chrome|android).)*safari/i.test(GC),[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(KC),[`Windows`,`Win16`,`Win32`,`WinCE`].includes(KC),KC.indexOf(`Linux`),/\bCrOS\b/.test(GC),XC=``,ZC=0,QC=0,$C=0,ew=0,tw={css:`#00000000`,rgba:0},(e=>{function t(e,t,n,r){return r===void 0?`#${DS(e)}${DS(t)}${DS(n)}`:`#${DS(e)}${DS(t)}${DS(n)}${DS(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(nw||={}),(e=>{function t(e,t){if(ew=(t.rgba&255)/255,ew===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return ZC=a+Math.round((n-a)*ew),QC=o+Math.round((r-o)*ew),$C=s+Math.round((i-s)*ew),{css:nw.toCss(ZC,QC,$C),rgba:nw.toRgba(ZC,QC,$C)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=ow.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return nw.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[ZC,QC,$C]=ow.toChannels(t),{css:nw.toCss(ZC,QC,$C),rgba:t}}e.opaque=i;function a(e,t){return ew=Math.round(t*255),[ZC,QC,$C]=ow.toChannels(e.rgba),{css:nw.toCss(ZC,QC,$C,ew),rgba:nw.toRgba(ZC,QC,$C,ew)}}e.opacity=a;function o(e,t){return ew=e.rgba&255,a(e,ew*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(rw||={}),(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return ZC=parseInt(e.slice(1,2).repeat(2),16),QC=parseInt(e.slice(2,3).repeat(2),16),$C=parseInt(e.slice(3,4).repeat(2),16),nw.toColor(ZC,QC,$C);case 5:return ZC=parseInt(e.slice(1,2).repeat(2),16),QC=parseInt(e.slice(2,3).repeat(2),16),$C=parseInt(e.slice(3,4).repeat(2),16),ew=parseInt(e.slice(4,5).repeat(2),16),nw.toColor(ZC,QC,$C,ew);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 r=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(r)return ZC=parseInt(r[1]),QC=parseInt(r[2]),$C=parseInt(r[3]),ew=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),nw.toColor(ZC,QC,$C,ew);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[ZC,QC,$C,ew]=t.getImageData(0,0,1,1).data,ew!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:nw.toRgba(ZC,QC,$C,ew),css:e}}e.toColor=r})(iw||={}),(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(aw||={}),(e=>{function t(e,t){if(ew=(t&255)/255,ew===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return ZC=a+Math.round((n-a)*ew),QC=o+Math.round((r-o)*ew),$C=s+Math.round((i-s)*ew),nw.toRgba(ZC,QC,$C)}e.blend=t;function n(e,t,n){let a=aw.relativeLuminance(e>>8),o=aw.relativeLuminance(t>>8);if(OS(a,o)<n){if(o<a){let o=r(e,t,n),s=OS(a,aw.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>OS(a,aw.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=OS(a,aw.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>OS(a,aw.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(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,l=OS(aw.relativeLuminance2(o,s,c),aw.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=OS(aw.relativeLuminance2(o,s,c),aw.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(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,l=OS(aw.relativeLuminance2(o,s,c),aw.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=OS(aw.relativeLuminance2(o,s,c),aw.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(ow||={}),sw=0,cw=0,lw=!1,uw=!1,dw=!1,pw=0,mw=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,r){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,cw=0,sw=0,uw=!1,lw=!1,dw=!1,fw=this._themeService.colors,pw=0,e.getCode()!==0&&e.extended.underlineStyle===4){let e=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));pw=t*r%(Math.round(e)*2)}if(this._decorationService.forEachDecorationAtCell(t,n,`bottom`,e=>{e.backgroundColorRGB&&(cw=e.backgroundColorRGB.rgba>>8&16777215,uw=!0),e.foregroundColorRGB&&(sw=e.foregroundColorRGB.rgba>>8&16777215,lw=!0)}),dw=this._selectionRenderModel.isCellSelected(this._terminal,t,n),dw){if(this.result.fg&67108864||this.result.bg&50331648){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:cw=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:cw=(this.result.fg&16777215)<<8|255;break;default:cw=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:cw=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:cw=(this.result.bg&16777215)<<8|255}cw=ow.blend(cw,(this._coreBrowserService.isFocused?fw.selectionBackgroundOpaque:fw.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else cw=(this._coreBrowserService.isFocused?fw.selectionBackgroundOpaque:fw.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(uw=!0,fw.selectionForeground&&(sw=fw.selectionForeground.rgba>>8&16777215,lw=!0),jS(e.getCode())){if(this.result.fg&67108864&&!(this.result.bg&50331648))sw=(this._coreBrowserService.isFocused?fw.selectionBackgroundOpaque:fw.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:sw=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:sw=(this.result.bg&16777215)<<8|255}else switch(this.result.fg&50331648){case 16777216:case 33554432:sw=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:sw=(this.result.fg&16777215)<<8|255;break;default:sw=this._themeService.colors.foreground.rgba}sw=ow.blend(sw,(this._coreBrowserService.isFocused?fw.selectionBackgroundOpaque:fw.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}lw=!0}}this._decorationService.forEachDecorationAtCell(t,n,`top`,e=>{e.backgroundColorRGB&&(cw=e.backgroundColorRGB.rgba>>8&16777215,uw=!0),e.foregroundColorRGB&&(sw=e.foregroundColorRGB.rgba>>8&16777215,lw=!0)}),uw&&(cw=dw?e.bg&-150994944|cw|50331648:e.bg&-16777216|cw|50331648),lw&&(sw=e.fg&-83886080|sw|50331648),this.result.fg&67108864&&(uw&&!lw&&(sw=this.result.bg&50331648?this.result.fg&-134217728|this.result.bg&67108863:this.result.fg&-134217728|fw.background.rgba>>8&16777215|50331648,lw=!0),!uw&&lw&&(cw=this.result.fg&50331648?this.result.bg&-67108864|this.result.fg&67108863:this.result.bg&-67108864|fw.foreground.rgba>>8&16777215|50331648,uw=!0)),fw=void 0,this.result.bg=uw?cw:this.result.bg,this.result.fg=lw?sw:this.result.fg,this.result.ext&=536870911,this.result.ext|=pw<<29&3758096384}},hw=.5,gw=qC||JC?`bottom`:`ideographic`,_w={"▀":[{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}]},vw={"░":[[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]]},yw={"─":{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`}},bw={"":{d:`M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655`,type:0},"":{d:`M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5`,type:0},"":{d:`M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82`,type:0},"":{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}},bw[``]=bw[``],bw[``]=bw[``],xw=new Map,Sw={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])},Cw=class{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={}}},ww=class{constructor(){this._data=new Cw}set(e,t,n,r,i){this._data.get(e,t)||this._data.set(e,t,new Cw),this._data.get(e,t).set(n,r,i)}get(e,t,n,r){return this._data.get(e,t)?.get(n,r)}clear(){this._data.clear()}},Tw=class{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=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},Ew=class extends Tw{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},Dw=class extends Tw{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Ow=!WC&&`requestIdleCallback`in window?Dw:Ew,kw=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Aw}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Aw=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},jw=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}},jw.Undefined=new jw(void 0),Mw=globalThis.performance&&typeof globalThis.performance.now==`function`,Nw=class e{static create(t){return new e(t)}constructor(e){this._now=Mw&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},Pw=!1,Fw=!1,Iw=!1,(e=>{e.None=()=>HC.None;function t(e){if(Iw){let{onDidAddListener:t}=e,n=Uw.create(),r=0;e.onDidAddListener=()=>{++r===2&&(console.warn(`snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here`),n.print()),t?.()}}}function n(e,t){return f(e,()=>{},0,void 0,!0,void 0,t)}e.defer=n;function r(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=r;function i(e,t,n){return u((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=i;function a(e,t,n){return u((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=a;function o(e,t,n){return u((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=o;function s(e){return e}e.signal=s;function c(...e){return(t,n=null,r)=>d(TS(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=c;function l(e,t,n,r){let a=n;return i(e,e=>(a=t(a,e),a),r)}e.reduce=l;function u(e,n){let r,i={onWillAddFirstListener(){r=e(a.fire,a)},onDidRemoveLastListener(){r?.dispose()}};n||t(i);let a=new Zw(i);return n?.add(a),a.event}function d(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function f(e,n,r=100,i=!1,a=!1,o,s){let c,l,u,d=0,f,p={leakWarningThreshold:o,onWillAddFirstListener(){c=e(e=>{d++,l=n(l,e),i&&!u&&(m.fire(l),l=void 0),f=()=>{let e=l;l=void 0,u=void 0,(!i||d>1)&&m.fire(e),d=0},typeof r==`number`?(clearTimeout(u),u=setTimeout(f,r)):u===void 0&&(u=0,queueMicrotask(f))})},onWillRemoveListener(){a&&d>0&&f?.()},onDidRemoveLastListener(){f=void 0,c.dispose()}};s||t(p);let m=new Zw(p);return s?.add(m),m.event}e.debounce=f;function p(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=p;function m(e,t=(e,t)=>e===t,n){let r=!0,i;return o(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=m;function h(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=h;function g(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new Zw({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=g;function _(e,t){return(n,r,i)=>{let a=t(new y);return e(function(e){let t=a.evaluate(e);t!==v&&n.call(r,t)},void 0,i)}}e.chain=_;let v=Symbol(`HaltChainable`);class y{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:v),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:v}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===v)break;return e}}function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Zw({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=b;function x(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Zw({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=x;function S(e){return new Promise(t=>r(e)(t))}e.toPromise=S;function C(e){let t=new Zw;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=C;function w(e,t){return e(e=>t.fire(e))}e.forward=w;function T(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=T;class E{constructor(e,n){this._observable=e,this._counter=0,this._hasChanged=!1;let r={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};n||t(r),this.emitter=new Zw(r),n&&n.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function D(e,t){return new E(e,t).emitter.event}e.fromObservable=D;function O(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof VC?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=O})(Lw||={}),Rw=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new Nw,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}},Rw.all=new Set,Rw._idPool=0,zw=Rw,Bw=-1,Vw=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new Ww(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}},Vw._idPool=1,Hw=Vw,Uw=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
142
|
+
`).slice(2).join(`
|
|
143
|
+
`))}},Ww=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},Gw=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},Kw=0,qw=class{constructor(e){this.value=e,this.id=Kw++}},Jw=2,Yw=(e,t)=>{if(e instanceof qw)t(e);else for(let n=0;n<e.length;n++){let r=e[n];r&&t(r)}},Pw){let e=[];setInterval(()=>{e.length!==0&&(console.warn(`[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:`),console.warn(e.join(`
|
|
144
|
+
`)),e.length=0)},3e3),Xw=new FinalizationRegistry(t=>{typeof t==`string`&&e.push(t)})}if(Zw=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Bw>0||this._options?.leakWarningThreshold?new Hw(e?.onListenerError??mS,this._options?.leakWarningThreshold??Bw):void 0,this._perfMon=this._options?._profName?new zw(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Fw){let e=this._listeners;queueMicrotask(()=>{Yw(e,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new Gw(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||mS)(n),HC.None}if(this._disposed)return HC.None;t&&(e=e.bind(t));let r=new qw(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Uw.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof qw?(this._deliveryQueue??=new Qw,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=ES(()=>{Xw?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof VC?n.add(a):Array.isArray(n)&&n.push(a),Xw){let e=Error().stack.split(`
|
|
145
|
+
`).slice(2,3).join(`
|
|
146
|
+
`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);Xw.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Jw<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||mS;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof qw)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},Qw=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},$w={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}},eT=2,nT=class e{constructor(e,t,n){this._document=e,this._config=t,this._unicodeService=n,this._didWarmUp=!1,this._cacheMap=new ww,this._cacheMapCombined=new ww,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new kw,this._textureSize=512,this._onAddTextureAtlasCanvas=new Zw,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Zw,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=US(e,this._config.deviceCellWidth*4+eT*2,this._config.deviceCellHeight+eT*2),this._tmpCtx=kS(this._tmpCanvas.getContext(`2d`,{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||=(this._doWarmUp(),!0)}_doWarmUp(){let e=new Ow;for(let t=33;t<126;t++)e.enqueue(()=>{if(!this._cacheMap.get(t,0,0,0)){let e=this._drawToCache(t,0,0,0,!1,void 0);this._cacheMap.set(t,0,0,0,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(e.maxAtlasPages&&this._pages.length>=Math.max(4,e.maxAtlasPages)){let t=this._pages.filter(t=>t.canvas.width*2<=(e.maxTextureSize||4096)).sort((e,t)=>t.canvas.width===e.canvas.width?t.percentageUsed-e.percentageUsed:t.canvas.width-e.canvas.width),n=-1,r=0;for(let e=0;e<t.length;e++)if(t[e].canvas.width!==r)n=e,r=t[e].canvas.width;else if(e-n===3)break;let i=t.slice(n,n+4),a=i.map(e=>e.glyphs[0].texturePage).sort((e,t)=>e>t?1:-1),o=this.pages.length-i.length,s=this._mergePages(i,o);s.version++;for(let e=a.length-1;e>=0;e--)this._deletePage(a[e]);this.pages.push(s),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(s.canvas)}let t=new rT(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(e,t){let n=e[0].canvas.width*2,r=new rT(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,a){return this._getFromCacheMap(this._cacheMapCombined,e,t,n,r,i,a)}getRasterizedGlyph(e,t,n,r,i,a){return this._getFromCacheMap(this._cacheMap,e,t,n,r,i,a)}_getFromCacheMap(e,t,n,r,i,a,o){return tT=e.get(t,n,r,i),tT||(tT=this._drawToCache(t,n,r,i,a,o),e.set(t,n,r,i,tT)),tT}_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 tw;let i;switch(e){case 16777216:case 33554432:i=this._getColorFromAnsiIndex(t);break;case 50331648:let e=kw.toColorRGB(t);i=nw.toColor(e[0],e[1],e[2]);break;default:i=n?rw.opaque(this._config.colors.foreground):this._config.colors.background}return this._config.allowTransparency||(i=rw.opaque(i)),i}_getForegroundColor(e,t,n,r,i,a,o,s,c,l){let u=this._getMinimumContrastColor(e,t,n,r,i,a,o,c,s,l);if(u)return u;let d;switch(i){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&c&&a<8&&(a+=8),d=this._getColorFromAnsiIndex(a);break;case 50331648:let e=kw.toColorRGB(a);d=nw.toColor(e[0],e[1],e[2]);break;default:d=o?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(d=rw.opaque(d)),s&&(d=rw.multiplyOpacity(d,hw)),d}_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,o,s,c,l){if(this._config.minimumContrastRatio===1||l)return;let u=this._getContrastCache(c),d=u.getColor(e,r);if(d!==void 0)return d||void 0;let f=this._resolveBackgroundRgba(t,n,o),p=this._resolveForegroundRgba(i,a,o,s),m=ow.ensureContrastRatio(f,p,this._config.minimumContrastRatio/(c?2:1));if(!m){u.setColor(e,r,null);return}let h=nw.toColor(m>>24&255,m>>16&255,m>>8&255);return u.setColor(e,r,h),h}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,n,r,i,a,o){let s=typeof t==`number`?String.fromCharCode(t):t;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display=`none`,o.append(this._tmpCanvas));let c=Math.min(this._config.deviceCellWidth*Math.max(s.length,2)+eT*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<c&&(this._tmpCanvas.width=c);let l=Math.min(this._config.deviceCellHeight+eT*4,this._textureSize);if(this._tmpCanvas.height<l&&(this._tmpCanvas.height=l),this._tmpCtx.save(),this._workAttributeData.fg=r,this._workAttributeData.bg=n,this._workAttributeData.extended.ext=i,this._workAttributeData.isInvisible())return $w;let u=!!this._workAttributeData.isBold(),d=!!this._workAttributeData.isInverse(),f=!!this._workAttributeData.isDim(),p=!!this._workAttributeData.isItalic(),m=!!this._workAttributeData.isUnderline(),h=!!this._workAttributeData.isStrikethrough(),g=!!this._workAttributeData.isOverline(),_=this._workAttributeData.getFgColor(),v=this._workAttributeData.getFgColorMode(),y=this._workAttributeData.getBgColor(),b=this._workAttributeData.getBgColorMode();if(d){let e=_;_=y,y=e;let t=v;v=b,b=t}let x=this._getBackgroundColor(b,y,d,f);this._tmpCtx.globalCompositeOperation=`copy`,this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation=`source-over`;let S=u?this._config.fontWeightBold:this._config.fontWeight,C=p?`italic`:``;this._tmpCtx.font=`${C} ${S} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=gw;let w=s.length===1&&AS(s.charCodeAt(0)),T=s.length===1&&fee(s.charCodeAt(0)),E=this._getForegroundColor(n,b,y,r,v,_,d,f,u,jS(s.charCodeAt(0)));this._tmpCtx.fillStyle=E.css;let D=T?0:eT*2,O=!1;this._config.customGlyphs!==!1&&(O=PS(this._tmpCtx,s,D,D,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let k=!w,ee;if(ee=typeof t==`number`?this._unicodeService.wcwidth(t):this._unicodeService.getStringCellWidth(t),m){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())k=!1,this._tmpCtx.strokeStyle=`rgb(${kw.toColorRGB(this._workAttributeData.getUnderlineColor()).join(`,`)})`;else{k=!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=D,r=Math.ceil(D+this._config.deviceCharHeight)-t-(a?e*2:0),i=r+e,o=r+e*2,c=this._workAttributeData.getUnderlineVariantOffset();for(let a=0;a<ee;a++){this._tmpCtx.save();let s=n+a*this._config.deviceCellWidth,l=n+(a+1)*this._config.deviceCellWidth,u=s+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(l,r),this._tmpCtx.moveTo(s,o),this._tmpCtx.lineTo(l,o);break;case 3:let n=e<=1?o:Math.ceil(D+this._config.deviceCharHeight-e/2)-t,a=e<=1?r:Math.ceil(D+this._config.deviceCharHeight+e/2)-t,d=new Path2D;d.rect(s,r,this._config.deviceCellWidth,o-r),this._tmpCtx.clip(d),this._tmpCtx.moveTo(s-this._config.deviceCellWidth/2,i),this._tmpCtx.bezierCurveTo(s-this._config.deviceCellWidth/2,a,s,a,s,i),this._tmpCtx.bezierCurveTo(s,n,u,n,u,i),this._tmpCtx.bezierCurveTo(u,a,l,a,l,i),this._tmpCtx.bezierCurveTo(l,n,l+this._config.deviceCellWidth/2,n,l+this._config.deviceCellWidth/2,i);break;case 4:let f=c===0?0:c>=e?e*2-c:e-c;c>=e||f===0?(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(s+f,r),this._tmpCtx.lineTo(l,r)):(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(s+f,r),this._tmpCtx.moveTo(s+f+e,r),this._tmpCtx.lineTo(l,r)),c=NS(l-s,e,c);break;case 5:let p=l-s,m=Math.floor(.6*p),h=Math.floor(.3*p),g=p-m-h;this._tmpCtx.setLineDash([m,h,g]),this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(l,r);break;default:this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(l,r)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!O&&this._config.fontSize>=12&&!this._config.allowTransparency&&s!==` `){this._tmpCtx.save(),this._tmpCtx.textBaseline=`alphabetic`;let t=this._tmpCtx.measureText(s);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*ee,o-r+Math.ceil(e/2)),this._tmpCtx.clip(t),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=x.css,this._tmpCtx.strokeText(s,D,D+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(g){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(D,D+t),this._tmpCtx.lineTo(D+this._config.deviceCharWidth*ee,D+t),this._tmpCtx.stroke()}if(O||this._tmpCtx.fillText(s,D,D+this._config.deviceCharHeight),s===`_`&&!this._config.allowTransparency){let e=VS(this._tmpCtx.getImageData(D,D,this._config.deviceCellWidth,this._config.deviceCellHeight),x,E,k);if(e)for(let t=1;t<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(s,D,D+this._config.deviceCharHeight-t),e=VS(this._tmpCtx.getImageData(D,D,this._config.deviceCellWidth,this._config.deviceCellHeight),x,E,k),e);t++);}if(h){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(D,D+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.lineTo(D+this._config.deviceCharWidth*ee,D+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.stroke()}this._tmpCtx.restore();let A=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),j;if(j=this._config.allowTransparency?HS(A):VS(A,x,E,k),j)return $w;let M=this._findGlyphBoundingBox(A,this._workBoundingBox,c,T,O,D),N,P;for(;;){if(this._activePages.length===0){let e=this._createNewPage();N=e,P=e.currentRow,P.height=M.size.y;break}N=this._activePages[this._activePages.length-1],P=N.currentRow;for(let e of this._activePages)M.size.y<=e.currentRow.height&&(N=e,P=e.currentRow);for(let e=this._activePages.length-1;e>=0;e--)for(let t of this._activePages[e].fixedRows)t.height<=P.height&&M.size.y<=t.height&&(N=this._activePages[e],P=t);if(M.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new rT(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),N=this._overflowSizePage,P=this._overflowSizePage.currentRow,P.x+M.size.x>=N.canvas.width&&(P.x=0,P.y+=P.height,P.height=0);break}if(P.y+M.size.y>=N.canvas.height||P.height>M.size.y+2){let t=!1;if(N.currentRow.y+N.currentRow.height+M.size.y>=N.canvas.height){let n;for(let e of this._activePages)if(e.currentRow.y+e.currentRow.height+M.size.y<e.canvas.height){n=e;break}if(n)N=n;else if(e.maxAtlasPages&&this._pages.length>=e.maxAtlasPages&&P.y+M.size.y<=N.canvas.height&&P.height>=M.size.y&&P.x+M.size.x<=N.canvas.width)t=!0;else{let e=this._createNewPage();N=e,P=e.currentRow,P.height=M.size.y,t=!0}}t||(N.currentRow.height>0&&N.fixedRows.push(N.currentRow),P={x:0,y:N.currentRow.y+N.currentRow.height,height:M.size.y},N.fixedRows.push(P),N.currentRow={x:0,y:P.y+P.height,height:0})}if(P.x+M.size.x<=N.canvas.width)break;P===N.currentRow?(P.x=0,P.y+=P.height,P.height=0):N.fixedRows.splice(N.fixedRows.indexOf(P),1)}return M.texturePage=this._pages.indexOf(N),M.texturePosition.x=P.x,M.texturePosition.y=P.y,M.texturePositionClipSpace.x=P.x/N.canvas.width,M.texturePositionClipSpace.y=P.y/N.canvas.height,M.sizeClipSpace.x/=N.canvas.width,M.sizeClipSpace.y/=N.canvas.height,P.height=Math.max(P.height,M.size.y),P.x+=M.size.x,N.ctx.putImageData(A,M.texturePosition.x-this._workBoundingBox.left,M.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,M.size.x,M.size.y),N.addGlyph(M),N.version++,M}_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+r*4+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+n*4+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+n*4+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+r*4+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)}}}},rT=class{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=US(e,t,t),this.ctx=kS(this.canvas.getContext(`2d`,{alpha:!0}))}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}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++}},iT=[],aT=600,oT=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=aT){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=aT-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0){this._restartInterval(e);return}}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=aT-(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})},aT)},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()}},sT=class e extends kw{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Aw,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?XS(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},cT=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),lT=class{constructor(e){this.texture=e,this.version=-1}},uT=`#version 300 es
|
|
147
|
+
layout (location = 0) in vec2 a_unitquad;
|
|
148
|
+
layout (location = 1) in vec2 a_cellpos;
|
|
149
|
+
layout (location = 2) in vec2 a_offset;
|
|
150
|
+
layout (location = 3) in vec2 a_size;
|
|
151
|
+
layout (location = 4) in float a_texpage;
|
|
152
|
+
layout (location = 5) in vec2 a_texcoord;
|
|
153
|
+
layout (location = 6) in vec2 a_texsize;
|
|
154
|
+
|
|
155
|
+
uniform mat4 u_projection;
|
|
156
|
+
uniform vec2 u_resolution;
|
|
157
|
+
|
|
158
|
+
out vec2 v_texcoord;
|
|
159
|
+
flat out int v_texpage;
|
|
160
|
+
|
|
161
|
+
void main() {
|
|
162
|
+
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
163
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
164
|
+
v_texpage = int(a_texpage);
|
|
165
|
+
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
166
|
+
}`,dT=11,fT=dT*Float32Array.BYTES_PER_ELEMENT,pT=2,mT=0,gT=0,_T=0,vT=class extends HC{constructor(e,t,n,r){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._optionsService=r,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array,attributesBuffers:[new Float32Array,new Float32Array]};let i=this._gl;nT.maxAtlasPages===void 0&&(nT.maxAtlasPages=Math.min(32,kS(i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS))),nT.maxTextureSize=kS(i.getParameter(i.MAX_TEXTURE_SIZE))),this._program=kS(ZS(i,uT,eC(nT.maxAtlasPages))),this._register(ES(()=>i.deleteProgram(this._program))),this._projectionLocation=kS(i.getUniformLocation(this._program,`u_projection`)),this._resolutionLocation=kS(i.getUniformLocation(this._program,`u_resolution`)),this._textureLocation=kS(i.getUniformLocation(this._program,`u_texture`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(ES(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(ES(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=kS(i.createBuffer()),this._register(ES(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,2,i.FLOAT,!1,fT,0),i.vertexAttribDivisor(2,1),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,i.FLOAT,!1,fT,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(3,1),i.enableVertexAttribArray(4),i.vertexAttribPointer(4,1,i.FLOAT,!1,fT,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(4,1),i.enableVertexAttribArray(5),i.vertexAttribPointer(5,2,i.FLOAT,!1,fT,5*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(5,1),i.enableVertexAttribArray(6),i.vertexAttribPointer(6,2,i.FLOAT,!1,fT,7*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(6,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,fT,9*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.useProgram(this._program);let l=new Int32Array(nT.maxAtlasPages);for(let e=0;e<nT.maxAtlasPages;e++)l[e]=e;i.uniform1iv(this._textureLocation,l),i.uniformMatrix4fv(this._projectionLocation,!1,cT),this._atlasTextures=[];for(let e=0;e<nT.maxAtlasPages;e++){let t=new lT(kS(i.createTexture()));this._register(ES(()=>i.deleteTexture(t.texture))),i.activeTexture(i.TEXTURE0+e),i.bindTexture(i.TEXTURE_2D,t.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[e]=t}i.enable(i.BLEND),i.blendFunc(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(e,t,n,r,i,a,o,s,c){this._updateCell(this._vertices.attributes,e,t,n,r,i,a,o,s,c)}_updateCell(e,t,n,r,i,a,o,s,c,l){if(mT=(n*this._terminal.cols+t)*dT,r===0||r===void 0){e.fill(0,mT,mT+dT-1-pT);return}this._atlas&&(hT=s&&s.length>1?this._atlas.getRasterizedGlyphCombinedChar(s,i,a,o,!1,this._terminal.element):this._atlas.getRasterizedGlyph(r,i,a,o,!1,this._terminal.element),gT=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),i!==l&&hT.offset.x>gT?(_T=hT.offset.x-gT,e[mT]=-(hT.offset.x-_T)+this._dimensions.device.char.left,e[mT+1]=-hT.offset.y+this._dimensions.device.char.top,e[mT+2]=(hT.size.x-_T)/this._dimensions.device.canvas.width,e[mT+3]=hT.size.y/this._dimensions.device.canvas.height,e[mT+4]=hT.texturePage,e[mT+5]=hT.texturePositionClipSpace.x+_T/this._atlas.pages[hT.texturePage].canvas.width,e[mT+6]=hT.texturePositionClipSpace.y,e[mT+7]=hT.sizeClipSpace.x-_T/this._atlas.pages[hT.texturePage].canvas.width,e[mT+8]=hT.sizeClipSpace.y):(e[mT]=-hT.offset.x+this._dimensions.device.char.left,e[mT+1]=-hT.offset.y+this._dimensions.device.char.top,e[mT+2]=hT.size.x/this._dimensions.device.canvas.width,e[mT+3]=hT.size.y/this._dimensions.device.canvas.height,e[mT+4]=hT.texturePage,e[mT+5]=hT.texturePositionClipSpace.x,e[mT+6]=hT.texturePositionClipSpace.y,e[mT+7]=hT.sizeClipSpace.x,e[mT+8]=hT.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&gee(r,c,hT.size.x,this._dimensions.device.cell.width)&&(e[mT+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*dT;this._vertices.count===t?this._vertices.attributes.fill(0):this._vertices.attributes=new Float32Array(t);let n=0;for(;n<this._vertices.attributesBuffers.length;n++)this._vertices.count===t?this._vertices.attributesBuffers[n].fill(0):this._vertices.attributesBuffers[n]=new Float32Array(t);this._vertices.count=t,n=0;for(let t=0;t<e.rows;t++)for(let r=0;r<e.cols;r++)this._vertices.attributes[n+9]=r/e.cols,this._vertices.attributes[n+10]=t/e.rows,n+=dT}handleResize(){let e=this._gl;e.useProgram(this._program),e.viewport(0,0,e.canvas.width,e.canvas.height),e.uniform2f(this._resolutionLocation,e.canvas.width,e.canvas.height),this.clear()}render(e){if(!this._atlas)return;let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let n=this._vertices.attributesBuffers[this._activeBuffer],r=0;for(let t=0;t<e.lineLengths.length;t++){let i=t*this._terminal.cols*dT,a=this._vertices.attributes.subarray(i,i+e.lineLengths[t]*dT);n.set(a,r),r+=a.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,n.subarray(0,r),t.STREAM_DRAW);for(let e=0;e<this._atlas.pages.length;e++)this._atlas.pages[e].version!==this._atlasTextures[e].version&&this._bindAtlasPageTexture(t,this._atlas,e);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,r/dT)}setAtlas(e){this._atlas=e;for(let e of this._atlasTextures)e.version=-1}_bindAtlasPageTexture(e,t,n){e.activeTexture(e.TEXTURE0+n),e.bindTexture(e.TEXTURE_2D,this._atlasTextures[n].texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t.pages[n].canvas),e.generateMipmap(e.TEXTURE_2D),this._atlasTextures[n].version=t.pages[n].version}setDimensions(e){this._dimensions=e}},yT=class{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]){this.clear();return}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);if(s>=e.rows||c<0){this.clear();return}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):!1}},bT=4,xT=1,ST=2,CT=3,wT=2147483648,TT=class{constructor(){this.cells=new Uint32Array,this.lineLengths=new Uint32Array,this.selection=tC()}resize(e,t){let n=e*t*bT;n!==this.cells.length&&(this.cells=new Uint32Array(n),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},ET=`#version 300 es
|
|
167
|
+
layout (location = 0) in vec2 a_position;
|
|
168
|
+
layout (location = 1) in vec2 a_size;
|
|
169
|
+
layout (location = 2) in vec4 a_color;
|
|
170
|
+
layout (location = 3) in vec2 a_unitquad;
|
|
171
|
+
|
|
172
|
+
uniform mat4 u_projection;
|
|
173
|
+
|
|
174
|
+
out vec4 v_color;
|
|
175
|
+
|
|
176
|
+
void main() {
|
|
177
|
+
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
178
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
179
|
+
v_color = a_color;
|
|
180
|
+
}`,DT=`#version 300 es
|
|
181
|
+
precision lowp float;
|
|
182
|
+
|
|
183
|
+
in vec4 v_color;
|
|
184
|
+
|
|
185
|
+
out vec4 outColor;
|
|
186
|
+
|
|
187
|
+
void main() {
|
|
188
|
+
outColor = v_color;
|
|
189
|
+
}`,OT=8,kT=OT*Float32Array.BYTES_PER_ELEMENT,AT=20*OT,jT=class{constructor(){this.attributes=new Float32Array(AT),this.count=0}},MT=0,NT=0,PT=0,FT=0,IT=0,LT=0,RT=0,zT=class extends HC{constructor(e,t,n,r){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=r,this._vertices=new jT,this._verticesCursor=new jT;let i=this._gl;this._program=kS(ZS(i,ET,DT)),this._register(ES(()=>i.deleteProgram(this._program))),this._projectionLocation=kS(i.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(ES(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(ES(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=kS(i.createBuffer()),this._register(ES(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,i.FLOAT,!1,kT,0),i.vertexAttribDivisor(0,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,kT,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,4,i.FLOAT,!1,kT,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(2,1),this._updateCachedColors(r.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,cT),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=1,i,a,o,s,c,l,u,d,f,p,m;for(i=0;i<t.rows;i++){for(o=-1,s=0,c=0,l=!1,a=0;a<t.cols;a++)u=(i*t.cols+a)*bT,d=e.cells[u+xT],f=e.cells[u+ST],p=!!(f&67108864),(d!==s||f!==c&&(l||p))&&((s!==0||l&&c!==0)&&(m=r++*OT,this._updateRectangle(n,m,c,s,o,a,i)),o=a,s=d,c=f,l=p);(s!==0||l&&c!==0)&&(m=r++*OT,this._updateRectangle(n,m,c,s,o,t.cols,i))}n.count=r}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style===`block`){t.count=0;return}let r,i=0;(n.style===`bar`||n.style===`outline`)&&(r=i++*OT,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=i++*OT,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=i++*OT,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=i++*OT,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,o){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:MT=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:MT=(n&16777215)<<8;break;default:MT=this._themeService.colors.foreground.rgba}else switch(r&50331648){case 16777216:case 33554432:MT=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:MT=(r&16777215)<<8;break;default:MT=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=$S(e.attributes,this._terminal.rows*this._terminal.cols*OT)),NT=i*this._dimensions.device.cell.width,PT=o*this._dimensions.device.cell.height,FT=(MT>>24&255)/255,IT=(MT>>16&255)/255,LT=(MT>>8&255)/255,RT=1,this._addRectangle(e.attributes,t,NT,PT,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,FT,IT,LT,RT)}_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,(e.rgba&255)/255])}},BT=class extends HC{constructor(e,t,n,r,i,a,o,s){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=o,this._themeService=s,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(ES(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=kS(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=qS(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),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=gw,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){let r=t?e.options.fontWeightBold:e.options.fontWeight;return`${n?`italic`:``} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},VT=class extends BT{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===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&KS(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()}},HT=typeof window==`object`?window:globalThis,UT=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Zw,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Zw,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}},UT.INSTANCE=new UT,WT=UT,WT.INSTANCE.onDidChangeZoomLevel,WT.INSTANCE.onDidChangeFullscreen,GT=typeof navigator==`object`?navigator.userAgent:``,GT.indexOf(`Firefox`),KT=GT.indexOf(`AppleWebKit`)>=0,!(GT.indexOf(`Chrome`)>=0)&>.indexOf(`Safari`),GT.indexOf(`Electron/`),GT.indexOf(`Android`),qT=!1,typeof HT.matchMedia==`function`){let e=HT.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=HT.matchMedia(`(display-mode: fullscreen)`);qT=e.matches,nC(HT,e,({matches:e})=>{qT&&t.matches||(qT=e)})}if(JT=`en`,YT=!1,XT=!1,ZT=!1,QT=JT,eE=globalThis,typeof eE.vscode<`u`&&typeof eE.vscode.process<`u`?tE=eE.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(tE=process),nE=typeof tE?.versions?.electron==`string`&&tE?.type===`renderer`,typeof tE==`object`){tE.platform,tE.platform,YT=tE.platform===`linux`,YT&&tE.env.SNAP&&tE.env.SNAP_REVISION,tE.env.CI||tE.env.BUILD_ARTIFACTSTAGINGDIRECTORY,QT=JT;let e=tE.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,QT=t.resolvedLanguage||JT,t.languagePack?.translationsConfigFile}catch{}XT=!0}else typeof navigator==`object`&&!nE?($T=navigator.userAgent,$T.indexOf(`Windows`),$T.indexOf(`Macintosh`),($T.indexOf(`Macintosh`)>=0||$T.indexOf(`iPad`)>=0||$T.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,YT=$T.indexOf(`Linux`)>=0,$T?.indexOf(`Mobi`),ZT=!0,QT=globalThis._VSCODE_NLS_LANGUAGE||JT,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);rE=XT,ZT&&typeof eE.importScripts==`function`&&eE.origin,iE=$T,aE=QT,(e=>{function t(){return aE}e.value=t;function n(){return aE.length===2?aE===`en`:aE.length>=3&&aE[0]===`e`&&aE[1]===`n`&&aE[2]===`-`}e.isDefaultVariant=n;function r(){return aE===`en`}e.isDefault=r})(oE||={}),sE=typeof eE.postMessage==`function`&&!eE.importScripts,(()=>{if(sE){let e=[];eE.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),eE.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})(),cE=!!(iE&&iE.indexOf(`Chrome`)>=0),iE&&iE.indexOf(`Firefox`),!cE&&iE&&iE.indexOf(`Safari`),iE&&iE.indexOf(`Edg/`),iE&&iE.indexOf(`Android`),lE=typeof navigator==`object`?navigator:{},rE||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||lE&&lE.clipboard&&lE.clipboard.writeText,rE||lE&&lE.clipboard&&lE.clipboard.readText,rE||rC()||lE.keyboard,`ontouchstart`in HT||lE.maxTouchPoints,HT.PointerEvent&&(`ontouchstart`in HT||navigator.maxTouchPoints),uE=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},dE=new uE,fE=new uE,pE=new uE,Array(230),(e=>{function t(e){return dE.keyCodeToStr(e)}e.toString=t;function n(e){return dE.strToKeyCode(e)}e.fromString=n;function r(e){return fE.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return pE.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return fE.strToKeyCode(e)||pE.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return dE.keyCodeToStr(e)}e.toElectronAccelerator=o})(mE||={}),hE=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof _E?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Lw.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:hE})})(gE||={}),_E=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?hE:(this._emitter||=new Zw,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})(),(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(vee||={}),vE=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Zw,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Lw.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}},vE.EMPTY=vE.fromArray([]),yE=class e{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){let t=e.length;if(t===0)return;let n=this._buff,r=this._buffLen,i=this._leftoverHighSurrogate,a,o;for(i===0?(a=e.charCodeAt(0),o=0):(a=i,o=-1,i=0);;){let s=a;if(iC(a)){if(o+1<t){let t=e.charCodeAt(o+1);aC(t)?(o++,s=oC(a,t)):s=65533}else{i=a;break}}else aC(a)&&(s=65533);if(r=this._push(n,r,s),o++,o<t)a=e.charCodeAt(o);else break}this._buffLen=r,this._leftoverHighSurrogate=i}_push(e,t,n){return n<128?e[t++]=n:n<2048?(e[t++]=192|(n&1984)>>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),_C(this._h0)+_C(this._h1)+_C(this._h2)+_C(this._h3)+_C(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,hC(this._buff,this._buffLen),this._buffLen>56&&(this._step(),hC(this._buff));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let t=e._bigBlock32,n=this._buffDV;for(let e=0;e<64;e+=4)t.setUint32(e,n.getUint32(e,!1),!1);for(let e=64;e<320;e+=4)t.setUint32(e,mC(t.getUint32(e-12,!1)^t.getUint32(e-32,!1)^t.getUint32(e-56,!1)^t.getUint32(e-64,!1),1),!1);let r=this._h0,i=this._h1,a=this._h2,o=this._h3,s=this._h4,c,l,u;for(let e=0;e<80;e++)e<20?(c=i&a|~i&o,l=1518500249):e<40?(c=i^a^o,l=1859775393):e<60?(c=i&a|i&o|a&o,l=2400959708):(c=i^a^o,l=3395469782),u=mC(r,5)+c+s+l+t.getUint32(e*4,!1)&4294967295,s=o,o=a,a=mC(i,30),i=r,r=u;this._h0=this._h0+r&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+a&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+s&4294967295}},yE._bigBlock32=new DataView(new ArrayBuffer(320)),{registerWindow:yee,getWindow:bE,getDocument:bee,getWindows:xee,getWindowsCount:See,getWindowId:Cee,getWindowById:wee,hasWindow:Tee,onDidRegisterWindow:Eee,onWillUnregisterWindow:Dee,onDidUnregisterWindow:Oee}=function(){let e=new Map,t={window:HT,disposables:new VC};e.set(HT.vscodeWindowId,t);let n=new Zw,r=new Zw,i=new Zw;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return HC.None;let a=new VC,o={window:t,disposables:a.add(new VC)};return e.set(t.vscodeWindowId,o),a.add(ES(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(vC(t,CE.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:HT},getDocument(e){return bE(e).document}}}(),xE=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}},SE=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}},SE.None=new SE(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=sC(n),a=r.get(i);if(a)a.users+=1;else{let o=new Zw,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(ES(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}},CE={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:KT?`webkitAnimationStart`:`animationstart`,ANIMATION_END:KT?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:KT?`webkitAnimationIteration`:`animationiteration`},wE=class extends HC{constructor(e,t,n,r,i,a,o,s,c){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._optionsService=o,this._themeService=s,this._cursorBlinkStateManager=new UC,this._charAtlasDisposable=this._register(new UC),this._observerDisposable=this._register(new UC),this._model=new TT,this._workCell=new sT,this._workCell2=new sT,this._rectangleRenderer=this._register(new UC),this._glyphRenderer=this._register(new UC),this._onChangeTextureAtlas=this._register(new Zw),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Zw),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Zw),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Zw),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Zw),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let l={antialias:!1,depth:!1,preserveDrawingBuffer:c};if(this._gl=this._canvas.getContext(`webgl2`,l),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new mw(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new VT(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=_ee(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(vC(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(vC(this._canvas,`webglcontextrestored`,e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,JS(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=YS(this._canvas,this._coreBrowserService.window,(e,t)=>this._setCanvasDevicePixelDimensions(e,t)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=YS(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._core.screenElement.isConnected,this._register(ES(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),JS(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 zT(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new vT(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){this._isAttached=!1;return}let e=qS(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._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=TS(Lw.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Lw.forward(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()}renderRows(e,t){if(!this._isAttached){if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return}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._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new oT(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r=this._workCell,i,a,o,s,c,l,u=0,d=!0,f,p,m,h,g,_,v,y,b;e=yC(e,n.rows-1,0),t=yC(t,n.rows-1,0);let x=this._coreService.decPrivateModes.cursorStyle??n.options.cursorStyle??`block`,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(a=e;a<=t;a++)for(o=a+n.buffer.ydisp,s=n.buffer.lines.get(o),this._model.lineLengths[a]=0,m=S===o,u=0,c=this._characterJoinerService.getJoinedCharacters(o),y=0;y<n.cols;y++){if(i=this._cellColorResolver.result.bg,s.loadCell(y,r),y===0&&(i=this._cellColorResolver.result.bg),l=!1,d=y>=u,f=y,c.length>0&&y===c[0][0]&&d){p=c.shift();let e=this._model.selection.isCellSelected(this._terminal,p[0],o);for(v=p[0]+1;v<p[1];v++)d&&=e===this._model.selection.isCellSelected(this._terminal,v,o);d&&=!m||w<p[0]||w>=p[1],d?(l=!0,r=new TE(r,s.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1):u=p[1]}if(h=r.getChars(),g=r.getCode(),v=(a*n.cols+y)*bT,this._cellColorResolver.resolve(r,y,o,this.dimensions.device.cell.width),E&&o===S&&(y===w&&(this._model.cursor={x:w,y:C,width:r.getWidth(),style:this._coreBrowserService.isFocused?x:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},T=w+r.getWidth()-1),y>=w&&y<=T&&(this._coreBrowserService.isFocused&&x===`block`||this._coreBrowserService.isFocused===!1&&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)),g!==0&&(this._model.lineLengths[a]=y+1),(this._model.cells[v]!==g||this._model.cells[v+xT]!==this._cellColorResolver.result.bg||this._model.cells[v+ST]!==this._cellColorResolver.result.fg||this._model.cells[v+CT]!==this._cellColorResolver.result.ext)&&(D=!0,h.length>1&&(g|=wT),this._model.cells[v]=g,this._model.cells[v+xT]=this._cellColorResolver.result.bg,this._model.cells[v+ST]=this._cellColorResolver.result.fg,this._model.cells[v+CT]=this._cellColorResolver.result.ext,_=r.getWidth(),this._glyphRenderer.value.updateCell(y,a,g,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,h,_,i),l)){for(r=this._workCell,y++;y<=f;y++)b=(a*n.cols+y)*bT,this._glyphRenderer.value.updateCell(y,a,0,0,0,0,XC,0,0),this._model.cells[b]=0,this._model.cells[b+xT]=this._cellColorResolver.result.bg,this._model.cells[b+ST]=this._cellColorResolver.result.fg,this._model.cells[b+CT]=this._cellColorResolver.result.ext;y--}}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})}},TE=class extends kw{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()]}},EE=`di$target`,DE=`di$dependencies`,OE=new Map,bC(`BufferService`),bC(`CoreMouseService`),bC(`CoreService`),bC(`CharsetService`),bC(`InstantiationService`),bC(`LogService`),kE=bC(`OptionsService`),bC(`OscLinkService`),bC(`UnicodeService`),bC(`DecorationService`),AE={trace:0,debug:1,info:2,warn:3,error:4,off:5},jE=`xterm.js: `,ME=class extends HC{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=AE[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?``:jE)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}},ME=wC([TC(0,kE)],ME),NE=class extends HC{constructor(e){if(YC&&dee()<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 Zw),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Zw),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Zw),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Zw),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let n=t.coreService,r=t.optionsService,i=t,a=i._renderService,o=i._characterJoinerService,s=i._charSizeService,c=i._coreBrowserService,l=i._decorationService;i._logService;let u=i._themeService;this._renderer=this._register(new wE(e,o,s,c,n,l,r,u,this._preserveDrawingBuffer)),this._register(Lw.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Lw.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Lw.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Lw.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),a.setRenderer(this._renderer),this._register(ES(()=>{if(this._terminal._core._store._isDisposed)return;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()}}})),Aee=s(((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.CanvasAddon=r():n.CanvasAddon=r()})(self,(()=>(()=>{var e={903:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;let r=n(274),i=n(627),a=n(237),o=n(860),s=n(374),c=n(296),l=n(345),u=n(859),d=n(399),f=n(855);class p extends u.Disposable{get canvas(){return this._canvas}get cacheCanvas(){return this._charAtlas?.pages[0].canvas}constructor(e,t,n,i,a,o,s,d,f,p){super(),this._terminal=e,this._container=t,this._alpha=a,this._themeService=o,this._bufferService=s,this._optionsService=d,this._decorationService=f,this._coreBrowserService=p,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._selectionModel=(0,c.createSelectionRenderModel)(),this._bitmapGenerator=[],this._charAtlasDisposable=this.register(new u.MutableDisposable),this._onAddTextureAtlasCanvas=this.register(new l.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._cellColorResolver=new r.CellColorResolver(this._terminal,this._optionsService,this._selectionModel,this._decorationService,this._coreBrowserService,this._themeService),this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=i.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._refreshCharAtlas(this._themeService.colors),this.register(this._themeService.onChangeColors((e=>{this._refreshCharAtlas(e),this.reset(),this.handleSelectionChanged(this._selectionModel.selectionStart,this._selectionModel.selectionEnd,this._selectionModel.columnSelectMode)}))),this.register((0,u.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,s.throwIfFalsy)(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(){}handleFocus(){}handleCursorMove(){}handleGridChanged(e,t){}handleSelectionChanged(e,t,n=!1){this._selectionModel.update(this._terminal._core,e,t,n)}_setTransparency(e){if(e===this._alpha)return;let t=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,t),this._refreshCharAtlas(this._themeService.colors),this.handleGridChanged(0,this._bufferService.rows-1)}_refreshCharAtlas(e){if(!(this._deviceCharWidth<=0&&this._deviceCharHeight<=0)){this._charAtlas=(0,i.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlasDisposable.value=(0,l.forwardEvent)(this._charAtlas.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),this._charAtlas.warmUp();for(let e=0;e<this._charAtlas.pages.length;e++)this._bitmapGenerator[e]=new m(this._charAtlas.pages[e].canvas)}}resize(e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(this._themeService.colors)}clearTextureAtlas(){this._charAtlas?.clearTexture()}_fillCells(e,t,n,r){this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight)}_fillMiddleLineAtCells(e,t,n=1){let r=Math.ceil(.5*this._deviceCellHeight);this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-r-this._coreBrowserService.dpr,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_fillBottomLineAtCells(e,t,n=1,r=0){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight+r-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_curlyUnderlineAtCell(e,t,n=1){this._ctx.save(),this._ctx.beginPath(),this._ctx.strokeStyle=this._ctx.fillStyle;let r=this._coreBrowserService.dpr;this._ctx.lineWidth=r;for(let i=0;i<n;i++){let n=(e+i)*this._deviceCellWidth,a=(e+i+.5)*this._deviceCellWidth,o=(e+i+1)*this._deviceCellWidth,s=(t+1)*this._deviceCellHeight-r-1,c=s-r,l=s+r;this._ctx.moveTo(n,s),this._ctx.bezierCurveTo(n,c,a,c,a,s),this._ctx.bezierCurveTo(a,l,o,l,o,s)}this._ctx.stroke(),this._ctx.restore()}_dottedUnderlineAtCell(e,t,n=1){this._ctx.save(),this._ctx.beginPath(),this._ctx.strokeStyle=this._ctx.fillStyle;let r=this._coreBrowserService.dpr;this._ctx.lineWidth=r,this._ctx.setLineDash([2*r,r]);let i=e*this._deviceCellWidth,a=(t+1)*this._deviceCellHeight-r-1;this._ctx.moveTo(i,a);for(let t=0;t<n;t++){let r=(e+n+t)*this._deviceCellWidth;this._ctx.lineTo(r,a)}this._ctx.stroke(),this._ctx.closePath(),this._ctx.restore()}_dashedUnderlineAtCell(e,t,n=1){this._ctx.save(),this._ctx.beginPath(),this._ctx.strokeStyle=this._ctx.fillStyle;let r=this._coreBrowserService.dpr;this._ctx.lineWidth=r,this._ctx.setLineDash([4*r,3*r]);let i=e*this._deviceCellWidth,a=(e+n)*this._deviceCellWidth,o=(t+1)*this._deviceCellHeight-r-1;this._ctx.moveTo(i,o),this._ctx.lineTo(a,o),this._ctx.stroke(),this._ctx.closePath(),this._ctx.restore()}_fillLeftLineAtCell(e,t,n){this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,this._coreBrowserService.dpr*n,this._deviceCellHeight)}_strokeRectAtCell(e,t,n,r){let i=this._coreBrowserService.dpr;this._ctx.lineWidth=i,this._ctx.strokeRect(e*this._deviceCellWidth+i/2,t*this._deviceCellHeight+i/2,n*this._deviceCellWidth-i,r*this._deviceCellHeight-i)}_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){this._ctx.font=this._getFont(!1,!1),this._ctx.textBaseline=a.TEXT_BASELINE,this._clipRow(n);let r=!1;!1!==this._optionsService.rawOptions.customGlyphs&&(r=(0,o.tryDrawCustomChar)(this._ctx,e.getChars(),t*this._deviceCellWidth,n*this._deviceCellHeight,this._deviceCellWidth,this._deviceCellHeight,this._optionsService.rawOptions.fontSize,this._coreBrowserService.dpr)),r||this._ctx.fillText(e.getChars(),t*this._deviceCellWidth+this._deviceCharLeft,n*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_drawChars(e,t,n){let r=e.getChars(),i=e.getCode(),a=e.getWidth();if(this._cellColorResolver.resolve(e,t,this._bufferService.buffer.ydisp+n,this._deviceCellWidth),!this._charAtlas)return;let o;if(o=r&&r.length>1?this._charAtlas.getRasterizedGlyphCombinedChar(r,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,!0):this._charAtlas.getRasterizedGlyph(e.getCode()||f.WHITESPACE_CELL_CODE,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,!0),!o.size.x||!o.size.y)return;this._ctx.save(),this._clipRow(n),this._bitmapGenerator[o.texturePage]&&this._charAtlas.pages[o.texturePage].canvas!==this._bitmapGenerator[o.texturePage].canvas&&(this._bitmapGenerator[o.texturePage]?.bitmap?.close(),delete this._bitmapGenerator[o.texturePage]),this._charAtlas.pages[o.texturePage].version!==this._bitmapGenerator[o.texturePage]?.version&&(this._bitmapGenerator[o.texturePage]||(this._bitmapGenerator[o.texturePage]=new m(this._charAtlas.pages[o.texturePage].canvas)),this._bitmapGenerator[o.texturePage].refresh(),this._bitmapGenerator[o.texturePage].version=this._charAtlas.pages[o.texturePage].version);let c=o.size.x;this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,s.allowRescaling)(i,a,o.size.x,this._deviceCellWidth)&&(c=this._deviceCellWidth-1),this._ctx.drawImage(this._bitmapGenerator[o.texturePage]?.bitmap||this._charAtlas.pages[o.texturePage].canvas,o.texturePosition.x,o.texturePosition.y,o.size.x,o.size.y,t*this._deviceCellWidth+this._deviceCharLeft-o.offset.x,n*this._deviceCellHeight+this._deviceCharTop-o.offset.y,c,o.size.y),this._ctx.restore()}_clipRow(e){this._ctx.beginPath(),this._ctx.rect(0,e*this._deviceCellHeight,this._bufferService.cols*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t){return`${t?`italic`:``} ${e?this._optionsService.rawOptions.fontWeightBold:this._optionsService.rawOptions.fontWeight} ${this._optionsService.rawOptions.fontSize*this._coreBrowserService.dpr}px ${this._optionsService.rawOptions.fontFamily}`}}t.BaseRenderLayer=p;class m{get bitmap(){return this._bitmap}constructor(e){this.canvas=e,this._state=0,this._commitTimeout=void 0,this._bitmap=void 0,this.version=-1}refresh(){this._bitmap?.close(),this._bitmap=void 0,d.isSafari||(this._commitTimeout===void 0&&(this._commitTimeout=window.setTimeout((()=>this._generate()),100)),this._state===1&&(this._state=2))}_generate(){this._state===0&&(this._bitmap?.close(),this._bitmap=void 0,this._state=1,window.createImageBitmap(this.canvas).then((e=>{this._state===2?this.refresh():this._bitmap=e,this._state=0})),this._commitTimeout&&=void 0)}}},949:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CanvasRenderer=void 0;let r=n(627),i=n(56),a=n(374),o=n(345),s=n(859),c=n(873),l=n(43),u=n(630),d=n(744);class f extends s.Disposable{constructor(e,t,n,f,p,m,h,g,_,v,y){super(),this._terminal=e,this._screenElement=t,this._bufferService=f,this._charSizeService=p,this._optionsService=m,this._coreBrowserService=_,this._themeService=y,this._observerDisposable=this.register(new s.MutableDisposable),this._onRequestRedraw=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onChangeTextureAtlas=this.register(new o.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new o.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event;let b=this._optionsService.rawOptions.allowTransparency;this._renderLayers=[new d.TextRenderLayer(this._terminal,this._screenElement,0,b,this._bufferService,this._optionsService,h,v,this._coreBrowserService,y),new u.SelectionRenderLayer(this._terminal,this._screenElement,1,this._bufferService,this._coreBrowserService,v,this._optionsService,y),new l.LinkRenderLayer(this._terminal,this._screenElement,2,n,this._bufferService,this._optionsService,v,this._coreBrowserService,y),new c.CursorRenderLayer(this._terminal,this._screenElement,3,this._onRequestRedraw,this._bufferService,this._optionsService,g,this._coreBrowserService,v,y)];for(let e of this._renderLayers)(0,o.forwardEvent)(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas);this.dimensions=(0,a.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._observerDisposable.value=(0,i.observeDevicePixelDimensions)(this._renderLayers[0].canvas,this._coreBrowserService.window,((e,t)=>this._setCanvasDevicePixelDimensions(e,t))),this.register(this._coreBrowserService.onWindowChange((e=>{this._observerDisposable.value=(0,i.observeDevicePixelDimensions)(this._renderLayers[0].canvas,e,((e,t)=>this._setCanvasDevicePixelDimensions(e,t)))}))),this.register((0,s.toDisposable)((()=>{for(let e of this._renderLayers)e.dispose();(0,r.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){return this._renderLayers[0].cacheCanvas}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._bufferService.cols,this._bufferService.rows))}handleResize(e,t){this._updateDimensions();for(let e of this._renderLayers)e.resize(this.dimensions);this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}handleCharSizeChanged(){this.handleResize(this._bufferService.cols,this._bufferService.rows)}handleBlur(){this._runOperation((e=>e.handleBlur()))}handleFocus(){this._runOperation((e=>e.handleFocus()))}handleSelectionChanged(e,t,n=!1){this._runOperation((r=>r.handleSelectionChanged(e,t,n))),this._themeService.colors.selectionForeground&&this._onRequestRedraw.fire({start:0,end:this._bufferService.rows-1})}handleCursorMove(){this._runOperation((e=>e.handleCursorMove()))}clear(){this._runOperation((e=>e.reset()))}_runOperation(e){for(let t of this._renderLayers)e(t)}renderRows(e,t){for(let n of this._renderLayers)n.handleGridChanged(e,t)}clearTextureAtlas(){for(let e of this._renderLayers)e.clearTextureAtlas()}_updateDimensions(){if(!this._charSizeService.hasValidSize)return;let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=Math.floor(this._charSizeService.width*e),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),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._bufferService.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._bufferService.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows,this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols}_setCanvasDevicePixelDimensions(e,t){this.dimensions.device.canvas.height=t,this.dimensions.device.canvas.width=e;for(let e of this._renderLayers)e.resize(this.dimensions);this._requestRedrawViewport()}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._bufferService.rows-1})}}t.CanvasRenderer=f},873:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorRenderLayer=void 0;let r=n(457),i=n(859),a=n(399),o=n(782),s=n(903);class c extends s.BaseRenderLayer{constructor(e,t,n,r,a,s,c,l,u,d){super(e,t,`cursor`,n,!0,d,a,s,u,l),this._onRequestRedraw=r,this._coreService=c,this._cursorBlinkStateManager=this.register(new i.MutableDisposable),this._cell=new o.CellData,this._state={x:0,y:0,isFocused:!1,style:``,width:0},this._cursorRenderers={bar:this._renderBarCursor.bind(this),block:this._renderBlockCursor.bind(this),underline:this._renderUnderlineCursor.bind(this),outline:this._renderOutlineCursor.bind(this)},this.register(s.onOptionChange((()=>this._handleOptionsChanged()))),this._handleOptionsChanged()}resize(e){super.resize(e),this._state={x:0,y:0,isFocused:!1,style:``,width:0}}reset(){this._clearCursor(),this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._handleOptionsChanged()}handleBlur(){this._cursorBlinkStateManager.value?.pause(),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})}handleFocus(){this._cursorBlinkStateManager.value?.resume(),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})}_handleOptionsChanged(){this._optionsService.rawOptions.cursorBlink?this._cursorBlinkStateManager.value||(this._cursorBlinkStateManager.value=new r.CursorBlinkStateManager((()=>this._render(!0)),this._coreBrowserService)):this._cursorBlinkStateManager.clear(),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})}handleCursorMove(){this._cursorBlinkStateManager.value?.restartBlinkAnimation()}handleGridChanged(e,t){!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isPaused?this._render(!1):this._cursorBlinkStateManager.value.restartBlinkAnimation()}_render(e){if(!this._coreService.isCursorInitialized||this._coreService.isCursorHidden)return void this._clearCursor();let t=this._bufferService.buffer.ybase+this._bufferService.buffer.y,n=t-this._bufferService.buffer.ydisp;if(n<0||n>=this._bufferService.rows)return void this._clearCursor();let r=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1);if(this._bufferService.buffer.lines.get(t).loadCell(r,this._cell),this._cell.content!==void 0){if(!this._coreBrowserService.isFocused){this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._themeService.colors.cursor.css;let e=this._optionsService.rawOptions.cursorStyle,t=this._optionsService.rawOptions.cursorInactiveStyle;t&&t!==`none`&&this._cursorRenderers[t](r,n,this._cell),this._ctx.restore(),this._state.x=r,this._state.y=n,this._state.isFocused=!1,this._state.style=e,this._state.width=this._cell.getWidth();return}if(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible){if(this._state){if(this._state.x===r&&this._state.y===n&&this._state.isFocused===this._coreBrowserService.isFocused&&this._state.style===this._optionsService.rawOptions.cursorStyle&&this._state.width===this._cell.getWidth())return;this._clearCursor()}this._ctx.save(),this._cursorRenderers[this._optionsService.rawOptions.cursorStyle||`block`](r,n,this._cell),this._ctx.restore(),this._state.x=r,this._state.y=n,this._state.isFocused=!1,this._state.style=this._optionsService.rawOptions.cursorStyle,this._state.width=this._cell.getWidth()}else this._clearCursor()}}_clearCursor(){this._state&&=(a.isFirefox||this._coreBrowserService.dpr<1?this._clearAll():this._clearCells(this._state.x,this._state.y,this._state.width,1),{x:0,y:0,isFocused:!1,style:``,width:0})}_renderBarCursor(e,t,n){this._ctx.save(),this._ctx.fillStyle=this._themeService.colors.cursor.css,this._fillLeftLineAtCell(e,t,this._optionsService.rawOptions.cursorWidth),this._ctx.restore()}_renderBlockCursor(e,t,n){this._ctx.save(),this._ctx.fillStyle=this._themeService.colors.cursor.css,this._fillCells(e,t,n.getWidth(),1),this._ctx.fillStyle=this._themeService.colors.cursorAccent.css,this._fillCharTrueColor(n,e,t),this._ctx.restore()}_renderUnderlineCursor(e,t,n){this._ctx.save(),this._ctx.fillStyle=this._themeService.colors.cursor.css,this._fillBottomLineAtCells(e,t),this._ctx.restore()}_renderOutlineCursor(e,t,n){this._ctx.save(),this._ctx.strokeStyle=this._themeService.colors.cursor.css,this._strokeRectAtCell(e,t,n.getWidth(),1),this._ctx.restore()}}t.CursorRenderLayer=c},574:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GridCache=void 0,t.GridCache=class{constructor(){this.cache=[]}resize(e,t){for(let n=0;n<e;n++){this.cache.length<=n&&this.cache.push([]);for(let e=this.cache[n].length;e<t;e++)this.cache[n].push(void 0);this.cache[n].length=t}this.cache.length=e}clear(){for(let e=0;e<this.cache.length;e++)for(let t=0;t<this.cache[e].length;t++)this.cache[e][t]=void 0}}},43:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;let r=n(197),i=n(237),a=n(903);class o extends a.BaseRenderLayer{constructor(e,t,n,r,i,a,o,s,c){super(e,t,`link`,n,!0,c,i,a,o,s),this.register(r.onShowLinkUnderline((e=>this._handleShowLinkUnderline(e)))),this.register(r.onHideLinkUnderline((e=>this._handleHideLinkUnderline(e))))}resize(e){super.resize(e),this._state=void 0}reset(){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&&(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},630:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionRenderLayer=void 0;let r=n(903);class i extends r.BaseRenderLayer{constructor(e,t,n,r,i,a,o,s){super(e,t,`selection`,n,!0,s,r,o,a,i),this._clearState()}_clearState(){this._state={start:void 0,end:void 0,columnSelectMode:void 0,ydisp:void 0}}resize(e){super.resize(e),this._selectionModel.selectionStart&&this._selectionModel.selectionEnd&&(this._clearState(),this._redrawSelection(this._selectionModel.selectionStart,this._selectionModel.selectionEnd,this._selectionModel.columnSelectMode))}reset(){this._state.start&&this._state.end&&(this._clearState(),this._clearAll())}handleBlur(){this.reset(),this._redrawSelection(this._selectionModel.selectionStart,this._selectionModel.selectionEnd,this._selectionModel.columnSelectMode)}handleFocus(){this.reset(),this._redrawSelection(this._selectionModel.selectionStart,this._selectionModel.selectionEnd,this._selectionModel.columnSelectMode)}handleSelectionChanged(e,t,n){super.handleSelectionChanged(e,t,n),this._redrawSelection(e,t,n)}_redrawSelection(e,t,n){if(!this._didStateChange(e,t,n,this._bufferService.buffer.ydisp))return;if(this._clearAll(),!e||!t)return void this._clearState();let r=e[1]-this._bufferService.buffer.ydisp,i=t[1]-this._bufferService.buffer.ydisp,a=Math.max(r,0),o=Math.min(i,this._bufferService.rows-1);if(a>=this._bufferService.rows||o<0)this._state.ydisp=this._bufferService.buffer.ydisp;else{if(this._ctx.fillStyle=(this._coreBrowserService.isFocused?this._themeService.colors.selectionBackgroundTransparent:this._themeService.colors.selectionInactiveBackgroundTransparent).css,n){let n=e[0],r=t[0]-n,i=o-a+1;this._fillCells(n,a,r,i)}else{let n=r===a?e[0]:0,s=a===i?t[0]:this._bufferService.cols;this._fillCells(n,a,s-n,1);let c=Math.max(o-a-1,0);if(this._fillCells(0,a+1,this._bufferService.cols,c),a!==o){let e=i===o?t[0]:this._bufferService.cols;this._fillCells(0,o,e,1)}}this._state.start=[e[0],e[1]],this._state.end=[t[0],t[1]],this._state.columnSelectMode=n,this._state.ydisp=this._bufferService.buffer.ydisp}}_didStateChange(e,t,n,r){return!this._areCoordinatesEqual(e,this._state.start)||!this._areCoordinatesEqual(t,this._state.end)||n!==this._state.columnSelectMode||r!==this._state.ydisp}_areCoordinatesEqual(e,t){return!(!e||!t)&&e[0]===t[0]&&e[1]===t[1]}}t.SelectionRenderLayer=i},744:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextRenderLayer=void 0;let r=n(577),i=n(147),a=n(782),o=n(855),s=n(903),c=n(574);class l extends s.BaseRenderLayer{constructor(e,t,n,r,i,o,s,l,u,d){super(e,t,`text`,n,r,d,i,o,l,u),this._characterJoinerService=s,this._characterWidth=0,this._characterFont=``,this._characterOverlapCache={},this._workCell=new a.CellData,this._state=new c.GridCache,this.register(o.onSpecificOptionChange(`allowTransparency`,(e=>this._setTransparency(e))))}resize(e){super.resize(e);let t=this._getFont(!1,!1);this._characterWidth===e.device.char.width&&this._characterFont===t||(this._characterWidth=e.device.char.width,this._characterFont=t,this._characterOverlapCache={}),this._state.clear(),this._state.resize(this._bufferService.cols,this._bufferService.rows)}reset(){this._state.clear(),this._clearAll()}_forEachCell(e,t,n){for(let i=e;i<=t;i++){let e=i+this._bufferService.buffer.ydisp,t=this._bufferService.buffer.lines.get(e),a=this._characterJoinerService.getJoinedCharacters(e);for(let e=0;e<this._bufferService.cols;e++){t.loadCell(e,this._workCell);let s=this._workCell,c=!1,l=e;if(s.getWidth()!==0){if(a.length>0&&e===a[0][0]){c=!0;let e=a.shift();s=new r.JoinedCellData(this._workCell,t.translateToString(!0,e[0],e[1]),e[1]-e[0]),l=e[1]-1}!c&&this._isOverlapping(s)&&l<t.length-1&&t.getCodePoint(l+1)===o.NULL_CELL_CODE&&(s.content&=-12582913,s.content|=2<<22),n(s,e,i),e=l}}}}_drawBackground(e,t){let n=this._ctx,r=this._bufferService.cols,a=0,o=0,s=null;n.save(),this._forEachCell(e,t,((e,t,c)=>{let l=null;e.isInverse()?l=e.isFgDefault()?this._themeService.colors.foreground.css:e.isFgRGB()?`rgb(${i.AttributeData.toColorRGB(e.getFgColor()).join(`,`)})`:this._themeService.colors.ansi[e.getFgColor()].css:e.isBgRGB()?l=`rgb(${i.AttributeData.toColorRGB(e.getBgColor()).join(`,`)})`:e.isBgPalette()&&(l=this._themeService.colors.ansi[e.getBgColor()].css);let u=!1;this._decorationService.forEachDecorationAtCell(t,this._bufferService.buffer.ydisp+c,void 0,(e=>{e.options.layer!==`top`&&u||(e.backgroundColorRGB&&(l=e.backgroundColorRGB.css),u=e.options.layer===`top`)})),s===null&&(a=t,o=c),c===o?s!==l&&(n.fillStyle=s||``,this._fillCells(a,o,t-a,1),a=t,o=c):(n.fillStyle=s||``,this._fillCells(a,o,r-a,1),a=t,o=c),s=l})),s!==null&&(n.fillStyle=s,this._fillCells(a,o,r-a,1)),n.restore()}_drawForeground(e,t){this._forEachCell(e,t,((e,t,n)=>this._drawChars(e,t,n)))}handleGridChanged(e,t){this._state.cache.length!==0&&(this._charAtlas&&this._charAtlas.beginFrame(),this._clearCells(0,e,this._bufferService.cols,t-e+1),this._drawBackground(e,t),this._drawForeground(e,t))}_isOverlapping(e){if(e.getWidth()!==1||e.getCode()<256)return!1;let t=e.getChars();if(this._characterOverlapCache.hasOwnProperty(t))return this._characterOverlapCache[t];this._ctx.save(),this._ctx.font=this._characterFont;let n=Math.floor(this._ctx.measureText(t).width)>this._characterWidth;return this._ctx.restore(),this._characterOverlapCache[t]=n,n}}t.TextRenderLayer=l},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)),ee=c.length===1&&(0,a.isRestrictedPowerlineGlyph)(c.charCodeAt(0)),A=this._getForegroundColor(t,T,w,n,C,S,h,_,p,(0,a.treatGlyphAsBackgroundColor)(c.charCodeAt(0)));this._tmpCtx.fillStyle=A.css;let j=ee?0:4,M=!1;!1!==this._config.customGlyphs&&(M=(0,i.tryDrawCustomChar)(this._tmpCtx,c,j,j,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let N,P=!k;if(N=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())P=!1,this._tmpCtx.strokeStyle=`rgb(${u.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(`,`)})`;else{P=!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=j,r=Math.ceil(j+this._config.deviceCharHeight)-t-(s?2*e:0),i=r+e,o=r+2*e,l=this._workAttributeData.getUnderlineVariantOffset();for(let s=0;s<N;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(j+this._config.deviceCharHeight-e/2)-t,s=e<=1?r:Math.ceil(j+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(),!M&&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*N,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,j,j+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(j,j+t),this._tmpCtx.lineTo(j+this._config.deviceCharWidth*N,j+t),this._tmpCtx.stroke()}if(M||this._tmpCtx.fillText(c,j,j+this._config.deviceCharHeight),c===`_`&&!this._config.allowTransparency){let e=g(this._tmpCtx.getImageData(j,j,this._config.deviceCellWidth,this._config.deviceCellHeight),E,A,P);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,j,j+this._config.deviceCharHeight-t),e=g(this._tmpCtx.getImageData(j,j,this._config.deviceCellWidth,this._config.deviceCellHeight),E,A,P),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(j,j+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.lineTo(j+this._config.deviceCharWidth*N,j+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.stroke()}this._tmpCtx.restore();let F=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),I;if(I=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}(F):g(F,E,A,P),I)return f;let L=this._findGlyphBoundingBox(F,this._workBoundingBox,l,ee,M,j),R,te;for(;;){if(this._activePages.length===0){let e=this._createNewPage();R=e,te=e.currentRow,te.height=L.size.y;break}R=this._activePages[this._activePages.length-1],te=R.currentRow;for(let e of this._activePages)L.size.y<=e.currentRow.height&&(R=e,te=e.currentRow);for(let e=this._activePages.length-1;e>=0;e--)for(let t of this._activePages[e].fixedRows)t.height<=te.height&&L.size.y<=t.height&&(R=this._activePages[e],te=t);if(te.y+L.size.y>=R.canvas.height||te.height>L.size.y+2){let e=!1;if(R.currentRow.y+R.currentRow.height+L.size.y>=R.canvas.height){let t;for(let e of this._activePages)if(e.currentRow.y+e.currentRow.height+L.size.y<e.canvas.height){t=e;break}if(t)R=t;else if(m.maxAtlasPages&&this._pages.length>=m.maxAtlasPages&&te.y+L.size.y<=R.canvas.height&&te.height>=L.size.y&&te.x+L.size.x<=R.canvas.width)e=!0;else{let t=this._createNewPage();R=t,te=t.currentRow,te.height=L.size.y,e=!0}}e||(R.currentRow.height>0&&R.fixedRows.push(R.currentRow),te={x:0,y:R.currentRow.y+R.currentRow.height,height:L.size.y},R.fixedRows.push(te),R.currentRow={x:0,y:te.y+te.height,height:0})}if(te.x+L.size.x<=R.canvas.width)break;te===R.currentRow?(te.x=0,te.y+=te.height,te.height=0):R.fixedRows.splice(R.fixedRows.indexOf(te),1)}return L.texturePage=this._pages.indexOf(R),L.texturePosition.x=te.x,L.texturePosition.y=te.y,L.texturePositionClipSpace.x=te.x/R.canvas.width,L.texturePositionClipSpace.y=te.y/R.canvas.height,L.sizeClipSpace.x/=R.canvas.width,L.sizeClipSpace.y/=R.canvas.height,te.height=Math.max(te.height,L.size.y),te.x+=L.size.x,R.ctx.putImageData(F,L.texturePosition.x-this._workBoundingBox.left,L.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,L.size.x,L.size.y),R.addGlyph(L),R.version++,L}_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}},577: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(147),o=n(855),s=n(782),c=n(97);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)},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.CanvasAddon=void 0;let t=n(345),i=n(859),a=n(776),o=n(949);class s extends i.Disposable{constructor(){super(...arguments),this._onChangeTextureAtlas=this.register(new t.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new t.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event}get textureAtlas(){return this._renderer?.textureAtlas}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,s=n.optionsService,c=n.screenElement,l=n.linkifier,u=n,d=u._bufferService,f=u._renderService,p=u._characterJoinerService,m=u._charSizeService,h=u._coreBrowserService,g=u._decorationService,_=u._logService,v=u._themeService;(0,a.setTraceLogger)(_),this._renderer=new o.CanvasRenderer(e,c,l,d,m,s,p,r,h,g,v),this.register((0,t.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,t.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),f.setRenderer(this._renderer),f.handleResize(d.cols,d.rows),this.register((0,i.toDisposable)((()=>{f.setRenderer(this._terminal._core._createRenderer()),f.handleResize(e.cols,e.rows),this._renderer?.dispose(),this._renderer=void 0})))}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}}e.CanvasAddon=s})(),r})()))}));function jee(e){let t=e?.devicePixelContentBoxSize?.[0];return!!t&&Math.abs(t.inlineSize-e.contentRect.width*window.devicePixelRatio)>2}function Mee(){if(PE)return;PE=!0;let e=document.createElement(`canvas`).getContext(`2d`);if(!e||(e.font=` 12px monospace`,e.font.startsWith(`12px`)))return;let t=Object.getOwnPropertyDescriptor(CanvasRenderingContext2D.prototype,`font`),{get:n,set:r}=t??{};!t||!n||!r||Object.defineProperty(CanvasRenderingContext2D.prototype,"font",{...t,set(e){r.call(this,typeof e==`string`?e.trim():e)}})}function Nee(){IE||=(FE=FE===`normal`?`400`:`normal`,requestAnimationFrame(()=>{IE=0}))}function Pee(e,t){let n=null,r=null,i=!1,a=async()=>{try{let{CanvasAddon:t}=await Al(async()=>{let{CanvasAddon:e}=await Promise.resolve().then(()=>u(Aee(),1));return{CanvasAddon:e}},void 0);if(i)return;let n=new t,a=n.dispose.bind(n),o=e._core;n.dispose=()=>{o?._store?._isDisposed||a()},e.loadAddon(n),r=n;let c=e.element?.querySelector(`canvas.xterm-text-layer`);c&&s(c)}catch{return}t()},o=[];function s(t){let r=new ResizeObserver(([t])=>{let r=e._core?._renderService;if(!r)return;let i=jee(t);i&&r.handleCharSizeChanged?.(),n&&!r._isPaused?r._renderRows?.(0,e.rows-1):i&&e.refresh(0,e.rows-1)});o.push(r);try{r.observe(t,{box:`device-pixel-content-box`})}catch{}}let c=null,l=0,d=()=>{l||=requestAnimationFrame(()=>{l=0,e.options.fontWeight=FE})},f=()=>{Nee(),d()},p=()=>{FE=e.options.fontWeight===`normal`?`400`:`normal`,d()};try{Mee(),e.options.fontWeight=FE;let t=new Set(e.element?.querySelectorAll(`canvas`)),r=new NE;r.onContextLoss(()=>{r.dispose(),n=null,a()}),r.onRemoveTextureAtlasCanvas(f),e.loadAddon(r),n=r,c=[...e.element?.querySelectorAll(`canvas`)??[]].find(e=>!t.has(e)&&!e.classList.contains(`xterm-link-layer`))??null}catch{a()}c?.addEventListener(`webglcontextrestored`,p),c&&s(c);let m=()=>{let t=n??r;t&&(t.clearTextureAtlas(),e.refresh(0,e.rows-1))};document.fonts.addEventListener(`loadingdone`,m);let h=()=>{document.visibilityState===`visible`&&m()};return document.addEventListener(`visibilitychange`,h),{dispose(){i=!0,document.fonts.removeEventListener(`loadingdone`,m),document.removeEventListener(`visibilitychange`,h),c?.removeEventListener(`webglcontextrestored`,p),l&&cancelAnimationFrame(l);for(let e of o)e.disconnect();c?.getContext(`webgl2`)?.getExtension(`WEBGL_lose_context`)?.loseContext()}}}var PE,FE,IE,LE=o((()=>{kee(),jl(),PE=!1,FE=`normal`,IE=0}));function RE(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function zE(e){return!e||typeof e!=`object`||!(`stream`in e)||typeof e.stream!=`string`?null:{stream:e.stream,...`data`in e&&typeof e.data==`string`?{data:e.data}:{},...`code`in e&&(typeof e.code==`number`||e.code===null)?{code:e.code}:{}}}function BE(e){let t=0,n=null,r=()=>{n!==null&&window.clearTimeout(n),n=null,t>0&&e(t),t=0};return{parsed(e){t+=e,t>=HE?r():n??=window.setTimeout(r,UE)},dispose(){n!==null&&window.clearTimeout(n),n=null,t=0}}}function VE(e){return!e||typeof e!=`object`||!(`stream`in e)||!(`replay`in e)?null:typeof e.stream==`string`&&typeof e.replay==`string`?{stream:e.stream,replay:e.replay}:null}var HE,UE,WE=o((()=>{HE=65536,UE=20})),GE=c({mountTerminal:()=>qE});function KE(e){let t=new Uint8Array(XE.length+e.length);return t.set(XE),t.set(e,XE.length),t}function qE(e){let{client:t,el:n,taskId:r,tabId:i}=e,a=new Ly({fontFamily:ob.get()??Kb,fontSize:Hb(),lineHeight:1.15,theme:ab.get()??Wb,cursorBlink:!0,scrollback:yb.get().prefs.scrollbackRows,allowProposedApi:!0,overviewRuler:{width:JE},scrollOnUserInput:!1}),o=new lx(a);a.loadAddon(o);let s=new Zl;a.loadAddon(s),a.loadAddon(new fd),a.unicode.activeVersion=`11`;let c=(e,t)=>void window.open(t,`_blank`,`noopener`);a.options.linkHandler={activate:c},a.loadAddon(new yd(c)),a.open(n);let l=Pee(a,()=>z()),u=Dx(a);o.fit();let d=Jb(a,n,s),f=!1;e.snapshot&&d.raise(e.snapshot),e.focusOnMount&&a.focus();let p=Tl(r,i,e.leafId),m=YE.get(t);m||(m=new Map,YE.set(t,m));let h=m.get(p)??{owners:0,attached:!1};h.owners++,m.set(p,h);let g=()=>void t.request(`term.detach`,{stream:p}).catch(()=>{}),_=null,v=!1,y=null,b=!1,x=Ax(e=>{_&&v&&t.request(`term.input`,{stream:_,data:e}).catch(()=>{})}),S=BE(e=>{_&&t.request(`term.ack`,{stream:_,chars:e}).catch(()=>{})}),C=(e,t,n)=>{u.push(e),a.write(e,()=>{n?.(),S.parsed(t)})},w=t.on(`term.data`,e=>{let t=zE(e);if(!t?.data||t.stream!==p)return;let n=RE(t.data);y?y.push({bytes:n,chars:t.data.length}):_&&C(n,t.data.length)}),T=e=>{if(a.rows<=2)return Promise.resolve();let{cols:n,rows:r}=a;return t.request(`term.resize`,{stream:e,cols:n,rows:r-1}).then(()=>new Promise(e=>window.setTimeout(e,60))).then(()=>_===e?t.request(`term.resize`,{stream:e,cols:n,rows:r}):void 0)},E=t.on(`term.reset`,e=>{let t=VE(e);if(!t||t.stream!==p||!_||y)return;let n=_;x.replay(e=>C(KE(RE(t.replay)),t.replay.length,e)),v&&T(n).catch(()=>{})}),D=t.on(`term.exit`,t=>{let n=zE(t);!n||n.stream!==p||(v=!1,e.setNotice({kind:`exited`,code:n.code??null}),e.onExit(n.code??null))}),O=!1,k=null,ee=()=>{let e=a.buffer.active;for(let t=0;t<a.rows;t++)if(e.getLine(e.viewportY+t)?.translateToString(!0).trim())return!0;return!1},A=t=>{if(!O){if(t&&!ee()){k??=a.onWriteParsed(()=>A(!0));return}O=!0,k?.dispose(),t?requestAnimationFrame(()=>requestAnimationFrame(()=>e.onPainted?.())):e.onPainted?.()}},j=async()=>{y=[],_=null;try{let n=await t.request(`term.attach`,{taskId:r,tabId:i,...e.leafId&&e.leafId!==`leaf-1`?{leafId:e.leafId}:{},cols:a.cols,rows:a.rows,acks:!0}),o=m.get(p);if(o?o.attached=!0:g(),b)return;ge.reset(),f&&!d.raised&&d.raise(d.snapshot()),f=!0,me=null,V=!0,x.replay(e=>{let t=RE(n.replay);u.push(t),a.write(KE(t),()=>{V=!1,e(),A(!0)})});for(let e of y)C(e.bytes,e.chars);_=n.stream,v=n.alive,n.alive&&a.rows>2?T(n.stream).then(()=>window.setTimeout(d.lower,250)).catch(d.lower):d.lower(),n.alive&&document.activeElement===a.textarea&&ve.set(n.stream),e.setNotice(n.alive?{kind:`none`}:n.restored?{kind:`restored`}:{kind:`exited`,code:null})}catch(t){if(b)return;t instanceof yl&&t.code===`TAB_NOT_LIVE`?e.setNotice({kind:`notLive`}):t instanceof yl&&t.code===`NOT_CONNECTED`||e.setNotice({kind:`failed`,message:t instanceof Error?t.message:String(t)})}finally{y=null,_||(d.lower(),A(!1))}},M=()=>n.clientWidth>0&&n.clientHeight>0,N=!1,P=t.onOpen(()=>{N=!M(),N||j()}),F=null,I=a.onData(e=>{if(F&&e.length===1){let t=F;F=null,t(),x.forward(see(e))}else x.forward(e)}),L=fS(a),R=tx(a,e=>x.forward(e),L.onKey),te=0,ne=()=>{!_||!v||(te=Date.now(),t.request(`term.resize`,{stream:_,cols:a.cols,rows:a.rows}).catch(()=>{}))},re=L.onKey(()=>{Date.now()-te>1e3&&ne()}),ie=null,ae=a.onResize(({cols:e,rows:n})=>{ie!==null&&window.clearTimeout(ie),ie=window.setTimeout(()=>{_&&v&&t.request(`term.resize`,{stream:_,cols:e,rows:n}).catch(()=>{})},80)});function z(){we.get()!==null||!M()||(o.fit(),N&&(N=!1,j()))}let oe=Ub(a,z),se=new ResizeObserver(z);se.observe(n);let ce=a.element?.querySelector(`.xterm-screen`);ce&&se.observe(ce);let le=we.subscribe(z),ue=yb.subscribe(()=>{a.options.scrollback=yb.get().prefs.scrollbackRows}),de=()=>{n.style.backgroundColor=(ab.get()??Wb).background??``};de();let B=ab.subscribe(()=>{a.options.theme=ab.get()??Wb,de()}),fe=zb(a,n,L,e.copyText,e.pasteImage),pe=a.textarea,me=null,V=!1,he=0,ge=nS(a,()=>{me=null}),_e=rS(n,a,ge),ye=lS(n,a,ge),be=e=>{e.target instanceof Element&&e.target.closest(`.scrollbar`)&&(me=null,ge.reset())};n.addEventListener(`mousedown`,be,{capture:!0});let xe=()=>Sb(n);n.addEventListener(`wheel`,xe,{capture:!0,passive:!0}),n.addEventListener(`touchmove`,xe,{capture:!0,passive:!0});let Se=()=>{if(!V&&a.buffer.active.type===`normal`){let e=Ux(a.buffer.active);me===null&&e>0&&(me=e),he=performance.now()}return!1},Ce=a.parser.registerCsiHandler({final:`J`},e=>e[0]===3&&Se()),Te=a.parser.registerEscHandler({final:`c`},Se),H=()=>{me=null,ge.reset(),Ux(a.buffer.active)>0&&a.scrollToBottom()},Ee=L.onKey(H);pe?.addEventListener(`paste`,H),pe?.addEventListener(`compositionend`,H);let De=()=>e.onScrolled(Ux(a.buffer.active)),Oe=a.onScroll(De),ke=a.onWriteParsed(()=>{me!==null&&performance.now()-he>1e3&&(me=null);let e=Wx(me,a.buffer.active);e!==null&&a.scrollToLine(e),De()}),Ae=e=>{me=null,ge.reset(),e()},je=()=>{ve.set(_),ne(),e.onFocusChange(!0)},Me=()=>e.onFocusChange(!1);return pe?.addEventListener(`focus`,je),pe?.addEventListener(`blur`,Me),{term:a,stream:p,scrollLines:e=>Ae(()=>a.scrollLines(e)),scrollToTop:()=>Ae(()=>a.scrollToTop()),scrollToBottom:()=>Ae(()=>a.scrollToBottom()),armCtrl:e=>{F=e},reattach:j,snapshot:d.snapshot,dispose(){b=!0,d.lower(),se.disconnect(),oe(),_e(),ye(),ge.dispose(),n.removeEventListener(`mousedown`,be,{capture:!0}),n.removeEventListener(`wheel`,xe,{capture:!0}),n.removeEventListener(`touchmove`,xe,{capture:!0}),pe?.removeEventListener(`paste`,H),pe?.removeEventListener(`compositionend`,H),Ce.dispose(),Te.dispose(),Ee.dispose(),B(),ue(),le(),ie!==null&&window.clearTimeout(ie),fe(),pe?.removeEventListener(`focus`,je),pe?.removeEventListener(`blur`,Me),Oe.dispose(),ke.dispose(),I.dispose(),R(),re.dispose(),L.dispose(),ae.dispose(),P(),w(),D(),E(),S.dispose(),_&&ve.get()===_&&ve.set(null),h.owners--,h.owners===0&&(m.delete(p),h.attached&&g()),u.dispose(),a.dispose(),l.dispose()}}}var JE,YE,XE,ZE=o((()=>{$l(),pd(),bd(),Ry(),zy(),wl(),cb(),xb(),Tb(),El(),Vb(),Xb(),cee(),ux(),kx(),Fb(),qb(),Nx(),Zx(),cS(),dS(),pS(),LE(),WE(),H(),JE=8,YE=new WeakMap,XE=new Uint8Array([27,99])}));El(),Ur(),jl();var QE=8,$E=32,eD=3e3,tD=100,nD=new WeakMap,rD=null;function iD(e){let t=nD.get(e);return t||(t={entries:new Map,snapshots:new Map,left:null},nD.set(e,t)),t}function aD(){return rD||(rD=document.createElement(`div`),rD.style.display=`none`,document.body.append(rD)),rD}function oD(e,t,n){e.snapshots.delete(t),e.snapshots.set(t,n);for(let t of e.snapshots.keys()){if(e.snapshots.size<=$E)break;e.snapshots.delete(t)}}function sD(e,t,n){e.entries.delete(t.key),t.leaving!==null&&window.clearTimeout(t.leaving),t.leaving=null,n?oD(e,t.key,t.handle.snapshot()):e.snapshots.delete(t.key),t.handle.dispose(),t.box.remove()}function cD(e){let t=[...e.entries.values()].filter(e=>e.slot.parkedAt!==null);t.sort((e,t)=>(e.slot.parkedAt??0)-(t.slot.parkedAt??0));for(let n of t.slice(0,Math.max(0,t.length-QE)))sD(e,n,!0)}function lD(e,t){return iD(e).entries.get(t)?.handle??null}function uD(e,t,n,r){return iD(e).entries.get(Tl(t,n,r))?.slot.parkedAt!=null}async function dD(e,t){let n=iD(e.client),r=Tl(e.taskId,e.tabId,e.leafId),i=n.entries.get(r);if(i&&i.slot.parkedAt!==null){let{slot:r,handle:a,box:o}=i;return r.parkedAt=null,r.binding=t,i.leaving!==null&&(window.clearTimeout(i.leaving),i.leaving=null,o.classList.remove(`is-leaving`)),n.left=null,hD(n),e.host.append(o),t.setNotice(r.notice),t.onScrolled(r.scrolled),a.term.refresh(0,a.term.rows-1),e.focusOnMount&&a.term.focus(),{handle:a,release:()=>fD(n,i)}}let a=document.createElement(`div`);a.className=Or,e.host.append(a),pD(n,e.host);let o=!i,s={binding:t,notice:{kind:`none`},scrolled:0,parkedAt:null},c=null,l=o?n.snapshots.get(r):void 0;l&&n.snapshots.delete(r);let{mountTerminal:u}=await Al(async()=>{let{mountTerminal:e}=await Promise.resolve().then(()=>(ZE(),GE));return{mountTerminal:e}},void 0),d=u({...e,el:a,snapshot:l,onPainted:()=>hD(n),setNotice:e=>{s.notice=e,s.binding?.setNotice(e)},onScrolled:e=>{s.scrolled=e,s.binding?.onScrolled(e)},onFocusChange:e=>s.binding?.onFocusChange(e),onExit:e=>{s.binding?s.binding.onExit(e):c&&n.entries.get(r)===c&&sD(n,c,!1)},copyText:e=>s.binding?.copyText(e)??Promise.resolve(!1),pasteImage:()=>s.binding?.pasteImage()??Promise.resolve()});if(!o)return{handle:d,release:()=>{d.dispose(),a.remove()}};let f={key:r,handle:d,box:a,slot:s,leaving:null};return c=f,n.entries.set(r,f),{handle:d,release:()=>fD(n,f)}}function fD(e,t){let{slot:n}=t;e.entries.get(t.key)===t&&n.parkedAt===null&&(n.binding?.onFocusChange(!1),n.binding=null,t.handle.term.blur(),n.parkedAt=performance.now(),aD().append(t.box),e.left=t,cD(e))}function pD(e,t){let n=e.left;e.left=null,!(!n||n.slot.parkedAt===null||performance.now()-n.slot.parkedAt>tD)&&e.entries.get(n.key)===n&&(n.box.classList.add(`is-leaving`),t.append(n.box),n.leaving=window.setTimeout(()=>mD(e,n),eD))}function mD(e,t){t.leaving!==null&&(window.clearTimeout(t.leaving),t.leaving=null,t.box.classList.remove(`is-leaving`),e.entries.get(t.key)===t&&t.slot.parkedAt!==null&&aD().append(t.box))}function hD(e){for(let t of e.entries.values())mD(e,t)}wl(),G(),El(),H();async function gD(e,t,n){return ol(await e.request(`output.read`,{taskId:t,tab:n,source:`terminal`,limit:12}))}async function _D(e,t,n,r){try{let i=await e.client.request(`tab.send`,{taskId:t,tabId:n,prompt:r});return i.delivered?!0:(z(U(`layout.composerNotSent`,{reason:i.reason??``}),`error`),!1)}catch(e){let t=e instanceof yl?e.code:void 0;return z(t===`UNKNOWN_OP`?U(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?U(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`),!1}}async function vD(e,t,n,r){let{client:i}=e,a=Tl(t,n),o=qc(a)!==void 0||uD(i,t,n);try{return o||await i.request(`term.attach`,{taskId:t,tabId:n}),await i.request(`term.input`,{stream:a,data:r}),!0}catch(e){return z(e instanceof Error?e.message:String(e),`error`),!1}finally{o||await i.request(`term.detach`,{stream:a}).catch(()=>{})}}async function yD(e,t,n){try{return(await e.client.request(`gate.answer`,{gateId:t,...n})).delivered||z(U(`inbox.gateKept`)),!0}catch(e){return z(e instanceof Error?e.message:String(e),`error`),!1}}var bD=`mx-2.5 mt-0.5 mb-1.5 flex min-w-0 flex-col gap-1.5 font-mono text-meta`;G(),Fb();var xD=2e3;function SD(e,t,n){let[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(0);return(0,J.useEffect)(()=>{if(!n)return;let r=!0,a=0,o=async()=>{try{let a=await gD(e.client,t,n);r&&i(a)}catch{r&&i(e=>al(e,`failed`))}r&&(a=window.setTimeout(o,xD))};return o(),()=>{r=!1,window.clearTimeout(a)}},[e,t,n,a]),{lines:r,refresh:()=>o(e=>e+1)}}function CD({d:e}){return(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:e})})}function wD(e){W();let{model:t,taskId:n,tabId:r,mode:i,gate:a}=e,{lines:o,refresh:s}=SD(t,n,r),c=(0,J.useRef)(null),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(!1);(0,J.useEffect)(()=>{let e=c.current;e&&(e.scrollTop=e.scrollHeight)},[o]);let p=async e=>{f(!0);let t=await e();return f(!1),t&&window.setTimeout(s,600),t},m=async()=>{let e=l.trim();!e||d||await p(()=>i===`gate`&&a?yD(t,a.id,{text:e}):r?_D(t,n,r,e):Promise.resolve(!1))&&u(``)};return(0,K.jsxs)(`div`,{className:bD,children:[a&&(0,K.jsx)(`p`,{className:`m-0 whitespace-pre-wrap wrap-anywhere text-ink`,children:a.question}),r&&(0,K.jsx)(`pre`,{ref:c,className:`m-0 max-h-60 overflow-y-auto rounded-sm border-hairline border-line bg-inset px-2 py-1.5 text-ink whitespace-pre-wrap wrap-anywhere`,"data-peek-lines":12,children:o===null?`…`:o===`unreadable`?U(`inbox.outputUnreadable`):o.length===0?U(`inbox.noOutput`):o.join(`
|
|
190
|
+
`)}),i===`gate`&&a&&(0,K.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:a.options.map(e=>(0,K.jsxs)(q,{disabled:d,title:e.detail,onClick:()=>void p(()=>yD(t,a.id,{option:e.key})),children:[`[ `,e.key===a.recommended?`★ `:``,e.label,` ]`]},e.key))}),i===`menu`&&r&&(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[Nb.map(e=>(0,K.jsxs)(q,{disabled:d,onClick:()=>void p(()=>vD(t,n,r,e.bytes(!1))),children:[`[ `,e.cap,` ]`]},e.id)),(0,K.jsx)(q,{onClick:e.onOpenTab,children:U(`inbox.openTab`)})]}),(i===`reply`||i===`gate`)&&(0,K.jsxs)(`form`,{className:`flex min-w-0 items-center gap-2`,onSubmit:e=>{e.preventDefault(),m()},children:[(0,K.jsx)(`input`,{className:`min-w-0 flex-1 rounded-sm border-hairline border-line bg-paper px-2 py-1.5 font-mono text-ink focus-visible:border-line-active focus-visible:outline-none touch:min-h-10 touch:text-display`,value:l,disabled:d,placeholder:U(`inbox.replyPlaceholder`),"aria-label":U(`inbox.replyPlaceholder`),autoComplete:`off`,enterKeyHint:`send`,onChange:e=>u(e.target.value)}),(0,K.jsx)(q,{variant:`icon`,type:`submit`,disabled:d||l.trim()===``,"aria-label":U(`inbox.send`),title:U(`inbox.send`),children:(0,K.jsx)(CD,{d:`M8 13V3.5M4 7.5l4-4 4 4`})})]})]})}function TD(e=`light`){globalThis.webkit?.messageHandlers?.haptic?.postMessage(e)}A(),Pn(),Ur();var ED={pane:`flex items-center gap-2.5 px-1`,screen:`flex flex-none items-center gap-3 px-3 py-2`},DD={name:`min-w-0 flex-1 truncate font-sans text-body font-normal text-ink`,heading:`m-0 font-sans text-display font-semibold normal-nums text-ink`};function OD(e){let t=e.titleKind??`name`;return(0,K.jsxs)(`div`,{className:ED[e.frame??`pane`],children:[(0,K.jsx)(Ca,{kind:e.back.kind??`back`,label:e.back.label,onClick:e.back.onClick}),e.title&&(t===`heading`?(0,K.jsx)(`h1`,{className:DD.heading,children:e.title}):(0,K.jsx)(`span`,{className:DD.name,children:e.title})),e.children]})}var kD=`flex min-h-0 w-full flex-1 flex-col gap-4 overflow-y-auto scrollbar-none px-3 pt-0 pb-8`;function AD({children:e}){return(0,K.jsx)(`h1`,{className:`m-0 px-0 pb-0.5 font-sans text-[28px] leading-[1.2] font-bold normal-nums text-ink`,children:e})}function jD({label:e,inset:t,children:n}){return(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e&&(0,K.jsx)(`p`,{className:`m-0 px-3 pb-0 font-mono text-meta font-normal text-subtle`,children:e}),(0,K.jsx)(`div`,{className:`flex flex-col overflow-hidden rounded-[12px] [&>*+*]:[border-top:var(--hairline)_solid_var(--line)] ${t?`bg-inset`:`bg-surface`}`,children:n})]})}var MD=`flex min-h-13 items-center gap-3 rounded-none px-3 py-1.25 text-left font-sans text-title text-ink hover:bg-hover`;function ND({actions:e}){return(0,K.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 flex-1 items-center gap-2.5`,"data-phone-actions":!0,children:e.map(e=>{let t=`grid h-13 cursor-pointer place-items-center px-2.5 font-sans text-body font-semibold no-underline disabled:opacity-50 ${An} ${Mn} ${jn} ${e.glyph?`w-13 flex-none`:`min-w-0 flex-1`} ${e.tone===`accent`?`border-hairline border-transparent bg-accent text-paper shadow-popover`:`${On()} text-ink`}`,n=e.glyph??(0,K.jsx)(`span`,{className:`max-w-full truncate`,children:e.label});return e.href&&!e.disabled?(0,K.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,"aria-label":e.glyph?e.label:void 0,className:t,onClick:()=>{TD(),e.onClick?.()},children:n},e.label):(0,K.jsx)(`button`,{type:`button`,disabled:e.disabled,"aria-label":e.glyph?e.label:void 0,className:t,onClick:()=>{TD(),e.onClick?.()},children:n},e.label)})})}function PD({label:e,children:t}){return(0,K.jsxs)(`div`,{className:`flex min-h-13 items-center gap-4 px-3 py-2 font-sans text-body`,children:[(0,K.jsx)(`span`,{className:`flex-none text-muted`,children:e}),(0,K.jsx)(`span`,{className:`ml-auto line-clamp-2 min-w-0 text-right wrap-anywhere text-ink`,children:t})]})}var FD=O({list:null,page:null});function ID(e,t){(0,J.useLayoutEffect)(()=>FD.set({...FD.get(),[e]:t})),(0,J.useLayoutEffect)(()=>()=>FD.set({...FD.get(),[e]:null}),[e])}var LD=`duration-220 ease-snap motion-reduce:transition-none`,RD=`pb-[max(8px,calc(12px_-_env(safe-area-inset-bottom)))]`,zD=`bottom-[max(8px,calc(12px_-_env(safe-area-inset-bottom)))]`,BD=80,VD=300,HD=120,UD=14,WD=6,GD=`rounded-[10px]`,KD=e=>`${e.capsule?`c`:``}${e.wide?`w${e.wide.label}\0${e.wide.note??``}`:`a${e.action?.label}\0${e.action?.tone??``}`}`,qD=e=>e.capsule?(e.capsule.left+e.capsule.width+e.main.left)/2:null,JD=(e,t)=>e.capsule?[e.capsule,e.main]:[{left:e.main.left,width:t+UD-e.main.left},{left:t-UD,width:e.main.left+e.main.width-t+UD}],YD=e=>({left:e.offsetLeft,width:e.offsetWidth}),XD=(e,t)=>({capsule:e&&YD(e),main:YD(t)}),ZD=(e,t)=>[t,...e?.firstElementChild?.children??[]].filter(e=>!!e);function QD({spec:e}){if(e.wide)return(0,K.jsxs)(`span`,{className:`flex h-full min-w-0 items-center gap-2 px-3.5 font-mono`,children:[(0,K.jsx)(`span`,{className:`flex flex-none text-accent`,children:(0,K.jsx)(Ea,{})}),(0,K.jsx)(`span`,{className:`min-w-0 truncate text-body text-ink lowercase`,children:e.wide.label}),e.wide.note&&(0,K.jsx)(`span`,{className:`ml-auto flex-none text-meta tracking-[0.08em] text-muted uppercase`,children:e.wide.note})]});let t=e.action?.tone===`accent`;return(0,K.jsx)(`span`,{className:`grid h-full place-items-center px-3 font-sans text-body font-semibold ${t?`text-paper`:`text-ink`}`,children:(0,K.jsx)(`span`,{className:`max-w-full truncate`,children:e.action?.label})})}function $D({show:e}){let t=k(FD),n=(0,J.useRef)(null),[r,i]=(0,J.useState)(e);(0,J.useLayoutEffect)(()=>{if(e===r)return;let t=!0,a=((e&&FD.get()[e]?n.current?.parentElement?.querySelector(`:scope > main`):null)?.getAnimations()??[]).map(e=>e.finished);return Promise.allSettled(a).then(()=>t&&i(e)),()=>{t=!1}},[e,r]);let a=r?t[r]:null,o=a?KD(a):null,[s,c]=(0,J.useState)(o),l=(0,J.useRef)(null),u=(0,J.useRef)(null);a&&(u.current=a),a&&o===s&&(l.current=a);let d=l.current,f=(0,J.useRef)(null),p=(0,J.useRef)(null),m=(0,J.useRef)(null),h=(0,J.useRef)(null),g=(0,J.useRef)(null),_=(0,J.useRef)(!1),[v,y]=(0,J.useState)(null),b=(0,J.useRef)(!1);if((0,J.useLayoutEffect)(()=>{if(!a||o===s||_.current)return;let e=()=>{l.current=u.current,c(u.current?KD(u.current):null)};if(!(n.current&&Number(getComputedStyle(n.current).opacity)>.5)||matchMedia(`(prefers-reduced-motion: reduce)`).matches)return e();_.current=!0;let t=ZD(f.current,m.current).map(e=>e.animate({opacity:[1,0]},{duration:BD,fill:`forwards`}).finished);Promise.allSettled(t).then(()=>{p.current?y(XD(f.current,p.current)):_.current=!1,e()})}),(0,J.useLayoutEffect)(()=>{if(!v){if(b.current)for(let e of ZD(f.current,m.current))e.animate({opacity:[0,1]},{duration:HD,easing:`ease-out`});b.current=!1;return}b.current=!0;let e=XD(f.current,p.current),t=qD(v)??qD(e)??e.main.left+e.main.width/2,n=JD(v,t),r=JD(e,t),i=n.every((e,t)=>e.left===r[t].left&&e.width===r[t].width),a=Math.min(n[0].left,r[0].left),o=Math.max(n[1].left+n[1].width,r[1].left+r[1].width);g.current?.style.setProperty(`left`,`${a}px`),g.current?.style.setProperty(`width`,`${o-a}px`);let s=Array.from(h.current?.children??[],(e,t)=>{let a=e;return a.style.left=`${r[t].left}px`,a.style.width=`${r[t].width}px`,a.animate([{transform:`translateX(${n[t].left-r[t].left}px) scaleX(${n[t].width/r[t].width})`},{transform:`none`}],{duration:i?0:VD,easing:`cubic-bezier(0.45, 0, 0.3, 1)`}).finished});Promise.allSettled(s).then(()=>{_.current=!1,y(null)})},[v]),!d)return null;let x=d.action?.tone===`accent`,S=d.wide?.onClick??d.action?.onClick,C=v?`invisible`:``;return(0,K.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 z-2 col-1 row-1 flex items-end gap-2.5 ${RD} transition-[translate,opacity] ${LD} ${d.capsule?`px-4`:`px-3`} ${a?``:`translate-y-4 opacity-0`}`,ref:n,inert:!a,"data-bottom-bar":!0,children:[v&&(0,K.jsxs)(`span`,{"aria-hidden":`true`,className:`absolute inset-0`,"data-bar-melt":!0,children:[(0,K.jsx)(`span`,{ref:g,className:`absolute ${zD} h-13 backdrop-blur-md backdrop-saturate-150 opaque:hidden rounded-[14px]`}),(0,K.jsxs)(`span`,{ref:h,className:`absolute inset-0 [filter:url(#phone-bar-goo)] ${x?``:`opacity-60 opaque:opacity-100`}`,children:[(0,K.jsx)(`span`,{className:`absolute ${zD} h-13 origin-left bg-inset ${GD}`}),(0,K.jsx)(`span`,{className:`absolute ${zD} h-13 origin-left ${GD} ${x?`bg-accent`:`bg-inset`}`})]}),(0,K.jsx)(`svg`,{className:`absolute size-0`,role:`presentation`,children:(0,K.jsxs)(`filter`,{id:`phone-bar-goo`,x:`-10%`,y:`-50%`,width:`120%`,height:`200%`,colorInterpolationFilters:`sRGB`,children:[(0,K.jsx)(`feGaussianBlur`,{in:`SourceGraphic`,stdDeviation:WD}),(0,K.jsx)(`feColorMatrix`,{values:`1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 20 -9.5`,result:`shape`}),(0,K.jsx)(`feMorphology`,{in:`shape`,operator:`erode`,radius:`1`,result:`inner`}),(0,K.jsx)(`feFlood`,{floodColor:`var(--ink)`,floodOpacity:`0.12`}),(0,K.jsx)(`feComposite`,{in2:`shape`,operator:`in`}),(0,K.jsx)(`feComposite`,{in2:`inner`,operator:`out`,result:`rim`}),(0,K.jsx)(`feGaussianBlur`,{in:`shape`,stdDeviation:`4`}),(0,K.jsx)(`feOffset`,{dy:`2`}),(0,K.jsx)(`feColorMatrix`,{values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4 0`}),(0,K.jsx)(`feComposite`,{in2:`shape`,operator:`out`,result:`shadow`}),(0,K.jsxs)(`feMerge`,{children:[(0,K.jsx)(`feMergeNode`,{in:`shadow`}),(0,K.jsx)(`feMergeNode`,{in:`shape`}),(0,K.jsx)(`feMergeNode`,{in:`rim`})]})]})})]}),d.capsule&&(0,K.jsx)(`div`,{ref:f,className:`flex-none ${C}`,children:d.capsule},s),(0,K.jsxs)(`button`,{ref:p,type:`button`,disabled:d.action?.disabled,className:`group/glass pointer-events-auto relative h-13 min-w-0 flex-1 cursor-pointer disabled:opacity-50 ${jn} ${C}`,"data-new-task-bar":d.wide?``:void 0,onClick:()=>{TD(),S?.()},children:[(0,K.jsx)(`span`,{className:`absolute inset-0 ${An} ${Nn} ${x?`bg-accent shadow-popover`:On()}`}),(0,K.jsx)(`span`,{ref:m,className:`relative block h-full`,children:(0,K.jsx)(QD,{spec:d})},s)]})]})}function eO(e){return(0,K.jsxs)(`button`,{type:`button`,className:`flex min-h-13 w-full flex-col justify-center gap-0.5 px-3 py-2 text-left hover:bg-hover active:bg-hover focus-visible:bg-hover focus-visible:outline-none`,onClick:e.onClick,onContextMenu:e.onContextMenu,children:[(0,K.jsxs)(`span`,{className:`flex w-full min-w-0 items-baseline gap-2`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-sans text-body text-ink`,children:e.title}),e.trailing]}),e.subtitle&&(0,K.jsx)(`span`,{className:`w-full truncate font-sans text-meta text-muted`,children:e.subtitle})]})}function tO(e){return ID(`page`,e.primary?{wide:e.primary}:e.action?{action:e.action}:null),(0,K.jsx)(`div`,{ref:e.rootRef,tabIndex:-1,className:`relative flex min-h-0 flex-1 flex-col focus:outline-none`,children:(0,K.jsxs)(`div`,{className:`${kD} ${e.primary||e.action?`pb-20`:``}`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(AD,{children:e.title}),e.note&&(0,K.jsx)(`p`,{className:`m-0 font-sans text-meta text-muted`,children:e.note})]}),e.children]})})}function nO({label:e}){return(0,K.jsx)(`button`,{type:`button`,className:`${$n(`off`)} hidden keyboard:block`,"aria-label":e,onClick:()=>document.activeElement?.blur(),children:(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`mx-auto size-5 fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.6]`,"aria-hidden":`true`,children:[(0,K.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`12`,rx:`2`}),(0,K.jsx)(`path`,{d:`M7 7h.01M11 7h.01M15 7h.01M8 11h8M9 19l3 3 3-3`})]})})}var rO=x();H();var iO=`fixed inset-x-0 top-0 z-50 flex h-(--vvh,100dvh) items-end bg-[var(--scrim)]`,aO=`static m-0 flex max-h-[85dvh] w-full max-w-none flex-col rounded-t-[16px] border-0 p-0 text-inherit bg-surface pb-[max(env(safe-area-inset-bottom),12px)] shadow-dialog focus:outline-none keyboard:max-h-[calc(var(--vvh,100dvh)-24px)] keyboard:pb-3`,oO=`flex flex-none touch-none flex-col`,sO=`mx-auto mt-2 mb-1 h-1 w-9 rounded-full bg-line-active`,cO=`m-0 px-5 pt-2 pb-2 font-sans text-body font-semibold text-ink`,lO=`flex min-h-0 flex-col overflow-y-auto px-3 pb-1`,uO=`flex min-h-11 w-full flex-none items-center gap-3 rounded-sm px-2 text-left font-sans text-body hover:bg-hover active:bg-hover focus-visible:bg-hover focus-visible:outline-none`,dO={ink:`text-ink`,danger:`text-error`,muted:`text-muted`,cancel:`justify-center font-semibold text-ink`,action:`justify-center font-semibold text-accent`},fO=`flex min-h-11 w-full flex-none flex-col justify-center gap-1 rounded-sm px-2 py-2 text-left font-sans text-ink hover:bg-hover active:bg-hover focus-visible:bg-hover focus-visible:outline-none disabled:opacity-60`,pO=`mx-2 my-1 h-px flex-none border-none bg-line`,mO=`ml-auto size-4 flex-none fill-none stroke-accent [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.75]`,hO=48;function gO(e){let t=(0,J.useRef)(null),n=(0,J.useRef)(null),[r,i]=(0,J.useState)(!1),a=(0,J.useRef)(!1),o=()=>oe()?e.onClose():i(!0);return(0,J.useEffect)(()=>{n.current?.contains(document.activeElement)||n.current?.focus()},[]),(0,rO.createPortal)((0,K.jsx)(`div`,{className:`${iO} ${r?`pointer-events-none animate-fade-out`:`motion-safe:animate-fade-in`}`,onPointerDown:e=>{a.current=e.target===e.currentTarget},onClick:e=>a.current&&e.target===e.currentTarget&&o(),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),o())},children:(0,K.jsxs)(`dialog`,{ref:n,tabIndex:-1,open:!0,"aria-modal":`true`,"aria-label":e.label,className:`${aO} ${r?`animate-sheet-out`:`motion-safe:animate-sheet-in`}`,onAnimationEnd:t=>r&&t.target===t.currentTarget&&e.onClose(),children:[(0,K.jsxs)(`div`,{className:oO,onTouchStart:e=>{t.current=e.touches[0]?.clientY??null},onTouchEnd:e=>{let n=t.current;t.current=null,n!==null&&(e.changedTouches[0]?.clientY??n)-n>hO&&o()},children:[(0,K.jsx)(`span`,{className:sO,"aria-hidden":`true`}),e.title&&(0,K.jsx)(`h2`,{className:cO,children:e.title})]}),e.children(o)]})}),document.body)}function _O(e){let{tone:t=`ink`,stacked:n=!1,...r}=e;return(0,K.jsx)(`button`,{type:`button`,className:n?fO:`${uO} ${dO[t]}`,...r})}function vO(){return(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,className:mO,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:`M3 8.5 6.5 12 13 4.5`})})}function yO(e){let t=(0,J.useRef)(null);return(0,J.useEffect)(()=>t.current?.focus(),[]),(0,K.jsx)(gO,{label:e.title,title:e.title,onClose:e.onClose,children:n=>(0,K.jsx)(`div`,{className:lO,children:e.picks.map(r=>{let i=r.value===e.value;return(0,K.jsxs)(_O,{ref:i?t:void 0,"aria-pressed":i,onClick:()=>{TD(),n(),i||e.onPick(r.value)},children:[(0,K.jsx)(`span`,{className:`min-w-0`,children:r.label}),i&&(0,K.jsx)(vO,{})]},r.value)})})})}var bO=24,xO=16,SO=120,CO={accent:`bg-accent text-paper`,danger:`bg-error text-paper`,neutral:`bg-line-active text-ink`},wO={surface:`bg-surface`,paper:`bg-paper`};function TO(e){let[t,n]=(0,J.useState)(0),r=(0,J.useRef)(null),i=(0,J.useRef)(!1),a=t<0?e.left:t>0?e.right:void 0,o=t=>Math.max(e.left?-window.innerWidth:0,Math.min(e.right?window.innerWidth:0,t));return(0,K.jsxs)(`div`,{className:`relative overflow-hidden touch-pan-y`,onTouchStart:e=>{let t=e.touches[0];r.current=t&&e.touches.length===1&&t.clientX>bO?{x:t.clientX,y:t.clientY,on:!1}:null},onTouchMove:e=>{let t=r.current,i=e.touches[0];if(!t||!i)return;let a=i.clientX-t.x;if(!t.on){let e=i.clientY-t.y;if(Math.hypot(a,e)<xO)return;if(Math.abs(a)<=2*Math.abs(e)){r.current=null;return}t.on=!0,t.x=i.clientX}n(o(Math.round(i.clientX-t.x)))},onTouchEnd:()=>{let e=r.current;r.current=null,e?.on&&(i.current=!0,a&&Math.abs(t)>=SO&&(TD(`medium`),a.run()),n(0))},onTouchCancel:()=>{r.current=null,n(0)},onClickCapture:e=>{i.current&&(i.current=!1,e.preventDefault(),e.stopPropagation())},children:[a&&(0,K.jsx)(`div`,{"aria-hidden":`true`,className:`absolute inset-0 flex items-center px-5 font-sans text-body font-semibold ${t<0?`justify-end`:`justify-start`} ${CO[a.tone]}`,children:a.label}),(0,K.jsx)(`div`,{className:`relative ${t===0?`transition-transform duration-200 ease-snap motion-reduce:transition-none`:`${wO[e.ground??`surface`]} will-change-transform`}`,style:t?{transform:`translateX(${t}px)`}:void 0,children:e.children})]})}var EO={accent:`text-accent`,muted:`text-subtle`,attention:`text-error`,warning:`text-warning`,info:`text-info`,success:`text-success`,added:`text-diff-added`,removed:`text-diff-removed`},DO={accent:`text-accent`,muted:`text-subtle`,attention:`text-error`,warning:`text-warning`,success:`text-success`,info:`text-accent`,ink:`text-ink`};G(),H();function OO({model:e}){W();let{attention:t,recent:n,now:r,open:i,ack:a,ackAll:o,peekOf:s,menuOf:c}=dl(e),[l,u]=(0,J.useState)(null),d=e=>e.attention&&$c(e.attention.state).glyph===`?`?0:1,f=[...t].sort((e,t)=>d(e)-d(t)),p=t=>{let n=t.attention?$c(t.attention.state):null,o=s(t),d=c(t,e=>u(e.id)),f=(0,K.jsx)(eO,{title:t.identity,subtitle:t.subtitle,onClick:()=>i(t),onContextMenu:e=>{e.preventDefault(),de.set({x:e.clientX,y:e.clientY,target:e.currentTarget,items:d})},trailing:(0,K.jsxs)(K.Fragment,{children:[n&&(0,K.jsxs)(`span`,{className:`flex-none font-sans text-meta ${n.tone===`success`?`text-subtle`:DO[n.tone]}`,children:[n.glyph,` `,U(n.stateKey)]}),(0,K.jsx)(`span`,{className:`flex-none font-sans text-meta text-subtle`,children:el(r-t.at)})]})});return(0,K.jsxs)(`div`,{children:[t.attention?(0,K.jsx)(TO,{left:{label:U(`inbox.phone.ack`),tone:`accent`,run:()=>a(t)},children:f}):f,o&&l===o.id&&t.taskId&&(0,K.jsx)(wD,{model:e,taskId:t.taskId,tabId:o.tabId,mode:o.mode,gate:o.gate,onOpenTab:()=>i(t)})]},t.key)};return(0,K.jsx)(gO,{label:U(`inbox.phone.title`),title:U(`inbox.phone.title`),onClose:ce,children:()=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`${lO} gap-4`,children:[t.length===0&&n.length===0&&(0,K.jsx)(`p`,{className:`m-0 px-2 py-3 font-sans text-body text-muted`,children:U(`inbox.phone.empty`)}),t.length>0&&(0,K.jsx)(jD,{label:U(`inbox.attention`),children:f.map(p)}),n.length>0&&(0,K.jsx)(jD,{label:U(`inbox.recent`),children:n.map(p)})]}),t.length>0&&(0,K.jsx)(`div`,{className:`flex-none px-3 pt-1`,children:(0,K.jsx)(_O,{tone:`action`,onClick:o,children:U(`inbox.phone.ackAll`)})})]})})}function kO({text:e}){return(0,K.jsx)(`span`,{className:`inline-flex flex-wrap gap-x-3 gap-y-0`,children:e.split(`·`).map(e=>e.trim()).filter(Boolean).map(e=>(0,K.jsx)(`span`,{children:e},e))})}G(),He(),H();function AO({model:e}){return ke()?(0,K.jsx)(OO,{model:e}):(0,K.jsx)(jO,{model:e})}function jO({model:e}){W();let{attention:t,recent:n,cards:r,now:i,open:a,ack:o,ackAll:s,peekOf:c,menuOf:l}=dl(e),u=(0,J.useRef)(null),[d,f]=(0,J.useState)(0),[p,m]=(0,J.useState)(null),h=r[Math.min(d,r.length-1)],g=(0,J.useRef)(!1),_=e=>{g.current=!0,f(t=>Math.max(0,Math.min(r.length-1,t+e)))};(0,J.useEffect)(()=>{g.current&&u.current?.querySelectorAll(`li`)[d]?.scrollIntoView({block:`nearest`}),g.current=!1},[d]),(0,J.useEffect)(()=>{let e=e=>{if(!(e.target instanceof HTMLElement&&e.target.closest(`input, textarea`))){if(e.key===`ArrowDown`||e.key===`j`)_(1);else if(e.key===`ArrowUp`||e.key===`k`)_(-1);else if(e.key===`Enter`&&h)a(h);else if(e.key===`d`&&h)o(h);else if(e.key===`D`)s();else return;e.preventDefault()}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)});let v=t=>{let n=t.attention?$c(t.attention.state):null,s=n?.tone===`success`,u=t===h,d=c(t),g=!!d&&p===d.id,_=!!d||!!t.attention;return(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`div`,{className:ga,onMouseEnter:()=>f(r.indexOf(t)),onContextMenu:e=>{e.preventDefault();let n=l(t,e=>m(e.id));de.set({x:e.clientX,y:e.clientY,target:e.currentTarget,items:n})},children:[(0,K.jsxs)(`button`,{type:`button`,className:`${Aa({selected:u})} ${_a}`,onClick:()=>a(t),children:[(0,K.jsx)(`span`,{className:`${Pa} ${n&&!s?DO[n.tone]:`text-subtle`}`,title:n?U(n.stateKey):void 0,children:n?.glyph}),(0,K.jsxs)(`span`,{className:pa,children:[(0,K.jsx)(`span`,{className:ma,children:t.label}),(0,K.jsx)(`span`,{className:ha,children:[t.project,t.subtitle].filter(Boolean).join(` · `)})]}),n&&!s&&(0,K.jsx)(`span`,{className:`flex-none font-mono text-meta font-normal normal-nums ${DO[n.tone]}`,children:U(n.stateKey)}),(0,K.jsx)(`span`,{className:`${da} ${g?`invisible`:_?fa:``}`,children:el(i-t.at)})]}),_&&(0,K.jsxs)(`span`,{className:`absolute inset-y-0 right-2 flex items-center gap-0.5 ${g?``:`invisible group-hover/card:visible group-focus-within/card:visible`}`,children:[d&&(0,K.jsx)(q,{variant:g?`iconOn`:`icon`,"aria-label":U(`inbox.phone.reply`),title:U(`inbox.phone.reply`),"aria-expanded":g,onClick:()=>m(g?null:d.id),children:(0,K.jsx)(CD,{d:`M6.5 4 3 7.5 6.5 11M3 7.5h6.5a3.5 3.5 0 0 1 3.5 3.5v1`})}),t.attention&&(0,K.jsx)(q,{variant:`icon`,"aria-label":U(`inbox.phone.ack`),title:U(`inbox.phone.ack`),onClick:()=>o(t),children:(0,K.jsx)(CD,{d:`M3.5 8.5 6.5 11.5 12.5 4.5`})})]})]}),g&&t.taskId&&(0,K.jsx)(wD,{model:e,taskId:t.taskId,tabId:d.tabId,mode:d.mode,gate:d.gate,onOpenTab:()=>a(t)})]},t.key)};return(0,K.jsx)(za,{title:U(`inbox.title`),wide:!0,children:(0,K.jsxs)(`div`,{ref:u,className:Yi,children:[(0,K.jsxs)(`div`,{className:ca,children:[(0,K.jsx)(`p`,{className:`${Di} text-muted ${sa} touch:hidden!`,children:(0,K.jsx)(kO,{text:U(`inbox.hints`)})}),t.length>0&&(0,K.jsx)(q,{variant:`pill`,onClick:s,children:U(`inbox.phone.ackAll`)})]}),(0,K.jsx)(`h2`,{className:`${Di} text-muted ${la}`,children:U(`inbox.attention`)}),t.length===0?(0,K.jsx)(`p`,{className:`mono text-muted`,children:U(`inbox.empty`)}):(0,K.jsx)(`ul`,{className:ua,children:t.map(v)}),n.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`h2`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted mt-1`,children:U(`inbox.recent`)}),(0,K.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:n.map(v)})]})]})})}wl(),G();function MO(e){return e instanceof yl&&e.code===`NOT_CONNECTED`?U(`workspace.connect.notConnected`):e instanceof Error?e.message:String(e)}H();var NO=`rove.web.legacyAdopt.dismissed`,PO=6,FO=!1,IO=e=>e.replace(/[\\/]+$/,``).split(/[\\/]/).at(-1)??e;function LO(){try{return localStorage.getItem(NO)===`1`}catch{return!1}}function RO(){try{localStorage.setItem(NO,`1`)}catch{}}function zO(e){let t=e.slice(0,PO).map(e=>` ${IO(e.repo)}/${e.title}`);return e.length>PO&&t.push(` ${Y(`tasks`,`confirm.legacyAdoptMore`,{count:e.length-PO})}`),t.join(`
|
|
191
|
+
`)}function BO(e){return Y(`tasks`,`confirm.legacyAdoptPrompt`,{list:e.map(e=>`- ${e.id} · ${e.title} · ${e.worktreePath}`).join(`
|
|
192
|
+
`)})}async function VO(e){if(FO||LO())return;FO=!0;let{tasks:t}=await e.client.request(`worktree.legacyAdopted`,{}).catch(()=>({tasks:[]}));t.length!==0&&B.get()===null&&B.set((0,K.jsx)(HO,{model:e,tasks:t}))}function HO(e){let[t,n]=(0,J.useState)(!1),[r,i]=(0,J.useState)(null),a=async()=>{n(!0),i(null);try{let{taskId:t}=await e.model.client.request(`worktree.legacyCleanup`,{title:Y(`tasks`,`confirm.legacyAdoptSessionTitle`),prompt:BO(e.tasks)});ce(),e.model.selectWhenListed(t)}catch(e){i(Y(`tasks`,`confirm.legacyAdoptFailed`,{message:MO(e)}))}finally{n(!1)}};return(0,K.jsx)(za,{title:Y(`tasks`,`confirm.legacyAdoptTitle`,{count:e.tasks.length}),children:(0,K.jsxs)(`div`,{className:Yi,children:[(0,K.jsx)(`p`,{className:`text-muted whitespace-pre-wrap`,children:Y(`tasks`,`confirm.legacyAdoptBody`,{list:zO(e.tasks)})}),r&&(0,K.jsx)(`p`,{className:`text-error`,children:r}),(0,K.jsxs)(`div`,{className:Mi,children:[(0,K.jsx)(q,{onClick:()=>{RO(),ce()},children:Y(`tasks`,`confirm.legacyAdoptNever`)}),(0,K.jsx)(q,{onClick:ce,children:Y(`tasks`,`confirm.legacyAdoptLater`)}),(0,K.jsx)(q,{variant:`filled`,disabled:t,autoFocus:!0,onClick:()=>void a(),children:Y(`tasks`,`confirm.legacyAdoptClean`)})]})]})})}h(),_l();function UO(e,t){let n=t&&typeof t==`object`?t:{};if(e===200&&typeof n.token==`string`&&/^[A-Za-z0-9_-]{43}$/.test(n.token))return{kind:`ok`,token:n.token};if(e===429){if(n.locked===`global`)return{kind:`lockedHost`};let e=typeof n.retryAfterSeconds==`number`?n.retryAfterSeconds:900;return{kind:`locked`,minutes:Math.max(1,Math.ceil(e/60))}}return e===401?{kind:`wrong`}:{kind:`unreachable`}}async function WO(e=fl){try{let t=await e(`/login`,{headers:{Accept:`application/json`},cache:`no-store`});return!t.ok||!(t.headers.get(`content-type`)??``).includes(`application/json`)?!1:(await t.json()).password===!0}catch{return!1}}async function GO(e=fl){try{let t=await e(`/auth`,{headers:{Accept:`application/json`},cache:`no-store`});return!t.ok||!(t.headers.get(`content-type`)??``).includes(`application/json`)?!1:(await t.json()).open===!0}catch{return!1}}async function KO(e,t=fl){try{let n=await t(`/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:e}),credentials:`omit`}),r=UO(n.status,await n.json().catch(()=>null));return r.kind===`ok`&&f(r.token),r}catch{return{kind:`unreachable`}}}async function qO(e=fl){let t=d();p(),t&&await e(`/logout`,{method:`POST`,headers:{Authorization:`Bearer ${t}`}}).catch(()=>{})}G(),Ur();function JO(e){if(!e)return null;switch(e.kind){case`ok`:return null;case`wrong`:return U(`login.wrong`);case`locked`:return U(`login.locked`,{minutes:e.minutes});case`lockedHost`:return U(`login.lockedHost`);case`unreachable`:return U(`login.unreachable`)}}function YO(){W();let[e,t]=(0,J.useState)(``),[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(null),o=JO(i);return(0,K.jsx)(`div`,{className:Br,children:(0,K.jsxs)(`form`,{className:Vr,onSubmit:async i=>{if(i.preventDefault(),n||!e)return;r(!0);let o=await KO(e);if(o.kind===`ok`){window.location.reload();return}t(``),a(o),r(!1)},children:[(0,K.jsxs)(`span`,{className:Rr,children:[(0,K.jsx)(`span`,{className:zr,children:`[`}),` rove `,(0,K.jsx)(`span`,{className:zr,children:`]`})]}),(0,K.jsx)(`h1`,{className:`${Di} text-muted`,children:U(`login.title`)}),(0,K.jsx)(`p`,{className:`text-muted`,children:U(`login.body`)}),(0,K.jsx)(`input`,{className:ji,type:`password`,autoComplete:`current-password`,"aria-label":U(`login.field`),placeholder:U(`login.field`),autoFocus:!0,value:e,disabled:n,onChange:e=>{t(e.target.value),a(null)}}),o&&(0,K.jsx)(`p`,{className:`text-error`,role:`alert`,children:o}),(0,K.jsx)(`div`,{className:Mi,children:(0,K.jsx)(`button`,{type:`submit`,className:vi(),disabled:n||!e,children:U(n?`login.checking`:`login.submit`)})})]})})}G();var XO=524288e3,ZO=1048576;function QO(e,t){return/\.pdf$/i.test(e)?`pdf[${t}]`:/\.(png|jpe?g|gif|webp)$/i.test(e)?`images[${t}]`:`files[${t}]`}function $O(e){let t=-1;for(let n of e.matchAll(/^(?:images|pdf|files)\[(\d+)\]:/gm)){let e=Number.parseInt(n[1],10);e>t&&(t=e)}return t+1}function ek(e,t){let n=e.replace(/\s+$/,``),r=$O(e);for(let e of t){let t=`${QO(e,r)}: ${e}`;n=n.length>0?`${n}\n${t}`:t,r+=1}return n}function tk(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}async function nk(e,t,n){if(t.size>524288e3)throw Error(U(`pages.attachTooLarge`,{name:t.name}));let r={mime:t.type,name:t.name,...n?{task:n}:{}},i=async(e,n)=>tk(new Uint8Array(await t.slice(e,n).arrayBuffer()));if(t.size<=1048576)return e.request(`attachment.put`,{...r,data:await i(0,t.size)});let a;for(let n=0;;){let o=Math.min(n+ZO,t.size),s=await e.request(`attachment.part`,{...r,...a?{upload:a}:{},offset:n,data:await i(n,o),done:o===t.size});if(s.path!==void 0)return{path:s.path,kind:s.kind??`file`};a=s.upload,n=o}}async function rk(e,t,n){return(await nk(e,t,n)).path}function ik(e){if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`,`TB`],n=e/1024,r=0;for(;n>=1023.5&&r<t.length-1;)n/=1024,r++;let i=n.toFixed(1);return`${Number(i)>=100?Math.round(n):i} ${t[r]}`}G();var ak=`size-14 rounded-sm border-hairline border-line object-cover`;function ok({name:e,thumb:t}){if(t)return(0,K.jsx)(`img`,{src:t,alt:``,draggable:!1,className:ak});let n=e.includes(`.`)?e.split(`.`).pop()??``:``;return(0,K.jsx)(`span`,{className:`${ak} flex items-center justify-center font-mono text-meta uppercase text-muted`,children:n.slice(0,4)||`file`})}function sk({item:e,onRemove:t}){let[n]=(0,J.useState)(e.pending);return(0,K.jsxs)(`li`,{className:`group relative size-14 shrink-0 ${n?`motion-safe:animate-rise-in`:``}`,title:`${e.name} · ${ik(e.size)}`,children:[(0,K.jsx)(`div`,{className:`transition-opacity duration-150 motion-reduce:transition-none ${e.pending?`opacity-50`:``}`,children:(0,K.jsx)(ok,{...e})}),(0,K.jsx)(`button`,{type:`button`,"aria-label":U(`newSession.removeAttachment`,{name:e.name}),className:`absolute top-0.5 right-0.5 flex size-5 cursor-pointer items-center justify-center rounded-full border-hairline border-line bg-paper p-0 text-meta leading-none text-ink opacity-0 group-focus-within:opacity-100 group-hover:opacity-100 touch:size-7 touch:opacity-100 touch:after:absolute touch:after:-inset-2 touch:after:content-['']`,onClick:()=>t(e.id),children:`×`})]})}function ck({items:e,onRemove:t}){return e.length===0?null:(0,K.jsx)(`ul`,{className:`m-0 flex min-w-0 list-none flex-wrap gap-1.5 p-0`,"data-field":`attachments`,children:e.map(e=>(0,K.jsx)(sk,{item:e,onRemove:t},e.id))})}function lk(e,t){let n=e=>e.dataTransfer.types.includes(`Files`);return{drop:{onDragEnter:e=>n(e)&&t?.(!0),onDragOver:e=>{n(e)&&(e.preventDefault(),t?.(!0))},onDragLeave:e=>{let n=e.currentTarget.getBoundingClientRect();e.clientX>n.left&&e.clientX<n.right&&e.clientY>n.top&&e.clientY<n.bottom||t?.(!1)},onDrop:n=>{t?.(!1),n.dataTransfer.files.length!==0&&(n.preventDefault(),n.stopPropagation(),e(Array.from(n.dataTransfer.files)))}},onPaste:t=>{let n=Array.from(t.clipboardData.files);n.length!==0&&(t.preventDefault(),e(n))}}}function uk(e){let[t,n]=(0,J.useState)(!1);return{over:t,...lk(e,n)}}function dk(e){return(0,K.jsxs)(`label`,{className:e.className,title:e.title,"data-tp-part":`composer-attach`,children:[e.children,(0,K.jsx)(`input`,{type:`file`,multiple:!0,className:`sr-only`,disabled:e.disabled,onChange:t=>{let n=Array.from(t.target.files??[]);t.target.value=``,n.length>0&&e.onFiles(n)}})]})}var fk={image:`images`,pdf:`pdf`};function pk(e,t){let n=t.filter(e=>e.path!==void 0);return n.length===0?e:`${e}\n\n${n.map((e,t)=>`${fk[e.kind??`image`]??`files`}[${t}]: ${e.path}`).join(`
|
|
193
|
+
`)}`}var mk=112;async function hk(e){if(e.type.startsWith(`image/`))try{let t=await createImageBitmap(e),n=Math.min(1,mk/Math.min(t.width,t.height)),r=document.createElement(`canvas`);return r.width=Math.round(t.width*n),r.height=Math.round(t.height*n),r.getContext(`2d`)?.drawImage(t,0,0,r.width,r.height),t.close(),r.toDataURL(`image/webp`,.8)}catch{return}}function gk(e){if(!e)return[];try{let t=JSON.parse(sessionStorage.getItem(e)??`[]`);return Array.isArray(t)?t:[]}catch{return[]}}var _k=0;function vk(e,t,n,r){let[i,a]=(0,J.useState)(()=>gk(n)),o=(0,J.useRef)(i),s=(0,J.useRef)(new Set),c=e=>{if(o.current=e(o.current),a(o.current),n)try{sessionStorage.setItem(n,JSON.stringify(o.current.filter(e=>e.path!==void 0)))}catch{}},l=async n=>{let i=`${Date.now()}-${_k++}`,a=await hk(n);c(e=>[...e,{id:i,name:n.name,size:n.size,mime:n.type,...a?{thumb:a}:{}}]);try{let t=await nk(e.client,n,r);c(e=>e.map(e=>e.id===i?{...e,path:t.path,kind:t.kind}:e))}catch(e){c(e=>e.filter(e=>e.id!==i)),t(e instanceof Error?e.message:String(e))}};return{attachments:i,attach:e=>{for(let t of e){let e=l(t);s.current.add(e),e.finally(()=>s.current.delete(e))}},remove:e=>c(t=>t.filter(t=>t.id!==e)),ready:async()=>(await Promise.all(s.current),o.current),clear:()=>c(()=>[])}}function yk(e){return(0,K.jsx)(ck,{items:e.attachments.map(e=>({...e,pending:e.path===void 0})),onRemove:e.onRemove})}var bk=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5],xk=Array.from({length:64},(e,t)=>{let n=t%8,r=t>>3;return(4*(bk[(r&3)*4+(n&3)]??0)+([0,2,3,1][(r>>2)*2+(n>>2)]??0)+.5)/64}),Sk=(e,t)=>xk[(t&7)*8+(e&7)]??1,Ck=[[6,9,.3],[22,68,2.1],[37,4,4],[95,7,1.2],[118,20,3.3],[122,62,5.1],[11,40,2.8],[83,75,.9]];function wk(e,t){e.fill(0);for(let[n,r,i]of Ck)Math.sin(t*.8+i)>-.5&&(e[r*128+n]=1)}var Tk=64,Ek=40,Dk=25,Ok=(1-1.2/Dk)**2,kk=[{radius:1.55,lift:.3,roll:-.42,speed:.9,phase:.4,ink:4},{radius:1.95,lift:.22,roll:.3,speed:-.55,phase:2.6,ink:3},{radius:2.4,lift:.36,roll:-.12,speed:.38,phase:4.4,ink:3}],Ak=1.9;function jk(e,t){wk(e,t);let n=(t,n,r)=>{t>=0&&t<128&&n>=0&&n<80&&(e[n*128+t]=r)},r=-.55+.25*Math.sin(t*.3),i=-.5,a=.67,o=Math.hypot(r,i,a),s=t*.35,c=Math.sin(s),l=Math.cos(s),u=.4,d=Math.sin(u),f=Math.cos(u);for(let e=0;e<80;e++)for(let t=0;t<128;t++){let s=(t+.5-Tk)/Dk,u=(e+.5-Ek)/Dk,p=s*s+u*u;if(p>=1)continue;let m=Math.sqrt(1-p),h=Math.max(0,(s*r+u*i+m*a)/o),g=s*f+u*d,_=u*f-s*d,v=Math.atan2(g*l+m*c,m*l-g*c),y=Math.asin(Math.max(-1,Math.min(1,_))),b=.5+.5*Math.sin(y*9+1.3*Math.sin(v*2+y*3));h**.75*(.4+.6*b)>Sk(t,e)?n(t,e,h>.4?3:2):p>Ok&&n(t,e,1)}for(let e of kk){let r=Math.sin(e.roll),i=Math.cos(e.roll),a=t=>{let n=e.radius*Math.cos(t),a=e.radius*Math.sin(t),o=a*e.lift,s=n*i-o*r,c=n*r+o*i,l=s*s+c*c<1;return a<0&&l?null:[Math.floor(Tk+s*Dk),Math.floor(Ek+c*Dk),l]},o=Math.round(Math.PI*e.radius*Dk);for(let e=0;e<o;e++){let t=a(e/o*Math.PI*2);t&&!t[2]&&n(t[0],t[1],1)}let s=e.phase+t*e.speed,c=.5/(e.radius*Dk),l=-Math.sign(e.speed)*c;for(let e=Ak/c;e>=0;e--){let t=a(s+e*l);if(t?.[2])for(let e=-2;e<=2;e++)for(let r=-2;r<=2;r++)n(t[0]+r,t[1]+e,0)}for(let t=Ak/c;t>0;t--){let r=a(s+t*l),i=1-t*c/Ak;r&&i>Sk(r[0],r[1])&&n(r[0],r[1],i>.6?e.ink:2)}let u=a(s);if(u)for(let t=-1;t<=1;t++)for(let r=-1;r<=1;r++)n(u[0]+r,u[1]+t,e.ink)}}var Mk=-.38,Nk=Math.cos(Mk),Pk=Math.sin(Mk),Fk=.3;function Ik(e,t){wk(e,t);let n=t*.21,r=55*Math.cos(n),i=21*Math.sin(n),a=r*Nk-i*Pk,o=r*Pk+i*Nk;for(let t=0;t<80;t++)for(let r=0;r<128;r++){let s=t*128+r,c=r+.5-64,l=t+.5-40,u=c*Nk+l*Pk,d=l*Nk-c*Pk,f=Sk(r,t),p=(u*u+d*d)/441;if(p<1){let t=Math.sqrt(1-p),r=Math.max(0,-.57*u/21-.68*d/21+.56*t),i=d/21+.17*t;e[s]=r*(.73+.23*Math.cos(i*18+.5*Math.sin(n+u/9)))>f?3:+(p>.94&&f<.68)}let m=Math.hypot(u,d/Fk);if(m>=28&&m<53&&(p>=1||d>0)){let t=.61+.29*Math.cos(m*1.4)+.1*Math.sin(m*3-n);e[s]=(m>41.5&&m<44.5?0:t*(u>10&&d<0&&Math.abs(d)<7?.32:1)*(m<31||m>49?.55:1))>f?m>45&&m<47&&u<-8&&d>0?4:d>0?3:2:0}let h=Math.hypot(c-a,l-o);h<2&&(p>=1||i>0)&&(e[s]=h<1.45?4:2)}}var Lk=[[-.33,-.34,.22],[.22,-.5,.11],[-.48,.2,.13],[.15,.34,.27]];function Rk(e,t){wk(e,t);let n=t*.27,r=26+6*Math.cos(n),i=49+3*Math.sin(n);for(let t=0;t<80;t++)for(let a=0;a<128;a++){let o=t*128+a,s=Sk(a,t),c=(a-94)/15,l=(t-55)/15,u=c*c+l*l;if(u<1){let t=Math.sqrt(1-u),n=-.83*c-.49*l+.19*t;for(let[e,t,r]of Lk){let i=Math.hypot(c-e,l-t)/r;i<1&&(n+=i>.72?.22:-.3)}e[o]=n>s?n>.54?3:2:+(u>.92&&s<.28)}let d=a-r,f=t-i,p=d/80;if(p>0&&p<1){let t=-d*.63+28*p*p,r=3+13*p,i=(f-t)/r,a=Math.max(0,1-Math.abs(i)),c=.58+.42*Math.cos(i*14+p*5-n),l=Math.max(0,1-Math.abs(f+d*.54)/1.65);(a*c+l*.75)*(1-p)>s&&(e[o]=l>.55&&p<.68?4:p<.56?3:2)}let m=Math.hypot(d,f);m<2.8?e[o]=3:m<8&&.84*(1-m/8)**1.3>s&&(e[o]=4)}}var zk=`flex min-h-0 w-full flex-1 flex-col overflow-y-auto`,Bk=`mx-auto mt-[clamp(0rem,calc(50dvh-13rem),12rem)] flex w-full max-w-130 flex-col items-center gap-4 px-5 py-7 text-center narrow:mt-0 narrow:pb-20`,Vk=`relative mb-3 aspect-[760/335] min-h-0 w-full max-w-[830px] shrink narrow:aspect-[760/465]`;function Hk(e){let t=e;return()=>(t=Math.imul(t,1664525)+1013904223>>>0,t/4294967296)}var Uk=Hk(892671),Wk=Array.from({length:104},(e,t)=>({along:Uk()+Uk()-1,across:Uk()+Uk()-1,depth:Uk(),phase:Uk()*2*Math.PI,pace:Uk(),starX:44+Uk()*672,starY:23+Uk()*284,copper:t===2||t===61||t===24,near:t===2||t===30||t===82,lead:t===2,glint:t===59})).sort((e,t)=>Number(e.near)-Number(t.near)||e.depth-t.depth),Gk=Array.from({length:12},()=>({x:15+Uk()*730,y:12+Uk()*300,phase:Uk()*2*Math.PI})),Kk=[[-2,174,174],[0,222,172],[2,262,167],[4,372,149],[5.8,485,96],[6.9,555,101],[7.8,551,143],[8.9,484,174],[10.4,351,204],[11.7,246,177],[13,217,128],[14.3,285,100],[16,459,103],[18,642,132],[20,826,135]];function qk(e){let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)}function Jk(e){let t=0;for(;t<Kk.length-2&&e>Kk[t+1][0];)t++;let n=Kk[t],r=Kk[t+1],i=Kk[Math.max(0,t-1)],a=Kk[Math.min(Kk.length-1,t+2)],o=r[0]-n[0],s=Math.max(0,Math.min(1,(e-n[0])/o)),c=s*s,l=c*s;function u(e){let t=(r[e]-i[e])*o/(r[0]-i[0]),u=(a[e]-n[e])*o/(a[0]-n[0]);return(2*l-3*c+1)*n[e]+(l-2*c+s)*t+(3*c-2*l)*r[e]+(l-c)*u}return[u(1),u(2)]}function Yk(e,t){let n=t+e.along*1.43+(e.depth-.5)*.32,[r,i]=Jk(n),[a,o]=Jk(n+.045),s=Math.hypot(a-r,o-i)||1,c=(a-r)/s,l=(o-i)/s,u=Math.sin(n*1.25+e.along*2.2),d=43+15*Math.sin(t*.61)+17*u,f=e.along*67+8*Math.sin(t*.58+e.phase),p=e.across*d+u*18+(e.depth-.5)*25+6*Math.sin(t*.72+e.phase),m=e.near?qk((t-5)/3)*(1-qk((t-11.6)/2.1)):0;return{x:r+c*f-l*p+m*(e.depth-.5)*135,y:i+l*f+c*p+m*(e.lead?58:36),near:m}}function Xk(e,t,n,r,i,a,o,s,c){let l=Math.cos(r),u=Math.sin(r),d=(e,r,a=0)=>[t+i*(e*l-r*u+.22*a),n+i*(e*u+r*l*.67-a*.7)];function f(t,n,...r){e.fillStyle=t,e.beginPath(),e.moveTo(...n);for(let t of r)e.lineTo(...t);e.closePath(),e.fill()}function p(e,t){let n=1+e*o*.42,r=a*.85+e*o*.5,i=(t,i,a)=>d(t,e*i*n,a*r);f(t,d(3,e*.4),i(3,3,.8),i(1.4,6.3,3.8),i(-4.9,10.6,6),i(-3.7,6.2,3.9),i(-4.3,6.5,3.5),i(-2.3,2.7,.5),d(-2,e*.45))}p(-1,s),p(1,c),f(c,d(6,0),d(3.1,-.95),d(.8,-1.05),d(-2.4,-.75),d(-5.9,-1.35),d(-5.6,.85),d(-2.2,.55),d(.8,1.18),d(2.8,.72))}function Zk(e,t,n,r,i,a,o,s,c){let l=1-a,u=.5+.5*Math.sin(i*(1.6+t.pace)+t.phase);if(e.save(),e.setTransform(1,0,0,1,Math.round(n*e.canvas.width/760),Math.round(r*e.canvas.height/335)),t.lead||t.glint||t.depth>.945){let n=(t.lead?6:3)+Math.round(u*2),r=Math.max(2,Math.round(n*l*.82));e.fillStyle=c,e.globalAlpha=l*(.69+.18*u),e.fillRect(-r,0,2*r+1,1),e.fillRect(0,-r-1,1,2*r+3),e.globalAlpha=l*(.38+.14*u),e.fillRect(-2,-2,1,1),e.fillRect(2,2,1,1),e.fillRect(-2,2,1,1),e.fillRect(2,-2,1,1),e.fillStyle=s,e.globalAlpha=l,e.fillRect(-1,-1,3,3)}else{let n=t.depth>.54||t.copper;e.fillStyle=n?s:c,e.globalAlpha=l*(n?.83+.17*u:.56+.2*u);let r=n||o?2:1;e.fillRect(0,0,r,r)}e.restore()}function Qk(e,t,n,r){let i=r.getPropertyValue(`--color-ink`).trim(),a=r.getPropertyValue(`--color-muted`).trim(),o=r.getPropertyValue(`--color-accent`).trim(),s=r.getPropertyValue(`--color-subtle`).trim(),c=`color-mix(in srgb, ${i} 60%, ${r.colorScheme===`light`?`black`:`white`})`,l=`color-mix(in srgb, ${a} 60%, ${i})`,u=`color-mix(in srgb, ${i} 55%, ${o})`,d=`color-mix(in srgb, ${o} 70%, ${r.getPropertyValue(`--color-paper`)})`;e.setTransform(e.canvas.width/760,0,0,e.canvas.height/335,0,0),e.clearRect(0,0,760,335),e.fillStyle=s;for(let n of Gk)e.globalAlpha=.33+.18*Math.sin(t*.52+n.phase),e.fillRect(n.x,n.y,1.9,1.9);for(let r of Wk){let f=qk((t-1.8-r.along*.59-r.depth*.56)/2.25)*(1-qk((t-14.85-r.along*.36)/1.87)),p=f>0?Yk(r,t):{x:r.starX,y:r.starY,near:0},m=r.starX+(p.x-r.starX)*f,h=r.starY+(p.y-r.starY)*f;if(f<.97&&Zk(e,r,m,h,t,f,n,r.copper?u:c,r.copper?o:l),f<.04)continue;let g=Yk(r,t+.05),_=Math.atan2(g.y-p.y,g.x-p.x),v=Math.sin(t*(3.9+r.pace*2.4)+r.phase),y=.74*Math.sin(t*1.18+r.along*2.4+.26*r.phase),b=(.31+.51*r.depth**1.8+p.near*(r.lead?2.7:1.55))*(n?1.18:1)*(.28+.72*f);e.globalAlpha=f*(.68+.32*r.depth),Xk(e,m,h,_,b,v,y,r.copper?d:s,r.copper?o:r.depth>.5?i:a)}e.globalAlpha=1}var $k=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function eA(e){let t=document.createElement(`canvas`),n=t.getContext(`2d`,{willReadFrequently:!0}),r=e.getContext(`2d`),i=getComputedStyle(e);return a=>{if(!n||!r||!e.clientWidth||!e.clientHeight)return;let o=e.clientWidth<550,s=o?460:440;t.width!==s&&(t.width=s,t.height=Math.round(s*335/760)),Qk(n,a%17,o,i);let c=n.getImageData(0,0,t.width,t.height),l=3;for(let e=0;e<t.height;e++)for(let n=0;n<t.width;n++,l+=4){let t=c.data[l];if(!t)continue;let r=$k[(n&3)+4*(e&3)];c.data[l]=t>12+7*r?Math.max(135,t)*(r>12?.45:1):0}n.putImageData(c,0,0);let u=Math.min(window.devicePixelRatio||1,2),d=Math.round(e.clientWidth*u),f=Math.round(e.clientHeight*u);(e.width!==d||e.height!==f)&&(e.width=d,e.height=f),r.clearRect(0,0,d,f),r.imageSmoothingEnabled=!1;let p=Math.min(d/760,f/335)*(o?1.24:1),m=760*p,h=335*p;r.drawImage(t,(d-m)/2,(f-h)/2,m,h)}}var tA=3,nA=2,rA=[``,`--color-subtle`,`--color-muted`,`--color-ink`,`--color-accent`],iA={orbit:jk,rings:Ik,comet:Rk},aA=7;function oA(e,t){let n=e.getContext(`2d`);if(!n)return;let r=window.devicePixelRatio||1,i=Math.round(128*tA*r);e.width!==i&&(e.width=i,e.height=Math.round(80*tA*r)),n.setTransform(r,0,0,r,0,0),n.clearRect(0,0,128*tA,80*tA);let a=getComputedStyle(e);for(let e=1;e<=4;e++){n.fillStyle=a.getPropertyValue(rA[e]??``)||a.color;for(let r=0;r<t.length;r++)t[r]===e&&n.fillRect(r%128*tA,Math.floor(r/128)*tA,nA,nA)}}function sA(e,t){let n=new Uint8Array(10240),r=iA[t]??jk;return t=>{r(n,t),oA(e,n)}}function cA({scene:e}){let t=(0,J.useRef)(null);return(0,J.useEffect)(()=>{let n=t.current;if(!n)return;let r=window.matchMedia(`(prefers-reduced-motion: reduce)`),i=e===`starlings`,a=i?eA(n):sA(n,e),o=i?8.7:aA,s=!1,c=0,l=i?0:aA,u=0,d=()=>a(r.matches?o:l),f=e=>{c=requestAnimationFrame(f),!(e-u<1e3/24)&&(l+=(e-u)/1e3,u=e,d())},p=()=>{cancelAnimationFrame(c),!(!s||document.hidden)&&(d(),r.matches||(u=performance.now(),c=requestAnimationFrame(f)))},m=new IntersectionObserver(([e])=>{s=!!e?.isIntersecting,p()});m.observe(n);let h=new MutationObserver(()=>{s&&r.matches&&d()}),g=i?new ResizeObserver(()=>{s&&!document.hidden&&r.matches&&d()}):null;return g?.observe(n),h.observe(document.documentElement,{attributes:!0,attributeFilter:[`style`]}),r.addEventListener(`change`,p),document.addEventListener(`visibilitychange`,p),()=>{cancelAnimationFrame(c),m.disconnect(),g?.disconnect(),h.disconnect(),r.removeEventListener(`change`,p),document.removeEventListener(`visibilitychange`,p)}},[e]),(0,K.jsx)(`div`,{"aria-hidden":`true`,className:e===`starlings`?Vk:`mb-3 w-96 max-w-full shrink-0 narrow:w-72`,children:(0,K.jsx)(`canvas`,{ref:t,"data-plate":e,width:128*tA,height:80*tA,className:e===`starlings`?`absolute inset-0 block h-full w-full text-muted`:`block h-auto w-full text-muted`},e)})}function lA(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(hover: none) and (pointer: coarse)`).matches}var uA=/^(?:enter|return|tab|esc|space|shift|ctrl\+\S+|cmd\+\S+|alt\+\S+|[↑↓←→]+(?:\/[↑↓←→]+)?|[b-hj-z](?:\/[b-hj-z])?)(?:\/\S+)?(?:\s|$)/i;function dA(e){return e.split(`·`).map(e=>e.trim()).filter(e=>e&&!uA.test(e)).join(` · `)}function fA(e){return lA()?dA(e):e}var pA=`relative p-0 text-transparent caret-ink placeholder:text-muted`,mA=`pointer-events-none absolute inset-0 overflow-hidden whitespace-pre-wrap text-ink [overflow-wrap:break-word] touch:text-[length:var(--fs-display)]`,hA=`rounded-full py-[2px] box-decoration-clone`,gA=`${hA} bg-hover text-ink`,_A=`${hA} text-muted bg-[linear-gradient(90deg,var(--hover)_0%,var(--hover)_35%,var(--line-active)_50%,var(--hover)_65%,var(--hover)_100%)] bg-size-[300%_100%] motion-safe:animate-shimmer`,Fee=`text-muted`,vA=`absolute top-1/2 left-1/2 size-[1em] max-w-none -translate-x-1/2 -translate-y-1/2`,Iee=`${vA} rounded-[3px] bg-[#fff] p-px`,Lee=`${vA} text-muted`,yA=``,Ree=` `,bA=` `,xA=``,SA=e=>Array.from(e).join(xA),CA=SA(`${yA}${bA}${bA}${Ree}${bA}`)+xA,wA=SA(`${bA}${bA}${yA}`),TA=RegExp(`${CA}((?:[^\u2063\u2060\n]${xA})*?)${wA}`,`gu`),EA=22,DA=`rove.web.newSession.links`,OA=e=>`${CA}${SA(e)}${xA}${wA}`,zee=e=>(e[1]??``).replaceAll(xA,``),kA=e=>Array.from(e.replace(/[\u2063\u2060\n]/g,``));function AA(e,t=EA){let n=kA(e);return n.length>t?`${n.slice(0,t-1).join(``)}…`:n.join(``)}function jA(e){let t=kA(`${e.host}${e.pathname.replace(/\/$/,``)}`);return t.length>EA?`…${t.slice(-21).join(``)}`:t.join(``)}function Bee(){try{return JSON.parse(sessionStorage.getItem(DA)??`{}`)}catch{return{}}}function Vee(e,t){return e.replace(TA,(e,n)=>t[n.replaceAll(xA,``)]?.url??e).replace(/[\u2063\u2060]/g,``)}function Hee(e){let[t,n]=(0,J.useState)(Bee),r=(0,J.useRef)({value:e.value,links:t});r.current={value:e.value,links:t};let i=(0,J.useRef)(null),a=e=>{r.current.links=e,n(e);try{sessionStorage.setItem(DA,JSON.stringify(e))}catch{}},o=(0,J.useRef)(null);(0,J.useLayoutEffect)(()=>{let t=o.current;t!==null&&(o.current=null,e.area.current?.setSelectionRange(t,t))});let s=(t,n)=>{r.current.value=t,e.onChange(t),o.current=n},c=(e,t)=>{let{links:n,value:i}=r.current,a=e=>n[e]&&n[e].url!==t&&i.includes(OA(e)),o=e;for(let t=2;a(o);t++)o=`${AA(e,21-String(t).length)} ${t}`;return o},l=(t,n,i,o)=>{let l=c(AA(i),n),{value:u,links:d}=r.current;if(a({...d,[l]:{url:n,icon:o}}),l===t)return;let f=u.indexOf(OA(t));if(f<0)return;let p=e.area.current?.selectionStart??u.length,m=p>f?OA(l).length-OA(t).length:0;s(u.replace(OA(t),OA(l)),p+m)},u=t=>{let n=t.clipboardData.getData(`text/plain`).trim();if(!/^https?:\/\/\S+$/.test(n))return!1;let i;try{i=new URL(n)}catch{return!1}t.preventDefault();let o=t.currentTarget,{value:u}=r.current,d=c(jA(i),i.href);a({...r.current.links,[d]:{url:i.href,loading:!0}});let f=OA(d);return s(u.slice(0,o.selectionStart)+f+u.slice(o.selectionEnd),o.selectionStart+f.length),e.model.client.request(`link.preview`,{url:i.href}).catch(()=>null).then(e=>{l(d,i.href,e?.title||jA(i),e?.icon??``)}),!0},d=(0,J.useRef)(0),f=e=>{let t=e.currentTarget,{selectionStart:n,selectionEnd:i}=t,a=n,o=i;for(let e of r.current.value.matchAll(TA)){let t=e.index,r=t+e[0].length,s=n!==i||n>d.current;a>t&&a<r&&(a=n===i&&s?r:t),o>t&&o<r&&(o=n===i?a:r)}d.current=a,(a!==n||o!==i)&&t.setSelectionRange(a,o)},p=e=>{let t=e.currentTarget;if(e.key!==`Backspace`&&e.key!==`Delete`||t.selectionStart!==t.selectionEnd)return!1;let{value:n}=r.current,i=t.selectionStart;for(let t of n.matchAll(TA)){let r=t.index,a=r+t[0].length;if(e.key===`Backspace`?i>r&&i<=a:i>=r&&i<a)return e.preventDefault(),s(n.slice(0,r)+n.slice(a),r),!0}return!1},m=[],h=0;for(let n of e.value.matchAll(TA)){let r=t[zee(n)],i=n[0];m.push(e.value.slice(h,n.index),i.slice(0,4)),m.push((0,K.jsxs)(`span`,{className:r?r.loading?_A:gA:Fee,children:[i.slice(4,6),(0,K.jsxs)(`span`,{className:`relative`,children:[i[6],r&&(0,K.jsx)(Uee,{src:r.icon})]}),i.slice(7,-3)]},n.index),i.slice(-3)),h=n.index+n[0].length}return m.push(`${e.value.slice(h)}`),{layer:(0,K.jsx)(`div`,{ref:i,"aria-hidden":!0,className:mA,children:m}),field:{...e.field,onScroll:e=>{i.current&&(i.current.scrollTop=e.currentTarget.scrollTop)},onPaste:t=>{e.onFilePaste?.(t),t.defaultPrevented||u(t)},onKeyDown:t=>p(t)||e.field.onKeyDown(t),onSelect:t=>{f(t),e.field.onSelect(t)}},insert:(t,n)=>{let i=e.area.current,{value:a}=r.current,o=i?.selectionStart??a.length,c=o>0&&!/\s$/.test(a.slice(0,o))?` `:``;n&&i?.focus(),s(`${a.slice(0,o)}${c}${t}${a.slice(i?.selectionEnd??a.length)}`,o+c.length+t.length)},expand:e=>Vee(e,r.current.links)}}function Uee({src:e}){let[t,n]=(0,J.useState)(!1);return!e||t?(0,K.jsx)(Wee,{}):(0,K.jsx)(`img`,{src:e,alt:``,draggable:!1,onError:()=>n(!0),className:Iee})}function Wee(){return(0,K.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,className:Lee,children:(0,K.jsx)(`path`,{d:`M6.5 9.5l3-3M7 4.5l1-1a2.5 2.5 0 013.5 3.5l-1 1M9 11.5l-1 1a2.5 2.5 0 01-3.5-3.5l1-1`})})}function MA(e,t){let n=t.trim().toLowerCase(),r=e.toLowerCase();if(r.includes(n))return`substring`;if(!n.includes(`/`))return null;let i=n.split(`/`),a=0;for(let e of r.split(`/`))a<i.length&&e.startsWith(i[a]??``)&&a++;return a===i.length?`segments`:null}function Gee(e,t){if(!t.trim())return e;let n=[],r=[];for(let i of e){let e=MA(i,t);e===`substring`?n.push(i):e===`segments`&&r.push(i)}return[...n,...r]}Pn();var Kee=`flex min-h-0 min-w-0 flex-1 flex-col p-4 font-mono text-meta leading-[1.5] font-normal not-italic normal-nums`,qee=`flex min-h-0 flex-1 flex-col items-center justify-center gap-1.5 overflow-hidden text-center keyboard:hidden`,Jee=`relative mx-auto flex w-full max-w-[104ch] flex-none flex-col gap-2 keyboard:mt-auto`,Yee=`pointer-events-none absolute bottom-full left-0 mb-2 flex flex-col gap-1`,Xee=`relative flex flex-col gap-2 rounded-md border-hairline border-line bg-surface px-3 py-2.5 focus-within:border-line-active`,Zee=`flex flex-wrap items-center justify-end gap-1.5`,Qee=`${Pi} min-h-[4.5em] w-full bg-transparent text-ink [border:0] [outline:0]`,$ee=`group/bar flex items-center gap-1.5 narrow:order-first`,ete=`group-data-tight/bar:sr-only`,tte=`hidden group-data-tight/bar:contents`,nte=`flex min-w-0 items-center gap-1.5 narrow:flex-1`,rte=`group/end ml-auto flex min-w-0 flex-none items-center gap-1.5`,NA=(e=!1)=>`flex h-7 min-w-7 cursor-pointer items-center justify-center rounded-sm px-1 narrow:first:-ml-1.25 has-[:disabled]:opacity-60 disabled:opacity-60 hover:bg-hover hover:text-ink ${e?`text-accent`:`text-muted`}`,PA=`size-3.25 flex-none fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.3]`,FA=`narrow:sr-only`,IA=`min-w-8.5`,ite=`transition-[scale,background-color,color] duration-150 ease-snap active:scale-97 active:bg-hover active:text-ink motion-reduce:transition-none motion-reduce:active:scale-none`,LA=(e=!1)=>`inline-flex max-w-[28ch] ${IA} items-center gap-1.5 overflow-hidden rounded-sm narrow:${kn} ${ite} border-hairline px-2.5 py-0.75 text-ellipsis whitespace-nowrap touch:py-1.75 narrow:min-h-11 narrow:text-[15px] hover:bg-hover hover:text-ink aria-expanded:bg-hover aria-expanded:text-ink ${e?`border-[color-mix(in_srgb,var(--accent)_45%,transparent)] bg-accent-soft text-accent`:`border-line text-muted`}`,RA=`disabled:cursor-default disabled:opacity-60`,ate=e=>`${LA(e)} min-w-[9ch] justify-center ${RA}`,ote=`touch-none select-none [-webkit-touch-callout:none]`,ste=(e=!1)=>`group/chip relative inline-flex ${IA} narrow:shrink-0 ${e?`group-data-tight/bar:shrink`:``}`,zA=`flex min-h-0 flex-col gap-1 overflow-x-hidden overflow-y-auto p-1.5 [outline:0]`,cte=`${zA} w-[52ch] max-w-full`,BA=`flex min-h-0 flex-col overflow-x-hidden overflow-y-auto`,VA=`w-full rounded-none border-0 [border-bottom:var(--hairline)_solid_var(--line-faint)] bg-transparent px-1.5 py-2 font-mono text-meta font-normal normal-nums text-ink focus-visible:outline-none`,HA=`sticky top-0 z-1 m-0 bg-surface px-1.5 pt-1.5 pb-0.5 text-left`,UA=e=>`flex w-full items-baseline gap-2 rounded-[calc(var(--radius)-6px)] px-2 py-1 text-left touch:py-2.5 disabled:cursor-default disabled:opacity-50 ${e.dim?`text-subtle`:`text-ink`} ${e.cursor?`bg-hover`:``}`,WA=`flex-[0_0_1.5ch] text-accent`,lte=`ml-auto pl-3 inline-flex items-center gap-1`,GA=`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`,ute=`${GA} narrow:max-w-[13ch]`,KA=`${GA} [direction:rtl]`,qA=`flex-none whitespace-nowrap`,JA=`mx-2 my-1`,dte=`m-0 flex-none border-t-hairline border-t-line px-2 pt-1.5 pb-0.5`,YA=`flex flex-col gap-0.5 px-1.5 py-0.5`,fte=`min-w-[36ch]`,pte=`flex flex-wrap items-center justify-end gap-1.5 p-1.5`;function mte(){return(0,K.jsx)(`svg`,{className:PA,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:`M2 4.5a1 1 0 0 1 1-1h3l1.5 1.5H13a1 1 0 0 1 1 1V12a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1z`})})}function hte(){return(0,K.jsxs)(`svg`,{className:PA,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,K.jsx)(`circle`,{cx:`4.5`,cy:`3.5`,r:`1.5`}),(0,K.jsx)(`circle`,{cx:`4.5`,cy:`12.5`,r:`1.5`}),(0,K.jsx)(`circle`,{cx:`11.5`,cy:`5`,r:`1.5`}),(0,K.jsx)(`path`,{d:`M4.5 5v6M11.5 6.5c0 3-7 2-7 4.5`})]})}function gte(e){return e instanceof Error?e.message:String(e)}function XA(e){return/no space left on device|ENOSPC|disk quota exceeded/i.test(gte(e))}var ZA=Math.min,QA=Math.max,$A=Math.round,ej=Math.floor,tj=e=>({x:e,y:e}),nj={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function rj(e,t,n){return QA(e,ZA(t,n))}function ij(e,t){return typeof e==`function`?e(t):e}function aj(e){return e.split(`-`)[0]}function oj(e){return e.split(`-`)[1]}function sj(e){return e===`x`?`y`:`x`}function cj(e){return e===`y`?`height`:`width`}function lj(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function uj(e){return sj(lj(e))}function dj(e,t,n){n===void 0&&(n=!1);let r=oj(e),i=uj(e),a=cj(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=bj(o)),[o,bj(o)]}function fj(e){let t=bj(e);return[pj(e),t,pj(t)]}function pj(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var mj=[`left`,`right`],hj=[`right`,`left`],gj=[`top`,`bottom`],_j=[`bottom`,`top`];function vj(e,t,n){switch(e){case`top`:case`bottom`:return n?t?hj:mj:t?mj:hj;case`left`:case`right`:return t?gj:_j;default:return[]}}function yj(e,t,n,r){let i=oj(e),a=vj(aj(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(pj)))),a}function bj(e){let t=aj(e);return nj[t]+e.slice(t.length)}function xj(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Sj(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:xj(e)}function Cj(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function wj(e,t,n){let{reference:r,floating:i}=e,a=lj(t),o=uj(t),s=cj(o),c=aj(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=oj(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Tj(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=ij(t,e),p=Sj(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Cj(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Cj(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Ej=50,Dj=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Tj},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=wj(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Ej&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=wj(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Oj=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=ij(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=aj(r),_=lj(o),v=aj(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[bj(o)]:fj(o)),x=p!==`none`;!d&&x&&b.push(...yj(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=dj(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===lj(t)||T.every(e=>lj(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=lj(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},kj=new Set([`left`,`top`]);async function Aj(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=aj(n),s=oj(n),c=lj(n)===`y`,l=kj.has(o)?-1:1,u=a&&c?-1:1,d=ij(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var jj=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Aj(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Mj=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=ij(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=lj(i),p=sj(f),m=u[p],h=u[f],g=(e,t)=>rj(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}};function Nj(){return typeof window<`u`}function Pj(e){return Lj(e)?(e.nodeName||``).toLowerCase():`#document`}function Fj(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ij(e){return((Lj(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Lj(e){return Nj()?e instanceof Node||e instanceof Fj(e).Node:!1}function Rj(e){return Nj()?e instanceof Element||e instanceof Fj(e).Element:!1}function zj(e){return Nj()?e instanceof HTMLElement||e instanceof Fj(e).HTMLElement:!1}function Bj(e){return!Nj()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Fj(e).ShadowRoot}function Vj(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Qj(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Hj(e){return/^(table|td|th)$/.test(Pj(e))}function Uj(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Wj=/transform|translate|scale|rotate|perspective|filter/,Gj=/paint|layout|strict|content/,Kj=e=>!!e&&e!==`none`,qj;function Jj(e){let t=Rj(e)?Qj(e):e;return Kj(t.transform)||Kj(t.translate)||Kj(t.scale)||Kj(t.rotate)||Kj(t.perspective)||!Xj()&&(Kj(t.backdropFilter)||Kj(t.filter))||Wj.test(t.willChange||``)||Gj.test(t.contain||``)}function Yj(e){let t=eM(e);for(;zj(t)&&!Zj(t);){if(Jj(t))return t;if(Uj(t))return null;t=eM(t)}return null}function Xj(){return qj??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),qj}function Zj(e){return/^(html|body|#document)$/.test(Pj(e))}function Qj(e){return Fj(e).getComputedStyle(e)}function $j(e){return Rj(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function eM(e){if(Pj(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Bj(e)&&e.host||Ij(e);return Bj(t)?t.host:t}function tM(e){let t=eM(e);return Zj(t)?(e.ownerDocument||e).body:zj(t)&&Vj(t)?t:tM(t)}function nM(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=tM(e),i=r===e.ownerDocument?.body,a=Fj(r);if(i){let e=rM(a);return t.concat(a,a.visualViewport||[],Vj(r)?r:[],e&&n?nM(e):[])}return t.concat(r,nM(r,[],n))}function rM(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function iM(e){let t=Qj(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=zj(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=$A(n)!==a||$A(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function aM(e){return Rj(e)?e:e.contextElement}function oM(e){let t=aM(e);if(!zj(t))return tj(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=iM(t),o=(a?$A(n.width):n.width)/r,s=(a?$A(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var sM=tj(0);function cM(e){let t=Fj(e);return!Xj()||!t.visualViewport?sM:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function lM(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Fj(e)}function uM(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=aM(e),o=tj(1);t&&(r?Rj(r)&&(o=oM(r)):o=oM(e));let s=lM(a,n,r)?cM(a):tj(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Fj(a),t=Rj(r)?Fj(r):r,n=e,i=rM(n);for(;i&&t!==n;){let e=oM(i),t=i.getBoundingClientRect(),r=Qj(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Fj(i),i=rM(n)}}return Cj({width:u,height:d,x:c,y:l})}function dM(e,t){let n=$j(e).scrollLeft;return t?t.left+n:uM(Ij(e)).left+n}function fM(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-dM(e,n),y:n.top+t.scrollTop}}function pM(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Ij(r),s=t?Uj(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=tj(1),u=tj(0),d=zj(r);if((d||!a)&&((Pj(r)!==`body`||Vj(o))&&(c=$j(r)),d)){let e=uM(r);l=oM(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?fM(o,c):tj(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function mM(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function hM(e){let t=$j(e),n=e.ownerDocument.body,r=QA(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=QA(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+dM(e),o=-t.scrollTop;return Qj(n).direction===`rtl`&&(a+=QA(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var gM=25;function _M(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Fj(e),a=Ij(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Xj()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(dM(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=gM&&(s-=o)}return{width:s,height:c,x:l,y:u}}function vM(e,t){let n=uM(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=oM(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function yM(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=_M(e,n,t);else if(t===`document`)r=hM(Ij(e));else if(Rj(t))r=vM(t,n);else{let n=cM(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Cj(r)}function bM(e,t){let n=t.get(e);if(n)return n;let r=nM(e,[],!1).filter(e=>Rj(e)&&Pj(e)!==`body`),i=null,a=Qj(e).position===`fixed`,o=a?eM(e):e;for(;Rj(o)&&!Zj(o);){let e=Qj(o),t=Jj(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=eM(o)}return t.set(e,r),r}function xM(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Uj(t)?[]:bM(t,this._c):[].concat(n),r],o=yM(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=yM(t,a[e],i);s=QA(n.top,s),c=ZA(n.right,c),l=ZA(n.bottom,l),u=QA(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function SM(e){let{width:t,height:n}=iM(e);return{width:t,height:n}}function CM(e,t,n){let r=zj(t),i=Ij(t),a=n===`fixed`,o=uM(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=tj(0);if((r||!a)&&((Pj(t)!==`body`||Vj(i))&&(s=$j(t)),r)){let e=uM(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=dM(i));let l=i&&!r&&!a?fM(i,s):tj(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function wM(e){return Qj(e).position===`static`}function TM(e,t){if(!zj(e)||Qj(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Ij(e)===n&&(n=n.ownerDocument.body),n}function EM(e,t){let n=Fj(e);if(Uj(e))return n;if(!zj(e)){let t=eM(e);for(;t&&!Zj(t);){if(Rj(t)&&!wM(t))return t;t=eM(t)}return n}let r=TM(e,t);for(;r&&Hj(r)&&wM(r);)r=TM(r,t);return r&&Zj(r)&&wM(r)&&!Jj(r)?n:r||Yj(e)||n}var DM=async function(e){let t=this.getOffsetParent||EM,n=this.getDimensions,r=await n(e.floating);return{reference:CM(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function OM(e){return Qj(e).direction===`rtl`}var kM={convertOffsetParentRelativeRectToViewportRelativeRect:pM,getDocumentElement:Ij,getClippingRect:xM,getOffsetParent:EM,getElementRects:DM,getClientRects:mM,getDimensions:SM,getScale:oM,isElement:Rj,isRTL:OM};function AM(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function jM(e,t,n){let r=null,i,a=Ij(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=ej(d),h=ej(a.clientWidth-(u+f)),g=ej(a.clientHeight-(d+p)),_=ej(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:QA(0,ZA(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!AM(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Fj(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function MM(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=aM(e),u=i||a?[...l?nM(l):[],...t?nM(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?jM(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?uM(e):null;c&&g();function g(){let t=uM(e);h&&!AM(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var NM=jj,PM=Mj,FM=Oj,IM=(e,t,n)=>{let r=new Map,i=n??{},a={...kM,...i.platform,_c:r};return Dj(e,t,{...i,platform:a})},LM=`pointer-events-none fixed top-0 left-0 z-35 max-w-80 animate-tip-in rounded-sm border-hairline border-line bg-inset px-2.5 py-1.5 font-sans text-meta leading-[1.4] whitespace-normal wrap-anywhere text-ink shadow-popover motion-reduce:animate-none`,RM=500,zM=400,BM=`rove-tip`,VM=null,HM=null,UM=null,WM=null,GM=0,KM=!1,qM=()=>KM;function JM(){return VM?.isConnected?VM:(VM=document.createElement(`div`),VM.id=BM,VM.setAttribute(`role`,`tooltip`),VM.className=LM,VM.hidden=!0,document.body.append(VM),VM)}function YM(){WM!==null&&window.clearTimeout(WM),WM=null}function XM(e,t,n=`top`){YM(),ZM();let r=JM();r.textContent=t,r.hidden=!1,HM=e,e.setAttribute(`aria-describedby`,BM),UM=MM(e,r,()=>{if(!e.isConnected)return ZM();IM(e,r,{strategy:`fixed`,placement:n,middleware:[NM(6),FM(),PM({padding:8})]}).then(({x:e,y:t})=>{r.style.left=`${e}px`,r.style.top=`${t}px`})})}function ZM(){YM(),HM&&(UM?.(),UM=null,HM.getAttribute(`aria-describedby`)===BM&&HM.removeAttribute(`aria-describedby`),HM=null,VM&&(VM.hidden=!0),GM=performance.now())}function QM(e){if(!(e instanceof Element))return null;let t=e.closest(`[title], [data-tip]`);if(!t||t instanceof HTMLIFrameElement)return null;let n=t.getAttribute(`title`);if(n!==null){if(t.removeAttribute(`title`),n===``)return null;t.dataset.tip=n,!t.hasAttribute(`aria-label`)&&!t.textContent?.trim()&&t.setAttribute(`aria-label`,n)}return t.dataset.tip?t:null}function $M(e){if(e===HM)return;YM();let t=HM!==null||performance.now()-GM<zM,n=()=>e.isConnected&&e.dataset.tip&&XM(e,e.dataset.tip);t?n():WM=window.setTimeout(n,RM)}var eN=!1;function tN(){eN||(eN=!0,document.addEventListener(`pointerover`,e=>{if(e.pointerType===`touch`)return;let t=QM(e.target);t?$M(t):HM&&e.target instanceof Node&&HM.contains(e.target)||ZM()}),document.addEventListener(`pointerout`,e=>{let t=QM(e.target);t&&!(e.relatedTarget instanceof Node&&t.contains(e.relatedTarget))&&ZM()}),document.addEventListener(`keydown`,e=>{KM=!0,e.key===`Escape`&&ZM()},!0),document.addEventListener(`pointerdown`,()=>{KM=!1,ZM()},!0),document.addEventListener(`focusin`,e=>{let t=KM?QM(e.target):null;t&&$M(t)}),document.addEventListener(`focusout`,e=>{e.target===HM&&ZM()}),window.addEventListener(`blur`,ZM))}Ur();var nN=`-mr-0.5 ml-0 flex flex-none self-stretch`,rN=`before:absolute before:top-0 before:ml-1 before:content-[''] before:[border-left:var(--hairline)_solid_var(--line-active)]`,iN={blank:``,pipe:`${rN} before:bottom-0`,tee:`${rN} before:bottom-0`,elbow:`${rN} before:w-2 before:bottom-1/2 before:rounded-bl-[6px] before:[border-bottom:var(--hairline)_solid_var(--line-active)]`},aN=e=>`w-3 ${iN[e]}`,oN=`-mx-1 inline-flex min-w-6 cursor-pointer items-center justify-center gap-1 self-stretch px-2 font-mono text-muted hover:text-ink`,sN=`opacity-0 group-hover/row:opacity-100 group-focus-visible/row:opacity-100 touch:opacity-100`,cN=`inline-flex items-center gap-1`,lN=`group -mx-2.5 -my-2 grid min-h-11 min-w-11 flex-none cursor-pointer place-items-center px-1`,uN=`inline-flex items-center gap-1 whitespace-nowrap rounded-sm px-1.5 py-0.5 font-mono text-[13px] leading-[1.3] group-hover:bg-hover group-active:bg-hover motion-safe:transition-transform motion-safe:duration-120 motion-safe:ease-out group-active:scale-97`,dN=e=>`fixed z-35 flex max-h-[min(380px,60vh)] w-85 max-w-[calc(100vw-24px)] animate-pr-list-in flex-col overflow-y-auto overscroll-contain rounded-md border-hairline border-line bg-surface p-1.5 shadow-popover transition-[opacity,translate] duration-120 ease-in motion-reduce:animate-none motion-reduce:transition-none ${e?`-translate-x-1 opacity-0`:``}`,fN=`truncate font-semibold text-ink`,pN=`flex items-baseline gap-0 text-meta leading-[inherit] whitespace-nowrap`,mN=`inline-flex items-baseline gap-1.25`,hN=`font-mono`,gN=`overflow-hidden text-ellipsis whitespace-pre text-muted`,_N=`inline-flex flex-none items-center text-subtle`,vN=`size-3.5 flex-none fill-none stroke-current stroke-[1.75] [stroke-linecap:round] [stroke-linejoin:round]`,yN=`group/rail rail @container row-1 flex min-h-0 flex-col focus:outline-none ${Vn}`,bN=`flex min-w-0 items-center gap-2.5 overflow-hidden px-3.5 pt-3.5 pb-2.5 whitespace-nowrap narrow:px-4`,xN=`flex gap-1 px-3.5 pb-2 text-meta`,SN=`min-w-0 flex-1 border-none bg-transparent p-0 text-ink [font:inherit] outline-none placeholder:text-subtle`,CN=e=>`flex-1 overflow-y-auto px-1.5 pt-1 pb-3 narrow:px-2 narrow:pb-24 scrollbar-none ${e?`[&>[data-row]]:[transition:transform_150ms_ease-out,scale_150ms_ease-out,opacity_150ms_ease-out] motion-reduce:[&>[data-row]]:transition-none [&>[data-row]]:[box-shadow:none]! [&>[data-row]:not([data-lifted])]:opacity-45`:``}`,wN=`group-[:is(:focus-visible,:has(:focus-visible))]/rail:[box-shadow:inset_0_0_0_1px_var(--focus)]`,TN=e=>`group/head mx-2 mt-1.5 mb-1 flex items-center gap-1 font-mono text-meta font-semibold normal-nums not-first:mt-4.5 ${e.dragging?`origin-left scale-[1.03] cursor-grabbing text-ink motion-reduce:scale-none`:`text-subtle`} ${e.grab&&!e.dragging?`cursor-grab [&>button:first-child]:cursor-grab`:``} ${e.moving?`bg-accent-soft after:font-mono after:text-meta after:font-medium after:normal-nums after:text-accent after:content-['move']`:``}`,EN=`touch:relative touch:after:absolute touch:after:-inset-x-1.5 touch:after:-inset-y-3 touch:after:content-['']`,DN=`inline-flex min-w-0 cursor-pointer items-center gap-1 rounded-xs border-none bg-transparent px-1 py-0.5 text-inherit [font:inherit] hover:text-ink touch:relative touch:after:absolute touch:after:inset-x-0 touch:after:-inset-y-3 touch:after:content-['']`,ON=`-ml-1 ${DN}`,kN=`group/toggle ${DN}`,AN=e=>e?``:`opacity-0 group-hover/head:opacity-100 group-focus-visible/toggle:opacity-100 touch:opacity-100`,jN=`-mr-[4.5px] ml-auto size-5 shrink-0 narrow:-mr-0.5 cursor-pointer rounded-xs border-none bg-transparent text-muted opacity-0 [font:400_var(--fs-display)/1_var(--sans)] group-hover/head:opacity-100 hover:bg-hover hover:text-ink focus-visible:opacity-100 touch:opacity-100 ${EN}`;G(),A(),Ur();var MN=1e4;function NN(e,t){let n=e.hostLabel||e.alias;if(e.state===`online`)return e.version?`${n} · v${e.version}`:n;let r=t[e.state];return e.state===`mismatch`?e.version?`${n} · ⚠ v${e.version} (${r})`:`${n} · ⚠ ${r}`:`${n} · ${r}`}function PN(e,t,n,r=e){let i=t?.hostLabel&&t.hostLabel!==e?` (${t.hostLabel})`:``,a=n.runsOn.replace(`{host}`,t?`${e}${i}`:r);return!t||t.state===`online`?a:`${a}${NN(t,n).slice((t.hostLabel||t.alias).length)}`}function FN(e,t,n){if(e.kind!==`task`)return null;let r=e.machine??e.task.workspaceOn;return r===void 0?null:PN(r,t.find(e=>e.alias===r),n,e.task.machine?.label)}function IN({label:e,onOpen:t}){return(0,K.jsx)(`span`,{className:_N,role:`img`,"aria-label":e,onPointerEnter:n=>{n.pointerType!==`touch`&&(t?.(),XM(n.currentTarget,e,`right`))},onPointerLeave:ZM,children:(0,K.jsx)(`svg`,{className:vN,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:`M6.25 18.5A3.75 3.75 0 0 1 7.34 11.16A4.75 4.75 0 0 1 16.66 11.16A3.75 3.75 0 0 1 17.75 18.5Z`})})})}function LN({host:e,onMachines:t}){return W(),(0,K.jsxs)(`div`,{className:Hr,children:[(0,K.jsx)(`p`,{className:`text-muted`,children:Y(`tasks`,`machine.filesElsewhere`,{host:e})}),(0,K.jsx)(`p`,{className:`text-muted`,children:Y(`tasks`,`machine.filesHint`,{host:e})}),(0,K.jsx)(`div`,{children:(0,K.jsx)(q,{hit:`tight`,onClick:t,children:U(`machines.open`)})})]})}function RN(e){let t=k(e.client.conn),n=k(e.remote),[r,i]=(0,J.useState)(()=>Hs(e,`machines.list`)?.machines??[]),a=[...new Set(n.map(e=>`${e.machine?.id}:${e.machine?.stale??!1}`))].join();return(0,J.useEffect)(()=>{if(t.state!==`open`)return;let n=!0,r=()=>Ws(e,`machines.list`).then(e=>n&&i(e.machines),()=>{});r();let a=Ga(MN,r);return()=>{n=!1,a()}},[e.client,t.state,a]),r}function zN(e){if(typeof e!=`string`)return``;let t=e.replace(/\s+/g,` `).trim();if(t.length===0)return``;let n=[...t];return n.length<=40?t:`${n.slice(0,40).join(``)}…`}function BN(e){let t=HN(e);return t<0||t===e.length-1?{base:e,dir:``}:{base:e.slice(t+1),dir:e.slice(0,t+1)}}function VN(e){return/^(?:[A-Za-z]:(?:[\\/]|$)|\\\\)/.test(e)}function HN(e){return VN(e)||/^~\\/.test(e)?Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`)):e.lastIndexOf(`/`)}function UN(e){return e.startsWith(`/`)||VN(e)}function WN(e){return e.startsWith(`~`)||e.includes(`/`)||VN(e)}function GN(e,t){return t?e===`~`?t:e.startsWith(`~/`)||e.startsWith(`~\\`)?t+e.slice(1):e:e}function KN(e){let t=VN(e),n=t&&/^[A-Za-z]:/.test(e)?3:1,r=e.length;for(;r>n&&(e[r-1]===`/`||t&&e[r-1]===`\\`);)r--;return e.slice(0,r)}var qN=/^(?:(?:https?|ssh|git):\/\/[A-Za-z0-9[]\S*|[A-Za-z0-9._-]+@[A-Za-z0-9][A-Za-z0-9.-]*:\S+)$/i,JN=/^[A-Za-z0-9][A-Za-z0-9-]{0,38}\/(?![.]+(?:git)?$)[A-Za-z0-9._-]{1,100}$/i;function YN(e){let t=e.trim();return qN.test(t)||JN.test(t)?t:null}var XN=/^(?:https?:\/\/(?:www\.)?github\.com\/|(?:ssh:\/\/)?git@github\.com[:/])/i;function ZN(e){let t=e.trim(),n=t.replace(XN,``);if(n===t)return JN.test(t)?t.replace(/\.git$/i,``).toLowerCase():null;let[r,i]=n.split(/[/?#]/),a=i?.replace(/\.git$/i,``);return r&&a?`${r}/${a}`.toLowerCase():null}function QN(e,t){return e.filter(e=>e.enabled!==!1||e.id===t)}function $N(e,t){return(e.find(e=>e.id===t)??e.find(e=>e.ready!==!1)??e[0])?.id??``}function eP(e,t){return!e||e.acceptsModel===!1?[]:[{id:``,label:t},...(e.models??[]).map(e=>({id:e.id,label:e.label??e.id}))]}function tP(e,t,n){return t?e.find(e=>e.id===t)?.label??t:n}function nP(e,t){return e.includes(t)?e.length>1?e.filter(e=>e!==t):e:[...e,t]}function rP(e){let[t,n,...r]=e;return!t||!n?t??``:r.length>0?`${t} + ${n} +${r.length}`:`${t} + ${n}`}function iP(e){if(!(e instanceof Error)||!(`code`in e)||e.code!==`PARTIAL_FANOUT`)return;let t=`detail`in e&&e.detail&&typeof e.detail==`object`?e.detail:void 0;return t&&`groupId`in t&&typeof t.groupId==`string`&&t.groupId?t.groupId:void 0}function aP(e){let[t,...n]=e;if(!t)return``;let r=BN(t).base;return n.length>0?`${r} +${n.length}`:r}function oP(e,t){return e.includes(t)?e.filter(e=>e!==t):e.length>=8?e:[...e,t]}function sP(e,t){if(!/^[1-9]$/.test(e))return null;let n=Number(e)-1;return n<t?n:null}function cP(e){let[t,...n]=e.repos;if(!t)throw Error(`no repo`);let r=e.at?zN(e.prompt):``,i=(e.engines?.length??0)>1;return{repo:t.repo,...t.baseRef?{baseBranch:t.baseRef}:{},...n.length>0?{extraRepos:n.map(e=>({repo:e.repo,...e.baseRef?{baseRef:e.baseRef}:{}}))}:{},...!i&&n.length>0&&e.branch?{branch:e.branch}:{},...e.at?{scheduleAt:e.at.toISOString(),schedulePrompt:e.prompt}:e.prompt?{prompt:e.prompt}:{},...r?{title:r}:{},...i?{agents:(e.engines??[]).map(e=>`${e}:1`).join(`,`)}:{},...!i&&e.engine?{engine:e.engine}:{},...!i&&e.engine&&e.commandFrom?{commandFrom:e.commandFrom}:{},...!i&&e.model?{model:e.model}:{}}}async function lP(e,t,n,r=``){let i=t?{engine:t}:{},a=n.trim()?zN(n):``,{taskId:o}=await e(`task.openScratch`,{...i,...r?{model:r}:{},...a?{title:a}:{}});return await e(`tab.new`,{taskId:o,kind:`engine`,...i,prompt:n.trim()}),o}async function uP(e,t,n,r,i=r.trim(),a,o=``){let s=n?{engine:n}:{},c=r.trim()?zN(r):``,{taskId:l}=await e(`task.openCheckout`,{repo:t,...s,...c?{title:c}:{},...o?{model:o}:{},...a?{scheduleAt:a.toISOString(),schedulePrompt:i}:{}});if(!(a||!l))return await e(`tab.new`,{taskId:l,kind:`engine`,...s,prompt:i}),l}G(),He();function dP(e){let[t,n]=(0,J.useState)(e.startOpen===!0),r=ke(),i=(0,J.useRef)(e.onClose);i.current=e.onClose,(0,J.useEffect)(()=>{t||i.current?.()},[t]);let a=(0,J.useRef)(null),o=(0,J.useRef)(null),s=(0,J.useRef)(null);(0,J.useLayoutEffect)(()=>{let e=s.current;if(!t||!e)return;let n=e.getBoundingClientRect(),r=n.right>window.innerWidth-8?window.innerWidth-8-n.right:n.left<8?8-n.left:0;r&&(e.style.transform=`translateX(${Math.round(r)}px)`)},[t]);let c=()=>{n(!1),o.current?.focus()};return(0,J.useEffect)(()=>{if(!t||r)return;let e=e=>{a.current?.contains(e.target)||n(!1)};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[t,r]),(0,K.jsxs)(`span`,{ref:a,className:ste(e.yields),onKeyDown:e=>{e.key!==`Escape`||!t||(e.preventDefault(),e.stopPropagation(),c())},children:[(0,K.jsx)(`button`,{ref:o,type:`button`,className:LA(),"data-field":e.field,title:e.title,"aria-haspopup":`menu`,"aria-expanded":t,disabled:e.disabled,onClick:()=>{r&&!t&&TD(),n(e=>!e)},children:typeof e.label==`string`?(0,K.jsx)(`span`,{className:GA,children:e.label}):e.label}),t&&(r?(0,K.jsx)(gO,{label:e.title,onClose:c,children:t=>(0,K.jsx)(`div`,{className:`flex min-h-0 flex-col px-1.5`,children:e.children(t)})}):(0,K.jsx)(`div`,{ref:s,className:`absolute bottom-[calc(100%+6px)] left-0 z-20 flex max-h-[min(50vh,420px)] max-w-[min(52ch,calc(100vw-16px))] min-w-[min(34ch,calc(100vw-16px))] flex-col overflow-hidden rounded-md border-hairline border-line-active bg-surface shadow-popover group-[&]/end:group-last-of-type/chip:right-0 group-[&]/end:group-last-of-type/chip:left-auto`,children:e.children(c)}))]})}function fP(e){let[t,n]=(0,J.useState)(0),r=[...e.extra?[e.extra]:[],...e.rows,...e.more??[],...e.pinned?[e.pinned]:[]],i=e.pinned?r.slice(0,-1):r,a=Math.min(t,Math.max(0,r.length-1)),o=(0,J.useRef)(null);(0,J.useEffect)(()=>{o.current?.scrollIntoView({block:`nearest`})},[a,e.rows]);let s=(t,r)=>(0,K.jsxs)(`button`,{type:`button`,"aria-current":t.checked===!0,ref:r===a?o:void 0,tabIndex:-1,title:t.title,className:UA({cursor:r===a}),onMouseMove:()=>n(r),onClick:n=>e.onPick(t.key,n.shiftKey||n.metaKey||n.ctrlKey),children:[(0,K.jsx)(`span`,{className:WA,children:t.checked?`✓`:``}),(0,K.jsx)(`span`,{className:qA,children:t.text}),t.dim&&(0,K.jsx)(`span`,{className:`ml-auto pl-3 text-muted ${t.dimPath?KA:`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`}`,children:t.dimPath?(0,K.jsx)(`bdi`,{children:t.dim}):t.dim})]});return(0,K.jsxs)(`div`,{className:zA,children:[(0,K.jsx)(`input`,{className:VA,autoFocus:!0,spellCheck:!1,placeholder:e.placeholder,value:e.query,onChange:t=>{n(0),e.onQuery(t.target.value)},onKeyDown:t=>{if(!t.nativeEvent.isComposing){if(t.key===`ArrowDown`||t.key===`ArrowUp`)t.preventDefault(),n(Math.max(0,Math.min(r.length-1,a+(t.key===`ArrowDown`?1:-1))));else if(t.key===`Enter`){t.preventDefault();let n=r[a];n&&e.onPick(n.key,t.shiftKey||t.metaKey||t.ctrlKey)}}}}),(0,K.jsxs)(`div`,{className:BA,children:[i.length===0&&(0,K.jsx)(`p`,{className:`mx-2 my-1 text-muted`,children:e.empty}),i.map((t,n)=>(0,K.jsxs)(J.Fragment,{children:[e.moreLabel&&t===e.more?.[0]&&(0,K.jsx)(`p`,{className:`mx-2 mt-2 mb-0.5 text-muted`,children:e.moreLabel}),t.ruled&&n>0&&(0,K.jsx)(`div`,{className:`mx-2 my-1 flex-none border-t border-t-line`}),s(t,n)]},t.key))]}),e.pinned&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`mx-2 my-1 flex-none border-t border-t-line`}),s(e.pinned,r.length-1)]}),e.hint&&(0,K.jsx)(`p`,{className:`m-0 flex-none border-t-hairline border-t-line px-2 pt-1.5 pb-0.5 text-subtle touch:hidden`,children:e.hint})]})}function pP(e){return(0,K.jsxs)(`button`,{type:`button`,role:e.multi?`menuitemcheckbox`:`menuitemradio`,"aria-checked":e.checked,tabIndex:-1,disabled:e.option.disabled,className:UA({cursor:e.cursor,dim:e.option.dim}),onMouseMove:e.onHover,onClick:e.onPick,children:[(0,K.jsx)(`span`,{className:WA,children:e.checked?`✓`:``}),(0,K.jsx)(`span`,{children:e.option.label}),!e.checked&&e.digit!==void 0&&!e.option.disabled&&(0,K.jsx)(`span`,{className:`ml-auto pl-3 keys-only text-muted`,children:e.digit})]})}function mP(e){let[t,n]=(0,J.useState)(()=>Math.max(0,e.options.findIndex(t=>t.id===e.value))),r=(0,J.useRef)(null);return(0,J.useEffect)(()=>r.current?.focus(),[]),(0,K.jsxs)(`div`,{ref:r,role:`menu`,tabIndex:-1,className:zA,onKeyDown:r=>{if(!(r.ctrlKey||r.metaKey||r.altKey||r.nativeEvent.isComposing)){if(r.key===`ArrowDown`||r.key===`ArrowUp`)r.preventDefault(),n(Math.max(0,Math.min(e.options.length-1,t+(r.key===`ArrowDown`?1:-1))));else if(r.key===`Enter`){r.preventDefault();let n=e.options[t];n&&!n.disabled&&e.onPick(n.id)}else if(e.onBack&&(r.key===`Escape`||r.key===`ArrowLeft`))r.preventDefault(),r.stopPropagation(),e.onBack();else{let t=e.digits?sP(r.key,e.options.length):null,n=t===null?void 0:e.options[t];if(!n||n.disabled)return;r.preventDefault(),e.onPick(n.id)}}},children:[e.onBack?(0,K.jsxs)(`button`,{type:`button`,className:`${HA} ${Di} text-muted`,tabIndex:-1,onClick:e.onBack,children:[`‹ `,e.heading]}):(0,K.jsx)(`p`,{className:`${HA} ${Di} text-muted`,children:e.heading}),e.options.map((r,i)=>(0,K.jsx)(pP,{option:r,checked:e.values?e.values.includes(r.id):r.id===e.value,multi:e.values!==void 0,cursor:i===t,digit:e.digits&&i<9?i+1:void 0,onHover:()=>n(i),onPick:()=>e.onPick(r.id)},r.id)),e.footer]})}function hP(e){return(0,K.jsxs)(`div`,{className:`${zA} ${fte}`,children:[(0,K.jsx)(`p`,{className:`${HA} ${Di} text-muted`,children:U(`newSession.branches`)}),(0,K.jsxs)(`label`,{className:YA,children:[(0,K.jsx)(`span`,{className:`text-muted`,children:U(`newSession.branchName`)}),(0,K.jsx)(`input`,{className:ji,autoFocus:!0,spellCheck:!1,placeholder:U(`newSession.branchNamePlaceholder`),value:e.branch,onChange:t=>e.onBranch(t.target.value)})]}),e.repos.map(t=>(0,K.jsxs)(`label`,{className:YA,children:[(0,K.jsxs)(`span`,{children:[t.name,t.primary&&(0,K.jsxs)(`span`,{className:`text-muted`,children:[` `,U(`newSession.primary`)]})]}),(0,K.jsx)(`select`,{className:ji,"aria-label":t.name,value:t.base||t.current,onChange:n=>e.onBase(t.path,n.target.value),children:(t.branches.includes(t.base||t.current)?t.branches:[t.base||t.current,...t.branches]).filter(e=>e!==``).map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))})]},t.path))]})}function gP(e){return e.replace(/\.git$/,``).split(/[/:]/).filter(Boolean).slice(-2).join(`/`)}function _P(e){return e.id.startsWith(`root:`)?e.primary??e.checkouts[0]??e.id:e.id}function vP(e,t){if(!e||e.clone)return null;if(UN(e.ref))return e.ref;let n=t.find(t=>t.id===e.ref);return n?.primary??n?.checkouts[0]??null}function yP(e,t){if(!e)return null;let n=t.find(t=>t.id===e||t.checkouts.includes(e));return n?{ref:_P(n),clone:!1}:UN(e)?{ref:e,clone:!1}:null}function bP(e,t,n){let r=t.toLowerCase();return n?e.some(e=>e.toLowerCase()===`github.com/${r}`):e.some(e=>BN(e).base.toLowerCase()===(r.split(`/`)[1]??``))}function xP(e,t,n){let r=t.find(t=>t.id===e||t.checkouts.includes(e))?.id??e,i=n.find(e=>e.id===r);return i?{ref:_P(i),clone:!1}:r.startsWith(`root:`)||UN(r)?null:{ref:r,clone:!0}}function SP(e,t){let n=new Set(t.filter(e=>e.installed!==!1).map(e=>e.id)),r=new Set(t.length>0?e.filter(e=>!n.has(e.id)).map(e=>e.id):[]),i=new Set(e.map(e=>e.id)),a=t.filter(e=>n.has(e.id)&&!i.has(e.id)).map(e=>({id:e.id,name:e.name??e.id}));return{rows:[...e,...a],missing:r}}function CP(e){return{repo:e.checkout??e.pick.ref,machine:e.machine,...e.checkout?{noWorktree:!0}:{},...e.pick.clone?{clone:!0}:{},...e.baseRef&&!e.checkout?{baseBranch:e.baseRef}:{},...e.prompt?{prompt:e.prompt}:{},...e.engine?{engine:e.engine}:{},...e.engineThere?{engineThere:!0}:{},...!e.engineThere&&e.model?{model:e.model}:{}}}function wP(e){switch(e?.kind){case`busy`:case`running`:return`working`;case`needs-input`:return`waiting`;case`attention`:return e.reason===`rate_limited`?`waiting`:`error`;case`unseen`:return`done`;default:return`idle`}}var TP={error:[0,4,8,2,6],done:[3,7,5,2],idle:[1,2,5,8,7,6,3,0]},EP=1.2,DP=[0,1,4,5];function OP(e){return DP.includes((Math.floor(e)%20+20)%20)}var kP=.3,AP=.35,jP=.25,MP=.12,NP=2,PP=1,FP={error:{dots:TP.error,bright:1},done:{dots:TP.done,bright:1},idle:{dots:TP.idle,bright:.6}},IP=Array.from({length:9},(e,t)=>Math.hypot(t%3-1,Math.floor(t/3)-1));function LP(e){return AP+.65*(.5+.5*Math.cos(2*Math.PI*e/EP))}function RP(e,t,n,r=1){switch(e){case`working`:{let e=t*80/1e3/r;return IP.map(t=>LP(e-t*kP))}case`waiting`:{let e=OP(t/r);return Array(9).fill(e?jP:1)}default:{let t=FP[e],r=Array(9).fill(MP);return t?.dots.forEach((e,i)=>{let a=Math.min(Math.max(n-i*PP,0),NP)/NP;r[e]=t.bright*a+MP*(1-a)}),r}}}function zP(e,t){let n=FP[e];return!n||t<(n.dots.length-1)*PP+NP}var BP={working:`info`,waiting:`warning`,error:`attention`,done:`success`,idle:`muted`},VP={prOpen:``,prMerged:``,prClosed:``};function HP(e){let t=wP(e);return{look:t,tone:BP[t]}}function UP(e,t){return Object.values(e.tabStatus??{}).some(e=>e.engine)?!1:!e.engine?.id||!!t?.length&&!t.some(e=>e.kind===`engine`)}function WP(e){return e.rowStatus?.kind===`needs-input`||e.rowStatus?.kind===`attention`}var GP={busy:0,attention:1,"needs-input":2,running:3,unseen:4,idle:5};function KP(e){let t;for(let{rowStatus:n}of e)n&&(!t||GP[n.kind]<GP[t.kind]||n.kind===t.kind&&n.since>t.since)&&(t=n);return t}function qP(e,t){if(!e)return null;if(e.lifecycle===`merged`)return{glyph:VP.prMerged,tone:`text-merged`,state:`merged`};if(e.lifecycle===`closed`)return{glyph:VP.prClosed,tone:`text-muted`,state:`closed`};if(e.lifecycle!==`open`&&e.lifecycle!==`ready_to_merge`&&e.lifecycle!==`unknown`)return null;let n=t===`conflict`?`conflict`:t===`failing`?`failing`:t===`passing`?`passing`:e.checkState===`pending`?`pending`:void 0,r=n===`conflict`?`text-warning`:n===`failing`?`text-error`:`text-success`;return{glyph:VP.prOpen,tone:r,state:`open`,...n?{checks:n}:{}}}function JP(e){return qP(e.pr,e.prChip)}function YP(e){return qP(e,(e.mergeable??``).toUpperCase()===`CONFLICTING`?`conflict`:e.checkState===`failing`?`failing`:e.checkState===`passing`?`passing`:null)}function XP(e){let t=e=>e.state===`open`?e.checks===`conflict`||e.checks===`failing`?0:1:e.state===`merged`?2:3;return[...e].sort((e,n)=>t(e)-t(n))[0]}var ZP=3,QP=new Set,$P;function eF(e,t){let n=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches,r=1/0,i=e.held+t-e.step,a=zP(e.look,n?r:i);return RP(e.look,t,n?r:i,n?ZP:1).forEach((t,n)=>{let r=e.el.children[n].style;r.opacity=t.toFixed(3)}),a}function tF(){let e=Math.floor(performance.now()/80);for(let t of QP)eF(t,e)||QP.delete(t);nF()}function nF(){$P=QP.size?window.setTimeout(tF,80-performance.now()%80+2):void 0}function rF(e,t,n){let r=Math.floor(performance.now()/80),i=n>0?Math.max(Date.now()-n,0):1/0,a={el:e,look:t,step:r,held:Math.floor(i/80)};return eF(a,r)&&(QP.add(a),$P===void 0&&nF()),()=>{QP.delete(a)}}function iF({status:e}){let{look:t,tone:n}=HP(e);return(0,K.jsx)(cF,{look:t,tone:n,since:e?.since??0},t)}function aF({look:e}){return(0,K.jsx)(cF,{look:e,tone:BP[e],since:0},e)}var oF=e=>e===`muted`?`text-muted`:e===`ink`?`text-ink`:EO[e];function sF(){return(0,K.jsx)(cF,{look:`working`,tone:`info`,since:Date.now()})}function cF({look:e,tone:t,since:n}){let r=(0,J.useRef)(null),[i]=(0,J.useState)(n);return(0,J.useLayoutEffect)(()=>{let t=r.current;return t?rF(t,e,i):void 0},[e,i]),(0,K.jsx)(`span`,{ref:r,className:`inline-grid flex-none grid-cols-[repeat(3,3px)] auto-rows-[3px] gap-px self-center narrow:auto-rows-[4px] narrow:grid-cols-[repeat(3,4px)] narrow:gap-0.5 ${oF(t)}`,"aria-hidden":`true`,"data-dots":e,children:Array.from({length:9},(e,t)=>(0,K.jsx)(`i`,{className:`rounded-full bg-current opacity-12`},t))})}wl(),G();var lF={offline:`newSession.remoteOffline`,outdated:`newSession.remoteOutdated`},uF=`local`,dF=`auto`,fF=`rove.newSession.autoMachine`;function pF(){try{return localStorage.getItem(fF)===`1`}catch{return!1}}var mF=(e,t)=>Ws(e,`machines.repos`,{machine:t});function hF(e,t){let n=t.filter(e=>e.state===`online`).map(e=>e.alias).join(`
|
|
194
|
+
`);(0,J.useEffect)(()=>{for(let t of n?[uF,...n.split(`
|
|
195
|
+
`)]:[])mF(e,t).catch(()=>{})},[e,n])}function gF(e,t){let[n,r]=(0,J.useState)(null);return(0,J.useEffect)(()=>{if(!t)return;let n=!1;return Ws(e,`machines.engines`,{machine:t}).then(e=>!n&&r({machine:t,reply:e})).catch(()=>{}),()=>{n=!0}},[e,t]),t?(n?.machine===t?n.reply:Hs(e,`machines.engines`,{machine:t}))?.engines??[]:[]}function _F(e,t,n){let r=SP(n.engines,gF(e,t)),i=r.rows.filter(e=>!r.missing.has(e.id)),a=i.some(e=>e.id===n.engine)?n.engine:i[0]?.id??n.engine;return{engines:r.rows,engine:a,setEngine:n.setEngine,missing:t?r.missing:void 0}}function vF(e,t,n){let[r,i]=(0,J.useState)(null),a=bF(e,r?.from??``);return(0,J.useEffect)(()=>{!r||!a.loaded||!t.loaded||(t.problem||n(xP(r.ref,a.repos,t.repos)),i(null))},[r,a,t,n]),(e,t)=>i(e&&t?{from:e,ref:t}:null)}function yF(e,t,n){let r=RN(e),[i,a]=(0,J.useState)(t.machine??``),[o,s]=(0,J.useState)(()=>!t.machine&&pF()),c=bF(e,i),[l,u]=(0,J.useState)(!1),d=_F(e,l?i:``,n);hF(e,r);let[f,p]=(0,J.useState)(null),[m,h]=(0,J.useState)(``),g=vF(e,c,e=>p(t=>t??e));return(0,J.useEffect)(()=>{!i||!c.loaded||i!==t.machine||p(e=>e??yP(t.repo,c.repos))},[c.loaded]),{machines:r,machine:i,auto:o,remote:i!==``,machineName:r.find(e=>e.alias===i)?.hostLabel||i,remoteList:c,engineThere:l,setEngineThere:u,shown:d,pick:f,setPick:p,base:m,setBase:h,switchTo(e,t){let n=e===`auto`?``:e;s(e===dF);try{localStorage.setItem(fF,e===`auto`?`1`:`0`)}catch{}g(n&&(i||`local`),i?f?.ref:t),a(n),p(null),h(``)}}}function bF(e,t){W();let[n,r]=(0,J.useState)(null);if((0,J.useEffect)(()=>{if(!t)return;let n=!1;return mF(e,t).then(e=>!n&&r({machine:t,reply:e,failed:``})).catch(e=>!n&&r({machine:t,reply:null,failed:String(e)})),()=>{n=!0}},[e,t]),!t)return{repos:[],loaded:!0,problem:``};let i=n?.machine===t?n:void 0,a=Hs(e,`machines.repos`,{machine:t});if(!i&&!a)return{repos:[],loaded:!1,problem:``};let o=i?i.reply:a;if(!o)return{repos:[],loaded:!0,problem:U(`newSession.remoteFailed`,{machine:t,message:i?.failed??``})};let s=o.reason?lF[o.reason]:void 0,c=o.reason?s?U(s,{machine:t}):U(`newSession.remoteFailed`,{machine:t,message:o.message??o.reason}):``;return{repos:o.repos,loaded:!0,problem:c}}function xF(e,t){return t.problem?t.problem:t.loaded?U(`newSession.remoteNone`,{machine:e}):U(`newSession.remoteLoading`,{machine:e})}function SF(){return(0,K.jsxs)(`svg`,{className:PA,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,K.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`8`,rx:`1`}),(0,K.jsx)(`path`,{d:`M5.5 13.5h5M8 11v2.5`})]})}function CF(e){let t=(W()===`zh`?fo:uo).machine,n=e.machines.find(t=>t.alias===e.value),r=e.value===`auto`?U(`newSession.machineAuto`):e.value?n?.hostLabel||e.value:U(`newSession.thisMachine`);return(0,K.jsx)(dP,{field:`machine`,title:U(`newSession.machine`),label:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(SF,{}),(0,K.jsx)(`span`,{className:FA,children:r})]}),children:n=>(0,K.jsx)(mP,{heading:U(`newSession.machine`),options:[{id:dF,label:U(`newSession.machineAuto`)},{id:``,label:U(`newSession.thisMachine`)},...e.machines.map(e=>({id:e.alias,label:NN(e,t),disabled:e.state!==`online`}))],footer:e.value===`auto`?(0,K.jsx)(`p`,{className:`${JA} text-muted`,children:U(`newSession.machineAutoNote`)}):null,value:e.value,digits:!0,onPick:t=>{e.onPick(t),n()}})})}function wF(e){let{machine:t}=e;return(0,K.jsx)(mP,{heading:U(`newSession.agentPlace`),options:[{id:``,label:U(`newSession.thisMachine`)},{id:`there`,label:t}],value:e.there?`there`:``,digits:!0,onBack:e.onBack,onPick:t=>e.onPick(t!==``),footer:(0,K.jsx)(`p`,{className:`${JA} text-muted`,children:U(e.there?`newSession.agentThereNote`:`newSession.agentHereNote`,{machine:t})})})}function TF(e){let[t,n]=(0,J.useState)(``),r=t.trim();return(0,K.jsx)(dP,{field:`branch`,title:U(`newSession.branch`),label:e.value||U(`newSession.branch`),children:i=>(0,K.jsx)(fP,{placeholder:U(`newSession.branchTypeRef`),empty:``,rows:[{key:``,text:U(`newSession.branchRemoteDefault`),checked:e.value===``}],query:t,onQuery:n,extra:r?{key:r,text:r,checked:e.value===r}:null,onPick:t=>{e.onPick(t),n(``),i()}})})}async function EF(e,t){return(await e.client.request(`task.spawn`,CP(t))).taskIds[0]}function DF(e){let{progress:t,error:n}=e;return!t&&!n?null:(0,K.jsxs)(`div`,{className:Yee,children:[t&&(0,K.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-muted`,"data-field":`clone-progress`,children:[(0,K.jsx)(sF,{}),(0,K.jsx)(`span`,{className:`running-shimmer:bg-[linear-gradient(90deg,var(--ink)_0%,var(--ink)_35%,var(--accent)_50%,var(--ink)_65%,var(--ink)_100%)] running-shimmer:bg-size-[300%_100%] running-shimmer:bg-clip-text running-shimmer:text-transparent running-shimmer:animate-shimmer`,children:t})]}),n&&!XA(n)&&(0,K.jsxs)(`p`,{className:`m-0 text-error`,children:[`※ `,n]}),n&&XA(n)&&(0,K.jsxs)(`p`,{className:`pointer-events-auto m-0 text-error`,"data-field":`no-disk-space`,children:[`※ `,Y(`tasks`,`toast.noDiskSpace`),` `,(0,K.jsx)(q,{hit:`tight`,disabled:e.busy,onClick:e.onRetry,children:U(`newSession.retry`)})]})]})}function OF(e){return e instanceof yl&&e.code===`CLONE_FAILED`?Y(`newTask`,`error.cloneFailed`,{error:e.message}):e instanceof Error?e.message:String(e)}function kF({on:e,...t}){return(0,K.jsx)(`button`,{type:`button`,className:`${LA(e)} ${RA} narrow:shrink-0`,"aria-pressed":e,...t})}G();function AF(e){let[t,n]=(0,J.useState)(``);if(e.ungrouped)return null;if(e.remote){if(!e.remotePick)return null;let t=e.remoteWorktree;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(jF,{on:t!==`off`,disabled:t===`required`,title:U(t===`required`?`newSession.worktreeRemoteRequired`:t===`off`?`newSession.worktreeOff`:`newSession.worktreeOn`),onClick:e.onToggleWorktree}),t!==`off`&&(0,K.jsx)(TF,{value:e.remoteBase,onPick:e.onRemoteBase})]})}let{repos:r,bases:i,inPlace:a}=e,o=r[0]??``,s=e.probes[o]??null,c=i[o]||s?.current||``,l=Gee(s?.branches??[],t).map(e=>({key:e,text:e,checked:e===(i[o]||s?.current)})),u=r.map(t=>({path:t,name:BN(t).base,primary:t===o,branches:e.probes[t]?.branches??[],current:e.probes[t]?.current??``,base:i[t]??``}));return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(jF,{on:!a,disabled:r.length>1||e.plain,title:e.plain?U(`newSession.worktreeNoGit`):r.length>1?U(`newSession.worktreeMulti`):U(a?`newSession.worktreeOff`:`newSession.worktreeOn`),onClick:e.onToggleWorktree}),r.length>1?(0,K.jsx)(dP,{field:`branch`,title:U(`newSession.branches`),label:U(`newSession.branches`),children:()=>(0,K.jsx)(hP,{repos:u,branch:e.branchName,onBranch:e.onBranchName,onBase:e.onBase})}):!a&&s?.ok&&c&&(0,K.jsx)(dP,{field:`branch`,title:U(`newSession.branch`),label:c,children:r=>(0,K.jsx)(fP,{placeholder:U(`newSession.branchSearch`),empty:U(`newSession.branchEmpty`),rows:l,query:t,onQuery:n,onPick:t=>{e.onBase(o,t),n(``),r()}})})]})}function jF(e){return(0,K.jsxs)(kF,{on:e.on,disabled:e.disabled,title:e.title,onClick:e.onClick,children:[(0,K.jsx)(hte,{}),(0,K.jsx)(`span`,{className:FA,children:U(`newSession.worktree`)})]})}var MF=`rove.web.newSession.prompt`,NF=`rove.web.newSession.attachments`,PF=sessionStorage.getItem(MF)??``;function FF(){return PF}function IF(e){PF=e;try{sessionStorage.setItem(MF,e)}catch{}}var LF=`rove.web.newSession.worktree`,RF=()=>localStorage.getItem(`rove.web.newSession.worktree`)===`0`?`folder`:`worktree`,zF=`block size-4 flex-none translate-y-px narrow:size-4.5`,BF=`animate-mark-pulse motion-reduce:[animation-duration:4.8s]`;function VF(e){let t=(0,J.useId)();if(e.blank)return(0,K.jsx)(`span`,{className:zF,"aria-hidden":`true`});let n=e.status?.look;if(n===`waiting`||n===`error`)return(0,K.jsx)(`span`,{className:`${zF} text-center font-mono text-meta leading-4 font-semibold ${DO[e.status?.tone??`muted`]}`,"aria-hidden":`true`,children:n===`waiting`?`?`:`!`});let r=e.status&&(n===`idle`?`text-muted`:DO[e.status.tone]);return(0,K.jsx)(`svg`,{className:`${zF} ${r??(e.icon?`text-ink`:`text-muted`)} ${n===`working`?BF:``}`,viewBox:e.icon?.viewBox??`0 0 14 14`,role:e.name?`img`:void 0,"aria-label":e.name,"aria-hidden":!e.name||void 0,children:e.icon?e.icon.paths.map((e,n)=>e.fade&&!r?(0,K.jsxs)(`g`,{children:[(0,K.jsxs)(`linearGradient`,{id:`${t}-${n}`,gradientUnits:`userSpaceOnUse`,x1:e.fade[0],y1:e.fade[1],x2:e.fade[2],y2:e.fade[3],children:[(0,K.jsx)(`stop`,{stopColor:e.fill??`currentColor`}),(0,K.jsx)(`stop`,{offset:`1`,stopColor:e.fill??`currentColor`,stopOpacity:`0`})]}),(0,K.jsx)(`path`,{d:e.d,fill:`url(#${t}-${n})`,fillRule:e.evenodd?`evenodd`:void 0})]},n):e.fade?null:(0,K.jsx)(`path`,{d:e.d,fill:r?`currentColor`:e.fill??`currentColor`,fillRule:e.evenodd?`evenodd`:void 0},n)):(0,K.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`})})}G();function HF(e){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:tte,children:e.mark}),(0,K.jsx)(`span`,{className:`${GA} ${ete}`,children:e.word})]})}function UF(e,t){let[n,r]=(0,J.useState)(null),i=t&&n!==null,a=i?n:e.engine?[e.engine]:[];return{ids:a,comparing:i,setComparing:e=>r(e?a:null),toggle(t){let n=nP(a,t);r(n),n[0]&&n[0]!==e.engine&&e.setEngine(n[0])}}}function WF(e){let{picks:t,choice:n}=e,r=n.engines;if(r.length<2)return null;let i=t.ids.map(e=>r.find(t=>t.id===e)),a=i.map((e,n)=>e?.name??t.ids[n]??``),o=i.map((e,n)=>(0,K.jsx)(VF,{icon:e?.icon},t.ids[n]));return(0,K.jsx)(dP,{field:`engine`,title:U(`newSession.engine`),label:(0,K.jsx)(HF,{mark:o,word:rP(a)||U(`newSession.engine`)}),children:i=>(0,K.jsx)(mP,{heading:U(`newSession.engine`),options:r.map(t=>{if(!e.missing)return{id:t.id,label:t.name,dim:t.ready===!1};let n=e.missing.has(t.id);return{id:t.id,label:n?U(`newSession.engineMissing`,{engine:t.name}):t.name,disabled:n}}),value:n.engine,...t.comparing?{values:t.ids}:{},onPick:e=>{if(t.comparing)return t.toggle(e);n.setEngine(e),i()},footer:e.available&&r.length>1?(0,K.jsx)(q,{className:`mx-2 mt-1 mb-0.5 self-start font-mono`,"data-field":`compare-engines`,hit:`tight`,onClick:()=>t.setComparing(!t.comparing),children:U(t.comparing?`compare.oneEngine`:`compare.severalEngines`)}):null})})}function GF(e){return(0,K.jsx)(dP,{field:`model`,title:U(`newSession.model`),label:(0,K.jsx)(HF,{mark:(0,K.jsx)(KF,{}),word:tP(e.models,e.model,U(`newSession.modelDefault`))}),children:t=>(0,K.jsx)(mP,{heading:U(`newSession.modelHeading`),options:e.models,value:e.model,digits:!0,onPick:n=>{e.onModel(n),t()}})})}function KF(){return(0,K.jsx)(`svg`,{className:PA,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:`M8 2.5c.4 3 1.5 4.6 5.5 5.5-4 .9-5.1 2.5-5.5 5.5-.4-3-1.5-4.6-5.5-5.5 4-.9 5.1-2.5 5.5-5.5z`})})}function qF(e){return e<32||e>=127&&e<=159||e>=768&&e<=879||e>=4448&&e<=4607||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8203&&e<=8207||e>=8234&&e<=8238||e>=8288&&e<=8292||e>=8400&&e<=8447||e>=12330&&e<=12335||e>=12441&&e<=12442||e>=65024&&e<=65039||e>=65056&&e<=65071||e===65279?0:e>=4352&&e<=4447||e===9001||e===9002||e>=11904&&e<=12350||e>=12353&&e<=13311||e>=13312&&e<=19903||e>=19968&&e<=40959||e>=40960&&e<=42191||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e===126980||e===127183||e>=127488&&e<=127743||e>=127744&&e<=129791||e>=131072&&e<=262141?2:1}function JF(e){let t=0;for(let n of e)t+=qF(n.codePointAt(0));return t}var YF=6e4,XF=/^(?:(today|tomorrow|今天|明天)\s*)?(\d{1,2})(?::(\d{2}))?\s*(am|pm)?$/i,ZF=/^\+\s*(?:(\d+)\s*h)?\s*(?:(\d+)\s*m)?$/i;function QF(e,t){let n=e.trim(),r=ZF.exec(n);if(r&&(r[1]||r[2])){let e=Number(r[1]??0)*60+Number(r[2]??0);return e>0?new Date(t.getTime()+e*YF):null}let i=XF.exec(n);if(!i)return null;let a=i[1]?.toLowerCase(),o=Number(i[2]),s=Number(i[3]??0),c=i[4]?.toLowerCase();if(c){if(o<1||o>12)return null;o=o%12+(c===`pm`?12:0)}if(o>23||s>59)return null;let l=new Date(t.getFullYear(),t.getMonth(),t.getDate(),o,s);if(a===`tomorrow`||a===`明天`)l.setDate(l.getDate()+1);else if(l.getTime()<=t.getTime()){if(a)return null;l.setDate(l.getDate()+1)}return l.getTime()>t.getTime()?l:null}function $F(e,t=new Date){let n=e.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`});return e.toDateString()===t.toDateString()?n:`${e.toLocaleDateString([],{weekday:`short`})} ${n}`}G();function eI(e){let[t,n]=(0,J.useState)(``),r=()=>{let n=QF(t,new Date);if(!n)return e.onInvalid(U(`newSession.laterBad`));e.onSchedule(n)},i=U(`newSession.laterPlaceholder`);return(0,K.jsxs)(`div`,{className:pte,children:[(0,K.jsx)(`input`,{className:`${Ai} flex-1 px-2.5 py-2`,value:t,placeholder:i,size:JF(i),"aria-label":U(`newSession.later`),spellCheck:!1,autoComplete:`off`,autoFocus:!0,onChange:e=>n(e.target.value),onKeyDown:t=>{if(t.key===`Escape`)return t.preventDefault(),t.stopPropagation(),e.onBack();t.key!==`Enter`||t.nativeEvent.isComposing||(t.preventDefault(),t.stopPropagation(),r())}}),(0,K.jsx)(q,{variant:`filled`,className:`shrink-0`,disabled:!t.trim(),onClick:r,children:U(`newSession.laterConfirm`)})]})}function tI(e){return(0,K.jsx)(`svg`,{className:`block size-2.5 flex-none transition-[rotate,opacity] duration-150 ease-[ease] motion-reduce:transition-none ${e.right?`-rotate-90 is-right`:``} ${e.className??``}`,viewBox:`0 0 10 10`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:`M2.5 3.75 5 6.25l2.5-2.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinecap:`round`,strokeLinejoin:`round`})})}G();function nI(e){let[t,n]=(0,J.useState)(`root`),r=e.agentPlace;return!r&&!e.onLater?null:(0,K.jsx)(dP,{field:`more`,title:U(`newSession.more`),label:(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`⋯`}),onClose:()=>n(`root`),children:i=>t===`later`?(0,K.jsxs)(`div`,{className:zA,children:[(0,K.jsxs)(`button`,{type:`button`,className:`${HA} ${Di} text-muted`,onClick:()=>n(`root`),children:[`‹ `,U(`newSession.later`)]}),(0,K.jsx)(eI,{onBack:()=>n(`root`),onInvalid:e.onInvalid,onSchedule:t=>{i(),e.onLater?.(t)}})]}):t===`agent`&&r?(0,K.jsx)(wF,{...r,onBack:()=>n(`root`),onPick:e=>{r.onPick(e),i()}}):(0,K.jsxs)(`div`,{role:`menu`,className:zA,children:[r&&(0,K.jsx)(rI,{label:U(`newSession.agentPlace`),dim:r.there?r.machine:U(`newSession.thisMachine`),sub:!0,disabled:e.busy,onClick:()=>n(`agent`)}),e.onLater&&(0,K.jsx)(rI,{label:U(`newSession.later`),sub:!0,disabled:e.busy,onClick:()=>n(`later`)})]})})}function rI(e){return(0,K.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`${UA({cursor:!1})} enabled:hover:bg-hover`,disabled:e.disabled,onClick:e.onClick,children:[(0,K.jsx)(`span`,{className:GA,children:e.label}),(e.dim!==void 0||e.sub)&&(0,K.jsxs)(`span`,{className:`${lte} text-muted`,children:[e.dim,e.sub&&(0,K.jsx)(tI,{right:!0})]})]})}G();var iI=`\0up`,aI=`\0use`,oI=`\0use-typed`,sI=`\0back`;function cI(e){return/^(?:[~/'"]|file:|[A-Za-z]:[\\/]|\\\\)/i.test(e.trim())}function lI(e){let{dir:t}=BN(KN(e));return t||e}function uI(e){let[t,n]=(0,J.useState)(e.start),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(0),[s,c]=(0,J.useState)(null),l=cI(r);(0,J.useEffect)(()=>{let i=!1;return e.model.client.request(`fs.subdirs`,{path:l?r.trim():t+r}).then(e=>{i||(c(e),!r&&e.base&&e.base!==t&&n(e.base))}).catch(()=>!i&&c(null)),()=>{i=!0}},[e.model,t,r,l]);let u=(0,J.useRef)(null);(0,J.useEffect)(()=>{u.current?.scrollIntoView({block:`nearest`})},[a,s]);let d=s?.base||t,f=KN(d),p=l&&s?.dir?s.dir:null,m=[...p?[{key:oI,text:U(`newSession.folderUse`,{name:p})}]:[],...!r&&lI(d)!==d?[{key:iI,text:`..`,dim:U(`newSession.folderParent`)}]:[],...(s?.names??[]).map(e=>({key:e,text:`${e}/`,dim:s?.git.includes(e)?U(`newSession.folderGit`):void 0})),...p?[]:[{key:aI,text:U(`newSession.folderUse`,{name:BN(f).base||f})}],{key:sI,text:U(`newSession.folderBack`)}],h=m.findIndex(e=>e.key===aI||e.key===sI),g=Math.min(a,m.length-1),_=s!==null&&s.names.length===0&&!p,v=e=>{n(e),i(``),o(0)},y=e=>{if(e===iI)return v(lI(d));if(e===aI||e===oI||e===sI)return b(e);v(d+e+(d.endsWith(`\\`)?`\\`:`/`))},b=t=>{if(t===sI)return e.onBack();if(t===iI)return v(lI(d));if(t===oI&&p)return e.onUse(p);if(t===aI)return e.onUse(f);e.onUse(d+t)};return(0,K.jsxs)(`div`,{className:cte,children:[(0,K.jsxs)(q,{variant:`row`,className:`${HA} ${Di} flex min-w-0 gap-2 text-muted`,tabIndex:-1,title:d,onClick:e.onBack,children:[(0,K.jsxs)(`span`,{className:`flex-none`,children:[`‹ `,U(`newSession.openFolderHeading`)]}),(0,K.jsx)(`span`,{className:KA,children:(0,K.jsx)(`bdi`,{children:d})})]}),(0,K.jsx)(`input`,{className:VA,autoFocus:!0,spellCheck:!1,placeholder:U(`newSession.folderFilter`),value:r,onChange:e=>{o(0),i(e.target.value)},onKeyDown:t=>{if(t.nativeEvent.isComposing)return;let n=m[g];if(t.key===`ArrowDown`||t.key===`ArrowUp`)t.preventDefault(),o(Math.max(0,Math.min(m.length-1,g+(t.key===`ArrowDown`?1:-1))));else if(t.key===`Enter`)t.preventDefault(),n&&b(n.key);else if(t.key===`Escape`)t.preventDefault(),t.stopPropagation(),e.onBack();else if(!r&&(t.key===`ArrowLeft`||t.key===`Backspace`))t.preventDefault(),v(lI(d));else if(t.key===`ArrowRight`&&!r||t.key===`Tab`){if(!n||n.key.startsWith(`\0`))return;t.preventDefault(),y(n.key)}}}),(0,K.jsx)(`div`,{className:BA,children:m.map((e,t)=>(0,K.jsxs)(J.Fragment,{children:[t===h&&(0,K.jsxs)(K.Fragment,{children:[_&&(0,K.jsx)(`p`,{className:`mx-2 my-1 text-muted`,children:U(`newSession.folderEmpty`)}),(0,K.jsx)(`div`,{className:`mx-2 my-1 flex-none border-t border-t-line`})]}),(0,K.jsxs)(q,{variant:`row`,ref:t===g?u:void 0,tabIndex:-1,title:e.key.startsWith(`\0`)?void 0:d+e.key,className:UA({cursor:t===g}),onMouseMove:()=>o(t),onClick:()=>y(e.key),children:[(0,K.jsx)(`span`,{className:WA}),(0,K.jsx)(`span`,{className:qA,children:e.text}),e.dim&&(0,K.jsx)(`span`,{className:`ml-auto pl-3 text-muted`,children:e.dim})]})]},e.key))}),(0,K.jsx)(`p`,{className:`${dte} text-subtle touch:hidden`,children:U(`newSession.folderHint`)})]})}G();var dI=`clone:`,fI=`\0open-folder`;function pI(e){let{model:t,saved:n,picked:r,primary:i,home:a,query:o,remote:s}=e,[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(()=>Hs(t,`github.repos`)??null);(0,J.useEffect)(()=>{let e=!1,n=t.client.onOpen(()=>{Ws(t,`github.repos`).then(t=>!e&&d(t)).catch(()=>!e&&d(e=>e??{repos:[],reason:`failed`}))});return()=>{e=!0,n()}},[t]);let f=o.trim(),p=f.toLowerCase(),m=ZN(f),h=n.filter(e=>e.toLowerCase().includes(p)||m!==null&&`/${BN(e).base.toLowerCase()}`===m.slice(m.indexOf(`/`))),g=U(`newSession.noFolder`),_=e.ungrouped&&(!f||g.toLowerCase().includes(f.toLowerCase()))?[{key:ps,text:g,checked:e.ungrouped.on}]:[],v=n.map(e=>BN(e).base.toLowerCase()),y=e=>v.filter(t=>t===e.toLowerCase()).length>1,b=h.map((e,t)=>{let{base:n,dir:a}=BN(e),o=y(n)?a:``;return{key:e,text:n,dim:[e===i&&r.length>1?U(`newSession.primary`):``,o].filter(Boolean).join(`, `)||void 0,dimPath:!0,title:e,checked:r.includes(e),ruled:t===0&&_.length>0}}),x=YN(f),S=x&&(x.includes(`:`)||h.length===0)?x:null,C=!S&&WN(f)&&!n.includes(f)&&(!s||UN(f))?KN(GN(f,a)):``,w=(u?.repos??[]).filter(e=>e.nameWithOwner.toLowerCase().includes(m??p)).filter(e=>!bP(n,e.nameWithOwner,s!==void 0)).sort((e,t)=>Number(t.nameWithOwner.toLowerCase()===m)-Number(e.nameWithOwner.toLowerCase()===m)).map(t=>({key:dI+t.nameWithOwner,text:t.nameWithOwner,dim:t.description,title:t.description,checked:e.cloning===t.nameWithOwner})),T=m!==null&&!/^(?:ssh:|git@)/i.test(f)&&w[0]?.text.toLowerCase()===m?null:S?{key:dI+S,text:s?U(`newSession.cloneRowOn`,{source:S,machine:s.name}):U(`newSession.cloneRow`,{source:S})}:C?{key:C,text:C,checked:r.includes(C)}:null,E=s?null:{key:fI,text:U(`newSession.openFolder`)};return c?(0,K.jsx)(uI,{model:t,start:i&&BN(i).dir||(a?`${KN(a)}/`:`~/`),onUse:t=>e.onToggle(t,!1),onBack:()=>l(!1)}):(0,K.jsx)(fP,{placeholder:U(s?`newSession.repoSearchRemote`:`newSession.repoSearch`),empty:s?.empty??U(u?`newSession.repoEmpty`:`newSession.githubLoading`),rows:s?.blocked?[]:[..._,...b],pinned:E,query:o,onQuery:e.onQuery,extra:s?.blocked?null:T,more:s?.blocked?[]:w,moreLabel:U(`newSession.githubGroup`),onPick:(t,n)=>{if(t===fI)return l(!0);if(t===`~scratch`)return e.ungrouped?.pick(),e.close();if(!t.startsWith(`clone:`))return e.onToggle(t,n);e.onClone(t.slice(6)),e.close()}})}G();var mI=`:shell`;function hI(e,t){let[n,r]=(0,J.useState)(!1),i=t&&n;return t?{on:i,choice:{...e,engines:[...e.engines,{id:mI,name:U(`newSession.shell`)}],engine:i?mI:e.engine,setEngine:t=>{r(t===mI),t!==`:shell`&&e.setEngine(t)}}}:{on:i,choice:e}}async function gI(e,t,n){let r=n.trim();if(/[\r\n]/.test(r))throw Error(U(`newSession.shellOneLine`));let i=r?{type:r}:{},a=r?zN(r):U(`newSession.shell`);if(typeof t==`object`&&t)return(await e(`task.spawn`,{...cP({repos:t.repos,branch:t.branch,engine:``,prompt:``,model:``}),title:a,shell:!0,...i})).taskIds[0];let{taskId:o}=t===null?await e(`task.openScratch`,{}):await e(`task.openCheckout`,{repo:t,title:a});return await e(`tab.new`,{taskId:o,kind:`shell`,own:!0,...i}),o}function _I(e,t){let n=Ko(e),r=n?[]:t.extraRepos??[];return{...n?{ungrouped:!0}:{repo:t.repo},...t.baseRef?{baseBranch:t.baseRef}:{},...r.length>0?{extras:r}:{},...e.machine?{machine:e.machine.id}:{},prompt:t.prompt,...t.engine?{engine:t.engine}:{},worktree:e.kind===`task`,retryOf:{id:e.id,label:e.label}}}function vI(e,t){return e?[e,...(t.extras??[]).map(e=>e.repo)]:[]}function yI(e,t){return e?{...t.baseBranch?{[e]:t.baseBranch}:{},...Object.fromEntries((t.extras??[]).flatMap(e=>e.baseRef?[[e.repo,e.baseRef]]:[]))}:{}}function bI(e){return[e.machine??``,e.repo??``,e.ungrouped?`u`:``,e.retryOf?.id??``,e.baseBranch??``,e.worktree===void 0?``:String(e.worktree)].join(`\0`)}function xI(e,t){return e.retryOf&&e.engine&&e.engine===t?e.retryOf.id:void 0}wl(),G(),H();async function SI(e,t){try{let{task:n}=await e.client.request(`task.get`,{taskId:t.id});if(!n.prompt)return void z(U(`menu.retryNoPrompt`),`error`);ie(_I(t,{...n,prompt:n.prompt}))}catch(e){z(Ra(e),`error`)}}function CI(e,t){let n=async n=>{await e.act(`task.archive`,{taskId:t.id,archived:!0,...n?{force:n}:{}}),z(Y(`tasks`,`archive.done`,{title:t.label}))};B.set((0,K.jsx)(Ha,{title:U(`newSession.retryArchiveTitle`,{title:t.label}),body:U(`newSession.retryArchiveBody`),confirmLabel:Y(`tasks`,`menu.archive`),onConfirm:()=>n(!1),escalate:{when:e=>e instanceof yl&&e.code===`TASK_BUSY`,label:Y(`tasks`,`archive.busyConfirm`),title:Y(`tasks`,`archive.busyTitle`),body:()=>Y(`tasks`,`archive.busyBody`,{title:t.label}),run:()=>n(!0)}}))}A();var wI=O([]),TI=()=>k(wI);async function EI(e){wI.set((await e.request(`snippets.get`)).snippets)}async function DI(e,t){wI.set((await e.request(`snippets.save`,{name:t.name,text:t.text})).snippets)}async function OI(e,t){wI.set((await e.request(`snippets.remove`,{name:t})).snippets)}var kI=/^[A-Za-z0-9][\w-]{0,31}$/;function AI(e,t){let n=t;for(;n>0&&/[\w-]/.test(e[n-1]??``);)n--;if(n===0||e[n-1]!==`@`)return null;let r=e[n-2];if(r!==void 0&&!/\s/.test(r))return null;let i=t;for(;i<e.length&&/[\w-]/.test(e[i]??``);)i++;return{start:n-1,end:i,query:e.slice(n,t)}}function jI(e,t){let n=t.toLowerCase(),r=e.filter(e=>e.name.toLowerCase().startsWith(n));return[...r.filter(e=>e.name.toLowerCase()===n),...r.filter(e=>e.name.toLowerCase()!==n)]}function MI(e,t,n){return{text:e.slice(0,t.start)+n.text+e.slice(t.end),caret:t.start+n.text.length}}var NI=e=>e.split(`
|
|
196
|
+
`,1)[0]??``;function PI(e){return(0,K.jsx)(`ul`,{className:`${Ti} ${e.className}`,children:e.items.map((t,n)=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(q,{variant:`row`,tabIndex:-1,"aria-pressed":n===e.at,className:Ei({cursor:n===e.at,accent:!1}),onMouseDown:t=>{t.preventDefault(),e.onPick(n)},children:[(0,K.jsxs)(`span`,{className:`text-accent`,children:[`@`,t.name]}),(0,K.jsxs)(`span`,{className:`text-muted`,children:[` `,NI(t.text)]})]})},t.name))})}function FI(e){let t=TI(),[n,r]=(0,J.useState)(0),[i,a]=(0,J.useState)(0),[o,s]=(0,J.useState)(null),c=(0,J.useRef)(null),l=AI(e.value,Math.min(n,e.value.length)),u=l?jI(t,l.query):[],d=l!==null&&u.length>0&&o!==l.start,f=Math.min(i,Math.max(0,u.length-1));(0,J.useLayoutEffect)(()=>{let t=c.current,n=e.area.current;t===null||!n||(c.current=null,n.setSelectionRange(t,t),r(t))});let p=t=>{let n=u[t];if(!l||!n)return;let r=MI(e.value,l,n);c.current=r.caret,a(0),e.onChange(r.text)},m=e=>{if(!d||e.nativeEvent.isComposing)return!1;if(e.key===`ArrowDown`||e.key===`ArrowUp`)a(Math.max(0,Math.min(u.length-1,f+(e.key===`ArrowDown`?1:-1))));else if(e.key===`Tab`&&!e.shiftKey||e.key===`Enter`&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey)p(f);else if(e.key===`Escape`)s(l?.start??null),e.stopPropagation();else return!1;return e.preventDefault(),!0};return{list:d?(0,K.jsx)(PI,{items:u,at:f,className:e.listClassName??``,onPick:p}):null,field:{onChange:t=>{r(t.target.selectionStart),a(0),e.onChange(t.target.value)},onSelect:e=>r(e.currentTarget.selectionStart),onKeyDown:t=>{m(t)||!e.onEnter||t.key!==`Enter`||t.shiftKey||t.nativeEvent.isComposing||(t.preventDefault(),e.onEnter())}}}}function II(e){let t=(0,J.useRef)(null),n=(0,J.useRef)(e.value);n.current=e.value;let r=(r,i)=>{r.preventDefault();let a=e.choices.findIndex(e=>e.id===n.current),o=e.choices[(a+i+e.choices.length)%e.choices.length];o&&(n.current=o.id,e.onChange(o.id),requestAnimationFrame(()=>t.current?.querySelector(`[aria-pressed=true]`)?.focus()))};return(0,K.jsx)(`div`,{ref:t,className:Bi,"aria-label":e.label,"data-field":e.field,onKeyDown:t=>{t.ctrlKey||t.metaKey||t.altKey||e.choices.length===0||(t.key===`ArrowRight`||t.key===`l`?r(t,1):(t.key===`ArrowLeft`||t.key===`h`)&&r(t,-1))},children:e.choices.map(t=>(0,K.jsx)(`button`,{type:`button`,"aria-pressed":t.id===e.value,tabIndex:t.id===e.value||!e.choices.some(t=>t.id===e.value)?0:-1,className:Vi(t.id===e.value,t.dim),title:t.title,onClick:()=>e.onChange(t.id),children:t.label},t.id))})}G(),El(),H();var LI=`rove.web.engines`;function RI(){try{let e=JSON.parse(localStorage.getItem(LI)??`null`);return Array.isArray(e)?{engines:e}:void 0}catch{return}}function zI(e){try{localStorage.setItem(LI,JSON.stringify(e))}catch{}}function BI(e,t){let[n]=(0,J.useState)(()=>{let n=Hs(e,`engines.list`)??RI(),r=n?QN(n.engines):[];return{offered:r,engine:n?$N(r,t??n.preferred):``}}),[r,i]=(0,J.useState)(n.offered),[a,o]=(0,J.useState)(n.engine);return(0,J.useEffect)(()=>e.client.onOpen(()=>{Ws(e,`engines.list`).then(e=>{zI(e.engines);let n=QN(e.engines);i(n),o($N(n,t??e.preferred))}).catch(()=>{})}),[e]),{engines:r,engine:a,setEngine:o}}var VI=`shell`,HI=`pane:`,UI=e=>e.startsWith(HI),WI=e=>e.slice(5);function GI(e){let[t,n]=(0,J.useState)(()=>Hs(e,`plugin.panes`)?.panes??[]);return(0,J.useEffect)(()=>{Ws(e,`plugin.panes`).then(e=>n(e.panes)).catch(()=>n([]))},[e]),t}function KI(e){let t=[...e.engines,...e.withShell?[{id:VI,name:U(`tab.shell`)}]:[],...(e.panes??[]).map(e=>({id:HI+e.id,name:e.title}))];return(0,K.jsx)(II,{label:U(`newTask.engine`),field:`engine`,value:e.value,onChange:e.onChange,choices:t.map(e=>({id:e.id,label:e.name,dim:`ready`in e&&e.ready===!1,title:`ready`in e&&e.ready===!1?U(`newTask.notReady`):void 0}))})}function qI(e,t){return JI(e,t,{kind:`engine`,latest:!0}).catch(e=>z(String(e),`error`))}async function JI(e,t,n){let{tabId:r,taskId:i}=await e.client.request(`tab.new`,{taskId:t,kind:n.kind,...n.engine?{engine:n.engine}:{},...n.prompt?{prompt:n.prompt}:{},...n.latest?{latest:!0}:{},...n.replaceTab?{replaceTab:n.replaceTab}:{}});if(i){e.selectWhenListed(i);return}await e.refreshTabsNow(t),n.replaceTab&&await qc(Tl(t,r))?.reattach(),e.select(t,r)}async function YI(e){await JI(e,(await e.client.request(`task.openScratch`,{})).taskId,{kind:`shell`})}function XI(){return(0,K.jsx)(`span`,{className:`inline-flex items-center gap-[3px] align-middle`,"aria-hidden":`true`,children:[0,160,320].map(e=>(0,K.jsx)(`i`,{className:`block size-1 rounded-full bg-current motion-safe:animate-dot`,style:{animationDelay:`${e}ms`}},e))})}Pn();var ZI=`relative z-5 hidden h-[calc(60px+2*var(--hairline))] items-end px-0.5 py-1.5 touch:flex`,QI=`relative z-5 flex min-h-[calc(60px+2*var(--hairline))] items-end px-0.5 py-1.5`,$I=`basis-full px-1.5 pt-1.5 pb-1`,eL=`absolute inset-x-2.5 bottom-full z-6 mb-2.5`,tL=`relative flex min-w-0 flex-1 flex-wrap items-end gap-0.5 rounded-[14px] p-0.5 ${On()} focus-within:border-line-active transition-colors duration-150 has-[[data-recording]]:border-accent has-[[data-recording=on]]:bg-accent-soft has-[[data-recording=armed]]:bg-accent has-[[data-recording=on]]:text-accent has-[[data-recording=armed]]:text-paper has-[[data-recording]]:*:text-inherit`,nL=`flex min-h-11 min-w-0 flex-1 items-end has-[textarea:disabled]:opacity-60`,rL=`${Pi} min-w-0 flex-1 resize-none bg-transparent py-[11px] pr-2 pl-1 font-sans text-display leading-[22px] text-ink outline-none [border:0] placeholder:text-muted has-[+button]:pr-0`,iL=`transition-[scale,background-color,color] duration-150 active:scale-[0.98] motion-reduce:transition-none motion-reduce:active:scale-none`;function aL({label:e}){return(0,K.jsx)(`span`,{className:`pointer-events-none absolute -inset-px z-10 grid place-items-center rounded-[inherit] border-2 border-accent bg-[color-mix(in_srgb,var(--surface)_88%,transparent)] font-sans text-body text-accent motion-safe:animate-fade-in`,children:e})}var oL=`flex size-11 shrink-0 cursor-pointer items-center justify-center ${kn} touch-manipulation active:bg-[color-mix(in_srgb,var(--ink)_14%,transparent)] disabled:opacity-60 has-[:disabled]:opacity-60 ${jn}`,sL=e=>`flex size-11 shrink-0 items-center justify-center ${kn} touch-manipulation transition-[scale,background-color,color] duration-150 active:scale-95 motion-reduce:transition-none motion-reduce:active:scale-none ${e?`bg-accent text-paper`:`bg-hover text-muted`}`,cL=`size-4.5 narrow:size-5.5 flex-none fill-none stroke-current stroke-[1.5] [stroke-linecap:round] [stroke-linejoin:round]`,lL=(e=!1)=>`${oL} ${e?`text-accent`:`text-muted`}`,uL=e=>`${oL} ${e?`text-accent`:`text-muted`}`,dL=`relative z-6 flex h-11 min-w-0 flex-1 items-center gap-2.5 rounded-[12px] px-3.5 font-sans touch-manipulation disabled:text-muted ${iL}`,fL=(e,t)=>`${dL} ${t?`bg-accent text-paper`:e?`bg-accent-soft text-accent`:`bg-transparent text-muted`}`,pL=(e,t)=>`${dL} ${t?`text-paper`:e?`text-accent`:`text-muted`}`;function mL({d:e}){return(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,className:cL,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:e})})}var hL=`M8 1.5a2.5 2.5 0 0 1 2.5 2.5v4.5a2.5 2.5 0 0 1-5 0V4A2.5 2.5 0 0 1 8 1.5zM3 8a5 5 0 0 0 10 0M8 13v1.5`,gL=`M8 13V3M3.5 7.5 8 3l4.5 4.5`;function _L(){return(0,K.jsx)(mL,{d:`M10.5 4.5 5.8 9.2a1.4 1.4 0 0 0 2 2l5-5a2.8 2.8 0 0 0-4-4l-5.2 5.2a4.2 4.2 0 0 0 6 6L13 9`})}function vL(e){return(0,K.jsxs)(`button`,{type:`submit`,className:sL(!e.disabled),title:e.label,disabled:e.disabled,children:[(0,K.jsx)(`span`,{className:`sr-only`,children:e.label}),(0,K.jsx)(mL,{d:gL})]})}function yL(e,t){let n=(0,J.useRef)(e);e!==null&&(n.current=e);let r=e===null,[i,a]=(0,J.useState)(r);return(0,J.useEffect)(()=>{if(!r)return a(!1);let e=window.setTimeout(()=>a(!0),t);return()=>window.clearTimeout(e)},[r,t]),{shown:e??(i?null:n.current),leaving:r&&!i}}function bL(e){return typeof Intl.Segmenter==`function`?[...new Intl.Segmenter(void 0,{granularity:`word`}).segment(e)].map(e=>e.segment):e.split(/(\s+)/)}function xL({level:e,seconds:t,wide:n}){let r=n?120:80,i=(0,J.useRef)([]),a=(0,J.useRef)(-1);t!==a.current&&(a.current=t,i.current=[...i.current,e].slice(-r));let o=[...Array(r-i.current.length).fill(0),...i.current];return(0,K.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center justify-end overflow-hidden ${n?`h-10 gap-[3px]`:`h-5.5 gap-[2.5px]`}`,"aria-hidden":`true`,children:o.map((e,t)=>(0,K.jsx)(`i`,{className:`block h-full flex-none rounded-full bg-current transition-transform duration-100 ease-linear motion-reduce:transition-none ${n?`w-[3px]`:`w-[2.5px]`}`,style:{transform:`scaleY(${Math.max(n?.08:.12,Math.min(1,e*10))})`}},t))})}var SL=`pointer-events-none absolute inset-x-0 bottom-full z-6 mb-2.5 flex min-h-17 origin-bottom items-center rounded-[16px] border-hairline bg-surface px-4 py-3 text-left shadow-dialog transition-colors duration-150`;function CL({bubble:e,leaving:t}){return(0,K.jsx)(`span`,{className:`${SL} ${t?`motion-safe:animate-sink-out`:`motion-safe:animate-bubble-in`} ${e.armed?`border-accent`:`border-line`}`,children:e.text?(0,K.jsx)(`span`,{className:`flex max-h-[5.8em] min-w-0 flex-1 flex-col justify-end overflow-hidden font-sans text-display leading-[1.45] transition-colors duration-150 motion-safe:animate-fade-in ${e.waiting?`text-muted`:`text-ink`}`,children:(0,K.jsx)(`span`,{children:bL(e.text).map((e,t)=>(0,K.jsx)(`span`,{className:`motion-safe:animate-fade-in`,children:e},t))})},`words`):(0,K.jsx)(`span`,{className:`flex min-w-0 flex-1 text-accent`,children:(0,K.jsx)(xL,{level:e.level,seconds:e.seconds,wide:!0})},`wave`)})}var wL=`flex min-w-0 flex-1 items-center gap-2.5 motion-safe:animate-fade-in`;function TL(e){let{state:t}=e,n=t.phase===`recording`,r=t.phase===`transcribing`,i=e.slide!==void 0,a=n&&t.held,o=(0,J.useRef)(``);n&&(o.current=t.partial);let{shown:s,leaving:c}=yL(i&&(a||(n||r)&&o.current!==``)?{text:o.current,armed:a&&t.armed,waiting:!a,level:t.level,seconds:t.seconds}:null,140),l=s&&(0,K.jsx)(CL,{bubble:s,leaving:c}),u=(0,K.jsxs)(`span`,{className:`${wL} justify-center gap-2 text-body`,children:[e.working.replace(/…$/,``),(0,K.jsx)(XI,{})]},`working`);return r||n&&i&&!a?(0,K.jsxs)(K.Fragment,{children:[l,u]}):n?(0,K.jsxs)(K.Fragment,{children:[l,(0,K.jsxs)(`span`,{className:wL,children:[(0,K.jsx)(`span`,{className:`size-2 flex-none rounded-full bg-current`,style:{opacity:.3+Math.min(1,t.level*10)*.7}}),(0,K.jsx)(`span`,{className:`flex-none font-mono text-body normal-nums`,children:t.time}),i?(0,K.jsxs)(`span`,{className:`ml-auto flex flex-none items-center gap-1 text-body motion-safe:animate-fade-in ${t.armed?`font-semibold`:`opacity-80`}`,children:[(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`size-4 flex-none fill-none stroke-current stroke-[1.5]`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:gL})}),t.armed?e.release:e.slide]},String(t.armed)):t.partial?(0,K.jsx)(`span`,{className:`flex min-w-0 flex-1 justify-end overflow-hidden whitespace-nowrap text-meta`,children:t.partial}):(0,K.jsx)(xL,{level:t.level,seconds:t.seconds})]},`take`)]}):(0,K.jsxs)(K.Fragment,{children:[l,(0,K.jsxs)(`span`,{className:`${wL} justify-center gap-2 text-body`,children:[(0,K.jsx)(`span`,{className:`flex text-muted`,children:(0,K.jsx)(mL,{d:hL})}),e.idle]},`idle`)]})}function EL({state:e}){return e.phase===`recording`?(0,K.jsx)(`span`,{className:`font-mono text-meta normal-nums`,children:e.time}):e.phase===`transcribing`?(0,K.jsx)(`span`,{className:`font-mono text-meta`,children:`…`}):(0,K.jsx)(mL,{d:hL})}function DL(e){return e.hold?(0,K.jsx)(TL,{state:e.state,idle:e.idle,working:e.working}):(0,K.jsx)(EL,{state:e.state})}function OL(e){let t=Ii(e.value,e.fieldRef);return(0,K.jsx)(`form`,{className:e.inPackage?QI:ZI,"data-composer":e.composerKey,"data-tp-part":`composer`,onSubmit:t=>{t.preventDefault(),e.onSend()},children:(0,K.jsxs)(`div`,{className:tL,"data-tp-part":`composer-row`,...e.drop,children:[e.attached&&(0,K.jsx)(`div`,{className:e.inPackage?`${$I} empty:hidden`:$I,"data-tp-part":`composer-attachments`,children:e.attached}),e.suggest&&(0,K.jsx)(`div`,{className:eL,children:e.suggest}),e.dropHint&&(0,K.jsx)(aL,{label:e.dropHint}),e.attach,e.voice,e.voice&&(0,K.jsx)(`span`,{className:`size-11 shrink-0`,"aria-hidden":`true`}),!e.voice&&(0,K.jsxs)(`div`,{className:nL,"data-tp-part":`composer-field`,children:[(0,K.jsx)(`textarea`,{ref:t,className:rL,"data-tp-part":`composer-input`,rows:1,value:e.value,placeholder:e.placeholder,disabled:e.busy,enterKeyHint:`send`,onChange:e.onChange,onSelect:e.onSelect,onKeyDown:e.onKeyDown,onPaste:e.onPaste,onBlur:e.onBlur}),e.dictate]}),e.inPackage?.send]})})}function kL(e){let t=e?.firstElementChild;!e||!t||(delete e.dataset.tight,t.scrollWidth>t.clientWidth&&(e.dataset.tight=``))}function AL(){let e=(0,J.useRef)(null);return(0,J.useLayoutEffect)(()=>kL(e.current)),(0,J.useEffect)(()=>{let t=e.current;if(!t)return;let n=new ResizeObserver(()=>kL(t));return n.observe(t),document.fonts.ready.then(()=>kL(t)),()=>n.disconnect()},[]),e}var jL=`rove.voice.nativeCaptions.off.v2`,ML=null;function NL(e=1e3){return ML&&Promise.race([ML,new Promise(t=>setTimeout(t,e))])}function PL(e,t){let n=Reflect.get(globalThis,`SpeechRecognition`)??Reflect.get(globalThis,`webkitSpeechRecognition`);if(!n||localStorage.getItem(jL))return null;let r=new n;r.lang=navigator.language,r.continuous=!0,r.interimResults=!0;let i=!1,a=()=>{i||(i=!0,t())};r.onresult=t=>{let n=``;for(let e=0;e<t.results.length;e++)n+=t.results[e]?.[0]?.transcript??``;i||e(n.trim())};let o=()=>{},s=new Promise(e=>{o=()=>{ML===s&&(ML=null),e()}});ML=s,r.onerror=a,r.onend=()=>{o(),a()};try{r.start()}catch{return o(),null}return{stop(e=!1){i=!0,e&&localStorage.setItem(jL,`1`),r.abort()}}}wl(),_l(),A();var FL=`/dictation-worklet.js`,IL=60,LL=16e3,RL=.004,zL=3e4,BL={phase:`idle`,seconds:0,level:0,error:null,partial:``},VL=1e3,HL=5e3,UL=1500,WL=class{step;emitted=0;consumed=0;constructor(e){this.step=e}push(e){let t=e.reduce((e,t)=>e+t.length,0),n=new Float32Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;let i=this.consumed+t,a=[];for(let e=Math.floor(this.emitted*this.step);e<i;e=Math.floor(this.emitted*this.step)){let t=Math.max(-1,Math.min(1,n[e-this.consumed]??0));a.push(Math.round(t*32767)),this.emitted++}return this.consumed=i,Int16Array.from(a)}};function GL(e){let t=new Uint8Array(e.length*2),n=new DataView(t.buffer);for(let t=0;t<e.length;t++)n.setInt16(t*2,e[t],!0);return t}function KL(e,t){let n=new WL(t/LL).push(e),r=Math.max(1,n.length),i=new Uint8Array(44+r*2),a=new DataView(i.buffer),o=(e,t)=>{for(let n=0;n<t.length;n++)a.setUint8(e+n,t.charCodeAt(n))};return o(0,`RIFF`),a.setUint32(4,36+r*2,!0),o(8,`WAVEfmt `),a.setUint32(16,16,!0),a.setUint16(20,1,!0),a.setUint16(22,1,!0),a.setUint32(24,LL,!0),a.setUint32(28,LL*2,!0),a.setUint16(32,2,!0),a.setUint16(34,16,!0),o(36,`data`),a.setUint32(40,r*2,!0),i.set(GL(n),44),i}function qL(e){for(let t of e.getTracks())t.stop();return null}function JL(e){let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=e[n].toString(16).padStart(2,`0`);return t.join(``)}var YL=()=>`${Date.now().toString(36)}${Math.random().toString(36).slice(2,10)}`,XL=class{client;scope;view=O(BL);stream=null;context=null;node=null;chunks=[];timer=null;capTimer=null;peak=0;recent=0;session=0;live=null;liveTimer=null;captions=null;captioned=!1;nativeText=``;constructor(e,t){this.client=e,this.scope=t}get recording(){return this.view.get().phase===`recording`}async toggle(){return this.recording?this.stop():this.start()}async start(e=!1){if(this.view.get().phase!==`idle`&&this.view.get().phase!==`error`)return null;let t=++this.session;this.live=null,this.view.set({...BL,phase:`recording`});try{let n=NL();if(n&&(await n,t!==this.session))return null;let r=window.setTimeout(()=>{t===this.session&&(this.release(),this.fail(Error(`the microphone did not answer`)))},HL),i;try{i=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}})}finally{window.clearTimeout(r)}if(t!==this.session)return qL(i);this.stream=i;let a=new AudioContext;if(this.context=a,await a.audioWorklet.addModule(gl?await pl(FL):FL),t!==this.session)return null;let o=a.createMediaStreamSource(i);this.node=new AudioWorkletNode(a,`rove-capture`),this.chunks=[],this.peak=0,this.recent=0,this.node.port.onmessage=e=>{let t=e.data;this.chunks.push(t);let n=0;for(let e=0;e<t.length;e++)n+=t[e]*t[e];let r=Math.sqrt(n/Math.max(1,t.length));this.peak=Math.max(this.peak,r),this.recent=Math.max(this.recent,r)},o.connect(this.node);let s=a.createGain();s.gain.value=0,this.node.connect(s),s.connect(a.destination);let c=Date.now();return this.timer=window.setInterval(()=>{this.view.set({...this.view.get(),seconds:(Date.now()-c)/1e3,level:this.recent}),this.recent=0,this.captions&&this.captioned&&Date.now()-c>UL&&this.peak<RL&&(this.captions.stop(!0),this.captions=null)},100),this.capTimer=window.setTimeout(()=>void this.stop(),IL*1e3),e&&(this.live={id:YL(),resample:new WL(a.sampleRate/LL),sent:0,seq:0,inFlight:null,dead:!1},this.liveTimer=window.setInterval(()=>void this.pump(!1),VL),this.captioned=!1,this.nativeText=``,this.captions=PL(e=>{this.captioned=!0,this.nativeText=e;let t=this.view.get();t.phase===`recording`&&this.view.set({...t,partial:e})},()=>{this.captions=null})),null}catch(e){return t===this.session?(this.release(),this.fail(e),null):null}}async pump(e){let t=this.live;if(!t||t.dead||t.inFlight&&!e||(t.inFlight&&await t.inFlight.catch(()=>{}),t.dead))return null;let n=this.chunks.slice(t.sent);t.sent+=n.length;let r=t.seq++,i=r===0?this.scope():null,a=this.client.request(`voice.stream`,{session:t.id,seq:r,pcm:JL(GL(t.resample.push(n))),final:e,...i?{context:i.draft,taskId:i.taskId,tabId:i.tabId}:{}});t.inFlight=a;try{let n=await a;if(e)return n;let r=this.view.get(),i=this.captions!==null&&this.captioned;this.live===t&&!i&&r.phase===`recording`&&typeof n.partial==`string`&&this.view.set({...r,partial:n.partial})}catch{t.dead=!0}finally{t.inFlight===a&&(t.inFlight=null)}return null}async stop(e){if(this.view.get().phase!==`recording`)return null;let t=this.context?.sampleRate??LL,n=this.chunks,r=this.nativeText.trim();this.view.set({...this.view.get(),phase:`transcribing`,level:0}),this.release();let i=KL(n,t),a=(i.length-44)/2/LL;if(a<.3||this.peak<RL)return this.live=null,this.view.set(BL),r?{text:r,seconds:a,ms:0}:{text:``,seconds:a,ms:0,reason:`silent`};try{if(e&&await this.sendOnHost(i,await e()))return this.view.set(BL),{text:``,seconds:a,ms:0,sent:!0};let t=this.live?await this.pump(!0):null;this.live=null;let n=t??await this.transcribeWhole(i);return this.view.set(BL),n}catch(e){return this.live=null,this.fail(e),null}}async sendOnHost(e,t){let n=this.live;this.live=null,n?.inFlight&&await n.inFlight.catch(()=>{});let r={...t,context:this.scope().draft,session:n?.id??YL()},i=()=>({...r,wav:JL(e)}),a=n&&!n.dead?{...r,seq:n.seq,pcm:JL(GL(n.resample.push(this.chunks.slice(n.sent))))}:i();for(let e=0;;e++)try{return await this.client.request(`voice.send`,a),!0}catch(t){let n=t instanceof yl?t.code:void 0;if(n===`UNKNOWN_OP`)return!1;if(n===`NOT_CONNECTED`&&e<2&&await this.reconnected())continue;if(`wav`in a)throw t;a=i()}}async transcribeWhole(e){let t=this.scope(),n={wav:JL(e),context:t.draft,taskId:t.taskId,tabId:t.tabId};for(let e=0;;e++)try{return await this.client.request(`voice.transcribe`,n)}catch(t){if(e>=2||!(t instanceof yl&&t.code===`NOT_CONNECTED`)||!await this.reconnected())throw t}}reconnected(){return new Promise(e=>{let t=()=>{},n=window.setTimeout(()=>{t(),e(!1)},zL);t=this.client.onOpen(()=>{window.clearTimeout(n),queueMicrotask(()=>t()),e(!0)})})}fail(e){this.view.set({...BL,phase:`error`,error:e instanceof Error?e.message:String(e)})}cancel(){this.view.get().phase===`recording`&&(this.release(),this.live=null,this.view.set(BL))}release(){this.session++,this.timer!==null&&window.clearInterval(this.timer),this.capTimer!==null&&window.clearTimeout(this.capTimer),this.liveTimer!==null&&window.clearInterval(this.liveTimer),this.timer=null,this.capTimer=null,this.liveTimer=null,this.captions?.stop(),this.captions=null,this.node?.port.close(),this.node=null;for(let e of this.stream?.getTracks()??[])e.stop();this.stream=null,this.context?.close().catch(()=>{}),this.context=null}};G(),A(),H();var ZL=e=>`0:${String(Math.floor(e)).padStart(2,`0`)}`,QL=300,$L=48,eR=e=>{TD(e),navigator.vibrate?.(8)},tR=new WeakMap,nR=new WeakSet;function rR(e){let t=tR.get(e);return t||(t=O(null),tR.set(e,t)),t}var iR=()=>typeof navigator<`u`&&typeof navigator.mediaDevices?.getUserMedia==`function`;function aR(e,t){rR(e).set(t&&iR())}var oR=e=>e.available??(e.ready===!0||(e.model??null)!==null);function sR(e){let t=rR(e),n=k(t);return(0,J.useEffect)(()=>{nR.has(e)||(nR.add(e),e.onOpen(()=>{e.request(`voice.status`).then(e=>t.set(oR(e)&&iR()),()=>t.set(!1))}))},[e,t]),n}var cR=e=>lA()&&rR(e).get()!==!1;function lR(e){W();let t=(0,J.useRef)(e);t.current=e;let n=(0,J.useRef)(null);n.current===null&&(n.current=new XL(e.client,()=>t.current.context()));let r=k(n.current.view),i=sR(e.client),a=(0,J.useRef)(null),o=(0,J.useRef)(!1),[s,c]=(0,J.useState)(null);(0,J.useEffect)(()=>{r.error&&z(U(`voice.failed`,{error:r.error}),`error`)},[r.error]),(0,J.useEffect)(()=>()=>{a.current&&window.clearTimeout(a.current.timer),n.current?.cancel()},[]);let l=(e,n)=>{if(!e?.text)return;let{onSend:r,onText:i}=t.current;n&&r?r(e.text):i(e.text)},u=()=>void n.current?.toggle().then(e=>l(e,!1)),d=e=>{if(e.button!==0)return;e.currentTarget.setPointerCapture(e.pointerId);let t={y:e.clientY,timer:0,held:!1,armed:!1,started:null};(r.phase===`idle`||r.phase===`error`)&&(t.timer=window.setTimeout(()=>{t.held=!0,t.started=n.current?.start(!0)??null,c({armed:!1}),eR(`medium`)},QL)),a.current=t},f=e=>{let n=a.current;if(!n?.held||!t.current.onSend)return;let r=n.y-e.clientY>$L;r!==n.armed&&(n.armed=r,c({armed:r}),eR())},p=async()=>{let e=a.current;if(a.current=null,!e)return;if(window.clearTimeout(e.timer),o.current=e.held,!e.held)return t.current.onTap?void 0:u();eR(),c(null),await e.started;let r=await n.current?.stop(e.armed?void 0:t.current.handoff)??null;r?.sent?t.current.onHandedOff?.():l(r,!e.armed)},m=async()=>{let e=a.current;a.current=null,e&&(window.clearTimeout(e.timer),e.held&&(c(null),await e.started,n.current?.cancel()))},h=r.phase===`recording`?U(s?`voice.release`:`voice.stop`,{time:ZL(r.seconds)}):r.phase===`transcribing`?U(`voice.working`):e.idle??U(`voice.say`),g=r.phase===`recording`,_=s?.armed??!1;return i===!0?(0,K.jsx)(`button`,{type:`button`,className:`${(e.look??ate)(g,_)} ${ote}`,disabled:e.disabled||r.phase===`transcribing`,"data-recording":g?_?`armed`:`on`:void 0,title:r.error??U(`voice.hint`),"aria-label":e.face?h:void 0,onPointerDown:d,onPointerMove:f,onPointerUp:()=>void p(),onPointerCancel:()=>void m(),onContextMenu:e=>e.preventDefault(),onClick:t=>{let n=o.current;if(o.current=!1,e.onTap)return n?void 0:e.onTap();t.detail===0&&u()},children:e.face?e.face({phase:r.phase,time:ZL(r.seconds),seconds:r.seconds,level:r.level,held:s!==null,armed:_,partial:r.partial}):(0,K.jsxs)(K.Fragment,{children:[h,g&&(0,K.jsx)(`span`,{className:`inline-flex items-center`,"aria-hidden":`true`,children:(0,K.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`,style:{opacity:.25+Math.min(1,r.level*12)*.75}})})]})}):null}G(),He(),A(),H();function uR(e,t){e||t?re(e,void 0,t):dR()}function dR(){re(void 0,void 0,void 0,void 0,!0)}function fR({model:e,seed:t}){W();let n=k(e.selection).taskId,r=e.tasks.get()?.tasks.find(e=>e.id===n)?.repo,i=BI(e,t.engine),a=Hs(e,`repos.list`)?.repos,o=e=>t.ungrouped?void 0:(t.machine?void 0:t.repo)??r??e?.[0],[s,c]=(0,J.useState)(a??[]),[l,u]=(0,J.useState)(()=>Hs(e,`fs.subdirs`,{path:`~/`})?.home??``),[d,f]=(0,J.useState)(()=>vI(o(a),t)),[p,m]=(0,J.useState)(()=>Object.fromEntries(d.flatMap(t=>{let n=Hs(e,`repo.probe`,{path:t});return n?[[t,n]]:[]}))),h=(0,J.useRef)(new Set),[g,_]=(0,J.useState)(t.ungrouped===!0),[v,y]=(0,J.useState)(null),b=()=>{_(!0),f([]),y(null)},[x,S]=(0,J.useState)(()=>yI(o(a),t)),[C,w]=(0,J.useState)(``),[T,E]=(0,J.useState)(``),[D,O]=(0,J.useState)(()=>(t.prompt!==void 0&&IF(t.prompt),FF())),ee=e=>{IF(e),O(e)},[A,j]=(0,J.useState)(``),[M,N]=(0,J.useState)(!1),[P,F]=(0,J.useState)(``),[I,L]=(0,J.useState)(()=>t.worktree??localStorage.getItem(`rove.web.newSession.worktree`)!==`0`),R=e=>{localStorage.setItem(LF,e?`1`:`0`),L(e)},[te,ne]=(0,J.useState)(null),re=(0,J.useRef)(()=>{}),{attachments:ie,attach:ae,remove:oe,ready:se,clear:ce}=vk(e,ne,NF),le=(0,J.useRef)(null),ue=Ii(D,le),de=sR(e.client),B=lA()&&de===!0,fe=yF(e,{machine:t.machine,repo:t.repo},i),{machines:pe,machine:me,remote:V,machineName:he,remoteList:ge,engineThere:_e,shown:ve}=fe,{pick:ye,setPick:xe,base:Se,setBase:Ce}=fe,we=hI(ve,!V),Te=uk(e=>void ae(e)),H=V||we.on?null:Te,Ee=ve.engine;(0,J.useEffect)(()=>e.client.onOpen(()=>{Promise.all([Ws(e,`repos.list`),Ws(e,`fs.subdirs`,{path:`~/`})]).then(([e,n])=>{c(e.repos),u(n.home);let r=o(e.repos);f(e=>e.length>0||!r?e:vI(r,t)),S(e=>({...e,...yI(r,t)}))}).catch(()=>{})}),[e,t.repo]);let Oe=d.some(e=>p[e]?.git===!1),ke=!V&&(!I||Oe)&&d.length===1,Ae=V&&!_e?vP(ye,ge.repos):null,je=Ae!==null&&!I,Me=d[0]??``;(0,J.useEffect)(()=>{for(let t of d)h.current.has(t)||(h.current.add(t),Ws(e,`repo.probe`,{path:t}).then(e=>m(n=>({...n,[t]:e}))).catch(()=>{}))},[e,d]),(0,J.useEffect)(()=>{!cR(e.client)&&!t.pickProject&&le.current?.focus()},[e.client,t.pickProject]);let Ne=!V&&!g&&!ke&&!we.on,Pe=UF(we.choice,Ne),Fe=Pe.comparing?ve:we.choice,Ie=AL(),Le=i.engines.find(e=>e.id===Ee),Re=ve.engines.find(e=>e.id===Ee)?.name??Ee,ze=eP(Le,U(`newSession.modelDefault`)),Be=ze.some(e=>e.id===A)?A:``,Ve=async t=>{F(U(`newSession.cloning`,{source:t}));let n=await e.client.request(`repo.clone`,{url:t},F);return c(e=>e.includes(n.path)?e:[...e,n.path]),f([n.path]),y(null),n.path},He=async()=>{if(!ye)return ne(U(`newSession.needRepo`));if(!D.trim())return ne(U(`newSession.needPrompt`));let n=ve.missing?.has(Ee)&ℜif(n)return ne(U(`newSession.engineMissingOn`,{engine:n,machine:he}));N(!0),F(ye.clone?U(`newSession.cloningOn`,{source:gP(ye.ref),machine:he}):U(`newSession.startingOn`,{machine:he}));try{let n=await EF(e,{pick:ye,machine:me,engine:Ee,prompt:Ge.expand(D).trim(),baseRef:Se,...je?{checkout:Ae}:{},engineThere:_e,model:Be});IF(``),be.set(null),n&&e.selectWhenListed(n),t.retryOf&&n&&CI(e,t.retryOf)}catch(e){ne(OF(e))}finally{N(!1),F(``)}},Ue=async n=>{if(re.current=()=>void Ue(n),ne(null),V)return He();if(!Me&&!g&&!v)return ne(U(`newSession.needRepo`));if(!D.trim()&&!we.on)return ne(U(`newSession.needPrompt`));N(!0);let r=Ge.expand(D),i=pk(r.trim(),await se());try{let a=v?[await Ve(v)]:d,o=await Promise.all(a.map(t=>e.client.request(`repo.probe`,{path:t}))),s=o.find(e=>!e.ok);if(s)throw Error(s.reason??s.repo);let c=o.some(e=>e.git===!1);if(c&&o.length>1)throw Error(U(`newSession.plainMulti`));let l,u,f=e.client.request.bind(e.client),p=a.map((e,t)=>({repo:o[t]?.repo??e,baseRef:x[e]??``})),m=a.length===1&&!I||c?p[0]?.repo??``:null;if(we.on)l=await gI(f,g?null:m??{repos:p,branch:C.trim()},r);else if(g)l=await lP(f,Ee,i,Be);else if(m!==null)l=await uP(f,m,Ee,r,i,n,Be);else{let r=xI(t,Ee),o=fe.auto&&!n&&a.length===1&&Pe.ids.length<=1&&ie.length===0&&!r,s=await e.client.request(`task.spawn`,{...cP({repos:p,branch:C.trim(),engine:Ee,commandFrom:r,engines:n?[]:Pe.ids,prompt:i,...n?{at:n}:{},model:Be}),...o?{machine:dF}:{}});s.machine&&z(U(`newSession.startedOn`,{machine:s.machine})),l=s.taskIds[0],u=s.groupId}n&&z(U(`newSession.laterSet`,{time:$F(n)})),IF(``),ce(),be.set(null),u?De(u):l&&e.selectWhenListed(l),t.retryOf&&l&&CI(e,t.retryOf)}catch(e){let t=iP(e);t?(IF(``),ce(),be.set(null),z(e instanceof Error?e.message:String(e),`error`),De(t)):ne(OF(e))}finally{N(!1),F(``)}},We=FI({value:D,onChange:ee,area:le,onEnter:()=>void Ue()}),Ge=Hee({model:e,value:D,onChange:ee,area:le,field:We.field,onFilePaste:H?.onPaste}),Ke=e=>{fe.switchTo(e,Me),E(``),ne(null),_(!1)};return(0,K.jsxs)(`div`,{className:Kee,children:[(0,K.jsxs)(`div`,{className:qee,children:[(0,K.jsx)(cA,{scene:t.sky??`orbit`}),(0,K.jsx)(`h1`,{className:`m-0 font-sans text-title font-semibold text-accent`,children:U(`newSession.title`)}),(0,K.jsx)(`p`,{className:`m-0 text-muted narrow:hidden`,children:U(`newSession.tagline`)})]}),(0,K.jsxs)(`form`,{className:Jee,onSubmit:e=>{e.preventDefault(),Ue()},children:[(0,K.jsxs)(`div`,{className:Xee,...H?.drop,children:[H?.over&&(0,K.jsx)(aL,{label:U(`layout.composerDrop`)}),!V&&(0,K.jsx)(yk,{attachments:ie,onRemove:oe}),(0,K.jsxs)(`div`,{className:`relative`,children:[Ge.layer,(0,K.jsx)(`textarea`,{ref:ue,className:`${Qee} ${pA}`,rows:4,spellCheck:!1,placeholder:U(we.on?`newSession.shellPlaceholder`:`newSession.placeholder`),value:D,disabled:M,...Ge.field})]}),We.list,(0,K.jsxs)(`div`,{className:Zee,children:[H&&(0,K.jsxs)(dk,{className:(B?lL:NA)(ie.length>0),title:U(`newSession.attachHint`),disabled:M,onFiles:ae,children:[(0,K.jsx)(`span`,{className:`sr-only`,children:U(`newSession.attach`)}),(0,K.jsx)(_L,{})]}),(0,K.jsx)(lR,{client:e.client,context:()=>({draft:[D.slice(-300),Me,C,ye?.ref??``].filter(Boolean).join(`
|
|
197
|
+
`)}),onText:e=>Ge.insert(e,!B),disabled:M,look:B?fL:NA,idle:B?U(`voice.hold`):void 0,face:e=>(0,K.jsx)(DL,{state:e,hold:B,idle:U(`voice.hold`),working:U(`voice.working`)})}),!B&&(0,K.jsx)(`span`,{className:`flex-1`}),B&&(0,K.jsx)(vL,{label:U(`newSession.start`),disabled:M||!(D.trim()||we.on)}),!B&&(0,K.jsx)(`button`,{type:`submit`,className:vi(),disabled:M,children:U(`newSession.start`)})]})]}),(0,K.jsxs)(`div`,{ref:Ie,className:$ee,children:[(0,K.jsxs)(`div`,{className:nte,children:[pe.length>0&&(0,K.jsx)(CF,{machines:pe,value:fe.auto?`auto`:me,onPick:Ke}),(0,K.jsx)(dP,{field:`repo`,yields:!0,startOpen:t.pickProject,title:!V&&d.length>1?U(`newSession.repoCount`,{count:d.length}):U(`newSession.repo`),label:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(mte,{}),(0,K.jsx)(`span`,{className:ute,children:(V?ye?.clone?gP(ye.ref):aP(ye?[ye.ref]:[]):v?gP(v):aP(d))||U(`newSession.chooseFolder`)})]}),children:t=>(0,K.jsx)(pI,{model:e,saved:V?ge.repos.map(_P):s,picked:V?ye?[ye.ref]:[]:d,primary:V?``:Me,home:V?``:l,query:T,onQuery:E,onToggle:(e,n)=>{if(ne(null),!V)return _(!1),y(null),n?f(t=>oP(t,e)):(f([e]),t());xe({ref:e,clone:!1}),t()},onClone:e=>{if(ne(null),V)return xe({ref:e,clone:!0});y(e),f([]),_(!1),E(``)},cloning:V?void 0:v??void 0,close:t,remote:V?{name:he,empty:xF(me,ge),blocked:ge.problem!==``}:void 0,ungrouped:V?void 0:{on:g,pick:b}})}),(0,K.jsx)(AF,{remote:V,remotePick:ye,remoteBase:Se,onRemoteBase:Ce,remoteWorktree:Ae===null?`required`:je?`off`:`on`,ungrouped:g,inPlace:ke,plain:Oe,onToggleWorktree:()=>R(!I),repos:d,probes:p,bases:x,onBase:(e,t)=>S(n=>({...n,[e]:t})),branchName:C,onBranchName:w})]}),(0,K.jsxs)(`div`,{className:rte,children:[(0,K.jsx)(WF,{choice:Fe,picks:Pe,available:Ne,missing:ve.missing}),!(V&&_e)&&!Pe.comparing&&!we.on&&ze.length>0&&(0,K.jsx)(GF,{models:ze,model:Be,onModel:j}),(0,K.jsx)(nI,{busy:M,onLater:!V&&!g&&!Pe.comparing&&!we.on?e=>void Ue(e):void 0,onInvalid:ne,agentPlace:V?{machine:he,there:_e,onPick:fe.setEngineThere}:void 0})]})]}),(0,K.jsx)(DF,{progress:M?P:``,error:te,busy:M,onRetry:()=>re.current()})]})]})}G(),H();function pR({state:e}){let[t,n]=(0,J.useState)(null);(0,J.useEffect)(()=>{n(null);let t=e.target;return t?.setAttribute(`data-menu-open`,``),()=>t?.removeAttribute(`data-menu-open`)},[e]);let r=t?.children??e.items;return(0,K.jsx)(gO,{label:t?.label??(e.target?.textContent?.trim()||U(`menu.more`)),onClose:()=>de.set(null),children:e=>{let i=t=>{if(t.children)return n(t);e(),t.run?.()};return(0,K.jsxs)(`div`,{className:lO,role:`menu`,children:[t&&(0,K.jsxs)(_O,{tone:`muted`,onClick:()=>n(null),children:[(0,K.jsx)(tI,{className:`rotate-90`}),(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:t.label})]}),r.map((e,n)=>(0,K.jsxs)(J.Fragment,{children:[(t?n===0:n>0&&e.section!==r[n-1]?.section)&&(0,K.jsx)(`hr`,{className:`mx-2 my-1 h-px flex-none border-none bg-line`}),(0,K.jsxs)(_O,{tone:e.danger?`danger`:`ink`,role:e.checked===void 0?`menuitem`:`menuitemradio`,"aria-checked":e.checked,"aria-haspopup":e.children?`menu`:void 0,onClick:()=>i(e),children:[(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),e.children?(0,K.jsx)(tI,{right:!0,className:`ml-auto text-subtle`}):e.checked&&(0,K.jsx)(vO,{})]})]},e.label)),(0,K.jsx)(`hr`,{className:pO}),(0,K.jsx)(_O,{tone:`cancel`,onClick:e,children:U(`menu.cancel`)})]})}})}He(),A(),H();var mR=120;function hR(e,t,n,r=e-t){return e+t+8<=n?e:Math.max(8,Math.min(r,n-t-8))}function gR(e){let{item:t}=e;return(0,K.jsxs)(`button`,{ref:e.rowRef,type:`button`,role:t.checked===void 0?`menuitem`:`menuitemradio`,"aria-checked":t.checked,"aria-haspopup":t.children?`menu`:void 0,"aria-expanded":t.children?!!e.open:void 0,className:Zi({selected:e.selected,open:e.open,danger:t.danger}),onMouseEnter:e.onEnter,onMouseLeave:e.onLeave,onClick:e.onPick,children:[(0,K.jsx)(`span`,{children:t.label}),t.children?(0,K.jsx)(tI,{right:!0,className:ea(!!(e.selected||e.open))}):t.checked?(0,K.jsx)(`span`,{className:ta,"aria-hidden":!0,children:`✓`}):t.key&&(0,K.jsx)(`span`,{className:$i({selected:e.selected,danger:t.danger}),children:t.key})]})}function _R(){let e=k(de),[t,n]=(0,J.useState)(0),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(-1),[s,c]=(0,J.useState)(!1),l=(0,J.useRef)(null),u=(0,J.useRef)(null),d=(0,J.useRef)([]),f=(0,J.useRef)(void 0),[p,m]=(0,J.useState)({x:0,y:0}),[h,g]=(0,J.useState)({x:0,y:0});if((0,J.useLayoutEffect)(()=>{if(!e||!l.current)return;n(e.start??(e.fromKeyboard?0:-1)),i(null),c(!1);let{width:t,height:r}=l.current.getBoundingClientRect(),a=e.right===void 0?e.x:Math.max(e.right-l.current.offsetWidth,0);m({x:hR(a,t,window.innerWidth),y:hR(e.y,r,window.innerHeight)});let o=e.target;return o?.setAttribute(`data-menu-open`,``),()=>o?.removeAttribute(`data-menu-open`)},[e]),(0,J.useLayoutEffect)(()=>{let e=r===null?null:d.current[r];if(!e||!l.current||!u.current)return;let t=l.current.getBoundingClientRect(),n=e.getBoundingClientRect(),{width:i,height:a}=u.current.getBoundingClientRect();g({x:hR(t.right+2,i,window.innerWidth,t.left-i-2),y:hR(n.top-5,a,window.innerHeight,n.bottom+5-a)})},[r]),(0,J.useEffect)(()=>()=>window.clearTimeout(f.current),[]),(0,J.useEffect)(()=>{if(!e)return;let d=e.items,f=r===null?[]:d[r]?.children??[],p=()=>de.set(null),m=e=>{e?.run&&(p(),e.run())},h=(e,t,n)=>e(e=>n===1?e>=t?0:e+1:e<=0?t:e-1),g=e=>{let l=e.key;if(s&&r!==null){let t=f.length-1;if(l===`Escape`||l===`ArrowLeft`||l===`h`)i(null),c(!1);else if(l===`ArrowDown`||l===`j`)h(o,t,1);else if(l===`ArrowUp`||l===`k`)h(o,t,-1);else if(l===`Home`)o(0);else if(l===`End`)o(t);else if(l===`Enter`)m(f[a]);else return;e.preventDefault(),e.stopPropagation();return}let u=d.length-1,g=d[t],_=()=>{i(t),c(!0),o(0)};if(l===`Escape`)p();else if(l===`ArrowDown`||l===`j`)h(n,u,1);else if(l===`ArrowUp`||l===`k`)h(n,u,-1);else if(l===`Home`)n(0);else if(l===`End`)n(u);else if((l===`ArrowRight`||l===`l`)&&g?.children)_();else if(l===`Enter`)g?.children?_():m(g);else return;e.preventDefault(),e.stopPropagation()},_=e=>{e.target instanceof Node&&(l.current?.contains(e.target)||u.current?.contains(e.target))||p()};return window.addEventListener(`keydown`,g,!0),window.addEventListener(`mousedown`,_),()=>{window.removeEventListener(`keydown`,g,!0),window.removeEventListener(`mousedown`,_)}},[e,t,r,a,s]),!e)return null;let _=r===null?null:e.items[r]?.children,v=e=>{e.run&&(de.set(null),e.run())},y=e=>{window.clearTimeout(f.current),i(e),c(!1),o(-1)};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{ref:l,className:Xi(),role:`menu`,style:{left:p.x,top:p.y,minWidth:e.minWidth},children:e.items.map((a,o)=>(0,K.jsxs)(J.Fragment,{children:[o>0&&a.section!==e.items[o-1]?.section&&(0,K.jsx)(`hr`,{className:`-mx-1 my-1 h-px flex-none border-none bg-line`}),(0,K.jsx)(gR,{item:a,rowRef:e=>{d.current[o]=e},selected:o===t,open:o===r,onEnter:()=>{n(o),window.clearTimeout(f.current),a.children?f.current=window.setTimeout(()=>y(o),mR):i(null)},onLeave:()=>{window.clearTimeout(f.current),o!==r&&n(-1)},onPick:()=>a.children?y(o):v(a)})]},a.label))}),_&&(0,K.jsx)(`div`,{ref:u,className:Xi(!0),role:`menu`,style:{left:h.x,top:h.y},children:_.map((e,t)=>(0,K.jsx)(gR,{item:e,selected:t===a,onEnter:()=>{o(t),c(!0)},onLeave:()=>o(-1),onPick:()=>v(e)},e.label))})]})}function vR(){let e=k(B),t=k(pe),n=k(de),r=ke();return(0,K.jsxs)(K.Fragment,{children:[r&&n?(0,K.jsx)(pR,{state:n}):(0,K.jsx)(_R,{}),e,(0,K.jsx)(`div`,{className:na,"aria-live":`polite`,children:t.map(e=>{let t=`${oa(e.tone===`error`)} ${e.leaving?`is-leaving`:``}`,n=e.action;return n?(0,K.jsxs)(`div`,{className:`${t} ${ra}`,children:[(0,K.jsx)(`span`,{className:ia,children:e.text}),(0,K.jsx)(q,{className:aa,onClick:()=>{se(e.id),n.run()},children:`[ ${n.label} ]`})]},e.id):(0,K.jsx)(`button`,{type:`button`,className:t,onClick:()=>se(e.id),children:e.text},e.id)})})]})}function yR(e,t){return e.filter(e=>e.groupId===t).sort((e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``)||e.title.localeCompare(t.title))}var bR=400;function xR(e){let t=null;for(let n of e.history?.messages??[]){if(n.role!==`assistant`)continue;let e=(n.blocks??[]).flatMap(e=>e.type===`text`&&e.text?[e.text]:[]).join(`
|
|
198
|
+
`).trim(),r=n.timestamp??``;e&&(!t||r>t.at)&&(t={at:r,text:e})}let n=(e.terminal?.tail??[]).map(e=>e.trimEnd()).filter(e=>e.trim()!==``),r=t?.text??n.slice(-6).join(`
|
|
199
|
+
`);return r?r.length>bR?`${r.slice(0,bR).trimEnd()}…`:r:null}function SR(e){let t=e.files.filter(e=>e.scope===`working`),n=t.length>0?`working`:`branch`,r=n===`working`?t:e.files.filter(e=>e.scope===`branch`);return{scope:n,files:r,added:r.reduce((e,t)=>e+(t.added??0),0),deleted:r.reduce((e,t)=>e+(t.deleted??0),0)}}var CR=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/;function wR(e,t=null,n=!1){let r=[],i=0,a=0,o=t,s=!1;for(let t of e.replace(/\n$/,``).split(`
|
|
200
|
+
`)){if(t.startsWith(`diff --git `)){let e=/ b\/(.+)$/.exec(t);o=e?e[1]:o,s=!1,r.push({kind:`file`,text:o??t,oldNo:null,newNo:null,path:o});continue}let e=CR.exec(t);if(e){i=Number(e[1]),a=Number(e[2]),s=!0,r.push({kind:`hunk`,text:t,oldNo:null,newNo:null,path:o});continue}if(!s){r.push({kind:`meta`,text:t,oldNo:null,newNo:null,path:o});continue}t.startsWith(`+`)?r.push({kind:`add`,text:t.slice(1),oldNo:null,newNo:a++,path:o}):t.startsWith(`-`)?r.push({kind:`del`,text:t.slice(1),oldNo:i++,newNo:null,path:o,...n?{foreignOld:!0}:{}}):t.startsWith(`\\`)?r.push({kind:`meta`,text:t,oldNo:null,newNo:null,path:o}):r.push({kind:`ctx`,text:t.slice(1),oldNo:i++,newNo:a++,path:o})}return r}function TR(e,t){return e.replace(/\n$/,``).split(`
|
|
201
|
+
`).map((e,n)=>({kind:`ctx`,text:e,oldNo:null,newNo:n+1,path:t}))}function ER(e){return e.kind===`del`?e.foreignOld?null:e.oldNo:e.kind===`add`||e.kind===`ctx`?e.newNo:null}function DR(e){let t=e.startLine?`lines ${e.startLine}-${e.line}`:`line ${e.line}`;return`@${e.path} (${t}) `}function OR(e,t,n){let r=e[t],i=r?ER(r):null;if(!r?.path||i===null)return null;if(n===null||n===t)return{path:r.path,line:i};let a=e[Math.min(n,t)],o=e[Math.max(n,t)],s=a?ER(a):null,c=o?ER(o):null;return s===null||c===null||a?.path!==o?.path?{path:r.path,line:i}:s===c?{path:r.path,line:c}:{path:r.path,startLine:Math.min(s,c),line:Math.max(s,c)}}function kR(e,t,n){let r=OR(e,t,n);if(!r)return null;let i=r.startLine!==void 0&&n!==null;return{...r,first:i?Math.min(n,t):t,last:i?Math.max(n,t):t}}function AR(e,t){let n=[],r=!1;return e.forEach((e,i)=>{e.kind===`file`&&(r=e.path!==null&&t.has(e.path)),(!r||e.kind===`file`)&&n.push(i)}),n}function jR(e){let t=new Map,n=-1;return e.forEach((e,r)=>{if(e.kind===`file`){n=r,t.set(r,{added:0,removed:0});return}let i=t.get(n);i&&(e.kind===`add`?i.added++:e.kind===`del`&&i.removed++)}),t}G();var MR=[`source`,`tests`,`config`,`docs`,`generated`],NR=/(^|\/)(bun\.lockb?|package-lock\.json|yarn\.lock|pnpm-lock\.yaml|Cargo\.lock|poetry\.lock|uv\.lock|Gemfile\.lock|go\.sum|composer\.lock)$/,PR=/(^|\/)(dist|build|generated|__generated__|\.next)\/|\.min\.(js|css)$|\.snap$|\.generated\.|\.pb\.go$|\.map$/,FR=/(^|\/)(tests?|__tests__|spec|e2e)\/|\.(test|spec)\.[cm]?[jt]sx?$|_test\.(go|py)$|(^|\/)test_[^/]+\.py$/,IR=/\.(md|mdx|rst|txt)$|(^|\/)docs\//i,LR=/(^|\/)(\.[\w.-]+rc(\.\w+)?|[\w.-]*\.config\.[cm]?[jt]s|tsconfig[\w.-]*\.json|package\.json|biome\.json|Dockerfile|Makefile)$|\.(ya?ml|toml|ini|env)$|(^|\/)\.(github|changeset|vscode)\//,RR=e=>NR.test(e);function zR(e){return NR.test(e)||PR.test(e)?`generated`:FR.test(e)?`tests`:IR.test(e)?`docs`:LR.test(e)?`config`:`source`}var BR=e=>zR(e)===`generated`;function VR(e){let t=e.filter(e=>zR(e.path)!==`generated`),n=t.reduce((e,t)=>e+t.lines,0);return t.length===0?1:((e,t)=>e<=2&&t<=30?1:e<=5&&t<=150?2:e<=10&&t<=400?3:e<=20&&t<=1e3?4:5)(t.length,n)}function HR(e){let t=[],n=(e,n)=>n>0&&t.push({group:e,count:n});for(let t of MR)t===`generated`?(n(`lockfile`,e.filter(RR).length),n(`generated`,e.filter(e=>zR(e)===`generated`&&!RR(e)).length)):n(t,e.filter(e=>zR(e)===t).length);return t}function UR(e){let t=[];for(let n of e)(n.kind===`file`||t.length===0)&&t.push([]),t[t.length-1]?.push(n);let n=e=>MR.indexOf(zR(e[0]?.path??``));return t.map((e,t)=>({file:e,i:t})).sort((e,t)=>n(e.file)-n(t.file)||e.i-t.i).flatMap(({file:e})=>e)}function WR(e){return HR(e.map(e=>e.path)).map(({group:e,count:t})=>({key:e===`lockfile`?t===1?`lockfile`:`lockfiles`:e,count:t}))}function GR(e,t){let n=[...e.entries()].flatMap(([e,n])=>{let r=t[e]?.path;return r?[{path:r,lines:n.added+n.removed}]:[]});return n.length<2?``:[U(`review.shape.effort`,{n:VR(n)}),...WR(n).map(e=>U(`review.shape.${e.key}`,{count:e.count}))].join(` · `)}wl(),G();function KR(e,t,n){if(!e||typeof e!=`object`||!(`kind`in e))return{kind:`text`,text:U(`preview.unknown`)};let r=`text`in e&&typeof e.text==`string`?e.text:``;switch(e.kind){case`diff`:{let e=wR(r,t===`.`?null:t,n);return{kind:`rows`,rows:t===`.`?UR(e):e,diff:!0}}case`code`:return{kind:`rows`,rows:TR(r,t),diff:!1};case`binary`:return{kind:`text`,text:U(`preview.binary`)};case`empty`:return{kind:`text`,text:U(`preview.empty`)};case`error`:return{kind:`text`,text:`message`in e?String(e.message):U(`preview.unknown`),error:!0};default:return{kind:`text`,text:U(`preview.noHunks`,{kind:String(e.kind)})}}}function qR(e){return e instanceof yl&&e.code===`UNKNOWN_OP`?Error(U(`review.notSupported`)):e instanceof Error?e:Error(String(e))}function JR(e,t){let n=e.tasks.get()?.tasks.find(e=>e.id===t);return n?.workspace?`${n.machine?.id??``}:${n.workspace}`:t}function YR({tone:e,children:t}){return(0,K.jsx)(`span`,{className:Tn(`flex-none font-mono text-meta`,e&&EO[e]),children:t})}var XR=`mt-4 grid grid-cols-[repeat(auto-fit,minmax(min(100%,24rem),1fr))] items-stretch gap-3`,ZR=e=>`flex min-w-0 flex-col gap-2 rounded-md border-hairline bg-inset px-3 pt-2.5 pb-3 ${e?`border-accent`:`border-transparent`}`,QR=`flex min-w-0 items-center gap-2`,$R=`min-w-0 truncate font-bold`,ez=`truncate font-mono text-meta text-muted`,tz=`m-0 line-clamp-4 whitespace-pre-wrap wrap-anywhere`,nz=`m-0 flex gap-2 font-mono text-meta text-muted`,rz=`group/preview @container/preview -mx-3 max-h-[min(60vh,40rem)] min-h-0 overflow-x-hidden overflow-y-auto bg-paper py-1.5 font-mono text-meta/normal [&>:first-child]:mt-0 [&>:first-child]:border-t-0`,iz=`group w-full text-left`,az=`min-w-0 truncate group-hover:underline`,oz=`mt-auto flex min-h-7.5 flex-wrap items-center gap-x-3.5 gap-y-1 pt-1 font-mono text-meta`,sz=`flex min-w-0 flex-wrap items-center gap-x-3.5 gap-y-0.5 px-2.5 py-1 font-mono text-meta`,cz={add:`bg-diff-added-bg`,del:`bg-diff-removed-bg`},lz={add:`text-diff-added`,del:`text-diff-removed`};function uz(e,t){let n=t.cursor?`bg-inset group-focus/preview:bg-accent-soft`:t.noted?`bg-inset`:cz[e]??``;return`relative grid ${e===`file`||e===`note`?`cursor-pointer`:`cursor-default`} grid-cols-[4ch_4ch_2ch_minmax(0,1fr)] gap-x-2 gap-y-0 whitespace-pre px-3 group-data-file/preview:grid-cols-[4ch_1ch_minmax(0,1fr)] @max-md/preview:grid-cols-[3ch_3ch_1ch_minmax(0,1fr)] @max-md/preview:gap-x-1 @max-md/preview:px-1.5 @max-md/preview:group-data-file/preview:grid-cols-[3ch_1ch_minmax(0,1fr)] ${n} ${e===`file`?`mt-2 border-t-hairline border-line pt-1 font-bold text-ink`:e===`hunk`||e===`meta`?`text-subtle`:``}`}var dz=`text-right text-subtle`,fz=`${dz} group-data-file/preview:hidden`,pz=(e,t,n=!1)=>t?`text-accent`:n?`text-diff-added`:lz[e]??``,mz=e=>`min-w-0 whitespace-pre-wrap wrap-anywhere ${lz[e]??``}`,_te=`min-w-0 whitespace-pre-wrap wrap-anywhere text-accent`,hz=`col-span-3 flex min-w-0 items-baseline gap-2 overflow-hidden`;G();var gz=400;function vte(e){let{model:t,taskId:n,scope:r}=e,i={taskId:n,path:`.`,scope:r},[a,o]=(0,J.useState)(()=>{let e=Hs(t,`diff.file`,i);return e===void 0?null:KR(e,`.`,!1)});(0,J.useEffect)(()=>{let e=!0;return Ws(t,`diff.file`,{taskId:n,path:`.`,scope:r}).then(t=>e&&o(KR(t,`.`,!1)),t=>e&&o({kind:`text`,text:t instanceof Error?t.message:String(t),error:!0})),()=>{e=!1}},[t,n,r,e.refresh]);let s=(0,J.useMemo)(()=>a?.kind===`rows`?a.rows.filter(e=>e.kind!==`meta`):[],[a]),c=(0,J.useMemo)(()=>jR(s),[s]),l=s.length-gz;return(0,K.jsxs)(`div`,{className:rz,children:[!a&&(0,K.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle`,children:U(`preview.loading`)}),a?.kind===`text`&&(0,K.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle ${a.error?`text-error`:``}`,children:a.text}),s.slice(0,gz).map((t,n)=>t.kind===`file`?(0,K.jsx)(yte,{row:t,stat:c.get(n),onOpen:e.onOpen},n):(0,K.jsxs)(`div`,{className:uz(t.kind,{cursor:!1,noted:!1}),children:[(0,K.jsx)(`span`,{className:fz,children:t.oldNo??``}),(0,K.jsx)(`span`,{className:dz,children:t.newNo??``}),(0,K.jsx)(`span`,{className:pz(t.kind,!1),children:t.kind===`add`?`+`:t.kind===`del`?`−`:` `}),(0,K.jsx)(`span`,{className:mz(t.kind),children:t.text})]},n)),l>0&&(0,K.jsx)(q,{hit:`tight`,className:`mx-3 my-2 font-mono text-meta`,onClick:()=>e.onOpen(`.`),children:U(`compare.moreLines`,{count:l})})]})}function yte(e){let{row:t,stat:n}=e;return(0,K.jsxs)(q,{variant:`row`,title:t.text,className:`${uz(`file`,{cursor:!1,noted:!1})} ${iz}`,onClick:()=>e.onOpen(t.path??`.`),children:[(0,K.jsx)(`span`,{}),(0,K.jsxs)(`span`,{className:hz,children:[(0,K.jsx)(`span`,{className:az,children:t.text}),n?.added?(0,K.jsxs)(YR,{tone:`added`,children:[`+`,n.added]}):null,n?.removed?(0,K.jsxs)(YR,{tone:`removed`,children:[`−`,n.removed]}):null]})]})}wl(),G(),H();async function _z(e,t,n){let r=new Set(e.tasks.get()?.tasks.map(e=>e.id)),i=0;try{for(let a of t.filter(e=>r.has(e)))await e.act(`task.archive`,{taskId:a,archived:!0,...n?{force:!0}:{}}),i++}catch(e){if(i>0&&z(U(`compare.archived`,{count:i})),e instanceof yl&&e.code===`TASK_BUSY`)throw e;z(U(`compare.archiveFailed`,{error:Ra(e)}),`error`);return}z(U(`compare.archived`,{count:i}))}async function bte(e,t,n){try{for(let r of n)r.id!==t.id&&r.kept&&await e.act(`task.keep`,{taskId:r.id,kept:!1});await e.act(`task.keep`,{taskId:t.id,kept:!0})}catch(e){z(U(`compare.keepFailed`,{error:Ra(e)}),`error`);return}z(U(`compare.keptToast`,{title:t.label}));let r=n.filter(e=>e.id!==t.id).map(e=>e.id);r.length!==0&&B.set((0,K.jsx)(Ha,{title:U(`compare.archiveTitle`),body:U(`compare.archiveBody`,{count:r.length}),confirmLabel:U(`compare.archiveConfirm`),onConfirm:()=>_z(e,r,!1),escalate:{when:e=>e instanceof yl&&e.code===`TASK_BUSY`,label:U(`compare.archiveBusyConfirm`),title:U(`compare.archiveBusyTitle`),body:()=>U(`compare.archiveBusyBody`),run:()=>_z(e,r,!0)}}))}async function xte(e,t){try{await e.act(`task.keep`,{taskId:t.id,kept:!1}),z(U(`compare.unkeptToast`,{title:t.label}))}catch(e){z(U(`compare.keepFailed`,{error:Ra(e)}),`error`)}}A();var vz=e=>new Map((e?.engines??[]).flatMap(e=>e.icon?[[e.id,e.icon]]:[]));function yz(e){let[t,n]=(0,J.useState)(()=>vz(Hs(e,`engines.list`))),r=k(e.tasks)!==null;return(0,J.useEffect)(()=>{r&&Ws(e,`engines.list`).then(e=>n(vz(e))).catch(()=>{})},[e,r]),t}var Ste={title:`ROUTINES`,holdingDaemon:`keeping the daemon awake`,notHolding:`none active`,needAttention:`{count} of {total} need you ·`,paused:`paused`,newTitle:`New routine`,composerLegend:`enter create · tab fields · ←→ ↑↓ edit the focused field · esc cancel`,fieldName:`NAME`,fieldRepo:`REPO`,fieldTarget:`DELIVER TO`,fieldTargetTab:`EXISTING ENGINE TAB`,targetFresh:`New task on each run`,targetStanding:`Routine-owned standing task`,targetStandingNew:`Routine-owned standing task, new conversation each run`,targetExisting:`Existing conversation: {task} / {tab}. Never creates or revives a session.`,fieldPrompt:`PROMPT`,fieldTrigger:`TRIGGER`,triggerSchedule:`Schedule (cron)`,triggerEvent:`Event (automation)`,triggerHybrid:`Schedule + Event`,eventModeBadge:`event`,fieldSchedule:`SCHEDULE (FIVE-FIELD CRON)`,fieldEventKind:`EVENT SOURCE`,fieldEventFilter:`EVENT FILTER (OPTIONAL)`,eventKind:{ci_failed:`CI failed (PR poller / webhook)`,pr_review_requested:`PR review requested (PR poller / webhook)`,issue_opened:`Issue opened (GitHub webhook / emit)`,webhook:`Webhook (signed POST)`,local:`Local hook (rove api routine-emit)`},eventFilterPlaceholder:{ci_failed:`branch glob, e.g. main or release/* (blank = any)`,pr_review_requested:`branch glob, e.g. main (blank = any)`,issue_opened:`action, e.g. opened or * (blank = opened)`,webhook:`event or event.action, e.g. issues.opened (blank = any)`,local:`event name, e.g. deploy.finished (blank = any)`},detailEvents:`events: {events}`,detailWebhook:`webhook: {path}`,namePlaceholder:`weekday dependency audit`,promptPlaceholder:`Audit dependencies and summarize risky changes.`,noProject:`Ungrouped`,cronInvalid:`not a five-field cron`,cronField:{minute:`min`,hour:`hour`,dayOfMonth:`day`,month:`month`,dayOfWeek:`weekday`},schedule:{everyDay:`every day {at}`,weekdays:`weekdays {at}`,weekends:`weekends {at}`,onWeekday:`{weekday} {at}`,everyMinute:`every minute`,everyMinutes:`every {n}m`,everyHours:`every {n}h`,hourlyAt:`hourly at :{minute}`,atClock:`at {time}`,dow:{MON:`Mondays`,TUE:`Tuesdays`,WED:`Wednesdays`,THU:`Thursdays`,FRI:`Fridays`,SAT:`Saturdays`,SUN:`Sundays`}},when:{inMinutes:`in {n}m`,inHours:`in {n}h`,inDays:`in {n}d`,minutesAgo:`{n}m ago`,hoursAgo:`{n}h ago`,now:`now`,justNow:`just now`,dateTime:`{date}, {time}`},runStatus:{dispatched:`dispatched`,revived:`revived`,skipped_cancelled:`cancelled before delivery`,skipped_precheck:`skipped (precheck)`,skipped_blocked:`skipped (task can't use it)`,skipped_missed:`skipped (missed)`,skipped_unavailable:`skipped (unavailable)`,dispatch_failed:`dispatch failed`,ran:`ran`,script_failed:`script failed`},cronNever:`valid, but never fires`,missing:{target:`Choose an existing task.`,targetTab:`Enter an existing tab id, e.g. tab-2.`,name:`Give it a name.`,repo:`Pick a project.`,prompt:`Say what it should do.`,triggerMode:`Choose a trigger mode.`,schedule:`That schedule will not run.`,eventKind:`Pick an event source.`,eventFilter:`Check the event filter.`},empty:`No routines scheduled.`,loadFailed:`Could not read the routines: {message}`,emptyHint:`Press n to create one.`,precheck:`precheck: {command}`,engineDefault:`default engine`,engineChanged:`{name} now runs on {engine}.`,engineChangedNewSession:`{name} now runs on {engine}. Its next run starts a new session; the earlier one stays as a task.`,lastFailed:`last failed {when}: {reason}`,recentRuns:`RECENT RUNS`,precheckDetail:`WHY IT SKIPPED — precheck {exit} in {duration}ms`,precheckExited:`exited {code}`,precheckTimedOut:`timed out`,precheckStdout:`stdout`,precheckStderr:`stderr`,precheckNoOutput:`(no output)`,noRuns:`Not run yet.`,responses:`RESPONSES`,noResponses:"No run has reported back yet. Agents answer with `routine-respond`.",responseAwaiting:`awaiting response`,responseMissing:`no response`,noSelection:`A routine runs its prompt in a project on a schedule.`,running:`Running {name}…`,ranWith:`{name}: {status}`,latestRunNoTask:`The latest run created no task.`,runNow:`[ run now ]`,deleteTitle:`Delete routine?`,deleteBody:`{name} and its run history will be removed. Tasks it already created are untouched.`,deleteButton:`Delete`,createFailed:`Couldn't create the routine: {error}`,deleteFailed:`Couldn't delete "{name}": {error}`,enableFailed:`"{name}" stays paused: {error}`,disableFailed:`"{name}" stays enabled: {error}`,runFailed:`Couldn't run "{name}" now: {error}`},Cte={title:`例行任务`,holdingDaemon:`正在保持守护进程常驻`,notHolding:`无启用项`,needAttention:`{total} 个中有 {count} 个需要处理 ·`,paused:`已暂停`,newTitle:`新建例行任务`,composerLegend:`enter 创建 · tab 切字段 · ←→ ↑↓ 编辑当前字段 · esc 取消`,fieldName:`名称`,fieldTarget:`投递目标`,fieldTargetTab:`既有引擎标签页`,targetFresh:`每次新建任务`,targetStanding:`例行任务自有的常驻任务`,targetStandingNew:`例行任务自有的常驻任务,每次运行新开对话`,targetExisting:`既有会话:{task} / {tab}。不会创建或重启会话。`,fieldRepo:`仓库`,fieldPrompt:`提示词`,fieldTrigger:`触发方式`,triggerSchedule:`定时调度(Cron)`,triggerEvent:`事件驱动(自动化)`,triggerHybrid:`定时 + 事件`,eventModeBadge:`事件触发`,fieldSchedule:`调度(五段 cron)`,fieldEventKind:`事件源`,fieldEventFilter:`过滤条件(可选)`,eventKind:{ci_failed:`CI 失败(PR 轮询 / Webhook)`,pr_review_requested:`PR 请求评审(PR 轮询 / Webhook)`,issue_opened:`新 Issue 打开(GitHub Webhook / 本地触发)`,webhook:`通用 Webhook(签名 POST)`,local:`本地事件钩子(rove api routine-emit)`},eventFilterPlaceholder:{ci_failed:`分支过滤,如 main 或 release/*(留空匹配全部)`,pr_review_requested:`分支过滤,如 main(留空匹配全部)`,issue_opened:`动作过滤,如 opened 或 *(留空默认 opened)`,webhook:`事件或 event.action,如 issues.opened(留空匹配全部)`,local:`事件名,如 deploy.finished(留空匹配全部)`},detailEvents:`事件:{events}`,detailWebhook:`Webhook:{path}`,namePlaceholder:`工作日依赖审计`,promptPlaceholder:`审计依赖并总结有风险的变更。`,noProject:`未分组`,cronInvalid:`不是合法的五段 cron`,cronField:{minute:`分`,hour:`时`,dayOfMonth:`日`,month:`月`,dayOfWeek:`星期`},schedule:{everyDay:`每天{at}`,weekdays:`工作日{at}`,weekends:`周末{at}`,onWeekday:`{weekday}{at}`,everyMinute:`每分钟`,everyMinutes:`每 {n} 分钟`,everyHours:`每 {n} 小时`,hourlyAt:`每小时的 :{minute}`,atClock:`{time}`,dow:{MON:`每周一`,TUE:`每周二`,WED:`每周三`,THU:`每周四`,FRI:`每周五`,SAT:`每周六`,SUN:`每周日`}},when:{inMinutes:`{n} 分钟后`,inHours:`{n} 小时后`,inDays:`{n} 天后`,minutesAgo:`{n} 分钟前`,hoursAgo:`{n} 小时前`,now:`即将`,justNow:`刚刚`,dateTime:`{date} {time}`},runStatus:{dispatched:`已派发`,revived:`已重启会话`,skipped_cancelled:`交付前已取消`,skipped_precheck:`已跳过(预检)`,skipped_blocked:`已跳过(任务暂不能接收)`,skipped_missed:`已跳过(错过时间)`,skipped_unavailable:`已跳过(不可用)`,dispatch_failed:`派发失败`,ran:`已运行`,script_failed:`脚本失败`},cronNever:`语法合法,但永远不会触发`,missing:{target:`请选择既有任务。`,targetTab:`请输入既有标签页 ID,例如 tab-2。`,name:`起个名字。`,repo:`选一个项目。`,prompt:`说明它要做什么。`,triggerMode:`选择一种触发方式。`,schedule:`这个调度不会触发。`,eventKind:`选一个事件源。`,eventFilter:`检查事件过滤条件。`},empty:`还没有例行任务。`,loadFailed:`读不到例行任务:{message}`,emptyHint:`按 n 新建一条。`,precheck:`预检:{command}`,engineDefault:`默认引擎`,engineChanged:`{name} 已改用 {engine}。`,engineChangedNewSession:`{name} 已改用 {engine}。下次运行会新开会话,原来的会话保留为任务。`,lastFailed:`上次失败({when}):{reason}`,recentRuns:`最近执行`,precheckDetail:`为什么跳过 —— 预检{exit},耗时 {duration}ms`,precheckExited:`退出码 {code}`,precheckTimedOut:`超时`,precheckStdout:`标准输出`,precheckStderr:`标准错误`,precheckNoOutput:`(无输出)`,noRuns:`尚未执行。`,responses:`回报`,noResponses:"还没有执行回报。agent 用 `routine-respond` 回报。",responseAwaiting:`等待回报`,responseMissing:`未回报`,noSelection:`例行任务会按调度在某个项目里跑它的提示词。`,running:`正在运行 {name}…`,ranWith:`{name}:{status}`,latestRunNoTask:`最近一次执行没有创建任务。`,runNow:`[ 立即运行 ]`,deleteTitle:`删除这条例行任务?`,deleteBody:`将删除 {name} 及其执行记录。它已经创建的任务不受影响。`,deleteButton:`删除`,createFailed:`创建例行任务失败:{error}`,deleteFailed:`删除“{name}”失败:{error}`,enableFailed:`“{name}”仍处于暂停状态:{error}`,disableFailed:`“{name}”仍处于启用状态:{error}`,runFailed:`无法立即运行“{name}”:{error}`},wte={title:`Kanban`,hint:`tab project · ←↓↑→ card · enter detail · n new · d delete · r refresh · esc close`,loading:`Loading issues…`,noRepos:"No projects yet — add one with `rove add <path>`, or file a story with `rove api issue-create`.",empty:"No issues — agents file them via `rove api issue-create`.",readFailed:"Couldn't read this project's stories: {error}. Run `rove doctor`, then reopen Kanban.",readFailedToast:`Couldn't read stories for {repo}: {error}`,columnEmpty:`No cards`,column:{backlog:`Backlog`,inProgress:`In progress`,parked:`Parked`,done:`Done`},more:`+{count} more`,attention:`{count} need you`,turnComplete:`turn done`,menu:{setStatus:`status → {status}`},detail:{status:{open:`open`,doing:`doing`,hold:`hold`,done:`done`},statusLabel:`STATUS`,created:`created {date}`,linked:`linked to a session`,titleLabel:`TITLE`,description:`DESCRIPTION`,noDescription:`No description.`,attachHint:`paste a path / ctrl+v screenshot → inserts an image placeholder`,engine:`ENGINE`,workspace:`WORKSPACE`,placement:{worktree:`New worktree task — its own workspace`,project:`Project checkout — a new chattab, no worktree`},jumpLabel:`AFTER START`,jump:{stay:`Stay on the board`,follow:`Jump to the session`},startLegend:`enter/ctrl+enter start · tab fields · ←→ status/engine · ↑↓ workspace · esc save & close`,sessionLabel:`SESSION`,openAction:`Open the linked session ↵`,unlinkAction:`Unlink`,openLegend:`enter open the focused action · tab fields · ←→ status · unlink returns the card to Backlog · esc save & close`,eventsLabel:`EVENTS`,eventsLoading:`Loading events…`,eventsNone:`No engine events recorded yet.`,doneNote:`Done stories have nothing left to start — set the status back to reopen one · esc save & close`,startedBackground:`Started in background: {title}`,newStory:`NEW STORY`,createLegend:`ctrl+s save · enter/ctrl+enter save & start · tab fields · esc cancel`},confirmDelete:{title:`Delete story #{id}?`,body:`“{title}” will be removed from the tracker. A linked task, branch, or worktree is left untouched.`},deleteFailed:`Couldn't delete story #{id}: {error}`,createFailed:`Couldn't create the story: {error}`,updateFailed:`Couldn't save story #{id}: {error}`,statusFailed:`Story #{id} stays in its old column: {error}`,linkFailed:`Story #{id} isn't linked to its task: {error}`,unlinkFailed:`Story #{id} is still linked: {error}`},Tte={title:`看板`,hint:`tab 切项目 · ←↓↑→ 选卡片 · enter 详情 · n 新建 · d 删除 · r 刷新 · esc 关闭`,loading:`正在加载 issues…`,noRepos:"还没有项目——用 `rove add <路径>` 添加一个,或用 `rove api issue-create` 创建一个 story。",empty:"暂无 issue——agent 可通过 `rove api issue-create` 创建。",readFailed:"读取该项目的 story 失败:{error}。请运行 `rove doctor`,再重新打开看板。",readFailedToast:`读取 {repo} 的 story 失败:{error}`,columnEmpty:`暂无卡片`,column:{backlog:`待办`,inProgress:`进行中`,parked:`搁置`,done:`已完成`},more:`还有 {count} 条`,attention:`{count} 张等你处理`,turnComplete:`回合完成`,menu:{setStatus:`状态 → {status}`},detail:{status:{open:`待办`,doing:`进行中`,hold:`搁置`,done:`已完成`},statusLabel:`状态`,created:`创建于 {date}`,linked:`已关联会话`,titleLabel:`标题`,description:`描述`,noDescription:`暂无描述。`,attachHint:`粘贴路径 / ctrl+v 贴截图 → 插入图片占位行`,engine:`引擎`,workspace:`工作区`,placement:{worktree:`新建 worktree 任务——独立工作区`,project:`项目主目录——新开 chattab,不建 worktree`},jumpLabel:`启动后`,jump:{stay:`留在看板`,follow:`跳转到会话`},startLegend:`enter/ctrl+enter 启动 · tab 切字段 · ←→ 状态/引擎 · ↑↓ 工作区 · esc 保存关闭`,sessionLabel:`会话`,openAction:`打开关联会话 ↵`,unlinkAction:`解除关联`,openLegend:`enter 执行选中操作 · tab 切字段 · ←→ 状态 · 解除关联把卡片退回 Backlog · esc 保存关闭`,eventsLabel:`事件`,eventsLoading:`正在加载事件…`,eventsNone:`暂无引擎事件记录。`,doneNote:`已完成的 story 无需启动——改回状态即可重新打开 · esc 保存关闭`,startedBackground:`已在后台启动:{title}`,newStory:`新建 STORY`,createLegend:`ctrl+s 仅保存 · enter/ctrl+enter 保存并启动 · tab 切字段 · esc 取消`},confirmDelete:{title:`删除 story #{id}?`,body:`「{title}」将从 tracker 中移除。已关联的任务、分支、worktree 不受影响。`},deleteFailed:`删除 story #{id} 失败:{error}`,createFailed:`创建 story 失败:{error}`,updateFailed:`保存 story #{id} 失败:{error}`,statusFailed:`Story #{id} 仍留在原来的列:{error}`,linkFailed:`Story #{id} 未能关联到它的任务:{error}`,unlinkFailed:`Story #{id} 仍处于关联状态:{error}`},Ete={title:`ISSUES`,noRepo:`no project`,empty:`No open issues.`,assignedFilter:`assigned to me`,starting:`Starting work on #{number}…`,startedNoEngine:`Created {title}, but its engine did not start.`,linkedChip:`→ {title}`,openingLinked:`Opening {title}…`,startFailed:`Couldn't start work on #{number}: {error}`,errorHint:{noRemote:"Add a GitHub remote (`git remote add origin <url>`) and try again, or press q / esc to close.",ghMissing:"Install the `gh` CLI and authenticate, or press q / esc to close.",auth:"Run `gh auth login`, or press q / esc to close.",fallback:`{message} · press q / esc to close`}},Dte={title:`议题`,noRepo:`无项目`,empty:`没有开放的议题。`,assignedFilter:`分配给我的`,starting:`正在开始处理 #{number}…`,startedNoEngine:`已创建 {title},但引擎没有启动。`,linkedChip:`→ {title}`,openingLinked:`正在打开 {title}…`,startFailed:`开始处理 #{number} 失败:{error}`,errorHint:{noRemote:"添加 GitHub remote(`git remote add origin <url>`)后重试,或按 q / esc 关闭。",ghMissing:"安装 `gh` CLI 并登录,或按 q / esc 关闭。",auth:"执行 `gh auth login`,或按 q / esc 关闭。",fallback:`{message} · 按 q / esc 关闭`}};G(),A(),H();function bz(){let e=W()===`zh`;return{kanban:e?Tte:wte,auto:e?Cte:Ste,items:e?Dte:Ete,nav:(e?fo:uo).nav,group:(e?fo:uo).group,common:e?qa:Ka}}function xz(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e))}function Sz(){let{auto:e}=bz();return(t,n)=>{let r=e;for(let e of t.replace(/^automations\./,``).split(`.`))r=r&&typeof r==`object`?Reflect.get(r,e):void 0;return typeof r==`string`?n?xz(r,n):r:t}}function Cz(e){return e instanceof Error?e.message:String(e)}function wz(e){return e.replace(/^\/private\//,`/`).replace(/\/+$/,``)}function Tz(e,t){let n=qo(e),r=n[n.length-1]??e;return t.some(t=>t!==e&&qo(t).pop()===r)&&n.length>1?`${n[n.length-2]}/${r}`:r}function Ez(...e){let t=new Set,n=[];for(let r of e.flat()){if(!r||r.startsWith(`ssh://`))continue;let e=wz(r);t.has(e)||(t.add(e),n.push(r))}return n}function Dz(e){return Ez((k(e.tasks)?.tasks??[]).filter(e=>!ms(e)).map(e=>e.repo))}function Oz(e){let t=k(e.tasks),{taskId:n}=k(e.selection);return t?.tasks.find(e=>e.id===n)?.repo}function kz(e){let[t,n]=(0,J.useState)(0);return(0,J.useEffect)(()=>Ga(e,()=>n(e=>e+1)),[e]),[t,(0,J.useCallback)(()=>n(e=>e+1),[])]}function Ote(e){return e instanceof HTMLElement?e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName):!1}function Az(e){let t=(0,J.useRef)(e);t.current=e,(0,J.useEffect)(()=>{let e=e=>{if(e.defaultPrevented||B.get()||de.get())return;let n=e.target instanceof HTMLElement?e.target:null;Ote(n)||n?.closest(`.rail, .side-panel, .xterm`)||e.metaKey||e.altKey||e.ctrlKey&&e.key.toLowerCase()===`c`&&window.getSelection()?.toString()||t.current(e)&&(e.preventDefault(),e.stopPropagation())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}function jz(){let e=(0,J.useRef)(null);return(0,J.useEffect)(()=>e.current?.focus({preventScroll:!0}),[]),e}var Mz=`file:`,Nz=e=>`${Mz}${e}`,Pz=e=>e.startsWith(Mz)?e.slice(5):null;function kte(e,t){return t?`${t.replace(/\/$/,``)}/${e}`:e}function Ate(e,t){if(t(e))return e;let n=e.split(`/`);for(let e=1;e<n.length-1;e++){let r=`…/${n.slice(e).join(`/`)}`;if(t(r))return r}return n.length>1?`…/${n.at(-1)}`:e}function jte(e,t){let n=e.trim().replace(/^file:\/\//i,``),r;if(n.startsWith(`./`))r=n.slice(2);else if(n.startsWith(`/`)){let e=t?.replace(/\/$/,``);if(!e||!n.startsWith(`${e}/`))return`outside`;r=n.slice(e.length+1)}else return null;return r&&!r.split(`/`).includes(`..`)?Nz(r):`outside`}function Fz(e){return e===`localhost`||e.endsWith(`.localhost`)||e===`[::1]`||/^127(\.\d{1,3}){3}$/.test(e)}var Mte=/^(localhost|127(\.\d{1,3}){3}|\[::1\])(:\d+)?([/?#]|$)/i,Nte=/^[a-z][a-z0-9+.-]*:(?!\d+([/?#]|$))/i;function Pte(e){let t=e.trim();if(!t||/\s/.test(t)||Nte.test(t)&&!/^https?:\/\//i.test(t))return null;let n=/^https?:\/\//i.test(t)?t:Mte.test(t)?`http://${t}`:`https://${t.replace(/^\/\//,``)}`;try{let e=new URL(n);return e.hostname===`[::1]`&&(e.hostname=`localhost`),e.hostname?e.href:null}catch{return null}}function Fte(e,t,n=Fz(t.hostname),r=!1){let i=new URL(e);return i.origin===t.origin?`self`:r?`yes`:Fz(i.hostname)?n?`yes`:`remote`:i.protocol===`https:`?`yes`:`unreachable`}function Ite(e,t,n){let r=new URL(e).host;return t===`self`?{key:`self`,host:r}:t===`remote`?{key:`remote`,host:r}:t===`unreachable`?{key:`noFrame`,host:r}:n&&!n.reachable?{key:`unreachable`,host:r}:n&&!n.frameable?{key:`refuses`,host:r}:null}function Iz(e){return e.urls[e.at]??``}function Lz(e){let t=Pz(e);if(t!==null)return t.slice(t.lastIndexOf(`/`)+1);try{return new URL(e).host.replace(/^www\./,``)}catch{return e}}function Rz(){return{kind:`browser`,tabs:[{id:`t1`,urls:[],at:-1}],active:`t1`,recent:[`t1`],next:2}}function zz(e,t){return!e.tabs.some(e=>e.id===t)||e.active===t&&e.recent.at(-1)===t?e:{...e,active:t,recent:[...e.recent.filter(e=>e!==t),t]}}function Lte(e){let t=e;for(;t.tabs.length>12;){let e=t.tabs.filter(e=>e.id!==t.active).sort((e,n)=>t.recent.indexOf(e.id)-t.recent.indexOf(n.id))[0];if(!e)break;t=Gz(t,e.id)??t}return t}function Bz(e,t){let n=`t${e.next}`,r={id:n,urls:t,at:t.length-1};return Lte(zz({...e,tabs:[...e.tabs,r],next:e.next+1},n))}function Rte(e){return Bz(e,[])}function Vz(e,t){return{...e,tabs:e.tabs.map(e=>e.id===t.id?t:e)}}function Hz(e,t,n){let r=e.tabs.find(e=>e.id===t);if(!r||Iz(r)===n)return e;let i=[...r.urls.slice(0,r.at+1),n].slice(-30);return Vz(e,{...r,urls:i,at:i.length-1})}function zte(e,t,n){let r=e.tabs.find(e=>e.id===t);return!r||n===r.at||n<0||n>=r.urls.length?e:Vz(e,{...r,at:n})}function Uz(e,t){let n=e.tabs.find(e=>Iz(e)===t);if(n)return zz(e,n.id);let r=e.tabs.find(e=>Iz(e)===``);return r?Hz(zz(e,r.id),r.id,t):Bz(e,[t])}function Wz(e,t,n){let r=e.tabs.find(e=>Iz(e)===t),i=e.tabs.find(t=>t.id===e.active),a=i&&(Iz(i)===``||Pz(Iz(i))!==null),o=r?zz(e,r.id):a?Hz(e,i.id,t):Uz(e,t),s=o.tabs.find(e=>e.id===o.active);return n===void 0||!s||s.read===n?o:Vz(o,{...s,read:n})}function Gz(e,t){let n=e.tabs.filter(e=>e.id!==t);if(n.length===0)return null;let r=e.recent.filter(e=>e!==t);if(e.active!==t)return{...e,tabs:n,recent:r};let i=[...r].reverse().find(e=>n.some(t=>t.id===e))??n[0].id;return{...e,tabs:n,active:i,recent:[...r.filter(e=>e!==i),i]}}function Bte(e,t){return e.tabs.some(e=>e.id===t)?Gz(e,t):e}function Vte(e,t){let n=e.tabs.find(e=>e.id===t);return n?{...e,tabs:[n],active:t,recent:[t]}:e}function Hte(e,t,n){let r=new Set(n.map(e=>e.id)),i=[...e.filter(e=>r.has(e)&&e!==t),...r.has(t)?[t]:[]];return i.slice(Math.max(0,i.length-3))}function Kz(e,t,n,r){if(!Array.isArray(e))return null;let i=[];for(let t of e){if(!t||typeof t!=`object`)continue;let e=t;if(typeof e.id!=`string`||!/^t\d+$/.test(e.id)||i.some(t=>t.id===e.id))continue;let n=Array.isArray(e.urls)?e.urls.filter(e=>typeof e==`string`&&e!==``).slice(-30):[],r=typeof e.at==`number`&&Number.isInteger(e.at)?e.at:n.length-1;i.push({id:e.id,urls:n,at:n.length===0?-1:Math.min(n.length-1,Math.max(0,r))})}let a=i[0];if(!a)return null;let o=new Set(i.map(e=>e.id)),s=Array.isArray(n)?n.filter(e=>typeof e==`string`&&o.has(e)):[],c=typeof t==`string`&&o.has(t)?t:s.at(-1)??a.id,l=Math.max(...i.map(e=>Number(e.id.slice(1))));return{kind:`browser`,tabs:i,active:c,recent:[...s.filter(e=>e!==c),c],next:Math.max(l+1,typeof r==`number`&&Number.isInteger(r)?r:0)}}function qz(){return typeof window<`u`?window.roveDesktop?.browser??null:null}function Ute(){return qz()!==null}function Jz(e,t){return`${e}:${t}`}var Yz=new Map;function Wte(e,t){Yz.set(e,t)}function Gte(e){let t=Yz.get(e);return t!==void 0&&Yz.delete(e),t}function Xz(e,t){let n=qz();n&&n.closeByPanelKey(Jz(e,t)).catch(()=>{})}var Zz=`[role="dialog"], [role="menu"], dialog[open]`;function Kte(e){if(typeof document>`u`||typeof MutationObserver>`u`)return()=>{};let t=!!document.querySelector(Zz);e(t);let n=new MutationObserver(()=>{let n=!!document.querySelector(Zz);n!==t&&(t=n,e(n))});return n.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`open`]}),()=>n.disconnect()}var Qz=[`quota`,`files`,`diff`,`chat`,`browser`],qte=1e3,Jte=new Set([`diff`,`browser`]);function Yte(){return{columns:[{kind:`files`}],weights:{}}}function $z(e,t){return e.columns.find(e=>e.kind===t)}function Xte(e){return e.slice(e.lastIndexOf(`/`)+1)}function eB(e,t){return{...e,columns:e.columns.map(e=>e.kind===t.kind?t:e)}}function tB(e){return[...e].sort((e,t)=>Qz.indexOf(e.kind)-Qz.indexOf(t.kind))}function nB(e,t){return{...e,columns:tB([...e.columns,t])}}function rB(e,t){return $z(e,t)?e:nB(e,t===`diff`?{kind:t,path:`.`,scope:`working`}:t===`browser`?Rz():{kind:t})}function iB(e,t,n){let r=$z(e,`browser`);if(r?.kind!==`browser`)return nB(e,Wz(Rz(),Nz(t),n));let i=Wz(r,Nz(t),n);return i===r?e:eB(e,i)}function aB(e,t,n,r){let i=r===void 0?{kind:`diff`,path:t,scope:n}:{kind:`diff`,path:t,scope:n,at:r},a=$z(e,`diff`);return a?a.kind===`diff`&&a.path===t&&a.scope===n&&(r===void 0||a.at===r)?e:eB(e,i):nB(e,i)}function oB(e,t){let n=$z(e,`browser`);return n?.kind===`browser`?eB(e,Uz(n,t)):nB(e,Uz(Rz(),t))}function sB(e,t){if(!$z(e,t))return e;let{[t]:n,...r}=e.weights;return{columns:e.columns.filter(e=>e.kind!==t),weights:r}}function Zte(e,t){let n=$z(e,`browser`);if(n?.kind!==`browser`)return e;let r=t(n);return r===n?e:r?eB(e,r):sB(e,`browser`)}function Qte(e,t,n){if(!t){let t=e.columns.filter(e=>e.kind===n);return{panel:rB({...e,columns:t},n),open:!0}}if($z(e,n)){let t=sB(e,n);return{panel:t,open:t.columns.length>0}}return{panel:rB(e,n),open:!0}}function $te(e){let t=e.columns.flatMap(t=>{let n=e.weights[t.kind];return n!==void 0&&n>0?[n]:[]}),n=t.length>0?t.reduce((e,t)=>e+t,0)/t.length:1,r=e.columns.map(t=>e.weights[t.kind]||n*(Jte.has(t.kind)?2:1)),i=r.reduce((e,t)=>e+t,0);return r.map(e=>e/i*qte)}function ene(e,t){let n=t.reduce((e,t)=>e+t,0);if(t.length!==e.columns.length||!(n>0))return e;let r=Object.fromEntries(e.columns.map((e,r)=>[e.kind,Math.round(t[r]/n*1e3)/1e3]));return e.columns.every(t=>Math.abs((e.weights[t.kind]??0)-(r[t.kind]??0))<.001)?e:{...e,weights:r}}function tne(e){return Object.keys(e.weights).length===0?e:{...e,weights:{}}}function nne(e,t,n,r){let i=e[t],a=e[t+1];if(i===void 0||a===void 0)return[...e];let o=i+a,s=Math.min(r,o/2),c=Math.max(s,Math.min(o-s,i+n));return e.map((e,n)=>n===t?c:n===t+1?o-c:e)}var rne=[`files`,`diff`,`browser`];function ine(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.taskId==`string`&&t.taskId!==``&&rne.includes(t.view)&&typeof t.at==`number`&&(t.url===void 0||typeof t.url==`string`)&&(t.path===void 0||typeof t.path==`string`)}function ane(e){return e.narrow?{panel:!1,panelOpen:!1,narrow:!0}:{panel:!0,panelOpen:e.panelOpen,narrow:!1}}function one(e,t){return{tab:e.path?e.view===`files`?`browser`:`diff`:e.view,...e.view===`browser`&&e.url?{url:e.url}:{},...e.view!==`browser`&&e.path?{path:e.path}:{},show:t.taskId===e.taskId&&!t.narrow}}function sne(e,t,n){return t.url?oB(e,t.url):t.path?t.tab===`browser`?iB(e,t.path,n):aB(e,t.path,`working`,n):rB(e,t.tab)}He(),A(),H();var cB=Qz.filter(e=>e!==`chat`),lB=O(`terminal`),uB=`rove.web.phoneView`;function dB(){try{let e=JSON.parse(localStorage.getItem(uB)??`{}`);return e&&typeof e==`object`?e:{}}catch{return{}}}function fB(e,t){lB.set(e&&t&&dB()[`${e}::${t}`]||`terminal`)}function cne(e,t,n){if(lB.set(n),!t)return;let r=`${e}::${t}`,{[r]:i,...a}=dB(),o=Object.entries({...a,[r]:n}).slice(-200);localStorage.setItem(uB,JSON.stringify(Object.fromEntries(o)))}var pB=`rove.web.panelWidth`,mB=`rove.web.panelOpen`,hB=O((()=>{let e=Number(localStorage.getItem(pB));return Number.isFinite(e)&&e>0?e:null})());hB.subscribe(()=>{let e=hB.get();e===null?localStorage.removeItem(pB):localStorage.setItem(pB,String(Math.round(e)))}),hB.subscribe(le);var gB=O(localStorage.getItem(mB)===`1`);gB.subscribe(()=>localStorage.setItem(mB,gB.get()?`1`:`0`));var _B=O(!1);gB.subscribe(()=>{gB.get()||_B.set(!1)});function vB(e,t,n=window.innerWidth){let r=Math.max(280,n-t-320);return Math.max(280,Math.min(r,Math.round(e)))}var lne=[`files`,`chat`,`diff`,`browser`,`quota`],yB=e=>e===`branch`||e===`task`?e:`working`;function une(e){if(!e||typeof e!=`object`)return null;let t=e;return t.kind===`files`||t.kind===`chat`||t.kind===`quota`?{kind:t.kind}:t.kind===`diff`&&typeof t.path==`string`&&t.path!==``?{kind:`diff`,path:t.path,scope:yB(t.scope)}:t.kind===`browser`?Kz(t.tabs,t.active,t.recent,t.next):null}function dne(e,t){if(!e||typeof e!=`object`)return{};let n=e,r=t.flatMap(({kind:e})=>{let t=n[e];return typeof t==`number`&&Number.isFinite(t)&&t>0?[[e,t]]:[]});return Object.fromEntries(r)}function fne(e){let t=[e.top,e.bottom].map(e=>e&&typeof e==`object`&&`tabs`in e&&Array.isArray(e.tabs)?e.tabs:null);return t[0]?{tabs:t.flatMap(e=>e??[]).filter(e=>!!e&&typeof e==`object`&&/^t\d+$/.test(String(e.id))),recent:Array.isArray(e.recent)?e.recent.filter(e=>typeof e==`string`):[]}:null}function pne(e){let t=fne(e);if(!t)return null;let n=[...new Set(t.tabs.map(e=>e.kind))],r=[];for(let i of n){if((i===`files`||i===`chat`||i===`quota`)&&r.push({kind:i}),i===`diff`){let e=t.tabs.filter(e=>e.kind===`diff`&&typeof e.path==`string`&&e.path!==``),n=[...t.recent].reverse().map(t=>e.find(e=>e.id===t)).find(e=>e)??e[0];n&&r.push({kind:`diff`,path:n.path,scope:yB(n.scope)})}if(i===`browser`){let n=Kz(t.tabs.filter(e=>e.kind===`browser`),void 0,t.recent,e.next);n&&r.push(n)}}return{columns:tB(r),weights:{}}}function mne(e){if(!e||typeof e!=`object`)return null;let t=e;if(!Array.isArray(t.columns))return pne(t);let n=[];for(let e of t.columns){let t=une(e);t&&!n.some(e=>e.kind===t.kind)&&n.push(t)}let r={columns:tB(n),weights:dne(t.weights,n)},i=t.columns.find(e=>e?.kind===`file`&&typeof e.path==`string`&&e.path!==``);return i?iB(r,i.path):r}function hne(e,t){let n=Yte(),r=typeof t==`string`&&t!==``?t:``;return e!==`browser`&&!r?n:{...n,columns:[...n.columns,r?Uz(Rz(),r):Rz()]}}function bB(e){try{let t=JSON.parse(e??`{}`);return t&&typeof t==`object`&&!Array.isArray(t)?Object.entries(t):[]}catch{return[]}}function gne(e,t,n){let r=Object.fromEntries(Object.entries(e).filter(([e])=>e!==t));r[t]=n;for(let e of Object.keys(r).slice(0,-50))delete r[e];return r}function _ne(e,t){let n={};for(let[t,r]of bB(e)){let e=mne(r);e&&(n[t]=e)}let r=new Map(bB(t.tab).filter(([,e])=>lne.includes(e))),i=new Map(bB(t.url)),a=[...new Set([...r.keys(),...i.keys()])].filter(e=>!(e in n));n={...Object.fromEntries(a.map(e=>[e,hne(r.get(e),i.get(e))])),...n};for(let e of Object.keys(n).slice(0,-50))delete n[e];return n}He(),A(),H();var xB=`rove.web.panels`,SB=`rove.web.panelTab`,CB=`rove.web.panelUrl`;function vne(){let e={tab:localStorage.getItem(SB),url:localStorage.getItem(CB)},t=_ne(localStorage.getItem(xB),e);return(e.tab!==null||e.url!==null)&&(localStorage.setItem(xB,JSON.stringify(t)),localStorage.removeItem(SB),localStorage.removeItem(CB)),t}var wB=O(vne()),TB={columns:[],weights:{}};function EB(e){return k(wB)[e]??TB}function DB(e){let t=EB(e??``),n=k(gB),r=k(be)!==null,i=k(V)!==null;return n&&!r&&!i&&(e===null||t.columns.length>0)}function OB(e){return!gB.get()||be.get()!==null||V.get()!==null?!1:e===null||(wB.get()[e]??TB).columns.length>0}var kB=e=>wB.subscribe(e);function AB(e,t){let n=wB.get()[e]??TB,r=t(n);if(r===n)return;let i=gne(wB.get(),e,r);wB.set(i),localStorage.setItem(xB,JSON.stringify(i))}function jB(e,t){AB(e,e=>rB(e,t)),gB.set(!0),Be()&&lB.set(t)}function MB(e,t){let n=gB.get(),r=Qte(wB.get()[e]??TB,n,t);AB(e,()=>r.panel),r.open?gB.set(!0):_B.set(!1)}function NB(e){AB(e.taskId,t=>aB(t,e.path,e.scope)),gB.set(!0),Be()&&lB.set(`diff`)}function PB(e,t){AB(e,e=>iB(e,t)),gB.set(!0),Be()&&lB.set(`browser`)}function FB(e,t){AB(e,e=>oB(e,t)),gB.set(!0),Be()&&lB.set(`browser`)}function IB(e,t){let n=wB.get()[e]??TB;!Be()&&n.columns.length===0&&_B.set(!1),Be()&&lB.get()===t&&!$z(n,t)&&jB(e,`files`)}function LB(e,t){if(t===`browser`){let t=$z(wB.get()[e]??TB,`browser`);if(t?.kind===`browser`)for(let n of t.tabs)Xz(e,n.id)}AB(e,e=>sB(e,t)),IB(e,t)}function RB(e,t){let n=$z(wB.get()[e]??TB,`browser`);if(AB(e,e=>Zte(e,t)),n?.kind===`browser`){let t=$z(wB.get()[e]??TB,`browser`),r=new Set(t?.kind===`browser`?t.tabs.map(e=>e.id):[]);for(let t of n.tabs)r.has(t.id)||Xz(e,t.id)}IB(e,`browser`)}function zB(e,t){RB(e,e=>Bte(e,t))}function BB(e){let t=`${e.taskId}:`;if(e.panelKey?.startsWith(t)){let n=e.panelKey.slice(t.length);RB(e.taskId,e=>zz(e,n)),gB.set(!0),Be()&&lB.set(`browser`);return}AB(e.taskId,t=>{let n=oB(t,e.url),r=$z(n,`browser`);return r?.kind===`browser`&&Wte(Jz(e.taskId,r.active),e.desktopTabId),n}),gB.set(!0),Be()&&lB.set(`browser`)}function VB(e,t){let n=one(e,{taskId:t,narrow:Be()});AB(e.taskId,t=>sne(t,n,e.at)),n.show&&gB.set(!0)}xb();var HB=[`both`,`engine`,`dots`];function UB(){return hb().prefs.statusMark??`both`}function WB(e,t){pb(e,`statusMark`,t)}var GB=`page min-h-0 flex-1 rounded-md border-hairline border-line bg-paper px-4.5 py-3.5 focus:outline-none`,KB=`${GB} overflow-y-auto`,qB=`page-title mx-0 mt-0 mb-1.5 font-sans text-title font-bold normal-nums`,JB=`flex items-baseline justify-between gap-4 [&_.page-title]:m-0`,YB=e=>`min-w-0 truncate text-meta ${e?``:`leading-[inherit]`}`,XB=`flex flex-wrap items-center gap-2`,ZB={row:`touch:after:-inset-x-0.75 touch:after:-inset-y-0.5`,kanban:`touch:after:-inset-x-0.75 touch:after:-top-1.5 touch:after:-bottom-1`,header:`touch:after:-inset-x-0.75 touch:after:-top-2.5 touch:after:-bottom-1.25`},QB=`mt-2.5 flex flex-col gap-1.5`,$B=e=>`flex cursor-pointer flex-col gap-0.5 rounded-sm px-2.5 py-1.5 ${e?`bg-menu`:``}`,eV=`flex min-w-0 items-baseline gap-2.5`,tV=`whitespace-nowrap text-muted`,nV=`flex gap-2.5 pl-[4ch] text-meta leading-[inherit] text-muted`,rV=`min-w-0 flex-1 truncate`,iV=`flex flex-col px-1.5 pb-2 narrow:px-2`,aV=`flex flex-col border-t-hairline border-t-line px-1.5 py-1.5`,oV=`relative flex flex-col`,sV=`size-5.5 fill-none stroke-current stroke-[1.5] [stroke-linecap:round] [stroke-linejoin:round]`,cV=e=>`flex items-center rounded-sm px-2 py-0.75 text-left touch:min-h-10 narrow:min-h-13 narrow:text-(length:--fs-title) ${e?`bg-menu text-ink`:`text-muted hover:bg-hover`}`,lV=`ml-auto -mr-[4.5px] w-5 text-center font-sans text-display leading-none font-normal text-accent normal-nums`,uV=`mr-[7px] size-3.5 flex-none fill-none stroke-current stroke-[1.75] [stroke-linecap:round] [stroke-linejoin:round]`;G(),A(),H();function dV(e,t){let[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(()=>Hs(e,`diff.files`,{taskId:t.id})??null),o=`${t.rowStatus?.kind??``}:${t.rowStatus?.since??0}`,s=JSON.stringify(t.changes??null);return(0,J.useEffect)(()=>{let n=!0;return Ws(e,`output.read`,{taskId:t.id,limit:8}).then(e=>n&&r(xR(e)),()=>n&&r(null)),()=>{n=!1}},[e,t.id,o]),(0,J.useEffect)(()=>{let n=!0;return Ws(e,`diff.files`,{taskId:t.id}).then(e=>n&&a(e),()=>{}),()=>{n=!1}},[e,t.id,s,o]),{reply:n,changes:i?SR(i):null,refresh:`${s}|${o}`}}function fV(e){let{changes:t}=e;return t?t.files.length===0?(0,K.jsx)(`p`,{className:`m-0 font-mono text-meta text-subtle`,children:U(`compare.noChanges`)}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:nz,children:[(0,K.jsx)(`span`,{children:U(`compare.files`,{count:t.files.length})}),t.added>0&&(0,K.jsxs)(YR,{tone:`added`,children:[`+`,t.added]}),t.deleted>0&&(0,K.jsxs)(YR,{tone:`removed`,children:[`−`,t.deleted]})]}),(0,K.jsx)(vte,{model:e.model,taskId:e.row.id,scope:t.scope,refresh:e.refresh,onOpen:e.onOpen})]}):(0,K.jsx)(`p`,{className:xi,children:`…`})}function pV({model:e,row:t,icon:n}){let r=UB(),i=k(e.tabs)[t.id];return r===`dots`||UP(t,i)?(0,K.jsx)(iF,{status:t.rowStatus}):(0,K.jsx)(VF,{icon:n,name:t.engine?.name,status:r===`engine`?HP(t.rowStatus):void 0})}function mV(e){let{model:t,row:n,round:r}=e,{reply:i,changes:a,refresh:o}=dV(t,n),{look:s}=HP(n.rowStatus),c=n.kept===!0,l=e=>{t.select(n.id),NB({taskId:n.id,path:e,scope:a?.scope??`working`})};return(0,K.jsxs)(`section`,{className:ZR(c),"data-attempt":n.id,"aria-current":c||void 0,children:[(0,K.jsxs)(`div`,{className:QR,children:[(0,K.jsx)(pV,{model:t,row:n,icon:e.icon}),(0,K.jsx)(`span`,{className:$R,children:n.engine?.name??n.label}),(0,K.jsx)(`span`,{className:`flex-none text-meta text-muted`,children:U(`compare.status.${s}`)}),c&&(0,K.jsx)(`span`,{className:`ml-auto flex-none font-mono text-meta text-accent`,children:U(`compare.kept`)})]}),(0,K.jsx)(`span`,{className:ez,title:n.branch,children:n.branch}),i?(0,K.jsx)(`p`,{className:tz,children:i}):(0,K.jsx)(`p`,{className:`m-0 text-muted`,children:U(`compare.noReply`)}),(0,K.jsx)(fV,{model:t,row:n,changes:a,refresh:o,onOpen:l}),(0,K.jsxs)(`div`,{className:oz,children:[c?(0,K.jsx)(q,{hit:`tight`,onClick:()=>void xte(t,n),children:U(`compare.unkeep`)}):(0,K.jsx)(q,{variant:`filled`,onClick:()=>void bte(t,n,r),children:U(`compare.keep`)}),(0,K.jsx)(q,{hit:`tight`,onClick:()=>t.select(n.id),children:U(`compare.terminal`)}),(0,K.jsx)(q,{hit:`tight`,onClick:()=>l(`.`),children:U(`compare.diff`)})]})]})}function hV(e,t){let[n,r]=(0,J.useState)(()=>t?Hs(e,`task.get`,{taskId:t})?.task?.prompt??null:null);return(0,J.useEffect)(()=>{if(!t)return;let n=!0;return Ws(e,`task.get`,{taskId:t}).then(e=>n&&r(e.task?.prompt?.trim()||null),()=>{}),()=>{n=!1}},[e,t]),n}function gV({model:e}){W();let t=k(ge),n=k(e.tasks),r=jz(),i=yz(e),a=t&&n?yR(n.tasks,t):[],o=hV(e,a[0]?.id);return(0,K.jsxs)(`div`,{className:KB,tabIndex:0,ref:r,onKeyDown:e=>{e.metaKey||e.ctrlKey||e.altKey||e.key!==`q`&&e.key!==`Escape`||(e.preventDefault(),V.set(null))},children:[(0,K.jsxs)(`div`,{className:JB,children:[(0,K.jsx)(`h1`,{className:qB,children:U(`compare.title`)}),a.length>0&&(0,K.jsx)(`span`,{className:`flex-none font-mono text-meta text-muted`,children:U(`compare.attempts`,{count:a.length})})]}),o&&(0,K.jsx)(`p`,{className:`m-0 mt-1.5 line-clamp-4 max-w-[90ch] whitespace-pre-wrap wrap-anywhere rounded-sm bg-inset px-3 py-2 text-ink`,title:o,children:o}),a.length===0?(0,K.jsx)(`p`,{className:`text-muted`,children:U(`compare.empty`)}):(0,K.jsx)(`div`,{className:XR,children:a.map(t=>(0,K.jsx)(mV,{model:e,row:t,round:a,icon:i.get(t.engine?.id??``)},t.id))})]})}function _V(e){let t=Math.floor(e/6e4),n=Math.floor(t/60);return{minutes:t,hours:n,days:Math.floor(n/24)}}function vV(e,t=Date.now()){let n=Math.max(0,t-e),r=Math.floor(n/1e3);if(r<60)return`${r}s`;let{minutes:i,hours:a,days:o}=_V(n);return i<60?`${i}m`:a<24?`${a}h`:`${o}d`}A();var yV=O(`issues`);function bV(e,t,n){return{repo:e.repo,baseBranch:t,prompt:n,worktree:!0}}G(),A();var xV=[{id:`issues`,label:`reviewQueue.sourceIssues`},{id:`reviews`,label:`reviewQueue.sourceReviews`}];function SV(){W();let e=k(yV);return(0,K.jsx)(`span`,{className:`flex items-baseline gap-3 font-mono text-meta`,children:xV.map(t=>t.id===e?(0,K.jsx)(`span`,{className:`text-ink`,children:U(t.label)},t.id):(0,K.jsx)(q,{onClick:()=>yV.set(t.id),children:U(t.label)},t.id))})}G(),H();var CV={passing:`reviewQueue.checksPassing`,failing:`reviewQueue.checksFailing`,pending:`reviewQueue.checksPending`},wV={missing:`reviewQueue.gh.missing`,unauthenticated:`reviewQueue.gh.unauthenticated`,failed:`reviewQueue.gh.failed`};function TV(e){let{pr:t}=e,n=Date.parse(t.createdAt),r=[t.isDraft?U(`reviewQueue.draft`):``,t.fork?U(`reviewQueue.fork`):``,t.checks?U(CV[t.checks]):``];return(0,K.jsxs)(`div`,{"data-row":e.index,className:$B(e.at),onClick:e.onPick,children:[(0,K.jsxs)(`div`,{className:eV,children:[(0,K.jsxs)(`span`,{className:`mono ${tV}`,children:[t.nameWithOwner.split(`/`)[1],`#`,t.number]}),(0,K.jsx)(`span`,{className:rV,children:t.title}),(0,K.jsx)(q,{disabled:e.busy,onClick:e.onReview,children:U(`reviewQueue.start`)})]}),(0,K.jsxs)(`div`,{className:nV,children:[(0,K.jsx)(`span`,{className:rV,children:[t.author,...r].filter(Boolean).join(`, `)}),(0,K.jsxs)(`span`,{className:`mono`,children:[`+`,t.additions,` −`,t.deletions]}),(0,K.jsx)(`span`,{className:`mono`,children:Number.isFinite(n)?vV(n,e.now):``})]})]})}function EV({model:e}){W();let t=e.client,[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(0),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(null),[f,p]=(0,J.useState)(0),m=(0,J.useRef)(!1),h=jz(),g=(0,J.useRef)(null);(0,J.useEffect)(()=>{let e=!0,n=m.current;return m.current=!1,a(null),t.request(`review.queue`,n?{refresh:!0}:{}).then(t=>e&&r(t)).catch(t=>{e&&(a(Cz(t)),r({prs:[],other:0}))}),()=>{e=!1}},[t,f]);let _=n?.prs??[],v=Math.min(o,Math.max(0,_.length-1));(0,J.useEffect)(()=>{g.current?.querySelector(`[data-row="${v}"]`)?.scrollIntoView({block:`nearest`})},[v]);let y=async e=>{if(c===null){l(e.number),d(U(`reviewQueue.preparing`,{number:e.number}));try{let{ref:n}=await t.request(`review.prepare`,{repo:e.repo,number:e.number});ie(bV(e,n,U(`reviewQueue.prompt`,{number:e.number,repo:e.nameWithOwner,title:e.title,url:e.url,head:e.headRef,base:e.baseRef})))}catch(t){z(U(`reviewQueue.failed`,{number:e.number,error:Cz(t)}),`error`)}finally{l(null),d(null)}}};Az(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);switch(e.key){case`Escape`:case`q`:return V.set(null),!0;case`j`:case`ArrowDown`:return s(Math.min(_.length-1,v+1)),!0;case`k`:case`ArrowUp`:return s(Math.max(0,v-1)),!0;case`r`:return m.current=!0,p(e=>e+1),!0;case`Enter`:{let e=_[v];return e&&y(e),!0}default:return!1}});let b=Date.now();return(0,K.jsxs)(`div`,{className:KB,tabIndex:0,ref:h,children:[(0,K.jsxs)(`div`,{className:JB,children:[(0,K.jsx)(`h1`,{className:qB,children:U(`reviewQueue.title`)}),(0,K.jsx)(SV,{})]}),i?(0,K.jsx)(`p`,{className:`text-error`,children:i}):n===null?(0,K.jsx)(`p`,{className:`text-muted`,children:`…`}):n.reason?(0,K.jsx)(`p`,{className:`text-muted`,children:U(wV[n.reason])}):_.length===0?(0,K.jsx)(`p`,{className:`text-muted`,children:U(`reviewQueue.empty`)}):(0,K.jsx)(`div`,{className:QB,ref:g,children:_.map((e,t)=>(0,K.jsx)(TV,{pr:e,index:t,at:t===v,now:b,busy:c!==null,onPick:()=>s(t),onReview:()=>void y(e)},`${e.nameWithOwner}#${e.number}`))}),n&&n.other>0&&(0,K.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:U(`reviewQueue.other`,{count:n.other})}),u&&(0,K.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:u})]})}He(),A(),H();var DV=30;function OV(){let{items:e}=bz();return t=>{let n=t.indexOf(`: `);switch(n>=0?t.slice(0,n):`failed`){case`no-remote`:return e.errorHint.noRemote;case`gh-missing`:return e.errorHint.ghMissing;case`auth`:return e.errorHint.auth;default:return xz(e.errorHint.fallback,{message:t})}}}function kV({model:e}){let{items:t,common:n,nav:r}=bz(),i=ke(),a=OV(),o=e.client,s=k(e.tasks),c=Dz(e),l=Oz(e),[u,d]=(0,J.useState)(()=>{let e=l?c.findIndex(e=>wz(e)===wz(l)):-1;return Math.max(0,e)}),f=c[u],p=(e,t)=>({repo:e,limit:DV,...t?{assignee:`@me`}:{}}),m=e=>Object.fromEntries(e.links.map(e=>[e.number,e.taskId])),[h,g]=(0,J.useState)(()=>f?Hs(o,`workitem.list`,p(f,!1))?.items??null:null),[_,v]=(0,J.useState)(()=>{let e=f?Hs(o,`workitem.links`,{repo:f}):void 0;return e?m(e):{}}),[y,b]=(0,J.useState)(null),[x,S]=(0,J.useState)(!1),[C,w]=(0,J.useState)(0),[T,E]=(0,J.useState)(0),[D,O]=(0,J.useState)(!1),[ee,A]=(0,J.useState)(null),j=jz(),M=(0,J.useRef)(!1);(0,J.useEffect)(()=>{let e=!0;if(!f){g([]);return}b(null);let t=M.current;M.current=!1;let n=p(f,x),r=Hs(o,`workitem.list`,n);return r&&g(r.items),o.request(`workitem.list`,{...n,...t?{refresh:!0}:{}}).then(t=>e&&g(Us(o,`workitem.list`,n,t).items)).catch(t=>{e&&(b(Cz(t)),g([]))}),Ws(o,`workitem.links`,{repo:f}).then(t=>e&&v(m(t))).catch(()=>e&&v({})),()=>{e=!1}},[o,f,x,C,s?.tasks.length]);let N=h??[],P=Math.min(T,Math.max(0,N.length-1));(0,J.useEffect)(()=>A(null),[f,x]);let F=(0,J.useRef)(null);(0,J.useEffect)(()=>{F.current?.querySelector(`[data-row="${P}"]`)?.scrollIntoView({block:`nearest`})},[P]);let I=e=>s?.tasks.find(t=>t.id===e)?.label??e,L=t=>{V.set(null),e.select(t)},R=async()=>{let e=N[P];if(!e||!f||D)return;let n=_[e.number];if(n){A(xz(t.openingLinked,{title:I(n)})),L(n);return}O(!0),A(xz(t.starting,{number:e.number}));try{let n=await o.request(`workitem.start`,{repo:f,number:e.number});n.started?L(n.taskId):A(xz(t.startedNoEngine,{title:n.title}))}catch(n){z(xz(t.startFailed,{number:e.number,error:Cz(n)}),`error`)}finally{O(!1)}};Az(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);switch(e.key){case`Escape`:case`q`:return V.set(null),!0;case`j`:case`ArrowDown`:return E(Math.min(N.length-1,P+1)),!0;case`k`:case`ArrowUp`:return E(Math.max(0,P-1)),!0;case`Tab`:return d(t=>c.length?(t+(e.shiftKey?c.length-1:1))%c.length:0),!0;case`a`:return S(e=>!e),!0;case`r`:return M.current=!0,w(e=>e+1),!0;case`Enter`:return R(),!0;default:return!1}});let te=Date.now(),ne=(0,K.jsxs)(K.Fragment,{children:[y?(0,K.jsxs)(`div`,{className:QB,children:[(0,K.jsx)(`p`,{className:`text-error`,children:y}),(0,K.jsx)(`p`,{className:`text-muted`,children:a(y)})]}):h===null?(0,K.jsx)(`p`,{className:`text-muted`,children:n.loading}):N.length===0?(0,K.jsx)(`p`,{className:`text-muted`,children:t.empty}):(0,K.jsx)(`div`,{className:QB,ref:F,children:N.map((e,n)=>{let r=_[e.number],i=Date.parse(e.updatedAt);return(0,K.jsxs)(`div`,{"data-row":n,className:$B(n===P),onClick:()=>n===P?void R():E(n),children:[(0,K.jsxs)(`div`,{className:eV,children:[(0,K.jsxs)(`span`,{className:`mono ${tV}`,children:[`#`,e.number]}),(0,K.jsx)(`span`,{children:e.title})]}),(0,K.jsxs)(`div`,{className:nV,children:[(0,K.jsx)(`span`,{className:rV,children:[e.author,...e.labels.slice(0,2)].filter(Boolean).join(`, `)}),r&&(0,K.jsx)(`span`,{children:xz(t.linkedChip,{title:I(r)})}),(0,K.jsx)(`span`,{className:`mono`,children:Number.isFinite(i)?vV(i,te):``})]})]},e.number)})}),ee&&(0,K.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:ee})]});return i?(0,K.jsxs)(tO,{title:r.issues,rootRef:j,note:f?Tz(f,c):t.noRepo,children:[(0,K.jsx)(SV,{}),ne]}):(0,K.jsxs)(`div`,{className:KB,tabIndex:0,ref:j,children:[(0,K.jsxs)(`div`,{className:JB,children:[(0,K.jsx)(`h1`,{className:qB,children:t.title}),(0,K.jsx)(SV,{}),(0,K.jsxs)(`span`,{className:`mono touch:empty:hidden! text-muted ${YB(!0)}`,children:[f?Tz(f,c):t.noRepo,x?` ${t.assignedFilter}`:``]})]}),ne]})}function AV({model:e}){return k(yV)===`reviews`?(0,K.jsx)(EV,{model:e}):(0,K.jsx)(kV,{model:e})}var jV={backlog:`active`,in_progress:`active`,in_review:`parked`,error:`parked`,done:`terminal`,canceled:`terminal`,open:`active`,doing:`active`,hold:`parked`};function MV(e){return jV[e]??`parked`}var NV=[`backlog`,`in_progress`,`parked`,`done`];function PV(e,t,n){let r=e.find(e=>e.issues.length>0)?.issues[0]?.id??null;if(t==null)return r;let i=-1,a=-1;for(let[n,r]of e.entries()){let e=r.issues.findIndex(e=>e.id===t);if(e!==-1){i=n,a=e;break}}if(i===-1)return r;if(n===`up`||n===`down`){let r=e[i]?.issues??[],o=n===`up`?a-1:a+1;return r[Math.max(0,Math.min(o,r.length-1))]?.id??t}let o=n===`left`?-1:1;for(let n=i+o;n>=0&&n<e.length;n+=o){let r=e[n]?.issues??[];if(r.length!==0)return r[Math.min(a,r.length-1)]?.id??t}return t}function FV(e,t){let n=MV(e.status);return n===`terminal`?`done`:n===`parked`?`parked`:e.taskId!==void 0&&e.taskId!==``&&(t?.(e.taskId)??!0)||e.status===`doing`?`in_progress`:`backlog`}function IV(e,t){let n=0;return{columns:e.map(e=>{if(e.key!==`in_progress`)return e;let r=[],i=[];for(let n of e.issues)n.taskId!==void 0&&n.taskId!==``&&t(n.taskId)?r.push(n):i.push(n);return n=r.length,r.length===0?e:{...e,issues:[...r,...i]}}),attentionCount:n}}function LV(e,t){return e.created===t.created?t.id-e.id:e.created<t.created?1:-1}function RV(e,t){let n={backlog:[],in_progress:[],parked:[],done:[]};for(let r of e)n[FV(r,t)].push(r);return NV.map(e=>{let t=e===`done`||e===`parked`,r=n[e].sort(LV);return!t||r.length<=20?{key:e,issues:r,hiddenCount:0}:{key:e,issues:r.slice(0,20),hiddenCount:r.length-20}})}var zV=[`worktree`,`project`];async function BV(e,t){let n=t.placement===`project`?`project`:`worktree`,{title:r,prompt:i}=await e.request(`issue.prompt`,{repo:t.repo,id:t.issue.id,where:n}),a=[];if(t.placement!==`project`){let{taskId:n}=await e.request(`task.create`,{repo:t.repo,engine:t.engine,title:r,prompt:i});return await e.request(`issue.update`,{repo:t.repo,id:t.issue.id,task:n}).catch(e=>a.push({kind:`link`,error:Cz(e)})),{taskId:n,warnings:a}}let o=await uP((t,n)=>e.request(t,n),t.repo,t.engine,r,i);if(!o)throw Error(`the session did not start`);return await e.request(`issue.setStatus`,{repo:t.repo,id:t.issue.id,status:`doing`}).catch(e=>a.push({kind:`status`,error:Cz(e)})),{taskId:o,warnings:a}}var VV=`text-meta leading-[inherit]`,HV=`text-meta`,UV=`flex flex-col gap-2 overflow-hidden`,WV=`flex min-w-0 items-baseline gap-3`,GV=`font-bold whitespace-nowrap text-accent touch:relative touch:after:absolute touch:after:-inset-x-2 touch:after:-inset-y-1 touch:after:content-['']`,KV=`min-w-0 truncate ${HV}`,qV=`ml-auto ${VV}`,JV=`grid min-h-0 flex-1 grid-cols-4 gap-2`,YV=`flex min-h-0 flex-1 flex-col gap-2`,XV=`flex gap-4 ${HV}`,ZV=e=>`flex items-baseline gap-1.5 whitespace-nowrap touch:relative touch:after:absolute touch:after:-inset-x-1.5 touch:after:-top-1 touch:after:-bottom-3 touch:after:content-[''] ${e?`font-bold text-accent`:`text-muted`}`,QV={in_progress:`text-accent`,parked:`text-warning`,done:`text-success`},$V=e=>`flex min-h-0 flex-col rounded-md border-hairline border-line p-2 ${e?`flex-1`:``}`,eH=e=>`m-0 mb-2 flex justify-between gap-2 font-mono text-meta font-bold normal-nums ${QV[e]??`text-muted`}`,tH=`flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto`,nH=`m-0 ${HV}`,rH=e=>`flex flex-none cursor-pointer flex-col gap-1 rounded-sm border-hairline bg-surface px-2.5 py-2 ${e.selected?`border-accent`:e.attention?`border-warning`:`border-line hover:border-line-active`}`,iH=`flex justify-between gap-2`,aH=e=>`min-w-0 font-bold wrap-anywhere ${e?`text-muted`:``}`,oH=`h-[2.8em] overflow-hidden whitespace-pre-wrap wrap-anywhere ${VV}`,sH=`flex justify-between gap-2 ${HV}`,cH=`w-[min(680px,calc(100vw-32px))]!`,lH=`flex items-baseline gap-3.5`,uH=`flex items-baseline gap-2.5`,dH=`tracking-[0] normal-case`,fH=`min-h-40 font-mono`,pH=`flex flex-col items-start gap-0.5`,mH=e=>`text-left font-mono text-meta whitespace-pre-wrap normal-nums ${e?`font-bold text-accent`:`font-normal text-muted`}`,hH=VV,gH=`flex flex-col gap-1 [&_p]:m-0`,_H=`flex gap-2 ${HV}`,vH=`min-w-[4ch] text-right`,yH=`rounded-sm border-hairline border-transparent p-1 focus:border-accent focus:outline-none`,bH={choice:`radiogroup`,list:`listbox`,cells:`group`};function xH(e){return(0,K.jsx)(`div`,{ref:e.fieldRef,role:bH[e.kind??`choice`],tabIndex:0,"aria-label":e.label,className:`${yH} ${e.className??``}`,onKeyDown:e.onKeyDown,onClick:e.onClick,children:e.children})}G(),H();var SH=[`open`,`doing`,`hold`,`done`];function CH({model:e,taskId:t}){let{kanban:n}=bz(),[r,i]=(0,J.useState)(null);return(0,J.useEffect)(()=>{let n=!0;return e.client.request(`task.events`,{taskId:t}).then(e=>n&&i(e.events)).catch(()=>n&&i([])),()=>{n=!1}},[e,t]),(0,K.jsxs)(`div`,{className:gH,children:[(0,K.jsx)(`h2`,{className:`${Di} text-muted`,children:n.detail.eventsLabel}),r===null?(0,K.jsx)(`p`,{className:`text-muted`,children:n.detail.eventsLoading}):r.length===0?(0,K.jsx)(`p`,{className:`text-muted`,children:n.detail.eventsNone}):r.map(e=>(0,K.jsxs)(`div`,{className:`mono ${_H}`,children:[(0,K.jsx)(`span`,{className:`text-muted ${vH}`,children:vV(e.at)}),(0,K.jsx)(`span`,{children:e.kind}),e.tail&&(0,K.jsx)(`span`,{className:`text-muted`,children:e.tail})]},`${e.at}:${e.kind}:${e.tail}`))]})}function wH(e){let{kanban:t}=bz(),{issue:n,mode:r}=e,i=r===`create`,a=!i&&n.taskId?n.taskId:null,o=i||!a&&n.status!==`done`,[s,c]=(0,J.useState)(n.title),[l,u]=(0,J.useState)(n.body),[d,f]=(0,J.useState)(n.status),[p,m]=(0,J.useState)(e.defaultEngine),[h,g]=(0,J.useState)(zV[0]),[_,v]=(0,J.useState)(!1),[y,b]=(0,J.useState)(!1),x=(0,J.useRef)({}),S=e=>t=>{x.current[e]=t},C=Ii(l,S(`description`)),w=i?`title`:o?`workspace`:a?`open`:`title`;(0,J.useEffect)(()=>x.current[w]?.focus(),[w]);let T=()=>({title:s.trim()||n.title,body:l,status:d}),E=()=>({engine:p,placement:h,jump:_}),D=t=>{ce(),t&&e.onOutcome(t)},O=()=>s.trim()?!0:(x.current.title?.focus(),!1),k=()=>{i?O()&&D({kind:`create`,title:s.trim(),body:l,start:E()}):o?D({kind:`start`,...E(),...T()}):a&&D({kind:`open`,taskId:a,...T()})},ee=()=>{i&&O()&&D({kind:`create`,title:s.trim(),body:l,start:null})},A=()=>D(i?null:{kind:`close`,...T()}),j=(0,J.useRef)({commit:k,saveOnly:ee,close:A});j.current={commit:k,saveOnly:ee,close:A},(0,J.useEffect)(()=>{let e=e=>{let t=e.key===`Escape`?j.current.close:e.key===`Enter`&&(e.ctrlKey||e.metaKey)?j.current.commit:e.key.toLowerCase()===`s`&&e.ctrlKey&&!e.metaKey?j.current.saveOnly:null;t&&(e.preventDefault(),e.stopImmediatePropagation(),t())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]);let M=async t=>{let n=t.find(e=>e.size>XO);if(n){z(U(`pages.attachTooLarge`,{name:n.name||n.type}),`error`);return}b(!0);try{let n=await Promise.all(t.map(t=>rk(e.model.client,t)));u(e=>ek(e,n))}catch(e){z(Ra(e),`error`)}finally{b(!1)}},N=e=>{let t=Array.from(e.clipboardData.files);t.length!==0&&(e.preventDefault(),M(t))},P=e=>{let t=Array.from(e.dataTransfer.files);e.preventDefault(),t.length>0&&M(t)},F=(e,t,n)=>e[(Math.max(0,e.indexOf(t))+n+e.length)%e.length],I=(e,t,n)=>r=>{if(r.ctrlKey||r.metaKey||r.altKey)return;let i=(e===`x`?{ArrowRight:1,l:1,ArrowLeft:-1,h:-1}:{ArrowDown:1,ArrowUp:-1})[r.key];if(i)t(i);else if(r.key===`Enter`&&n)n();else return;r.preventDefault()},L=d===`done`?`text-success`:d===`hold`?`text-warning`:d===`doing`?`text-accent`:`text-muted`,R=e=>t.detail.status[e];return(0,K.jsx)(`div`,{className:Wi,onMouseDown:e=>e.target===e.currentTarget&&j.current.close(),children:(0,K.jsxs)(`dialog`,{open:!0,className:`${Gi(!0)} ${cH}`,"aria-label":i?t.detail.newStory:`#${n.id}`,onPaste:N,onDrop:P,onDragOver:e=>e.preventDefault(),children:[(0,K.jsxs)(`div`,{className:Ki,children:[i?(0,K.jsx)(`h1`,{className:`${Di} text-muted`,children:t.detail.newStory}):(0,K.jsxs)(`h1`,{className:`${Di} text-muted ${lH}`,children:[(0,K.jsxs)(`span`,{children:[`#`,n.id]}),(0,K.jsx)(`span`,{className:L,children:R(d)}),(0,K.jsx)(`span`,{className:`text-muted`,children:xz(t.detail.created,{date:n.created})}),a&&(0,K.jsx)(`span`,{className:`text-accent`,children:t.detail.linked})]}),(0,K.jsx)(Da,{onClick:()=>j.current.close()})]}),(0,K.jsxs)(`div`,{className:Yi,children:[(0,K.jsxs)(`label`,{className:Li,children:[(0,K.jsx)(`span`,{className:`${Ri}`,children:t.detail.titleLabel}),(0,K.jsx)(`input`,{ref:S(`title`),className:ji,spellCheck:!1,value:s,onChange:e=>c(e.target.value.replace(/[\r\n]+/g,` `)),onKeyDown:e=>{e.key===`Enter`&&!e.ctrlKey&&!e.metaKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),x.current.description?.focus())}})]}),(0,K.jsxs)(`label`,{className:Li,children:[(0,K.jsxs)(`span`,{className:`${Ri} ${uH}`,children:[t.detail.description,(0,K.jsx)(`span`,{className:`text-muted ${dH}`,children:lA()?U(`pages.attachHintTouch`):t.detail.attachHint}),y&&(0,K.jsx)(`span`,{className:`text-accent`,children:`…`})]}),(0,K.jsx)(`textarea`,{ref:C,className:`${ji} ${zi} ${fH}`,rows:8,spellCheck:!1,placeholder:t.detail.noDescription,value:l,onChange:e=>u(e.target.value)})]}),!i&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsxs)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted flex items-baseline gap-2.5`,children:[t.detail.statusLabel,(0,K.jsx)(`span`,{className:`keys-only text-muted tracking-[0] normal-case`,children:`←/→`})]}),(0,K.jsx)(xH,{fieldRef:S(`status`),label:t.detail.statusLabel,className:`flex flex-wrap gap-1.5`,onKeyDown:I(`x`,e=>f(F(SH,d,e))),children:SH.map(e=>(0,K.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e===d,className:Vi(e===d),onClick:()=>{f(e),x.current.status?.focus()},children:R(e)},e))})]}),o?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:Li,children:[(0,K.jsxs)(`span`,{className:`${Ri} ${uH}`,children:[t.detail.engine,(0,K.jsx)(`span`,{className:`keys-only text-muted ${dH}`,children:`←/→`})]}),(0,K.jsx)(xH,{fieldRef:S(`engine`),label:t.detail.engine,className:Bi,onKeyDown:I(`x`,t=>m(F(e.engines.map(e=>e.id),p,t)),k),children:e.engines.map(e=>(0,K.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e.id===p,className:Vi(e.id===p),onClick:()=>{m(e.id),x.current.engine?.focus()},children:e.name},e.id))})]}),(0,K.jsxs)(`div`,{className:Li,children:[(0,K.jsxs)(`span`,{className:`${Ri} ${uH}`,children:[t.detail.workspace,(0,K.jsx)(`span`,{className:`keys-only text-muted ${dH}`,children:`↑/↓`})]}),(0,K.jsx)(xH,{fieldRef:S(`workspace`),label:t.detail.workspace,className:pH,onKeyDown:I(`y`,e=>g(F(zV,h,e)),k),children:zV.map(e=>(0,K.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e===h,className:`touch:py-1.5 ${mH(e===h)}`,onClick:()=>{g(e),x.current.workspace?.focus()},children:[e===h?`▸ `:` `,t.detail.placement[e]]},e))})]}),(0,K.jsxs)(`div`,{className:Li,children:[(0,K.jsxs)(`span`,{className:`${Ri} ${uH}`,children:[t.detail.jumpLabel,(0,K.jsx)(`span`,{className:`keys-only text-muted ${dH}`,children:`←/→`})]}),(0,K.jsx)(xH,{fieldRef:S(`jump`),label:t.detail.jumpLabel,className:Bi,onKeyDown:I(`x`,()=>v(!_),k),children:[!1,!0].map(e=>(0,K.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e===_,className:Vi(e===_),onClick:()=>{v(e),x.current.jump?.focus()},children:e?t.detail.jump.follow:t.detail.jump.stay},String(e)))})]}),(0,K.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${hH}`,children:(0,K.jsx)(kO,{text:fA(i?t.detail.createLegend:t.detail.startLegend)})}),(0,K.jsxs)(`div`,{className:Mi,children:[i&&(0,K.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:ee,children:U(`pages.storySave`)}),(0,K.jsx)(`button`,{type:`button`,className:vi(),onClick:k,children:U(i?`pages.storySaveStart`:`pages.storyStart`)})]})]}):a?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:Li,children:[(0,K.jsx)(`span`,{className:`${Ri}`,children:t.detail.sessionLabel}),(0,K.jsxs)(`div`,{className:`${Bi} ${yH}`,children:[(0,K.jsx)(`button`,{ref:S(`open`),type:`button`,className:Vi(!0),onClick:()=>D({kind:`open`,taskId:a,...T()}),children:t.detail.openAction}),(0,K.jsx)(`button`,{ref:S(`unlink`),type:`button`,className:Vi(),onClick:()=>D({kind:`unlink`,...T()}),children:t.detail.unlinkAction})]})]}),(0,K.jsx)(CH,{model:e.model,taskId:a}),(0,K.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${hH}`,children:(0,K.jsx)(kO,{text:fA(t.detail.openLegend)})})]}):(0,K.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${hH}`,children:(0,K.jsx)(kO,{text:fA(t.detail.doneNote)})})]})]})})}var TH={"waiting-on-you":`text-error`,landing:`text-success`,"ready-for-review":`text-ink`,working:`text-accent`};function EH(e){let{engines:t,engine:n}=BI(e);return{engines:t,defaultEngine:n}}function DH(e,t){let n=Dz(e),r=n.join(`
|
|
202
|
+
`),[i,a]=(0,J.useState)(()=>Hs(e,`kanban.boards`)??null);return(0,J.useEffect)(()=>{let t=!0,r=e.client,i=e=>r.request(e).then(e=>e.repos).catch(()=>[]);return Promise.all([i(`repos.list`),i(`issue.repos`)]).then(([e,t])=>Ez(e,n,t)).then(e=>Promise.all(e.map(e=>r.request(`issue.list`,{repo:e}).catch(t=>({repoRoot:e,nextId:1,issues:[],readError:Cz(t)}))))).then(n=>{let r=Us(e,`kanban.boards`,void 0,[...n].sort((e,t)=>e.repoRoot.localeCompare(t.repoRoot)));t&&a(r)}),()=>{t=!1}},[e,t,r]),i}function OH(e){let{issue:t}=e,n=t.body.trim();return(0,K.jsxs)(`div`,{"data-issue":t.id,className:rH({selected:e.selected,attention:e.badge?.tone===`text-error`}),onClick:()=>e.selected?e.onOpen():e.onSelect(),onContextMenu:t=>{t.preventDefault(),e.onMenu(t.clientX,t.clientY)},children:[(0,K.jsxs)(`div`,{className:iH,children:[(0,K.jsx)(`span`,{className:aH(e.column===`done`),children:t.title}),(0,K.jsxs)(`span`,{className:`mono text-muted`,children:[`#`,t.id]})]}),(0,K.jsx)(`div`,{className:`text-muted ${oH}`,children:n}),(0,K.jsxs)(`div`,{className:`mono text-muted ${sH}`,children:[(0,K.jsx)(`span`,{children:t.created}),e.badge&&(0,K.jsx)(`span`,{className:e.badge.tone,children:e.badge.label})]})]})}G(),A(),H(),He();var kH=5e3,AH=760;function jH({model:e}){let{kanban:t,group:n,nav:r}=bz(),i=ke(),[a,o]=kz(kH),s=DH(e,a),{engines:c,defaultEngine:l}=EH(e),u=k(e.tasks),d=Oz(e),[f,p]=(0,J.useState)(null),[m,h]=(0,J.useState)(null),g=jz(),[_,v]=(0,J.useState)(!1);(0,J.useEffect)(()=>{let e=g.current;if(!e)return;let t=new ResizeObserver(()=>v(e.clientWidth<AH));return t.observe(e),()=>t.disconnect()},[g]);let y=s??[],b=d?y.find(e=>e.repoRoot.replace(/^\/private\//,`/`)===d.replace(/^\/private\//,`/`)):void 0,x=Math.max(0,y.findIndex(e=>e.repoRoot===(f??b?.repoRoot))),S=y[x],C=y.map(e=>e.repoRoot),w=y.filter(e=>e.readError).map(e=>`${e.repoRoot}\0${e.readError}`).join(`
|
|
203
|
+
`);(0,J.useEffect)(()=>{for(let e of y)e.readError&&z(xz(t.readFailedToast,{repo:Tz(e.repoRoot,C),error:e.readError}),`error`)},[w]);let T=u?.tasks??[],E=new Set(T.map(e=>e.id)),D=e=>T.find(t=>t.id===e)?.group,{columns:O,attentionCount:ee}=IV(S?RV(S.issues,E.size===0?void 0:e=>E.has(e)):[],e=>D(e)===`waiting-on-you`),A={backlog:t.column.backlog,in_progress:t.column.inProgress,parked:t.column.parked,done:t.column.done},j=(e,t)=>{let r=e.taskId&&(t===`in_progress`||t===`parked`)?D(e.taskId):void 0,i=r===`waiting-on-you`?n.waitingOnYou:r===`landing`?n.landing:r===`ready-for-review`?n.readyForReview:r===`working`?n.working:null;return r&&i?{label:i,tone:TH[r]??`text-muted`}:null},M=async(t,n,r,i)=>{try{return await e.client.request(t,{repo:S?.repoRoot,...n})}catch(e){return z(xz(r,{id:String(i),error:Cz(e)}),`error`),null}finally{o()}},N=(e,n)=>M(`issue.setStatus`,{id:e.id,status:n},t.statusFailed,e.id),P=t=>{V.set(null),e.select(t)},F=async(n,r,i)=>{try{let a=await BV(e.client,{repo:n,issue:r,engine:i.engine,placement:i.placement});for(let e of a.warnings)z(xz(e.kind===`link`?t.linkFailed:t.statusFailed,{id:String(r.id),error:e.error}),`error`);i.jump?(V.set(null),e.selectWhenListed(a.taskId)):z(xz(t.detail.startedBackground,{title:`#${r.id} ${r.title}`}))}catch(e){z(Ra(e),`error`)}finally{o()}},I=async(e,n)=>{if(!S||n.kind===`create`)return;let r={};n.title!==e.title&&(r.title=n.title),n.body!==e.body&&(r.body=n.body),(r.title!==void 0||r.body!==void 0)&&await M(`issue.update`,{id:e.id,...r},t.updateFailed,e.id),n.status!==e.status&&await N(e,n.status),n.kind===`open`?P(n.taskId):n.kind===`unlink`?await M(`issue.update`,{id:e.id,task:`none`},t.unlinkFailed,e.id):n.kind===`start`&&await F(S.repoRoot,{...e,...r},n)},L=t=>{S&&(h(t.id),B.set((0,K.jsx)(wH,{model:e,issue:t,mode:`detail`,engines:c,defaultEngine:l,onOutcome:e=>void I(t,e)})))},R=()=>{if(!S)return;let n=S.repoRoot,r={id:S.nextId,title:``,status:`open`,created:new Date().toISOString().slice(0,10),body:``};B.set((0,K.jsx)(wH,{model:e,issue:r,mode:`create`,engines:c,defaultEngine:l,onOutcome:i=>{i.kind===`create`&&(async()=>{try{let t=await e.client.request(`issue.create`,{repo:n,title:i.title,body:i.body});if(o(),!i.start)return;let a=t.issues.find(e=>e.id===r.id)??t.issues.reduce((e,t)=>e&&e.id>t.id?e:t,null);a&&await F(n,a,i.start)}catch(e){z(xz(t.createFailed,{error:Cz(e)}),`error`)}})()}}))},te=(n=S?.issues.find(e=>e.id===m))=>{if(!S||!n)return;let r=S.repoRoot;B.set((0,K.jsx)(Ha,{title:xz(t.confirmDelete.title,{id:String(n.id)}),body:xz(t.confirmDelete.body,{title:n.title}),confirmLabel:U(`pages.deleteIssue`),onConfirm:async()=>{try{await e.client.request(`issue.delete`,{repo:r,id:n.id}),h(null)}catch(e){z(xz(t.deleteFailed,{id:String(n.id),error:Cz(e)}),`error`)}finally{o()}}}))},ne=e=>{y.length!==0&&(p(y[(x+e+y.length)%y.length]?.repoRoot??null),h(null))},re=e=>{let t=PV(O,m,e);t!=null&&h(t)},ie=e=>O.some(e=>e.issues.length>0)?re(e):ne(e===`left`?-1:1);Az(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);switch(e.key){case`Escape`:case`q`:return V.set(null),!0;case`r`:return o(),!0;case`Tab`:return ne(e.shiftKey?-1:1),!0;case`ArrowUp`:return re(`up`),!0;case`ArrowDown`:return re(`down`),!0;case`ArrowRight`:case`l`:return ie(`right`),!0;case`ArrowLeft`:case`h`:return ie(`left`),!0;case`Enter`:{let e=S?.issues.find(e=>e.id===m);return e&&L(e),!0}case`n`:return R(),!0;case`d`:return te(),!0;default:return!1}});let ae=(0,J.useRef)(null);(0,J.useEffect)(()=>{ae.current?.querySelector(`[data-issue="${m}"]`)?.scrollIntoView({block:`nearest`})},[m]);let oe=(e,n,r)=>{h(e.id),de.set({x:n,y:r,items:SH.filter(t=>t!==e.status).map(n=>({label:xz(t.menu.setStatus,{status:t.detail.status[n]}),run:()=>void N(e,n)})).concat(i?[{label:U(`pages.deleteIssue`),danger:!0,section:`danger`,run:()=>te(e)}]:[])})},se=O.find(e=>e.issues.some(e=>e.id===m))??O.find(e=>e.issues.length>0)??O[0],ce=(e,n=!1)=>{let r=xz(t.attention,{count:String(ee)});return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{children:[A[e.key],` (`,e.issues.length+e.hiddenCount,`)`]}),e.key===`in_progress`&&ee>0&&(0,K.jsx)(`span`,{className:`text-warning`,title:n?r:void 0,children:n?`!${ee}`:r})]})},le=(e,n)=>(0,K.jsxs)(`section`,{className:$V(!n),children:[n&&(0,K.jsx)(`h2`,{className:eH(e.key),children:ce(e)}),(0,K.jsxs)(`div`,{className:tH,children:[e.issues.map(t=>(0,K.jsx)(OH,{issue:t,column:e.key,selected:t.id===m,badge:j(t,e.key),onSelect:()=>h(t.id),onOpen:()=>L(t),onMenu:(e,n)=>oe(t,e,n)},t.id)),e.issues.length===0&&e.hiddenCount===0&&(0,K.jsx)(`p`,{className:`mono text-muted ${nH}`,children:t.columnEmpty}),e.hiddenCount>0&&(0,K.jsx)(`p`,{className:`mono text-muted ${nH}`,children:xz(t.more,{count:String(e.hiddenCount)})})]})]},e.key),ue=s===null?(0,K.jsx)(`p`,{className:`text-muted`,children:t.loading}):S?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:WV,children:[(0,K.jsxs)(`button`,{type:`button`,className:GV,onClick:()=>ne(1),children:[Tz(S.repoRoot,C),y.length>1&&(0,K.jsx)(`span`,{className:`text-muted`,children:` ${x+1}/${y.length}`})]}),!_&&(0,K.jsx)(`span`,{className:`mono text-muted ${KV}`,children:S.repoRoot}),S.issues.length===0&&!S.readError&&(0,K.jsx)(`span`,{className:`text-muted ${qV}`,children:t.empty})]}),S.readError?(0,K.jsx)(`p`,{className:`text-error`,children:xz(t.readFailed,{error:S.readError})}):_&&se?(0,K.jsxs)(`div`,{className:YV,ref:ae,children:[(0,K.jsx)(`div`,{className:`mono ${XV}`,children:O.map(e=>(0,K.jsx)(`button`,{type:`button`,className:ZV(e.key===se.key),onClick:()=>{let t=e.issues[0];t&&h(t.id)},children:ce(e,!0)},e.key))}),le(se,!1)]}):(0,K.jsx)(`div`,{className:JV,ref:ae,children:O.map(e=>le(e,!0))})]}):(0,K.jsx)(`p`,{className:`text-muted`,children:t.noRepos});return i?(0,K.jsx)(tO,{title:r.kanban,rootRef:g,primary:S?{label:U(`pages.newCard`),onClick:R}:void 0,children:ue}):(0,K.jsxs)(`div`,{className:`${GB} ${UV}`,tabIndex:0,ref:g,children:[(0,K.jsxs)(`div`,{className:`kb-top`,children:[(0,K.jsx)(`h1`,{className:qB,children:t.title}),(0,K.jsx)(`span`,{className:`mono keys-only text-muted`,children:t.hint}),(0,K.jsxs)(`span`,{className:`mono ${XB}`,children:[(0,K.jsx)(`button`,{type:`button`,className:`${Oi} ${ZB.kanban}`,disabled:!S,onClick:R,children:U(`pages.new`)}),(0,K.jsx)(`button`,{type:`button`,className:`${Oi} ${ZB.kanban}`,disabled:!S?.issues.some(e=>e.id===m),onClick:()=>te(),children:U(`pages.delete`)})]})]}),ue]})}var MH={title:`Mods`,empty:`No mod is drawing anything.`,emptyHint:`A plugin with a [mod] entry draws its panes here, in the TUI and the web alike.`,keys:`↑↓/tab move · enter press · esc back`,pressFailed:`{plugin}: the press did not reach the mod ({reason})`},NH={title:`Mods`,empty:`当前没有 mod 在绘制内容。`,emptyHint:`声明了 [mod] 的插件会在这里绘制面板,TUI 和 web 显示的是同一份。`,keys:`↑↓/tab 移动 · enter 按下 · esc 返回`,pressFailed:`{plugin}:按键没有送达 mod({reason})`};A();function PH(e){let t=e.changes&&`behind`in e.changes?e.changes.behind??0:0;return{branch:e.branch,behind:t>0?`↓${t}`:null}}function FH(e,t,n){let r=[`kanban`,`issues`].filter(t=>e.has(t)).map(e=>({id:e,page:e,title:n[e]})),i=t.map(e=>{let t=`${e.plugin}/${e.id}`;return{id:`mod:${t}`,page:`mods`,title:e.title,note:e.plugin,pane:t}});return[...r,...i]}var IH=`rove.web.extPage`,LH=O(typeof localStorage>`u`?null:(()=>{try{return localStorage.getItem(IH)}catch{return null}})()),RH=O(null);function zH(e){LH.set(e.id),RH.set(e.pane??null);try{localStorage.setItem(IH,e.id)}catch{}}var BH={info:`text-info`,success:`text-success`,warning:`text-warning`,error:`text-error`,muted:`text-muted`},VH=`flex flex-col gap-3`,HH=`[&_p]:mx-0 [&_p]:my-1`,UH=`rounded-md border-hairline border-line px-3 pt-2 pb-3 font-mono`,WH=(e,t)=>`flex min-w-0 items-start ${e?`[&>form]:flex-[1_1_12em] [&>form]:self-center`:``} ${t?`rounded-sm border-hairline border-line`:``}`,GH=(e,t)=>`whitespace-pre-wrap wrap-anywhere ${e?BH[e]:`text-ink`} ${t?`font-bold`:``}`,KH=(e,t)=>`cursor-pointer rounded-sm border-hairline border-current px-2.5 py-0.5 [font:inherit] font-bold! ${BH[e]} ${t?`bg-[color-mix(in_srgb,currentcolor_18%,transparent)]`:`bg-transparent hover:bg-[color-mix(in_srgb,currentcolor_18%,transparent)]`}`,qH=`flex min-w-0 max-w-[40em] self-stretch`,JH=`w-full font-mono`;G(),He(),A(),H();var YH=[0,6,12,20];function XH(e){return`mod-${e.kind}:${e.plugin}/${e.pane}/${e.key}`}function ZH(e){let[t,n]=(0,J.useState)(e.value??``);return(0,K.jsx)(`form`,{className:qH,onSubmit:r=>{r.preventDefault(),e.onSubmit(t),n(e.value??``)},children:(0,K.jsx)(`input`,{id:e.id,className:`${ji} ${JH}`,spellCheck:!1,value:t,placeholder:e.placeholder,onFocus:e.onFocus,onChange:e=>n(e.target.value)})})}function QH(e){let{node:t}=e;if(t.type===`text`)return(0,K.jsx)(`span`,{className:GH(t.tone,t.bold===!0),children:t.text});if(t.type===`input`){let n={kind:`input`,plugin:e.pane.plugin,pane:e.pane.id,key:t.key};return(0,K.jsx)(ZH,{id:XH(n),placeholder:t.placeholder,value:t.value,onFocus:()=>e.onFocus(n),onSubmit:t=>e.onSubmit(n,t)},t.value??``)}if(t.type===`button`){let n={kind:`button`,plugin:e.pane.plugin,pane:e.pane.id,key:t.key};return(0,K.jsx)(`button`,{type:`button`,id:XH(n),className:KH(t.tone??`info`,zo(n,e.cursor)),onFocus:()=>e.onFocus(n),onClick:()=>e.onPress(n),children:t.label})}return(0,K.jsx)(`div`,{className:WH(t.direction===`row`,t.border===!0),style:{flexDirection:t.direction??`column`,gap:YH[t.gap??0],padding:YH[t.padding??0]},children:t.children.map((t,n)=>(0,K.jsx)(QH,{...e,node:t},n))})}function $H({model:e}){let t=W()===`zh`?NH:MH,n=ke(),r=k(RH),i=k(e.mods),a=n?i.filter(e=>`${e.plugin}/${e.id}`===r):[],o=a.length>0?a:i,s=Ro(o),[c,l]=(0,J.useState)(null),u=Bo(s,c),d=jz(),f=(0,J.useRef)(!1),p=(t,n,r={})=>{l(t),!f.current&&(f.current=!0,e.client.request(n,{plugin:t.plugin,pane:t.pane,key:t.key,...r}).catch(e=>z(e instanceof Error?e.message:String(e),`error`)).finally(()=>{f.current=!1}))},m=e=>p(e,`mod.press`),h=(e,t)=>p(e,`mod.submit`,{value:t}),g=e=>{let t=Vo(s,u,e);l(t),t&&document.getElementById(XH(t))?.focus()};Az(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);switch(e.key){case`Escape`:case`q`:return V.set(null),!0;case`ArrowDown`:return g(1),!0;case`ArrowUp`:return g(-1),!0;case`Enter`:return e.target instanceof HTMLButtonElement?!1:(u?.kind===`button`&&m(u),!0);default:return!1}});let _=o.length===0?(0,K.jsxs)(`div`,{className:HH,children:[(0,K.jsx)(`p`,{children:t.empty}),(0,K.jsx)(`p`,{className:`text-muted`,children:t.emptyHint})]}):o.map(e=>(0,K.jsxs)(`section`,{className:UH,children:[a.length===0&&(0,K.jsxs)(`header`,{className:`mb-2 text-meta leading-[inherit] text-ink`,children:[e.title,` `,(0,K.jsx)(`span`,{className:`text-muted`,children:e.plugin})]}),(0,K.jsx)(QH,{node:e.tree,pane:e,cursor:u,onPress:m,onSubmit:h,onFocus:l})]},`${e.plugin}/${e.id}`));return n?(0,K.jsx)(tO,{title:a[0]?.title??t.title,note:a[0]?.plugin,rootRef:d,children:_}):(0,K.jsxs)(`div`,{className:`${KB} ${VH}`,tabIndex:0,ref:d,children:[(0,K.jsxs)(`div`,{className:JB,children:[(0,K.jsx)(`h1`,{className:qB,children:t.title}),(0,K.jsx)(`span`,{className:`keys-only touch:empty:hidden! text-muted ${YB(!1)}`,children:t.keys})]}),_]})}var eU=[`ci_failed`,`pr_review_requested`,`issue_opened`,`webhook`,`local`];function tU(e){let t=!!e.schedule,n=nU(e);return t&&n?`hybrid`:n?`event`:`schedule`}function nU(e){return!!(e.eventTriggers&&e.eventTriggers.length>0||e.webhook)}function rU(e){let t=e.filter;if(!t)return e.kind;let n=[];return t.event?n.push(t.action?`${t.event}.${t.action}`:t.event):t.action&&n.push(t.action),t.branch&&n.push(t.branch),n.length>0?`${e.kind} (${n.join(`, `)})`:e.kind}function iU(e){let t=e.eventTriggers?.map(rU)??[];return t.length>0?t.join(`, `):e.webhook?`webhook`:``}function aU(e){return e===`dispatch_failed`||e===`skipped_unavailable`||e===`script_failed`}function oU(e,t){return e.response?`responded`:e.status!==`dispatched`&&e.status!==`revived`||e.deliveryStatus===`quiet`?null:e.deliveryStatus===`missing`?`missing`:e.deliveryStatus===`awaiting`?`awaiting`:t-Date.parse(e.at)>72e5?`missing`:`awaiting`}var sU=6e4,cU=3294,lU=new Map([[`JAN`,1],[`FEB`,2],[`MAR`,3],[`APR`,4],[`MAY`,5],[`JUN`,6],[`JUL`,7],[`AUG`,8],[`SEP`,9],[`OCT`,10],[`NOV`,11],[`DEC`,12]]),uU=new Map([[`SUN`,0],[`MON`,1],[`TUE`,2],[`WED`,3],[`THU`,4],[`FRI`,5],[`SAT`,6]]),dU=256;function fU(e,t,n){let r=e.toUpperCase(),i=t?.get(r);if(i!==void 0)return i;if(!/^\d+$/.test(r))throw Error(`invalid cron ${n}: ${e}`);return Number(r)}function pU(e){let t=new Set;for(let n of e.value.split(`,`)){if(n.length===0)throw Error(`invalid cron ${e.field}: ${e.value}`);let[r,i,...a]=n.split(`/`);if(a.length>0||r===void 0)throw Error(`invalid cron ${e.field}: ${n}`);let o=1;if(i!==void 0&&(!/^\d+$/.test(i)||(o=Number(i),o<1)))throw Error(`invalid cron ${e.field} step: ${n}`);let s,c;if(r===`*`)s=e.min,c=e.max;else if(r.includes(`-`)){let[t,i,...a]=r.split(`-`);if(a.length>0||t===void 0||i===void 0)throw Error(`invalid cron ${e.field} range: ${n}`);s=fU(t,e.names,e.field),c=fU(i,e.names,e.field)}else s=fU(r,e.names,e.field),c=i===void 0?s:e.max;if(s<e.min||c>e.max||s>c)throw Error(`cron ${e.field} out of range: ${n}`);for(let n=s;n<=c;n+=o)t.add(e.normalize?e.normalize(n):n)}return t}function mU(e){if(e.length>dU)throw Error(`cron expression is too long`);let t=e.trim().split(/\s+/).filter(Boolean);if(t.length!==5)throw Error(`cron expression needs 5 fields (minute hour day month weekday), got ${t.length}`);let[n,r,i,a,o]=t;return{minutes:pU({value:n,min:0,max:59,field:`minute`}),hours:pU({value:r,min:0,max:23,field:`hour`}),daysOfMonth:pU({value:i,min:1,max:31,field:`day-of-month`}),months:pU({value:a,min:1,max:12,field:`month`,names:lU}),daysOfWeek:pU({value:o,min:0,max:7,field:`weekday`,names:uU,normalize:e=>e%7}),dayOfMonthRestricted:!i.startsWith(`*`),dayOfWeekRestricted:!o.startsWith(`*`)}}function hU(e){try{return mU(e),!0}catch{return!1}}function gU(e,t,n){return new Date(e.year,e.month-1,e.day,t,n,0,0).getTime()}function _U(e){let t=new Date(e);return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}}function vU(e,t){return _U(new Date(e.year,e.month-1,e.day+t,12,0,0,0).getTime())}function yU(e,t){if(!e.months.has(t.month))return!1;let n=e.daysOfMonth.has(t.day),r=e.daysOfWeek.has(new Date(t.year,t.month-1,t.day).getDay());return e.dayOfMonthRestricted&&e.dayOfWeekRestricted?n||r:n&&r}function bU(e){return e-e%sU}function xU(e,t){return[...e].sort((e,n)=>(e-n)*t)}function SU(e,t){let n=mU(e),r=xU(n.hours,1),i=xU(n.minutes,1),a=new Date(bU(t)+sU),o=_U(a.getTime()),s=a.getHours(),c=a.getMinutes();for(let e=0;e<cU;e++){if(yU(n,o)){for(let e of r)if(!(e<s))for(let n of i){if(e===s&&n<c)continue;let r=gU(o,e,n);if(r>t)return r}}o=vU(o,1),s=0,c=0}throw Error(`cron expression never matches: ${e}`)}var CU=[`minute`,`hour`,`dayOfMonth`,`month`,`dayOfWeek`];function wU(e){let t=e.trim().split(/\s+/).filter(Boolean);return CU.map((e,n)=>t[n]??`*`)}function TU(e){return CU.map((t,n)=>e[n]??`*`).join(` `)}var EU=[`*`,`*/5`,`*/10`,`*/15`,`*/30`,...MU(0,59)],DU=[`*`,`*/2`,`*/3`,`*/4`,`*/6`,`*/12`,...MU(0,23)],OU=[`*`,...MU(1,31)],kU=[`*`,`JAN`,`FEB`,`MAR`,`APR`,`MAY`,`JUN`,`JUL`,`AUG`,`SEP`,`OCT`,`NOV`,`DEC`],AU=[`*`,`MON-FRI`,`SAT,SUN`,`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`,`SUN`],jU=[`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`,`SUN`];function MU(e,t){let n=[];for(let r=e;r<=t;r++)n.push(String(r));return n}var NU={minute:EU,hour:DU,dayOfMonth:OU,month:kU,dayOfWeek:AU};function PU(e,t,n){let r=NU[e],i=r.indexOf(t.trim().toUpperCase());return i<0?(n>0?r[0]:r[r.length-1])??t:r[(i+n+r.length)%r.length]??t}function FU(e,t){return Math.min(Math.max(e+t,0),CU.length-1)}function IU(e,t,n){let r=wU(e);return t<0||t>=CU.length||(r[t]=n),TU(r)}function LU(e,t){let[n,r,i,a,o]=wU(e);if(a!==`*`||i!==`*`||n===void 0||r===void 0||o===void 0)return null;let s=RU(n,r,t);if(!s)return null;let{at:c,bare:l}=s;if(o===`*`)return l?c:t(`automations.schedule.everyDay`,{at:c});if(o===`MON-FRI`)return t(`automations.schedule.weekdays`,{at:c});if(o===`SAT,SUN`)return t(`automations.schedule.weekends`,{at:c});let u=jU.find(e=>e===o.toUpperCase());return u?t(`automations.schedule.onWeekday`,{weekday:t(`automations.schedule.dow.${u}`),at:c}):null}function RU(e,t,n){return t===`*`?e===`*`?{at:n(`automations.schedule.everyMinute`),bare:!0}:e.startsWith(`*/`)?{at:n(`automations.schedule.everyMinutes`,{n:e.slice(2)}),bare:!0}:/^\d+$/.test(e)?{at:n(`automations.schedule.hourlyAt`,{minute:e.padStart(2,`0`)}),bare:!1}:null:t.startsWith(`*/`)&&e===`0`?{at:n(`automations.schedule.everyHours`,{n:t.slice(2)}),bare:!0}:/^\d+$/.test(t)&&/^\d+$/.test(e)?{at:n(`automations.schedule.atClock`,{time:`${t.padStart(2,`0`)}:${e.padStart(2,`0`)}`}),bare:!1}:null}function zU(e,t,n,r){let i=e.trim();if(!hU(i))return{kind:`invalid`};let a;try{a=SU(i,t)}catch{return{kind:`never`}}return{kind:`ok`,nextRunMs:a,relative:BU(a-t,n),absolute:VU(a,t,n,r)}}function BU(e,t){let{minutes:n,hours:r,days:i}=_V(e);return n<60?t(`automations.when.inMinutes`,{n:Math.max(1,n)}):r<24?t(`automations.when.inHours`,{n:r}):t(`automations.when.inDays`,{n:i})}function VU(e,t,n,r){let i=new Date(e),a=`${String(i.getHours()).padStart(2,`0`)}:${String(i.getMinutes()).padStart(2,`0`)}`,o=new Date(t);if(i.getFullYear()===o.getFullYear()&&i.getMonth()===o.getMonth()&&i.getDate()===o.getDate())return a;let s=e-t<5184e5,c=i.toLocaleDateString(r,s?{weekday:`short`}:{weekday:`short`,month:`short`,day:`numeric`});return s?`${c} ${a}`:n(`automations.when.dateTime`,{date:c,time:a})}var HU={name:``,repo:``,prompt:``,triggerMode:`schedule`,schedule:`0 9 * * MON-FRI`,eventKind:`ci_failed`,eventFilter:``};function UU(e){return e.triggerMode===`event`?`event`:`schedule`}function WU(e,t=``){let n=t.trim();if(!n)return{kind:e};let r;if(e===`ci_failed`||e===`pr_review_requested`)r={branch:n};else if(e===`issue_opened`)r={action:n};else if(e===`webhook`){let e=n.indexOf(`.`);r=e>0&&e<n.length-1?{event:n.slice(0,e),action:n.slice(e+1)}:{event:n}}else r={event:n};return{kind:e,filter:r}}function GU(e){let t=UU(e)===`event`?!!(e.eventKind&&eU.includes(e.eventKind)):hU(e.schedule.trim());return e.name.trim().length>0&&(e.repo===null||e.repo.trim().length>0)&&e.prompt.trim().length>0&&(!e.target||e.target.taskId.trim().length>0&&/^tab-[\w-]+$/.test(e.target.tabId))&&t}function KU(e){return e.name.trim().length===0?`name`:e.repo!==null&&e.repo.trim().length===0?`repo`:e.target&&!e.target.taskId.trim()?`target`:e.target&&!/^tab-[\w-]+$/.test(e.target.tabId)?`targetTab`:e.prompt.trim().length===0?`prompt`:UU(e)===`event`?!e.eventKind||!eU.includes(e.eventKind)?`eventKind`:null:hU(e.schedule.trim())?null:`schedule`}function qU(e,t,n){if(e.script||e.target)return null;let r=e.vendor?t(e.vendor):n;return{full:[r,e.model,e.modelEffort].filter(Boolean).join(` · `),short:e.model??r}}function JU(e,t){let n=e.schedule?t?LU(e.schedule,t)??e.schedule:e.schedule:``,r=iU(e);return n&&r?`${n} + ${r}`:r?`on ${r}`:n}function YU(e,t){if(t===`all`)return!0;let n=tU(e);return t===`schedule`?n===`schedule`||n===`hybrid`:n===`event`||n===`hybrid`}function XU(e){return`/hooks/routines/${e}`}G();function ZU(e,t){let n=t?.trim()??``;return n&&e?.effortLevels?.includes(n)?n:``}function QU(e){let{model:t}=e,[n,r]=(0,J.useState)([]),[i,a]=(0,J.useState)({}),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(``),[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(!1),{busy:m,error:h,submit:g}=Ba();(0,J.useEffect)(()=>{Promise.all([t.client.request(`engines.list`),e.current()]).then(([e,t])=>{let n=QN(e.engines,t.engine).filter(e=>e.ready!==!1||e.id===t.engine),i=n.find(e=>e.id===t.engine)??n[0];r(n),a(t),s(i?.id??``),l(ZU(i,t.effort)),d(i?.id===t.engine?t.model??``:``),p(!0)})},[t]);let _=n.find(e=>e.id===o),v=_?.effortLevels??[],y=v.length>0?[``,...v]:[],b=(_?.models??[]).map(e=>e.id).filter(e=>e.toLowerCase().includes(u.trim().toLowerCase())&&e!==u.trim()).slice(0,6),x=e=>{s(e);let t=n.find(t=>t.id===e);l(ZU(t,e===i.engine?i.effort:void 0)),d(e===i.engine?i.model??``:``)},S=e=>{let t=n.findIndex(e=>e.id===o),r=n[Math.max(0,Math.min(n.length-1,t+e))];r&&x(r.id)},C=e=>{if(y.length===0)return;let t=Math.max(0,y.indexOf(c));l(y[Math.max(0,Math.min(y.length-1,t+e))]??``)},w=e=>{let t=e.target instanceof HTMLInputElement;if(e.key===`ArrowUp`&&!t)S(-1);else if(e.key===`ArrowDown`&&!t)S(1);else if((e.key===`ArrowLeft`||e.key===`h`)&&!t)C(-1);else if((e.key===`ArrowRight`||e.key===`l`)&&!t)C(1);else return;e.preventDefault()},T=()=>g(async()=>{if(!_)return;let t=v.length>0?c:void 0,n=_.acceptsModel?u.trim():void 0;(_.id!==i.engine||t!==void 0&&t!==(i.effort??``)||n!==void 0&&n!==(i.model??``))&&await e.onSet({engine:_,...t===void 0?{}:{effort:t},...n===void 0?{}:{model:n}})});return(0,K.jsx)(za,{title:Y(`tasks`,`changeEngine.title`),wide:!0,children:(0,K.jsxs)(`form`,{className:Yi,onKeyDown:w,onSubmit:e=>{e.preventDefault(),T()},children:[(0,K.jsx)(`ul`,{className:Hi,"aria-label":Y(`tasks`,`changeEngine.title`),children:n.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":e.id===o,className:Aa({selected:e.id===o}),onClick:()=>x(e.id),children:[(0,K.jsx)(`span`,{className:`${Pa} text-accent`,children:e.id===o?`●`:` `}),(0,K.jsx)(`span`,{className:ja,children:e.name}),e.id===i.engine&&(0,K.jsx)(`span`,{className:`text-muted`,children:Y(`tasks`,`changeEngine.current`)})]})},e.id))}),f&&_&&_.acceptsModel&&(0,K.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:Y(`tasks`,`engineModel.label`)}),(0,K.jsx)(`input`,{className:ji,spellCheck:!1,placeholder:Y(`tasks`,`engineModel.placeholder`),value:u,onChange:e=>d(e.target.value)}),b.length>0&&(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:b.map(e=>(0,K.jsx)(`button`,{type:`button`,className:Vi(),onClick:()=>d(e),children:e},e))})]}),y.length>0&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:Y(`tasks`,`changeEngine.effortLabel`)}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:y.map(e=>(0,K.jsx)(`button`,{type:`button`,"aria-pressed":e===c,className:Vi(e===c),onClick:()=>l(e),children:e===``?Y(`tasks`,`changeEngine.noEffort`):e},e||`default`))})]}),(0,K.jsx)(`p`,{className:`keys-only ${Si}`,children:(0,K.jsx)(kO,{text:[Y(`tasks`,`changeEngine.footer.engine`),..._?.acceptsModel?[Y(`tasks`,`changeEngine.footer.model`)]:[],...y.length>0?[Y(`tasks`,`changeEngine.footer.effort`)]:[],Y(`tasks`,`changeEngine.footer.set`),Y(`tasks`,`changeEngine.footer.cancel`)].join(` · `)})}),h&&(0,K.jsx)(`p`,{className:`text-error`,children:h}),(0,K.jsx)(Wa,{busy:m||!f,submitLabel:U(`taskops.set`)})]})})}var $U=`flex flex-col overflow-hidden @container`,eW=`mt-2.5 grid min-h-0 flex-1 grid-cols-[minmax(260px,2fr)_minmax(0,3fr)] gap-4 rt-narrow:flex rt-narrow:flex-col rt-narrow:overflow-y-auto`,tW=`flex min-h-0 flex-col gap-3 overflow-y-auto scrollbar-none rt-narrow:shrink-0 rt-narrow:overflow-visible`,nW=`flex gap-1.5 px-2 pt-0 pb-1`,rW=e=>`flex min-w-0 cursor-pointer flex-col gap-0.5 rounded-sm px-2 py-1.5 select-none ${e?`bg-menu`:`hover:bg-hover`}`,iW=`flex min-w-0 items-baseline gap-2.5`,aW=e=>`min-w-0 flex-1 truncate font-bold ${e?`text-muted`:``}`,oW=`whitespace-nowrap text-meta`,sW=`truncate text-meta`,cW=`flex min-h-0 flex-col gap-1.5 overflow-y-auto py-0 pr-0 pl-4 [border-left:var(--hairline)_solid_var(--line)] [&_h2]:m-0 [&_p]:m-0 [&>*]:shrink-0 [&>h2]:mt-2.5 rt-narrow:shrink-0 rt-narrow:overflow-visible rt-narrow:pt-3 rt-narrow:pl-0 rt-narrow:[border-left:none] rt-narrow:[border-top:var(--hairline)_solid_var(--line)]`,lW=`flex flex-wrap items-baseline justify-between gap-3`,uW=`font-sans text-display font-bold normal-nums wrap-anywhere`,dW=`mx-0 mt-1 mb-0 grid grid-cols-[max-content_minmax(0,1fr)] items-baseline gap-x-3.5 gap-y-1 [&_dd]:m-0 [&_dd]:wrap-anywhere [&_dd_.mono]:whitespace-pre`,fW=`max-h-[12lh] overflow-y-auto rounded-sm bg-inset px-2.5 py-2 whitespace-pre-wrap wrap-anywhere`,pW=`min-w-0 text-meta leading-[inherit]`,mW=`flex w-full min-w-0 gap-2 text-inherit`,hW=mW,gW=`${mW} cursor-pointer border-none bg-transparent p-0 text-left font-[inherit] hover:underline`,_W=`min-w-0 flex-1 truncate`,vW=`[&+&]:mt-1.5`,yW=e=>`whitespace-pre-wrap wrap-anywhere text-meta ${e?``:`leading-[inherit]`}`,bW=`text-meta`,xW=`flex gap-4.5`,SW=e=>`flex min-w-[5ch] flex-col gap-0.5 rounded-sm border-hairline px-1.5 py-1 text-left font-mono text-body normal-nums [&>span]:text-meta [&>span]:text-subtle ${e?`border-accent font-bold text-accent`:`border-transparent font-normal`}`,CW=`hidden gap-2 px-1 pt-0.5 pb-1.5 touch:flex`,wW=`h-8 w-11 touch-manipulation rounded-sm border-hairline border-line bg-inset font-mono text-display font-normal normal-nums text-ink`;G(),H();function TW(e){let t=e.client,[n,r]=(0,J.useState)(()=>Hs(t,`pendingStart.list`)?.starts??[]);if((0,J.useEffect)(()=>{let e=!0;return Ws(t,`pendingStart.list`).then(t=>e&&r(t.starts)).catch(()=>void 0),()=>{e=!1}},[t,e.tick]),n.length===0)return null;let i=n.map(e=>e.repo),a=async n=>{try{await t.request(`pendingStart.cancel`,{id:n.id}),r(e=>e.filter(e=>e.id!==n.id)),e.reload()}catch(e){z(xz(U(`pages.laterCancelFailed`),{error:Cz(e)}),`error`)}};return(0,K.jsxs)(`section`,{"data-field":`later`,className:`mt-2.5`,children:[(0,K.jsx)(`h2`,{className:`${Di} ${nW} text-muted`,children:U(`pages.laterStarts`)}),n.map(e=>(0,K.jsxs)(`div`,{className:rW(!1),children:[(0,K.jsxs)(`span`,{className:iW,children:[(0,K.jsx)(`span`,{className:aW(!1),children:e.title}),(0,K.jsx)(`span`,{className:`mono text-muted ${oW}`,title:new Date(e.at).toLocaleString(),children:$F(new Date(e.at))}),(0,K.jsx)(q,{className:`font-mono`,hit:`tight`,onClick:()=>void a(e),children:U(`pages.laterCancel`)})]}),(0,K.jsx)(`span`,{className:`mono text-muted ${sW}`,children:Tz(e.repo,i)}),e.error&&(0,K.jsx)(`span`,{className:`mono text-warning truncate text-meta`,title:e.error,children:xz(U(`pages.laterFailed`),{error:e.error})})]},e.id))]})}function EW({label:e,value:t,picks:n,onPick:r}){return(0,K.jsx)(`fieldset`,{"aria-label":e,className:`m-0 inline-flex min-w-0 flex-wrap gap-0.5 rounded-sm border-hairline border-line bg-inset p-0.5`,children:n.map(e=>{let n=e.value===t;return(0,K.jsx)(`button`,{type:`button`,"aria-pressed":n,className:Tn(`rounded-xs px-2.5 py-1 font-sans text-meta whitespace-nowrap touch:min-h-9`,`focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`,n?`bg-menu text-ink`:`text-muted hover:bg-hover`),onClick:()=>!n&&r(e.value),children:e.label},e.value)})})}G(),H();function DW(e){let{auto:t,common:n}=bz(),r=Sz(),i=W()===`zh`?`zh-CN`:`en-US`,[a,o]=(0,J.useState)(()=>({...HU,repo:e.repos.find(t=>e.defaultRepo&&wz(t)===wz(e.defaultRepo))??e.repos[0]??null})),[s,c]=(0,J.useState)(0),[l,u]=(0,J.useState)(null),d=(0,J.useRef)({}),f=e=>t=>{d.current[e]=t};(0,J.useEffect)(()=>d.current.name?.focus(),[]);let p=e=>{o(t=>({...t,...e})),u(null)};(0,J.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopImmediatePropagation(),ce())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]);let m=UU(a),h=a.eventKind??`ci_failed`,g=e=>{let t=eU[(eU.indexOf(h)+e+eU.length)%eU.length];t&&p({eventKind:t})},_=()=>{if(GU(a)){ce(),e.onSubmit({name:a.name.trim(),repo:a.repo===null?null:a.repo.trim(),prompt:a.prompt.trim(),triggerMode:m,schedule:a.schedule.trim(),eventKind:h,eventFilter:(a.eventFilter??``).trim(),...a.target?{target:a.target}:{}});return}let n=KU(a);n&&(d.current[n]?.focus(),u(Reflect.get(t.missing,n)))},v=a.repo===null?[]:e.tasks.filter(e=>wz(e.repo)===wz(a.repo??``)),y=a.target?v.findIndex(e=>e.id===a.target?.taskId)+1:0,b=e=>{let t=(y+e+v.length+1)%(v.length+1),n=v[t-1];p({target:n?{kind:`existing-tab`,taskId:n.id,tabId:`tab-1`}:void 0})},x=[null,...e.repos],S=e=>{let t=Math.min(Math.max(x.indexOf(a.repo)+e,0),x.length-1),n=x[t];n!==void 0&&p({repo:n,target:void 0})},C=e=>t=>{(t.key===`ArrowUp`||t.key===`ArrowDown`)&&(t.preventDefault(),e(t.key===`ArrowDown`?1:-1))},w=e=>t=>{t.key===`Enter`&&(t.preventDefault(),d.current[e]?.focus())},T=wU(a.schedule),E=e=>{let t=CU[s];t&&p({schedule:IU(a.schedule,s,PU(t,T[s]??`*`,e))})},D=e=>{if(!(e.ctrlKey||e.metaKey||e.altKey)){if(e.key===`ArrowLeft`||e.key===`h`)c(FU(s,-1));else if(e.key===`ArrowRight`||e.key===`l`)c(FU(s,1));else if(e.key===`ArrowUp`||e.key===`ArrowDown`)E(e.key===`ArrowUp`?1:-1);else return;e.preventDefault()}},O=zU(a.schedule,Date.now(),r,i),k=LU(a.schedule,r);return(0,K.jsx)(`div`,{className:Wi,onMouseDown:e=>e.target===e.currentTarget&&ce(),children:(0,K.jsxs)(`dialog`,{open:!0,className:`${Gi(!0)} ${cH}`,"aria-label":t.newTitle,children:[(0,K.jsx)(`h1`,{className:`${Di} text-muted`,children:t.newTitle}),(0,K.jsxs)(`div`,{className:Yi,children:[(0,K.jsxs)(`label`,{className:Li,children:[(0,K.jsx)(`span`,{className:`${Ri}`,children:t.fieldName}),(0,K.jsx)(`input`,{ref:f(`name`),className:ji,spellCheck:!1,placeholder:t.namePlaceholder,value:a.name,onChange:e=>p({name:e.target.value}),onKeyDown:w(`repo`)})]}),(0,K.jsxs)(`div`,{className:Li,children:[(0,K.jsxs)(`span`,{className:`${Ri} ${uH}`,children:[t.fieldRepo,(0,K.jsx)(`span`,{className:`keys-only text-muted ${dH}`,children:`↑/↓`})]}),(0,K.jsx)(xH,{fieldRef:f(`repo`),kind:`list`,label:t.fieldRepo,className:pH,onKeyDown:C(S),children:x.map(t=>(0,K.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-selected":t===a.repo,className:`touch:py-1.5 ${mH(t===a.repo)}`,onClick:()=>{p({repo:t,target:void 0}),d.current.repo?.focus()},children:[t===a.repo?`▸ `:` `,t===null?U(`rail.noProject`):Tz(t,e.repos)]},t??``))})]}),(0,K.jsxs)(`div`,{className:Li,children:[(0,K.jsxs)(`span`,{className:`${Ri} ${uH}`,children:[t.fieldTarget,(0,K.jsx)(`span`,{className:`keys-only text-muted ${dH}`,children:`↑/↓`})]}),(0,K.jsx)(xH,{fieldRef:f(`target`),kind:`list`,label:t.fieldTarget,onKeyDown:C(b),onClick:()=>b(1),children:a.target?v[y-1]?.title??a.target.taskId:t.targetFresh})]}),a.target&&(0,K.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:t.fieldTargetTab}),(0,K.jsx)(`input`,{ref:f(`targetTab`),className:ji,spellCheck:!1,value:a.target.tabId,onChange:e=>a.target&&p({target:{...a.target,tabId:e.target.value}}),onKeyDown:w(`prompt`)})]}),(0,K.jsxs)(`label`,{className:Li,children:[(0,K.jsx)(`span`,{className:`${Ri}`,children:t.fieldPrompt}),(0,K.jsx)(`input`,{ref:f(`prompt`),className:ji,spellCheck:!1,placeholder:t.promptPlaceholder,value:a.prompt,onChange:e=>p({prompt:e.target.value}),onKeyDown:w(m===`event`?`eventKind`:`schedule`)})]}),(0,K.jsxs)(`div`,{className:Li,children:[(0,K.jsx)(`span`,{className:`${Ri}`,children:t.fieldTrigger}),(0,K.jsx)(EW,{label:t.fieldTrigger,value:m,picks:[{value:`schedule`,label:t.triggerSchedule},{value:`event`,label:t.triggerEvent}],onPick:e=>p({triggerMode:e})})]}),m===`schedule`?(0,K.jsxs)(`div`,{className:Li,children:[(0,K.jsxs)(`span`,{className:`${Ri} ${uH}`,children:[t.fieldSchedule,(0,K.jsx)(`span`,{className:`keys-only text-muted ${dH}`,children:`←/→ ↑/↓`})]}),(0,K.jsx)(xH,{fieldRef:f(`schedule`),kind:`cells`,label:t.fieldSchedule,className:xW,onKeyDown:D,children:CU.map((e,n)=>(0,K.jsxs)(`button`,{type:`button`,tabIndex:-1,className:SW(n===s),onClick:()=>{c(n),d.current.schedule?.focus()},children:[T[n]??`*`,(0,K.jsx)(`span`,{children:t.cronField[e]})]},e))}),(0,K.jsx)(`div`,{className:CW,children:[-1,1].map(e=>{let n=t.cronField[CU[s]??`minute`]??``;return(0,K.jsx)(`button`,{type:`button`,tabIndex:-1,className:wW,"aria-label":U(e<0?`pages.cronDown`:`pages.cronUp`,{field:n}),onClick:()=>{E(e),d.current.schedule?.focus()},children:e<0?`−`:`+`},e)})}),O.kind===`ok`?(0,K.jsxs)(`p`,{className:`mono text-success`,children:[k?`${k}, `:``,O.relative,`, `,O.absolute]}):(0,K.jsx)(`p`,{className:`mono text-error`,children:O.kind===`never`?t.cronNever:t.cronInvalid})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:Li,children:[(0,K.jsxs)(`span`,{className:`${Ri} ${uH}`,children:[t.fieldEventKind,(0,K.jsx)(`span`,{className:`keys-only text-muted ${dH}`,children:`↑/↓`})]}),(0,K.jsx)(xH,{fieldRef:f(`eventKind`),kind:`list`,label:t.fieldEventKind,onKeyDown:C(g),onClick:()=>g(1),children:t.eventKind[h]})]}),(0,K.jsxs)(`label`,{className:Li,children:[(0,K.jsx)(`span`,{className:`${Ri}`,children:t.fieldEventFilter}),(0,K.jsx)(`input`,{ref:f(`eventFilter`),className:ji,spellCheck:!1,placeholder:t.eventFilterPlaceholder[h],value:a.eventFilter??``,onChange:e=>p({eventFilter:e.target.value}),onKeyDown:w(`confirm`)})]})]}),l&&(0,K.jsxs)(`p`,{className:`text-error`,children:[`※ `,l]}),(0,K.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${hH}`,children:(0,K.jsx)(kO,{text:fA(t.composerLegend)})}),(0,K.jsxs)(`div`,{className:Mi,children:[(0,K.jsx)(`button`,{type:`button`,className:Oi,onClick:ce,children:n.cancel}),(0,K.jsx)(`button`,{ref:f(`confirm`),type:`button`,className:vi(),onClick:_,children:n.create})]})]})]})})}var OW=[`ok`,`blocked`,`failed`,`skipped`];function kW(e){switch(e.status){case`dispatched`:case`revived`:case`ran`:return`ok`;case`skipped_blocked`:return`blocked`;case`dispatch_failed`:case`skipped_unavailable`:case`script_failed`:return`failed`;default:return`skipped`}}var AW={scheduled:`schedule`,manual:`manual`,webhook:`webhook`,event:`event`};function jW(e){if(e.status===`skipped_precheck`)return e.precheckResult?.durationMs??null;if(e.status===`ran`||e.status===`script_failed`)return null;let t=Date.parse(e.at),n=Date.parse(e.response?.at??``);return Number.isFinite(t)&&Number.isFinite(n)&&n>=t?n-t:null}function MW(e){if(e<1e3)return`${Math.max(0,Math.round(e))}ms`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return n%60==0?`${r}h`:`${r}h ${n%60}m`}function NW(e,t){return e.filter(e=>t===null||kW(e)===t).sort((e,t)=>Date.parse(t.at)-Date.parse(e.at)||t.runNumber-e.runNumber)}function PW(e){let t=e.indexOf(`{`),n=e.lastIndexOf(`}`);if(t<0||n<=t)return null;try{return{prefix:e.slice(0,t).trim(),value:JSON.parse(e.slice(t,n+1))}}catch{return null}}var FW=(e,t)=>e&&typeof e==`object`?Reflect.get(e,t):void 0;function IW(e){let t=PW(e);if(!t)return{summary:e,full:e};let n=FW(t.value,`error`)??t.value,r=FW(n,`message`),i=FW(n,`code`),a=typeof r==`string`?typeof i==`string`?`${i}: ${r}`:r:null,o=t.prefix.replace(/:$/,``);return{summary:a?`${o} — ${a}`:e,full:`${t.prefix}\n${JSON.stringify(t.value,null,2)}`}}function LW(e){let t=e.trim();if(!/^[[{]/.test(t))return e;try{return JSON.stringify(JSON.parse(t),null,2)}catch{return e}}var RW={dispatched:`success`,revived:`success`,skipped_precheck:`muted`,skipped_blocked:`warning`,skipped_cancelled:`muted`,skipped_missed:`warning`,skipped_unavailable:`warning`,dispatch_failed:`error`,ran:`success`,script_failed:`error`},zW={success:`text-success`,muted:`text-muted`,warning:`text-warning`,error:`text-error`},BW={success:`✓`,error:`†`,warning:`!`,muted:`·`},VW=e=>RW[e]??`muted`;function HW(e){let{auto:t}=bz(),{runs:n,when:r}=e,i=e=>t.runStatus[e]??e,a=n.filter(e=>e.response);return(0,K.jsxs)(K.Fragment,{children:[n[0]?.precheckResult&&(0,K.jsx)(UW,{run:n[0]}),(0,K.jsx)(`h2`,{className:`${Di} text-muted`,children:t.responses}),a.length===0?(0,K.jsx)(`p`,{className:`text-muted`,children:t.noResponses}):a.map(e=>(0,K.jsxs)(`div`,{className:vW,children:[(0,K.jsx)(`p`,{className:`mono ${bW} ${zW[VW(e.status)]}`,children:`#${e.runNumber} ${i(e.status)}, ${r(e.response?.at)}`}),(0,K.jsx)(`p`,{className:yW(!1),children:LW(e.response?.text??``)})]},e.id))]})}function UW({run:e}){let{auto:t}=bz(),n=e.precheckResult;if(!n)return null;let r=n.timedOut?t.precheckTimedOut:xz(t.precheckExited,{code:String(n.exitCode??`?`)}),i=[{label:t.precheckStdout,text:n.stdout},{label:t.precheckStderr,text:n.stderr}].filter(e=>e.text.trim().length>0);return(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{className:`${Di} text-muted`,children:xz(t.precheckDetail,{exit:r,duration:String(n.durationMs)})}),i.length===0?(0,K.jsx)(`p`,{className:`text-muted`,children:t.precheckNoOutput}):i.map(e=>(0,K.jsx)(`p`,{className:`mono ${yW(!0)}`,children:`${e.label}: ${e.text.replace(/\s+$/,``).split(`
|
|
204
|
+
`).slice(-10).join(`
|
|
205
|
+
`)}`},e.label))]})}G();var WW=30;function GW(e,t,n){let r=t.join(`\0`),[i,a]=(0,J.useState)(()=>Object.fromEntries(t.map(t=>[t,Hs(e,`routine.runs`,{id:t})?.runs??[]])));return(0,J.useEffect)(()=>{let n=!0;for(let r of t)Ws(e,`routine.runs`,{id:r}).then(e=>n&&a(t=>({...t,[r]:e.runs}))).catch(()=>void 0);return()=>{n=!1}},[e,r,n]),i}function KW(){W();let{auto:e}=bz();return t=>{if(t.status===`skipped_blocked`){let e=t.blocked?.reason;return e?xz(U(`runLog.blockedRun`),{reason:U(`runLog.blocked.${e}`)}):U(`runLog.outcome.blocked`)}return e.runStatus[t.status]??t.status}}function qW(e){W();let{auto:t}=bz(),[n,r]=(0,J.useState)(null),i=NW(e.runs,n),a=KW(),o=(e,t,n,r)=>(0,K.jsx)(q,{variant:`pill`,hit:`tight`,"aria-current":t,className:`max-w-40 truncate`,onClick:n,children:`[ ${e} ]`},r);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`h2`,{className:`${Di} text-muted`,children:U(`runLog.title`)}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:[o(U(`runLog.all`),n===null,()=>r(null),`all`),OW.map(e=>o(U(`runLog.outcome.${e}`),n===e,()=>r(e),e))]}),i.length===0?(0,K.jsx)(`p`,{className:`text-muted`,children:e.runs.length===0?t.noRuns:U(`runLog.empty`)}):i.slice(0,WW).map(n=>{let r=VW(n.status),i=oU(n,e.now),o=i===`awaiting`?`, ${t.responseAwaiting}`:i===`missing`?`, ${t.responseMissing}`:``,s=jW(n),c=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{children:BW[r]}),(0,K.jsx)(`span`,{children:`#${n.runNumber}`}),(0,K.jsx)(`span`,{className:_W,title:n.event,children:`${a(n)}${n.tabId?`, ${n.tabId}`:``}${n.event?` · ${n.event}`:``}${o}`}),(0,K.jsx)(`span`,{className:`text-subtle`,children:U(`runLog.source.${AW[n.trigger]}`)}),s!==null&&(0,K.jsx)(`span`,{className:`text-muted`,children:MW(s)}),(0,K.jsx)(`span`,{className:`text-muted`,children:e.when(n.at)})]}),l=n.error?IW(n.error):null,u=n.taskId,d=i===`missing`?`text-warning`:zW[r];return(0,K.jsxs)(`div`,{className:`${pW} ${d}`,children:[u?(0,K.jsx)(`button`,{type:`button`,className:`mono ${gW}`,onClick:()=>e.openRun(u),children:c}):(0,K.jsx)(`span`,{className:`mono ${hW}`,children:c}),l&&(0,K.jsxs)(`details`,{className:`mono pl-[calc(2ch+16px)] [&_summary]:cursor-pointer [&_summary]:list-none [&_summary]:truncate [&_summary::-webkit-details-marker]:hidden [&[open]_summary]:whitespace-normal [&_pre]:mx-0 [&_pre]:mt-1 [&_pre]:mb-1.5 [&_pre]:max-h-[16lh] [&_pre]:overflow-auto [&_pre]:rounded-sm [&_pre]:bg-inset [&_pre]:px-2 [&_pre]:py-1.5 [&_pre]:whitespace-pre-wrap [&_pre]:wrap-anywhere [&_pre]:text-muted`,children:[(0,K.jsx)(`summary`,{children:l.summary}),(0,K.jsx)(`pre`,{children:l.full})]})]},n.id)}),i.length>WW&&(0,K.jsx)(`p`,{className:`text-muted`,children:U(`runLog.more`,{count:i.length-WW})})]})}G();function JW(e){let{auto:t}=bz(),n=Sz(),r=W()===`zh`?`zh-CN`:`en-US`,{routine:i,busy:a,when:o}=e,s=tU(i),c=i.schedule?LU(i.schedule,n):null,l=i.nextRunAt?Date.parse(i.nextRunAt):NaN,u=iU(i),d=s===`hybrid`?t.triggerHybrid:s===`event`?t.triggerEvent:t.triggerSchedule;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:lW,children:[(0,K.jsx)(`h2`,{className:uW,children:i.name}),(0,K.jsxs)(`span`,{className:`mono ${XB}`,children:[(0,K.jsx)(`button`,{type:`button`,className:`${Oi} ${ZB.row}`,disabled:a,onClick:e.onRunNow,children:t.runNow}),(0,K.jsx)(`button`,{type:`button`,className:`${Oi} ${ZB.row}`,disabled:a,onClick:e.onToggle,children:U(i.enabled?`pages.routinePause`:`pages.routineEnable`)}),(0,K.jsx)(`button`,{type:`button`,className:`${Oi} ${ZB.row}`,disabled:a,onClick:e.onDelete,children:U(`pages.delete`)})]})]}),(0,K.jsxs)(`dl`,{className:dW,children:[(0,K.jsx)(`dt`,{className:`text-muted`,children:U(`pages.routineTrigger`)}),(0,K.jsx)(`dd`,{children:d}),i.schedule&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`dt`,{className:`text-muted`,children:U(`pages.routineSchedule`)}),(0,K.jsxs)(`dd`,{children:[c??(0,K.jsx)(`span`,{className:`mono`,children:i.schedule}),c&&(0,K.jsx)(`span`,{className:`mono text-muted`,children:` ${i.schedule}`})]}),(0,K.jsx)(`dt`,{className:`text-muted`,children:U(`pages.routineNext`)}),(0,K.jsx)(`dd`,{className:i.enabled?``:`text-warning`,children:i.enabled?Number.isFinite(l)?`${o(i.nextRunAt)} · ${new Date(l).toLocaleString(r,{weekday:`short`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}`:`—`:t.paused})]}),u&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`dt`,{className:`text-muted`,children:U(`pages.routineEvents`)}),(0,K.jsx)(`dd`,{className:`mono`,children:u})]}),i.webhook&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`dt`,{className:`text-muted`,children:U(`pages.routineWebhook`)}),(0,K.jsx)(`dd`,{className:`mono`,children:XU(i.id)})]}),(0,K.jsx)(`dt`,{className:`text-muted`,children:U(`pages.routineProject`)}),(0,K.jsx)(`dd`,{children:e.project}),!i.script&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`dt`,{className:`text-muted`,children:U(`pages.routineDelivers`)}),(0,K.jsx)(`dd`,{children:i.target?xz(t.targetExisting,{task:e.targetTitle??i.target.taskId,tab:i.target.tabId}):i.persistentSession?i.newConversation?t.targetStandingNew:t.targetStanding:t.targetFresh})]}),e.engine&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`dt`,{className:`text-muted`,children:U(`pages.routineEngine`)}),(0,K.jsxs)(`dd`,{className:`flex flex-wrap items-baseline gap-x-3.5`,children:[(0,K.jsx)(`span`,{children:e.engine}),(0,K.jsx)(q,{className:`font-mono`,hit:`tight`,disabled:a,onClick:e.onChangeEngine,children:U(`pages.routineChangeEngine`)})]})]})]}),i.precheck&&(0,K.jsx)(`p`,{className:`mono text-muted`,children:xz(t.precheck,{command:i.precheck.command})}),i.script?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`h2`,{className:`${Di} text-muted`,children:U(`pages.routineScript`)}),(0,K.jsx)(`p`,{className:`mono ${fW}`,children:i.script.command})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`h2`,{className:`${Di} text-muted`,children:U(`pages.routinePrompt`)}),(0,K.jsx)(`p`,{className:fW,children:i.prompt})]}),(0,K.jsx)(qW,{runs:e.runs,now:e.now,when:o,openRun:e.openRun}),(0,K.jsx)(HW,{runs:e.runs,when:o})]})}function YW(e,t){let n=e?.lastRunStatus?.[t];return n!==void 0&&aU(n)}function XW(e,t){return e===`dispatch_failed`||e===`script_failed`?`error`:e!==void 0&&aU(e)?`waiting`:!t||e===void 0||e.startsWith(`skipped_`)?`idle`:`done`}function ZW(e,t){return n=>{let r=n?Date.parse(n):NaN;if(!Number.isFinite(r))return`—`;let i=r-t,a=i>=0,o=Math.floor(Math.abs(i)/6e4),s=Math.floor(o/60);return o<1?a?e.now:e.justNow:o<60?xz(a?e.inMinutes:e.minutesAgo,{n:o}):s<24?xz(a?e.inHours:e.hoursAgo,{n:s}):new Date(r).toLocaleDateString()}}function QW(){return(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`block size-4.5 flex-none translate-y-px fill-none stroke-current text-muted [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.3]`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:`M3 3.5h10a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1zM4.5 6.5 6.5 8l-2 1.5M8 10h3`})})}var $W=`relative flex min-h-15 w-full items-center gap-3 rounded-sm px-3 py-2 text-left active:not-has-[[data-pr-chip]:active]:bg-hover focus-visible:bg-hover focus-visible:outline-none [&>svg]:translate-y-0`,eG=`pointer-events-none absolute inset-0 rounded-[inherit] bg-hover animate-[fade-out_560ms_ease-in_forwards] motion-reduce:hidden`,tG=`flex min-w-0 items-center gap-1.5 font-mono text-[13px] leading-[1.3] text-muted empty:hidden`;function nG(e){let{lead:t,mark:n,title:r,dim:i,flash:a,line2:o,trail:s,status:c,...l}=e;return(0,K.jsxs)(`button`,{type:`button`,className:`${$W} hover:bg-hover data-menu-open:bg-hover`,"data-phone-row":!0,...l,children:[!!a&&(0,K.jsx)(`span`,{className:eG,"aria-hidden":`true`,"data-row-flash":!0},a),t,n,(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,K.jsx)(`span`,{className:`row-title truncate font-sans text-title ${i?`text-muted`:`text-ink`}`,children:r}),(0,K.jsx)(`span`,{className:tG,children:o})]}),s,c]})}var rG=`flex min-h-11 min-w-0 flex-1 cursor-pointer items-center gap-1.5 border-none bg-transparent p-0 text-left text-inherit [font:inherit] hover:text-ink`;function iG(e){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{type:`button`,className:rG,"aria-expanded":!e.collapsed,"aria-label":e.foldLabel,onClick:e.onToggle,children:[(0,K.jsx)(`span`,{className:`truncate tracking-[0.06em] uppercase`,children:e.label}),e.collapsed&&(0,K.jsx)(tI,{right:!0})]}),e.add&&(0,K.jsx)(`button`,{type:`button`,className:`-mr-2 grid size-11 flex-none cursor-pointer place-items-center border-none bg-transparent font-sans text-display text-muted hover:text-ink active:text-ink`,"aria-label":e.add.label,"data-group-add":!0,onClick:e.add.onClick,children:`+`})]})}var aG=`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`;function oG(e){return(0,K.jsxs)(ya,{size:`nav`,kind:`routines`,label:e.label,onClick:e.onClick,children:[(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`size-5.5 fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.6]`,"aria-hidden":`true`,children:[(0,K.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,K.jsx)(`path`,{d:`M12 6v6l4 2`})]}),e.count>0&&(0,K.jsx)(wa,{count:e.count})]})}function sG(e){return(0,K.jsx)(ya,{size:`nav`,kind:`extensions`,label:e.label,onClick:e.onClick,children:(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`size-5.5 fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.6]`,"aria-hidden":`true`,children:[(0,K.jsx)(`path`,{d:aG}),(0,K.jsx)(`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`})]})})}G();var cG=20,lG=`m-0 px-3 py-2.5 text-body whitespace-pre-wrap wrap-anywhere text-ink`;function uG(e){let{auto:t}=bz(),n=Sz(),r=W()===`zh`?`zh-CN`:`en-US`,i=KW(),[a,o]=(0,J.useState)(`all`),[s,c]=(0,J.useState)(!1),{routine:l,runs:u,busy:d,when:f}=e,p=tU(l),m=iU(l),h=p===`hybrid`?t.triggerHybrid:p===`event`?t.triggerEvent:t.triggerSchedule,g=l.nextRunAt?Date.parse(l.nextRunAt):NaN,_=NW(u,a===`all`?null:a),v=NW(u,null)[0],y=u.filter(e=>e.response);return(0,K.jsx)(gO,{label:l.name,title:l.name,onClose:e.onClose,children:()=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`${lO} gap-4 pt-1 pb-3`,"data-routine-sheet":!0,children:[(0,K.jsxs)(jD,{inset:!0,children:[(0,K.jsx)(PD,{label:U(`pages.routineTrigger`),children:h}),l.schedule&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(PD,{label:U(`pages.routineSchedule`),children:LU(l.schedule,n)??(0,K.jsx)(`span`,{className:`font-mono`,children:l.schedule})}),(0,K.jsx)(PD,{label:U(`pages.routineNext`),children:l.enabled?Number.isFinite(g)?`${f(l.nextRunAt)} · ${new Date(g).toLocaleString(r,{weekday:`short`,hour:`2-digit`,minute:`2-digit`})}`:`—`:t.paused})]}),m&&(0,K.jsx)(PD,{label:U(`pages.routineEvents`),children:(0,K.jsx)(`span`,{className:`font-mono`,children:m})}),l.webhook&&(0,K.jsx)(PD,{label:U(`pages.routineWebhook`),children:(0,K.jsx)(`span`,{className:`font-mono`,children:XU(l.id)})}),e.engine&&(0,K.jsx)(PD,{label:U(`pages.routineEngine`),children:e.engine}),(0,K.jsx)(PD,{label:U(`pages.routineProject`),children:e.project}),!l.script&&(0,K.jsx)(PD,{label:U(`pages.routineDelivers`),children:l.target?xz(t.targetExisting,{task:e.targetTitle??l.target.taskId,tab:l.target.tabId}):l.persistentSession?l.newConversation?t.targetStandingNew:t.targetStanding:t.targetFresh}),(0,K.jsx)(PD,{label:U(`pages.phone.lastRun`),children:v?`${i(v)} · ${f(v.at)}`:t.noRuns})]}),(0,K.jsxs)(jD,{inset:!0,label:U(l.script?`pages.phone.script`:`pages.phone.prompt`),children:[(0,K.jsx)(`p`,{className:`${lG} ${l.script?`font-mono`:`font-sans`}`,children:l.script?l.script.command:l.prompt}),l.precheck&&(0,K.jsx)(PD,{label:U(`pages.phone.precheck`),children:(0,K.jsx)(`span`,{className:`font-mono`,children:l.precheck.command})})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(`p`,{className:`m-0 px-3 font-mono text-meta text-subtle`,children:U(`runLog.title`)}),(0,K.jsx)(EW,{label:U(`runLog.title`),value:a,picks:[{value:`all`,label:U(`runLog.all`)},...OW.map(e=>({value:e,label:U(`runLog.outcome.${e}`)}))],onPick:o}),_.length===0?(0,K.jsx)(`p`,{className:`m-0 px-3 font-sans text-body text-muted`,children:u.length===0?t.noRuns:U(`runLog.empty`)}):(0,K.jsx)(jD,{inset:!0,children:_.slice(0,cG).map(t=>(0,K.jsx)(dG,{run:t,status:i(t),now:e.now,when:f,open:e.openRun},t.id))}),_.length>cG&&(0,K.jsx)(`p`,{className:`m-0 px-3 font-sans text-meta text-muted`,children:U(`runLog.more`,{count:_.length-cG})})]}),(0,K.jsx)(jD,{inset:!0,label:U(`pages.phone.responses`),children:y.length===0?(0,K.jsx)(`p`,{className:`${lG} font-sans text-muted`,children:U(`pages.phone.noResponses`)}):y.map(e=>(0,K.jsxs)(`div`,{className:`flex flex-col gap-1 px-3 py-2.5`,children:[(0,K.jsx)(`span`,{className:`font-mono text-meta text-muted`,children:`#${e.runNumber} · ${f(e.response?.at)}`}),(0,K.jsx)(`p`,{className:`m-0 font-sans text-body whitespace-pre-wrap wrap-anywhere text-ink`,children:LW(e.response?.text??``)})]},e.id))})]}),(0,K.jsx)(`div`,{className:`flex flex-none px-3 pt-2`,children:(0,K.jsx)(ND,{actions:[{label:U(`pages.phone.more`),glyph:`⋯`,onClick:()=>c(!0)},{label:U(l.enabled?`pages.phone.pause`:`pages.phone.enable`),disabled:d,onClick:e.onToggle},{label:U(`pages.phone.runNow`),tone:`accent`,disabled:d,onClick:e.onRunNow}]})}),s&&(0,K.jsx)(gO,{label:U(`pages.phone.more`),onClose:()=>c(!1),children:t=>(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-y-auto px-3 pb-1`,children:[e.engine&&(0,K.jsx)(_O,{onClick:()=>{e.onClose(),e.onChangeEngine()},children:U(`pages.phone.changeEngine`)}),e.engine&&(0,K.jsx)(`hr`,{className:`mx-2 my-1 h-px flex-none border-none bg-line`}),(0,K.jsx)(_O,{tone:`danger`,"data-routine-delete":!0,onClick:()=>{e.onClose(),e.onDelete()},children:U(`pages.phone.deleteRoutine`)}),(0,K.jsx)(_O,{tone:`cancel`,onClick:t,children:U(`menu.cancel`)})]})})]})})}function dG(e){let{auto:t}=bz(),{run:n}=e,r=oU(n,e.now),i=jW(n),a=n.taskId,o=[e.when(n.at),U(`runLog.source.${AW[n.trigger]}`),i===null?null:MW(i),r===`awaiting`?t.responseAwaiting:r===`missing`?t.responseMissing:null,n.error?IW(n.error).summary:null];return(0,K.jsx)(nG,{mark:null,title:`#${n.runNumber} ${e.status}`,line2:(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:o.filter(Boolean).join(` · `)}),status:(0,K.jsx)(aF,{look:XW(n.status,!0)}),disabled:!a,onClick:()=>a&&e.open(a)})}G();function fG(e){let{auto:t}=bz();return(0,K.jsxs)(`div`,{className:tW,ref:e.listRef,children:[e.header,e.sections.map(n=>n.rows.length===0?null:(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`h2`,{className:`${Di} ${nW} ${n===e.sections[0]?`text-error`:`text-muted`}`,children:U(n.key)}),n.rows.map(n=>{let r=e.rows.indexOf(n),i=e.lastRunStatus[n.id],a=i?VW(i):null,o=e.lastFailure[n.id];return(0,K.jsxs)(`div`,{"data-row":r,className:rW(r===e.cursor),onClick:()=>e.onPick(r),children:[(0,K.jsxs)(`span`,{className:iW,children:[(0,K.jsx)(`span`,{className:aW(!n.enabled),children:n.name}),(0,K.jsx)(`span`,{className:`mono text-muted ${oW}`,children:e.timingLabel(n)}),(0,K.jsx)(`span`,{className:`mono ${a?zW[a]:`text-muted`}`,style:{width:`1ch`},children:a?BW[a]:` `})]}),(0,K.jsx)(`span`,{className:`mono text-muted ${sW}`,title:n.schedule??e.triggerSub(n),children:[e.repoName(n.repo),e.triggerSub(n),e.engineShort(n)].filter(Boolean).join(` · `)}),o?(0,K.jsx)(`span`,{className:`mono text-warning ${sW}`,title:o.reason,children:xz(t.lastFailed,{when:e.when(o.at),reason:o.reason})}):null]},n.id)})]},n.key))]})}G();function pG(e){return(0,K.jsx)(K.Fragment,{children:e.sections.map(t=>t.rows.length===0?null:(0,K.jsx)(jD,{label:U(t.key),children:t.rows.map(t=>{let n=e.lastRunStatus[t.id];return(0,K.jsx)(nG,{"data-routine":t.id,mark:t.script?(0,K.jsx)(QW,{}):(0,K.jsx)(VF,{icon:e.icons.get(t.vendor??``),name:e.engine(t)}),title:t.name,dim:!t.enabled,line2:(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:e.line2(t)}),status:(0,K.jsx)(aF,{look:XW(n,t.enabled)}),onClick:()=>e.onPick(t)},t.id)})},t.key))})}G(),He(),A(),H();var mG=5e3;function hG({model:e}){let{auto:t,common:n,nav:r}=bz(),i=ke(),a=yz(e),o=e.client,[s,c]=kz(mG),l=k(e.tasks),u=Dz(e),d=Oz(e),[f,p]=(0,J.useState)(()=>Hs(o,`routine.list`)??null),[m,h]=(0,J.useState)(`all`),[g,_]=(0,J.useState)(null),[v,y]=(0,J.useState)(null),[b,x]=(0,J.useState)(null),S=jz(),C=Sz(),w=(0,J.useRef)(null);(0,J.useEffect)(()=>{let e=!0;return Ws(o,`routine.list`).then(t=>e&&p(t)).catch(()=>e&&p(e=>e??{automations:[],keepsDaemonAlive:!1})),()=>{e=!1}},[o,s]);let[T,E]=(0,J.useState)(()=>Hs(o,`engines.list`)?.engines??[]);(0,J.useEffect)(()=>o.onOpen(()=>{Ws(o,`engines.list`).then(e=>E(e.engines)).catch(()=>{})}),[o]);let D=f?.automations??[],O=D.filter(e=>YU(e,m)),ee=f?.lastRunStatus??{},A=f?.lastFailure??{},j=e=>YW(f,e.id),M=[{key:`pages.routinesNeedYou`,rows:O.filter(j)},{key:`pages.routinesActive`,rows:O.filter(e=>e.enabled&&!j(e))},{key:`pages.routinesPaused`,rows:O.filter(e=>!e.enabled&&!j(e))}],N=M.flatMap(e=>e.rows),P=Math.max(0,N.findIndex(e=>e.id===g)),F=N[P],I=e=>_(N[e]?.id??null),L=M[0]?.rows.length??0,R=k(he);(0,J.useEffect)(()=>{R===null||!f||(f.automations.some(e=>e.id===R)&&_(R),he.set(null))},[R,f]);let te=GW(o,F?[F.id]:[],s),[ne,re]=(0,J.useState)(!1),ie=F?te[F.id]??[]:[];(0,J.useEffect)(()=>x(null),[F?.id]);let ae=(0,J.useRef)(null),[oe,se]=(0,J.useState)(0),ce=(0,J.useRef)(0);(0,J.useEffect)(()=>{let e=w.current,t=oe!==ce.current;if(ce.current=oe,t&&e&&ae.current&&e.offsetTop>ae.current.offsetTop){e.scrollIntoView({block:`start`,behavior:`smooth`});return}ae.current?.querySelector(`[data-row="${P}"]`)?.scrollIntoView({block:`nearest`})},[P,oe]);let le=Date.now(),ue=ZW(t.when,le),de=e=>l?.tasks.find(t=>t.id===e)?.label??e,fe=t=>{V.set(null),e.select(t)},pe=(e,t,n)=>z(xz(e,{name:t,error:Cz(n)}),`error`),me=async()=>{if(!(!F||v)){y(F.id);try{await o.request(`routine.setEnabled`,{id:F.id,enabled:!F.enabled}),c()}catch(e){pe(F.enabled?t.disableFailed:t.enableFailed,F.name,e)}finally{y(null)}}},ge=async()=>{if(!(!F||v)){y(F.id),x(xz(t.running,{name:F.name}));try{let e=await o.request(`routine.runNow`,{id:F.id});x(xz(t.ranWith,{name:F.name,status:e.status})),c()}catch(e){pe(t.runFailed,F.name,e)}finally{y(null)}}},_e=async()=>{if(v)return;let e=Ez(await o.request(`repos.list`).then(e=>e.repos).catch(()=>[]),u);B.set((0,K.jsx)(DW,{repos:e,tasks:(l?.tasks??[]).filter(e=>!e.deleting).map(e=>({id:e.id,title:e.label,repo:e.repo})),defaultRepo:d,onSubmit:e=>{(async()=>{y(`new`);try{let t=UU(e)===`event`?WU(e.eventKind??`ci_failed`,e.eventFilter):null;await o.request(`routine.create`,{...e.repo===null?{}:{repo:e.repo},name:e.name,prompt:e.prompt,...t?{event:t.kind,...t.filter?.branch?{eventBranch:t.filter.branch}:{},...t.filter?.event?{eventName:t.filter.event}:{},...t.filter?.action?{eventAction:t.filter.action}:{}}:{schedule:e.schedule},...e.target?{targetTask:e.target.taskId,targetTab:e.target.tabId}:{}}),c()}catch(e){z(xz(t.createFailed,{error:Cz(e)}),`error`)}finally{y(null)}})()}}))},ve=()=>{if(!F||v)return;let e=F;B.set((0,K.jsx)(Ha,{title:t.deleteTitle,body:xz(t.deleteBody,{name:e.name}),confirmLabel:t.deleteButton,onConfirm:async()=>{y(e.id);try{await o.request(`routine.delete`,{id:e.id}),c()}catch(n){pe(t.deleteFailed,e.name,n)}finally{y(null)}}}))};Az(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);switch(e.key){case`Escape`:case`q`:return V.set(null),!0;case`j`:case`ArrowDown`:return I(Math.min(N.length-1,P+1)),!0;case`k`:case`ArrowUp`:return I(Math.max(0,P-1)),!0;case`n`:return _e(),!0;case`r`:return c(),!0;case`e`:return me(),!0;case`s`:return ge(),!0;case`d`:return ve(),!0;case`Enter`:{let e=ie[0]?.taskId;return e?fe(e):ie.length>0&&x(t.latestRunNoTask),!0}default:return!1}});let ye=e=>qU(e,e=>T.find(t=>t.id===e)?.name??e,t.engineDefault),be=()=>{if(!F)return;let n=F;B.set((0,K.jsx)(QU,{model:e,current:async()=>({engine:n.vendor,effort:n.modelEffort,model:n.model}),onSet:async e=>{let r=await o.request(`routine.setEngine`,{id:n.id,engine:e.engine.id,model:e.model??``,effort:e.effort??``});x(xz(r.releasedSessionTaskId?t.engineChangedNewSession:t.engineChanged,{name:n.name,engine:[e.engine.name,e.model,e.effort].filter(Boolean).join(` · `)})),c()}}))},xe=e=>e===void 0?U(`rail.noProject`):Tz(e,D.flatMap(e=>e.repo??[])),Se=F&&{routine:F,runs:ie,busy:v===F.id,project:xe(F.repo),engine:ye(F)?.full??null,targetTitle:F.target?de(F.target.taskId):void 0,now:le,when:ue,openRun:fe,onRunNow:()=>void ge(),onToggle:()=>void me(),onDelete:ve,onChangeEngine:be},Ce=Se&&(0,K.jsx)(JW,{...Se}),we=e=>JU(e,C),Te=e=>e.enabled?e.nextRunAt?ue(e.nextRunAt):t.eventModeBadge:t.paused,H=D.length>0&&(0,K.jsx)(EW,{label:U(`pages.routinesFilter`),value:m,picks:[{value:`all`,label:U(`pages.routinesFilterAll`)},{value:`schedule`,label:U(`pages.routinesFilterSchedule`)},{value:`event`,label:U(`pages.routinesFilterEvent`)}],onPick:h}),Ee=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(TW,{client:o,tick:s,reload:c}),f===null?(0,K.jsx)(`p`,{className:`text-muted`,children:n.loading}):D.length===0?(0,K.jsxs)(`div`,{className:QB,children:[(0,K.jsx)(`p`,{className:`text-muted`,children:t.empty}),(0,K.jsx)(`p`,{className:`keys-only`,children:t.emptyHint})]}):i?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`mb-2`,children:H}),(0,K.jsx)(pG,{sections:M,lastRunStatus:ee,icons:a,line2:e=>`${we(e)} · ${Te(e)}`,engine:e=>ye(e)?.short,onPick:e=>{_(e.id),re(!0)}})]}):(0,K.jsxs)(`div`,{className:eW,children:[(0,K.jsx)(fG,{listRef:ae,header:H,sections:M,rows:N,cursor:P,lastRunStatus:ee,lastFailure:A,repoName:xe,triggerSub:we,timingLabel:Te,engineShort:e=>ye(e)?.short,when:ue,onPick:e=>{I(e),se(e=>e+1)}}),(0,K.jsx)(`div`,{className:cW,ref:w,children:Ce??(0,K.jsx)(`p`,{className:`text-muted`,children:t.noSelection})})]}),b&&(0,K.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:b})]});return i?(0,K.jsxs)(tO,{title:r.automations,rootRef:S,note:`${L>0?xz(t.needAttention,{count:String(L),total:String(N.length)}):``} ${f?.keepsDaemonAlive?t.holdingDaemon:t.notHolding}`.trim(),primary:{label:U(`pages.newRoutine`),onClick:()=>void _e()},children:[Ee,ne&&Se&&(0,K.jsx)(uG,{...Se,onClose:()=>re(!1)})]}):(0,K.jsxs)(`div`,{className:`${GB} ${$U}`,tabIndex:0,ref:S,children:[(0,K.jsxs)(`div`,{className:JB,children:[(0,K.jsx)(`h1`,{className:qB,children:t.title}),(0,K.jsxs)(`span`,{className:`mono ${XB}`,children:[L>0&&(0,K.jsx)(`span`,{className:`text-error`,children:xz(t.needAttention,{count:String(L),total:String(N.length)})}),(0,K.jsx)(`span`,{className:`text-muted`,children:f?.keepsDaemonAlive?t.holdingDaemon:t.notHolding}),(0,K.jsx)(`button`,{type:`button`,className:`${Oi} ${ZB.header}`,onClick:()=>void _e(),children:U(`pages.new`)})]})]}),Ee]})}xb(),A();var gG=[`project`,`state`],_G=`rove.railGroup`,vG=O(gG.find(e=>e===localStorage.getItem(_G))??`project`);function yG(e){e!==vG.get()&&(vG.set(e),localStorage.setItem(_G,e))}yb.subscribe(()=>{let{loaded:e,prefs:t}=yb.get();e&&gG.includes(t.railGroup)&&yG(t.railGroup)});function bG(e){yG(e),mb(`railGroup`,e)}xb(),A();var xG=`rove.activeSortMode`;function SG(){let e=localStorage.getItem(xG);return is.find(t=>t===e)??`recent`}var CG=O(SG());function wG(e){e!==CG.get()&&(CG.set(e),localStorage.setItem(xG,e))}yb.subscribe(()=>{let{loaded:e,prefs:t}=yb.get();e&&is.includes(t.railSort)&&wG(t.railSort)});function TG(e){wG(e),mb(`railSort`,e)}function EG(){TG(is[(is.indexOf(CG.get())+1)%is.length]??`default`)}A(),H();var DG=O(!1);function OG(e){e&&(CG.get()!=="default"||vG.get()===`state`)&&(TG(`default`),bG(`project`),z(Y(`tasks`,`sort.reorderSwitched`))),DG.set(e)}async function kG(e,t,n){let r=n<0?`up`:`down`;try{await e.client.request(`task.move`,{taskId:t.task.id,direction:r})}catch(e){z(Y(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}async function AG(e,t,n){let r=n<0?`up`:`down`;try{for(let i=0;i<Math.abs(n);i++)await e.client.request(`task.move`,{taskId:t,direction:r})}catch(e){z(Y(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}var jG=new Map(hc.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint?{...e.hint}:void 0}]));function MG(){return hc.map(e=>{let t=jG.get(e.id);return{id:e.id,scope:e.scope,category:e.category,...e.bareKeys?{bareKeys:!0}:{},keys:[...t?.keys??[]],...t?.prefixKeys?{prefixKeys:[...t.prefixKeys]}:{},...t?.hint?{hint:{...t.hint}}:{}}})}var NG=new Map(hc.map(e=>[e.id,e]));function PG(e){return NG.get(e)}function FG(e){let t=[],n=new Map;for(let r of e){let e=n.get(r.category);e||(e=[],n.set(r.category,e),t.push({category:r.category,rows:e})),e.push(r)}return t}function IG(e){return e.hint?.keys??e.keys[0]}function LG(e){let t=PG(e);if(!t)return null;let n=IG(t);return n&&n.length>0?n:null}function RG(e){return e.keys.length>0?e.hint?.keys??e.keys[0]??null:e.prefixKeys?.length?null:e.hint?.keys??null}function zG(e,t){return e.scope===`global`?!0:t===null?!1:e.scope===t||t===`terminal`&&e.scope===`workspace`}function BG(e,t,n,r){let i=[],a=[],o=[],s=new Map;for(let c of e){let e=RG(c),l=zG(c,t),u=r?r.direct.has(c.id):l,d=r?r.prefix.has(c.id):l;if(e){let t={binding:c,primary:e,aliases:c.keys.filter(t=>t!==e)};if(u&&(l||c.presentation===`onePress`))c.presentation===`onePress`?a.push(t):i.push(t);else if(!l&&c.scope!==`global`){let e=s.get(c.scope);e?e.push(t):s.set(c.scope,[t])}}n&&d&&c.prefixKeys?.length&&o.push({binding:c,primary:`${n} + ${c.prefixKeys[0]}`,aliases:c.prefixKeys.slice(1).map(e=>`${n} + ${e}`)})}let c=[];i.length&&c.push({kind:`here`,scope:t??void 0,rows:i}),a.length&&c.push({kind:`direct`,rows:a}),o.length&&c.push({kind:`prefix`,rows:o});for(let[e,t]of s)c.push({kind:`other`,scope:e,rows:t});return c}var VG={global:`Global`,sidebar:`Sidebar`,workspace:`Workspace`,files:`Files`,inbox:`Inbox`,terminal:`Terminal`};function HG(e){return e?VG[e]:`Global`}function UG(e){return[`kanban.open`,`automations.open`,`workItems.open`].includes(e)?`Views`:e.startsWith(`focus.`)?`Navigation`:e.startsWith(`inbox.`)||e.startsWith(`attention.`)?`Attention`:e.startsWith(`chat.tab.`)||e.startsWith(`chat.session.`)?`Sessions`:e.startsWith(`chat.fork.`)||e.startsWith(`task.`)?`Tasks`:e.startsWith(`settings.`)||e===`workspace.filesToggle`?`Tools`:PG(e)?.category??`Global`}function WG(e,t,n){let r=e.trim();return Go(r,t)||Go(r,n)}var GG=`prefix.moreCommands`,KG=/^ctrl\+[^+]+$/;function qG(e){return KG.test(e)?e.slice(5):null}function JG(e){let t=PG(e.bindingId);if(!t)return null;if(e.reachability.direct.has(e.bindingId)){let e=t.keys[0];if(e)return yc(e)}if(e.prefixKey&&e.reachability.prefix.has(e.bindingId)){let n=t.prefixKeys?.[0];if(n)return`${yc(e.prefixKey)} ${yc(n)}`}return null}function YG(e,t){let n=hc.filter(t=>e.direct.has(t.id)).flatMap(e=>{let t=e.keys.flatMap(e=>qG(e)??[]);return t.length>2?[{stroke:`${t[0]}-${t.at(-1)}`,action:e.id}]:t.map(t=>({stroke:t,action:e.id}))}),r=t?qG(t):null;return r&&e.prefix.size>0&&n.push({stroke:r,action:GG}),n}var XG={Enter:`return`," ":`space`,Escape:`escape`,ArrowUp:`up`,ArrowDown:`down`,ArrowLeft:`left`,ArrowRight:`right`,PageUp:`pageup`,PageDown:`pagedown`};function ZG(e){if(e.altKey&&e.code){let t=/^Key([A-Z])$/.exec(e.code);if(t?.[1])return t[1].toLowerCase();let n=/^Digit(\d)$/.exec(e.code);if(n?.[1])return n[1]}return XG[e.key]??e.key.toLowerCase()}function QG(e){let t=ZG(e),n=t===`return`?[`return`,`enter`]:[t],r=[];e.ctrlKey&&r.push(`ctrl`),e.metaKey&&r.push(`cmd`),e.altKey&&r.push(`alt`);let i=t.length===1;return e.shiftKey&&!i&&r.push(`shift`),r.length===0?e.shiftKey&&i?[...n.map(e=>`shift+${e}`),...n]:n:e.shiftKey&&i?[]:n.map(e=>`${r.join(`+`)}+${e}`)}function $G(e){return e.startsWith(`shift+`)&&e.length===7?e.slice(6).toUpperCase():e}var eK={title:`Rove — keybindings`,palette:`Search commands`,search:`Type an action name or chord…`,filter:`/ filter actions`,noResults:`No matching actions. Try another name or clear the filter.`,run:`↑↓ select · enter run · esc cancel`,reportProblem:`Report a problem`,reportPrompt:"You are helping the user report a problem with Rove itself (not their own project) as a GitHub issue. First ask what they were doing and what felt wrong: one to three short questions, one at a time. Then collect context: run `rove --version` and `rove daemon status`, and read the last ~50 lines of {logPath} only if the problem could involve the daemon. Draft an issue title and body (what happened, what they expected, steps, relevant output) and show it to the user. Only after they say OK, file it with a heredoc: `rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'` followed by the body and `EOF`. Then share the issue URL. If it prints a prefilled link instead (gh missing or signed out), give the user that link and tell them to run `gh auth login`.",unavailable:`This action is no longer available. Close and reopen the palette.`,esc:`esc`,scrollKeys:`↑↓ ⇞⇟ scroll`,commandLayer:`{prefix} — more Rove commands`,escCancel:`esc cancel`,directLayer:`Hold ctrl — Rove shortcuts`,releaseCtrl:`release ctrl to close`,overflow:`… F1 for all shortcuts`,moreCommandsPrefix:`More commands (prefix)`,focused:`Focused: {surface}`,allBindings:`All keybinding contexts`,grammar:`Use keys here · one-press Rove shortcuts · {prefix} for more commands · right-click a row for its menu`,disabled:`prefix disabled`,here:`HERE — only in {surface}`,direct:`ONE PRESS — Rove shortcuts`,afterPrefix:`AFTER PREFIX — more Rove commands`,otherPane:`OTHER PANE — {surface}`,marks:{rows:`MARKS — task and tab rows`,inbox:`MARKS — tab strip and Inbox`},mark:{spinner:`working: an engine turn or a task job is running`,needsInput:`waiting on your answer: a permission prompt or a question`,attention:`needs you: an error, a rate limit, an exited engine or a failed deletion`,unseen:`a turn finished and you have not looked yet`,idle:`quiet`,subagent:`running subagents, in front of the branch`,remote:`the task lives on another machine`,done:`the turn finished`,rateLimited:`rate limited; it resumes on its own`,dead:`the engine process exited`,routineFailed:`a routine run failed`}},tK={title:`Rove — 快捷键`,palette:`搜索命令`,search:`输入操作名称或快捷键…`,filter:`/ 筛选操作`,noResults:`没有匹配的操作。请换个名称或清空筛选。`,run:`↑↓ 选择 · enter 执行 · esc 取消`,reportProblem:`报告问题`,reportPrompt:"你在帮用户把 Rove 本身的问题(不是他们自己项目的问题)提成一个 GitHub issue。先问清楚他们当时在做什么、哪里不对劲:一到三个简短的问题,一次问一个。然后收集上下文:运行 `rove --version` 和 `rove daemon status`,只有问题可能和 daemon 有关时才读 {logPath} 的最后约 50 行。起草 issue 的标题和正文(发生了什么、期望什么、复现步骤、相关输出)并展示给用户。用户确认之后才提交,用 heredoc:`rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'`,接正文,最后一行 `EOF`。然后把 issue 链接发给用户。如果输出的是预填链接(没装 gh 或没登录),把链接给用户,并告诉他运行 `gh auth login`。",unavailable:`此操作已不可用。请关闭并重新打开命令面板。`,esc:`esc`,scrollKeys:`↑↓ ⇞⇟ 滚动`,commandLayer:`{prefix} — 更多 Rove 命令`,escCancel:`esc 取消`,directLayer:`按住 ctrl — Rove 快捷键`,releaseCtrl:`松开 ctrl 关闭`,overflow:`… 按 F1 查看全部快捷键`,moreCommandsPrefix:`更多命令(prefix)`,focused:`当前焦点:{surface}`,allBindings:`所有快捷键上下文`,grammar:`当前区域直接按 · Rove 单次快捷键 · {prefix} 打开更多命令 · 右键任务行打开菜单`,disabled:`Prefix 已禁用`,here:`当前区域 — 仅在{surface}`,direct:`一次按下 — Rove 快捷键`,afterPrefix:`按下 Prefix 后 — 更多 Rove 命令`,otherPane:`其他区域 — {surface}`,marks:{rows:`标记 — 任务行和标签行`,inbox:`标记 — 标签栏和收件箱`},mark:{spinner:`运行中:引擎正在执行一轮,或任务作业正在运行`,needsInput:`等你回答:权限确认或提问`,attention:`需要你处理:出错、限流、引擎已退出或删除失败`,unseen:`一轮已结束,你还没看过`,idle:`空闲`,subagent:`正在运行的子代理,显示在分支名前`,remote:`任务在另一台机器上`,done:`这一轮已结束`,rateLimited:`被限流,会自动恢复`,dead:`引擎进程已退出`,routineFailed:`例行任务运行失败`}},nK={category:{Global:`Global`,Sidebar:`Sidebar`,Workspace:`Workspace`,Navigation:`Navigation`,"Tasks pane":`Tasks pane`,Files:`Files`,Terminal:`Terminal`,Views:`Views`,Tasks:`Tasks`,Sessions:`Sessions`,Attention:`Attention`,Tools:`Tools`,"Diff review":`Diff review`,Inbox:`Inbox`},desc:{"palette.open":`Search commands`,"help.open":`Show keybindings help`,"task.new":`New task`,"task.new.global":`New task`,"task.openEditor":`Open active Task directory in editor`,"task.moveMode":`Reorder sidebar rows — then j/k (tab, task, or project)`,"settings.open":`Open settings`,"app.refresh":`Refresh Rove onto the installed build (after an update)`,"settings.open.sidebar":`Open settings`,"inbox.show":`Open Inbox`,"worktrees.open.sidebar":`Open worktrees`,"kanban.open":`Open kanban (issues board)`,"automations.open":`Open routines (scheduled tasks)`,"workItems.open":`Open GitHub issues (external tracker)`,"app.quit":`Quit (with confirm)`,"focus.sidebar":`Back to sidebar (tasks)`,"focus.previous":`Focus previous pane (files → workspace → sidebar)`,"focus.next":`Focus next pane (sidebar → workspace → files)`,"workspace.filesToggle":`Show or hide Files`,"view.redraw":`Redraw the screen`,"attention.next":`Jump to the next Inbox item`,"task.previous":`Back to the previous task`,"sidebar.nav":`Move cursor up/down`,"sidebar.select":`Open the selected task`,"sidebar.tree.open":`Open the row under the cursor`,"sidebar.goto":`Top / bottom of list (gg or shift-G)`,"sidebar.rename":`Rename task`,"sidebar.localMerge":`Reorder row — Shift+M, then j/k (tab, task, or project)`,"sidebar.pin":`Pin / unpin task at top (Shift+P)`,"sidebar.sort":`Cycle task sort (default → recent → attention → name)`,"sidebar.delete":`Remove session (with confirm)`,"sidebar.search.enter":`Search tasks (fuzzy filter)`,"sidebar.search.nav":`Move highlight in search results`,"sidebar.search.submit":`Select search match and exit search`,"sidebar.search.cancel":`Cancel search (restore prior selection)`,"tasks.openWorktree":`Open selected Task directory in your editor`,"tasks.renameBranch":`Rename the selected task's git branch`,"tasks.cycleEngine":`Cycle engine vendor — applies on reopen`,"tasks.update":`Open the update page (when a new version is available)`,"tasks.focusEngine":`Focus the engine pane of the current window`,"chat.tab.new":`New conversation here (a child task sharing this directory)`,"chat.tab.chooseEngine":`New conversation — engine/shell picker with destination + context toggles`,"chat.tab.fork":`Continue this chat in a new child task (same directory, keeps the conversation)`,"chat.fork.new":`Quick-fork: create child task seeded with current repo/branch/model`,"chat.tab.close":`Close chat tab`,"chat.tab.rename":`Rename active chat tab`,"chat.tab.cycle-next":`Next chat tab`,"chat.tab.cycle-prev":`Previous chat tab`,"chat.tab.goto":`Go to chat tab N`,"workspace.split.right":`Split right`,"workspace.split.down":`Split down`,"workspace.split.focus-next":`Focus next split`,"workspace.split.close":`Close active split (tab when unsplit)`,"workspace.split.rename":`Rename active split (tab when unsplit)`,"workspace.reopenSession":`Reopen a session in a task whose tabs are all closed`,"files.nav":`Move cursor up/down`,"files.hierarchy":`Collapse / expand tree level`,"files.open":`Open file in configured editor (diff when supported)`,"files.tab":`Switch tab (cycle All / Changes)`,"files.refresh":`Refresh`,"files.scope":`Toggle Changes scope (working ↔ branch vs base)`,"files.diff":`Open a read-only diff in a workspace tab`,"files.diffAll":`Open the whole worktree's diff in one workspace tab`,"files.openExternal":`Open file in system default app (audio / video / pdf preview)`,"files.mention":`Inject @<path> mention into the engine pane`,"files.search.enter":`Search file names and text`,"files.hidden":`Show or hide dot files and folders on the All tab`,"files.changesView":`Show Changes as a folder tree or a flat list`,"files.search.nav":`Move highlight in file search results`,"files.search.submit":`Open the highlighted search result`,"files.search.cancel":`Close file search`,"files.createPR":`Ask the agent to create a PR from the current task`,"files.fixChecks":`Ask the agent to fix the failing PR checks`,"files.syncBase":`Merge the base branch into this task's worktree`,"diff.review.cursor":`Move the line cursor over the diff`,"diff.review.range":`Toggle range anchor at the cursor`,"diff.review.note":`Add a review note at the cursor`,"diff.review.send":`Send all unsent review notes to the engine`,"diff.review.drop":`Drop the review note the cursor sits inside`,"diff.review.reload":`Reload the previewed file from disk`,"inbox.nav":`Move through Inbox items`,"inbox.open":`Open the selected Inbox item`,"inbox.delete":`Ack the selected Inbox item`,"inbox.deleteAll":`Ack every ATTENTION item`,"terminal.scroll-up":`Scroll scrollback up`,"terminal.scroll-down":`Scroll scrollback down`,"terminal.reset":`Reset terminal — kill the current shell and respawn`}},rK={category:{Global:`全局`,Sidebar:`侧边栏`,Workspace:`工作区`,Navigation:`导航`,"Tasks pane":`任务面板`,Files:`文件`,Terminal:`终端`,Views:`视图`,Tasks:`任务`,Sessions:`会话`,Attention:`提醒`,Tools:`工具`,"Diff review":`差异审阅`,Inbox:`收件箱`},desc:{"palette.open":`搜索命令`,"help.open":`显示快捷键帮助`,"task.new":`新建任务`,"task.new.global":`新建任务`,"task.openEditor":`在编辑器中打开当前 Task 的目录`,"task.moveMode":`调整侧边栏行顺序——然后 j/k(tab / 任务 / 项目)`,"settings.open":`打开设置`,"app.refresh":`让 Rove 刷新到已安装的版本(更新之后)`,"settings.open.sidebar":`打开设置`,"inbox.show":`打开收件箱`,"worktrees.open.sidebar":`打开 worktrees`,"kanban.open":`打开看板(issues)`,"automations.open":`打开例行任务(定时任务)`,"workItems.open":`打开 GitHub issues(外部跟踪器)`,"app.quit":`退出(需确认)`,"focus.sidebar":`返回侧边栏(任务列表)`,"focus.previous":`聚焦上一个面板(文件 → 工作区 → 侧边栏)`,"focus.next":`聚焦下一个面板(侧边栏 → 工作区 → 文件)`,"workspace.filesToggle":`显示或收起文件栏`,"view.redraw":`重绘屏幕`,"attention.next":`跳到下一个收件箱条目`,"task.previous":`回到上一个任务`,"sidebar.nav":`上下移动光标`,"sidebar.select":`打开选中的任务`,"sidebar.tree.open":`打开光标所在行`,"sidebar.goto":`跳到列表顶部 / 底部(gg 或 shift-G)`,"sidebar.rename":`重命名任务`,"sidebar.localMerge":`调整当前行顺序——Shift+M,然后 j/k(tab / 任务 / 项目)`,"sidebar.pin":`置顶 / 取消置顶任务(Shift+P)`,"sidebar.sort":`切换任务排序方式(默认 → 最近 → 关注 → 名称)`,"sidebar.delete":`移除会话(需确认)`,"sidebar.search.enter":`搜索任务(模糊过滤)`,"sidebar.search.nav":`在搜索结果中移动高亮`,"sidebar.search.submit":`选中搜索匹配项并退出搜索`,"sidebar.search.cancel":`取消搜索(恢复之前的选中项)`,"tasks.openWorktree":`在编辑器中打开选中 Task 的目录`,"tasks.renameBranch":`重命名选中任务的 git 分支`,"tasks.cycleEngine":`循环切换引擎厂商——重新打开后生效`,"tasks.update":`打开更新页面(有新版本时)`,"tasks.focusEngine":`聚焦当前窗口的引擎面板`,"chat.tab.new":`在此新建对话(共享当前目录的子任务)`,"chat.tab.chooseEngine":`新建对话 —— 选择引擎或 shell,可切换落点与上下文`,"chat.tab.fork":`把当前对话接到新子任务(同一目录,带上已有对话)`,"chat.fork.new":`快速派生:以当前仓库/分支/模型创建子任务`,"chat.tab.close":`关闭聊天标签页`,"chat.tab.rename":`重命名当前聊天标签页`,"chat.tab.cycle-next":`下一个聊天标签页`,"chat.tab.cycle-prev":`上一个聊天标签页`,"chat.tab.goto":`跳到第 N 个聊天标签页`,"workspace.split.right":`向右分屏`,"workspace.split.down":`向下分屏`,"workspace.split.focus-next":`聚焦下一个分屏`,"workspace.split.close":`关闭当前分屏(未分屏时关闭标签页)`,"workspace.split.rename":`重命名当前分屏(未分屏时重命名标签页)`,"workspace.reopenSession":`在标签页全部关闭的任务中重新打开会话`,"files.nav":`上下移动光标`,"files.hierarchy":`折叠 / 展开树层级`,"files.open":`在已配置的编辑器中打开文件(支持时显示 diff)`,"files.tab":`切换标签页(循环 全部 / 变更)`,"files.refresh":`刷新`,"files.scope":`切换变更范围(工作区 ↔ 分支对比 base)`,"files.diff":`在工作区标签页中打开只读 diff`,"files.diffAll":`把整个 worktree 的 diff 打开在一个工作区标签页里`,"files.openExternal":`在系统默认应用中打开文件(音频 / 视频 / pdf 预览)`,"files.mention":`将 @<path> 提及注入引擎面板`,"files.search.enter":`搜索文件名和文件内容`,"files.hidden":`在「全部」标签页显示或隐藏以点开头的文件和文件夹`,"files.changesView":`将「改动」显示为文件夹树或平铺列表`,"files.search.nav":`在文件搜索结果中移动高亮`,"files.search.submit":`打开高亮的搜索结果`,"files.search.cancel":`关闭文件搜索`,"files.createPR":`让 agent 从当前任务创建 PR`,"files.fixChecks":`让 agent 修复失败的 PR 检查`,"files.syncBase":`把基础分支合并进该任务的工作树`,"diff.review.cursor":`在 diff 中移动行光标`,"diff.review.range":`在光标处切换范围锚点`,"diff.review.note":`在光标处添加审阅备注`,"diff.review.send":`将所有未发送的审阅备注发给引擎`,"diff.review.drop":`删除光标所在的评审备注`,"diff.review.reload":`从磁盘重新加载当前预览的文件`,"inbox.nav":`在收件箱条目之间移动`,"inbox.open":`打开选中的收件箱条目`,"inbox.delete":`将选中的收件箱条目标为已阅`,"inbox.deleteAll":`将所有待处理条目标为已阅`,"terminal.scroll-up":`向上滚动回滚`,"terminal.scroll-down":`向下滚动回滚`,"terminal.reset":`重置终端——关闭当前 shell 并重新启动`}};G();function iK(e,t){let n=e;for(let e of t.split(`.`)){if(!n||typeof n!=`object`||!(e in n))return;n=Reflect.get(n,e)}return typeof n==`string`?n:void 0}function aK(e,t){return Cn.get()===`zh`?t:e}function oK(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}var sK=(e,t)=>oK(iK(aK(eK,tK),e)??iK(eK,e)??e,t),cK=(e,t)=>oK(iK(aK(po,mo),e)??iK(po,e)??e,t);function lK(e){return aK(nK,rK).desc[e]??nK.desc[e]??e}function uK(e){let t=lK(e),n=t.search(/\s—\s|——/);return n>0?t.slice(0,n):t}function dK(e){return aK(nK,rK).category[e]??e}var fK=(e,t)=>oK(iK(aK(_o,vo),e)??iK(_o,e)??e,t),pK=(e,t)=>oK(iK(aK(uo,fo),e)??iK(uo,e)??e,t),mK=4e3;A();var hK=180,gK=mK,_K=O({guide:null,entries:[]}),vK=1;function yK(e,t){let n={id:vK++,stroke:e,action:t,at:Date.now()};_K.set({guide:null,entries:[..._K.get().entries,n].slice(-3)})}function bK(e,t){let n=e.querySelector(`[data-field="${t}"]`);(n?.matches(`input, textarea`)?n:n?.querySelector(`[tabindex='0']`))?.focus()}function xK(e,t,n){let r=document.activeElement?.closest(`[data-field]`)?.getAttribute(`data-field`),i=t.findIndex(e=>e===r),a=t[i<0?0:(i+n+t.length)%t.length];a&&bK(e,a)}G(),He(),H();var SK=[`1`,`2`,`3`,`4`,`5`],CK=[`tab`,`fork`,`scratch`],wK=[`message`,`attempts`,`engine`,`fork-base`,`destination`];function TK(e){W();let{model:t,taskId:n}=e,r=t.tasks.get()?.tasks.find(e=>e.id===n),i=BI(t),[a,o]=(0,J.useState)(e.destination??`tab`),[s,c]=(0,J.useState)(e.context??`fresh`),[l,u]=(0,J.useState)(``),d=Ii(l),[f,p]=(0,J.useState)(`1`),[m,h]=(0,J.useState)(r?.branch??`main`),{busy:g,error:_,setError:v,submit:y}=Ba(),{attachments:b,attach:x,remove:S,ready:C}=vk(t,v,void 0,n),w=s===`fresh`&&a!==`fork`,T=a===`tab`&&s===`fresh`,E=GI(t),D=i.engine===`shell`&&!w||UI(i.engine)&&!T?``:i.engine,O=D===VI,k=UI(D),ee=a===`fork`,A=(e,t)=>{let n=e===`scratch`&&t===`continue`&&a===`scratch`?`tab`:e;o(n),c(n===`scratch`?`fresh`:t)},j=()=>{let r=t.selection.get();return e.sourceTabId??(r.taskId===n?r.tabId:null)??`tab-1`},M=()=>t.tasks.get()?.tasks.find(e=>e.id===n)?.tabStatus?.[j()]?.reason===`dead`,N=async()=>{let e=await t.client.request(`tab.handoff`,{taskId:n,tabId:j()});if(e.kind===`handoff`&&e.prompt)return e.prompt;throw Error(e.kind===`no-transcript`?Y(`terminal`,`tab.noTranscriptToHandOff`,{engine:e.engine??``}):Y(`terminal`,`tab.nothingToFork`))},P=()=>y(async()=>{let e=s===`continue`&&a===`tab`&&!O&&!k&&M(),i=[s===`continue`&&!e?await N():``,pk(l.trim(),await C())].filter(Boolean).join(`
|
|
206
|
+
|
|
207
|
+
`);if(a===`scratch`){let e=await t.client.request(`task.openScratch`,O?{}:{engine:D});O?await JI(t,e.taskId,{kind:`shell`}):t.selectWhenListed(e.taskId)}else if(ee){if(!r)throw Error(Y(`terminal`,`tab.tabGone`));if(!l.trim())throw Error(U(`taskops.forkNeedsMessage`));let e=m.trim()||r.branch,a;try{a=await t.client.request(`tab.forkTask`,{repo:r.repo,baseBranch:e,prompt:i,...D?{engine:D}:{},...Number(f)>1?{count:Number(f)}:{},...e===r.branch?{forkFrom:n}:{}})}catch(e){let t=iP(e);if(!t)throw e;z(e instanceof Error?e.message:String(e),`error`),De(t);return}a.forkRefused&&z(U(`taskops.forkLeftBehind`,{reason:a.forkRefused}));let o=a.taskIds[0];a.groupId?De(a.groupId):o&&t.selectWhenListed(o)}else if(O)await JI(t,n,{kind:`shell`});else if(k){let{selection:e}=t,r=e.get().taskId===n?e.get().tabId:null,i=await t.client.request(`plugin.paneOpen`,{taskId:n,pane:WI(D),...r?{tabId:r}:{}});await t.refreshTabsNow(n),t.select(n,i.tabId)}else await JI(t,n,{kind:`engine`,engine:D,prompt:i,...e?{replaceTab:j()}:{}})});return(0,K.jsx)(za,{title:Y(`terminal`,`tab.newChat.title`),wide:!0,children:(0,K.jsxs)(`form`,{className:Yi,onKeyDown:e=>{if(e.key===`Tab`&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(ee||!e.shiftKey))e.preventDefault(),e.stopPropagation(),ee?xK(e.currentTarget,wK,e.shiftKey?-1:1):A(CK[(CK.indexOf(a)+1)%CK.length]??`tab`,s);else if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`e`){e.preventDefault(),e.stopPropagation();let t=i.engines.filter(e=>e.ready!==!1),n=t[(t.findIndex(e=>e.id===i.engine)+1)%t.length];n&&i.setEngine(n.id)}else e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`f`?(e.preventDefault(),e.stopPropagation(),A(a,s===`fresh`?`continue`:`fresh`)):e.key===`Enter`&&ee&&e.target.closest(`[data-field=attempts], [data-field=engine]`)&&(e.preventDefault(),e.currentTarget.requestSubmit())},onSubmit:e=>{e.preventDefault(),P()},onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),x(Array.from(e.dataTransfer.files))},children:[(0,K.jsxs)(`div`,{className:Li,children:[(0,K.jsx)(`span`,{className:`${Ri}`,children:Y(`terminal`,`tab.newChat.engine`)}),(0,K.jsx)(KI,{engines:i.engines,value:D,onChange:i.setEngine,withShell:w,panes:T?E:[]})]}),(0,K.jsxs)(`div`,{className:Li,children:[(0,K.jsx)(`span`,{className:`${Ri}`,children:Y(`terminal`,`tab.newChat.destLabel`)}),(0,K.jsx)(II,{label:Y(`terminal`,`tab.newChat.destLabel`),field:`destination`,value:a,onChange:e=>A(e,s),choices:CK.map(e=>({id:e,label:Y(`terminal`,`tab.newChat.dest${e===`tab`?`Tab`:e===`fork`?`Fork`:`Scratch`}`)}))})]}),(0,K.jsxs)(`div`,{className:Li,children:[(0,K.jsxs)(`span`,{className:`${Ri}`,children:[Y(`terminal`,`tab.newChat.ctxLabel`),` `,(0,K.jsx)(`span`,{className:`keys-only`,children:`ctrl+f`})]}),(0,K.jsx)(II,{label:Y(`terminal`,`tab.newChat.ctxLabel`),field:`context`,value:s,onChange:e=>A(a,e===`continue`?`continue`:`fresh`),choices:[`fresh`,`continue`].map(e=>({id:e,label:Y(`terminal`,`tab.newChat.ctx${e===`fresh`?`Fresh`:`Continue`}`)}))})]}),ee&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:Y(`quickTask`,`attemptsLabel`)}),(0,K.jsx)(II,{label:Y(`quickTask`,`attemptsLabel`),field:`attempts`,value:f,onChange:p,choices:SK.map(e=>({id:e,label:e}))})]}),(0,K.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:U(`taskops.forkBranch`)}),(0,K.jsx)(`input`,{className:ji,"data-field":`fork-base`,spellCheck:!1,value:m,onChange:e=>h(e.target.value)})]})]}),!O&&!k&&a!==`scratch`&&(0,K.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:U(`newChat.prompt`)}),(0,K.jsx)(`textarea`,{ref:d,className:`${ji} ${zi}`,"data-field":`message`,autoFocus:!0,rows:4,placeholder:U(`newChat.promptPlaceholder`),value:l,onChange:e=>u(e.target.value),onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length!==0&&(e.preventDefault(),x(t))},onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&e.currentTarget.form?.requestSubmit()}})]}),(0,K.jsx)(yk,{attachments:b,onRemove:S}),lA()?(0,K.jsx)(`p`,{className:`text-muted`,children:U(`pages.attachHintTouch`)}):(0,K.jsx)(`p`,{className:`keys-only mx-0 mt-2 mb-0 ${Si}`,children:Y(`quickTask`,`legend`)}),_&&(0,K.jsx)(`p`,{className:`text-error`,children:_}),(0,K.jsx)(Wa,{busy:g,submitLabel:U(`newChat.start`)})]})})}G();var EK=[`needs`,`working`,`ready`,`idle`],DK=`~state:`;function OK(e){switch(e.rowStatus?.kind){case`attention`:case`needs-input`:case`unseen`:return`needs`;case`busy`:case`running`:return`working`}switch(e.group){case`waiting-on-you`:return`needs`;case`working`:return`working`;case`landing`:case`ready-for-review`:return`ready`}return e.pr?.lifecycle===`open`||e.status===`done`?`ready`:`idle`}var kK=e=>e&&!ms(e)?Jo(e.repo):void 0;function AK(e,t){let n=hs(e,t.sort),{children:r,nested:i}=bs([{repo:``,label:``,tasks:n}]),a=n.filter(e=>!i.has(e.id)),o=ts(a),s=e=>{let t=[],n=new Set,i=e=>{if(!n.has(e.id)){n.add(e.id),t.push(e);for(let t of r.get(e.id)??[])i(t)}};return i(e),t},c=new Map;for(let e of a){let t=es(e),n=((t===null?void 0:o.get(t))??[e]).map(s),r=n.flat().map(OK).reduce((e,t)=>EK.indexOf(t)<EK.indexOf(e)?t:e);for(let e of n)for(let t of e)c.set(t.id,r)}return EK.flatMap(e=>{let t=n.filter(t=>c.get(t.id)===e);return t.length===0?[]:[{repo:``,label:U(`rail.state.${e}`),key:`${DK}${e}`,tasks:t}]})}function jK(e){let t=new Set(e.machines.map(e=>e.alias));return{rows:Cs(AK([...e.tasks.filter(e=>!e.routine),...e.remote.filter(e=>!e.routine&&e.machine!==void 0&&t.has(e.machine.id))],e),e.query,e.fold).map(e=>{if(e.kind!==`project`)return e;let t=e.id.slice(`project:${DK}`.length);return{id:`state:${t}`,kind:`state`,state:t,label:e.label}}),groups:[]}}var MK=new Set([`refused`,`timeout`,`host-key-changed`,`host-key-unverified`,`auth-denied`,`unresolved`,`ssh-failed`,`no-rove`,`no-daemon`,`bad-status`,`handshake`,`no-forwarding`,`lost`]);function NK(e){return e&&MK.has(e)?`machines.reason.${e}`:null}function PK(e,t){return e.filter(e=>e.machine?.id===t&&!e.routine&&!e.deleting)}function FK(e){let t=EK.map(e=>({state:e,tasks:[]}));for(let n of e)t[EK.indexOf(OK(n))]?.tasks.push(n);return t.filter(e=>e.tasks.length>0)}var IK=`flex flex-col font-mono text-meta`,LK=`flex flex-col gap-1 border-t-hairline border-line py-2.5 first:border-t-0 first:pt-0`,RK=`flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5`,zK=`min-w-0 text-ink wrap-anywhere`,BK=`m-0 text-muted wrap-anywhere`,VK=`flex flex-wrap gap-x-3.5 gap-y-1 pt-0.5 whitespace-nowrap`,HK=`mt-1.5 mb-0.5 text-subtle`,UK=`flex min-w-0 items-baseline gap-2 pl-2`,WK=`min-w-0 flex-1 truncate text-left`,GK=`min-w-0 max-w-[55%] flex-none truncate text-muted`;G(),He(),A(),H();function KK(e){B.set((0,K.jsx)(XK,{model:e}))}function qK({model:e,tasks:t}){let n=t=>{ce(),e.select(t.id),Ie()};return FK(t).map(e=>(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`${HK} m-0`,children:U(`rail.state.${e.state}`)}),e.tasks.map(e=>(0,K.jsxs)(q,{variant:`row`,className:`${UK} w-full rounded-sm py-0.5 hover:bg-hover`,onClick:()=>n(e),children:[(0,K.jsx)(`span`,{className:WK,children:e.label}),(0,K.jsx)(`span`,{className:GK,children:e.branch})]},e.id))]},e.state))}function JK({model:e,alias:t}){let[n,r]=(0,J.useState)(null);return(0,J.useEffect)(()=>{let n=!0;return Ws(e,`machines.repos`,{machine:t}).then(e=>n&&r(e),e=>n&&r({failed:e instanceof Error?e.message:String(e)})),()=>{n=!1}},[e,t]),n?`failed`in n?(0,K.jsx)(`p`,{className:BK,children:U(`machines.reposFailed`,{message:n.failed})}):n.reason?(0,K.jsx)(`p`,{className:BK,children:U(`machines.reposFailed`,{message:n.message??n.reason})}):n.repos.length===0?(0,K.jsx)(`p`,{className:BK,children:U(`machines.noRepos`)}):n.repos.map(e=>(0,K.jsxs)(`div`,{className:UK,children:[(0,K.jsx)(`span`,{className:WK,children:e.id}),(0,K.jsx)(`span`,{className:GK,title:e.primary??e.checkouts[0],children:e.primary??e.checkouts[0]??``})]},e.id)):(0,K.jsx)(`p`,{className:BK,children:U(`machines.loading`)})}function YK(e){let{model:t,row:n,tasks:r,words:i}=e,[a,o]=(0,J.useState)(null),s=n.state===`online`,c=NK(n.reason),l=FK(r).map(e=>`${e.tasks.length} ${U(`rail.state.${e.state}`)}`),u=e=>o(a===e?null:e),[d,f]=(0,J.useState)({busy:!1});return(0,K.jsxs)(`section`,{className:LK,children:[(0,K.jsxs)(`div`,{className:RK,children:[(0,K.jsx)(`span`,{className:`${zK} ${s?``:EO.warning}`,children:NN(n,i)}),(0,K.jsx)(`span`,{className:`text-muted`,children:l.length>0?l.join(` · `):U(`machines.noTasks`)})]}),c&&(0,K.jsx)(`p`,{className:`m-0 text-muted wrap-anywhere`,children:U(c)}),(d.busy||d.note)&&(0,K.jsx)(`p`,{className:`m-0 text-muted wrap-anywhere`,children:d.busy?U(`machines.updating`):d.note}),(0,K.jsxs)(`div`,{className:VK,children:[n.behind&&(0,K.jsx)(q,{hit:`tight`,disabled:d.busy,onClick:()=>{f({busy:!0}),t.client.request(`machines.update`,{machine:n.alias}).then(e=>f({busy:!1,note:e.ok?U(e.result.changed?`machines.updated`:`machines.upToDate`,{from:e.result.from??`?`,to:e.result.to??`?`}):U(`machines.updateFailed`,{message:e.message})}),e=>f({busy:!1,note:U(`machines.updateFailed`,{message:e instanceof Error?e.message:String(e)})}))},children:U(`machines.update`)}),s&&(0,K.jsx)(q,{hit:`tight`,onClick:()=>{ce(),uR(void 0,n.alias)},children:U(`machines.newHere`)}),r.length>0&&(0,K.jsx)(q,{hit:`tight`,"aria-expanded":a===`tasks`,onClick:()=>u(`tasks`),children:U(a===`tasks`?`machines.hide`:`machines.tasks`)}),s&&(0,K.jsx)(q,{hit:`tight`,"aria-expanded":a===`repos`,onClick:()=>u(`repos`),children:U(a===`repos`?`machines.hide`:`machines.repos`)})]}),a===`tasks`&&(0,K.jsx)(qK,{model:t,tasks:r}),a===`repos`&&(0,K.jsx)(JK,{model:t,alias:n.alias})]})}function XK({model:e}){let t=W(),n=RN(e),r=k(e.remote),i=(t===`zh`?fo:uo).machine;return(0,K.jsx)(za,{title:U(`machines.title`),wide:!0,children:(0,K.jsxs)(`div`,{className:`${Yi} ${IK}`,children:[n.length===0&&(0,K.jsx)(`p`,{className:`m-0 text-muted wrap-anywhere`,children:U(`machines.none`)}),n.map(t=>(0,K.jsx)(YK,{model:e,row:t,tasks:PK(r,t.alias),words:i},t.alias))]})})}function ZK(e,t,n=300){let r=0,i,a=()=>{r++,i?.(),i=void 0};return{stop:a,run:o=>{a();let s=o.trim();if(s.length<2){t({kind:`idle`});return}let c=r,l=setTimeout(()=>{t({kind:`searching`}),e(s).then(e=>c===r&&t({kind:`done`,query:s,reply:e}),e=>c===r&&t({kind:`failed`,message:e instanceof Error?e.message:String(e)}))},n);i=()=>clearTimeout(l)}}}var QK=`mx-1.5 mt-2 mb-0.5 font-mono text-meta font-semibold normal-nums text-subtle first:mt-0`,$K=`mx-1.5 my-1 text-meta text-muted [overflow-wrap:anywhere]`,eq=e=>`flex w-full min-w-0 cursor-pointer flex-col gap-0.5 rounded-sm px-1.5 py-1.5 text-left text-ink [font:inherit] touch:py-2.5 ${e?`is-selected bg-hover`:``}`,tq=`flex min-w-0 items-baseline gap-2`,nq=`min-w-0 flex-1 truncate text-body`,rq=`whitespace-nowrap text-meta text-muted`,iq=`text-meta text-muted [overflow-wrap:anywhere]`,aq=`rounded-xs bg-accent/25 text-ink`;G();function oq(e,t){let[n,r]=(0,J.useState)({kind:`idle`});return(0,J.useEffect)(()=>{let n=ZK(t=>e.client.request(`sessions.search`,{query:t}),r);return n.run(t),n.stop},[e,t]),n}function sq(e,t){let n=[],r=e.toLowerCase(),i=t.toLowerCase(),a=0;for(let t=r.indexOf(i);i&&t>=0;t=r.indexOf(i,t+i.length))t>a&&n.push(e.slice(a,t)),n.push({hit:e.slice(t,t+i.length),at:t}),a=t+i.length;return n.push(e.slice(a)),n.map(e=>typeof e==`string`?e:(0,K.jsx)(`mark`,{className:aq,children:e.hit},e.at))}function cq({children:e}){return(0,K.jsx)(`h3`,{className:QK,children:e})}function lq({children:e,error:t}){return(0,K.jsx)(`p`,{className:`${$K} ${t?`text-error`:``}`,children:e})}function uq(e){return(0,K.jsx)(q,{variant:`row`,className:eq(e.selected),onMouseEnter:e.onHover,onClick:e.onOpen,children:(0,K.jsxs)(`span`,{className:tq,children:[(0,K.jsx)(`span`,{className:nq,children:e.title}),(0,K.jsx)(`span`,{className:rq,children:e.repo})]})})}function dq(e){let{hit:t}=e;return(0,K.jsxs)(q,{variant:`row`,className:eq(e.selected),onMouseEnter:e.onHover,onClick:e.onOpen,children:[(0,K.jsxs)(`span`,{className:tq,children:[(0,K.jsx)(`span`,{className:nq,children:t.title}),(0,K.jsxs)(`span`,{className:rq,children:[U(t.role===`user`?`search.you`:`search.agent`),` · `,el(Date.now()-Date.parse(t.at))]})]}),(0,K.jsx)(`span`,{className:iq,children:sq(t.snippet,e.query)})]})}H();async function fq(e,t){let{taskId:n}=await e.client.request(`task.openScratch`);await JI(e,n,{kind:`engine`,prompt:t}),ce()}G();function pq(e,t){let n=U(`settings.feedback.reportPrompt`);return fq(e,t?`${n}\n\n${U(`settings.feedback.reportGiven`,t)}`:n)}function mq(e,t,n){let r=`worktrees.land.refusal.${t.refusal}`,i=e(r,{branch:t.branch??n,landedOn:t.landedOn??``,files:(t.dirtyFiles??[]).join(`, `)});return i===r?e(`worktrees.land.failed`,{error:t.message??t.refusal}):i}function hq(e){let t=e.todos;return!t||t.length===0?null:{done:t.filter(e=>e.done).length,total:t.length}}function gq(e){return(e.todos??[]).filter(e=>!e.done)}wl(),G(),H();var _q=/LAND_CONFLICT/,vq=/MAIN_CHECKOUT_DIRTY/,yq=/SYNC_CONFLICT(?:: )?(.*)/,bq=/SYNC_WORKTREE_DIRTY(?:: )?(.*)/;function xq(e){let t=Ra(e);return _q.test(t)?Y(`worktrees`,`land.conflict`,{files:t}):vq.test(t)?Y(`worktrees`,`land.dirtyBase`):Y(`worktrees`,`land.failed`,{error:t})}async function Sq(e,t,n){if(t.machine){Cq(e,t,t.machine.label,n);return}let r;try{r=await e.client.request(`task.landPreflight`,{taskId:t.id})}catch(e){z(Y(`worktrees`,`land.failed`,{error:Ra(e)}),`error`);return}if(r.refusal){z(r.refusal===`MAIN_CHECKOUT_DIRTY`?Y(`worktrees`,`land.dirtyBase`):mq((e,t)=>{let n=Y(`worktrees`,e.replace(/^worktrees\./,``),t);return n===e.replace(/^worktrees\./,``)?e:n},{...r,refusal:r.refusal},t.branch||t.title),`error`);return}let i=t.branch||t.title,a=gq(e.tasks.get()?.tasks.find(e=>e.id===t.id)??{}).length;B.set((0,K.jsx)(Ha,{title:Y(`worktrees`,`land.confirmTitle`),body:[Y(`worktrees`,r.ahead===1?`land.confirmBodyOne`:`land.confirmBody`,{branch:i,landedOn:r.landedOn,commits:r.ahead??`?`}),...a>0?[U(`files.landTodos`,{count:a})]:[]].join(`
|
|
208
|
+
|
|
209
|
+
`),confirmLabel:Y(`worktrees`,`land.button`),onConfirm:async()=>{try{let r=await e.client.request(`task.land`,{taskId:t.id});z(Y(`worktrees`,`land.done`,{branch:i,landedOn:r.landedOn,commit:r.commit.slice(0,8)})),n?.()}catch(e){throw Error(xq(e))}}}))}function Cq(e,t,n,r){let i=t.branch||t.title;B.set((0,K.jsx)(Ha,{title:U(`taskops.publishTitle`),body:U(`taskops.publishBody`,{branch:i,host:n}),confirmLabel:U(`taskops.publishButton`),onConfirm:async()=>{let n=await e.client.request(`task.land`,{taskId:t.id}),a=n.published?.prUrl;a?z(U(`taskops.publishedPr`,{branch:i,url:a})):z(U(`taskops.publishedNoPr`,{branch:i,reason:Tq(n.published?.prError??``)}),`error`),r?.()}}))}async function wq(e,t){try{let n=await e.client.request(`task.syncBase`,{taskId:t});z(Y(`tasks`,n.alreadyCurrent?`sync.alreadyCurrent`:`sync.done`,{base:n.baseRef}))}catch(e){let t=Ra(e),n=yq.exec(t),r=bq.exec(t);z(n?Y(`tasks`,`sync.conflict`,{files:n[1]?.trim()||`?`}):r?Y(`tasks`,`sync.dirty`,{files:r[1]?.trim()||`?`}):Y(`tasks`,`sync.failed`,{error:t}),`error`)}}function Tq(e){return e.split(`
|
|
210
|
+
`).find(e=>e.trim().length>0)?.trim()??e.trim()}async function Eq(e,t,n){try{let r=await e.client.request(`task.fixChecks`,e.engineTarget(t));r.outcome===`unavailable`?z(Y(`files`,`toast.ciChecksUnavailable`,{detail:Tq(r.detail??``)}),`error`):r.outcome===`none`?z(Y(`files`,`toast.ciNoFailingChecks`),`error`):z(n)}catch(e){z(Ra(e),`error`)}}async function Dq(e,t){try{let n=await e.client.request(`task.openEditor`,{taskId:t});n.outcome===`noEditor`?z(Y(`tasks`,`toast.noEditor`),`error`):n.outcome===`failed`&&z(Y(`tasks`,`toast.openWorktreeFailed`,{label:n.label??``}),`error`)}catch(e){z(XA(e)?Y(`tasks`,`toast.noDiskSpace`):Y(`tasks`,`toast.worktreeErrorGeneric`,{message:Ra(e)}),`error`)}}function Oq(e,t){let n=e.tasks.get();return[...n?.tasks??[],...n?.archived??[]].filter(e=>e.parentTaskId===t)}function kq(e,t){let n=Oq(e,t.id),r=n.length>0,i=n=>e.act(`task.delete`,{taskId:t.id,...n}).then(()=>{}),a=e=>`${Y(`worktrees`,`delete.forceBody`,{branch:t.branch||t.title})}\n\n${Y(`worktrees`,`delete.forceReason`,{reason:Ra(e).replace(`task ${t.id} `,``)})}`,o=async e=>{i(e).catch(n=>{if(e.force||!(n instanceof yl)||n.code!==`DIRTY_WORKTREE`){z(Ra(n),`error`);return}B.set((0,K.jsx)(Ha,{title:Y(`tasks`,`confirm.forceDeleteTitle`,{title:t.label}),body:a(n),confirmLabel:Y(`tasks`,`confirm.forceDeleteConfirm`),onConfirm:()=>o({...e,force:!0})}))})};return(0,K.jsx)(Ha,{title:r?Y(`tasks`,`confirm.childrenTitle`,{title:t.label,count:String(n.length)}):Y(`tasks`,t.kind===`dir`?`confirm.deleteTitleDir`:`confirm.deleteTitle`,{title:t.label}),body:r?Y(`tasks`,`confirm.childrenBody`):Y(`tasks`,t.kind===`dir`?`confirm.deleteBodyDir`:`confirm.deleteBodyTask`),confirmLabel:Y(`tasks`,r?`confirm.childrenPromote`:`confirm.deleteConfirm`),onConfirm:()=>o({}),...r?{secondary:{label:Y(`tasks`,`confirm.childrenCascade`),onConfirm:()=>o({cascade:!0})}}:{}})}async function Aq(e,t){let n=t.archived!==!0,r=t.label,i=async i=>{await e.act(`task.archive`,{taskId:t.id,archived:n,...i}),z(Y(`tasks`,n?`archive.done`:`archive.restored`,{title:r}))},a=async e=>{try{await i(e)}catch(t){if(n&&t instanceof yl&&t.code===`TASK_BUSY`){B.set((0,K.jsx)(Ha,{title:Y(`tasks`,`archive.busyTitle`),body:Y(`tasks`,`archive.busyBody`,{title:r}),confirmLabel:Y(`tasks`,`archive.busyConfirm`),onConfirm:()=>i({...e,force:!0})}));return}z(Y(`tasks`,n?`archive.failed`:`archive.restoreFailed`,{error:Ra(t)}),`error`)}},o=n?(e.tasks.get()?.tasks??[]).filter(e=>e.parentTaskId===t.id):[];if(o.length===0)return a({});B.set((0,K.jsx)(Ha,{title:Y(`tasks`,`confirm.childrenTitle`,{title:r,count:String(o.length)}),body:Y(`tasks`,`confirm.archiveChildrenBody`),confirmLabel:Y(`tasks`,`confirm.childrenPromote`),onConfirm:async()=>void a({promote:!0}),secondary:{label:Y(`tasks`,`confirm.archiveChildrenAll`),onConfirm:async()=>void a({})}}))}function jq(e,t,n){return(0,K.jsx)(Ha,{title:Y(`tasks`,`confirm.forgetProjectTitle`,{title:n}),body:Y(`tasks`,`confirm.forgetProjectBody`),confirmLabel:Y(`tasks`,`confirm.forgetProjectConfirm`),onConfirm:async()=>{try{await e.client.request(`project.forget`,{repo:t})}catch(e){throw Error(Y(`tasks`,`toast.forgetProjectFailed`,{error:Ra(e)}))}}})}A();var Mq=O(null),Nq=0;function Pq(e,t){Mq.set({taskId:e,hit:t,nonce:++Nq}),jB(e,`chat`)}G(),He(),A(),H(),Ur();var Fq=10;function Iq(e,t){let n=e=>e.surface===t?0:e.surface?1:2,r=Rc().filter(n=>zc(n,t)&&n.live?.(e)!==!1).map((e,t)=>({command:e,index:t})).sort((e,t)=>n(e.command)-n(t.command)||Number(e.command.prefix)-Number(t.command.prefix)||e.index-t.index),i=new Set,a=[];for(let{command:e}of r){let t=e.chords[0];!t||e.id===`palette.open`||i.has(e.id)||(i.add(e.id),a.push({command:e,name:lK(e.id),raw:e.prefix?`${Ec()} + ${t}`:t}))}return a}function Lq(e){let t=document.activeElement instanceof HTMLElement?document.activeElement:null;B.set((0,K.jsx)(zq,{model:e,surface:Vc(),origin:t}))}var Rq=8;function zq({model:e,surface:t,origin:n}){W();let[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(0),s=(0,J.useRef)(null),c=k(xc),l=k(e.tasks),u=k(e.remote),d=(0,J.useMemo)(()=>Iq(e,t),[e,t,c]).filter(e=>WG(r,e.name,e.raw)),f=(RN(e).length>0?[{name:U(`machines.title`)}]:[]).filter(e=>WG(r,e.name,``)),p=[{name:U(`settings.feedback.report`)}].filter(e=>WG(r,e.name,``)),m=r.trim(),h=m===``?[]:[...l?.tasks??[],...u,...l?.archived??[]].filter(e=>!e.routine&&!e.deleting&&[e.label,e.title,e.branch,Jo(e.repo)].some(e=>e!==``&&Go(m,e))).slice(0,Rq),g=k(e.installedMods).has(`issues`),_=[{id:`usage`,name:U(`usage.title`)},...g?[{id:`issues`,name:U(`reviewQueue.palette`),source:`reviews`}]:[]].filter(e=>m===``||Go(m,e.name)),v=oq(e,r),y=v.kind===`done`?v.reply.matches:[],b=[...d.map(e=>({kind:`command`,row:e})),..._.map(e=>({kind:`page`,...e})),...f.map(e=>({kind:`machines`,...e})),...p.map(e=>({kind:`report`,...e})),...h.map(e=>({kind:`task`,task:e})),...y.map(e=>({kind:`hit`,hit:e}))],x=Math.min(a,Math.max(0,b.length-1));(0,J.useEffect)(()=>()=>n?.focus(),[n]),(0,J.useEffect)(()=>{s.current?.querySelector(`.is-selected`)?.scrollIntoView({block:`nearest`})},[x]);let S=t=>{if(t.kind===`machines`){KK(e);return}if(ce(),n?.focus(),t.kind===`report`){pq(e).catch(()=>z(U(`settings.feedback.reportFailed`),`error`));return}if(t.kind===`command`){t.row.command.live?.(e)===!1?z(sK(`unavailable`),`error`):t.row.command.run(e);return}if(t.kind===`page`){t.source&&yV.set(t.source),Ee(t.id);return}t.kind===`task`&&t.task.archived&&Aq(e,t.task),t.kind===`task`?e.select(t.task.id):e.select(t.hit.taskId,t.hit.tabId??null),Ie(),t.kind===`hit`&&Pq(t.hit.taskId,t.hit)},C=e=>{if(e.key===`ArrowDown`)o(Math.min(b.length-1,x+1));else if(e.key===`ArrowUp`)o(Math.max(0,x-1));else if(e.key===`Enter`){let e=b[x];e&&S(e)}else return;e.preventDefault()},w=m!==``&&(h.length>0||m.length>=2),T=0,E=()=>T++;return(0,K.jsx)(za,{title:sK(`palette`),wide:!0,children:(0,K.jsxs)(`div`,{className:`${Yi} palette`,onKeyDown:C,children:[(0,K.jsx)(`input`,{className:lr,autoFocus:!0,spellCheck:!1,value:r,placeholder:sK(`search`),onChange:e=>{i(e.target.value),o(0)}}),(0,K.jsxs)(`div`,{className:or,ref:s,style:{maxHeight:`${(w?18:Fq)*1.9}em`},children:[b.length===0&&v.kind!==`searching`&&(0,K.jsx)(`p`,{className:`text-muted`,children:sK(`noResults`)}),w&&d.length>0&&(0,K.jsx)(cq,{children:U(`search.commands`)}),d.map(e=>{let t=E();return(0,K.jsx)(`button`,{type:`button`,className:sr(t===x),title:e.name,onMouseEnter:()=>o(t),onClick:()=>S({kind:`command`,row:e}),children:(0,K.jsx)(`span`,{className:cr,children:`${t===x?`› `:` `}${e.name}`})},e.command.id)}),_.map(e=>{let t=E();return(0,K.jsx)(q,{variant:`row`,className:sr(t===x),title:e.name,onMouseEnter:()=>o(t),onClick:()=>S({kind:`page`,...e}),children:(0,K.jsx)(`span`,{className:cr,children:`${t===x?`› `:` `}${e.name}`})},e.id)}),f.map(e=>{let t=E();return(0,K.jsx)(q,{variant:`row`,className:sr(t===x),title:e.name,onMouseEnter:()=>o(t),onClick:()=>S({kind:`machines`,...e}),children:(0,K.jsx)(`span`,{className:cr,children:`${t===x?`› `:` `}${e.name}`})},`machines`)}),p.map(e=>{let t=E();return(0,K.jsx)(q,{variant:`row`,className:sr(t===x),title:e.name,onMouseEnter:()=>o(t),onClick:()=>S({kind:`report`,...e}),children:(0,K.jsx)(`span`,{className:cr,children:`${t===x?`› `:` `}${e.name}`})},`report`)}),h.length>0&&(0,K.jsx)(cq,{children:U(`search.tasks`)}),h.map(e=>{let t=E();return(0,K.jsx)(uq,{title:e.label,repo:e.archived?U(`search.archived`,{repo:Jo(e.repo)}):Jo(e.repo),selected:t===x,onHover:()=>o(t),onOpen:()=>S({kind:`task`,task:e})},e.id)}),v.kind!==`idle`&&(0,K.jsx)(cq,{children:U(`search.inConversations`)}),v.kind===`searching`&&(0,K.jsx)(lq,{children:U(`search.searching`)}),v.kind===`failed`&&(0,K.jsx)(lq,{error:!0,children:v.message}),v.kind===`done`&&y.length===0&&(0,K.jsx)(lq,{children:U(`search.none`,{query:v.query})}),y.map(e=>{let t=E();return(0,K.jsx)(dq,{hit:e,query:v.kind===`done`?v.query:``,selected:t===x,onHover:()=>o(t),onOpen:()=>S({kind:`hit`,hit:e})},`${e.taskId}:${e.tabId??``}:${e.at}:${t}`)}),v.kind===`done`&&v.reply.truncated&&(0,K.jsx)(lq,{children:U(`search.truncated`)}),v.kind===`done`&&v.reply.skipped.length>0&&(0,K.jsx)(lq,{children:U(`search.skipped`,{count:v.reply.skipped.length})})]}),(0,K.jsx)(`p`,{className:`keys-only text-muted`,children:sK(`run`)})]})})}A();var Bq=O(null);function Vq(e){let t=(document.activeElement?.closest(`.rail`)==null?null:Bq.get())??e.selection.get().taskId;return e.tasks.get()?.tasks.find(e=>e.id===t)??null}var Hq=[`latest`,`next`,`nightly`],Uq={appearance:{enabled:`On`,disabled:`Off`,borderFlow:`Flowing gradient`,borderStill:`Still`,glyphsBraille:`Braille`,glyphsStarburst:`Starburst (needs a font with the Dingbats block)`,glyphsAscii:`ASCII`,titleShimmer:`Shimmer`,titleStill:`Still`,preview:`Workspace preview`,tasks:`Tasks`,terminal:`Terminal`,files:`Files`,testsPassed:`Tests passed`,transparent:`Transparent background`,opaque:`Opaque background`,modeDark:`Dark`,modeLight:`Light`,modeAuto:`Auto (follow the terminal)`,openHint:`Enter to choose an option and preview it.`,chooseHint:`↑/↓ or j/k preview · enter apply · esc cancel`,importFromTerminal:`Import from {terminal}`,themePackage:`· package: colours here, layout and components in the web client`,syncFromTerminal:`Sync from {terminal}`}},Wq={appearance:{enabled:`开启`,disabled:`关闭`,borderFlow:`流动渐变`,borderStill:`静止`,glyphsBraille:`盲文点`,glyphsStarburst:`星芒(需要含 Dingbats 符号区的字体)`,glyphsAscii:`ASCII`,titleShimmer:`流光`,titleStill:`静止`,preview:`工作区预览`,tasks:`任务`,terminal:`终端`,files:`文件`,testsPassed:`测试通过`,transparent:`透明背景`,opaque:`不透明背景`,modeDark:`深色`,modeLight:`浅色`,modeAuto:`自动(跟随终端)`,openHint:`按 Enter 打开选项和预览。`,chooseHint:`↑/↓ 或 j/k 预览 · enter 应用 · esc 取消`,importFromTerminal:`从 {terminal} 导入`,themePackage:`· 主题包:这里只画配色,布局和组件在 web 端`,syncFromTerminal:`从 {terminal} 重新同步`}},Gq={autoRouting:{title:`Auto routing`,hint:"Routing by depth: a task says how deep the work is — swift, standard, deep — and this table says which engine, model and reasoning effort that depth runs on. Pick a depth in the new-task dialog (or `rove api add --tier`) and Rove fills those three fields from the row; you still see them and can change them before the task starts. enter (or click) a row to point it somewhere else, with the same picker a task uses. A row whose target cannot start says why here, not at launch.",unconfigured:`Auto routing is off: a depth has nowhere to route — its engine is blank. Point it somewhere below, or remove the empty autoRouting.<tier>.engine from state.json.`,engineDefault:`engine default`,ready:`● ready`,unavailable:`! unavailable — {reason}`,classifierTitle:`Classifier`,classifierHint:"The rows above say what each depth RUNS. This says who CHOOSES one: switch it on and `rove api add --tier auto` reads the task's first message and picks the depth for you. It is off by default, it is never required, and it can never fail a create — no key, no network, a timeout, or an answer it is not confident enough about all leave you on the depth you would have had.",classifierDataFlow:"! Turning the classifier on sends the task's first message to a third party that is NOT the engine vendor you picked — TypeSafe System One for `jev`, or whatever address you point `custom` at. It reads the text before your engine does. Nothing leaves this machine while it is off.",classifierLabel:`Choose with`,classifierOff:`off`,classifierCustomLabel:`custom`,classifierOffHint:`— nothing is sent anywhere`,classifierJevHint:`— TypeSafe System One, billed to your own key`,classifierCustomHint:`— your endpoint: POST the text, answer with a depth and a confidence`,endpointLabel:`Endpoint`,endpointUnset:`(none — enter one, then set Choose with to custom)`,endpointTitle:`Custom classifier endpoint`,endpointField:`URL`,endpointInvalidTitle:`Not a URL`,endpointInvalidBody:`The endpoint has to start with https://, or http:// for a loopback address (127.0.0.1, localhost, ::1) — over a network, plain http would carry the task's first 1,200 characters in cleartext. Leave it empty to clear it.`,thresholdLabel:`Confidence floor`,thresholdHint:`— below this, the depth is left alone`,thresholdTitle:`Confidence floor`,thresholdField:`0 to 1`,thresholdInvalidTitle:`Not a confidence`,thresholdInvalidBody:`The floor is a number between 0 and 1. 0.5 is the shipped default.`,keyLabel:`API key`,keyStored:`stored {hint} — enter to replace, empty to clear`,keyFromEnv:"from ${env} — the environment wins over a stored key",keyNone:`not set — enter to paste one`,keyTitle:`{env}`,keyPlaceholder:`paste the key; leave empty to clear the stored one`,keySaved:`● key stored in ~/.rove/secrets.json (owner-only, never in state.json)`,keyCustomUnused:`● no Authorization header is sent to a custom endpoint — set autoRouting.classifierCustomKeyEnv to the variable holding its key if it needs one`,keyNoVariableTitle:`No key variable for this endpoint`,keyNoVariableBody:`A custom classifier endpoint is sent no Authorization header until autoRouting.classifierCustomKeyEnv names the variable its key lives in. Set that first — a key stored under a name nothing reads is a key at rest for no purpose.`,keyWriteFailedTitle:`Key not saved`,keyWriteFailedBody:`~/.rove/secrets.json could not be written: {reason}. Check directory permissions and disk space, then save again.`,keyMissing:`! no key — nothing is chosen and tasks keep their usual depth`,keyPresentEnv:"● key read from ${env} in this process's environment"}},Kq={autoRouting:{title:`自动路由`,hint:"按深度路由:任务说明这活有多深——轻快、标准、深入——这张表说明那一档跑在哪个引擎、哪个模型、哪个推理强度上。在新建任务对话框里选一档(或 `rove api add --tier`),Rove 就照那一行填进这三个字段;任务启动前你仍然看得见、改得了。enter(或点击)某一行,用和任务一样的选择器把它指到别处。目标起不来的行会在这里说明原因,而不是等到启动时才炸。",unconfigured:`自动路由已关闭:有一档无处可去——它的引擎是空的。在下面把它指到某个引擎,或从 state.json 里删掉空的 autoRouting.<tier>.engine。`,engineDefault:`引擎默认`,ready:`● 可用`,unavailable:`! 不可用——{reason}`,classifierTitle:`分类器`,classifierHint:"上面几行说的是每一档**跑什么**,这里决定**由谁来选**:打开之后,`rove api add --tier auto` 会读任务的第一句话替你选档。默认关着,从来不是必需的,也永远不会让建 task 失败——没 key、断网、超时、或者它自己没把握,都只是让你停在本来就会用的那一档上。",classifierDataFlow:"! 打开分类器,任务的第一句话会发给一个**不是你选的那个引擎厂商**的第三方——`jev` 是 TypeSafe System One,`custom` 是你自己填的地址。它比你的引擎更早读到这段文字。关着的时候什么都不发。",classifierLabel:`选档方式`,classifierOff:`关`,classifierCustomLabel:`自定义`,classifierOffHint:`——不向任何地方发送`,classifierJevHint:`——TypeSafe System One,走你自己的 key 计费`,classifierCustomHint:`——你自己的接口:POST 那段文本,返回一个档位加一个置信度`,endpointLabel:`接口地址`,endpointUnset:`(未填——先填一个,再把「选档方式」切到自定义)`,endpointTitle:`自定义分类器接口`,endpointField:`URL`,endpointInvalidTitle:`不是一个 URL`,endpointInvalidBody:`接口地址要以 https:// 开头;http:// 只在回环地址(127.0.0.1、localhost、::1)上接受——发到网络上的话,明文 http 会把任务的前 1200 个字符原样带走。留空则清除。`,thresholdLabel:`置信度下限`,thresholdHint:`——低于这个值就不动档位`,thresholdTitle:`置信度下限`,thresholdField:`0 到 1`,thresholdInvalidTitle:`不是一个置信度`,thresholdInvalidBody:`下限是 0 到 1 之间的数。出厂默认 0.5。`,keyLabel:`API key`,keyStored:`已存 {hint}——enter 可替换,留空清除`,keyFromEnv:"来自环境变量 ${env}——环境变量优先于存起来的那个",keyNone:`未设置——enter 粘贴一个`,keyTitle:`{env}`,keyPlaceholder:`粘贴 key;留空则清除已存的那个`,keySaved:`● key 存在 ~/.rove/secrets.json(仅本人可读,不会进 state.json)`,keyCustomUnused:`● 自定义接口不会收到 Authorization 头——它若需要凭据,把 autoRouting.classifierCustomKeyEnv 指向存它的变量`,keyNoVariableTitle:`这个接口还没有 key 变量`,keyNoVariableBody:`在 autoRouting.classifierCustomKeyEnv 指定存 key 的变量之前,自定义分类器接口不会收到任何 Authorization 头。先设那个——存在一个没人读的名字下面的 key,只是白白落在盘上。`,keyWriteFailedTitle:`key 没存下`,keyWriteFailedBody:`写不了 ~/.rove/secrets.json:{reason}。请检查目录权限和磁盘空间,再次保存。`,keyMissing:`! 没有 key——不会替你选档,任务保持原来的档位`,keyPresentEnv:"● key 来自本进程环境变量 ${env}"}},qq={dev:{reset:`Reset UI state`,resetHint:`Clears ~/.config/rove/state.json and ~/.rove/tasks.json, then quits Rove — relaunch to start fresh. Working session list, pane sizes, theme, model picks all reset. Worktrees on disk and engine session history are not touched.`,resetButton:`[enter] Reset`,restart:`Restart backend`,restartHint:`Stops the Rove daemon and relaunches this window on the installed build — picks up daemon / orchestrator / engine edits without quitting by hand. Running engine sessions live in the PTY host and survive it; other attached Rove windows reconnect on their own.`,restartButton:`[enter] Restart`,reload:`Reload settings`,reloadHint:"Applies hand edits to ~/.config/rove/state.json (from `rove config`) to this window without a restart.",reloadButton:`[enter] Reload`,reloadDone:`Reloaded: {count} changed.`,reloadUnchanged:`Already matches state.json; nothing changed.`,reloadFailed:`state.json could not be read, nothing changed: {error}`,doctorHint:"Daemon wedged or unresponsive? Restart backend does it from here; from a shell it is `rove daemon restart`. Hosted engine sessions stay alive across a daemon restart.",experimental:`Experimental`,remoteHint:"Remote projects (SSH): register a project whose git worktrees live on another host, driven from this local Rove. Unfinished — Hosted PTY engine launch over SSH is not implemented, and file/diff panes still degrade. Enables `rove add --remote`.",remote:`Remote projects`,autoStatusHint:`Auto status flow: a backlog task moves to in_progress when its engine starts a turn, and new sessions get a system-prompt note telling the agent to set in_review itself when the work is done. Never touches done/canceled.`,autoStatus:`Auto status flow`,dispatcherHint:"Field-notes dispatcher: task sessions file one-line gotchas (`rove api note`), and every session of that repo that starts later is handed them.",dispatcher:`Field-notes dispatcher`}},Jq={dev:{reset:`重置 UI 状态`,resetHint:`清空 ~/.config/rove/state.json 和 ~/.rove/tasks.json,然后退出 Rove——重新启动即可从头开始。工作会话列表、面板尺寸、主题、模型选择都会重置。磁盘上的 worktree 和引擎会话历史不受影响。`,resetButton:`[enter] 重置`,restart:`重启后端`,restartHint:`停止 Rove daemon,并以已安装的版本重新启动当前窗口——无需手动退出即可应用 daemon / orchestrator / engine 的改动。正在运行的引擎会话由 PTY host 托管,不受影响;其他已连接的 Rove 窗口会自行重连。`,restartButton:`[enter] 重启`,reload:`重新加载设置`,reloadHint:"把对 ~/.config/rove/state.json 的手动修改(来自 `rove config`)应用到当前窗口,无需重启。",reloadButton:`[enter] 重新加载`,reloadDone:`已重新加载:{count} 项有变化。`,reloadUnchanged:`已与 state.json 一致,没有变化。`,reloadFailed:`无法读取 state.json,未做任何改动:{error}`,doctorHint:"daemon 卡住或无响应?「重启后端」就能在这里完成;在 shell 里则是 `rove daemon restart`。Hosted PTY 引擎会话不会因 daemon 重启而退出。",experimental:`实验性`,remoteHint:"远程项目(SSH):注册一个 git worktree + 引擎都通过 SSH 跑在另一台主机上、由本地 Rove 驱动的项目。尚未完成——文件/diff 面板对远程仍会降级。启用 `rove add --remote`。",remote:`远程项目`,autoStatusHint:`自动状态流转:backlog 任务在其引擎开始一轮时移到 in_progress,新会话会拿到一条系统提示,告诉 agent 完成后自行设为 in_review。绝不触碰 done/canceled。`,autoStatus:`自动状态流转`,dispatcherHint:"现场笔记调度器:任务会话提交一行经验(`rove api note`),之后在该仓库启动的每个会话都会拿到这些笔记。",dispatcher:`现场笔记调度器`}},Yq={engines:{title:`Engines`,hint:`Engines Rove can start on this machine. New tasks start with the default engine; switch an engine off to stop offering it.`,keys:`space available · d default · enter launch command · r rename · x reset/remove`,customTag:`custom`,available:`available`,off:`off`,defaultMark:`default`,makeDefault:`Make default`,status:{checking:`Checking…`,unknown:`Status unknown`,ready:`Ready`,notInstalled:`Not installed`,notOnPath:`Not on PATH`,signIn:`Sign in needed`,integrationMissing:`Integration not installed`,integrationOutdated:`Integration outdated`,integrationBlocked:`Integration blocked`},detail:{program:`Program`,command:`Command`,signIn:`Sign-in`,reporting:`Live status`,adapter:`Adapter`,programFound:`{binary} found at {path}.`,programFoundVersion:`{binary} {version} found at {path}.`,programMissing:`{binary} is not on PATH. Install the engine's CLI, or point its launch command at it.`,programUnknown:`Rove could not check for {binary}.`,commandDefault:`{command} (the default)`,commandCustom:`{command} (yours)`,signedIn:`Signed in.`,signedInAs:`Signed in as {who}.`,apiKey:`An API key is configured.`,token:`A token is configured ({source}).`,signedOut:`Not signed in. Sign in with the engine's own CLI.`,signInUnknown:`Rove can't see whether this engine is signed in.`,signInFailed:`Sign-in check failed: {error}`,hooksInstalled:`Rove's hooks are installed, so tabs report their state as it changes.`,hooksOutdated:`Rove's hooks are from an older version; reinstall them under Engine integrations.`,hooksMissing:`Rove's hooks are not installed; install them under Engine integrations.`,hooksAwaitEngine:`Rove's hooks can be installed once the engine is.`,hooksUnsupported:`This engine has no hooks for Rove to install.`,hooksBlocked:`Rove can't write its hooks into {file}: {reason}`,hooksBlockedHere:`Rove can't write its hooks into the engine's config: {reason}`,markersYes:`It leaves turn-complete markers that Rove reads back.`,markersNo:`It leaves no turn-complete markers.`,screenYes:`Screen rules cover what the hooks don't.`,screenNo:`No screen rules.`,screenNotNeeded:`No screen rules; the hooks report everything.`,adapterDeclared:`Borrows the {protocol} adapter.`,adapterGeneric:`Generic adapter: no transcript reader, sign-in check or resume.`,skill:`Rove skill`,skillInstalled:`Installed in {dir}.`,skillInstalledHere:`Installed and current.`,skillOutdated:`From an older Rove; reinstall it under Rove agent skill.`,skillMissing:`Not installed; install it under Rove agent skill.`},skill:{title:`Rove agent skill`,hint:`Teaches the agent in each engine to drive Rove itself (rove api): start tasks, read other sessions, message them.`,install:`Install ({count})`,noEngines:`No engine here takes the skill`,failed:`Install failed: {reason}`,bannerTitle:`ROVE SKILL NOT INSTALLED`,bannerHint:`{engines} can't drive Rove yet (start tasks, read other sessions). Click here to install.`,bannerHintWeb:`{engines} can't drive Rove yet (start tasks, read other sessions).`},integrations:{title:`Engine integrations`,hint:`Hooks Rove writes into each engine's own config, so a tab shows working, waiting or done the moment it happens.`,summary:`{installed} of {total} installed`,install:`Install missing ({count})`,upToDate:`All up to date`,remove:`Remove all ({count})`,noneInstalled:`Nothing to remove`},addEngine:`+ Add engine`,permissionsTitle:`Permissions`,permissionBypass:`Skip permission prompts`,permissionBypassHint:`Starts Claude, Codex, Antigravity and Cursor with their skip-permissions flag so unattended sessions don't stall on an approval. Left alone if your launch command already picks a mode.`,launchCommandTitle:`{name} launch command`,displayNameTitle:`{name} display name (blank = default)`,addTitle:`Add engine`,addStepTitle:`Add engine · {id}`,protocolTitle:`Add engine · {id} — protocol`,protocolNone:`None — generic adapter`,protocolFooter:`↑↓ choose · enter pick · esc cancel`,protocolRow:`protocol {protocol}`,protocolGeneric:`generic`,idPlaceholder:`lowercase slug, e.g. aider`,commandPlaceholder:`e.g. aider --model sonnet`,hookTrustHint:`Open {command} in the engine and approve hooks yourself. Written hooks are not proof of trust.`,readiness:`CLI: {cli} · login: {login} · hooks: {hooks}`,cliReady:`available`,cliMissing:`missing; install the engine CLI`,loginReady:`detected`,loginMissing:`sign in with the engine CLI`,readinessUnknown:`not observable`,hooksWritten:`written`,hooksMissing:`not written; Settings → Engines`,hooksOutdated:`outdated; Settings → Engines`,hookWaiting:`No hook event received yet. After approval, send a short prompt to verify activity.`,hookReceived:`Hook event recorded for this tab. Send a short prompt to check current reporting; current trust is not inferred.`,readinessFailed:`Readiness check unavailable; run rove doctor. No authorization is inferred.`},accounts:{checking:`Checking…`,notLoggedIn:`○ Not logged in`,loggedIn:`● Logged in: {email}`,apiKeyConfigured:`● API key configured`,chatgptLogin:`● ChatGPT login: {email}`,tokenConfigured:`● Token configured ({source})`,detected:`● Login detected`}},Xq={engines:{title:`引擎`,hint:`Rove 能在这台机器上启动的引擎。新任务默认用「默认」引擎;关掉某个引擎,选引擎时就不再列出它。`,keys:`space 可用 · d 设为默认 · enter 启动命令 · r 重命名 · x 重置/移除`,customTag:`自定义`,available:`可用`,off:`已关`,defaultMark:`默认`,makeDefault:`设为默认`,status:{checking:`检查中…`,unknown:`状态未知`,ready:`就绪`,notInstalled:`未安装`,notOnPath:`不在 PATH 上`,signIn:`需要登录`,integrationMissing:`未安装接入`,integrationOutdated:`接入已过期`,integrationBlocked:`接入被拒绝`},detail:{program:`程序`,command:`命令`,signIn:`登录`,reporting:`实时状态`,adapter:`适配器`,programFound:`{binary} 位于 {path}。`,programFoundVersion:`{binary} {version} 位于 {path}。`,programMissing:`{binary} 不在 PATH 上。请安装引擎 CLI,或把启动命令指向它。`,programUnknown:`Rove 无法检查 {binary}。`,commandDefault:`{command}(默认)`,commandCustom:`{command}(自定义)`,signedIn:`已登录。`,signedInAs:`已登录:{who}。`,apiKey:`已配置 API key。`,token:`已配置 Token({source})。`,signedOut:`未登录。请用引擎自己的命令行登录。`,signInUnknown:`Rove 无法得知该引擎是否已登录。`,signInFailed:`登录检查失败:{error}`,hooksInstalled:`Rove 的钩子已安装,标签页的状态会实时上报。`,hooksOutdated:`Rove 的钩子来自旧版本;请在「引擎接入」里重新安装。`,hooksMissing:`Rove 的钩子未安装;请在「引擎接入」里安装。`,hooksAwaitEngine:`引擎安装后才能装 Rove 的钩子。`,hooksUnsupported:`该引擎没有可供 Rove 安装的钩子。`,hooksBlocked:`Rove 无法把钩子写入 {file}:{reason}`,hooksBlockedHere:`Rove 无法把钩子写入引擎配置:{reason}`,markersYes:`它会留下回合完成标记,Rove 可以读回。`,markersNo:`它不留下回合完成标记。`,screenYes:`读屏规则兜底钩子覆盖不到的状态。`,screenNo:`没有读屏规则。`,screenNotNeeded:`没有读屏规则;钩子已报全所有状态。`,adapterDeclared:`借用 {protocol} 适配器。`,adapterGeneric:`通用适配器:没有会话记录读取、登录检查和恢复。`,skill:`Rove 技能`,skillInstalled:`已安装在 {dir}。`,skillInstalledHere:`已安装,是最新版。`,skillOutdated:`来自旧版 Rove;请在「Rove 智能体技能」里重新安装。`,skillMissing:`未安装;请在「Rove 智能体技能」里安装。`},skill:{title:`Rove 智能体技能`,hint:`教会各引擎里的智能体自己操作 Rove(rove api):开任务、读其他会话、给它们发消息。`,install:`安装({count})`,noEngines:`这台机器上没有能装技能的引擎`,failed:`安装失败:{reason}`,bannerTitle:`ROVE 技能未安装`,bannerHint:`{engines} 还不能操作 Rove(开任务、读其他会话)。点这里安装。`,bannerHintWeb:`{engines} 还不能操作 Rove(开任务、读其他会话)。`},integrations:{title:`引擎接入`,hint:`Rove 写进各引擎自身配置的钩子,让标签页在工作、等待、完成的那一刻就显示出来。`,summary:`已安装 {installed}/{total}`,install:`安装缺失的({count})`,upToDate:`全部已是最新`,remove:`全部移除({count})`,noneInstalled:`没有可移除的`},addEngine:`+ 添加引擎`,permissionsTitle:`权限`,permissionBypass:`跳过权限确认`,permissionBypassHint:`启动 Claude、Codex、Antigravity、Cursor 时带上它们跳过权限确认的参数,免得无人值守的会话卡在审批上。启动命令里已经选了权限模式的不再追加。`,launchCommandTitle:`{name} 的启动命令`,displayNameTitle:`{name} 的显示名称(留空 = 默认)`,addTitle:`添加引擎`,addStepTitle:`添加引擎 · {id}`,protocolTitle:`添加引擎 · {id} —— 协议`,protocolNone:`无 —— 通用适配器`,protocolFooter:`↑↓ 选择 · enter 确认 · esc 取消`,protocolRow:`协议 {protocol}`,protocolGeneric:`通用`,idPlaceholder:`小写短名,如 aider`,commandPlaceholder:`如 aider --model sonnet`,hookTrustHint:`在引擎中打开 {command},由你自行批准 hooks。写入不代表已授权。`,readiness:`CLI:{cli} · 登录:{login} · hooks:{hooks}`,cliReady:`可用`,cliMissing:`缺失;请安装引擎 CLI`,loginReady:`已检测到`,loginMissing:`请通过引擎 CLI 登录`,readinessUnknown:`无法观测`,hooksWritten:`已写入`,hooksMissing:`未写入;设置 → 引擎`,hooksOutdated:`已过时;设置 → 引擎`,hookWaiting:`尚未收到 hook 事件。授权后发送一条简短提示,验证活动状态。`,hookReceived:`已记录此标签页的 hook 事件。发送简短提示以检查当前上报;不据此推断当前授权。`,readinessFailed:`无法检查就绪状态;请运行 rove doctor。不会据此推断已授权。`},accounts:{checking:`检查中…`,notLoggedIn:`○ 未登录`,loggedIn:`● 已登录: {email}`,apiKeyConfigured:`● 已配置 API key`,chatgptLogin:`● ChatGPT 登录: {email}`,tokenConfigured:`● 已配置 Token ({source})`,detected:`● 检测到登录`}},Zq={plugins:{title:`Plugins`,hint:"Rove's first-party mods first: enter (or click) installs or uninstalls one, and uninstalling keeps its data on disk. Then the plugins registered in ~/.rove/plugins.json: enter toggles one on or off — the daemon watches the file, so the change applies live. Rows indented under a plugin are the settings it declares; enter edits one, and the value reaches the plugin on its next run. Install and remove them from the shell: `rove plugin install <owner/repo>`, `rove plugin link <dir>`.",empty:"Kanban and Issues are first-party mods: enter (or click) installs one. No other plugins registered; add one with `rove plugin install <owner/repo>` — browse the `rove-plugin` topic on GitHub.",sourceLink:`linked {path}`,sourceGithub:`{spec}`,sourceBuiltIn:`first-party mod · not installed`,sourceBuiltInInstalled:`first-party mod · installed`,updateAvailable:`update available — rove plugin update`,declares:`{actions} actions · {events} events · {panes} panes`,declaresWithEngines:`{actions} actions · {events} events · {panes} panes · {engines} engines`,declaresPages:`· {pages} pages`,pageFailed:`page {detail}`,manifestUnreadable:`manifest unreadable; check the rove-plugin.toml path and TOML syntax`,unsupportedPlatform:`· not supported on this platform`,noHooks:`· no hooks declared`,lastRun:`· last run {label} {status} {ago} ago`,neverRun:`· never run`,runOk:`ok`,runRunning:`still running`,runFailed:"failed to start; inspect `rove plugin log <id>`",runExit:`exit {code}`,settingUnset:`(unset — enter to edit)`,settingInvalidTitle:`Not a number`,settingInvalidBody:`{label} only accepts a number. Keeping the previous value.`},marketplace:{title:`Marketplace`,hint:"Plugins published under the `rove-plugin` topic on GitHub, most-starred first. enter (or click) shows what the install would run and asks before running any of it. The listing is re-queried each time you open this section.",loading:`Searching GitHub…`,empty:`No plugins listed.`,offline:`GitHub is unreachable — showing first-party plugins only. Re-open this section to retry.`,installedTag:`installed`,firstParty:`first-party`,preparing:`cloning {ref}…`,installing:`building and registering {name}…`,installed:`installed {id} v{version} — it is enabled, and appears under Plugins.`,cancelled:`install cancelled; nothing was run.`,failed:`install failed: {error}. Check the build output and retry from Marketplace.`,alreadyInstalled:`already installed as {id} — manage it under Plugins.`,confirmTitle:`Install {name}?`,confirmInstall:`install`,previewSource:`source: {source}`,previewCommands:`Commands this plugin declares:`,previewNoCommands:`This plugin declares no commands.`,previewWarning:`warning: {warning}`,previewTrust:`Installing runs the build commands above, and the rest run later on the events they declare. They run as you, with your environment, and nothing is sandboxed.`}},Qq={plugins:{title:`插件`,hint:"先列 Rove 官方 mod:enter(或点击)安装或卸载,卸载后数据仍留在磁盘上。再列在 ~/.rove/plugins.json 里注册的插件:enter 切换启用/禁用——daemon 监听该文件,改动实时生效。插件下方缩进的行是它声明的设置项,enter 编辑,新值在插件下次运行时生效。安装与移除在 shell 里做:`rove plugin install <owner/repo>`、`rove plugin link <dir>`。",empty:"Kanban 和 Issues 是官方 mod:enter(或点击)安装。尚未注册其他插件;用 `rove plugin install <owner/repo>` 安装一个——可在 GitHub 的 `rove-plugin` 话题下浏览。",sourceLink:`本地链接 {path}`,sourceGithub:`{spec}`,sourceBuiltIn:`官方 mod · 未安装`,sourceBuiltInInstalled:`官方 mod · 已安装`,updateAvailable:`有新版本 — rove plugin update`,declares:`{actions} 个动作 · {events} 个事件 · {panes} 个面板`,declaresWithEngines:`{actions} 个动作 · {events} 个事件 · {panes} 个面板 · {engines} 个引擎`,declaresPages:`· {pages} 个页面`,pageFailed:`页面 {detail}`,manifestUnreadable:`manifest 无法解析;请检查rove-plugin.toml 的路径和 TOML 语法`,unsupportedPlatform:`· 不支持当前平台`,noHooks:`· 未声明钩子`,lastRun:`· 上次运行 {label} {status} {ago}前`,neverRun:`· 尚未运行过`,runOk:`成功`,runRunning:`仍在运行`,runFailed:"启动失败;请查看 `rove plugin log <id>`",runExit:`退出码 {code}`,settingUnset:`(未设置 — enter 编辑)`,settingInvalidTitle:`不是数字`,settingInvalidBody:`{label} 只接受数字,保留原值。`},marketplace:{title:`插件市场`,hint:"GitHub 上 `rove-plugin` 话题下发布的插件,按 star 数排序。enter(或点击)会先列出安装会执行的命令,确认后才真正执行。每次进入本区块都会重新查询列表。",loading:`正在搜索 GitHub…`,empty:`列表为空。`,offline:`GitHub 不可达——只显示首方插件。重新进入本区块可再试一次。`,installedTag:`已安装`,firstParty:`首方`,preparing:`正在克隆 {ref}…`,installing:`正在构建并注册 {name}…`,installed:`已安装 {id} v{version}——已启用,可在「插件」区块管理。`,cancelled:`已取消安装,没有执行任何命令。`,failed:`安装失败:{error}。请检查构建输出,再从插件市场重试。`,alreadyInstalled:`已安装为 {id}——在「插件」区块管理。`,confirmTitle:`安装 {name}?`,confirmInstall:`安装`,previewSource:`来源:{source}`,previewCommands:`该插件声明的命令:`,previewNoCommands:`该插件未声明任何命令。`,previewWarning:`警告:{warning}`,previewTrust:`安装会执行上面的 build 命令,其余命令会在它们声明的事件发生时执行。它们以你的身份、带你的环境变量运行,没有任何沙箱。`}},$q={...Uq,title:`Settings`,esc:`esc`,search:{placeholder:`Search settings…`,hint:`/ Search settings…`,title:`Search results`,count:`{count} results`,countOne:`1 result`,empty:`No settings match "{query}".`,emptyHint:`Try another keyword or press esc to return.`,clear:`Clear search`},nav:{default:`j/k pick · h/l switch level · / search · enter activate · esc close`,keys:`j/k pick · / search · enter record a key · backspace default · x unbind · esc close`,feedback:`tab next field · enter sends on Send · esc close`,search:`↑/↓ pick · enter jump · esc cancel`},groups:{preferences:`Preferences`,agents:`Agents`,more:`More`},sections:{general:`General`,engines:`Engines`,autoRouting:`Auto routing`,plugins:`Plugins`,marketplace:`Marketplace`,keys:`Keybindings`,feedback:`Feedback`,dev:`Dev`},general:{usage:`USAGE`,theme:`Theme`,themeMode:`Mode`,themeHint:`l to enter list · j/k to highlight · enter to apply`,language:`Language`,languageHint:`Display language for Rove's UI. l to enter list · j/k to highlight · enter to apply.`,transparent:`Transparent background`,transparentHint:`Drops the renderer's bg fill so the host terminal shows through. enter toggles.`,on:`[x] on`,off:`[ ] off`,focusAccent:`Focus accent`,focusAccentHint:`Color of focused pane title, ▌ marker, and split borders.`,accentPrimary:`Primary (brand accent)`,accentSuccess:`Success (legacy green)`,accentInfo:`Info (cool blue)`,appearance:`Appearance`,appearanceHint:`How split panes draw.`,splitStyle:`Split panes`,workingBorder:`Working border`,taskColors:`Task colors`,glyphSet:`State glyphs`,colorblind:`Colorblind diff colours`,runningTitle:`Running title`,splitBox:`Box frames`,splitLine:`Divider line`,splitRail:`Accent rail`,splitRule:`Top rule`,notifications:`Notifications`,notificationsHint:`When a background tab finishes or pauses on an approval.`,toast:`Toast`,toastHint:`bottom-right popup`,sound:`Sound`,soundHint:`bell + chime + an OSC 9 desktop notification (rides SSH)`,soundVolume:`Chime volume — {percent}%`,soundVolumeHint:`enter cycles; applies to the next chime`,crossTask:`Cross-task`,crossTaskHint:`also for a task you switched away from`,finishedAlerts:`Finished turns`,finishedAlertsHint:`off: only approvals and errors alert; the unread dot stays`,keyHints:`Keyboard hints`,keyHintsHint:`The status-bar reminder of the command and help keys.`,keyHintsShow:`Show keyboard hints`,updates:`Updates`,updatesHint:`Stable is the default channel; next previews the coming release; nightly is built from main every day.`,updateChannelTitle:`Release channel`,updateChannel:`Channel: {channel}`,updateChannelHint:"enter cycles stable / next / nightly; `rove update` follows it",updateChannelName:{latest:`stable`,next:`next preview`,nightly:`nightly preview`},updateNotify:`Notify on updates`,updateNotifyHint:`new versions on this channel; off hides the update chip, and checking by hand still reports`,updateCheck:`[ Check for updates ]`,updateCheckHint:`asks npm for the newest release on this channel right now`,updateCheckButton:`Check for updates`,updateChecking:`Checking…`,updateOpenPage:`Open Update page`,updateOpenPageRow:`[ Open Update page ]`,railFold:`Folded task rail`,railFoldHint:`What the rail shows once folded away from its corner control.`,railFoldRow:`Folded rail shows: {style}`,railFoldRowHint:`enter cycles`,railFoldGlyphs:`status glyphs`,railFoldInitials:`glyph + initials`,railFoldHairline:`colour band only`,editor:`Editor`,editorHint:`What enter opens a file with in the file tree — diff mode when the editor supports it, the read-only preview when it isn't installed.`,editorRow:`editor: < {kind} >`,editorRowHint:`auto follows $VISUAL / $EDITOR, else nvim / vim / emacs / nano`,editorCustom:`custom: {cmd}`,editorCustomUnset:`(unset — enter to edit)`,worktree:`Worktree location`,worktreeHint:`Where new task worktrees are created. New tasks only.`,worktreeBase:`location: < {kind} >`,worktreeBaseHint:"custom takes `~`, a relative path, or a leading `$project_dir`",worktreeKindDefault:`default ~/.rove/worktrees`,worktreeKindNext:`next to project`,worktreeKindCustom:`custom`,worktreeCustom:`custom: {path}`,worktreeCustomUnset:`(unset — enter to edit)`,worktreeBaseTitle:`Custom worktree location (blank = default; $project_dir = project root)`,worktreeBaseField:`PATH`,editorCustomTitle:`Custom editor command (use {file} for the path)`,worktreeBaseInvalidTitle:`Can't use that worktree location`,worktreeBaseTokenBody:`{token} only expands as the leading path segment (e.g. {token}/../rove-worktrees). Keeping the previous setting.`,worktreeBaseUnusableBody:`{path} isn't usable ({error}). Keeping the previous setting — pick a writable directory.`,terminal:`Terminal`,terminalHint:`Applies to terminals opened after the change.`,scrollbackRow:`scrollback: {rows} rows`,scrollbackRowHint:`100–100000 · larger costs proportionally more CPU per redraw`,scrollbackTitle:`Terminal scrollback rows (100–100000)`,scrollbackField:`ROWS`,scrollbackInvalidTitle:`Not a number`,scrollbackInvalidBody:`Scrollback must be a number of rows (e.g. 1000). Keeping the previous setting.`,tabStripRow:`tab strip: {mode}`,tabStripMode:{never:`off — the sidebar tree lists tabs`,multipleOnly:`only with 2+ tabs`,always:`always`},usageShowTitle:`Usage`,usageShowHint:`How plan quota and context percentages read, in the footer and here.`,usageShowRow:`percentages: {mode}`,usageShowMode:{used:`used`,left:`left`}},field:{command:`COMMAND`,name:`NAME`,id:`ID`},action:{save:`save`,next:`next`,add:`add`},reset:{title:`Reset UI state?`,body:`Wipes ~/.config/rove/state.json and ~/.rove/tasks.json, then quits Rove — relaunch for a fresh start with an empty working session list. Worktrees on disk and engine session history are NOT touched.`,done:`Rove: UI state reset. Relaunch Rove to start fresh.`,failedTitle:`UI state was not reset`,failedBody:`Could not write the settings file. Your settings and tasks have been kept. Try resetting again.`},restart:{title:`Restart backend?`,body:`Stops the daemon and relaunches this Rove on the installed build, so daemon / orchestrator / engine edits take effect. Running engine sessions live in the PTY host and keep going; open tabs come back. Any other attached windows reconnect on their own.`,done:`Rove: restarting the backend...`},stateWrite:{failedTitle:`Settings were not saved`,failedBody:`{file} could not be written ({keys}). Check its directory permissions and free disk space, then save again.`},...Gq,...Yq,...Zq,keybindings:{title:`Keybindings`,hint:`Press enter on a binding, then the key you want. To put it behind the prefix, press the prefix key first. Changes are saved to the file below and apply at once.`,configFile:`Config file`,notCreated:` (not created yet)`,prefixTitle:`Command layer ({prefix})`,prefixHint:`Bare keys act in the focused pane; a small one-press set covers frequent Rove actions; {prefix} opens the command layer ({timeout}ms second-stroke window). Prefix bindings keep their pane scope and modal rules.`,tapPresentation:`Prefix tap`,tapPresentationHint:`Choose whether the complete guide also marks controls already on screen.`,tapPresentationLocal:`On-screen entries + complete guide (default)`,tapPresentationGuide:`Complete guide only`,prefixDisabled:`disabled`,prefixKey:`Prefix key`,recording:`press the new key… (esc cancels)`,recordingPrefix:`{prefix}, then… (esc cancels)`,recordingSlot:`press the key for {slot}… (esc cancels)`,unbound:`(unbound)`,defaultKeys:`default: {keys}`,warnings:`Warnings`},feedback:{title:`Feedback`,hint:"Files a GitHub issue on the Rove repo through `gh`. Requires `gh auth login`; without it you get a prefilled link to open.",titleLabel:`title`,titlePlaceholder:`Short summary`,descriptionLabel:`description`,descriptionPlaceholder:`What happened? (enter for a new line · tab to Send)`,send:`[enter] File a GitHub issue`,submitting:`submitting...`,sent:`filed #{number}: {url}`,notFiled:`not filed: {hint}
|
|
211
|
+
{url}`,error:`error: {message}
|
|
212
|
+
{hint}`},...qq},eJ={...Wq,title:`设置`,esc:`esc`,search:{placeholder:`搜索设置…`,hint:`/ 搜索设置…`,title:`搜索结果`,count:`{count} 项结果`,countOne:`1 项结果`,empty:`没有匹配「{query}」的设置。`,emptyHint:`换个关键词试试,或按 esc 返回。`,clear:`清除搜索`},nav:{default:`j/k 选择 · h/l 切换层级 · / 搜索 · enter 确认 · esc 关闭`,keys:`j/k 选择 · / 搜索 · enter 录入按键 · backspace 恢复默认 · x 解绑 · esc 关闭`,feedback:`tab 下一项 · enter 在发送项发送 · esc 关闭`,search:`↑/↓ 选择 · enter 跳转 · esc 取消`},groups:{preferences:`偏好`,agents:`智能体`,more:`更多`},sections:{general:`通用`,autoRouting:`自动路由`,engines:`引擎`,plugins:`插件`,marketplace:`插件市场`,keys:`快捷键`,feedback:`反馈`,dev:`开发`},general:{usage:`用量`,theme:`主题`,themeMode:`明暗`,themeHint:`l 进入列表 · j/k 高亮 · enter 应用`,language:`语言`,languageHint:`Rove 界面的显示语言。l 进入列表 · j/k 高亮 · enter 应用。`,transparent:`透明背景`,transparentHint:`去掉渲染器的背景填充,让宿主终端透出来。按 enter 切换。`,on:`[x] 开`,off:`[ ] 关`,focusAccent:`聚焦强调色`,focusAccentHint:`聚焦面板标题、▌ 标记和分隔边框的颜色。`,accentPrimary:`主色(品牌强调色)`,accentSuccess:`成功色(传统绿)`,accentInfo:`信息色(冷蓝)`,appearance:`外观`,appearanceHint:`分屏面板怎么画边。`,splitStyle:`分屏面板`,workingBorder:`运行中边框`,taskColors:`任务配色`,glyphSet:`状态符号`,colorblind:`色盲友好的增删配色`,runningTitle:`运行中标题`,splitBox:`方框边框`,splitLine:`单线分隔`,splitRail:`左侧强调条`,splitRule:`顶部横线`,notifications:`通知`,notificationsHint:`后台标签完成或在审批处暂停时触发。`,toast:`Toast 弹窗`,toastHint:`右下角弹窗`,sound:`声音`,soundHint:`响铃 + 提示音 + OSC 9 桌面通知(经 SSH 直达本地)`,soundVolume:`提示音音量 — {percent}%`,soundVolumeHint:`回车循环切换;下一声提示音生效`,crossTask:`跨任务`,crossTaskHint:`你已切走的任务也通知`,finishedAlerts:`回合完成`,finishedAlertsHint:`关闭后只有审批和错误会提醒;未读标记照常`,keyHints:`键盘提示`,keyHintsHint:`状态栏里的命令键和帮助键提醒。`,keyHintsShow:`显示键盘提示`,updates:`更新`,updatesHint:`稳定版是默认渠道;next 预览即将发布的版本;nightly 每天从 main 自动构建。`,updateChannelTitle:`发布渠道`,updateChannel:`渠道:{channel}`,updateChannelHint:"enter 在稳定版 / next / nightly 间切换;`rove update` 跟随它",updateChannelName:{latest:`稳定版`,next:`next 预览版`,nightly:`nightly 预览版`},updateNotify:`有新版本时通知我`,updateNotifyHint:`只针对所选渠道;关闭后不再显示更新标记,手动检查仍会给出结果`,updateCheck:`[ 检查更新 ]`,updateCheckHint:`立即向 npm 查询所选渠道的最新版本`,updateCheckButton:`检查更新`,updateChecking:`检查中…`,updateOpenPage:`打开更新页`,updateOpenPageRow:`[ 打开更新页 ]`,railFold:`折叠后的任务栏`,railFoldHint:`任务栏从角标折叠之后显示什么。`,railFoldRow:`折叠后显示:{style}`,railFoldRowHint:`enter 切换`,railFoldGlyphs:`状态字形`,railFoldInitials:`字形 + 首字母`,railFoldHairline:`仅色带`,editor:`编辑器`,editorHint:`文件树里按 enter 用什么打开文件——支持时走编辑器 diff 模式,未安装时回退到只读预览。`,editorRow:`编辑器: < {kind} >`,editorRowHint:`auto 跟随 $VISUAL / $EDITOR,否则 nvim / vim / emacs / nano`,editorCustom:`自定义: {cmd}`,editorCustomUnset:`(未设置 — enter 编辑)`,worktree:`工作树位置`,worktreeHint:`新任务工作树的创建位置。仅对新任务生效。`,worktreeBase:`位置: < {kind} >`,worktreeBaseHint:"自定义可填 `~`、相对路径或以 `$project_dir` 开头",worktreeKindDefault:`默认 ~/.rove/worktrees`,worktreeKindNext:`项目旁边`,worktreeKindCustom:`自定义`,worktreeCustom:`自定义: {path}`,worktreeCustomUnset:`(未设置 — enter 编辑)`,worktreeBaseTitle:`自定义工作树位置(留空 = 默认;$project_dir = 项目根目录)`,worktreeBaseField:`路径`,editorCustomTitle:`自定义编辑器命令(用 {file} 代表文件路径)`,worktreeBaseInvalidTitle:`无法使用该工作树位置`,worktreeBaseTokenBody:`{token} 只能作为路径的第一段展开(如 {token}/../rove-worktrees)。保留原设置。`,worktreeBaseUnusableBody:`{path} 不可用({error})。保留原设置 —— 请选择一个可写目录。`,terminal:`终端`,terminalHint:`对修改后新打开的终端生效。`,scrollbackRow:`回滚行数: {rows} 行`,scrollbackRowHint:`100–100000 · 调大会按比例增加每次重绘的 CPU`,scrollbackTitle:`终端回滚行数(100–100000)`,scrollbackField:`行数`,scrollbackInvalidTitle:`不是数字`,scrollbackInvalidBody:`回滚行数必须是数字(如 1000)。保留原设置。`,tabStripRow:`标签栏: {mode}`,tabStripMode:{never:`关闭 — 标签在左侧树里`,multipleOnly:`仅 2 个以上标签时显示`,always:`始终显示`},usageShowTitle:`用量`,usageShowHint:`套餐额度和上下文百分比的显示方式,作用于底栏和此处。`,usageShowRow:`百分比: {mode}`,usageShowMode:{used:`已用`,left:`剩余`}},field:{command:`命令`,name:`名称`,id:`标识`},action:{save:`保存`,next:`下一步`,add:`添加`},reset:{title:`重置界面状态?`,body:`将清除 ~/.config/rove/state.json 和 ~/.rove/tasks.json 并退出 Rove —— 重新启动后会是一个干净的开始,工作会话列表为空。磁盘上的工作树和引擎会话历史不受影响。`,done:`Rove:界面状态已重置。重新启动 Rove 即可从头开始。`,failedTitle:`UI 状态未能重置`,failedBody:`无法写入设置文件。设置和任务均已保留,请稍后重新尝试重置。`},restart:{title:`重启后端?`,body:`会停掉 daemon,并以已安装的版本重新启动当前 Rove 窗口,从而让 daemon / orchestrator / 引擎的改动生效。正在运行的引擎会话由 PTY host 托管,不会中断;已打开的标签页会恢复。其他已连接的窗口会自行重连。`,done:`Rove:正在重启后端……`},stateWrite:{failedTitle:`设置未能保存`,failedBody:`{file} 写入失败({keys})。请检查目录权限和磁盘空间,再次保存。`},...Kq,...Xq,...Qq,keybindings:{title:`快捷键`,hint:`在某一行按 enter,再按你想要的键。想放到 prefix 后面,就先按 prefix 键。改动会写进下面的文件,立即生效。`,configFile:`配置文件`,notCreated:` (尚未创建)`,prefixTitle:`命令层({prefix})`,prefixHint:`裸键作用于当前聚焦面板;少量单次快捷键覆盖高频 Rove 操作;{prefix} 打开命令层(第二击窗口 {timeout}ms)。Prefix 绑定保持原有的面板作用域和 modal 规则。`,tapPresentation:`点按 Prefix`,tapPresentationHint:`选择完整指南是否同时标记当前屏幕上的入口。`,tapPresentationLocal:`屏幕入口 + 完整指南(默认)`,tapPresentationGuide:`仅完整指南`,prefixDisabled:`已禁用`,prefixKey:`Prefix 键`,recording:`按下新的键…(esc 取消)`,recordingPrefix:`{prefix},然后…(esc 取消)`,recordingSlot:`按下「{slot}」对应的键…(esc 取消)`,unbound:`(已解绑)`,defaultKeys:`默认: {keys}`,warnings:`警告`},feedback:{title:`反馈`,hint:"通过 `gh` 在 Rove 仓库提一个 GitHub issue。需要 `gh auth login`;没登录时会给你一条预填好的链接。",titleLabel:`标题`,titlePlaceholder:`简短概括`,descriptionLabel:`描述`,descriptionPlaceholder:`发生了什么?(enter 换行 · tab 跳到发送)`,send:`[enter] 提交 GitHub issue`,submitting:`提交中...`,sent:`已提交 #{number}:{url}`,notFiled:`未提交:{hint}
|
|
213
|
+
{url}`,error:`错误:{message}
|
|
214
|
+
{hint}`},...Jq};G();var tJ={en:$q,zh:eJ},nJ={en:uo,zh:fo};function $(e,t){return vn(tJ,e,t)}function rJ(e,t){return vn(nJ,e,t)}He(),H();function iJ({label:e,value:t,picks:n,onPick:r}){let i=(0,J.useRef)(!1),[a,o]=(0,J.useState)(!1),s=e=>{if(Be())return o(!0);let i=e.getBoundingClientRect();de.set({x:i.left,y:i.bottom+4,right:i.right,minWidth:i.width,start:Math.max(n.findIndex(e=>e.value===t),0),target:e,items:n.map(n=>({label:n.label,checked:n.value===t,run:()=>{e.focus(),n.value!==t&&r(n.value)}}))})};return(0,K.jsxs)(K.Fragment,{children:[a&&(0,K.jsx)(yO,{title:e,value:t,picks:n,onPick:r,onClose:()=>o(!1)}),(0,K.jsxs)(`button`,{type:`button`,"aria-label":`${e}: ${n.find(e=>e.value===t)?.label??t}`,"aria-haspopup":`menu`,className:`relative inline-flex max-w-full min-w-0 items-center rounded-sm border-hairline border-line bg-inset py-1.5 pr-7 pl-2.5 text-left font-sans text-meta text-ink hover:border-line-active focus-visible:border-line-active focus-visible:outline-none data-menu-open:border-line-active touch:min-h-10 w-narrow:border-0 w-narrow:bg-transparent w-narrow:pr-5 w-narrow:pl-0 w-narrow:text-body w-narrow:text-muted`,onMouseDown:e=>{i.current=e.currentTarget.hasAttribute(`data-menu-open`)},onClick:e=>{i.current||s(e.currentTarget),i.current=!1},onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),s(e.currentTarget))},children:[(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:n.find(e=>e.value===t)?.label??t}),(0,K.jsx)(tI,{className:`pointer-events-none absolute top-1/2 right-2.5 -translate-y-1/2 text-subtle w-narrow:right-0`})]})]})}var aJ=`${Ui} w-narrow:pt-0`,oJ=`dialog relative m-0 flex h-[min(640px,80vh)] w-[min(880px,calc(100vw-32px))] overflow-hidden rounded-md border-hairline border-line bg-surface text-inherit shadow-dialog focus:outline-none motion-safe:animate-rise-in [.is-leaving_&]:animate-sink-out w-narrow:motion-safe:animate-push-in w-narrow:[.is-leaving_&]:animate-push-out w-narrow:bg-paper w-narrow:h-dvh w-narrow:w-screen w-narrow:flex-col w-narrow:rounded-none w-narrow:border-0 w-narrow:pt-[env(safe-area-inset-top)] w-narrow:translate-x-[var(--back-x,0px)] w-narrow:px-0 w-narrow:pb-[env(safe-area-inset-bottom)] short:h-[calc(100dvh-24px)]`,sJ=`absolute top-3 right-3 z-1 grid size-7 place-items-center rounded-sm text-display leading-none text-muted hover:bg-inset hover:text-ink focus-visible:bg-inset focus-visible:text-ink touch:size-10`,cJ=e=>`flex min-h-0 min-w-0 flex-1 flex-col w-narrow:motion-safe:animate-push-in ${e?`absolute inset-0 z-1 translate-x-(--back-x) bg-surface [padding:inherit] shadow-dialog w-narrow:bg-paper`:``}`,lJ=`flex w-56 flex-none flex-col gap-5 overflow-y-auto scrollbar-none [border-right:var(--hairline)_solid_var(--line)] px-2.5 py-4`,uJ=`m-0 px-2 pb-0.5 font-sans text-title font-semibold normal-nums text-ink`,dJ=`flex flex-col gap-2.5`,fJ=`relative flex items-center`,pJ=`pointer-events-none absolute left-2.5 block size-3.5 text-subtle w-narrow:left-3 w-narrow:size-4`,mJ=`${ki} w-full py-1.25 pr-7 pl-7.5 font-sans text-body w-narrow:min-h-10 w-narrow:rounded-[10px] w-narrow:border-0 w-narrow:bg-surface w-narrow:py-2 w-narrow:pr-9 w-narrow:pl-9`,hJ=`flex flex-col border-t-hairline border-t-line [&>*]:border-b-hairline [&>*]:border-b-line`,gJ=e=>`flex w-full flex-col gap-0.5 px-2.5 py-2.5 text-left transition-none focus-visible:outline-1 focus-visible:outline-offset-[-1px] focus-visible:outline-focus ${e?`bg-menu`:`hover:bg-hover`}`,_J=`flex w-full min-w-0 items-baseline justify-between gap-3`,vJ=`flex-none whitespace-nowrap font-mono text-meta text-subtle`,yJ=`data-[setting-flash=true]:-mx-2 data-[setting-flash=true]:rounded-sm data-[setting-flash=true]:border-b-transparent data-[setting-flash=true]:bg-accent-soft data-[setting-flash=true]:px-2 w-narrow:data-[setting-flash=true]:mx-0 w-narrow:data-[setting-flash=true]:rounded-none w-narrow:data-[setting-flash=true]:px-3`,bJ=`flex flex-col gap-0.5`,xJ=`m-0 px-2 pb-1 font-mono text-meta font-normal text-subtle`,SJ=`flex flex-col gap-0.5`,CJ=e=>`flex items-center rounded-sm px-2 py-1.25 text-left font-sans text-body text-ink touch:min-h-10 ${e?`bg-menu`:`hover:bg-hover`}`,wJ=`ml-auto block text-subtle`,TJ=`block size-5 flex-none fill-none stroke-current text-muted [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.4]`,EJ=`min-h-0 min-w-0 flex-1 overflow-y-auto scrollbar-none`,DJ=`flex w-full flex-col gap-7 px-8 pt-7 pb-10 w-narrow:gap-4 w-narrow:px-3 w-narrow:pt-0 w-narrow:pb-10`,OJ=`flex flex-col gap-1 pr-8 w-narrow:pr-0`,kJ=`m-0 font-sans text-display font-semibold normal-nums text-ink`,AJ=`m-0 text-body text-muted w-narrow:px-3 w-narrow:text-meta`,jJ=`flex flex-col gap-7 w-narrow:gap-4`,MJ=`flex flex-col`,NJ=`flex min-w-0 flex-wrap gap-x-4 text-meta`,PJ=`inline-flex min-h-6.5 min-w-0 items-center gap-2`,FJ=`block h-7 w-36 rounded-md border-hairline border-line bg-paper w-narrow:hidden`,IJ=`m-0 pb-1.5 font-sans text-meta font-medium normal-nums text-muted w-narrow:px-3 w-narrow:font-normal w-narrow:text-subtle`,LJ=`m-0 pb-2 text-meta text-subtle w-narrow:order-last w-narrow:px-3 w-narrow:pt-1.5 w-narrow:pb-0`,RJ=`flex flex-col border-t-hairline border-t-line [&>*]:border-b-hairline [&>*]:border-b-line w-narrow:overflow-hidden w-narrow:rounded-[12px] w-narrow:border-t-0 w-narrow:bg-surface w-narrow:[&>*]:px-3 w-narrow:[&>*:last-child]:border-b-0`,zJ=`w-narrow:grid w-narrow:grid-cols-[minmax(0,1fr)_auto] w-narrow:items-center w-narrow:gap-x-3 w-narrow:gap-y-0.5`,BJ=`flex items-center justify-between gap-x-6 gap-y-2 py-3 w-narrow:min-h-11 ${zJ}`,VJ=`flex items-center justify-between gap-x-6 py-3 ${zJ}`,HJ=`w-narrow:col-start-1 w-narrow:row-start-1 w-narrow:line-clamp-2`,UJ=`flex flex-col gap-3 py-3`,WJ=`flex min-w-0 flex-1 flex-col gap-0.5 w-narrow:contents`,GJ=`text-body text-ink w-narrow:text-title`,KJ=`text-meta text-muted [&_a]:text-accent`,qJ=`max-w-90 min-w-0 truncate font-mono text-meta text-muted [overflow-wrap:anywhere]`,JJ=`flex min-h-13 w-full items-center gap-3 py-2 text-left active:bg-hover`,YJ=`flex min-w-0 flex-1 flex-col gap-0.5`,XJ=`w-narrow:order-last`,ZJ=`flex flex-wrap items-center justify-between gap-2.5 w-narrow:flex-col w-narrow:items-stretch w-narrow:[&>fieldset]:self-start`,QJ=`m-0 py-3 text-body text-muted`,$J=`${ki} px-2.5 py-1.5 font-sans text-body`,eY=`${$J} w-24 text-right`,tY=`flex flex-col gap-1.5`,nY=`flex flex-wrap items-center justify-end gap-2.5`,rY=`flex items-center gap-2.5 rounded-sm bg-inset px-3 py-2 text-meta`,iY=`grid grid-cols-[minmax(0,1fr)_104px_72px] items-center gap-3`,aY=`flex flex-col`,oY=`${iY} pb-1.5 pl-7.5 font-sans text-meta font-medium normal-nums text-subtle [&>span:not(:first-child)]:text-center`,sY=`border-b-hairline border-b-line first:border-t-hairline first:border-t-line`,cY=`${iY} group/eng rounded-sm py-1.5 pr-1 pl-0`,lY=`flex min-w-0 items-center gap-2 rounded-sm py-1.5 pr-0 pl-1.5 text-left focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`,uY=e=>`mx-0.5 ${e?`text-muted`:`text-subtle`}`,dY=`flex min-w-0 flex-col gap-0.5`,fY=e=>`truncate text-body leading-[inherit] font-medium ${e?`text-muted`:`text-ink`}`,pY=`ml-2 text-meta leading-[inherit] font-normal text-subtle`,mY={ready:`bg-success`,attention:`bg-warning`,error:`bg-error`,absent:`bg-subtle`},hY=e=>`inline-flex items-center gap-1.5 text-meta leading-[inherit] ${e===`error`?`text-error`:`text-muted`}`,gY=e=>`size-1.75 flex-none rounded-full ${mY[e]}`,_Y=`flex justify-center`,vY=`rounded-full bg-accent-soft px-2.5 py-0.5 font-sans text-meta font-medium normal-nums capitalize text-accent`,yY=`rounded-full border-hairline border-line px-2.5 py-0.5 text-meta leading-[inherit] whitespace-nowrap text-muted opacity-0 transition-opacity duration-120 ease-[ease] group-hover/eng:opacity-100 group-focus-within/eng:opacity-100 hover:border-line-active hover:text-ink motion-reduce:transition-none touch:opacity-100`,bY=`relative flex min-h-13 items-center gap-3 px-3 py-2`,xY=`flex min-w-0 flex-1 items-center gap-3 text-left after:absolute after:inset-0 after:content-[''] active:after:bg-hover focus-visible:outline-none focus-visible:after:bg-hover`,SY=`truncate font-sans text-title text-ink`,CY=`block text-subtle`,wY=`px-2 pt-1 pb-3`,TY=`mt-0 mr-1 mb-3 ml-7 flex flex-col gap-2.5 px-1.5 py-1`,EY=`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-3.5 gap-y-1.5 text-meta leading-[1.5]`,DY=`text-subtle`,OY=e=>`m-0 wrap-anywhere ${e?`text-warning`:`text-ink`}`,kY=`flex items-center gap-2`,AY=`flex-1 px-2 py-1.25`,jY=`text-meta leading-[inherit] text-success`,MY=(e=!1)=>`overflow-hidden text-ellipsis text-meta text-muted ${e?`whitespace-normal`:`whitespace-nowrap`}`,NY=`flex flex-col gap-1 py-3 w-narrow:py-0`,PY=`flex items-baseline gap-3`,FY=`flex flex-col gap-2.5 pt-2 w-narrow:pb-3`,IY=`grid grid-cols-[repeat(auto-fill,minmax(96px,1fr))] gap-2`,LY=`m-0 pb-1.5 text-meta font-medium text-subtle`,RY=e=>e?`border-accent bg-accent-soft`:`border-line hover:bg-hover`,zY=`flex h-9 overflow-hidden rounded-xs border-hairline`,BY=`flex w-2/5 flex-col gap-0.75 p-1`,VY=`flex min-w-0 flex-1 flex-col gap-0.75 p-1`,HY=`h-0.75 rounded-xs`,UY=`mt-auto flex gap-0.75`,WY=`size-1 rounded-xs`,GY=`flex min-w-0 items-baseline gap-1.5 font-sans text-meta`,KY=`grid grid-cols-2 gap-2.5 w-narrow:grid-cols-1`,qY=(e=!1)=>`flex min-w-0 flex-col gap-2.5 rounded-md border-hairline border-line bg-surface p-3.5 w-narrow:rounded-[12px] w-narrow:border-0 w-narrow:p-3 ${e?`col-span-2 w-narrow:col-span-1`:``}`,JY=`flex min-w-0 items-center gap-3`,YY=`flex min-w-0 flex-wrap items-center justify-end gap-x-3 gap-y-2`,XY=`flex min-w-0 grow basis-60 items-center gap-3`,ZY=e=>`grid transition-[grid-template-rows,opacity] duration-300 ease-out motion-reduce:transition-none ${e?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`}`,QY=`group relative h-4.5 w-7.5 flex-none justify-self-center rounded-full border-hairline border-line bg-inset transition-[background,border-color] duration-120 ease-[ease] aria-checked:border-accent aria-checked:bg-accent motion-reduce:transition-none`,$Y=`absolute top-0.5 left-0.5 size-3 rounded-full bg-muted transition-[transform,background] duration-120 ease-[ease] group-aria-checked:[transform:translateX(12px)] group-aria-checked:bg-paper motion-reduce:transition-none`;function eX({on:e,...t}){return(0,K.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,className:QY,...t,children:(0,K.jsx)(`span`,{className:$Y})})}G(),He();function tX(e){return(0,K.jsxs)(`section`,{className:e.settingId?`${MJ} ${yJ}`:MJ,"data-setting-id":e.settingId,children:[e.title&&(0,K.jsx)(`h2`,{className:`m-0 pb-1.5 font-sans text-meta font-medium normal-nums text-muted w-narrow:px-3 w-narrow:font-normal w-narrow:text-subtle`,children:e.title}),e.hint&&(0,K.jsx)(`p`,{className:`m-0 pb-2 text-meta text-subtle w-narrow:order-last w-narrow:px-3 w-narrow:pt-1.5 w-narrow:pb-0`,children:e.hint}),(0,K.jsx)(`div`,{className:RJ,children:e.children})]})}function nX(e){let t=(0,K.jsxs)(`div`,{className:WJ,children:[(0,K.jsx)(`span`,{id:e.labelId,className:`${GJ} ${HJ}`,children:e.label}),e.hint&&(0,K.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent w-narrow:col-span-2`,children:e.hint}),e.sample&&(0,K.jsx)(`span`,{className:`mt-1.5 flex min-w-0 w-narrow:col-span-2`,children:e.sample})]}),n=e.settingId?` ${yJ}`:``;return e.stack?(0,K.jsxs)(`div`,{className:`${UJ}${n}`,"data-setting-id":e.settingId,children:[t,e.children]}):(0,K.jsxs)(`div`,{className:`${e.inline?VJ:BJ}${n}`,"data-setting-id":e.settingId,children:[t,e.children&&(0,K.jsx)(`div`,{className:`flex min-w-0 flex-none items-center justify-end gap-2 w-narrow:col-start-2 w-narrow:row-start-1 w-narrow:max-w-[55vw]`,children:e.children})]})}function rX(e){let t=(0,J.useId)();return(0,K.jsx)(nX,{label:e.label,hint:e.hint,labelId:t,settingId:e.settingId,inline:!0,children:(0,K.jsx)(eX,{on:e.checked,"aria-labelledby":t,disabled:e.disabled,onClick:()=>e.onChange(!e.checked)})})}var iX=36,aX=/[\u2e80-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef]/,oX=20;function sX(e,t=!1){let n=0;for(let t of e)for(let e of t.label)n+=aX.test(e)?2:1;return t?e.length===2&&n<=oX:e.length<=4&&n<=iX}function cX(e){let t=sX(e.picks,ke())?EW:iJ;return(0,K.jsx)(nX,{label:e.label,hint:e.hint,sample:e.sample,settingId:e.settingId,children:(0,K.jsx)(t,{label:e.label,value:e.value,picks:e.picks,onPick:e.onPick})})}function lX(e){return(0,K.jsx)(nX,{label:e.label,hint:e.note,settingId:e.settingId,children:(0,K.jsx)(`span`,{className:qJ,children:e.value})})}function uX(e,t){let[n,r]=(0,J.useState)(()=>Hs(e,t)),[i,a]=(0,J.useState)(null),o=(0,J.useCallback)(()=>Ws(e,t).then(e=>{r(e),a(null)},e=>a(Ra(e))),[e,t]);return(0,J.useEffect)(()=>e.onOpen(()=>void o()),[e,o]),{value:n,failed:i,reload:o}}function dX(e){return e.failed===null?(0,K.jsx)(`p`,{className:QJ,children:U(`preview.loading`)}):(0,K.jsxs)(`p`,{className:QJ,children:[U(`settings.loadFailed`,{error:e.failed}),` `,(0,K.jsx)(q,{onClick:e.onRetry,children:U(`settings.retry`)})]})}var fX=[`web`,`tui`,`ios`,`android`,`cli`,`daemon`],pX=[`ios`,`web`,`daemon`],mX=[`ios`,`web`,`tui`,`cli`,`daemon`,`android`],hX=/^([-*]\s+(?:(?:\[[^\]]*\]\([^)]*\)|#\d+|`[0-9a-f]{7,40}`)\s+)*)/,gX=/^\*\*([a-z]+(?: · [a-z]+)*)\*\*([ \t]+|$)/,_X=/^(?:feat|fix|refactor|perf|chore|docs|style|test|build|ci|revert)\(([a-z0-9_/-]+(?:\s*,\s*[a-z0-9_/-]+)*)\)!?:\s/,vX={web:`web`,"rove-web":`web`,bridge:`web`,"rove-bridge":`web`,ios:`ios`,"rove-ios":`ios`,iphone:`ios`,phone:`ios`,mobile:`ios`,android:`android`,"rove-android":`android`,tui:`tui`,"tui-react":`tui`,terminal:`tui`,cli:`cli`,api:`cli`,daemon:`daemon`,"rove-daemon":`daemon`,pty:`daemon`,"pty-host":`daemon`,orchestrator:`daemon`},yX=e=>fX.includes(e);function bX(e){let t=hX.exec(e);if(!t)return null;let n=e.slice(t[0].length),r=gX.exec(n);if(r){let e=r[1]?.split(` · `)??[];return e.length>0&&e.every(yX)?e:null}let i=_X.exec(n);if(!i?.[1])return null;let a=[];for(let e of i[1].split(/[,/]/)){let t=vX[e.trim().toLowerCase()];t&&!a.includes(t)&&a.push(t)}return a.length>0?a:null}function xX(e){let t=hX.exec(e);if(!t)return e;let n=e.slice(t[0].length),r=gX.exec(n);if(!r)return e;let i=r[1]?.split(` · `)??[];return i.length===0||!i.every(yX)?e:`${t[0]}${n.slice(r[0].length)}`}function SX(e){let t=e.trim().toLowerCase();return t===`major changes`||t===`重大更新`?`major`:t===`minor changes`||t===`功能更新`?`minor`:t===`patch changes`||t===`补丁更新`?`patch`:`custom`}function CX(e,t){let n=new Map;for(let t of e){let e=n.get(t.scope),r=t.lines.join(`
|
|
215
|
+
`).trimEnd();e?e.push(r):n.set(t.scope,[r])}let r=[];for(let e of t){let t=n.get(e);t&&t.length>0&&r.push({scope:e,entries:t,count:t.length})}return r}function wX(e,t){let n=[{heading:null,kind:null,preface:[],entries:[]}],r=[...t,`other`],i=mX.filter(e=>!t.includes(e));for(let r of e.replace(/\r\n/g,`
|
|
216
|
+
`).split(`
|
|
217
|
+
`)){let e=n[n.length-1],a=/^#{1,6}\s+(.*)$/.exec(r);if(a){let t=(a[1]??``).trim();e={heading:t,kind:SX(t),preface:[],entries:[]},n.push(e)}else if(/^[-*]\s/.test(r)){let n=bX(r),a,o;if(n===null)a=!0,o=`other`;else{let e=t.find(e=>n.includes(e));e?(a=!0,o=e):(a=!1,o=i.find(e=>n.includes(e))??n[0])}e.entries.push({lines:[xX(r)],own:a,scope:o})}else{let t=e.entries[e.entries.length-1];(t?t.lines:e.preface).push(r)}}let a=n.some(e=>e.heading!==null&&e.kind!==`patch`&&(e.entries.length>0||e.preface.some(e=>e.trim()!==``))),o=n.filter(e=>e.heading===null||!a&&e.kind===`patch`).map(e=>e.preface.join(`
|
|
218
|
+
`).trim()).filter(Boolean).join(`
|
|
219
|
+
|
|
220
|
+
`),s=[],c=[];if(a)for(let e of n){let t=CX(e.entries.filter(e=>e.own),r),n=CX(e.entries.filter(e=>!e.own),i);t.length>0&&s.push({heading:e.heading,sections:t}),n.length>0&&c.push({heading:e.heading,sections:n})}else{let e=n.flatMap(e=>e.entries),t=CX(e.filter(e=>e.own),r),a=CX(e.filter(e=>!e.own),i);t.length>0&&s.push({heading:null,sections:t}),a.length>0&&c.push({heading:null,sections:a})}return{preface:o,hasSignificantBump:a,own:s,other:c,ownCount:s.reduce((e,t)=>e+t.sections.reduce((e,t)=>e+t.count,0),0),otherCount:c.reduce((e,t)=>e+t.sections.reduce((e,t)=>e+t.count,0),0),hasScopedEntries:[...s,...c].some(e=>e.sections.some(e=>e.scope!==`other`))}}var TX=`[&_b]:mr-2.5`,EX=`${GB} flex flex-col overflow-hidden`,DX=`min-h-0 flex-1 overflow-y-auto`,OX=`[&_h2]:mx-0 [&_h2]:mt-3.5 [&_h2]:mb-1 [&_h2]:text-[length:var(--fs-body)]`,kX=`mt-5 first:mt-0`,AX=`mx-0 mt-0 mb-2 font-sans text-[length:var(--fs-body)] font-semibold text-accent`,jX=`mt-4 first:mt-0`,MX=`max-h-[55vh] overflow-x-hidden overflow-y-auto`,NX=`mr-auto text-[length:var(--fs-meta)]`,PX=`flex min-h-0 flex-1 flex-col gap-3 overflow-x-hidden overflow-y-auto px-5 pt-1 pb-3 [&_p]:m-0`,FX=`flex flex-none px-3 pt-2`,IX=`text-[length:var(--fs-body)] leading-[1.55] wrap-anywhere [&_ul]:m-0 [&_ul]:pl-4.5 [&_li+li]:mt-2 [&_p]:mx-0 [&_p]:mt-0 [&_p]:mb-2 [&_a]:text-accent [&_a]:underline [&_a]:underline-offset-2 [&_code]:rounded-sm [&_code]:bg-inset [&_code]:px-1 [&_code]:py-0 [&_code]:font-mono [&_code]:text-meta [&_code]:font-normal [&_code]:normal-nums`,LX=`mx-0 mt-3 mb-1.5 font-sans text-meta font-medium normal-nums text-muted first:mt-0`,RX=`mt-3`,zX=e=>`rounded-sm px-2 py-1.25 ${e?`bg-menu`:``}`,BX=`flex items-baseline gap-2 text-[length:var(--fs-body)]`,VX=`flex items-baseline justify-between gap-2`,HX=`font-mono`,UX=`truncate`,WX=`mt-4 text-[length:var(--fs-meta)]`;G();function GX(e){return e.replace(/\[`[0-9a-f]{7,40}`\]\([^)]*\)\s*/g,``).replace(/\s+[—-]\s+\[@[^\]]+\]\([^)]*\)\s*$/,``).trim()}function KX(e){let t=[],n=(e,n)=>t.push({kind:e,text:n,id:t.length});for(let r of e.split(/\r?\n/)){let e=r.trimEnd();if(e.trim()===``)continue;let i=/^#{1,6}\s+(.*)$/.exec(e);if(i){n(`heading`,i[1]??``);continue}let a=/^\s*[-*]\s+(.*)$/.exec(e);if(a){n(`item`,a[1]??``);continue}let o=t.at(-1);o&&o.kind!==`heading`?o.text=`${o.text} ${e.trim()}`:n(`para`,e.trim())}return t.map(e=>e.kind===`item`?{...e,text:GX(e.text)}:e)}var qX=/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)|`([^`]+)`|\*\*([^*]+)\*\*/g;function JX(e){let t=[],n=0;for(let r of e.matchAll(qX)){let i=r.index??0;i>n&&t.push(e.slice(n,i));let[a,o,s,c,l]=r;o!==void 0&&s!==void 0?t.push((0,K.jsx)(`a`,{href:s,target:`_blank`,rel:`noopener noreferrer`,children:JX(o)},i)):c===void 0?l!==void 0&&t.push((0,K.jsx)(`b`,{children:l},i)):t.push((0,K.jsx)(`code`,{children:c},i)),n=i+a.length}return n<e.length&&t.push(e.slice(n)),t}function YX({body:e}){let t=W()===`zh`?go:ho,n=wX(e,pX),r=e=>t.scopes[e];return(0,K.jsxs)(`div`,{className:IX,children:[n.preface&&(0,K.jsx)(ZX,{body:n.preface}),(0,K.jsx)(XX,{groups:n.own,scopeLabel:r,showScopeHeading:n.hasScopedEntries}),n.otherCount>0&&(0,K.jsxs)(`details`,{className:`mt-4 [&>summary]:cursor-pointer [&>summary]:select-none [&>summary]:py-1 [&>summary]:text-meta [&>summary]:text-muted [&>summary]:hover:text-ink touch:[&>summary]:py-2.5`,children:[(0,K.jsx)(`summary`,{children:t.otherClients.replace(`{count}`,String(n.otherCount))}),(0,K.jsx)(`div`,{className:`mt-2`,children:(0,K.jsx)(XX,{groups:n.other,scopeLabel:r,showScopeHeading:n.hasScopedEntries})})]})]})}function XX({groups:e,scopeLabel:t,showScopeHeading:n}){return e.map(e=>{let r=e.sections.map(e=>(0,K.jsxs)(`section`,{className:jX,children:[n&&(0,K.jsxs)(`div`,{className:`mx-0 mt-0 mb-1.5 flex items-baseline gap-2`,children:[(0,K.jsx)(`span`,{className:`font-mono text-meta font-semibold text-ink`,children:t(e.scope)}),(0,K.jsx)(`span`,{className:`rounded-xs bg-inset px-1.5 font-mono text-meta font-normal text-muted`,children:e.count})]}),(0,K.jsx)(ZX,{body:e.entries.join(`
|
|
221
|
+
|
|
222
|
+
`)})]},e.scope)),i=e.heading??e.sections.map(e=>e.scope).join(`,`);return e.heading?(0,K.jsxs)(`div`,{className:kX,children:[(0,K.jsx)(`h3`,{className:AX,children:e.heading}),r]},i):(0,K.jsx)(`div`,{children:r},i)})}function ZX({body:e}){let t=KX(e),n=[],r=[],i=()=>{r.length>0&&n.push((0,K.jsx)(`ul`,{children:r},`ul-${n.length}`)),r=[]};for(let e of t){if(e.kind===`item`){r.push((0,K.jsx)(`li`,{children:JX(e.text)},e.id));continue}i(),n.push(e.kind===`heading`?(0,K.jsx)(`h3`,{className:LX,children:e.text},e.id):(0,K.jsx)(`p`,{children:JX(e.text)},e.id))}return i(),n}wl(),G(),He(),xb(),A(),H(),Ur();var QX=O(null),$X=O(!1),eZ=(e,t)=>e.replace(/\{(\w+)\}/g,(e,n)=>t[n]??e),tZ=e=>`https://github.com/Sma1lboy/rove/releases/tag/v${e}`;function nZ(){return W()===`zh`?go:ho}function rZ(e,t){return e.request(`update.check`,{force:!0,locale:Cn.get(),channel:t}).then(e=>(QX.set(e),!0),()=>!1)}function iZ(){let e=nZ(),t=k(QX),{prefs:n}=hb();if(!n.updateNotify||!t?.info?.hasUpdate)return null;let r=eZ(e.available,{version:t.info.latest});return(0,K.jsxs)(q,{variant:`row`,className:`${Wn} whitespace-nowrap font-mono text-meta text-warning`,"aria-label":`${U(`rail.update`)} · ${r}`,title:r,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},onClick:()=>Ee(`update`),children:[`↑`,(0,K.jsxs)(`span`,{className:`rail-tight:hidden`,children:[` `,t.info.latest]})]})}function aZ({notes:e}){return e.map(e=>(0,K.jsxs)(`section`,{className:OX,children:[(0,K.jsxs)(`h2`,{className:`mono`,children:[`v`,e.version]}),(0,K.jsx)(YX,{body:e.body})]},e.version))}var oZ=1e3;function sZ(e){let[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(!0);return(0,J.useEffect)(()=>{if(!r)return;let t=!0,a,o=()=>e.request(`update.status`,{}).then(e=>{t&&(n(e.status),e.status?.running?a=setTimeout(o,oZ):i(!1))},()=>t&&i(!1));return o(),()=>{t=!1,clearTimeout(a)}},[e,r]),{run:t,setRun:n,poll:()=>i(!0)}}function cZ({client:e}){let t=nZ(),n=k(QX),[r,i]=(0,J.useState)(!1),a=k($X),[o,s]=(0,J.useState)(null),{run:c,setRun:l,poll:u}=sZ(e),d=(0,J.useRef)(null),f=ke();(0,J.useEffect)(()=>{d.current?.focus(),rZ(e).finally(()=>i(!0))},[e]);let p=n?.info??null,m=n?.current??``,h=p?.latest??m,g=p?.hasUpdate===!0,_=r&&p===null,v=r&&p!==null&&!g,y=n?.notes??[],b=y[0]?.url??(h?tZ(h):null),x=c?.code===0,[S,C]=(0,J.useState)(!1),w=g&&!c?.running&&!x,T=n=>{if(n===`close`)return V.set(null);if(n===`restart`){if(!x||S)return;C(!0),e.request(`update.restart`,{}).catch(e=>e instanceof yl&&C(!1));return}if(n===`update`){if(!w)return;s(null),e.request(`update.run`,{}).then(e=>{l(e.status),u()},e=>{if(e instanceof yl&&e.code===`BUSY`)return u();s(eZ(t.webStartFailed,{error:e instanceof Error?e.message:String(e)}))});return}s(b&&window.open(b,`_blank`,`noopener`)!==null?t.statusReleaseOpened:t.statusReleaseError)};(0,J.useEffect)(()=>{!r||!a||($X.set(!1),g&&T(`update`))},[r,g,a]);let E=e=>{if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`c`&&!window.getSelection()?.toString())return e.preventDefault(),T(`close`);if(!(e.metaKey||e.ctrlKey||e.altKey)){if(e.key===`Enter`&&e.target===d.current)T(x?`restart`:w?`update`:`release`);else if(e.key===`Enter`)return;else if(e.key===`u`)T(`update`);else if(e.key===`r`)T(`release`);else if(e.key===`q`||e.key===`Escape`)T(`close`);else return;e.preventDefault()}},[D,O]=(0,J.useState)(null);(0,J.useEffect)(()=>{if(!f||!v||!m)return;let t=!0;return e.request(`release.notes`,{version:m.replace(/-.*$/,``),locale:Cn.get()}).then(e=>t&&O(e.notes)).catch(()=>{}),()=>{t=!1}},[e,f,v,m]);let ee=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`mono ${TX}`,children:[(0,K.jsx)(`span`,{className:`text-muted`,children:t.current}),` `,(0,K.jsxs)(`b`,{children:[`v`,m]}),` `,(0,K.jsx)(`span`,{className:`text-muted`,children:t.latest}),` `,_?(0,K.jsx)(`b`,{className:`text-muted`,children:t.latestUnknown}):r?(0,K.jsxs)(`b`,{className:g?`text-warning`:`text-success`,children:[`v`,h]}):(0,K.jsx)(`span`,{className:`text-muted`,children:`…`})]}),_&&(0,K.jsx)(`p`,{className:`text-muted`,children:t.registryRetry}),v&&(0,K.jsx)(`p`,{className:`text-success`,children:t.upToDate}),o&&(0,K.jsx)(`p`,{className:`mono text-accent`,children:o}),c&&(0,K.jsxs)(K.Fragment,{children:[c.output&&(0,K.jsx)(`pre`,{className:`my-2 max-h-[40vh] overflow-auto whitespace-pre-wrap wrap-anywhere rounded-sm bg-inset p-2 font-mono text-[length:var(--fs-meta)]`,children:c.output}),(0,K.jsx)(`p`,{className:`mono ${c.running?`text-muted`:c.code===0?`text-success`:`text-error`}`,children:c.running?eZ(t.webRunning,{command:c.command}):c.code===0?S?t.webRestarting:eZ(t.webInstalled,{latest:h}):eZ(t.updateFailed,{code:String(c.code)})})]}),g&&(0,K.jsx)(`p`,{className:`mono text-muted`,children:eZ(t.changesSectionHeader,{from:m,to:h})}),!r&&(0,K.jsx)(`p`,{className:`text-muted`,children:t.loadingNotes}),r&&g&&y.length===0&&(0,K.jsx)(`p`,{className:`text-muted`,children:t.notesUnavailable}),(0,K.jsx)(aZ,{notes:y})]}),A=(0,K.jsxs)(`div`,{className:`${Mi} pt-2.5`,children:[b?(0,K.jsx)(`a`,{className:vi({secondary:!0}),href:b,target:`_blank`,rel:`noopener noreferrer`,"aria-keyshortcuts":`r`,children:t.actions.openRelease}):(0,K.jsx)(`span`,{className:`text-muted`,children:t.releaseUrlUnavailable}),x&&(0,K.jsx)(q,{variant:`filled`,disabled:S,onClick:()=>T(`restart`),children:t.webRestart}),w&&(0,K.jsx)(q,{variant:`filled`,"aria-keyshortcuts":`u`,onClick:()=>T(`update`),children:t.actions.updateNow})]});return f?(0,K.jsxs)(tO,{title:U(`rail.update`),rootRef:d,action:x?{label:t.webRestart,tone:`accent`,disabled:S,onClick:()=>T(`restart`)}:w?{label:U(`pages.phone.updateTo`,{version:h}),tone:`accent`,onClick:()=>T(`update`)}:{label:U(`pages.phone.viewNotes`),disabled:!b,onClick:()=>T(`release`)},children:[ee,D&&(0,K.jsx)(aZ,{notes:[D]})]}):(0,K.jsxs)(`div`,{className:EX,tabIndex:0,ref:d,onKeyDown:E,children:[(0,K.jsx)(`h1`,{className:qB,children:U(`rail.update`)}),(0,K.jsx)(`div`,{className:DX,children:ee}),A]})}var lZ=`rove.whatsNewSeenVersion`,uZ=e=>e.split(/[.-]/).slice(0,3).map(Number),dZ=(e,t)=>{let[n,r]=[uZ(e),uZ(t)];for(let e=0;e<3;e++)if((n[e]??0)!==(r[e]??0))return(n[e]??0)>(r[e]??0);return!1};function fZ(e,t){let n=localStorage.getItem(lZ);localStorage.setItem(lZ,t),!(!n||!dZ(t,n))&&e.request(`release.notes`,{version:t.replace(/-.*$/,``),locale:Cn.get()}).then(e=>B.set((0,K.jsx)(pZ,{from:n,to:t,notes:e.notes})),()=>B.set((0,K.jsx)(pZ,{from:n,to:t,notes:null})))}function pZ(e){let t=nZ(),n=ke(),r=U(`whatsNew.title`),i=e.notes?.url??tZ(e.to),a=(0,J.useRef)(null),o=(0,J.useRef)(ce);(0,J.useEffect)(()=>{n||a.current?.focus()},[n]),(0,J.useEffect)(()=>{let e=e=>{e.key===`q`&&o.current()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let s=e.notes?(0,K.jsx)(YX,{body:e.notes.body}):(0,K.jsx)(`p`,{className:`text-muted`,children:t.whatsNew.notesUnavailable});return n?(0,K.jsx)(gO,{label:r,title:r,onClose:ce,children:n=>(o.current=n,(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:PX,children:[(0,K.jsx)(`p`,{className:`text-muted`,children:eZ(t.whatsNew.upgraded,{from:e.from,to:e.to})}),s]}),(0,K.jsx)(`div`,{className:FX,children:(0,K.jsx)(ND,{actions:[{label:U(`whatsNew.openRelease`),href:i},{label:U(`whatsNew.continue`),tone:`accent`,onClick:n}]})})]}))}):(o.current=ce,(0,K.jsxs)(za,{title:r,wide:!0,children:[(0,K.jsx)(`p`,{className:`m-0 text-muted`,children:eZ(t.whatsNew.upgraded,{from:e.from,to:e.to})}),(0,K.jsx)(`div`,{className:MX,children:s}),(0,K.jsxs)(`div`,{className:Mi,children:[(0,K.jsx)(`span`,{className:`mono text-muted ${NX} touch:hidden!`,children:U(`whatsNew.keys`)}),(0,K.jsx)(`a`,{className:vi({secondary:!0}),href:i,target:`_blank`,rel:`noopener noreferrer`,children:U(`whatsNew.openRelease`)}),(0,K.jsx)(q,{ref:a,variant:`filled`,onClick:ce,children:U(`whatsNew.continue`)})]})]}))}h(),G(),He(),xb(),A(),H();var mZ=(e,t)=>e.replace(`{version}`,t);function hZ({client:e}){let t=nZ(),n=k(QX),{prefs:r}=hb(),[i,a]=(0,J.useState)(`idle`),o=()=>{a(`checking`),rZ(e,r.updateChannel).then(e=>a(e?`done`:`failed`))},s=t=>{a(`idle`),pb(e,`updateChannel`,t)},c=n?.info??null,l=i===`failed`||i===`done`&&c===null,u=i===`done`&&n&&c?c.hasUpdate?mZ(t.available,c.latest):t.upToDate:l?t.latestUnknown:void 0,d=l?`text-muted`:c?.hasUpdate?`text-warning`:`text-success`;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(cX,{settingId:`about.updateChannel`,label:$(`general.updateChannelTitle`),hint:$(`general.updatesHint`),value:r.updateChannel,picks:Hq.map(e=>({value:e,label:$(`general.updateChannelName.${e}`)})),onPick:s}),(0,K.jsx)(rX,{settingId:`about.updateNotify`,label:$(`general.updateNotify`),hint:$(`general.updateNotifyHint`),checked:r.updateNotify,onChange:t=>void pb(e,`updateNotify`,t)}),(0,K.jsxs)(nX,{settingId:`about.updateCheck`,label:$(`general.updates`),hint:$(`general.updateCheckHint`),children:[i===`done`&&c?.hasUpdate&&(0,K.jsx)(q,{variant:`action`,onClick:()=>{ce(),Ee(`update`)},children:$(`general.updateOpenPage`)}),(0,K.jsx)(q,{variant:`action`,disabled:i===`checking`,onClick:o,children:$(i===`checking`?`general.updateChecking`:`general.updateCheckButton`)})]}),u&&(0,K.jsx)(nX,{label:(0,K.jsx)(`span`,{className:d,children:u}),hint:c?.hasUpdate?(0,K.jsx)(`code`,{className:`font-mono`,children:`rove update`}):void 0,children:i===`done`&&n&&c&&(0,K.jsx)(`span`,{className:`max-w-90 min-w-0 truncate font-mono text-meta text-muted [overflow-wrap:anywhere]`,title:`${t.latest} v${c.latest}`,children:`${t.current} v${n.current} · ${t.latest} v${c.latest}`})})]})}function gZ({client:e}){let[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(null),l=()=>e.request(`auth.status`).then(n,()=>n(null));if((0,J.useEffect)(()=>void l(),[e]),!t)return null;let u=async(t,n)=>{c(null);try{let r=n===void 0?{mode:t}:{mode:t,password:n},{token:a}=await e.request(`auth.setMode`,r);if(a){f(a),window.location.reload();return}i(!1),o(``),await l()}catch(e){c(e instanceof Error?e.message:String(e))}},d=r?`password`:t.mode,p=a.length<t.minPassword;return(0,K.jsxs)(tX,{title:U(`settings.about.access`),children:[(0,K.jsx)(cX,{settingId:`about.signIn`,label:U(`settings.about.signIn`),hint:U(`settings.about.signInHint.${d}`),value:d,picks:t.modes.map(e=>({value:e,label:U(`settings.about.signInMode.${e}`)})),onPick:e=>{e===`password`&&!t.hasPassword?i(!0):u(e)}}),d===`password`&&(0,K.jsxs)(nX,{label:U(t.hasPassword?`settings.about.passwordChange`:`settings.about.passwordSet`),hint:s??U(`settings.about.passwordHint`,{min:t.minPassword}),children:[(0,K.jsx)(`input`,{className:`${$J} w-48`,type:`password`,autoComplete:`new-password`,"aria-label":U(`settings.about.passwordField`),placeholder:U(`settings.about.passwordField`),value:a,onChange:e=>o(e.target.value),onKeyDown:e=>e.key===`Enter`&&!p&&void u(`password`,a)}),(0,K.jsx)(q,{variant:`action`,disabled:p,onClick:()=>void u(`password`,a),children:U(`settings.about.passwordSave`)})]})]})}function _Z({client:e}){let t=k(e.conn).hello?.host,[n,r]=(0,J.useState)(()=>Hs(e,`daemon.info`)??null);return(0,J.useEffect)(()=>{Ws(e,`daemon.info`).then(r,()=>r(null))},[e]),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(tX,{title:U(`settings.about.groupRove`),children:[t&&(0,K.jsx)(nX,{label:U(`settings.about.computer`),hint:t}),n?.daemonVersion&&(0,K.jsx)(nX,{settingId:`about.daemon`,label:U(`settings.about.daemon`),hint:U(n.stale?`settings.about.daemonStale`:`settings.about.daemonCurrent`,{version:n.daemonVersion})}),(0,K.jsx)(hZ,{client:e})]}),(0,K.jsx)(gZ,{client:e}),(0,K.jsx)(tX,{title:U(`settings.about.browser`),children:(0,K.jsx)(nX,{settingId:`about.signOut`,label:U(`settings.about.signOut`),hint:U(`settings.about.browserHint`),children:(0,K.jsx)(q,{variant:`action`,onClick:()=>void qO().then(()=>window.location.reload()),children:U(`settings.about.signOut`)})})})]})}G(),Ur();var vZ=[{label:`settings.appearance.previewWorking`,status:{kind:`running`,since:0}},{label:`settings.appearance.previewDone`,status:{kind:`unseen`,since:0}},{label:`settings.appearance.previewIdle`,status:{kind:`idle`,since:0}},{label:`settings.appearance.previewWaiting`,status:{kind:`needs-input`,since:0}},{label:`settings.appearance.previewBroken`,status:{kind:`attention`,reason:`error`,since:0}}];function yZ({model:e}){let t=UB(),[n]=[...yz(e).values()];return(0,K.jsx)(`span`,{className:NJ,"aria-hidden":`true`,children:vZ.map(({label:e,status:r})=>(0,K.jsxs)(`span`,{className:PJ,children:[t!==`dots`&&(0,K.jsx)(VF,{icon:n,status:t===`engine`?HP(r):void 0}),(0,K.jsx)(`span`,{className:`text-ink`,children:U(e)}),t!==`engine`&&(0,K.jsx)(iF,{status:r})]},e))})}function bZ(){return(0,K.jsx)(`span`,{className:`${PJ} ${Ma} ${Na}`,"aria-hidden":`true`,children:U(`settings.appearance.previewTitle`)})}function xZ(){return(0,K.jsx)(`span`,{className:`${FJ} ${Cr}`,"aria-hidden":`true`})}var SZ=`claude`,CZ=new Map,wZ=new Set,TZ=(e,t)=>`${e}/${t}`,EZ=e=>CZ.get(e)??``;function DZ(e,t){t===``?CZ.delete(e):CZ.set(e,t);for(let e of wZ)e()}function OZ(e){return wZ.add(e),()=>wZ.delete(e)}function kZ(e,t){let n=EZ(e).trimEnd();DZ(e,n===``?t:`${n}\n\n${t}`)}G(),H();function AZ(e,t,n,r,i,a){let o=n.length-t.length;return{base:n,spans:[...e?.base===t?e.spans.filter(([e,t])=>t<=r||e>=i).map(([e,t])=>e>=i?[e+o,t+o]:[e,t]):[],a]}}async function jZ(e,t,n){if(n===t.base)return;let r;try{r=(await e.request(`voice.learn`,{base:t.base,spans:t.spans,sent:n})).learned??[]}catch{return}r.length!==0&&z(U(`voice.learned`,{pairs:r.map(e=>U(`voice.learnedPair`,{spoken:e.spoken,term:e.term})).join(`, `)}),`info`,{label:U(`voice.undo`),run:()=>void e.request(`voice.unlearn`,{learned:r}).then(()=>z(U(`voice.unlearned`)),()=>z(U(`voice.unlearnFailed`),`error`))})}wl(),G(),A(),H();var MZ=new WeakSet,NZ=O({}),PZ=6e4,FZ=e=>{let t=NZ.get();if(!t[e])return;let{[e]:n=0,...r}=t;NZ.set(n>1?{...r,[e]:n-1}:r)};function IZ(e){MZ.has(e)||(MZ.add(e),e.on(`voice.sendFailed`,e=>{let t=e,n=t.taskId&&t.tabId?TZ(t.taskId,t.tabId):null,r=[n?EZ(n):``,t.prefix,t.text].filter(Boolean).join(` `);n&&r&&DZ(n,r),n&&FZ(n),z(U(`layout.composerNotSent`,{reason:t.reason??``}),`error`)}),e.on(`voice.sent`,e=>{let t=e;t.taskId&&t.tabId&&FZ(TZ(t.taskId,t.tabId))}))}function LZ({model:e,taskId:t,tabId:n,inPackage:r}){let i=k(e.tasks)?.tasks.find(e=>e.id===t)!==void 0,a=TZ(t,n),o=(0,J.useSyncExternalStore)(OZ,()=>EZ(a)),[s,c]=(0,J.useState)(!1),{attachments:l,attach:u,remove:d,ready:f,clear:p}=vk(e,e=>z(e,`error`),void 0,t),m=(0,J.useRef)(null),h=sR(e.client),[g,_]=(0,J.useState)(!1),v=FI({value:o,onChange:e=>DZ(a,e),area:m,listClassName:`m-0`,onEnter:()=>void E()}),y=(0,J.useRef)(null),b=e=>{let t=m.current,n=t?.selectionStart??o.length,r=t?.selectionEnd??o.length,i=n>0&&!/\s$/.test(o.slice(0,n))?` `:``,s=`${o.slice(0,n)}${i}${e}${o.slice(r)}`;DZ(a,s);let c=n+i.length+e.length;y.current=AZ(y.current,o,s,n,r,[n+i.length,c]),requestAnimationFrame(()=>t?.setSelectionRange(c,c))},x=async e=>{let t=o.trim()?`${o.trimEnd()} ${e}`:e;await E(t)||DZ(a,t)},S=e=>void x(e);(0,J.useEffect)(()=>IZ(e.client),[e.client]);let C=async()=>({taskId:t,tabId:n,prefix:pk(o.trim(),await f()).trim()}),w=(k(NZ)[a]??0)>0,T=()=>{NZ.set({...NZ.get(),[a]:(NZ.get()[a]??0)+1}),window.setTimeout(()=>FZ(a),PZ),DZ(a,``),p(),y.current=null},E=async(r=o)=>{c(!0);try{let i=pk(r.trim(),await f()).trim();if(!i)return!1;let o=await e.client.request(`tab.send`,{taskId:t,tabId:n,prompt:i});return o.delivered?(DZ(a,``),p(),window.setTimeout(()=>_(!1),140),y.current&&jZ(e.client,y.current,r),y.current=null,!0):(z(U(`layout.composerNotSent`,{reason:o.reason??``}),`error`),!1)}catch(e){let t=e instanceof yl?e.code:void 0;return z(t===`UNKNOWN_OP`?U(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?U(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`),!1}finally{c(!1)}},D=uk(u);if(!i)return null;let O=u,ee={client:e.client,context:()=>({draft:o,taskId:t,tabId:n}),onText:e=>void b(e),disabled:s},A=h===!0&&!g&&o===``,j=()=>{(0,rO.flushSync)(()=>_(!0)),m.current?.focus()};return(0,K.jsx)(OL,{value:o,placeholder:r?.placeholder??U(`layout.composerPlaceholder`),inPackage:r&&{send:r.sendLabel?(0,K.jsx)(q,{variant:`filled`,type:`submit`,className:`m-1 flex-none`,"data-tp-part":`composer-send`,disabled:s,children:r.sendLabel}):void 0},busy:s,attached:l.length>0&&(0,K.jsx)(yk,{attachments:l,onRemove:d}),attach:(0,K.jsxs)(dk,{className:lL(),title:U(`layout.composerAttach`),disabled:s,onFiles:O,children:[(0,K.jsx)(`span`,{className:`sr-only`,children:U(`layout.composerAttach`)}),(0,K.jsx)(_L,{})]}),dictate:(0,K.jsx)(lR,{...ee,look:uL,face:e=>(0,K.jsx)(EL,{state:e})}),voice:A?(0,K.jsx)(lR,{...ee,onSend:S,handoff:C,onHandedOff:T,look:pL,onTap:j,idle:U(w?`voice.sending`:`voice.holdOrType`),face:e=>(0,K.jsx)(TL,{state:e,idle:U(w?`voice.sending`:`voice.holdOrType`),working:U(`voice.working`),slide:U(`voice.slideToEdit`),release:U(`voice.tipEdit`)})}):void 0,composerKey:a,fieldRef:m,suggest:v.list,...v.field,onPaste:D.onPaste,drop:D.drop,dropHint:D.over?U(`layout.composerDrop`):void 0,onBlur:()=>o===``&&_(!1),onSend:()=>void E()})}var RZ={md:`md`,markdown:`md`,html:`html`,htm:`html`,svg:`svg`,png:`image`,jpg:`image`,jpeg:`image`,gif:`image`,webp:`image`,pdf:`pdf`};function zZ(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<0?null:RZ[t.slice(n+1).toLowerCase()]??null}function BZ(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var VZ=e=>new TextDecoder().decode(BZ(e));function HZ(e,t){if(e===`svg`)return`image/svg+xml`;if(e===`pdf`)return`application/pdf`;let n=t.slice(t.lastIndexOf(`.`)+1).toLowerCase();return n===`jpg`||n===`jpeg`?`image/jpeg`:n===`gif`?`image/gif`:n===`webp`?`image/webp`:`image/png`}var UZ=`default-src 'none'; img-src data:; style-src 'unsafe-inline'`;function WZ(e){let t=`<meta http-equiv="Content-Security-Policy" content="${UZ}">`,n=/^\s*<!doctype[^>]*>/i.exec(e);return n?`${n[0]}${t}${e.slice(n[0].length)}`:`${t}${e}`}var GZ=/^\[([^\]\n]+)\]\((https?:\/\/[^\s)]+)\)/,KZ=/^https?:\/\/[^\s<>)\]]+/,qZ=/[\p{L}\p{N}]/u;function JZ(e){let t=[],n=``,r=()=>{n&&t.push({t:`text`,v:n}),n=``},i=0;for(;i<e.length;){let a=e.slice(i),o=e[i]??``;if(o==="`"){let n=e.indexOf("`",i+1);if(n>i+1){r(),t.push({t:`code`,v:e.slice(i+1,n)}),i=n+1;continue}}else if(a.startsWith(`**`)){let n=e.indexOf(`**`,i+2);if(n>i+2){r(),t.push({t:`bold`,c:JZ(e.slice(i+2,n))}),i=n+2;continue}}else if(o===`*`||o===`_`&&!qZ.test(e[i-1]??``)){let n=e.indexOf(o,i+1);if(n>i+1&&!/\s/.test(e[i+1]??` `)&&(o===`*`||!qZ.test(e[n+1]??``))){r(),t.push({t:`em`,c:JZ(e.slice(i+1,n))}),i=n+1;continue}}else if(o===`[`){let e=GZ.exec(a);if(e){r(),t.push({t:`link`,href:e[2],c:JZ(e[1])}),i+=e[0].length;continue}}else if(o===`h`&&!qZ.test(e[i-1]??``)){let e=KZ.exec(a);if(e){let n=e[0].replace(/[.,;:!?]+$/,``);r(),t.push({t:`link`,href:n,c:[{t:`text`,v:n}]}),i+=n.length;continue}}n+=o,i++}return r(),t}var YZ=/^\s*(```+|~~~+)\s*([\w+#.-]*)\s*$/,XZ=/^(#{1,6})\s+(.*?)\s*#*\s*$/,ZZ=/^(\s*)([-*+])\s+(.*)$/,QZ=/^(\s*)\d+[.)]\s+(.*)$/,$Z=/^\s*([-*_])(\s*\1){2,}\s*$/,eQ=/^\s*\|.*\|\s*$/,tQ=/^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s*$/,nQ=e=>e.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());function rQ(e){let t=e.replace(/\r\n?/g,`
|
|
223
|
+
`).split(`
|
|
224
|
+
`),n=[],r=[],i=()=>{r.length>0&&n.push({t:`para`,c:JZ(r.join(`
|
|
225
|
+
`))}),r=[]};for(let e=0;e<t.length;e++){let a=t[e],o=YZ.exec(a);if(o){i();let r=o[1][0],a=[];for(e++;e<t.length&&!RegExp(`^\\s*${r}{3,}\\s*$`).test(t[e]);e++)a.push(t[e]);n.push({t:`code`,lang:o[2]??``,v:a.join(`
|
|
226
|
+
`)});continue}if(a.trim()===``){i();continue}let s=XZ.exec(a);if(s){i(),n.push({t:`heading`,level:s[1].length,c:JZ(s[2])});continue}if($Z.test(a)){i(),n.push({t:`hr`});continue}if(eQ.test(a)){i();let r=[];for(;e<t.length&&eQ.test(t[e]);e++){let n=t[e];tQ.test(n)||r.push(nQ(n))}e--,n.push({t:`table`,rows:r.map(e=>e.map(e=>JZ(e)))});continue}if(a.startsWith(`>`)){i();let r=[];for(;e<t.length&&t[e].startsWith(`>`);e++)r.push(t[e].replace(/^>\s?/,``));e--,n.push({t:`quote`,c:JZ(r.join(`
|
|
227
|
+
`))});continue}let c=ZZ.exec(a),l=c?null:QZ.exec(a);if(c||l){i();let r=!c,a=[];for(;e<t.length;e++){let n=r?QZ.exec(t[e]):ZZ.exec(t[e]);if(!n)break;let i=n[1].length;a.push({depth:Math.min(3,Math.floor(i/2)),c:JZ(r?n[2]:n[3])})}e--,n.push({t:`list`,ordered:r,items:a});continue}r.push(a)}return i(),n}var iQ=`flex min-h-0 min-w-0 flex-1 flex-col font-sans text-body`,aQ=`flex flex-none flex-wrap items-center gap-x-3 gap-y-1 px-3 pb-1.5 font-mono text-meta`,oQ=`min-h-0 flex-1 overflow-y-auto px-3 pb-3`,sQ=`m-0 px-3 py-2 font-mono text-meta text-subtle`,cQ=`m-0 whitespace-pre-wrap px-3 pb-3 font-mono text-meta leading-[1.45] text-muted wrap-anywhere`,lQ=e=>`group/entry mt-3 rounded-sm border-l-2 py-0.5 pl-2.5 ${e.flash?`border-accent bg-accent-soft`:e.current?`border-line-active`:`border-transparent`}`,uQ=`mb-0.5 flex items-center gap-2 font-mono text-meta`,dQ=e=>e===`user`?`text-accent`:`text-muted`,fQ=`text-subtle`,pQ=`ml-auto opacity-0 group-hover/entry:opacity-100 focus-visible:opacity-100 touch:opacity-100`,mQ=`m-0 mt-0.5 flex min-w-0 items-baseline gap-1.5 font-mono text-meta text-subtle`,hQ=`flex-none text-muted`,gQ=`min-w-0 flex-1 truncate`,_Q=`group/tool mt-0.5`,vQ=`${mQ} mt-0 cursor-pointer list-none hover:text-muted focus-visible:outline focus-visible:outline-1 focus-visible:outline-focus [&::-webkit-details-marker]:hidden`,yQ=`m-0 mt-1 mb-1 max-h-60 overflow-auto rounded-sm border-hairline border-line bg-inset px-2.5 py-1.5 font-mono text-meta leading-[1.45] whitespace-pre-wrap text-muted wrap-anywhere`,bQ=`text-diff-added`,xQ=`text-diff-removed`,SQ=`m-0 mt-1 mb-1 line-clamp-3 font-mono text-meta text-subtle italic`,CQ=e=>`group/notice mt-3 rounded-sm border-hairline px-2.5 py-1 ${e.flash?`border-accent bg-accent-soft`:e.current?`border-line-active bg-inset`:`border-line bg-inset`}`,wQ=`flex min-w-0 cursor-pointer list-none items-baseline gap-2 font-mono text-meta text-muted focus-visible:outline focus-visible:outline-1 focus-visible:outline-focus [&::-webkit-details-marker]:hidden`,TQ=`flex-none text-subtle`,EQ=`min-w-0 flex-1 truncate font-sans text-body text-ink`,DQ=e=>`flex-none ${/fail|error|kill|cancel/i.test(e)?`text-error`:/complet|success|done|pass/i.test(e)?`text-success`:`text-warning`}`,OQ=`group/fold mt-0.5`,kQ=`flex cursor-pointer list-none items-baseline gap-1.5 font-mono text-meta text-subtle hover:text-muted focus-visible:outline focus-visible:outline-1 focus-visible:outline-focus [&::-webkit-details-marker]:hidden`,AQ=`inline-block flex-none group-open/fold:rotate-90`,jQ=`cursor-zoom-in rounded-sm p-0`,MQ=`overlay fixed inset-0 z-20 grid cursor-zoom-out place-items-center bg-(--scrim) motion-safe:animate-fade-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-fade-out`,NQ=`dialog static m-0 cursor-default border-0 bg-transparent p-0`,PQ=`block max-h-[calc(100dvh-32px)] max-w-[calc(100vw-32px)] rounded-sm object-contain shadow-dialog`,FQ=`block h-20 min-w-20 max-w-48 rounded-sm border-hairline border-line bg-inset object-cover hover:border-line-active`,IQ=`leading-[1.5] wrap-anywhere`,LQ=`m-0 mb-2 whitespace-pre-wrap last:mb-0`,RQ=`m-0 mt-3 mb-1.5 font-semibold first:mt-0`,zQ=`m-0 mb-2 flex flex-col gap-0.5 pl-5 last:mb-0`,BQ=`m-0 mb-2 border-l-2 border-line pl-2.5 whitespace-pre-wrap text-muted last:mb-0`,VQ=`m-0 mb-2 overflow-x-auto rounded-sm border-hairline border-line bg-inset px-2.5 py-2 font-mono text-meta leading-[1.45] last:mb-0`,HQ=`rounded-xs bg-inset px-1 font-mono text-meta`,UQ=`text-accent underline`,WQ=`mb-2 block max-w-full overflow-x-auto border-collapse font-mono text-meta last:mb-0`,GQ=`border-hairline border-line px-2 py-0.5 text-left align-top`,KQ=`my-2 border-0 border-t border-line`;function qQ(e,t){let n=t.trim().toLowerCase();if(!n)return e;let r=e.toLowerCase(),i=[],a=0;for(let t=r.indexOf(n);t>=0;t=r.indexOf(n,a))t>a&&i.push(e.slice(a,t)),i.push((0,K.jsx)(`mark`,{className:aq,"data-hit":``,children:e.slice(t,t+n.length)},t)),a=t+n.length;return i.push(e.slice(a)),J.Children.toArray(i)}var JQ=[`h3`,`h3`,`h4`,`h5`,`h6`,`h6`];function YQ({level:e,children:t}){let n=JQ[Math.min(5,Math.max(0,e-1))]??`h6`;return(0,K.jsx)(n,{className:RQ,children:t})}function XQ(e,t){return e.map((e,n)=>(0,K.jsx)(J.Fragment,{children:t(e)},n))}function ZQ({nodes:e,needle:t}){return XQ(e,e=>e.t===`text`?qQ(e.v,t):e.t===`code`?(0,K.jsx)(`code`,{className:HQ,children:qQ(e.v,t)}):e.t===`bold`?(0,K.jsx)(`strong`,{children:(0,K.jsx)(ZQ,{nodes:e.c,needle:t})}):e.t===`em`?(0,K.jsx)(`em`,{children:(0,K.jsx)(ZQ,{nodes:e.c,needle:t})}):(0,K.jsx)(`a`,{className:UQ,href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:(0,K.jsx)(ZQ,{nodes:e.c,needle:t})}))}function QQ({block:e,needle:t}){switch(e.t){case`heading`:return(0,K.jsx)(YQ,{level:e.level,children:(0,K.jsx)(ZQ,{nodes:e.c,needle:t})});case`para`:return(0,K.jsx)(`p`,{className:LQ,children:(0,K.jsx)(ZQ,{nodes:e.c,needle:t})});case`code`:return(0,K.jsx)(`pre`,{className:VQ,children:(0,K.jsx)(`code`,{children:qQ(e.v,t)})});case`quote`:return(0,K.jsx)(`blockquote`,{className:BQ,children:(0,K.jsx)(ZQ,{nodes:e.c,needle:t})});case`hr`:return(0,K.jsx)(`hr`,{className:KQ});case`list`:{let n=e.ordered?`ol`:`ul`;return(0,K.jsx)(n,{className:`${zQ} ${e.ordered?`list-decimal`:`list-disc`}`,children:XQ(e.items,e=>(0,K.jsx)(`li`,{style:{marginLeft:`${e.depth*1.25}rem`},children:(0,K.jsx)(ZQ,{nodes:e.c,needle:t})}))})}case`table`:return(0,K.jsx)(`table`,{className:WQ,children:(0,K.jsx)(`tbody`,{children:XQ(e.rows,e=>(0,K.jsx)(`tr`,{children:XQ(e,e=>(0,K.jsx)(`td`,{className:GQ,children:(0,K.jsx)(ZQ,{nodes:e,needle:t})}))}))})})}}function $Q({source:e,needle:t=``}){let n=(0,J.useMemo)(()=>rQ(e),[e]);return(0,K.jsx)(`div`,{className:IQ,children:XQ(n,e=>(0,K.jsx)(QQ,{block:e,needle:t}))})}wl(),G();function e$(e){if(e instanceof yl){if(e.code===`TOO_LARGE`){let t=e.detail?.size;return xz(U(`artifact.tooLarge`),{size:typeof t==`number`?`${(t/1048576).toFixed(1)} MB`:`5 MB+`})}if(e.code===`NOT_PREVIEWABLE`)return U(`artifact.notPreviewable`);if(e.code===`NOT_FOUND`)return U(`artifact.gone`)}return xz(U(`artifact.failed`),{error:e instanceof Error?e.message:String(e)})}function t$(e,t,n,r){let[i,a]=(0,J.useState)({kind:`loading`});return(0,J.useEffect)(()=>{let r=!0;return e.client.request(`file.read`,{taskId:t,path:n}).then(e=>r&&a({kind:`ready`,file:e}),e=>r&&a({kind:`failed`,text:e$(e)})),()=>{r=!1}},[e,t,n,r]),i}function n$(e,t){let n=(0,J.useMemo)(()=>e===null?null:URL.createObjectURL(new Blob([BZ(e)],{type:t})),[e,t]);return(0,J.useEffect)(()=>()=>void(n&&URL.revokeObjectURL(n)),[n]),n}function r$({model:e,taskId:t,path:n,kind:r,changeKey:i}){W();let a=t$(e,t,n,i),o=n$(a.kind===`ready`&&(r===`svg`||r===`image`||r===`pdf`)?a.file.base64:null,r===`md`||r===`html`?``:HZ(r,n));return a.kind===`loading`?(0,K.jsx)(`p`,{className:xi,children:U(`artifact.loading`)}):a.kind===`failed`?(0,K.jsx)(`p`,{className:`${xi} text-error`,children:a.text}):r===`md`?(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-3 py-2`,children:(0,K.jsx)($Q,{source:VZ(a.file.base64)})}):r===`html`?(0,K.jsx)(`iframe`,{title:n,sandbox:``,srcDoc:WZ(VZ(a.file.base64)),style:{colorScheme:`light`,background:`#fff`},className:`min-h-0 w-full flex-1 border-none`}):o?r===`pdf`?(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,K.jsx)(`a`,{className:`${Oi} px-3 py-1 font-mono text-meta`,href:o,target:`_blank`,rel:`noreferrer noopener`,children:U(`artifact.open`)}),(0,K.jsx)(`iframe`,{title:n,src:o,className:`min-h-0 w-full flex-1 border-none`})]}):(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,K.jsx)(`img`,{src:o,alt:n,className:`max-w-full`})}):null}function i$(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.taskId==`string`&&(t.source===`history`||t.source===`terminal`)}var a$={entries:[],failed:new Set,outputs:new Map,ended:new Map,thoughts:new Map},o$=4e3;function s$(e){return(typeof e==`string`?e:Array.isArray(e)?e.map(e=>typeof e?.text==`string`?e.text:``).join(`
|
|
228
|
+
`):e==null?``:JSON.stringify(e)).slice(0,o$)}var c$=[`command`,`cmd`,`file_path`,`path`,`pattern`,`query`,`url`,`description`,`prompt`],l$=new Set([`command`,`cmd`]),u$=new Set([`file_path`,`path`]),d$=100,f$=4e3,p$=48;function m$(e){let t=(e.split(`
|
|
229
|
+
`).find(e=>e.trim()!==``)??``).trim();return t.length>d$?`${t.slice(0,99)}…`:t}function h$(e){if(e.length<=p$)return e;let t=e.split(`/`).filter(e=>e!==``);return t.length>3?`…/${t.slice(-3).join(`/`)}`:e}function g$(e){let t=e.split(`
|
|
230
|
+
`),n=(t.find(e=>e.trim()!==``)??``).trim();for(let e=``;e!==n;)e=n,n=n.replace(/^cd\s+(?:"[^"]*"|'[^']*'|\S+)\s*(?:&&|;)\s*/,``).replace(/^[A-Za-z_][A-Za-z0-9_]*=\S*\s+/,``);let r=n.match(/\s*<<-?\s*['"]?\w+['"]?/);if(r?.index!==void 0){let e=t.length-2;n=`${n.slice(0,r.index)}${e>0?` (${e} lines)`:``}`}return n=n.replace(/(?:~|\.{0,2})?\/[^\s"'|;&<>()]+/g,e=>h$(e)),n.length>d$?`${n.slice(0,99)}…`:n}function _$(e){let t=e.trim().match(/^<([a-z][a-z0-9]*(?:-[a-z0-9]+)+)>([\s\S]*)<\/\1>$/);if(!t)return null;let[,n=``,r=``]=t,i=[...r.matchAll(/<([a-z][a-z0-9-]*)>([\s\S]*?)<\/\1>/g)].map(([,e=``,t=``])=>[e,t.trim()]),a=e=>i.find(([t])=>t===e)?.[1],o=r.replace(/<[^>]+>/g,` `).trim(),s=a(`status`);return{kind:n.replaceAll(`-`,` `),...s?{status:s}:{},summary:m$(a(`summary`)??o),details:i.length>0?i.map(([e,t])=>`${e}: ${t}`).join(`
|
|
231
|
+
`):o}}function v$(e){if(typeof e==`string`)return{text:e,kind:`other`};if(!e||typeof e!=`object`)return{text:``,kind:`other`};let t=e,n=e=>typeof e==`string`?e:Array.isArray(e)&&e.every(e=>typeof e==`string`)?e.join(` `):``,r=new Map;for(let[e,n]of Object.entries(t))r.set(e.toLowerCase(),n);for(let e of c$){let i=n(t[e]??r.get(e));if(i.trim())return{text:i,kind:l$.has(e)?`command`:u$.has(e)?`path`:`other`}}for(let e of Object.values(t)){let t=n(e);if(t.trim())return{text:t,kind:`other`}}return{text:``,kind:`other`}}function y$(e){let{text:t,kind:n}=v$(e),r=t.trim(),i=n===`command`?g$(r):m$(n===`path`?h$(r):r);return i===r?{summary:i}:{summary:i,full:r.slice(0,f$)}}function b$(e){return e===`user`||e===`assistant`||e===`system`?e:null}function x$(e,t){let n=[],r=[],i=[],a=[],o=[];return e.forEach((e,s)=>{let c=b$(e.role);if(!c)return;let l=[],u=[],d=[],f=(e.blocks??[]).flatMap(e=>e.type===`thinking`&&e.text?.trim()?[e.text.trim()]:[]);f.length>0&&o.push([t+s,{at:e.timestamp??``,text:f.join(`
|
|
232
|
+
|
|
233
|
+
`).slice(0,o$)}]);for(let t of e.blocks??[])if(t.type===`text`&&t.text?.trim())l.push(t.text.trim());else if(t.type===`image`&&t.path)d.push(t.path);else if(t.type===`tool_call`)u.push({callId:t.callId??``,name:t.name??`tool`,...y$(t.input),input:t.input});else if(t.type===`tool_result`&&t.callId){t.isError&&r.push(t.callId);let n=s$(t.output);n&&i.push([t.callId,n]),e.timestamp&&a.push([t.callId,e.timestamp])}if(l.length===0&&u.length===0&&d.length===0)return;let p=l.join(`
|
|
234
|
+
|
|
235
|
+
`),m=u.length===0&&c!==`assistant`?_$(p):null,h=m?{index:t+s,role:`system`,at:e.timestamp??``,text:m.summary,tools:u,notice:m}:{index:t+s,role:c,at:e.timestamp??``,text:p,tools:u};n.push(d.length>0?{...h,images:d}:h)}),{entries:n,failed:r,outputs:i,ended:a,thoughts:o}}function S$(e,t,n){let r=x$(t,n),i=new Map(e.entries.map(e=>[e.index,e]));for(let e of r.entries)i.set(e.index,e);let a=r.failed.length>0?new Set([...e.failed,...r.failed]):e.failed,o=r.outputs.length>0?new Map([...e.outputs,...r.outputs]):e.outputs,s=r.ended.length>0?new Map([...e.ended,...r.ended]):e.ended,c=r.thoughts.length>0?new Map([...e.thoughts,...r.thoughts]):e.thoughts;return{entries:[...i.values()].sort((e,t)=>e.index-t.index),failed:a,outputs:o,ended:s,thoughts:c}}function C$(e){let t=[];return{text:e.replace(/^images\[\d+\]: (\/.+)\n?/gm,(e,n)=>(t.push(n.trim()),``)).trim(),images:t}}function w$(e){let t=[];for(let n of e){let e=t.at(-1);e&&n.text===``&&n.role===`assistant`&&e.role===`assistant`?t[t.length-1]={...e,tools:[...e.tools,...n.tools]}:t.push(n)}return t}function T$(e,t){let n=t.trim().toLowerCase();return n!==``&&e.tools.some(e=>`${e.name} ${e.summary}`.toLowerCase().includes(n))}function E$(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>e.text.toLowerCase().includes(n)||e.tools.some(e=>`${e.name} ${e.summary}`.toLowerCase().includes(n))).map(e=>e.index):[]}var D$=e=>e.replace(/[*_`]+/g,``).replace(/[…\s]+/g,` `).trim().toLowerCase();function O$(e,t){let n=e.find(e=>e.at===t.at&&e.role===t.role);if(n)return n.index;let r=D$(t.snippet);return r?e.find(e=>e.role===t.role&&D$(e.text).includes(r))?.index??null:null}function k$(e,t){let n=e[0];if(!n)return!0;let[r,i]=[Date.parse(n.at),Date.parse(t.at)];return Number.isNaN(r)||Number.isNaN(i)?!0:r>i}function A$(e,t){let n=e.tools.map(e=>`- \`${e.name}\`${e.summary?` ${e.summary}`:``}${t.has(e.callId)?` (failed)`:``}`);return[e.text,n.join(`
|
|
236
|
+
`)].filter(e=>e!==``).join(`
|
|
237
|
+
|
|
238
|
+
`)}function j$(e,t){return e.text===``?A$(e,t):e.text}function M$(e,t,n,r){return`# ${e}\n\n${t.map(e=>`${`## ${r[e.role]}${e.at?` · ${e.at}`:``}`}\n\n${A$(e,n)}`).join(`
|
|
239
|
+
|
|
240
|
+
`)}\n`}var N$=50;function P$(e,t){if(t.reset)return t.source===`terminal`||!t.history?{kind:`terminal`,tail:t.terminal?.tail??[]}:{kind:`ready`,transcript:S$(a$,t.history.messages??[],t.history.firstIndex??0),cursor:t.cursor??null,older:t.olderCursor??null};if(t.source===`history`&&t.history){let n=t.history.messages??[],r=t.history.firstIndex??0;return e.kind===`ready`?{...e,transcript:S$(e.transcript,n,r),cursor:t.cursor??e.cursor}:{kind:`ready`,transcript:S$(a$,n,r),cursor:t.cursor??null,older:t.olderCursor??null}}return t.source===`terminal`&&t.terminal?{kind:`terminal`,tail:t.terminal.tail??[]}:e}function F$(e,t,n=!0){let[r,i]=(0,J.useState)({kind:`loading`}),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(!1),l=(0,J.useRef)(r);l.current=r;let u=(0,J.useRef)(!1),d=(0,J.useRef)(0),f=(0,J.useCallback)(n=>e.client.request(`output.read`,{taskId:t,limit:N$,...n}),[e,t]),p=(0,J.useCallback)(async()=>{let e=++d.current;u.current=!0;try{let t=await f({});if(e!==d.current)return;if(t.source===`terminal`||!t.history){i({kind:`terminal`,tail:t.terminal?.tail??[]});return}let n=S$(a$,t.history.messages??[],t.history.firstIndex??0);i({kind:`ready`,transcript:n,cursor:t.cursor??null,older:t.olderCursor??null})}catch(t){e===d.current&&i({kind:`error`,message:Ra(t)})}finally{e===d.current&&(u.current=!1)}},[f]);(0,J.useEffect)(()=>{if(i({kind:`loading`}),c(!1),t)return p(),()=>{d.current++,u.current=!1}},[p,t]);let m=r.kind===`ready`||r.kind===`terminal`?r.kind:null;(0,J.useEffect)(()=>{if(!n||!m){c(!1);return}let r=!1,a=!1,o=e.client.on(`transcript.update`,e=>{r||!i$(e)||e.taskId!==t||e.tab||i(t=>P$(t,e))}),s=e.client.onOpen(()=>{let n=l.current,i=n.kind===`ready`?n.cursor:null;e.client.request(`transcript.subscribe`,{taskId:t,...i?{cursor:i}:{}}).then(e=>{if(r)return;let t=e?.streaming===!0;a=t,c(t)},()=>{r||c(!1)})});return()=>{r=!0,o(),s(),c(!1),a&&e.client.request(`transcript.unsubscribe`,{taskId:t}).catch(()=>{})}},[n,m,e,t]);let h=(0,J.useCallback)(async()=>{let e=l.current;if(u.current)return;if(e.kind===`terminal`)return p();if(e.kind!==`ready`||!e.cursor)return;let t=d.current;u.current=!0;try{let n=await f({cursor:e.cursor,source:`history`});if(t!==d.current)return;i(e=>e.kind===`ready`?{...e,transcript:S$(e.transcript,n.history?.messages??[],n.history?.firstIndex??0),cursor:n.cursor??e.cursor}:e)}catch{t===d.current&&(u.current=!1,await p())}finally{t===d.current&&(u.current=!1)}},[f,p]);return{state:r,paging:a,streaming:s,loadOlder:(0,J.useCallback)(async()=>{let e=l.current;if(u.current||e.kind!==`ready`||!e.older)return;let t=d.current;u.current=!0,o(!0);try{let n=await f({cursor:e.older,source:`history`});if(t!==d.current)return;i(e=>e.kind===`ready`?{...e,transcript:S$(e.transcript,n.history?.messages??[],n.history?.firstIndex??0),older:n.olderCursor??null}:e)}catch(e){t===d.current&&i({kind:`error`,message:Ra(e)})}finally{t===d.current&&(u.current=!1,o(!1))}},[f]),loadAll:(0,J.useCallback)(async()=>{let e=l.current;if(e.kind!==`ready`)return null;if(u.current||!e.older)return e.transcript;let t=d.current;u.current=!0,o(!0);let n=[],r=e.transcript;try{for(let i=e.older;i&&t===d.current;){let e=await f({cursor:i,source:`history`}),t={messages:e.history?.messages??[],firstIndex:e.history?.firstIndex??0};n.push(t),r=S$(r,t.messages,t.firstIndex),i=e.olderCursor??null}return t===d.current?(i(e=>e.kind===`ready`?{...e,transcript:n.reduce((e,t)=>S$(e,t.messages,t.firstIndex),e.transcript),older:null}:e),r):null}catch(e){return t===d.current&&i({kind:`error`,message:Ra(e)}),null}finally{t===d.current&&(u.current=!1,o(!1))}},[f]),refresh:h,reload:(0,J.useCallback)(()=>{i({kind:`loading`}),p()},[p])}}G();var I$=8,L$=14;function R$(e){return e<1e3?`${Math.max(1,Math.round(e))}ms`:e<6e4?`${(e/1e3).toFixed(+(e<1e4))}s`:`${Math.floor(e/6e4)}m ${String(Math.round(e%6e4/1e3)).padStart(2,`0`)}s`}function z$(e){if(!e||typeof e!=`object`)return null;let t=Object.fromEntries(Object.entries(e).map(([e,t])=>[e.toLowerCase(),t])),n=t.old_string??t.oldtext??t.old_str??t.old,r=t.new_string??t.newtext??t.new_str??t.new;return typeof n==`string`&&typeof r==`string`?{before:n,after:r}:null}function B$({before:e,after:t}){let n=[...e.split(`
|
|
241
|
+
`).map(e=>({kind:`del`,text:e})),...t.split(`
|
|
242
|
+
`).map(e=>({kind:`add`,text:e}))],r=n.slice(0,L$);return(0,K.jsxs)(`pre`,{className:yQ,"data-tp-part":`tool-edit`,children:[r.map((e,t)=>(0,K.jsxs)(`span`,{className:e.kind===`add`?bQ:xQ,"data-line":e.kind,children:[e.kind===`add`?`+ `:`- `,e.text,`
|
|
243
|
+
`]},t)),n.length>r.length&&(0,K.jsxs)(`span`,{className:`text-subtle`,children:[`… +`,n.length-r.length]})]})}function V$(e){let{tool:t,show:n}=e,r=n.edits?z$(t.input):null,i=n.output&&e.output?e.output.trimEnd().split(`
|
|
244
|
+
`):null,a=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:hQ,"data-tp-part":`tool-name`,children:qQ(t.name,e.needle)},`name`),(0,K.jsx)(`span`,{className:gQ,"data-tp-part":`tool-arg`,children:qQ(t.summary,e.needle)},`text`),n.duration&&e.ran!==void 0&&(0,K.jsx)(`span`,{className:`text-subtle`,"data-tp-part":`tool-time`,children:R$(e.ran)},`ran`),e.failed&&(0,K.jsx)(`span`,{className:`flex-none text-error`,children:U(`transcript.failed`)},`failed`)]}),o={"data-tp-part":`tool`,"data-tool":t.name.toLowerCase(),"data-failed":e.failed||void 0};return!t.full&&!r&&!i?(0,K.jsx)(`p`,{className:mQ,title:`${t.name} ${t.summary}`,...o,children:a}):(0,K.jsxs)(`details`,{className:_Q,open:n.open&&(r!==null||i!==null),...o,children:[(0,K.jsx)(`summary`,{className:vQ,"data-tp-part":`tool-line`,title:`${t.name} ${t.full??t.summary}`.slice(0,600),children:a}),t.full&&(0,K.jsx)(`pre`,{className:`m-0 mt-1 mb-1 max-h-60 overflow-auto rounded-sm border-hairline border-line bg-inset px-2.5 py-1.5 font-mono text-meta leading-[1.45] whitespace-pre-wrap text-muted wrap-anywhere`,"data-tp-part":`tool-full`,children:t.full}),r&&(0,K.jsx)(B$,{...r}),i&&(0,K.jsxs)(`pre`,{className:`m-0 mt-1 mb-1 max-h-60 overflow-auto rounded-sm border-hairline border-line bg-inset px-2.5 py-1.5 font-mono text-meta leading-[1.45] whitespace-pre-wrap text-muted wrap-anywhere`,"data-tp-part":`tool-output`,"data-failed":e.failed||void 0,children:[i.length>I$&&(0,K.jsxs)(`span`,{className:`text-subtle`,children:[`… +`,i.length-I$,`
|
|
245
|
+
`]}),i.slice(-8).join(`
|
|
246
|
+
`)]})]})}function H$({text:e}){return(0,K.jsx)(`p`,{className:SQ,"data-tp-part":`thinking`,title:e.slice(0,600),children:e})}G(),A(),H();var U$=3e3,W$=15e3,G$=80,K$=2500,q$=new Map;function J$(e,t){let n=URL.createObjectURL(new Blob([t],{type:`text/markdown;charset=utf-8`})),r=document.createElement(`a`);r.href=n,r.download=e,r.click(),URL.revokeObjectURL(n)}var Y$=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})};function X$({url:e,name:t}){return(0,J.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.preventDefault(),ce())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,K.jsx)(`div`,{className:MQ,onMouseDown:e=>e.target===e.currentTarget&&ce(),children:(0,K.jsx)(`dialog`,{open:!0,"aria-label":t,className:NQ,children:(0,K.jsx)(`img`,{src:e,alt:t,className:PQ})})})}function Z$({model:e,path:t}){let[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(!1);(0,J.useEffect)(()=>{let n=!0;return e.client.request(`attachment.get`,{path:t}).then(e=>n&&r(e.base64),()=>n&&a(!0)),()=>{n=!1}},[e,t]);let o=n$(n,HZ(`image`,t)),s=t.split(`/`).pop()??t;return i?(0,K.jsx)(`span`,{className:mQ,children:t}):o?(0,K.jsx)(q,{variant:`row`,className:jQ,title:s,onClick:()=>B.set((0,K.jsx)(X$,{url:o,name:s})),children:(0,K.jsx)(`img`,{src:o,alt:s,className:FQ})}):(0,K.jsx)(`span`,{className:FQ})}function Q$(e){let{entry:t}=e,n=U(t.role===`user`?`transcript.you`:t.role===`assistant`?`transcript.agent`:`transcript.system`),r=Date.parse(t.at),i=t.tools.map((t,n)=>{let i=Date.parse(e.ended.get(t.callId)??``);return(0,K.jsx)(V$,{tool:t,failed:e.failed.has(t.callId),needle:e.needle,output:e.outputs.get(t.callId),ran:i>=r?i-r:void 0,show:e.show},n)}),a=(0,J.useMemo)(()=>C$(t.text),[t.text]),o=[...new Set([...a.images,...t.images??[]])],s=t.tools.filter(t=>e.failed.has(t.callId)).length;if(t.notice){let{kind:n,status:r,summary:i,details:a}=t.notice;return(0,K.jsxs)(`details`,{className:CQ(e),"data-index":t.index,"data-tp-part":`notice`,"data-status":r,children:[(0,K.jsxs)(`summary`,{className:wQ,children:[(0,K.jsx)(`span`,{className:TQ,children:n}),r&&(0,K.jsx)(`span`,{className:DQ(r),children:r}),(0,K.jsx)(`span`,{className:EQ,children:qQ(i,e.needle)}),(0,K.jsx)(`span`,{className:fQ,children:Y$(t.at)})]}),(0,K.jsx)(`pre`,{className:yQ,children:a})]})}return(0,K.jsxs)(`article`,{className:lQ(e),"data-index":t.index,"data-tp-part":`entry`,"data-role":t.role,children:[e.thinking&&(0,K.jsx)(H$,{text:e.thinking}),(0,K.jsxs)(`header`,{className:uQ,"data-tp-part":`entry-head`,children:[(0,K.jsx)(`span`,{className:dQ(t.role),"data-tp-part":`entry-who`,children:n}),(0,K.jsx)(`span`,{className:fQ,"data-tp-part":`entry-time`,children:Y$(t.at)}),(0,K.jsx)(q,{className:pQ,"data-tp-part":`entry-copy`,onClick:e.onCopy,children:U(`transcript.copy`)})]}),a.text!==``&&(0,K.jsx)(`div`,{"data-tp-part":`entry-text`,children:(0,K.jsx)($Q,{source:a.text,needle:e.needle})}),o.length>0&&(0,K.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:o.map(t=>(0,K.jsx)(Z$,{model:e.model,path:t},t))}),t.tools.length>1?(0,K.jsxs)(`details`,{className:OQ,open:e.show.open||T$(t,e.needle),"data-tp-part":`tools-fold`,children:[(0,K.jsxs)(`summary`,{className:kQ,"data-tp-part":`tools-summary`,children:[(0,K.jsx)(`span`,{className:AQ,children:`›`}),U(`transcript.tools`,{count:t.tools.length}),s>0&&(0,K.jsx)(`span`,{className:`flex-none text-error`,children:U(`transcript.toolsFailed`,{count:s})})]}),i]}):i]})}var $$={};function e1({model:e,task:t,active:n,show:r=$$,bar:i=!0}){W();let a=F$(e,t.id,n),{state:o,streaming:s}=a,[c,l]=(0,J.useState)(``),[u,d]=(0,J.useState)(0),[f,p]=(0,J.useState)(null),m=(0,J.useRef)(null),h=(0,J.useRef)(!0),g=(0,J.useRef)(null),_=k(Mq),v=o.kind===`ready`?o:null,y=(0,J.useMemo)(()=>w$(v?.transcript.entries??[]),[v?.transcript]),b=v?.transcript.failed??new Set,x=v?.transcript.outputs??q$,S=v?.transcript.ended??q$,C=(0,J.useMemo)(()=>{let e=new Map;if(!r.thinking||!v)return e;for(let[t,n]of v.transcript.thoughts){let r=(y.find(e=>e.index>=t)??y.at(-1))?.index;r!==void 0&&e.set(r,e.has(r)?`${e.get(r)}\n${n.text}`:n.text)}return e},[r.thinking,v,y]),w=(0,J.useMemo)(()=>E$(y,c),[y,c]),T=w.length===0?0:Math.min(u,w.length-1),E=w[T]??null,D=e=>{h.current=!1,m.current?.querySelector(`[data-index="${e}"]`)?.scrollIntoView({block:`center`})},O=t.rowStatus?.kind,ee=O===`running`||O===`needs-input`,{refresh:A}=a;(0,J.useEffect)(()=>{n&&A()},[n,O,A]),(0,J.useEffect)(()=>{if(!n||!ee)return;let e=setInterval(()=>void A(),s?W$:U$);return()=>clearInterval(e)},[n,ee,A,s]),(0,J.useLayoutEffect)(()=>{let e=m.current;e&&(g.current?(e.scrollTop=g.current.top+(e.scrollHeight-g.current.height),g.current=null):h.current&&(e.scrollTop=e.scrollHeight))},[y]);let j=async()=>{let e=m.current;e&&(g.current={height:e.scrollHeight,top:e.scrollTop}),await a.loadOlder()};(0,J.useEffect)(()=>{if(!_||_.taskId!==t.id||!v||!n)return;let e=O$(y,_.hit);e===null?v.older&&k$(y,_.hit)?j():Mq.set(null):(p(e),D(e),Mq.set(null))},[_,v,y,n,t.id]),(0,J.useEffect)(()=>{if(f===null)return;let e=setTimeout(()=>p(null),K$);return()=>clearTimeout(e)},[f]),(0,J.useEffect)(()=>{d(0);let e=E$(y,c)[0];e!==void 0&&D(e)},[c]);let M=e=>{if(w.length===0)return;let t=(T+e+w.length)%w.length;d(t),D(w[t])},N=e=>{e.key===`Enter`&&!e.nativeEvent.isComposing?(e.preventDefault(),M(e.shiftKey?-1:1)):e.key===`Escape`&&c!==``&&(e.stopPropagation(),l(``))},P=e=>void navigator.clipboard.writeText(j$(e,b)).then(()=>z(U(`transcript.copied`)),()=>z(U(`menu.copyFailed`),`error`)),F=async()=>{let e=await a.loadAll();if(!e)return;let n={user:U(`transcript.you`),assistant:U(`transcript.agent`),system:U(`transcript.system`)};J$(`${t.label.replace(/[^\p{L}\p{N}]+/gu,`-`).replace(/^-|-$/g,``)||`conversation`}.md`,M$(t.label,w$(e.entries),e.failed,n))};return o.kind===`loading`?(0,K.jsx)(`div`,{className:iQ,children:(0,K.jsx)(`p`,{className:sQ,children:U(`transcript.loading`)})}):o.kind===`error`?(0,K.jsxs)(`div`,{className:iQ,children:[(0,K.jsx)(`p`,{className:`${sQ} text-error`,children:U(`transcript.error`,{error:o.message})}),(0,K.jsx)(`p`,{className:sQ,children:(0,K.jsx)(q,{onClick:a.reload,children:U(`transcript.retry`)})})]}):o.kind===`terminal`?(0,K.jsxs)(`div`,{className:iQ,children:[(0,K.jsx)(`p`,{className:sQ,children:U(`transcript.noHistory`)}),(0,K.jsx)(`pre`,{className:`${cQ} min-h-0 flex-1 overflow-y-auto`,children:o.tail.join(`
|
|
247
|
+
`)})]}):(0,K.jsxs)(`div`,{className:iQ,"data-tp-part":`transcript`,"data-live":ee||void 0,children:[i&&(0,K.jsxs)(`div`,{className:`flex flex-none flex-wrap items-center gap-x-3 gap-y-1 px-3 pb-1.5 font-mono text-meta`,"data-tp-part":`transcript-bar`,children:[(0,K.jsx)(`input`,{className:`${ji} min-w-0 flex-1 basis-32 py-1 text-meta`,value:c,placeholder:U(`transcript.findPlaceholder`),"aria-label":U(`transcript.findPlaceholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>l(e.target.value),onKeyDown:N}),c.trim()!==``&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`whitespace-nowrap text-muted`,children:w.length===0?U(`transcript.findNone`):U(`transcript.findCount`,{at:T+1,total:w.length})}),(0,K.jsx)(q,{onClick:()=>M(-1),disabled:w.length===0,children:U(`transcript.prev`)}),(0,K.jsx)(q,{onClick:()=>M(1),disabled:w.length===0,children:U(`transcript.next`)})]}),(0,K.jsx)(q,{onClick:()=>void F(),disabled:y.length===0,children:U(`transcript.export`)})]}),(0,K.jsxs)(`div`,{ref:m,className:oQ,"data-tp-part":`transcript-thread`,onScroll:e=>{let t=e.currentTarget;h.current=t.scrollHeight-t.scrollTop-t.clientHeight<G$,t.scrollTop<G$&&v?.older&&!a.paging&&j()},children:[v?.older&&(0,K.jsx)(`p`,{className:`m-0 px-3 py-2 font-mono text-meta text-subtle`,children:(0,K.jsx)(q,{onClick:()=>void j(),disabled:a.paging,children:U(`transcript.older`)})}),y.length===0&&(0,K.jsx)(`p`,{className:`m-0 px-3 py-2 font-mono text-meta text-subtle`,children:U(`transcript.empty`)}),y.map(t=>(0,K.jsx)(Q$,{model:e,entry:t,failed:b,outputs:x,ended:S,thinking:C.get(t.index),show:r,needle:c,flash:f===t.index,current:E===t.index,onCopy:()=>P(t)},t.index))]})]})}G(),A();var t1=O(null),n1=(0,J.createContext)(null);function r1(e){let t=k(t1),n=k(t?.tabs??i1);if(!t)return null;let r=t.engineTarget(e.taskId).tabId??n[e.taskId]?.find(e=>e.kind===`engine`)?.id;return r?(0,K.jsx)(LZ,{model:t,taskId:e.taskId,tabId:r,inPackage:{placeholder:e.placeholder,sendLabel:e.sendLabel}}):null}var i1=O({});function a1(e){W();let t=t=>{t.key===`Escape`&&e.value!==``&&(t.stopPropagation(),e.onChange(``))},n=e.label??e.placeholder??U(`rail.searchPlaceholder`);return(0,K.jsx)(`input`,{className:ji,"data-tp-part":`search`,type:`text`,value:e.value,placeholder:e.placeholder??U(`rail.searchPlaceholder`),"aria-label":n,spellCheck:!1,autoComplete:`off`,autoCapitalize:`off`,enterKeyHint:`search`,onChange:t=>e.onChange(t.target.value),onKeyDown:t})}function o1(){return(0,J.useContext)(n1)}function s1(e){let t=k(t1),n=k(t?.tasks??c1),r=t?ec(n,e.taskId):void 0;return!t||!r?null:(0,K.jsx)(e1,{model:t,task:r,active:!0,show:e.show,bar:e.bar??!1})}var c1=O(null);function l1({decision:e,sendLabel:t}){W();let[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(``),o=t=>{r(!0),e.onAnswer(t)};return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"data-tp-part":`decision`,"data-answered":n||void 0,children:[e.options.map(t=>(0,K.jsx)(q,{variant:t.key===e.recommended?`filled`:`action`,"data-tp-part":`decision-option`,"data-recommended":t.key===e.recommended||void 0,title:t.detail,disabled:n,onClick:()=>o({option:t.key}),children:t.label},t.key)),e.options.length===0&&(0,K.jsxs)(`form`,{className:`flex min-w-0 flex-1 items-center gap-2`,onSubmit:e=>{e.preventDefault(),i.trim()&&o({text:i.trim()})},children:[(0,K.jsx)(`input`,{className:ji,"data-tp-part":`decision-input`,value:i,disabled:n,"aria-label":e.question,onChange:e=>a(e.target.value)}),(0,K.jsx)(q,{variant:`action`,type:`submit`,"data-tp-part":`decision-option`,disabled:n||!i.trim(),children:t??U(`inbox.gateAnswer`)})]})]})}var u1={Composer:r1,SearchField:a1,Terminal:o1,Transcript:s1,Decision:l1};xb(),A(),jl();var d1=O({loaded:!1,dir:``,activeId:null,activePack:null,packs:[],loadErrors:[],slotComponents:{},runtimeErrors:[],disabledByCrash:!1}),f1=O({}),p1=String(Date.now());function m1(){return f1.get()}function h1(){return k(f1)}function g1(){let e=globalThis;e.__ROVE_THEME_HOST__||=Object.freeze({React:J,jsxRuntime:K,ui:Object.freeze({Button:q,Chip:YR,StatusDots:iF,EngineIcon:VF,Chevron:tI,...u1}),getTokens:m1,useTokens:h1})}g1();var _1=``,v1={};async function y1(e){if(!e.hasComponents||!e.bundleUrl)return{slots:{}};let t=`${e.id}@${e.fingerprint}`;if(_1===t)return{slots:v1};g1();let n=e.bundleUrl.includes(`?`)?`&`:`?`,r=`${e.bundleUrl}${n}boot=${p1}`;try{let n=await Al(()=>import(r),[]);if(!n||typeof n.slots!=`object`||n.slots===null)return{slots:{},error:{packId:e.id,phase:`import`,file:e.bundleUrl,message:`theme bundle exported no slots map`,timestamp:Date.now()}};let i=n.slots,a={};for(let[t,n]of Object.entries(i)){if(typeof n!=`function`){let n=e.manifest.slots?.[t];return{slots:{},error:{packId:e.id,phase:`import`,slot:t,file:n?.component??e.bundleUrl,message:`slot "${t}" export "${n?.export??`default`}" is not a React component function`,timestamp:Date.now()}}}a[t]=n}return _1=t,v1=a,{slots:v1}}catch(t){return{slots:{},error:{packId:e.id,phase:`import`,file:e.bundleUrl,message:t instanceof Error?t.message:String(t),stack:t instanceof Error?t.stack:void 0,timestamp:Date.now()}}}}async function b1(e){let t=e.active,n=e.errors.find(e=>e.id===t),r=e.packs.find(e=>e.id===t)??null;if(!t||!r){_1=``,v1={},d1.set({loaded:!0,dir:e.dir,activeId:t,activePack:null,packs:e.packs,loadErrors:e.errors,slotComponents:{},runtimeErrors:t&&n?[{packId:t,phase:`manifest`,file:n.file,slot:n.slot,message:n.message,issues:n.issues,timestamp:Date.now()}]:[],disabledByCrash:!1});return}if(r.bundleError){let n=r.bundleError.line?`:${r.bundleError.line}`:``;d1.set({loaded:!0,dir:e.dir,activeId:t,activePack:null,packs:e.packs,loadErrors:e.errors,slotComponents:{},runtimeErrors:[{packId:t,phase:`bundle`,file:`${r.bundleError.file}${n}`,slot:r.bundleError.slot,message:r.bundleError.message,timestamp:Date.now()}],disabledByCrash:!1});return}let i=await y1(r);if(i.error){d1.set({loaded:!0,dir:e.dir,activeId:t,activePack:null,packs:e.packs,loadErrors:e.errors,slotComponents:{},runtimeErrors:[i.error],disabledByCrash:!1});return}let a=d1.get(),o=a.activePack?.id===r.id&&a.activePack?.fingerprint===r.fingerprint,s=o?a.runtimeErrors.filter(e=>e.packId===r.id&&(e.phase===`render`||e.phase===`shell`)):[];d1.set({loaded:!0,dir:e.dir,activeId:t,activePack:o&&a.disabledByCrash?null:r,packs:e.packs,loadErrors:e.errors,slotComponents:o&&a.disabledByCrash?{}:i.slots,runtimeErrors:s,disabledByCrash:o?a.disabledByCrash:!1})}async function x1(e){await b1(await e.request(`theme.packages`))}async function S1(e){await pb(e,`theme`,SZ),await x1(e)}function C1(e,t,n,r,i){let a=d1.get(),o=[r.stack,i].filter(Boolean).join(`
|
|
248
|
+
`);a.runtimeErrors.some(n=>n.packId===e&&n.slot===t&&n.phase===`render`&&n.message===r.message)||d1.set({...a,runtimeErrors:[...a.runtimeErrors,{packId:e,phase:`render`,slot:t,file:n,message:r.message,stack:o,timestamp:Date.now()}]})}function w1(e,t){let n=d1.get(),r=[e.stack,t].filter(Boolean).join(`
|
|
249
|
+
`);d1.set({...n,activePack:null,slotComponents:{},disabledByCrash:!0,runtimeErrors:[...n.runtimeErrors,{packId:n.activeId??``,phase:`shell`,message:e.message,stack:r,timestamp:Date.now()}]})}function T1(){return k(d1)}function E1(){let e=k(d1);return e.disabledByCrash?null:e.activePack}var D1=`flex flex-wrap items-center gap-2 border-b-hairline border-error bg-surface px-3 py-1.5 font-mono text-meta text-ink`,O1=`rounded-xs bg-error px-1.5 py-0.5 font-semibold text-paper`,k1=`min-w-0 flex-1 truncate text-error`,A1=`ml-auto flex flex-none items-center gap-2`,j1=`flex w-full min-w-0 flex-col gap-0.5 rounded-sm px-2.5 py-1.5 text-left transition-colors`,M1=`flex min-w-0 items-center gap-1.5 text-title text-ink`,N1=`inline-flex items-center gap-1 rounded-xs bg-inset px-1.5 py-0.5 font-mono text-meta text-muted`,P1=`rounded-md border-hairline border-line bg-surface overflow-hidden`;function F1(e){return e===`cards`?`bg-paper p-[var(--tp-shell-pad,8px)] gap-[var(--tp-pane-gap,8px)]`:``}function I1(e){return e===`cards`?P1:``}function L1(e){return e===`compact`?`min-h-6 py-0.5 px-2`:e===`spacious`?`min-h-11 py-2 px-3`:`min-h-8 py-1.25 px-2.5`}function R1(e,t){return e===`surface`?t?`bg-menu border-hairline border-accent`:`bg-surface border-hairline border-line hover:bg-hover`:e===`inset`?t?`bg-menu border-hairline border-accent`:`bg-inset hover:bg-hover`:e===`accentSoft`?t?`bg-accent-soft border-hairline border-accent`:`bg-accent-soft/60 hover:bg-accent-soft`:e===`paper`?t?`bg-menu`:`bg-paper hover:bg-hover`:e===`sidebar`?t?`bg-menu`:`bg-sidebar hover:bg-hover`:e===`engineTint`?t?`border-hairline border-accent bg-[color-mix(in_srgb,var(--tp-engine-color,var(--accent))_22%,var(--surface))]`:`border-hairline border-line bg-[color-mix(in_srgb,var(--tp-engine-color,var(--surface))_11%,var(--surface))] hover:bg-[color-mix(in_srgb,var(--tp-engine-color,var(--surface))_17%,var(--surface))]`:t?`bg-menu`:`hover:bg-hover`}function z1(e){return e===`card`?`rounded-md mb-1`:e===`pill`?`rounded-full px-3`:e===`compact`?`rounded-xs py-0.5`:e===`minimal`?`rounded-none px-1.5`:`rounded-sm`}var B1=`col-span-full flex min-w-0 items-center gap-3 border-t-hairline border-line bg-surface px-3 py-1 font-mono text-meta whitespace-nowrap text-muted`,V1=`flex min-w-0 items-center justify-between gap-2 border-b-hairline border-line bg-surface px-2.5 py-1.5 font-mono text-meta text-ink`;G();function H1({model:e}){W();let t=T1(),n=t.runtimeErrors[t.runtimeErrors.length-1]??null;return(0,K.jsxs)(K.Fragment,{children:[t.packs.length>0&&(0,K.jsx)(`p`,{className:`text-meta text-muted [&_a]:text-accent m-0`,children:U(`settings.appearance.themePackageNote`)}),n&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-error bg-inset p-3 font-mono text-meta text-ink`,"data-theme-package-last-error":!0,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsxs)(`span`,{className:`font-semibold text-error`,children:[U(`settings.appearance.themeLastError`,{theme:n.packId}),n.slot?` · ${n.slot}`:``,n.file?` (${n.file})`:``]}),(0,K.jsx)(q,{variant:`action`,onClick:()=>void S1(e.client),children:U(`settings.appearance.themeSwitchDefault`)})]}),(0,K.jsx)(`p`,{className:`m-0 text-ink`,children:n.message}),n.stack&&(0,K.jsx)(`pre`,{className:`m-0 max-h-40 overflow-auto whitespace-pre-wrap break-all rounded-xs bg-paper p-2 font-mono text-meta text-muted`,children:n.stack})]}),t.loadErrors.length>0&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-theme-package-load-errors":!0,children:[(0,K.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent`,children:U(`settings.appearance.themeInvalidHeading`)}),t.loadErrors.map(e=>(0,K.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-error bg-inset p-3 font-mono text-meta text-ink`,children:[(0,K.jsxs)(`span`,{className:`font-semibold text-error`,children:[e.id,` · `,e.file,e.slot?` (${e.slot})`:``]}),e.issues&&e.issues.length>0?(0,K.jsx)(`ul`,{className:`m-0 list-disc pl-4 text-ink`,children:e.issues.map(e=>(0,K.jsxs)(`li`,{children:[e.path?`${e.path}: `:``,e.message]},`${e.path}:${e.message}`))}):(0,K.jsx)(`span`,{className:`text-ink`,children:e.message})]},e.id))]})]})}G(),He(),cb(),xb(),A();var U1=O(null);function W1({theme:e,mode:t}){let n=e[t],r=(e,t)=>({background:e,width:t});return(0,K.jsxs)(`span`,{className:zY,style:{background:n.background,borderColor:n.border},"aria-hidden":!0,children:[(0,K.jsxs)(`span`,{className:BY,style:{background:n.backgroundPanel},children:[(0,K.jsx)(`span`,{className:HY,style:r(n.primary,`70%`)}),(0,K.jsx)(`span`,{className:HY,style:r(n.textMuted,`85%`)}),(0,K.jsx)(`span`,{className:HY,style:r(n.textMuted,`55%`)})]}),(0,K.jsxs)(`span`,{className:VY,children:[(0,K.jsx)(`span`,{className:HY,style:r(n.text,`90%`)}),(0,K.jsx)(`span`,{className:HY,style:r(n.textMuted,`65%`)}),(0,K.jsx)(`span`,{className:HY,style:r(n.accent??n.primary,`40%`)}),(0,K.jsx)(`span`,{className:UY,children:[n.success,n.warning,n.error,n.info].map((e,t)=>(0,K.jsx)(`span`,{className:WY,style:{background:e}},t))})]})]})}function G1(e){return(0,K.jsxs)(q,{variant:`card`,title:e.title,"aria-pressed":e.active,className:RY(e.active),onMouseEnter:()=>sb.set(e.theme),onFocus:()=>sb.set(e.theme),onClick:e.onClick,children:[(0,K.jsx)(W1,{theme:e.theme,mode:e.mode}),(0,K.jsxs)(`span`,{className:GY,children:[(0,K.jsx)(`span`,{className:`truncate text-ink`,children:e.label??e.theme.name}),e.tag&&(0,K.jsx)(`span`,{className:`text-subtle`,children:e.tag})]})]})}function K1({children:e}){return(0,K.jsx)(`div`,{className:IY,onMouseLeave:()=>sb.set(null),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||sb.set(null)},children:e})}function q1(e){let{model:t}=e,{client:n}=t,r=k(U1),[i,a]=(0,J.useState)([]),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(null),[f,p]=(0,J.useState)(null),[m,h]=(0,J.useState)(!1),[g,_]=(0,J.useState)(!1),v=ke(),y=new Map(T1().packs.map(e=>[e.id,e]));(0,J.useEffect)(()=>()=>sb.set(null),[]),(0,J.useEffect)(()=>void fb(n).catch(()=>void 0),[n]),(0,J.useEffect)(()=>{let e=!0;return n.request(`theme.terminals`).then(t=>{e&&a(t.terminals)},()=>{e&&a([])}),()=>{e=!1}},[n]),(0,J.useEffect)(()=>{U1.get()===null&&n.request(`theme.hosted`).then(e=>U1.set(e),()=>U1.set({themes:[],dir:null}))},[n]);let b=e=>{h(!1),fq(t,U(`prefs.themeAgentPrompt`,{dir:e})).catch(()=>h(!0))},x=r?.dir??null,S=async e=>{s(e),l(null);try{await n.request(`theme.install`,{name:e}),await fb(n),await pb(n,`theme`,e)}catch{l(e)}finally{s(null)}},C=async e=>{d(e.id),p(null);try{let t=await n.request(`theme.importTerminal`,{terminal:e.id});await fb(n),await pb(n,`theme`,t.name),a(t=>t.map(t=>t.id===e.id?{...t,installed:!0}:t))}catch{p(e.id)}finally{d(null)}},w=new Set(e.themes.map(e=>e.name)),T=(r?.themes??[]).filter(e=>!w.has(e.name));return(0,K.jsxs)(nX,{settingId:`appearance.theme`,label:e.label,hint:U(`prefs.themePreviewHint`),stack:!0,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:LY,children:U(`prefs.themeInstalled`)}),(0,K.jsx)(K1,{children:e.themes.map(t=>(0,K.jsx)(G1,{theme:t,mode:e.mode,active:t.name===e.value,title:[t.name,y.get(t.name)?.manifest.description].filter(Boolean).join(`: `),tag:y.has(t.name)?U(`prefs.themePackage`):t.bundled?void 0:U(`prefs.themeUser`),onClick:()=>t.name!==e.value&&void pb(n,`theme`,t.name)},t.name))})]}),(0,K.jsx)(H1,{model:t}),i.length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`m-0 pb-1.5 text-meta font-medium text-subtle`,children:U(`prefs.themeTerminals`)}),(0,K.jsx)(`p`,{className:`text-meta text-muted [&_a]:text-accent m-0 pb-2`,children:U(`prefs.themeTerminalsHint`)}),(0,K.jsx)(K1,{children:i.map(t=>(0,K.jsx)(G1,{theme:t,label:t.label,title:t.fontFamily?`${t.configPath} · ${t.fontFamily}`:t.configPath,mode:e.mode,active:!1,tag:u===t.id?U(`prefs.themeImporting`):f===t.id?U(`prefs.themeImportFailed`):w.has(t.name)?U(`prefs.themeSync`):U(`prefs.themeImport`),onClick:()=>u===null&&void C(t)},t.id))})]}),T.length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(q,{className:v?`flex min-h-11 w-full items-center gap-3 text-left`:`inline-flex items-center gap-1.5`,"aria-expanded":g,onClick:()=>_(!g),children:[!v&&(0,K.jsx)(tI,{right:!g}),g?U(`prefs.themeHide`):U(`prefs.themeBrowse`,{count:T.length}),v&&(0,K.jsx)(tI,{right:!g,className:`ml-auto block text-subtle`})]}),g&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`m-0 pb-1.5 text-meta font-medium text-subtle mt-2.5`,children:U(`prefs.themeMoreHint`)}),(0,K.jsx)(K1,{children:T.map(t=>(0,K.jsx)(G1,{theme:t,mode:e.mode,active:!1,title:[t.name,t.description].filter(Boolean).join(`: `),tag:o===t.name?U(`prefs.themeInstalling`):c===t.name?U(`prefs.themeInstallFailed`):t.package?U(`prefs.themePackage`):U(`prefs.themeGet`),onClick:()=>o===null&&void S(t.name)},t.name))})]})]}),x&&(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,K.jsx)(q,{variant:`action`,onClick:()=>b(x),children:U(`prefs.themeAgent`)}),(0,K.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent`,children:U(m?`prefs.themeAgentFailed`:`prefs.themeAgentHint`)})]})]})}cb(),xb(),A();var J1=O({}),Y1=``,X1=`(prefers-color-scheme: dark)`;function Z1(e){let t=window.matchMedia(X1);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function Q1(){return(0,J.useSyncExternalStore)(Z1,()=>window.matchMedia(X1).matches,()=>!0)}function $1(){let e=Q1();return By(hb().prefs.themeMode,e)}function e0(e){let t=$1(),n=hb();(0,J.useEffect)(()=>{if(!n.loaded||n.prefs.taskColors!==`on`)return;let r=`${n.prefs.theme}/${t}`;r!==Y1&&(Y1=r,J1.set({}));let i=()=>{let i=J1.get(),a=e.tasks.get(),o=[...a?.tasks??[],...a?.archived??[]].map(e=>e.id).filter(e=>!(e in i));o.length!==0&&e.client.request(`theme.taskColors`,{theme:n.prefs.theme,mode:t,taskIds:o}).then(e=>{Y1===r&&J1.set({...J1.get(),...e.colors})}).catch(()=>void 0)};return i(),e.tasks.subscribe(i)},[e,t,n.loaded,n.prefs.taskColors,n.prefs.theme])}function t0(e){let t=hb(),n=k(J1);return e&&t.prefs.taskColors===`on`?n[e]:void 0}G(),xb(),A();var n0={themeMode:{dark:`appearance.modeDark`,light:`appearance.modeLight`,auto:`appearance.modeAuto`},focusAccent:{primary:`general.accentPrimary`,success:`general.accentSuccess`,info:`general.accentInfo`},splitStyle:{box:`general.splitBox`,line:`general.splitLine`,rail:`general.splitRail`,rule:`general.splitRule`},railFold:{glyphs:`general.railFoldGlyphs`,initials:`general.railFoldInitials`,hairline:`general.railFoldHairline`},workingBorder:{flow:`appearance.borderFlow`,still:`appearance.borderStill`},runningTitle:{shimmer:`appearance.titleShimmer`,still:`appearance.titleStill`}},r0={engine:`settings.appearance.statusMarkEngine`,both:`settings.appearance.statusMarkBoth`,dots:`settings.appearance.statusMarkDots`};function i0({model:e}){let{client:t}=e,n=hb(),r=$1(),i=k(vG),a=UB(),o=(e,n)=>void pb(t,e,n),s=(e,t,r,i)=>(0,K.jsx)(cX,{settingId:`appearance.${e}`,label:$(t),hint:r,sample:i,value:n.prefs[e],picks:gb(n,e).map(t=>({value:t,label:e===`themeMode`&&t===`auto`?U(`prefs.modeAuto`):$(n0[e]?.[String(t)]??String(t))})),onPick:t=>o(e,t)}),c=(e,t,r)=>(0,K.jsx)(rX,{settingId:`appearance.${e}`,label:$(t),hint:r,checked:n.prefs[e]===`on`,onChange:t=>o(e,t?`on`:`off`)});return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(tX,{children:[(0,K.jsx)(q1,{model:e,label:$(`general.theme`),themes:n.themes,value:n.prefs.theme,mode:r}),s(`themeMode`,`general.themeMode`)]}),(0,K.jsxs)(tX,{title:U(`settings.appearance.groupColours`),children:[s(`focusAccent`,`general.focusAccent`,$(`general.focusAccentHint`)),c(`taskColors`,`general.taskColors`,U(`settings.appearance.taskColorsNote`)),c(`colorblind`,`general.colorblind`,U(`settings.appearance.colorblindNote`))]}),(0,K.jsxs)(tX,{title:U(`settings.appearance.groupTasks`),children:[s(`workingBorder`,`general.workingBorder`,U(`settings.appearance.workingBorderNote`),(0,K.jsx)(xZ,{})),s(`runningTitle`,`general.runningTitle`,void 0,(0,K.jsx)(bZ,{})),s(`splitStyle`,`general.splitStyle`),s(`railFold`,`general.railFold`,$(`general.railFoldHint`)),(0,K.jsx)(cX,{settingId:`appearance.railGroup`,label:U(`settings.appearance.railGroup`),value:i,picks:gG.map(e=>({value:e,label:U(e===`state`?`settings.appearance.railGroupState`:`settings.appearance.railGroupProject`)})),onPick:bG}),(0,K.jsx)(cX,{settingId:`appearance.statusMark`,label:U(`settings.appearance.statusMark`),sample:(0,K.jsx)(yZ,{model:e}),value:a,picks:HB.map(e=>({value:e,label:U(r0[e])})),onPick:e=>WB(t,e)})]})]})}H();function a0(e,t,n){if(t===`offline`)return`offline`;if(t===`unsupported`||t===`mismatch`)return`outdated`;if(!e)return`loading`;let r=e.status;return r?r.gh?r.account?r.account===n?`same`:`different`:`signedOut`:`noGh`:e.reason===`failed`||!e.reason?`failed`:e.reason}var o0=e=>e===``?{}:{machine:e},s0=2e3,c0=e=>e?.login?.state===`pending`||e?.login?.state===`syncing`;function l0(e){let{client:t}=e,n=RN(e),[r,i]=(0,J.useState)({}),[a,o]=(0,J.useState)(!1),s=(0,J.useMemo)(()=>{let e={};for(let i of[``,...n.map(e=>e.alias)]){let n=r[i]??Hs(t,`github.status`,o0(i));n&&(e[i]=n)}return e},[r,n,t]),c=n.flatMap(e=>e.state===`online`?[e.alias]:[]).join(`
|
|
250
|
+
`),l=(0,J.useMemo)(()=>c?c.split(`
|
|
251
|
+
`):[],[c]),u=(0,J.useRef)(new Set),d=(0,J.useCallback)(async e=>{let n=await Ws(t,`github.status`,o0(e)).catch(n=>Hs(t,`github.status`,o0(e))??{status:null,reason:`failed`,message:Ra(n)});i(t=>({...t,[e]:n}))},[t]),f=(0,J.useCallback)(async()=>{o(!0);try{await Promise.all([``,...l].map(d))}finally{o(!1)}},[d,l]);return(0,J.useEffect)(()=>t.onOpen(()=>void f()),[t,f]),(0,J.useEffect)(()=>{let e=new Set(Object.entries(s).flatMap(([e,t])=>c0(t.status)?[e]:[])),t=[...u.current].some(t=>!e.has(t));if(u.current=e,t&&f(),e.size===0)return;let n=window.setTimeout(()=>{for(let t of e)d(t)},s0);return()=>window.clearTimeout(n)},[s,d,f]),{machines:n,probes:s,refreshing:a,refresh:f,probe:d,act:(0,J.useCallback)(async(e,n)=>{try{let r=await t.request(e,n);return r.ok||z(r.message,`error`),r}catch(e){return z(Ra(e),`error`),null}},[t])}}function u0({term:e,children:t}){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`dt`,{className:DY,children:e}),(0,K.jsx)(`dd`,{className:`${OY(!1)} flex min-w-0 flex-wrap items-baseline gap-x-2.5 gap-y-1`,children:t})]})}G(),H();var d0=(e,t)=>U(`settings.connectors.${e}`,t),f0={weixin:{copy:`weixin`,command:`rove weixin login`},lark:{copy:`lark`,command:`rove lark connect`}};function p0({id:e}){return(0,K.jsx)(`svg`,{className:`size-7 flex-none`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:e===`lark`?(0,K.jsx)(`path`,{fill:`currentColor`,d:`M14.6 1.6 1.5 7.2c-.5.2-.5.9 0 1.1l3.4 1.3 1.3 3.9c.2.5.8.6 1.1.2l1.9-2.1 3.3 2.4c.4.3 1 .1 1.1-.4l2-11.2c.1-.5-.5-1-1-.8ZM6 9.3l6.2-5.1-4.8 6-.4 2.1L6 9.3Z`}):(0,K.jsx)(`path`,{fill:`currentColor`,d:`M6 2C3.2 2 1 3.9 1 6.2c0 1.3.7 2.5 1.8 3.2L2.3 11l1.9-1c.6.2 1.2.3 1.8.3h.3A3.6 3.6 0 0 1 6.2 9c0-2.2 2-3.9 4.5-3.9h.2C10.4 3.3 8.4 2 6 2Zm4.7 3.9c-2.1 0-3.7 1.4-3.7 3.1s1.6 3.1 3.7 3.1c.5 0 .9-.1 1.3-.2l1.5.8-.4-1.3c.8-.6 1.3-1.4 1.3-2.4 0-1.7-1.6-3.1-3.7-3.1Z`})})}function m0(e){let[t,n]=(0,J.useState)(e.initial);return(0,K.jsx)(`input`,{autoFocus:!0,className:`${$J} min-w-0 flex-1 py-0 text-meta`,placeholder:e.placeholder,value:t,spellCheck:!1,onChange:e=>n(e.target.value),onKeyDown:n=>{n.nativeEvent.isComposing||(n.key===`Enter`?(e.onCommit(t),e.onDone()):n.key===`Escape`&&(n.stopPropagation(),e.onDone()))},onBlur:e.onDone})}function h0({model:e,row:t,reload:n}){let{client:r}=e,i=f0[t.id],[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(null),p=async(e,i={})=>{o(!0);try{return await r.request(e,{id:t.id,...i})}catch(e){return z(e instanceof Error?e.message:String(e)),null}finally{o(!1),await n()}},m=async()=>{let e=await p(`connectors.chatConnect`);u(e?.ok===!1&&typeof e.message==`string`?e.message:null)},h=t.allow??[],g=e=>void p(`connectors.chatUpdate`,{allow:e}),_=t=>{ce(),e.select(t)};return(0,K.jsxs)(`div`,{className:qY(!0),children:[(0,K.jsxs)(`div`,{className:YY,children:[(0,K.jsxs)(`span`,{className:XY,children:[(0,K.jsx)(p0,{id:t.id}),(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,K.jsx)(`span`,{className:GJ,children:d0(`${i.copy}Name`)}),(0,K.jsx)(`span`,{className:KJ,children:d0(`${i.copy}Description`)})]})]}),t.connected?(0,K.jsx)(q,{variant:`action`,disabled:a,onClick:()=>c(!0),children:d0(`disconnect`)}):t.connectable&&(0,K.jsx)(q,{variant:`filled`,disabled:a,onClick:()=>void m(),children:d0(a?`chatConnecting`:`connect`)})]}),!t.connected&&(l??!t.connectable)&&(0,K.jsx)(`p`,{className:`text-meta text-muted [&_a]:text-accent m-0 pl-10 w-narrow:pl-0`,children:d0(`chatRunInTerminal`,{command:l??i.command})}),t.connected&&(0,K.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-3.5 gap-y-1.5 text-meta leading-[1.5] pl-10 w-narrow:pl-0`,children:[t.account&&(0,K.jsx)(u0,{term:d0(`chatBot`),children:(0,K.jsx)(`span`,{title:t.since?d0(`chatSince`,{date:t.since.slice(0,10)}):void 0,children:t.account})}),(0,K.jsx)(u0,{term:d0(`chatAgent`),children:t.agentTaskId?(0,K.jsx)(q,{onClick:()=>_(t.agentTaskId),children:d0(`chatOpen`)}):(0,K.jsx)(`span`,{className:`text-muted`,children:d0(`chatAgentNotYet`)})}),(0,K.jsxs)(u0,{term:d0(`chatAllowed`),children:[(0,K.jsx)(`span`,{children:t.owner?d0(`chatYouNamed`,{name:t.owner}):d0(`chatYou`)}),h.map(e=>(0,K.jsxs)(`span`,{className:`inline-flex min-w-0 items-baseline gap-1 text-muted`,children:[(0,K.jsx)(`span`,{className:`max-w-40 truncate`,title:e,children:e}),(0,K.jsx)(q,{hit:`tight`,disabled:a,"aria-label":d0(`chatRemove`,{id:e}),title:d0(`chatRemove`,{id:e}),onClick:()=>g(h.filter(t=>t!==e)),children:`×`})]},e)),d===`allow`?(0,K.jsx)(m0,{initial:``,placeholder:d0(`chatAllowAdd`),onCommit:e=>e.trim()&&g([...h,e.trim()]),onDone:()=>f(null)}):(0,K.jsx)(q,{disabled:a,onClick:()=>f(`allow`),children:d0(`chatAdd`)})]}),t.tone!==void 0&&(0,K.jsx)(u0,{term:d0(`chatTone`),children:d===`tone`?(0,K.jsx)(m0,{initial:t.tone,onCommit:e=>e.trim()!==t.tone&&void p(`connectors.chatUpdate`,{tone:e}),onDone:()=>f(null)}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`min-w-0`,children:t.tone}),(0,K.jsx)(q,{disabled:a,onClick:()=>f(`tone`),children:d0(`chatEdit`)})]})})]}),s&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-inset px-3 py-2.5 [&_p]:m-0 [&_p]:text-meta [&_p]:text-muted`,children:[(0,K.jsx)(`p`,{children:d0(`chatDisconnectBody`,{name:d0(`${i.copy}Name`),command:i.command})}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,K.jsx)(q,{onClick:()=>c(!1),children:U(`dialog.cancel`)}),(0,K.jsx)(q,{variant:`danger`,disabled:a,onClick:()=>void p(`connectors.chatDisconnect`).then(()=>c(!1)),children:d0(`disconnect`)})]})]})]})}function g0({model:e}){let{client:t}=e,[n,r]=(0,J.useState)(()=>Hs(t,`connectors.chat`)?.connectors),i=()=>Ws(t,`connectors.chat`).then(e=>r(e.connectors),()=>r(e=>e??[]));(0,J.useEffect)(()=>{i()},[t]);let a=(n??[]).filter(e=>f0[e.id]);return a.length===0?null:(0,K.jsxs)(`section`,{className:`flex flex-col pt-4`,children:[(0,K.jsx)(`h2`,{className:IJ,children:d0(`chat`)}),(0,K.jsx)(`p`,{className:LJ,children:d0(`chatHint`)}),(0,K.jsx)(`div`,{className:KY,children:a.map(t=>(0,K.jsx)(h0,{model:e,row:t,reload:i},t.id))})]})}G(),H();var _0=(e,t)=>U(`settings.connectors.${e}`,t),v0=[`1/m`,`10/m`,`1/s`,`2/s`,`5/s`],y0=[``,`7d`,`30d`,`90d`],b0=e=>e>=1?`${e}/s`:e*60>=1?`${+(e*60).toFixed(2)}/m`:`${+(e*3600).toFixed(2)}/h`,x0=e=>new Date(e).toLocaleString();function S0(e){navigator.clipboard.writeText(e).then(()=>z(_0(`inboxCopied`)),()=>{})}var C0=e=>()=>B.set((0,K.jsx)(V3,{model:e,section:`connectors`}));function w0({label:e,value:t}){return(0,K.jsxs)(`div`,{className:Li,children:[(0,K.jsx)(`span`,{className:Ri,children:e}),(0,K.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,K.jsx)(`code`,{className:`min-w-0 flex-1 select-all break-all rounded-sm bg-inset px-2 py-1 text-meta`,children:t}),(0,K.jsx)(q,{onClick:()=>S0(t),children:_0(`inboxCopy`)})]})]})}function T0({model:e}){let{client:t}=e,n=C0(e),[r,i]=(0,J.useState)(()=>Hs(t,`routine.list`)?.automations.filter(e=>!e.script)??null),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(`2/s`),[p,m]=(0,J.useState)(`5`),[h,g]=(0,J.useState)(``),[_,v]=(0,J.useState)(!1),[y,b]=(0,J.useState)(null),[x,S]=(0,J.useState)(null);(0,J.useEffect)(()=>{Ws(t,`routine.list`).then(e=>i(e.automations.filter(e=>!e.script)),()=>i(e=>e??[]))},[t]);let C=async()=>{v(!0),b(null);try{S(await t.request(`inbox.tokenAdd`,{name:a.trim(),...s.trim()?{id:s.trim()}:{},...l===`agent`?{agent:!0}:l?{to:`routine:${l}`}:{},rate:d,burst:Number(p),...h?{expires:h}:{}}))}catch(e){b(Ra(e))}finally{v(!1)}};return x?(0,K.jsx)(za,{title:_0(`inboxCreatedTitle`,{name:x.name}),wide:!0,onClose:n,children:(0,K.jsxs)(`div`,{className:Yi,children:[(0,K.jsx)(`p`,{className:`m-0 text-warning`,children:_0(`inboxCreated`)}),(0,K.jsx)(w0,{label:_0(`inboxAddress`),value:x.url}),(0,K.jsx)(w0,{label:_0(`inboxKey`),value:x.recipient}),(0,K.jsx)(w0,{label:_0(`inboxToken`),value:x.token}),(0,K.jsx)(w0,{label:_0(`inboxCommand`),value:x.command}),(0,K.jsx)(`p`,{className:`${KJ} m-0`,children:_0(`inboxCopyPromptNote`)}),(0,K.jsxs)(`div`,{className:Mi,children:[(0,K.jsx)(q,{variant:`action`,onClick:()=>S0(x.prompt),children:_0(`inboxCopyPrompt`)}),(0,K.jsx)(q,{variant:`filled`,onClick:n,children:_0(`inboxDone`)})]})]})}):(0,K.jsx)(za,{title:_0(`inboxDialogTitle`),onClose:n,children:(0,K.jsxs)(`form`,{className:Yi,onSubmit:e=>{e.preventDefault(),a.trim()&&C()},children:[(0,K.jsxs)(`label`,{className:Li,children:[(0,K.jsx)(`span`,{className:Ri,children:_0(`inboxName`)}),(0,K.jsx)(`input`,{className:$J,autoFocus:!0,spellCheck:!1,placeholder:`Grok Bot`,value:a,onChange:e=>o(e.target.value)})]}),(0,K.jsxs)(`label`,{className:Li,children:[(0,K.jsx)(`span`,{className:Ri,children:_0(`inboxId`)}),(0,K.jsx)(`input`,{className:`${$J} font-mono`,spellCheck:!1,autoCapitalize:`off`,placeholder:_0(`inboxIdAuto`),value:s,onChange:e=>c(e.target.value)})]}),(0,K.jsxs)(`div`,{className:Li,children:[(0,K.jsx)(`span`,{className:Ri,children:_0(`inboxPickRoutine`)}),(0,K.jsx)(iJ,{label:_0(`inboxPickRoutine`),value:l,picks:[{value:``,label:_0(`inboxDeliverOnly`)},{value:`agent`,label:_0(`inboxStartsAgent`)},...(r??[]).map(e=>({value:e.id,label:_0(`inboxStartsRoutine`,{name:e.name})}))],onPick:u})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,K.jsxs)(`div`,{className:Li,children:[(0,K.jsx)(`span`,{className:Ri,children:_0(`inboxRate`)}),(0,K.jsx)(iJ,{label:_0(`inboxRate`),value:d,picks:v0.map(e=>({value:e,label:e})),onPick:f})]}),(0,K.jsxs)(`label`,{className:Li,children:[(0,K.jsx)(`span`,{className:Ri,children:_0(`inboxBurst`)}),(0,K.jsx)(`input`,{className:`${$J} w-20`,inputMode:`numeric`,value:p,onChange:e=>m(e.target.value.replace(/\D/g,``))})]}),(0,K.jsxs)(`div`,{className:Li,children:[(0,K.jsx)(`span`,{className:Ri,children:_0(`inboxExpiry`)}),(0,K.jsx)(iJ,{label:_0(`inboxExpiry`),value:h,picks:y0.map(e=>({value:e,label:e?_0(`inboxExpiryDays`,{days:Number.parseInt(e,10)}):_0(`inboxExpiryNever`)})),onPick:g})]})]}),y&&(0,K.jsx)(`p`,{className:`m-0 text-error`,children:y}),(0,K.jsxs)(`div`,{className:Mi,children:[(0,K.jsx)(q,{onClick:n,children:U(`dialog.cancel`)}),(0,K.jsx)(q,{type:`submit`,variant:`filled`,disabled:_||!a.trim(),children:_0(`inboxCreate`)})]})]})})}function E0({row:e,onRevoke:t}){let[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(!1),o=[_0(`inboxRateValue`,{rate:b0(e.rate),burst:e.burst}),e.daily?_0(`inboxDaily`,{daily:e.daily}):``,e.expiresAt?_0(`inboxExpires`,{date:x0(e.expiresAt)}):``].filter(Boolean);return(0,K.jsxs)(`div`,{className:qY(!0),children:[(0,K.jsxs)(`div`,{className:YY,children:[(0,K.jsx)(`span`,{className:XY,children:(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,K.jsx)(`span`,{className:GJ,children:e.name}),e.id!==e.name&&(0,K.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent font-mono`,children:e.id})]}),(0,K.jsx)(`span`,{className:KJ,children:e.routineId?e.routineName??_0(`inboxMissingRoutine`):_0(e.agent?`inboxStartsAgent`:`inboxKeeps`)})]})}),(0,K.jsx)(q,{variant:`action`,disabled:i,onClick:()=>r(!0),children:_0(`inboxRevoke`)})]}),(0,K.jsxs)(`dl`,{className:EY,children:[(0,K.jsx)(u0,{term:_0(`inboxRate`),children:o.join(` · `)}),(0,K.jsx)(u0,{term:_0(`inboxLastUsed`),children:e.lastUsedAt?x0(e.lastUsedAt):_0(`inboxNever`)}),(0,K.jsx)(u0,{term:_0(`inboxDay`),children:_0(`inboxDayValue`,e.last24h)}),e.recent.length>0&&(0,K.jsx)(u0,{term:_0(`inboxRecent`),children:(0,K.jsx)(`ul`,{className:`m-0 flex w-full list-none flex-col gap-0.5 p-0`,children:e.recent.slice(0,8).map(e=>(0,K.jsxs)(`li`,{className:`flex min-w-0 gap-2`,children:[(0,K.jsx)(`span`,{className:`text-subtle tabular-nums`,children:x0(e.at)}),(0,K.jsx)(`span`,{className:e.accepted?`text-diff-added`:`text-diff-removed`,children:e.accepted?_0(`inboxAccepted`):_0(`inboxRefused`,{reason:e.reason})})]},e.at))})})]}),n&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-inset px-3 py-2.5 [&_p]:m-0 [&_p]:text-meta [&_p]:text-muted`,children:[(0,K.jsx)(`p`,{children:_0(`inboxRevokeBody`,{name:e.name})}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,K.jsx)(q,{onClick:()=>r(!1),children:U(`dialog.cancel`)}),(0,K.jsx)(q,{variant:`danger`,disabled:i,onClick:()=>{a(!0),t().finally(()=>a(!1))},children:_0(`inboxRevoke`)})]})]})]})}function D0({model:e}){let{client:t}=e,[n,r]=(0,J.useState)(()=>Hs(t,`inbox.status`)??null),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1),c=()=>Ws(t,`inbox.status`).then(r,e=>z(_0(`inboxFailed`,{error:Ra(e)}),`error`));(0,J.useEffect)(()=>{c()},[t]);let l=async(e,n={})=>{s(!0);try{await t.request(e,n)}catch(e){z(Ra(e),`error`)}finally{s(!1),await c()}},u=n?.address;return(0,K.jsxs)(`section`,{className:`flex flex-col pt-4`,children:[(0,K.jsx)(`h2`,{className:IJ,children:_0(`inbox`)}),(0,K.jsx)(`p`,{className:LJ,children:_0(`inboxHint`)}),(0,K.jsxs)(`div`,{className:KY,children:[(0,K.jsxs)(`div`,{className:qY(!0),children:[(0,K.jsxs)(`div`,{className:YY,children:[(0,K.jsx)(`span`,{className:XY,children:(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,K.jsx)(`span`,{className:GJ,children:_0(`inboxTitle`)}),(0,K.jsx)(`span`,{className:KJ,children:_0(`inboxNote`)})]})}),(0,K.jsx)(q,{variant:`filled`,onClick:()=>B.set((0,K.jsx)(T0,{model:e})),children:_0(`inboxNew`)})]}),u?(0,K.jsxs)(`dl`,{className:EY,children:[(0,K.jsx)(u0,{term:_0(`inboxAddress`),children:(0,K.jsx)(`code`,{className:`min-w-0 select-all break-all`,children:u.url})}),(0,K.jsxs)(u0,{term:_0(`inboxKey`),children:[(0,K.jsx)(`code`,{className:`min-w-0 select-all break-all`,children:u.recipient}),(0,K.jsx)(q,{disabled:o,onClick:()=>a(!0),children:_0(`inboxRotate`)})]})]}):n&&(0,K.jsx)(`p`,{className:`text-meta text-muted [&_a]:text-accent m-0`,children:_0(`inboxNone`)}),i&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-inset px-3 py-2.5 [&_p]:m-0 [&_p]:text-meta [&_p]:text-muted`,children:[(0,K.jsx)(`p`,{children:_0(`inboxRotateBody`)}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,K.jsx)(q,{onClick:()=>a(!1),children:U(`dialog.cancel`)}),(0,K.jsx)(q,{variant:`danger`,disabled:o,onClick:()=>void l(`inbox.rotate`).then(()=>{a(!1),z(_0(`inboxRotated`))}),children:_0(`inboxRotate`)})]})]})]}),n?.tokens.map(e=>(0,K.jsx)(E0,{row:e,onRevoke:()=>l(`inbox.tokenRevoke`,{id:e.id})},e.id))]})]})}function O0(e){let t=e?/\bRoveApp\/(\S+) \(([\w,]+); ([0-9a-f]{8,})(?:; ([\d.]+))?\)/.exec(e):null;return t?{build:t[1],model:t[2],deviceId:t[3],...t[4]?{os:t[4]}:{}}:null}var k0=(e=>(e[e.Border=-1]=`Border`,e[e.Data=0]=`Data`,e[e.Function=1]=`Function`,e[e.Position=2]=`Position`,e[e.Timing=3]=`Timing`,e[e.Alignment=4]=`Alignment`,e))(k0||{}),A0=[0,1],j0=[1,0],M0=[2,3],N0=[3,2],P0={L:A0,M:j0,Q:M0,H:N0},F0=/^\d*$/,I0=/^[A-Z0-9 $%*+./:-]*$/,L0=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,R0=1,z0=40,B0=3,V0=3,H0=40,U0=10,W0=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],G0=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],K0=class{constructor(e,t,n,r){if(this.version=e,this.ecc=t,e<R0||e>z0)throw RangeError(`Version value out of range`);if(r<-1||r>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let i=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(i.slice()),this.types.push(i.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(n);if(this.drawCodewords(a),r===-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(r=t,e=n),this.applyMask(t)}}this.mask=r,this.applyMask(r),this.drawFormatBits(r)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,k0.Timing),this.setFunctionModule(e,6,e%2==0,k0.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n===0&&r===0||n===0&&r===t-1||n===t-1&&r===0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,J0(r,e));this.setFunctionModule(8,7,J0(r,6)),this.setFunctionModule(8,8,J0(r,7)),this.setFunctionModule(7,8,J0(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,J0(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,J0(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,J0(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=J0(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;a>=0&&a<this.size&&o>=0&&o<this.size&&this.setFunctionModule(a,o,i!==2&&i!==4,k0.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!==1,k0.Alignment)}setFunctionModule(e,t,n,r=k0.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==l2(t,n))throw RangeError(`Invalid argument`);let r=G0[n[0]][t],i=W0[n[0]][t],a=Math.floor(c2(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=u2(i);for(let t=0,n=0;t<r;t++){let r=e.slice(n,n+s-i+(t<o?0:1));n+=r.length;let a=d2(r,l);t<o&&r.push(0),c.push(r.concat(a))}let u=[];for(let e=0;e<c[0].length;e++)c.forEach((t,n)=>{(e!==s-i||n>=o)&&u.push(t[e])});return u}drawCodewords(e){if(e.length!==Math.floor(c2(this.version)/8))throw RangeError(`Invalid argument`);let t=0;for(let n=this.size-1;n>=1;n-=2){n===6&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=n-i,o=n+1&2?r:this.size-1-r;!this.types[o][a]&&t<e.length*8&&(this.modules[o][a]=J0(e[t>>>3],7-(t&7)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.types[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[t][a]===n?(r++,r===5?e+=B0:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*H0),n=this.modules[t][a],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*H0}for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[a][t]===n?(r++,r===5?e+=B0:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*H0),n=this.modules[a][t],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*H0}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let r=this.modules[t][n];r===this.modules[t][n+1]&&r===this.modules[t+1][n]&&r===this.modules[t+1][n+1]&&(e+=V0)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size,r=Math.ceil(Math.abs(t*20-n*10)/n)-1;return e+=r*U0,e}getAlignmentPatternPositions(){if(this.version===1)return[];{let e=Math.floor(this.version/7)+2,t=this.version===32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===t*3&&e[4]===t&&e[5]===t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]===0&&(e+=this.size),t.pop(),t.unshift(e)}};function q0(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function J0(e,t){return!!(e>>>t&1)}var Y0=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}},X0=[1,10,12,14],Z0=[2,9,11,13],Q0=[4,8,16,16];function $0(e,t){return e[Math.floor((t+7)/17)+1]}function e2(e){let t=[];for(let n of e)q0(n,8,t);return new Y0(Q0,e.length,t)}function t2(e){if(!i2(e))throw RangeError(`String contains non-numeric characters`);let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length-n,3);q0(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new Y0(X0,e.length,t)}function n2(e){if(!a2(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n;for(n=0;n+2<=e.length;n+=2){let r=L0.indexOf(e.charAt(n))*45;r+=L0.indexOf(e.charAt(n+1)),q0(r,11,t)}return n<e.length&&q0(L0.indexOf(e.charAt(n)),6,t),new Y0(Z0,e.length,t)}function r2(e){return e===``?[]:i2(e)?[t2(e)]:a2(e)?[n2(e)]:[e2(s2(e))]}function i2(e){return F0.test(e)}function a2(e){return I0.test(e)}function o2(e,t){let n=0;for(let r of e){let e=$0(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function s2(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)===`%`?(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}function c2(e){if(e<R0||e>z0)throw RangeError(`Version number out of range`);let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function l2(e,t){return Math.floor(c2(e)/8)-W0[t[0]][e]*G0[t[0]][e]}function u2(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let e=0;e<t.length;e++)t[e]=f2(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=f2(n,2)}return t}function d2(e,t){let n=t.map(e=>0);for(let r of e){let e=r^n.shift();n.push(0),t.forEach((t,r)=>n[r]^=f2(t,e))}return n}function f2(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function p2(e,t,n=1,r=40,i=-1,a=!0){if(!(R0<=n&&n<=r&&r<=z0)||i<-1||i>7)throw RangeError(`Invalid value`);let o,s;for(o=n;;o++){let n=l2(o,t)*8,i=o2(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[j0,M0,N0])a&&s<=l2(o,e)*8&&(t=e);let c=[];for(let t of e){q0(t.mode[0],4,c),q0(t.numChars,$0(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=l2(o,t)*8;q0(0,Math.min(4,l-c.length),c),q0(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)q0(e,8,c);let u=Array.from({length:Math.ceil(c.length/8)},()=>0);return c.forEach((e,t)=>u[t>>>3]|=e<<7-(t&7)),new K0(o,t,u,i)}function m2(e,t){let{ecc:n=`L`,boostEcc:r=!1,minVersion:i=1,maxVersion:a=40,maskPattern:o=-1,border:s=1}=t||{},c=typeof e==`string`?r2(e):Array.isArray(e)?[e2(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=p2(c,P0[n],i,a,o,r),u=h2({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function h2(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=k0.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(i),e.push(i)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:r},e=>i)),e.types.push(Array.from({length:r},e=>i));return e}function g2(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function _2(e,t={}){let n=m2(e,t),{pixelSize:r=10,whiteColor:i=`white`,blackColor:a=`black`}=t,o=n.size*r,s=n.size*r,c=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${s} ${o}">`,l=[];for(let e=0;e<n.size;e++)for(let t=0;t<n.size;t++){let i=t*r,a=e*r;n.data[e][t]&&l.push(`M${i},${a}h${r}v${r}h-${r}z`)}return c+=`<rect fill="${g2(i)}" width="${s}" height="${o}"/>`,c+=`<path fill="${g2(a)}" d="${l.join(``)}"/>`,c+=`</svg>`,c}G(),H();var v2=(e,t)=>U(`settings.connectors.${e}`,t),y2=5e3,b2={"iPhone14,4":`iPhone 13 mini`,"iPhone14,5":`iPhone 13`,"iPhone14,2":`iPhone 13 Pro`,"iPhone14,3":`iPhone 13 Pro Max`,"iPhone14,6":`iPhone SE`,"iPhone14,7":`iPhone 14`,"iPhone14,8":`iPhone 14 Plus`,"iPhone15,2":`iPhone 14 Pro`,"iPhone15,3":`iPhone 14 Pro Max`,"iPhone15,4":`iPhone 15`,"iPhone15,5":`iPhone 15 Plus`,"iPhone16,1":`iPhone 15 Pro`,"iPhone16,2":`iPhone 15 Pro Max`,"iPhone17,3":`iPhone 16`,"iPhone17,4":`iPhone 16 Plus`,"iPhone17,1":`iPhone 16 Pro`,"iPhone17,2":`iPhone 16 Pro Max`,"iPhone17,5":`iPhone 16e`,"iPhone18,3":`iPhone 17`,"iPhone18,1":`iPhone 17 Pro`,"iPhone18,2":`iPhone 17 Pro Max`,"iPhone18,4":`iPhone Air`};function x2(e){if(!e)return null;let t=O0(e),n=/\b(iPhone|iPad)\b.*? OS (\d+)_(\d+)/.exec(e);if(n){let e=t?b2[t.model]??t.model:n[1],r=`${n[1]===`iPad`?`iPadOS`:`iOS`} ${t?.os??`${n[2]}.${n[3]}`}`;return t?`${e} · ${r} · Rove app`:`${e} · ${r}`}let r=/Android (\d+(?:\.\d+)?)/.exec(e);return r?`Android ${r[1]}`:null}function S2(e){let[t,n]=(0,J.useState)([]),r=(0,J.useCallback)(async()=>{try{n((await e.client.request(`phone.list`)).phones)}catch{}},[e]);return(0,J.useEffect)(()=>{let t=window.setInterval(()=>void r(),y2),n=e.client.onOpen(()=>void r());return r(),()=>{window.clearInterval(t),n()}},[e,r]),{phones:t,load:r}}function C2({phone:e,model:t,onForgot:n}){let r=W()===`zh`?`zh-CN`:`en-US`,[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1),c=e=>new Date(e).toLocaleDateString(r,{month:`short`,day:`numeric`}),l=e.connected?v2(`phoneConnected`):v2(`phoneLastSeen`,{time:(e=>new Date(e).toLocaleString(r,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}))(e.lastSeenAt)}),u=async()=>{s(!0);try{await t.client.request(`phone.forget`,{device:e.device}),n()}catch(e){z(v2(`phoneForgetFailed`,{error:Ra(e)}),`error`)}finally{s(!1),a(!1)}};return(0,K.jsxs)(`li`,{className:`flex flex-col gap-2 py-2.5`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,K.jsx)(`span`,{className:GJ,children:x2(e.userAgent)??v2(`phoneUnknown`)}),(0,K.jsxs)(`span`,{className:`${KJ} truncate`,children:[(0,K.jsx)(`span`,{className:e.connected?`text-success`:void 0,children:l}),` · `,v2(`phonePairedOn`,{date:c(e.pairedAt)}),` · `,(0,K.jsx)(`span`,{className:`font-mono`,children:O0(e.userAgent)?.deviceId??e.device})]})]}),!i&&(0,K.jsx)(q,{variant:`action`,onClick:()=>a(!0),children:v2(`phoneForget`)})]}),i&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-inset px-3 py-2.5 [&_p]:m-0 [&_p]:text-meta [&_p]:text-muted`,children:[(0,K.jsx)(`p`,{children:v2(`phoneForgetBody`)}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,K.jsx)(q,{onClick:()=>a(!1),children:U(`dialog.cancel`)}),(0,K.jsx)(q,{variant:`danger`,disabled:o,onClick:()=>void u(),children:v2(`phoneForget`)})]})]})]})}function w2({model:e}){let{phones:t,load:n}=S2(e),[r,i]=(0,J.useState)(!1),a=(0,J.useRef)(null),[o,s]=(0,J.useState)(null),c=async()=>{s(null),i(!0);try{s(await e.client.request(`phone.pair`)),n()}catch(e){i(!1),z(v2(`phoneFailed`,{error:Ra(e)}),`error`)}};return(0,K.jsxs)(`section`,{className:`flex flex-col pt-4`,children:[(0,K.jsx)(`h2`,{className:IJ,children:v2(`phone`)}),(0,K.jsx)(`p`,{className:LJ,children:v2(`phoneHint`)}),(0,K.jsx)(`div`,{className:KY,children:(0,K.jsxs)(`div`,{className:qY(!0),ref:a,children:[(0,K.jsxs)(`div`,{className:YY,children:[(0,K.jsx)(`span`,{className:XY,children:(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,K.jsx)(`span`,{className:GJ,children:v2(`phoneTitle`)}),(0,K.jsx)(`span`,{className:KJ,children:v2(`phoneNote`)})]})}),r?(0,K.jsx)(q,{onClick:()=>i(!1),children:v2(`phoneHide`)}):(0,K.jsx)(q,{variant:`filled`,onClick:()=>void c(),children:v2(`phoneShow`)})]}),(0,K.jsx)(`div`,{className:ZY(r),inert:!r,onTransitionEnd:e=>{e.target===e.currentTarget&&(r?a.current?.scrollIntoView({block:`nearest`,behavior:`smooth`}):s(null))},children:(0,K.jsx)(`div`,{className:`min-h-0 overflow-hidden`,children:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4 pt-1`,children:[o?(0,K.jsx)(`img`,{className:`size-48 flex-none rounded-sm bg-white p-2 motion-safe:animate-qr-in`,alt:v2(`phoneQrAlt`),src:`data:image/svg+xml;utf8,${encodeURIComponent(_2(o.link,{blackColor:`#000`,whiteColor:`#fff`}))}`}):(0,K.jsxs)(`output`,{className:`flex size-48 flex-none flex-col items-center justify-center gap-2 rounded-sm border-hairline border-dashed border-line text-meta text-muted`,children:[(0,K.jsx)(XI,{}),v2(`phoneMaking`)]}),o&&(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2 text-meta text-muted motion-safe:animate-rise-in`,children:[(0,K.jsx)(`p`,{children:v2(`phoneSecret`)}),(0,K.jsx)(`p`,{children:v2(`phoneDevice`,{device:o.device})}),(0,K.jsx)(`div`,{children:(0,K.jsx)(q,{onClick:()=>navigator.clipboard.writeText(o.link).then(()=>z(v2(`phoneCopied`)),()=>{}),children:v2(`phoneCopy`)})})]})]})})}),t.length>0&&(0,K.jsx)(`ul`,{className:`m-0 flex list-none flex-col border-t-hairline border-t-line p-0 [&>li+li]:border-t-hairline [&>li+li]:border-t-line`,children:t.map(t=>(0,K.jsx)(C2,{phone:t,model:e,onForgot:()=>void n()},t.device))})]})})]})}G(),H();var yne={same:`markSame`,different:`markDifferent`,signedOut:`markSignedOut`,noGh:`markNoGh`,outdated:`markOutdated`,offline:`markOffline`,denied:`markDenied`,failed:`markFailed`},T2=(e,t)=>U(`settings.connectors.${e}`,t),E2={same:`text-diff-added`,signedOut:`text-diff-removed`,failed:`text-diff-removed`,denied:`text-diff-removed`,different:`text-warning`,outdated:`text-warning`,offline:`text-muted`,noGh:`text-muted`,loading:`text-muted`};function D2(e,t){return e===`loading`?T2(`loading`):T2(yne[e],{login:t?.account??``})}function O2(e){if(!e?.gh)return``;let t=e.ssh.ok?`✓ ${e.ssh.user??``}`.trim():`✗`;return T2(`detail`,{protocol:e.protocol??`—`,ssh:t})}function k2(){return(0,K.jsx)(`svg`,{className:`size-7 flex-none`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{fill:`currentColor`,d:`M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z`})})}function A2(e){navigator.clipboard.writeText(e).then(()=>z(T2(`codeCopied`)),()=>{})}function j2({login:e,onCancel:t}){return e.state===`failed`?(0,K.jsxs)(`div`,{className:rY,children:[(0,K.jsx)(`span`,{className:`text-muted`,children:T2(`loginFailed`,{error:e.error??``})}),(0,K.jsx)(q,{className:`ml-auto`,onClick:t,children:T2(`dismiss`)})]}):e.state===`syncing`?(0,K.jsx)(`div`,{className:rY,children:(0,K.jsx)(`span`,{className:`text-muted`,children:T2(`syncing`)})}):(0,K.jsxs)(`div`,{className:rY,children:[e.code?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,className:`font-mono font-normal normal-nums rounded-sm border-hairline border-dashed border-line px-2 py-0.5 text-display tracking-code`,title:T2(`codeHint`),onClick:()=>A2(e.code??``),children:e.code}),(0,K.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:T2(`openGithub`)})]}):(0,K.jsx)(`span`,{className:`text-muted`,children:T2(`loading`)}),(0,K.jsx)(q,{className:`ml-auto`,onClick:t,children:U(`dialog.cancel`)})]})}function M2(e){let t=a0(e.probe,e.machine,e.rove),n=e.probe?.status??null,r=c0(n),i=t===`different`||t===`signedOut`,a=n?.login,o=O2(n),s=i&&!r;return(0,K.jsxs)(`div`,{className:qY(),children:[(0,K.jsxs)(`div`,{className:JY,children:[(0,K.jsx)(`span`,{className:`${GJ} min-w-0 flex-1 truncate`,children:e.name}),(0,K.jsx)(`span`,{className:`whitespace-nowrap text-meta ${E2[t]}`,title:e.probe?.message,children:D2(t,n)})]}),o&&(0,K.jsx)(`span`,{className:MY(),title:[n?.authDetail,n?.ssh.detail].filter(Boolean).join(`, `)||void 0,children:o}),s&&(e.onSync||e.onLogin)&&(0,K.jsxs)(`div`,{className:`mt-auto flex flex-wrap gap-2`,children:[e.onSync&&e.rove&&(0,K.jsx)(q,{variant:`action`,disabled:e.busy,onClick:e.onSync,children:T2(`useRove`)}),e.onLogin&&(0,K.jsx)(q,{variant:`action`,disabled:e.busy,onClick:e.onLogin,children:T2(`loginThere`)})]}),a&&(0,K.jsx)(j2,{login:a,onCancel:e.onCancel})]})}function N2({model:e}){let{machines:t,probes:n,refreshing:r,refresh:i,probe:a,act:o}=l0(e),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1),d=n[``],f=d?.status?.account??null,p=c0(d?.status),m=async(e,t)=>{c(e);try{await t()}finally{c(null)}},h=e=>m(e,async()=>{await o(`github.login`,e===``?{}:{machine:e}),await a(e)}),g=e=>m(e,async()=>{await o(`github.login`,e===``?{cancel:!0}:{machine:e,cancel:!0}),await a(e)}),_=e=>m(e,async()=>{(await o(`github.sync`,{machine:e}))?.ok&&z(T2(`synced`,{machine:e,login:f??``})),await a(e)}),v=()=>m(``,async()=>{(await o(`github.logout`,{}))?.ok&&u(!1),await i()});return(0,K.jsxs)(`div`,{className:KY,children:[(0,K.jsxs)(`div`,{className:qY(!0),children:[(0,K.jsxs)(`div`,{className:YY,children:[(0,K.jsxs)(`span`,{className:XY,children:[(0,K.jsx)(k2,{}),(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,K.jsx)(`span`,{className:GJ,children:`GitHub`}),(0,K.jsx)(`span`,{className:KJ,children:T2(`githubDescription`)})]})]}),f?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:qJ,children:[`@`,f]}),(0,K.jsx)(q,{variant:`action`,disabled:s!==null,onClick:()=>u(!0),children:T2(`disconnect`)})]}):d?.status?!p&&(0,K.jsx)(q,{variant:`filled`,disabled:s!==null,onClick:()=>void h(``),children:T2(`connect`)}):(0,K.jsx)(`span`,{className:`text-meta text-muted`,title:d?.message,children:d?D2(a0(d,null,null),null):T2(`loading`)})]}),l&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-inset px-3 py-2.5 [&_p]:m-0 [&_p]:text-meta [&_p]:text-muted`,children:[(0,K.jsx)(`p`,{children:T2(`disconnectBody`)}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,K.jsx)(q,{onClick:()=>u(!1),children:U(`dialog.cancel`)}),(0,K.jsx)(q,{variant:`danger`,disabled:s!==null,onClick:()=>void v(),children:T2(`disconnect`)})]})]}),!f&&d?.status?.login&&(0,K.jsx)(j2,{login:d.status.login,onCancel:()=>void g(``)})]}),(f||!d?.status)&&(0,K.jsxs)(`section`,{className:`col-span-2 flex flex-col pt-4 w-narrow:col-span-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pb-1.5 [&>h2]:pb-0`,children:[(0,K.jsx)(`h2`,{className:`m-0 pb-1.5 font-sans text-meta font-medium normal-nums text-muted w-narrow:px-3 w-narrow:font-normal w-narrow:text-subtle`,children:T2(`machines`)}),r?(0,K.jsx)(`span`,{className:`text-meta text-muted`,children:T2(`refreshing`)}):(0,K.jsx)(q,{onClick:()=>void i(),children:T2(`refresh`)})]}),(0,K.jsx)(`p`,{className:`m-0 pb-2 text-meta text-subtle w-narrow:order-last w-narrow:px-3 w-narrow:pt-1.5 w-narrow:pb-0`,children:T2(`machinesHint`)}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2.5 w-narrow:grid-cols-1`,children:[(0,K.jsx)(M2,{name:T2(`thisMachine`),probe:d,machine:null,rove:f,busy:s!==null,onCancel:()=>void g(``)}),t.map(e=>(0,K.jsx)(M2,{name:e.alias,probe:n[e.alias],machine:e.state,rove:f,busy:s!==null,onSync:()=>void _(e.alias),onLogin:()=>void h(e.alias),onCancel:()=>void g(e.alias)},e.alias))]})]})]})}function P2({model:e}){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{"data-setting-id":`connectors.github`,className:yJ,children:(0,K.jsx)(N2,{model:e})}),(0,K.jsx)(`div`,{"data-setting-id":`connectors.chat`,className:yJ,children:(0,K.jsx)(g0,{model:e})}),(0,K.jsx)(`div`,{"data-setting-id":`connectors.phone`,className:yJ,children:(0,K.jsx)(w2,{model:e})}),(0,K.jsx)(`div`,{"data-setting-id":`connectors.inbox`,className:yJ,children:(0,K.jsx)(D0,{model:e})})]})}G(),xb(),H();var F2=[{key:`remoteProjects`,label:`dev.remote`,hint:`dev.remoteHint`},{key:`autoStatus`,label:`dev.autoStatus`,hint:`dev.autoStatusHint`},{key:`dispatcher`,label:`dev.dispatcher`,hint:`dev.dispatcherHint`}];function I2({client:e}){let{prefs:t}=hb(),[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(!1),o=async()=>{if(n){a(!0);try{if(n===`reset`){await e.request(`dev.reset`),localStorage.removeItem(`rove.prefs`),window.location.reload();return}await e.request(`daemon.restart`),z($(`restart.done`)),r(null)}catch(e){z(Ra(e),`error`)}finally{a(!1)}}},s=(e,t,a,s,c)=>(0,K.jsxs)(`div`,{children:[(0,K.jsx)(nX,{settingId:`dev.${e}`,label:t,hint:a,children:(0,K.jsx)(q,{variant:`action`,onClick:()=>r(e),children:s})}),n===e&&(0,K.jsx)(`div`,{className:`pb-3`,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-inset px-3 py-2.5 [&_p]:m-0 [&_p]:text-meta [&_p]:text-muted`,children:[(0,K.jsx)(`strong`,{children:$(`${e}.title`)}),(0,K.jsx)(`p`,{children:U(e===`reset`?`prefs.resetBody`:`prefs.restartBody`)}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,K.jsx)(q,{onClick:()=>r(null),children:U(`dialog.cancel`)}),(0,K.jsx)(q,{variant:c?`danger`:`filled`,disabled:i,onClick:()=>void o(),children:s})]})]})})]});return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(tX,{title:$(`dev.experimental`),children:F2.map(n=>(0,K.jsx)(rX,{settingId:`dev.${n.key}`,label:$(n.label),hint:$(n.hint),checked:t[n.key],onChange:t=>void pb(e,n.key,t)},n.key))}),(0,K.jsxs)(tX,{hint:$(`dev.doctorHint`),children:[s(`restart`,$(`dev.restart`),U(`prefs.restartHint`),U(`prefs.restartButton`),!1),s(`reset`,$(`dev.reset`),U(`prefs.resetHint`),U(`prefs.resetButton`),!0)]})]})}function L2(e){return e.binaryFound===void 0?{key:`settings.engines.status.checking`,tone:`unknown`}:e.binaryFound===null?{key:`settings.engines.status.unknown`,tone:`unknown`}:e.binaryFound?e.configIssue?{key:`settings.engines.status.integrationBlocked`,tone:`error`}:e.login===`no`?{key:`settings.engines.status.signIn`,tone:`attention`}:e.hooks===`outdated`?{key:`settings.engines.status.integrationOutdated`,tone:`attention`}:e.hooks===`not-installed`?{key:`settings.engines.status.integrationMissing`,tone:`attention`}:{key:`settings.engines.status.ready`,tone:`ready`}:e.commandChosen?{key:`settings.engines.status.notOnPath`,tone:`attention`}:{key:`settings.engines.status.notInstalled`,tone:`absent`}}G();function R2(e){return L2({binaryFound:e.binaryFound,login:e.login,hooks:e.hooks,configIssue:e.configIssue,commandChosen:e.custom||e.customized})}var z2={ready:`ready`,attention:`attention`,error:`error`,absent:`absent`,unknown:`absent`};function B2(e){if(e.configIssue)return $(`engines.detail.hooksBlockedHere`,{reason:e.configIssue});switch(e.hooks){case`installed`:return $(`engines.detail.hooksInstalled`);case`outdated`:return $(`engines.detail.hooksOutdated`);case`not-installed`:return e.binaryFound===!1?$(`engines.detail.hooksAwaitEngine`):$(`engines.detail.hooksMissing`);default:return $(`engines.detail.hooksUnsupported`)}}function V2({engine:e}){let t=e.binaryFound===!0?$(`engines.detail.programFound`,{binary:e.binary,path:e.binaryPath??e.binary}):e.binaryFound===!1?$(`engines.detail.programMissing`,{binary:e.binary}):$(`engines.detail.programUnknown`,{binary:e.binary}),n=e.login===`yes`?$(`engines.detail.signedIn`):e.login===`no`?$(`engines.detail.signedOut`):$(`engines.detail.signInUnknown`),r=[B2(e),$(e.markers?`engines.detail.markersYes`:`engines.detail.markersNo`),$(e.screen?`engines.detail.screenYes`:e.hooks===`installed`?`engines.detail.screenNotNeeded`:`engines.detail.screenNo`)];return(0,K.jsxs)(`dl`,{className:EY,children:[(0,K.jsx)(`dt`,{className:DY,children:$(`engines.detail.program`)}),(0,K.jsx)(`dd`,{className:OY(e.binaryFound===!1),children:t}),(0,K.jsx)(`dt`,{className:DY,children:$(`engines.detail.signIn`)}),(0,K.jsx)(`dd`,{className:OY(e.login===`no`),children:n}),(0,K.jsx)(`dt`,{className:DY,children:$(`engines.detail.reporting`)}),(0,K.jsx)(`dd`,{className:OY(!1),children:r.map(e=>(0,K.jsx)(`span`,{className:`block`,children:e},e))}),e.skill===`unsupported`?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`dt`,{className:DY,children:$(`engines.detail.skill`)}),(0,K.jsx)(`dd`,{className:OY(e.skill!==`installed`),children:$(e.skill===`installed`?`engines.detail.skillInstalledHere`:e.skill===`outdated`?`engines.detail.skillOutdated`:`engines.detail.skillMissing`)})]}),e.custom?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`dt`,{className:DY,children:$(`engines.detail.adapter`)}),(0,K.jsx)(`dd`,{className:OY(!1),children:e.protocol?$(`engines.detail.adapterDeclared`,{protocol:e.protocol}):$(`engines.detail.adapterGeneric`)})]}):null]})}function H2(e){let[t,n]=(0,J.useState)(e.name);return(0,K.jsxs)(`form`,{className:kY,onSubmit:n=>{n.preventDefault(),e.onSave(t)},children:[(0,K.jsx)(`input`,{className:`${Ai} w-full ${AY}`,autoFocus:!0,value:t,"aria-label":U(`settings.engines.rename`),placeholder:U(`settings.engines.namePlaceholder`),onChange:e=>n(e.target.value),onKeyDown:t=>{t.key===`Escape`&&(t.stopPropagation(),e.onCancel())}}),(0,K.jsx)(q,{variant:`filled`,type:`submit`,children:U(`settings.engines.save`)}),(0,K.jsx)(q,{variant:`action`,onClick:e.onCancel,children:U(`settings.engines.cancel`)})]})}G();function U2(e){let[t,n]=(0,J.useState)(null),r=e.engines.find(e=>e.id===t);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(jD,{children:e.engines.map(t=>(0,K.jsx)(W2,{engine:t,icon:e.icons.get(t.id),run:e.run,onOpen:()=>n(t.id)},t.id))}),r&&(0,K.jsx)(G2,{engine:r,run:e.run,onClose:()=>n(null)})]})}function W2(e){let{engine:t,run:n}=e,r=z2[R2(t).tone];return(0,K.jsxs)(`div`,{className:`${bY} ${yJ}`,"data-setting-id":`engines.item:${t.id}`,children:[(0,K.jsxs)(q,{variant:`row`,className:xY,"aria-haspopup":`dialog`,onClick:e.onOpen,children:[(0,K.jsx)(VF,{icon:e.icon}),(0,K.jsxs)(`span`,{className:dY,children:[(0,K.jsxs)(`span`,{className:SY,children:[t.name,t.renamedFrom?(0,K.jsx)(`span`,{className:pY,children:t.renamedFrom}):null,t.custom&&!t.renamedFrom?(0,K.jsx)(`span`,{className:pY,children:$(`engines.customTag`)}):null]}),(0,K.jsxs)(`span`,{className:hY(r),children:[(0,K.jsx)(`span`,{className:gY(r),"aria-hidden":`true`}),$(R2(t).key.slice(9)),t.isDefault&&(0,K.jsxs)(`span`,{className:`text-accent capitalize`,children:[`· `,$(`engines.defaultMark`)]})]})]})]}),t.binaryFound!==!1&&(0,K.jsx)(`span`,{className:`relative z-1 flex flex-none items-center`,children:(0,K.jsx)(eX,{on:t.enabled,"aria-label":U(`settings.engines.enabled`,{name:t.name}),onClick:()=>n(`engine.setEnabled`,{id:t.id,enabled:!t.enabled})})}),(0,K.jsx)(tI,{right:!0,className:CY})]})}function G2(e){let{engine:t,run:n}=e,[r,i]=(0,J.useState)(!1),a=!t.isDefault&&t.canBeDefault&&t.binaryFound!==!1;return(0,K.jsx)(gO,{label:t.name,title:t.name,onClose:e.onClose,children:e=>(0,K.jsxs)(`div`,{className:lO,children:[(0,K.jsx)(`div`,{className:wY,children:(0,K.jsx)(V2,{engine:t})}),r?(0,K.jsx)(`div`,{className:wY,children:(0,K.jsx)(H2,{name:t.name,onCancel:()=>i(!1),onSave:e=>{n(`engine.rename`,{id:t.id,name:e}),i(!1)}})}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`hr`,{className:pO}),a&&(0,K.jsx)(_O,{onClick:()=>{n(`engine.setDefault`,{id:t.id}),e()},children:$(`engines.makeDefault`)}),(0,K.jsx)(_O,{onClick:()=>i(!0),children:U(`settings.engines.rename`)}),(t.custom||t.customized)&&(0,K.jsx)(_O,{tone:t.custom?`danger`:`ink`,onClick:()=>{n(`engine.reset`,{id:t.id}),e()},children:t.custom?U(`settings.engines.remove`):U(`settings.engines.reset`)}),(0,K.jsx)(`hr`,{className:pO}),(0,K.jsx)(_O,{tone:`cancel`,onClick:e,children:U(`menu.cancel`)})]})]})})}A(),H();var K2=O([]),q2=3e4;function J2(e){return e.request(`skill.missing`).then(e=>K2.set(e.engines),()=>{})}function Y2(e){(0,J.useEffect)(()=>{let t=e.onOpen(()=>void J2(e)),n=Ga(q2,()=>void J2(e));return()=>{t(),n()}},[e])}function X2(e){return e.request(`skill.install`).then(e=>{e.error&&z($(`engines.skill.failed`,{reason:e.error}),`error`)}).catch(e=>z(Ra(e),`error`)).then(()=>J2(e))}G(),He(),xb(),H();function Z2({model:e}){let{client:t}=e,n=ke(),r=yz(e),{value:i,failed:a,reload:o}=uX(t,`engines.settings`),s=i?.engines,[c,l]=(0,J.useState)(null),u=(e,n={})=>void t.request(e,n).then(o).catch(e=>z(Ra(e),`error`));return s?(0,K.jsxs)(K.Fragment,{children:[n?(0,K.jsx)(U2,{engines:s,icons:r,run:u}):(0,K.jsxs)(`section`,{"data-setting-id":`engines.list`,className:yJ,children:[(0,K.jsx)(`p`,{className:LJ,children:$(`engines.hint`)}),(0,K.jsxs)(`div`,{className:aY,children:[(0,K.jsxs)(`div`,{className:oY,"aria-hidden":`true`,children:[(0,K.jsx)(`span`,{}),(0,K.jsx)(`span`,{children:$(`engines.defaultMark`)}),(0,K.jsx)(`span`,{children:$(`engines.available`)})]}),s.map(e=>(0,K.jsx)(Q2,{engine:e,open:c===e.id,onToggleOpen:()=>l(c===e.id?null:e.id),run:u},e.id))]})]}),(0,K.jsx)(e4,{engines:s,run:u}),(0,K.jsx)(t4,{engines:s,client:t,reload:o}),(0,K.jsx)(n4,{client:t})]}):(0,K.jsx)(dX,{failed:a,onRetry:o})}function Q2(e){let{engine:t,run:n}=e,r=(0,J.useId)(),i=R2(t),a=t.binaryFound===!1;return(0,K.jsxs)(`div`,{className:`${sY} ${yJ}`,"data-setting-id":`engines.item:${t.id}`,children:[(0,K.jsxs)(`div`,{className:cY,children:[(0,K.jsxs)(`button`,{type:`button`,className:lY,"aria-expanded":e.open,"aria-controls":r,onClick:e.onToggleOpen,children:[(0,K.jsx)(tI,{right:!e.open,className:uY(e.open)}),(0,K.jsxs)(`span`,{className:dY,children:[(0,K.jsxs)(`span`,{className:fY(!t.enabled),children:[t.name,t.renamedFrom?(0,K.jsx)(`span`,{className:pY,children:t.renamedFrom}):null,t.custom&&!t.renamedFrom?(0,K.jsx)(`span`,{className:pY,children:$(`engines.customTag`)}):null]}),(0,K.jsxs)(`span`,{className:hY(z2[i.tone]),children:[(0,K.jsx)(`span`,{className:gY(z2[i.tone]),"aria-hidden":`true`}),$(i.key.slice(9))]})]})]}),(0,K.jsx)(`div`,{className:_Y,children:t.isDefault?(0,K.jsx)(`span`,{className:vY,children:$(`engines.defaultMark`)}):t.canBeDefault&&!a?(0,K.jsx)(`button`,{type:`button`,className:yY,"aria-label":U(`settings.engines.default`,{name:t.name}),onClick:()=>n(`engine.setDefault`,{id:t.id}),children:$(`engines.makeDefault`)}):null}),a?(0,K.jsx)(`span`,{}):(0,K.jsx)(eX,{on:t.enabled,"aria-label":U(`settings.engines.enabled`,{name:t.name}),onClick:()=>n(`engine.setEnabled`,{id:t.id,enabled:!t.enabled})})]}),e.open?(0,K.jsx)($2,{id:r,engine:t,run:n}):null]})}function $2(e){let{engine:t,run:n}=e,[r,i]=(0,J.useState)(!1);return(0,K.jsxs)(`div`,{id:e.id,className:TY,children:[(0,K.jsx)(V2,{engine:t}),r?(0,K.jsx)(H2,{name:t.name,onCancel:()=>i(!1),onSave:e=>{n(`engine.rename`,{id:t.id,name:e}),i(!1)}}):(0,K.jsxs)(`div`,{className:kY,children:[(0,K.jsx)(q,{variant:`action`,onClick:()=>i(!0),children:U(`settings.engines.rename`)}),t.custom||t.customized?(0,K.jsx)(q,{variant:`action`,onClick:()=>n(`engine.reset`,{id:t.id}),children:t.custom?U(`settings.engines.remove`):U(`settings.engines.reset`)}):null]})]})}function e4({engines:e,run:t}){let n=e.filter(e=>e.hooks!==`unsupported`),r=n.filter(e=>e.binaryFound!==!1),i=r.filter(e=>e.hooks===`installed`).length,a=r.length-i,o=n.filter(e=>e.hooks!==`not-installed`).length;return n.length===0?null:(0,K.jsx)(tX,{settingId:`engines.integrations`,title:$(`engines.integrations.title`),hint:$(`engines.integrations.hint`),children:(0,K.jsx)(nX,{label:$(`engines.integrations.summary`,{installed:i,total:r.length}),children:(0,K.jsxs)(`div`,{className:nY,children:[a>0?(0,K.jsx)(q,{variant:`filled`,onClick:()=>t(`engines.hooks.install`),children:$(`engines.integrations.install`,{count:a})}):(0,K.jsx)(`span`,{className:jY,children:$(`engines.integrations.upToDate`)}),o>0?(0,K.jsx)(q,{variant:`action`,onClick:()=>t(`engines.hooks.uninstall`),children:$(`engines.integrations.remove`,{count:o})}):null]})})})}function t4(e){let t=e.engines.filter(e=>e.skill!==`unsupported`),n=t.filter(e=>e.skill===`installed`).length,r=t.length-n;return(0,K.jsx)(tX,{settingId:`engines.skill`,title:$(`engines.skill.title`),hint:$(`engines.skill.hint`),children:(0,K.jsx)(nX,{label:t.length>0?$(`engines.integrations.summary`,{installed:n,total:t.length}):$(`engines.skill.noEngines`),children:r>0?(0,K.jsx)(q,{variant:`filled`,onClick:()=>void X2(e.client).then(e.reload),children:$(`engines.skill.install`,{count:r})}):t.length>0?(0,K.jsx)(`span`,{className:jY,children:$(`engines.integrations.upToDate`)}):null})})}function n4({client:e}){let{prefs:t}=hb();return(0,K.jsx)(tX,{title:$(`engines.permissionsTitle`),hint:$(`engines.permissionBypassHint`),children:(0,K.jsx)(rX,{settingId:`engines.permissionBypass`,label:$(`engines.permissionBypass`),checked:t.permissionBypass,onChange:t=>void pb(e,`permissionBypass`,t)})})}G(),H();var r4={bug:`settings.feedback.kindBug`,idea:`settings.feedback.kindIdea`,question:`settings.feedback.kindQuestion`};function i4(e){let t=e.split(`
|
|
252
|
+
`).find(e=>e.trim())?.trim()??``;return t.length>120?`${t.slice(0,119).trimEnd()}…`:t}function a4({model:e}){let[t,n]=(0,J.useState)(`bug`),[r,i]=(0,J.useState)(``),a=Ii(r),[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(!1),f=!r.trim();return(0,K.jsxs)(`form`,{"data-setting-id":`feedback.form`,className:`flex flex-col gap-3 ${yJ}`,onSubmit:n=>{n.preventDefault(),s(!0),d(!1),pq(e,f?void 0:{text:r.trim(),kind:t}).catch(()=>d(!0)).finally(()=>s(!1))},children:[(0,K.jsx)(`p`,{className:`m-0 ${KJ} ${XJ}`,children:U(`settings.feedback.hint`)}),(0,K.jsx)(`textarea`,{ref:a,className:`${$J} ${zi} w-full`,"aria-label":U(`settings.feedback.prompt`),placeholder:U(`settings.feedback.prompt`),value:r,onChange:e=>i(e.target.value)}),(c||u)&&(0,K.jsxs)(`p`,{className:`m-0 text-meta text-muted [&_a]:text-accent break-words`,children:[u?U(`settings.feedback.reportFailed`):c?.filed?U(`settings.feedback.sent`,{number:c.number??0}):U(`settings.feedback.notFiled`,{hint:c?.hint??``}),` `,c&&!u&&(0,K.jsx)(`a`,{className:`underline`,href:c.url,target:`_blank`,rel:`noreferrer`,children:c.filed?c.url:U(`settings.feedback.openLink`)})]}),(0,K.jsxs)(`div`,{className:ZJ,children:[(0,K.jsx)(EW,{label:U(`settings.feedback.kindLabel`),value:t,picks:Object.keys(r4).map(e=>({value:e,label:U(r4[e])})),onPick:n}),(0,K.jsxs)(`div`,{className:Mi,children:[(0,K.jsx)(q,{variant:`action`,type:`button`,disabled:o||f,onClick:()=>{s(!0),l(null),d(!1),e.client.request(`feedback.send`,{title:i4(r),body:r.trim(),kind:t}).then(e=>{l(e),e.filed&&i(``)}).catch(e=>z(Ra(e),`error`)).finally(()=>s(!1))},children:U(`settings.feedback.fileAsIs`)}),(0,K.jsx)(q,{variant:`filled`,type:`submit`,disabled:o,children:U(`settings.feedback.draft`)})]})]}),(0,K.jsx)(`p`,{className:`m-0 ${KJ}`,children:U(`settings.feedback.note`)})]})}G(),xb();var o4=[{value:`en`,label:`English`},{value:`zh`,label:`中文`}],s4={default:`general.worktreeKindDefault`,nextToProject:`general.worktreeKindNext`,custom:`general.worktreeKindCustom`};function c4({model:e}){let{client:t}=e,n=hb(),{prefs:r,info:i}=n,a=(e,n)=>void pb(t,e,n),o=[`default`,`nextToProject`];(i.worktreeCustomPath||r.worktreeBase===`custom`)&&o.push(`custom`);let s=o.map(e=>({value:e,label:$(s4[e])}));return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(tX,{title:U(`settings.general.groupInterface`),children:[(0,K.jsx)(cX,{settingId:`general.language`,label:$(`general.language`),hint:U(`prefs.languageHint`),value:r.locale,picks:o4,onPick:e=>a(`locale`,e)}),(0,K.jsx)(rX,{settingId:`general.keyHints`,label:$(`general.keyHintsShow`),hint:U(`settings.general.tuiKeyHints`),checked:r.keyHints,onChange:e=>a(`keyHints`,e)}),(0,K.jsx)(cX,{settingId:`general.tabStrip`,label:U(`settings.general.tabStrip`),value:r.tabStrip,picks:gb(n,`tabStrip`).map(e=>({value:e,label:$(`general.tabStripMode.${e}`)})),onPick:e=>a(`tabStrip`,e)})]}),(0,K.jsx)(tX,{title:U(`settings.general.groupFiles`),children:(0,K.jsx)(cX,{settingId:`general.worktree`,label:$(`general.worktree`),hint:$(`general.worktreeHint`),value:r.worktreeBase,picks:s,onPick:e=>a(`worktreeBase`,e)})}),(0,K.jsx)(tX,{title:U(`settings.general.groupTerminal`),hint:$(`general.terminalHint`),children:(0,K.jsx)(l4,{client:t})})]})}function l4({client:e}){let t=hb(),n=t.options.scrollbackRows,r=n&&`min`in n?n:{min:100,max:1e5},[i,a]=(0,J.useState)(String(t.prefs.scrollbackRows));return(0,J.useEffect)(()=>a(String(t.prefs.scrollbackRows)),[t.prefs.scrollbackRows]),(0,K.jsx)(nX,{settingId:`general.scrollback`,label:U(`settings.general.scrollback`),hint:$(`general.scrollbackRowHint`),children:(0,K.jsx)(`input`,{className:eY,inputMode:`numeric`,value:i,"aria-label":$(`general.scrollbackTitle`),onChange:e=>a(e.target.value),onBlur:()=>{let n=Number(i);if(i.trim()===``||!Number.isInteger(n)){a(String(t.prefs.scrollbackRows));return}let o=Math.min(r.max,Math.max(r.min,n));o===t.prefs.scrollbackRows?a(String(o)):pb(e,`scrollbackRows`,o)},onKeyDown:e=>e.key===`Enter`&&e.currentTarget.blur()})})}var u4={general:`M2 4.5h7m3 0h2M2 11.5h2m3 0h7M10.5 3v3M5.5 10v3`,appearance:`M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2zM8 2v12M8 5h4.5M8 8h6M8 11h4.5`,notifications:`M4 11V7a4 4 0 0 1 8 0v4l1 1.5H3zM6.5 14h3`,snippets:`M3 4h10M3 8h6M3 12h8`,keys:`M2 4.5h12v7H2zM4.5 7h.01M7 7h.01M9.5 7h.01M12 7h.01M5 9.5h6`,engines:`M2.5 3.5h11v9h-11zM5 6.5 7 8l-2 1.5M8.5 10H11`,autoRouting:`M2 4h3l6 8h3M2 12h3l1.5-2M9.5 6 11 4h3`,voice:`M8 1.5a2.5 2.5 0 0 1 2.5 2.5v4.5a2.5 2.5 0 0 1-5 0V4A2.5 2.5 0 0 1 8 1.5zM3 8a5 5 0 0 0 10 0M8 13v1.5`,connectors:`M6.5 9.5l3-3M5 8 3.5 9.5a2.1 2.1 0 0 0 3 3L8 11M11 8l1.5-1.5a2.1 2.1 0 0 0-3-3L8 5`,plugins:`M2.5 2.5H7V7H2.5zM9 2.5h4.5V7H9zM2.5 9H7v4.5H2.5zM11.25 9v4.5M9 11.25h4.5`,about:`M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2zM8 7.5V11M8 5h.01`,feedback:`M2.5 3.5h11v7h-6L4.5 13v-2.5h-2z`,dev:`M5.5 4.5 2 8l3.5 3.5M10.5 4.5 14 8l-3.5 3.5`};function d4({id:e}){return(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,className:TJ,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:u4[e]})})}var f4=`prefix.key`;function p4(e,t,n){let r=t.find(e=>e===`enter`||e.endsWith(`+enter`))??t[0];if(r===void 0)return{kind:`more`,recording:e};if(t.includes(`escape`))return{kind:`cancel`};if(e.prefixArmed)return{kind:`done`,mode:`prefix`,keys:[r]};if(e.got.length===0&&n.some(e=>t.includes(e)))return{kind:`more`,recording:{...e,prefixArmed:!0}};let i=[...e.got,r];return i.length<e.slots?{kind:`more`,recording:{...e,got:i}}:{kind:`done`,mode:`direct`,keys:i}}function m4(){return FG(MG().filter(e=>e.keys.length>0||e.prefixKeys!==void 0)).flatMap(e=>[...e.rows])}[...Array.from({length:12},(e,t)=>`f${t+1}`)];function h4(e,t){let n=`alternating [${e}, ${t}] pairs`;return{layout:n,slots:[e,t],validateCount:e=>e>=2&&e%2==0?null:`needs ${n} (an even number of chords — got ${e})`}}var g4={"sidebar.goto":h4(`top (double-tap)`,`bottom`),"sidebar.nav":h4(`down`,`up`),"files.nav":h4(`down`,`up`),"diff.review.cursor":h4(`down`,`up`),"sidebar.search.nav":h4(`down`,`up`),"files.search.nav":h4(`down`,`up`),"files.hierarchy":h4(`collapse`,`expand`),"files.tab":h4(`previous tab`,`next tab`),"app.quit":{layout:`[quit confirm, hard exit] (second chord optional)`,validateCount:e=>e<=2?null:`needs [quit confirm, hard exit] (1 or 2 chords — got ${e})`}};function _4(e){return g4[e]?.slots??[]}var v4=`group/cap relative inline-flex flex-none items-stretch rounded-sm border-hairline bg-surface font-mono text-meta has-[:focus-visible]:outline-1 has-[:focus-visible]:outline-offset-1 has-[:focus-visible]:outline-focus`,y4={idle:`border-line text-ink hover:border-line-active`,changed:`border-line text-accent hover:border-line-active`,empty:`border-dashed border-line text-subtle hover:border-line-active`,active:`border-accent text-accent`},b4=`absolute -top-1.5 -right-1.5 flex size-4 cursor-pointer items-center justify-center rounded-full border-hairline border-line bg-paper p-0 leading-none text-subtle hover:border-line-active hover:text-error focus-visible:opacity-100 group-hover/cap:opacity-100 touch:size-5 touch:opacity-100 touch:after:absolute touch:after:-inset-2.5 touch:after:content-['']`;function x4(e){return(0,K.jsxs)(`span`,{className:Tn(v4,y4[e.tone??`idle`]),children:[(0,K.jsx)(`button`,{type:`button`,"aria-label":e.label,className:`px-2 py-1 touch:min-h-10`,onClick:e.onPress,children:e.children}),e.onRemove&&(0,K.jsx)(`button`,{type:`button`,"aria-label":e.removeLabel,className:Tn(b4,!e.removeShown&&`opacity-0`),onClick:e.onRemove,children:`×`})]})}G(),H();var S4=new Set([`app.quit`,`view.redraw`]),C4=FG(m4().filter(e=>!S4.has(e.id)));function w4(e){let[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(null),a=(0,J.useRef)(t);a.current=t;let o=async(t,n)=>{try{let r=await e.request(`keybindings.set`,{id:t,...n});i({id:t,lines:r.lines}),await wc(e)}catch(e){z(Ra(e),`error`)}},s=(0,J.useRef)(o);s.current=o;let c=t!==null;return(0,J.useEffect)(()=>{if(!c)return;let e=e=>{e.preventDefault(),e.stopImmediatePropagation();let t=a.current;if(!t||[`Control`,`Shift`,`Alt`,`Meta`].includes(e.key))return;let r=t.id===`prefix.key`?[]:xc.get().prefix.firstStrokes,i=p4(t,QG(e),r);if(i.kind===`more`)return n(i.recording);n(null),i.kind===`done`&&s.current(t.id,{[i.mode]:i.keys})};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[c]),{recording:t,notice:r,record:e=>{i(null),n({id:e,slots:Math.max(1,_4(e).length),got:[],prefixArmed:!1})},save:(e,t)=>void o(e,t)}}function T4(e,t){if(e.prefixArmed)return $(`keybindings.recordingPrefix`,{prefix:t});let n=_4(e.id)[e.got.length];return n?$(`keybindings.recordingSlot`,{slot:n}):$(`keybindings.recording`)}function E4(e){let{editor:t,id:n}=e,r=()=>t.record(n),i=U(`keys.recordFor`,{name:e.name});if(t.recording?.id===n)return(0,K.jsx)(x4,{tone:`active`,label:i,onPress:r,children:T4(t.recording,e.prefixName)});let a=e.changed?`changed`:`idle`,o=t.notice?.id===n,s=e.prefix??[];return e.direct.length===0&&s.length===0?(0,K.jsx)(x4,{tone:`empty`,label:i,onPress:r,children:$(`keybindings.unbound`)}):(0,K.jsxs)(K.Fragment,{children:[e.direct.length>0&&(0,K.jsx)(x4,{tone:a,label:i,onPress:r,onRemove:()=>t.save(n,{direct:[]}),removeLabel:U(`keys.removeFor`,{name:e.name}),removeShown:o,children:e.direct.join(` / `)}),s.length>0&&(0,K.jsx)(x4,{tone:a,label:i,onPress:r,onRemove:()=>t.save(n,{prefix:[]}),removeLabel:U(`keys.removeFor`,{name:e.name}),removeShown:o,children:s.map(t=>`${e.prefixName} ${t}`).join(` / `)})]})}function D4(e,t,n,r){let i=e.notice?.id===t?e.notice.lines:[];return i.length>0?(0,K.jsx)(`span`,{className:`text-warning`,children:i.join(` `)}):n===null?r:(0,K.jsxs)(`span`,{className:`inline-flex flex-wrap items-baseline gap-x-2`,children:[$(`keybindings.defaultKeys`,{keys:n}),(0,K.jsx)(q,{hit:`tight`,onClick:()=>e.save(t,{direct:`default`,prefix:`default`}),children:U(`keys.reset`)})]})}function O4({editor:e,keys:t}){let n=t.prefix.key??$(`keybindings.prefixDisabled`),r=(e,t=[])=>[...e,...t.map(e=>`${n} ${e}`)].join(` / `);return(0,K.jsx)(K.Fragment,{children:C4.map(i=>(0,K.jsx)(tX,{title:dK(i.category),children:i.rows.map(i=>{let a=t.rows.find(e=>e.id===i.id),o=lK(i.id);return(0,K.jsx)(nX,{settingId:`keys.binding:${i.id}`,label:o,hint:D4(e,i.id,a?r(i.keys,i.prefixKeys):null),children:(0,K.jsx)(E4,{editor:e,id:i.id,name:o,direct:a?.keys??i.keys,prefix:a?a.prefixKeys:i.prefixKeys,prefixName:n,changed:a!==void 0})},i.id)})},i.category))})}G(),xb(),A();function k4({model:e}){let{client:t}=e,{prefs:n}=hb(),r=k(xc),[i,a]=(0,J.useState)(!1);(0,J.useEffect)(()=>void wc(t),[t]);let o=r.prefix.key??$(`keybindings.prefixDisabled`),s=w4(t),c=bc.prefix.firstStrokes,l=r.prefix.firstStrokes.join()!==c.join();return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(tX,{hint:U(`keys.editHint`),children:[(0,K.jsx)(cX,{settingId:`keys.tapPresentation`,label:$(`keybindings.tapPresentation`),hint:$(`keybindings.tapPresentationHint`),value:n.prefixTap,picks:[{value:`local`,label:$(`keybindings.tapPresentationLocal`)},{value:`guide`,label:$(`keybindings.tapPresentationGuide`)}],onPick:e=>void pb(t,`prefixTap`,e)}),(0,K.jsx)(nX,{settingId:`keys.prefix`,label:$(`keybindings.prefixTitle`,{prefix:o}),hint:D4(s,f4,l?c.join(` / `):null,$(`keybindings.prefixHint`,{prefix:o,timeout:r.prefix.timeoutMs})),children:(0,K.jsx)(E4,{editor:s,id:f4,name:$(`keybindings.prefixKey`),direct:r.prefix.firstStrokes,prefixName:o,changed:l})})]}),r.warnings.length>0&&(0,K.jsx)(tX,{title:$(`keybindings.warnings`),children:r.warnings.map(e=>(0,K.jsx)(nX,{label:(0,K.jsx)(`span`,{className:`text-warning`,children:e})},e))}),(0,K.jsx)(O4,{editor:s,keys:r}),r.plugins.length>0&&(0,K.jsx)(tX,{title:U(`keys.pluginChords`),children:r.plugins.map(e=>(0,K.jsx)(nX,{label:(0,K.jsx)(`span`,{className:`font-mono`,children:e.chord}),hint:(0,K.jsx)(`span`,{className:`font-mono`,children:`${e.kind}:${e.target}`})},e.chord))}),(0,K.jsx)(tX,{settingId:`keys.configFile`,title:$(`keybindings.configFile`),hint:U(`prefs.keysYaml`),children:(0,K.jsx)(nX,{label:(0,K.jsx)(`span`,{className:`font-mono break-all`,children:r.path+(r.exists?``:$(`keybindings.notCreated`))}),hint:U(i?`keys.agentFailed`:`keys.agentHint`),children:(0,K.jsx)(q,{variant:`action`,onClick:()=>{a(!1),fq(e,U(`keys.agentPrompt`,{path:r.path})).catch(()=>a(!0))},children:U(`keys.agent`)})})})]})}var A4=`/relay-client/assets/pulse-3XJkP4CJ.wav`;function j4(e,t){return e===`error`||t}function M4(e,t,n=!1){return n?e.kind===`error`:t||e.kind!==`done`||e.turnEnd!==!0}function N4(e,t,n=!1){return t&&e.silent!==!0&&!n}function P4(e){return e===`permission_needed`?`needs_input`:e===`error`||e===`rate_limited`||e===`dead`?`error`:e===`turn_complete`?`done`:null}function F4(e,t,n,r){if(e===null)return[];let i=[];for(let[a,o]of t){if(a===n||e.get(a)===o)continue;let t=r(o);t&&i.push({key:a,kind:t})}return i}function I4(){return window.isSecureContext&&`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window}var L4=()=>navigator.serviceWorker.register(`sw.js`);async function R4(e){if(!I4())return`unsupported`;if(Notification.permission===`denied`)return`blocked`;let t=await(await navigator.serviceWorker.getRegistration())?.pushManager.getSubscription();if(!t)return`off`;let{subscribed:n}=await e.request(`push.status`,{endpoint:t.endpoint});return n?`on`:`off`}async function z4(e){if(!I4())return`unsupported`;if(await Notification.requestPermission()!==`granted`)return`blocked`;let t=await L4();await navigator.serviceWorker.ready;let{publicKey:n}=await e.request(`push.key`),r=await t.pushManager.getSubscription();return r?.options.applicationServerKey&&G4(r.options.applicationServerKey)!==n&&(await r.unsubscribe(),r=null),r??=await t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:W4(n)}),await e.request(`push.subscribe`,{subscription:r.toJSON()}),`on`}async function B4(e){let t=await(await navigator.serviceWorker.getRegistration())?.pushManager.getSubscription();return t&&(await e.request(`push.unsubscribe`,{endpoint:t.endpoint}),await t.unsubscribe()),`off`}async function V4(e,t,n,r){let i={body:r,tag:`task:${e}:${t}`,icon:`icon-192.png`,data:{taskId:e}},a=`serviceWorker`in navigator?await navigator.serviceWorker.getRegistration():void 0;if(a)return a.showNotification(`Rove — ${n}`,i);let o=new Notification(`Rove — ${n}`,i);o.onclick=()=>{window.focus(),H4?.(e),o.close()}}var H4=null;function U4(e){H4=t=>e.selectWhenListed(t);let t=new URLSearchParams(window.location.search),n=t.get(`task`);if(n){t.delete(`task`);let r=t.toString();history.replaceState(null,``,`${window.location.pathname}${r?`?${r}`:``}${window.location.hash}`),e.selectWhenListed(n)}let r=()=>{H4=null};if(!(`serviceWorker`in navigator))return r;let i=t=>{let n=t.data;n?.type===`rove.openTask`&&typeof n.taskId==`string`&&n.taskId&&e.selectWhenListed(n.taskId)};return navigator.serviceWorker.addEventListener(`message`,i),()=>{r(),navigator.serviceWorker.removeEventListener(`message`,i)}}function W4(e){let t=atob(e.replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(t,e=>e.charCodeAt(0))}function G4(e){return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}G(),xb(),H();var K4={done:`✓`,needs_input:`?`,error:`✕`};function q4(e){let t=new Audio(A4);t.volume=Math.min(1,Math.max(0,e)),t.play().catch(()=>void 0)}function J4(e,t,n){!document.hidden||typeof Notification>`u`||Notification.permission!==`granted`||V4(e,t,n,K4[t]).catch(()=>void 0)}function Y4(){typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission()}function X4(e){let t=new Map;for(let n of e.tasks)n.activity&&t.set(n.id,n.activity.state);return t}function Z4(e){let t=(0,J.useRef)(null);(0,J.useEffect)(()=>{let n=()=>{let n=e.tasks.get();if(!n)return;let r=X4(n),i=F4(t.current,r,null,P4);t.current=r;let{prefs:a}=yb.get();if(!a.crossTask)return;let o=e.selection.get().taskId,s=new Map(n.tasks.map(e=>[e.id,e.label]));for(let{key:t,kind:n}of i){if(t===o||!M4({kind:n,turnEnd:!0},a.finishedAlerts))continue;let r=s.get(t)??t;j4(n,a.toast)&&z(`${K4[n]} ${r}`,n===`error`?`error`:`info`,{label:U(`workspace.openTask`),run:()=>e.select(t)}),N4({},a.sound)&&(q4(a.soundVolume),J4(t,n,r))}};return n(),e.tasks.subscribe(n)},[e])}G(),xb();function Q4({client:e}){let[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(null);(0,J.useEffect)(()=>{R4(e).then(n,()=>n(`off`))},[e]);let a=t=>{i(null),(t?z4(e):B4(e)).then(n,e=>i(e instanceof Error?e.message:String(e)))},o=r?U(`prefs.pushFailed`,{error:r}):U(t===`unsupported`?`prefs.pushUnsupported`:t===`blocked`?`prefs.pushBlocked`:`prefs.pushHint`);return(0,K.jsx)(rX,{settingId:`notifications.push`,label:U(`prefs.push`),hint:o,checked:t===`on`,disabled:t===null||t===`unsupported`||t===`blocked`,onChange:a})}function $4({model:e}){let{client:t}=e,n=hb(),{prefs:r}=n,i=(e,n)=>void pb(t,e,n);return(0,K.jsxs)(tX,{children:[(0,K.jsx)(rX,{settingId:`notifications.toast`,label:$(`general.toast`),hint:U(`settings.notifications.toastNote`),checked:r.toast,onChange:e=>i(`toast`,e)}),(0,K.jsx)(rX,{settingId:`notifications.sound`,label:$(`general.sound`),hint:U(`prefs.soundHint`),checked:r.sound,onChange:e=>{e&&Y4(),i(`sound`,e)}}),(0,K.jsx)(cX,{settingId:`notifications.soundVolume`,label:U(`settings.notifications.volume`),hint:U(`prefs.soundVolumeHint`),value:r.soundVolume,picks:gb(n,`soundVolume`).map(e=>({value:e,label:`${Math.round(e*100)}%`})),onPick:e=>{yb.get().prefs.sound&&q4(e),i(`soundVolume`,e)}}),(0,K.jsx)(rX,{settingId:`notifications.crossTask`,label:$(`general.crossTask`),hint:$(`general.crossTaskHint`),checked:r.crossTask,onChange:e=>i(`crossTask`,e)}),(0,K.jsx)(rX,{settingId:`notifications.finishedAlerts`,label:$(`general.finishedAlerts`),hint:$(`general.finishedAlertsHint`),checked:r.finishedAlerts,onChange:e=>i(`finishedAlerts`,e)}),(0,K.jsx)(Q4,{client:t})]})}G(),A(),H();var e3={kanban:`kanban`,issues:`issues`};function t3({model:e}){let t=k(e.installedMods),{value:n,failed:r,reload:i}=uX(e.client,`builtinMods.list`),a=n?.mods;if((0,J.useEffect)(()=>{e.refreshMods()},[e]),!a)return r===null?null:(0,K.jsx)(tX,{title:U(`settings.plugins.builtIn`),children:(0,K.jsx)(dX,{failed:r,onRetry:i})});if(a.length===0)return null;let o=n=>{let r=!t.has(n.id);e.client.request(`builtinMod.setInstalled`,{id:n.id,installed:r}).then(()=>(!r&&V.get()===e3[n.id]&&V.set(null),e.refreshMods())).catch(e=>z(Ra(e),`error`))};return(0,K.jsx)(tX,{settingId:`plugins.builtIn`,title:U(`settings.plugins.builtIn`),hint:U(`settings.plugins.builtInHint`),children:a.map(e=>(0,K.jsx)(nX,{label:e.name,hint:e.description,inline:!0,children:(0,K.jsx)(eX,{on:t.has(e.id),"aria-label":U(`settings.plugins.turnOn`,{name:e.name}),onClick:()=>o(e)})},e.id))})}function n3({model:e}){let{client:t}=e,{value:n,failed:r,reload:i}=uX(t,`plugins.list`),a=n?.plugins;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(t3,{model:e}),(0,K.jsx)(tX,{settingId:`plugins.registered`,title:U(`settings.plugins.registered`),children:a?a.length===0?(0,K.jsx)(`p`,{className:QJ,children:U(`settings.plugins.empty`)}):a.map(e=>(0,K.jsx)(nX,{label:e.id,hint:[e.version,e.linked?U(`settings.plugins.linked`):null,e.platformOk===!1?U(`settings.plugins.unsupportedPlatform`):null].filter(Boolean).join(`, `),inline:!0,children:(0,K.jsx)(eX,{on:e.enabled,"aria-label":e.id,onClick:()=>void t.request(`plugin.setEnabled`,{id:e.id,enabled:!e.enabled}).then(i).catch(e=>z(Ra(e),`error`))})},e.id)):(0,K.jsx)(dX,{failed:r,onRetry:i})})]})}G(),He(),H();function r3(e){let[t,n]=(0,J.useState)(e.tier.engine),[r,i]=(0,J.useState)(e.tier.model??``),[a,o]=(0,J.useState)(e.tier.effort??``),s=e.engines.find(e=>e.id===t),c=ke();return(0,K.jsxs)(`form`,{className:FY,onSubmit:n=>{n.preventDefault(),e.onSave(t,s?.takesModel?r.trim():``,a)},onKeyDown:t=>{t.key===`Escape`&&(t.stopPropagation(),e.onCancel())},children:[(0,K.jsx)(EW,{label:$(`sections.engines`),value:t,picks:e.engines.map(e=>({value:e.id,label:e.name})),onPick:t=>{let r=e.engines.find(e=>e.id===t);n(t),r&&!r.effortLevels.includes(a)&&o(``),r&&!r.takesModel&&i(``)}}),s&&s.effortLevels.length>0&&(0,K.jsx)(EW,{label:U(`prefs.tierEffort`),value:a,picks:[``,...s.effortLevels].map(e=>({value:e,label:e||$(`autoRouting.engineDefault`)})),onPick:o}),s?.takesModel&&(0,K.jsx)(`input`,{className:$J,value:r,spellCheck:!1,placeholder:$(`autoRouting.engineDefault`),"aria-label":U(`prefs.tierModel`),onChange:e=>i(e.target.value)}),(0,K.jsxs)(`div`,{className:nY,children:[(0,K.jsx)(q,{variant:c?`action`:`link`,onClick:e.onCancel,children:U(`dialog.cancel`)}),(0,K.jsx)(q,{variant:`filled`,type:`submit`,children:$(`action.save`)})]})]})}function i3({client:e}){let{value:t,failed:n,reload:r}=uX(e,`autoRouting.get`),[i,a]=(0,J.useState)(null),o=ke(),s=(t,n)=>e.request(t,n).then(r).catch(e=>z(Ra(e),`error`));if(!t)return(0,K.jsx)(dX,{failed:n,onRetry:r});let c=t.classifier,l=[{value:`off`,label:$(`autoRouting.classifierOff`)},{value:`jev`,label:`jev`},...c.canCustom||c.mode===`custom`?[{value:`custom`,label:$(`autoRouting.classifierCustomLabel`)}]:[]],u=c.mode===`off`?$(`autoRouting.classifierOffHint`):c.mode===`jev`?$(`autoRouting.classifierJevHint`):$(`autoRouting.classifierCustomHint`),d=c.keySource===`env`?$(`autoRouting.keyPresentEnv`,{env:c.keyEnv??``}):c.keySource===`file`?$(`autoRouting.keySaved`):c.keyConfigured?$(`autoRouting.keyMissing`):$(`autoRouting.keyCustomUnused`);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(tX,{hint:$(`autoRouting.hint`),children:[!t.configured&&(0,K.jsx)(nX,{label:(0,K.jsx)(`span`,{className:`text-warning`,children:$(`autoRouting.unconfigured`)})}),t.tiers.map(e=>{let n=()=>a(i===e.tier?null:e.tier),r=(0,K.jsx)(`span`,{className:`${KJ} min-w-0 truncate`,children:[e.engineName,e.model??$(`autoRouting.engineDefault`),e.effort??$(`autoRouting.engineDefault`)].join(` · `)}),c=(0,K.jsx)(`span`,{className:`text-meta ${e.block?`text-warning`:`text-success`}`,children:e.block?$(`autoRouting.unavailable`,{reason:e.block}):$(`autoRouting.ready`)});return(0,K.jsxs)(`div`,{className:`${NY} ${yJ}`,"data-setting-id":`autoRouting.tier.${e.tier}`,children:[o?(0,K.jsxs)(q,{variant:`row`,className:JJ,"aria-expanded":i===e.tier,onClick:n,children:[(0,K.jsxs)(`span`,{className:YJ,children:[(0,K.jsx)(`span`,{className:GJ,children:rJ(`tier.${e.tier}`)}),r,(0,K.jsx)(`span`,{className:KJ,children:rJ(`tierDesc.${e.tier}`)}),c]}),(0,K.jsx)(tI,{right:i!==e.tier,className:wJ})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:PY,children:[(0,K.jsx)(`span`,{className:GJ,children:rJ(`tier.${e.tier}`)}),r,(0,K.jsx)(q,{className:`ml-auto`,onClick:n,children:U(`prefs.tierEdit`)})]}),(0,K.jsx)(`span`,{className:KJ,children:rJ(`tierDesc.${e.tier}`)}),c]}),i===e.tier&&(0,K.jsx)(r3,{tier:e,engines:t.engines,onCancel:()=>a(null),onSave:(t,n,r)=>{a(null),s(`autoRouting.setTier`,{tier:e.tier,engine:t,model:n,effort:r})}})]},e.tier)})]}),(0,K.jsxs)(tX,{title:$(`autoRouting.classifierTitle`),hint:$(`autoRouting.classifierHint`),children:[(0,K.jsx)(nX,{label:(0,K.jsx)(`span`,{className:c.mode===`off`?`text-muted`:`text-warning`,children:$(`autoRouting.classifierDataFlow`)})}),(0,K.jsx)(cX,{settingId:`autoRouting.classifier`,label:$(`autoRouting.classifierLabel`),hint:u.replace(/^[—\s]+/,``),value:c.mode,picks:l,onPick:e=>void s(`autoRouting.setClassifier`,{mode:e})})]}),(0,K.jsxs)(tX,{title:U(`prefs.classifierConnection`),hint:U(`prefs.editInTui`),children:[(0,K.jsx)(lX,{settingId:`autoRouting.endpoint`,label:$(`autoRouting.endpointLabel`),value:c.endpointHost||U(`prefs.unset`)}),(0,K.jsx)(lX,{settingId:`autoRouting.threshold`,label:$(`autoRouting.thresholdLabel`),value:c.threshold.toFixed(2)}),(0,K.jsx)(nX,{settingId:`autoRouting.key`,label:$(`autoRouting.keyLabel`),hint:d})]})]})}function a3(){return(0,K.jsxs)(`svg`,{className:pJ,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"aria-hidden":`true`,children:[(0,K.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.75`,strokeWidth:`1.4`}),(0,K.jsx)(`path`,{d:`M10.5 10.5 14 14`,strokeWidth:`1.4`,strokeLinecap:`round`})]})}function o3(e){return(0,K.jsxs)(`div`,{className:fJ,children:[(0,K.jsx)(a3,{}),(0,K.jsx)(`input`,{ref:e.inputRef,type:`text`,role:`searchbox`,className:mJ,value:e.query,placeholder:$(`search.placeholder`),"aria-label":$(`search.placeholder`),spellCheck:!1,autoComplete:`off`,"data-settings-search":!0,onChange:t=>e.onChange(t.target.value),onKeyDown:e.onKeyDown}),e.query!==``&&(0,K.jsx)(q,{variant:`row`,className:`absolute right-1 grid size-5.5 place-items-center rounded-xs text-body leading-none text-muted hover:bg-hover hover:text-ink focus-visible:outline-1 focus-visible:outline-focus w-narrow:right-1.5 w-narrow:size-7`,"aria-label":$(`search.clear`),title:$(`search.clear`),onClick:()=>{e.onChange(``),e.inputRef.current?.focus()},children:`×`})]})}function s3(e){return e.groupLabel&&e.groupLabel!==e.sectionLabel?`${e.sectionLabel} · ${e.groupLabel}`:e.sectionLabel}function c3(e){return e===1?$(`search.countOne`):$(`search.count`,{count:e})}function l3(e){let t=(0,J.useRef)(null);return(0,J.useEffect)(()=>{t.current?.querySelector(`[data-selected="true"]`)?.scrollIntoView({block:`nearest`})},[e.selected]),(0,K.jsx)(`div`,{className:EJ,children:(0,K.jsxs)(`div`,{className:DJ,children:[(0,K.jsxs)(`header`,{className:OJ,children:[(0,K.jsx)(`h1`,{className:kJ,children:$(`search.title`)}),(0,K.jsx)(`p`,{className:AJ,children:c3(e.results.length)})]}),(0,K.jsx)(`div`,{className:jJ,children:e.results.length===0?(0,K.jsxs)(`div`,{className:`flex flex-col items-start gap-2`,children:[(0,K.jsx)(`p`,{className:QJ,children:$(`search.empty`,{query:e.query.trim()})}),(0,K.jsx)(q,{variant:`action`,onClick:e.onClear,children:$(`search.clear`)})]}):(0,K.jsx)(`div`,{ref:t,className:hJ,children:e.results.map((t,n)=>{let r=n===e.selected;return(0,K.jsxs)(q,{variant:`row`,"aria-current":r?`true`:void 0,"data-selected":r?`true`:void 0,"data-search-result":t.id,className:gJ(r),onMouseEnter:()=>e.onSelect(n),onClick:()=>e.onPick(t),children:[(0,K.jsxs)(`span`,{className:_J,children:[(0,K.jsx)(`span`,{className:`${GJ} truncate`,children:t.label}),(0,K.jsx)(`span`,{className:vJ,children:s3(t)})]}),t.hint&&(0,K.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent line-clamp-2`,children:t.hint})]},`${t.section}:${t.id}`)})})})]})})}function u3(e){return e.results.length===0?(0,K.jsx)(`p`,{className:QJ,children:$(`search.empty`,{query:e.query.trim()})}):(0,K.jsx)(jD,{label:c3(e.results.length),children:e.results.map(t=>(0,K.jsxs)(q,{variant:`row`,"data-search-result":t.id,className:`${JJ} px-3`,onClick:()=>e.onPick(t),children:[(0,K.jsxs)(`span`,{className:YJ,children:[(0,K.jsx)(`span`,{className:`${GJ} truncate`,children:t.label}),(0,K.jsx)(`span`,{className:`${KJ} truncate`,children:t.hint?`${s3(t)} · ${t.hint}`:s3(t)})]}),(0,K.jsx)(tI,{right:!0,className:wJ})]},`${t.section}:${t.id}`))})}function d3(e,t){let n=t.toLowerCase(),r=e.length*2+2,i=e.charCodeAt(0);for(let t=0;t<n.length;t++){if(n.charCodeAt(t)!==i)continue;let a=Math.min(n.length,t+r),o=1;for(let r=t+1;r<a&&o<e.length;r++)n.charCodeAt(r)===e.charCodeAt(o)&&o++;if(o===e.length)return!0}return!1}function f3(e,t){let n=t.label.toLowerCase();if(n===e)return 0;if(n.startsWith(e))return 1;let r=n.indexOf(e);if(r>=0)return r===0||/[\s/_.:-]/.test(n[r-1]??``)?2:3;let i=t.sectionLabel.toLowerCase(),a=t.groupLabel?.toLowerCase()??``;if(i.includes(e)||a!==``&&a.includes(e))return 4;if(t.keywords)for(let n of t.keywords){let t=n.toLowerCase();if(t===e||t.startsWith(e))return 4;if(t.includes(e))return 5}let o=t.hint?.toLowerCase()??``;if(o!==``&&o.includes(e))return 6;if(e.length>=2){if(d3(e,n))return 7;if(d3(e,i)||a!==``&&d3(e,a))return 8;if(t.keywords?.some(t=>d3(e,t)))return 9}return 1/0}function p3(e,t){let n=t.trim().toLowerCase();if(!n)return[];let r=n.split(/\s+/).filter(Boolean);if(r.length===0)return[];let i=[];for(let t=0;t<e.length;t++){let n=e[t];if(!n)continue;let a=0,o=!0;for(let e of r){let t=f3(e,n);if(!Number.isFinite(t)){o=!1;break}a+=t}o&&i.push({entry:n,score:a,index:t})}return i.sort((e,t)=>e.score-t.score||e.index-t.index),i.map(e=>e.entry)}G();var m3=new Set([`app.quit`,`view.redraw`]),h3={general:`sections.general`,engines:`sections.engines`,autoRouting:`sections.autoRouting`,plugins:`sections.plugins`,keys:`sections.keys`,feedback:`sections.feedback`,dev:`sections.dev`},g3=e=>{let t=h3[e];return t?$(t):U(`settings.sections.${e}`)};function _3(e=[]){let t=(e,t,n,r)=>({id:t,section:e,sectionLabel:g3(e),groupLabel:r?.groupLabel,label:n,hint:r?.hint,keywords:r?.keywords}),n=U(`settings.general.groupInterface`),r=U(`settings.general.groupFiles`),i=U(`settings.general.groupTerminal`),a=U(`settings.appearance.groupColours`),o=U(`settings.appearance.groupTasks`),s=U(`settings.about.groupRove`),c=U(`settings.about.access`),l=U(`settings.about.browser`),u=$(`autoRouting.classifierTitle`),d=U(`prefs.classifierConnection`),f=$(`dev.experimental`),p=m4().filter(e=>!m3.has(e.id)).map(e=>{let n=e.prefixKeys??[];return t(`keys`,`keys.binding:${e.id}`,lK(e.id),{groupLabel:dK(e.category),hint:[...e.keys,...n.map(e=>`prefix ${e}`)].join(` / `)||void 0,keywords:[`keybinding`,`shortcut`,`hotkey`,`chord`,e.id,...e.keys,...n]})}),m=e.map(e=>t(`engines`,`engines.item:${e.id}`,e.name,{groupLabel:$(`sections.engines`),keywords:[`engine`,`agent`,`default`,e.id,e.name]}));return[t(`general`,`general.language`,$(`general.language`),{groupLabel:n,hint:U(`prefs.languageHint`),keywords:[`language`,`locale`,`english`,`chinese`,`中文`,`语言`]}),t(`general`,`general.keyHints`,$(`general.keyHintsShow`),{groupLabel:n,hint:U(`settings.general.tuiKeyHints`),keywords:[`keyboard`,`hints`,`shortcut`,`status bar`,`key hints`]}),t(`general`,`general.tabStrip`,U(`settings.general.tabStrip`),{groupLabel:n,keywords:[`tab`,`tab strip`,`tabs`,`标签栏`]}),t(`general`,`general.worktree`,$(`general.worktree`),{groupLabel:r,hint:$(`general.worktreeHint`),keywords:[`worktree`,`git`,`directory`,`folder`,`location`,`path`,`工作树`]}),t(`general`,`general.scrollback`,U(`settings.general.scrollback`),{groupLabel:i,hint:$(`general.scrollbackRowHint`),keywords:[`scrollback`,`terminal`,`buffer`,`history`,`rows`,`lines`,`回滚`]}),t(`appearance`,`appearance.theme`,$(`general.theme`),{hint:U(`prefs.themePreviewHint`),keywords:[`theme`,`palette`,`color`,`package`,`ghostty`,`kitty`,`alacritty`,`wezterm`,`主题`,`配色`]}),t(`appearance`,`appearance.themeMode`,$(`general.themeMode`),{keywords:[`dark`,`light`,`auto`,`mode`,`theme mode`,`深色`,`浅色`,`明暗`]}),t(`appearance`,`appearance.focusAccent`,$(`general.focusAccent`),{groupLabel:a,hint:$(`general.focusAccentHint`),keywords:[`focus`,`accent`,`color`,`primary`,`highlight`,`强调色`]}),t(`appearance`,`appearance.taskColors`,$(`general.taskColors`),{groupLabel:a,hint:U(`settings.appearance.taskColorsNote`),keywords:[`task colors`,`hue`,`border`,`任务配色`]}),t(`appearance`,`appearance.colorblind`,$(`general.colorblind`),{groupLabel:a,hint:U(`settings.appearance.colorblindNote`),keywords:[`colorblind`,`diff`,`accessibility`,`a11y`,`色盲`]}),t(`appearance`,`appearance.workingBorder`,$(`general.workingBorder`),{groupLabel:o,hint:U(`settings.appearance.workingBorderNote`),keywords:[`working border`,`gradient`,`flow`,`still`,`border`,`边框`]}),t(`appearance`,`appearance.runningTitle`,$(`general.runningTitle`),{groupLabel:o,keywords:[`running title`,`shimmer`,`still`,`title`,`流光`]}),t(`appearance`,`appearance.splitStyle`,$(`general.splitStyle`),{groupLabel:o,keywords:[`split`,`panes`,`divider`,`box`,`rail`,`rule`,`分屏`]}),t(`appearance`,`appearance.railFold`,$(`general.railFold`),{groupLabel:o,hint:$(`general.railFoldHint`),keywords:[`rail`,`sidebar`,`fold`,`collapse`,`glyphs`,`initials`,`折叠`]}),t(`appearance`,`appearance.railGroup`,U(`settings.appearance.railGroup`),{groupLabel:o,keywords:[`task list`,`rail`,`sidebar`,`group`,`project`,`state`,`任务列表`]}),t(`appearance`,`appearance.statusMark`,U(`settings.appearance.statusMark`),{groupLabel:o,keywords:[`task status`,`icon`,`dots`,`status mark`,`engine icon`,`任务状态`]}),t(`notifications`,`notifications.toast`,$(`general.toast`),{hint:U(`settings.notifications.toastNote`),keywords:[`toast`,`popup`,`notification`,`alert`,`弹窗`]}),t(`notifications`,`notifications.sound`,$(`general.sound`),{hint:U(`prefs.soundHint`),keywords:[`sound`,`audio`,`chime`,`bell`,`desktop notification`,`声音`,`提示音`]}),t(`notifications`,`notifications.soundVolume`,U(`settings.notifications.volume`),{hint:U(`prefs.soundVolumeHint`),keywords:[`volume`,`chime`,`sound`,`audio`,`音量`]}),t(`notifications`,`notifications.crossTask`,$(`general.crossTask`),{hint:$(`general.crossTaskHint`),keywords:[`cross-task`,`background`,`notification`,`跨任务`]}),t(`notifications`,`notifications.finishedAlerts`,$(`general.finishedAlerts`),{hint:$(`general.finishedAlertsHint`),keywords:[`finished`,`turns`,`approval`,`alert`,`unread`,`回合完成`]}),t(`notifications`,`notifications.push`,U(`prefs.push`),{hint:U(`prefs.pushHint`),keywords:[`push`,`web push`,`closed`,`notification`,`推送`]}),t(`snippets`,`snippets.list`,U(`settings.sections.snippets`),{hint:U(`settings.pages.snippets`),keywords:[`snippets`,`prompt`,`template`,`@name`,`reusable`,`片段`]}),t(`keys`,`keys.tapPresentation`,$(`keybindings.tapPresentation`),{hint:$(`keybindings.tapPresentationHint`),keywords:[`prefix tap`,`guide`,`badges`,`command layer`,`keybindings`,`点按`]}),t(`keys`,`keys.prefix`,$(`keybindings.prefixKey`),{hint:$(`keybindings.title`),keywords:[`prefix`,`ctrl+a`,`leader`,`chord`,`keybinding`,`shortcut`,`快捷键`]}),t(`keys`,`keys.configFile`,$(`keybindings.configFile`),{hint:U(`prefs.keysYaml`),keywords:[`keybindings.yaml`,`yaml`,`config file`,`keybindings`,`配置文件`]}),...p,t(`engines`,`engines.list`,$(`sections.engines`),{hint:$(`engines.hint`),keywords:[`engines`,`agent`,`default engine`,`cli`,`coding agent`,`引擎`]}),...m,t(`engines`,`engines.integrations`,$(`engines.integrations.title`),{hint:$(`engines.integrations.hint`),keywords:[`hooks`,`integrations`,`install`,`uninstall`,`activity`,`集成`]}),t(`engines`,`engines.skill`,$(`engines.skill.title`),{hint:$(`engines.skill.hint`),keywords:[`skill`,`agent skill`,`install`,`技能`]}),t(`engines`,`engines.permissionBypass`,$(`engines.permissionBypass`),{groupLabel:$(`engines.permissionsTitle`),hint:$(`engines.permissionBypassHint`),keywords:[`permission`,`bypass`,`auto approve`,`yolo`,`权限`]}),...[`swift`,`standard`,`deep`].map(e=>t(`autoRouting`,`autoRouting.tier.${e}`,rJ(`tier.${e}`),{groupLabel:$(`sections.autoRouting`),hint:rJ(`tierDesc.${e}`),keywords:[`auto routing`,`tier`,`model`,`effort`,e,`自动路由`,`档位`]})),t(`autoRouting`,`autoRouting.classifier`,$(`autoRouting.classifierLabel`),{groupLabel:u,hint:$(`autoRouting.classifierHint`),keywords:[`classifier`,`jev`,`custom`,`auto routing`,`分类器`]}),t(`autoRouting`,`autoRouting.endpoint`,$(`autoRouting.endpointLabel`),{groupLabel:d,keywords:[`endpoint`,`url`,`classifier`,`端点`]}),t(`autoRouting`,`autoRouting.threshold`,$(`autoRouting.thresholdLabel`),{groupLabel:d,keywords:[`threshold`,`confidence`,`classifier`,`阈值`]}),t(`autoRouting`,`autoRouting.key`,$(`autoRouting.keyLabel`),{groupLabel:d,keywords:[`api key`,`secret`,`classifier`,`密钥`]}),t(`voice`,`voice.dictation`,U(`voice.setup.dictation`),{hint:U(`settings.pages.voice`),keywords:[`voice`,`dictation`,`speech`,`microphone`,`whisper`,`transcribe`,`asr`,`语音`,`口述`]}),t(`connectors`,`connectors.github`,`GitHub`,{hint:U(`settings.connectors.githubDescription`),keywords:[`github`,`gh`,`git`,`pr`,`ssh`,`machines`,`account`,`账号`]}),t(`connectors`,`connectors.chat`,U(`settings.connectors.chat`),{hint:U(`settings.connectors.chatHint`),keywords:[`chat`,`wechat`,`weixin`,`lark`,`feishu`,`bot`,`微信`,`飞书`,`聊天`]}),t(`connectors`,`connectors.phone`,U(`settings.connectors.phoneTitle`),{hint:U(`settings.connectors.phoneHint`),keywords:[`phone`,`pair`,`qr`,`ios`,`iphone`,`android`,`mobile`,`relay`,`手机`,`配对`,`扫码`]}),t(`connectors`,`connectors.inbox`,U(`settings.connectors.inboxTitle`),{hint:U(`settings.connectors.inboxHint`),keywords:[`inbox`,`encrypted`,`token`,`external`,`age`,`relay`,`收件箱`]}),t(`plugins`,`plugins.builtIn`,U(`settings.plugins.builtIn`),{hint:U(`settings.plugins.builtInHint`),keywords:[`mods`,`built-in`,`kanban`,`issues`,`plugins`,`内置`,`插件`]}),t(`plugins`,`plugins.registered`,U(`settings.plugins.registered`),{hint:U(`settings.pages.plugins`),keywords:[`plugins`,`registered`,`extensions`,`插件`]}),t(`about`,`about.daemon`,U(`settings.about.daemon`),{groupLabel:s,hint:U(`settings.pages.about`),keywords:[`daemon`,`version`,`computer`,`host`,`build`,`守护进程`,`版本`]}),t(`about`,`about.updateChannel`,$(`general.updateChannelTitle`),{groupLabel:s,hint:$(`general.updatesHint`),keywords:[`update`,`channel`,`stable`,`next`,`nightly`,`release`,`发布渠道`,`更新`]}),t(`about`,`about.updateNotify`,$(`general.updateNotify`),{groupLabel:s,hint:$(`general.updateNotifyHint`),keywords:[`update`,`notify`,`version`,`更新通知`]}),t(`about`,`about.updateCheck`,$(`general.updates`),{groupLabel:s,hint:$(`general.updateCheckHint`),keywords:[`check for updates`,`update`,`npm`,`upgrade`,`检查更新`]}),t(`about`,`about.signIn`,U(`settings.about.signIn`),{groupLabel:c,keywords:[`sign in`,`login`,`password`,`token`,`auth`,`access`,`security`,`登录`,`密码`]}),t(`about`,`about.signOut`,U(`settings.about.signOut`),{groupLabel:l,hint:U(`settings.about.browserHint`),keywords:[`sign out`,`logout`,`token`,`browser`,`退出登录`]}),t(`feedback`,`feedback.form`,$(`sections.feedback`),{hint:U(`settings.pages.feedback`),keywords:[`feedback`,`bug`,`idea`,`question`,`issue`,`github`,`report`,`反馈`]}),t(`dev`,`dev.remoteProjects`,$(`dev.remote`),{groupLabel:f,hint:$(`dev.remoteHint`),keywords:[`remote`,`ssh`,`experimental`,`dev`,`远程项目`]}),t(`dev`,`dev.autoStatus`,$(`dev.autoStatus`),{groupLabel:f,hint:$(`dev.autoStatusHint`),keywords:[`auto status`,`in_progress`,`in_review`,`experimental`,`dev`,`自动状态`]}),t(`dev`,`dev.dispatcher`,$(`dev.dispatcher`),{groupLabel:f,hint:$(`dev.dispatcherHint`),keywords:[`dispatcher`,`field notes`,`note`,`experimental`,`dev`,`现场笔记`]}),t(`dev`,`dev.restart`,$(`dev.restart`),{hint:U(`prefs.restartHint`),keywords:[`restart`,`daemon`,`backend`,`dev`,`重启`]}),t(`dev`,`dev.reset`,$(`dev.reset`),{hint:U(`prefs.resetHint`),keywords:[`reset`,`wipe`,`clear`,`state.json`,`tasks.json`,`dev`,`重置`]})]}function v3(e,t=[]){return p3(_3(t),e)}var y3=[{id:`preferences`,sections:[`general`,`appearance`,`notifications`,`snippets`,`keys`]},{id:`agents`,sections:[`engines`,`autoRouting`,`voice`,`connectors`,`plugins`]},{id:`more`,sections:[`about`,`feedback`,`dev`]}],b3=e=>({section:e??`general`,drilled:e!==void 0});function x3(e,t){return t&&e.drilled?`list`:`close`}G(),He(),H();var S3=e=>e.split(`
|
|
253
|
+
`,1)[0]??``;function C3(e){let t=ke(),[n,r]=(0,J.useState)(e.editing?.name??``),[i,a]=(0,J.useState)(e.editing?.text??``),o=Ii(i),[s,c]=(0,J.useState)(!1),l=kI.test(n)&&i.trim()!==``;return(0,K.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:t=>{t.preventDefault(),l&&(c(!0),DI(e.client,{name:n,text:i}).then(e.onDone).catch(e=>{z(Ra(e),`error`),c(!1)}))},children:[(0,K.jsxs)(`label`,{className:tY,children:[(0,K.jsx)(`span`,{className:Ri,children:U(`snippets.name`)}),(0,K.jsx)(`input`,{className:`${$J} w-full font-mono`,value:n,maxLength:32,spellCheck:!1,autoComplete:`off`,autoFocus:!e.editing,readOnly:e.editing!==void 0,placeholder:U(`snippets.namePlaceholder`),onChange:e=>r(e.target.value)}),n!==``&&!kI.test(n)&&(0,K.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent`,children:U(`snippets.badName`)})]}),(0,K.jsxs)(`label`,{className:tY,children:[(0,K.jsx)(`span`,{className:Ri,children:U(`snippets.text`)}),(0,K.jsx)(`textarea`,{ref:o,className:`${$J} ${zi} w-full`,rows:5,value:i,maxLength:8e3,placeholder:U(`snippets.textPlaceholder`),onChange:e=>a(e.target.value)})]}),t?(0,K.jsxs)(`div`,{className:nY,children:[e.onRemove&&(0,K.jsx)(q,{variant:`actionDanger`,className:`mr-auto`,onClick:e.onRemove,children:U(`snippets.phone.remove`)}),(0,K.jsx)(q,{variant:`action`,onClick:e.onDone,children:U(`snippets.phone.cancel`)}),(0,K.jsx)(q,{variant:`filled`,type:`submit`,disabled:s||!l,children:U(`snippets.phone.save`)})]}):(0,K.jsxs)(`div`,{className:nY,children:[(0,K.jsx)(q,{onClick:e.onDone,children:U(`snippets.cancel`)}),(0,K.jsx)(q,{type:`submit`,disabled:s||!l,children:U(`snippets.save`)})]})]})}function w3({model:e}){let{client:t}=e,n=TI(),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)({done:!1,failed:null}),s=(0,J.useCallback)(()=>EI(t).then(()=>o({done:!0,failed:null}),e=>o(t=>({...t,failed:Ra(e)}))),[t]);(0,J.useEffect)(()=>t.onOpen(()=>void s()),[t,s]);let c=ke(),l=e=>void OI(t,e).then(()=>{i(null),z(U(`snippets.removed`,{name:e}))}).catch(e=>z(Ra(e),`error`));return(0,K.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,K.jsxs)(tX,{settingId:`snippets.list`,children:[n.length===0&&r===null&&(a.done?(0,K.jsx)(nX,{label:U(`snippets.empty`)}):(0,K.jsx)(dX,{failed:a.failed,onRetry:s})),n.map(e=>c?(0,K.jsxs)(q,{variant:`row`,className:JJ,onClick:()=>i(e),children:[(0,K.jsxs)(`span`,{className:YJ,children:[(0,K.jsxs)(`span`,{className:`${GJ} font-mono`,children:[`@`,e.name]}),(0,K.jsx)(`span`,{className:`${KJ} truncate`,children:S3(e.text)})]}),(0,K.jsx)(tI,{right:!0,className:wJ})]},e.name):(0,K.jsxs)(nX,{label:(0,K.jsxs)(`span`,{className:`font-mono`,children:[`@`,e.name]}),hint:S3(e.text),children:[(0,K.jsx)(q,{onClick:()=>i(e),children:U(`snippets.edit`)}),(0,K.jsx)(q,{onClick:()=>l(e.name),children:U(`snippets.remove`)})]},e.name)),c&&r===null&&(0,K.jsx)(q,{variant:`row`,className:`flex min-h-11 w-full items-center py-2 text-left font-sans text-title text-accent active:bg-hover`,onClick:()=>i(`new`),children:U(`snippets.phone.add`)})]}),c&&r===null?null:r===null?(0,K.jsx)(`div`,{className:nY,children:(0,K.jsx)(q,{onClick:()=>i(`new`),children:U(`snippets.add`)})}):(0,K.jsx)(C3,{client:t,editing:r===`new`?void 0:r,onDone:()=>i(null),onRemove:c&&r!==`new`?()=>l(r.name):void 0},r===`new`?`new`:r.name)]})}function T3(e,t){return t===`left`?100-Math.min(100,Math.max(0,e)):e}var E3=e=>e>=95?`crit`:e>=75?`warn`:`ok`,D3=e=>String(e).padStart(2,`0`);function O3(e,t){if(e==null||e<=t)return``;let n=new Date(e),r=`${D3(n.getHours())}:${D3(n.getMinutes())}`;return e-t<864e5?`→ ${r}`:`→ ${n.getMonth()+1}/${n.getDate()} ${r}`}function k3(e,t,n=`used`){let r=e.windows.find(e=>e.kind===`session`)??e.windows[0];return r?{label:r.label,percentText:`${T3(r.percent,n)}%`,resetText:O3(r.resetsAt,t),tone:E3(r.percent)}:null}G(),He(),A(),H(),Ur();var A3=1e4;function j3({client:e,inset:t=!0}){let n=k(e.conn),[r,i]=(0,J.useState)(null);(0,J.useEffect)(()=>{if(n.state!==`open`)return;let t=!0,r=()=>e.request(`usage.get`,{}).then(e=>{t&&i(e.usage)}).catch(()=>{});r();let a=Ga(A3,r);return()=>{t=!1,a()}},[e,n.state]);let a=Date.now(),o=(r??[]).flatMap(e=>{let t=k3({capturedAt:e.capturedAt,windows:e.windows},a);return t?[{vendor:e.vendor,name:e.name,chip:t}]:[]});return o.length===0?null:(0,K.jsx)(`div`,{className:`${Nr} ${t?`px-2`:``}`,children:o.map(({vendor:e,name:t,chip:n})=>{let r=Math.min(100,Math.max(0,Number.parseInt(n.percentText,10)||0));return(0,K.jsxs)(q,{variant:`row`,className:Pr,title:`${t} · ${n.label} ${n.percentText} ${n.resetText}`.trim(),"aria-label":`${U(`usage.open`)}: ${t}`,onClick:()=>{ce(),Ee(`usage`)},children:[(0,K.jsx)(`span`,{className:`truncate`,children:t}),(0,K.jsx)(`span`,{className:Lr(n.tone),style:{"--fill":`${r}%`}}),(0,K.jsxs)(`span`,{children:[n.label,` `,(0,K.jsx)(`span`,{className:Fr[n.tone],children:n.percentText})]})]},e)})})}G();var M3=2e3;function N3(e){let[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(null),a=(0,J.useCallback)(t=>{n(t),aR(e,t.available)},[e]),o=(0,J.useCallback)(()=>e.request(`voice.status`).then(a,e=>i(Ra(e))),[e,a]);(0,J.useEffect)(()=>void o(),[o]);let s=t?.setup?.install.phase===`running`||t?.available===!0&&!t.ready;return(0,J.useEffect)(()=>{if(!s)return;let e=window.setInterval(()=>void o(),M3);return()=>window.clearInterval(e)},[s,o]),{status:t,error:r,setError:i,accept:a}}function P3(e){let[t,n]=(0,J.useState)(!1);return t?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:qJ,children:e.ask}),(0,K.jsx)(q,{variant:`action`,disabled:e.disabled,onClick:()=>{n(!1),e.onConfirm()},children:e.label}),(0,K.jsx)(q,{variant:`action`,onClick:()=>n(!1),children:U(`voice.setup.cancel`)})]}):(0,K.jsx)(q,{variant:`action`,disabled:e.disabled,onClick:()=>n(!0),children:e.label})}function F3({client:e}){let{status:t,error:n,setError:r,accept:i}=N3(e),[a,o]=(0,J.useState)(!1),s=t?.setup,[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(``),[m,h]=(0,J.useState)(``);(0,J.useEffect)(()=>{s?.cloud&&(d(e=>e||s.cloud?.baseURL||``),p(e=>e||s.cloud?.model||``))},[s?.cloud]);let g=(t,n)=>(o(!0),r(null),e.request(t,n).then(i,e=>r(Ra(e))).finally(()=>o(!1)));if(!t)return(0,K.jsx)(`p`,{className:QJ,children:n??`…`});if(!s)return(0,K.jsx)(`p`,{className:QJ,children:t.model??U(`voice.setup.unavailable`)});let _=s.install,v=_.phase===`running`,y=c?`cloud`:s.backend,b=e=>{if(e===`cloud`&&!s.cloud?.hasKey)return l(!0);l(!1),g(`voice.configure`,{backend:e})},x=y===`off`?U(`voice.setup.offHint`):c?U(`voice.setup.cloudNeeded`):y===`local`&&!s.localInstalled?U(v?`voice.setup.localInstalling`:`voice.setup.localNeeded`):t.ready?U(`voice.setup.ready`,{model:t.model??``}):t.error??U(`voice.setup.starting`),S=v?_.line??U(`voice.setup.installing`):_.phase===`failed`&&!s.localInstalled?U(`voice.setup.failed`,{line:_.line??``}):s.localInstalled?U(`voice.setup.installed`):s.blocked??U(`voice.setup.localHint`);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(tX,{children:(0,K.jsx)(cX,{settingId:`voice.dictation`,label:U(`voice.setup.dictation`),hint:x,value:y,picks:[`off`,`local`,`cloud`].map(e=>({value:e,label:U(`voice.setup.backend.${e}`)})),onPick:b})}),(y===`local`||s.localInstalled||v)&&(0,K.jsx)(tX,{title:U(`voice.setup.backend.local`),children:(0,K.jsx)(nX,{label:U(`voice.setup.localTitle`),hint:S,children:v?(0,K.jsx)(`span`,{className:`max-w-90 min-w-0 truncate font-mono text-meta text-muted [overflow-wrap:anywhere]`,children:U(`voice.setup.installing`)}):s.localInstalled?(0,K.jsx)(P3,{label:U(`voice.setup.uninstall`),ask:U(`voice.setup.uninstallAsk`),disabled:a,onConfirm:()=>void g(`voice.uninstall`)}):!s.blocked&&(0,K.jsx)(q,{variant:`action`,disabled:a,onClick:()=>void g(`voice.install`),children:U(`voice.setup.install`)})})}),(y===`cloud`||s.cloud)&&(0,K.jsx)(tX,{title:U(`voice.setup.cloudTitle`),hint:U(`voice.setup.cloudHint`),children:(0,K.jsxs)(`form`,{className:`flex flex-col gap-3 py-3`,onSubmit:e=>{e.preventDefault(),g(`voice.configure`,{backend:`cloud`,baseURL:u,model:f,apiKey:m}).then(()=>l(!1)),h(``)},children:[(0,K.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:U(`voice.setup.baseURL`)}),(0,K.jsx)(`input`,{className:`${$J} font-mono`,value:u,placeholder:`https://api.openai.com/v1`,spellCheck:!1,autoComplete:`off`,onChange:e=>d(e.target.value)})]}),(0,K.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:U(`voice.setup.model`)}),(0,K.jsx)(`input`,{className:`${$J} font-mono`,value:f,placeholder:`gpt-4o-mini-transcribe`,spellCheck:!1,autoComplete:`off`,onChange:e=>p(e.target.value)})]}),(0,K.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:U(`voice.setup.apiKey`)}),(0,K.jsx)(`input`,{className:`${$J} font-mono`,type:`password`,value:m,placeholder:s.cloud?.hasKey?U(`voice.setup.keySaved`):``,autoComplete:`off`,onChange:e=>h(e.target.value)})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[s.cloud&&(0,K.jsx)(P3,{label:U(`voice.setup.forget`),ask:U(`voice.setup.forgetAsk`),disabled:a,onConfirm:()=>{d(``),p(``),g(`voice.forgetCloud`)}}),(0,K.jsx)(q,{variant:`action`,type:`submit`,disabled:a||!u.trim()||!f.trim()||!(m||s.cloud?.hasKey),children:U(s.backend===`cloud`?`voice.setup.save`:`voice.setup.saveAndUse`)})]})]})}),n&&(0,K.jsx)(`p`,{className:`m-0 py-3 text-body text-muted text-error`,children:n})]})}G(),He(),A(),H();var I3={general:e=>(0,K.jsx)(c4,{model:e}),appearance:e=>(0,K.jsx)(i0,{model:e}),notifications:e=>(0,K.jsx)($4,{model:e}),snippets:e=>(0,K.jsx)(w3,{model:e}),keys:e=>(0,K.jsx)(k4,{model:e}),engines:e=>(0,K.jsx)(Z2,{model:e}),autoRouting:e=>(0,K.jsx)(i3,{client:e.client}),voice:e=>(0,K.jsx)(F3,{client:e.client}),connectors:e=>(0,K.jsx)(P2,{model:e}),plugins:e=>(0,K.jsx)(n3,{model:e}),about:e=>(0,K.jsx)(_Z,{client:e.client}),feedback:e=>(0,K.jsx)(a4,{model:e}),dev:e=>(0,K.jsx)(I2,{client:e.client})},L3=1800,R3=4e3;function z3(e){return(e?.engines??[]).map(e=>({id:e.id,name:e.name??e.id}))}function B3(e){return e.narrow?(0,K.jsxs)(`nav`,{className:kD,"aria-label":U(`settings.title`),children:[(0,K.jsx)(AD,{children:U(`settings.title`)}),e.searchField,e.searching?e.phoneResults:(0,K.jsxs)(K.Fragment,{children:[y3.map(t=>(0,K.jsx)(jD,{label:U(`settings.groups.${t.id}`),children:t.sections.map(t=>(0,K.jsxs)(q,{variant:`row`,className:MD,"data-section":t,onClick:()=>e.onPick(t),children:[(0,K.jsx)(d4,{id:t}),g3(t),(0,K.jsx)(tI,{right:!0,className:wJ})]},t))},t.id)),e.foot]})]}):(0,K.jsxs)(`nav`,{className:lJ,"aria-label":U(`settings.title`),children:[(0,K.jsxs)(`div`,{className:dJ,children:[(0,K.jsx)(`h1`,{className:uJ,children:U(`settings.title`)}),e.searchField]}),y3.map(t=>(0,K.jsxs)(`div`,{className:bJ,children:[(0,K.jsx)(`p`,{className:xJ,children:U(`settings.groups.${t.id}`)}),(0,K.jsx)(`div`,{className:SJ,children:t.sections.map(t=>{let n=!e.searching&&e.current===t;return(0,K.jsx)(q,{variant:`row`,"data-section":t,className:CJ(n),"aria-current":n?`page`:void 0,onClick:()=>e.onPick(t),children:g3(t)},t)})})]},t.id))]})}function V3({model:e,section:t}){let n=W(),[r,i]=(0,J.useState)(()=>b3(t)),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(0),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(()=>z3(Hs(e.client,`engines.list`))),p=(0,J.useRef)(null),m=(0,J.useRef)(null),h=ke();(0,J.useEffect)(()=>{let t=!0;return Ws(e.client,`engines.list`).then(e=>{t&&f(z3(e))},()=>{}),()=>{t=!1}},[e.client]);let g=a.trim()!==``,_=(0,J.useMemo)(()=>v3(a,d),[a,d,n]),v=Math.min(s,Math.max(0,_.length-1)),y=()=>{o(``),c(0)},b=e=>{y(),i({section:e.section,drilled:!0}),u(t=>({section:e.section,id:e.id,seq:(t?.seq??0)+1}))},x=()=>{if(g){y();return}x3(r,h)===`list`?i({...r,drilled:!1}):ce()};(0,J.useEffect)(()=>{let e=document.querySelector(`.dialog`);e&&!e.contains(document.activeElement)&&e.focus()},[]),(0,J.useEffect)(()=>{let e=e=>{if(!e.defaultPrevented){if(e.key===`Escape`){e.preventDefault(),x();return}if(e.key===`/`&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let t=e.target;if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)return;e.preventDefault(),p.current?.focus()}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)});let S=k(Je)===`panel`&&h&&r.drilled,C=!h||!r.drilled||S,w=!h||r.drilled;(0,J.useEffect)(()=>{if(!l||!w||g||l.section!==r.section)return;let e=m.current;if(!e)return;let t=`[data-setting-id="${CSS.escape(l.id)}"]`,n=null,i=null,a=null,o=e=>{let t=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1;e.scrollIntoView({block:`center`,behavior:t?`auto`:`smooth`}),e.dataset.settingFlash=`true`,a=e,n=window.setTimeout(()=>{delete e.dataset.settingFlash},L3)},s=e.querySelector(t);if(s)return o(s),()=>{n!==null&&window.clearTimeout(n),a&&delete a.dataset.settingFlash};let c=new MutationObserver(()=>{let n=e.querySelector(t);n&&(c.disconnect(),i!==null&&window.clearTimeout(i),o(n))});return c.observe(e,{childList:!0,subtree:!0}),i=window.setTimeout(()=>c.disconnect(),R3),()=>{c.disconnect(),i!==null&&window.clearTimeout(i),n!==null&&window.clearTimeout(n),a&&delete a.dataset.settingFlash}},[l,w,g,r.section]);let T=(0,K.jsx)(o3,{inputRef:p,query:a,onChange:e=>{o(e),c(0)},onKeyDown:e=>{if(e.key===`ArrowDown`&&_.length>0)e.preventDefault(),c(Math.min(_.length-1,v+1));else if(e.key===`ArrowUp`&&_.length>0)e.preventDefault(),c(Math.max(0,v-1));else if(e.key===`Enter`&&_.length>0){e.preventDefault();let t=_[v];t&&b(t)}else e.key===`Escape`&&a!==``&&(e.preventDefault(),e.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),y())}});return(0,K.jsx)(`div`,{className:aJ,onMouseDown:e=>e.target===e.currentTarget&&ce(),children:(0,K.jsxs)(`dialog`,{ref:h&&!r.drilled?Ye(ce):void 0,tabIndex:-1,open:!0,className:oJ,"aria-label":U(`settings.title`),onKeyDown:e=>{let t=e.target;e.key===`Escape`&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(t.blur(),e.stopPropagation(),e.nativeEvent.stopImmediatePropagation())},children:[h?C&&(0,K.jsx)(OD,{frame:`screen`,back:{label:Ne.get()===`sidebar`?fK(`narrowBack`):U(`dialog.close`),onClick:ce}}):(0,K.jsx)(q,{variant:`row`,className:sJ,"aria-label":U(`dialog.close`),title:U(`dialog.close`),onClick:ce,children:`×`}),C&&(0,K.jsx)(B3,{current:r.section,narrow:h,searching:g,searchField:T,phoneResults:h&&g?(0,K.jsx)(u3,{query:a,results:_,onPick:b}):void 0,onPick:e=>{y(),i({section:e,drilled:!0})},foot:h&&(0,K.jsx)(`div`,{className:`rounded-[12px] bg-surface px-3 py-1`,children:(0,K.jsx)(j3,{client:e.client,inset:!1})})}),w&&(0,K.jsxs)(`div`,{ref:h?Ye(x):void 0,className:cJ(S),children:[h&&(0,K.jsx)(OD,{frame:`screen`,back:{label:U(`settings.title`),onClick:x},title:g3(r.section),titleKind:`heading`}),!h&&g?(0,K.jsx)(l3,{query:a,results:_,selected:v,onSelect:c,onPick:b,onClear:()=>{y(),p.current?.focus()}}):(0,K.jsx)(`div`,{ref:m,className:`min-h-0 min-w-0 flex-1 overflow-y-auto scrollbar-none`,children:(0,K.jsxs)(`div`,{className:`flex w-full flex-col gap-7 px-8 pt-7 pb-10 w-narrow:gap-4 w-narrow:px-3 w-narrow:pt-0 w-narrow:pb-10`,children:[(0,K.jsxs)(`header`,{className:`flex flex-col gap-1 pr-8 w-narrow:pr-0`,children:[!h&&(0,K.jsx)(`h1`,{className:`m-0 font-sans text-display font-semibold normal-nums text-ink`,children:g3(r.section)}),(0,K.jsx)(`p`,{className:`m-0 text-body text-muted w-narrow:px-3 w-narrow:text-meta`,children:U(`settings.pages.${r.section}`)})]}),(0,K.jsx)(`div`,{className:`flex flex-col gap-7 w-narrow:gap-4`,children:I3[r.section](e)})]})},r.section)]})]})})}function H3(e){return e.kind===`leaf`?[e]:e.children.flatMap(H3)}function U3(e){return!!e&&H3(e.root).length>1}function W3(e){let t=[],n=(e,r,i,a,o,s,c)=>{if(e.kind===`leaf`){t.push({id:e.id,x:r,y:i,w:a,h:o,left:s,top:c});return}let l=e.children.length;e.children.forEach((t,u)=>{e.orientation===`row`?n(t,r+a*u/l,i,a/l,o,u>0||s,c):n(t,r,i+o*u/l,a,o/l,s,u>0||c)})};return n(e,0,0,1,1,!1,!1),t}function G3(e,t,n=1){let r=H3(e.root).map(e=>e.id),i=r.indexOf(t);return r[(Math.max(0,i)+n+r.length)%r.length]??t}function K3(e,t){let n=new Map,r=new Map;for(let i of H3(e.root)){if(i.title){r.set(i.id,i.title);continue}let e=i.own?t:i.engineName??`shell`,a=(n.get(e)??0)+1;n.set(e,a),r.set(i.id,a===1?e:`${e} ${a}`)}return r}function q3(e,t,n){return e.kind===`engine`&&H3(t.root).some(e=>e.id===n&&e.own)}function J3(e){return e.alive!==!1||!!e.split&&!H3(e.split.root).some(e=>e.own)}function Y3(e){return H3(e.root).map(e=>e.id).join(`,`)}G(),He(),H();var X3=e=>{let{taskId:t}=e.selection.get();return e.tasks.get()?.tasks.find(e=>e.id===t)??null},Z3=e=>{let{taskId:t,tabId:n}=e.selection.get(),r=t?e.tabs.get()[t]?.find(e=>e.id===n):void 0;return!!r&&!U3(r.split)},Q3=[{id:`app.refresh`,live:()=>Co.get().stale,run:e=>Do(e.client)},{id:`palette.open`,live:()=>!0,run:Lq},{id:`task.new.global`,live:()=>!0,run:()=>uR()},{id:`chat.tab.fork`,live:e=>!!X3(e),run:e=>{let t=X3(e);t&&B.set((0,K.jsx)(TK,{model:e,taskId:t.id,context:`continue`}))}},{id:`chat.fork.new`,live:e=>!!X3(e),run:e=>{let t=X3(e);t&&B.set((0,K.jsx)(TK,{model:e,taskId:t.id,destination:`fork`}))}},{id:`settings.open`,live:()=>!0,run:e=>B.set((0,K.jsx)(V3,{model:e}))},{id:`inbox.show`,live:()=>!0,run:e=>B.set((0,K.jsx)(AO,{model:e}))},{id:`focus.previous`,live:()=>!0,run:()=>dc(-1)},{id:`focus.next`,live:()=>!0,run:()=>dc(1)},{id:`workspace.filesToggle`,live:e=>!!X3(e),run:e=>{let t=X3(e);t&&MB(t.id,`files`)}},{id:`files.createPR`,live:e=>!!X3(e),run:e=>{let t=X3(e);t&&e.client.request(`tab.requestPR`,e.engineTarget(t.id)).then(()=>z(U(`files.prRequested`))).catch(e=>z(e instanceof Error?e.message:String(e),`error`))}},{id:`chat.tab.close`,live:e=>!!e.selection.get().tabId&&Z3(e),run:e=>{let{taskId:t,tabId:n}=e.selection.get();!t||!n||e.closeTab(t,n).catch(e=>z(e instanceof Error?e.message:String(e),`error`))}},{id:`kanban.open`,live:e=>e.installedMods.get().has(`kanban`),run:()=>Ee(`kanban`)},{id:`automations.open`,live:()=>!0,run:()=>Ee(`routines`)},{id:`workItems.open`,live:e=>e.installedMods.get().has(`issues`),run:()=>Ee(`issues`)},{id:`task.moveMode`,live:e=>!!Vq(e),run:()=>{OG(!DG.get()),document.querySelector(`.rail`)?.focus()}},{id:`files.syncBase`,live:e=>Vq(e)?.kind===`task`,run:e=>{let t=Vq(e);t&&wq(e,t.id)}},{id:`files.fixChecks`,live:e=>!!Vq(e),run:e=>{let t=Vq(e);t&&Eq(e,t.id,U(`taskops.fixSent`))}},{id:`task.openEditor`,live:e=>!!Vq(e),run:e=>{let t=Vq(e);t&&Dq(e,t.id)}}];Ic(()=>Q3.map(e=>({id:e.id,chords:jc(e.id),prefix:!0,live:e.live,run:e.run})));function $3(e){return $G(e[0]??``)}function e6(e,t){let n=Vc(),r=Rc().filter(t=>t.prefix&&zc(t,n)&&t.live?.(e)!==!1);for(let e of t){let t=r.filter(t=>t.chords.includes(e)).sort((e,t)=>Bc(e,n)-Bc(t,n))[0];if(t)return t}}var t6=null,n6=null;function r6(){t6=null,n6!==null&&window.clearTimeout(n6),n6=null;let e=_K.get();e.guide?.kind===`prefix`&&_K.set({...e,guide:null})}function i6(){if(t6!==null){r6();return}B.get()||Ec()===null||(t6=Date.now(),_K.set({..._K.get(),guide:{kind:`prefix`,armedAt:t6}}),n6!==null&&window.clearTimeout(n6),n6=window.setTimeout(r6,xc.get().prefix.timeoutMs))}function a6(e,t){r6();let n=typeof t==`string`?[t]:t,r=e6(e,n);yK($3(n),r?.id??null),r?.run(e)}var o6=null;function s6(){o6!==null&&window.clearTimeout(o6),o6=null;let e=_K.get();e.guide?.kind===`direct`&&_K.set({...e,guide:null})}function c6(){o6!==null||B.get()||(o6=window.setTimeout(()=>{r6(),_K.set({..._K.get(),guide:{kind:`direct`}})},400))}function l6(e){(0,J.useEffect)(()=>{let t=t=>{if(t.key===`Control`){t.repeat||c6();return}if(s6(),[`Shift`,`Alt`,`Meta`].includes(t.key))return;let n=QG(t),{firstStrokes:r,timeoutMs:i}=xc.get().prefix;if(t6!==null&&Date.now()-t6<=i){if(t.preventDefault(),t.stopImmediatePropagation(),t.key===`Escape`)return r6();a6(e,n);return}r6();let a=document.activeElement,o=Xc(a instanceof HTMLElement?a:null)===`field`;!B.get()&&!o&&n.some(e=>r.includes(e))&&(t.preventDefault(),t.stopImmediatePropagation(),i6())},n=e=>e.key===`Control`&&s6(),r=e=>{t6!==null&&(e.target instanceof Element&&e.target.closest(`.prefix-guide, .shortcut-badge, [data-prefix-arm]`)||r6())};return window.addEventListener(`keydown`,t,{capture:!0}),window.addEventListener(`keyup`,n,{capture:!0}),window.addEventListener(`pointerdown`,r,{capture:!0}),window.addEventListener(`blur`,s6),()=>{window.removeEventListener(`keydown`,t,{capture:!0}),window.removeEventListener(`keyup`,n,{capture:!0}),window.removeEventListener(`pointerdown`,r,{capture:!0}),window.removeEventListener(`blur`,s6),s6(),r6()}},[e])}G(),xb(),A(),H(),Ur();function u6(e){let t=Vc(),n=new Map;for(let r of Rc()){if(!r.prefix||!zc(r,t)||r.live?.(e)===!1)continue;let i=Bc(r,t);for(let e of r.chords){let t=n.get(e);(!t||i<t.rank)&&n.set(e,{action:r.id,rank:i})}}return[...n].map(([e,{action:t}])=>({stroke:e,action:t}))}function d6(e){let t=new Map(hc.map((e,t)=>[e.id,t])),n=new Map;for(let{stroke:t,action:r}of e)n.set(r,[...n.get(r)??[],t]);let r=new Map,i=[...n].sort(([e],[n])=>(t.get(e)??2**53-1)-(t.get(n)??2**53-1));for(let[e,t]of i){let n=UG(e);r.set(n,[...r.get(n)??[],{action:e,strokes:t}])}return[...r].map(([e,t])=>({category:e,actions:t}))}var f6=e=>e===`prefix.moreCommands`?sK(`moreCommandsPrefix`):uK(e);function p6(e){let[,t]=(0,J.useState)(0);(0,J.useEffect)(()=>{if(e===null)return;let n=window.setTimeout(()=>t(e=>e+1),Math.max(30,e-Date.now()));return()=>window.clearTimeout(n)},[e])}function m6({model:e}){W();let t=k(_K);k(xc),k(e.selection);let n=Date.now(),r=t.entries.filter(e=>n-e.at<gK),i=t.guide?.kind===`prefix`?t.guide.armedAt:null,a=i!==null&&n-i<hK?i+hK:null;p6(a??(r[0]?r[0].at+gK:null));let o=t.guide?.kind===`direct`||i!==null&&a===null;if(!o&&!t.guide&&r.length===0)return null;if(o&&t.guide){let n=t.guide.kind===`direct`,r=n?YG(Hc(e,Vc()),Ec()):u6(e);return(0,K.jsxs)(`output`,{className:`mono ${er}`,onMouseDown:e=>e.preventDefault(),children:[(0,K.jsxs)(`div`,{className:nr,children:[(0,K.jsx)(`span`,{className:`text-accent`,children:n?sK(`directLayer`):sK(`commandLayer`,{prefix:Ec()??``})}),(0,K.jsx)(`span`,{className:`keys-only text-muted`,children:sK(n?`releaseCtrl`:`escCancel`)})]}),(0,K.jsx)(`div`,{className:rr,children:d6(r).map(t=>(0,K.jsxs)(`div`,{className:ir,children:[(0,K.jsx)(`div`,{className:`text-accent`,children:dK(t.category)}),t.actions.map(({action:t,strokes:r})=>(0,K.jsxs)(`button`,{type:`button`,className:ar,disabled:n,onClick:()=>r[0]&&a6(e,r[0]),children:[(0,K.jsx)(`span`,{className:tr,children:r.map($G).join(`/`)}),(0,K.jsx)(`span`,{children:f6(t)})]},t))]},t.category))})]})}return(0,K.jsxs)(`output`,{className:_r,children:[r.map(e=>(0,K.jsxs)(h6,{at:e.at,children:[(0,K.jsx)(`span`,{className:`text-accent`,children:Ec()}),` + `,e.stroke,` →`,` `,e.action?f6(e.action):(0,K.jsx)(`span`,{className:`text-muted`,children:`∅`})]},e.id)),i!==null&&(0,K.jsxs)(`div`,{className:vr(!1),children:[(0,K.jsx)(`span`,{className:`text-accent`,children:Ec()}),` ⋯`]})]})}function h6({at:e,children:t}){let[n]=(0,J.useState)(Date.now),r=n-e>140,i={"--hud-out":`${e+gK-140-n}ms`};return(0,K.jsx)(`div`,{className:vr(r),style:i,children:t})}function g6({model:e,bindingId:t,head:n=!1}){let r=k(_K);k(xc);let i=hb().prefs.prefixTap;if(r.guide?.kind!==`prefix`||i!==`local`)return null;let a=JG({bindingId:t,reachability:Hc(e,Vc()),prefixKey:Ec()});if(!a)return null;let o=Rc().find(e=>e.id===t&&e.prefix)?.chords[0];return(0,K.jsx)(`button`,{type:`button`,className:`mono ${Gn(n)}`,onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),o&&a6(e,o)},children:a})}function _6(e,t,n){let r=t(n),i=[];for(let a=2;a<=r;a++){let o=n+1;for(;o<e&&t(o)>a;)o++;let s=o<e&&t(o)===a;i.push(a===r?s?`tee`:`elbow`:s?`pipe`:`blank`)}return i}function v6(e,t,n){let r=e=>e.repo===t.repo&&!e.pinned==!t.pinned;if(t.id===n.id||!r(n))return null;let i=e.filter(r).sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).map(e=>e.id);return i.indexOf(n.id)-i.indexOf(t.id)}function y6(e,t,n,r){let i=v6(e,t,n);return i===null?null:r===`above`&&i>0?i-1:r===`below`&&i<0?i+1:i}function b6(e,t){return e.id!==t.id&&t.repo===e.repo&&!t.pinned==!e.pinned}var x6=e=>e===void 0||e.kind===`project`||e.kind===`state`?0:e.kind===`task`||e.kind===`pane`||e.kind===`round`?e.depth:1;function S6(e,t){let n=x6(e[t]),r=t+1;for(;r<e.length&&x6(e[r])>n;)r++;return r}function C6(e,t){return _6(e.length,t=>x6(e[t]),t)}function w6(e,t,n,r){let i=e.findIndex(e=>e.id===t);if(i<0||t===n)return e;let a=S6(e,i),o=e.slice(i,a),s=[...e.slice(0,i),...e.slice(a)],c=s.findIndex(e=>e.id===n);if(c<0)return e;let l=r===`above`?c:S6(s,c);return[...s.slice(0,l),...o,...s.slice(l)]}var T6=globalThis.webkit?.messageHandlers?.roveMac;function E6(e){let t=t=>e(t.detail);return window.addEventListener(`rove-mac`,t),()=>window.removeEventListener(`rove-mac`,t)}function D6(e,t,n,r,i,a){(0,J.useEffect)(()=>{if(T6)return T6.postMessage({op:`toolbar`,folded:e,waiting:t,back:n,forward:r,dark:getComputedStyle(document.documentElement).colorScheme!==`light`}),E6(({action:e})=>{e===`fold`&&a(),e===`back`&&n&&i(-1),e===`forward`&&r&&i(1)})},[e,t,n,r,i,a])}He(),A(),H();function O6(e,t){return e.kind===`task`&&t.kind===`task`?e.taskId===t.taskId:e.kind===`page`&&t.kind===`page`?e.id===t.id:e.kind===`new`&&t.kind===`new`}var k6={entries:[],at:-1};function A6(e,t){let n=e.entries[e.at];if(n&&O6(n,t)){let n=[...e.entries];return n[e.at]=t,{entries:n,at:e.at}}let r=[...e.entries.slice(0,e.at+1),t].slice(-50);return{entries:r,at:r.length-1}}function j6(e,t,n){for(let r=e.at+t;r>=0&&r<e.entries.length;r+=t){let t=e.entries[r];if(t&&n(t))return r}return-1}var M6=O(k6);function N6(e){let t=V.get();if(t)return{kind:`page`,id:t};let n=be.get();if(n)return{kind:`new`,start:n};let{taskId:r,tabId:i}=e.selection.get();return r?{kind:`task`,taskId:r,tabId:i}:null}function P6(e,t){if(t.kind!==`task`)return!0;let n=e.tasks.get()?.tasks.find(e=>e.id===t.taskId);return n!==void 0&&!n.deleting}var F6=!1;function I6(e){let t=!1,n=()=>{t||(t=!0,queueMicrotask(()=>{if(t=!1,F6)return;let n=N6(e);n&&M6.set(A6(M6.get(),n))}))};n();let r=[e.selection.subscribe(n),V.subscribe(n),be.subscribe(n)];return()=>{for(let e of r)e()}}function L6(e,t){let n=M6.get(),r=j6(n,t,t=>P6(e,t)),i=n.entries[r];i&&(F6=!0,i.kind===`task`?(V.set(null),be.set(null),e.select(i.taskId,i.tabId)):i.kind===`page`?(be.set(null),Ee(i.id)):(V.set(null),be.set(i.start)),M6.set({entries:n.entries,at:r}),queueMicrotask(()=>{F6=!1}))}G();function R6({children:e}){return(0,K.jsx)(`svg`,{className:`size-3.5 ${Wr}`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:e})}var z6={chat:(0,K.jsx)(`path`,{d:`M3 3.5h10a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H8l-3 2.5v-2.5H3a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1zM5 6.5h6M5 8.5h4`}),files:(0,K.jsx)(`path`,{d:`M2 4.5a1 1 0 0 1 1-1h3l1.5 1.5H13a1 1 0 0 1 1 1V12a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1z`}),diff:(0,K.jsx)(`path`,{d:`M3.5 2.5h9a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1zM8 5v4M6 7h4M6 11h4`}),browser:(0,K.jsx)(`path`,{d:`M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2zM2 8h12M8 2c2.2 2 2.2 10 0 12M8 2c-2.2 2-2.2 10 0 12`}),quota:(0,K.jsx)(`path`,{d:`M2 10a6 6 0 1 1 12 0M8 10l2.5-3.5M4 13h8`})};function B6(e){let t=Iz(e);return t?Lz(t):U(`panel.browser`)}var V6=7.3,H6=22,U6=160,W6=2,G6=24;function K6(e,t){let n=0;for(let t of e){let e=0;for(let n of t)e+=(n.codePointAt(0)??0)>11903?2:1;n+=Math.min(U6,H6+e*V6)+W6}return n<=t}function q6(e,t,n){let r=[{label:U(`panel.close`),section:`close`,run:()=>zB(e,n.id)}];return t.tabs.length>1&&r.push({label:U(`panel.closeOthers`),section:`close`,run:()=>RB(e,e=>Vte(e,n.id))}),r}function J6({taskId:e,column:t}){W();let n=(0,J.useRef)(null),r=(0,J.useRef)(null),[i,a]=(0,J.useState)(0);(0,J.useEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(([e])=>a(e?.contentRect.width??0));return t.observe(e),()=>t.disconnect()},[]);let o=i>0&&!K6(t.tabs.map(B6),i-G6);return(0,J.useEffect)(()=>{r.current?.querySelector(`.is-active`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[t.active,t.tabs.length,o]),(0,K.jsxs)(`div`,{className:ei,ref:n,children:[(0,K.jsx)(`div`,{className:ti,role:`tablist`,"aria-label":U(`panel.tabs`),ref:r,children:t.tabs.map(n=>{let r=n.id===t.active;return(0,K.jsxs)(`div`,{role:`presentation`,className:ni({active:r,compact:o}),onMouseDown:e=>{e.button===1&&e.preventDefault()},onAuxClick:t=>{t.button===1&&(t.preventDefault(),zB(e,n.id))},onContextMenu:r=>d7(r,q6(e,t,n)),children:[(0,K.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":r,className:ri(r),title:Iz(n)||B6(n),onClick:()=>RB(e,e=>zz(e,n.id)),children:(0,K.jsx)(`span`,{className:ii,children:B6(n)})}),(0,K.jsx)(`button`,{type:`button`,className:ai(r),"aria-label":U(`panel.close`),tabIndex:-1,onClick:()=>zB(e,n.id),children:`×`})]},n.id)})}),(0,K.jsx)(`button`,{type:`button`,className:Gr({tool:!0}),title:U(`panel.new`),"aria-label":U(`panel.new`),onClick:()=>RB(e,Rte),children:(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:`M8 3.5v9M3.5 8h9`})})})]})}He(),A(),H();var Y6=192,X6=`rove.web.railWidth`,Z6=`rove.web.railFolded`;function Q6(){let e=Number(localStorage.getItem(X6));return Number.isFinite(e)&&e>0?e:null}var $6=O(Q6());$6.subscribe(()=>{let e=$6.get();e===null?localStorage.removeItem(X6):localStorage.setItem(X6,String(Math.round(e)))}),$6.subscribe(le);var e8=O(localStorage.getItem(Z6)===`1`);e8.subscribe(()=>localStorage.setItem(Z6,e8.get()?`1`:`0`));var t8=O(!1),n8=null,r8=!1;function i8(e){n8!==null&&window.clearTimeout(n8),n8=null,r8=e,e?t8.set(!0):n8=window.setTimeout(()=>de.get()===null&&t8.set(!1),250)}de.subscribe(()=>{de.get()===null&&t8.get()&&!r8&&i8(!1)}),e8.subscribe(()=>t8.set(!1)),e8.subscribe(le);function a8(e,t=window.innerWidth){let n=Math.max(Y6,t-320);return Math.max(Y6,Math.min(n,Math.round(e)))}G(),A();function o8({client:e,railBar:t}){W(),k(xc);let{stale:n,bridgeVersion:r,daemonVersion:i}=k(Co);if(!n)return null;let a=U(`layout.refreshRove`),o=[U(`layout.refreshVersions`,{bridge:r?`v${r}`:U(`layout.unknownVersion`),daemon:i?`v${i}`:U(`layout.unknownVersion`)}),Ac(`app.refresh`)].filter(Boolean).join(` · `),s=(0,K.jsxs)(q,{variant:`pill`,className:`ml-auto min-h-6 min-w-6 justify-center touch:min-h-8 rounded-sm focus-visible:outline-1 focus-visible:outline-focus`,"aria-label":a,title:o,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},onClick:()=>Do(e),children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 shrink-0 rounded-full bg-warning`}),(0,K.jsx)(`span`,{className:t?`@max-[6.25rem]/refresh:sr-only`:void 0,children:a})]});return t?(0,K.jsx)(`div`,{className:`@container/refresh absolute top-2 right-2.5 left-[calc(5.75rem+var(--shell-inset-left,0px))] flex h-6.5 items-center justify-end @max-[13rem]:right-1`,children:s}):s}function s8({edge:e,className:t,...n}){return(0,K.jsx)(`div`,{"data-grip":``,className:Tn(`absolute inset-y-0 z-5 w-1.5 cursor-col-resize touch-none`,`after:absolute after:inset-y-0 after:w-0.5 after:bg-line-active after:opacity-0 after:transition-opacity after:duration-120`,`hover:after:opacity-100 hover:after:delay-250 active:after:bg-accent active:after:opacity-100 active:after:delay-0`,e===`right`?`right-0 after:right-0`:`left-0 after:left-0`,t),...n})}G(),He(),A(),H(),Ur();var c8=400;function l8({rail:e}){W();let t=(0,J.useRef)(null),n=(0,J.useRef)(0),r=(0,J.useRef)(null);return(0,K.jsx)(s8,{edge:`right`,title:U(`layout.railResize`),onPointerDown:n=>{t.current={x:n.clientX,width:e.current?.getBoundingClientRect().width??0,moved:!1},n.currentTarget.setPointerCapture(n.pointerId),ue(!0)},onPointerMove:e=>{let n=t.current;!n||e.clientX===n.x||(n.moved=!0,$6.set(a8(n.width+e.clientX-n.x)))},onPointerUp:()=>{let e=t.current;if(t.current=null,!e)return;if(e.moved){n.current=0;return}let i=Date.now();r.current!==null&&window.clearTimeout(r.current),r.current=null,i-n.current<c8?(n.current=0,$6.set(null)):(n.current=i,r.current=window.setTimeout(()=>e8.set(!0),c8))},onLostPointerCapture:()=>ue(!1)})}function u8({side:e}){return(0,K.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,K.jsx)(`rect`,{x:`1.5`,y:`2.5`,width:`13`,height:`11`,rx:`2.5`}),(0,K.jsx)(`path`,{d:e===`left`?`M6 2.5v11`:`M10 2.5v11`})]})}function d8({model:e,hidden:t=!1}){W();let n=k(M6),r=k(e8),i=k(e.tasks),a=t=>P6(e,t),o=U(r?`layout.railUnfold`:`layout.railFold`),s=r&&(i?.tasks??[]).some(WP);return D6(r,s,j6(n,-1,a)>=0,j6(n,1,a)>=0,t=>L6(e,t<0?-1:1),()=>e8.set(!r)),T6||t?null:(0,K.jsxs)(`div`,{className:Kr,onMouseEnter:()=>r&&t8.get()&&i8(!0),onMouseLeave:()=>r&&t8.get()&&i8(!1),children:[(0,K.jsxs)(`button`,{type:`button`,className:Gr(),title:o,"aria-label":o,onClick:()=>e8.set(!r),children:[(0,K.jsx)(u8,{side:`left`}),s&&(0,K.jsx)(`span`,{className:`absolute top-0.75 right-0.75 size-1.5 rounded-full bg-accent`})]}),(0,K.jsx)(`button`,{type:`button`,className:Gr(),title:U(`layout.navBack`),"aria-label":U(`layout.navBack`),disabled:j6(n,-1,a)<0,onClick:()=>L6(e,-1),children:(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:`M10 3.5 5.5 8l4.5 4.5`})})}),(0,K.jsx)(`button`,{type:`button`,className:Gr(),title:U(`layout.navForward`),"aria-label":U(`layout.navForward`),disabled:j6(n,1,a)<0,onClick:()=>L6(e,1),children:(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:`M6 3.5 10.5 8 6 12.5`})})})]})}var f8=(0,K.jsx)(`path`,{d:`M3 3.5h10a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1zM4.5 6.5 6.5 8l-2 1.5M8 10h3`}),p8=[`terminal`,`chat`,...cB],m8=e=>U(e===`terminal`?`layout.narrowTerminal`:`panel.${e}`);function h8(e,t,n){n!==`terminal`&&jB(e,n),cne(e,t,n)}function g8({client:e,taskId:t,tabId:n=null,title:r}){W();let i=k(lB),[a,o]=(0,J.useState)(!1);return(0,K.jsxs)(OD,{back:{label:fK(`narrowBack`),onClick:Le},title:r,children:[t&&(0,K.jsx)(ya,{size:`nav`,kind:`view`,label:`${U(`layout.narrowViews`)}: ${m8(i)}`,onClick:()=>o(!0),children:(0,K.jsx)(`svg`,{className:`size-5.5 fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.2]`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:i===`terminal`?f8:z6[i]})}),t&&a&&(0,K.jsx)(yO,{title:U(`layout.narrowViews`),value:i,picks:p8.map(e=>({value:e,label:m8(e)})),onPick:e=>h8(t,n,e),onClose:()=>o(!1)}),(0,K.jsx)(o8,{client:e})]})}function _8({title:e}){return W(),(0,K.jsxs)(`button`,{type:`button`,className:Aa({}),onClick:Ie,children:[(0,K.jsx)(`span`,{className:`${Pa} font-bold text-accent`,children:`↩`}),(0,K.jsx)(`span`,{className:ja,children:pK(`recentJump`,{title:e})})]})}var v8={duration:180,easing:`cubic-bezier(0.16, 1, 0.3, 1)`};function y8(e,t){let n=(0,J.useRef)(null);(0,J.useLayoutEffect)(()=>{let r=[...document.querySelectorAll(`[data-rail-body] > [data-row]`)],i=new Map(r.map(e=>[e.dataset.row??``,e.offsetTop])),a=n.current;if(n.current={list:e,tops:i},!(!a||a.list===e||a.tops.size===0||t)&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)for(let e of r){let t=a.tops.get(e.dataset.row??``);t===void 0?e.animate([{opacity:0},{opacity:1}],v8):t!==e.offsetTop&&e.animate([{transform:`translateY(${t-e.offsetTop}px)`},{transform:`none`}],v8)}})}H();var b8=null,x8=()=>(b8||(b8=new Image,b8.src=`data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`),b8);function S8(e,t,n,r){let[i,a]=(0,J.useState)(null),o=(0,J.useRef)(t);o.current=t;let[s,c]=(0,J.useState)(null),l=(0,J.useRef)(()=>a(null));(0,J.useEffect)(()=>{if(!s)return;let e=()=>{c(null),l.current()};if(t!==s)return e();let n=window.setTimeout(e,3e3);return()=>window.clearTimeout(n)},[t,s]);let u=(0,J.useRef)(null),d=(0,J.useRef)(null);y8(t,i!==null||s!==null);let f=()=>[...u.current?.querySelectorAll(`[data-row]`)??[]];(0,J.useLayoutEffect)(()=>{let e=d.current;if(!e||(d.current=null,window.matchMedia(`(prefers-reduced-motion: reduce)`).matches))return;let t=f().flatMap(t=>{let n=e.get(t.dataset.row??``),r=n===void 0?0:n-t.getBoundingClientRect().top;return r?[{el:t,dy:r}]:[]});for(let{el:e,dy:n}of t)e.style.transition=`none`,e.style.transform=`translateY(${n}px)`;u.current?.getBoundingClientRect();for(let{el:e}of t)e.style.transition=`transform 150ms ease-out`,e.style.transform=``,e.addEventListener(`transitionend`,()=>e.style.removeProperty(`transition`),{once:!0})});let p=(0,J.useRef)(null),m=(0,J.useRef)([]),h=(0,J.useRef)(new Map),g=(0,J.useRef)(0),_=(0,J.useRef)(0),v=e=>{p.current=e,a(e)},y=e=>!n||e.machine!==void 0?null:e.kind===`project`?e.noProject?null:t.find(t=>t.repo===e.repo&&!ms(t))??null:e.kind===`task`&&e.depth===1?e.task:null,b=e=>{let t=y(e);if(t)return{draggable:!0,onDragStart:n=>{n.dataTransfer.effectAllowed=`move`,n.dataTransfer.setDragImage(x8(),0,0),n.dataTransfer.setData(`text/plain`,t.id),u.current=n.currentTarget.closest(`[data-rail-body]`),C(u.current);let r=m.current,i=r.findIndex(t=>t.id===e.id);g.current=r.slice(i,S6(r,i)).reduce((e,t,n)=>e+(h.current.get(t.id)?.height??0)+(n>0?h.current.get(t.id)?.gap??0:0),0),_.current=n.clientY,v({fromRow:e.id,from:t,toRow:e.id,to:t,side:`above`,project:e.kind===`project`})},onDragEnd:()=>p.current&&v(null)}},x=(e,t,n)=>{let r=t;if(n.project)for(;r>0&&e[r]?.kind!==`project`;)r--;let i=e[r];if(!i||i.kind===`project`!==n.project)return null;let a=y(i);return!a||!n.project&&!b6(n.from,a)?null:{row:i.id,task:a}},S={onDragOver:e=>{let t=p.current;if(!t)return;e.preventDefault();let n=e.clientY-_.current;_.current=e.clientY;let r=e.target.closest(`[data-row]`)?.dataset.row,i=m.current,a=x(i,i.findIndex(e=>e.id===r),t);if(!a||a.row===t.fromRow)return;let o=e.currentTarget.querySelector(`[data-row="${CSS.escape(t.fromRow)}"]`)?.getBoundingClientRect().top;if(o===void 0||e.clientY>=o&&e.clientY<o+g.current)return;let s=e.clientY<o?`above`:`below`;(s===`above`?n>=0:n<=0)||(t.toRow!==a.row||t.side!==s)&&v({...t,toRow:a.row,to:a.task,side:s})},onDrop:n=>{let i=p.current;if(!i)return;n.preventDefault(),p.current=null,r?l.current=()=>a(null):l.current=()=>{d.current=new Map(f().map(e=>[e.dataset.row??``,e.getBoundingClientRect().top])),a(null),TG(`default`),z(Y(`tasks`,`sort.label`,{mode:Y(`tasks`,`sort.modes.default`)}))};let s=o.current,u=()=>o.current===s?c(s):l.current();if(i.project){if(i.toRow===i.fromRow)return l.current();let t={repo:i.from.repo,target:i.to.repo,side:i.side===`above`?`before`:`after`};e.client.request(`project.move`,t).catch(e=>z(Y(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)).finally(u);return}let m=y6(t,i.from,i.to,i.side);m?AG(e,i.from.id,m).finally(u):l.current()}},C=e=>{let t=[...e?.querySelectorAll(`[data-row]`)??[]];h.current=new Map(t.map((e,n)=>{let r=t[n-1],i=r?e.offsetTop-r.offsetTop-r.offsetHeight:0;return[e.dataset.row??``,{top:e.offsetTop,gap:i,height:e.offsetHeight}]}))},w=(e,t)=>{m.current=t?w6(e,t.fromRow,t.toRow,t.side):e;let n=new Map;if(!t)return n;let r=Math.min(...[...h.current.values()].map(e=>e.top)),i=e=>e.kind===`project`||e.kind===`state`,a=Math.max(0,...e.filter(i).map(e=>h.current.get(e.id)?.gap??0));for(let[e,t]of m.current.entries()){let o=h.current.get(t.id);if(!o)return new Map;e>0&&(r+=i(t)?a:o.gap),r!==o.top&&n.set(t.id,r-o.top),r+=o.height}return n};return{props:b,body:S,places:e=>{let t=[...h.current.keys()],n=i&&e.length===t.length&&e.every((e,n)=>e.id===t[n])?i:null,r=w(e,n),a=n?e.findIndex(e=>e.id===n.fromRow):-1,o=new Set(a<0?[]:e.slice(a,S6(e,a)).map(e=>e.id));return{dragging:n?.fromRow??null,place:e=>{let t=r.get(e.id);return{"data-row":e.id,...o.has(e.id)?{"data-lifted":``}:{},...t?{style:{transform:`translateY(${t}px)`}}:{}}}}}}}var C8=/^rgba?\(([^()]*)\)$/i;function w8(e){return C8.test(e.trim())}var T8=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;function E8(e){return T8.test(e)}function D8(e,t){let n=e.defs??{},r={};for(let[i,a]of Object.entries(e.engineColors??{})){let e=typeof a==`string`?a:a[t],o=new Set;for(;!E8(e)&&!w8(e)&&Object.hasOwn(n,e)&&!o.has(e);)o.add(e),e=n[e];r[i]=e}return r}var O8=[`shell.frame`,`shell.topBar`,`rail.frame`,`rail.header`,`rail.groupHeader`,`rail.row`,`rail.footer`,`session.header`,`session.body`,`session.footer`,`panel.frame`,`panel.tabs`,`panel.section`,`status.bar`,`package.view`,`phone.topBar`,`phone.listHeader`,`phone.groupHeader`,`phone.row`,`phone.sessionHeader`,`phone.tabs`],k8=/\{\{([a-zA-Z0-9_]+)\}\}/g;function A8(e,t){return e.replace(k8,(e,n)=>{let r=t[n];return r==null||r===!1?``:String(r)})}var j8=`theme.json`;new Set(O8),G();var M8=class extends J.Component{state={tripped:!1};static getDerivedStateFromError(e){let t=d1.get();if(t.activePack!==null&&!t.disabledByCrash)return{tripped:!0};throw e}componentDidCatch(e,t){let n=d1.get();n.activePack!==null&&!n.disabledByCrash&&(w1(e,t.componentStack??void 0),this.setState({tripped:!1}))}render(){return this.state.tripped?null:this.props.children}},N8=class extends J.Component{state={crashed:!1};static getDerivedStateFromError(){return{crashed:!0}}componentDidCatch(e,t){C1(this.props.packId,this.props.slot,this.props.file,e,t.componentStack??void 0)}render(){return this.state.crashed?this.props.fallback:this.props.children}};function P8({client:e,onOpenSettings:t}){W();let n=T1();if(n.runtimeErrors.length===0)return null;let r=n.runtimeErrors[n.runtimeErrors.length-1];if(!r)return null;let i=[r.slot,r.file].filter(Boolean).join(` · `);return(0,K.jsxs)(`div`,{className:D1,role:`alert`,"data-theme-package-error-banner":!0,children:[(0,K.jsx)(`span`,{className:O1,children:U(`settings.appearance.themeErrorBadge`)}),(0,K.jsx)(`span`,{className:`font-semibold text-ink`,children:r.packId}),i&&(0,K.jsx)(`span`,{className:`text-muted`,children:i}),(0,K.jsx)(`span`,{className:k1,title:r.message,children:r.message}),(0,K.jsxs)(`div`,{className:A1,children:[(0,K.jsx)(q,{variant:`link`,onClick:t,children:U(`settings.appearance.themeErrorDetails`)}),(0,K.jsx)(q,{variant:`action`,onClick:()=>void S1(e),children:U(`settings.appearance.themeSwitchDefault`)})]})]})}var F8=[`--radius`,`--radius-sm`,`--radius-xs`,`--hairline`,`--tp-pane-gap`,`--tp-shell-pad`];function I8(e,t,n){for(let t of F8)e.style.removeProperty(t);if(delete e.dataset.tpFrame,delete e.dataset.tpDensity,delete e.dataset.tpPack,f1.set(n),!t)return;let r=t.manifest.layout;r&&(r.radius!==void 0&&e.style.setProperty(`--radius`,`${r.radius}px`),r.radiusSm!==void 0&&e.style.setProperty(`--radius-sm`,`${r.radiusSm}px`),r.radiusXs!==void 0&&e.style.setProperty(`--radius-xs`,`${r.radiusXs}px`),r.paneGap!==void 0&&e.style.setProperty(`--tp-pane-gap`,`${r.paneGap}px`),r.shellPadding!==void 0&&e.style.setProperty(`--tp-shell-pad`,`${r.shellPadding}px`),r.borderStyle===`none`?e.style.setProperty(`--hairline`,`0px`):r.borderStyle===`solid`&&e.style.setProperty(`--hairline`,`1px`),r.frame&&(e.dataset.tpFrame=r.frame),r.density&&(e.dataset.tpDensity=r.density)),e.dataset.tpPack=t.id}function L8(e,t,n){if(!e?.engineColors)return;let r=D8(e,n),i=typeof t==`string`?t:t?.id,a=typeof t==`string`?void 0:t?.protocol;return i&&r[i]||a&&r[a]||r.default}A();var R8=15e3,z8=24,B8=3,V8=e=>e.changes&&!(`unreadable`in e.changes)?e.changes.ahead:void 0,H8=e=>e.repo?e.repo.split(`/`).pop():void 0,U8=e=>e.workspace&&e.workspace!==e.repo?e.workspace.split(`/`).pop():void 0,W8=e=>e&&Date.parse(e)||0;function G8(e,t,n,r,i){let a=e.changes&&!(`unreadable`in e.changes)?e.changes:void 0;return{id:e.id,title:e.label,repo:H8(e),branch:e.branch||void 0,worktree:U8(e),engineId:e.engine?.id??void 0,engineName:e.engine?.name,engineColor:L8(n,e.engine,r),model:e.model,engineFamily:e.engine?.protocol,baseRef:e.baseRef,statusKind:e.rowStatus?.kind??`idle`,since:e.rowStatus?.since??0,ahead:V8(e),diffStats:a?{files:0,added:a.added,removed:a.deleted}:void 0,pr:e.pr?.number?{number:e.pr.number,state:e.pr.lifecycle,url:e.pr.url,checkState:e.pr.checkState}:void 0,parentId:e.parentTaskId,createdAt:W8(e.createdAt)||void 0,selected:e.id===i,onSelect:()=>t.select(e.id)}}function K8(e,t,n,r=0,i=0){let a=n?JSON.stringify(n):null,[,o]=(0,J.useState)(0);return(0,J.useEffect)(()=>{if(!n)return;let r=!0,a=()=>Ws(e,t,n).then(()=>r&&o(e=>e+1),()=>{});a();let s=i>0?Ga(i,a):void 0;return()=>{r=!1,s?.()}},[e,t,a,r,i]),n?Hs(e,t,n):void 0}function q8(e,t,n){let r=Date.now();return e.flatMap(e=>e.windows.map(i=>({label:e.name,pct:i.percent,tone:k3({capturedAt:e.capturedAt,windows:[i]},r)?.tone??`ok`,detail:i.label,engineId:e.vendor,engineColor:L8(t,{id:e.vendor,protocol:e.vendor},n),window:i.kind,resetsAt:i.resetsAt??void 0})))}async function J8(e,t){let[n,r]=await Promise.all([(async()=>{let n=a$,r;for(let i=0;i<B8&&r!==null;i++){let i=await e.client.request(`output.read`,{taskId:t,limit:50,...r?{cursor:r,source:`history`}:{}}).catch(()=>null);n=S$(n,i?.history?.messages??[],i?.history?.firstIndex??0),r=i?.olderCursor??null}return n})(),e.client.request(`task.events`,{taskId:t,limit:100}).catch(()=>null)]),i=n.entries.flatMap(e=>e.tools.map(r=>({sessionId:t,kind:n.failed.has(r.callId)?`tool-failed`:`tool`,at:W8(e.at),detail:r.name,summary:r.summary,endedAt:W8(n.ended.get(r.callId))||void 0}))),a=[...n.thoughts.values()].map(e=>({sessionId:t,kind:`thinking`,at:W8(e.at),detail:``,summary:e.text.slice(0,200)})),o=(r?.events??[]).map(e=>({sessionId:t,kind:e.kind,at:e.at,detail:e.detail??``}));return[...i,...a,...o].filter(e=>e.at>0)}function Y8(e,t){let[n,r]=(0,J.useState)(new Map),i=(0,J.useRef)(new Map),a=t?[...t].sort((e,t)=>W8(t.updatedAt)-W8(e.updatedAt)).slice(0,z8):null,o=a?.map(e=>`${e.id}@${e.updatedAt}:${e.rowStatus?.since??0}`).join(`,`)??null,s=a?.filter(e=>e.rowStatus?.kind===`running`).map(e=>e.id).join(`,`)??``;return(0,J.useEffect)(()=>{if(!o)return;let t=!0,n=n=>void Promise.all(n.map(async t=>[t,await J8(e,t)])).then(e=>t&&e.length>0&&r(t=>new Map([...t,...e])));n(o.split(`,`).filter(e=>{let[t=``,n=``]=e.split(`@`),r=i.current.get(t)===n;return i.current.set(t,n),!r}).map(e=>e.split(`@`)[0]??``));let a=s?Ga(R8,()=>n(s.split(`,`))):void 0;return()=>{t=!1,a?.()}},[e,o,s]),(0,J.useMemo)(()=>o?[...n.values()].flat().sort((e,t)=>e.at-t.at):void 0,[n,o])}function X8(e,t){let n=e?.slots?.[t];return n?.component?n.data??(t===`panel.section`?[`commits`,`sessions`]:[]):[]}function Z8(e,t,n,r){let i=e=>t.includes(e),a=k(e.tasks),o=k(e.selection),s=k(e.tabs),c=ec(a,o.taskId)??null,l=c?.id??null,u=(c&&V8(c))??0,d=c?.changes&&!(`unreadable`in c.changes)?c.changes.added+c.changes.deleted:0,f=K8(e,`diff.refs`,i(`commits`)&&l&&u>0?{taskId:l}:null,u),p=K8(e,`diff.files`,i(`files`)&&l?{taskId:l}:null,`${u}:${d}`),m=K8(e,`usage.get`,i(`usage`)?{}:null,0,6e4),h=l?(s[l]??[]).find(e=>e.kind===`engine`)?.id:void 0,g=K8(e,`context.usage`,i(`context`)&&l&&h?{taskId:l,tabId:h,probe:!1}:null,0,R8),_=K8(e,`pr.checks`,i(`checks`)&&l&&c?.pr?.number?{taskId:l}:null,c?.pr?.checkState,6e4),v=F$(e,i(`transcript`)&&l?l:``,i(`transcript`)),y=(0,J.useMemo)(()=>{if(v.state.kind!==`ready`)return;let{entries:e,failed:t,outputs:n,ended:r,thoughts:i}=v.state.transcript,a=new Set(e.map(e=>e.index)),o=[...i].flatMap(([e,t])=>a.has(e)?[]:[{index:e,role:`assistant`,at:t.at,text:``,tools:[]}]);return[...e,...o].sort((e,t)=>e.index-t.index).map(e=>({index:e.index,role:e.role,at:W8(e.at),text:e.text,thinking:i.get(e.index)?.text,tools:e.tools.map(e=>({id:e.callId,name:e.name,summary:e.summary,failed:t.has(e.callId),input:e.input,output:n.get(e.callId),endedAt:W8(r.get(e.callId))||void 0}))}))},[v.state]),b=a?.tasks??[],x=Y8(e,i(`activity`)?b:null);return{...i(`sessions`)?{sessions:b.map(t=>G8(t,e,n,r,l))}:{},...i(`commits`)?{commits:f?.commits.slice(0,u)??[]}:{},...i(`files`)?{files:(p?.files??[]).map(e=>({path:e.path,status:e.status,added:e.added??0,removed:e.deleted??0}))}:{},...i(`transcript`)?{transcript:y??[]}:{},...i(`usage`)?{usage:q8(m?.usage??[],n,r)}:{},...i(`context`)?{context:g?.meter??null}:{},...i(`checks`)?{checks:_?.checks??[]}:{},...i(`activity`)?{activity:x??[]}:{},...i(`decisions`)?{decisions:(a?.gates??[]).filter(e=>e.status===`open`).map(t=>({id:t.id,sessionId:t.taskId,question:t.question,options:t.options,recommended:t.recommended,at:W8(t.createdAt),onAnswer:n=>void yD(e,t.id,n)}))}:{}}}G(),A();var Q8=[0,4,8,14],$8=e=>e===`rail.row`||e===`phone.row`,e5=e=>e===`rail.groupHeader`||e===`phone.groupHeader`,t5=(0,J.createContext)({});function n5(e,t){if($8(e)){let e=t;return{title:e.title,branch:e.branch??``,repo:e.repo??``,engine:e.engineName??e.engineId??``,status:e.statusKind,statusLabel:e.statusLabel,pr:e.pr?`#${e.pr.number} ${e.pr.state}`:``,todos:e.todos?`${e.todos.done}/${e.todos.total}`:``,tokens:e.tokens?.map(e=>e.text).join(` · `)??``,age:e.age??``,cloud:e.cloud??``,pinned:e.pinned?`pinned`:``,diffStats:e.diffStats?`+${e.diffStats.added} -${e.diffStats.removed}`:``,cost:e.cost??``}}if(e5(e)){let e=t;return{label:e.label,repo:e.repo??``,count:e.count,collapsed:e.collapsed,kind:e.kind}}if(e===`rail.footer`){let e=t;return{usageSummary:e.usageSummary,settingsLabel:e.settingsLabel,unreadCount:e.unreadCount}}if(e===`session.header`){let e=t;return{title:e.title,branch:e.branch??``,repo:e.repo??``,engine:e.engineName??e.engineId??``,status:e.statusKind,tabCount:e.tabCount,activeTab:e.activeTab??``}}if(e===`panel.tabs`){let e=t;return{kind:e.kind,title:e.title,hint:e.hint,tabCount:e.tabCount,expanded:e.expanded}}if(e===`panel.section`){let e=t;return{kind:e.kind,title:e.title,branch:e.branch??``,repo:e.repo??``,engine:e.engineName??e.engineId??``,status:e.statusKind,diffStats:e.diffStats?`+${e.diffStats.added} -${e.diffStats.removed}`:``,todos:e.todos?`${e.todos.done}/${e.todos.total}`:``,pr:e.pr?`#${e.pr.number}`:``,cost:e.cost??``}}if(e===`status.bar`){let e=t;return{connection:e.connection,taskTitle:e.taskTitle??``,branch:e.branch??``,engine:e.engineName??``,status:e.statusKind??``,diffStats:e.diffStats?`+${e.diffStats.added} -${e.diffStats.removed}`:``,usageSummary:e.usageSummary}}return t}function r5({node:e,values:t,onAction:n}){if(e.type===`text`){let n=A8(e.text,t);return n?(0,K.jsx)(`span`,{className:GH(e.tone,e.bold===!0),children:n}):null}return e.type===`button`?(0,K.jsx)(q,{variant:`action`,onClick:()=>n?.(e.key),children:A8(e.label,t)}):e.type===`input`?null:(0,K.jsx)(`div`,{className:WH(e.direction===`row`,e.border===!0),style:{flexDirection:e.direction??`column`,gap:Q8[e.gap??0],padding:Q8[e.padding??0]},children:e.children.map((e,r)=>(0,K.jsx)(r5,{node:e,values:t,onAction:n},r))})}function i5(e,t,n,r,i){let a=n5(e,n);if(t.tree)return(0,K.jsx)(r5,{node:t.tree,values:a,onAction:t=>{$8(e)&&t===`select`&&n.onSelect(),e5(e)&&t===`toggle`&&n.onToggle(),e5(e)&&t===`newTask`&&n.onNewTask?.(),e===`rail.footer`&&t===`settings`&&n.onOpenSettings(),e===`rail.footer`&&t===`inbox`&&n.onOpenInbox(),e===`panel.tabs`&&t===`close`&&n.onClose(),e===`panel.tabs`&&t===`expand`&&n.onToggleExpand?.(),e===`status.bar`&&t===`retry`&&n.onRetry()}});if($8(e)&&(t.fields||t.secondaryFields||t.surface||t.variant)){let e=n,r=t.fields??[`title`,`pr`,`statusLabel`],o=t.secondaryFields??[],s=e.engineColor?{"--tp-engine-color":e.engineColor}:void 0;return(0,K.jsxs)(q,{variant:`row`,className:`${j1} ${L1(i)} ${R1(t.surface,e.selected)} ${z1(t.variant)}`,style:s,onClick:e.onSelect,"data-tp-slot":`rail.row`,children:[(0,K.jsx)(`span`,{className:M1,children:r.map(e=>{let t=a[e];return t?e===`title`?(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:String(t)},e):(0,K.jsx)(`span`,{className:N1,children:String(t)},e):null})}),o.length>0&&(0,K.jsx)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 font-mono text-meta text-muted`,children:o.map(e=>{let t=a[e];return t?(0,K.jsx)(`span`,{className:`truncate`,children:String(t)},e):null})})]})}if(e===`panel.section`&&(t.fields||t.secondaryFields)){let e=[...t.fields??[],...t.secondaryFields??[]].map(e=>[e,a[e]]).filter(([,e])=>!!e);return(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-tp-slot":`panel.section`,children:[e.length>0&&(0,K.jsx)(`div`,{className:`flex flex-wrap items-center gap-2 border-b-hairline border-line bg-inset px-2.5 py-1.5 font-mono text-meta text-muted`,children:e.map(([e,t])=>(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-xs bg-inset px-1.5 py-0.5 font-mono text-meta text-muted`,children:[e,`: `,String(t)]},e))}),r]})}if(e===`panel.tabs`&&(t.fields||t.surface||t.variant)){let e=n,r=t.fields??[`title`];return(0,K.jsxs)(`div`,{className:V1,"data-tp-slot":`panel.tabs`,children:[(0,K.jsx)(`span`,{className:`flex min-w-0 items-center gap-2 truncate`,children:r.map(e=>a[e]?(0,K.jsx)(`span`,{children:String(a[e])},e):null)}),(0,K.jsx)(q,{variant:`action`,onClick:e.onClose,children:`×`})]})}if(e===`status.bar`&&(t.fields||t.secondaryFields)){let e=[...t.fields??[],...t.secondaryFields??[]].map(e=>[e,a[e]]).filter(([,e])=>!!e);return e.length===0?r:(0,K.jsx)(`footer`,{className:B1,"data-tp-slot":`status.bar`,children:e.map(([e,t])=>(0,K.jsx)(`span`,{className:`truncate`,children:String(t)},e))})}return r}function a5({slot:e,data:t,fallback:n}){let r=T1(),i=E1(),a=$1(),o=W(),s=k(f1);if(!i)return n;let c=i.manifest.slots?.[e];if(!c)return n;if(c.hidden)return null;let l=r.slotComponents[e],u=`${i.id}:${i.fingerprint}:${e}`;if(l){let r={slot:e,data:t,defaultNode:n,spec:c,tokens:s,mode:a,locale:o},d=t=>e===`session.body`?(0,K.jsx)(n1,{value:n,children:t}):t,f=X8(i.manifest,e);return(0,K.jsx)(N8,{packId:i.id,slot:e,file:c.component,fallback:n,children:d(f.length>0?(0,K.jsx)(o5,{Comp:l,props:r,kinds:f}):(0,K.jsx)(l,{...r,children:n}))},u)}return c.tree||c.fields||c.secondaryFields||c.surface||c.variant?(0,K.jsx)(N8,{packId:i.id,slot:e,file:j8,fallback:n,children:i5(e,c,t,n,i.manifest.layout?.density)},u):n}function o5({Comp:e,props:t,kinds:n}){let r=(0,J.useContext)(t5),i=Object.fromEntries(n.flatMap(e=>e in r?[[e,r[e]]]:[]));return(0,K.jsx)(e,{...t,data:{...t.data,...i},children:t.defaultNode})}function s5({model:e,children:t}){let n=E1(),r=$1(),i=Object.keys(n?.manifest.slots??{}),a=Z8(e,[...new Set(i.flatMap(e=>X8(n?.manifest,e)))],n?.manifest,r);return(0,J.useEffect)(()=>(t1.set(e),()=>t1.set(null)),[e]),(0,K.jsx)(t5,{value:a,children:t})}G(),A();function c5({className:e}){return(0,K.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,K.jsx)(`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`}),(0,K.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]})}function l5({model:e,narrow:t,onSettings:n,inbox:r}){W();let i=k(K2),a=$(`engines.skill.bannerHintWeb`,{engines:i.join(`, `)});if(ID(`list`,t?{wide:{label:U(`rail.newTask`),note:U(`rail.newTaskMode.${RF()}`),onClick:()=>uR()},capsule:(0,K.jsx)(xa,{settings:{label:i.length>0?`${U(`rail.settings`)}, ${a}`:U(`rail.settings`),onClick:n,glyph:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(c5,{className:sV}),i.length>0&&(0,K.jsx)(`span`,{className:`absolute top-0.75 right-0.75 size-1.5 rounded-full bg-accent`})]})},inbox:{label:U(`rail.inbox`,{count:r.count}),onClick:r.onClick,count:r.count}})}:null),t)return null;let o=(0,K.jsxs)(`div`,{className:aV,children:[!t&&(0,K.jsx)(j3,{client:e.client}),(0,K.jsxs)(`div`,{className:oV,children:[(0,K.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${cV(!1)}`,onClick:n,children:[(0,K.jsx)(c5,{className:uV}),(0,K.jsx)(`span`,{children:U(`rail.settings`)}),i.length>0&&(0,K.jsx)(`span`,{className:`ml-2 min-w-0 truncate text-meta text-subtle`,title:a,children:U(`rail.skillCue`)})]}),(0,K.jsx)(g6,{model:e,bindingId:`settings.open`})]})]});return(0,K.jsx)(a5,{slot:`rail.footer`,data:{unreadCount:r.count,settingsLabel:U(`rail.settings`),usage:[],usageSummary:``,onOpenSettings:n,onOpenInbox:r.onClick},fallback:o})}G(),A(),El(),H();var u5=O({});function d5(e,t,n){let r=u5.get()[`${e}::${t.id}`];return r&&r.sig===Y3(n)&&H3(n.root).some(e=>e.id===r.leaf)?r.leaf:n.activeLeafId}function f5(e,t,n,r){u5.set({...u5.get(),[`${e}::${t}`]:{sig:Y3(n),leaf:r}})}function p5(e,t,n,r){f5(e,t.id,n,r),qc(Tl(e,t.id,r))?.focus()}function m5(e){let{taskId:t,tabId:n}=e.selection.get(),r=t?e.tabs.get()[t]?.find(e=>e.id===n):void 0;return t&&r?{taskId:t,tab:r}:null}async function h5(e,t,n){try{let r=await e.client.request(`tab.split`,t);typeof t.taskId==`string`&&await e.refreshTabsNow(t.taskId),n?.(r)}catch(e){z(e instanceof Error?e.message:String(e),`error`)}}function g5(e,t,n,r,i){let a=i??(n.split?d5(t,n,n.split):`leaf-1`),o=e.selection.get();(o.taskId!==t||o.tabId!==n.id)&&e.select(t,n.id);let s=qc(Tl(t,n.id,a))?.size();h5(e,{taskId:t,tabId:n.id,action:`open`,direction:r,leafId:a,...s},e=>{e.changed?e.split&&f5(t,n.id,e.split,e.leaf):z(U(`layout.splitTooSmall`),`error`)})}function _5(e,t,n,r){let i=n.split,a=i?d5(t,n,i):r,o=()=>h5(e,{taskId:t,tabId:n.id,action:`close`,leafId:r},e=>{let i=e.split;if(!i)return;let o=a!==r&&H3(i.root).some(e=>e.id===a);f5(t,n.id,i,o?a:i.activeLeafId)});if(!i||!q3(n,i,r)){o();return}B.set((0,K.jsx)(Ha,{title:U(`confirm.closePaneTitle`,{pane:K3(i,Ds(n)).get(r)??r}),body:U(`confirm.closePaneBody`),confirmLabel:U(`menu.closePane`),onConfirm:o}))}function v5(e,t,n,r){let i=n.split;i&&B.set((0,K.jsx)(Va,{title:cK(`split.renameTitle`),initial:K3(i,Ds(n)).get(r)??``,allowEmpty:!0,submitLabel:U(`dialog.save`),onSubmit:i=>h5(e,{taskId:t,tabId:n.id,action:`rename`,leafId:r,title:i})}))}function y5(e,t,n,r){return[{label:U(`menu.renamePane`),section:`split`,key:LG(`workspace.split.rename`)??void 0,run:()=>v5(e,t,n,r)},{label:U(`menu.closePane`),section:`split`,key:Ac(`workspace.split.close`)||void 0,run:()=>_5(e,t,n,r)}]}function b5(e,t,n,r){return[{label:U(`menu.splitRight`),section:`split`,key:LG(`workspace.split.right`)??void 0,run:()=>g5(e,t,n,`right`,r)},{label:U(`menu.splitDown`),section:`split`,key:LG(`workspace.split.down`)??void 0,run:()=>g5(e,t,n,`down`,r)}]}function x5(e,t,n,r){let i=n.split,a=r??(i?d5(t,n,i):`leaf-1`);return[...b5(e,t,n,a),...U3(i)?y5(e,t,n,a):[]]}function S5(e,t){let n=e.tabs.get()[t]??[],r=e.selection.get(),i=(r.taskId===t?n.find(e=>e.id===r.tabId):void 0)??rc(n);return!i||!J3(i)?[]:b5(e,t,i,i.split?d5(t,i,i.split):`leaf-1`)}A();function C5(e,{task:t,tab:n,leaf:r}){n.split&&p5(t.id,n,n.split,r),e.select(t.id,n.id)}function w5(e){let{row:t}=e;k(u5);let n=e.selectedTabId===t.tab.id&&!!t.tab.split&&d5(t.task.id,t.tab,t.tab.split)===t.leaf;return(0,K.jsxs)(`button`,{type:`button`,className:`${Aa({size:`pane`})} ${e.cursor?wN:``}`,"aria-current":n||void 0,onClick:e.onClick,onContextMenu:e.onMenu,...e.place,children:[(0,K.jsx)(`span`,{className:nN,"aria-hidden":`true`,children:e.guides?.map((e,t)=>(0,K.jsx)(`span`,{className:aN(e)},t))}),(0,K.jsx)(`span`,{className:`${ja} text-(length:--fs-meta) ${n?`text-ink`:`text-muted`}`,children:t.label})]})}G(),H();function T5({model:e,task:t}){let[n,r]=(0,J.useState)(()=>Hs(e,`task.get`,{taskId:t.id})?.task??null),[i,a]=(0,J.useState)(null),{busy:o,error:s,submit:c}=Ba();(0,J.useEffect)(()=>{Ws(e,`task.get`,{taskId:t.id}).then(e=>r(e.task)).catch(e=>a(Ra(e)))},[e,t.id]);let l=()=>c(async()=>{if(!n?.prompt)return;let t=(await e.client.request(`task.spawn`,{repo:n.repo,prompt:n.prompt,...n.engine?{engine:n.engine}:{},...n.baseRef?{baseBranch:n.baseRef}:{}})).taskIds[0];t&&e.selectWhenListed(t)});return(0,K.jsx)(za,{title:Y(`tasks`,`runAgain.title`),wide:!0,children:(0,K.jsxs)(`form`,{className:Yi,onSubmit:e=>{e.preventDefault(),l()},children:[(0,K.jsx)(`p`,{className:`text-muted`,children:Y(`tasks`,`runAgain.source`,{title:t.label})}),(0,K.jsx)(`pre`,{className:Ci,children:n?.prompt??i??Y(`tasks`,`fieldNotes.loading`)}),(0,K.jsx)(`p`,{className:Si,children:Y(`tasks`,`runAgain.hint`)}),s&&(0,K.jsx)(`p`,{className:`text-error`,children:s}),(0,K.jsx)(Wa,{busy:o||!n?.prompt,submitLabel:Y(`tasks`,`runAgain.confirm`)})]})})}function E5(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function D5({model:e,repo:t}){let[n,r]=(0,J.useState)({kind:`loading`}),[i,a]=(0,J.useState)(0),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(null),u=(0,J.useRef)(null),d=()=>e.client.request(`notes.list`,{repo:t}).then(e=>r({kind:`ready`,notes:e.notes})).catch(e=>r({kind:`error`,message:Ra(e)}));(0,J.useEffect)(()=>void d(),[]);let f=n.kind===`ready`?n.notes:[];(0,J.useEffect)(()=>a(e=>Math.max(0,Math.min(e,f.length-1))),[f.length]),(0,J.useEffect)(()=>{u.current?.querySelector(`.is-selected`)?.scrollIntoView({block:`nearest`})},[i]);let p=async n=>{if(n.id!==void 0){l(null);try{await e.client.request(`notes.delete`,{repo:t,id:n.id}),s(null),await d()}catch(e){l(Ra(e))}}};return(0,K.jsx)(za,{title:Y(`tasks`,`fieldNotes.title`),wide:!0,children:(0,K.jsxs)(`div`,{className:Yi,onKeyDown:e=>{if(!o){if(e.key===`ArrowDown`||e.key===`j`)a(e=>Math.min(f.length-1,e+1));else if(e.key===`ArrowUp`||e.key===`k`)a(e=>Math.max(0,e-1));else if(e.key===`d`&&f[i]?.id!==void 0)s(f[i]??null);else return;e.preventDefault()}},children:[(0,K.jsx)(`p`,{className:`font-mono text-meta break-all text-muted`,children:t}),n.kind===`loading`&&(0,K.jsx)(`p`,{className:`text-muted`,children:Y(`tasks`,`fieldNotes.loading`)}),n.kind===`error`&&(0,K.jsx)(`p`,{className:`text-error`,children:n.message}),n.kind===`ready`&&f.length===0&&(0,K.jsx)(`p`,{className:`text-muted`,children:Y(`tasks`,`fieldNotes.empty`)}),f.length>0&&(0,K.jsx)(`ul`,{className:`m-0 list-none p-0 flex max-h-[44vh] flex-col gap-2 overflow-y-auto`,ref:u,children:f.map((e,t)=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,className:wi(t===i),onClick:()=>a(t),autoFocus:t===0,children:[(0,K.jsxs)(`span`,{className:`font-mono text-meta whitespace-pre text-accent`,children:[t===i?`▸ `:` `,E5(e.at),`, `,e.author]}),(0,K.jsx)(`span`,{className:`text-ink whitespace-pre-wrap wrap-anywhere`,children:e.text})]})},`${e.at}:${t}`))}),o&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-paper px-3 py-2.5`,children:[(0,K.jsx)(`p`,{children:(0,K.jsx)(`strong`,{children:Y(`tasks`,`fieldNotes.confirmDelete.title`)})}),(0,K.jsx)(`p`,{className:`text-muted`,children:Y(`tasks`,`fieldNotes.confirmDelete.body`,{text:o.text})}),c&&(0,K.jsx)(`p`,{className:`text-error`,children:c}),(0,K.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5 w-narrow:grid w-narrow:auto-cols-fr w-narrow:grid-flow-col w-narrow:items-stretch w-narrow:gap-2.5 w-narrow:[&>:is(a,button)]:inline-flex w-narrow:[&>:is(a,button)]:min-h-11! w-narrow:[&>:is(a,button)]:items-center w-narrow:[&>:is(a,button)]:justify-center w-narrow:[&>:is(a,button)]:px-3.5 w-narrow:[&>:is(a,button)]:py-1.5 w-narrow:[&>:is(a,button)]:text-center w-narrow:[&>:is(a,button)]:text-body w-narrow:[&>.link]:rounded-sm w-narrow:[&>.link]:border-hairline w-narrow:[&>.link]:border-line w-narrow:[&>.link]:bg-inset w-narrow:[&>.link]:text-ink w-narrow:[&>.link]:no-underline! w-narrow:[&>.link]:active:scale-97 w-narrow:[&>.link]:motion-reduce:active:scale-none`,children:[(0,K.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>s(null),children:U(`dialog.cancel`)}),(0,K.jsx)(`button`,{type:`button`,className:vi({danger:!0}),onClick:()=>void p(o),children:U(`taskops.retire`)})]})]}),!o&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`keys-only font-sans text-meta text-subtle`,children:Y(`tasks`,`fieldNotes.footerDeletable`)}),(0,K.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5 w-narrow:grid w-narrow:auto-cols-fr w-narrow:grid-flow-col w-narrow:items-stretch w-narrow:gap-2.5 w-narrow:[&>:is(a,button)]:inline-flex w-narrow:[&>:is(a,button)]:min-h-11! w-narrow:[&>:is(a,button)]:items-center w-narrow:[&>:is(a,button)]:justify-center w-narrow:[&>:is(a,button)]:px-3.5 w-narrow:[&>:is(a,button)]:py-1.5 w-narrow:[&>:is(a,button)]:text-center w-narrow:[&>:is(a,button)]:text-body w-narrow:[&>.link]:rounded-sm w-narrow:[&>.link]:border-hairline w-narrow:[&>.link]:border-line w-narrow:[&>.link]:bg-inset w-narrow:[&>.link]:text-ink w-narrow:[&>.link]:no-underline! w-narrow:[&>.link]:active:scale-97 w-narrow:[&>.link]:motion-reduce:active:scale-none`,children:[(0,K.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,disabled:f[i]?.id===void 0,onClick:()=>s(f[i]??null),children:U(`taskops.retire`)}),(0,K.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:ce,children:U(`taskops.close`)})]})]})]})})}G(),He(),H();var O5=[`backlog`,`in_progress`,`in_review`,`done`,`canceled`,`error`],k5={backlog:`status.backlog`,in_progress:`status.inProgress`,in_review:`status.inReview`,done:`status.done`,canceled:`status.canceled`,error:`status.error`},A5=e=>({binding:e,key:LG(e)??void 0});async function j5(e,t){if(!e){z(U(`menu.nothingToCopy`,{what:t}),`error`);return}try{await navigator.clipboard.writeText(e),z(U(`menu.copied`,{text:e}))}catch{z(U(`menu.copyFailed`),`error`)}}function M5(e,t,n){let r=[{label:U(`menu.newTask`),section:`open`,run:()=>uR(t)}],i=(n,i,a)=>{i!==null&&r.push({label:n,section:`edit`,run:()=>void e.client.request(`project.move`,{repo:t,target:i,side:a}).catch(e=>z(Y(`tasks`,`toast.moveFailed`,{error:String(e)}),`error`))})};return i(Y(`tasks`,`menu.moveToTop`),n.top,`before`),i(Y(`tasks`,`menu.moveProjectUp`),n.above,`before`),i(Y(`tasks`,`menu.moveProjectDown`),n.below,`after`),r.push({label:U(`menu.viewSessions`),section:`open`,run:()=>Oe(t)}),r.push({label:Y(`tasks`,`menu.fieldNotes`),section:`notes`,run:()=>B.set((0,K.jsx)(D5,{model:e,repo:t}))}),n.local&&r.push({label:Y(`tasks`,`menu.forgetProject`),section:`danger`,danger:!0,run:()=>B.set(jq(e,t,n.label))}),r}function N5(e){return[{label:U(`menu.newChatNoFolder`),section:`open`,run:()=>dR()},{label:U(`menu.newShell`),section:`open`,run:()=>void YI(e).catch(e=>z(String(e),`error`))}]}function P5(){OG(!DG.get()),document.querySelector(`.rail`)?.focus()}function bne(e,t,n){let r=ms(t),i=n.filter(e=>!e.startsWith(`ssh://`)&&(r||e!==t.repo)),a=i.map(e=>{let t=e.slice(e.lastIndexOf(`/`)+1);return{value:e,label:i.filter(e=>e.endsWith(`/${t}`)).length>1?e:t}});return t.kind===`dir`&&!r&&a.unshift({value:``,label:Y(`tasks`,`moveToProject.ungrouped`)}),a.length===0?(z(Y(`tasks`,`moveToProject.empty`),`error`),null):(0,K.jsx)(Ua,{title:Y(`tasks`,`moveToProject.title`),choices:a,onPick:async n=>{await e.client.request(`task.moveToProject`,{taskId:t.id,repo:n||null}),z(Y(`tasks`,`toast.movedToProject`,{project:a.find(e=>e.value===n)?.label??n}))}})}function xne(e,t){return{left:{label:Y(`tasks`,`menu.archive`),tone:`neutral`,run:()=>void Aq(e,t)},right:{label:t.pinned?U(`menu.unpin`):U(`menu.pin`),tone:`accent`,run:()=>void e.act(`task.pin`,{taskId:t.id,pinned:!t.pinned}).catch(e=>z(String(e),`error`))}}}function F5(e,t,n){let r=e.client,i=[];n&&(i.push({label:U(`menu.closeTab`),section:`tab`,run:()=>B.set((0,K.jsx)(Ha,{title:U(`confirm.closeTabTitle`,{tab:n.title??n.engineName??n.id}),body:U(`confirm.closeTabBody`),confirmLabel:U(`menu.closeTab`),onConfirm:async()=>{await e.closeTab(t.id,n.id)}}))}),i.push(...x5(e,t.id,n))),i.push({label:U(`menu.newChat`),section:`open`,run:()=>void qI(e,t.id)}),i.push({label:U(`menu.newChatPick`),section:`open`,rare:!0,run:()=>B.set((0,K.jsx)(TK,{model:e,taskId:t.id}))}),i.push({label:U(`menu.continueEngine`),section:`open`,rare:!0,...A5(`chat.tab.fork`),run:()=>B.set((0,K.jsx)(TK,{model:e,taskId:t.id,context:`continue`,sourceTabId:n?.id}))}),i.push({label:U(`menu.newShell`),section:`open`,run:()=>void JI(e,t.id,{kind:`shell`}).catch(e=>z(String(e),`error`))}),t.kind===`task`&&t.ownsBranch===!0&&t.branch&&!t.sharesWorkspaceOf&&!t.machine&&!t.extraRepoCount&&i.push({label:Y(`tasks`,`menu.newTaskFromBranch`),section:`open`,rare:!0,run:()=>ie({repo:t.repo,baseBranch:t.branch,worktree:!0})}),t.startsAt&&(i.push({label:U(`menu.startNow`),section:`open`,run:()=>void e.client.request(`task.startScheduledNow`,{taskId:t.id}).catch(e=>z(String(e),`error`))}),i.push({label:U(`menu.cancelStart`),section:`open`,run:()=>void e.client.request(`task.cancelScheduledStart`,{taskId:t.id}).catch(e=>z(String(e),`error`))})),t.hasPrompt&&(i.push({label:Y(`tasks`,`menu.runAgain`),section:`open`,run:()=>B.set((0,K.jsx)(T5,{model:e,task:t}))}),i.push({label:U(`menu.retryEdit`),section:`open`,rare:!0,run:()=>void SI(e,t)}));let a=!t.machine;if(a&&i.push({label:Y(`tasks`,`menu.openEditor`),section:`open`,...A5(`tasks.openWorktree`),run:()=>void Dq(e,t.id)}),t.groupId){let e=t.groupId;i.push({label:U(`compare.menu`),section:`open`,run:()=>De(e)})}i.push({label:U(`menu.rename`),section:`edit`,...A5(`sidebar.rename`),run:()=>B.set((0,K.jsx)(Va,{title:U(`menu.rename`),initial:t.title,submitLabel:U(`dialog.save`),onSubmit:n=>e.act(`task.rename`,{taskId:t.id,title:n}).then(()=>{})}))}),i.push({label:t.pinned?U(`menu.unpin`):U(`menu.pin`),section:`edit`,...A5(`sidebar.pin`),run:()=>void e.act(`task.pin`,{taskId:t.id,pinned:!t.pinned}).catch(e=>z(String(e),`error`))}),a&&!t.archived&&i.push({label:Y(`tasks`,`menu.reorder`),section:`edit`,rare:!0,...A5(`sidebar.localMerge`),run:()=>P5()}),i.push({label:U(`menu.setStatus`),section:`edit`,children:O5.map(n=>({label:U(k5[n]),checked:n===t.status,run:()=>void e.act(`task.setStatus`,{taskId:t.id,status:n}).catch(e=>z(String(e),`error`))}))}),a&&!t.routine&&!t.parentTaskId&&!t.extraRepoCount&&i.push({label:Y(`tasks`,`menu.moveToProject`),section:`edit`,rare:!0,run:()=>void e.client.request(`repos.list`).then(n=>{let r=bne(e,t,n.repos);r&&B.set(r)}).catch(e=>z(String(e),`error`))}),a&&i.push({label:U(`menu.changeEngine`),section:`edit`,rare:!0,...A5(`tasks.cycleEngine`),run:()=>B.set((0,K.jsx)(QU,{model:e,current:async()=>(await e.client.request(`task.get`,{taskId:t.id})).task,onSet:async n=>{await e.client.request(`task.setEngine`,{taskId:t.id,engine:n.engine.id,...n.effort===void 0?{}:{effort:n.effort},...n.model===void 0?{}:{model:n.model}}),z(Y(`tasks`,`toast.engineSwitched`,{engine:n.engine.name}))}}))}),t.pr?.checkState===`failing`&&i.push({label:Y(`tasks`,`menu.fixChecks`),section:`git`,key:Ac(`files.fixChecks`),run:()=>void Eq(e,t.id,U(`taskops.fixSent`))}),t.kind===`task`&&t.branch&&a&&i.push({label:Y(`tasks`,`menu.syncBase`),section:`git`,rare:!0,key:Ac(`files.syncBase`),run:()=>void wq(e,t.id)}),t.branch&&i.push({label:U(`menu.renameBranch`),section:`git`,rare:!0,...A5(`tasks.renameBranch`),run:()=>B.set((0,K.jsx)(Va,{title:U(`menu.renameBranch`),initial:t.branch,submitLabel:U(`dialog.save`),onSubmit:e=>r.request(`task.setBranch`,{taskId:t.id,branch:e}).then(()=>{})}))}),t.kind===`task`&&t.branch&&i.push({label:U(`menu.land`),section:`git`,run:()=>void Sq(e,t)});let o=[{label:U(`menu.copyWhat.id`),run:()=>void j5(t.id,U(`menu.what.id`))}];return t.branch&&o.push({label:U(`menu.copyWhat.branch`),run:()=>void j5(t.branch,U(`menu.what.branch`))}),o.push({label:U(`menu.copyWhat.path`),run:()=>void r.request(`task.get`,{taskId:t.id}).then(e=>j5(e.task.worktreePath,U(`menu.what.path`))).catch(e=>z(String(e),`error`))}),i.push({label:U(`menu.copy`),section:`copy`,children:o}),i.push({label:Y(`tasks`,t.archived?`menu.unarchive`:`menu.archive`),section:`danger`,run:()=>void Aq(e,t)}),i.push({label:U(`menu.removeSession`),section:`danger`,...A5(`sidebar.delete`),danger:!0,run:()=>B.set(kq(e,t))}),i}G(),He(),A(),H();var I5=`rove.collapsedProjects`,L5=`rove.foldedTasks`,R5=`rove.openedTasks`,Sne=600;function z5(e){try{let t=JSON.parse(localStorage.getItem(e)??`[]`);return new Set(Array.isArray(t)?t.filter(e=>typeof e==`string`):[])}catch{return new Set}}function B5(e,t){try{localStorage.setItem(e,JSON.stringify([...t]))}catch{}}var Cne=(e,t)=>{let n=new Set(e);return n.delete(t)||n.add(t),n};function wne(){let e=k(CG),[t,n]=(0,J.useState)({active:!1,query:``}),[r,i]=(0,J.useState)(()=>z5(I5)),a=e=>i(t=>{let n=Cne(t,e);return B5(I5,n),n}),[o,s]=(0,J.useState)(()=>({folded:z5(L5),opened:z5(R5)}));return{sort:e,cycleSort:EG,search:t,setSearch:n,collapsed:r,toggleProject:a,hand:o,toggleTaskFold:(e,t)=>s(n=>{let r=new Set(n.folded),i=new Set(n.opened);return t?(r.delete(e),i.add(e)):(i.delete(e),r.add(e)),B5(L5,r),B5(R5,i),{folded:r,opened:i}})}}var Tne=[`sidebar.nav`,`sidebar.goto`,`sidebar.select`,`sidebar.tree.open`,`sidebar.rename`,`sidebar.pin`,`sidebar.localMerge`,`sidebar.delete`,`sidebar.sort`,`sidebar.search.enter`,`tasks.renameBranch`,`tasks.cycleEngine`,`tasks.openWorktree`,`tasks.update`,`tasks.focusEngine`,`task.new`,`settings.open.sidebar`,`worktrees.open.sidebar`];function Ene(e){for(let t of e)for(let e of Tne){let n=kc(e).indexOf(t);if(n>=0)return{id:e,slot:n}}return null}function Dne(e,t){let n=e.selection.get().taskId===t;e.select(t),Ie(),n&&!cR(e.client)&&uc()}function One(e,t,n,r){let{search:i,setSearch:a}=n,[o,s]=(0,J.useState)(null),c=(0,J.useRef)(0),l=t.filter(e=>e.kind!==`project`&&e.kind!==`state`),u=l.findIndex(e=>e.id===o);(0,J.useEffect)(()=>{u<0&&s(r.selectedId&&l.some(e=>e.id===r.selectedId)?r.selectedId:l[0]?.id??null)},[u,l,r.selectedId]);let d=l[u],f=d?.kind===`task`||d?.kind===`pane`?d.task.id:null;(0,J.useEffect)(()=>Bq.set(f),[f]);let p=l[0]?.id??null;(0,J.useEffect)(()=>{i.query,i.active&&s(p)},[i.active,i.query,p]);let m=e=>{let t=l[Math.max(0,Math.min(l.length-1,e))];t&&s(t.id)},h=t=>{t?.kind===`task`&&e.select(t.task.id),t?.kind===`round`&&De(t.groupId),t?.kind===`pane`&&C5(e,t),t&&Ie()},g=(t,n)=>{t?.kind===`task`&&R(F5(e,t.task,null),n)?.run?.()},_=async t=>{if(t?.kind===`task`&&t.machine===void 0)try{let{engines:n}=await e.client.request(`engines.list`),r=QN(n).filter(e=>e.ready!==!1),i=r[(r.findIndex(e=>e.id===t.task.engine?.id)+1)%r.length];if(!i||i.id===t.task.engine?.id)return;await e.client.request(`task.setCommand`,{taskId:t.task.id,engine:i.id}),z(U(`rail.engineSwitched`,{engine:i.name}))}catch(e){z(U(`rail.engineSwitchFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}};return{cursor:o,setCursor:s,onKeyDown:t=>{let o=l[u],s=t.target instanceof HTMLInputElement;if(i.active){if(t.metaKey||t.ctrlKey||t.altKey)return;if(t.key===`Escape`)a({active:!1,query:``});else if(t.key===`Enter`)h(o),a({active:!1,query:``});else if(t.key===`ArrowDown`)m(u+1);else if(t.key===`ArrowUp`)m(u-1);else if(t.key===`Backspace`&&!s)a(e=>({...e,query:e.query.slice(0,-1)}));else if(t.key.length===1&&!s)a(e=>({...e,query:e.query+t.key}));else return;t.preventDefault();return}let d=Ene(QG(t));if(DG.get()){let n=o?.kind===`task`&&o.machine===void 0;if(d?.id===`sidebar.nav`)n&&kG(e,o,d.slot%2==0?1:-1);else if(d?.id===`sidebar.localMerge`||t.key===`Enter`||t.key===`Escape`)OG(!1);else return;t.preventDefault();return}switch(d?.id){case`sidebar.nav`:m(d.slot%2==0?u+1:u-1);break;case`sidebar.goto`:d.slot%2==1?m(l.length-1):Date.now()-c.current<Sne?(m(0),c.current=0):c.current=Date.now();break;case`sidebar.select`:case`sidebar.tree.open`:h(o);break;case`tasks.focusEngine`:uc();break;case`sidebar.rename`:case`sidebar.pin`:case`sidebar.delete`:case`tasks.renameBranch`:case`tasks.openWorktree`:g(o,d.id);break;case`tasks.cycleEngine`:_(o);break;case`sidebar.localMerge`:o?.machine===void 0&&OG(!0);break;case`sidebar.sort`:n.cycleSort(),z(Y(`tasks`,`sort.label`,{mode:Y(`tasks`,`sort.modes.${CG.get()}`)}));break;case`sidebar.search.enter`:a({active:!0,query:``});break;case`task.new`:r.onNewTask(o?.kind===`task`||o?.kind===`pane`?o.task.repo:void 0,o?.machine);break;case`settings.open.sidebar`:r.onSettings();break;case`worktrees.open.sidebar`:Ee(`worktrees`);break;case`tasks.update`:Ee(`update`);break;default:return}t.preventDefault()},onPress:e=>{let t=e.target.closest(`[data-row]`)?.dataset.row;t&&s(t)}}}var kne=(e,t,n)=>`~pane:${e}:${t}:${n}`;function Ane(e,t){return e.flatMap(e=>e.kind===`task`?[e,...(t[e.task.id]??[]).flatMap(t=>{let n=t.split;if(!n||!U3(n))return[];let r=K3(n,Ds(t));return H3(n.root).map(n=>({id:kne(e.task.id,t.id,n.id),kind:`pane`,task:e.task,tab:t,leaf:n.id,label:r.get(n.id)??n.id,depth:e.depth+1,...e.machine===void 0?{}:{machine:e.machine}}))})]:[e])}G();function jne(e){return e?.match(/^https?:\/\/[^/]+\/([^/]+\/[^/]+)\/(?:pull|merge_requests|-\/merge_requests)\//)?.[1]}var Mne=e=>e.charAt(0).toUpperCase()+e.slice(1);function Nne(e){return[U(`rail.pr.state.${e.state}`),...e.checks?[U(`rail.pr.checks.${e.checks}`)]:[]].join(`, `)}function V5(e){let t=new Map;for(let n of e){let e=JP(n),r=[...e&&n.pr?[{pr:n.pr,mark:e}]:[],...(n.sessionPrs??[]).flatMap(e=>{let t=YP(e);return t?[{pr:e,mark:t}]:[]})];for(let{pr:e,mark:i}of r){let r=e.url??(e.number===void 0?n.id:`${n.repo}#${e.number}`),a=t.get(r),o=e.lifecycle===`unknown`,s=a?.pr.lifecycle===`unknown`;(!a||s&&!o||o===s&&XP([a.mark,i])!==a.mark)&&t.set(r,{task:n,pr:e,mark:i})}}return[...t.values()]}var H5={open:0,merged:1,closed:2},Pne=e=>[...e].sort((e,t)=>H5[e.mark.state]-H5[t.mark.state]),U5=(e,t)=>t.url??`${e.id}#${t.number??``}`;function W5({task:e,pr:t,mark:n}){let r=jne(t.url),i=t.additions!==void 0&&t.deletions!==void 0;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:fN,children:t.title||e.label}),(0,K.jsxs)(`span`,{className:pN,children:[(0,K.jsxs)(`span`,{className:`${mN} ${n.tone}`,children:[(0,K.jsx)(`span`,{className:hN,children:n.glyph}),Mne(U(`rail.pr.state.${n.state}`))]}),(0,K.jsx)(`span`,{className:gN,children:[...n.checks?[U(`rail.pr.checks.${n.checks}`)]:[],[r,t.number===void 0?``:`#${t.number}`].filter(Boolean).join(` `)].filter(Boolean).map(e=>`, ${e}`).join(``)}),i&&(0,K.jsxs)(`span`,{className:`ml-auto flex gap-1.5 pl-3 tabular-nums`,children:[(0,K.jsxs)(`span`,{className:`text-success`,children:[`+`,t.additions]}),(0,K.jsxs)(`span`,{className:`text-error`,children:[`−`,t.deletions]})]})]})]})}var G5=(e,t)=>e.length===1?`PR #${e[0]?.pr.number??``}, ${Nne(t)}`:U(`rail.pr.many`,{count:e.length});function Fne({entries:e,lead:t}){let[n,r]=(0,J.useState)(!1);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:lN,"data-pr-chip":!0,"aria-label":G5(e,t),onClick:e=>{e.stopPropagation(),TD(),r(!0)},children:(0,K.jsxs)(`span`,{className:`${uN} ${t.tone}`,children:[t.glyph,e.length>1&&(0,K.jsx)(`span`,{className:`font-sans`,children:e.length})]})}),n&&(0,K.jsx)(`span`,{className:`contents`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),children:(0,K.jsx)(gO,{label:G5(e,t),title:e.length>1?G5(e,t):void 0,onClose:()=>r(!1),children:t=>(0,K.jsx)(`div`,{className:`flex min-h-0 flex-col overflow-y-auto px-3 pb-1 max-h-[60dvh] overscroll-contain`,"data-pr-sheet":!0,children:Pne(e).map(e=>(0,K.jsx)(_O,{stacked:!0,disabled:!e.pr.url,onClick:()=>{t(),window.open(e.pr.url,`_blank`,`noopener`)},children:(0,K.jsx)(W5,{...e})},U5(e.task,e.pr)))})})})]})}function K5({tasks:e,onOpen:t,sheet:n}){if(n){let t=V5(e),n=XP(t.map(e=>e.mark));return n?(0,K.jsx)(Fne,{entries:t,lead:n}):null}return(0,K.jsx)(Ine,{tasks:e,onOpen:t})}function Ine({tasks:e,onOpen:t}){let[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(!1),o=(0,J.useRef)(null),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=lA();(0,J.useLayoutEffect)(()=>{let e=c.current;if(!e||!n)return;let t=e.getBoundingClientRect();t.right>window.innerWidth-8&&(e.style.left=`${Math.max(8,window.innerWidth-t.width-8)}px`,e.style.top=`${n.bottom+6}px`);let r=e.getBoundingClientRect().bottom-(window.innerHeight-8);r>0&&(e.style.top=`${Math.max(8,e.getBoundingClientRect().top-r)}px`)},[n]);let u=()=>{t?.(),s.current!==null&&window.clearTimeout(s.current),s.current=null,a(!1),o.current&&!n&&r(o.current.getBoundingClientRect())},d=()=>{a(!0),s.current=window.setTimeout(()=>r(null),140)};(0,J.useEffect)(()=>{if(!l||!n)return;let e=e=>{let t=e.target;o.current?.contains(t)||c.current?.contains(t)||(a(!0),s.current=window.setTimeout(()=>r(null),140))};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[l,n]),(0,J.useEffect)(()=>()=>{s.current!==null&&window.clearTimeout(s.current)},[]);let f=V5(e),p=XP(f.map(e=>e.mark));if(!p)return null;let m=G5(f,p);return(0,K.jsxs)(`span`,{ref:o,className:`chip ${cN} ${p.tone}`,"aria-label":m,onMouseEnter:l?void 0:u,onMouseLeave:l?void 0:d,onClick:e=>{l&&(e.stopPropagation(),n&&!i?d():u())},children:[p.glyph,f.length>1&&(0,K.jsx)(`span`,{className:`font-sans`,children:f.length}),n&&(0,rO.createPortal)((0,K.jsx)(`div`,{ref:c,className:dN(i),style:{top:n.top-6,left:n.right+8},onMouseEnter:l?void 0:u,onMouseLeave:l?void 0:d,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),children:f.map(({task:e,pr:t,mark:n})=>(0,K.jsx)(`button`,{type:`button`,className:`flex flex-col gap-1 rounded-[calc(var(--radius)-6px)] px-3 py-2 text-left font-sans enabled:hover:bg-hover`,disabled:!t?.url,onClick:()=>t?.url&&window.open(t.url,`_blank`,`noopener`),children:(0,K.jsx)(W5,{task:e,pr:t,mark:n})},U5(e,t)))}),document.body)]})}var Lne=450,q5=e=>{let t=e.querySelector(`.row-title`);return!!t&&t.scrollWidth>t.clientWidth};function Rne(e,t){let n=(0,J.useRef)(null),r=(0,J.useRef)(null),i=(0,J.useRef)(e);i.current=e;let a=()=>{n.current!==null&&window.clearTimeout(n.current),n.current=null},o=e=>{a(),n.current=window.setTimeout(()=>XM(e,i.current,`right`),Lne)},s=()=>{a(),ZM()};return(0,J.useEffect)(()=>{let e=r.current,n=e?.closest(`.rail`);if(!t||!e||!n||!qM()||!n.contains(document.activeElement)||!q5(e))return;let i=e=>{e.relatedTarget instanceof Node&&n.contains(e.relatedTarget)||s()};return o(e),n.addEventListener(`focusout`,i),()=>{n.removeEventListener(`focusout`,i),s()}},[t]),(0,J.useEffect)(()=>()=>{n.current!==null&&window.clearTimeout(n.current)},[]),{ref:e=>{r.current=e},onPointerEnter:e=>{e.pointerType===`touch`||!q5(e.currentTarget)||o(e.currentTarget)},onPointerLeave:s,hide:s}}var zne={info:`text-info`,success:`text-success`,warning:`text-warning`,error:`text-error`};function Bne(e){return e.tokens?.map(e=>(0,K.jsx)(`span`,{className:`max-w-32 truncate ${zne[e.tone??``]??`text-subtle`}`,title:e.source,children:e.text},`${e.source}:${e.text}`))}G();function Vne({at:e}){let t=new Date(e);if(Number.isNaN(t.getTime()))return null;let n=$F(t);return(0,K.jsxs)(`span`,{className:`text-subtle`,title:U(`rail.startsAt`,{time:t.toLocaleString()}),children:[`◷ `,n]})}G(),He();function Hne(e){let{repo:t,label:n,collapsed:r}=e,i=U(r?`rail.expandGroup`:`rail.collapseGroup`,{name:n});return(0,K.jsxs)(K.Fragment,{children:[t&&(0,K.jsx)(`button`,{type:`button`,className:ON,title:t,onClick:()=>Oe(t),children:(0,K.jsx)(`span`,{className:`truncate`,children:n})}),(0,K.jsxs)(`button`,{type:`button`,className:`${kN} ${t?`min-w-6 shrink-0 justify-center`:`-ml-1`}`,"aria-label":t?i:void 0,"aria-expanded":!r,title:i,onClick:e.onToggle,children:[!t&&(0,K.jsx)(`span`,{className:`truncate`,children:n}),(0,K.jsx)(tI,{right:r,className:AN(r)})]}),e.onNewTask&&(0,K.jsx)(`button`,{type:`button`,className:jN,title:U(`rail.newTask`),onClick:e.onNewTask,children:`+`})]})}G();function Une(e){let{row:t}=e,n=E1(),r=$1(),i=Rne(t.kind===`task`?t.task.label:``,e.cursor&&t.kind===`task`),a=e.cursor?wN:``;if(t.kind===`project`||t.kind===`state`){let n=(0,K.jsx)(`h2`,{className:TN({moving:e.moving,dragging:e.dragging,grab:e.drag!==void 0}),onContextMenu:e.onMenu,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},...e.place,...e.drag,children:(0,K.jsx)(Hne,{label:t.label,repo:t.kind===`project`&&!t.noProject?t.repo:void 0,collapsed:!!e.collapsed,onToggle:e.onClick,onNewTask:e.onNewTask})});return(0,K.jsx)(a5,{slot:`rail.groupHeader`,data:J5(e),fallback:n})}let o=t.task,s=o.rowStatus?.kind===`running`,c=hq(o),l=UB(),u=UP(o,e.tabs),d=l===`engine`&&!u,f=t.fold?.collapsed?e.rollup:o.rowStatus,p=(0,K.jsxs)(`button`,{type:`button`,ref:i.ref,className:`group/row ${Aa({selected:e.selected,moving:e.moving,lifted:e.dragging,grab:e.drag!==void 0})} ${a}`,onClick:e.onClick,onContextMenu:e.onMenu,onPointerEnter:i.onPointerEnter,onPointerLeave:i.onPointerLeave,...e.place,...e.drag,children:[e.guides&&(0,K.jsx)(`span`,{className:`-mr-0.5 ml-0 flex flex-none self-stretch`,"aria-hidden":`true`,children:e.guides.map((e,t)=>(0,K.jsx)(`span`,{className:aN(e)},t))}),l!==`dots`&&(0,K.jsx)(VF,{icon:e.engineIcon,name:o.engine?.name,status:d?HP(f):void 0,blank:u}),(0,K.jsx)(`span`,{className:`${Ma} ${e.stale?`text-subtle`:``} ${s?Na:``}`,children:t.attempt??o.label}),(0,K.jsxs)(`span`,{className:`${Ia} ml-auto items-center`,children:[(0,K.jsx)(Bne,{tokens:o.rowTokens}),e.repo&&(0,K.jsx)(`span`,{className:`max-w-24 truncate text-subtle`,children:e.repo}),t.level!==void 0&&(0,K.jsx)(`span`,{className:`text-subtle`,children:t.level}),(o.extraRepoCount??0)>0&&(0,K.jsxs)(`span`,{className:`text-subtle`,title:U(o.extraRepoCount===1?`rail.extraReposOne`:`rail.extraRepos`,{count:o.extraRepoCount??0}),children:[`+`,o.extraRepoCount]}),c&&(0,K.jsxs)(`span`,{className:`text-subtle tabular-nums`,title:U(c.total===1?`rail.todosOne`:`rail.todos`,c),children:[c.done,`/`,c.total]}),t.fold&&(0,K.jsx)(Wne,{fold:t.fold,onToggle:e.onToggleFold}),o.kept&&(0,K.jsx)(`span`,{className:`text-accent`,title:U(`compare.kept`),children:`✓`}),o.pinned&&(0,K.jsx)(`span`,{className:`text-subtle`,children:`▴`}),o.startsAt&&(0,K.jsx)(Vne,{at:o.startsAt}),(0,K.jsx)(K5,{tasks:e.prTasks??[o],onOpen:i.hide}),e.cloud&&(0,K.jsx)(IN,{label:e.cloud,onOpen:i.hide}),!d&&(0,K.jsx)(iF,{status:f})]})]}),m=e.swipe?(0,K.jsx)(TO,{left:e.swipe.left,right:e.swipe.right,ground:`paper`,children:p}):p;return(0,K.jsx)(a5,{slot:`rail.row`,data:Y5(e,n?.manifest,r),fallback:m})}function J5(e){let t=e.row;return{id:t.id,kind:t.kind,label:t.label,repo:t.kind===`project`&&!t.noProject?t.repo:void 0,count:e.count??0,collapsed:!!e.collapsed,onToggle:()=>e.onClick(),onNewTask:e.onNewTask}}function Y5(e,t,n){let r=e.row,i=r.task,a=r.fold?.collapsed?e.rollup:i.rowStatus,o=i.changes&&!(`unreadable`in i.changes)?{files:0,added:i.changes.added,removed:i.changes.deleted}:void 0,s=i.activity?.forMs,c=s===void 0?void 0:s<6e4?`${Math.max(1,Math.round(s/1e3))}s`:s<36e5?`${Math.round(s/6e4)}m`:`${Math.round(s/36e5)}h`;return{id:i.id,title:r.attempt??i.label,branch:i.branch||void 0,repo:e.repo??(i.repo?i.repo.split(`/`).pop():void 0),worktree:U8(i),engineId:i.engine?.id??void 0,engineName:i.engine?.name,model:i.model,engineFamily:i.engine?.protocol,engineColor:L8(t,i.engine,n),statusKind:a?.kind??`idle`,statusLabel:a?.kind??`idle`,selected:e.selected,cursor:e.cursor,stale:e.stale,pinned:!!i.pinned,depth:r.depth,pr:i.pr?.number?{number:i.pr.number,state:i.pr.lifecycle,url:i.pr.url}:void 0,todos:hq(i)??void 0,tokens:i.rowTokens?.map(e=>({key:e.source,text:e.text})),age:c,cloud:e.cloud,diffStats:o,onSelect:()=>e.onClick(),onMenu:t=>e.onMenu(t)}}function Wne(e){let{collapsed:t}=e.fold,n=Y(`tasks`,t?`menu.expandChildren`:`menu.collapseChildren`);return(0,K.jsxs)(`span`,{role:`button`,tabIndex:-1,"aria-label":n,"aria-expanded":!t,className:`${oN} ${t?``:sN}`,title:n,onClick:t=>{t.stopPropagation(),e.onToggle()},children:[t&&e.fold.count,(0,K.jsx)(tI,{right:t})]})}G(),A(),Ur();var Gne=1500,Kne=8e3;function X5(e,t){let n=k(e.conn).state!==`open`,[r,i]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{if(i(!1),!n)return;let e=window.setTimeout(()=>i(!0),t);return()=>window.clearTimeout(e)},[n,t]),n&&r}function qne({model:e,narrow:t}){let n=e.client,r=k(n.conn),i=k(e.tasks),a=k(e.selection),o=E1(),s=ec(i,a.taskId),c=X5(n,t?Kne:r.state===`connecting`?Gne:0),l=o?.manifest.layout?.statusBar??`auto`,u=!!o?.manifest.slots?.[`status.bar`];if(l===`hidden`&&!c||!c&&l!==`always`&&!u)return null;let d=s?.changes&&!(`unreadable`in s.changes)?{files:0,added:s.changes.added,removed:s.changes.deleted}:void 0,f=c?(0,K.jsxs)(`footer`,{className:jr,children:[(0,K.jsx)(`span`,{className:Mr(r.state===`retrying`)}),(0,K.jsx)(`span`,{children:r.state===`retrying`?U(`status.retrying`,{count:r.failures}):U(`status.connecting`)}),r.state===`retrying`&&(0,K.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>n.retryNow(),children:U(`status.retry`)})]}):(0,K.jsxs)(`footer`,{className:B1,children:[(0,K.jsx)(`span`,{children:r.state}),s?.label&&(0,K.jsx)(`span`,{className:`truncate text-ink`,children:s.label}),s?.branch&&(0,K.jsx)(`span`,{className:`truncate`,children:s.branch}),s?.engine?.name&&(0,K.jsx)(`span`,{children:s.engine.name})]});return(0,K.jsx)(a5,{slot:`status.bar`,data:{connection:r.state===`open`?`open`:r.state===`retrying`?`retrying`:`connecting`,failures:r.failures,taskTitle:s?.label,branch:s?.branch,engineName:s?.engine?.name,statusKind:s?.rowStatus?.kind,diffStats:d,usageSummary:``,onRetry:()=>n.retryNow()},fallback:f})}G(),He(),A(),H();function Jne(e){let{row:t}=e,n=k(Pe),r=E1(),i=$1();if(t.kind===`project`||t.kind===`state`){let n=(0,K.jsx)(`h2`,{className:`${TN({moving:e.moving,dragging:!1,grab:!1})} narrow:mb-0`,onContextMenu:e.onMenu,...e.place,children:(0,K.jsx)(iG,{label:t.label,collapsed:!!e.collapsed,foldLabel:U(e.collapsed?`rail.expandGroup`:`rail.collapseGroup`,{name:t.label}),onToggle:e.onClick,add:e.onNewTask?{label:U(`rail.newTask`),onClick:e.onNewTask}:void 0})});return(0,K.jsx)(a5,{slot:`phone.groupHeader`,data:J5(e),fallback:n})}let a=t.task,o=PH(a),s=t.fold?.collapsed?e.rollup:a.rowStatus,c=(0,K.jsx)(nG,{lead:e.guides&&(0,K.jsx)(`span`,{className:`-mr-0.5 ml-0 flex flex-none self-stretch`,"aria-hidden":`true`,children:e.guides.map((e,t)=>(0,K.jsx)(`span`,{className:aN(e)},t))}),mark:(0,K.jsx)(VF,{icon:e.engineIcon,name:a.engine?.name,blank:UP(a,e.tabs)}),title:t.attempt??a.label,dim:e.stale,flash:e.selected?n:0,line2:(0,K.jsxs)(K.Fragment,{children:[e.repo&&(0,K.jsx)(`span`,{className:`max-w-24 flex-none truncate text-subtle`,children:e.repo}),o.branch&&(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:o.branch}),o.behind&&(0,K.jsx)(`span`,{className:`flex-none tabular-nums`,children:o.behind}),t.fold?.collapsed&&(0,K.jsxs)(`span`,{className:`flex-none text-subtle`,children:[`+`,t.fold.count]}),a.pinned&&(0,K.jsx)(`span`,{className:`flex-none text-subtle`,children:`▴`}),e.cloud&&(0,K.jsx)(IN,{label:e.cloud})]}),trail:(0,K.jsx)(K5,{tasks:e.prTasks??[a],sheet:!0}),status:(0,K.jsx)(iF,{status:s}),onClick:e.onClick,onContextMenu:e.onMenu,...e.place}),l=(0,K.jsx)(a5,{slot:`phone.row`,data:Y5(e,r?.manifest,i),fallback:c});return e.swipe?(0,K.jsx)(TO,{left:e.swipe.left,right:e.swipe.right,ground:`paper`,children:l}):l}function Yne({model:e}){W();let t=k(e.client.conn);return X5(e.client,8e3)?(0,K.jsx)(`div`,{className:`relative z-1 h-0`,children:(0,K.jsx)(`p`,{className:`absolute inset-x-0 top-0 m-0 truncate bg-paper px-4 pb-2 font-sans text-meta text-muted`,"data-rail-note":!0,children:U(t.state===`retrying`?`rail.reconnecting`:`status.connecting`)})}):null}var Xne=3e4;function Zne({model:e}){let{nav:t}=bz(),n=e.client,[r]=kz(Xne),[i,a]=(0,J.useState)(()=>Hs(n,`routine.list`)??null);(0,J.useEffect)(()=>{let e=!0,t=n.onOpen(()=>Ws(n,`routine.list`).then(t=>e&&a(t)).catch(()=>{}));return()=>{e=!1,t()}},[n,r]);let o=(i?.automations??[]).filter(e=>YW(i,e.id)).length;return(0,K.jsx)(oG,{label:t.automations,count:o,onClick:()=>Ee(`routines`)})}function Qne({model:e}){let{nav:t}=bz(),[n,r]=(0,J.useState)(!1),i=k(LH),a=[...FH(k(e.installedMods),k(e.mods),t)].sort((e,t)=>Number(t.id===i)-Number(e.id===i)),o=U(`rail.extensions`);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(sG,{label:o,onClick:()=>r(!0)}),n&&(0,K.jsx)(gO,{label:o,title:o,onClose:()=>r(!1),children:t=>(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-y-auto px-3 pb-1`,children:[a.map(e=>(0,K.jsxs)(_O,{"data-ext-row":e.id,onClick:()=>{t(),zH(e),Ee(e.page)},children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(0,K.jsx)(`span`,{className:`flex-none font-mono text-meta text-subtle`,children:e.id===i?U(`rail.lastOpened`):e.note})]},e.id)),a.length>0&&(0,K.jsx)(`hr`,{className:`mx-2 my-1 h-px flex-none border-none bg-line`}),(0,K.jsxs)(_O,{"data-ext-row":`add`,onClick:()=>{t(),B.set((0,K.jsx)(V3,{model:e,section:`plugins`}))},children:[(0,K.jsx)(`span`,{className:`w-4 flex-none text-center text-accent`,children:`+`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:U(`rail.addExtension`)})]})]})})]})}wl(),G(),A(),H();var Z5=O({ids:new Set,anchor:null});function Q5(){Z5.get().ids.size>0&&Z5.set({ids:new Set,anchor:Z5.get().anchor})}function $ne(e,t,n,r){let{ids:i,anchor:a}=Z5.get();if(e.shiftKey){let e=n.flatMap(e=>e.kind===`task`?[e.id]:[]),i=e.indexOf(a??r??t),o=e.indexOf(t),[s,c]=i<0?[o,o]:[Math.min(i,o),Math.max(i,o)];return Z5.set({ids:new Set(e.slice(s,c+1)),anchor:a??r}),!0}if(e.metaKey||e.ctrlKey){let e=new Set(i);return e.size===0&&r&&n.some(e=>e.kind===`task`&&e.id===r)&&e.add(r),e.has(t)?e.delete(t):e.add(t),Z5.set({ids:e,anchor:t}),!0}return Z5.set({ids:new Set,anchor:t}),!1}function ere(e){return e.key!==`Escape`||Z5.get().ids.size===0?!1:(Q5(),e.preventDefault(),!0)}function tre(e,t,n){let{ids:r}=Z5.get(),i=n.flatMap(e=>e.kind===`task`&&r.has(e.id)?[e.task]:[]);return r.has(t)&&i.length>1?nre(e,i):(Q5(),null)}function nre(e,t){let n=t.length;return[{label:U(`menu.archiveMany`,{count:n}),section:`danger`,run:()=>void ire(e,t)},{label:U(`menu.removeMany`,{count:n}),section:`danger`,danger:!0,run:()=>B.set((0,K.jsx)(Ha,{title:U(`menu.removeManyTitle`,{count:n}),body:U(`menu.removeManyBody`),confirmLabel:Y(`tasks`,`confirm.deleteConfirm`),onConfirm:async()=>void are(e,t)}))}]}function rre(e){let t=new Set(e.map(e=>e.id)),n=new Map(e.map(e=>[e.id,e.parentTaskId]));return e.filter(e=>{for(let r=e.parentTaskId;r;r=n.get(r))if(t.has(r))return!1;return!0})}function $5(e,t,n,r){let i=new Map;return Promise.allSettled(t.map(t=>{let a={taskId:t.id,...r(t)},o=t.machine?.id??``,s=(i.get(o)??Promise.resolve()).then(()=>e.client.request(n,a));i.set(o,s.catch(()=>{}));let c=Ls(n,a);return c?e.optimistic(c,()=>s):s}))}async function e7(e,t,n,r,i,a,o){Q5();let s=await $5(e,t,n,r),c=t.filter((e,t)=>{let n=s[t];return n?.status===`rejected`&&n.reason instanceof yl&&n.reason.code===i}),l=t.flatMap((e,t)=>{let n=s[t];return n?.status===`rejected`&&!c.includes(e)?[`${e.label}: ${Ra(n.reason)}`]:[]}),u=s.filter(e=>e.status===`fulfilled`).length;u>0&&o(u),l.length>0&&z(l.join(`
|
|
254
|
+
`),`error`),c.length!==0&&B.set((0,K.jsx)(Ha,{title:a.title,body:`${a.body}\n\n${c.map(e=>e.label).join(`
|
|
255
|
+
`)}`,confirmLabel:a.confirm,onConfirm:async()=>{let t=await $5(e,c,n,e=>({...r(e),force:!0})),i=t.filter(e=>e.status===`fulfilled`).length;i>0&&o(i);let a=c.flatMap((e,n)=>{let r=t[n];return r?.status===`rejected`?[`${e.label}: ${Ra(r.reason)}`]:[]});a.length>0&&z(a.join(`
|
|
256
|
+
`),`error`)}}))}function ire(e,t){return e7(e,rre(t),`task.archive`,()=>({archived:!0}),`TASK_BUSY`,{title:Y(`tasks`,`archive.busyTitle`),body:U(`menu.archiveManyBusy`),confirm:Y(`tasks`,`archive.busyConfirm`)},e=>z(U(`menu.archivedMany`,{count:e})))}function are(e,t){return e7(e,t,`task.delete`,()=>({}),`DIRTY_WORKTREE`,{title:U(`menu.removeManyDirtyTitle`),body:U(`menu.removeManyDirtyBody`),confirm:Y(`tasks`,`confirm.forceDeleteConfirm`)},e=>z(U(`menu.removedMany`,{count:e})))}G(),He();function ore(e){let{row:t}=e;return(0,K.jsxs)(`button`,{type:`button`,className:`${Aa({size:`pane`})} ${e.cursor?wN:``}`,title:U(`compare.menu`),onClick:()=>{e.onClick(),De(t.groupId)},...e.place,children:[e.guides&&(0,K.jsx)(`span`,{className:`-mr-0.5 ml-0 flex flex-none self-stretch`,"aria-hidden":`true`,children:e.guides.map((e,t)=>(0,K.jsx)(`span`,{className:aN(e)},t))}),(0,K.jsx)(`span`,{className:`${ja} text-(length:--fs-meta) text-muted`,children:t.title}),(0,K.jsxs)(`span`,{className:`${Ia} ml-auto items-center`,children:[e.repo&&(0,K.jsx)(`span`,{className:`max-w-24 truncate text-subtle`,children:e.repo}),(0,K.jsx)(`span`,{className:`text-subtle`,children:t.tasks.length}),(0,K.jsx)(iF,{status:KP(t.tasks)})]})]})}G();function sre(e){let t=(0,J.useRef)(null);return(0,J.useEffect)(()=>{let e=t.current;return()=>{e&&document.activeElement===e&&e.closest(`nav`)?.focus()}},[]),(0,K.jsxs)(`div`,{className:`${xN} mono items-center`,children:[(0,K.jsx)(`span`,{className:`text-accent`,children:`/`}),(0,K.jsx)(`input`,{ref:t,className:SN,type:`text`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,autoCapitalize:`off`,enterKeyHint:`go`,value:e.query,placeholder:U(`rail.searchPlaceholder`),"aria-label":U(`rail.searchPlaceholder`),onChange:t=>e.onChange(t.target.value)}),e.query&&(0,K.jsx)(`span`,{className:`ml-1.5 text-muted`,children:e.count})]})}A();var t7=O(null);function n7(e,t){return t===`attention`?e.rowStatus?.kind===`attention`:t===`merged`?e.pr?.lifecycle===`merged`:e.group===t}function r7(e){let t=k(t7),n={attention:0,merged:0};for(let t of e){n[t.group]=(n[t.group]??0)+1;for(let e of[`attention`,`merged`])n7(t,e)&&(n[e]=(n[e]??0)+1)}return{counts:n,filter:t,onFilter:e=>t7.set(e)}}G(),xb(),H();var cre=2e4;function lre(e,t){let n=hb().prefs.statusMarkNoticeSeen===!1,r=UB();(0,J.useEffect)(()=>{!n||t===void 0||(pb(e.client,`statusMarkNoticeSeen`,!0),t!==0&&r!==`dots`&&z(U(`rail.markNotice`),`info`,{label:U(`rail.markNoticeUndo`),run:()=>WB(e.client,`dots`)},cre))},[e,n,t,r])}var i7=(0,J.createContext)(null),a7=(0,J.createContext)(null);function o7({slot:e,fallback:t}){let n=(0,J.useContext)(i7);return n?(0,K.jsx)(a5,{slot:e,data:n,fallback:t}):t}function s7(e){let t=E1(),{runtimeErrors:n}=T1();return t?.manifest.slots?.[e]?.component?!n.some(n=>n.packId===t.id&&n.slot===e&&n.phase===`render`):!1}var c7=`flex flex-col gap-0.5 px-2 pb-2 font-mono text-meta`,l7=`flex items-start gap-2`,ure=`flex min-w-0 flex-1 flex-wrap items-center gap-x-2 text-left text-ink`;G(),A(),H();var dre=e=>e.replace(/^'|'$/g,``).split(`/`).pop()||e;function fre(e,t){let n=e=>e.map(e=>e.name).join(`, `),r=e.engines.length+e.signedOut.length>0,i=e.signedOut[0],a=e.engines.filter(e=>e.login!==`unknown`),o=[{id:`engine`,ok:r,label:r?U(`firstRun.engineFound`,{list:n([...e.engines,...e.signedOut])}):U(`firstRun.engineMissing`),fix:U(`firstRun.engineFix`),run:()=>B.set((0,K.jsx)(V3,{model:t,section:`engines`}))},{id:`login`,ok:e.engines.length>0,label:a.length>0?U(`firstRun.loginFound`,{list:n(a)}):e.engines.length>0?U(`firstRun.loginUnknown`,{list:n(e.engines)}):U(i?`firstRun.loginMissing`:`firstRun.loginWaiting`,{list:n(e.signedOut)}),fix:U(`firstRun.loginFix`,{name:i?.name??``}),...lA()&&i?{instead:U(`firstRun.loginFixTouch`,{command:dre(i.signIn??i.id)})}:{},run:()=>void gI((e,n)=>t.client.request(e,n),null,i?.signIn??i?.id??``).then(e=>e&&t.selectWhenListed(e)).catch(e=>z(e instanceof Error?e.message:String(e),`error`))}];return e.project!==void 0&&o.push({id:`project`,ok:e.project!==null,label:e.project?U(`firstRun.projectFound`,{name:e.project.split(/[\\/]/).pop()??e.project}):U(`firstRun.projectMissing`),fix:U(`firstRun.projectFix`),run:()=>ie({pickProject:!0})}),o}function u7({model:e}){W(),k(xc);let[t,n]=(0,J.useState)(()=>Hs(e,`welcome.env`)??null),r=k(B)!==null;(0,J.useEffect)(()=>{if(r)return;let t=!0,i=()=>Ws(e,`welcome.env`).then(e=>t&&n(e)).catch(()=>{});return i(),window.addEventListener(`focus`,i),()=>{t=!1,window.removeEventListener(`focus`,i)}},[e,r]);let i=t===null?[]:fre(t,e),a=i.find(e=>!e.ok);return(0,K.jsx)(`div`,{className:zk,"data-field":`welcome`,children:(0,K.jsxs)(`div`,{className:Bk,children:[(0,K.jsx)(cA,{scene:`rings`}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`h1`,{className:`m-0 font-sans text-title font-semibold text-ink`,children:U(`firstRun.title`)}),(0,K.jsx)(`p`,{className:`m-0 font-sans text-body text-muted`,children:U(`firstRun.body`)})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`button`,{type:`button`,className:vi(),"data-field":`start-first-task`,onClick:()=>uR(t?.start?.repo),children:U(`firstRun.start`)}),(0,K.jsx)(`span`,{className:`keys-only mono text-meta text-subtle`,children:Ac(`task.new.global`)})]}),t!==null&&(0,K.jsxs)(`div`,{className:`flex w-full flex-col gap-2 font-sans text-meta`,"data-field":`first-run-checks`,children:[(0,K.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1.5 p-0 text-left`,children:i.map(e=>(0,K.jsxs)(`li`,{className:`flex min-h-7 items-center gap-2`,"data-check":e.id,"data-ok":e.ok,children:[(0,K.jsx)(`span`,{className:`mono w-[1ch] flex-none text-center ${e.ok?`text-success`:`text-warning`}`,"aria-hidden":!0,children:e.ok?`✓`:`✗`}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1 ${e.ok?`text-subtle`:`text-ink`}`,children:[e.label,e===a&&e.instead&&(0,K.jsx)(`span`,{className:`block text-muted`,children:e.instead})]}),e===a&&!e.instead&&(0,K.jsx)(q,{variant:`action`,onClick:e.run,children:e.fix})]},e.id))}),!t.git&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,K.jsx)(`p`,{className:`m-0 text-warning`,children:Y(`workspace`,`welcome.gitMissing`)}),(0,K.jsx)(`p`,{className:`mono m-0 text-accent`,children:Y(`doctor`,`fix.gitAction`)})]})]})]})})}G(),He(),A(),H(),Ur();function d7(e,t){e.preventDefault(),de.set({x:e.clientX,y:e.clientY,items:t,target:e.currentTarget,fromKeyboard:e.button!==2})}function pre({model:e,narrow:t}){let n=W(),r=k(e.tasks),i=k(e.remote),a=RN(e),o=k(e.tabs),s=yz(e);lre(e,r?.tasks.length);let c=k(e.selection),l=r?.tasks??[],u=r7(l),d=u.filter?l.filter(e=>n7(e,u.filter??``)):l,f=r?.attention.filter(e=>e.unread).length??0,p=c.taskId,m=k(V)===null?p:null,h=new Map([...d,...i].map(e=>[e.id,e])),g=wne(),_=k(DG),v=k(Z5).ids,y=k(vG)===`state`,b=e=>(y?jK:Es)({tasks:d,remote:i,machines:a,sort:g.sort,query:e,fold:{...g.hand,selectedId:p??void 0}}),x=b(g.search.active?g.search.query:``),{groups:S}=x,C=g.search.active?x.rows:Os(Ane(x.rows,o),g.collapsed),w=new Map,T=``;for(let e of x.rows)e.kind===`project`||e.kind===`state`?T=e.id:e.kind===`task`&&w.set(T,(w.get(T)??0)+1);let E=e=>e.filter(e=>e.kind!==`project`&&e.kind!==`state`&&e.kind!==`round`),D=(n===`zh`?fo:uo).machine,O=new Set(a.filter(e=>e.state!==`online`).map(e=>e.alias)),ee=S.filter(e=>!e.noProject&&e.machine===void 0).map(e=>e.repo),A=e=>{let t=ee.indexOf(e);return{label:Jo(e),local:t>=0,top:t>0?ee[0]??null:null,above:t>0?ee[t-1]??null:null,below:t>=0?ee[t+1]??null:null}},j=S8(e,d,!g.search.active&&!y,g.sort==="default"),{place:M,dragging:N}=j.places(C),P=()=>B.set((0,K.jsx)(V3,{model:e})),F=()=>B.set((0,K.jsx)(AO,{model:e})),I=One(e,C,g,{selectedId:p,onNewTask:uR,onSettings:P}),R=E(b(``).rows).length,te=(0,J.useRef)(null),ne=k(e8)&&!t,re=k(t8)&&ne,ie=t?d.find(e=>e.id===c.taskId&&!e.deleting)??null:null,ae=t?Jne:Une,z=E1(),oe=!t&&!ne?I1(z?.manifest.layout?.frame):``,se=M7(e),ce=(0,J.useContext)(i7),le=!t&&!!z?.manifest.slots?.[`rail.header`],ue=!t&&!!z?.manifest.slots?.[`shell.topBar`]?.component,de=(0,K.jsxs)(`header`,{className:bN,children:[(0,K.jsxs)(`span`,{className:`${Rr} mr-auto`,"data-wordmark":!0,children:[(0,K.jsx)(`span`,{className:zr,children:`[`}),` rove `,(0,K.jsx)(`span`,{className:zr,children:`]`})]}),!t&&(0,K.jsxs)(`span`,{className:`relative`,children:[(0,K.jsx)(`button`,{type:`button`,className:`m-0 text-meta font-medium normal-nums inbox-chip relative font-mono hover:text-accent ${Wn} ${f>0?`text-accent`:`text-muted`}`,onClick:F,children:U(`rail.inbox`,{count:f})}),(0,K.jsx)(g6,{model:e,bindingId:`inbox.show`,head:!0})]}),!t&&(0,K.jsx)(iZ,{}),!t&&(0,K.jsx)(o8,{client:e.client,railBar:!0}),t&&(0,K.jsx)(Zne,{model:e}),t&&(0,K.jsx)(Qne,{model:e})]}),fe=(0,K.jsxs)(`nav`,{"data-tp-region":`rail`,className:`${yN} ${oe} ${ne?`is-folded`:``}`,ref:te,style:ue?{paddingTop:0}:void 0,inert:ne&&!re,"aria-hidden":ne&&!re,onMouseEnter:ne?()=>i8(!0):void 0,onMouseLeave:ne?()=>i8(!1):void 0,tabIndex:0,onKeyDown:e=>ere(e)||I.onKeyDown(e),children:[t?ce?(0,K.jsx)(a5,{slot:`phone.listHeader`,data:{...ce,query:g.search.active?g.search.query:``,onSearch:e=>g.setSearch(t=>({...t,active:e!==``,query:e}))},fallback:de}):de:(0,K.jsx)(a5,{slot:`rail.header`,data:{...u,taskCount:l.length+i.length,unreadCount:f,narrow:t,query:g.search.active?g.search.query:``,onSearch:e=>g.setSearch(t=>({...t,active:e!==``,query:e})),onNewSession:()=>dR(),onOpenInbox:F,pages:se},fallback:de}),t&&(0,K.jsxs)(`div`,{className:`-mt-1 flex items-center gap-2 px-4 pb-2 empty:hidden`,children:[(0,K.jsx)(iZ,{}),(0,K.jsx)(o8,{client:e.client})]}),t&&r&&(0,K.jsx)(Yne,{model:e}),_&&(0,K.jsxs)(`div`,{className:`flex gap-1 px-3.5 pb-2 text-meta mono`,children:[(0,K.jsx)(`span`,{className:`text-accent`,children:Y(`tasks`,`moveChip`).trim()}),(0,K.jsx)(`span`,{className:`keys-only ml-1.5 text-muted`,children:(0,K.jsx)(kO,{text:U(`taskops.moveHint`)})})]}),g.search.active&&(0,K.jsx)(sre,{query:g.search.query,count:`${E(C).length}/${R}`,onChange:e=>g.setSearch(t=>({...t,query:e}))}),!t&&!le&&(0,K.jsx)($re,{model:e}),(0,K.jsxs)(`div`,{"data-rail-body":!0,className:CN(N!==null),...j.body,onPointerDownCapture:I.onPress,children:[r&&d.length===0&&i.length===0&&t&&(0,K.jsx)(u7,{model:e}),r&&d.length===0&&i.length===0&&!t&&(0,K.jsx)(`p`,{className:`m-0 px-2 py-3 font-mono text-meta text-subtle`,children:U(`rail.empty`)}),ie&&(0,K.jsx)(_8,{title:ie.title}),C.map((n,r)=>n.kind===`round`?(0,K.jsx)(ore,{row:n,guides:n.depth>1?C6(C,r):void 0,repo:y&&n.depth===1?kK(n.tasks[0]):void 0,cursor:n.id===I.cursor,place:M(n),onClick:()=>I.setCursor(n.id)},n.id):n.kind===`pane`?(0,K.jsx)(w5,{selectedTabId:n.task.id===m?c.tabId:null,row:n,guides:C6(C,r),cursor:n.id===I.cursor,place:M(n),onClick:()=>{I.setCursor(n.id),C5(e,n),Ie()},onMenu:t=>{I.setCursor(n.id),d7(t,y5(e,n.task.id,n.tab,n.leaf))}},n.id):(0,K.jsx)(ae,{row:n,guides:n.kind===`task`&&n.depth>1?C6(C,r):void 0,cloud:FN(n,a,D),repo:y&&n.kind===`task`&&n.depth===1?kK(n.task):void 0,tabs:n.kind===`task`?o[n.task.id]:void 0,engineIcon:n.kind===`task`?s.get(n.task.engine?.id??``):void 0,selected:n.id===m,cursor:n.id===I.cursor&&N===null,stale:n.machine!==void 0&&O.has(n.machine),collapsed:(n.kind===`project`||n.kind===`state`)&&g.collapsed.has(n.id),count:w.get(n.id),drag:j.props(n),swipe:t&&n.kind===`task`&&n.machine===void 0&&!n.task.archived?xne(e,n.task):void 0,dragging:N===n.id,place:M(n),onNewTask:n.kind===`project`?n.noProject?dR:()=>uR(n.repo,n.machine):void 0,moving:v.has(n.id)||_&&n.machine===void 0&&n.kind!==`project`&&n.id===I.cursor,prTasks:n.kind===`task`&&n.fold?.collapsed?[n.task,...n.fold.descendantIds.flatMap(e=>h.get(e)??[])]:void 0,rollup:n.kind===`task`&&n.fold?.collapsed?KP([n.task,...n.fold.descendantIds.flatMap(e=>h.get(e)??[])]):void 0,onToggleFold:()=>{n.kind===`task`&&g.toggleTaskFold(n.id,n.fold?.collapsed===!0)},onClick:t=>{n.kind===`task`&&t&&$ne(t,n.id,C,m)||(I.setCursor(n.id),(n.kind===`project`||n.kind===`state`)&&g.toggleProject(n.id),n.kind===`task`&&Dne(e,n.task.id))},onMenu:t=>{if(n.kind===`project`&&n.machine!==void 0)return;if(n.kind===`project`&&n.noProject){d7(t,N5(e));return}if(n.kind===`project`){d7(t,M5(e,n.repo,A(n.repo)));return}if(n.kind!==`task`)return;I.setCursor(n.id);let r=tre(e,n.id,C);if(r)return d7(t,r);d7(t,L(hre(mre(F5(e,n.task,null),n.fold,()=>g.toggleTaskFold(n.id,n.fold?.collapsed===!0)),S5(e,n.task.id)),U(`menu.more`)))}},n.id))]}),(0,K.jsx)(l5,{model:e,narrow:t,onSettings:P,inbox:{count:f,onClick:F}}),!t&&!ne&&(0,K.jsx)(l8,{rail:te})]});return(0,K.jsx)(a5,{slot:`rail.frame`,data:{unreadCount:f,taskCount:d.length+i.length,groupBy:y?`state`:`project`,sortBy:g.sort,folded:ne,narrow:t},fallback:fe})}function mre(e,t,n){if(!t)return e;let r={label:Y(`tasks`,t.collapsed?`menu.expandChildren`:`menu.collapseChildren`),section:`open`,rare:!0,run:n},i=e.map(e=>e.section).lastIndexOf(`open`);return[...e.slice(0,i+1),r,...e.slice(i+1)]}function hre(e,t){let n=e.map(e=>e.section).lastIndexOf(`open`);return[...e.slice(0,n+1),...t.map(e=>({...e,rare:!0})),...e.slice(n+1)]}var f7=e=>Date.parse(e.updatedAt??e.createdAt??``)||0;function gre(e,t,n){return(n===`archived`?e?.archived??[]:e?.tasks??[]).filter(e=>!e.routine).filter(e=>t===null||!ms(e)&&wz(e.repo)===wz(t)).sort((e,t)=>f7(t)-f7(e))}function _re(e){let t=new Set,n=[];for(let r of[...e?.tasks??[],...e?.archived??[]]){if(r.routine||ms(r)||r.repo.startsWith(`ssh://`))continue;let e=wz(r.repo);t.has(e)||(t.add(e),n.push(r.repo))}return n}function vre({tabs:e,value:t,onChange:n,className:r}){return(0,K.jsx)(`div`,{className:Tn(`flex gap-1`,r),role:`tablist`,children:e.map(e=>{let r=e.id===t;return(0,K.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":r,className:Tn(`relative rounded-sm px-2.5 py-0.75 font-mono text-meta font-semibold`,`touch:after:absolute touch:after:content-[''] touch:after:-inset-x-0.5 touch:after:-top-2 touch:after:-bottom-1.5`,r?`bg-inset text-ink group-focus-within/pane:text-accent`:`text-muted`),onClick:()=>n(e.id),children:e.label},e.id)})})}G(),A(),H();function yre({model:e}){let{common:t}=bz(),n=k(e.tasks),r=k(_e)??``,[i,a]=(0,J.useState)(`active`),[o,s]=(0,J.useState)(0),c=_re(n),l=r===``?null:r,u=gre(n,l,i),d=Math.min(o,Math.max(0,u.length-1)),f=(0,J.useRef)(null);(0,J.useEffect)(()=>f.current?.focus(),[]);let p=(0,J.useRef)(null);(0,J.useEffect)(()=>{p.current?.querySelector(`[data-row="${d}"]`)?.scrollIntoView({block:`nearest`})},[d]);let m=t=>{V.set(null),e.select(t)},h=e=>{a(e),s(0)},g=e=>{let t=[``,...c],n=t.findIndex(e=>e===``?r===``:wz(e)===wz(r));_e.set(t[(Math.max(0,n)+(e?t.length-1:1))%t.length]??``),s(0)};Az(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);let t=u[d];switch(e.key){case`Escape`:case`q`:return V.set(null),!0;case`j`:case`ArrowDown`:return s(Math.min(u.length-1,d+1)),!0;case`k`:case`ArrowUp`:return s(Math.max(0,d-1)),!0;case`Tab`:return g(e.shiftKey),!0;case`a`:return h(i===`active`?`archived`:`active`),!0;case`Enter`:return t&&m(t.id),!0;default:return!1}});let _=Date.now();return(0,K.jsxs)(`div`,{className:`group/pane ${KB}`,tabIndex:0,ref:f,children:[(0,K.jsxs)(`div`,{className:JB,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,K.jsx)(`h1`,{className:qB,children:U(`sessions.title`)}),(0,K.jsx)(vre,{tabs:[{id:`active`,label:U(`sessions.active`)},{id:`archived`,label:U(`sessions.archived`)}],value:i,onChange:h})]}),(0,K.jsx)(`span`,{className:`mono touch:empty:hidden! text-muted ${YB(!0)}`,children:l?Tz(l,c):U(`sessions.allProjects`)})]}),n?u.length===0?(0,K.jsx)(`p`,{className:`text-muted`,children:U(i===`archived`?`sessions.emptyArchived`:`sessions.emptyActive`)}):(0,K.jsx)(`div`,{className:QB,ref:p,children:u.map((t,n)=>{let r=Date.parse(t.updatedAt??t.createdAt??``);return(0,K.jsx)(`div`,{"data-row":n,className:$B(n===d),onClick:()=>m(t.id),onContextMenu:r=>{s(n),d7(r,L(F5(e,t,null),U(`menu.more`)))},children:(0,K.jsxs)(`div`,{className:eV,children:[(0,K.jsx)(`span`,{className:rV,title:t.label,children:t.label}),l===null&&!ms(t)?(0,K.jsx)(`span`,{className:`mono text-meta ${tV}`,children:Tz(t.repo,c)}):null,(0,K.jsx)(`span`,{className:`mono text-meta ${tV}`,children:Number.isFinite(r)?vV(r,_):``})]})},t.id)})}):(0,K.jsx)(`p`,{className:`text-muted`,children:t.loading}),(0,K.jsx)(`p`,{className:`mt-2.5 mb-0 text-meta text-subtle touch:hidden`,children:U(`sessions.keys`)})]})}function p7({active:e=!1,onSelect:t,plus:n=!1,children:r}){return(0,K.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${cV(e)}`,"aria-current":e?`page`:void 0,onClick:t,children:[r,n?(0,K.jsx)(`span`,{className:lV,"aria-hidden":`true`,children:`+`}):null]})}var bre=`mx-auto flex max-w-[76rem] flex-col font-mono text-meta leading-[1.5]`,xre=`flex items-end justify-between gap-[4ch]`,Sre=`m-0 text-title font-bold tracking-[0.02em]`,m7=`font-bold tracking-code uppercase`,h7=`text-muted`,Cre=`text-subtle`,wre=`my-4 border-t-hairline border-dashed! border-line-active`,g7=`m-0 mb-1.5 text-meta text-muted ${m7}`,Tre=`${g7} flex flex-wrap items-baseline justify-between gap-x-[4ch]`,Ere=`flex flex-wrap items-start gap-x-[8ch] gap-y-4`,Dre=`min-w-[min(100%,36ch)] flex-1`,Ore=`text-[3.5rem] leading-none font-bold tracking-[-0.03em]`,kre=`grid grid-cols-[repeat(auto-fit,minmax(min(100%,34ch),1fr))] items-start gap-x-[6ch] gap-y-5`,Are=`flex min-w-0 items-baseline gap-[1ch] whitespace-nowrap`,_7=`min-w-0 truncate`,jre=`min-w-[2ch] flex-1 -translate-y-0.75 border-b-hairline border-dotted! border-line-active`,Mre=`pl-[2ch] text-subtle`,v7=`-mx-[1ch] block rounded-sm px-[1ch] py-0.5 text-left`,Nre=`${v7} w-[calc(100%+2ch)] cursor-pointer hover:bg-hover focus-visible:outline-1 focus-visible:-outline-offset-1 focus-visible:outline-focus`,Pre=`grid grid-cols-[6ch_minmax(0,1fr)_5ch_5ch_8ch] items-center gap-x-[2ch] py-0.5 whitespace-nowrap`,y7=[`bg-accent`,`bg-info`,`bg-merged`,`bg-subtle`],Fre=`grid grid-cols-[minmax(0,1fr)_minmax(8ch,14ch)_5ch] items-center gap-x-[1ch] whitespace-nowrap`,b7=`relative h-2.5 border-hairline border-current after:absolute after:inset-y-0 after:left-0 after:w-(--fill) after:bg-current after:content-['']`,x7={ok:`${b7} text-success`,warn:`${b7} text-warning`,crit:`${b7} text-error`},Ire=`flex h-9 flex-none items-stretch text-ink`,Lre=`flex-none bg-current`,Rre=`flex flex-wrap items-baseline justify-between gap-x-[4ch] gap-y-1 text-subtle`,S7={turns:0,tokens:0,ms:0},C7=e=>(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0),zre=e=>Math.max(0,e.endedAt-e.startedAt),w7=(e,t)=>({turns:e.turns+1,tokens:e.tokens+C7(t),ms:e.ms+zre(t)});function T7(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Bre(e,t,n,r){let i=[];for(let e=n-1;e>=0;e--){let n=new Date(t);n.setDate(n.getDate()-e),i.push(T7(n.getTime()))}let a=new Map(i.map(e=>[e,{sum:S7,byEngine:{}}]));for(let t of e){let e=a.get(T7(t.startedAt));if(!e)continue;let n=t.vendor??`unknown`;e.sum=w7(e.sum,t),e.byEngine[n]=(e.byEngine[n]??0)+C7(t)}let o=e.reduce((e,t)=>Math.min(e,t.startedAt),1/0),s=e.length>=r&&Number.isFinite(o)?{count:e.length,day:T7(o)}:null;return{cutoff:s,days:i.map(e=>{let t=a.get(e);return{day:e,...t?.sum??S7,byEngine:t?.byEngine??{},partial:s!==null&&e<=s.day}})}}function Vre(e){let t=new Map;for(let n of e){let e=n.vendor??`unknown`,r=n.model??`unknown`,i=`${e}\0${r}`;t.set(i,{engine:e,model:r,...w7(t.get(i)??S7,n)})}return[...t.values()].sort((e,t)=>t.tokens-e.tokens||t.turns-e.turns)}function Hre(e,t){let n=new Map;for(let t of e)n.set(t.taskId,{taskId:t.taskId,...w7(n.get(t.taskId)??S7,t)});return[...n.values()].sort((e,t)=>t.tokens-e.tokens||t.turns-e.turns).slice(0,t)}function E7(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(+(e<1e4)).replace(/\.0$/,``)}k`:`${(e/1e6).toFixed(+(e<1e7)).replace(/\.0$/,``)}M`}var Ure=.1,Wre=/^(\d+)\s*(h|d)$/;function Gre(e,t){let n=Wre.exec(e.label.trim());if(!n||e.resetsAt===null||e.percent<=0)return null;let r=Number(n[1])*(n[2]===`d`?24:1)*36e5,i=r-(e.resetsAt-t);if(!(i>=r*Ure)||i>r)return null;if(e.percent>=100)return{kind:`full`,at:t};let a=t+(100-e.percent)/e.percent*i;return a<e.resetsAt?{kind:`full`,at:a}:{kind:`lasts`}}G(),A(),H(),Ur();var D7=14,O7=500,Kre=3e4,qre=8;function k7(e,t,n,r){let i=Hs(e,t,n),[a,o]=(0,J.useState)(i?{kind:`ready`,value:i}:{kind:`loading`}),s=k(e.client.conn).state===`open`,c=JSON.stringify(n);return(0,J.useEffect)(()=>{if(!s)return;let r=!0;return Ws(e,t,n).then(e=>r&&o({kind:`ready`,value:e})).catch(e=>r&&o(t=>t.kind===`ready`?t:{kind:`failed`,error:Cz(e)})),()=>{r=!1}},[e,t,c,r,s]),a}var A7=()=>(0,K.jsx)(`div`,{className:wre});function j7({name:e,title:t,sum:n,sub:r,open:i}){let a=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:Are,children:[(0,K.jsx)(`span`,{className:_7,title:t,children:e}),(0,K.jsx)(`span`,{className:jre}),(0,K.jsx)(`span`,{children:E7(n.tokens)})]}),(0,K.jsx)(`span`,{className:`block truncate ${Mre}`,children:[r,`${n.turns}t`,MW(n.ms)].filter(Boolean).join(` · `)})]});return i?(0,K.jsx)(q,{variant:`row`,className:Nre,onClick:i,children:a}):(0,K.jsx)(`div`,{className:v7,children:a})}function Jre({sum:e}){let t=`${e.tokens}${e.turns}${e.ms}`.repeat(4).slice(0,36);return(0,K.jsx)(`div`,{className:Ire,"aria-hidden":`true`,children:[...t].map((e,t)=>(0,K.jsx)(`span`,{className:Lre,style:{width:1+Number(e)%3,marginRight:1+Number(e)%2}},t))})}function Yre({usage:e,nameOf:t}){let n=Date.now(),r=e.flatMap(e=>e.windows.map(r=>{let i=Gre(r,n),a=i?.kind===`full`&&i.at-n<72e6,o=i?.kind===`full`?xz(U(`usage.full`),{time:new Date(i.at).toLocaleString([],{...a?{}:{weekday:`short`},hour:`2-digit`,minute:`2-digit`})}):i?U(`usage.lasts`):``;return{key:`${e.vendor}:${r.kind}`,name:`${e.name||t(e.vendor)} ${r.label}`,percent:Math.round(r.percent),tone:k3({capturedAt:e.capturedAt,windows:[r]},n)?.tone??`ok`,note:o}}));return r.length===0?null:(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`h2`,{className:g7,children:U(`usage.quota`)}),r.map(e=>(0,K.jsxs)(`div`,{className:`py-0.5`,children:[(0,K.jsxs)(`div`,{className:Fre,children:[(0,K.jsx)(`span`,{className:_7,children:e.name}),(0,K.jsx)(`span`,{className:x7[e.tone]??x7.ok,style:{"--fill":`${Math.min(100,Math.max(0,e.percent))}%`}}),(0,K.jsx)(`span`,{className:`text-right ${Fr[e.tone]}`,children:`${e.percent}%`})]}),e.note&&(0,K.jsx)(`div`,{className:`pl-[2ch] text-subtle`,children:e.note})]},e.key))]})}function Xre({model:e}){W();let t=jz(),[n]=kz(Kre),r=k7(e,`turns.list`,{sinceDays:D7,limit:O7},n),i=k7(e,`engines.list`,{},n),a=k7(e,`usage.get`,{},n),o=k(e.tasks),s=i.kind===`ready`?i.value.engines:[],c=e=>s.find(t=>t.id===e)?.name??e,l=e=>o?.tasks.find(t=>t.id===e)?.label??U(`usage.removedTask`),u=a.kind===`ready`&&a.value.usage&&(0,K.jsx)(Yre,{usage:a.value.usage,nameOf:c});return(0,K.jsx)(`div`,{className:KB,tabIndex:0,ref:t,onKeyDown:e=>{e.metaKey||e.ctrlKey||e.altKey||e.key!==`q`&&e.key!==`Escape`||(e.preventDefault(),V.set(null))},children:(0,K.jsx)(`div`,{className:bre,children:(()=>{if(r.kind===`loading`)return(0,K.jsx)(`p`,{className:`m-0 ${h7}`,children:U(`usage.loading`)});if(r.kind===`failed`)return(0,K.jsx)(`p`,{className:`m-0 text-error`,children:xz(U(`usage.failed`),{error:r.error})});let t=r.value.turns,n=new Set(r.value.readers??[]),i=Bre(t,Date.now(),D7,O7),a=new Map;for(let e of i.days)for(let[t,n]of Object.entries(e.byEngine))a.set(t,(a.get(t)??0)+n);let s=[...a].sort((e,t)=>t[1]-e[1]).map(([e])=>e),d=e=>y7[Math.max(0,s.indexOf(e))%y7.length]??y7[0],f=Math.max(0,...i.days.map(e=>e.tokens)),p=i.days.slice(Math.max(0,i.days.findIndex(e=>e.turns>0))),m=i.days.reduce((e,t)=>({turns:e.turns+t.turns,tokens:e.tokens+t.tokens,ms:e.ms+t.ms}),{turns:0,tokens:0,ms:0}),h=[...new Set((o?.tasks??[]).flatMap(e=>e.engine?.id&&!n.has(e.engine.id)?[e.engine.id]:[]))];return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:xre,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`h1`,{className:Sre,children:[(0,K.jsx)(`span`,{className:zr,children:`[`}),` rove `,(0,K.jsx)(`span`,{className:zr,children:`]`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:m7,children:U(`usage.receipt`)}),(0,K.jsx)(`span`,{className:h7,children:` ${i.days[0]?.day.slice(5)} → ${i.days.at(-1)?.day.slice(5)}`})]})]}),t.length>0&&(0,K.jsx)(Jre,{sum:m})]}),(0,K.jsx)(A7,{}),t.length===0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`m-0 ${h7}`,children:U(`usage.empty`)}),u&&(0,K.jsx)(A7,{}),u]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:Ere,children:[(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`h2`,{className:g7,children:U(`usage.total`)}),(0,K.jsx)(`div`,{className:Ore,children:E7(m.tokens)}),(0,K.jsx)(`div`,{className:`mt-1.5 ${h7}`,children:`${xz(U(m.turns===1?`usage.turnsOne`:`usage.turns`),{count:m.turns})} · ${MW(m.ms)}`})]}),(0,K.jsxs)(`section`,{className:Dre,children:[(0,K.jsxs)(`h2`,{className:Tre,children:[U(`usage.perDay`),s.length>1&&(0,K.jsx)(`span`,{className:`flex flex-wrap gap-x-[2ch] font-normal tracking-normal normal-case`,children:s.map(e=>(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`span`,{className:`mr-[1ch] inline-block size-2 align-baseline ${d(e)}`}),c(e)]},e))})]}),p.map(e=>(0,K.jsxs)(`div`,{className:Pre,children:[(0,K.jsx)(`span`,{className:h7,children:`${e.day.slice(5)}${e.partial?`~`:``}`}),(0,K.jsx)(`span`,{className:`flex min-w-0`,children:e.tokens>0&&f>0&&(0,K.jsx)(`span`,{className:`flex h-2.5 w-(--fill) min-w-0.5 gap-px`,style:{"--fill":`${e.tokens/f*100}%`},children:s.map(t=>(e.byEngine[t]??0)>0&&(0,K.jsx)(`span`,{className:`min-w-0.5 basis-0 ${d(t)}`,style:{flexGrow:e.byEngine[t]}},t))})}),e.turns>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-right`,children:E7(e.tokens)}),(0,K.jsx)(`span`,{className:`text-right text-subtle`,children:`${e.turns}t`}),(0,K.jsx)(`span`,{className:`text-right text-subtle`,children:MW(e.ms)})]})]},e.day))]})]}),(0,K.jsx)(A7,{}),(0,K.jsxs)(`div`,{className:kre,children:[(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`h2`,{className:g7,children:U(`usage.byModel`)}),Vre(t).map(e=>(0,K.jsx)(j7,{name:e.model,title:`${c(e.engine)} · ${e.model}`,sum:e,sub:c(e.engine)},`${e.engine}\0${e.model}`))]}),(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`h2`,{className:g7,children:U(`usage.topTasks`)}),Hre(t,qre).map(t=>{let n=o?.tasks.some(e=>e.id===t.taskId),r=l(t.taskId);return(0,K.jsx)(j7,{name:n?r:(0,K.jsx)(`span`,{className:Cre,children:r}),title:r,sum:t,open:n?()=>{V.set(null),e.select(t.taskId)}:null},t.taskId)})]}),u]})]}),(0,K.jsx)(A7,{}),(0,K.jsxs)(`div`,{className:Rre,children:[(0,K.jsx)(`span`,{children:xz(U(`usage.range`),{days:D7})}),i.cutoff&&(0,K.jsx)(`span`,{children:xz(U(`usage.cutoff`),{count:i.cutoff.count,day:i.cutoff.day.slice(5)})}),h.length>0&&(0,K.jsx)(`span`,{children:xz(U(`usage.noReader`),{engines:h.map(c).join(`, `)})}),(0,K.jsx)(`span`,{className:`${m7} ml-auto`,children:U(`usage.thanks`)})]})]})})()})})}G(),He(),A(),H();var Zre={id:`mods`,label:`mods`},Qre=[{id:`kanban`,label:`kanban`,mod:`kanban`},{id:`routines`,label:`automations`},{id:`issues`,label:`issues`,mod:`issues`}];function M7(e){let{nav:t}=bz(),n=k(V),r=k(e.mods).length>0,i=k(e.installedMods);return[...Qre.filter(e=>!e.mod||i.has(e.mod)),...r?[Zre]:[]].map(e=>({id:e.id,label:t[e.label],active:n===e.id,onOpen:()=>Ee(e.id)}))}function $re({model:e}){let t=M7(e);return(0,K.jsxs)(`div`,{className:iV,children:[(0,K.jsx)(p7,{plus:!0,onSelect:()=>uR(),children:U(`rail.newTask`)}),t.map(e=>(0,K.jsx)(p7,{active:e.active,onSelect:e.onOpen,children:e.label},e.id))]})}function eie({model:e,page:t}){let n=k(e.installedMods);return t===`kanban`&&n.has(`kanban`)?(0,K.jsx)(jH,{model:e}):t===`routines`?(0,K.jsx)(hG,{model:e}):t===`issues`&&n.has(`issues`)?(0,K.jsx)(AV,{model:e}):t===`mods`?(0,K.jsx)($H,{model:e}):t===`compare`?(0,K.jsx)(gV,{model:e}):t===`usage`?(0,K.jsx)(Xre,{model:e}):t===`sessions`?(0,K.jsx)(yre,{model:e}):t===`update`?(0,K.jsx)(cZ,{client:e.client}):null}G(),A(),H(),Ur();var N7=e=>e.split(` + `).map(e=>yc(e)).join(` + `);function tie(e){let t=dK(HG(e.scope));return e.kind===`here`?sK(`here`,{surface:t}):e.kind===`direct`?sK(`direct`):e.kind===`prefix`?sK(`afterPrefix`):sK(`otherPane`,{surface:t})}function nie(e){let t=document.activeElement instanceof HTMLElement?document.activeElement:null;B.set((0,K.jsx)(rie,{model:e,surface:Vc(),origin:t}))}function rie({model:e,surface:t,origin:n}){W();let r=k(xc),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(``),c=(0,J.useRef)(null),l=(0,J.useMemo)(()=>Hc(e,t),[e,t]),u=(0,J.useMemo)(()=>BG(Uc(),t===`terminal`?`terminal`:t,Ec(),l),[l,t,r]).map(e=>({...e,rows:e.rows.filter(e=>WG(o,lK(e.binding.id),e.primary))})).filter(e=>e.rows.length>0);return(0,J.useEffect)(()=>()=>n?.focus(),[n]),(0,J.useEffect)(()=>{let e=c.current,t=t=>{if(!e||t.ctrlKey||t.metaKey||t.altKey)return;let n=e.clientHeight;if(t.key===`ArrowUp`)e.scrollBy({top:-24});else if(t.key===`ArrowDown`)e.scrollBy({top:24});else if(t.key===`PageUp`)e.scrollBy({top:-n});else if(t.key===`PageDown`)e.scrollBy({top:n});else if(t.key===`Home`)e.scrollTo({top:0});else if(t.key===`End`)e.scrollTo({top:e.scrollHeight});else if(!i&&t.key===`?`)ce();else if(!i&&t.key===`/`)a(!0);else return;t.preventDefault()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[i]),(0,K.jsx)(za,{title:sK(`title`),wide:!0,children:(0,K.jsxs)(`div`,{className:`${Yi} help`,children:[(0,K.jsxs)(`div`,{className:ur,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`text-muted`,children:t?sK(`focused`,{surface:dK(HG(t))}):sK(`allBindings`)}),(0,K.jsx)(`p`,{className:`text-muted`,children:sK(`grammar`,{prefix:Dc()})})]}),(0,K.jsxs)(`div`,{className:dr,children:[(0,K.jsx)(`span`,{className:`subtle`,children:sK(`scrollKeys`)}),(0,K.jsx)(`button`,{type:`button`,className:Oi,onClick:ce,children:sK(`esc`)})]})]}),i?(0,K.jsx)(`input`,{className:ji,autoFocus:!0,spellCheck:!1,value:o,placeholder:sK(`search`),onChange:e=>{s(e.target.value),c.current?.scrollTo({top:0})}}):(0,K.jsx)(`p`,{className:`text-muted`,children:sK(`filter`)}),u.length===0&&(0,K.jsx)(`p`,{className:`text-muted`,children:sK(`noResults`)}),(0,K.jsx)(`div`,{className:fr,ref:c,children:u.map((e,t)=>(0,K.jsxs)(`section`,{className:pr,children:[(0,K.jsx)(`h2`,{className:mr,children:tie(e)}),e.rows.map(t=>(0,K.jsxs)(`div`,{className:hr,children:[(0,K.jsx)(`span`,{className:`mono ${gr}`,children:N7(t.primary)}),(0,K.jsx)(`span`,{className:`flex-1`,children:lK(t.binding.id)}),t.aliases.length>0&&(0,K.jsx)(`span`,{className:`text-muted`,children:`(${t.aliases.map(N7).join(`, `)})`})]},`${e.kind}-${t.binding.id}`))]},`${e.kind}-${e.scope??t}`))})]})})}G(),H();function P7(e){return!(e instanceof HTMLElement)||e.closest(`.xterm`)?!1:e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName)}function iie(e){return e instanceof HTMLElement&&!!e.closest(`.rail, button, a`)}var F7=e=>e.tabs.get()[e.selection.get().taskId??``]??[];function I7(e){let{taskId:t,tabId:n}=e.selection.get(),r=F7(e);return{taskId:t,tabs:r,at:r.findIndex(e=>e.id===n)}}function L7(e,t){let{taskId:n,tabs:r}=I7(e),i=r[t];!n||!i||e.select(n,i.id)}function aie(e){let{taskId:t,tabs:n,at:r}=I7(e),i=n[r];!t||!i||B.set((0,K.jsx)(Va,{title:U(`menu.renameTab`),initial:Ds(i),submitLabel:U(`dialog.save`),onSubmit:async n=>{await e.renameTab(t,i.id,n)}}))}var R7=e=>!!e.selection.get().taskId,z7=e=>F7(e).length>0,oie=[{id:`help.open`,chords:[`f1`],prefix:!1,run:nie},{id:`focus.next`,chords:[`f4`],prefix:!1,run:()=>dc(1)},{id:`chat.tab.chooseEngine`,chords:[`ctrl+e`],prefix:!1,surface:`workspace`,live:R7,run:e=>{let{taskId:t}=e.selection.get();t&&B.set((0,K.jsx)(TK,{model:e,taskId:t}))}},{id:`chat.tab.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:e=>{let{tabs:t,at:n}=I7(e);return!!t[n]&&!U3(t[n]?.split)},run:aie},{id:`chat.tab.cycle-next`,chords:[`ctrl+]`],prefix:!1,surface:`workspace`,live:z7,run:e=>L7(e,(I7(e).at+1)%F7(e).length)},{id:`chat.tab.cycle-prev`,chords:[`ctrl+[`],prefix:!1,surface:`workspace`,live:z7,run:e=>L7(e,(I7(e).at-1+F7(e).length)%F7(e).length)},{id:`chat.tab.goto`,chords:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`].map(e=>`ctrl+${e}`),prefix:!1,surface:`workspace`,live:z7,run:(e,t=``)=>{let n=Rc().find(e=>e.id===`chat.tab.goto`&&!e.prefix)?.chords.indexOf(t)??-1;n>=0&&L7(e,n)}},{id:`attention.next`,chords:[`f7`],prefix:!1,run:e=>cie(e)}];Ic(()=>oie);function sie(e){(0,J.useEffect)(()=>{let t=t=>{if(B.get()||P7(t.target))return;let n=V.get();if(n===`worktrees`)return;let r=Vc()??(R7(e)?`workspace`:`sidebar`),{taskId:i}=e.selection.get();if(!n&&i&&!t.ctrlKey&&!t.shiftKey&&!t.metaKey&&!t.altKey&&t.key===`Enter`&&!z7(e)&&!iie(t.target)){t.preventDefault(),t.stopPropagation(),B.set((0,K.jsx)(TK,{model:e,taskId:i}));return}let a=QG(t),o=Rc().filter(t=>!t.prefix&&!t.native&&t.chords.some(e=>a.includes(e))&&zc(t,r)&&!(n&&t.surface)&&t.live?.(e)!==!1).sort((e,t)=>Bc(e,r)-Bc(t,r))[0];o&&(t.preventDefault(),t.stopPropagation(),o.run(e,a.find(e=>o.chords.includes(e))))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},[e])}function cie(e){let t=e.tasks.get();if(!t)return;let n=il(t.attention,t.tasks.map(e=>e.id),e.selection.get());if(!n){z(U(`inbox.empty`));return}if(tl(n.state)){cl(e,n);return}n.taskId!==null&&(e.select(n.taskId,n.tabId),sl(e,n))}G(),H();async function lie(e,t){try{if(t.kind===`action`){await e.client.request(`plugin.chordAction`,{chord:t.chord});return}let{taskId:n,tabId:r}=e.selection.get();if(!n){z(U(`keys.pluginNoTask`),`error`);return}let i=await e.client.request(`plugin.paneOpen`,{taskId:n,pane:t.target,...r?{tabId:r}:{}});await e.refreshTabsNow(n),e.select(n,i.tabId)}catch(e){z(Ra(e),`error`)}}function uie(e){(0,J.useEffect)(()=>{let t=t=>{let n=xc.get().plugins;if(n.length===0||!Pc({dialog:B.get()!==null,page:V.get()})||P7(t.target))return;let r=Nc(n,QG(t));r&&(t.preventDefault(),t.stopImmediatePropagation(),lie(e,r))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},[e])}cb(),xb(),A();var die=[`workingBorder`,`runningTitle`,`taskColors`,`colorblind`];function fie(e){let{client:t}=e,n=hb(),r=$1(),i=k(sb),a=E1();e0(e),Z4(e),(0,J.useEffect)(()=>{let e=()=>{fb(t).catch(()=>void 0),EI(t).catch(()=>void 0)},n=()=>document.visibilityState===`visible`&&e(),r=t.onOpen(e);return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,n),()=>{r(),window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,n)}},[t]),(0,J.useEffect)(()=>{x1(t).catch(()=>void 0)},[t,n]),(0,J.useEffect)(()=>{let e=document.documentElement,t=n.prefs.theme,o=i?i[r]:Vy(n.themes,t,r),s=i?i.fontFamily??null:Hy(n.themes,t),c=o?Zy(o,n.prefs):{};for(let[t,n]of Object.entries(c))e.style.setProperty(t,n);s?e.style.setProperty(`--mono`,Wy(s)):e.style.removeProperty(`--mono`),I8(e,i&&i.name!==t?null:a,c),e.style.colorScheme=r;for(let t of die)e.dataset[t]=String(n.prefs[t]);ab.set(o?Qy(o):null),ob.set(s?Gy(s):null);let l=document.querySelector(`meta[name="theme-color"]`);l||(l=document.createElement(`meta`),l.name=`theme-color`,document.head.append(l)),l.content=getComputedStyle(document.body).backgroundColor},[n,r,i,a])}function pie(e,t,n){let r=n.width/t.width,i=n.height/t.height,a=Math.min(n.width,Math.max(0,Math.round(e.left*r))),o=Math.min(n.height,Math.max(0,Math.round(e.top*i)));return{x:a,y:o,width:Math.min(n.width-a,Math.round(e.width*r)),height:Math.min(n.height-o,Math.round(e.height*i))}}function mie(e,t,n){let r={left:0,top:0,width:n.innerWidth,height:n.innerHeight},i={left:(n.outerWidth-n.innerWidth)/2,top:n.outerHeight-n.innerHeight},a={...i,width:n.outerWidth,height:n.outerHeight},o={left:n.screenX+i.left,top:n.screenY+i.top,...n.screen},s={browser:r,window:a,monitor:o}[e??``];if(s)return s;let c=e=>Math.abs(e.width/e.height-t.width/t.height);return[r,a,o].reduce((e,t)=>c(t)<c(e)?t:e)}function hie(){return typeof navigator.mediaDevices?.getDisplayMedia==`function`}async function gie(e,t){let n=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:`browser`},preferCurrentTab:!0,selfBrowserSurface:`include`});try{let r=document.createElement(`video`);r.muted=!0,r.srcObject=n,await r.play();let i={width:r.videoWidth,height:r.videoHeight},a=e.getBoundingClientRect(),o=mie(n.getVideoTracks()[0]?.getSettings().displaySurface,i,window),s=pie({left:a.left+o.left,top:a.top+o.top,width:a.width,height:a.height},o,i),c=document.createElement(`canvas`);c.width=s.width,c.height=s.height,c.getContext(`2d`)?.drawImage(r,s.x,s.y,s.width,s.height,0,0,s.width,s.height);let l=await new Promise(e=>c.toBlob(e,`image/png`));if(!l)throw Error(`empty capture`);return new File([l],t,{type:`image/png`})}finally{for(let e of n.getTracks())e.stop()}}async function _ie(e,t,n){let r=new Image;r.src=e,await r.decode();let i=document.createElement(`canvas`);i.width=r.naturalWidth||r.width,i.height=r.naturalHeight||r.height;let a=i.getContext(`2d`);if(!a)throw Error(`canvas unavailable`);if(a.drawImage(r,0,0,i.width,i.height),t){let e=t.getBoundingClientRect(),n=t.cloneNode(!0);n.setAttribute(`xmlns`,`http://www.w3.org/2000/svg`),n.setAttribute(`width`,String(e.width||i.width)),n.setAttribute(`height`,String(e.height||i.height));let r=getComputedStyle(t).stroke||`#e5734a`;n.setAttribute(`stroke`,r),n.setAttribute(`fill`,`none`),n.setAttribute(`stroke-width`,`2.5`),n.setAttribute(`stroke-linecap`,`round`),n.setAttribute(`stroke-linejoin`,`round`);let o=URL.createObjectURL(new Blob([new XMLSerializer().serializeToString(n)],{type:`image/svg+xml`}));try{let e=new Image;e.src=o,await e.decode(),a.drawImage(e,0,0,i.width,i.height)}finally{URL.revokeObjectURL(o)}}let o=await new Promise(e=>i.toBlob(e,`image/png`));if(!o)throw Error(`empty capture`);return new File([o],n,{type:`image/png`})}var B7=new Set,vie=2e3;function yie(e){B7.add(e)}function bie(e,t=vie){setTimeout(()=>B7.delete(e),t)}var V7=e=>B7.has(e);G(),H(),Ur();function xie(e){switch(e.kind){case`restored`:return U(`workspace.restored`);case`notLive`:return U(`workspace.tabNotLive`);case`exited`:return e.code===null?U(`workspace.exitedNoCode`):U(`workspace.exited`,{code:e.code});case`failed`:return U(`workspace.attachFailed`,{message:e.message});case`none`:return``}}function Sie(e){return e===null?U(`workspace.engineExitedNoCode`):U(`workspace.engineExited`,{code:e})}function H7(e){W();let{notice:t,engineExit:n,model:r,taskId:i,tabId:a,revive:o}=e,s=t.kind===`none`?n:null,c=t.kind===`none`&&!s&&e.usageLimit===!0&&!o.error,[l,u]=(0,J.useState)(!1);if(t.kind===`none`&&!s&&!c)return null;let d=c?r.tasks.get()?.attention.find(e=>e.taskId===i&&e.state===`rate_limited`)?.resumeAt:void 0,f=t.kind===`notLive`||t.kind===`restored`||t.kind===`exited`,p=t.kind===`exited`||s!==null,m=o.error?U(`workspace.reopenFailed`,{message:o.error}):s?Sie(s.code):c?d?U(`workspace.usageLimitUntil`,{time:new Date(d).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}):U(`workspace.usageLimit`):xie(t);return(0,K.jsxs)(`div`,{className:Ar(t.kind===`failed`||!!o.error),children:[(0,K.jsx)(`span`,{children:m}),e.onReopen&&(f||s)&&(0,K.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,disabled:o.busy,onClick:()=>e.onReopen?.(s!==null),children:o.busy?U(`workspace.reopening`):U(s?`workspace.retry`:`workspace.reopen`)}),t.kind===`failed`&&e.onRetryAttach&&(0,K.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:e.onRetryAttach,children:U(`workspace.retry`)}),c&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(q,{variant:`link`,hit:`tight`,onClick:()=>B.set((0,K.jsx)(TK,{model:r,taskId:i,context:`continue`,sourceTabId:a})),children:U(`menu.continueEngine`)}),(0,K.jsx)(q,{variant:`link`,hit:`tight`,disabled:l,onClick:()=>{u(!0),r.client.request(`task.resumeQuota`,{taskId:i}).catch(e=>z(e instanceof Error?e.message:String(e),`error`)).finally(()=>u(!1))},children:U(l?`workspace.resumingQuota`:`workspace.resumeQuota`)}),(0,K.jsx)(q,{variant:`link`,hit:`tight`,onClick:e.onDismissLimit,children:U(`workspace.dismiss`)})]}),p&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>B.set((0,K.jsx)(V3,{model:r,section:`engines`})),children:U(`workspace.engineSettings`)}),(0,K.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>B.set((0,K.jsx)(TK,{model:r,taskId:i})),children:U(`menu.newChatPick`)}),(0,K.jsx)(q,{variant:`link`,hit:`tight`,onClick:()=>B.set((0,K.jsx)(TK,{model:r,taskId:i,context:`continue`,sourceTabId:a})),children:U(`menu.continueEngine`)})]})]})}G(),El(),H();function U7(e,t,n,r,i,a){let o=Tl(t,n,r);B.set((0,K.jsx)(Ha,{title:cK(`reset.title`),body:cK(`reset.body`),confirmLabel:U(`workspace.reset`),onConfirm:async()=>{yie(o);try{await e.request(`tab.split`,{taskId:t,tabId:n,action:`reset`,leafId:r??`leaf-1`,...i}),await a()}finally{bie(o)}}}))}cb(),xb(),El(),qb(),Nx(),WE(),Ur();function Cie(e,t){let n=``,r=0,i=()=>{r=0;let i=e.getBoundingClientRect(),a=i.width>1&&i.height>1&&[[.02,.03],[.5,.5],[.98,.97],[.02,.97],[.98,.03]].every(([t,n])=>e.contains(document.elementFromPoint(i.x+i.width*t,i.y+i.height*n)))&&!document.querySelector(`[role="menu"], [aria-modal="true"], .overlay`),o=[i.x,i.y,i.width,i.height,a].join(`,`);o!==n&&(n=o,t(i,a))},a=()=>{document.hidden?i():r||=requestAnimationFrame(i)},o=new ResizeObserver(a);o.observe(e);let s=new MutationObserver(a);return s.observe(document.body,{childList:!0,attributes:!0,subtree:!0}),window.addEventListener(`resize`,a),window.addEventListener(`scroll`,a,!0),document.addEventListener(`transitionend`,a),document.addEventListener(`visibilitychange`,a),i(),()=>{o.disconnect(),s.disconnect(),cancelAnimationFrame(r),window.removeEventListener(`resize`,a),window.removeEventListener(`scroll`,a,!0),document.removeEventListener(`transitionend`,a),document.removeEventListener(`visibilitychange`,a)}}function wie(e){let{client:t,taskId:n,tabId:r,leafId:i}=e,a=(0,J.useRef)(null),o=(0,J.useRef)(e);o.current=e;let[s,c]=(0,J.useState)({kind:`none`}),[l,u]=(0,J.useState)(0),[d,f]=(0,J.useState)(!1),p=Tl(n,r,i);return(0,J.useEffect)(()=>{if(!a.current||!T6)return;let e=a.current,s=String(l)+crypto.randomUUID(),u=(e,t={})=>T6?.postMessage({id:s,op:e,...t}),d=(e,n)=>void t.request(e,n).catch(()=>{}),f=!1,m=0,h=!1,g=0,_=0,v=null,y=BE(e=>{h&&d(`term.ack`,{stream:p,chars:e})}),b=async()=>{if(!f||!g||!_)return;let e={cols:g,rows:_},a=++m;h=!1,v=[];try{let o=await t.request(`term.attach`,{taskId:n,tabId:r,...i&&i!==`leaf-1`?{leafId:i}:{},...e,acks:!0});if(m!==a)return;h=o.alive,h&&(g!==e.cols||_!==e.rows)&&d(`term.resize`,{stream:p,cols:g,rows:_}),u(`replay`,{data:o.replay});for(let e of v??[])u(`data`,{data:e});v=null,c(o.alive?{kind:`none`}:{kind:o.restored?`restored`:`notLive`})}catch(e){m===a&&(v=null,c({kind:`failed`,message:String(e)}))}},x=!1,S=e=>{h&&d(`term.input`,{stream:p,data:e})},C=Ax(S),w={stream:p,input:S,focus:()=>u(`focus`),size:()=>({cols:g,rows:_}),reattach:b,scrollPages:e=>u(`scroll`,{direction:e}),hasSelection:()=>x,copySelection:()=>(x&&u(`copy`),x),reset:()=>U7(t,n,r,i,{cols:g,rows:_},async()=>{await b(),u(`focus`)})},T=Kc(w),E=E6(e=>{if(e.id===s&&((e.action===`input`||e.action===`reply`)&&e.data&&C.forward(e.data),e.action===`selection`&&(x=e.selected===!0),e.action===`blur`&&Gc.get()===w&&Gc.set(null),e.action===`parsed`&&e.chars&&y.parsed(e.chars),e.action===`focus`&&(Gc.set(w),o.current.onActivate?.()),e.action===`size`&&e.cols&&e.rows)){let t=!g;g=e.cols,_=e.rows,t?b():h&&d(`term.resize`,{stream:p,cols:g,rows:_})}}),D=[t.on(`term.data`,e=>{let t=zE(e);t?.stream!==p||!t.data||(v?v.push(t.data):h&&u(`data`,{data:t.data}))}),t.on(`term.reset`,e=>{let t=VE(e);h&&t?.stream===p&&u(`reset`,{data:t.replay})}),t.on(`term.exit`,e=>{let t=zE(e);t?.stream===p&&(h=!1,++m,v=null,c({kind:`exited`,code:t.code??null}),V7(p)||o.current.onExit?.())}),t.conn.subscribe(()=>{t.conn.get().state!==`open`&&(f=!1,h=!1,v=null,++m)}),t.onOpen(()=>{f=!0,b()})],O=()=>{let e=ab.get()??Wb,t=getComputedStyle(document.documentElement);return{dark:t.colorScheme!==`light`,subtle:t.getPropertyValue(`--subtle`).trim(),muted:t.getPropertyValue(`--muted`).trim(),foreground:e.foreground,background:e.background,scrollback:yb.get().prefs.scrollbackRows}},k=()=>u(`appearance`,O());D.push(ab.subscribe(k),yb.subscribe(k));let ee=Cie(e,(e,t)=>u(`frame`,{x:e.x,y:e.y,width:e.width,height:e.height,visible:t,focus:o.current.focused!==!1,...O()}));return()=>{++m,h=!1;for(let e of D)e();T(),E(),y.dispose(),ee(),u(`remove`),f&&g&&d(`term.detach`,{stream:p}),f=!1}},[t,n,r,i,p,l]),(0,K.jsx)(`div`,{className:wr,"data-stream":p,children:(0,K.jsxs)(`div`,{className:Tr,children:[(0,K.jsx)(`div`,{className:Er,ref:a,"data-native-terminal":``}),(0,K.jsx)(H7,{model:e.model,taskId:n,tabId:r,notice:s,engineExit:e.engineExit??null,revive:{busy:d,error:null},onRetryAttach:()=>u(e=>e+1),onReopen:async e=>{f(!0);try{await t.request(`term.revive`,{taskId:n,tabId:r,...e?{restartExited:e}:{}}),u(e=>e+1)}catch(e){c({kind:`failed`,message:String(e)})}finally{f(!1)}}})]})})}G(),Fb(),Ur();var W7={up:`layout.termKeyUp`,down:`layout.termKeyDown`,left:`layout.termKeyLeft`,right:`layout.termKeyRight`,interrupt:`layout.termKeyInterrupt`,enter:`layout.termKeyEnter`};function G7({to:e,atMenu:t}){W();let n=typeof e==`function`?null:e,[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(!1);(0,J.useEffect)(()=>{n?.armCtrl(r?()=>i(!1):null)},[n,r]),(0,J.useEffect)(()=>()=>n?.armCtrl(null),[n]);let s=t=>typeof e==`function`?e(t.bytes(!1)):e.term.input(t.bytes(e.term.modes.applicationCursorKeysMode),!0),c=e=>(0,K.jsx)(`button`,{type:`button`,className:$n(`off`),"aria-label":W7[e.id]?U(W7[e.id]):void 0,onClick:()=>{i(!1),s(e)},children:e.cap},e.id),l=oee(t);return(0,K.jsxs)(`div`,{className:`mono ${Zn}`,role:`toolbar`,"aria-label":U(`layout.termKeys`),onPointerDown:e=>e.preventDefault(),children:[a&&n&&(0,K.jsx)(`button`,{type:`button`,className:$n(r?`on`:`off`),"aria-pressed":r,onClick:()=>i(!r),children:`ctrl`}),(a?l.rest:l.first).map(c),(0,K.jsx)(`button`,{type:`button`,className:$n(r&&!a?`hint`:`off`),"aria-expanded":a,"aria-label":U(`layout.termKeyMore`),onClick:()=>o(!a),children:`⋯`}),(0,K.jsx)(nO,{label:U(`layout.termKeyHideKeyboard`)})]})}G(),H();function Tie(e){let t=e.split(`
|
|
257
|
+
`).map(e=>e.trimEnd());for(;t[0]===``;)t.shift();for(;t.at(-1)===``;)t.pop();if(t.length===0)return null;let n=Math.max(0,...Array.from(t.join(`
|
|
258
|
+
`).matchAll(/`+/g),e=>e[0].length)),r="`".repeat(Math.max(3,n+1));return`${r}\n${t.join(`
|
|
259
|
+
`)}\n${r}\n`}function Eie(e){let t=document.querySelector(`[data-composer="${CSS.escape(e)}"]`);return t&&t.offsetParent!==null?t:null}function Die(e,t,n,r){let i=Tie(e.term.getSelection());if(i===null)return!1;let a=TZ(t,n),o=Eie(a);if(o){kZ(a,i),e.term.clearSelection();let t=o.querySelector(`textarea`);return t?.focus(),t?.setSelectionRange(t.value.length,t.value.length),!0}return r?(z(U(`quote.atMenu`),`error`),!1):e.term.modes.bracketedPasteMode?(e.term.paste(i),e.term.clearSelection(),e.term.focus(),!0):(z(U(`quote.notReady`),`error`),!1)}G(),A(),El(),qb(),H(),Ur();async function K7(e,t,n){for(let r of n){r.size>1048576&&z(U(`layout.dropUploading`,{name:r.name}));try{t.term.paste(`${await rk(e,r,t.stream.split(`::`)[0])} `)}catch(e){z(e instanceof Error?e.message:String(e),`error`)}}t.term.focus()}async function Oie(){if(!navigator.clipboard?.read)throw Error(U(`layout.pasteNeedsHttps`));let e=[];for(let t of await navigator.clipboard.read())for(let n of t.types)(n.startsWith(`image/`)||n===`application/pdf`)&&e.push(new File([await t.getType(n)],`clipboard`,{type:n}));return e}async function q7(e,t){let n;try{n=await Oie()}catch(e){z(U(`layout.pasteNoAccess`,{error:e instanceof Error?e.message:String(e)}),`error`);return}n.length===0?z(U(`layout.pasteNoImage`),`error`):await K7(e,t,n)}async function J7(e){try{return await navigator.clipboard.writeText(e),!0}catch{return z(U(`menu.copyFailed`),`error`),!1}}function kie(e){return T6?(0,K.jsx)(wie,{...e}):(0,K.jsx)(Aie,{...e})}function Aie(e){let{client:t,taskId:n,tabId:r,leafId:i}=e,a=k(e.model.tasks)?.tasks.find(e=>e.id===n)?.tabStatus?.[r]?.kind===`needs-input`;W();let o=(0,J.useRef)(null),[s,c]=(0,J.useState)({kind:`none`}),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(0),[p,m]=(0,J.useState)({busy:!1,error:null}),h=(0,J.useRef)(e);h.current=e,sR(t);let g=e.composer===!0&&cR(t),_=(0,J.useRef)(g);_.current=g,(0,J.useEffect)(()=>{let e=o.current;if(!e)return;let a=null,s=!1,l=[document.fonts.load(`13px "JetBrains Mono"`),document.fonts.load(`bold 13px "JetBrains Mono"`)];document.fonts.load(`13px "${Gb}"`,String.fromCodePoint(57504)).catch(()=>{});let d=()=>{s||dD({client:t,host:e,taskId:n,tabId:r,leafId:i,focusOnMount:h.current.focused!==!1&&!_.current},{setNotice:c,onScrolled:f,onFocusChange:e=>{if(!a)return;let{stream:t}=a.handle;e?(h.current.onActivate?.(),Gc.set(qc(t)??null)):Gc.get()?.stream===t&&Gc.set(null)},onExit:()=>{V7(Tl(n,r,i))||h.current.onExit?.()},copyText:J7,pasteImage:async()=>{a&&await q7(t,a.handle)}}).then(e=>{s?e.release():(a=e,u(e.handle))})};return uD(t,n,r,i)?d():Promise.allSettled(l).then(d),()=>{s=!0,u(null),a?.release()}},[t,n,r,i]);let[v,y]=(0,J.useState)(!1);(0,J.useEffect)(()=>{if(!l)return;y(l.term.hasSelection());let e=l.term.onSelectionChange(()=>y(l.term.hasSelection()));return()=>{e.dispose(),y(!1)}},[l]),(0,J.useEffect)(()=>{if(!l)return;let{term:e,stream:a}=l,o={stream:a,focus:()=>e.focus(),input:t=>e.input(t,!0),reattach:()=>l.reattach(),scrollPages:e=>l.scrollLines(e*10),hasSelection:()=>e.hasSelection(),copySelection:()=>{let t=e.getSelection();return t.trim().length!==0&&(J7(t),e.clearSelection(),!0)},reset:()=>U7(t,n,r,i,{cols:e.cols,rows:e.rows},async()=>{await l.reattach(),e.focus()}),size:()=>({cols:e.cols,rows:e.rows})},s=Kc(o);return document.activeElement===e.textarea&&Gc.set(o),()=>{s()}},[l,t,n,r,i]),(0,J.useEffect)(()=>{e.focused&&!g&&l&&document.activeElement!==l.term.textarea&&l.term.focus()},[e.focused,g,l]);let b=!i||i===`leaf-1`,[x,S]=(0,J.useState)(null),C=e.engineExit?.since===x,[w,T]=(0,J.useState)(null),E=e.usageLimit&&e.usageLimit.since!==w?e.usageLimit:null,D=(0,J.useRef)(!1),O=async(i,a)=>{if(!D.current){D.current=!0,m({busy:!0,error:null});try{await t.request(`term.revive`,{taskId:n,tabId:r,...a?{restartExited:a}:{}}),await i.reattach(),i.term.focus(),S(e.engineExit?.since??null),m({busy:!1,error:null})}catch(e){m({busy:!1,error:e instanceof Error?e.message:String(e)})}finally{D.current=!1}}};return(0,K.jsxs)(`div`,{className:wr,"data-stream":Tl(n,r,i),onDragOver:e=>e.dataTransfer.types.includes(`Files`)&&e.preventDefault(),onDrop:e=>{!e.dataTransfer.files.length||!l||(e.preventDefault(),K7(t,l,Array.from(e.dataTransfer.files)))},onPasteCapture:e=>{if(!l||e.target.closest(`form[data-composer]`))return;let n=Array.from(e.clipboardData.files);(n.length!==0||e.clipboardData.getData(`text/plain`)===``)&&(e.preventDefault(),e.stopPropagation(),n.length>0?K7(t,l,n):q7(t,l))},children:[(0,K.jsxs)(`div`,{className:Tr,children:[(0,K.jsx)(`div`,{className:Er,ref:o}),(0,K.jsx)(H7,{notice:s,engineExit:C?null:e.engineExit??null,model:e.model,taskId:n,tabId:r,revive:p,onReopen:b&&l?e=>void O(l,e):void 0,onRetryAttach:l?()=>void l.reattach():void 0,usageLimit:E!==null,onDismissLimit:E?()=>T(E.since):void 0}),v&&e.composer&&l&&(0,K.jsx)(q,{variant:`floating`,className:`absolute top-2.5 right-2.5 z-4`,title:U(`quote.title`),onClick:()=>Die(l,n,r,a),children:U(`quote.action`)}),d>0&&l&&(0,K.jsxs)(`div`,{className:`mono absolute right-2.5 bottom-2.5 z-4 flex gap-3 rounded-sm border-hairline border-line bg-inset px-2.5 py-1 text-meta`,children:[(0,K.jsx)(`span`,{className:`text-warning`,children:cK(`scrolledBack`,{lines:d})}),(0,K.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>l.scrollToTop(),children:cK(`scrollFirst`)}),(0,K.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>l.scrollToBottom(),children:cK(`scrollLatest`)})]})]}),e.composer&&(0,K.jsx)(LZ,{model:e.model,taskId:n,tabId:r}),l&&(0,K.jsx)(G7,{to:l,atMenu:a})]})}G(),H();var jie=[{tool:`pen`,d:`M3 13l.6-2.6L10.9 3.1l2 2L5.6 12.4zM9.6 4.4l2 2`},{tool:`box`,d:`M3 4h10v8H3z`},{tool:`text`,d:`M4 4h8M8 4v8.5`}];function Mie({mark:e}){return e.kind===`pen`?(0,K.jsx)(`path`,{d:e.d}):e.kind===`box`?(0,K.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:e.h,rx:2}):(0,K.jsx)(`text`,{x:e.x,y:e.y,className:`fill-accent stroke-none font-mono text-body font-semibold`,children:e.text})}function Nie({model:e,taskId:t,url:n,target:r,backdrop:i,onClose:a}){let[o,s]=(0,J.useState)(`pen`),[c,l]=(0,J.useState)([]),[u,d]=(0,J.useState)(null),[f,p]=(0,J.useState)(null),[m,h]=(0,J.useState)(!1),g=(0,J.useRef)(null),_=e=>{let t=e.currentTarget.getBoundingClientRect();return{x:Math.round(e.clientX-t.left),y:Math.round(e.clientY-t.top)}},v=e=>{let{x:t,y:n}=_(e);o!==`text`&&(e.currentTarget.setPointerCapture(e.pointerId),d(o===`pen`?{kind:`pen`,d:`M${t} ${n}`}:{kind:`box`,x:t,y:n,w:0,h:0}))},y=e=>{if(!u)return;let{x:t,y:n}=_(e);u.kind===`pen`?d({kind:`pen`,d:`${u.d} L${t} ${n}`}):u.kind===`box`&&d({...u,w:Math.max(0,t-u.x),h:Math.max(0,n-u.y)})},b=()=>{u&&(u.kind!==`box`||u.w>2&&u.h>2)&&l([...c,u]),d(null)},x=e=>{f&&e.trim()&&l([...c,{kind:`text`,...f,text:e.trim()}]),p(null)},S=async()=>{let o=ve.get(),s=o?.startsWith(`${t}::`)?lD(e.client,o):null,c=r.current;if(!s||!c){z(U(`browser.noEngine`),`error`);return}h(!0);try{let t=`browser-${Lz(n)}.png`,r=i?await _ie(i,g.current,t):await gie(c,t);await K7(e.client,s,[r]),a()}catch(e){e instanceof DOMException&&e.name===`NotAllowedError`||z(U(`browser.captureFailed`,{error:e instanceof Error?e.message:String(e)}),`error`),h(!1)}};return(0,K.jsxs)(K.Fragment,{children:[i&&(0,K.jsx)(`img`,{src:i,alt:``,className:`size-full object-contain`}),(0,K.jsxs)(`svg`,{ref:g,className:mi,"aria-label":U(`browser.annotate`),onPointerDown:v,onPointerMove:y,onPointerUp:b,onPointerCancel:b,onClick:e=>o===`text`&&p(_(e)),children:[(0,K.jsx)(`title`,{children:U(`browser.annotate`)}),[...c,...u?[u]:[]].map((e,t)=>(0,K.jsx)(Mie,{mark:e},t))]}),f&&(0,K.jsx)(`input`,{autoFocus:!0,className:`absolute min-w-24 rounded-xs border-hairline border-accent bg-paper px-1 font-mono text-body text-accent focus:outline-none`,style:{left:f.x,top:f.y-14},"aria-label":U(`browser.text`),onBlur:e=>x(e.target.value),onKeyDown:e=>e.key===`Enter`&&e.currentTarget.blur()},`${f.x},${f.y}`),!m&&(0,K.jsxs)(`div`,{className:`absolute bottom-3 left-1/2 flex w-max -translate-x-1/2 items-center whitespace-nowrap gap-0.5 rounded-md border-hairline border-line bg-surface p-1 shadow-popover [&_svg]:flex-none`,children:[jie.map(e=>(0,K.jsx)(q,{variant:o===e.tool?`iconOn`:`icon`,title:U(`browser.${e.tool}`),"aria-label":U(`browser.${e.tool}`),"aria-pressed":o===e.tool,onClick:()=>s(e.tool),children:(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:e.d})})},e.tool)),(0,K.jsx)(q,{variant:`icon`,disabled:c.length===0,title:U(`browser.undo`),"aria-label":U(`browser.undo`),onClick:()=>l(c.slice(0,-1)),children:(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:`M5.5 3.5 3 6l2.5 2.5M3 6h6.5a3 3 0 0 1 0 6H7`})})}),(0,K.jsx)(q,{variant:`filled`,onClick:()=>void S(),children:U(`browser.addToChat`)}),(0,K.jsx)(q,{variant:`icon`,title:U(`browser.annotateDone`),"aria-label":U(`browser.annotateDone`),onClick:a,children:(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]})]})}G();var Pie=5e3;function Y7(e,t){let[n,r]=(0,J.useState)([]);return(0,J.useEffect)(()=>{r([]);let n=!0,i=()=>e.client.request(`browser.ports`,{taskId:t}).then(e=>n&&r(e.ports),()=>{});i();let a=window.setInterval(()=>void i(),Pie);return()=>{n=!1,window.clearInterval(a)}},[e,t]),n}function Fie({model:e,task:t}){W();let n=t.id,r=Y7(e,n);return r.length===0?null:(0,K.jsx)(`div`,{className:`flex flex-wrap justify-end gap-x-3.5 gap-y-1 px-2 pb-2 font-mono text-meta whitespace-nowrap`,children:r.map(e=>(0,K.jsx)(q,{onClick:()=>FB(n,e.url),children:U(`files.openPort`,{port:e.port})},e.port))})}function Iie(e){let[t,n]=(0,J.useState)(0),r=e.open&&e.items.length>0,i=Math.min(t,Math.max(0,e.items.length-1)),a=(0,J.useRef)(null),{onCursor:o}=e;return(0,J.useEffect)(()=>o?.(i),[i,o]),(0,J.useEffect)(()=>{a.current?.scrollIntoView({block:`nearest`})},[i,e.items]),(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsx)(`input`,{className:ji,"data-field":e.field,spellCheck:!1,autoComplete:`off`,autoFocus:e.autoFocus,placeholder:e.placeholder,value:e.value,onChange:t=>{n(0),e.onChange(t.target.value.replace(/[\r\n]+/g,``))},onKeyDown:t=>{if(!t.nativeEvent.isComposing){if(t.key===`ArrowDown`||t.key===`ArrowUp`){if(!r)return;t.preventDefault(),n(Math.max(0,Math.min(e.items.length-1,i+(t.key===`ArrowDown`?1:-1))))}else t.key===`Tab`&&!t.shiftKey&&r&&e.onComplete?.(i)?(t.preventDefault(),n(0)):t.key===`Enter`&&!t.ctrlKey&&!t.metaKey&&(t.preventDefault(),r?((e.onEnterRow??e.onPick)(i),n(0)):e.onEnter?.())}}}),r&&(0,K.jsx)(`ul`,{className:`mx-0 mt-1 mb-0 max-h-47 list-none overflow-y-auto rounded-sm border-hairline border-line bg-inset p-0.5 font-mono text-meta`,children:e.items.map((t,n)=>(0,K.jsx)(`li`,{ref:n===i?a:void 0,children:(0,K.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":n===i,className:Ei({cursor:n===i,accent:!!t.accent}),onMouseDown:t=>{t.preventDefault(),e.onPick(n)},children:[(0,K.jsx)(`span`,{children:t.text}),t.dim&&(0,K.jsxs)(`span`,{className:`text-muted`,children:[` `,t.dim]})]})},t.key))})]})}G(),H();function Lie(e,t,n){let r=[{ref:null,suggestion:{key:`default`,text:t,dim:U(`review.baseDefault`),accent:!0}}],i=(e,n)=>{for(let i of e)i!==t&&r.push({ref:i,suggestion:{key:`${n}:${i}`,text:i,dim:n}})};i(e?.branches??[],U(`review.baseBranch`)),i(e?.remotes??[],U(`review.baseRemote`)),i(e?.tags??[],U(`review.baseTag`));for(let t of e?.commits??[])r.push({ref:t.sha,suggestion:{key:`commit:${t.sha}`,text:t.sha,dim:t.subject}});let a=n.trim().toLowerCase();if(a===``)return r.slice(0,40);let o=e=>{if(e.suggestion.text.toLowerCase()===a)return 0;let t=MA(e.suggestion.text,a);return t===`substring`||(e.suggestion.dim??``).toLowerCase().includes(a)?1:t===`segments`?2:null};return r.flatMap(e=>{let t=o(e);return t===null?[]:[{c:e,r:t}]}).sort((e,t)=>e.r-t.r).map(e=>e.c).slice(0,40)}function Rie(e){let[t,n]=(0,J.useState)(!1),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(null),s=e.model.client;(0,J.useEffect)(()=>{if(!t)return;let n=!0;return Ws(s,`diff.refs`,{taskId:e.taskId}).then(e=>n&&o(e),()=>{}),()=>{n=!1}},[t,s,e.taskId]);let c=Lie(a,e.base,r),l=t=>{e.onPick(t),n(!1),i(``)},u=e.custom??e.base,d=[{id:`task`,label:U(`review.scopeTask`)},{id:`working`,label:U(`review.scopeWorking`)},{id:`branch`,label:U(`review.scopeBranch`)}],f=d.find(t=>t.id===e.scope)?.label??``;return(0,K.jsxs)(`span`,{className:`relative`,onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&t&&n(!1)},children:[(0,K.jsx)(q,{hit:`tight`,"aria-expanded":t,"aria-haspopup":`menu`,onClick:t=>{let r=t.currentTarget.getBoundingClientRect();de.set({x:r.left,y:r.bottom+2,target:t.currentTarget,items:[...d.map(t=>({label:t.label,section:`scope`,checked:t.id===e.scope,run:()=>e.onScope(t.id)})),{label:U(`review.compareAgainst`,{base:u}),section:`base`,run:()=>n(!0)}]})},children:U(`review.scopeMenu`,{base:u,scope:f})}),t&&(0,K.jsx)(`div`,{className:`absolute top-full left-0 z-3 mt-1 w-64 max-w-full rounded-sm border-hairline border-line-active bg-surface p-1 shadow-popover`,children:(0,K.jsx)(Iie,{field:`diff-base`,autoFocus:!0,value:r,onChange:i,items:c.map(e=>e.suggestion),open:!0,placeholder:U(`review.basePlaceholder`),onPick:e=>l(c[e]?.ref??null),onEnter:()=>l(r.trim()===``?null:r.trim())})})]})}var X7=`rove.diffBase`;function Z7(){try{let e=JSON.parse(localStorage.getItem(X7)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return{}}}function zie(e){return Z7()[e]??null}function Bie(e,t){let n=Z7();t===null?delete n[e]:n[e]=t;try{localStorage.setItem(X7,JSON.stringify(n))}catch{}}function Vie(e){let[t,n]=(0,J.useState)(()=>zie(e.taskId));return[t,t=>{Bie(e.taskId,t),n(t),t!==null&&e.scope!==`task`&&NB({taskId:e.taskId,path:e.path,scope:`task`})}]}G();var Hie=(0,J.memo)(function(e){return(0,K.jsxs)(`div`,{className:`flex items-center ${e.viewed?`opacity-60`:``}`,children:[(0,K.jsxs)(q,{variant:`row`,"data-row":e.index,"aria-expanded":!e.closed,"aria-label":U(e.closed?`review.unfold`:`review.fold`,{path:e.name}),className:`${uz(`file`,{cursor:e.cursor,noted:!1})} min-w-0 flex-1 text-left`,onClick:()=>e.onToggleFold(e.index,e.path),children:[(0,K.jsx)(`span`,{className:`grid place-items-center text-subtle`,children:(0,K.jsx)(tI,{right:e.closed})}),(0,K.jsxs)(`span`,{className:hz,children:[(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),e.added?(0,K.jsxs)(YR,{tone:`added`,children:[`+`,e.added]}):null,e.removed?(0,K.jsxs)(YR,{tone:`removed`,children:[`−`,e.removed]}):null]})]}),e.path!==null&&(0,K.jsx)(q,{hit:`tight`,className:`flex-none px-2`,"aria-pressed":e.viewed,"aria-label":U(e.viewed?`review.unmarkViewed`:`review.markViewed`,{path:e.name}),onClick:()=>e.path!==null&&e.onToggleViewed(e.path),children:e.viewed?U(`review.viewedOn`):U(`review.viewed`)})]})});G();function Uie(e){return(0,K.jsxs)(`div`,{className:`absolute top-full right-3 z-1 flex gap-1.5`,children:[(0,K.jsx)(q,{variant:`floating`,onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),e.onComment()},children:U(`review.comment`)}),e.showRange&&(0,K.jsx)(q,{variant:`floating`,onClick:t=>{t.stopPropagation(),e.onRange()},children:U(`review.range`)}),e.ranged&&(0,K.jsx)(q,{variant:`floating`,title:U(`preview.askInChatHint`),onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),e.onAsk()},children:U(`preview.askInChat`)})]})}function Wie({note:e,onEdit:t}){return(0,K.jsxs)(q,{variant:`row`,className:`${uz(`note`,{cursor:!1,noted:!1})} w-full text-left`,onClick:t,children:[(0,K.jsx)(`span`,{className:fz}),(0,K.jsx)(`span`,{}),(0,K.jsx)(`span`,{className:`text-accent`,children:`●`}),(0,K.jsx)(`span`,{className:_te,children:e.body})]})}G();function Gie(e){let t=(0,J.useRef)(e);return t.current=e,(0,J.useMemo)(()=>({rowClick:(e,n)=>t.current.rowClick(e,n),fileClick:(e,n)=>t.current.fileClick(e,n),viewedClick:e=>t.current.viewedClick(e),editNote:e=>t.current.editNote(e)}),[])}var Q7=2e3,Kie=(0,J.memo)(function(e){let{index:t,row:n,noted:r}=e;return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{"data-row":t,className:uz(n.kind,{cursor:e.cursor,noted:r}),onClick:n=>e.onClick(t,n),children:[(0,K.jsx)(`span`,{className:fz,children:n.oldNo??``}),(0,K.jsx)(`span`,{className:dz,children:n.newNo??``}),(0,K.jsx)(`span`,{className:pz(n.kind,r,e.changed),children:n.kind===`add`?`+`:n.kind===`del`?`−`:r?`●`:e.changed?`▎`:` `}),(0,K.jsxs)(`span`,{className:mz(n.kind),children:[n.text.length>Q7?n.text.slice(0,Q7):n.text,n.text.length>Q7&&(0,K.jsxs)(`span`,{className:`text-subtle`,children:[` `,U(`review.lineClipped`,{count:(n.text.length-Q7).toLocaleString()})]})]}),e.actions]}),e.notes?.map(t=>t.id===e.editId?(0,K.jsx)(J.Fragment,{children:e.composer},t.id):(0,K.jsx)(Wie,{note:t,onEdit:()=>e.onEditNote(t)},t.id)),e.editId===void 0&&e.composer]})});G();function qie(e){return(0,K.jsxs)(`div`,{className:`flex flex-none flex-wrap items-center gap-x-3 gap-y-1 px-2 pt-1.5 font-mono text-meta`,children:[e.picker,(0,K.jsx)(q,{hit:`tight`,"aria-pressed":e.ignoreWs,title:U(`review.ignoreWsHint`),className:`opacity-60 aria-pressed:underline aria-pressed:opacity-100`,onClick:e.onToggleWs,children:U(`review.ignoreWs`)}),(0,K.jsxs)(`span`,{className:`flex min-w-0 basis-full flex-wrap items-center gap-x-1.5 text-muted`,children:[U(e.files===1?`review.totalsOne`:`review.totals`,{files:e.files,added:e.added,removed:e.removed}),e.shape&&(0,K.jsxs)(`span`,{children:[`· `,e.shape]}),e.files>0&&(0,K.jsxs)(`span`,{className:`whitespace-nowrap`,children:[`· `,U(`review.viewedCount`,{done:e.viewed,files:e.files})]})]}),(0,K.jsxs)(`span`,{className:`ml-auto flex items-center gap-x-3`,children:[e.files>1&&(0,K.jsx)(q,{hit:`tight`,onClick:e.onNextFile,children:U(`review.nextFile`)}),e.onNextComment&&(0,K.jsx)(q,{hit:`tight`,onClick:e.onNextComment,children:U(`review.nextComment`)}),e.files>1&&(0,K.jsx)(q,{hit:`tight`,onClick:e.onFoldAll,children:e.allFolded?U(`review.unfoldAll`):U(`review.foldAll`)})]})]})}var $7=`rove.diffViewed`,e9=(e,t)=>`${e}\0${t}`,t9=4096;function Jie(e){let t=2166136261;for(let n of e){let e=n.text.length>t9?`${n.text.slice(0,t9/2)}${n.text.length}${n.text.slice(-2048)}`:n.text,r=`${n.kind}${e}\n`;for(let e=0;e<r.length;e++)t=Math.imul(t^r.charCodeAt(e),16777619)}return(t>>>0).toString(16)}function Yie(e){let t=new Map,n=-1,r=r=>{let i=n>=0?e[n]?.path:null;i&&t.set(i,Jie(e.slice(n+1,r)))};return e.forEach((e,t)=>{e.kind===`file`&&(r(t),n=t)}),r(e.length),t}function Xie(){try{let e=JSON.parse(localStorage.getItem($7)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return{}}}function Zie(e){try{localStorage.setItem($7,JSON.stringify(e))}catch{}}function Qie(e,t,n){let r=new Set;for(let[i,a]of n)e[e9(t,i)]===a&&r.add(i);return r}function $ie(e,t,n,r){let i={...e};return r===void 0?delete i[e9(t,n)]:i[e9(t,n)]=r,i}function n9(e,t){return e.find(e=>e>t)??e[0]??null}var r9=`rove.diffIgnoreWs`;function eae(){try{return localStorage.getItem(r9)===`1`}catch{return!1}}function tae(e){try{localStorage.setItem(r9,e?`1`:`0`)}catch{}}G();function nae(e){return(0,K.jsx)(`div`,{className:`flex flex-none items-center gap-3 px-2 pt-1.5 font-mono text-meta`,children:(0,K.jsx)(q,{hit:`tight`,onClick:()=>e.file?NB({taskId:e.taskId,path:e.path,scope:`working`}):PB(e.taskId,e.path),children:U(e.file?`preview.modeDiff`:`preview.modeFile`)})})}function rae(e,t,n,r,i){let[a,o]=(0,J.useState)(null);return(0,J.useEffect)(()=>{if(!r)return;let i=!0;return Ws(e,`diff.file`,{taskId:t,path:n,scope:`working`}).then(e=>{if(!i)return;let t=e.kind===`diff`&&typeof e.text==`string`?wR(e.text,n):[];o(new Set(t.flatMap(e=>e.kind===`add`&&e.newNo!==null?[e.newNo]:[])))},()=>i&&o(null)),()=>{i=!1}},[e,t,n,r,i]),r?a:null}var i9=[`renamed`,`added`,`untracked`,`modified`,`deleted`,`conflict`],iae={U:`conflict`,D:`deleted`,M:`modified`,T:`modified`,"?":`untracked`,A:`added`,R:`renamed`,C:`renamed`},a9={conflict:`attention`,deleted:`attention`,modified:`warning`,untracked:`success`,added:`success`,renamed:`accent`},aae={conflict:`!`,deleted:`D`,modified:`M`,untracked:`U`,added:`A`,renamed:`R`};function o9(e){let t=new Map;for(let n of[`branch`,`working`])for(let r of e){let e=r.scope===n?iae[r.status]:void 0;e&&t.set(r.path,e)}let n=new Map(t);for(let[e,r]of t)for(let t=e.indexOf(`/`);t>=0;t=e.indexOf(`/`,t+1)){let i=e.slice(0,t+1),a=n.get(i);(a===void 0||i9.indexOf(r)>i9.indexOf(a))&&n.set(i,r)}return n}function oae(e,t){return e.some(e=>e.scope===`working`&&e.path===t&&e.status!==`?`)}var sae={add:`+`,del:`-`},cae=40,lae=160,s9=e=>`${sae[e.kind]??` `}${e.text.slice(0,lae)}`,c9=e=>e.startLine!==void 0&&e.startLine!==e.line?`${e.filePath}:${e.startLine}-${e.line}`:`${e.filePath}:${e.line}`;function uae(e,t,n){let r=[];for(let i=t;i<=n&&r.length<cae;i++){let t=e[i];t&&ER(t)!==null&&r.push(s9(t))}return r.join(`
|
|
260
|
+
`)}function l9(e,t){let n=e.startLine??e.line,r=t.flatMap((t,n)=>t.path===e.filePath&&ER(t)!==null?[n]:[]);if(!e.code){let i=r.filter(r=>{let i=ER(t[r]);return i>=n&&i<=e.line}),a=i[0],o=i[i.length-1];return a===void 0||o===void 0?null:{first:a,last:o}}let i=e.code.split(`
|
|
261
|
+
`);for(let e=0;e+i.length<=r.length;e++){let a=r.slice(e,e+i.length),o=a[0],s=a[a.length-1];if(o!==void 0&&s!==void 0&&ER(t[o])===n&&a.every((e,n)=>s9(t[e])===i[n]))return{first:o,last:s}}return null}function dae(e,t,n){return l9(e,t)?`ok`:t.some(t=>t.path===e.filePath)||n?`moved`:`unknown`}G();function fae(e){let[t,n]=(0,J.useState)(null),r=()=>{n(null),e.focusView()},i=async n=>{if(t){if(t.kind===`add`){let{target:r}=t;await e.client.request(`review.add`,{taskId:e.taskId,filePath:r.path,line:r.line,...r.startLine?{startLine:r.startLine}:{},code:uae(e.rows,r.first,r.last),body:n})}else await e.client.request(`review.edit`,{taskId:e.taskId,id:t.note.id,body:n}).catch(e=>{throw qR(e)});e.onSaved(t.kind===`add`),r()}};return{node:t&&(0,K.jsx)(pae,{location:t.kind===`add`?c9({filePath:t.target.path,startLine:t.target.startLine,line:t.target.line}):c9(t.note),...t.kind===`edit`?{initial:t.note.body}:{},onSubmit:i,onCancel:r}),row:t?t.kind===`add`?t.target.last:l9(t.note,e.rows)?.last??-1:null,editId:t?.kind===`edit`?t.note.id:void 0,add:()=>e.target&&n({kind:`add`,target:e.target}),edit:e=>n({kind:`edit`,note:e})}}function pae(e){let[t,n]=(0,J.useState)(e.initial??``),r=Ii(t),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(null),c=e.initial!==void 0,l=t.trim(),u=async()=>{if(!(!l||i)){a(!0),s(null);try{await e.onSubmit(l)}catch(e){s(e instanceof Error?e.message:String(e)),a(!1)}}};return(0,K.jsxs)(`div`,{className:uz(`note`,{cursor:!1,noted:!1}),onKeyDown:e=>e.stopPropagation(),onMouseUp:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[(0,K.jsx)(`span`,{className:fz}),(0,K.jsx)(`span`,{}),(0,K.jsx)(`span`,{className:`text-accent`,children:`●`}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5 whitespace-normal`,children:[(0,K.jsx)(`textarea`,{ref:r,className:`${ji} ${zi} font-mono`,"aria-label":U(c?`review.noteEditOn`:`review.noteOn`,{location:e.location}),autoFocus:!0,rows:3,value:t,disabled:i,onChange:e=>n(e.target.value),onFocus:e=>e.currentTarget.setSelectionRange(t.length,t.length),onKeyDown:t=>{t.key===`Enter`&&(t.ctrlKey||t.metaKey)?(t.preventDefault(),u()):t.key===`Escape`&&(t.preventDefault(),e.onCancel())}}),o&&(0,K.jsx)(`p`,{className:`m-0 text-error`,children:o}),(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(q,{hit:`tight`,disabled:i||!l,onClick:()=>void u(),children:U(c?`review.noteSave`:`review.noteAdd`)}),(0,K.jsx)(q,{hit:`tight`,className:`text-muted`,disabled:i,onClick:e.onCancel,children:U(`review.noteCancel`)})]})]})]})}G();function mae({notes:e,states:t,sending:n,onShow:r,onEdit:i,onDrop:a,onSend:o}){W();let[s,c]=(0,J.useState)(!1);if(e.length===0)return null;let l=e.length;return(0,K.jsxs)(`div`,{className:`flex max-h-2/5 min-h-0 flex-none flex-col border-t-hairline border-line font-mono text-meta`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-1.5 narrow:px-2`,children:[(0,K.jsxs)(q,{variant:`row`,className:`flex min-w-0 flex-1 items-center gap-2 text-left text-ink`,"aria-expanded":s,onClick:()=>c(!s),children:[(0,K.jsx)(tI,{right:!s}),(0,K.jsx)(`span`,{children:U(`review.count`,{count:l})})]}),(0,K.jsx)(q,{disabled:n,onClick:o,children:n?U(`review.sending`):U(`review.send`,{count:l})})]}),s&&(0,K.jsx)(`ul`,{className:`m-0 min-h-0 list-none overflow-y-auto p-0 pb-1`,children:e.map(e=>(0,K.jsxs)(`li`,{className:`flex flex-col gap-0.5 px-3 py-1 narrow:px-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,K.jsx)(q,{variant:`row`,className:`min-w-0 flex-1 truncate text-left text-ink hover:underline`,title:U(`review.show`),onClick:()=>r(e),children:c9(e)}),t.get(e.id)===`moved`&&(0,K.jsx)(`span`,{title:U(`review.movedHint`),children:(0,K.jsx)(YR,{tone:`warning`,children:U(`review.moved`)})}),(0,K.jsx)(q,{hit:`tight`,onClick:()=>i(e),children:U(`review.edit`)}),(0,K.jsx)(q,{hit:`tight`,onClick:()=>a(e),children:U(`review.drop`)})]}),(0,K.jsx)(`p`,{className:`m-0 line-clamp-2 whitespace-pre-wrap wrap-anywhere text-muted`,children:e.body})]},e.id))})]})}wl(),G(),A(),H();var hae=[];function u9({model:e,view:t,active:n,restored:r,onClose:i}){W();let a=lA(),[o,s]=(0,J.useState)(eae),[c,l]=(0,J.useState)(Xie),[u,d]=Vie(t),f=t.scope===`task`?u:null,p=f!==null,m=t.file===!0,h={taskId:t.taskId,path:t.path,scope:t.scope,...m?{content:!0}:{},...o?{ignoreWhitespace:!0}:{},...f?{base:f}:{}},g=JR(e,t.taskId),_={...h,taskId:g},[v,y]=(0,J.useState)(()=>{let n=Hs(e,`diff.file`,_);return n===void 0?null:KR(n,t.path,p)}),[b,x]=(0,J.useState)(()=>Hs(e,`review.list`,{taskId:t.taskId})?.notes??[]),[S,C]=(0,J.useState)(()=>Hs(e,`diff.files`,{taskId:g})),[w,T]=(0,J.useState)(0),[E,D]=(0,J.useState)(null),[O,ee]=(0,J.useState)(!1),[A,j]=(0,J.useState)(new Map),[M,N]=(0,J.useState)(!1),[P,F]=(0,J.useState)(0),I=(0,J.useRef)(null),L=e.client,R=k(L.conn).state;(0,J.useEffect)(()=>{let e=!0;return L.request(`diff.file`,h).then(n=>e&&y(KR(Us(L,`diff.file`,_,n),t.path,p)),t=>{if(e){if(f&&t instanceof yl&&t.code===`BAD_REF`){d(null),z(t.message,`error`);return}y({kind:`text`,text:MO(t),error:!0})}}),()=>{e=!1}},[L,t.taskId,t.path,t.scope,o,f,P,R]),(0,J.useEffect)(()=>{let e=!0;return L.request(`diff.files`,{taskId:t.taskId}).then(t=>e&&C(Us(L,`diff.files`,{taskId:g},t)),()=>{}),()=>{e=!1}},[L,t.taskId,P]);let te=()=>void Ws(L,`review.list`,{taskId:t.taskId}).then(e=>x(e.notes));(0,J.useEffect)(te,[L,t.taskId,P]);let ne=(0,J.useRef)(!1);(0,J.useEffect)(()=>{n&&(ne.current||!r)&&I.current?.focus(),ne.current=!0},[n,r]);let re=v?.kind===`rows`?v.rows:hae,ie=v?.kind===`rows`&&v.diff,ae=S?.base??null,oe=t.path!==`.`&&t.scope===`working`&&oae(S?.files??[],t.path),se=rae(L,t.taskId,t.path,m&&oe&&!ie,P),ce=(0,J.useMemo)(()=>re.map((e,t)=>`row-${t}`),[re]),le=(0,J.useMemo)(()=>jR(re),[re]),ue=(0,J.useMemo)(()=>Yie(re),[re]),de=(0,J.useMemo)(()=>Qie(c,t.taskId,ue),[c,t.taskId,ue]),B=(0,J.useMemo)(()=>{let e=new Set;for(let t of ue.keys())(A.get(t)??(BR(t)||de.has(t)))&&e.add(t);return e},[ue,de,A]),fe=(e,t)=>j(n=>{let r=new Map(n);for(let n of e)r.set(n,t);return r}),pe=(0,J.useMemo)(()=>AR(re,B),[re,B]),me=(0,J.useMemo)(()=>b.filter(e=>e.sentAt===void 0),[b]),V=(0,J.useMemo)(()=>me.map(e=>({note:e,at:l9(e,re)})),[me,re]),he=(0,J.useMemo)(()=>{let e=new Set;for(let{at:t}of V)if(t)for(let n=t.first;n<=t.last;n++)e.add(n);return e},[V]),ge=(0,J.useMemo)(()=>{let e=new Map;for(let{note:t,at:n}of V)n&&e.set(n.last,[...e.get(n.last)??[],t]);return e},[V]),_e=t.path===`.`&&v!==null&&!(v.kind===`text`&&v.error),ye=(0,J.useMemo)(()=>{let e=new Map;for(let{note:t}of V)e.set(t.id,dae(t,re,_e));return e},[V,re,_e]);(0,J.useEffect)(()=>{if(pe.includes(w))return;let e=w;for(;e>0&&re[e]?.kind!==`file`;)e--;T(e),D(null)},[pe,w,re]);let be=(0,J.useRef)(!1);(0,J.useEffect)(()=>{if(!be.current){be.current=!0;return}I.current?.querySelector(`[data-row="${w}"]`)?.scrollIntoView({block:`nearest`})},[w]);let xe=kR(re,w,E),Se=e=>fe([e],!B.has(e)),Ce=[...le.keys()].flatMap(e=>re[e]?.path?[re[e]?.path]:[]),we=(0,J.useMemo)(()=>GR(le,re),[le,re]),Te=Ce.length>0&&Ce.every(e=>B.has(e)),H=[...le.values()].reduce((e,t)=>({added:e.added+t.added,removed:e.removed+t.removed}),{added:0,removed:0}),Ee=e=>{let n=$ie(c,t.taskId,e,de.has(e)?void 0:ue.get(e));l(n),Zie(n),j(t=>{let n=new Map(t);return n.delete(e),n})},De=()=>{tae(!o),s(!o)},Oe=fae({client:L,taskId:t.taskId,rows:re,target:xe,onSaved:e=>{e&&(D(null),ee(!1)),te()},focusView:()=>I.current?.focus()}),ke=e=>{Ne(e),(t.path===`.`||t.path===e.filePath)&&Oe.edit(e)},Ae=e=>void L.request(`review.remove`,{taskId:t.taskId,id:e.id}).then(te).catch(e=>z(qR(e).message,`error`)),je=k(ve),Me=()=>{let e=OR(re,w,E);if(e){if(!je?.startsWith(`${t.taskId}::`)){z(U(`files.mentionNoEngine`),`error`);return}L.request(`term.input`,{stream:je,data:DR(e)}).then(()=>{D(null),qc(je)?.focus()}).catch(e=>z(e instanceof Error?e.message:String(e),`error`))}},Ne=e=>{let n=l9(e,re),r=re.findIndex(t=>t.kind===`file`&&t.path===e.filePath);n?(fe([e.filePath],!1),T(n.first)):t.path===`.`&&r>=0?T(r):t.path!==e.filePath&&t.path!==`.`&&NB({taskId:t.taskId,path:e.filePath,scope:t.scope}),D(null),ee(!1)},Pe=()=>{N(!0),L.request(`review.send`,e.engineTarget(t.taskId)).then(e=>{z(e.delivered?U(`preview.sent`,{count:e.sent}):U(`preview.notSent`,{reason:e.reason??``}),e.delivered?`info`:`error`),te()}).catch(e=>z(e instanceof Error?e.message:String(e),`error`)).finally(()=>N(!1))},Fe=()=>{let e=n9([...le.keys()],w);e!==null&&(T(e),D(null),ee(!1))},Ie=()=>{let e=n9(V.flatMap(({at:e})=>e?[e.first]:[]).sort((e,t)=>e-t),w);if(e===null)return;let t=re[e]?.path;t&&fe([t],!1),T(e),D(null),ee(!1)},Le=e=>T(t=>{let n=Math.max(0,pe.indexOf(t));return pe[Math.min(pe.length-1,Math.max(0,n+e))]??t}),Re=e=>{let t=e.key;if(t===`j`||t===`ArrowDown`)Le(1);else if(t===`k`||t===`ArrowUp`)Le(-1);else if(t===`v`)D(e=>e===null?w:null),ee(!0);else if(t===`c`&&!e.ctrlKey)Oe.add();else if(t===`x`){let e=V.find(({at:e})=>e&&w>=e.first&&w<=e.last);e&&Ae(e.note)}else if(t===`s`)Pe();else if(t===`z`){let e=re[w]?.path;e&&ie&&Se(e)}else if(t===`r`)F(e=>e+1);else if(t===`q`||t===`Escape`)i();else if(e.ctrlKey&&!e.metaKey&&t.toLowerCase()===`c`&&!window.getSelection()?.toString())i();else return;e.preventDefault()},ze=()=>{let e=window.getSelection();if(!e||e.isCollapsed)return;let t=e=>(e instanceof Element?e:e?.parentElement)?.closest(`[data-row]`),n=t(e.anchorNode),r=t(e.focusNode);!n||!r||(D(Number(n.dataset.row)),T(Number(r.dataset.row)),ee(!0))},Be=Gie({rowClick:(e,t)=>{window.getSelection()?.isCollapsed!==!1&&(t.shiftKey?D(e=>e??w):(!a||E===null)&&D(null),T(e),ee(!0))},fileClick:(e,t)=>{T(e),D(null),ee(!1),t&&Se(t)},viewedClick:Ee,editNote:ke}),Ve=E===null?w:Math.min(E,w),He=E===null?w:Math.max(E,w);return(0,K.jsxs)(`div`,{className:`group/preview @container/preview flex min-h-0 min-w-0 flex-1 flex-col outline-none`,"data-file":m&&!ie?``:void 0,tabIndex:0,ref:I,onKeyDown:Re,children:[oe&&(0,K.jsx)(nae,{taskId:t.taskId,path:t.path,file:m}),ie&&(0,K.jsx)(qie,{picker:ae!==null&&(0,K.jsx)(Rie,{taskId:t.taskId,model:e,scope:t.scope,onScope:e=>NB({taskId:t.taskId,path:t.path,scope:e}),base:ae,custom:u,onPick:d}),ignoreWs:o,onToggleWs:De,files:Ce.length,shape:we,added:H.added,removed:H.removed,viewed:de.size,allFolded:Te,onFoldAll:()=>fe(Ce,!Te),onNextFile:Fe,onNextComment:V.some(({at:e})=>e)?Ie:null}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto py-1.5 font-mono text-meta/normal`,onMouseUp:ze,children:[!v&&(0,K.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle`,children:U(`preview.loading`)}),v?.kind===`text`&&(0,K.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle ${v.error?`text-error`:``}`,children:v.text}),pe.map(e=>{let t=re[e],n=e>=Ve&&e<=He;if(t.kind===`file`){let r=le.get(e),i=t.path;return(0,K.jsx)(Hie,{index:e,name:t.text,path:i,closed:i!==null&&B.has(i),viewed:i!==null&&de.has(i),cursor:n,added:r?.added??0,removed:r?.removed??0,onToggleFold:Be.fileClick,onToggleViewed:Be.viewedClick},ce[e])}return(0,K.jsx)(Kie,{index:e,row:t,cursor:n,noted:he.has(e),actions:O&&xe&&!Oe.node&&e===He&&(0,K.jsx)(Uie,{showRange:a&&E===null,ranged:E!==null,onComment:Oe.add,onRange:()=>D(w),onAsk:Me}),notes:ge.get(e),changed:t.newNo!==null&&se?.has(t.newNo)===!0,composer:e===Oe.row?Oe.node:void 0,editId:e===Oe.row?Oe.editId:void 0,onClick:Be.rowClick,onEditNote:Be.editNote},ce[e])}),Oe.row===-1&&Oe.node]}),(0,K.jsx)(mae,{notes:me,states:ye,sending:M,onShow:Ne,onEdit:ke,onDrop:Ae,onSend:Pe})]})}G(),A();function d9(e){W();let{model:t,view:n}=e,r=n.path===`.`?null:zZ(n.path),[i,a]=(0,J.useState)(null),o=k(t.tasks);if(!r)return(0,K.jsx)(u9,{...e});let s=i===n.path,c=JSON.stringify(o?.tasks.find(e=>e.id===n.taskId)?.changes??null);return(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,K.jsxs)(`div`,{className:`flex gap-x-3 px-2.5 py-1`,children:[(0,K.jsx)(q,{variant:`pill`,hit:`tight`,"aria-current":!s,onClick:()=>a(null),children:`[ ${U(`artifact.preview`)} ]`}),(0,K.jsx)(q,{variant:`pill`,hit:`tight`,"aria-current":s,onClick:()=>a(n.path),children:`[ ${U(`artifact.source`)} ]`})]}),s?(0,K.jsx)(u9,{...e}):(0,K.jsx)(r$,{model:t,taskId:n.taskId,path:n.path,kind:r,changeKey:c})]})}var gae=6e4,f9=new class{known=new Map;get(e){return this.known.get(e)}due(e,t){let n=this.known.get(e);return!n||t-n.at>=gae}set(e,t,n){t===null&&this.known.get(e)?.probe||this.known.set(e,{probe:t,at:n})}};function _ae(e,t,n){let[,r]=(0,J.useState)(0);(0,J.useEffect)(()=>{if(!n||!f9.due(t,Date.now()))return;let i=!0;return e.request(`browser.probe`,{url:t,origin:window.location.origin}).then(e=>f9.set(t,e,Date.now()),()=>f9.set(t,null,Date.now())).then(()=>i&&r(e=>e+1)),()=>{i=!1}},[e,t,n]);let i=n?f9.get(t):void 0;return{pending:n&&!i,probe:i?.probe??null}}G(),H();function vae(e){let t=qz(),n=Jz(e.taskId,e.tabId),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(!1),s=(0,J.useRef)(null),c=(0,J.useRef)(e.url);c.current=e.url;let l=(0,J.useRef)(e.onUrlSync);l.current=e.onUrlSync,(0,J.useEffect)(()=>{if(t)return Kte(o)},[t]),(0,J.useEffect)(()=>{if(!t||!e.enabled||!e.url)return;let r=!0,a=Gte(n);return t.attach({panelKey:n,taskId:e.taskId,url:e.url,...a?{adoptTabId:a}:{}}).then(n=>{r&&(s.current=n.id,i(n),n.url&&n.url!==e.url&&!a&&t.navigate(n.id,e.url))}).catch(()=>{}),()=>{r=!1;let e=s.current;e&&t.setVisible(e,!1).catch(()=>{})}},[t,e.enabled,e.taskId,n,e.url]),(0,J.useEffect)(()=>{if(!(!t||!e.enabled))return t.onState(e=>{(e.panelKey===n||e.id===s.current)&&(s.current=e.id,i(e),e.url&&/^https?:\/\//i.test(e.url)&&e.url!==c.current&&l.current(e.url))})},[t,e.enabled,n]);let u=r?.id??null,d=!!(t&&e.enabled&&e.shown&&!e.paused&&!a&&u);(0,J.useEffect)(()=>{if(!t||!u)return;let n=e.stage.current;if(!d||!n){t.setVisible(u,!1).catch(()=>{});return}let r=0,i=()=>{let e=n.getBoundingClientRect();if(e.width<=0||e.height<=0){t.setVisible(u,!1).catch(()=>{});return}t.setBounds(u,{x:e.left,y:e.top,width:e.width,height:e.height}).catch(()=>{})},a=()=>{cancelAnimationFrame(r),r=requestAnimationFrame(i)};i();let o=new ResizeObserver(a);return o.observe(n),window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(r),o.disconnect(),window.removeEventListener(`resize`,a),t.setVisible(u,!1).catch(()=>{})}},[t,u,d,e.stage]);let f=(0,J.useCallback)(e=>{let n=s.current;!t||!n||t.navigate(n,e).then(e=>i(e)).catch(()=>{})},[t]),p=(0,J.useCallback)(()=>{let e=s.current;!t||!e||t.goBack(e).then(e=>i(e)).catch(()=>{})},[t]),m=(0,J.useCallback)(()=>{let e=s.current;!t||!e||t.goForward(e).then(e=>i(e)).catch(()=>{})},[t]),h=(0,J.useCallback)(()=>{let e=s.current;!t||!e||t.reload(e).then(e=>i(e)).catch(()=>{})},[t]),g=(0,J.useCallback)(()=>{let e=s.current;if(!t||!e)return;let n=r?.owner===`agent`?`human`:`agent`;t.handoff(e,n).then(e=>{z(U(e.owner===`agent`?`browser.handedToAgent`:`browser.handedToHuman`,{id:e.id}),`info`)}).catch(()=>{})},[t,r?.owner]),_=(0,J.useCallback)(async()=>{let e=s.current;if(!t||!e)throw Error(`native browser tab is not ready`);return`data:image/png;base64,${await t.capture(e)}`},[t]);return t?{state:r,navigate:f,goBack:p,goForward:m,reload:h,toggleHandoff:g,captureDataUrl:_}:null}G(),A();function p9({d:e}){return(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:e})})}function yae(e){let t=Y7(e.model,e.taskId);return(0,K.jsxs)(`div`,{className:li,children:[t.length>0&&(0,K.jsx)(`div`,{className:`flex w-[36ch] max-w-full flex-col text-left text-ink`,children:t.map(t=>(0,K.jsxs)(`button`,{type:`button`,className:Aa({size:`file`}),title:t.url,onClick:()=>e.onOpen(t.url),children:[(0,K.jsx)(`span`,{className:`row-title min-w-0 flex-1 truncate`,children:t.command}),(0,K.jsx)(`span`,{className:`flex-none text-subtle`,children:`:${t.port}`})]},t.port))}),(0,K.jsx)(`p`,{children:U(t.length>0?`browser.empty`:`browser.emptyPorts`)})]})}var m9=`M6.5 3.5h-3v9h9v-3M9.5 3.5h3v3M12.5 3.5l-5 5`;function bae({model:e,taskId:t,tab:n,root:r,shown:i,restored:a,onClose:o,onNavigate:s,onStep:c}){W();let l=Iz(n),u=Pz(l),d=u===null?l:kte(u,r),[f,p]=(0,J.useState)(d),[m,h]=(0,J.useState)(null),[g,_]=(0,J.useState)(0),[v,y]=(0,J.useState)(!1),[b,x]=(0,J.useState)(void 0),S=(0,J.useRef)(null),C=(0,J.useRef)(null),w=k(e.client.conn).hello?.peer?.local,T=Ute(),E=l&&u===null?Fte(l,window.location,w,T):null;(0,J.useEffect)(()=>{p(d),h(null)},[d]);let[D,O]=(0,J.useState)(!1),[ee,A]=(0,J.useState)(0);(0,J.useEffect)(()=>{let e=C.current;if(!e)return;let t=new ResizeObserver(()=>A(e.clientWidth));return t.observe(e),()=>t.disconnect()},[]);let j=u===null||D||!C.current?f:xae(C.current,f,ee),M=E?new URL(l).hostname:``,N=!T&&E===`yes`&&l.startsWith(`https:`)&&!Fz(M),{pending:P,probe:F}=_ae(e.client,l,N),I=l&&E?Ite(l,E,F):null,L=E===`yes`&&!I&&!P,R=vae({taskId:t,tabId:n.id,url:l,enabled:T&&u===null&&L,shown:i,paused:v,stage:S,onUrlSync:s}),te=e=>{let t=jte(e,r),n=t===`outside`?null:t??Pte(e);h(t===`outside`?`outside`:n===null&&e.trim()!==``?`invalid`:null),n!==null&&(n===l?(p(d),R&&u===null?R.reload():_(g+1)):(s(n),R&&Pz(n)===null&&R.navigate(n)))},ne=()=>{if(v){y(!1),x(void 0);return}if(R){R.captureDataUrl().then(e=>{x(e),y(!0)},()=>{x(void 0),y(!1)});return}y(!0)},re=R&&u===null?!R.state?.canGoBack:n.at<=0,ie=R&&u===null?!R.state?.canGoForward:n.at>=n.urls.length-1,ae=I?U(`browser.${I.key}`,{host:I.host}):E===null&&u===null?U(`browser.${m??`empty`}`):null;return(0,K.jsxs)(`div`,{className:ui,children:[(0,K.jsxs)(`form`,{className:di,onSubmit:e=>{e.preventDefault(),te(f)},children:[(0,K.jsx)(`button`,{type:`button`,className:Gr({small:!0}),disabled:re,title:U(`browser.back`),"aria-label":U(`browser.back`),onClick:()=>R&&u===null?R.goBack():c(n.at-1),children:(0,K.jsx)(p9,{d:`M10 3.5 5.5 8l4.5 4.5`})}),(0,K.jsx)(`button`,{type:`button`,className:Gr({small:!0}),disabled:ie,title:U(`browser.forward`),"aria-label":U(`browser.forward`),onClick:()=>R&&u===null?R.goForward():c(n.at+1),children:(0,K.jsx)(p9,{d:`M6 3.5 10.5 8 6 12.5`})}),(0,K.jsx)(`button`,{type:`button`,className:Gr({small:!0}),disabled:!L&&u===null,title:U(`browser.reload`),"aria-label":U(`browser.reload`),onClick:()=>R&&u===null?R.reload():_(g+1),children:(0,K.jsx)(p9,{d:`M12.5 8a4.5 4.5 0 1 1-1.4-3.3M12.5 2.5v2.7H9.8`})}),(0,K.jsx)(`input`,{ref:C,className:`browser-url mono ${fi}`,value:j,placeholder:U(`browser.placeholder`),onFocus:()=>O(!0),onBlur:()=>O(!1),"aria-label":U(`browser.address`),"aria-invalid":m!==null,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,inputMode:`url`,onChange:e=>p(e.target.value)}),R?.state&&L&&(0,K.jsx)(q,{variant:`pill`,"aria-current":R.state.owner===`agent`?`true`:void 0,title:R.state.handoffReason??(R.state.owner===`agent`?U(`browser.takeControl`):U(`browser.handToAgent`)),onClick:()=>R.toggleHandoff(),children:R.state.owner===`agent`?U(`browser.takeControl`):U(`browser.handToAgent`)}),(hie()||T)&&(0,K.jsx)(q,{variant:v&&L?`iconOn`:`icon`,disabled:!L,title:U(`browser.annotate`),"aria-label":U(`browser.annotate`),"aria-pressed":v&&L,onClick:ne,children:(0,K.jsx)(p9,{d:`M3 13l.6-2.6L10.9 3.1l2 2L5.6 12.4zM9.6 4.4l2 2`})}),l&&u===null?(0,K.jsx)(`a`,{className:Gr({small:!0}),href:l,target:`_blank`,rel:`noopener noreferrer`,title:U(`browser.openTab`),"aria-label":U(`browser.openTab`),children:(0,K.jsx)(p9,{d:m9})}):(0,K.jsx)(`button`,{type:`button`,className:Gr({small:!0}),disabled:!0,"aria-label":U(`browser.openTab`),children:(0,K.jsx)(p9,{d:m9})})]}),u===null?L?(0,K.jsxs)(`div`,{ref:S,className:pi,"data-native-browser":R?.state?.id??void 0,children:[!T&&(0,K.jsx)(`iframe`,{className:`min-w-0 flex-1 rounded-sm border-none bg-paper`,src:l,title:l,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups`,referrerPolicy:`no-referrer`},`${l}#${g}`),v&&(0,K.jsx)(Nie,{model:e,taskId:t,url:l,target:S,backdrop:b,onClose:()=>{y(!1),x(void 0)}},`${l}#${g}`)]}):E===null&&m===null?(0,K.jsx)(yae,{model:e,taskId:t,onOpen:s}):ae?(0,K.jsx)(`p`,{className:li,children:ae}):null:(0,K.jsx)(d9,{model:e,view:{taskId:t,path:u,scope:`working`,file:!0},active:i,restored:a,onClose:o},`${u}#${g}#${n.read??``}`)]})}var h9=document.createElement(`canvas`).getContext(`2d`);function xae(e,t,n){let r=getComputedStyle(e),i=n-Number.parseFloat(r.paddingLeft)-Number.parseFloat(r.paddingRight);return!h9||!(i>0)?t:(h9.font=r.font,Ate(t,e=>h9.measureText(e).width<=i))}var Sae=`scrollbar-none flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3`,g9=`m-0 p-3 font-mono text-meta text-muted`,Cae=`flex items-baseline justify-between gap-3 font-mono text-meta normal-nums`,wae=`flex h-1.5 w-full gap-px overflow-hidden rounded-full bg-inset`,Tae=`h-full min-w-[2px] flex-none`,Eae=`m-0 flex list-none flex-col p-0`,_9=`-mx-1 flex h-5.5 min-w-0 items-center gap-2 rounded-xs px-1 font-mono text-meta normal-nums`,Dae=`mt-2`,Oae=`size-2 flex-none rounded-full bg-line`,kae=`flex min-w-0 flex-1 items-center gap-1.5`,Aae=`min-w-0 truncate text-muted`,jae=`w-[7ch] flex-none text-right text-ink`,Mae=`w-[6ch] flex-none text-right text-muted`,Nae=`group/fold`,Pae=`${_9} cursor-pointer list-none hover:bg-hover focus-visible:outline focus-visible:outline-1 focus-visible:outline-focus [&::-webkit-details-marker]:hidden`,Fae=`m-0 flex list-none flex-col p-0`,Iae=`${_9} pl-5`,Lae=`flex min-w-0 flex-1 overflow-hidden`,Rae=`min-w-0 truncate text-subtle`,zae=`flex-none text-muted`,Bae=`w-[7ch] flex-none text-right text-muted`,Vae=`w-[6ch] flex-none`;G(),A();var Hae=1e4,Uae={system:`var(--info)`,system_prompt:`var(--info)`,system_tools:`var(--success)`,mcp_tools:`var(--warning)`,mcp_instructions:`var(--warning)`,custom_agents:`var(--ink)`,memory_files:`var(--merged)`,skills:`var(--muted)`,messages:`var(--accent)`,used:`var(--accent)`},v9=[`var(--info)`,`var(--success)`,`var(--warning)`,`var(--merged)`];function Wae({model:e,task:t,active:n}){W();let r=k(e.client.conn),i=k(e.selection),a=k(e.tabs)[t.id]??[],o=i.taskId===t.id?a.find(e=>e.id===i.tabId):void 0,s=(o?.kind===`engine`?o:a.find(e=>e.kind===`engine`))?.id??null,[c,l]=(0,J.useState)({kind:`loading`}),[u,d]=(0,J.useState)(!1),f=(0,J.useRef)(``);if((0,J.useEffect)(()=>{if(!n||r.state!==`open`)return;let i=`${t.id}::${s}`;if(f.current!==i&&l({kind:`loading`}),f.current=i,!s){l({kind:`ready`,meter:null});return}let a=!0,o=n=>e.client.request(`context.usage`,{taskId:t.id,tabId:s,probe:n}).then(e=>a&&l({kind:`ready`,meter:e.meter})).catch(e=>a&&l(t=>t.kind===`ready`?t:{kind:`failed`,error:Cz(e)})),c=()=>{d(!0),o(!0).finally(()=>a&&d(!1))};o(!1).then(c);let u=Ga(Hae,c);return()=>{a=!1,d(!1),u()}},[e,n,r.state,t.id,s]),c.kind===`loading`)return(0,K.jsx)(`p`,{className:g9,children:U(`context.loading`)});if(c.kind===`failed`)return(0,K.jsx)(`p`,{className:g9,children:U(`context.failed`,{error:c.error})});if(!c.meter)return(0,K.jsx)(`p`,{className:g9,children:U(`context.none`)});let p=c.meter,m=p.rows.filter(e=>e.share!==void 0),h=e=>e.share===void 0?void 0:Uae[e.key]??v9[m.indexOf(e)%v9.length],g=`${p.approximate?`~`:``}${b9(p.used)}`;return(0,K.jsxs)(`div`,{className:Sae,children:[(0,K.jsxs)(`div`,{className:Cae,children:[(0,K.jsx)(`span`,{className:`text-ink`,children:p.percent===null?U(`context.usedTokens`,{tokens:g}):U(`context.used`,{percent:x9(p.percent)})}),p.window!==null&&(0,K.jsxs)(`span`,{className:`text-muted`,children:[g,` / `,b9(p.window)]})]}),(0,K.jsx)(`div`,{className:wae,role:`meter`,"aria-valuenow":Math.round(p.percent??100),"aria-valuemin":0,"aria-valuemax":100,children:m.map(e=>(0,K.jsx)(`span`,{className:Tae,style:{width:`${e.share}%`,background:h(e)}},e.key))}),(0,K.jsx)(`ul`,{className:Eae,children:p.rows.map((e,t)=>{let n=`context.part.${e.key}`,r=U(n)===n?e.label??e.key:U(n),i=h(e),a=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:Oae,style:i?{background:i}:void 0}),(0,K.jsxs)(`span`,{className:kae,children:[(0,K.jsx)(`span`,{className:Aae,title:r,children:r}),e.items&&(0,K.jsx)(`span`,{className:`inline-block flex-none text-subtle group-open/fold:rotate-90`,children:`›`})]}),(0,K.jsx)(`span`,{className:jae,children:b9(e.tokens)}),(0,K.jsx)(`span`,{className:Mae,children:e.deferred?`—`:x9(e.tokens/(p.window??p.used)*100)})]}),o=(e.deferred?!p.rows[t-1]?.deferred:e.share===void 0)?Dae:void 0;if(!e.items)return(0,K.jsx)(`li`,{className:o,children:(0,K.jsx)(`div`,{className:_9,children:a})},e.key);let s=e.items.reduce((e,t)=>e+t.tokens,0),c=(e.itemCount??e.items.length)-e.items.length;return(0,K.jsx)(`li`,{className:o,children:(0,K.jsxs)(`details`,{className:Nae,children:[(0,K.jsx)(`summary`,{className:Pae,children:a}),(0,K.jsxs)(`ul`,{className:Fae,children:[e.items.map(e=>(0,K.jsx)(y9,{name:e.name,tokens:e.tokens},e.name)),c>0&&(0,K.jsx)(y9,{name:U(`context.more`,{count:c}),tokens:e.tokens-s})]})]})},e.key)})}),u&&m.length<2&&(0,K.jsx)(`p`,{className:`m-0 font-mono text-meta text-subtle`,children:U(`context.probing`)})]})}function y9({name:e,tokens:t}){let n=e.lastIndexOf(`/`)+1;return(0,K.jsxs)(`li`,{className:Iae,title:e,children:[(0,K.jsxs)(`span`,{className:Lae,children:[n>0&&(0,K.jsx)(`span`,{className:`min-w-0 truncate text-subtle`,children:e.slice(0,n)}),(0,K.jsx)(`span`,{className:n>0?zae:Rae,children:e.slice(n)})]}),(0,K.jsx)(`span`,{className:Bae,children:b9(Math.max(0,t))}),(0,K.jsx)(`span`,{className:Vae})]})}function b9(e){return e>=1e6?`${+(e/1e6).toFixed(1)}M`:e>=1e3?`${+(e/1e3).toFixed(1)}k`:String(e)}function x9(e){return e>0&&e<.1?`<0.1%`:`${e<10?+e.toFixed(1):Math.round(e)}%`}G(),H();var Gae=3;function Kae({model:e,task:t}){W();let n=t.autoFixCi,r=n=>void e.client.request(`task.autoFixCi`,{taskId:t.id,enabled:n}).catch(e=>z(e instanceof Error?e.message:String(e),`error`));return(0,K.jsx)(`div`,{className:`flex items-center gap-3 px-2 pt-1 font-mono text-meta`,children:n?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:n.stopped?EO.attention:`text-muted`,title:U(`files.autoFix.hint`),children:U(n.stopped?`files.autoFix.stopped`:`files.autoFix.count`,{n:n.attempts,max:Gae})}),(0,K.jsx)(q,{hit:`tight`,onClick:()=>r(!1),children:U(`files.autoFix.off`)})]}):(0,K.jsx)(q,{hit:`tight`,title:U(`files.autoFix.hint`),onClick:()=>r(!0),children:U(`files.autoFix.on`)})})}function qae(e){let t=e.pr;return!!t&&t.number!==void 0&&!e.machine&&(t.lifecycle===`open`||t.lifecycle===`ready_to_merge`)}function Jae(e){let t={fail:0,pending:0,pass:0,skipped:0};for(let n of e)t[n.state]++;return t}function S9(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m${String(t%60).padStart(2,`0`)}s`:`${Math.floor(n/60)}h${String(n%60).padStart(2,`0`)}m`}function Yae(e,t){let{startedAt:n,completedAt:r,durationMs:i}=e;return e.state===`pending`?n?{key:`files.checks.runningFor`,vars:{elapsed:S9(t-n)}}:null:i===null?r?{key:`files.checks.finishedAgo`,vars:{age:el(t-r)}}:null:r?{key:`files.checks.tookAgo`,vars:{duration:S9(i),age:el(t-r)}}:{key:`files.checks.took`,vars:{duration:S9(i)}}}function Xae(e){let t=[],n=e.mergeState.toUpperCase();e.draft&&t.push({key:`files.merge.draft`,tone:`warning`}),e.mergeable.toUpperCase()===`CONFLICTING`||n===`DIRTY`?t.push({key:`files.merge.conflicts`,tone:`attention`}):n===`BEHIND`?t.push({key:`files.merge.behind`,tone:`warning`}):n===`UNSTABLE`?t.push({key:`files.merge.unstable`,tone:`warning`}):n===`BLOCKED`?t.push({key:`files.merge.blocked`,tone:`warning`}):n===`CLEAN`&&!e.draft&&t.push({key:`files.merge.clean`,tone:`success`});let r=e.review.toUpperCase();return r===`APPROVED`?t.push({key:`files.merge.approved`,tone:`success`}):r===`CHANGES_REQUESTED`?t.push({key:`files.merge.changes`,tone:`attention`}):r===`REVIEW_REQUIRED`&&t.push({key:`files.merge.reviewRequired`,tone:`warning`}),t}G();var Zae={pass:{glyph:`✓`,tone:`success`},fail:{glyph:`✗`,tone:`attention`},pending:{glyph:`●`,tone:`warning`},skipped:{glyph:`–`,tone:`muted`}};function Qae({model:e,task:t}){W();let n=t.pr,r=t.id,[i,a]=(0,J.useState)(()=>Hs(e,`pr.checks`,{taskId:r})??null),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)({}),[u,d]=(0,J.useState)(0),f=`${n?.number}:${n?.checkState}:${n?.mergeable}:${n?.reviewDecision}`;(0,J.useEffect)(()=>{let t=!0,n={taskId:r};return e.client.request(`pr.checks`,u>0?{...n,fresh:!0}:n).then(r=>{t&&(Us(e,`pr.checks`,n,r),a(r))},e=>t&&a({outcome:`unavailable`,detail:e instanceof Error?e.message:String(e)})),()=>{t=!1}},[e,r,f,u]);let p=t=>{let n=`${t.runId}:${t.name}`;if(c[n]){l(({[n]:e,...t})=>t);return}l(e=>({...e,[n]:{state:`loading`}})),e.client.request(`pr.checkLog`,{taskId:r,runId:t.runId,job:t.name}).then(e=>e.outcome===`ok`?{state:`text`,text:e.tail}:e.outcome===`none`?{state:`note`,text:U(`files.checks.noLog`)}:{state:`note`,text:U(`files.checks.logUnavailable`,{detail:e.detail})}).catch(e=>({state:`note`,text:U(`files.checks.logUnavailable`,{detail:e instanceof Error?e.message:String(e)})})).then(e=>l(t=>n in t?{...t,[n]:e}:t))},m=(0,K.jsx)(q,{hit:`tight`,className:`flex-none whitespace-nowrap`,onClick:()=>d(e=>e+1),children:U(`files.checks.refresh`)});if(!i)return(0,K.jsx)(`div`,{className:c7,children:(0,K.jsx)(`div`,{className:l7,children:(0,K.jsxs)(`span`,{className:`flex-1 text-muted`,children:[U(`files.checks.title`),` `,U(`files.checks.loading`)]})})});if(i.outcome!==`ok`)return(0,K.jsx)(`div`,{className:c7,children:(0,K.jsxs)(`div`,{className:l7,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 text-muted wrap-anywhere`,children:i.outcome===`none`?U(`files.checks.none`):U(`files.checks.unavailable`,{detail:i.detail})}),m]})});let h=Jae(i.checks),g=Date.now(),_=o??(h.fail>0||h.pending>0),v=Xae(i);return(0,K.jsxs)(`div`,{className:c7,children:[(0,K.jsxs)(`div`,{className:l7,children:[(0,K.jsxs)(q,{variant:`row`,className:ure,"aria-expanded":_,disabled:i.total===0,onClick:()=>s(!_),children:[i.total>0&&(0,K.jsx)(tI,{right:!_}),(0,K.jsx)(`span`,{children:i.total===0?U(`files.checks.none`):U(`files.checks.summary`,{pass:h.pass+h.skipped,total:i.total})}),h.fail>0&&(0,K.jsx)(`span`,{className:EO.attention,children:U(`files.checks.failed`,{count:h.fail})}),h.pending>0&&(0,K.jsx)(`span`,{className:EO.warning,children:U(`files.checks.running`,{count:h.pending})}),v.map(e=>(0,K.jsx)(`span`,{className:EO[e.tone],children:U(e.key)},e.key))]}),m]}),_&&i.checks.map(e=>{let{glyph:t,tone:n}=Zae[e.state],r=Yae(e,g),i=`${e.runId}:${e.name}`,a=c[i];return(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-baseline gap-2 pl-4`,children:[(0,K.jsx)(`span`,{className:`w-[1ch] flex-none text-center ${EO[n]}`,children:t}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.name,children:e.name}),r&&(0,K.jsx)(`span`,{className:`flex-none text-subtle`,children:U(r.key,r.vars)}),e.state===`fail`&&e.runId&&(0,K.jsx)(q,{hit:`tight`,className:`flex-none whitespace-nowrap`,onClick:()=>p(e),children:U(a?`files.checks.hideLog`:`files.checks.log`)})]}),a&&(0,K.jsx)(`pre`,{className:`m-0 ml-4 mb-1 max-h-40 overflow-y-auto rounded-sm border-hairline border-line bg-inset px-2 py-1.5 whitespace-pre-wrap wrap-anywhere text-muted`,children:a.state===`loading`?U(`files.checks.loading`):a.text})]},`${e.name}:${e.url}`)}),_&&i.total>i.checks.length&&(0,K.jsx)(`span`,{className:`pl-4 text-subtle`,children:U(`files.checks.more`,{count:i.total-i.checks.length})})]})}function $ae({model:e,task:t}){return qae(t)?(0,K.jsxs)(`div`,{onKeyDown:e=>e.stopPropagation(),children:[(0,K.jsx)(Qae,{model:e,task:t}),(0,K.jsx)(Kae,{model:e,task:t})]}):null}function eoe(e,t){return e.dir===t.dir?e.name<t.name?-1:+(e.name>t.name):e.dir?-1:1}function toe(e,t){let n={children:new Map,file:!1};for(let t of e){let e=n;for(let n of t.split(`/`)){let t=e.children.get(n);t||(t={children:new Map,file:!1},e.children.set(n,t)),e=t}e.file=!0}let r=[],i=(e,n,a)=>{let o=[...e.children].sort(([e,t],[n,r])=>eoe({name:e,dir:t.children.size>0&&!t.file},{name:n,dir:r.children.size>0&&!r.file}));for(let[e,s]of o){let o=s.children.size>0&&!s.file,c=o?`${n}${e}/`:`${n}${e}`,l=o&&t.has(c);r.push({path:c,name:e,depth:a,dir:o,open:l}),l&&i(s,c,a+1)}};return i(n,``,0),r}G(),El(),H();var C9={start:`\x1B[200~`,end:`\x1B[201~`};function noe(e,t){return e.engineTarget(t).tabId??e.tabs.get()[t]?.find(e=>e.kind===`engine`)?.id}async function roe(e,t,n){let r=noe(e,t);if(!r)return z(U(`files.stripNoEngine`),`error`),!1;try{return e.selection.get().tabId!==r&&e.select(t,r),await e.client.request(`term.input`,{stream:Tl(t,r),data:`${C9.start}${n}${C9.end}`}),z(U(`files.stripFilled`)),!0}catch(e){return z(e instanceof Error?e.message:String(e),`error`),!1}}function ioe(e){let t=e.kind===`task`&&!e.noWorktree&&!e.machine&&!e.archived,n=e.changes;return t&&!!n&&`added`in n&&n.added+n.deleted>0}function aoe(e){return[...ioe(e)?[`commit`]:[],...ooe(e)]}function ooe(e){let t=e.pr;if(!t)return e.kind===`task`&&!e.noWorktree&&!e.machine&&!e.archived&&!e.sessionPrs?.length?[`createPR`]:[];if(t.lifecycle===`merged`)return e.archived?[]:[`archive`];if(t.lifecycle!==`open`&&t.lifecycle!==`ready_to_merge`)return[];let n=[];return((t.mergeable??``).toUpperCase()===`CONFLICTING`||e.prChip===`conflict`)&&n.push(`conflicts`),t.checkState===`failing`&&n.push(`fixCI`),(t.reviewDecision??``).toUpperCase()===`CHANGES_REQUESTED`&&n.push(`comments`),n}G(),H();async function soe(e,t,n){try{let r=await e.client.request(`task.prompt`,{taskId:t.id,kind:n});r.outcome===`unavailable`?z(U(`files.stripUnavailable`,{detail:r.detail??``}),`error`):r.outcome===`none`||!r.prompt?z(U(`files.stripNothing`),`error`):await roe(e,t.id,r.prompt)}catch(e){z(e instanceof Error?e.message:String(e),`error`)}}var coe={commit:`files.stripCommit`,createPR:`files.stripCreate`,conflicts:`files.stripConflicts`,fixCI:`files.stripFixCi`,comments:`files.stripComments`,archive:`files.stripArchive`};function loe({model:e,task:t}){let n=aoe(t);return n.length===0?null:(0,K.jsx)(`div`,{className:`flex flex-wrap justify-end gap-x-3.5 gap-y-1 px-2 pb-2 font-mono text-meta whitespace-nowrap`,children:n.map(n=>(0,K.jsx)(q,{onClick:()=>n===`archive`?void Aq(e,t):void soe(e,t,n),children:U(coe[n])},n))})}G(),A(),H();function uoe({model:e,task:t,narrow:n=!1}){W();let[r,i]=(0,J.useState)(()=>Hs(e,`files.list`,{taskId:t.id})?.files??null),[a,o]=(0,J.useState)(()=>o9(Hs(e,`diff.files`,{taskId:t.id})?.files??[])),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(null),[p,m]=(0,J.useState)(new Set),[h,g]=(0,J.useState)(0),[_,v]=(0,J.useState)(0),y=(0,J.useRef)(null),b=k(ve),x=k(e.client.conn),S=JSON.stringify(t.changes??null);(0,J.useEffect)(()=>{let n=!0;return Ws(e,`files.list`,{taskId:t.id}).then(e=>{n&&(i(e.files),u(e.truncated===!0),c(e.root??null),f(null))},e=>n&&f(MO(e))),()=>{n=!1}},[e,t.id,S,_,x.state]),(0,J.useEffect)(()=>{let n=!0;return Ws(e,`diff.files`,{taskId:t.id}).then(e=>n&&o(o9(e.files)),()=>{}),()=>{n=!1}},[e,t.id,S,_,x.state]);let C=r!==null,w=toe(r??[],p).map(e=>({path:e.path,label:e.name,depth:e.depth,dir:e.dir,open:e.open,state:a.get(e.path)})),T=Math.min(h,Math.max(0,w.length-1)),E=w[T],D=(e,t)=>m(n=>{let r=new Set(n);return t??!r.has(e)?r.add(e):r.delete(e),r}),O=e=>PB(t.id,e),ee=e=>NB({taskId:t.id,path:e,scope:`working`}),A=n=>{if(!b?.startsWith(`${t.id}::`)){z(U(`files.mentionNoEngine`),`error`);return}e.client.request(`term.input`,{stream:b,data:`@${n} `}).catch(e=>z(String(e),`error`))},j=(n,r,i)=>t.machine?z(U(`files.remoteNoExternal`,{host:t.machine.label}),`error`):void e.client.request(n,{taskId:t.id,path:r}).then(()=>i&&z(i)).catch(e=>z(e instanceof Error?e.message:String(e),`error`)),M=e=>j(`file.openExternal`,e,U(`taskops.openedExternal`)),N=n=>void e.client.request(`file.openTerminal`,{taskId:t.id,path:n}).catch(e=>z(e instanceof Error?e.message:String(e),`error`)),P=e=>{let t=e.dir?e.path.slice(0,-1):e.path;return[{label:U(`files.menu.attach`),key:`a`,run:()=>A(e.path)},{label:U(`files.menu.copy`),children:[{label:U(`files.menu.copyRelative`),run:()=>void j5(t,t)},...s?[{label:U(`files.menu.copyAbsolute`),run:()=>void j5(`${s}/${t}`,t)}]:[],{label:U(`files.menu.copyName`),run:()=>void j5(e.label,t)}]},{label:U(`files.menu.diff`),key:`d`,section:`open`,run:()=>ee(e.path)},...e.dir?[]:[{label:U(`files.menu.openExternal`),key:`o`,section:`open`,run:()=>M(e.path)}],{label:U(`files.menu.reveal`),section:`open`,run:()=>j(`file.reveal`,t)},{label:U(`files.menu.terminal`),section:`terminal`,run:()=>N(t)}]};return(0,K.jsxs)(`div`,{className:`group/pane flex min-h-0 min-w-0 flex-1 flex-col outline-none ${n?`px-1.5 pt-2.5 pb-2`:`p-1.5`}`,tabIndex:0,ref:y,onKeyDown:e=>{let t=e.key;if(t===`j`||t===`ArrowDown`)g(Math.min(w.length-1,T+1));else if(t===`k`||t===`ArrowUp`)g(Math.max(0,T-1));else if((t===`l`||t===`ArrowRight`)&&E?.dir)D(E.path,!0);else if((t===`h`||t===`ArrowLeft`)&&E?.dir)D(E.path,!1);else if(t===`r`)v(e=>e+1);else if(t===`D`&&e.shiftKey)ee(`.`);else if(t===`d`&&E)ee(E.path);else if(t===`Enter`&&E)E.dir?D(E.path):O(E.path);else if(t===`a`&&E)A(E.path);else if(t===`o`&&E&&!E.dir)M(E.path);else return;e.preventDefault()},children:[(0,K.jsx)(loe,{model:e,task:t}),(0,K.jsx)($ae,{model:e,task:t}),(0,K.jsx)(Fie,{model:e,task:t}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[d&&(0,K.jsx)(`p`,{className:`mono text-error`,children:d}),!d&&C&&w.length===0&&(0,K.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle`,children:U(`files.emptyAll`)}),w.map((e,t)=>(0,K.jsxs)(`button`,{type:`button`,className:Aa({selected:t===T,size:n?`file-narrow`:`file`}),style:{paddingLeft:8+e.depth*14},title:e.path,onContextMenu:n=>{g(t),d7(n,P(e))},onClick:()=>{g(t),y.current?.focus(),e.dir?D(e.path):O(e.path)},children:[(0,K.jsx)(`span`,{className:Fa,children:e.dir?(0,K.jsx)(tI,{right:!e.open}):null}),(0,K.jsx)(`span`,{className:`${ja} ${e.state?EO[a9[e.state]]:``}`,children:e.label}),e.state&&(0,K.jsx)(`span`,{className:`w-[1ch] flex-none text-center font-mono ${EO[a9[e.state]]}`,title:U(`files.state.${e.state}`),children:e.dir?`•`:aae[e.state]})]},e.path)),!d&&l&&(0,K.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle`,children:U(`files.truncated`,{count:(r?.length??0).toLocaleString()})})]})]})}G(),A();var doe={working:`review.scopeWorking`,branch:`review.scopeBranch`,task:`review.scopeTask`};function foe(e){return e.kind===`diff`?e.path===`.`?{text:U(doe[e.scope]),hint:U(`preview.whole`)}:{text:Xte(e.path),hint:e.path}:{text:U(`panel.${e.kind}`),hint:U(`panel.${e.kind}`)}}function w9({taskId:e,kind:t,expand:n}){W();let r=k(_B),i=U(r?`panel.restore`:`panel.expand`);return(0,K.jsxs)(K.Fragment,{children:[n&&(0,K.jsx)(`button`,{type:`button`,className:Gr({tool:!0}),title:i,"aria-label":i,"aria-pressed":r,onClick:()=>_B.set(!r),children:(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:r?`M13.5 6.5h-4v-4M2.5 9.5h4v4M9.5 6.5l4-4M6.5 9.5l-4 4`:`M9.5 2.5h4v4M6.5 13.5h-4v-4M13.5 2.5l-4.5 4.5M2.5 13.5 7 9`})})}),(0,K.jsx)(`button`,{type:`button`,className:Gr({tool:!0}),title:U(`panel.close`),"aria-label":U(`panel.close`),onClick:()=>LB(e,t),children:(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]})}function poe({taskId:e,column:t,narrow:n}){W();let r=k(_B);if(t.kind===`browser`){let i=(0,K.jsxs)(`div`,{className:Qr(n),children:[(0,K.jsx)(J6,{taskId:e,column:t}),!n&&(0,K.jsx)(w9,{taskId:e,kind:`browser`,expand:!0})]});return(0,K.jsx)(a5,{slot:`panel.tabs`,data:{taskId:e,kind:`browser`,title:U(`panel.browser`),hint:U(`panel.browser`),tabCount:t.tabs.length,expanded:r,onToggleExpand:n?void 0:()=>_B.set(!r),onClose:()=>LB(e,`browser`)},fallback:i})}if(n&&t.kind!==`diff`)return null;let{text:i,hint:a}=foe(t),o=(0,K.jsxs)(`div`,{className:Qr(n),children:[(0,K.jsx)(`span`,{className:$r,title:a,children:i}),(0,K.jsx)(w9,{taskId:e,kind:t.kind,expand:!n})]});return(0,K.jsx)(a5,{slot:`panel.tabs`,data:{taskId:e,kind:t.kind,title:i,hint:a,tabCount:1,expanded:r,onToggleExpand:n?void 0:()=>_B.set(!r),onClose:()=>LB(e,t.kind)},fallback:o})}var T9=e=>`${e.id}:${Iz(e)}`;function moe({model:e,task:t,column:n,restored:r}){let i=(0,J.useRef)([]);i.current=Hte(i.current,n.active,n.tabs);let a=(0,J.useRef)(n.tabs.map(T9));return n.tabs.filter(e=>i.current.includes(e.id)).map(i=>(0,K.jsx)(`div`,{className:ci,hidden:i.id!==n.active,children:(0,K.jsx)(bae,{model:e,taskId:t.id,tab:i,root:t.workspace,shown:i.id===n.active,restored:r&&a.current.includes(T9(i)),onClose:()=>zB(t.id,i.id),onNavigate:e=>RB(t.id,t=>Hz(t,i.id,e)),onStep:e=>RB(t.id,t=>zte(t,i.id,e))})},i.id))}function hoe({model:e,task:t,column:n,narrow:r,restored:i,index:a}){let o=E1(),s=$1(),c=n.kind===`browser`?(0,K.jsx)(moe,{model:e,task:t,column:n,restored:i}):(0,K.jsxs)(`div`,{className:ci,children:[n.kind===`files`&&(0,K.jsx)(uoe,{model:e,task:t,narrow:r}),n.kind===`chat`&&(0,K.jsx)(e1,{model:e,task:t,active:!0}),n.kind===`quota`&&(0,K.jsx)(Wae,{model:e,task:t,active:!0}),n.kind===`diff`&&(0,K.jsx)(d9,{model:e,view:{taskId:t.id,path:n.path,scope:n.scope},active:!0,restored:i,onClose:()=>LB(t.id,`diff`)},`${t.id}:${n.path}:${n.scope}:${n.at??``}`)]}),l=t.changes&&!(`unreadable`in t.changes)?{files:0,added:t.changes.added,removed:t.changes.deleted}:void 0,u=hq(t)??void 0;return(0,K.jsx)(a5,{slot:`panel.section`,data:{taskId:t.id,index:a,kind:n.kind,title:t.label,branch:t.branch||void 0,repo:t.repo?t.repo.split(`/`).pop():void 0,engineId:t.engine?.id??void 0,engineName:t.engine?.name,model:t.model,engineFamily:t.engine?.protocol,engineColor:L8(o?.manifest,t.engine,s),statusKind:t.rowStatus?.kind??`idle`,diffStats:l,todos:u,pr:t.pr?.number?{number:t.pr.number,state:t.pr.lifecycle,url:t.pr.url}:void 0},fallback:c})}function goe({taskId:e,kinds:t,index:n,body:r,slot:i}){W();let a=(0,J.useRef)(null);return(0,K.jsx)(`div`,{className:si,style:{gridColumn:i},title:U(`panel.resizeSplit`),onPointerDown:e=>{let n=t.map(e=>r.current?.querySelector(`[data-kind="${e}"]`)?.getBoundingClientRect().width??0);a.current={x:e.clientX,widths:n},r.current?.classList.add(`is-resizing`),e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:t=>{let r=a.current;if(!r)return;let i=nne(r.widths,n,t.clientX-r.x,220);AB(e,e=>ene(e,i))},onLostPointerCapture:()=>{a.current=null,r.current?.classList.remove(`is-resizing`)},onDoubleClick:()=>AB(e,tne)})}G(),A(),H();function _oe({panel:e}){W();let t=(0,J.useRef)(null);return(0,K.jsx)(s8,{edge:`left`,title:U(`panel.resize`),onPointerDown:n=>{t.current={x:n.clientX,width:e.current?.getBoundingClientRect().width??0},e.current?.classList.add(`is-resizing`),n.currentTarget.setPointerCapture(n.pointerId),ue(!0)},onPointerMove:e=>{let n=t.current;if(!n||e.clientX===n.x)return;let r=e8.get()?0:a8($6.get()??280);hB.set(vB(n.width-(e.clientX-n.x),r))},onLostPointerCapture:()=>{t.current=null,e.current?.classList.remove(`is-resizing`),ue(!1)},onDoubleClick:()=>hB.set(null)})}var E9=e=>e.kind===`diff`?`diff:${e.path}:${e.scope}`:e.kind;function voe({model:e,task:t,narrow:n}){W();let r=EB(t.id),i=k(lB),a=k(_B),o=(0,J.useRef)(null),s=(0,J.useRef)(null),c=i===`terminal`?`files`:i,l=n?$z(r,c):void 0;(0,J.useEffect)(()=>{n&&!l&&AB(t.id,e=>rB(e,c))},[n,l,c,t.id]);let u=n?l?[l]:[]:r.columns,d=u.map(e=>e.kind),f=(n?[1]:$te(r)).map((e,t)=>`${t>0?`var(--divider) `:``}minmax(0, ${e}fr)`).join(` `),p=(0,J.useRef)(u.map(E9)),m=E1(),h=n?``:I1(m?.manifest.layout?.frame),g=$1(),_=!n&&m?.manifest.slots?.[`panel.frame`]?.component!==void 0,v=t.changes&&!(`unreadable`in t.changes)?t.changes:void 0,y=(0,K.jsxs)(`div`,{className:Xr,ref:s,style:{gridTemplateColumns:f},children:[u.map((r,i)=>(0,K.jsxs)(`section`,{className:Zr,"data-kind":r.kind,style:{gridColumn:2*d.indexOf(r.kind)+1},children:[(0,K.jsx)(poe,{taskId:t.id,column:r,narrow:n}),(0,K.jsx)(hoe,{model:e,task:t,column:r,narrow:n,restored:p.current.includes(E9(r)),index:i})]},r.kind)),!n&&u.slice(1).map((e,n)=>(0,K.jsx)(goe,{taskId:t.id,kinds:d,index:n,body:s,slot:2*n+2},`divider:${e.kind}`))]});return(0,K.jsxs)(`aside`,{"data-tp-region":`panel`,className:`${Yr(n)} ${h}`,ref:o,style:_?{padding:0}:void 0,children:[!n&&!a&&(0,K.jsx)(_oe,{panel:o}),n?y:(0,K.jsx)(a5,{slot:`panel.frame`,data:{taskId:t.id,title:t.label,branch:t.branch||void 0,repo:t.repo?t.repo.split(`/`).pop():void 0,worktree:U8(t),engineId:t.engine?.id??void 0,engineName:t.engine?.name,model:t.model,engineFamily:t.engine?.protocol,engineColor:L8(m?.manifest,t.engine,g),statusKind:t.rowStatus?.kind??`idle`,diffStats:v?{files:0,added:v.added,removed:v.deleted}:void 0,pr:t.pr?.number?{number:t.pr.number,state:t.pr.lifecycle,url:t.pr.url,checkState:t.pr.checkState}:void 0,views:Qz.map(e=>({kind:e,title:U(`panel.${e}`),open:d.includes(e)})),activeView:d.length===1?d[0]:void 0,onShowView:e=>AB(t.id,t=>rB({...t,columns:t.columns.filter(t=>t.kind===e)},e))},fallback:y})]})}function D9({model:e,task:t,remoteHost:n,narrow:r=!1}){let i=DB(t?.id??null),a=E1()?.manifest.slots?.[`panel.frame`]?.component!==void 0;return!r&&!(i||a&&t)?null:t?(0,K.jsx)(voe,{model:e,task:t,narrow:r},t.id):n?(0,K.jsx)(`aside`,{"data-tp-region":`panel`,className:Yr(!1),children:(0,K.jsx)(LN,{host:n,onMachines:()=>KK(e)})}):null}He(),A();var O9=O(null);function k9(e){O9.set(e),!(e===null||!Be())&&(lB.set(`terminal`),Ie())}G(),He(),xb(),H();var A9=`rove.web.update.skipped`,j9=`rove.web.update.askedAt`;function yoe(e){return!e.latest||!e.notify||e.latest===e.skipped||e.askedAt!==null&&e.now-e.askedAt<18e6?null:e.latest}function boe(){let e=QX.get(),t=yoe({latest:e?.info?.hasUpdate?e.info.latest:null,notify:yb.get().prefs.updateNotify,skipped:localStorage.getItem(A9),askedAt:Number(localStorage.getItem(j9))||null,now:Date.now()});!t||B.get()!==null||(localStorage.setItem(j9,String(Date.now())),B.set((0,K.jsx)(xoe,{current:e?.current??``,latest:t,notes:e?.notes??[]})))}function xoe(e){let[t]=e.notes;return(0,K.jsx)(za,{title:U(`updatePrompt.title`,{version:e.latest}),wide:e.notes.length>0,children:(0,K.jsxs)(`div`,{className:Yi,children:[(0,K.jsx)(`p`,{className:`text-muted`,children:U(`updatePrompt.body`,{current:e.current})}),e.notes.length===1&&t?(0,K.jsx)(YX,{body:t.body}):(0,K.jsx)(aZ,{notes:e.notes}),(0,K.jsxs)(`div`,{className:Mi,children:[(0,K.jsx)(q,{onClick:()=>{localStorage.setItem(A9,e.latest),ce()},children:U(`updatePrompt.skip`)}),(0,K.jsx)(q,{onClick:ce,children:U(`updatePrompt.later`)}),(0,K.jsx)(q,{variant:`filled`,autoFocus:!0,onClick:()=>{ce(),$X.set(!0),Ee(`update`)},children:U(`updatePrompt.yes`)})]})]})})}G();function Soe({model:e,task:t}){return(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col pt-2`,children:[(0,K.jsxs)(`div`,{className:aQ,children:[(0,K.jsx)(`span`,{className:`text-warning`,children:U(`workspace.archived`)}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-subtle`,children:U(`workspace.archivedNote`)}),(0,K.jsx)(q,{variant:`filled`,onClick:()=>void Aq(e,t),children:Y(`tasks`,`menu.unarchive`)})]}),(0,K.jsx)(e1,{model:e,task:t,active:!0})]})}G(),He(),A();function Coe({model:e,taskId:t,groupId:n}){W();let r=k(e.tasks),i=r?yR(r.tasks,n):[];return i.length<2||!i.some(e=>e.id===t)?null:(0,K.jsxs)(`nav`,{className:sz,"aria-label":U(`compare.menu`),children:[i.map((n,r)=>(0,K.jsxs)(q,{variant:`pill`,hit:`tight`,"aria-current":n.id===t,onClick:()=>e.select(n.id),children:[`[ `,(0,K.jsx)(iF,{status:n.rowStatus}),r+1,` `,n.engine?.name??n.label,n.kept&&(0,K.jsx)(`span`,{className:`text-accent`,children:`✓`}),` ]`]},n.id)),(0,K.jsx)(q,{hit:`tight`,className:`ml-auto flex-none whitespace-nowrap`,onClick:()=>De(n),children:U(`compare.strip`)})]})}G(),H();function woe({model:e,taskId:t,fallback:n}){let[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{i(null),e.client.request(`inbox.message`,{id:t}).then(i,()=>i(`none`))},[e,t]),r===null?null:r===`none`?n:(0,K.jsx)(`div`,{className:iQ,children:(0,K.jsx)(`div`,{className:oQ,children:(0,K.jsxs)(`article`,{className:lQ({flash:!1,current:!1}),children:[(0,K.jsxs)(`header`,{className:uQ,children:[(0,K.jsx)(`span`,{className:dQ(`user`),children:r.from}),(0,K.jsx)(`span`,{className:fQ,children:new Date(r.at).toLocaleString()}),(0,K.jsx)(q,{className:`ml-auto`,disabled:a,onClick:()=>{o(!0),e.client.request(`inbox.toAgent`,{id:t}).catch(e=>{o(!1),z(Ra(e),`error`)})},children:U(`workspace.external.toAgent`)})]}),(0,K.jsx)($Q,{source:r.text})]})})})}xb(),A(),Ur();var M9=e=>m5(e)!==null,N9=e=>U3(m5(e)?.tab.split);function P9(e){let t=m5(e),n=t?.tab.split;return t&&n?{...t,split:n,leaf:d5(t.taskId,t.tab,n)}:null}Ic(()=>[{id:`workspace.split.right`,chords:[`ctrl+\\`],prefix:!1,surface:`workspace`,live:M9,run:e=>{let t=m5(e);t&&g5(e,t.taskId,t.tab,`right`)}},{id:`workspace.split.down`,chords:[`ctrl+=`],prefix:!1,surface:`workspace`,live:M9,run:e=>{let t=m5(e);t&&g5(e,t.taskId,t.tab,`down`)}},{id:`workspace.split.focus-next`,chords:[`f3`],prefix:!1,surface:`workspace`,live:N9,run:e=>{let t=P9(e);t&&p5(t.taskId,t.tab,t.split,G3(t.split,t.leaf))}},{id:`workspace.split.close`,chords:[`w`],prefix:!0,surface:`workspace`,live:N9,run:e=>{let t=P9(e);t&&_5(e,t.taskId,t.tab,t.leaf)}},{id:`workspace.split.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:N9,run:e=>{let t=P9(e);t&&v5(e,t.taskId,t.tab,t.leaf)}}]);var Toe=4e3,Eoe=[{id:`leaf-1`,x:0,y:0,w:1,h:1,left:!1,top:!1}];function Doe({model:e,taskId:t,tab:n}){let r=n.split;k(u5);let i=r?d5(t,n,r):`leaf-1`,a=r?K3(r,Ds(n)):new Map,o=U3(r),{prefs:s}=hb(),c=k(e.tasks)?.tasks.find(e=>e.id===t)?.tabStatus?.[n.id]??n.status,l=n.kind===`engine`&&c?.reason===`dead`?c.since:null;(0,J.useEffect)(()=>{l!==null&&e.refreshTabsNow(t)},[l,e,t]),(0,J.useEffect)(()=>{if(!o)return;let n=window.setInterval(()=>{document.hidden||e.refreshTabsNow(t)},Toe);return()=>window.clearInterval(n)},[o,e,t]);let u=l!==null&&n.alive!==!1?{code:n.exit?.code??null,since:l}:null,d=n.kind===`engine`&&c?.reason===`rate_limited`?{since:c.since}:null;return(0,K.jsx)(`div`,{className:Kn,children:(r?W3(r.root):Eoe).map(c=>(0,K.jsxs)(`div`,{className:Yn(o?s.splitStyle:null,{left:c.left,top:c.top,active:c.id===i}),style:{left:`calc(${c.x*100}% + var(--ml, 0px))`,top:`calc(${c.y*100}% + var(--mt, 0px))`,width:`calc(${c.w*100}% - var(--ml, 0px))`,height:`calc(${c.h*100}% - var(--mt, 0px))`},children:[(0,K.jsx)(kie,{client:e.client,model:e,engineExit:c.id===`leaf-1`?u:null,usageLimit:c.id===`leaf-1`?d:null,composer:n.kind===`engine`&&c.id===`leaf-1`,taskId:t,tabId:n.id,leafId:c.id,focused:c.id===i,onActivate:()=>r&&f5(t,n.id,r,c.id),onExit:()=>{o?h5(e,{taskId:t,tabId:n.id,action:`close`,leafId:c.id}):n.kind!==`engine`&&e.closeTab(t,n.id).catch(()=>{})}}),o&&(0,K.jsx)(`span`,{className:Xn(s.splitStyle===`rule`,c.id===i),onContextMenu:r=>d7(r,x5(e,t,n,c.id)),children:a.get(c.id)})]},c.id))})}var F9=/^[0-9a-f]{7,40}$/i;function I9(e,t){return t.sharesWorkspaceOf||!t.baseRef?null:e.find(e=>e.id!==t.id&&e.branch!==``&&e.branch===t.baseRef)||(F9.test(t.baseRef)&&t.parentTaskId?e.find(e=>e.id===t.parentTaskId)??null:null)}var Ooe=(e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``),L9=(e,t)=>e.filter(n=>!n.deleting&&I9(e,n)?.id===t).sort(Ooe);function koe(e,t){let n=[];for(let r=I9(e,t);r&&n.length<20&&!n.includes(r);r=I9(e,r))n.unshift(r);let r=L9(e,t.id);if(n.length===0&&r.length===0)return null;let i=n[n.length-1],a=i?L9(e,i.id):[t];a.includes(t)||a.push(t);let o=n[0]??t;return{path:n,level:a,kids:r,base:o.baseRef&&!F9.test(o.baseRef)?o.baseRef:null}}var R9=e=>e.pr?.lifecycle===`merged`;function Aoe(e,t){let n=e.level.find(e=>e.id===t),r=n?[...e.path,n]:e.path,[i,...a]=e.kids;return r.find(e=>!R9(e))??(i&&a.length===0&&!R9(i)?i:null)}G();var z9=`min-h-11 flex-none cursor-pointer whitespace-nowrap font-sans text-meta`;function joe(e){let t=t=>(0,K.jsxs)(`button`,{type:`button`,className:`${z9} max-w-[20ch] truncate ${t.id===e.taskId?`text-ink`:`text-muted`}`,"aria-current":t.id===e.taskId,title:t.title,onClick:()=>e.onSelect(t.id),children:[t.label||t.title,R9(t)&&(0,K.jsx)(`span`,{className:`text-accent`,children:` ✓`})]},t.id),n=(e,t)=>e.length===1?t(e[0]):(0,K.jsxs)(`span`,{className:`flex flex-none items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-subtle`,children:`{`}),e.map((e,n)=>(0,K.jsxs)(`span`,{className:`flex flex-none items-center gap-2`,children:[n>0&&(0,K.jsx)(`span`,{className:`text-subtle`,children:`|`}),t(e)]},e.id)),(0,K.jsx)(`span`,{className:`text-subtle`,children:`}`})]});return(0,K.jsxs)(`nav`,{className:`flex min-w-0 flex-none items-center gap-3 px-2 font-sans text-meta text-muted`,"aria-label":U(`compare.stackLabel`),children:[(0,K.jsxs)(`div`,{ref:e.scroller,className:`flex min-w-0 flex-1 items-center gap-2 overflow-x-auto scrollbar-none mask-r-from-[calc(100%-1.5rem)]`,children:[e.stack.base&&(0,K.jsxs)(`span`,{className:`flex-none text-subtle`,children:[e.stack.base,` ←`]}),e.stack.path.map(e=>(0,K.jsxs)(`span`,{className:`flex flex-none items-center gap-2`,children:[t(e),(0,K.jsx)(`span`,{className:`text-subtle`,children:`←`})]},e.id)),n(e.stack.level,r=>r.id===e.taskId&&e.stack.kids.length>0?(0,K.jsxs)(`span`,{className:`flex flex-none items-center gap-2`,children:[t(r),(0,K.jsx)(`span`,{className:`text-subtle`,children:`←`}),n(e.stack.kids,t)]},r.id):t(r)),(0,K.jsx)(`span`,{className:`w-4 flex-none`,"aria-hidden":`true`})]}),e.onLand&&(0,K.jsx)(`button`,{type:`button`,className:`${z9} text-accent`,onClick:e.onLand,children:U(`compare.landBottomPhone`)})]})}G(),He(),A();function Moe({model:e,taskId:t}){W();let n=ke(),r=k(e.tasks)?.tasks??[],i=r.find(e=>e.id===t),a=i?koe(r,i):null,o=Noe(t,a!==null);if(!a)return null;let s=Aoe(a,t),c=s&&!s.machine?()=>void Sq(e,s):void 0,l=t=>e.select(t);if(n)return(0,K.jsx)(joe,{stack:a,taskId:t,onSelect:l,onLand:c,scroller:o});let u=(e,n)=>(0,K.jsxs)(q,{variant:`pill`,hit:`tight`,"aria-current":e.id===t,title:e.title,onClick:()=>l(e.id),children:[n&&`[ `,(0,K.jsx)(iF,{status:e.rowStatus}),(0,K.jsx)(`span`,{className:`max-w-48 truncate`,children:e.label||e.title}),R9(e)?(0,K.jsx)(`span`,{className:`text-accent`,children:`✓`}):e.pr?.number?(0,K.jsx)(`span`,{children:`PR`}):null,n&&`]`]},e.id),d=(e,n)=>e.id===t&&a.kids.length>0?(0,K.jsxs)(`span`,{className:`flex flex-none items-center gap-x-3.5`,children:[u(e,n),(0,K.jsx)(`span`,{className:`text-subtle`,children:`←`}),(0,K.jsx)(B9,{nodes:a.kids,render:u})]},e.id):u(e,n);return(0,K.jsxs)(`nav`,{className:`flex min-w-0 items-center gap-x-3.5 px-2.5 py-1 font-mono text-meta`,"aria-label":U(`compare.stackLabel`),children:[(0,K.jsxs)(`div`,{ref:o,className:`flex min-w-0 flex-1 items-center gap-x-3.5 overflow-x-auto scrollbar-none`,children:[a.base&&(0,K.jsxs)(`span`,{className:`flex-none text-subtle`,children:[a.base,` ←`]}),a.path.map(e=>(0,K.jsxs)(`span`,{className:`flex flex-none items-center gap-x-3.5`,children:[d(e,!0),(0,K.jsx)(`span`,{className:`text-subtle`,children:`←`})]},e.id)),(0,K.jsx)(B9,{nodes:a.level,render:d})]}),c&&(0,K.jsx)(q,{hit:`tight`,className:`flex-none whitespace-nowrap`,onClick:c,children:U(`compare.landBottom`)})]})}function B9({nodes:e,render:t}){return e.length===1?t(e[0],!0):(0,K.jsxs)(`span`,{className:`flex flex-none items-center gap-x-2`,children:[(0,K.jsx)(`span`,{className:`text-subtle`,children:`{`}),e.map((e,n)=>(0,K.jsxs)(`span`,{className:`flex items-center gap-x-2`,children:[n>0&&(0,K.jsx)(`span`,{className:`text-subtle`,children:`|`}),t(e,!1)]},e.id)),(0,K.jsx)(`span`,{className:`text-subtle`,children:`}`})]})}function Noe(e,t){let n=(0,J.useRef)(null);return(0,J.useEffect)(()=>{n.current?.querySelector(`[aria-current="true"]`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[e,t]),n}function Poe(e,t){return e===`never`?!1:e!==`multipleOnly`||t>=2}G();function Foe({taskId:e}){W();let t=EB(e),n=DB(e);return(0,K.jsx)(`div`,{className:oi,children:cB.map(r=>{let i=n&&!!$z(t,r);return(0,K.jsx)(`button`,{type:`button`,className:Gr({on:i}),title:U(`panel.${r}`),"aria-label":U(`panel.${r}`),"aria-pressed":i,onClick:()=>MB(e,r),children:(0,K.jsx)(R6,{children:z6[r]})},r)})})}G(),xb(),A(),H();function Ioe({model:e,task:t,tabs:n,narrow:r}){let i=k(e.selection),{prefs:a}=hb(),o=k(O9),s=E1(),c=$1(),l=!Poe(a.tabStrip,n.length),u=(0,K.jsxs)(`div`,{className:qr,role:`tablist`,children:[n.map((n,r)=>(0,K.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n.id===i.tabId,className:`group/tab flex items-center gap-1.5 whitespace-nowrap rounded-sm px-2.5 py-1 active:scale-97 motion-reduce:active:scale-none touch:select-none touch:touch-callout-none ${l?`hidden`:``} ${n.id===i.tabId?`bg-inset text-ink`:`text-muted hover:bg-hover data-menu-open:bg-hover`}`,onClick:()=>e.select(t.id,n.id),onContextMenu:r=>d7(r,L(F5(e,t,n),U(`menu.more`))),children:[(0,K.jsx)(`span`,{className:`text-subtle group-aria-selected/tab:text-accent`,children:r+1}),Ds(n)]},n.id)),!r&&(0,K.jsx)(Foe,{taskId:t.id})]});return(0,K.jsx)(a5,{slot:`session.header`,data:V9(e,t,n,i.tabId,s?.manifest,c,r,o),fallback:u})}function V9(e,t,n,r,i,a,o,s){let c=n.find(e=>e.id===r);return{taskId:t.id,title:t.label,branch:t.branch||void 0,repo:t.repo?t.repo.split(`/`).pop():void 0,worktree:U8(t),engineId:t.engine?.id??void 0,engineName:t.engine?.name,model:t.model,engineFamily:t.engine?.protocol,engineColor:L8(i,t.engine,a),statusKind:t.rowStatus?.kind??`idle`,tabs:n.map(e=>({id:e.id,label:Ds(e),active:e.id===r})),activeTab:c?Ds(c):void 0,tabCount:n.length,onSelectTab:n=>e.select(t.id,n),narrow:o,packageView:s,onPackageView:k9,view:o?lB.get():`terminal`,onShowView:e=>{if(p8.includes(e)){if(!o)return e===`terminal`?void 0:jB(t.id,e);O9.set(null),h8(t.id,r,e)}}}}G(),H();function H9(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e))}function U9({model:e}){let t=W()===`zh`?bo:yo,n=e.client,[r,i]=(0,J.useState)(()=>(Hs(n,`worktrees.list`,{network:!0})??Hs(n,`worktrees.list`,{network:!1}))?.projects??null),[a,o]=(0,J.useState)([]),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(0),[d,f]=(0,J.useState)(0),p=(0,J.useRef)(null);(0,J.useEffect)(()=>{let e=!0,t=n.onOpen(()=>{let t=!1,r=r=>Ws(n,`worktrees.list`,{network:r}).then(n=>{if(!(!e||!r&&t)&&(r&&(t=!0),c(null),i(n.projects),r)){let e=new Set(n.projects.flatMap(e=>e.worktrees.map(e=>e.path)));o(t=>t.filter(t=>e.has(t)))}}).catch(t=>{e&&c(MO(t))});r(!1),r(!0)});return()=>{e=!1,t()}},[n,d]),(0,J.useEffect)(()=>p.current?.focus(),[]);let m=(r??[]).map(e=>({...e,worktrees:e.worktrees.filter(e=>!a.includes(e.path))})),h=m.flatMap(e=>e.worktrees),g=Math.min(l,Math.max(0,h.length-1));(0,J.useEffect)(()=>{p.current?.querySelector(`[data-row="${g}"]`)?.scrollIntoView({block:`nearest`})},[g]);let _=(0,J.useCallback)(()=>f(e=>e+1),[]),v=async(e,r)=>{o(t=>[...t,e.path]);try{let i=await n.request(`worktrees.remove`,{path:e.path,force:r});i.residue&&z(H9(t.delete.residue,i.residue)),_()}catch(n){o(t=>t.filter(t=>t!==e.path));let i=n&&typeof n==`object`&&`code`in n?n.code:null;if(!r&&i===`DIRTY_WORKTREE`){B.set((0,K.jsx)(Ha,{title:t.delete.forceTitle,body:`${H9(t.delete.forceBody,{branch:e.branch||e.path})}\n\n${H9(t.delete.forceReason,{reason:Ra(n)})}`,confirmLabel:t.delete.button,onConfirm:()=>v(e,!0)}));return}z(H9(t.delete.failed,{error:Ra(n)}),`error`)}},y=e=>B.set((0,K.jsx)(Ha,{title:t.delete.confirmTitle,body:H9(t.delete.confirmBody,{branch:e.branch||e.path}),confirmLabel:t.delete.button,onConfirm:async()=>{v(e,!1)}})),b=n=>{if(!n.taskId){z(t.land.noTask,`error`);return}Sq(e,{id:n.taskId,title:n.branch,branch:n.branch},_)},x=e=>{if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`c`&&!window.getSelection()?.toString())return e.preventDefault(),V.set(null);if(e.metaKey||e.ctrlKey||e.altKey)return;let t=h[g];if(e.key===`j`||e.key===`ArrowDown`)u(Math.min(h.length-1,g+1));else if(e.key===`k`||e.key===`ArrowUp`)u(Math.max(0,g-1));else if(e.key===`d`&&t)y(t);else if(e.key===`l`&&t)b(t);else if(e.key===`q`||e.key===`Escape`)V.set(null);else return;e.preventDefault()},S=0;return(0,K.jsxs)(`div`,{className:KB,tabIndex:0,ref:p,onKeyDown:x,children:[(0,K.jsx)(`h1`,{className:qB,children:t.title}),s!==null&&(0,K.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-3 text-error`,children:[H9(t.loadFailed,{message:s}),(0,K.jsx)(q,{onClick:_,children:U(`workspace.retry`)})]}),r===null?s===null&&(0,K.jsx)(`p`,{className:`text-muted`,children:t.loading}):m.length===0?(0,K.jsx)(`p`,{className:`text-muted`,children:t.noProjects}):m.map(e=>{let n=S;return S+=e.worktrees.length,(0,K.jsxs)(`section`,{className:RX,children:[(0,K.jsxs)(`h2`,{className:`mt-1.5 mr-2 mb-1 ml-0 flex items-center gap-1 font-mono text-meta font-semibold normal-nums text-subtle`,children:[(0,K.jsx)(`span`,{children:e.repo}),(0,K.jsx)(`span`,{className:`rule`})]}),e.worktrees.length===0&&(0,K.jsx)(`p`,{className:`mono text-muted`,children:t.noWorktrees}),e.worktrees.map((e,r)=>{let i=n+r;return(0,K.jsxs)(`div`,{"data-row":i,className:zX(i===g),onClick:()=>u(i),children:[(0,K.jsxs)(`div`,{className:BX,children:[(0,K.jsx)(`span`,{className:HX,children:e.branch||t.row.detached}),e.roveManaged&&(0,K.jsx)(`span`,{className:`chip text-muted`,children:t.badge.roveManaged}),e.dirty===!0&&(0,K.jsx)(`span`,{className:`chip text-warning`,children:t.badge.dirty}),e.dirty===null&&(0,K.jsx)(`span`,{className:`chip text-muted`,children:t.badge.dirtyUnknown}),(0,K.jsx)(`span`,{className:`chip ${e.branchOnRemote===!0?`text-success`:e.branchOnRemote===!1?`text-warning`:`text-muted`}`,children:e.branchOnRemote===!0?t.badge.remoteOn:e.branchOnRemote===!1?t.badge.remoteOff:t.badge.remoteUnknown}),e.verdictReason!==`dirty`&&e.verdictReason!==`fresh`&&(0,K.jsx)(`span`,{className:`chip ${e.verdict===`merged`?`text-success`:e.verdict===`stale`?`text-warning`:`text-accent`}`,children:t.verdict[e.verdictReason]??e.verdictReason})]}),(0,K.jsxs)(`div`,{className:`${VX} mono text-muted`,children:[(0,K.jsx)(`span`,{className:UX,children:e.path}),e.createdAtMs>0&&(0,K.jsx)(`span`,{children:H9(t.row.created,{age:el(Date.now()-e.createdAtMs)})})]}),i===g&&(0,K.jsxs)(`div`,{className:`flex items-baseline gap-2 text-[length:var(--fs-body)]`,children:[(0,K.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>y(e),children:t.delete.button}),e.taskId&&(0,K.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>b(e),children:t.land.button})]})]},e.path)})]},e.repo)}),(0,K.jsx)(`p`,{className:`${WX} mono keys-only text-muted`,children:(0,K.jsx)(kO,{text:`j/k · d ${t.delete.button} · l ${t.land.button} · q/esc`})})]})}G(),A(),El(),H(),Ur();function Loe({model:e,narrow:t}){let n=k(e.selection),r=k(e.tabs),i=k(e.tasks),a=k(e.remote),o=a.find(e=>e.id===n.taskId&&!e.machine?.stale),s=ec(i,n.taskId)??o??null,c=o?void 0:a.find(e=>e.id===n.taskId),l=s?r[s.id]??[]:[],u=s?s.id in r:!1,d=k(V),f=t0(s?.id),p=s?.rowStatus?.kind===`running`,m=k(be),h=E1(),g=$1(),_=t?``:I1(h?.manifest.layout?.frame),v=k(lB),y=k(O9),b=(0,J.useContext)(a7),x=s7(`package.view`),S=v!==`terminal`&&t&&!!s,C=l.find(e=>e.id===n.tabId);if((0,J.useEffect)(()=>{let t=e.selection.get();return fB(t.taskId,t.tabId),e.selection.subscribe(()=>{V.set(null),be.set(null);let n=e.selection.get();n.taskId!==t.taskId&&d1.get().activePack?.manifest.slots?.[`package.view`]&&O9.set(null),(n.taskId!==t.taskId||n.tabId!==t.tabId)&&fB(n.taskId,n.tabId),t=n})},[e]),(0,J.useEffect)(()=>I6(e),[e]),d===`worktrees`)return(0,K.jsxs)(`main`,{"data-tp-region":`workspace`,className:`${xr} ${Hn}`,children:[t&&(0,K.jsx)(o7,{slot:`phone.sessionHeader`,fallback:(0,K.jsx)(g8,{client:e.client})}),(0,K.jsx)(U9,{model:e})]});if(d)return(0,K.jsxs)(`main`,{"data-tp-region":`workspace`,className:`${xr} ${Hn}`,children:[t&&(0,K.jsx)(o7,{slot:`phone.sessionHeader`,fallback:(0,K.jsx)(g8,{client:e.client})}),(0,K.jsx)(eie,{model:e,page:d})]});if(b&&y!==null&&x)return(0,K.jsxs)(`main`,{"data-tp-region":`workspace`,className:`${xr} ${Hn}`,children:[t&&(0,K.jsx)(o7,{slot:`phone.sessionHeader`,fallback:(0,K.jsx)(g8,{client:e.client})}),(0,K.jsx)(a5,{slot:`package.view`,data:{...b,narrow:t,onShowView:e=>{!s||!p8.includes(e)||(O9.set(null),t?h8(s.id,n.tabId,e):e!==`terminal`&&jB(s.id,e))}},fallback:null})]});if(m)return(0,K.jsxs)(`main`,{"data-tp-region":`workspace`,className:`${xr} ${Hn}`,children:[t&&(0,K.jsx)(o7,{slot:`phone.sessionHeader`,fallback:(0,K.jsx)(g8,{client:e.client})}),(0,K.jsx)(`div`,{className:Sr,children:(0,K.jsx)(fR,{model:e,seed:m},bI(m))})]});if(s?.archived)return(0,K.jsxs)(`main`,{"data-tp-region":`workspace`,className:`${xr} ${Hn}`,children:[t&&(0,K.jsx)(o7,{slot:`phone.sessionHeader`,fallback:(0,K.jsx)(g8,{client:e.client,title:s.title})}),(0,K.jsx)(`div`,{className:Sr,children:(0,K.jsx)(Soe,{model:e,task:s})})]});let w=t=>(0,K.jsxs)(`div`,{className:br,children:[(0,K.jsx)(`p`,{children:U(`workspace.noTabs`)}),(0,K.jsx)(q,{variant:`filled`,onClick:()=>void JI(e,t.id,{kind:`engine`}).catch(e=>z(String(e),`error`)),children:t.engine?U(`workspace.startEngine`,{engine:t.engine.name}):U(`workspace.startSession`)}),` `,(0,K.jsx)(q,{variant:`filled`,onClick:()=>void qI(e,t.id),children:U(`menu.newChat`)}),` `,(0,K.jsx)(q,{variant:`filled`,onClick:()=>B.set((0,K.jsx)(TK,{model:e,taskId:t.id})),children:U(`menu.newChatPick`)})]}),T=s?{...V9(e,s,l,n.tabId,h?.manifest,g,t,y),onSend:t=>void e.client.request(`tab.send`,{...e.engineTarget(s.id),prompt:t}).catch(e=>z(String(e),`error`))}:null;return(0,K.jsxs)(`main`,{"data-tp-region":`workspace`,className:`${xr} ${Hn} ${_}`,children:[t&&(0,K.jsx)(o7,{slot:`phone.sessionHeader`,fallback:(0,K.jsx)(g8,{client:e.client,taskId:s?.id,tabId:n.tabId,title:s?.title})}),s&&(0,K.jsx)(Ioe,{model:e,task:s,tabs:l,narrow:t}),s&&!s.groupId&&(0,K.jsx)(Moe,{model:e,taskId:s.id}),s?.groupId&&(0,K.jsx)(Coe,{model:e,taskId:s.id,groupId:s.groupId}),(e=>T&&!S?(0,K.jsx)(a5,{slot:`session.body`,data:T,fallback:e}):e)((0,K.jsxs)(`div`,{className:`${Sr} ${p?Cr:``}`,style:f?{"--task-ink":f}:void 0,children:[!t&&!s&&!c&&i&&i.tasks.length+a.length===0&&(0,K.jsx)(u7,{model:e}),!s&&!c&&i&&i.tasks.length+a.length>0&&(0,K.jsx)(`p`,{className:yr,children:U(`workspace.pickTask`)}),c?.machine&&(0,K.jsx)(`div`,{className:br,children:(0,K.jsx)(LN,{host:c.machine.label,onMachines:()=>KK(e)})}),s&&u&&l.length===0&&!S&&s.connector!==`inbox`&&w(s),s&&u&&l.length===0&&!S&&s.connector===`inbox`&&(0,K.jsx)(woe,{model:e,taskId:s.id,fallback:w(s)}),s&&S&&(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,K.jsx)(D9,{model:e,task:s,narrow:!0}),v===`chat`&&C?.kind===`engine`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(LZ,{model:e,taskId:s.id,tabId:C.id}),(0,K.jsx)(G7,{to:t=>void e.client.request(`term.input`,{stream:Tl(s.id,C.id),data:t}).catch(e=>z(String(e),`error`)),atMenu:s.tabStatus?.[C.id]?.kind===`needs-input`})]})]}),s&&n.tabId&&l.some(e=>e.id===n.tabId)&&(0,K.jsx)(`div`,{className:`min-w-0 flex-1 ${S?`hidden`:`flex`}`,children:(0,K.jsx)(Doe,{model:e,taskId:s.id,tab:l.find(e=>e.id===n.tabId)??l[0]},`${s.id}::${n.tabId}`)})]})),T&&(0,K.jsx)(a5,{slot:`session.footer`,data:T,fallback:null})]})}G(),He(),cb(),xb(),A(),H(),Ur();function Roe({model:e}){W();let t=k(e.client.conn);return t.hello===null&&t.failures>=2?(0,K.jsx)(zoe,{}):(0,K.jsx)(M8,{children:(0,K.jsx)(Boe,{model:e})})}function zoe(){let[e,t]=(0,J.useState)(null);return(0,J.useEffect)(()=>{WO().then(t)},[]),e===null?null:e?(0,K.jsx)(YO,{}):(0,K.jsx)(Ni,{failing:!0})}function Boe({model:e}){l6(e);let t=k(e.client.conn).hello;(0,J.useEffect)(()=>{if(!t)return;fZ(e.client,t.roveVersion);let n=()=>void rZ(e.client).then(boe);n();let r=window.setInterval(n,36e5);return()=>window.clearInterval(r)},[t,e.client]),(0,J.useEffect)(()=>{t&&VO(e)},[t,e]),uie(e),sie(e),Qc(),Tc(e.client),fie(e),Eo(e.client),Y2(e.client),(0,J.useEffect)(()=>{e.onSelect=Ie;let t=be.subscribe(()=>{be.get()!==null&&Ie()});return ae(),t},[e]),(0,J.useEffect)(()=>U4(e),[e]);let n=k(e.selection),r=k(e.tasks),i=k(e.remote),a=ke(),o=k(e8),s=k(t8),c=k($6),l=k(Ne),u=k(Je)===`app`,d=k(hB),f=k(_B),p=k(V),m=k(we)===`drag`,h=k(be)!==null,g=i.find(e=>e.id===n.taskId&&!e.machine?.stale),_=ec(r,n.taskId)??g??null,v=g?void 0:i.find(e=>e.id===n.taskId),y=DB(_?.id??null),b=EB(_?.id??``).columns.length,x=k(O9),S=s7(`package.view`)&&x!==null,C=a?Ae(l,!!_||!!v,p!==null||h||S):null;(0,J.useEffect)(()=>e.setTaskShown(C===null||C===`content`&&p===null&&!h),[e,C,p,h]);let w=E1(),T=w?.manifest.layout?.frame,E=w?.manifest.layout?.railWidth,D=w?.manifest.slots?.[`panel.frame`]?.component!==void 0&&!!_,O=D?w?.manifest.layout?.panelWidth:void 0,{prefs:ee}=hb(),A=r7(r?.tasks??[]),j=s7(`phone.tabs`)&&a;(0,J.useEffect)(()=>O9.set(null),[w?.id]);let M=M7(e),N=a8(c??E??280),P=d??O??null,F=P===null?null:vB(P,o?0:N),I=Math.max(1,b),L=`max(280px, min(calc((100% - var(--rail-w)) * ${I} / ${I+2}), calc(100% - var(--rail-w) - 320px)))`,R={"--rail-w":`${o?0:N}px`,"--rail-open-w":`${o?a8(280):N}px`,"--panel-w":F===null?L:`${F}px`},te=(0,K.jsxs)(`div`,{className:`${Bn({panel:(y||D)&&(!!_||!!v)&&!a,expanded:f&&(y||D)&&!a,surface:C&&u?`back`:C,folded:o&&!a,peek:o&&s&&!a,dragging:m})} ${a?``:F1(T)}`,style:a?void 0:R,children:[!a&&(0,K.jsx)(d8,{model:e,hidden:!!w?.manifest.slots?.[`shell.topBar`]?.component}),o&&!a&&(0,K.jsx)(`div`,{className:`absolute inset-y-0 left-0 z-5 col-1 row-1 w-2.5`,title:U(`layout.railUnfold`),onMouseEnter:()=>i8(!0),onMouseLeave:()=>i8(!1),onMouseUp:()=>e8.set(!1)}),(0,K.jsx)(pre,{model:e,narrow:a}),(0,K.jsx)(Loe,{model:e,narrow:a}),C&&!j&&(0,K.jsx)($D,{show:C===`sidebar`?`list`:`page`}),!a&&(0,K.jsx)(D9,{model:e,task:_,remoteHost:v?.machine?.label}),(0,K.jsx)(qne,{model:e,narrow:a}),(0,K.jsx)(vR,{}),(0,K.jsx)(m6,{model:e}),(0,K.jsx)(ic,{model:e})]}),ne=By(ee.themeMode,matchMedia(`(prefers-color-scheme: dark)`).matches),re={...A,taskCount:(r?.tasks.length??0)+i.length,selectedId:_?.id,selectedTitle:_?.label??``,railFolded:o&&!a,onToggleRail:()=>e8.set(!o),mode:ne,onSetMode:t=>void pb(e.client,`themeMode`,t),unreadCount:r?.attention.filter(e=>e.unread).length??0,pages:M,onNewSession:()=>dR(),onOpenSettings:()=>B.set((0,K.jsx)(V3,{model:e})),onOpenInbox:()=>B.set((0,K.jsx)(AO,{model:e})),packageView:x,onPackageView:k9},ie=k(lB),z=a?{...re,pane:C===`sidebar`?`list`:p!==null||h?`page`:S?`view`:`session`,title:M.find(e=>e.active)?.label??(p===null&&!h?_?.label??``:``),onShowList:Le,onShowSession:()=>{V.set(null),be.set(null),_&&Ie()},views:p8.map(e=>({kind:e,title:m8(e)})),view:ie,onShowView:e=>{!_||!p8.includes(e)||(O9.set(null),h8(_.id,n.tabId,e),Ie())}}:null;return(0,K.jsx)(s5,{model:e,children:(0,K.jsx)(a7,{value:re,children:(0,K.jsx)(i7,{value:z,children:(0,K.jsxs)(`div`,{className:zn,children:[(0,K.jsx)(P8,{client:e.client,onOpenSettings:()=>B.set((0,K.jsx)(V3,{model:e,section:`appearance`}))}),!a&&(0,K.jsx)(a5,{slot:`shell.topBar`,data:re,fallback:null}),(0,K.jsx)(o7,{slot:`phone.topBar`,fallback:null}),(0,K.jsx)(a5,{slot:`shell.frame`,data:{...re,panelOpen:(y||D)&&!a,narrow:a},fallback:te}),j&&(0,K.jsx)(o7,{slot:`phone.tabs`,fallback:null})]})})})})}var W9=`rove.crashLog`,Voe=4e3;function G9(){try{let e=JSON.parse(localStorage.getItem(W9)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}catch{return[]}}function Hoe(e){if(e instanceof Error)return`${e.message}\n${e.stack??``}`;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function K9(e,...t){let n=`${new Date().toISOString()} [${e}] ${t.map(Hoe).join(` `)}`.slice(0,Voe);try{localStorage.setItem(W9,JSON.stringify([...G9(),n].slice(-100)))}catch{}}function Uoe(){return G9().join(`
|
|
262
|
+
`)}function Woe(){let e=console.error.bind(console);console.error=(...t)=>{K9(`error`,...t),e(...t)},window.addEventListener(`error`,e=>K9(`uncaught`,e.error??e.message)),window.addEventListener(`unhandledrejection`,e=>K9(`rejection`,e.reason)),document.addEventListener(`webglcontextlost`,()=>K9(`webgl`,`context lost`),!0)}G();var Goe=class extends J.Component{state={error:null,componentStack:``};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.setState({componentStack:t.componentStack??``})}render(){let{error:e,componentStack:t}=this.state;if(!e)return this.props.children;let n=[`${e.message}\n${e.stack??``}`,t,Uoe()].filter(Boolean).join(`
|
|
263
|
+
|
|
264
|
+
`);return(0,K.jsx)(Koe,{report:n})}};function Koe({report:e}){let[t,n]=(0,J.useState)(!1);return(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3 bg-surface p-4 text-ink`,children:[(0,K.jsx)(`p`,{className:`font-sans text-title`,children:U(`crash.title`)}),(0,K.jsxs)(`div`,{className:`flex gap-4`,children:[(0,K.jsx)(q,{variant:`filled`,onClick:()=>void navigator.clipboard.writeText(e).then(()=>n(!0),()=>n(!1)),children:U(t?`crash.copied`:`crash.copy`)}),(0,K.jsx)(q,{variant:`action`,onClick:()=>location.reload(),children:U(`crash.reload`)})]}),(0,K.jsx)(`pre`,{className:`min-h-0 flex-1 select-text overflow-auto whitespace-pre-wrap break-all font-mono text-meta text-muted`,children:e})]})}var qoe=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function Joe(e){return[...e.querySelectorAll(qoe)].filter(e=>e.tabIndex>=0&&e.offsetParent!==null)}function Yoe(){window.addEventListener(`keydown`,e=>{if(e.key!==`Tab`||e.defaultPrevented||e.ctrlKey||e.metaKey||e.altKey)return;let t=[...document.querySelectorAll(`.overlay:not(.is-leaving)`)].at(-1);if(!t)return;let n=Joe(t);if(n.length===0)return;let r=document.activeElement,i=r instanceof HTMLElement&&t.contains(r),a=e.shiftKey?n.filter(e=>i&&!!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)).at(-1)??n.at(-1):n.find(e=>i&&!!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING))??n[0];e.preventDefault(),a?.focus()})}H();function q9(e){if(!oe())for(let t of document.querySelectorAll(`${e}:not(.is-leaving)`)){let e=t.cloneNode(!0);e.classList.add(`is-leaving`),e.inert=!0,e.setAttribute(`aria-hidden`,`true`),document.body.append(e);let n=t.querySelectorAll(`*`),r=e.querySelectorAll(`*`);n.forEach((e,t)=>{let n=r[t];e.scrollTop&&(n.scrollTop=e.scrollTop),(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&(n.value=e.value)}),window.setTimeout(()=>e.remove(),200)}}function J9(e){for(let t of document.querySelectorAll(`${e}.is-leaving`))t.remove()}function Xoe(){for(let e of document.querySelectorAll(`.overlay:not(.is-leaving)`))for(let t of e.getAnimations())t instanceof CSSAnimation&&t.animationName===`fade-in`&&t.finish()}function Zoe(){let e=B.get(),t=-1/0;B.subscribe(()=>{let n=B.get();if(n===null&&e!==null)t=performance.now(),q9(`.overlay`);else if(n!==null){let n=e!==null||performance.now()-t<140;J9(`.overlay`),n&&requestAnimationFrame(Xoe)}e=n});let n=de.get();de.subscribe(()=>{let e=de.get();e===null&&n!==null?q9(`.menu`):e!==null&&J9(`.menu`),n=e});let r=_K.get().guide;_K.subscribe(()=>{let e=_K.get().guide;e===null&&r!==null?q9(`.prefix-guide`):e!==null&&J9(`.prefix-guide`),r=e})}var Qoe=500,$oe=10,ese=`input, textarea, select, [contenteditable], .xterm`,Y9=[`mousedown`,`mouseup`,`click`,`contextmenu`];function tse(){let e=null,t=()=>{e&&window.clearTimeout(e.timer),e=null},n=()=>{let e=e=>{e.preventDefault(),e.stopPropagation()},t=()=>{for(let t of Y9)document.removeEventListener(t,e,!0);document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`keydown`,t,!0)};for(let t of Y9)document.addEventListener(t,e,!0);document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`keydown`,t,!0)};document.addEventListener(`pointerdown`,r=>{if(t(),r.pointerType!==`touch`||!(r.target instanceof Element)||r.target.closest(ese))return;let i=r.target,a={x:r.clientX,y:r.clientY,native:!1,timer:window.setTimeout(()=>{e=null,!(a.native||!i.isConnected)&&(i.dispatchEvent(new MouseEvent(`contextmenu`,{bubbles:!0,cancelable:!0,clientX:a.x,clientY:a.y,button:2})),n())},Qoe)};e=a},!0),document.addEventListener(`pointermove`,n=>{e&&Math.hypot(n.clientX-e.x,n.clientY-e.y)>$oe&&t()},!0),document.addEventListener(`pointerup`,t,!0),document.addEventListener(`pointercancel`,t,!0),document.addEventListener(`contextmenu`,t=>{e&&t.isTrusted&&(e.native=!0)},!0)}He(),H();function nse(e,t){e.viewingExtras=()=>ane({narrow:Be(),panelOpen:OB(e.selection.get().taskId)});let n=()=>e.reportViewing();gB.subscribe(n),kB(n),be.subscribe(n),V.subscribe(n),Ve(n),t.on(`panel`,t=>{ine(t)&&VB(t,e.selection.get().taskId)});let r=qz();if(r){let t=t=>{let n=t.taskId??e.selection.get().taskId;!n||!t.url||BB({taskId:n,desktopTabId:t.id,panelKey:t.panelKey,url:t.url})};r.onHandoff(e=>{e.owner===`human`&&t(e)}),r.onFocus(e=>t(e))}}G(),H();function rse(e){let t=e;return!!t&&typeof t.promptId==`string`&&typeof t.title==`string`}function ise({client:e,prompt:t}){let n=(W()===`zh`?qa:Ka).prompt,[r,i]=(0,J.useState)(t.initial??``),a=(0,J.useRef)(!1),{busy:o,error:s,submit:c}=Ba();return(0,J.useEffect)(()=>()=>{a.current||e.request(`ui.promptReply`,{promptId:t.promptId}).catch(()=>{})},[e,t.promptId]),(0,K.jsx)(za,{title:t.title,children:(0,K.jsxs)(`form`,{className:Yi,onSubmit:n=>{n.preventDefault(),c(async()=>{await e.request(`ui.promptReply`,{promptId:t.promptId,value:r}),a.current=!0})},children:[(0,K.jsx)(`input`,{className:ji,"aria-label":n.fieldLabel,autoFocus:!0,spellCheck:!1,value:r,placeholder:t.placeholder,onChange:e=>i(e.target.value)}),s&&(0,K.jsx)(`p`,{className:`text-error`,children:s}),(0,K.jsx)(Wa,{busy:o,submitLabel:n.submitLabel})]})})}function ase(e,t){B.get()||B.set((0,K.jsx)(ise,{client:e,prompt:t},t.promptId))}var X9=`rove-web.reloadedFor`;function ose(e,t,n){return e===null?`adopt`:t===e||t===n?`stay`:`reload`}function sse(){let e=null;try{e=window.sessionStorage}catch{}return{storage:e,reload:()=>window.location.reload()}}function cse(e,t=sse()){let n=null,r=null,i=()=>{try{return t.storage?.getItem(X9)??r}catch{return r}};return e.conn.subscribe(()=>{let{state:a,hello:o}=e.conn.get();if(a!==`open`||!o)return;let s=ose(n,o.roveVersion,i());if(s===`adopt`&&(n=o.roveVersion),s===`reload`){r=o.roveVersion;try{t.storage?.setItem(X9,o.roveVersion)}catch{}t.reload()}})}function lse(){let e=window.visualViewport;if(!e)return;let t=document.documentElement,n=window.matchMedia(`(pointer: coarse)`),r=0,i=0,a=()=>{let a=e.height*e.scale;window.innerWidth!==i&&(i=window.innerWidth,r=0),r=n.matches?Math.max(r,a,window.innerHeight):window.innerHeight;let o=r-a>120,s=o===t.hasAttribute(`data-keyboard`)?null:document.querySelector(`.overlay:not(.is-leaving) .dialog`),c=s?.getBoundingClientRect().top;if(t.style.setProperty(`--vvh`,`${a}px`),t.toggleAttribute(`data-keyboard`,o),s&&c!==void 0&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches){let e=c-s.getBoundingClientRect().top;e&&s.animate({translate:[`0 ${e}px`,`0 0`]},{duration:240,easing:`cubic-bezier(0.2, 0, 0, 1)`})}e.scale===1&&window.scrollY!==0&&window.scrollTo(0,0)};e.addEventListener(`resize`,a),e.addEventListener(`scroll`,a),window.addEventListener(`scroll`,a,{passive:!0}),a()}h(),wl(),Tb(),Woe();var use=(0,Ue.createRoot)(document.getElementById(`root`));lse(),tse(),et(),aee(),Zoe(),Yoe(),tN();var Z9=e=>use.render((0,K.jsx)(J.StrictMode,{children:(0,K.jsx)(Goe,{children:e})}));function Q9(e){let t=new Cl(vl(),e),n=new nc(t);t.on(`prompt`,e=>{rse(e)&&ase(t,e)}),nse(n,t),cse(t),t.start(),Z9((0,K.jsx)(Roe,{model:n}))}var $9=d();$9?Q9($9):Promise.all([GO(),WO()]).then(([e,t])=>{e?Q9(``):Z9(t?(0,K.jsx)(YO,{}):(0,K.jsx)(Ni,{}))});
|