@bkm016/basalt 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/README.md +3 -2
  2. package/{chunk-bng72094.js → chunk-03wzwnn6.js} +1 -1
  3. package/{chunk-9e8vhzy7.js → chunk-0crbhhna.js} +1 -1
  4. package/{chunk-h9zxqeqr.js → chunk-0rasqm8y.js} +2 -2
  5. package/{chunk-0x9netvr.js → chunk-1w4nh5t6.js} +1 -1
  6. package/{chunk-dk6fgprw.js → chunk-2eaehpp6.js} +1 -1
  7. package/{chunk-6sea12mw.js → chunk-30dxcr91.js} +1 -1
  8. package/{chunk-2zbj8ny6.js → chunk-343jsm46.js} +2 -2
  9. package/chunk-38g4jd6v.js +5 -0
  10. package/{chunk-zx75vnw8.js → chunk-39mh7h58.js} +22 -22
  11. package/chunk-44b9yx79.js +2 -0
  12. package/{chunk-r1jn77q6.js → chunk-4f6p4n7k.js} +2 -2
  13. package/{chunk-sgz87ht5.js → chunk-4w8j6n7z.js} +1 -1
  14. package/{chunk-szj85dqe.js → chunk-4yxd2kg1.js} +2 -2
  15. package/{chunk-bp61xdsc.js → chunk-59hg9a84.js} +1 -1
  16. package/{chunk-bq54argx.js → chunk-62ebm0bn.js} +1 -1
  17. package/{chunk-6d9r9p91.js → chunk-6ef085c1.js} +4 -4
  18. package/{chunk-zk91579b.js → chunk-6hx9y86d.js} +2 -2
  19. package/chunk-73t051r6.js +2 -0
  20. package/{chunk-pryvvs96.js → chunk-7mgkpn94.js} +22 -22
  21. package/{chunk-2q56egb8.js → chunk-81x8r8w4.js} +1 -1
  22. package/{chunk-rn3jwyh1.js → chunk-8np9b2y8.js} +2 -2
  23. package/{chunk-1q6e3mj7.js → chunk-9ew8cap5.js} +2 -2
  24. package/chunk-9v3b7jjv.js +2 -0
  25. package/{chunk-tjg0gcks.js → chunk-9vam83py.js} +1 -1
  26. package/{chunk-ct77cdg7.js → chunk-9xjecw6c.js} +1 -1
  27. package/{chunk-8cgz8xv7.js → chunk-b2wpj81x.js} +2 -2
  28. package/{chunk-302n9g7p.js → chunk-bjvv3403.js} +1 -1
  29. package/{chunk-tfhze1vq.js → chunk-c8g9jjqs.js} +2 -2
  30. package/{chunk-0a7ft50x.js → chunk-cs91rmbf.js} +8 -8
  31. package/{chunk-gpnqmtbk.js → chunk-edcf97ka.js} +1 -1
  32. package/{chunk-74wwdx3y.js → chunk-en7z6ne5.js} +2 -2
  33. package/{chunk-f0h2bv11.js → chunk-evnqkyt7.js} +10 -10
  34. package/{chunk-4rnmxtpx.js → chunk-ge38dhv9.js} +2 -2
  35. package/chunk-hggam3je.js +2 -0
  36. package/{chunk-mf04h0yy.js → chunk-k38jaz6c.js} +4 -4
  37. package/{chunk-jjtt9aq8.js → chunk-kcn05erf.js} +3 -3
  38. package/{chunk-y23dpz5e.js → chunk-m5km74eq.js} +2 -2
  39. package/{chunk-095adzn5.js → chunk-mfb3dgs8.js} +2 -2
  40. package/{chunk-0nedq669.js → chunk-mh4bjtfs.js} +3 -3
  41. package/{chunk-yy1f9jxc.js → chunk-nysatg77.js} +429 -312
  42. package/{chunk-bja7p3em.js → chunk-p886jr17.js} +13 -13
  43. package/{chunk-xvm0y99b.js → chunk-pdt65s31.js} +2 -2
  44. package/{chunk-ymg7mtcx.js → chunk-pjgt1bdx.js} +2 -2
  45. package/{chunk-959z9efn.js → chunk-pyj6avd5.js} +2 -2
  46. package/chunk-qd2enpr2.js +3 -0
  47. package/{chunk-tnj2kqb8.js → chunk-qe76naq9.js} +1 -1
  48. package/{chunk-z0c8ek0j.js → chunk-qjnx4fsn.js} +2 -2
  49. package/{chunk-2tf7qfbx.js → chunk-qs161f2q.js} +2 -2
  50. package/{chunk-nbjnwd54.js → chunk-rghqprav.js} +1 -1
  51. package/{chunk-7chv3knf.js → chunk-t33bm5aa.js} +1 -1
  52. package/chunk-vd5332ps.js +2 -0
  53. package/{chunk-22az84sh.js → chunk-w55cnj0f.js} +2 -2
  54. package/{chunk-4k9t9jvx.js → chunk-wnd3y4c0.js} +1 -1
  55. package/{chunk-snz19yc2.js → chunk-xafx1p7z.js} +2 -2
  56. package/{chunk-15ve3nmv.js → chunk-xf7zw32f.js} +12 -12
  57. package/chunk-xk3t5ves.js +482 -0
  58. package/{chunk-kbpbrr11.js → chunk-xq74x4gc.js} +2 -2
  59. package/{chunk-mdkfm1ak.js → chunk-y0274xr2.js} +3 -3
  60. package/{chunk-y4pvhes1.js → chunk-z9p6s986.js} +6 -6
  61. package/{chunk-41das1ty.js → chunk-zcwz44db.js} +1 -1
  62. package/{chunk-77c2cqp2.js → chunk-zhyzhekt.js} +1 -1
  63. package/compiled.js +12 -12
  64. package/package.json +1 -1
  65. package/ui-test-worker.js +51 -51
  66. package/web/chunk-15g9pnzy.js +1 -0
  67. package/web/{chunk-16jc5m0f.js → chunk-17wwzrp4.js} +1 -1
  68. package/web/chunk-19tkjg9w.js +1 -0
  69. package/web/chunk-1y387f45.js +1 -0
  70. package/web/{chunk-mykrm8ba.js → chunk-25sn840r.js} +2 -2
  71. package/web/chunk-26sp6jre.js +1 -0
  72. package/web/{chunk-wpxtkxjt.js → chunk-2c7kxr4v.js} +2 -2
  73. package/web/{chunk-et1rsgmp.js → chunk-2gsf89vs.js} +2 -2
  74. package/web/{chunk-jpem3qvs.js → chunk-2gvz70wr.js} +5 -5
  75. package/web/chunk-2s3my1jn.js +1 -0
  76. package/web/{chunk-yn4t5s9r.js → chunk-32dh0hft.js} +1 -1
  77. package/web/{chunk-5cwxhhae.js → chunk-3haw3wcw.js} +2 -2
  78. package/web/{chunk-t82sngk9.js → chunk-3rxhs9qm.js} +7 -7
  79. package/web/chunk-410qdvmv.js +1 -0
  80. package/web/chunk-4qehf2xx.js +2 -0
  81. package/web/{chunk-b9jry5a3.js → chunk-51b8n5e1.js} +1 -1
  82. package/web/{chunk-xe121vg7.js → chunk-54mgncq3.js} +1 -1
  83. package/web/{chunk-ze6azq7z.js → chunk-59g6rrew.js} +4 -4
  84. package/web/{chunk-h6k1x096.js → chunk-5d9veaef.js} +2 -2
  85. package/web/chunk-6481wt3t.js +1 -0
  86. package/web/chunk-6ehecat3.js +1 -0
  87. package/web/chunk-6m8hq6ph.js +1 -0
  88. package/web/chunk-73941p08.js +1 -0
  89. package/web/{chunk-0jbf73pr.js → chunk-783s8jds.js} +3 -3
  90. package/web/{chunk-qbmtah1x.js → chunk-78m018ya.js} +1 -1
  91. package/web/{chunk-3p9w8sg5.js → chunk-797bh7z6.js} +3 -3
  92. package/web/{chunk-1xm9x7d6.js → chunk-7hpqrfgg.js} +2 -2
  93. package/web/{chunk-zxrbbbtp.js → chunk-7kywe73f.js} +2 -2
  94. package/web/chunk-7qq1ypvj.js +1 -0
  95. package/web/{chunk-awkdw9rw.js → chunk-7wzszsf5.js} +2 -2
  96. package/web/{chunk-c57f714b.js → chunk-7zfqppsx.js} +2 -2
  97. package/web/{chunk-jh33m2mq.js → chunk-8sr9w61v.js} +3 -3
  98. package/web/{chunk-4py9sndw.js → chunk-8ttp8fh3.js} +6 -6
  99. package/web/chunk-8zg89764.js +1 -0
  100. package/web/{chunk-ct7z7bea.js → chunk-988e9wx6.js} +3 -3
  101. package/web/{chunk-vk7ch6fh.js → chunk-9h0f3gar.js} +2 -2
  102. package/web/{chunk-p6e2vr51.js → chunk-9vr6hpmk.js} +6 -6
  103. package/web/chunk-9vrp249f.js +2 -0
  104. package/web/{chunk-eqxy6535.js → chunk-a205cj09.js} +2 -2
  105. package/web/{chunk-980zhtht.js → chunk-ahn2frbt.js} +1 -1
  106. package/web/{chunk-xvm66b7v.js → chunk-aknsydan.js} +4 -4
  107. package/web/chunk-at0xtfhy.js +1 -0
  108. package/web/chunk-bahccwb9.js +1 -0
  109. package/web/{chunk-w4tfad6c.js → chunk-c7fqrs8j.js} +1 -1
  110. package/web/{chunk-zqcg6frm.js → chunk-d3hyf9yd.js} +1 -1
  111. package/web/chunk-dcegr80c.js +1 -0
  112. package/web/{chunk-v4cqc9f9.js → chunk-dwtatme7.js} +1 -1
  113. package/web/{chunk-cr04125j.js → chunk-ex8rmqn1.js} +12 -12
  114. package/web/{chunk-jh3k7xex.js → chunk-faskbfjf.js} +3 -3
  115. package/web/{chunk-zb61mf0a.js → chunk-feanedhx.js} +1 -1
  116. package/web/{chunk-xk1vkcj4.js → chunk-ffywf5w5.js} +4 -4
  117. package/web/chunk-fx3d48e6.js +1 -0
  118. package/web/{chunk-3jjksgze.js → chunk-g3szt4c4.js} +1 -1
  119. package/web/chunk-g7bcntpm.js +1 -0
  120. package/web/chunk-gr1tjqbd.js +1 -0
  121. package/web/{chunk-2sef2wft.js → chunk-hbwxtbq3.js} +2 -2
  122. package/web/{chunk-6e87m0nm.js → chunk-hdtvrh0f.js} +2 -2
  123. package/web/chunk-j031r08w.js +1 -0
  124. package/web/{chunk-5ym5ffd5.js → chunk-j6wcszxq.js} +2 -2
  125. package/web/{chunk-jccz14ye.js → chunk-jdx7qp2w.js} +2 -2
  126. package/web/chunk-jge7nn3s.js +1 -0
  127. package/web/chunk-jy8zat04.js +1 -0
  128. package/web/{chunk-0rhx7qb8.js → chunk-jzge034r.js} +1 -1
  129. package/web/{chunk-qq6m2my8.js → chunk-k4qrqmdk.js} +2 -2
  130. package/web/chunk-k8s7kye3.js +1 -0
  131. package/web/{chunk-ke8dffnk.js → chunk-k9fyqrhp.js} +2 -2
  132. package/web/chunk-k9zn1n6d.js +1 -0
  133. package/web/chunk-kg3tksv7.js +1 -0
  134. package/web/chunk-kk5rw81s.js +2 -0
  135. package/web/{chunk-y9waq403.js → chunk-kpmd893m.js} +2 -2
  136. package/web/chunk-md9j949p.js +1 -0
  137. package/web/{chunk-e57h40qa.js → chunk-mn2wv9ye.js} +2 -2
  138. package/web/{chunk-14vmr99v.js → chunk-mv7jgmnb.js} +3 -3
  139. package/web/{chunk-qq06x2ce.js → chunk-mvm68qtt.js} +2 -2
  140. package/web/chunk-nbcpbqq4.js +1 -0
  141. package/web/{chunk-6rsr2cyw.js → chunk-nfpff7yf.js} +8 -8
  142. package/web/chunk-nk7jkpam.js +1 -0
  143. package/web/chunk-nmvt1rn3.js +1 -0
  144. package/web/{chunk-3ctmehg4.js → chunk-npw1s1h2.js} +1 -1
  145. package/web/chunk-nzzxv84v.js +8 -0
  146. package/web/{chunk-a9er7a7c.js → chunk-p4pqtybm.js} +19 -19
  147. package/web/{chunk-ba9qy65y.js → chunk-p79c7aak.js} +1 -1
  148. package/web/{chunk-frnh4zqf.js → chunk-pafw34vg.js} +2 -2
  149. package/web/{chunk-ct90yf8z.js → chunk-pf65cank.js} +2 -2
  150. package/web/{chunk-g0be12na.js → chunk-ppa21760.js} +1 -1
  151. package/web/{chunk-g7hqafb8.js → chunk-ptpkv0te.js} +1 -1
  152. package/web/{chunk-ddg8rz82.js → chunk-qcdej581.js} +1 -1
  153. package/web/{chunk-xxmaqj1m.js → chunk-qftcdcps.js} +2 -2
  154. package/web/{chunk-eqndhs21.js → chunk-qv1w36ja.js} +2 -2
  155. package/web/{chunk-mnf4ngj9.js → chunk-r8p741qj.js} +2 -2
  156. package/web/chunk-rcexbkjj.js +1 -0
  157. package/web/{chunk-w28dn4dw.js → chunk-rjakb64x.js} +1 -1
  158. package/web/{chunk-k0cg4n2k.js → chunk-s0xy00v5.js} +2 -2
  159. package/web/{chunk-cr05dttm.js → chunk-s2ps0ct5.js} +1 -1
  160. package/web/{chunk-xcyqd7cn.js → chunk-s45g7fp6.js} +1 -1
  161. package/web/{chunk-h1k2kqbs.js → chunk-s70aj1v5.js} +4 -4
  162. package/web/chunk-say8bvkc.js +1 -0
  163. package/web/{chunk-qh62nkem.js → chunk-sd3cdqcm.js} +2 -2
  164. package/web/{chunk-a6g3nqp0.js → chunk-sgkevxdf.js} +2 -2
  165. package/web/chunk-sjffrcq9.js +1 -0
  166. package/web/{chunk-2y1avvqj.js → chunk-snaepr87.js} +3 -3
  167. package/web/{chunk-p7pa02k9.js → chunk-tdzh6nsz.js} +2 -2
  168. package/web/{chunk-ga07tv37.js → chunk-tjd8qp87.js} +1 -1
  169. package/web/chunk-tncc9e57.js +1 -0
  170. package/web/{chunk-ve8gy05p.js → chunk-ty2rmwda.js} +92 -92
  171. package/web/chunk-v22hp18w.js +1 -0
  172. package/web/{chunk-zh7193nq.js → chunk-ve9dz857.js} +2 -2
  173. package/web/{chunk-s935z8er.js → chunk-vg346gxc.js} +2 -2
  174. package/web/{chunk-b4gcpsbg.js → chunk-vpegzgzb.js} +5 -5
  175. package/web/{chunk-pzg25qqe.js → chunk-vvvd3grf.js} +2 -2
  176. package/web/{chunk-ss96cz1f.js → chunk-vwv6pqy7.js} +1 -1
  177. package/web/{chunk-sq75q603.js → chunk-vxm7n7w6.js} +6 -6
  178. package/web/{chunk-qb8mbptk.js → chunk-w5q7978e.js} +1 -1
  179. package/web/{chunk-97t3ngqf.js → chunk-we4mhfmq.js} +7 -7
  180. package/web/{chunk-20jxvmbw.js → chunk-wfgrdabk.js} +1 -1
  181. package/web/{chunk-3wpxymxa.js → chunk-wkhj4hsw.js} +3 -3
  182. package/web/{chunk-q4vy3dkk.js → chunk-wspk8qbg.js} +2 -2
  183. package/web/{chunk-9wz8jne3.js → chunk-xf1hnpme.js} +1 -1
  184. package/web/{chunk-fnvgdvrg.js → chunk-xhqvzmfj.js} +4 -4
  185. package/web/chunk-xq70hgre.js +1 -0
  186. package/web/chunk-xtss82z2.js +1 -0
  187. package/web/{chunk-8j4tzff5.js → chunk-y3tb6410.js} +3 -3
  188. package/web/{chunk-mkxeenph.js → chunk-y6mcxfm0.js} +1 -1
  189. package/web/{chunk-0rvwj2wh.js → chunk-ya696bfe.js} +2 -2
  190. package/web/{chunk-2x7vmhm0.js → chunk-ysw5fs45.js} +3 -3
  191. package/web/{chunk-atppv8fk.js → chunk-zkq1xknc.js} +1 -1
  192. package/web/chunk-zkv025s5.js +1 -0
  193. package/web/{chunk-dmha2y9c.js → chunk-zpzvz973.js} +18 -18
  194. package/web/{chunk-c6m4vfn5.js → chunk-zsat72qd.js} +68 -68
  195. package/web/{chunk-9k7fkx80.js → chunk-zx3h7v72.js} +1 -1
  196. package/web/index.html +1 -1
  197. package/chunk-1dbfmejf.js +0 -2
  198. package/chunk-4w9zqv0k.js +0 -2
  199. package/chunk-6f4ht2hw.js +0 -2
  200. package/chunk-edbq461k.js +0 -5
  201. package/chunk-m71pj3g1.js +0 -2
  202. package/chunk-n22vd4at.js +0 -2
  203. package/chunk-sgrrxsnz.js +0 -482
  204. package/chunk-ydzag81d.js +0 -3
  205. package/web/chunk-12qf1r6m.js +0 -1
  206. package/web/chunk-1m6fx2h7.js +0 -2
  207. package/web/chunk-2n5xbnrt.js +0 -1
  208. package/web/chunk-36s08nye.js +0 -1
  209. package/web/chunk-4swea9sn.js +0 -1
  210. package/web/chunk-4zz5a483.js +0 -1
  211. package/web/chunk-6y55gk1n.js +0 -1
  212. package/web/chunk-7aep7k4v.js +0 -1
  213. package/web/chunk-8tgavnwx.js +0 -1
  214. package/web/chunk-a00vg115.js +0 -1
  215. package/web/chunk-a4gbxnm3.js +0 -1
  216. package/web/chunk-bq6mep6p.js +0 -2
  217. package/web/chunk-bwy3e58v.js +0 -1
  218. package/web/chunk-de29pe57.js +0 -1
  219. package/web/chunk-eeesa5q1.js +0 -1
  220. package/web/chunk-f7jpakwh.js +0 -1
  221. package/web/chunk-fp62avjh.js +0 -1
  222. package/web/chunk-gr163fex.js +0 -1
  223. package/web/chunk-gx340asc.js +0 -1
  224. package/web/chunk-gxtz10wf.js +0 -1
  225. package/web/chunk-k9qnvx86.js +0 -2
  226. package/web/chunk-kcnj0gan.js +0 -1
  227. package/web/chunk-kpp5xqsb.js +0 -1
  228. package/web/chunk-m33yted6.js +0 -1
  229. package/web/chunk-me5jqqn6.js +0 -1
  230. package/web/chunk-mzqqwbmr.js +0 -1
  231. package/web/chunk-mzzaet63.js +0 -1
  232. package/web/chunk-q34as3v6.js +0 -1
  233. package/web/chunk-q6c8p73w.js +0 -1
  234. package/web/chunk-qn93we3a.js +0 -1
  235. package/web/chunk-r1f1egve.js +0 -1
  236. package/web/chunk-tt9410zw.js +0 -8
  237. package/web/chunk-vg1ebkce.js +0 -1
  238. package/web/chunk-vnt34mkb.js +0 -1
  239. package/web/chunk-xh4xn1az.js +0 -1
  240. package/web/chunk-xrk5ewsn.js +0 -1
  241. package/web/chunk-xzwxcxb4.js +0 -1
  242. package/web/chunk-ydhnkws0.js +0 -1
  243. package/web/chunk-ys2tns0p.js +0 -1
@@ -1,2 +1,2 @@
1
- function Bn(i,d){let e;if(d===void 0){for(let n of i)if(n!=null&&(e<n||e===void 0&&n>=n))e=n}else{let n=-1;for(let f of i)if((f=d(f,++n,i))!=null&&(e<f||e===void 0&&f>=f))e=f}return e}function gn(i,d){let e;if(d===void 0){for(let n of i)if(n!=null&&(e>n||e===void 0&&n>=n))e=n}else{let n=-1;for(let f of i)if((f=d(f,++n,i))!=null&&(e>f||e===void 0&&f>=f))e=f}return e}
2
- export{Bn,gn};
1
+ function zn(i,d){let e;if(d===void 0){for(let n of i)if(n!=null&&(e<n||e===void 0&&n>=n))e=n}else{let n=-1;for(let f of i)if((f=d(f,++n,i))!=null&&(e<f||e===void 0&&f>=f))e=f}return e}function yn(i,d){let e;if(d===void 0){for(let n of i)if(n!=null&&(e>n||e===void 0&&n>=n))e=n}else{let n=-1;for(let f of i)if((f=d(f,++n,i))!=null&&(e>f||e===void 0&&f>=f))e=f}return e}
2
+ export{zn,yn};
@@ -1 +1 @@
1
- import{h,o,W,i,r,m,e,n,y,rn,er,ze,Pn,Ie,mn,oe,Q,ia,Eo,oa}from"./chunk-ve8gy05p.js";function de(d){let{Button:b,confirm:L,PageLayout:x,Switch:_,cn:F,style:z}=y(),{connection:f,onOpen:O}=d,[D,p]=r([]),[w,H]=r([]),[q,J]=r([]),[I,T]=r(),[B,U]=r([]),[A,V]=r(!0),[k,N]=r(),[C,R]=r(),[G,P]=r(!1),[K,c]=r({}),s=i(0),E=h(async()=>{let t=++s.current;try{let[a,l,u,g]=await Promise.all([f.request("/api/automations"),f.request("/api/projects").catch(()=>[]),f.request("/api/info").catch(()=>{return}),f.request("/api/models").catch(()=>({models:[]}))]),te=[...new Set(a.flatMap((v)=>v.lastSessionID?[v.lastSessionID]:[]))],ne=(await Promise.all(te.map(async(v)=>f.request(`/api/sessions/${encodeURIComponent(v)}`).catch((j)=>{if(j instanceof Error&&"status"in j&&j.status===404)return;throw j})))).filter((v)=>v!==void 0);if(t!==s.current)return;if(p(a.sort((v,j)=>v.created-j.created)),H(l),J(ne),T(u),g?.models)U(g.models.map((v)=>v.id));N(void 0)}catch(a){if(t===s.current)N(a instanceof Error?a.message:"加载失败")}finally{if(t===s.current)V(!1)}},[f]);o(()=>(E(),()=>{s.current++}),[E]);let S=(t)=>{R(t),P(!0)},Y=async(t)=>{c((a)=>({...a,[t.id]:!0}));try{let a=await f.request(`/api/automations/${t.id}/run`,{method:"POST"});O(a.id)}catch(a){N(a instanceof Error?a.message:"运行失败")}finally{c((a)=>({...a,[t.id]:!1}))}},Z=async(t)=>{if(!await L({title:`删除自动化「${t.name}」?`,description:"已经跑出来的会话会保留。",action:"删除",danger:!0}))return;try{await f.request(`/api/automations/${t.id}`,{method:"DELETE"}),p((l)=>l.filter((u)=>u.id!==t.id))}catch(l){N(l instanceof Error?l.message:"删除失败")}},ee=async(t,a)=>{try{let l=await f.request(`/api/automations/${t.id}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:a})});p((u)=>u.map((g)=>g.id===t.id?l:g))}catch(l){N(l instanceof Error?l.message:"状态切换失败")}};return n(x,{title:"自动化",description:n(m,{children:["到点自动开一个新会话执行提示词,跑完的结果在会话里查看。",I?.timezone&&n("span",{className:"text-faint",children:["按服务器时区 ",I.timezone,"。"]})]}),actions:n(b,{variant:"primary",onClick:()=>S(null),children:[e(oe,{className:"size-4"}),"新建"]}),children:[k&&e("div",{className:"mb-4 rounded-lg bg-danger/10 px-3 py-2 text-xs text-danger",children:k}),A?e("div",{className:"flex justify-center py-12 text-xs text-faint",children:"正在加载自动化…"}):D.length===0?n("div",{className:z("surface.emptyDashed","animate-fade"),children:[e("div",{className:"grid size-11 place-items-center rounded-xl bg-raised text-dim",children:e(rn,{className:"size-5"})}),n("div",{children:[e("p",{className:"text-[15px] font-medium",children:"还没有自动化"}),e("p",{className:"mt-1 text-sm text-dim",children:"比如「每个工作日 9 点总结昨天的提交」。"})]}),n(b,{size:"sm",onClick:()=>S(null),className:"mt-1",children:[e(oe,{className:"size-3.5"}),"新建自动化"]})]}):e("ul",{className:"flex animate-fade flex-col gap-3",children:D.map((t)=>{let a=t.projectID?w.find((g)=>g.id===t.projectID):void 0,l=t.lastSessionID?q.find((g)=>g.id===t.lastSessionID):void 0,u=Boolean(K[t.id]);return e("li",{children:n("article",{className:z("surface.card","group p-4 transition-[border-color,box-shadow] duration-200 hover:border-line-strong hover:shadow-composer"),children:[n("div",{className:"flex items-start gap-3",children:[n("div",{className:F("min-w-0 flex-1 transition-opacity duration-200",!t.enabled&&"opacity-55"),children:[e("h2",{className:"truncate text-[15px] font-medium",children:t.name}),n("div",{className:"mt-1 flex flex-wrap items-center gap-x-3.5 gap-y-1 text-[13px] text-dim",children:[n("span",{className:"flex items-center gap-1.5 [&_svg]:size-3.5 [&_svg]:text-faint",children:[e(rn,{}),Eo(t.schedule)]}),n("span",{className:"flex items-center gap-1.5 [&_svg]:size-3.5 [&_svg]:text-faint",children:[a?e(ze,{}):e(Pn,{}),a?a.name:"聊天"]}),t.enabled&&t.nextRun!==null&&n("span",{className:"flex items-center gap-1.5 [&_svg]:size-3.5 [&_svg]:text-faint",children:[e(er,{}),"下次 ",oa(t.nextRun)]})]})]}),e(_,{checked:t.enabled,label:t.enabled?"停用":"启用",onCheckedChange:(g)=>ee(t,g),className:"mt-0.5"})]}),e("p",{className:F("mt-3 line-clamp-2 text-sm leading-6 whitespace-pre-wrap text-faint transition-opacity duration-200",!t.enabled&&"opacity-55"),children:t.prompt}),n("div",{className:"mt-3 -mb-1 flex items-center gap-1",children:[n(b,{size:"sm",onClick:()=>Y(t),disabled:u,children:[e(mn,{className:"size-3.5"}),u?"正在启动…":"立即运行"]}),n(b,{size:"sm",variant:"ghost",onClick:()=>S(t),children:[e(Ie,{className:"size-3.5"}),"编辑"]}),n(b,{size:"sm",variant:"danger-ghost",onClick:()=>Z(t),children:[e(Q,{className:"size-3.5"}),"删除"]}),e("div",{className:"flex-1"}),t.lastRun!==null&&n("button",{type:"button",disabled:!l,onClick:()=>l&&O(l.id),className:"rounded-md px-1.5 py-1 text-[13px] text-faint transition-colors enabled:hover:bg-raised enabled:hover:text-ink",children:["上次运行 ",oa(t.lastRun),l?.archivedAt!=null?" · 已归档":"",!l?" · 会话已删除":""]})]})]})},t.id)})}),C!==void 0&&e(se,{open:G,onOpenChange:P,automation:C??void 0,projects:w,models:B,timezone:I?.timezone,onSaved:(t)=>{p((a)=>{let l=a.findIndex((u)=>u.id===t.id);if(l>=0){let u=[...a];return u[l]=t,u}return[...a,t].sort((u,g)=>u.created-g.created)}),P(!1)},connection:f},C?.id??"new")]})}var M="custom",X="chat";function se(d){let{Button:b,Dialog:L,Field:x,Form:_,FormError:F,Input:z,Select:f,Textarea:O}=y(),D=W(),p=d.automation,[w,H]=r(p?.name??""),[q,J]=r(p?.prompt??""),[I,T]=r(p?.schedule??ia[0]?.cron??"0 9 * * *"),[B,U]=r(()=>!ia.some((c)=>c.cron===I)),[A,V]=r(p?.projectID??X),[k,N]=r(p?.model??""),[C,R]=r(!1),[G,P]=r();async function K(c){c.preventDefault(),R(!0),P(void 0);try{let s=A===X?void 0:A,E={name:w,prompt:q,schedule:I,model:k||void 0},S;if(p)S=await d.connection.request(`/api/automations/${p.id}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({...E,projectID:s??null})});else S=await d.connection.request("/api/automations",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...E,projectID:s})});d.onSaved(S)}catch(s){P(s instanceof Error?s.message:"保存失败")}finally{R(!1)}}return e(L,{open:d.open,onOpenChange:d.onOpenChange,title:d.automation?"编辑自动化":"新建自动化",size:"lg",footer:n(m,{children:[e("div",{className:"flex-1 max-sm:hidden"}),e(b,{onClick:()=>d.onOpenChange(!1),children:"取消"}),e(b,{type:"submit",form:D,variant:"primary",disabled:C,children:C?"正在保存…":d.automation?"保存":"创建"})]}),children:n(_,{id:D,onSubmit:K,children:[e(x,{label:"名称",children:(c)=>e(z,{id:c,autoFocus:!p,required:!0,value:w,onChange:(s)=>H(s.target.value),placeholder:"例如:每日提交总结"})}),e(x,{label:"提示词",hint:"没人盯着运行,写清楚要做什么、结果怎么汇报。",children:(c)=>e(O,{id:c,required:!0,value:q,onChange:(s)=>J(s.target.value),rows:5,placeholder:"总结昨天到现在的 git 提交,按模块分组,列出需要我关注的改动。"})}),n("div",{className:"grid gap-x-3 gap-y-4 sm:grid-cols-2",children:[e(x,{label:"时间",children:(c)=>e(f,{id:c,value:B?M:I,onValueChange:(s)=>{if(U(s===M),s!==M)T(s)},groups:[{options:ia.map((s)=>({value:s.cron,label:s.label}))},{options:[{value:M,label:"自定义(cron)"}]}]})}),e(x,{label:"在哪里运行",children:(c)=>e(f,{id:c,value:A,onValueChange:V,groups:[{options:[{value:X,label:"聊天",description:"不绑定目录",icon:e(Pn,{})}]},...d.projects.length?[{label:"项目",options:d.projects.map((s)=>({value:s.id,label:s.name,icon:e(ze,{})}))}]:[]]})})]}),B&&e(x,{label:"cron 表达式",hint:`分 时 日 月 周,例如 30 8 * * 1-5 是工作日 8:30。${d.timezone?`按 ${d.timezone} 时间。`:""}`,children:(c)=>e(z,{id:c,required:!0,value:I,onChange:(s)=>T(s.target.value),spellCheck:!1,className:"font-mono"})}),d.models.length>0&&e(x,{label:"模型",children:(c)=>e(f,{id:c,value:k||"default",onValueChange:(s)=>N(s==="default"?"":s),groups:[{options:[{value:"default",label:"默认模型"},...d.models.map((s)=>({value:s,label:s}))]}]})}),e(F,{children:G})]})})}export{de as AutomationsPage};
1
+ import{h,o,G,i,r,m,e,n,y,an,nr,ze,On,Ie,fn,oe,Q,sa,Ro,la}from"./chunk-ty2rmwda.js";function de(d){let{Button:b,confirm:L,PageLayout:x,Switch:_,cn:F,style:z}=y(),{connection:f,onOpen:O}=d,[D,p]=r([]),[w,H]=r([]),[q,J]=r([]),[I,T]=r(),[B,U]=r([]),[A,V]=r(!0),[k,N]=r(),[C,R]=r(),[W,P]=r(!1),[K,c]=r({}),s=i(0),E=h(async()=>{let t=++s.current;try{let[a,l,u,g]=await Promise.all([f.request("/api/automations"),f.request("/api/projects").catch(()=>[]),f.request("/api/info").catch(()=>{return}),f.request("/api/models").catch(()=>({models:[]}))]),te=[...new Set(a.flatMap((v)=>v.lastSessionID?[v.lastSessionID]:[]))],ne=(await Promise.all(te.map(async(v)=>f.request(`/api/sessions/${encodeURIComponent(v)}`).catch((j)=>{if(j instanceof Error&&"status"in j&&j.status===404)return;throw j})))).filter((v)=>v!==void 0);if(t!==s.current)return;if(p(a.sort((v,j)=>v.created-j.created)),H(l),J(ne),T(u),g?.models)U(g.models.map((v)=>v.id));N(void 0)}catch(a){if(t===s.current)N(a instanceof Error?a.message:"加载失败")}finally{if(t===s.current)V(!1)}},[f]);o(()=>(E(),()=>{s.current++}),[E]);let S=(t)=>{R(t),P(!0)},Y=async(t)=>{c((a)=>({...a,[t.id]:!0}));try{let a=await f.request(`/api/automations/${t.id}/run`,{method:"POST"});O(a.id)}catch(a){N(a instanceof Error?a.message:"运行失败")}finally{c((a)=>({...a,[t.id]:!1}))}},Z=async(t)=>{if(!await L({title:`删除自动化「${t.name}」?`,description:"已经跑出来的会话会保留。",action:"删除",danger:!0}))return;try{await f.request(`/api/automations/${t.id}`,{method:"DELETE"}),p((l)=>l.filter((u)=>u.id!==t.id))}catch(l){N(l instanceof Error?l.message:"删除失败")}},ee=async(t,a)=>{try{let l=await f.request(`/api/automations/${t.id}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:a})});p((u)=>u.map((g)=>g.id===t.id?l:g))}catch(l){N(l instanceof Error?l.message:"状态切换失败")}};return n(x,{title:"自动化",description:n(m,{children:["到点自动开一个新会话执行提示词,跑完的结果在会话里查看。",I?.timezone&&n("span",{className:"text-faint",children:["按服务器时区 ",I.timezone,"。"]})]}),actions:n(b,{variant:"primary",onClick:()=>S(null),children:[e(oe,{className:"size-4"}),"新建"]}),children:[k&&e("div",{className:"mb-4 rounded-lg bg-danger/10 px-3 py-2 text-xs text-danger",children:k}),A?e("div",{className:"flex justify-center py-12 text-xs text-faint",children:"正在加载自动化…"}):D.length===0?n("div",{className:z("surface.emptyDashed","animate-fade"),children:[e("div",{className:"grid size-11 place-items-center rounded-xl bg-raised text-dim",children:e(an,{className:"size-5"})}),n("div",{children:[e("p",{className:"text-[15px] font-medium",children:"还没有自动化"}),e("p",{className:"mt-1 text-sm text-dim",children:"比如「每个工作日 9 点总结昨天的提交」。"})]}),n(b,{size:"sm",onClick:()=>S(null),className:"mt-1",children:[e(oe,{className:"size-3.5"}),"新建自动化"]})]}):e("ul",{className:"flex animate-fade flex-col gap-3",children:D.map((t)=>{let a=t.projectID?w.find((g)=>g.id===t.projectID):void 0,l=t.lastSessionID?q.find((g)=>g.id===t.lastSessionID):void 0,u=Boolean(K[t.id]);return e("li",{children:n("article",{className:z("surface.card","group p-4 transition-[border-color,box-shadow] duration-200 hover:border-line-strong hover:shadow-composer"),children:[n("div",{className:"flex items-start gap-3",children:[n("div",{className:F("min-w-0 flex-1 transition-opacity duration-200",!t.enabled&&"opacity-55"),children:[e("h2",{className:"truncate text-[15px] font-medium",children:t.name}),n("div",{className:"mt-1 flex flex-wrap items-center gap-x-3.5 gap-y-1 text-[13px] text-dim",children:[n("span",{className:"flex items-center gap-1.5 [&_svg]:size-3.5 [&_svg]:text-faint",children:[e(an,{}),Ro(t.schedule)]}),n("span",{className:"flex items-center gap-1.5 [&_svg]:size-3.5 [&_svg]:text-faint",children:[a?e(ze,{}):e(On,{}),a?a.name:"聊天"]}),t.enabled&&t.nextRun!==null&&n("span",{className:"flex items-center gap-1.5 [&_svg]:size-3.5 [&_svg]:text-faint",children:[e(nr,{}),"下次 ",la(t.nextRun)]})]})]}),e(_,{checked:t.enabled,label:t.enabled?"停用":"启用",onCheckedChange:(g)=>ee(t,g),className:"mt-0.5"})]}),e("p",{className:F("mt-3 line-clamp-2 text-sm leading-6 whitespace-pre-wrap text-faint transition-opacity duration-200",!t.enabled&&"opacity-55"),children:t.prompt}),n("div",{className:"mt-3 -mb-1 flex items-center gap-1",children:[n(b,{size:"sm",onClick:()=>Y(t),disabled:u,children:[e(fn,{className:"size-3.5"}),u?"正在启动…":"立即运行"]}),n(b,{size:"sm",variant:"ghost",onClick:()=>S(t),children:[e(Ie,{className:"size-3.5"}),"编辑"]}),n(b,{size:"sm",variant:"danger-ghost",onClick:()=>Z(t),children:[e(Q,{className:"size-3.5"}),"删除"]}),e("div",{className:"flex-1"}),t.lastRun!==null&&n("button",{type:"button",disabled:!l,onClick:()=>l&&O(l.id),className:"rounded-md px-1.5 py-1 text-[13px] text-faint transition-colors enabled:hover:bg-raised enabled:hover:text-ink",children:["上次运行 ",la(t.lastRun),l?.archivedAt!=null?" · 已归档":"",!l?" · 会话已删除":""]})]})]})},t.id)})}),C!==void 0&&e(se,{open:W,onOpenChange:P,automation:C??void 0,projects:w,models:B,timezone:I?.timezone,onSaved:(t)=>{p((a)=>{let l=a.findIndex((u)=>u.id===t.id);if(l>=0){let u=[...a];return u[l]=t,u}return[...a,t].sort((u,g)=>u.created-g.created)}),P(!1)},connection:f},C?.id??"new")]})}var M="custom",X="chat";function se(d){let{Button:b,Dialog:L,Field:x,Form:_,FormError:F,Input:z,Select:f,Textarea:O}=y(),D=G(),p=d.automation,[w,H]=r(p?.name??""),[q,J]=r(p?.prompt??""),[I,T]=r(p?.schedule??sa[0]?.cron??"0 9 * * *"),[B,U]=r(()=>!sa.some((c)=>c.cron===I)),[A,V]=r(p?.projectID??X),[k,N]=r(p?.model??""),[C,R]=r(!1),[W,P]=r();async function K(c){c.preventDefault(),R(!0),P(void 0);try{let s=A===X?void 0:A,E={name:w,prompt:q,schedule:I,model:k||void 0},S;if(p)S=await d.connection.request(`/api/automations/${p.id}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({...E,projectID:s??null})});else S=await d.connection.request("/api/automations",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...E,projectID:s})});d.onSaved(S)}catch(s){P(s instanceof Error?s.message:"保存失败")}finally{R(!1)}}return e(L,{open:d.open,onOpenChange:d.onOpenChange,title:d.automation?"编辑自动化":"新建自动化",size:"lg",footer:n(m,{children:[e("div",{className:"flex-1 max-sm:hidden"}),e(b,{onClick:()=>d.onOpenChange(!1),children:"取消"}),e(b,{type:"submit",form:D,variant:"primary",disabled:C,children:C?"正在保存…":d.automation?"保存":"创建"})]}),children:n(_,{id:D,onSubmit:K,children:[e(x,{label:"名称",children:(c)=>e(z,{id:c,autoFocus:!p,required:!0,value:w,onChange:(s)=>H(s.target.value),placeholder:"例如:每日提交总结"})}),e(x,{label:"提示词",hint:"没人盯着运行,写清楚要做什么、结果怎么汇报。",children:(c)=>e(O,{id:c,required:!0,value:q,onChange:(s)=>J(s.target.value),rows:5,placeholder:"总结昨天到现在的 git 提交,按模块分组,列出需要我关注的改动。"})}),n("div",{className:"grid gap-x-3 gap-y-4 sm:grid-cols-2",children:[e(x,{label:"时间",children:(c)=>e(f,{id:c,value:B?M:I,onValueChange:(s)=>{if(U(s===M),s!==M)T(s)},groups:[{options:sa.map((s)=>({value:s.cron,label:s.label}))},{options:[{value:M,label:"自定义(cron)"}]}]})}),e(x,{label:"在哪里运行",children:(c)=>e(f,{id:c,value:A,onValueChange:V,groups:[{options:[{value:X,label:"聊天",description:"不绑定目录",icon:e(On,{})}]},...d.projects.length?[{label:"项目",options:d.projects.map((s)=>({value:s.id,label:s.name,icon:e(ze,{})}))}]:[]]})})]}),B&&e(x,{label:"cron 表达式",hint:`分 时 日 月 周,例如 30 8 * * 1-5 是工作日 8:30。${d.timezone?`按 ${d.timezone} 时间。`:""}`,children:(c)=>e(z,{id:c,required:!0,value:I,onChange:(s)=>T(s.target.value),spellCheck:!1,className:"font-mono"})}),d.models.length>0&&e(x,{label:"模型",children:(c)=>e(f,{id:c,value:k||"default",onValueChange:(s)=>N(s==="default"?"":s),groups:[{options:[{value:"default",label:"默认模型"},...d.models.map((s)=>({value:s,label:s}))]}]})}),e(F,{children:W})]})})}export{de as AutomationsPage};
@@ -1,4 +1,4 @@
1
- import{H}from"./chunk-ba9qy65y.js";import{t,a,we,N,x,F,C,S,E,T,A,L,R,V,U}from"./chunk-c6m4vfn5.js";import{J}from"./chunk-a9er7a7c.js";var ht=t(()=>({domains:new Map,transitions:[]}),"createDefaultData"),ot=ht(),St=t(()=>ot.domains,"getDomains"),Mt=t(()=>ot.transitions,"getTransitions"),zt=t((e)=>{if(!e)return;for(let n of e){let o=n.domain,r=(n.items??[]).map((l)=>({label:l.label}));ot.domains.set(o,{name:o,items:r})}},"setDomains"),Lt=t((e)=>{if(!e)return;ot.transitions=e.filter((n)=>{if(n.from===n.to)return a.warn(`Cynefin: self-loop transition on domain "${n.from}" is not meaningful and will be skipped.`),!1;return!0}).map((n)=>({from:n.from,to:n.to,label:n.label||void 0}))},"setTransitions"),Nt=t(()=>U({...N.cynefin,...x().cynefin}),"getConfig"),Pt=t(()=>{C(),ot=ht()},"clear"),it={getDomains:St,getTransitions:Mt,setDomains:zt,setTransitions:Lt,getConfig:Nt,clear:Pt,setAccTitle:S,getAccTitle:E,setDiagramTitle:L,getDiagramTitle:R,getAccDescription:A,setAccDescription:T},It=t((e)=>{H(e,it),it.setDomains(e.domains),it.setTransitions(e.transitions)},"populate"),Wt={parse:t(async(e)=>{let n=await J("cynefin",e);a.debug(n),It(n)},"parse")};function nt(e){let n=e+1831565813|0;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}t(nt,"seededRandom");function xt(e){let n=0;for(let o=0;o<e.length;o++){let r=e.charCodeAt(o);n=(n<<5)-n+r,n|=0}return n}t(xt,"hashString");function $t(e,n){if(typeof e==="number"&&Number.isFinite(e)&&e!==0)return e;return xt(n)}t($t,"resolveSeed");function bt(e,n,o,r){let l=e/2,p=r??e*0.015,at=7,Q=n/7,f=[];for(let i=0;i<=7;i++){let y=nt(o+i*17)*p*2-p;f.push({x:l+y,y:i*Q})}let M=`M${f[0].x},${f[0].y}`;for(let i=0;i<f.length-1;i++){let y=f[i],c=f[i+1],m=(y.y+c.y)/2,D=i%2===0?1:-1,h=p*1.5*D*nt(o+i*31+7),Z=y.x+h,K=m,tt=c.x-h;M+=` C${Z},${K} ${tt},${m} ${c.x},${c.y}`}return M}t(bt,"generateFoldPath");function wt(e,n,o,r){let l=n/2,p=r??n*0.015,at=7,Q=e/7,f=[];for(let i=0;i<=7;i++){let y=nt(o+i*23)*p*2-p;f.push({x:i*Q,y:l+y})}let M=`M${f[0].x},${f[0].y}`;for(let i=0;i<f.length-1;i++){let y=f[i],c=f[i+1],m=(y.x+c.x)/2,D=i%2===0?1:-1,h=p*1.5*D*nt(o+i*37+11),Z=m,K=y.y+h,tt=m,Y=c.y-h;M+=` C${Z},${K} ${tt},${Y} ${c.x},${c.y}`}return M}t(wt,"generateHorizontalBoundary");function Ct(e,n){let o=e/2,r=n*0.5,l=n,p=e*0.03;return[`M${o},${r}`,`C${o+p},${r+(l-r)*0.2}`,`${o-p*1.5},${r+(l-r)*0.55}`,`${o+p*0.5},${r+(l-r)*0.75}`,`C${o-p},${r+(l-r)*0.85}`,`${o+p*0.3},${r+(l-r)*0.95}`,`${o},${l}`].join(" ")}t(Ct,"generateCliffPath");function vt(e,n,o,r){return[`M${e-o},${n}`,`A${o},${r} 0 1,1 ${e+o},${n}`,`A${o},${r} 0 1,1 ${e-o},${n}`,"Z"].join(" ")}t(vt,"generateConfusionPath");var gt={complex:{model:"Probe → Sense → Respond",practice:"Emergent Practices"},complicated:{model:"Sense → Analyse → Respond",practice:"Good Practices"},clear:{model:"Sense → Categorise → Respond",practice:"Best Practices"},chaotic:{model:"Act → Sense → Respond",practice:"Novel Practices"},confusion:{model:"",practice:"Disorder"}},Rt=t((e,n)=>{let o=e/2,r=n/2;return{complex:{cx:o/2,cy:r/2,x:0,y:0,w:o,h:r},complicated:{cx:o+o/2,cy:r/2,x:o,y:0,w:o,h:r},chaotic:{cx:o/2,cy:r+r/2,x:0,y:r,w:o,h:r},clear:{cx:o+o/2,cy:r+r/2,x:o,y:r,w:o,h:r},confusion:{cx:o,cy:r,x:o*0.7,y:r*0.7,w:o*0.6,h:r*0.6}}},"getDomainLayouts"),Ft=t(()=>{let e=we(),n=x();return U(e,n.themeVariables).cynefin},"getCynefinDomainColors"),lt=3,Vt=t((e,n,o,r)=>{let l=r.db,p=l.getDomains(),at=l.getTransitions(),Q=l.getDiagramTitle(),f=l.getAccTitle(),M=l.getAccDescription(),i=l.getConfig(),y=Ft();a.debug("Rendering Cynefin diagram");let{width:c,height:m,padding:D,showDomainDescriptions:h,boundaryAmplitude:Z}=i,K=c+D*2,tt=m+D*2,Y={complex:y.complexBg,complicated:y.complicatedBg,clear:y.clearBg,chaotic:y.chaoticBg,confusion:y.confusionBg},z=V(n);if(F(z,tt,K,i.useMaxWidth??!0),z.attr("viewBox",`0 0 ${K} ${tt}`),f)z.append("title").text(f);if(M)z.append("desc").text(M);let P=z.append("g").attr("transform",`translate(${D}, ${D})`),et=Rt(c,m),dt=$t(i.seed,n),Dt=P.append("g").attr("class","cynefin-backgrounds"),st=["complex","complicated","chaotic","clear"];for(let d of st){let s=et[d];Dt.append("rect").attr("class","cynefinDomain").attr("x",s.x).attr("y",s.y).attr("width",s.w).attr("height",s.h).attr("fill",Y[d]).attr("fill-opacity",0.4).attr("stroke","none")}let ct=P.append("g").attr("class","cynefin-boundaries");ct.append("path").attr("class","cynefinBoundary").attr("d",bt(c,m,dt,Z)).attr("fill","none"),ct.append("path").attr("class","cynefinBoundary").attr("d",wt(c,m,dt+100,Z)).attr("fill","none"),ct.append("path").attr("class","cynefinCliff").attr("d",Ct(c,m)).attr("fill","none");let kt=c*0.15,Tt=m*0.15;P.append("path").attr("class","cynefinConfusion").attr("d",vt(c/2,m/2,kt,Tt)).attr("fill",Y.confusion).attr("fill-opacity",0.5);let ft=P.append("g").attr("class","cynefin-labels");for(let d of st){let s=et[d];ft.append("text").attr("class","cynefinDomainLabel").attr("x",s.cx).attr("y",h?s.cy-30:s.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(d.charAt(0).toUpperCase()+d.slice(1))}if(ft.append("text").attr("class","cynefinDomainLabel").attr("x",c/2).attr("y",h?m/2-10:m/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),h){let d=P.append("g").attr("class","cynefin-subtitles");for(let s of st){let g=et[s],u=gt[s];d.append("text").attr("class","cynefinSubtitle").attr("x",g.cx).attr("y",g.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(u.model),d.append("text").attr("class","cynefinSubtitle").attr("x",g.cx).attr("y",g.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(u.practice)}d.append("text").attr("class","cynefinSubtitle").attr("x",c/2).attr("y",m/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(gt.confusion.practice)}let mt=P.append("g").attr("class","cynefin-items"),I=26,pt=10,At=["complex","complicated","chaotic","clear","confusion"];for(let d of At){let s=p.get(d);if(!s||s.items.length===0)continue;let g=et[d],u=d==="confusion",O=s.items,X=0;if(u&&s.items.length>lt)X=s.items.length-lt,O=s.items.slice(0,lt);let W;if(u){let w=h?22:14;W=g.cy+w}else W=g.cy+(h?25:15);if([...O].forEach((w,_)=>{let k=W+_*(I+4),G=mt.append("g"),j=G.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",I/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(w.label),v=w.label.length*7,b=j.node();if(b&&typeof b.getBBox==="function"){let rt=b.getBBox();if(rt.width>0)v=rt.width}let B=v+pt*2,q=g.cx-B/2;G.attr("transform",`translate(${q}, ${k})`),G.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",B).attr("height",I).attr("rx",4).attr("ry",4).attr("fill",Y[d]).attr("fill-opacity",0.95),j.attr("x",B/2).attr("y",I/2)}),X>0){let w=W+O.length*(I+4),_=`+${X} more`,k=mt.append("g"),G=k.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",I/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(_),j=_.length*7,v=G.node();if(v&&typeof v.getBBox==="function"){let q=v.getBBox();if(q.width>0)j=q.width}let b=j+pt*2,B=g.cx-b/2;k.attr("transform",`translate(${B}, ${w})`),k.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",b).attr("height",I).attr("rx",4).attr("ry",4).attr("fill",Y[d]).attr("fill-opacity",0.6),G.attr("x",b/2).attr("y",I/2)}}if(at.length>0){let d=z.select("defs").empty()?z.append("defs"):z.select("defs"),s=`cynefin-arrow-${n}`;d.append("marker").attr("id",s).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");let g=P.append("g").attr("class","cynefin-arrows");at.forEach((u)=>{let O=et[u.from],X=et[u.to];if(!O||!X)return;if(u.from===u.to){a.warn(`Cynefin renderer: skipping self-loop on domain "${u.from}"`);return}let{cx:W,cy:w}=O,{cx:_,cy:k}=X,G=(W+_)/2,j=(w+k)/2,v=_-W,b=k-w,B=Math.sqrt(v*v+b*b),q=B*0.15,rt=-b/B,Bt=v/B,yt=G+rt*q,ut=j+Bt*q;if(g.append("path").attr("class","cynefinArrowLine").attr("d",`M${W},${w} Q${yt},${ut} ${_},${k}`).attr("fill","none").attr("marker-end",`url(#${s})`),u.label)g.append("text").attr("class","cynefinArrowLabel").attr("x",yt).attr("y",ut-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(u.label)})}if(Q)P.append("text").attr("class","cynefinTitle").attr("x",c/2).attr("y",-D/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(Q)},"draw"),_t={draw:Vt},Et=t(()=>{let e=we(),n=x();return U(e,n.themeVariables).cynefin},"getCynefinTheme"),Ht=t(()=>{let e=Et();return`
1
+ import{H}from"./chunk-p79c7aak.js";import{t,a,we,N,x,F,C,S,E,T,A,L,R,V,j}from"./chunk-zsat72qd.js";import{J}from"./chunk-p4pqtybm.js";var ht=t(()=>({domains:new Map,transitions:[]}),"createDefaultData"),ot=ht(),St=t(()=>ot.domains,"getDomains"),Mt=t(()=>ot.transitions,"getTransitions"),zt=t((e)=>{if(!e)return;for(let n of e){let o=n.domain,r=(n.items??[]).map((l)=>({label:l.label}));ot.domains.set(o,{name:o,items:r})}},"setDomains"),Lt=t((e)=>{if(!e)return;ot.transitions=e.filter((n)=>{if(n.from===n.to)return a.warn(`Cynefin: self-loop transition on domain "${n.from}" is not meaningful and will be skipped.`),!1;return!0}).map((n)=>({from:n.from,to:n.to,label:n.label||void 0}))},"setTransitions"),Nt=t(()=>j({...N.cynefin,...x().cynefin}),"getConfig"),Pt=t(()=>{C(),ot=ht()},"clear"),it={getDomains:St,getTransitions:Mt,setDomains:zt,setTransitions:Lt,getConfig:Nt,clear:Pt,setAccTitle:S,getAccTitle:E,setDiagramTitle:L,getDiagramTitle:R,getAccDescription:A,setAccDescription:T},It=t((e)=>{H(e,it),it.setDomains(e.domains),it.setTransitions(e.transitions)},"populate"),Wt={parse:t(async(e)=>{let n=await J("cynefin",e);a.debug(n),It(n)},"parse")};function nt(e){let n=e+1831565813|0;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}t(nt,"seededRandom");function xt(e){let n=0;for(let o=0;o<e.length;o++){let r=e.charCodeAt(o);n=(n<<5)-n+r,n|=0}return n}t(xt,"hashString");function $t(e,n){if(typeof e==="number"&&Number.isFinite(e)&&e!==0)return e;return xt(n)}t($t,"resolveSeed");function bt(e,n,o,r){let l=e/2,p=r??e*0.015,at=7,Q=n/7,f=[];for(let i=0;i<=7;i++){let y=nt(o+i*17)*p*2-p;f.push({x:l+y,y:i*Q})}let M=`M${f[0].x},${f[0].y}`;for(let i=0;i<f.length-1;i++){let y=f[i],c=f[i+1],m=(y.y+c.y)/2,D=i%2===0?1:-1,h=p*1.5*D*nt(o+i*31+7),Z=y.x+h,K=m,tt=c.x-h;M+=` C${Z},${K} ${tt},${m} ${c.x},${c.y}`}return M}t(bt,"generateFoldPath");function wt(e,n,o,r){let l=n/2,p=r??n*0.015,at=7,Q=e/7,f=[];for(let i=0;i<=7;i++){let y=nt(o+i*23)*p*2-p;f.push({x:i*Q,y:l+y})}let M=`M${f[0].x},${f[0].y}`;for(let i=0;i<f.length-1;i++){let y=f[i],c=f[i+1],m=(y.x+c.x)/2,D=i%2===0?1:-1,h=p*1.5*D*nt(o+i*37+11),Z=m,K=y.y+h,tt=m,Y=c.y-h;M+=` C${Z},${K} ${tt},${Y} ${c.x},${c.y}`}return M}t(wt,"generateHorizontalBoundary");function Ct(e,n){let o=e/2,r=n*0.5,l=n,p=e*0.03;return[`M${o},${r}`,`C${o+p},${r+(l-r)*0.2}`,`${o-p*1.5},${r+(l-r)*0.55}`,`${o+p*0.5},${r+(l-r)*0.75}`,`C${o-p},${r+(l-r)*0.85}`,`${o+p*0.3},${r+(l-r)*0.95}`,`${o},${l}`].join(" ")}t(Ct,"generateCliffPath");function vt(e,n,o,r){return[`M${e-o},${n}`,`A${o},${r} 0 1,1 ${e+o},${n}`,`A${o},${r} 0 1,1 ${e-o},${n}`,"Z"].join(" ")}t(vt,"generateConfusionPath");var gt={complex:{model:"Probe → Sense → Respond",practice:"Emergent Practices"},complicated:{model:"Sense → Analyse → Respond",practice:"Good Practices"},clear:{model:"Sense → Categorise → Respond",practice:"Best Practices"},chaotic:{model:"Act → Sense → Respond",practice:"Novel Practices"},confusion:{model:"",practice:"Disorder"}},Rt=t((e,n)=>{let o=e/2,r=n/2;return{complex:{cx:o/2,cy:r/2,x:0,y:0,w:o,h:r},complicated:{cx:o+o/2,cy:r/2,x:o,y:0,w:o,h:r},chaotic:{cx:o/2,cy:r+r/2,x:0,y:r,w:o,h:r},clear:{cx:o+o/2,cy:r+r/2,x:o,y:r,w:o,h:r},confusion:{cx:o,cy:r,x:o*0.7,y:r*0.7,w:o*0.6,h:r*0.6}}},"getDomainLayouts"),Ft=t(()=>{let e=we(),n=x();return j(e,n.themeVariables).cynefin},"getCynefinDomainColors"),lt=3,Vt=t((e,n,o,r)=>{let l=r.db,p=l.getDomains(),at=l.getTransitions(),Q=l.getDiagramTitle(),f=l.getAccTitle(),M=l.getAccDescription(),i=l.getConfig(),y=Ft();a.debug("Rendering Cynefin diagram");let{width:c,height:m,padding:D,showDomainDescriptions:h,boundaryAmplitude:Z}=i,K=c+D*2,tt=m+D*2,Y={complex:y.complexBg,complicated:y.complicatedBg,clear:y.clearBg,chaotic:y.chaoticBg,confusion:y.confusionBg},z=V(n);if(F(z,tt,K,i.useMaxWidth??!0),z.attr("viewBox",`0 0 ${K} ${tt}`),f)z.append("title").text(f);if(M)z.append("desc").text(M);let P=z.append("g").attr("transform",`translate(${D}, ${D})`),et=Rt(c,m),dt=$t(i.seed,n),Dt=P.append("g").attr("class","cynefin-backgrounds"),st=["complex","complicated","chaotic","clear"];for(let d of st){let s=et[d];Dt.append("rect").attr("class","cynefinDomain").attr("x",s.x).attr("y",s.y).attr("width",s.w).attr("height",s.h).attr("fill",Y[d]).attr("fill-opacity",0.4).attr("stroke","none")}let ct=P.append("g").attr("class","cynefin-boundaries");ct.append("path").attr("class","cynefinBoundary").attr("d",bt(c,m,dt,Z)).attr("fill","none"),ct.append("path").attr("class","cynefinBoundary").attr("d",wt(c,m,dt+100,Z)).attr("fill","none"),ct.append("path").attr("class","cynefinCliff").attr("d",Ct(c,m)).attr("fill","none");let kt=c*0.15,Tt=m*0.15;P.append("path").attr("class","cynefinConfusion").attr("d",vt(c/2,m/2,kt,Tt)).attr("fill",Y.confusion).attr("fill-opacity",0.5);let ft=P.append("g").attr("class","cynefin-labels");for(let d of st){let s=et[d];ft.append("text").attr("class","cynefinDomainLabel").attr("x",s.cx).attr("y",h?s.cy-30:s.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(d.charAt(0).toUpperCase()+d.slice(1))}if(ft.append("text").attr("class","cynefinDomainLabel").attr("x",c/2).attr("y",h?m/2-10:m/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),h){let d=P.append("g").attr("class","cynefin-subtitles");for(let s of st){let g=et[s],u=gt[s];d.append("text").attr("class","cynefinSubtitle").attr("x",g.cx).attr("y",g.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(u.model),d.append("text").attr("class","cynefinSubtitle").attr("x",g.cx).attr("y",g.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(u.practice)}d.append("text").attr("class","cynefinSubtitle").attr("x",c/2).attr("y",m/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(gt.confusion.practice)}let mt=P.append("g").attr("class","cynefin-items"),I=26,pt=10,At=["complex","complicated","chaotic","clear","confusion"];for(let d of At){let s=p.get(d);if(!s||s.items.length===0)continue;let g=et[d],u=d==="confusion",O=s.items,X=0;if(u&&s.items.length>lt)X=s.items.length-lt,O=s.items.slice(0,lt);let W;if(u){let w=h?22:14;W=g.cy+w}else W=g.cy+(h?25:15);if([...O].forEach((w,_)=>{let k=W+_*(I+4),G=mt.append("g"),q=G.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",I/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(w.label),v=w.label.length*7,b=q.node();if(b&&typeof b.getBBox==="function"){let rt=b.getBBox();if(rt.width>0)v=rt.width}let B=v+pt*2,U=g.cx-B/2;G.attr("transform",`translate(${U}, ${k})`),G.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",B).attr("height",I).attr("rx",4).attr("ry",4).attr("fill",Y[d]).attr("fill-opacity",0.95),q.attr("x",B/2).attr("y",I/2)}),X>0){let w=W+O.length*(I+4),_=`+${X} more`,k=mt.append("g"),G=k.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",I/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(_),q=_.length*7,v=G.node();if(v&&typeof v.getBBox==="function"){let U=v.getBBox();if(U.width>0)q=U.width}let b=q+pt*2,B=g.cx-b/2;k.attr("transform",`translate(${B}, ${w})`),k.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",b).attr("height",I).attr("rx",4).attr("ry",4).attr("fill",Y[d]).attr("fill-opacity",0.6),G.attr("x",b/2).attr("y",I/2)}}if(at.length>0){let d=z.select("defs").empty()?z.append("defs"):z.select("defs"),s=`cynefin-arrow-${n}`;d.append("marker").attr("id",s).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");let g=P.append("g").attr("class","cynefin-arrows");at.forEach((u)=>{let O=et[u.from],X=et[u.to];if(!O||!X)return;if(u.from===u.to){a.warn(`Cynefin renderer: skipping self-loop on domain "${u.from}"`);return}let{cx:W,cy:w}=O,{cx:_,cy:k}=X,G=(W+_)/2,q=(w+k)/2,v=_-W,b=k-w,B=Math.sqrt(v*v+b*b),U=B*0.15,rt=-b/B,Bt=v/B,yt=G+rt*U,ut=q+Bt*U;if(g.append("path").attr("class","cynefinArrowLine").attr("d",`M${W},${w} Q${yt},${ut} ${_},${k}`).attr("fill","none").attr("marker-end",`url(#${s})`),u.label)g.append("text").attr("class","cynefinArrowLabel").attr("x",yt).attr("y",ut-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(u.label)})}if(Q)P.append("text").attr("class","cynefinTitle").attr("x",c/2).attr("y",-D/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(Q)},"draw"),_t={draw:Vt},Et=t(()=>{let e=we(),n=x();return j(e,n.themeVariables).cynefin},"getCynefinTheme"),Ht=t(()=>{let e=Et();return`
2
2
  .cynefinDomain {
3
3
  stroke: none;
4
4
  }
@@ -1,4 +1,4 @@
1
- import{h,o,v,i,r,m,e,n,y,st}from"./chunk-ve8gy05p.js";var V="__chat__";function M(t){if(!Number.isFinite(t)||t<=0)return"0";if(t<1000)return Math.round(t).toString();if(t<1e6)return`${(t/1000).toFixed(1)}K`;if(t<1e9)return`${(t/1e6).toFixed(2)}M`;return`${(t/1e9).toFixed(2)}B`}function L(t){let u=Number.isFinite(t)?Math.max(0,t):0;return Math.round(u).toLocaleString("en-US")}function P(t){if(!Number.isFinite(t)||t<=0)return"0s";if(t<1000)return"<1s";if(t<60000)return`${Math.floor(t/1000)}s`;if(t<3600000){let c=Math.floor(t/1000),a=Math.floor(c/60),f=c%60;return f>0?`${a}m ${f}s`:`${a}m`}if(t<259200000){let c=Math.floor(t/60000),a=Math.floor(c/60),f=c%60;return f>0?`${a}h ${f}m`:`${a}h`}let u=Math.floor(t/3600000),g=Math.floor(u/24),p=u%24;return p>0?`${g}d ${p}h`:`${g}d`}function ae(t){if(!Number.isFinite(t)||t<=0)return"0s";if(t<1000)return"<1s";if(t<60000)return`${Math.round(t/1000)}s`;if(t<3600000)return`${Math.round(t/60000)}m`;if(t<86400000){let p=t/3600000;return`${p>=10?Math.round(p).toString():p.toFixed(1).replace(/\.0$/,"")}h`}let u=t/86400000;return`${u>=10?Math.round(u).toString():u.toFixed(1).replace(/\.0$/,"")}d`}function B(t,u=1){if(!Number.isFinite(t)||t<=0)return"0%";let g=10**-u/100;if(t<g)return`<${(g*100).toFixed(u)}%`;return`${(t*100).toFixed(u)}%`}function Q(t){if(!Number.isFinite(t)||t<=0)return"0 B";if(t<1024)return`${Math.round(t)} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;if(t<1073741824)return`${(t/1048576).toFixed(2)} MB`;return`${(t/1073741824).toFixed(2)} GB`}function W(t){let u=t.split("-"),g=u[1],p=u[2];if(g!==void 0&&p!==void 0)return`${g}/${p}`;return t}function Z(t){let u=t.split("-"),g=u[0],p=u[1],c=u[2];if(g===void 0||p===void 0||c===void 0)return t;let a=Number(g),f=Number(p)-1,b=Number(c),w=new Date(Date.UTC(a,f,b)),C=["周日","周一","周二","周三","周四","周五","周六"],D=w.getUTCDay(),F=C[D]??"";return`${t} ${F}`}function se(t,u=Date.now()){if(t===null||t===void 0||!Number.isFinite(t)||t<=0)return"从未";let g=Math.max(0,u-t);if(g<60000)return"刚刚";if(g<3600000)return`${Math.max(1,Math.floor(g/60000))} 分钟前`;if(g<86400000)return`${Math.max(1,Math.floor(g/3600000))} 小时前`;if(g<2592000000)return`${Math.max(1,Math.floor(g/86400000))} 天前`;let p=new Date(t),c=p.getFullYear(),a=String(p.getMonth()+1).padStart(2,"0"),f=String(p.getDate()).padStart(2,"0");return`${c}-${a}-${f}`}function K(t){return e("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-raised",children:e("div",{className:"h-full rounded-full bg-accent transition-all duration-300",style:{width:`${t.percent}%`}})})}function Y(t){return e("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:t.children})}function G(t){return e("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:t.children})}function J(t){return n(G,{children:[n("span",{children:["输入 ",e("span",{className:"text-ink",children:M(t.stat.inputTokens)})]}),n("span",{children:["输出 ",e("span",{className:"text-ink",children:M(t.stat.outputTokens)})]}),n("span",{children:["缓存读 ",e("span",{className:"text-ink",children:M(t.stat.cacheReadTokens)}),t.cacheHitRate!==void 0&&n("span",{className:"text-faint",children:[" (",B(t.cacheHitRate),")"]})]})]})}function oe(t){let{projects:u,selectedProjectID:g,onSelectProject:p}=t,{style:c}=y();if(u.length===0)return e("div",{className:c("surface.empty"),children:"暂无项目统计数据"});return e("div",{className:"divide-y divide-line",children:u.map((a)=>{let f=a.projectID??V,b=g===f,w=Math.max(a.tokenShare>0?1:0,a.tokenShare*100);return n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[e("span",{className:"font-medium text-sm text-ink truncate",children:a.name}),e("span",{className:c("control.badge","font-mono truncate max-w-[240px]"),title:a.directory||"未绑定项目目录",children:a.directory||"独立会话"}),e("button",{type:"button",onClick:()=>p(b?null:f),className:"rounded px-1.5 py-0.5 text-[11px] text-accent hover:bg-accent/10 transition-colors cursor-pointer shrink-0",children:b?"取消筛选":"筛选"})]}),n("div",{className:"flex items-baseline gap-1.5 font-mono tabular-nums shrink-0",children:[e("span",{className:"text-xs font-medium text-ink",title:L(a.totalTokens),children:M(a.totalTokens)}),n("span",{className:"text-[11px] text-faint",children:["(",B(a.tokenShare),")"]})]})]}),e(K,{percent:w}),n(Y,{children:[e(J,{stat:a,cacheHitRate:a.cacheHitRate}),n(G,{children:[n("span",{children:["耗时 ",e("span",{className:"text-ink",children:P(a.activeDurationMs)})]}),n("span",{children:[e("span",{className:"text-ink",children:a.sessionCount.toLocaleString()})," 会话"]}),n("span",{children:["工具 ",e("span",{className:"text-ink",children:a.toolCalls.toLocaleString()})," 次"]})]})]})]},f)})})}function re(t){let{models:u}=t,{ModelIcon:g,style:p}=y();if(u.length===0)return e("div",{className:p("surface.empty"),children:"暂无模型调用数据"});return e("div",{className:"divide-y divide-line",children:u.map((c)=>{let a=Math.max(c.share>0?1:0,c.share*100);return n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[e(g,{modelID:c.model,className:"size-4 shrink-0"}),e("span",{className:"font-mono text-sm font-medium text-ink truncate",children:c.shortName}),e("span",{className:p("control.badge","font-mono shrink-0"),children:c.provider})]}),n("div",{className:"flex items-baseline gap-2.5 font-mono tabular-nums shrink-0",children:[c.avgTps!==null&&n("span",{className:"text-[11px] text-dim",children:[c.avgTps.toFixed(1)," tok/s"]}),n("span",{className:"text-xs font-medium text-ink",title:L(c.totalTokens),children:[M(c.totalTokens)," ",n("span",{className:"text-[11px] font-normal text-faint",children:["(",B(c.share),")"]})]})]})]}),e(K,{percent:a}),n(Y,{children:[e(J,{stat:c,cacheHitRate:c.cacheHitRate}),n(G,{children:[n("span",{children:[e("span",{className:"text-ink",children:c.turns.toLocaleString()})," 轮",c.errors>0?n("span",{className:"text-danger",children:[" (",c.errors," 错)"]}):null]}),n("span",{children:["工具 ",e("span",{className:"text-ink",children:c.toolCalls.toLocaleString()})," 次"]}),c.generationMs>0&&n("span",{children:["推理 ",e("span",{className:"text-ink",children:ae(c.generationMs)})]})]})]})]},c.model)})})}function ie(t){let{tools:u}=t,{StatusChip:g,style:p}=y();if(u.length===0)return e("div",{className:p("surface.empty"),children:"暂无工具调用数据"});return e("div",{className:"divide-y divide-line",children:u.map((c)=>{let a=Math.max(c.share>0?1:0,c.share*100),f=c.successRate>=0.95?"success":c.successRate>=0.8?"warning":"danger",b=Math.max(0,c.calls-c.errors),w=c.calls>0?Math.round(c.outputBytes/c.calls):0;return n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[e("span",{className:"font-mono text-sm font-medium text-ink truncate",children:c.name}),n(g,{tone:f,children:["成功率 ",B(c.successRate)]})]}),n("div",{className:"flex items-baseline gap-1.5 font-mono tabular-nums shrink-0",children:[n("span",{className:"text-xs font-medium text-ink",children:[c.calls.toLocaleString()," 次"]}),n("span",{className:"text-[11px] text-faint",children:["(",B(c.share),")"]})]})]}),e(K,{percent:a}),n(Y,{children:[n(G,{children:[n("span",{children:["成功 ",e("span",{className:"text-ink",children:b.toLocaleString()})," 次"]}),n("span",{children:["失败 ",e("span",{className:c.errors>0?"text-danger":"text-ink",children:c.errors.toLocaleString()})," 次"]})]}),n(G,{children:[n("span",{children:["累计输出 ",e("span",{className:"text-ink",children:Q(c.outputBytes)})]}),n("span",{children:["单次均值 ",e("span",{className:"text-ink",children:Q(w)})]})]})]})]},c.name)})})}function le(t){let{sessions:u,onOpenSession:g}=t,{style:p}=y();if(u.length===0)return e("div",{className:p("surface.empty"),children:"暂无高消耗会话记录"});let c=Math.max(1,...u.map((a)=>a.totalTokens));return e("div",{className:"divide-y divide-line",children:u.map((a)=>{let f=c>0?Math.max(1,a.totalTokens/c*100):0,b=a.model.split("/").pop()??a.model;return n("button",{type:"button",onClick:()=>g(a.id),className:"group block w-full p-4 text-left space-y-2.5 hover:bg-raised/40 transition-colors cursor-pointer",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[e("span",{className:"font-medium text-sm text-ink truncate group-hover:text-accent transition-colors",children:a.title.trim()||"新会话"}),e("span",{className:p("control.badge","font-mono truncate max-w-[140px] shrink-0"),title:a.projectName,children:a.projectName}),a.kind==="sub"&&e("span",{className:"rounded bg-accent/15 px-1.5 py-0.5 text-[10.5px] text-accent shrink-0",children:"子代理"}),a.archivedAt!==null&&e("span",{className:p("control.badge","shrink-0"),children:"已归档"})]}),n("div",{className:"flex items-center gap-1.5 font-mono tabular-nums shrink-0",children:[e("span",{className:"text-xs font-medium text-ink",title:L(a.totalTokens),children:M(a.totalTokens)}),e(st,{className:"size-3.5 text-faint group-hover:text-ink group-hover:translate-x-0.5 transition-all"})]})]}),e(K,{percent:f}),n(Y,{children:[e(J,{stat:a}),n(G,{children:[e("span",{className:"text-ink",children:b}),n("span",{children:["耗时 ",e("span",{className:"text-ink",children:P(a.activeDurationMs)})]}),n("span",{children:[e("span",{className:"text-ink",children:a.assistantTurns})," 轮"]}),e("span",{className:"text-faint",children:se(a.updated)})]})]})]},a.id)})})}var ce=[{value:"tokens",label:"Token 用量"},{value:"duration",label:"活跃耗时"},{value:"activity",label:"交互轮次"}];function ue(t){let{cn:u,Segmented:g,SettingGroup:p,style:c}=y(),{daily:a}=t,[f,b]=r("tokens"),[w,C]=r(null),D=v(()=>a.some((s)=>s.totalTokens>0||s.activeDurationMs>0||s.runs>0),[a]),F=v(()=>{if(a.length===0)return{totalText:"0",avgText:"0",peakDate:"—",peakValueText:"0"};if(f==="tokens"){let S=a.reduce((_,A)=>_+A.totalTokens,0),R=a.filter((_)=>_.totalTokens>0).length,N=a[0];for(let _ of a)if(!N||_.totalTokens>N.totalTokens)N=_;return{totalText:M(S),totalFullText:L(S),avgText:R>0?M(Math.round(S/R)):"0",peakDate:N&&N.totalTokens>0?W(N.date):"—",peakValueText:N&&N.totalTokens>0?M(N.totalTokens):"0"}}if(f==="duration"){let S=a.reduce((_,A)=>_+A.activeDurationMs,0),R=a.filter((_)=>_.activeDurationMs>0).length,N=a[0];for(let _ of a)if(!N||_.activeDurationMs>N.activeDurationMs)N=_;return{totalText:P(S),totalFullText:P(S),avgText:R>0?P(Math.round(S/R)):"0s",peakDate:N&&N.activeDurationMs>0?W(N.date):"—",peakValueText:N&&N.activeDurationMs>0?P(N.activeDurationMs):"0s"}}let s=a.reduce((S,R)=>S+R.assistantTurns,0),l=a.reduce((S,R)=>S+R.userMessages,0),x=s+l,T=a.filter((S)=>S.assistantTurns>0||S.userMessages>0).length,k=a[0];for(let S of a){let R=k?k.assistantTurns+k.userMessages:0;if(!k||S.assistantTurns+S.userMessages>R)k=S}let H=k?k.assistantTurns+k.userMessages:0;return{totalText:`${x.toLocaleString()} 轮`,totalFullText:`助手 ${s.toLocaleString()} 轮 · 用户 ${l.toLocaleString()} 问`,avgText:T>0?`${(x/T).toFixed(1)} 轮/天`:"0 轮/天",peakDate:k&&H>0?W(k.date):"—",peakValueText:k&&H>0?`${H.toLocaleString()} 轮`:"0 轮"}},[a,f]),j=v(()=>{if(w){let s=a.find((l)=>l.date===w);if(s)return s}for(let s=a.length-1;s>=0;s--){let l=a[s];if(l&&(l.totalTokens>0||l.activeDurationMs>0||l.runs>0))return l}return a[a.length-1]},[a,w]),z=v(()=>{if(f==="tokens")return Math.max(1,...a.map((s)=>s.totalTokens));if(f==="duration")return Math.max(1000,...a.map((s)=>s.activeDurationMs));return Math.max(1,...a.map((s)=>s.assistantTurns+s.userMessages))},[a,f]),d=v(()=>{if(a.length<=7)return a.map((x)=>x.date);let s=6,l=[];for(let x=0;x<s;x++){let T=Math.round(x*(a.length-1)/(s-1)),k=a[T];if(k)l.push(k.date)}return l},[a]);if(!D)return e(p,{title:"每日趋势",action:e(g,{value:f,onChange:(s)=>b(s),options:ce}),children:e("div",{className:c("surface.empty"),children:"当前时间范围内暂无活跃数据"})});return e(p,{title:"每日趋势",action:e(g,{value:f,onChange:(s)=>b(s),options:ce}),children:n("div",{className:"p-4 space-y-4",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex flex-wrap items-center gap-x-3.5 gap-y-1 font-mono text-dim tabular-nums",children:[n("span",{children:["汇总 ",e("span",{className:"text-ink",children:F.totalText})]}),n("span",{children:["日均 ",e("span",{className:"text-ink",children:F.avgText})]}),n("span",{children:["峰值 ",e("span",{className:"text-ink",children:F.peakValueText}),F.peakDate!=="—"?n("span",{className:"text-faint",children:[" (",F.peakDate,")"]}):null]})]}),n("div",{className:"flex items-center gap-3 text-[11px] text-dim",children:[f==="tokens"&&n(m,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent/40"}),"缓存读"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent"}),"输入"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-success"}),"输出"]})]}),f==="duration"&&n(m,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent"}),"工作调度"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-success"}),"模型推理"]})]}),f==="activity"&&n(m,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent"}),"助手回复"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-success"}),"用户提问"]})]})]})]}),n("div",{className:"relative h-44 w-full pt-1",children:[n("div",{className:"absolute inset-0 flex flex-col justify-between pointer-events-none pb-5 text-[10px] text-faint/60",children:[e("div",{className:"border-b border-line/40 w-full"}),e("div",{className:"border-b border-line/30 w-full"}),e("div",{className:"border-b border-line/40 w-full"})]}),n("section",{"aria-label":"每日趋势柱状序列",className:"relative h-full flex flex-col justify-between",onMouseLeave:()=>C(null),children:[e("div",{className:"flex-1 flex items-end gap-1 sm:gap-1.5 pb-2",children:a.map((s)=>{let l=s.totalTokens;if(f==="duration")l=s.activeDurationMs;else if(f==="activity")l=s.assistantTurns+s.userMessages;let x=l<=0,T=x?0:Math.max(3,Math.min(100,l/z*100)),k=j?.date===s.date;return n("button",{type:"button","aria-label":`${s.date} 统计数据`,className:"flex-1 h-full flex flex-col justify-end items-center group cursor-pointer relative min-w-0 bg-transparent p-0 border-0 focus:outline-hidden",onMouseEnter:()=>C(s.date),onFocus:()=>C(s.date),onClick:()=>C(s.date),children:[e("div",{className:u("absolute inset-y-0 w-full rounded-xs transition-colors pointer-events-none",k?"bg-accent/10":"group-hover:bg-raised/60")}),x?e("div",{className:"h-1 w-full max-w-[24px] rounded-full bg-raised group-hover:bg-dim/30"}):n("div",{className:"w-full max-w-[24px] rounded-t-xs overflow-hidden flex flex-col justify-end transition-all duration-150",style:{height:`${T}%`},children:[f==="tokens"&&n(m,{children:[s.outputTokens>0&&e("div",{className:"bg-success transition-all duration-200",style:{height:`${s.outputTokens/s.totalTokens*100}%`}}),s.inputTokens+s.cacheWriteTokens>0&&e("div",{className:"bg-accent transition-all duration-200",style:{height:`${(s.inputTokens+s.cacheWriteTokens)/s.totalTokens*100}%`}}),s.cacheReadTokens>0&&e("div",{className:"bg-accent/40 transition-all duration-200",style:{height:`${s.cacheReadTokens/s.totalTokens*100}%`}})]}),f==="duration"&&n(m,{children:[s.generationMs>0&&e("div",{className:"bg-success transition-all duration-200",style:{height:`${Math.min(100,s.generationMs/Math.max(1,s.activeDurationMs)*100)}%`}}),e("div",{className:"bg-accent flex-1 transition-all duration-200"})]}),f==="activity"&&n(m,{children:[s.userMessages>0&&e("div",{className:"bg-success transition-all duration-200",style:{height:`${s.userMessages/Math.max(1,s.assistantTurns+s.userMessages)*100}%`}}),e("div",{className:"bg-accent flex-1 transition-all duration-200"})]})]}),k&&e("div",{className:"absolute -bottom-1 size-1 rounded-full bg-accent"})]},s.date)})}),e("div",{className:u("flex items-center pt-1.5 text-[10px] text-faint font-mono tabular-nums",a.length<=7?"gap-1 sm:gap-1.5":"justify-between"),children:d.map((s)=>e("div",{className:u("whitespace-nowrap",a.length<=7&&"flex-1 text-center"),children:W(s)},s))})]})]}),e("div",{className:"flex flex-wrap items-center justify-between gap-2 border-t border-line pt-3 font-mono text-xs tabular-nums",children:j?n(m,{children:[e("span",{className:"text-ink",children:Z(j.date)}),n("div",{className:"flex flex-wrap items-center gap-x-3.5 gap-y-1 text-dim",children:[n("span",{children:["Token ",e("span",{className:"text-ink",children:M(j.totalTokens)})]}),n("span",{children:["耗时 ",e("span",{className:"text-ink",children:P(j.activeDurationMs)})]}),n("span",{children:["交互 ",n("span",{className:"text-ink",children:[j.assistantTurns+j.userMessages," 轮"]})]}),n("span",{children:["工具 ",n("span",{className:"text-ink",children:[j.toolCalls," 次"]})]})]})]}):e("span",{className:"font-sans text-faint",children:"悬停柱状图查看单日明细"})})]})})}function pe(t){let{cn:u,SettingGroup:g}=y(),{daily:p,hourly:c}=t,[a,f]=r(null),b=v(()=>{let l=new Map;for(let T of c)l.set(T.hour,T);let x=[];for(let T=0;T<24;T++){let k=l.get(T);if(k)x.push(k);else x.push({hour:T,totalTokens:0,activeDurationMs:0,userMessages:0,assistantTurns:0,runs:0})}return x},[c]),w=v(()=>{let l=b[0];for(let x of b)if(!l||x.totalTokens>l.totalTokens)l=x;return l&&l.totalTokens>0?l:null},[b]),C=v(()=>b.reduce((l,x)=>l+x.totalTokens,0),[b]),D=v(()=>Math.max(1,...b.map((l)=>l.totalTokens)),[b]),F=v(()=>{if(C<=0)return 0;return b.filter((x)=>x.hour>=8&&x.hour<20).reduce((x,T)=>x+T.totalTokens,0)/C},[b,C]),j=v(()=>Math.max(1,...p.map((l)=>l.totalTokens)),[p]),z=v(()=>{let l=0,x=0;for(let T of p)if(T.totalTokens>0||T.activeDurationMs>0||T.runs>0){if(x++,x>l)l=x}else x=0;return l},[p]),d=v(()=>p.filter((l)=>l.totalTokens>0||l.activeDurationMs>0||l.runs>0).length,[p]),s=a!==null?b[a]:w;return n(g,{title:"活跃时段与热力",action:n("div",{className:"flex items-center gap-3 font-mono text-xs text-faint tabular-nums",children:[n("span",{children:["日间占比 ",B(F)]}),n("span",{children:["连续活跃 ",z," 天"]}),n("span",{children:["活跃 ",d,"/",p.length," 天"]})]}),children:[n("div",{className:"p-4 space-y-3",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[e("span",{className:"text-dim",children:"24 小时分布"}),s?n("div",{className:"flex items-center gap-3 font-mono text-dim tabular-nums",children:[n("span",{className:"text-ink",children:[a!==null?"时段 ":"高峰 ",String(s.hour).padStart(2,"0"),":00 -"," ",String((s.hour+1)%24).padStart(2,"0"),":00"]}),e("span",{className:"text-ink",children:M(s.totalTokens)}),s.activeDurationMs>0&&e("span",{children:P(s.activeDurationMs)})]}):e("span",{className:"text-faint",children:"暂无时段分布"})]}),n("section",{"aria-label":"24 小时活跃分布序列",className:"h-28 w-full flex flex-col justify-between pt-1",onMouseLeave:()=>f(null),children:[e("div",{className:"flex-1 flex items-end gap-1.5 pb-1.5",children:b.map((l)=>{let x=w?.hour===l.hour,T=a===l.hour,k=l.totalTokens>0?Math.max(6,l.totalTokens/D*100):0,H=`${String(l.hour).padStart(2,"0")}:00 - ${String((l.hour+1)%24).padStart(2,"0")}:00
1
+ import{h,o,v,i,r,m,e,n,y,lt}from"./chunk-ty2rmwda.js";var V="__chat__";function M(t){if(!Number.isFinite(t)||t<=0)return"0";if(t<1000)return Math.round(t).toString();if(t<1e6)return`${(t/1000).toFixed(1)}K`;if(t<1e9)return`${(t/1e6).toFixed(2)}M`;return`${(t/1e9).toFixed(2)}B`}function L(t){let u=Number.isFinite(t)?Math.max(0,t):0;return Math.round(u).toLocaleString("en-US")}function P(t){if(!Number.isFinite(t)||t<=0)return"0s";if(t<1000)return"<1s";if(t<60000)return`${Math.floor(t/1000)}s`;if(t<3600000){let c=Math.floor(t/1000),a=Math.floor(c/60),f=c%60;return f>0?`${a}m ${f}s`:`${a}m`}if(t<259200000){let c=Math.floor(t/60000),a=Math.floor(c/60),f=c%60;return f>0?`${a}h ${f}m`:`${a}h`}let u=Math.floor(t/3600000),g=Math.floor(u/24),p=u%24;return p>0?`${g}d ${p}h`:`${g}d`}function ae(t){if(!Number.isFinite(t)||t<=0)return"0s";if(t<1000)return"<1s";if(t<60000)return`${Math.round(t/1000)}s`;if(t<3600000)return`${Math.round(t/60000)}m`;if(t<86400000){let p=t/3600000;return`${p>=10?Math.round(p).toString():p.toFixed(1).replace(/\.0$/,"")}h`}let u=t/86400000;return`${u>=10?Math.round(u).toString():u.toFixed(1).replace(/\.0$/,"")}d`}function B(t,u=1){if(!Number.isFinite(t)||t<=0)return"0%";let g=10**-u/100;if(t<g)return`<${(g*100).toFixed(u)}%`;return`${(t*100).toFixed(u)}%`}function Q(t){if(!Number.isFinite(t)||t<=0)return"0 B";if(t<1024)return`${Math.round(t)} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;if(t<1073741824)return`${(t/1048576).toFixed(2)} MB`;return`${(t/1073741824).toFixed(2)} GB`}function W(t){let u=t.split("-"),g=u[1],p=u[2];if(g!==void 0&&p!==void 0)return`${g}/${p}`;return t}function Z(t){let u=t.split("-"),g=u[0],p=u[1],c=u[2];if(g===void 0||p===void 0||c===void 0)return t;let a=Number(g),f=Number(p)-1,b=Number(c),w=new Date(Date.UTC(a,f,b)),C=["周日","周一","周二","周三","周四","周五","周六"],D=w.getUTCDay(),F=C[D]??"";return`${t} ${F}`}function se(t,u=Date.now()){if(t===null||t===void 0||!Number.isFinite(t)||t<=0)return"从未";let g=Math.max(0,u-t);if(g<60000)return"刚刚";if(g<3600000)return`${Math.max(1,Math.floor(g/60000))} 分钟前`;if(g<86400000)return`${Math.max(1,Math.floor(g/3600000))} 小时前`;if(g<2592000000)return`${Math.max(1,Math.floor(g/86400000))} 天前`;let p=new Date(t),c=p.getFullYear(),a=String(p.getMonth()+1).padStart(2,"0"),f=String(p.getDate()).padStart(2,"0");return`${c}-${a}-${f}`}function K(t){return e("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-raised",children:e("div",{className:"h-full rounded-full bg-accent transition-all duration-300",style:{width:`${t.percent}%`}})})}function Y(t){return e("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:t.children})}function G(t){return e("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:t.children})}function J(t){return n(G,{children:[n("span",{children:["输入 ",e("span",{className:"text-ink",children:M(t.stat.inputTokens)})]}),n("span",{children:["输出 ",e("span",{className:"text-ink",children:M(t.stat.outputTokens)})]}),n("span",{children:["缓存读 ",e("span",{className:"text-ink",children:M(t.stat.cacheReadTokens)}),t.cacheHitRate!==void 0&&n("span",{className:"text-faint",children:[" (",B(t.cacheHitRate),")"]})]})]})}function oe(t){let{projects:u,selectedProjectID:g,onSelectProject:p}=t,{style:c}=y();if(u.length===0)return e("div",{className:c("surface.empty"),children:"暂无项目统计数据"});return e("div",{className:"divide-y divide-line",children:u.map((a)=>{let f=a.projectID??V,b=g===f,w=Math.max(a.tokenShare>0?1:0,a.tokenShare*100);return n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[e("span",{className:"font-medium text-sm text-ink truncate",children:a.name}),e("span",{className:c("control.badge","font-mono truncate max-w-[240px]"),title:a.directory||"未绑定项目目录",children:a.directory||"独立会话"}),e("button",{type:"button",onClick:()=>p(b?null:f),className:"rounded px-1.5 py-0.5 text-[11px] text-accent hover:bg-accent/10 transition-colors cursor-pointer shrink-0",children:b?"取消筛选":"筛选"})]}),n("div",{className:"flex items-baseline gap-1.5 font-mono tabular-nums shrink-0",children:[e("span",{className:"text-xs font-medium text-ink",title:L(a.totalTokens),children:M(a.totalTokens)}),n("span",{className:"text-[11px] text-faint",children:["(",B(a.tokenShare),")"]})]})]}),e(K,{percent:w}),n(Y,{children:[e(J,{stat:a,cacheHitRate:a.cacheHitRate}),n(G,{children:[n("span",{children:["耗时 ",e("span",{className:"text-ink",children:P(a.activeDurationMs)})]}),n("span",{children:[e("span",{className:"text-ink",children:a.sessionCount.toLocaleString()})," 会话"]}),n("span",{children:["工具 ",e("span",{className:"text-ink",children:a.toolCalls.toLocaleString()})," 次"]})]})]})]},f)})})}function re(t){let{models:u}=t,{ModelIcon:g,style:p}=y();if(u.length===0)return e("div",{className:p("surface.empty"),children:"暂无模型调用数据"});return e("div",{className:"divide-y divide-line",children:u.map((c)=>{let a=Math.max(c.share>0?1:0,c.share*100);return n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[e(g,{modelID:c.model,className:"size-4 shrink-0"}),e("span",{className:"font-mono text-sm font-medium text-ink truncate",children:c.shortName}),e("span",{className:p("control.badge","font-mono shrink-0"),children:c.provider})]}),n("div",{className:"flex items-baseline gap-2.5 font-mono tabular-nums shrink-0",children:[c.avgTps!==null&&n("span",{className:"text-[11px] text-dim",children:[c.avgTps.toFixed(1)," tok/s"]}),n("span",{className:"text-xs font-medium text-ink",title:L(c.totalTokens),children:[M(c.totalTokens)," ",n("span",{className:"text-[11px] font-normal text-faint",children:["(",B(c.share),")"]})]})]})]}),e(K,{percent:a}),n(Y,{children:[e(J,{stat:c,cacheHitRate:c.cacheHitRate}),n(G,{children:[n("span",{children:[e("span",{className:"text-ink",children:c.turns.toLocaleString()})," 轮",c.errors>0?n("span",{className:"text-danger",children:[" (",c.errors," 错)"]}):null]}),n("span",{children:["工具 ",e("span",{className:"text-ink",children:c.toolCalls.toLocaleString()})," 次"]}),c.generationMs>0&&n("span",{children:["推理 ",e("span",{className:"text-ink",children:ae(c.generationMs)})]})]})]})]},c.model)})})}function ie(t){let{tools:u}=t,{StatusChip:g,style:p}=y();if(u.length===0)return e("div",{className:p("surface.empty"),children:"暂无工具调用数据"});return e("div",{className:"divide-y divide-line",children:u.map((c)=>{let a=Math.max(c.share>0?1:0,c.share*100),f=c.successRate>=0.95?"success":c.successRate>=0.8?"warning":"danger",b=Math.max(0,c.calls-c.errors),w=c.calls>0?Math.round(c.outputBytes/c.calls):0;return n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[e("span",{className:"font-mono text-sm font-medium text-ink truncate",children:c.name}),n(g,{tone:f,children:["成功率 ",B(c.successRate)]})]}),n("div",{className:"flex items-baseline gap-1.5 font-mono tabular-nums shrink-0",children:[n("span",{className:"text-xs font-medium text-ink",children:[c.calls.toLocaleString()," 次"]}),n("span",{className:"text-[11px] text-faint",children:["(",B(c.share),")"]})]})]}),e(K,{percent:a}),n(Y,{children:[n(G,{children:[n("span",{children:["成功 ",e("span",{className:"text-ink",children:b.toLocaleString()})," 次"]}),n("span",{children:["失败 ",e("span",{className:c.errors>0?"text-danger":"text-ink",children:c.errors.toLocaleString()})," 次"]})]}),n(G,{children:[n("span",{children:["累计输出 ",e("span",{className:"text-ink",children:Q(c.outputBytes)})]}),n("span",{children:["单次均值 ",e("span",{className:"text-ink",children:Q(w)})]})]})]})]},c.name)})})}function le(t){let{sessions:u,onOpenSession:g}=t,{style:p}=y();if(u.length===0)return e("div",{className:p("surface.empty"),children:"暂无高消耗会话记录"});let c=Math.max(1,...u.map((a)=>a.totalTokens));return e("div",{className:"divide-y divide-line",children:u.map((a)=>{let f=c>0?Math.max(1,a.totalTokens/c*100):0,b=a.model.split("/").pop()??a.model;return n("button",{type:"button",onClick:()=>g(a.id),className:"group block w-full p-4 text-left space-y-2.5 hover:bg-raised/40 transition-colors cursor-pointer",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[e("span",{className:"font-medium text-sm text-ink truncate group-hover:text-accent transition-colors",children:a.title.trim()||"新会话"}),e("span",{className:p("control.badge","font-mono truncate max-w-[140px] shrink-0"),title:a.projectName,children:a.projectName}),a.kind==="sub"&&e("span",{className:"rounded bg-accent/15 px-1.5 py-0.5 text-[10.5px] text-accent shrink-0",children:"子代理"}),a.archivedAt!==null&&e("span",{className:p("control.badge","shrink-0"),children:"已归档"})]}),n("div",{className:"flex items-center gap-1.5 font-mono tabular-nums shrink-0",children:[e("span",{className:"text-xs font-medium text-ink",title:L(a.totalTokens),children:M(a.totalTokens)}),e(lt,{className:"size-3.5 text-faint group-hover:text-ink group-hover:translate-x-0.5 transition-all"})]})]}),e(K,{percent:f}),n(Y,{children:[e(J,{stat:a}),n(G,{children:[e("span",{className:"text-ink",children:b}),n("span",{children:["耗时 ",e("span",{className:"text-ink",children:P(a.activeDurationMs)})]}),n("span",{children:[e("span",{className:"text-ink",children:a.assistantTurns})," 轮"]}),e("span",{className:"text-faint",children:se(a.updated)})]})]})]},a.id)})})}var ce=[{value:"tokens",label:"Token 用量"},{value:"duration",label:"活跃耗时"},{value:"activity",label:"交互轮次"}];function ue(t){let{cn:u,Segmented:g,SettingGroup:p,style:c}=y(),{daily:a}=t,[f,b]=r("tokens"),[w,C]=r(null),D=v(()=>a.some((s)=>s.totalTokens>0||s.activeDurationMs>0||s.runs>0),[a]),F=v(()=>{if(a.length===0)return{totalText:"0",avgText:"0",peakDate:"—",peakValueText:"0"};if(f==="tokens"){let S=a.reduce((_,A)=>_+A.totalTokens,0),R=a.filter((_)=>_.totalTokens>0).length,N=a[0];for(let _ of a)if(!N||_.totalTokens>N.totalTokens)N=_;return{totalText:M(S),totalFullText:L(S),avgText:R>0?M(Math.round(S/R)):"0",peakDate:N&&N.totalTokens>0?W(N.date):"—",peakValueText:N&&N.totalTokens>0?M(N.totalTokens):"0"}}if(f==="duration"){let S=a.reduce((_,A)=>_+A.activeDurationMs,0),R=a.filter((_)=>_.activeDurationMs>0).length,N=a[0];for(let _ of a)if(!N||_.activeDurationMs>N.activeDurationMs)N=_;return{totalText:P(S),totalFullText:P(S),avgText:R>0?P(Math.round(S/R)):"0s",peakDate:N&&N.activeDurationMs>0?W(N.date):"—",peakValueText:N&&N.activeDurationMs>0?P(N.activeDurationMs):"0s"}}let s=a.reduce((S,R)=>S+R.assistantTurns,0),l=a.reduce((S,R)=>S+R.userMessages,0),x=s+l,T=a.filter((S)=>S.assistantTurns>0||S.userMessages>0).length,k=a[0];for(let S of a){let R=k?k.assistantTurns+k.userMessages:0;if(!k||S.assistantTurns+S.userMessages>R)k=S}let H=k?k.assistantTurns+k.userMessages:0;return{totalText:`${x.toLocaleString()} 轮`,totalFullText:`助手 ${s.toLocaleString()} 轮 · 用户 ${l.toLocaleString()} 问`,avgText:T>0?`${(x/T).toFixed(1)} 轮/天`:"0 轮/天",peakDate:k&&H>0?W(k.date):"—",peakValueText:k&&H>0?`${H.toLocaleString()} 轮`:"0 轮"}},[a,f]),j=v(()=>{if(w){let s=a.find((l)=>l.date===w);if(s)return s}for(let s=a.length-1;s>=0;s--){let l=a[s];if(l&&(l.totalTokens>0||l.activeDurationMs>0||l.runs>0))return l}return a[a.length-1]},[a,w]),z=v(()=>{if(f==="tokens")return Math.max(1,...a.map((s)=>s.totalTokens));if(f==="duration")return Math.max(1000,...a.map((s)=>s.activeDurationMs));return Math.max(1,...a.map((s)=>s.assistantTurns+s.userMessages))},[a,f]),d=v(()=>{if(a.length<=7)return a.map((x)=>x.date);let s=6,l=[];for(let x=0;x<s;x++){let T=Math.round(x*(a.length-1)/(s-1)),k=a[T];if(k)l.push(k.date)}return l},[a]);if(!D)return e(p,{title:"每日趋势",action:e(g,{value:f,onChange:(s)=>b(s),options:ce}),children:e("div",{className:c("surface.empty"),children:"当前时间范围内暂无活跃数据"})});return e(p,{title:"每日趋势",action:e(g,{value:f,onChange:(s)=>b(s),options:ce}),children:n("div",{className:"p-4 space-y-4",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex flex-wrap items-center gap-x-3.5 gap-y-1 font-mono text-dim tabular-nums",children:[n("span",{children:["汇总 ",e("span",{className:"text-ink",children:F.totalText})]}),n("span",{children:["日均 ",e("span",{className:"text-ink",children:F.avgText})]}),n("span",{children:["峰值 ",e("span",{className:"text-ink",children:F.peakValueText}),F.peakDate!=="—"?n("span",{className:"text-faint",children:[" (",F.peakDate,")"]}):null]})]}),n("div",{className:"flex items-center gap-3 text-[11px] text-dim",children:[f==="tokens"&&n(m,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent/40"}),"缓存读"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent"}),"输入"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-success"}),"输出"]})]}),f==="duration"&&n(m,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent"}),"工作调度"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-success"}),"模型推理"]})]}),f==="activity"&&n(m,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent"}),"助手回复"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-success"}),"用户提问"]})]})]})]}),n("div",{className:"relative h-44 w-full pt-1",children:[n("div",{className:"absolute inset-0 flex flex-col justify-between pointer-events-none pb-5 text-[10px] text-faint/60",children:[e("div",{className:"border-b border-line/40 w-full"}),e("div",{className:"border-b border-line/30 w-full"}),e("div",{className:"border-b border-line/40 w-full"})]}),n("section",{"aria-label":"每日趋势柱状序列",className:"relative h-full flex flex-col justify-between",onMouseLeave:()=>C(null),children:[e("div",{className:"flex-1 flex items-end gap-1 sm:gap-1.5 pb-2",children:a.map((s)=>{let l=s.totalTokens;if(f==="duration")l=s.activeDurationMs;else if(f==="activity")l=s.assistantTurns+s.userMessages;let x=l<=0,T=x?0:Math.max(3,Math.min(100,l/z*100)),k=j?.date===s.date;return n("button",{type:"button","aria-label":`${s.date} 统计数据`,className:"flex-1 h-full flex flex-col justify-end items-center group cursor-pointer relative min-w-0 bg-transparent p-0 border-0 focus:outline-hidden",onMouseEnter:()=>C(s.date),onFocus:()=>C(s.date),onClick:()=>C(s.date),children:[e("div",{className:u("absolute inset-y-0 w-full rounded-xs transition-colors pointer-events-none",k?"bg-accent/10":"group-hover:bg-raised/60")}),x?e("div",{className:"h-1 w-full max-w-[24px] rounded-full bg-raised group-hover:bg-dim/30"}):n("div",{className:"w-full max-w-[24px] rounded-t-xs overflow-hidden flex flex-col justify-end transition-all duration-150",style:{height:`${T}%`},children:[f==="tokens"&&n(m,{children:[s.outputTokens>0&&e("div",{className:"bg-success transition-all duration-200",style:{height:`${s.outputTokens/s.totalTokens*100}%`}}),s.inputTokens+s.cacheWriteTokens>0&&e("div",{className:"bg-accent transition-all duration-200",style:{height:`${(s.inputTokens+s.cacheWriteTokens)/s.totalTokens*100}%`}}),s.cacheReadTokens>0&&e("div",{className:"bg-accent/40 transition-all duration-200",style:{height:`${s.cacheReadTokens/s.totalTokens*100}%`}})]}),f==="duration"&&n(m,{children:[s.generationMs>0&&e("div",{className:"bg-success transition-all duration-200",style:{height:`${Math.min(100,s.generationMs/Math.max(1,s.activeDurationMs)*100)}%`}}),e("div",{className:"bg-accent flex-1 transition-all duration-200"})]}),f==="activity"&&n(m,{children:[s.userMessages>0&&e("div",{className:"bg-success transition-all duration-200",style:{height:`${s.userMessages/Math.max(1,s.assistantTurns+s.userMessages)*100}%`}}),e("div",{className:"bg-accent flex-1 transition-all duration-200"})]})]}),k&&e("div",{className:"absolute -bottom-1 size-1 rounded-full bg-accent"})]},s.date)})}),e("div",{className:u("flex items-center pt-1.5 text-[10px] text-faint font-mono tabular-nums",a.length<=7?"gap-1 sm:gap-1.5":"justify-between"),children:d.map((s)=>e("div",{className:u("whitespace-nowrap",a.length<=7&&"flex-1 text-center"),children:W(s)},s))})]})]}),e("div",{className:"flex flex-wrap items-center justify-between gap-2 border-t border-line pt-3 font-mono text-xs tabular-nums",children:j?n(m,{children:[e("span",{className:"text-ink",children:Z(j.date)}),n("div",{className:"flex flex-wrap items-center gap-x-3.5 gap-y-1 text-dim",children:[n("span",{children:["Token ",e("span",{className:"text-ink",children:M(j.totalTokens)})]}),n("span",{children:["耗时 ",e("span",{className:"text-ink",children:P(j.activeDurationMs)})]}),n("span",{children:["交互 ",n("span",{className:"text-ink",children:[j.assistantTurns+j.userMessages," 轮"]})]}),n("span",{children:["工具 ",n("span",{className:"text-ink",children:[j.toolCalls," 次"]})]})]})]}):e("span",{className:"font-sans text-faint",children:"悬停柱状图查看单日明细"})})]})})}function pe(t){let{cn:u,SettingGroup:g}=y(),{daily:p,hourly:c}=t,[a,f]=r(null),b=v(()=>{let l=new Map;for(let T of c)l.set(T.hour,T);let x=[];for(let T=0;T<24;T++){let k=l.get(T);if(k)x.push(k);else x.push({hour:T,totalTokens:0,activeDurationMs:0,userMessages:0,assistantTurns:0,runs:0})}return x},[c]),w=v(()=>{let l=b[0];for(let x of b)if(!l||x.totalTokens>l.totalTokens)l=x;return l&&l.totalTokens>0?l:null},[b]),C=v(()=>b.reduce((l,x)=>l+x.totalTokens,0),[b]),D=v(()=>Math.max(1,...b.map((l)=>l.totalTokens)),[b]),F=v(()=>{if(C<=0)return 0;return b.filter((x)=>x.hour>=8&&x.hour<20).reduce((x,T)=>x+T.totalTokens,0)/C},[b,C]),j=v(()=>Math.max(1,...p.map((l)=>l.totalTokens)),[p]),z=v(()=>{let l=0,x=0;for(let T of p)if(T.totalTokens>0||T.activeDurationMs>0||T.runs>0){if(x++,x>l)l=x}else x=0;return l},[p]),d=v(()=>p.filter((l)=>l.totalTokens>0||l.activeDurationMs>0||l.runs>0).length,[p]),s=a!==null?b[a]:w;return n(g,{title:"活跃时段与热力",action:n("div",{className:"flex items-center gap-3 font-mono text-xs text-faint tabular-nums",children:[n("span",{children:["日间占比 ",B(F)]}),n("span",{children:["连续活跃 ",z," 天"]}),n("span",{children:["活跃 ",d,"/",p.length," 天"]})]}),children:[n("div",{className:"p-4 space-y-3",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[e("span",{className:"text-dim",children:"24 小时分布"}),s?n("div",{className:"flex items-center gap-3 font-mono text-dim tabular-nums",children:[n("span",{className:"text-ink",children:[a!==null?"时段 ":"高峰 ",String(s.hour).padStart(2,"0"),":00 -"," ",String((s.hour+1)%24).padStart(2,"0"),":00"]}),e("span",{className:"text-ink",children:M(s.totalTokens)}),s.activeDurationMs>0&&e("span",{children:P(s.activeDurationMs)})]}):e("span",{className:"text-faint",children:"暂无时段分布"})]}),n("section",{"aria-label":"24 小时活跃分布序列",className:"h-28 w-full flex flex-col justify-between pt-1",onMouseLeave:()=>f(null),children:[e("div",{className:"flex-1 flex items-end gap-1.5 pb-1.5",children:b.map((l)=>{let x=w?.hour===l.hour,T=a===l.hour,k=l.totalTokens>0?Math.max(6,l.totalTokens/D*100):0,H=`${String(l.hour).padStart(2,"0")}:00 - ${String((l.hour+1)%24).padStart(2,"0")}:00
2
2
  消耗: ${L(l.totalTokens)} Token
3
3
  耗时: ${P(l.activeDurationMs)}
4
4
  助手轮次: ${l.assistantTurns} 轮`;return e("button",{type:"button","aria-label":`${String(l.hour).padStart(2,"0")}:00 时段统计`,className:"flex-1 h-full flex flex-col justify-end items-center group relative cursor-pointer bg-transparent p-0 border-0 focus:outline-hidden",title:H,onMouseEnter:()=>f(l.hour),onFocus:()=>f(l.hour),onClick:()=>f(l.hour),children:k>0?e("div",{className:u("w-full max-w-[20px] rounded-t-xs transition-all duration-200",x||T?"bg-accent":"bg-accent/55 group-hover:bg-accent"),style:{height:`${k}%`}}):e("div",{className:"h-1 w-full max-w-[20px] rounded-full bg-raised group-hover:bg-dim/30"})},l.hour)})}),n("div",{className:"flex justify-between items-center text-[10px] text-faint font-mono pt-1.5 border-t border-line/40",children:[e("span",{children:"00:00"}),e("span",{children:"04:00"}),e("span",{children:"08:00"}),e("span",{children:"12:00"}),e("span",{children:"16:00"}),e("span",{children:"20:00"}),e("span",{children:"23:00"})]})]})]}),n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"text-xs text-dim",children:["自然日热力 (",p.length," 天)"]}),e("div",{className:"flex flex-wrap items-center gap-1.5",children:p.map((l)=>{let x="bg-raised";if(l.totalTokens>0){let k=l.totalTokens/j;if(k<=0.33)x="bg-accent/30";else if(k<=0.66)x="bg-accent/60";else x="bg-accent"}let T=`${Z(l.date)}
@@ -1,2 +1,2 @@
1
- import{r,m,e,n,y,s,te,tn,K}from"./chunk-ve8gy05p.js";var g=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16c.5-2 1.5-7 4-7 2 0 2 3 4 3 2.5 0 4.5-5 5-7",key:"lw07rv"}]],d=s("chart-spline",g);function ra(t){let i=y();i.useTheme();let[u,c]=r("preview"),o=t.streaming&&!t.rendered,l=!t.streaming&&!t.rendered&&Boolean(t.error),a=u==="code"||o;return n(i.Panel,{"aria-label":t.title,"data-render-pending":t.pending&&!l?"true":void 0,className:"group/graph relative my-4 font-sans not-italic first:mt-0 last:mb-0",children:[e("div",{role:"toolbar","aria-label":`${t.title}操作`,className:o?"absolute top-2 right-2 z-10 flex items-center":i.style("surface.toolbarFloating","absolute top-2 right-2 z-10 opacity-0 transition-opacity duration-150 group-hover/graph:opacity-100 focus-within:opacity-100 [@media(hover:none)]:opacity-70"),children:o?n("span",{className:i.style("control.badge","gap-1.5 rounded-full px-2 py-0.5 text-[11px]"),children:[e(K,{className:"size-3 animate-spin"}),"生成",t.title]}):n(m,{children:[e("button",{type:"button","aria-label":a?"查看图表":"查看代码",title:a?"查看图表":"查看代码",onClick:()=>c(a?"preview":"code"),className:"flex size-6 items-center justify-center rounded-md text-dim hover:bg-raised hover:text-ink [&_svg]:size-3.5",children:a?e(d,{}):e(tn,{})}),e(i.CopyButton,{text:t.code,size:"icon-sm",label:"复制代码"})]})}),a&&e(i.Code,{code:t.code,lang:t.codeLang,className:"px-4 py-3"}),l&&!a&&n("div",{role:"alert",className:"flex flex-col items-center gap-2 px-4 py-8 text-center",children:[e(te,{className:"size-5 text-warning"}),e("p",{className:"max-w-full text-xs break-words text-dim",children:t.error}),e("button",{type:"button",onClick:()=>c("code"),className:"text-xs text-accent-strong underline underline-offset-2",children:"查看代码"})]}),e("div",{hidden:a||l,children:t.children})]})}
2
- export{ra};
1
+ import{r,m,e,n,y,s,te,nn,K}from"./chunk-ty2rmwda.js";var g=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16c.5-2 1.5-7 4-7 2 0 2 3 4 3 2.5 0 4.5-5 5-7",key:"lw07rv"}]],d=s("chart-spline",g);function ia(t){let i=y();i.useTheme();let[u,c]=r("preview"),o=t.streaming&&!t.rendered,l=!t.streaming&&!t.rendered&&Boolean(t.error),a=u==="code"||o;return n(i.Panel,{"aria-label":t.title,"data-render-pending":t.pending&&!l?"true":void 0,className:"group/graph relative my-4 font-sans not-italic first:mt-0 last:mb-0",children:[e("div",{role:"toolbar","aria-label":`${t.title}操作`,className:o?"absolute top-2 right-2 z-10 flex items-center":i.style("surface.toolbarFloating","absolute top-2 right-2 z-10 opacity-0 transition-opacity duration-150 group-hover/graph:opacity-100 focus-within:opacity-100 [@media(hover:none)]:opacity-70"),children:o?n("span",{className:i.style("control.badge","gap-1.5 rounded-full px-2 py-0.5 text-[11px]"),children:[e(K,{className:"size-3 animate-spin"}),"生成",t.title]}):n(m,{children:[e("button",{type:"button","aria-label":a?"查看图表":"查看代码",title:a?"查看图表":"查看代码",onClick:()=>c(a?"preview":"code"),className:"flex size-6 items-center justify-center rounded-md text-dim hover:bg-raised hover:text-ink [&_svg]:size-3.5",children:a?e(d,{}):e(nn,{})}),e(i.CopyButton,{text:t.code,size:"icon-sm",label:"复制代码"})]})}),a&&e(i.Code,{code:t.code,lang:t.codeLang,className:"px-4 py-3"}),l&&!a&&n("div",{role:"alert",className:"flex flex-col items-center gap-2 px-4 py-8 text-center",children:[e(te,{className:"size-5 text-warning"}),e("p",{className:"max-w-full text-xs break-words text-dim",children:t.error}),e("button",{type:"button",onClick:()=>c("code"),className:"text-xs text-accent-strong underline underline-offset-2",children:"查看代码"})]}),e("div",{hidden:a||l,children:t.children})]})}
2
+ export{ia};
@@ -1,2 +1,2 @@
1
- var e=Object.freeze(JSON.parse('{"displayName":"Shell","name":"shellscript","patterns":[{"include":"#initial_context"}],"repository":{"alias_statement":{"begin":"[\\\\t ]*+(alias)[\\\\t ]*+((?:((?<!\\\\w)-\\\\w+)\\\\b[\\\\t ]*+)*)[\\\\t ]*+((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))(?:(\\\\[)((?:(?:\\\\$?(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)|@)|\\\\*)|(-?\\\\d+))(]))?(?:(?:(=)|(\\\\+=))|(-=))","beginCaptures":{"1":{"name":"storage.type.alias.shell"},"2":{"patterns":[{"match":"(?<!\\\\w)-\\\\w+\\\\b","name":"string.unquoted.argument.shell constant.other.option.shell"}]},"3":{"name":"string.unquoted.argument.shell constant.other.option.shell"},"4":{"name":"variable.other.assignment.shell"},"5":{"name":"punctuation.definition.array.access.shell"},"6":{"name":"variable.other.assignment.shell"},"7":{"name":"constant.numeric.shell constant.numeric.integer.shell"},"8":{"name":"punctuation.definition.array.access.shell"},"9":{"name":"keyword.operator.assignment.shell"},"10":{"name":"keyword.operator.assignment.compound.shell"},"11":{"name":"keyword.operator.assignment.compound.shell"}},"end":"(?=[\\\\t ]|$)|(?:(?:(?:(;)|(&&))|(\\\\|\\\\|))|(&))","endCaptures":{"1":{"name":"punctuation.terminator.statement.semicolon.shell"},"2":{"name":"punctuation.separator.statement.and.shell"},"3":{"name":"punctuation.separator.statement.or.shell"},"4":{"name":"punctuation.separator.statement.background.shell"}},"name":"meta.expression.assignment.alias.shell","patterns":[{"include":"#normal_context"}]},"argument":{"begin":"[\\\\t ]++(?![\\\\n#\\\\&(\\\\[|]|$|;)","beginCaptures":{},"end":"(?=[\\\\t \\\\&;|]|$|[\\\\n)`])","endCaptures":{},"name":"meta.argument.shell","patterns":[{"include":"#argument_context"},{"include":"#line_continuation"}]},"argument_context":{"patterns":[{"captures":{"1":{"name":"string.unquoted.argument.shell","patterns":[{"match":"\\\\*","name":"variable.language.special.wildcard.shell"},{"include":"#variable"},{"include":"#numeric_literal"},{"captures":{"1":{"name":"constant.language.$1.shell"}},"match":"(?<!\\\\w)\\\\b(true|false)\\\\b(?!\\\\w)"}]}},"match":"[\\\\t ]*+([^\\\\t\\\\n \\"$\\\\&-);<>\\\\\\\\`|]+(?!>))"},{"include":"#normal_context"}]},"arithmetic_double":{"patterns":[{"begin":"\\\\(\\\\(","beginCaptures":{"0":{"name":"punctuation.section.arithmetic.double.shell"}},"end":"\\\\)\\\\s*\\\\)","endCaptures":{"0":{"name":"punctuation.section.arithmetic.double.shell"}},"name":"meta.arithmetic.shell","patterns":[{"include":"#math"},{"include":"#string"}]}]},"arithmetic_no_dollar":{"patterns":[{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.section.arithmetic.single.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.section.arithmetic.single.shell"}},"name":"meta.arithmetic.shell","patterns":[{"include":"#math"},{"include":"#string"}]}]},"array_access_inline":{"captures":{"1":{"name":"punctuation.section.array.shell"},"2":{"patterns":[{"include":"#special_expansion"},{"include":"#string"},{"include":"#variable"}]},"3":{"name":"punctuation.section.array.shell"}},"match":"(\\\\[)([^]\\\\[]+)(])"},"array_value":{"begin":"[\\\\t ]*+((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))(?:(\\\\[)((?:(?:\\\\$?(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)|@)|\\\\*)|(-?\\\\d+))(]))?(?:(?:(=)|(\\\\+=))|(-=))[\\\\t ]*+(\\\\()","beginCaptures":{"1":{"name":"variable.other.assignment.shell"},"2":{"name":"punctuation.definition.array.access.shell"},"3":{"name":"variable.other.assignment.shell"},"4":{"name":"constant.numeric.shell constant.numeric.integer.shell"},"5":{"name":"punctuation.definition.array.access.shell"},"6":{"name":"keyword.operator.assignment.shell"},"7":{"name":"keyword.operator.assignment.compound.shell"},"8":{"name":"keyword.operator.assignment.compound.shell"},"9":{"name":"punctuation.definition.array.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.array.shell"}},"patterns":[{"include":"#comment"},{"captures":{"1":{"name":"variable.other.assignment.array.shell entity.other.attribute-name.shell"},"2":{"name":"keyword.operator.assignment.shell punctuation.definition.assignment.shell"}},"match":"((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))(=)"},{"captures":{"1":{"name":"punctuation.definition.bracket.named-array.shell"},"2":{"name":"string.unquoted.shell entity.other.attribute-name.bracket.shell"},"3":{"name":"punctuation.definition.bracket.named-array.shell"},"4":{"name":"punctuation.definition.assignment.shell"}},"match":"(\\\\[)(.+?)(])(=)"},{"include":"#normal_context"},{"include":"#simple_unquoted"}]},"assignment_statement":{"patterns":[{"include":"#array_value"},{"include":"#modified_assignment_statement"},{"include":"#normal_assignment_statement"}]},"basic_command_name":{"captures":{"1":{"name":"storage.modifier.$1.shell"},"2":{"name":"entity.name.function.call.shell entity.name.command.shell","patterns":[{"match":"(?<!\\\\w)(?:continue|return|break)(?!\\\\w)","name":"keyword.control.$0.shell"},{"match":"(?<!\\\\w)(?:unfunction|continue|autoload|unsetopt|bindkey|builtin|getopts|command|declare|unalias|history|unlimit|typeset|suspend|source|printf|unhash|disown|ulimit|return|which|alias|break|false|print|shift|times|umask|unset|read|type|exec|eval|wait|echo|dirs|jobs|kill|hash|stat|exit|test|trap|true|let|set|pwd|cd|fg|bg|fc|[.:])(?!/)(?!\\\\w)(?!-)","name":"support.function.builtin.shell"},{"include":"#variable"}]}},"match":"(?![\\\\n!#\\\\&()<>\\\\[{|]|$|[\\\\t ;])(?!nocorrect |nocorrect\\\\t|nocorrect$|readonly |readonly\\\\t|readonly$|function |function\\\\t|function$|foreach |foreach\\\\t|foreach$|coproc |coproc\\\\t|coproc$|logout |logout\\\\t|logout$|export |export\\\\t|export$|select |select\\\\t|select$|repeat |repeat\\\\t|repeat$|pushd |pushd\\\\t|pushd$|until |until\\\\t|until$|while |while\\\\t|while$|local |local\\\\t|local$|case |case\\\\t|case$|done |done\\\\t|done$|elif |elif\\\\t|elif$|else |else\\\\t|else$|esac |esac\\\\t|esac$|popd |popd\\\\t|popd$|then |then\\\\t|then$|time |time\\\\t|time$|for |for\\\\t|for$|end |end\\\\t|end$|fi |fi\\\\t|fi$|do |do\\\\t|do$|in |in\\\\t|in$|if |if\\\\t|if$)(?:((?<=^|[\\\\t \\\\&;])(?:readonly|declare|typeset|export|local)(?=[\\\\t \\\\&;]|$))|((?![\\"\']|\\\\\\\\\\\\n?$)[^\\\\t\\\\n\\\\r !\\"\'<>]+?))(?:(?=[\\\\t ])|(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\))","name":"meta.statement.command.name.basic.shell"},"block_comment":{"begin":"\\\\s*+(/\\\\*)","beginCaptures":{"1":{"name":"punctuation.definition.comment.begin.shell"}},"end":"\\\\*/","endCaptures":{"0":{"name":"punctuation.definition.comment.end.shell"}},"name":"comment.block.shell"},"boolean":{"match":"\\\\b(?:true|false)\\\\b","name":"constant.language.$0.shell"},"case_statement":{"begin":"\\\\b(case)\\\\b[\\\\t ]*+(.+?)[\\\\t ]*+\\\\b(in)\\\\b","beginCaptures":{"1":{"name":"keyword.control.case.shell"},"2":{"patterns":[{"include":"#initial_context"}]},"3":{"name":"keyword.control.in.shell"}},"end":"\\\\besac\\\\b","endCaptures":{"0":{"name":"keyword.control.esac.shell"}},"name":"meta.case.shell","patterns":[{"include":"#comment"},{"captures":{"1":{"name":"keyword.operator.pattern.case.default.shell"}},"match":"[\\\\t ]*+(\\\\* *\\\\))"},{"begin":"(?<!\\\\))(?![\\\\t ]*+(?:esac\\\\b|$))","beginCaptures":{},"end":"(?=\\\\besac\\\\b)|(\\\\))","endCaptures":{"1":{"name":"keyword.operator.pattern.case.shell"}},"name":"meta.case.entry.pattern.shell","patterns":[{"include":"#case_statement_context"}]},{"begin":"(?<=\\\\))","beginCaptures":{},"end":"(;;)|(?=\\\\besac\\\\b)","endCaptures":{"1":{"name":"punctuation.terminator.statement.case.shell"}},"name":"meta.case.entry.body.shell","patterns":[{"include":"#typical_statements"},{"include":"#initial_context"}]}]},"case_statement_context":{"patterns":[{"match":"\\\\*","name":"variable.language.special.quantifier.star.shell keyword.operator.quantifier.star.shell punctuation.definition.arbitrary-repetition.shell punctuation.definition.regex.arbitrary-repetition.shell"},{"match":"\\\\+","name":"variable.language.special.quantifier.plus.shell keyword.operator.quantifier.plus.shell punctuation.definition.arbitrary-repetition.shell punctuation.definition.regex.arbitrary-repetition.shell"},{"match":"\\\\?","name":"variable.language.special.quantifier.question.shell keyword.operator.quantifier.question.shell punctuation.definition.arbitrary-repetition.shell punctuation.definition.regex.arbitrary-repetition.shell"},{"match":"@","name":"variable.language.special.at.shell keyword.operator.at.shell punctuation.definition.regex.at.shell"},{"match":"\\\\|","name":"keyword.operator.orvariable.language.special.or.shell keyword.operator.alternation.ruby.shell punctuation.definition.regex.alternation.shell punctuation.separator.regex.alternation.shell"},{"match":"\\\\\\\\.","name":"constant.character.escape.shell"},{"match":"(?<=\\\\tin| in|[\\\\t ]|;;)\\\\(","name":"keyword.operator.pattern.case.shell"},{"begin":"(?<=\\\\S)(\\\\()","beginCaptures":{"1":{"name":"punctuation.definition.group.shell punctuation.definition.regex.group.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.definition.regex.group.shell"}},"name":"meta.parenthese.shell","patterns":[{"include":"#case_statement_context"}]},{"begin":"\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.character-class.shell"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.character-class.shell"}},"name":"string.regexp.character-class.shell","patterns":[{"match":"\\\\\\\\.","name":"constant.character.escape.shell"}]},{"include":"#string"},{"match":"[^\\\\t\\\\n )*?@\\\\[|]","name":"string.unquoted.pattern.shell string.regexp.unquoted.shell"}]},"command_name_range":{"begin":"\\\\G","beginCaptures":{},"end":"(?=[\\\\t \\\\&;|]|$|[\\\\n)`])|(?=<)","endCaptures":{},"name":"meta.statement.command.name.shell","patterns":[{"match":"(?<!\\\\w)(?:continue|return|break)(?!\\\\w)","name":"entity.name.function.call.shell entity.name.command.shell keyword.control.$0.shell"},{"match":"(?<!\\\\w)(?:unfunction|continue|autoload|unsetopt|bindkey|builtin|getopts|command|declare|unalias|history|unlimit|typeset|suspend|source|printf|unhash|disown|ulimit|return|which|alias|break|false|print|shift|times|umask|unset|read|type|exec|eval|wait|echo|dirs|jobs|kill|hash|stat|exit|test|trap|true|let|set|pwd|cd|fg|bg|fc|[.:])(?!/)(?!\\\\w)(?!-)","name":"entity.name.function.call.shell entity.name.command.shell support.function.builtin.shell"},{"include":"#variable"},{"captures":{"1":{"name":"entity.name.function.call.shell entity.name.command.shell"}},"match":"(?<!\\\\w)(?<=\\\\G|[\\"\')}])([^\\\\t\\\\n\\\\r \\"\\\\&\');->`{|]+)"},{"begin":"(?:\\\\G|(?<![\\\\t\\\\n #\\\\&;{|]))(\\\\$?)((\\")|(\'))","beginCaptures":{"1":{"name":"meta.statement.command.name.quoted.shell punctuation.definition.string.shell entity.name.function.call.shell entity.name.command.shell"},"2":{},"3":{"name":"meta.statement.command.name.quoted.shell string.quoted.double.shell punctuation.definition.string.begin.shell entity.name.function.call.shell entity.name.command.shell"},"4":{"name":"meta.statement.command.name.quoted.shell string.quoted.single.shell punctuation.definition.string.begin.shell entity.name.function.call.shell entity.name.command.shell"}},"end":"(?<!\\\\G)(?<=\\\\2)","endCaptures":{},"patterns":[{"include":"#continuation_of_single_quoted_command_name"},{"include":"#continuation_of_double_quoted_command_name"}]},{"include":"#line_continuation"},{"include":"#simple_unquoted"}]},"command_statement":{"begin":"[\\\\t ]*+(?![\\\\n!#\\\\&()<>\\\\[{|]|$|[\\\\t ;])(?!nocorrect |nocorrect\\\\t|nocorrect$|readonly |readonly\\\\t|readonly$|function |function\\\\t|function$|foreach |foreach\\\\t|foreach$|coproc |coproc\\\\t|coproc$|logout |logout\\\\t|logout$|export |export\\\\t|export$|select |select\\\\t|select$|repeat |repeat\\\\t|repeat$|pushd |pushd\\\\t|pushd$|until |until\\\\t|until$|while |while\\\\t|while$|local |local\\\\t|local$|case |case\\\\t|case$|done |done\\\\t|done$|elif |elif\\\\t|elif$|else |else\\\\t|else$|esac |esac\\\\t|esac$|popd |popd\\\\t|popd$|then |then\\\\t|then$|time |time\\\\t|time$|for |for\\\\t|for$|end |end\\\\t|end$|fi |fi\\\\t|fi$|do |do\\\\t|do$|in |in\\\\t|in$|if |if\\\\t|if$)(?!\\\\\\\\\\\\n?$)","beginCaptures":{},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.statement.command.shell","patterns":[{"include":"#command_name_range"},{"include":"#line_continuation"},{"include":"#option"},{"include":"#argument"},{"include":"#string"},{"include":"#heredoc"}]},"comment":{"captures":{"1":{"name":"comment.line.number-sign.shell meta.shebang.shell"},"2":{"name":"punctuation.definition.comment.shebang.shell"},"3":{"name":"comment.line.number-sign.shell"},"4":{"name":"punctuation.definition.comment.shell"}},"match":"(?:^|[\\\\t ]++)(?:((#!).*)|((#).*))"},"comments":{"patterns":[{"include":"#block_comment"},{"include":"#line_comment"}]},"compound-command":{"patterns":[{"begin":"\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"name":"meta.scope.logical-expression.shell","patterns":[{"include":"#logical-expression"},{"include":"#initial_context"}]},{"begin":"(?<=\\\\s|^)\\\\{(?=\\\\s|$)","beginCaptures":{"0":{"name":"punctuation.definition.group.shell"}},"end":"(?<=^|;)\\\\s*(})","endCaptures":{"1":{"name":"punctuation.definition.group.shell"}},"name":"meta.scope.group.shell","patterns":[{"include":"#initial_context"}]}]},"continuation_of_double_quoted_command_name":{"begin":"\\\\G(?<=\\")","beginCaptures":{},"contentName":"meta.statement.command.name.continuation string.quoted.double entity.name.function.call entity.name.command","end":"\\"","endCaptures":{"0":{"name":"string.quoted.double.shell punctuation.definition.string.end.shell entity.name.function.call.shell entity.name.command.shell"}},"patterns":[{"match":"\\\\\\\\[\\\\n\\"$\\\\\\\\`]","name":"constant.character.escape.shell"},{"include":"#variable"},{"include":"#interpolation"}]},"continuation_of_single_quoted_command_name":{"begin":"\\\\G(?<=\')","beginCaptures":{},"contentName":"meta.statement.command.name.continuation string.quoted.single entity.name.function.call entity.name.command","end":"\'","endCaptures":{"0":{"name":"string.quoted.single.shell punctuation.definition.string.end.shell entity.name.function.call.shell entity.name.command.shell"}}},"custom_command_names":{"patterns":[]},"custom_commands":{"patterns":[]},"double_quote_context":{"patterns":[{"match":"\\\\\\\\[\\\\n\\"$\\\\\\\\`]","name":"constant.character.escape.shell"},{"include":"#variable"},{"include":"#interpolation"}]},"double_quote_escape_char":{"match":"\\\\\\\\[\\\\n\\"$\\\\\\\\`]","name":"constant.character.escape.shell"},"floating_keyword":{"patterns":[{"match":"(?<=^|[\\\\t \\\\&;])(?:then|elif|else|done|end|do|if|fi)(?=[\\\\t \\\\&;]|$)","name":"keyword.control.$0.shell"}]},"for_statement":{"patterns":[{"begin":"\\\\b(for)\\\\b[\\\\t ]*+((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))[\\\\t ]*+\\\\b(in)\\\\b","beginCaptures":{"1":{"name":"keyword.control.for.shell"},"2":{"name":"variable.other.for.shell"},"3":{"name":"keyword.control.in.shell"}},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.for.in.shell","patterns":[{"include":"#string"},{"include":"#simple_unquoted"},{"include":"#normal_context"}]},{"begin":"\\\\b(for)\\\\b","beginCaptures":{"1":{"name":"keyword.control.for.shell"}},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.for.shell","patterns":[{"include":"#arithmetic_double"},{"include":"#normal_context"}]}]},"function_definition":{"applyEndPatternLast":1,"begin":"[\\\\t ]*+(?:\\\\b(function)\\\\b[\\\\t ]*+([^\\\\t\\\\n\\\\r \\"\'()=]+)(?:(\\\\()[\\\\t ]*+(\\\\)))?|([^\\\\t\\\\n\\\\r \\"\'()=]+)[\\\\t ]*+(\\\\()[\\\\t ]*+(\\\\)))","beginCaptures":{"1":{"name":"storage.type.function.shell"},"2":{"name":"entity.name.function.shell"},"3":{"name":"punctuation.definition.arguments.shell"},"4":{"name":"punctuation.definition.arguments.shell"},"5":{"name":"entity.name.function.shell"},"6":{"name":"punctuation.definition.arguments.shell"},"7":{"name":"punctuation.definition.arguments.shell"}},"end":"(?<=[)}])","endCaptures":{},"name":"meta.function.shell","patterns":[{"match":"\\\\G[\\\\t\\\\n ]"},{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.section.function.definition.shell"}},"end":"}","endCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.section.function.definition.shell"}},"name":"meta.function.body.shell","patterns":[{"include":"#initial_context"}]},{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.section.function.definition.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.section.function.definition.shell"}},"name":"meta.function.body.shell","patterns":[{"include":"#initial_context"}]},{"include":"#initial_context"}]},"heredoc":{"patterns":[{"begin":"((?<!<)<<-)[\\\\t ]*+([\\"\'])[\\\\t ]*+([^\\"\']+?)(?=[\\"\\\\&\';<\\\\s])(\\\\2)(.*)","beginCaptures":{"1":{"name":"keyword.operator.heredoc.shell"},"2":{"name":"punctuation.definition.string.heredoc.quote.shell"},"3":{"name":"punctuation.definition.string.heredoc.delimiter.shell"},"4":{"name":"punctuation.definition.string.heredoc.quote.shell"},"5":{"patterns":[{"include":"#redirect_fix"},{"include":"#typical_statements"}]}},"contentName":"string.quoted.heredoc.indent.$3","end":"^\\\\t*\\\\3(?=[\\\\&;\\\\s]|$)","endCaptures":{"0":{"name":"punctuation.definition.string.heredoc.$0.shell"}},"patterns":[]},{"begin":"((?<!<)<<(?!<))[\\\\t ]*+([\\"\'])[\\\\t ]*+([^\\"\']+?)(?=[\\"\\\\&\';<\\\\s])(\\\\2)(.*)","beginCaptures":{"1":{"name":"keyword.operator.heredoc.shell"},"2":{"name":"punctuation.definition.string.heredoc.quote.shell"},"3":{"name":"punctuation.definition.string.heredoc.delimiter.shell"},"4":{"name":"punctuation.definition.string.heredoc.quote.shell"},"5":{"patterns":[{"include":"#redirect_fix"},{"include":"#typical_statements"}]}},"contentName":"string.quoted.heredoc.no-indent.$3","end":"^\\\\3(?=[\\\\&;\\\\s]|$)","endCaptures":{"0":{"name":"punctuation.definition.string.heredoc.delimiter.shell"}},"patterns":[]},{"begin":"((?<!<)<<-)[\\\\t ]*+([^\\\\t \\"\']+)(?=[\\"\\\\&\';<\\\\s])(.*)","beginCaptures":{"1":{"name":"keyword.operator.heredoc.shell"},"2":{"name":"punctuation.definition.string.heredoc.delimiter.shell"},"3":{"patterns":[{"include":"#redirect_fix"},{"include":"#typical_statements"}]}},"contentName":"string.unquoted.heredoc.indent.$2","end":"^\\\\t*\\\\2(?=[\\\\&;\\\\s]|$)","endCaptures":{"0":{"name":"punctuation.definition.string.heredoc.delimiter.shell"}},"patterns":[{"include":"#double_quote_escape_char"},{"include":"#variable"},{"include":"#interpolation"}]},{"begin":"((?<!<)<<(?!<))[\\\\t ]*+([^\\\\t \\"\']+)(?=[\\"\\\\&\';<\\\\s])(.*)","beginCaptures":{"1":{"name":"keyword.operator.heredoc.shell"},"2":{"name":"punctuation.definition.string.heredoc.delimiter.shell"},"3":{"patterns":[{"include":"#redirect_fix"},{"include":"#typical_statements"}]}},"contentName":"string.unquoted.heredoc.no-indent.$2","end":"^\\\\2(?=[\\\\&;\\\\s]|$)","endCaptures":{"0":{"name":"punctuation.definition.string.heredoc.delimiter.shell"}},"patterns":[{"include":"#double_quote_escape_char"},{"include":"#variable"},{"include":"#interpolation"}]}]},"herestring":{"patterns":[{"begin":"(<<<)\\\\s*((\'))","beginCaptures":{"1":{"name":"keyword.operator.herestring.shell"},"2":{"name":"string.quoted.single.shell"},"3":{"name":"punctuation.definition.string.begin.shell"}},"contentName":"string.quoted.single.shell","end":"(\')","endCaptures":{"0":{"name":"string.quoted.single.shell"},"1":{"name":"punctuation.definition.string.end.shell"}},"name":"meta.herestring.shell"},{"begin":"(<<<)\\\\s*((\\"))","beginCaptures":{"1":{"name":"keyword.operator.herestring.shell"},"2":{"name":"string.quoted.double.shell"},"3":{"name":"punctuation.definition.string.begin.shell"}},"contentName":"string.quoted.double.shell","end":"(\\")","endCaptures":{"0":{"name":"string.quoted.double.shell"},"1":{"name":"punctuation.definition.string.end.shell"}},"name":"meta.herestring.shell","patterns":[{"include":"#double_quote_context"}]},{"captures":{"1":{"name":"keyword.operator.herestring.shell"},"2":{"name":"string.unquoted.herestring.shell","patterns":[{"include":"#initial_context"}]}},"match":"(<<<)\\\\s*(([^)\\\\\\\\\\\\s]|\\\\\\\\.)+)","name":"meta.herestring.shell"}]},"initial_context":{"patterns":[{"include":"#comment"},{"include":"#pipeline"},{"include":"#normal_statement_seperator"},{"include":"#logical_expression_double"},{"include":"#logical_expression_single"},{"include":"#assignment_statement"},{"include":"#case_statement"},{"include":"#for_statement"},{"include":"#loop"},{"include":"#function_definition"},{"include":"#line_continuation"},{"include":"#arithmetic_double"},{"include":"#misc_ranges"},{"include":"#variable"},{"include":"#interpolation"},{"include":"#heredoc"},{"include":"#herestring"},{"include":"#redirection"},{"include":"#pathname"},{"include":"#floating_keyword"},{"include":"#alias_statement"},{"include":"#normal_statement"},{"include":"#string"},{"include":"#support"}]},"inline_comment":{"captures":{"1":{"name":"comment.block.shell punctuation.definition.comment.begin.shell"},"2":{"name":"comment.block.shell"},"3":{"patterns":[{"match":"\\\\*/","name":"comment.block.shell punctuation.definition.comment.end.shell"},{"match":"\\\\*","name":"comment.block.shell"}]}},"match":"(/\\\\*)((?:[^*]|\\\\*++[^/])*+(\\\\*++/))"},"interpolation":{"patterns":[{"include":"#arithmetic_dollar"},{"include":"#subshell_dollar"},{"begin":"`","beginCaptures":{"0":{"name":"punctuation.definition.evaluation.backticks.shell"}},"end":"`","endCaptures":{"0":{"name":"punctuation.definition.evaluation.backticks.shell"}},"name":"string.interpolated.backtick.shell","patterns":[{"match":"\\\\\\\\[$\\\\\\\\`]","name":"constant.character.escape.shell"},{"begin":"(?<=\\\\W)(?=#)(?!#\\\\{)","beginCaptures":{"1":{"name":"punctuation.whitespace.comment.leading.shell"}},"end":"(?!\\\\G)","patterns":[{"begin":"#","beginCaptures":{"0":{"name":"punctuation.definition.comment.shell"}},"end":"(?=`)","name":"comment.line.number-sign.shell"}]},{"include":"#initial_context"}]}]},"keyword":{"patterns":[{"match":"(?<=^|[\\\\&;\\\\s])(then|else|elif|fi|for|in|do|done|select|continue|esac|while|until|return)(?=[\\\\&;\\\\s]|$)","name":"keyword.control.shell"},{"match":"(?<=^|[\\\\&;\\\\s])(?:export|declare|typeset|local|readonly)(?=[\\\\&;\\\\s]|$)","name":"storage.modifier.shell"}]},"line_comment":{"begin":"\\\\s*+(//)","beginCaptures":{"1":{"name":"punctuation.definition.comment.shell"}},"end":"(?<=\\\\n)(?<!\\\\\\\\\\\\n)","endCaptures":{},"name":"comment.line.double-slash.shell","patterns":[{"include":"#line_continuation_character"}]},"line_continuation":{"match":"\\\\\\\\(?=\\\\n)","name":"constant.character.escape.line-continuation.shell"},"logical-expression":{"patterns":[{"include":"#arithmetic_no_dollar"},{"match":"=[=~]?|!=?|[<>]|&&|\\\\|\\\\|","name":"keyword.operator.logical.shell"},{"match":"(?<!\\\\S)-(nt|ot|ef|eq|ne|l[et]|g[et]|[GLNOSa-hknopr-uwxz])\\\\b","name":"keyword.operator.logical.shell"}]},"logical_expression_context":{"patterns":[{"include":"#regex_comparison"},{"include":"#arithmetic_no_dollar"},{"include":"#logical-expression"},{"include":"#logical_expression_single"},{"include":"#logical_expression_double"},{"include":"#comment"},{"include":"#boolean"},{"include":"#redirect_number"},{"include":"#numeric_literal"},{"include":"#pipeline"},{"include":"#normal_statement_seperator"},{"include":"#string"},{"include":"#variable"},{"include":"#interpolation"},{"include":"#heredoc"},{"include":"#herestring"},{"include":"#pathname"},{"include":"#floating_keyword"},{"include":"#support"}]},"logical_expression_double":{"begin":"\\\\[\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"end":"]]","endCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"name":"meta.scope.logical-expression.shell","patterns":[{"include":"#logical_expression_context"}]},"logical_expression_single":{"begin":"\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"name":"meta.scope.logical-expression.shell","patterns":[{"include":"#logical_expression_context"}]},"loop":{"patterns":[{"begin":"(?<=^|[\\\\&;\\\\s])(for)\\\\s+(.+?)\\\\s+(in)(?=[\\\\&;\\\\s]|$)","beginCaptures":{"1":{"name":"keyword.control.shell"},"2":{"name":"variable.other.loop.shell","patterns":[{"include":"#string"}]},"3":{"name":"keyword.control.shell"}},"end":"(?<=^|[\\\\&;\\\\s])done(?=[\\\\&;\\\\s]|$|\\\\))","endCaptures":{"0":{"name":"keyword.control.shell"}},"name":"meta.scope.for-in-loop.shell","patterns":[{"include":"#initial_context"}]},{"begin":"(?<=^|[\\\\&;\\\\s])(while|until)(?=[\\\\&;\\\\s]|$)","beginCaptures":{"1":{"name":"keyword.control.shell"}},"end":"(?<=^|[\\\\&;\\\\s])done(?=[\\\\&;\\\\s]|$|\\\\))","endCaptures":{"0":{"name":"keyword.control.shell"}},"name":"meta.scope.while-loop.shell","patterns":[{"include":"#initial_context"}]},{"begin":"(?<=^|[\\\\&;\\\\s])(select)\\\\s+((?:[^\\\\\\\\\\\\s]|\\\\\\\\.)+)(?=[\\\\&;\\\\s]|$)","beginCaptures":{"1":{"name":"keyword.control.shell"},"2":{"name":"variable.other.loop.shell"}},"end":"(?<=^|[\\\\&;\\\\s])(done)(?=[\\\\&;\\\\s]|$|\\\\))","endCaptures":{"1":{"name":"keyword.control.shell"}},"name":"meta.scope.select-block.shell","patterns":[{"include":"#initial_context"}]},{"begin":"(?<=^|[\\\\&;\\\\s])if(?=[\\\\&;\\\\s]|$)","beginCaptures":{"0":{"name":"keyword.control.if.shell"}},"end":"(?<=^|[\\\\&;\\\\s])fi(?=[\\\\&;\\\\s]|$)","endCaptures":{"0":{"name":"keyword.control.fi.shell"}},"name":"meta.scope.if-block.shell","patterns":[{"include":"#initial_context"}]}]},"math":{"patterns":[{"include":"#variable"},{"match":"\\\\+{1,2}|-{1,2}|[!~]|\\\\*{1,2}|[%/]|<[<=]?|>[=>]?|==|!=|^|\\\\|{1,2}|&{1,2}|[,:=?]|[-%\\\\&*+/^|]=|<<=|>>=","name":"keyword.operator.arithmetic.shell"},{"match":"0[Xx]\\\\h+","name":"constant.numeric.hex.shell"},{"match":";","name":"punctuation.separator.semicolon.range"},{"match":"0\\\\d+","name":"constant.numeric.octal.shell"},{"match":"\\\\d{1,2}#[0-9@-Z_a-z]+","name":"constant.numeric.other.shell"},{"match":"\\\\d+","name":"constant.numeric.integer.shell"},{"match":"(?<!\\\\w)[0-9A-Z_a-z]+(?!\\\\w)","name":"variable.other.normal.shell"}]},"math_operators":{"patterns":[{"match":"\\\\+{1,2}|-{1,2}|[!~]|\\\\*{1,2}|[%/]|<[<=]?|>[=>]?|==|!=|^|\\\\|{1,2}|&{1,2}|[,:=?]|[-%\\\\&*+/^|]=|<<=|>>=","name":"keyword.operator.arithmetic.shell"},{"match":"0[Xx]\\\\h+","name":"constant.numeric.hex.shell"},{"match":"0\\\\d+","name":"constant.numeric.octal.shell"},{"match":"\\\\d{1,2}#[0-9@-Z_a-z]+","name":"constant.numeric.other.shell"},{"match":"\\\\d+","name":"constant.numeric.integer.shell"}]},"misc_ranges":{"patterns":[{"include":"#logical_expression_single"},{"include":"#logical_expression_double"},{"include":"#subshell_dollar"},{"begin":"(?<![^\\\\t ])(\\\\{)(?![$\\\\w])","beginCaptures":{"1":{"name":"punctuation.definition.group.shell"}},"end":"}","endCaptures":{"0":{"name":"punctuation.definition.group.shell"}},"name":"meta.scope.group.shell","patterns":[{"include":"#initial_context"}]}]},"modified_assignment_statement":{"begin":"(?<=^|[\\\\t \\\\&;])(?:readonly|declare|typeset|export|local)(?=[\\\\t \\\\&;]|$)","beginCaptures":{"0":{"name":"storage.modifier.$0.shell"}},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.statement.shell meta.expression.assignment.modified.shell","patterns":[{"match":"(?<!\\\\w)-\\\\w+\\\\b","name":"string.unquoted.argument.shell constant.other.option.shell"},{"include":"#array_value"},{"captures":{"1":{"name":"variable.other.assignment.shell"},"2":{"name":"punctuation.definition.array.access.shell"},"3":{"name":"variable.other.assignment.shell"},"4":{"name":"constant.numeric.shell constant.numeric.integer.shell"},"5":{"name":"punctuation.definition.array.access.shell"},"6":{"name":"keyword.operator.assignment.shell"},"7":{"name":"keyword.operator.assignment.compound.shell"},"8":{"name":"keyword.operator.assignment.compound.shell"},"9":{"name":"constant.numeric.shell constant.numeric.hex.shell"},"10":{"name":"constant.numeric.shell constant.numeric.octal.shell"},"11":{"name":"constant.numeric.shell constant.numeric.other.shell"},"12":{"name":"constant.numeric.shell constant.numeric.decimal.shell"},"13":{"name":"constant.numeric.shell constant.numeric.version.shell"},"14":{"name":"constant.numeric.shell constant.numeric.integer.shell"}},"match":"((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))(?:(\\\\[)((?:(?:\\\\$?(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)|@)|\\\\*)|(-?\\\\d+))(]))?(?:(?:(=)|(\\\\+=))|(-=))?(?:(?<=[\\\\t =]|^|[(\\\\[{])(?:(?:(?:(?:(?:(0[Xx]\\\\h+)|(0\\\\d+))|(\\\\d{1,2}#[0-9@-Z_a-z]+))|(-?\\\\d+\\\\.\\\\d+))|(-?\\\\d+(?:\\\\.\\\\d+)+))|(-?\\\\d+))(?=[\\\\t ]|$|[);}]))?"},{"include":"#normal_context"}]},"modifiers":{"match":"(?<=^|[\\\\t \\\\&;])(?:readonly|declare|typeset|export|local)(?=[\\\\t \\\\&;]|$)","name":"storage.modifier.$0.shell"},"normal_assignment_statement":{"begin":"[\\\\t ]*+((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))(?:(\\\\[)((?:(?:\\\\$?(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)|@)|\\\\*)|(-?\\\\d+))(]))?(?:(?:(=)|(\\\\+=))|(-=))","beginCaptures":{"1":{"name":"variable.other.assignment.shell"},"2":{"name":"punctuation.definition.array.access.shell"},"3":{"name":"variable.other.assignment.shell"},"4":{"name":"constant.numeric.shell constant.numeric.integer.shell"},"5":{"name":"punctuation.definition.array.access.shell"},"6":{"name":"keyword.operator.assignment.shell"},"7":{"name":"keyword.operator.assignment.compound.shell"},"8":{"name":"keyword.operator.assignment.compound.shell"}},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.expression.assignment.shell","patterns":[{"include":"#comment"},{"include":"#string"},{"include":"#normal_assignment_statement"},{"begin":"(?<=[\\\\t ])(?![\\\\t ]|\\\\w+=)","beginCaptures":{},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.statement.command.env.shell","patterns":[{"include":"#command_name_range"},{"include":"#line_continuation"},{"include":"#option"},{"include":"#argument"},{"include":"#string"}]},{"include":"#simple_unquoted"},{"include":"#normal_context"}]},"normal_context":{"patterns":[{"include":"#comment"},{"include":"#pipeline"},{"include":"#normal_statement_seperator"},{"include":"#misc_ranges"},{"include":"#boolean"},{"include":"#redirect_number"},{"include":"#numeric_literal"},{"include":"#string"},{"include":"#variable"},{"include":"#interpolation"},{"include":"#heredoc"},{"include":"#herestring"},{"include":"#redirection"},{"include":"#pathname"},{"include":"#floating_keyword"},{"include":"#support"},{"include":"#parenthese"}]},"normal_statement":{"begin":"(?!^[\\\\t ]*+$)(?:(?<=(?:^until| until|\\\\tuntil|^while| while|\\\\twhile|^elif| elif|\\\\telif|^else| else|\\\\telse|^then| then|\\\\tthen|^do| do|\\\\tdo|^if| if|\\\\tif) )|(?<=^|[!\\\\&(;`{|]))[\\\\t ]*+(?!nocorrect\\\\W|nocorrect\\\\$|function\\\\W|function\\\\$|foreach\\\\W|foreach\\\\$|repeat\\\\W|repeat\\\\$|logout\\\\W|logout\\\\$|coproc\\\\W|coproc\\\\$|select\\\\W|select\\\\$|while\\\\W|while\\\\$|pushd\\\\W|pushd\\\\$|until\\\\W|until\\\\$|case\\\\W|case\\\\$|done\\\\W|done\\\\$|elif\\\\W|elif\\\\$|else\\\\W|else\\\\$|esac\\\\W|esac\\\\$|popd\\\\W|popd\\\\$|then\\\\W|then\\\\$|time\\\\W|time\\\\$|for\\\\W|for\\\\$|end\\\\W|end\\\\$|fi\\\\W|fi\\\\$|do\\\\W|do\\\\$|in\\\\W|in\\\\$|if\\\\W|if\\\\$)","beginCaptures":{},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.statement.shell","patterns":[{"include":"#typical_statements"}]},"normal_statement_seperator":{"captures":{"1":{"name":"punctuation.terminator.statement.semicolon.shell"},"2":{"name":"punctuation.separator.statement.and.shell"},"3":{"name":"punctuation.separator.statement.or.shell"},"4":{"name":"punctuation.separator.statement.background.shell"}},"match":"(?:(?:(;)|(&&))|(\\\\|\\\\|))|(&)"},"numeric_literal":{"captures":{"1":{"name":"constant.numeric.shell constant.numeric.hex.shell"},"2":{"name":"constant.numeric.shell constant.numeric.octal.shell"},"3":{"name":"constant.numeric.shell constant.numeric.other.shell"},"4":{"name":"constant.numeric.shell constant.numeric.decimal.shell"},"5":{"name":"constant.numeric.shell constant.numeric.version.shell"},"6":{"name":"constant.numeric.shell constant.numeric.integer.shell"}},"match":"(?<=[\\\\t =]|^|[(\\\\[{])(?:(?:(?:(?:(?:(0[Xx]\\\\h+)|(0\\\\d+))|(\\\\d{1,2}#[0-9@-Z_a-z]+))|(-?\\\\d+\\\\.\\\\d+))|(-?\\\\d+(?:\\\\.\\\\d+)+))|(-?\\\\d+))(?=[\\\\t ]|$|[);}])"},"option":{"begin":"[\\\\t ]++(-)((?![\\\\n!#\\\\&()<>\\\\[{|]|$|[\\\\t ;]))","beginCaptures":{"1":{"name":"string.unquoted.argument.shell constant.other.option.dash.shell"},"2":{"name":"string.unquoted.argument.shell constant.other.option.shell"}},"contentName":"string.unquoted.argument constant.other.option","end":"(?=[\\\\t ])|(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"patterns":[{"include":"#option_context"}]},"option_context":{"patterns":[{"include":"#misc_ranges"},{"include":"#string"},{"include":"#variable"},{"include":"#interpolation"},{"include":"#heredoc"},{"include":"#herestring"},{"include":"#redirection"},{"include":"#pathname"},{"include":"#floating_keyword"},{"include":"#support"}]},"parenthese":{"patterns":[{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.section.parenthese.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.section.parenthese.shell"}},"name":"meta.parenthese.group.shell","patterns":[{"include":"#initial_context"}]}]},"pathname":{"patterns":[{"match":"(?<=[:=\\\\s]|^)~","name":"keyword.operator.tilde.shell"},{"match":"[*?]","name":"keyword.operator.glob.shell"},{"begin":"([!*+?@])(\\\\()","beginCaptures":{"1":{"name":"keyword.operator.extglob.shell"},"2":{"name":"punctuation.definition.extglob.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.extglob.shell"}},"name":"meta.structure.extglob.shell","patterns":[{"include":"#initial_context"}]}]},"pipeline":{"patterns":[{"match":"(?<=^|[\\\\&;\\\\s])(time)(?=[\\\\&;\\\\s]|$)","name":"keyword.other.shell"},{"match":"[!|]","name":"keyword.operator.pipe.shell"}]},"redirect_fix":{"captures":{"1":{"name":"keyword.operator.redirect.shell"},"2":{"name":"string.unquoted.argument.shell"}},"match":"(>>?)[\\\\t ]*+([^\\\\t\\\\n \\"$\\\\&-);<>\\\\\\\\`|]+)"},"redirect_number":{"captures":{"1":{"name":"keyword.operator.redirect.stdout.shell"},"2":{"name":"keyword.operator.redirect.stderr.shell"},"3":{"name":"keyword.operator.redirect.$3.shell"}},"match":"(?<=[\\\\t ])(?:(1)|(2)|(\\\\d+))(?=>)"},"redirection":{"patterns":[{"begin":"[<>]\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.string.end.shell"}},"name":"string.interpolated.process-substitution.shell","patterns":[{"include":"#initial_context"}]},{"match":"(?<![<>])(&>|\\\\d*>&\\\\d*|\\\\d*(>>|[<>])|\\\\d*<&|\\\\d*<>)(?![<>])","name":"keyword.operator.redirect.shell"}]},"regex_comparison":{"match":"=~","name":"keyword.operator.logical.regex.shell"},"regexp":{"patterns":[{"match":".+"}]},"simple_options":{"captures":{"0":{"patterns":[{"captures":{"1":{"name":"string.unquoted.argument.shell constant.other.option.dash.shell"},"2":{"name":"string.unquoted.argument.shell constant.other.option.shell"}},"match":"[\\\\t ]++(-)(\\\\w+)"}]}},"match":"(?:[\\\\t ]++-\\\\w+)*"},"simple_unquoted":{"match":"[^\\\\t\\\\n \\"$\\\\&-);<>\\\\\\\\`|]","name":"string.unquoted.shell"},"special_expansion":{"match":"!|:[-=?]?|[*@]|##?|%%|[%/]","name":"keyword.operator.expansion.shell"},"start_of_command":{"match":"[\\\\t ]*+(?![\\\\n!#\\\\&()<>\\\\[{|]|$|[\\\\t ;])(?!nocorrect |nocorrect\\\\t|nocorrect$|readonly |readonly\\\\t|readonly$|function |function\\\\t|function$|foreach |foreach\\\\t|foreach$|coproc |coproc\\\\t|coproc$|logout |logout\\\\t|logout$|export |export\\\\t|export$|select |select\\\\t|select$|repeat |repeat\\\\t|repeat$|pushd |pushd\\\\t|pushd$|until |until\\\\t|until$|while |while\\\\t|while$|local |local\\\\t|local$|case |case\\\\t|case$|done |done\\\\t|done$|elif |elif\\\\t|elif$|else |else\\\\t|else$|esac |esac\\\\t|esac$|popd |popd\\\\t|popd$|then |then\\\\t|then$|time |time\\\\t|time$|for |for\\\\t|for$|end |end\\\\t|end$|fi |fi\\\\t|fi$|do |do\\\\t|do$|in |in\\\\t|in$|if |if\\\\t|if$)(?!\\\\\\\\\\\\n?$)"},"string":{"patterns":[{"match":"\\\\\\\\.","name":"constant.character.escape.shell"},{"begin":"\'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.shell"}},"end":"\'","endCaptures":{"0":{"name":"punctuation.definition.string.end.shell"}},"name":"string.quoted.single.shell"},{"begin":"\\\\$?\\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.shell"}},"end":"\\"","endCaptures":{"0":{"name":"punctuation.definition.string.end.shell"}},"name":"string.quoted.double.shell","patterns":[{"match":"\\\\\\\\[\\\\n\\"$\\\\\\\\`]","name":"constant.character.escape.shell"},{"include":"#variable"},{"include":"#interpolation"}]},{"begin":"\\\\$\'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.shell"}},"end":"\'","endCaptures":{"0":{"name":"punctuation.definition.string.end.shell"}},"name":"string.quoted.single.dollar.shell","patterns":[{"match":"\\\\\\\\[\'\\\\\\\\abefnrtv]","name":"constant.character.escape.ansi-c.shell"},{"match":"\\\\\\\\[0-9]{3}\\"","name":"constant.character.escape.octal.shell"},{"match":"\\\\\\\\x\\\\h{2}\\"","name":"constant.character.escape.hex.shell"},{"match":"\\\\\\\\c.\\"","name":"constant.character.escape.control-char.shell"}]}]},"subshell_dollar":{"patterns":[{"begin":"\\\\$\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.subshell.single.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.subshell.single.shell"}},"name":"meta.scope.subshell","patterns":[{"include":"#parenthese"},{"include":"#initial_context"}]}]},"support":{"patterns":[{"match":"(?<=^|[\\\\&;\\\\s])[.:](?=[\\\\&;\\\\s]|$)","name":"support.function.builtin.shell"}]},"typical_statements":{"patterns":[{"include":"#assignment_statement"},{"include":"#case_statement"},{"include":"#for_statement"},{"include":"#while_statement"},{"include":"#function_definition"},{"include":"#command_statement"},{"include":"#line_continuation"},{"include":"#arithmetic_double"},{"include":"#normal_context"}]},"variable":{"patterns":[{"captures":{"1":{"name":"punctuation.definition.variable.shell variable.parameter.positional.all.shell"},"2":{"name":"variable.parameter.positional.all.shell"}},"match":"(\\\\$)(@(?!\\\\w))"},{"captures":{"1":{"name":"punctuation.definition.variable.shell variable.parameter.positional.shell"},"2":{"name":"variable.parameter.positional.shell"}},"match":"(\\\\$)([0-9](?!\\\\w))"},{"captures":{"1":{"name":"punctuation.definition.variable.shell variable.language.special.shell"},"2":{"name":"variable.language.special.shell"}},"match":"(\\\\$)([-!#$*0?_](?!\\\\w))"},{"begin":"(\\\\$)(\\\\{)[\\\\t ]*+(?=\\\\d)","beginCaptures":{"1":{"name":"punctuation.definition.variable.shell variable.parameter.positional.shell"},"2":{"name":"punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell variable.parameter.positional.shell"}},"contentName":"meta.parameter-expansion","end":"}","endCaptures":{"0":{"name":"punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell variable.parameter.positional.shell"}},"patterns":[{"include":"#special_expansion"},{"include":"#array_access_inline"},{"match":"[0-9]+","name":"variable.parameter.positional.shell"},{"match":"(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)","name":"variable.other.normal.shell"},{"include":"#variable"},{"include":"#string"}]},{"begin":"(\\\\$)(\\\\{)","beginCaptures":{"1":{"name":"punctuation.definition.variable.shell"},"2":{"name":"punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell"}},"contentName":"meta.parameter-expansion","end":"}","endCaptures":{"0":{"name":"punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell"}},"patterns":[{"include":"#special_expansion"},{"include":"#array_access_inline"},{"match":"(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)","name":"variable.other.normal.shell"},{"include":"#variable"},{"include":"#string"}]},{"captures":{"1":{"name":"punctuation.definition.variable.shell variable.other.normal.shell"},"2":{"name":"variable.other.normal.shell"}},"match":"(\\\\$)(\\\\w+(?!\\\\w))"}]},"while_statement":{"patterns":[{"begin":"\\\\b(while)\\\\b","beginCaptures":{"1":{"name":"keyword.control.while.shell"}},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.while.shell","patterns":[{"include":"#line_continuation"},{"include":"#math_operators"},{"include":"#option"},{"include":"#simple_unquoted"},{"include":"#normal_context"},{"include":"#string"}]}]}},"scopeName":"source.shell","aliases":["bash","sh","shell","zsh"]}')),ca=[e];
2
- export{ca};
1
+ var e=Object.freeze(JSON.parse('{"displayName":"Shell","name":"shellscript","patterns":[{"include":"#initial_context"}],"repository":{"alias_statement":{"begin":"[\\\\t ]*+(alias)[\\\\t ]*+((?:((?<!\\\\w)-\\\\w+)\\\\b[\\\\t ]*+)*)[\\\\t ]*+((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))(?:(\\\\[)((?:(?:\\\\$?(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)|@)|\\\\*)|(-?\\\\d+))(]))?(?:(?:(=)|(\\\\+=))|(-=))","beginCaptures":{"1":{"name":"storage.type.alias.shell"},"2":{"patterns":[{"match":"(?<!\\\\w)-\\\\w+\\\\b","name":"string.unquoted.argument.shell constant.other.option.shell"}]},"3":{"name":"string.unquoted.argument.shell constant.other.option.shell"},"4":{"name":"variable.other.assignment.shell"},"5":{"name":"punctuation.definition.array.access.shell"},"6":{"name":"variable.other.assignment.shell"},"7":{"name":"constant.numeric.shell constant.numeric.integer.shell"},"8":{"name":"punctuation.definition.array.access.shell"},"9":{"name":"keyword.operator.assignment.shell"},"10":{"name":"keyword.operator.assignment.compound.shell"},"11":{"name":"keyword.operator.assignment.compound.shell"}},"end":"(?=[\\\\t ]|$)|(?:(?:(?:(;)|(&&))|(\\\\|\\\\|))|(&))","endCaptures":{"1":{"name":"punctuation.terminator.statement.semicolon.shell"},"2":{"name":"punctuation.separator.statement.and.shell"},"3":{"name":"punctuation.separator.statement.or.shell"},"4":{"name":"punctuation.separator.statement.background.shell"}},"name":"meta.expression.assignment.alias.shell","patterns":[{"include":"#normal_context"}]},"argument":{"begin":"[\\\\t ]++(?![\\\\n#\\\\&(\\\\[|]|$|;)","beginCaptures":{},"end":"(?=[\\\\t \\\\&;|]|$|[\\\\n)`])","endCaptures":{},"name":"meta.argument.shell","patterns":[{"include":"#argument_context"},{"include":"#line_continuation"}]},"argument_context":{"patterns":[{"captures":{"1":{"name":"string.unquoted.argument.shell","patterns":[{"match":"\\\\*","name":"variable.language.special.wildcard.shell"},{"include":"#variable"},{"include":"#numeric_literal"},{"captures":{"1":{"name":"constant.language.$1.shell"}},"match":"(?<!\\\\w)\\\\b(true|false)\\\\b(?!\\\\w)"}]}},"match":"[\\\\t ]*+([^\\\\t\\\\n \\"$\\\\&-);<>\\\\\\\\`|]+(?!>))"},{"include":"#normal_context"}]},"arithmetic_double":{"patterns":[{"begin":"\\\\(\\\\(","beginCaptures":{"0":{"name":"punctuation.section.arithmetic.double.shell"}},"end":"\\\\)\\\\s*\\\\)","endCaptures":{"0":{"name":"punctuation.section.arithmetic.double.shell"}},"name":"meta.arithmetic.shell","patterns":[{"include":"#math"},{"include":"#string"}]}]},"arithmetic_no_dollar":{"patterns":[{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.section.arithmetic.single.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.section.arithmetic.single.shell"}},"name":"meta.arithmetic.shell","patterns":[{"include":"#math"},{"include":"#string"}]}]},"array_access_inline":{"captures":{"1":{"name":"punctuation.section.array.shell"},"2":{"patterns":[{"include":"#special_expansion"},{"include":"#string"},{"include":"#variable"}]},"3":{"name":"punctuation.section.array.shell"}},"match":"(\\\\[)([^]\\\\[]+)(])"},"array_value":{"begin":"[\\\\t ]*+((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))(?:(\\\\[)((?:(?:\\\\$?(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)|@)|\\\\*)|(-?\\\\d+))(]))?(?:(?:(=)|(\\\\+=))|(-=))[\\\\t ]*+(\\\\()","beginCaptures":{"1":{"name":"variable.other.assignment.shell"},"2":{"name":"punctuation.definition.array.access.shell"},"3":{"name":"variable.other.assignment.shell"},"4":{"name":"constant.numeric.shell constant.numeric.integer.shell"},"5":{"name":"punctuation.definition.array.access.shell"},"6":{"name":"keyword.operator.assignment.shell"},"7":{"name":"keyword.operator.assignment.compound.shell"},"8":{"name":"keyword.operator.assignment.compound.shell"},"9":{"name":"punctuation.definition.array.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.array.shell"}},"patterns":[{"include":"#comment"},{"captures":{"1":{"name":"variable.other.assignment.array.shell entity.other.attribute-name.shell"},"2":{"name":"keyword.operator.assignment.shell punctuation.definition.assignment.shell"}},"match":"((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))(=)"},{"captures":{"1":{"name":"punctuation.definition.bracket.named-array.shell"},"2":{"name":"string.unquoted.shell entity.other.attribute-name.bracket.shell"},"3":{"name":"punctuation.definition.bracket.named-array.shell"},"4":{"name":"punctuation.definition.assignment.shell"}},"match":"(\\\\[)(.+?)(])(=)"},{"include":"#normal_context"},{"include":"#simple_unquoted"}]},"assignment_statement":{"patterns":[{"include":"#array_value"},{"include":"#modified_assignment_statement"},{"include":"#normal_assignment_statement"}]},"basic_command_name":{"captures":{"1":{"name":"storage.modifier.$1.shell"},"2":{"name":"entity.name.function.call.shell entity.name.command.shell","patterns":[{"match":"(?<!\\\\w)(?:continue|return|break)(?!\\\\w)","name":"keyword.control.$0.shell"},{"match":"(?<!\\\\w)(?:unfunction|continue|autoload|unsetopt|bindkey|builtin|getopts|command|declare|unalias|history|unlimit|typeset|suspend|source|printf|unhash|disown|ulimit|return|which|alias|break|false|print|shift|times|umask|unset|read|type|exec|eval|wait|echo|dirs|jobs|kill|hash|stat|exit|test|trap|true|let|set|pwd|cd|fg|bg|fc|[.:])(?!/)(?!\\\\w)(?!-)","name":"support.function.builtin.shell"},{"include":"#variable"}]}},"match":"(?![\\\\n!#\\\\&()<>\\\\[{|]|$|[\\\\t ;])(?!nocorrect |nocorrect\\\\t|nocorrect$|readonly |readonly\\\\t|readonly$|function |function\\\\t|function$|foreach |foreach\\\\t|foreach$|coproc |coproc\\\\t|coproc$|logout |logout\\\\t|logout$|export |export\\\\t|export$|select |select\\\\t|select$|repeat |repeat\\\\t|repeat$|pushd |pushd\\\\t|pushd$|until |until\\\\t|until$|while |while\\\\t|while$|local |local\\\\t|local$|case |case\\\\t|case$|done |done\\\\t|done$|elif |elif\\\\t|elif$|else |else\\\\t|else$|esac |esac\\\\t|esac$|popd |popd\\\\t|popd$|then |then\\\\t|then$|time |time\\\\t|time$|for |for\\\\t|for$|end |end\\\\t|end$|fi |fi\\\\t|fi$|do |do\\\\t|do$|in |in\\\\t|in$|if |if\\\\t|if$)(?:((?<=^|[\\\\t \\\\&;])(?:readonly|declare|typeset|export|local)(?=[\\\\t \\\\&;]|$))|((?![\\"\']|\\\\\\\\\\\\n?$)[^\\\\t\\\\n\\\\r !\\"\'<>]+?))(?:(?=[\\\\t ])|(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\))","name":"meta.statement.command.name.basic.shell"},"block_comment":{"begin":"\\\\s*+(/\\\\*)","beginCaptures":{"1":{"name":"punctuation.definition.comment.begin.shell"}},"end":"\\\\*/","endCaptures":{"0":{"name":"punctuation.definition.comment.end.shell"}},"name":"comment.block.shell"},"boolean":{"match":"\\\\b(?:true|false)\\\\b","name":"constant.language.$0.shell"},"case_statement":{"begin":"\\\\b(case)\\\\b[\\\\t ]*+(.+?)[\\\\t ]*+\\\\b(in)\\\\b","beginCaptures":{"1":{"name":"keyword.control.case.shell"},"2":{"patterns":[{"include":"#initial_context"}]},"3":{"name":"keyword.control.in.shell"}},"end":"\\\\besac\\\\b","endCaptures":{"0":{"name":"keyword.control.esac.shell"}},"name":"meta.case.shell","patterns":[{"include":"#comment"},{"captures":{"1":{"name":"keyword.operator.pattern.case.default.shell"}},"match":"[\\\\t ]*+(\\\\* *\\\\))"},{"begin":"(?<!\\\\))(?![\\\\t ]*+(?:esac\\\\b|$))","beginCaptures":{},"end":"(?=\\\\besac\\\\b)|(\\\\))","endCaptures":{"1":{"name":"keyword.operator.pattern.case.shell"}},"name":"meta.case.entry.pattern.shell","patterns":[{"include":"#case_statement_context"}]},{"begin":"(?<=\\\\))","beginCaptures":{},"end":"(;;)|(?=\\\\besac\\\\b)","endCaptures":{"1":{"name":"punctuation.terminator.statement.case.shell"}},"name":"meta.case.entry.body.shell","patterns":[{"include":"#typical_statements"},{"include":"#initial_context"}]}]},"case_statement_context":{"patterns":[{"match":"\\\\*","name":"variable.language.special.quantifier.star.shell keyword.operator.quantifier.star.shell punctuation.definition.arbitrary-repetition.shell punctuation.definition.regex.arbitrary-repetition.shell"},{"match":"\\\\+","name":"variable.language.special.quantifier.plus.shell keyword.operator.quantifier.plus.shell punctuation.definition.arbitrary-repetition.shell punctuation.definition.regex.arbitrary-repetition.shell"},{"match":"\\\\?","name":"variable.language.special.quantifier.question.shell keyword.operator.quantifier.question.shell punctuation.definition.arbitrary-repetition.shell punctuation.definition.regex.arbitrary-repetition.shell"},{"match":"@","name":"variable.language.special.at.shell keyword.operator.at.shell punctuation.definition.regex.at.shell"},{"match":"\\\\|","name":"keyword.operator.orvariable.language.special.or.shell keyword.operator.alternation.ruby.shell punctuation.definition.regex.alternation.shell punctuation.separator.regex.alternation.shell"},{"match":"\\\\\\\\.","name":"constant.character.escape.shell"},{"match":"(?<=\\\\tin| in|[\\\\t ]|;;)\\\\(","name":"keyword.operator.pattern.case.shell"},{"begin":"(?<=\\\\S)(\\\\()","beginCaptures":{"1":{"name":"punctuation.definition.group.shell punctuation.definition.regex.group.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.definition.regex.group.shell"}},"name":"meta.parenthese.shell","patterns":[{"include":"#case_statement_context"}]},{"begin":"\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.character-class.shell"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.character-class.shell"}},"name":"string.regexp.character-class.shell","patterns":[{"match":"\\\\\\\\.","name":"constant.character.escape.shell"}]},{"include":"#string"},{"match":"[^\\\\t\\\\n )*?@\\\\[|]","name":"string.unquoted.pattern.shell string.regexp.unquoted.shell"}]},"command_name_range":{"begin":"\\\\G","beginCaptures":{},"end":"(?=[\\\\t \\\\&;|]|$|[\\\\n)`])|(?=<)","endCaptures":{},"name":"meta.statement.command.name.shell","patterns":[{"match":"(?<!\\\\w)(?:continue|return|break)(?!\\\\w)","name":"entity.name.function.call.shell entity.name.command.shell keyword.control.$0.shell"},{"match":"(?<!\\\\w)(?:unfunction|continue|autoload|unsetopt|bindkey|builtin|getopts|command|declare|unalias|history|unlimit|typeset|suspend|source|printf|unhash|disown|ulimit|return|which|alias|break|false|print|shift|times|umask|unset|read|type|exec|eval|wait|echo|dirs|jobs|kill|hash|stat|exit|test|trap|true|let|set|pwd|cd|fg|bg|fc|[.:])(?!/)(?!\\\\w)(?!-)","name":"entity.name.function.call.shell entity.name.command.shell support.function.builtin.shell"},{"include":"#variable"},{"captures":{"1":{"name":"entity.name.function.call.shell entity.name.command.shell"}},"match":"(?<!\\\\w)(?<=\\\\G|[\\"\')}])([^\\\\t\\\\n\\\\r \\"\\\\&\');->`{|]+)"},{"begin":"(?:\\\\G|(?<![\\\\t\\\\n #\\\\&;{|]))(\\\\$?)((\\")|(\'))","beginCaptures":{"1":{"name":"meta.statement.command.name.quoted.shell punctuation.definition.string.shell entity.name.function.call.shell entity.name.command.shell"},"2":{},"3":{"name":"meta.statement.command.name.quoted.shell string.quoted.double.shell punctuation.definition.string.begin.shell entity.name.function.call.shell entity.name.command.shell"},"4":{"name":"meta.statement.command.name.quoted.shell string.quoted.single.shell punctuation.definition.string.begin.shell entity.name.function.call.shell entity.name.command.shell"}},"end":"(?<!\\\\G)(?<=\\\\2)","endCaptures":{},"patterns":[{"include":"#continuation_of_single_quoted_command_name"},{"include":"#continuation_of_double_quoted_command_name"}]},{"include":"#line_continuation"},{"include":"#simple_unquoted"}]},"command_statement":{"begin":"[\\\\t ]*+(?![\\\\n!#\\\\&()<>\\\\[{|]|$|[\\\\t ;])(?!nocorrect |nocorrect\\\\t|nocorrect$|readonly |readonly\\\\t|readonly$|function |function\\\\t|function$|foreach |foreach\\\\t|foreach$|coproc |coproc\\\\t|coproc$|logout |logout\\\\t|logout$|export |export\\\\t|export$|select |select\\\\t|select$|repeat |repeat\\\\t|repeat$|pushd |pushd\\\\t|pushd$|until |until\\\\t|until$|while |while\\\\t|while$|local |local\\\\t|local$|case |case\\\\t|case$|done |done\\\\t|done$|elif |elif\\\\t|elif$|else |else\\\\t|else$|esac |esac\\\\t|esac$|popd |popd\\\\t|popd$|then |then\\\\t|then$|time |time\\\\t|time$|for |for\\\\t|for$|end |end\\\\t|end$|fi |fi\\\\t|fi$|do |do\\\\t|do$|in |in\\\\t|in$|if |if\\\\t|if$)(?!\\\\\\\\\\\\n?$)","beginCaptures":{},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.statement.command.shell","patterns":[{"include":"#command_name_range"},{"include":"#line_continuation"},{"include":"#option"},{"include":"#argument"},{"include":"#string"},{"include":"#heredoc"}]},"comment":{"captures":{"1":{"name":"comment.line.number-sign.shell meta.shebang.shell"},"2":{"name":"punctuation.definition.comment.shebang.shell"},"3":{"name":"comment.line.number-sign.shell"},"4":{"name":"punctuation.definition.comment.shell"}},"match":"(?:^|[\\\\t ]++)(?:((#!).*)|((#).*))"},"comments":{"patterns":[{"include":"#block_comment"},{"include":"#line_comment"}]},"compound-command":{"patterns":[{"begin":"\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"name":"meta.scope.logical-expression.shell","patterns":[{"include":"#logical-expression"},{"include":"#initial_context"}]},{"begin":"(?<=\\\\s|^)\\\\{(?=\\\\s|$)","beginCaptures":{"0":{"name":"punctuation.definition.group.shell"}},"end":"(?<=^|;)\\\\s*(})","endCaptures":{"1":{"name":"punctuation.definition.group.shell"}},"name":"meta.scope.group.shell","patterns":[{"include":"#initial_context"}]}]},"continuation_of_double_quoted_command_name":{"begin":"\\\\G(?<=\\")","beginCaptures":{},"contentName":"meta.statement.command.name.continuation string.quoted.double entity.name.function.call entity.name.command","end":"\\"","endCaptures":{"0":{"name":"string.quoted.double.shell punctuation.definition.string.end.shell entity.name.function.call.shell entity.name.command.shell"}},"patterns":[{"match":"\\\\\\\\[\\\\n\\"$\\\\\\\\`]","name":"constant.character.escape.shell"},{"include":"#variable"},{"include":"#interpolation"}]},"continuation_of_single_quoted_command_name":{"begin":"\\\\G(?<=\')","beginCaptures":{},"contentName":"meta.statement.command.name.continuation string.quoted.single entity.name.function.call entity.name.command","end":"\'","endCaptures":{"0":{"name":"string.quoted.single.shell punctuation.definition.string.end.shell entity.name.function.call.shell entity.name.command.shell"}}},"custom_command_names":{"patterns":[]},"custom_commands":{"patterns":[]},"double_quote_context":{"patterns":[{"match":"\\\\\\\\[\\\\n\\"$\\\\\\\\`]","name":"constant.character.escape.shell"},{"include":"#variable"},{"include":"#interpolation"}]},"double_quote_escape_char":{"match":"\\\\\\\\[\\\\n\\"$\\\\\\\\`]","name":"constant.character.escape.shell"},"floating_keyword":{"patterns":[{"match":"(?<=^|[\\\\t \\\\&;])(?:then|elif|else|done|end|do|if|fi)(?=[\\\\t \\\\&;]|$)","name":"keyword.control.$0.shell"}]},"for_statement":{"patterns":[{"begin":"\\\\b(for)\\\\b[\\\\t ]*+((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))[\\\\t ]*+\\\\b(in)\\\\b","beginCaptures":{"1":{"name":"keyword.control.for.shell"},"2":{"name":"variable.other.for.shell"},"3":{"name":"keyword.control.in.shell"}},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.for.in.shell","patterns":[{"include":"#string"},{"include":"#simple_unquoted"},{"include":"#normal_context"}]},{"begin":"\\\\b(for)\\\\b","beginCaptures":{"1":{"name":"keyword.control.for.shell"}},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.for.shell","patterns":[{"include":"#arithmetic_double"},{"include":"#normal_context"}]}]},"function_definition":{"applyEndPatternLast":1,"begin":"[\\\\t ]*+(?:\\\\b(function)\\\\b[\\\\t ]*+([^\\\\t\\\\n\\\\r \\"\'()=]+)(?:(\\\\()[\\\\t ]*+(\\\\)))?|([^\\\\t\\\\n\\\\r \\"\'()=]+)[\\\\t ]*+(\\\\()[\\\\t ]*+(\\\\)))","beginCaptures":{"1":{"name":"storage.type.function.shell"},"2":{"name":"entity.name.function.shell"},"3":{"name":"punctuation.definition.arguments.shell"},"4":{"name":"punctuation.definition.arguments.shell"},"5":{"name":"entity.name.function.shell"},"6":{"name":"punctuation.definition.arguments.shell"},"7":{"name":"punctuation.definition.arguments.shell"}},"end":"(?<=[)}])","endCaptures":{},"name":"meta.function.shell","patterns":[{"match":"\\\\G[\\\\t\\\\n ]"},{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.section.function.definition.shell"}},"end":"}","endCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.section.function.definition.shell"}},"name":"meta.function.body.shell","patterns":[{"include":"#initial_context"}]},{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.section.function.definition.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.section.function.definition.shell"}},"name":"meta.function.body.shell","patterns":[{"include":"#initial_context"}]},{"include":"#initial_context"}]},"heredoc":{"patterns":[{"begin":"((?<!<)<<-)[\\\\t ]*+([\\"\'])[\\\\t ]*+([^\\"\']+?)(?=[\\"\\\\&\';<\\\\s])(\\\\2)(.*)","beginCaptures":{"1":{"name":"keyword.operator.heredoc.shell"},"2":{"name":"punctuation.definition.string.heredoc.quote.shell"},"3":{"name":"punctuation.definition.string.heredoc.delimiter.shell"},"4":{"name":"punctuation.definition.string.heredoc.quote.shell"},"5":{"patterns":[{"include":"#redirect_fix"},{"include":"#typical_statements"}]}},"contentName":"string.quoted.heredoc.indent.$3","end":"^\\\\t*\\\\3(?=[\\\\&;\\\\s]|$)","endCaptures":{"0":{"name":"punctuation.definition.string.heredoc.$0.shell"}},"patterns":[]},{"begin":"((?<!<)<<(?!<))[\\\\t ]*+([\\"\'])[\\\\t ]*+([^\\"\']+?)(?=[\\"\\\\&\';<\\\\s])(\\\\2)(.*)","beginCaptures":{"1":{"name":"keyword.operator.heredoc.shell"},"2":{"name":"punctuation.definition.string.heredoc.quote.shell"},"3":{"name":"punctuation.definition.string.heredoc.delimiter.shell"},"4":{"name":"punctuation.definition.string.heredoc.quote.shell"},"5":{"patterns":[{"include":"#redirect_fix"},{"include":"#typical_statements"}]}},"contentName":"string.quoted.heredoc.no-indent.$3","end":"^\\\\3(?=[\\\\&;\\\\s]|$)","endCaptures":{"0":{"name":"punctuation.definition.string.heredoc.delimiter.shell"}},"patterns":[]},{"begin":"((?<!<)<<-)[\\\\t ]*+([^\\\\t \\"\']+)(?=[\\"\\\\&\';<\\\\s])(.*)","beginCaptures":{"1":{"name":"keyword.operator.heredoc.shell"},"2":{"name":"punctuation.definition.string.heredoc.delimiter.shell"},"3":{"patterns":[{"include":"#redirect_fix"},{"include":"#typical_statements"}]}},"contentName":"string.unquoted.heredoc.indent.$2","end":"^\\\\t*\\\\2(?=[\\\\&;\\\\s]|$)","endCaptures":{"0":{"name":"punctuation.definition.string.heredoc.delimiter.shell"}},"patterns":[{"include":"#double_quote_escape_char"},{"include":"#variable"},{"include":"#interpolation"}]},{"begin":"((?<!<)<<(?!<))[\\\\t ]*+([^\\\\t \\"\']+)(?=[\\"\\\\&\';<\\\\s])(.*)","beginCaptures":{"1":{"name":"keyword.operator.heredoc.shell"},"2":{"name":"punctuation.definition.string.heredoc.delimiter.shell"},"3":{"patterns":[{"include":"#redirect_fix"},{"include":"#typical_statements"}]}},"contentName":"string.unquoted.heredoc.no-indent.$2","end":"^\\\\2(?=[\\\\&;\\\\s]|$)","endCaptures":{"0":{"name":"punctuation.definition.string.heredoc.delimiter.shell"}},"patterns":[{"include":"#double_quote_escape_char"},{"include":"#variable"},{"include":"#interpolation"}]}]},"herestring":{"patterns":[{"begin":"(<<<)\\\\s*((\'))","beginCaptures":{"1":{"name":"keyword.operator.herestring.shell"},"2":{"name":"string.quoted.single.shell"},"3":{"name":"punctuation.definition.string.begin.shell"}},"contentName":"string.quoted.single.shell","end":"(\')","endCaptures":{"0":{"name":"string.quoted.single.shell"},"1":{"name":"punctuation.definition.string.end.shell"}},"name":"meta.herestring.shell"},{"begin":"(<<<)\\\\s*((\\"))","beginCaptures":{"1":{"name":"keyword.operator.herestring.shell"},"2":{"name":"string.quoted.double.shell"},"3":{"name":"punctuation.definition.string.begin.shell"}},"contentName":"string.quoted.double.shell","end":"(\\")","endCaptures":{"0":{"name":"string.quoted.double.shell"},"1":{"name":"punctuation.definition.string.end.shell"}},"name":"meta.herestring.shell","patterns":[{"include":"#double_quote_context"}]},{"captures":{"1":{"name":"keyword.operator.herestring.shell"},"2":{"name":"string.unquoted.herestring.shell","patterns":[{"include":"#initial_context"}]}},"match":"(<<<)\\\\s*(([^)\\\\\\\\\\\\s]|\\\\\\\\.)+)","name":"meta.herestring.shell"}]},"initial_context":{"patterns":[{"include":"#comment"},{"include":"#pipeline"},{"include":"#normal_statement_seperator"},{"include":"#logical_expression_double"},{"include":"#logical_expression_single"},{"include":"#assignment_statement"},{"include":"#case_statement"},{"include":"#for_statement"},{"include":"#loop"},{"include":"#function_definition"},{"include":"#line_continuation"},{"include":"#arithmetic_double"},{"include":"#misc_ranges"},{"include":"#variable"},{"include":"#interpolation"},{"include":"#heredoc"},{"include":"#herestring"},{"include":"#redirection"},{"include":"#pathname"},{"include":"#floating_keyword"},{"include":"#alias_statement"},{"include":"#normal_statement"},{"include":"#string"},{"include":"#support"}]},"inline_comment":{"captures":{"1":{"name":"comment.block.shell punctuation.definition.comment.begin.shell"},"2":{"name":"comment.block.shell"},"3":{"patterns":[{"match":"\\\\*/","name":"comment.block.shell punctuation.definition.comment.end.shell"},{"match":"\\\\*","name":"comment.block.shell"}]}},"match":"(/\\\\*)((?:[^*]|\\\\*++[^/])*+(\\\\*++/))"},"interpolation":{"patterns":[{"include":"#arithmetic_dollar"},{"include":"#subshell_dollar"},{"begin":"`","beginCaptures":{"0":{"name":"punctuation.definition.evaluation.backticks.shell"}},"end":"`","endCaptures":{"0":{"name":"punctuation.definition.evaluation.backticks.shell"}},"name":"string.interpolated.backtick.shell","patterns":[{"match":"\\\\\\\\[$\\\\\\\\`]","name":"constant.character.escape.shell"},{"begin":"(?<=\\\\W)(?=#)(?!#\\\\{)","beginCaptures":{"1":{"name":"punctuation.whitespace.comment.leading.shell"}},"end":"(?!\\\\G)","patterns":[{"begin":"#","beginCaptures":{"0":{"name":"punctuation.definition.comment.shell"}},"end":"(?=`)","name":"comment.line.number-sign.shell"}]},{"include":"#initial_context"}]}]},"keyword":{"patterns":[{"match":"(?<=^|[\\\\&;\\\\s])(then|else|elif|fi|for|in|do|done|select|continue|esac|while|until|return)(?=[\\\\&;\\\\s]|$)","name":"keyword.control.shell"},{"match":"(?<=^|[\\\\&;\\\\s])(?:export|declare|typeset|local|readonly)(?=[\\\\&;\\\\s]|$)","name":"storage.modifier.shell"}]},"line_comment":{"begin":"\\\\s*+(//)","beginCaptures":{"1":{"name":"punctuation.definition.comment.shell"}},"end":"(?<=\\\\n)(?<!\\\\\\\\\\\\n)","endCaptures":{},"name":"comment.line.double-slash.shell","patterns":[{"include":"#line_continuation_character"}]},"line_continuation":{"match":"\\\\\\\\(?=\\\\n)","name":"constant.character.escape.line-continuation.shell"},"logical-expression":{"patterns":[{"include":"#arithmetic_no_dollar"},{"match":"=[=~]?|!=?|[<>]|&&|\\\\|\\\\|","name":"keyword.operator.logical.shell"},{"match":"(?<!\\\\S)-(nt|ot|ef|eq|ne|l[et]|g[et]|[GLNOSa-hknopr-uwxz])\\\\b","name":"keyword.operator.logical.shell"}]},"logical_expression_context":{"patterns":[{"include":"#regex_comparison"},{"include":"#arithmetic_no_dollar"},{"include":"#logical-expression"},{"include":"#logical_expression_single"},{"include":"#logical_expression_double"},{"include":"#comment"},{"include":"#boolean"},{"include":"#redirect_number"},{"include":"#numeric_literal"},{"include":"#pipeline"},{"include":"#normal_statement_seperator"},{"include":"#string"},{"include":"#variable"},{"include":"#interpolation"},{"include":"#heredoc"},{"include":"#herestring"},{"include":"#pathname"},{"include":"#floating_keyword"},{"include":"#support"}]},"logical_expression_double":{"begin":"\\\\[\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"end":"]]","endCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"name":"meta.scope.logical-expression.shell","patterns":[{"include":"#logical_expression_context"}]},"logical_expression_single":{"begin":"\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"name":"meta.scope.logical-expression.shell","patterns":[{"include":"#logical_expression_context"}]},"loop":{"patterns":[{"begin":"(?<=^|[\\\\&;\\\\s])(for)\\\\s+(.+?)\\\\s+(in)(?=[\\\\&;\\\\s]|$)","beginCaptures":{"1":{"name":"keyword.control.shell"},"2":{"name":"variable.other.loop.shell","patterns":[{"include":"#string"}]},"3":{"name":"keyword.control.shell"}},"end":"(?<=^|[\\\\&;\\\\s])done(?=[\\\\&;\\\\s]|$|\\\\))","endCaptures":{"0":{"name":"keyword.control.shell"}},"name":"meta.scope.for-in-loop.shell","patterns":[{"include":"#initial_context"}]},{"begin":"(?<=^|[\\\\&;\\\\s])(while|until)(?=[\\\\&;\\\\s]|$)","beginCaptures":{"1":{"name":"keyword.control.shell"}},"end":"(?<=^|[\\\\&;\\\\s])done(?=[\\\\&;\\\\s]|$|\\\\))","endCaptures":{"0":{"name":"keyword.control.shell"}},"name":"meta.scope.while-loop.shell","patterns":[{"include":"#initial_context"}]},{"begin":"(?<=^|[\\\\&;\\\\s])(select)\\\\s+((?:[^\\\\\\\\\\\\s]|\\\\\\\\.)+)(?=[\\\\&;\\\\s]|$)","beginCaptures":{"1":{"name":"keyword.control.shell"},"2":{"name":"variable.other.loop.shell"}},"end":"(?<=^|[\\\\&;\\\\s])(done)(?=[\\\\&;\\\\s]|$|\\\\))","endCaptures":{"1":{"name":"keyword.control.shell"}},"name":"meta.scope.select-block.shell","patterns":[{"include":"#initial_context"}]},{"begin":"(?<=^|[\\\\&;\\\\s])if(?=[\\\\&;\\\\s]|$)","beginCaptures":{"0":{"name":"keyword.control.if.shell"}},"end":"(?<=^|[\\\\&;\\\\s])fi(?=[\\\\&;\\\\s]|$)","endCaptures":{"0":{"name":"keyword.control.fi.shell"}},"name":"meta.scope.if-block.shell","patterns":[{"include":"#initial_context"}]}]},"math":{"patterns":[{"include":"#variable"},{"match":"\\\\+{1,2}|-{1,2}|[!~]|\\\\*{1,2}|[%/]|<[<=]?|>[=>]?|==|!=|^|\\\\|{1,2}|&{1,2}|[,:=?]|[-%\\\\&*+/^|]=|<<=|>>=","name":"keyword.operator.arithmetic.shell"},{"match":"0[Xx]\\\\h+","name":"constant.numeric.hex.shell"},{"match":";","name":"punctuation.separator.semicolon.range"},{"match":"0\\\\d+","name":"constant.numeric.octal.shell"},{"match":"\\\\d{1,2}#[0-9@-Z_a-z]+","name":"constant.numeric.other.shell"},{"match":"\\\\d+","name":"constant.numeric.integer.shell"},{"match":"(?<!\\\\w)[0-9A-Z_a-z]+(?!\\\\w)","name":"variable.other.normal.shell"}]},"math_operators":{"patterns":[{"match":"\\\\+{1,2}|-{1,2}|[!~]|\\\\*{1,2}|[%/]|<[<=]?|>[=>]?|==|!=|^|\\\\|{1,2}|&{1,2}|[,:=?]|[-%\\\\&*+/^|]=|<<=|>>=","name":"keyword.operator.arithmetic.shell"},{"match":"0[Xx]\\\\h+","name":"constant.numeric.hex.shell"},{"match":"0\\\\d+","name":"constant.numeric.octal.shell"},{"match":"\\\\d{1,2}#[0-9@-Z_a-z]+","name":"constant.numeric.other.shell"},{"match":"\\\\d+","name":"constant.numeric.integer.shell"}]},"misc_ranges":{"patterns":[{"include":"#logical_expression_single"},{"include":"#logical_expression_double"},{"include":"#subshell_dollar"},{"begin":"(?<![^\\\\t ])(\\\\{)(?![$\\\\w])","beginCaptures":{"1":{"name":"punctuation.definition.group.shell"}},"end":"}","endCaptures":{"0":{"name":"punctuation.definition.group.shell"}},"name":"meta.scope.group.shell","patterns":[{"include":"#initial_context"}]}]},"modified_assignment_statement":{"begin":"(?<=^|[\\\\t \\\\&;])(?:readonly|declare|typeset|export|local)(?=[\\\\t \\\\&;]|$)","beginCaptures":{"0":{"name":"storage.modifier.$0.shell"}},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.statement.shell meta.expression.assignment.modified.shell","patterns":[{"match":"(?<!\\\\w)-\\\\w+\\\\b","name":"string.unquoted.argument.shell constant.other.option.shell"},{"include":"#array_value"},{"captures":{"1":{"name":"variable.other.assignment.shell"},"2":{"name":"punctuation.definition.array.access.shell"},"3":{"name":"variable.other.assignment.shell"},"4":{"name":"constant.numeric.shell constant.numeric.integer.shell"},"5":{"name":"punctuation.definition.array.access.shell"},"6":{"name":"keyword.operator.assignment.shell"},"7":{"name":"keyword.operator.assignment.compound.shell"},"8":{"name":"keyword.operator.assignment.compound.shell"},"9":{"name":"constant.numeric.shell constant.numeric.hex.shell"},"10":{"name":"constant.numeric.shell constant.numeric.octal.shell"},"11":{"name":"constant.numeric.shell constant.numeric.other.shell"},"12":{"name":"constant.numeric.shell constant.numeric.decimal.shell"},"13":{"name":"constant.numeric.shell constant.numeric.version.shell"},"14":{"name":"constant.numeric.shell constant.numeric.integer.shell"}},"match":"((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))(?:(\\\\[)((?:(?:\\\\$?(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)|@)|\\\\*)|(-?\\\\d+))(]))?(?:(?:(=)|(\\\\+=))|(-=))?(?:(?<=[\\\\t =]|^|[(\\\\[{])(?:(?:(?:(?:(?:(0[Xx]\\\\h+)|(0\\\\d+))|(\\\\d{1,2}#[0-9@-Z_a-z]+))|(-?\\\\d+\\\\.\\\\d+))|(-?\\\\d+(?:\\\\.\\\\d+)+))|(-?\\\\d+))(?=[\\\\t ]|$|[);}]))?"},{"include":"#normal_context"}]},"modifiers":{"match":"(?<=^|[\\\\t \\\\&;])(?:readonly|declare|typeset|export|local)(?=[\\\\t \\\\&;]|$)","name":"storage.modifier.$0.shell"},"normal_assignment_statement":{"begin":"[\\\\t ]*+((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))(?:(\\\\[)((?:(?:\\\\$?(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)|@)|\\\\*)|(-?\\\\d+))(]))?(?:(?:(=)|(\\\\+=))|(-=))","beginCaptures":{"1":{"name":"variable.other.assignment.shell"},"2":{"name":"punctuation.definition.array.access.shell"},"3":{"name":"variable.other.assignment.shell"},"4":{"name":"constant.numeric.shell constant.numeric.integer.shell"},"5":{"name":"punctuation.definition.array.access.shell"},"6":{"name":"keyword.operator.assignment.shell"},"7":{"name":"keyword.operator.assignment.compound.shell"},"8":{"name":"keyword.operator.assignment.compound.shell"}},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.expression.assignment.shell","patterns":[{"include":"#comment"},{"include":"#string"},{"include":"#normal_assignment_statement"},{"begin":"(?<=[\\\\t ])(?![\\\\t ]|\\\\w+=)","beginCaptures":{},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.statement.command.env.shell","patterns":[{"include":"#command_name_range"},{"include":"#line_continuation"},{"include":"#option"},{"include":"#argument"},{"include":"#string"}]},{"include":"#simple_unquoted"},{"include":"#normal_context"}]},"normal_context":{"patterns":[{"include":"#comment"},{"include":"#pipeline"},{"include":"#normal_statement_seperator"},{"include":"#misc_ranges"},{"include":"#boolean"},{"include":"#redirect_number"},{"include":"#numeric_literal"},{"include":"#string"},{"include":"#variable"},{"include":"#interpolation"},{"include":"#heredoc"},{"include":"#herestring"},{"include":"#redirection"},{"include":"#pathname"},{"include":"#floating_keyword"},{"include":"#support"},{"include":"#parenthese"}]},"normal_statement":{"begin":"(?!^[\\\\t ]*+$)(?:(?<=(?:^until| until|\\\\tuntil|^while| while|\\\\twhile|^elif| elif|\\\\telif|^else| else|\\\\telse|^then| then|\\\\tthen|^do| do|\\\\tdo|^if| if|\\\\tif) )|(?<=^|[!\\\\&(;`{|]))[\\\\t ]*+(?!nocorrect\\\\W|nocorrect\\\\$|function\\\\W|function\\\\$|foreach\\\\W|foreach\\\\$|repeat\\\\W|repeat\\\\$|logout\\\\W|logout\\\\$|coproc\\\\W|coproc\\\\$|select\\\\W|select\\\\$|while\\\\W|while\\\\$|pushd\\\\W|pushd\\\\$|until\\\\W|until\\\\$|case\\\\W|case\\\\$|done\\\\W|done\\\\$|elif\\\\W|elif\\\\$|else\\\\W|else\\\\$|esac\\\\W|esac\\\\$|popd\\\\W|popd\\\\$|then\\\\W|then\\\\$|time\\\\W|time\\\\$|for\\\\W|for\\\\$|end\\\\W|end\\\\$|fi\\\\W|fi\\\\$|do\\\\W|do\\\\$|in\\\\W|in\\\\$|if\\\\W|if\\\\$)","beginCaptures":{},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.statement.shell","patterns":[{"include":"#typical_statements"}]},"normal_statement_seperator":{"captures":{"1":{"name":"punctuation.terminator.statement.semicolon.shell"},"2":{"name":"punctuation.separator.statement.and.shell"},"3":{"name":"punctuation.separator.statement.or.shell"},"4":{"name":"punctuation.separator.statement.background.shell"}},"match":"(?:(?:(;)|(&&))|(\\\\|\\\\|))|(&)"},"numeric_literal":{"captures":{"1":{"name":"constant.numeric.shell constant.numeric.hex.shell"},"2":{"name":"constant.numeric.shell constant.numeric.octal.shell"},"3":{"name":"constant.numeric.shell constant.numeric.other.shell"},"4":{"name":"constant.numeric.shell constant.numeric.decimal.shell"},"5":{"name":"constant.numeric.shell constant.numeric.version.shell"},"6":{"name":"constant.numeric.shell constant.numeric.integer.shell"}},"match":"(?<=[\\\\t =]|^|[(\\\\[{])(?:(?:(?:(?:(?:(0[Xx]\\\\h+)|(0\\\\d+))|(\\\\d{1,2}#[0-9@-Z_a-z]+))|(-?\\\\d+\\\\.\\\\d+))|(-?\\\\d+(?:\\\\.\\\\d+)+))|(-?\\\\d+))(?=[\\\\t ]|$|[);}])"},"option":{"begin":"[\\\\t ]++(-)((?![\\\\n!#\\\\&()<>\\\\[{|]|$|[\\\\t ;]))","beginCaptures":{"1":{"name":"string.unquoted.argument.shell constant.other.option.dash.shell"},"2":{"name":"string.unquoted.argument.shell constant.other.option.shell"}},"contentName":"string.unquoted.argument constant.other.option","end":"(?=[\\\\t ])|(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"patterns":[{"include":"#option_context"}]},"option_context":{"patterns":[{"include":"#misc_ranges"},{"include":"#string"},{"include":"#variable"},{"include":"#interpolation"},{"include":"#heredoc"},{"include":"#herestring"},{"include":"#redirection"},{"include":"#pathname"},{"include":"#floating_keyword"},{"include":"#support"}]},"parenthese":{"patterns":[{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.section.parenthese.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.section.parenthese.shell"}},"name":"meta.parenthese.group.shell","patterns":[{"include":"#initial_context"}]}]},"pathname":{"patterns":[{"match":"(?<=[:=\\\\s]|^)~","name":"keyword.operator.tilde.shell"},{"match":"[*?]","name":"keyword.operator.glob.shell"},{"begin":"([!*+?@])(\\\\()","beginCaptures":{"1":{"name":"keyword.operator.extglob.shell"},"2":{"name":"punctuation.definition.extglob.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.extglob.shell"}},"name":"meta.structure.extglob.shell","patterns":[{"include":"#initial_context"}]}]},"pipeline":{"patterns":[{"match":"(?<=^|[\\\\&;\\\\s])(time)(?=[\\\\&;\\\\s]|$)","name":"keyword.other.shell"},{"match":"[!|]","name":"keyword.operator.pipe.shell"}]},"redirect_fix":{"captures":{"1":{"name":"keyword.operator.redirect.shell"},"2":{"name":"string.unquoted.argument.shell"}},"match":"(>>?)[\\\\t ]*+([^\\\\t\\\\n \\"$\\\\&-);<>\\\\\\\\`|]+)"},"redirect_number":{"captures":{"1":{"name":"keyword.operator.redirect.stdout.shell"},"2":{"name":"keyword.operator.redirect.stderr.shell"},"3":{"name":"keyword.operator.redirect.$3.shell"}},"match":"(?<=[\\\\t ])(?:(1)|(2)|(\\\\d+))(?=>)"},"redirection":{"patterns":[{"begin":"[<>]\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.string.end.shell"}},"name":"string.interpolated.process-substitution.shell","patterns":[{"include":"#initial_context"}]},{"match":"(?<![<>])(&>|\\\\d*>&\\\\d*|\\\\d*(>>|[<>])|\\\\d*<&|\\\\d*<>)(?![<>])","name":"keyword.operator.redirect.shell"}]},"regex_comparison":{"match":"=~","name":"keyword.operator.logical.regex.shell"},"regexp":{"patterns":[{"match":".+"}]},"simple_options":{"captures":{"0":{"patterns":[{"captures":{"1":{"name":"string.unquoted.argument.shell constant.other.option.dash.shell"},"2":{"name":"string.unquoted.argument.shell constant.other.option.shell"}},"match":"[\\\\t ]++(-)(\\\\w+)"}]}},"match":"(?:[\\\\t ]++-\\\\w+)*"},"simple_unquoted":{"match":"[^\\\\t\\\\n \\"$\\\\&-);<>\\\\\\\\`|]","name":"string.unquoted.shell"},"special_expansion":{"match":"!|:[-=?]?|[*@]|##?|%%|[%/]","name":"keyword.operator.expansion.shell"},"start_of_command":{"match":"[\\\\t ]*+(?![\\\\n!#\\\\&()<>\\\\[{|]|$|[\\\\t ;])(?!nocorrect |nocorrect\\\\t|nocorrect$|readonly |readonly\\\\t|readonly$|function |function\\\\t|function$|foreach |foreach\\\\t|foreach$|coproc |coproc\\\\t|coproc$|logout |logout\\\\t|logout$|export |export\\\\t|export$|select |select\\\\t|select$|repeat |repeat\\\\t|repeat$|pushd |pushd\\\\t|pushd$|until |until\\\\t|until$|while |while\\\\t|while$|local |local\\\\t|local$|case |case\\\\t|case$|done |done\\\\t|done$|elif |elif\\\\t|elif$|else |else\\\\t|else$|esac |esac\\\\t|esac$|popd |popd\\\\t|popd$|then |then\\\\t|then$|time |time\\\\t|time$|for |for\\\\t|for$|end |end\\\\t|end$|fi |fi\\\\t|fi$|do |do\\\\t|do$|in |in\\\\t|in$|if |if\\\\t|if$)(?!\\\\\\\\\\\\n?$)"},"string":{"patterns":[{"match":"\\\\\\\\.","name":"constant.character.escape.shell"},{"begin":"\'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.shell"}},"end":"\'","endCaptures":{"0":{"name":"punctuation.definition.string.end.shell"}},"name":"string.quoted.single.shell"},{"begin":"\\\\$?\\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.shell"}},"end":"\\"","endCaptures":{"0":{"name":"punctuation.definition.string.end.shell"}},"name":"string.quoted.double.shell","patterns":[{"match":"\\\\\\\\[\\\\n\\"$\\\\\\\\`]","name":"constant.character.escape.shell"},{"include":"#variable"},{"include":"#interpolation"}]},{"begin":"\\\\$\'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.shell"}},"end":"\'","endCaptures":{"0":{"name":"punctuation.definition.string.end.shell"}},"name":"string.quoted.single.dollar.shell","patterns":[{"match":"\\\\\\\\[\'\\\\\\\\abefnrtv]","name":"constant.character.escape.ansi-c.shell"},{"match":"\\\\\\\\[0-9]{3}\\"","name":"constant.character.escape.octal.shell"},{"match":"\\\\\\\\x\\\\h{2}\\"","name":"constant.character.escape.hex.shell"},{"match":"\\\\\\\\c.\\"","name":"constant.character.escape.control-char.shell"}]}]},"subshell_dollar":{"patterns":[{"begin":"\\\\$\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.subshell.single.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.subshell.single.shell"}},"name":"meta.scope.subshell","patterns":[{"include":"#parenthese"},{"include":"#initial_context"}]}]},"support":{"patterns":[{"match":"(?<=^|[\\\\&;\\\\s])[.:](?=[\\\\&;\\\\s]|$)","name":"support.function.builtin.shell"}]},"typical_statements":{"patterns":[{"include":"#assignment_statement"},{"include":"#case_statement"},{"include":"#for_statement"},{"include":"#while_statement"},{"include":"#function_definition"},{"include":"#command_statement"},{"include":"#line_continuation"},{"include":"#arithmetic_double"},{"include":"#normal_context"}]},"variable":{"patterns":[{"captures":{"1":{"name":"punctuation.definition.variable.shell variable.parameter.positional.all.shell"},"2":{"name":"variable.parameter.positional.all.shell"}},"match":"(\\\\$)(@(?!\\\\w))"},{"captures":{"1":{"name":"punctuation.definition.variable.shell variable.parameter.positional.shell"},"2":{"name":"variable.parameter.positional.shell"}},"match":"(\\\\$)([0-9](?!\\\\w))"},{"captures":{"1":{"name":"punctuation.definition.variable.shell variable.language.special.shell"},"2":{"name":"variable.language.special.shell"}},"match":"(\\\\$)([-!#$*0?_](?!\\\\w))"},{"begin":"(\\\\$)(\\\\{)[\\\\t ]*+(?=\\\\d)","beginCaptures":{"1":{"name":"punctuation.definition.variable.shell variable.parameter.positional.shell"},"2":{"name":"punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell variable.parameter.positional.shell"}},"contentName":"meta.parameter-expansion","end":"}","endCaptures":{"0":{"name":"punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell variable.parameter.positional.shell"}},"patterns":[{"include":"#special_expansion"},{"include":"#array_access_inline"},{"match":"[0-9]+","name":"variable.parameter.positional.shell"},{"match":"(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)","name":"variable.other.normal.shell"},{"include":"#variable"},{"include":"#string"}]},{"begin":"(\\\\$)(\\\\{)","beginCaptures":{"1":{"name":"punctuation.definition.variable.shell"},"2":{"name":"punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell"}},"contentName":"meta.parameter-expansion","end":"}","endCaptures":{"0":{"name":"punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell"}},"patterns":[{"include":"#special_expansion"},{"include":"#array_access_inline"},{"match":"(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)","name":"variable.other.normal.shell"},{"include":"#variable"},{"include":"#string"}]},{"captures":{"1":{"name":"punctuation.definition.variable.shell variable.other.normal.shell"},"2":{"name":"variable.other.normal.shell"}},"match":"(\\\\$)(\\\\w+(?!\\\\w))"}]},"while_statement":{"patterns":[{"begin":"\\\\b(while)\\\\b","beginCaptures":{"1":{"name":"keyword.control.while.shell"}},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.while.shell","patterns":[{"include":"#line_continuation"},{"include":"#math_operators"},{"include":"#option"},{"include":"#simple_unquoted"},{"include":"#normal_context"},{"include":"#string"}]}]}},"scopeName":"source.shell","aliases":["bash","sh","shell","zsh"]}')),da=[e];
2
+ export{da};
@@ -1,2 +1,2 @@
1
- import{h,o,r,e,n,y,te}from"./chunk-ve8gy05p.js";import{na}from"./chunk-k9qnvx86.js";function qt(t){let{Button:i,SettingActions:l,cn:d}=y();return n(l,{children:[t.notice&&n("span",{role:t.notice.type==="error"?"alert":"status",className:d("mr-auto flex min-w-0 items-center gap-1.5 text-xs",t.notice.type==="success"?"text-success":"text-danger"),children:[t.notice.type==="success"?e(na,{className:"size-3.5 shrink-0"}):e(te,{className:"size-3.5 shrink-0"}),e("span",{className:"min-w-0 break-words",children:t.notice.text})]}),t.dirty&&e(i,{type:"button",variant:"ghost",size:"sm",disabled:t.busy,onClick:t.onReset,children:"撤销更改"}),e(i,{form:t.formID,type:"submit",variant:"primary",size:"sm",disabled:t.busy||!t.dirty,children:t.saving?"保存中…":"保存"})]})}function Mn(t){let{connection:i,endpoint:l,loadError:d}=t,[g,S]=r(null),[c,f]=r(null),[N,P]=r({models:[]}),[b,p]=r(!0),[M,T]=r(!1),[v,x]=r(!1),[k,a]=r(null),m=h(async(u=!1)=>{if(u)T(!0);else p(!0);a(null);try{let[s,C]=await Promise.all([i.request(l),i.request("/api/models")]);S(s),f(s),P(C)}catch(s){a({type:"error",text:s instanceof Error?s.message:d})}finally{p(!1),T(!1)}},[i,l,d]);o(()=>{m()},[m]);let w=c&&g?t.differs(c,g):!1;return{settings:c,modelList:N,loading:b,refreshing:M,saving:v,notice:k,dirty:w,load:m,save:async(u)=>{if(u?.preventDefault(),!c||v||b)return;x(!0),a(null);try{let s=await i.request(l,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.toBody(c))});S(s),f(s),a({type:"success",text:"设置已保存"})}catch(s){a({type:"error",text:s instanceof Error?s.message:"保存设置失败"})}finally{x(!1)}},reset:()=>{f(g),a(null)},edit:(u)=>{f((s)=>s?u(s):null),a(null)}}}
2
- export{qt,Mn};
1
+ import{h,o,r,e,n,y,te}from"./chunk-ty2rmwda.js";import{aa}from"./chunk-4qehf2xx.js";function qt(t){let{Button:i,SettingActions:l,cn:d}=y();return n(l,{children:[t.notice&&n("span",{role:t.notice.type==="error"?"alert":"status",className:d("mr-auto flex min-w-0 items-center gap-1.5 text-xs",t.notice.type==="success"?"text-success":"text-danger"),children:[t.notice.type==="success"?e(aa,{className:"size-3.5 shrink-0"}):e(te,{className:"size-3.5 shrink-0"}),e("span",{className:"min-w-0 break-words",children:t.notice.text})]}),t.dirty&&e(i,{type:"button",variant:"ghost",size:"sm",disabled:t.busy,onClick:t.onReset,children:"撤销更改"}),e(i,{form:t.formID,type:"submit",variant:"primary",size:"sm",disabled:t.busy||!t.dirty,children:t.saving?"保存中…":"保存"})]})}function Pn(t){let{connection:i,endpoint:l,loadError:d}=t,[g,S]=r(null),[c,f]=r(null),[N,P]=r({models:[]}),[b,p]=r(!0),[M,T]=r(!1),[v,x]=r(!1),[k,a]=r(null),m=h(async(u=!1)=>{if(u)T(!0);else p(!0);a(null);try{let[s,C]=await Promise.all([i.request(l),i.request("/api/models")]);S(s),f(s),P(C)}catch(s){a({type:"error",text:s instanceof Error?s.message:d})}finally{p(!1),T(!1)}},[i,l,d]);o(()=>{m()},[m]);let w=c&&g?t.differs(c,g):!1;return{settings:c,modelList:N,loading:b,refreshing:M,saving:v,notice:k,dirty:w,load:m,save:async(u)=>{if(u?.preventDefault(),!c||v||b)return;x(!0),a(null);try{let s=await i.request(l,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.toBody(c))});S(s),f(s),a({type:"success",text:"设置已保存"})}catch(s){a({type:"error",text:s instanceof Error?s.message:"保存设置失败"})}finally{x(!1)}},reset:()=>{f(g),a(null)},edit:(u)=>{f((s)=>s?u(s):null),a(null)}}}
2
+ export{qt,Pn};
@@ -0,0 +1 @@
1
+ import"./chunk-zsat72qd.js";import"./chunk-tdzh6nsz.js";import"./chunk-2c7kxr4v.js";import{lo}from"./chunk-j6wcszxq.js";export{lo as render};
@@ -1 +1 @@
1
- import{r,m,e,n,y,s,te,K,q,Ke}from"./chunk-ve8gy05p.js";var z=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]],h=s("circle-slash",z);function B(t){if(!t||typeof t!=="object")return;if(!("id"in t)||typeof t.id!=="string")return;if(!("state"in t)||typeof t.state!=="string")return;return{id:t.id,state:t.state,command:"command"in t&&typeof t.command==="string"?t.command:void 0,code:"code"in t&&(t.code===null||typeof t.code==="number")?t.code:void 0,output:"output"in t&&typeof t.output==="string"?t.output:void 0}}function U(t){let{Button:N,Panel:b,style:k}=y(),i=B(t.payload),[a,c]=r(!1),[C,P]=r(!1),[u,d]=r();if(!i)return null;let o=C?"killed":i.state,l=o==="running",f=o==="exited"&&i.code===0,p=o==="killed"||o==="timeout",g=i.output?.trim(),I=async()=>{if(a)return;c(!0),d(void 0);try{await t.connection.request(`/api/sessions/${encodeURIComponent(t.sessionID)}/jobs/${encodeURIComponent(i.id)}/kill`,{method:"POST"}),P(!0)}catch(x){d(x instanceof Error?x.message:"停止失败,后台任务可能已结束")}finally{c(!1)}};return n(b,{className:"my-2",header:n(m,{children:[e(Ke,{className:"size-3.5 shrink-0 text-faint"}),e("span",{className:"truncate font-mono text-ink/90",title:i.command??i.id,children:i.command??`任务 ${i.id}`})]}),actions:n(m,{children:[l&&n(m,{children:[n("span",{className:"flex items-center gap-1 text-warning",children:[e(K,{className:"size-3.5 animate-spin"}),e("span",{children:"后台运行中"})]}),e(N,{size:"sm",variant:"danger-ghost",className:"h-6 rounded-md px-2 text-xs",disabled:a,onClick:()=>{I()},children:"停止"})]}),f&&n("span",{className:"flex items-center gap-1 text-success",children:[e(q,{className:"size-3.5"}),e("span",{children:"已完成"})]}),p&&n("span",{className:"flex items-center gap-1 text-faint",children:[e(h,{className:"size-3.5"}),e("span",{children:o==="timeout"?"已超时":"已停止"})]}),!l&&!f&&!p&&n("span",{className:"flex items-center gap-1 text-danger",children:[e(te,{className:"size-3.5"}),n("span",{children:["退出码 ",i.code??"异常"]})]})]}),children:[u&&e("p",{role:"status",className:"border-b border-line px-4 py-2.5 text-xs text-danger",children:u}),g&&e("pre",{className:k("chat.toolOutput","max-h-60 text-ink/90 select-text"),children:g})]})}export{U as BashJobCard};
1
+ import{r,m,e,n,y,s,te,K,U,Ke}from"./chunk-ty2rmwda.js";var z=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]],h=s("circle-slash",z);function B(t){if(!t||typeof t!=="object")return;if(!("id"in t)||typeof t.id!=="string")return;if(!("state"in t)||typeof t.state!=="string")return;return{id:t.id,state:t.state,command:"command"in t&&typeof t.command==="string"?t.command:void 0,code:"code"in t&&(t.code===null||typeof t.code==="number")?t.code:void 0,output:"output"in t&&typeof t.output==="string"?t.output:void 0}}function E(t){let{Button:N,Panel:b,style:k}=y(),i=B(t.payload),[a,c]=r(!1),[C,P]=r(!1),[u,d]=r();if(!i)return null;let o=C?"killed":i.state,l=o==="running",f=o==="exited"&&i.code===0,p=o==="killed"||o==="timeout",g=i.output?.trim(),I=async()=>{if(a)return;c(!0),d(void 0);try{await t.connection.request(`/api/sessions/${encodeURIComponent(t.sessionID)}/jobs/${encodeURIComponent(i.id)}/kill`,{method:"POST"}),P(!0)}catch(x){d(x instanceof Error?x.message:"停止失败,后台任务可能已结束")}finally{c(!1)}};return n(b,{className:"my-2",header:n(m,{children:[e(Ke,{className:"size-3.5 shrink-0 text-faint"}),e("span",{className:"truncate font-mono text-ink/90",title:i.command??i.id,children:i.command??`任务 ${i.id}`})]}),actions:n(m,{children:[l&&n(m,{children:[n("span",{className:"flex items-center gap-1 text-warning",children:[e(K,{className:"size-3.5 animate-spin"}),e("span",{children:"后台运行中"})]}),e(N,{size:"sm",variant:"danger-ghost",className:"h-6 rounded-md px-2 text-xs",disabled:a,onClick:()=>{I()},children:"停止"})]}),f&&n("span",{className:"flex items-center gap-1 text-success",children:[e(U,{className:"size-3.5"}),e("span",{children:"已完成"})]}),p&&n("span",{className:"flex items-center gap-1 text-faint",children:[e(h,{className:"size-3.5"}),e("span",{children:o==="timeout"?"已超时":"已停止"})]}),!l&&!f&&!p&&n("span",{className:"flex items-center gap-1 text-danger",children:[e(te,{className:"size-3.5"}),n("span",{children:["退出码 ",i.code??"异常"]})]})]}),children:[u&&e("p",{role:"status",className:"border-b border-line px-4 py-2.5 text-xs text-danger",children:u}),g&&e("pre",{className:k("chat.toolOutput","max-h-60 text-ink/90 select-text"),children:g})]})}export{E as BashJobCard};