@qitqode/qitqode-android-arm64 0.2.10 → 0.2.13

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 (410) hide show
  1. package/bundle/{chunk-x308f9j4.js → chunk-00krzh3y.js} +2 -2
  2. package/bundle/{chunk-q0xgxygw.js → chunk-04x4b2yy.js} +1 -1
  3. package/bundle/{chunk-1q10jyka.js → chunk-08mgb5tt.js} +2 -2
  4. package/bundle/{chunk-yexzxx6f.js → chunk-094m66q5.js} +1 -1
  5. package/bundle/{chunk-c3ey896z.js → chunk-0cjp9088.js} +1 -1
  6. package/bundle/{chunk-7a3txs9f.js → chunk-0mdmqtfr.js} +2 -2
  7. package/bundle/chunk-0nves64y.js +2 -0
  8. package/bundle/chunk-0v7knkt5.js +2 -0
  9. package/bundle/{chunk-wbt31xap.js → chunk-0w77vhg4.js} +2 -2
  10. package/bundle/{chunk-dnjyepb2.js → chunk-0ware2sh.js} +2 -2
  11. package/bundle/{chunk-djfrkbd5.js → chunk-0xf12tf3.js} +1 -1
  12. package/bundle/{chunk-qbewhcsz.js → chunk-139qfnsq.js} +1 -1
  13. package/bundle/{chunk-xgf4k9q7.js → chunk-1851skhm.js} +1 -1
  14. package/bundle/{chunk-f17se3hh.js → chunk-1bbx1da7.js} +1 -1
  15. package/bundle/{chunk-vk35g121.js → chunk-1bhcg889.js} +2 -2
  16. package/bundle/{chunk-xnxw5zz9.js → chunk-1exjy880.js} +2 -2
  17. package/bundle/{chunk-atacnspd.js → chunk-1f9qcrn6.js} +2 -2
  18. package/bundle/{chunk-5fcyb122.js → chunk-1gt6ppza.js} +1 -1
  19. package/bundle/chunk-1h5jdsgx.js +2 -0
  20. package/bundle/{chunk-brk1jca3.js → chunk-1q5h95hc.js} +1 -1
  21. package/bundle/chunk-1r5e1jsb.js +2 -0
  22. package/bundle/{chunk-vy93mn7d.js → chunk-1rafe6f5.js} +2 -2
  23. package/bundle/{chunk-62y6zk9x.js → chunk-1rw4srd1.js} +1 -1
  24. package/bundle/{chunk-h2p984qb.js → chunk-1sejtx9a.js} +2 -2
  25. package/bundle/{chunk-3zzrdpsx.js → chunk-1wy8wmah.js} +1 -1
  26. package/bundle/chunk-1wyy3c48.js +2 -0
  27. package/bundle/chunk-1z299xq6.js +2 -0
  28. package/bundle/chunk-21aqt31s.js +2 -0
  29. package/bundle/chunk-22aq9ymg.js +2 -0
  30. package/bundle/chunk-26a17c9z.js +2 -0
  31. package/bundle/chunk-2a154mr0.js +2 -0
  32. package/bundle/{chunk-acsqvgdw.js → chunk-2b80n6nx.js} +1 -1
  33. package/bundle/{chunk-nnkfdhh9.js → chunk-2bfq0mtx.js} +1 -1
  34. package/bundle/{chunk-wecs14rz.js → chunk-2d0vympj.js} +1 -1
  35. package/bundle/{chunk-dz3kcsb6.js → chunk-2h8b0csf.js} +2 -2
  36. package/bundle/{chunk-xqwk2zsx.js → chunk-2md5fz4f.js} +2 -2
  37. package/bundle/chunk-2nbce486.js +2 -0
  38. package/bundle/chunk-2npxatq9.js +2 -0
  39. package/bundle/{chunk-gx4v8z64.js → chunk-2p1qaqv3.js} +2 -2
  40. package/bundle/{chunk-ge7csm6m.js → chunk-2ts2s8b4.js} +2 -2
  41. package/bundle/{chunk-d1xfv4d3.js → chunk-374js0y6.js} +1 -1
  42. package/bundle/{chunk-g52wmt1v.js → chunk-3be70hxy.js} +1 -1
  43. package/bundle/{chunk-c8yc8qcd.js → chunk-3fx3eghq.js} +1 -1
  44. package/bundle/chunk-3gryj9r9.js +2 -0
  45. package/bundle/chunk-3jnanbjr.js +2 -0
  46. package/bundle/chunk-3meh1cbc.js +2 -0
  47. package/bundle/{chunk-t2r51r6v.js → chunk-3rcfy8te.js} +1 -1
  48. package/bundle/chunk-3t71xfr6.js +2 -0
  49. package/bundle/chunk-4045jzv5.js +2 -0
  50. package/bundle/{chunk-qdh2dm62.js → chunk-404ew3d3.js} +1 -1
  51. package/bundle/{chunk-ecz4h0a2.js → chunk-45dtsre6.js} +1 -1
  52. package/bundle/{chunk-v03xq38e.js → chunk-47pxz6cb.js} +2 -2
  53. package/bundle/{chunk-v8bxj01h.js → chunk-4ar8hey8.js} +1 -1
  54. package/bundle/chunk-4b2vv484.js +2 -0
  55. package/bundle/{chunk-9tz18e54.js → chunk-4d9s7cgr.js} +1 -1
  56. package/bundle/chunk-4ene1ymj.js +2 -0
  57. package/bundle/{chunk-yydqavgh.js → chunk-4enhsmq1.js} +2 -2
  58. package/bundle/{chunk-dm447tgc.js → chunk-4krmja97.js} +2 -2
  59. package/bundle/{chunk-pwsajn96.js → chunk-4q14whpc.js} +1 -1
  60. package/bundle/{chunk-z023h7t8.js → chunk-4s9d2zte.js} +1 -1
  61. package/bundle/{chunk-9zy5tsry.js → chunk-4wzv2v36.js} +3 -3
  62. package/bundle/{chunk-4sa9t0vx.js → chunk-53n3tfwn.js} +2 -2
  63. package/bundle/{chunk-3sj0jv91.js → chunk-5828bcp8.js} +1 -1
  64. package/bundle/chunk-58r5etg8.js +2 -0
  65. package/bundle/{chunk-waa781eh.js → chunk-5a4zt1b7.js} +1 -1
  66. package/bundle/chunk-5c2zw4h0.js +2 -0
  67. package/bundle/chunk-5e0vejcb.js +8 -0
  68. package/bundle/{chunk-nq4x6792.js → chunk-5es19n1m.js} +2 -2
  69. package/bundle/{chunk-32xd626h.js → chunk-5fbzvy6q.js} +2 -2
  70. package/bundle/{chunk-e1x1mp9m.js → chunk-5gv6r7v8.js} +1 -1
  71. package/bundle/{chunk-v8rqgt7h.js → chunk-5psekq9f.js} +1 -1
  72. package/bundle/{chunk-te91d271.js → chunk-5rtsnnjk.js} +1 -1
  73. package/bundle/{chunk-p6jf1fyt.js → chunk-5wjwzbk8.js} +1 -1
  74. package/bundle/chunk-608f83n0.js +2 -0
  75. package/bundle/{chunk-asxmkyz2.js → chunk-610mqqqa.js} +1 -1
  76. package/bundle/chunk-671r50ry.js +2 -0
  77. package/bundle/chunk-6bfnhr3d.js +2 -0
  78. package/bundle/chunk-6cv6d8rw.js +2 -0
  79. package/bundle/{chunk-psqtptrs.js → chunk-6dmk2eyt.js} +1 -1
  80. package/bundle/{chunk-7s0nq2aa.js → chunk-6g3bzap8.js} +2 -2
  81. package/bundle/{chunk-ccdjzn2m.js → chunk-6jb4mnvq.js} +3 -3
  82. package/bundle/{chunk-m01h6kk1.js → chunk-6kpk6pr3.js} +1 -1
  83. package/bundle/{chunk-gbkz04ke.js → chunk-6p848y99.js} +1 -1
  84. package/bundle/chunk-6qm6f88j.js +2 -0
  85. package/bundle/{chunk-wh2qqhep.js → chunk-6wt8g6mc.js} +2 -2
  86. package/bundle/{chunk-mn0pshpv.js → chunk-71naz1qp.js} +1 -1
  87. package/bundle/{chunk-by1kwg4r.js → chunk-72qx43fq.js} +2 -2
  88. package/bundle/chunk-78bfwwmc.js +2 -0
  89. package/bundle/{chunk-0sfc21qe.js → chunk-78rfz0ex.js} +2 -2
  90. package/bundle/{chunk-1r81q7m3.js → chunk-7bvh48s2.js} +1 -1
  91. package/bundle/{chunk-mmqyter3.js → chunk-7h0regqs.js} +1 -1
  92. package/bundle/{chunk-d0dsgxk4.js → chunk-7k1q26yn.js} +2 -2
  93. package/bundle/{chunk-kec1xw1n.js → chunk-7nh8vjx4.js} +1 -1
  94. package/bundle/{chunk-5w7ebtcd.js → chunk-7p8f8xav.js} +1 -1
  95. package/bundle/chunk-7wwtgxxf.js +2 -0
  96. package/bundle/{chunk-gksbv613.js → chunk-81mwbcy3.js} +2 -2
  97. package/bundle/{chunk-fvv1cret.js → chunk-821zkh5v.js} +1 -1
  98. package/bundle/{chunk-pf2vq6t1.js → chunk-84712kbe.js} +2 -2
  99. package/bundle/{chunk-eabbrt1p.js → chunk-8hrt4d0v.js} +1 -1
  100. package/bundle/{chunk-gmq1kwn0.js → chunk-8psfgg8y.js} +1 -1
  101. package/bundle/{chunk-at4dge22.js → chunk-8rbbt1s8.js} +1 -1
  102. package/bundle/{chunk-cdenq7jb.js → chunk-8t17w67q.js} +1 -1
  103. package/bundle/{chunk-9fjcgdea.js → chunk-8xbd0ra5.js} +1 -1
  104. package/bundle/{chunk-nh4zk07t.js → chunk-95ga21eq.js} +1 -1
  105. package/bundle/{chunk-e10c0crf.js → chunk-962hspr0.js} +1 -1
  106. package/bundle/chunk-98sb49dz.js +2 -0
  107. package/bundle/{chunk-9d0exvey.js → chunk-9a9qcvtz.js} +2 -2
  108. package/bundle/{chunk-x0hhw46n.js → chunk-9c0f79mt.js} +1 -1
  109. package/bundle/{chunk-kcqeh1e5.js → chunk-9h2fms7x.js} +1 -1
  110. package/bundle/chunk-9kbtpq9m.js +2 -0
  111. package/bundle/{chunk-eqpep2m2.js → chunk-9r6wk75s.js} +1 -1
  112. package/bundle/chunk-9szp9b4m.js +2 -0
  113. package/bundle/{chunk-tg1f56s3.js → chunk-9xbc558j.js} +1 -1
  114. package/bundle/chunk-9xqszq0c.js +2 -0
  115. package/bundle/chunk-a32kjs9e.js +2 -0
  116. package/bundle/{chunk-c8080519.js → chunk-a4242cn4.js} +1 -1
  117. package/bundle/{chunk-c8k32724.js → chunk-ajyfms68.js} +1 -1
  118. package/bundle/{chunk-8peby2d1.js → chunk-ajykvcas.js} +1 -1
  119. package/bundle/{chunk-tm79yrf3.js → chunk-anm5g0m4.js} +2 -2
  120. package/bundle/chunk-apym02ct.js +2 -0
  121. package/bundle/{chunk-dx7rexx3.js → chunk-aq75kv5f.js} +3 -3
  122. package/bundle/chunk-armv2rv5.js +2 -0
  123. package/bundle/chunk-as215v64.js +2 -0
  124. package/bundle/{chunk-rk21wv4k.js → chunk-b274mb6v.js} +1 -1
  125. package/bundle/{chunk-zfqgh9h7.js → chunk-b46t2315.js} +1 -1
  126. package/bundle/{chunk-yzd6cyep.js → chunk-ba2hn77m.js} +1 -1
  127. package/bundle/{chunk-pyf649pz.js → chunk-bd4krah7.js} +1 -1
  128. package/bundle/chunk-bnmpgpyf.js +2 -0
  129. package/bundle/{chunk-5nm5egq0.js → chunk-bpv378bm.js} +2 -2
  130. package/bundle/chunk-bq3zt1x1.js +2 -0
  131. package/bundle/chunk-bx8fgjam.js +2 -0
  132. package/bundle/{chunk-fsndgr9a.js → chunk-bydaqb08.js} +1 -1
  133. package/bundle/{chunk-819qr675.js → chunk-c1srcpfk.js} +1 -1
  134. package/bundle/{chunk-9bbwxp5d.js → chunk-c99npyz9.js} +1 -1
  135. package/bundle/chunk-ckcnb59t.js +2 -0
  136. package/bundle/{chunk-qdbx1qkr.js → chunk-csbndz33.js} +1 -1
  137. package/bundle/{chunk-c1c8ch3g.js → chunk-cv3xdp8q.js} +8 -8
  138. package/bundle/{chunk-xvvt886p.js → chunk-d2049chz.js} +2 -2
  139. package/bundle/{chunk-je8fcsa9.js → chunk-d4ys15w3.js} +1 -1
  140. package/bundle/chunk-d79xaj6s.js +3 -0
  141. package/bundle/chunk-dah2d37s.js +2 -0
  142. package/bundle/chunk-dhgjv1n2.js +2 -0
  143. package/bundle/chunk-dk9k8ff5.js +2 -0
  144. package/bundle/{chunk-b9f78x5g.js → chunk-dmgdwvn1.js} +1 -1
  145. package/bundle/{chunk-azss4acq.js → chunk-dpm5x19e.js} +2 -2
  146. package/bundle/{chunk-rpdgn9z3.js → chunk-dwjv3m5s.js} +2 -2
  147. package/bundle/chunk-dymysn4h.js +2 -0
  148. package/bundle/{chunk-7rbg6mg9.js → chunk-dzy3ezht.js} +2 -2
  149. package/bundle/{chunk-8rkszwxq.js → chunk-e0w082wt.js} +4 -4
  150. package/bundle/{chunk-0mwzxqt5.js → chunk-e4658j15.js} +3 -3
  151. package/bundle/{chunk-pbanj1gk.js → chunk-e6s8ep9m.js} +2 -2
  152. package/bundle/{chunk-dp6ms01y.js → chunk-ec1bwa7f.js} +2 -2
  153. package/bundle/{chunk-ff8q10gk.js → chunk-eefzbdbk.js} +2 -2
  154. package/bundle/{chunk-j5z95b6f.js → chunk-eftk07r3.js} +1 -1
  155. package/bundle/{chunk-qjw2zcq5.js → chunk-eh73j82b.js} +1 -1
  156. package/bundle/{chunk-h91zmzs5.js → chunk-es6vbsjg.js} +1 -1
  157. package/bundle/{chunk-k10rtgsk.js → chunk-etvwxwn3.js} +1 -1
  158. package/bundle/chunk-ev4gw5k6.js +2 -0
  159. package/bundle/chunk-ew2dxm43.js +2 -0
  160. package/bundle/{chunk-nk5vrenn.js → chunk-ewde5bss.js} +2 -2
  161. package/bundle/{chunk-8gpjmj42.js → chunk-fbd971t7.js} +3 -3
  162. package/bundle/{chunk-gbnf7zf9.js → chunk-ff031crt.js} +1 -1
  163. package/bundle/chunk-ffp4wg27.js +2 -0
  164. package/bundle/{chunk-6y58jzak.js → chunk-fj87htwn.js} +1 -1
  165. package/bundle/{chunk-rxnd79h7.js → chunk-fmvmp278.js} +1 -1
  166. package/bundle/{chunk-6mnk5sg3.js → chunk-fqzfytjk.js} +1 -1
  167. package/bundle/{chunk-c2ns2csn.js → chunk-g0x6q2ks.js} +1 -1
  168. package/bundle/{chunk-mp1x10t5.js → chunk-g3y5kvg6.js} +2 -2
  169. package/bundle/{chunk-3vae1s42.js → chunk-g6ffx794.js} +1 -1
  170. package/bundle/{chunk-d1fv2c7s.js → chunk-gcpwm7b5.js} +2 -2
  171. package/bundle/{chunk-pxm0x3e0.js → chunk-gdawpkxs.js} +2 -2
  172. package/bundle/{chunk-jbcqhw3x.js → chunk-gjmxrz0v.js} +2 -2
  173. package/bundle/{chunk-vbb1jg02.js → chunk-gtmtvjwc.js} +1 -1
  174. package/bundle/{chunk-7hdb1fhq.js → chunk-gvc1mqrs.js} +2 -2
  175. package/bundle/{chunk-56yp5v0w.js → chunk-gw2fz5ry.js} +1 -1
  176. package/bundle/{chunk-g08qj9z3.js → chunk-h1p3xcfp.js} +2 -2
  177. package/bundle/{chunk-c9cngded.js → chunk-h2vtypa5.js} +1 -1
  178. package/bundle/{chunk-m4j6t713.js → chunk-h9tcpbr7.js} +1 -1
  179. package/bundle/{chunk-2fbkw84y.js → chunk-hcd0k14e.js} +2 -2
  180. package/bundle/{chunk-s05hqtx1.js → chunk-hd6sd912.js} +1 -1
  181. package/bundle/{chunk-6wjdhvdf.js → chunk-hgcnzsd5.js} +1 -1
  182. package/bundle/chunk-hjy90gt2.js +2 -0
  183. package/bundle/{chunk-2zjet9tx.js → chunk-hk8m8vax.js} +2 -2
  184. package/bundle/chunk-hmden934.js +2 -0
  185. package/bundle/{chunk-0tkznq75.js → chunk-hnbtfpb7.js} +1 -1
  186. package/bundle/{chunk-ngyv4fhn.js → chunk-hp9q7vvq.js} +2 -2
  187. package/bundle/{chunk-kc8n5cgb.js → chunk-hrfdrz36.js} +1 -1
  188. package/bundle/chunk-hsm8fbb1.js +2 -0
  189. package/bundle/{chunk-yce8ph5b.js → chunk-hsmtjb4d.js} +2 -2
  190. package/bundle/chunk-hz1xfedb.js +2 -0
  191. package/bundle/{chunk-qq9yc2tp.js → chunk-hzzvmr41.js} +2 -2
  192. package/bundle/chunk-ja9y478k.js +2 -0
  193. package/bundle/chunk-jam7xyjf.js +2 -0
  194. package/bundle/{chunk-4a9jqe5s.js → chunk-jcn8bg31.js} +1 -1
  195. package/bundle/{chunk-2dmcpqak.js → chunk-jf4zyy7r.js} +1 -1
  196. package/bundle/{chunk-yspstxkq.js → chunk-jmrqp50k.js} +1 -1
  197. package/bundle/{chunk-qm9fm5ja.js → chunk-jrh028na.js} +2 -2
  198. package/bundle/{chunk-r81w6skn.js → chunk-jt94rhev.js} +1 -1
  199. package/bundle/{chunk-cs825mxr.js → chunk-k3x6z5q1.js} +1 -1
  200. package/bundle/chunk-k51qphrk.js +2 -0
  201. package/bundle/chunk-kee7xpe3.js +2 -0
  202. package/bundle/{chunk-61t4g8bh.js → chunk-m18pxkdg.js} +4 -4
  203. package/bundle/{chunk-npdgfqaw.js → chunk-map852em.js} +1 -1
  204. package/bundle/{chunk-wd2xmkdp.js → chunk-mbma071k.js} +2 -2
  205. package/bundle/{chunk-qyan69nb.js → chunk-mchf2bcc.js} +2 -2
  206. package/bundle/{chunk-x50adh71.js → chunk-mfg4stzn.js} +1 -1
  207. package/bundle/{chunk-snf6ahg7.js → chunk-mgff8bcx.js} +1 -1
  208. package/bundle/{chunk-81dvy370.js → chunk-mhn0a828.js} +1 -1
  209. package/bundle/{chunk-yh1t6jrj.js → chunk-mp5m0acf.js} +1 -1
  210. package/bundle/{chunk-1m78yy4k.js → chunk-mqtj38j9.js} +1 -1
  211. package/bundle/{chunk-cxtwavyf.js → chunk-mrh5q4s6.js} +2 -2
  212. package/bundle/{chunk-xcmbxny8.js → chunk-msbe5rb7.js} +1 -1
  213. package/bundle/{chunk-b8rzn48q.js → chunk-n73ckwr7.js} +1 -1
  214. package/bundle/{chunk-gqgjybjc.js → chunk-nn2hbew8.js} +1 -1
  215. package/bundle/{chunk-9nf5650d.js → chunk-npryn3en.js} +1 -1
  216. package/bundle/chunk-p13eeqe4.js +2 -0
  217. package/bundle/{chunk-a70m6kyn.js → chunk-p3tcw42f.js} +1 -1
  218. package/bundle/chunk-p45f2nyb.js +2 -0
  219. package/bundle/{chunk-q26s0wb5.js → chunk-p863r97y.js} +1 -1
  220. package/bundle/{chunk-tjfer79w.js → chunk-paqy0c2v.js} +1 -1
  221. package/bundle/{chunk-vsfj16v9.js → chunk-pfen4ekj.js} +2 -2
  222. package/bundle/{chunk-5p2r8bxx.js → chunk-pzn7cade.js} +1 -1
  223. package/bundle/{chunk-jt6bvxtr.js → chunk-q65qzc9w.js} +1 -1
  224. package/bundle/{chunk-h0pvxre5.js → chunk-q7wc3frq.js} +1 -1
  225. package/bundle/{chunk-141p12c4.js → chunk-qa38xchd.js} +1 -1
  226. package/bundle/{chunk-f0ab2f28.js → chunk-qqftaqza.js} +1 -1
  227. package/bundle/{chunk-d9w2bn2e.js → chunk-qvwx32p9.js} +2 -2
  228. package/bundle/chunk-qw9whsy2.js +2 -0
  229. package/bundle/{chunk-8nnajdwf.js → chunk-r65zw08x.js} +3 -3
  230. package/bundle/chunk-r77kpzdv.js +2 -0
  231. package/bundle/{chunk-e3mrw0k7.js → chunk-r9hsd9pw.js} +1 -1
  232. package/bundle/chunk-rc95tp19.js +2 -0
  233. package/bundle/{chunk-xv03hbgj.js → chunk-rf9pjbg3.js} +1 -1
  234. package/bundle/chunk-rmh2fhqy.js +2 -0
  235. package/bundle/{chunk-t9pq363q.js → chunk-rqdfmbns.js} +2 -2
  236. package/bundle/{chunk-ev6jwt7q.js → chunk-rr94dpe9.js} +1 -1
  237. package/bundle/chunk-rrn86a8w.js +2 -0
  238. package/bundle/{chunk-kk850sdw.js → chunk-rwt0rwvn.js} +2 -2
  239. package/bundle/{chunk-f6btedtt.js → chunk-s7ypkpg2.js} +1 -1
  240. package/bundle/{chunk-hgm8yfcb.js → chunk-s81ck6bw.js} +1 -1
  241. package/bundle/chunk-s8v0h63x.js +2 -0
  242. package/bundle/chunk-sh4mngre.js +2 -0
  243. package/bundle/chunk-shqqngm8.js +2 -0
  244. package/bundle/chunk-sjfcwykr.js +2 -0
  245. package/bundle/{chunk-q7s6z0nz.js → chunk-sn15skh8.js} +1 -1
  246. package/bundle/chunk-sv01v0n0.js +2 -0
  247. package/bundle/{chunk-dzma8zvf.js → chunk-sv27ep93.js} +2 -2
  248. package/bundle/{chunk-q8fjktv4.js → chunk-t1e52h0k.js} +1 -1
  249. package/bundle/{chunk-zskdxbbh.js → chunk-t1hw67x4.js} +1 -1
  250. package/bundle/{chunk-9pj10pgd.js → chunk-t4kma6mq.js} +2 -2
  251. package/bundle/{chunk-8v60bqm0.js → chunk-t66gerft.js} +1 -1
  252. package/bundle/{chunk-z69tt390.js → chunk-t7gp6mjm.js} +1 -1
  253. package/bundle/{chunk-dd461rg3.js → chunk-tks3qzsw.js} +1 -1
  254. package/bundle/{chunk-1h96bk6p.js → chunk-tn0sfsks.js} +2 -2
  255. package/bundle/chunk-tn8hsd2c.js +2 -0
  256. package/bundle/chunk-tqsx7w8z.js +2 -0
  257. package/bundle/{chunk-tdevq564.js → chunk-trg0zg0q.js} +1 -1
  258. package/bundle/chunk-tyt1negg.js +2 -0
  259. package/bundle/chunk-tz1sv9kt.js +3 -0
  260. package/bundle/{chunk-p506eydh.js → chunk-tzw56029.js} +1 -1
  261. package/bundle/{chunk-t5wdstzv.js → chunk-v30fmrz0.js} +1 -1
  262. package/bundle/chunk-v580zwpf.js +3 -0
  263. package/bundle/{chunk-6gbdvz6p.js → chunk-v6djkm35.js} +1 -1
  264. package/bundle/{chunk-h6z86aay.js → chunk-v9yxkbz7.js} +1 -1
  265. package/bundle/chunk-vdv6cyh0.js +2 -0
  266. package/bundle/{chunk-z0m1qm7j.js → chunk-vqxyk6as.js} +2 -2
  267. package/bundle/{chunk-se8d5xg9.js → chunk-vr7525pa.js} +1 -1
  268. package/bundle/chunk-vsk8yfxp.js +2 -0
  269. package/bundle/{chunk-vjt6mh10.js → chunk-vvcyvdnk.js} +2 -2
  270. package/bundle/chunk-vvgmkjym.js +2 -0
  271. package/bundle/{chunk-0bhzhh7s.js → chunk-vvmvryh1.js} +2 -2
  272. package/bundle/{chunk-eme9xmh3.js → chunk-vzf04vad.js} +1 -1
  273. package/bundle/{chunk-xstxdw7v.js → chunk-vzj91hg8.js} +1 -1
  274. package/bundle/chunk-w0zyex7f.js +2 -0
  275. package/bundle/{chunk-e72jwbfc.js → chunk-w264gs2c.js} +1 -1
  276. package/bundle/chunk-w623r5kb.js +3 -0
  277. package/bundle/{chunk-5rqjze1g.js → chunk-wac35a6p.js} +1 -1
  278. package/bundle/chunk-wkxt9v7s.js +2 -0
  279. package/bundle/{chunk-gb51fn3r.js → chunk-wqm1vawg.js} +1 -1
  280. package/bundle/{chunk-pchv413c.js → chunk-wrkt670m.js} +2 -2
  281. package/bundle/{chunk-2y5bthrp.js → chunk-wspm2k19.js} +1 -1
  282. package/bundle/chunk-wwf6zacw.js +2 -0
  283. package/bundle/{chunk-nqk8d62j.js → chunk-wwtyrgga.js} +1 -1
  284. package/bundle/{chunk-ajnzv5jt.js → chunk-x0wy15q9.js} +2 -2
  285. package/bundle/chunk-x9c8eddk.js +2 -0
  286. package/bundle/{chunk-ztvkzex1.js → chunk-xaewye8w.js} +1 -1
  287. package/bundle/{chunk-gq3zb4wv.js → chunk-xgdst5n5.js} +2 -2
  288. package/bundle/{chunk-3yfjgks3.js → chunk-xgphhnpk.js} +1 -1
  289. package/bundle/chunk-xjed8t2h.js +2 -0
  290. package/bundle/{chunk-qtyapmy7.js → chunk-xn6mwsc9.js} +1 -1
  291. package/bundle/{chunk-v0hnn7nb.js → chunk-xpz5mnwz.js} +1 -1
  292. package/bundle/{chunk-6axm2qtj.js → chunk-xrb46v1e.js} +1 -1
  293. package/bundle/chunk-xxhta1tm.js +2 -0
  294. package/bundle/{chunk-532fnfmw.js → chunk-y5m9c5ek.js} +2 -2
  295. package/bundle/{chunk-9s5h0f1y.js → chunk-y9kjt2jj.js} +2 -2
  296. package/bundle/{chunk-vbfc0wgv.js → chunk-y9mxwwz7.js} +2 -2
  297. package/bundle/{chunk-td9hm9be.js → chunk-ycth54ja.js} +1 -1
  298. package/bundle/{chunk-pky8h8rh.js → chunk-ydz7387e.js} +1 -1
  299. package/bundle/{chunk-f3y5kr76.js → chunk-yg5azmxb.js} +2 -2
  300. package/bundle/{chunk-j7637cwg.js → chunk-yhe5qz48.js} +2 -2
  301. package/bundle/chunk-yhj6858v.js +2 -0
  302. package/bundle/chunk-yq3byrpv.js +2 -0
  303. package/bundle/{chunk-3mtjxmw1.js → chunk-yqvqzg7b.js} +1 -1
  304. package/bundle/chunk-ys8ajwys.js +2 -0
  305. package/bundle/chunk-yzt7p956.js +2 -0
  306. package/bundle/{chunk-2cvwrabw.js → chunk-yzxcjr6y.js} +2 -2
  307. package/bundle/{chunk-f6vy70p6.js → chunk-z1psybn1.js} +2 -2
  308. package/bundle/{chunk-xj0zc9za.js → chunk-z2cnd2cp.js} +1 -1
  309. package/bundle/{chunk-s27cz24e.js → chunk-z4gczap3.js} +52 -52
  310. package/bundle/chunk-z56cb3fs.js +2 -0
  311. package/bundle/{chunk-qdafm7qg.js → chunk-z66xdxkg.js} +2 -2
  312. package/bundle/{chunk-v16n1fep.js → chunk-z6f54x4k.js} +2 -2
  313. package/bundle/{chunk-kds2g7r2.js → chunk-z6qb4gt5.js} +1 -1
  314. package/bundle/{chunk-q4mtwv1w.js → chunk-zgj7jx8k.js} +2 -2
  315. package/bundle/{chunk-mn5cacf6.js → chunk-zhddj91f.js} +2 -2
  316. package/bundle/chunk-zhypknyg.js +2 -0
  317. package/bundle/index.js +3 -3
  318. package/bundle/parser.worker.js +2 -2
  319. package/bundle/worker.js +1 -1
  320. package/package.json +3 -3
  321. package/bundle/chunk-062chtrq.js +0 -2
  322. package/bundle/chunk-062vs7bp.js +0 -2
  323. package/bundle/chunk-08g14hmz.js +0 -2
  324. package/bundle/chunk-0w2v8dfy.js +0 -2
  325. package/bundle/chunk-10fr7a2y.js +0 -2
  326. package/bundle/chunk-15bjhfav.js +0 -3
  327. package/bundle/chunk-1hv61m11.js +0 -2
  328. package/bundle/chunk-2mkvx8b2.js +0 -2
  329. package/bundle/chunk-2rykfc3a.js +0 -2
  330. package/bundle/chunk-2w5hx4fs.js +0 -2
  331. package/bundle/chunk-2yy63sxz.js +0 -2
  332. package/bundle/chunk-2z3fe4qw.js +0 -2
  333. package/bundle/chunk-361cmmrp.js +0 -2
  334. package/bundle/chunk-3r6dq1h3.js +0 -2
  335. package/bundle/chunk-4a12wv2m.js +0 -2
  336. package/bundle/chunk-547a55ba.js +0 -2
  337. package/bundle/chunk-5ztmc770.js +0 -2
  338. package/bundle/chunk-62x3r2q8.js +0 -2
  339. package/bundle/chunk-6th7vpwm.js +0 -2
  340. package/bundle/chunk-6ybh5smv.js +0 -2
  341. package/bundle/chunk-73kprndw.js +0 -2
  342. package/bundle/chunk-79fr19xf.js +0 -2
  343. package/bundle/chunk-7ezr478e.js +0 -2
  344. package/bundle/chunk-7gj1vqyj.js +0 -2
  345. package/bundle/chunk-7ywfkwb4.js +0 -2
  346. package/bundle/chunk-85fnnwm2.js +0 -2
  347. package/bundle/chunk-89fwh84w.js +0 -2
  348. package/bundle/chunk-8e724g3k.js +0 -2
  349. package/bundle/chunk-9894a2yn.js +0 -2
  350. package/bundle/chunk-98ye2nwt.js +0 -2
  351. package/bundle/chunk-9s4excg8.js +0 -2
  352. package/bundle/chunk-aetgcegz.js +0 -2
  353. package/bundle/chunk-agas0nay.js +0 -2
  354. package/bundle/chunk-ayknzc4m.js +0 -2
  355. package/bundle/chunk-b2ybst88.js +0 -2
  356. package/bundle/chunk-bd5vtjd7.js +0 -2
  357. package/bundle/chunk-bjqqk6jt.js +0 -2
  358. package/bundle/chunk-cpkcdykz.js +0 -2
  359. package/bundle/chunk-cyafm8d6.js +0 -2
  360. package/bundle/chunk-d4316r53.js +0 -2
  361. package/bundle/chunk-d8ym7mcg.js +0 -2
  362. package/bundle/chunk-dnpjxjkp.js +0 -2
  363. package/bundle/chunk-e5gjqtby.js +0 -2
  364. package/bundle/chunk-ee3mqzms.js +0 -2
  365. package/bundle/chunk-er5f61s5.js +0 -2
  366. package/bundle/chunk-er716522.js +0 -2
  367. package/bundle/chunk-ez3gacqe.js +0 -2
  368. package/bundle/chunk-fkc7wf1p.js +0 -2
  369. package/bundle/chunk-fm6z8nqb.js +0 -2
  370. package/bundle/chunk-g0qwm23d.js +0 -2
  371. package/bundle/chunk-g4yn8cj8.js +0 -2
  372. package/bundle/chunk-gsez13bg.js +0 -3
  373. package/bundle/chunk-h1spsy3y.js +0 -2
  374. package/bundle/chunk-h8gkv40j.js +0 -2
  375. package/bundle/chunk-j59kmb49.js +0 -2
  376. package/bundle/chunk-jv37ghev.js +0 -2
  377. package/bundle/chunk-k3hcb6qf.js +0 -2
  378. package/bundle/chunk-k5d822n2.js +0 -3
  379. package/bundle/chunk-m8ytbq04.js +0 -2
  380. package/bundle/chunk-mf9nc4xz.js +0 -2
  381. package/bundle/chunk-mxby91bj.js +0 -2
  382. package/bundle/chunk-mzv1gh6f.js +0 -2
  383. package/bundle/chunk-n0hsvvw8.js +0 -2
  384. package/bundle/chunk-nm1v9z14.js +0 -2
  385. package/bundle/chunk-p7nstcxa.js +0 -2
  386. package/bundle/chunk-pfwkvv7g.js +0 -2
  387. package/bundle/chunk-pn1jz8qj.js +0 -2
  388. package/bundle/chunk-pqvmtfk7.js +0 -2
  389. package/bundle/chunk-prgw26g3.js +0 -2
  390. package/bundle/chunk-pv9ty6v7.js +0 -2
  391. package/bundle/chunk-q4rstre7.js +0 -2
  392. package/bundle/chunk-q6jk2v6g.js +0 -2
  393. package/bundle/chunk-qd43npx3.js +0 -2
  394. package/bundle/chunk-qdb21y83.js +0 -2
  395. package/bundle/chunk-qeksaefy.js +0 -2
  396. package/bundle/chunk-r7t9yb9d.js +0 -2
  397. package/bundle/chunk-sdv3a4w3.js +0 -2
  398. package/bundle/chunk-sk89becn.js +0 -2
  399. package/bundle/chunk-tc0996xz.js +0 -2
  400. package/bundle/chunk-tfs50mgj.js +0 -2
  401. package/bundle/chunk-thecq33z.js +0 -3
  402. package/bundle/chunk-tjvtp9d9.js +0 -2
  403. package/bundle/chunk-tkm9m3n0.js +0 -2
  404. package/bundle/chunk-v1s1rcqx.js +0 -2
  405. package/bundle/chunk-v4dt4062.js +0 -2
  406. package/bundle/chunk-wgrq86kd.js +0 -2
  407. package/bundle/chunk-x8ks2bn7.js +0 -2
  408. package/bundle/chunk-xy2ty5h5.js +0 -8
  409. package/bundle/chunk-z0383stv.js +0 -2
  410. package/bundle/chunk-zewrmk8x.js +0 -2
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Js as x}from"./chunk-9d0exvey.js";import{bt as K,ct as j,qt as V,xt as q,yt as H}from"./chunk-azss4acq.js";import{du as M,iu as I}from"./chunk-cxtwavyf.js";import{XE as v,cI as _}from"./chunk-2zjet9tx.js";import{sP as a}from"./chunk-djfrkbd5.js";var U={};a(U,{validateArchiveMetadata:()=>P,validateArchiveEntries:()=>g,replaceDirectoryAtomically:()=>C,extractZip:()=>p,assertArchiveDestinationSafe:()=>T});import m from"path";import c from"fs/promises";function g(o,r){let n=m.resolve(r);for(let e of o){let t=e.trim().replaceAll("\\","/");if(!t)continue;if(t.includes("\x00")||m.posix.isAbsolute(t)||/^[a-z]:\//i.test(t))throw Error(`Unsafe archive entry: ${e}`);if(t.split("/").includes(".."))throw Error(`Unsafe archive entry: ${e}`);let s=m.resolve(n,...t.split("/"));if(s!==n&&!s.startsWith(`${n}${m.sep}`))throw Error(`Unsafe archive entry: ${e}`)}}function P(o){for(let r of o.split(/\r?\n/))if(/^[bclps]/.test(r))throw Error("Archive contains an unsafe special entry")}async function u(o){let r=await c.readdir(o,{withFileTypes:!0});await Promise.all(r.map(async(n)=>{let e=m.join(o,n.name);if(n.isSymbolicLink())throw Error(`Archive contains a symbolic link: ${n.name}`);if(n.isDirectory())await u(e)}))}async function b(o){return c.lstat(o).catch((r)=>{if(r.code==="ENOENT")return;throw r})}async function T(o){let r=m.resolve(o),n=m.parse(r),e=n.root;for(let t of r.slice(n.root.length).split(m.sep).filter(Boolean)){e=m.join(e,t);let s=await b(e);if(!s)return;if(s.isSymbolicLink())throw Error(`Archive destination contains a symbolic link: ${e}`)}}async function C(o,r){let n=m.resolve(r);await T(n);let e=await b(n);if(e&&!e.isDirectory())throw Error("Archive destination must be a directory");let t=m.join(m.dirname(n),`.qitqode-backup-${crypto.randomUUID()}`);if(e)await c.rename(n,t);try{await c.rename(o,n)}catch(s){if(e)await c.rename(t,n);throw s}if(e)await c.rm(t,{recursive:!0,force:!0})}async function p(o,r){let n=m.resolve(o),e=m.resolve(r),t=await x(process.platform==="win32"?["tar","-tf",n]:["unzip","-Z1",n]);g(t.stdout.toString().split(/\r?\n/),e);let s=await x(process.platform==="win32"?["tar","-tvf",n]:["unzip","-Z","-l",n]);P(s.stdout.toString()),await T(m.dirname(e)),await c.mkdir(m.dirname(e),{recursive:!0}),await T(m.dirname(e));let f=await c.mkdtemp(m.join(m.dirname(e),".qitqode-extract-"));try{if(process.platform==="win32"){let w=n.replace(/'/g,"''"),R=f.replace(/'/g,"''"),S=`$global:ProgressPreference = 'SilentlyContinue'; Expand-Archive -Path '${w}' -DestinationPath '${R}' -Force`;await x(["powershell","-NoProfile","-NonInteractive","-Command",S])}else await x(["unzip","-o","-q",n,"-d",f]);await u(f),await C(f,e)}finally{await c.rm(f,{recursive:!0,force:!0})}}var $={};a($,{isValidHex:()=>J,hexToRgb:()=>F,hexToAnsiBold:()=>y});function J(o){if(!o)return!1;return/^#[0-9a-fA-F]{6}$/.test(o)}function F(o){let r=parseInt(o.slice(1,3),16),n=parseInt(o.slice(3,5),16),e=parseInt(o.slice(5,7),16);return{r,g:n,b:e}}function y(o){if(!J(o))return;let{r,g:n,b:e}=F(o);return`\x1B[38;2;${r};${n};${e}m\x1B[1m`}var Q={};a(Q,{awaitDeferred:()=>k});function k(o,r){return _.ensuring(v.await(o),_.sync(r))}import d from"os";import oo from"path";var i;async function A(){if(i)return i;let o=oo.join(I.Path.data,"installation_id"),r=await M.readText(o).catch(()=>{return});if(r&&r.trim())return i=r.trim(),i;return i=crypto.randomUUID(),await M.write(o,i),i}function ro(){if(process.env.USER)return process.env.USER;if(process.env.USERNAME)return process.env.USERNAME;return d.userInfo().username}function no(){return Intl.DateTimeFormat().resolvedOptions().locale}function eo(){return Intl.DateTimeFormat().resolvedOptions().timeZone}async function to(){let o=d.cpus();return{os:{platform:d.platform(),arch:d.arch(),release:d.release(),hostname:d.hostname()},cpu:{model:o[0]?.model??"unknown",count:o.length},memory:{total_bytes:d.totalmem()},user:{username:ro(),homedir:d.homedir()},runtime:{bun_version:Bun.version,node_version:process.versions.node,pid:process.pid,timezone:eo(),locale:no()},paths:{cwd:process.cwd(),data:I.Path.data,config:I.Path.config},qitqode:{version:K,channel:j,installation_id:await A(),run_id:q,process_role:H}}}var W={};a(W,{toString:()=>mo,parse:()=>co,match:()=>so,fromParsedKey:()=>fo});function so(o,r){if(!o)return!1;let n={...o,super:o.super??!1},e={...r,super:r.super??!1};return V(n,e)}function fo(o,r=!1){return{name:o.name===" "?"space":o.name,ctrl:o.ctrl,meta:o.meta,shift:o.shift,super:o.super??!1,leader:r}}function mo(o){if(!o)return"";let r=[];if(o.ctrl)r.push("ctrl");if(o.meta)r.push("alt");if(o.super)r.push("super");if(o.shift)r.push("shift");if(o.name)if(o.name==="delete")r.push("del");else r.push(o.name);let n=r.join("+");if(o.leader)n=n?`<leader> ${n}`:"<leader>";return n}function co(o){if(o==="none")return[];return o.split(",").map((r)=>{let e=r.replace(/<leader>/g,"leader+").toLowerCase().split("+"),t={ctrl:!1,meta:!1,shift:!1,leader:!1,name:""};for(let s of e)switch(s){case"ctrl":t.ctrl=!0;break;case"alt":case"meta":case"option":t.meta=!0;break;case"super":t.super=!0;break;case"shift":t.shift=!0;break;case"leader":t.leader=!0;break;case"esc":t.name="escape";break;default:t.name=s;break}return t})}var B={};a(B,{create:()=>io,NotFound:()=>O});import{AsyncLocalStorage as ao}from"async_hooks";class O extends Error{name;constructor(o){super(`No context found for ${o}`);this.name=o}}function io(o){let r=new ao;return{use(){let n=r.getStore();if(!n)throw new O(o);return n},provide(n,e){return r.run(n,e)}}}var X={};a(X,{truncateMiddle:()=>To,truncate:()=>Ro,todayTimeOrDateTime:()=>xo,titlecase:()=>wo,time:()=>N,pluralize:()=>Mo,number:()=>Io,duration:()=>Eo,datetime:()=>G});function wo(o){return o.replace(/\b\w/g,(r)=>r.toUpperCase())}function N(o){return new Date(o).toLocaleTimeString(void 0,{timeStyle:"short"})}function G(o){let r=new Date(o),n=N(o),e=r.toLocaleDateString();return`${n} \xB7 ${e}`}function xo(o){let r=new Date(o),n=new Date;if(r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()&&r.getDate()===n.getDate())return N(o);else return G(o)}function Io(o){if(o>=1e6)return(o/1e6).toFixed(1)+"M";else if(o>=1000)return(o/1000).toFixed(1)+"K";return o.toString()}function Eo(o){if(o<1000)return`${o}ms`;if(o<60000)return`${(o/1000).toFixed(1)}s`;if(o<3600000){let e=Math.floor(o/60000),t=Math.floor(o%60000/1000);return`${e}m ${t}s`}if(o<86400000){let e=Math.floor(o/3600000),t=Math.floor(o%3600000/60000);return`${e}h ${t}m`}let r=Math.floor(o%86400000/3600000);return`${Math.floor(o/86400000)}d ${r}h`}function Ro(o,r){if(r<=0)return"";if(o.length<=r)return o;return o.slice(0,r-1)+"\u2026"}function To(o,r=35){if(r<=0)return"";if(o.length<=r)return o;let n="\u2026",e=Math.ceil((r-n.length)/2),t=Math.floor((r-n.length)/2);return o.slice(0,e)+n+(t>0?o.slice(-t):"")}function Mo(o,r,n){return(o===1?r:n).replace("{}",o.toString())}var h={};a(h,{write:()=>Oo,read:()=>_o});var E=new Map;function Y(o){if(!E.has(o))E.set(o,{readers:0,writer:!1,waitingReaders:[],waitingWriters:[]});return E.get(o)}function So(o){let r=E.get(o);if(!r||r.writer||r.readers>0)return;if(r.waitingWriters.length>0){r.waitingWriters.shift()();return}while(r.waitingReaders.length>0)r.waitingReaders.shift()();if(r.readers===0&&!r.writer&&r.waitingReaders.length===0&&r.waitingWriters.length===0)E.delete(o)}function L(o){return new Promise((r)=>{let n=()=>{o.acquire();let e=!1;r({[Symbol.dispose]:()=>{if(e)return;e=!0,o.release(),So(o.key)}})};if(o.available())n();else o.waiting.push(n)})}async function _o(o){let r=Y(o);return L({key:o,available:()=>!r.writer&&r.waitingWriters.length===0,acquire:()=>r.readers++,release:()=>r.readers--,waiting:r.waitingReaders})}async function Oo(o){let r=Y(o);return L({key:o,available:()=>!r.writer&&r.readers===0,acquire:()=>{r.writer=!0},release:()=>{r.writer=!1},waiting:r.waitingWriters})}var z={};a(z,{listen:()=>No,emit:()=>go,client:()=>Po});function No(o){onmessage=async(r)=>{let n=JSON.parse(r.data);if(n.type==="rpc.request")try{let e=await o[n.method](n.input);postMessage(JSON.stringify({type:"rpc.result",result:e,id:n.id}))}catch(e){postMessage(JSON.stringify({type:"rpc.result",error:e instanceof Error?e.message:String(e),id:n.id}))}}}function go(o,r){postMessage(JSON.stringify({type:"rpc.event",event:o,data:r}))}function Po(o){let r=new Map,n=new Map,e=0;return o.onmessage=async(t)=>{let s=JSON.parse(t.data);if(s.type==="rpc.result"){let f=r.get(s.id);if(f)if(r.delete(s.id),"error"in s)f.reject(Error(typeof s.error==="string"?s.error:"RPC call failed"));else f.resolve(s.result)}if(s.type==="rpc.event"){let f=n.get(s.event);if(f)for(let w of f)w(s.data)}},{call(t,s){let f=e++;return new Promise((w,R)=>{r.set(f,{resolve:w,reject:R});try{o.postMessage(JSON.stringify({type:"rpc.request",method:t,input:s,id:f}))}catch(S){r.delete(f),R(S)}})},on(t,s){let f=n.get(t);if(!f)f=new Set,n.set(t,f);return f.add(s),()=>{f.delete(s)}}}}var D={};a(D,{estimate:()=>Z});function Z(o){return Math.max(0,Math.round((o||"").length/4))}export{U as vs,$ as ws,Q as xs,A as ys,to as zs,W as As,B as Bs,X as Cs,h as Ds,Po as Es,z as Fs,D as Gs};
2
+ import{Ks as x}from"./chunk-9a9qcvtz.js";import{ct as K,dt as j,rt as V,yt as q,zt as H}from"./chunk-dpm5x19e.js";import{eu as M,ju as I}from"./chunk-mrh5q4s6.js";import{YE as v,dI as _}from"./chunk-hk8m8vax.js";import{tP as a}from"./chunk-0xf12tf3.js";var U={};a(U,{validateArchiveMetadata:()=>P,validateArchiveEntries:()=>g,replaceDirectoryAtomically:()=>C,extractZip:()=>p,assertArchiveDestinationSafe:()=>T});import m from"path";import c from"fs/promises";function g(o,r){let n=m.resolve(r);for(let e of o){let t=e.trim().replaceAll("\\","/");if(!t)continue;if(t.includes("\x00")||m.posix.isAbsolute(t)||/^[a-z]:\//i.test(t))throw Error(`Unsafe archive entry: ${e}`);if(t.split("/").includes(".."))throw Error(`Unsafe archive entry: ${e}`);let s=m.resolve(n,...t.split("/"));if(s!==n&&!s.startsWith(`${n}${m.sep}`))throw Error(`Unsafe archive entry: ${e}`)}}function P(o){for(let r of o.split(/\r?\n/))if(/^[bclps]/.test(r))throw Error("Archive contains an unsafe special entry")}async function u(o){let r=await c.readdir(o,{withFileTypes:!0});await Promise.all(r.map(async(n)=>{let e=m.join(o,n.name);if(n.isSymbolicLink())throw Error(`Archive contains a symbolic link: ${n.name}`);if(n.isDirectory())await u(e)}))}async function b(o){return c.lstat(o).catch((r)=>{if(r.code==="ENOENT")return;throw r})}async function T(o){let r=m.resolve(o),n=m.parse(r),e=n.root;for(let t of r.slice(n.root.length).split(m.sep).filter(Boolean)){e=m.join(e,t);let s=await b(e);if(!s)return;if(s.isSymbolicLink())throw Error(`Archive destination contains a symbolic link: ${e}`)}}async function C(o,r){let n=m.resolve(r);await T(n);let e=await b(n);if(e&&!e.isDirectory())throw Error("Archive destination must be a directory");let t=m.join(m.dirname(n),`.qitqode-backup-${crypto.randomUUID()}`);if(e)await c.rename(n,t);try{await c.rename(o,n)}catch(s){if(e)await c.rename(t,n);throw s}if(e)await c.rm(t,{recursive:!0,force:!0})}async function p(o,r){let n=m.resolve(o),e=m.resolve(r),t=await x(process.platform==="win32"?["tar","-tf",n]:["unzip","-Z1",n]);g(t.stdout.toString().split(/\r?\n/),e);let s=await x(process.platform==="win32"?["tar","-tvf",n]:["unzip","-Z","-l",n]);P(s.stdout.toString()),await T(m.dirname(e)),await c.mkdir(m.dirname(e),{recursive:!0}),await T(m.dirname(e));let f=await c.mkdtemp(m.join(m.dirname(e),".qitqode-extract-"));try{if(process.platform==="win32"){let w=n.replace(/'/g,"''"),R=f.replace(/'/g,"''"),S=`$global:ProgressPreference = 'SilentlyContinue'; Expand-Archive -Path '${w}' -DestinationPath '${R}' -Force`;await x(["powershell","-NoProfile","-NonInteractive","-Command",S])}else await x(["unzip","-o","-q",n,"-d",f]);await u(f),await C(f,e)}finally{await c.rm(f,{recursive:!0,force:!0})}}var $={};a($,{isValidHex:()=>J,hexToRgb:()=>F,hexToAnsiBold:()=>y});function J(o){if(!o)return!1;return/^#[0-9a-fA-F]{6}$/.test(o)}function F(o){let r=parseInt(o.slice(1,3),16),n=parseInt(o.slice(3,5),16),e=parseInt(o.slice(5,7),16);return{r,g:n,b:e}}function y(o){if(!J(o))return;let{r,g:n,b:e}=F(o);return`\x1B[38;2;${r};${n};${e}m\x1B[1m`}var Q={};a(Q,{awaitDeferred:()=>k});function k(o,r){return _.ensuring(v.await(o),_.sync(r))}import d from"os";import oo from"path";var i;async function A(){if(i)return i;let o=oo.join(I.Path.data,"installation_id"),r=await M.readText(o).catch(()=>{return});if(r&&r.trim())return i=r.trim(),i;return i=crypto.randomUUID(),await M.write(o,i),i}function ro(){if(process.env.USER)return process.env.USER;if(process.env.USERNAME)return process.env.USERNAME;return d.userInfo().username}function no(){return Intl.DateTimeFormat().resolvedOptions().locale}function eo(){return Intl.DateTimeFormat().resolvedOptions().timeZone}async function to(){let o=d.cpus();return{os:{platform:d.platform(),arch:d.arch(),release:d.release(),hostname:d.hostname()},cpu:{model:o[0]?.model??"unknown",count:o.length},memory:{total_bytes:d.totalmem()},user:{username:ro(),homedir:d.homedir()},runtime:{bun_version:Bun.version,node_version:process.versions.node,pid:process.pid,timezone:eo(),locale:no()},paths:{cwd:process.cwd(),data:I.Path.data,config:I.Path.config},qitqode:{version:K,channel:j,installation_id:await A(),run_id:q,process_role:H}}}var W={};a(W,{toString:()=>mo,parse:()=>co,match:()=>so,fromParsedKey:()=>fo});function so(o,r){if(!o)return!1;let n={...o,super:o.super??!1},e={...r,super:r.super??!1};return V(n,e)}function fo(o,r=!1){return{name:o.name===" "?"space":o.name,ctrl:o.ctrl,meta:o.meta,shift:o.shift,super:o.super??!1,leader:r}}function mo(o){if(!o)return"";let r=[];if(o.ctrl)r.push("ctrl");if(o.meta)r.push("alt");if(o.super)r.push("super");if(o.shift)r.push("shift");if(o.name)if(o.name==="delete")r.push("del");else r.push(o.name);let n=r.join("+");if(o.leader)n=n?`<leader> ${n}`:"<leader>";return n}function co(o){if(o==="none")return[];return o.split(",").map((r)=>{let e=r.replace(/<leader>/g,"leader+").toLowerCase().split("+"),t={ctrl:!1,meta:!1,shift:!1,leader:!1,name:""};for(let s of e)switch(s){case"ctrl":t.ctrl=!0;break;case"alt":case"meta":case"option":t.meta=!0;break;case"super":t.super=!0;break;case"shift":t.shift=!0;break;case"leader":t.leader=!0;break;case"esc":t.name="escape";break;default:t.name=s;break}return t})}var B={};a(B,{create:()=>io,NotFound:()=>O});import{AsyncLocalStorage as ao}from"async_hooks";class O extends Error{name;constructor(o){super(`No context found for ${o}`);this.name=o}}function io(o){let r=new ao;return{use(){let n=r.getStore();if(!n)throw new O(o);return n},provide(n,e){return r.run(n,e)}}}var X={};a(X,{truncateMiddle:()=>To,truncate:()=>Ro,todayTimeOrDateTime:()=>xo,titlecase:()=>wo,time:()=>N,pluralize:()=>Mo,number:()=>Io,duration:()=>Eo,datetime:()=>G});function wo(o){return o.replace(/\b\w/g,(r)=>r.toUpperCase())}function N(o){return new Date(o).toLocaleTimeString(void 0,{timeStyle:"short"})}function G(o){let r=new Date(o),n=N(o),e=r.toLocaleDateString();return`${n} \xB7 ${e}`}function xo(o){let r=new Date(o),n=new Date;if(r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()&&r.getDate()===n.getDate())return N(o);else return G(o)}function Io(o){if(o>=1e6)return(o/1e6).toFixed(1)+"M";else if(o>=1000)return(o/1000).toFixed(1)+"K";return o.toString()}function Eo(o){if(o<1000)return`${o}ms`;if(o<60000)return`${(o/1000).toFixed(1)}s`;if(o<3600000){let e=Math.floor(o/60000),t=Math.floor(o%60000/1000);return`${e}m ${t}s`}if(o<86400000){let e=Math.floor(o/3600000),t=Math.floor(o%3600000/60000);return`${e}h ${t}m`}let r=Math.floor(o%86400000/3600000);return`${Math.floor(o/86400000)}d ${r}h`}function Ro(o,r){if(r<=0)return"";if(o.length<=r)return o;return o.slice(0,r-1)+"\u2026"}function To(o,r=35){if(r<=0)return"";if(o.length<=r)return o;let n="\u2026",e=Math.ceil((r-n.length)/2),t=Math.floor((r-n.length)/2);return o.slice(0,e)+n+(t>0?o.slice(-t):"")}function Mo(o,r,n){return(o===1?r:n).replace("{}",o.toString())}var h={};a(h,{write:()=>Oo,read:()=>_o});var E=new Map;function Y(o){if(!E.has(o))E.set(o,{readers:0,writer:!1,waitingReaders:[],waitingWriters:[]});return E.get(o)}function So(o){let r=E.get(o);if(!r||r.writer||r.readers>0)return;if(r.waitingWriters.length>0){r.waitingWriters.shift()();return}while(r.waitingReaders.length>0)r.waitingReaders.shift()();if(r.readers===0&&!r.writer&&r.waitingReaders.length===0&&r.waitingWriters.length===0)E.delete(o)}function L(o){return new Promise((r)=>{let n=()=>{o.acquire();let e=!1;r({[Symbol.dispose]:()=>{if(e)return;e=!0,o.release(),So(o.key)}})};if(o.available())n();else o.waiting.push(n)})}async function _o(o){let r=Y(o);return L({key:o,available:()=>!r.writer&&r.waitingWriters.length===0,acquire:()=>r.readers++,release:()=>r.readers--,waiting:r.waitingReaders})}async function Oo(o){let r=Y(o);return L({key:o,available:()=>!r.writer&&r.readers===0,acquire:()=>{r.writer=!0},release:()=>{r.writer=!1},waiting:r.waitingWriters})}var z={};a(z,{listen:()=>No,emit:()=>go,client:()=>Po});function No(o){onmessage=async(r)=>{let n=JSON.parse(r.data);if(n.type==="rpc.request")try{let e=await o[n.method](n.input);postMessage(JSON.stringify({type:"rpc.result",result:e,id:n.id}))}catch(e){postMessage(JSON.stringify({type:"rpc.result",error:e instanceof Error?e.message:String(e),id:n.id}))}}}function go(o,r){postMessage(JSON.stringify({type:"rpc.event",event:o,data:r}))}function Po(o){let r=new Map,n=new Map,e=0;return o.onmessage=async(t)=>{let s=JSON.parse(t.data);if(s.type==="rpc.result"){let f=r.get(s.id);if(f)if(r.delete(s.id),"error"in s)f.reject(Error(typeof s.error==="string"?s.error:"RPC call failed"));else f.resolve(s.result)}if(s.type==="rpc.event"){let f=n.get(s.event);if(f)for(let w of f)w(s.data)}},{call(t,s){let f=e++;return new Promise((w,R)=>{r.set(f,{resolve:w,reject:R});try{o.postMessage(JSON.stringify({type:"rpc.request",method:t,input:s,id:f}))}catch(S){r.delete(f),R(S)}})},on(t,s){let f=n.get(t);if(!f)f=new Set,n.set(t,f);return f.add(s),()=>{f.delete(s)}}}}var D={};a(D,{estimate:()=>Z});function Z(o){return Math.max(0,Math.round((o||"").length/4))}export{U as ws,$ as xs,Q as ys,A as zs,to as As,W as Bs,B as Cs,X as Ds,h as Es,Po as Fs,z as Gs,D as Hs};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{$f as X}from"./chunk-xvvt886p.js";import{Dg as x,zg as M}from"./chunk-f6vy70p6.js";import{tj as B}from"./chunk-s27cz24e.js";import{_o as G,cp as C,jp as N,kp as V,np as L}from"./chunk-wh2qqhep.js";import{cI as z}from"./chunk-2zjet9tx.js";var Z="forgewise";function A(j){if(!j||j.type!=="api")return"skip";if(j.method==="api-key")return"skip";if(M(j.expiresAt))return"skip";return"probe"}function F(j){if(j===null)return"skipped";if(!j)return"revoked";return"valid"}function U(j){if(!j||j.type!=="api")return{kind:"skip"};if(j.method==="api-key")return{kind:"skip"};if(!M(j.expiresAt))return{kind:"skip"};if(j.refreshToken)return{kind:"refresh-token",refreshToken:j.refreshToken};return{kind:"browser"}}function T(j){if(j==="invalid_grant")return{kind:"revoked"};if(j===null)return{kind:"transient"};return{kind:"persist",credential:L(j,{rotateRefreshToken:!0})}}var b=1e4;function P(j){if(!j)return;if(j.type!=="api")return{type:j.type,expiresAt:0};return{type:j.type,method:j.metadata?.method,expiresAt:Number(j.metadata?.expires_at??0),refreshToken:j.metadata?.refresh_token}}function w(){if(process.platform==="linux")return Boolean(process.env.DISPLAY||process.env.WAYLAND_DISPLAY);return process.platform==="win32"||process.platform==="darwin"}var K=()=>z.gen(function*(){let j=yield*B.Service,D=yield*z.orElseSucceed(j.get(Z),()=>{return});if(A(P(D))==="skip")return"skipped";if(!D||D.type!=="api")return"skipped";let J=yield*z.orElseSucceed(z.tryPromise({try:()=>C(),catch:()=>{return}}).pipe(z.map((Q)=>Q.issuer)),()=>{return});if(!J)return"skipped";let $=yield*z.promise(()=>N(J,D.key)),H=F($);if(H==="revoked")yield*z.orElseSucceed(j.remove(Z),()=>{return});return H}).pipe(z.withSpan("forgewise.validateStoredToken")),W=()=>z.gen(function*(){let j=yield*B.Service,D=yield*z.orElseSucceed(j.get(Z),()=>{return}),J=U(P(D));if(J.kind==="skip")return"skipped";if(J.kind==="refresh-token"){let _=yield*z.promise(()=>V(J.refreshToken).catch(()=>null)),q=T(_);if(q.kind==="revoked")return yield*z.orElseSucceed(j.remove(Z),()=>{return}),"failed";if(q.kind==="persist")return(yield*j.set(Z,q.credential).pipe(z.map(()=>!0),z.catch(()=>z.succeed(!1))))?"ok":"failed"}if(!w())return"skipped";let $=new AbortController,H=setTimeout(()=>$.abort(),b),Q=yield*z.promise(()=>x({signal:$.signal}).catch(()=>null).finally(()=>clearTimeout(H)));if(!Q)return"failed";let Y=L(Q,{rotateRefreshToken:!1});return(yield*j.set(Z,Y).pipe(z.map(()=>!0),z.catch(()=>z.succeed(!1))))?"ok":"failed"}).pipe(z.withSpan("forgewise.refreshIfNeeded"));var E=()=>z.gen(function*(){if((yield*z.promise(()=>G()))?.method!=="sso")return"ok";if((yield*K())==="revoked")return yield*z.sync(()=>X.println(X.Style.TEXT_DANGER+"Your session was revoked (signed out from another device or by an admin action). Run `qitqode auth login` to sign in again."+X.Style.TEXT_NORMAL)),"revoked";if((yield*W())==="failed")yield*z.sync(()=>X.println(X.Style.TEXT_DIM+"(Session refresh failed \u2014 run `qitqode auth login` to re-authenticate)"+X.Style.TEXT_NORMAL));return"ok"});
2
+ import{ag as X}from"./chunk-d2049chz.js";import{Ag as M,Eg as x}from"./chunk-z1psybn1.js";import{uj as B}from"./chunk-z4gczap3.js";import{$o as G,dp as C,kp as N,lp as V,op as L}from"./chunk-6wt8g6mc.js";import{dI as z}from"./chunk-hk8m8vax.js";var Z="forgewise";function A(j){if(!j||j.type!=="api")return"skip";if(j.method==="api-key")return"skip";if(M(j.expiresAt))return"skip";return"probe"}function F(j){if(j===null)return"skipped";if(!j)return"revoked";return"valid"}function U(j){if(!j||j.type!=="api")return{kind:"skip"};if(j.method==="api-key")return{kind:"skip"};if(!M(j.expiresAt))return{kind:"skip"};if(j.refreshToken)return{kind:"refresh-token",refreshToken:j.refreshToken};return{kind:"browser"}}function T(j){if(j==="invalid_grant")return{kind:"revoked"};if(j===null)return{kind:"transient"};return{kind:"persist",credential:L(j,{rotateRefreshToken:!0})}}var b=1e4;function P(j){if(!j)return;if(j.type!=="api")return{type:j.type,expiresAt:0};return{type:j.type,method:j.metadata?.method,expiresAt:Number(j.metadata?.expires_at??0),refreshToken:j.metadata?.refresh_token}}function w(){if(process.platform==="linux")return Boolean(process.env.DISPLAY||process.env.WAYLAND_DISPLAY);return process.platform==="win32"||process.platform==="darwin"}var K=()=>z.gen(function*(){let j=yield*B.Service,D=yield*z.orElseSucceed(j.get(Z),()=>{return});if(A(P(D))==="skip")return"skipped";if(!D||D.type!=="api")return"skipped";let J=yield*z.orElseSucceed(z.tryPromise({try:()=>C(),catch:()=>{return}}).pipe(z.map((Q)=>Q.issuer)),()=>{return});if(!J)return"skipped";let $=yield*z.promise(()=>N(J,D.key)),H=F($);if(H==="revoked")yield*z.orElseSucceed(j.remove(Z),()=>{return});return H}).pipe(z.withSpan("forgewise.validateStoredToken")),W=()=>z.gen(function*(){let j=yield*B.Service,D=yield*z.orElseSucceed(j.get(Z),()=>{return}),J=U(P(D));if(J.kind==="skip")return"skipped";if(J.kind==="refresh-token"){let _=yield*z.promise(()=>V(J.refreshToken).catch(()=>null)),q=T(_);if(q.kind==="revoked")return yield*z.orElseSucceed(j.remove(Z),()=>{return}),"failed";if(q.kind==="persist")return(yield*j.set(Z,q.credential).pipe(z.map(()=>!0),z.catch(()=>z.succeed(!1))))?"ok":"failed"}if(!w())return"skipped";let $=new AbortController,H=setTimeout(()=>$.abort(),b),Q=yield*z.promise(()=>x({signal:$.signal}).catch(()=>null).finally(()=>clearTimeout(H)));if(!Q)return"failed";let Y=L(Q,{rotateRefreshToken:!1});return(yield*j.set(Z,Y).pipe(z.map(()=>!0),z.catch(()=>z.succeed(!1))))?"ok":"failed"}).pipe(z.withSpan("forgewise.refreshIfNeeded"));var E=()=>z.gen(function*(){if((yield*z.promise(()=>G()))?.method!=="sso")return"ok";if((yield*K())==="revoked")return yield*z.sync(()=>X.println(X.Style.TEXT_DANGER+"Your session was revoked (signed out from another device or by an admin action). Run `qitqode auth login` to sign in again."+X.Style.TEXT_NORMAL)),"revoked";if((yield*W())==="failed")yield*z.sync(()=>X.println(X.Style.TEXT_DIM+"(Session refresh failed \u2014 run `qitqode auth login` to re-authenticate)"+X.Style.TEXT_NORMAL));return"ok"});
3
3
  export{E as h};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ih as f,Jh as q,Kh as w,Lh as x}from"./chunk-4q14whpc.js";import"./chunk-0xf12tf3.js";export{w as applyModuleEvalRuntimeOptions,q as applyBaseRuntimeOptions,x as QuickJSWASMModule,f as QuickJSModuleCallbacks};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ld as a}from"./chunk-mp5m0acf.js";import"./chunk-8t17w67q.js";import"./chunk-0xf12tf3.js";export{a as dict};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import"./chunk-0xf12tf3.js";var r="./highlights-eq9cgrbb.scm";export{r as default};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import"./chunk-djfrkbd5.js";var e={"ui.sessionReview.title":"Altera\xE7\xF5es da sess\xE3o","ui.sessionReview.title.lastTurn":"Altera\xE7\xF5es do \xFAltimo turno","ui.sessionReview.diffStyle.unified":"Unificado","ui.sessionReview.diffStyle.split":"Dividido","ui.sessionReview.openFile":"Abrir ficheiro","ui.sessionReview.selection.line":"linha {{line}}","ui.sessionReview.selection.lines":"linhas {{start}}-{{end}}","ui.sessionReview.expandAll":"Expandir tudo","ui.sessionReview.collapseAll":"Recolher tudo","ui.sessionReview.change.added":"Adicionado","ui.sessionReview.change.removed":"Removido","ui.sessionReview.change.modified":"Modificado","ui.sessionReview.image.loading":"A carregar...","ui.sessionReview.image.placeholder":"Imagem","ui.sessionReview.largeDiff.title":"Diff demasiado grande para renderizar","ui.sessionReview.largeDiff.meta":"Limite: {{limit}} linhas alteradas. Atual: {{current}} linhas alteradas.","ui.sessionReview.largeDiff.renderAnyway":"Renderizar mesmo assim","ui.fileMedia.kind.image":"imagem","ui.fileMedia.kind.audio":"\xE1udio","ui.fileMedia.state.removed":"Ficheiro de {{kind}} removido.","ui.fileMedia.state.loading":"A carregar {{kind}}...","ui.fileMedia.state.error":"Imposs\xEDvel carregar {{kind}}.","ui.fileMedia.state.unavailable":"Pr\xE9-visualiza\xE7\xE3o de {{kind}} indispon\xEDvel.","ui.fileMedia.binary.title":"Ficheiro bin\xE1rio","ui.fileMedia.binary.description.path":"{{path}} \xE9 bin\xE1rio.","ui.fileMedia.binary.description.default":"Conte\xFAdo bin\xE1rio","ui.lineComment.label.prefix":"Comentar em ","ui.lineComment.label.suffix":"","ui.lineComment.editorLabel.prefix":"A comentar em ","ui.lineComment.editorLabel.suffix":"","ui.lineComment.placeholder":"Adicionar coment\xE1rio","ui.lineComment.submit":"Comentar","ui.sessionTurn.steps.show":"Mostrar passos","ui.sessionTurn.steps.hide":"Ocultar passos","ui.sessionTurn.summary.response":"Resposta","ui.sessionTurn.diff.showMore":"Mostrar mais altera\xE7\xF5es ({{count}})","ui.sessionTurn.diffs.changed":"Alterado","ui.sessionTurn.diffs.showAll":"Mostrar tudo","ui.sessionTurn.diffs.showLess":"Mostrar menos","ui.sessionTurn.diffs.more":"+{{count}} ficheiros","ui.sessionTurn.retry.retrying":"a tentar novamente","ui.sessionTurn.retry.inSeconds":"em {{seconds}}s","ui.sessionTurn.retry.attempt":"tentativa #{{attempt}}","ui.sessionTurn.retry.attemptLine":"{{line}} - tentativa #{{attempt}}","ui.sessionTurn.retry.geminiHot":"o gemini est\xE1 sobrecarregado neste momento","ui.sessionTurn.error.freeUsageExceeded":"Limite de uso gratuito excedido","ui.sessionTurn.error.addQredits":"Adicionar cr\xE9ditos","ui.sessionTurn.status.delegating":"A delegar trabalho","ui.sessionTurn.status.planning":"A planear os pr\xF3ximos passos","ui.sessionTurn.status.gatheringContext":"A explorar","ui.sessionTurn.status.gatheredContext":"Explorado","ui.sessionTurn.status.searchingCodebase":"A pesquisar no c\xF3digo","ui.sessionTurn.status.searchingWeb":"A pesquisar na web","ui.sessionTurn.status.makingEdits":"A fazer edi\xE7\xF5es","ui.sessionTurn.status.runningCommands":"A executar comandos","ui.sessionTurn.status.thinking":"A pensar","ui.sessionTurn.status.thinkingWithTopic":"A pensar - {{topic}}","ui.sessionTurn.status.gatheringThoughts":"A recolher pensamentos","ui.sessionTurn.status.consideringNextSteps":"A considerar os pr\xF3ximos passos","ui.messagePart.diagnostic.error":"Erro","ui.messagePart.title.edit":"Editar","ui.messagePart.title.write":"Escrever","ui.messagePart.option.typeOwnAnswer":"Escreva a sua pr\xF3pria resposta","ui.messagePart.review.title":"Reveja as suas respostas","ui.messagePart.questions.dismissed":"Perguntas ignoradas","ui.messagePart.compaction":"Sess\xE3o compactada","ui.messagePart.context.read.one":"{{count}} leitura","ui.messagePart.context.read.other":"{{count}} leituras","ui.messagePart.context.search.one":"{{count}} pesquisa","ui.messagePart.context.search.other":"{{count}} pesquisas","ui.messagePart.context.list.one":"{{count}} lista","ui.messagePart.context.list.other":"{{count}} listas","ui.list.loading":"A carregar","ui.list.empty":"Sem resultados","ui.list.clearFilter":"Limpar filtro","ui.list.emptyWithFilter.prefix":"Sem resultados para","ui.list.emptyWithFilter.suffix":"","ui.fileSearch.placeholder":"Localizar","ui.fileSearch.previousMatch":"Correspond\xEAncia anterior","ui.fileSearch.nextMatch":"Pr\xF3xima correspond\xEAncia","ui.fileSearch.close":"Fechar pesquisa","ui.messageNav.newMessage":"Nova mensagem","ui.textField.copyToClipboard":"Copiar para a \xE1rea de transfer\xEAncia","ui.textField.copyLink":"Copiar liga\xE7\xE3o","ui.textField.copied":"Copiado","ui.imagePreview.alt":"Pr\xE9-visualiza\xE7\xE3o de imagem","ui.scrollView.ariaLabel":"conte\xFAdo desloc\xE1vel","ui.tool.read":"Ler","ui.tool.loaded":"Carregado","ui.tool.list":"Listar","ui.tool.glob":"Glob","ui.tool.grep":"Grep","ui.tool.task":"Tarefa","ui.tool.webfetch":"Webfetch","ui.tool.websearch":"Pesquisa Web","ui.tool.codesearch":"Pesquisa de C\xF3digo","ui.tool.shell":"Shell","ui.tool.patch":"Patch","ui.tool.todos":"Tarefas","ui.tool.todos.read":"Ler tarefas","ui.tool.questions":"Perguntas","ui.tool.agent":"Agente {{type}}","ui.tool.agent.default":"Agente","ui.tool.skill":"Skill","ui.basicTool.called":"Chamado `{{tool}}`","ui.toolErrorCard.failed":"Falhou","ui.toolErrorCard.copyError":"Copiar erro","ui.common.file.one":"ficheiro","ui.common.file.other":"ficheiros","ui.common.question.one":"pergunta","ui.common.question.other":"perguntas","ui.common.add":"Adicionar","ui.common.back":"Voltar","ui.common.cancel":"Cancelar","ui.common.confirm":"Confirmar","ui.common.dismiss":"Ignorar","ui.common.close":"Fechar","ui.common.next":"Seguinte","ui.common.submit":"Enviar","ui.permission.deny":"Negar","ui.permission.allowAlways":"Permitir sempre","ui.permission.allowOnce":"Permitir uma vez","ui.message.expand":"Expandir mensagem","ui.message.collapse":"Recolher mensagem","ui.message.copy":"Copiar","ui.message.copyMessage":"Copiar mensagem","ui.message.forkMessage":"Bifurcar para nova sess\xE3o","ui.message.revertMessage":"Reverter mensagem","ui.message.copyResponse":"Copiar resposta","ui.message.copied":"Copiado","ui.message.duration.seconds":"{{count}}s","ui.message.duration.minutesSeconds":"{{minutes}}m {{seconds}}s","ui.message.interrupted":"Interrompido","ui.message.queued":"Em fila","ui.message.attachment.alt":"anexo","ui.patch.action.deleted":"Eliminado","ui.patch.action.created":"Criado","ui.patch.action.moved":"Movido","ui.patch.action.patched":"Corrigido","ui.question.subtitle.answered":"{{count}} respondidas","ui.question.answer.none":"(sem resposta)","ui.question.review.notAnswered":"(n\xE3o respondida)","ui.question.multiHint":"Selecione todas as que se aplicam","ui.question.singleHint":"Selecione uma resposta","ui.question.custom.placeholder":"Escreva a sua resposta..."};export{e as dict};
2
+ import"./chunk-0xf12tf3.js";var e={"ui.sessionReview.title":"Altera\xE7\xF5es da sess\xE3o","ui.sessionReview.title.lastTurn":"Altera\xE7\xF5es do \xFAltimo turno","ui.sessionReview.diffStyle.unified":"Unificado","ui.sessionReview.diffStyle.split":"Dividido","ui.sessionReview.openFile":"Abrir ficheiro","ui.sessionReview.selection.line":"linha {{line}}","ui.sessionReview.selection.lines":"linhas {{start}}-{{end}}","ui.sessionReview.expandAll":"Expandir tudo","ui.sessionReview.collapseAll":"Recolher tudo","ui.sessionReview.change.added":"Adicionado","ui.sessionReview.change.removed":"Removido","ui.sessionReview.change.modified":"Modificado","ui.sessionReview.image.loading":"A carregar...","ui.sessionReview.image.placeholder":"Imagem","ui.sessionReview.largeDiff.title":"Diff demasiado grande para renderizar","ui.sessionReview.largeDiff.meta":"Limite: {{limit}} linhas alteradas. Atual: {{current}} linhas alteradas.","ui.sessionReview.largeDiff.renderAnyway":"Renderizar mesmo assim","ui.fileMedia.kind.image":"imagem","ui.fileMedia.kind.audio":"\xE1udio","ui.fileMedia.state.removed":"Ficheiro de {{kind}} removido.","ui.fileMedia.state.loading":"A carregar {{kind}}...","ui.fileMedia.state.error":"Imposs\xEDvel carregar {{kind}}.","ui.fileMedia.state.unavailable":"Pr\xE9-visualiza\xE7\xE3o de {{kind}} indispon\xEDvel.","ui.fileMedia.binary.title":"Ficheiro bin\xE1rio","ui.fileMedia.binary.description.path":"{{path}} \xE9 bin\xE1rio.","ui.fileMedia.binary.description.default":"Conte\xFAdo bin\xE1rio","ui.lineComment.label.prefix":"Comentar em ","ui.lineComment.label.suffix":"","ui.lineComment.editorLabel.prefix":"A comentar em ","ui.lineComment.editorLabel.suffix":"","ui.lineComment.placeholder":"Adicionar coment\xE1rio","ui.lineComment.submit":"Comentar","ui.sessionTurn.steps.show":"Mostrar passos","ui.sessionTurn.steps.hide":"Ocultar passos","ui.sessionTurn.summary.response":"Resposta","ui.sessionTurn.diff.showMore":"Mostrar mais altera\xE7\xF5es ({{count}})","ui.sessionTurn.diffs.changed":"Alterado","ui.sessionTurn.diffs.showAll":"Mostrar tudo","ui.sessionTurn.diffs.showLess":"Mostrar menos","ui.sessionTurn.diffs.more":"+{{count}} ficheiros","ui.sessionTurn.retry.retrying":"a tentar novamente","ui.sessionTurn.retry.inSeconds":"em {{seconds}}s","ui.sessionTurn.retry.attempt":"tentativa #{{attempt}}","ui.sessionTurn.retry.attemptLine":"{{line}} - tentativa #{{attempt}}","ui.sessionTurn.retry.geminiHot":"o gemini est\xE1 sobrecarregado neste momento","ui.sessionTurn.error.freeUsageExceeded":"Limite de uso gratuito excedido","ui.sessionTurn.error.addQredits":"Adicionar cr\xE9ditos","ui.sessionTurn.status.delegating":"A delegar trabalho","ui.sessionTurn.status.planning":"A planear os pr\xF3ximos passos","ui.sessionTurn.status.gatheringContext":"A explorar","ui.sessionTurn.status.gatheredContext":"Explorado","ui.sessionTurn.status.searchingCodebase":"A pesquisar no c\xF3digo","ui.sessionTurn.status.searchingWeb":"A pesquisar na web","ui.sessionTurn.status.makingEdits":"A fazer edi\xE7\xF5es","ui.sessionTurn.status.runningCommands":"A executar comandos","ui.sessionTurn.status.thinking":"A pensar","ui.sessionTurn.status.thinkingWithTopic":"A pensar - {{topic}}","ui.sessionTurn.status.gatheringThoughts":"A recolher pensamentos","ui.sessionTurn.status.consideringNextSteps":"A considerar os pr\xF3ximos passos","ui.messagePart.diagnostic.error":"Erro","ui.messagePart.title.edit":"Editar","ui.messagePart.title.write":"Escrever","ui.messagePart.option.typeOwnAnswer":"Escreva a sua pr\xF3pria resposta","ui.messagePart.review.title":"Reveja as suas respostas","ui.messagePart.questions.dismissed":"Perguntas ignoradas","ui.messagePart.compaction":"Sess\xE3o compactada","ui.messagePart.context.read.one":"{{count}} leitura","ui.messagePart.context.read.other":"{{count}} leituras","ui.messagePart.context.search.one":"{{count}} pesquisa","ui.messagePart.context.search.other":"{{count}} pesquisas","ui.messagePart.context.list.one":"{{count}} lista","ui.messagePart.context.list.other":"{{count}} listas","ui.list.loading":"A carregar","ui.list.empty":"Sem resultados","ui.list.clearFilter":"Limpar filtro","ui.list.emptyWithFilter.prefix":"Sem resultados para","ui.list.emptyWithFilter.suffix":"","ui.fileSearch.placeholder":"Localizar","ui.fileSearch.previousMatch":"Correspond\xEAncia anterior","ui.fileSearch.nextMatch":"Pr\xF3xima correspond\xEAncia","ui.fileSearch.close":"Fechar pesquisa","ui.messageNav.newMessage":"Nova mensagem","ui.textField.copyToClipboard":"Copiar para a \xE1rea de transfer\xEAncia","ui.textField.copyLink":"Copiar liga\xE7\xE3o","ui.textField.copied":"Copiado","ui.imagePreview.alt":"Pr\xE9-visualiza\xE7\xE3o de imagem","ui.scrollView.ariaLabel":"conte\xFAdo desloc\xE1vel","ui.tool.read":"Ler","ui.tool.loaded":"Carregado","ui.tool.list":"Listar","ui.tool.glob":"Glob","ui.tool.grep":"Grep","ui.tool.task":"Tarefa","ui.tool.webfetch":"Webfetch","ui.tool.websearch":"Pesquisa Web","ui.tool.codesearch":"Pesquisa de C\xF3digo","ui.tool.shell":"Shell","ui.tool.patch":"Patch","ui.tool.todos":"Tarefas","ui.tool.todos.read":"Ler tarefas","ui.tool.questions":"Perguntas","ui.tool.agent":"Agente {{type}}","ui.tool.agent.default":"Agente","ui.tool.skill":"Skill","ui.basicTool.called":"Chamado `{{tool}}`","ui.toolErrorCard.failed":"Falhou","ui.toolErrorCard.copyError":"Copiar erro","ui.common.file.one":"ficheiro","ui.common.file.other":"ficheiros","ui.common.question.one":"pergunta","ui.common.question.other":"perguntas","ui.common.add":"Adicionar","ui.common.back":"Voltar","ui.common.cancel":"Cancelar","ui.common.confirm":"Confirmar","ui.common.dismiss":"Ignorar","ui.common.close":"Fechar","ui.common.next":"Seguinte","ui.common.submit":"Enviar","ui.permission.deny":"Negar","ui.permission.allowAlways":"Permitir sempre","ui.permission.allowOnce":"Permitir uma vez","ui.message.expand":"Expandir mensagem","ui.message.collapse":"Recolher mensagem","ui.message.copy":"Copiar","ui.message.copyMessage":"Copiar mensagem","ui.message.forkMessage":"Bifurcar para nova sess\xE3o","ui.message.revertMessage":"Reverter mensagem","ui.message.copyResponse":"Copiar resposta","ui.message.copied":"Copiado","ui.message.duration.seconds":"{{count}}s","ui.message.duration.minutesSeconds":"{{minutes}}m {{seconds}}s","ui.message.interrupted":"Interrompido","ui.message.queued":"Em fila","ui.message.attachment.alt":"anexo","ui.patch.action.deleted":"Eliminado","ui.patch.action.created":"Criado","ui.patch.action.moved":"Movido","ui.patch.action.patched":"Corrigido","ui.question.subtitle.answered":"{{count}} respondidas","ui.question.answer.none":"(sem resposta)","ui.question.review.notAnswered":"(n\xE3o respondida)","ui.question.multiHint":"Selecione todas as que se aplicam","ui.question.singleHint":"Selecione uma resposta","ui.question.custom.placeholder":"Escreva a sua resposta..."};export{e as dict};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Nd as a}from"./chunk-jcn8bg31.js";import"./chunk-8t17w67q.js";import"./chunk-0xf12tf3.js";export{a as dict};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import"./chunk-0xf12tf3.js";var t="./injections-73j83es3.scm";export{t as default};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{W as R9}from"./chunk-qyan69nb.js";import{Rd as E9}from"./chunk-t9pq363q.js";import{$d as q6,Sd as P6,Vd as p$,Wd as S9,Xd as U9,_d as H9}from"./chunk-vbfc0wgv.js";import"./chunk-j7637cwg.js";import{ce as T0}from"./chunk-rk21wv4k.js";import{$f as O}from"./chunk-xvvt886p.js";import{Xg as j9,th as I9,xh as E$}from"./chunk-c1c8ch3g.js";import"./chunk-ajnzv5jt.js";import"./chunk-dz3kcsb6.js";import"./chunk-pwsajn96.js";import"./chunk-hgm8yfcb.js";import"./chunk-7rbg6mg9.js";import"./chunk-mp1x10t5.js";import{Jj as O6,Kj as M0,Pk as w9,Rk as D9,_k as b9,sj as T9}from"./chunk-s27cz24e.js";import{ll as N9}from"./chunk-gx4v8z64.js";import{Al as A0,Jl as T$}from"./chunk-v03xq38e.js";import"./chunk-dx7rexx3.js";import"./chunk-xgf4k9q7.js";import"./chunk-dnjyepb2.js";import"./chunk-8gpjmj42.js";import"./chunk-atacnspd.js";import"./chunk-qdafm7qg.js";import"./chunk-r81w6skn.js";import"./chunk-ge7csm6m.js";import"./chunk-d0dsgxk4.js";import"./chunk-1q10jyka.js";import"./chunk-wh2qqhep.js";import"./chunk-vy93mn7d.js";import"./chunk-yce8ph5b.js";import"./chunk-kec1xw1n.js";import"./chunk-cqtkxwd8.js";import"./chunk-x50adh71.js";import"./chunk-ngyv4fhn.js";import"./chunk-nq4x6792.js";import"./chunk-f17se3hh.js";import"./chunk-2y5bthrp.js";import"./chunk-7hdb1fhq.js";import"./chunk-xnxw5zz9.js";import"./chunk-gq3zb4wv.js";import"./chunk-2cvwrabw.js";import"./chunk-4sa9t0vx.js";import"./chunk-g52wmt1v.js";import{Ls as C6}from"./chunk-9d0exvey.js";import"./chunk-h2p984qb.js";import"./chunk-qm9fm5ja.js";import"./chunk-z0m1qm7j.js";import"./chunk-wd2xmkdp.js";import"./chunk-8peby2d1.js";import{ft as F9,it as R6,jt as M9,ot as A9}from"./chunk-azss4acq.js";import"./chunk-0bhzhh7s.js";import"./chunk-7s0nq2aa.js";import{du as L9}from"./chunk-cxtwavyf.js";import"./chunk-15bjhfav.js";import"./chunk-q4mtwv1w.js";import"./chunk-7a3txs9f.js";import"./chunk-x308f9j4.js";import{cI as V9}from"./chunk-2zjet9tx.js";import"./chunk-mn5cacf6.js";import"./chunk-9pj10pgd.js";import{qP as q0,rP as D,uP as E}from"./chunk-djfrkbd5.js";var JZ=D((zZ)=>{/*!
2
+ import{X as R9}from"./chunk-mchf2bcc.js";import{Sd as E9}from"./chunk-rqdfmbns.js";import{$d as H9,Td as P6,Wd as p$,Xd as S9,Yd as U9,ae as q6}from"./chunk-y9mxwwz7.js";import"./chunk-yhe5qz48.js";import{de as T0}from"./chunk-b274mb6v.js";import{ag as O}from"./chunk-d2049chz.js";import{Yg as j9,uh as I9,yh as E$}from"./chunk-cv3xdp8q.js";import"./chunk-x0wy15q9.js";import"./chunk-2h8b0csf.js";import"./chunk-4q14whpc.js";import"./chunk-s81ck6bw.js";import"./chunk-dzy3ezht.js";import"./chunk-g3y5kvg6.js";import{$k as b9,Kj as O6,Lj as M0,Qk as w9,Sk as D9,tj as T9}from"./chunk-z4gczap3.js";import{ml as N9}from"./chunk-2p1qaqv3.js";import{Bl as A0,Kl as T$}from"./chunk-47pxz6cb.js";import"./chunk-aq75kv5f.js";import"./chunk-1851skhm.js";import"./chunk-0ware2sh.js";import"./chunk-fbd971t7.js";import"./chunk-1f9qcrn6.js";import"./chunk-z66xdxkg.js";import"./chunk-jt94rhev.js";import"./chunk-2ts2s8b4.js";import"./chunk-7k1q26yn.js";import"./chunk-08mgb5tt.js";import"./chunk-6wt8g6mc.js";import"./chunk-1rafe6f5.js";import"./chunk-hsmtjb4d.js";import"./chunk-7nh8vjx4.js";import"./chunk-cqtkxwd8.js";import"./chunk-mfg4stzn.js";import"./chunk-hp9q7vvq.js";import"./chunk-5es19n1m.js";import"./chunk-1bbx1da7.js";import"./chunk-wspm2k19.js";import"./chunk-gvc1mqrs.js";import"./chunk-1exjy880.js";import"./chunk-xgdst5n5.js";import"./chunk-yzxcjr6y.js";import"./chunk-53n3tfwn.js";import"./chunk-3be70hxy.js";import{Ms as C6}from"./chunk-9a9qcvtz.js";import"./chunk-1sejtx9a.js";import"./chunk-jrh028na.js";import"./chunk-vqxyk6as.js";import"./chunk-mbma071k.js";import"./chunk-ajykvcas.js";import{gt as F9,jt as R6,kt as M9,pt as A9}from"./chunk-dpm5x19e.js";import"./chunk-vvmvryh1.js";import"./chunk-6g3bzap8.js";import{eu as L9}from"./chunk-mrh5q4s6.js";import"./chunk-w623r5kb.js";import"./chunk-zgj7jx8k.js";import"./chunk-0mdmqtfr.js";import"./chunk-00krzh3y.js";import{dI as V9}from"./chunk-hk8m8vax.js";import"./chunk-zhddj91f.js";import"./chunk-t4kma6mq.js";import{rP as q0,sP as D,vP as E}from"./chunk-0xf12tf3.js";var JZ=D((zZ)=>{/*!
3
3
  * content-type
4
4
  * Copyright(c) 2015 Douglas Christopher Wilson
5
5
  * MIT Licensed
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{tP as w}from"./chunk-djfrkbd5.js";async function M(z,Z,{concurrency:q=Number.POSITIVE_INFINITY,stopOnError:A=!0,signal:J}={}){return new Promise((B,Q)=>{if(z[Symbol.iterator]===void 0&&z[Symbol.asyncIterator]===void 0)throw TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof z})`);if(typeof Z!=="function")throw TypeError("Mapper function is required");if(!(Number.isSafeInteger(q)&&q>=1||q===Number.POSITIVE_INFINITY))throw TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${q}\` (${typeof q})`);let X=[],$=[],K=new Map,N=!1,F=!1,T=!1,G=0,f=0,_=z[Symbol.iterator]===void 0?z[Symbol.asyncIterator]():z[Symbol.iterator](),D=()=>{Y(J.reason)},E=()=>{J?.removeEventListener("abort",D)},O=(H)=>{B(H),E()},Y=(H)=>{N=!0,F=!0,Q(H),E()};if(J){if(J.aborted)Y(J.reason);J.addEventListener("abort",D,{once:!0})}let V=async()=>{if(F)return;let H=await _.next(),h=f;if(f++,H.done){if(T=!0,G===0&&!F){if(!A&&$.length>0){Y(AggregateError($));return}if(F=!0,K.size===0){O(X);return}let U=[];for(let[W,P]of X.entries()){if(K.get(W)===L)continue;U.push(P)}O(U)}return}G++,(async()=>{try{let U=await H.value;if(F)return;let W=await Z(U,h);if(W===L)K.set(h,W);X[h]=W,G--,await V()}catch(U){if(A)Y(U);else{$.push(U),G--;try{await V()}catch(W){Y(W)}}}})()};(async()=>{for(let H=0;H<q;H++){try{await V()}catch(h){Y(h);break}if(T||N)break}})()})}function I(z,Z,{concurrency:q=Number.POSITIVE_INFINITY,backpressure:A=q}={}){if(z[Symbol.iterator]===void 0&&z[Symbol.asyncIterator]===void 0)throw TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof z})`);if(typeof Z!=="function")throw TypeError("Mapper function is required");if(!(Number.isSafeInteger(q)&&q>=1||q===Number.POSITIVE_INFINITY))throw TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${q}\` (${typeof q})`);if(!(Number.isSafeInteger(A)&&A>=q||A===Number.POSITIVE_INFINITY))throw TypeError(`Expected \`backpressure\` to be an integer from \`concurrency\` (${q}) and up or \`Infinity\`, got \`${A}\` (${typeof A})`);return{async*[Symbol.asyncIterator](){let J=z[Symbol.asyncIterator]===void 0?z[Symbol.iterator]():z[Symbol.asyncIterator](),B=[],Q=0,X=!1,$=0;function K(){if(X||!(Q<q&&B.length<A))return;Q++;let N=(async()=>{let{done:F,value:T}=await J.next();if(F)return Q--,{done:!0};K();try{let G=await Z(await T,$++);if(Q--,G===L){let f=B.indexOf(N);if(f>0)B.splice(f,1)}return K(),{done:!1,value:G}}catch(G){return Q--,X=!0,{error:G}}})();B.push(N)}K();while(B.length>0){let{error:N,done:F,value:T}=await B[0];if(B.shift(),N)throw N;if(F)return;if(K(),T===L)continue;yield T}}}}var L;var C=w(()=>{L=Symbol("skip")});C();export{L as pMapSkip,I as pMapIterable,M as default};
2
+ import{uP as w}from"./chunk-0xf12tf3.js";async function M(z,Z,{concurrency:q=Number.POSITIVE_INFINITY,stopOnError:A=!0,signal:J}={}){return new Promise((B,Q)=>{if(z[Symbol.iterator]===void 0&&z[Symbol.asyncIterator]===void 0)throw TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof z})`);if(typeof Z!=="function")throw TypeError("Mapper function is required");if(!(Number.isSafeInteger(q)&&q>=1||q===Number.POSITIVE_INFINITY))throw TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${q}\` (${typeof q})`);let X=[],$=[],K=new Map,N=!1,F=!1,T=!1,G=0,f=0,_=z[Symbol.iterator]===void 0?z[Symbol.asyncIterator]():z[Symbol.iterator](),D=()=>{Y(J.reason)},E=()=>{J?.removeEventListener("abort",D)},O=(H)=>{B(H),E()},Y=(H)=>{N=!0,F=!0,Q(H),E()};if(J){if(J.aborted)Y(J.reason);J.addEventListener("abort",D,{once:!0})}let V=async()=>{if(F)return;let H=await _.next(),h=f;if(f++,H.done){if(T=!0,G===0&&!F){if(!A&&$.length>0){Y(AggregateError($));return}if(F=!0,K.size===0){O(X);return}let U=[];for(let[W,P]of X.entries()){if(K.get(W)===L)continue;U.push(P)}O(U)}return}G++,(async()=>{try{let U=await H.value;if(F)return;let W=await Z(U,h);if(W===L)K.set(h,W);X[h]=W,G--,await V()}catch(U){if(A)Y(U);else{$.push(U),G--;try{await V()}catch(W){Y(W)}}}})()};(async()=>{for(let H=0;H<q;H++){try{await V()}catch(h){Y(h);break}if(T||N)break}})()})}function I(z,Z,{concurrency:q=Number.POSITIVE_INFINITY,backpressure:A=q}={}){if(z[Symbol.iterator]===void 0&&z[Symbol.asyncIterator]===void 0)throw TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof z})`);if(typeof Z!=="function")throw TypeError("Mapper function is required");if(!(Number.isSafeInteger(q)&&q>=1||q===Number.POSITIVE_INFINITY))throw TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${q}\` (${typeof q})`);if(!(Number.isSafeInteger(A)&&A>=q||A===Number.POSITIVE_INFINITY))throw TypeError(`Expected \`backpressure\` to be an integer from \`concurrency\` (${q}) and up or \`Infinity\`, got \`${A}\` (${typeof A})`);return{async*[Symbol.asyncIterator](){let J=z[Symbol.asyncIterator]===void 0?z[Symbol.iterator]():z[Symbol.asyncIterator](),B=[],Q=0,X=!1,$=0;function K(){if(X||!(Q<q&&B.length<A))return;Q++;let N=(async()=>{let{done:F,value:T}=await J.next();if(F)return Q--,{done:!0};K();try{let G=await Z(await T,$++);if(Q--,G===L){let f=B.indexOf(N);if(f>0)B.splice(f,1)}return K(),{done:!1,value:G}}catch(G){return Q--,X=!0,{error:G}}})();B.push(N)}K();while(B.length>0){let{error:N,done:F,value:T}=await B[0];if(B.shift(),N)throw N;if(F)return;if(K(),T===L)continue;yield T}}}}var L;var C=w(()=>{L=Symbol("skip")});C();export{L as pMapSkip,I as pMapIterable,M as default};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Pl as an,Ql as _i,Rl as bn,Sl as Ni,Ul as Yr,Vl as zr}from"./chunk-dx7rexx3.js";import{$l as ur,$m as ui,Am as so,Bm as _o,Cm as No,Dm as po,Em as Ao,Fm as To,Gm as Ir,Hm as Oo,Im as $o,Jm as Do,Km as Lr,Lm as vo,Mm as dr,Nm as Bo,Om as Gr,Pm as Jr,Qm as Mr,Rm as Sr,Sm as Cr,Tm as Hr,Um as Qo,Vm as Io,Wl as uo,Wm as Fo,Xl as yo,Zl as er,_l as mr,am as yr,bm as fr,cm as gr,dm as lr,em as sr,fm as _r,gm as Nr,hm as pr,im as Ar,jm as V,km as Tr,lm as Or,mm as $r,nm as Dr,om as vr,pm as Br,qm as j,rm as v,sm as yn,tm as un,um as Xo,vm as Qr,wm as Z,xm as go,ym as Kn,zm as lo}from"./chunk-xgf4k9q7.js";import{Gn as Fn,Kn as jn}from"./chunk-qdafm7qg.js";import{Ln as gi}from"./chunk-r81w6skn.js";import{Mn as Mo}from"./chunk-ge7csm6m.js";import{tr as Wn,ur as hn,vr as Nn,wr as hr,xr as ti,zr as ni}from"./chunk-gq3zb4wv.js";import{Ar as ri}from"./chunk-2cvwrabw.js";import{Bs as gn}from"./chunk-g52wmt1v.js";import{_s as ro}from"./chunk-wd2xmkdp.js";import{ct as Ro}from"./chunk-azss4acq.js";import{Lt as nn,Ut as c}from"./chunk-7s0nq2aa.js";import{$t as k,Xt as Xr,_t as qo,du as mo,iu as $n}from"./chunk-cxtwavyf.js";import{ju as a}from"./chunk-15bjhfav.js";import{_z as pn,gA as Jn,uA as Cn}from"./chunk-x308f9j4.js";import{BF as h,JE as Ko,QE as Xn,RO as N,XE as ln,cI as r,fL as Zr,gK as Uo,jC as cn,kJ as Ln,lF as Ur,xC as vn}from"./chunk-2zjet9tx.js";import{sP as On}from"./chunk-djfrkbd5.js";var Vo={};On(Vo,{run:()=>$i});var mn={time_created:j().notNull().$default(()=>Date.now()),time_updated:j().notNull().$onUpdate(()=>Date.now())};var J=un("project",{id:v().$type().primaryKey(),worktree:v().notNull(),vcs:v(),name:v(),icon_url:v(),icon_color:v(),...mn,time_initialized:j(),sandboxes:v({mode:"json"}).notNull().$type(),commands:v({mode:"json"}).$type()});var fn=un("session",{id:v().$type().primaryKey(),project_id:v().$type().notNull().references(()=>J.id,{onDelete:"cascade"}),workspace_id:v().$type(),parent_id:v().$type(),context_from:v().$type(),context_watermark:v().$type(),slug:v().notNull(),directory:v().notNull(),title:v().notNull(),version:v().notNull(),share_url:v(),summary_additions:j(),summary_deletions:j(),summary_files:j(),summary_diffs:v({mode:"json"}).$type(),revert:v({mode:"json"}).$type(),permission:v({mode:"json"}).$type(),...mn,time_compacting:j(),time_archived:j(),last_checkpoint_message_id:v().$type()},(n)=>[yn("session_project_idx").on(n.project_id),yn("session_workspace_idx").on(n.workspace_id),yn("session_parent_idx").on(n.parent_id),yn("session_context_from_idx").on(n.context_from)]),eo=un("message",{id:v().$type().primaryKey(),session_id:v().$type().notNull().references(()=>fn.id,{onDelete:"cascade"}),agent_id:v().notNull().default("main"),...mn,data:v({mode:"json"}).notNull().$type()},(n)=>[yn("message_session_time_created_id_idx").on(n.session_id,n.time_created,n.id),yn("message_session_agent_idx").on(n.session_id,n.agent_id,n.id)]),Yo=un("part",{id:v().$type().primaryKey(),message_id:v().$type().notNull().references(()=>eo.id,{onDelete:"cascade"}),session_id:v().$type().notNull(),...mn,data:v({mode:"json"}).notNull().$type()},(n)=>[yn("part_message_id_id_idx").on(n.message_id,n.id),yn("part_session_idx").on(n.session_id)]),zo=un("todo",{session_id:v().$type().notNull().references(()=>fn.id,{onDelete:"cascade"}),content:v().notNull(),status:v().notNull(),position:j().notNull(),...mn},(n)=>[Xo({columns:[n.session_id,n.position]}),yn("todo_session_idx").on(n.session_id)]),co=un("permission",{project_id:v().primaryKey().references(()=>J.id,{onDelete:"cascade"}),...mn,data:v({mode:"json"}).notNull().$type()});var ko=un("session_share",{session_id:v().primaryKey().references(()=>fn.id,{onDelete:"cascade"}),id:v().notNull(),secret:v().notNull(),url:v().notNull(),...mn});import z from"path";var U=c.create({service:"json-migration"});async function $i(n,o){let i=z.join($n.Path.data,"storage");if(!await mo.exists(i))return U.info("storage directory does not exist, skipping migration"),{projects:0,sessions:0,messages:0,parts:0,todos:0,permissions:0,shares:0,errors:[]};U.info("starting json to sqlite migration",{storageDir:i});let l=performance.now();n.run("PRAGMA journal_mode = WAL"),n.run("PRAGMA synchronous = OFF"),n.run("PRAGMA cache_size = 10000"),n.run("PRAGMA temp_store = MEMORY");let e={projects:0,sessions:0,messages:0,parts:0,todos:0,permissions:0,shares:0,errors:[]},A={sessions:0,todos:0,permissions:0,shares:0},_=e.errors,T=1000,M=Date.now();async function x(f){return qo.scan(f,{cwd:i,absolute:!0})}async function C(f,d,S){let B=S-d,p=Array(B);for(let E=0;E<B;E++)p[E]=mo.readJson(f[d+E]);let G=await Promise.allSettled(p),W=Array(B);for(let E=0;E<G.length;E++){let q=G[E];if(q.status==="fulfilled"){W[E]=q.value;continue}_.push(`failed to read ${f[d+E]}: ${q.reason}`)}return W}function H(f,d,S){if(f.length===0)return 0;try{return n.insert(d).values(f).onConflictDoNothing().run(),f.length}catch(B){return _.push(`failed to migrate ${S} batch: ${B}`),0}}U.info("scanning files...");let[K,$,Q,L,g,s,m]=await Promise.all([x("project/*.json"),x("session/*/*.json"),x("message/*/*.json"),x("part/*/*.json"),x("todo/*.json"),x("permission/*.json"),x("session_share/*.json")]);U.info("file scan complete",{projects:K.length,sessions:$.length,messages:Q.length,parts:L.length,todos:g.length,permissions:s.length,shares:m.length});let y=Math.max(1,K.length+$.length+Q.length+L.length+g.length+s.length+m.length),t=o?.progress,u=0,D=(f,d)=>{u=Math.min(y,u+d),t?.({current:u,total:y,label:f})};t?.({current:u,total:y,label:"starting"}),n.run("BEGIN TRANSACTION");let I=new Set,O=[];for(let f=0;f<K.length;f+=T){let d=Math.min(f+T,K.length),S=await C(K,f,d);O.length=0;for(let B=0;B<S.length;B++){let p=S[B];if(!p)continue;let G=z.basename(K[f+B],".json");I.add(G),O.push({id:G,worktree:p.worktree??"/",vcs:p.vcs,name:p.name??void 0,icon_url:p.icon?.url,icon_color:p.icon?.color,time_created:p.time?.created??M,time_updated:p.time?.updated??M,time_initialized:p.time?.initialized,sandboxes:p.sandboxes??[],commands:p.commands})}e.projects+=H(O,J,"project"),D("projects",d-f)}U.info("migrated projects",{count:e.projects,duration:Math.round(performance.now()-l)});let P=$.map((f)=>z.basename(z.dirname(f))),Y=new Set,en=[];for(let f=0;f<$.length;f+=T){let d=Math.min(f+T,$.length),S=await C($,f,d);en.length=0;for(let B=0;B<S.length;B++){let p=S[B];if(!p)continue;let G=z.basename($[f+B],".json"),W=P[f+B];if(!I.has(W)){A.sessions++;continue}Y.add(G),en.push({id:G,project_id:W,parent_id:p.parentID??null,slug:p.slug??"",directory:p.directory??"",title:p.title??"",version:p.version??"",share_url:p.share?.url??null,summary_additions:p.summary?.additions??null,summary_deletions:p.summary?.deletions??null,summary_files:p.summary?.files??null,summary_diffs:p.summary?.diffs??null,revert:p.revert??null,permission:p.permission??null,time_created:p.time?.created??M,time_updated:p.time?.updated??M,time_compacting:p.time?.compacting??null,time_archived:p.time?.archived??null})}e.sessions+=H(en,fn,"session"),D("sessions",d-f)}if(U.info("migrated sessions",{count:e.sessions}),A.sessions>0)U.warn("skipped orphaned sessions",{count:A.sessions});let sn=[],R=[],kn=new Map;for(let f of Q){let d=z.basename(z.dirname(f));if(!Y.has(d))continue;sn.push(f),R.push(d)}for(let f=0;f<sn.length;f+=T){let d=Math.min(f+T,sn.length),S=await C(sn,f,d),B=Array(S.length),p=0;for(let G=0;G<S.length;G++){let W=S[G];if(!W)continue;let E=sn[f+G],q=z.basename(E,".json"),xn=R[f+G];kn.set(q,xn);let Bn=W;delete Bn.id,delete Bn.sessionID,B[p++]={id:q,session_id:xn,time_created:W.time?.created??M,time_updated:W.time?.updated??M,data:Bn}}B.length=p,e.messages+=H(B,eo,"message"),D("messages",d-f)}U.info("migrated messages",{count:e.messages});for(let f=0;f<L.length;f+=T){let d=Math.min(f+T,L.length),S=await C(L,f,d),B=Array(S.length),p=0;for(let G=0;G<S.length;G++){let W=S[G];if(!W)continue;let E=L[f+G],q=z.basename(E,".json"),xn=z.basename(z.dirname(E)),Bn=kn.get(xn);if(!Bn){_.push(`part missing message session: ${E}`);continue}if(!Y.has(Bn))continue;let wn=W;delete wn.id,delete wn.messageID,delete wn.sessionID,B[p++]={id:q,message_id:xn,session_id:Bn,time_created:W.time?.created??M,time_updated:W.time?.updated??M,data:wn}}B.length=p,e.parts+=H(B,Yo,"part"),D("parts",d-f)}U.info("migrated parts",{count:e.parts});let Tn=g.map((f)=>z.basename(f,".json"));for(let f=0;f<g.length;f+=T){let d=Math.min(f+T,g.length),S=await C(g,f,d),B=[];for(let p=0;p<S.length;p++){let G=S[p];if(!G)continue;let W=Tn[f+p];if(!Y.has(W)){A.todos++;continue}if(!Array.isArray(G)){_.push(`todo not an array: ${g[f+p]}`);continue}for(let E=0;E<G.length;E++){let q=G[E];if(!q?.content||!q?.status)continue;B.push({session_id:W,content:q.content,status:q.status,position:E,time_created:M,time_updated:M})}}e.todos+=H(B,zo,"todo"),D("todos",d-f)}if(U.info("migrated todos",{count:e.todos}),A.todos>0)U.warn("skipped orphaned todos",{count:A.todos});let qn=s.map((f)=>z.basename(f,".json")),Hn=[];for(let f=0;f<s.length;f+=T){let d=Math.min(f+T,s.length),S=await C(s,f,d);Hn.length=0;for(let B=0;B<S.length;B++){let p=S[B];if(!p)continue;let G=qn[f+B];if(!I.has(G)){A.permissions++;continue}Hn.push({project_id:G,data:p})}e.permissions+=H(Hn,co,"permission"),D("permissions",d-f)}if(U.info("migrated permissions",{count:e.permissions}),A.permissions>0)U.warn("skipped orphaned permissions",{count:A.permissions});let Vn=m.map((f)=>z.basename(f,".json")),dn=[];for(let f=0;f<m.length;f+=T){let d=Math.min(f+T,m.length),S=await C(m,f,d);dn.length=0;for(let B=0;B<S.length;B++){let p=S[B];if(!p)continue;let G=Vn[f+B];if(!Y.has(G)){A.shares++;continue}if(!p?.id||!p?.secret||!p?.url){_.push(`session_share missing id/secret/url: ${m[f+B]}`);continue}dn.push({session_id:G,id:p.id,secret:p.secret,url:p.url})}e.shares+=H(dn,ko,"session_share"),D("shares",d-f)}if(U.info("migrated session shares",{count:e.shares}),A.shares>0)U.warn("skipped orphaned session shares",{count:A.shares});if(n.run("COMMIT"),U.info("json migration complete",{projects:e.projects,sessions:e.sessions,messages:e.messages,parts:e.parts,todos:e.todos,permissions:e.permissions,shares:e.shares,errorCount:e.errors.length,duration:Math.round(performance.now()-l)}),e.errors.length>0)U.warn("migration errors",{errors:e.errors.slice(0,20)});return t?.({current:y,total:y,label:"complete"}),e}var In={};On(In,{use:()=>Ce,transaction:()=>xe,textDecoder:()=>re,sumDistinct:()=>rr,sum:()=>or,sql:()=>V,relationsOrderToSQL:()=>Rt,relationsFilterToSQL:()=>Kt,relationToSQL:()=>xt,relationExtrasToSQL:()=>Ht,processRelations:()=>Ct,placeholder:()=>Or,param:()=>Ar,orderSelectedFields:()=>oe,orderByOperators:()=>St,or:()=>lo,operators:()=>Mt,notLike:()=>Gr,notInArray:()=>Ir,notIlike:()=>Mr,notExists:()=>Lr,notBetween:()=>dr,not:()=>so,noopMapper:()=>Nr,noopEncoder:()=>_r,noopDecoder:()=>sr,ne:()=>go,name:()=>gr,min:()=>tr,max:()=>ir,mapUpdateSet:()=>ne,mapResultRow:()=>ht,mapRelationalRow:()=>Jt,mapColumnsInSQLToAlias:()=>it,mapColumnsInAliasedSQLToAlias:()=>rt,lte:()=>Ao,lt:()=>po,like:()=>Bo,l2Distance:()=>Xt,l1Distance:()=>Zt,jaccardDistance:()=>Ut,isWithEnum:()=>bt,isView:()=>vr,isTable:()=>Yi,isSQLWrapper:()=>mr,isNull:()=>Oo,isNotNull:()=>$o,isDriverValueEncoder:()=>lr,isConfig:()=>at,is:()=>Mi,innerProduct:()=>Wt,inArray:()=>To,ilike:()=>Jr,haveSameKeys:()=>jt,hasOwnEntityKind:()=>Ji,hammingDistance:()=>Pt,gte:()=>No,gt:()=>_o,getViewSelectedFields:()=>Ft,getViewName:()=>Br,getTableUniqueName:()=>Xi,getTableName:()=>Zi,getTableLikeName:()=>wt,getTableColumns:()=>Vt,getTableAsAliasSQL:()=>Gt,getOriginalColumnFromAlias:()=>ot,getOrderByOperators:()=>dt,getColumns:()=>qt,getColumnTable:()=>Ci,getColumnNameAndConfig:()=>kt,getChannelPath:()=>li,fillPlaceholders:()=>$r,fieldSelectionToSQL:()=>Lt,extractTablesFromSchema:()=>It,extractExtendedColumnType:()=>mt,exists:()=>Do,eq:()=>Z,entityKind:()=>Gi,effect:()=>He,desc:()=>Io,defineRelationsPart:()=>Qt,defineRelations:()=>Bt,createRelationsHelper:()=>vt,countDistinct:()=>bo,count:()=>fo,cosineDistance:()=>Et,close:()=>Se,buildRelationsParts:()=>Dt,buildRelations:()=>$t,bindIfParam:()=>Qr,between:()=>vo,avgDistinct:()=>nr,avg:()=>ho,assertUnreachable:()=>ct,asc:()=>Qo,arrayOverlaps:()=>Hr,arrayContains:()=>Sr,arrayContained:()=>Cr,applyMixins:()=>zt,and:()=>Kn,aliasedTableColumn:()=>nt,aliasedTable:()=>hi,aliasedRelation:()=>bi,aliasedColumn:()=>ai,WithSubquery:()=>ci,ViewSelectionAliasProxyHandler:()=>ji,ViewBaseConfig:()=>ki,View:()=>Dr,TransactionRollbackError:()=>ft,TableSchema:()=>Ui,TableColumns:()=>Wi,TableAliasProxyHandler:()=>Fi,Table:()=>Pi,Subquery:()=>zi,StringChunk:()=>ur,SQL:()=>yr,RelationsHelperStatic:()=>Ot,RelationsBuilderTable:()=>Tt,RelationsBuilderJunctionColumn:()=>At,RelationsBuilderColumn:()=>pt,RelationTableAliasProxyHandler:()=>wi,Relation:()=>Nt,QueryPromise:()=>tt,Placeholder:()=>Tr,Path:()=>Eo,Param:()=>pr,OriginalName:()=>Ei,One:()=>_t,NotFoundError:()=>Me,NoopLogger:()=>di,Name:()=>fr,Many:()=>st,IsAlias:()=>Ri,FakePrimitiveParam:()=>er,ExtraConfigColumns:()=>Ki,ExtraConfigBuilder:()=>xi,DrizzleQueryError:()=>yt,DrizzleError:()=>ut,DefaultLogger:()=>Li,Count:()=>lt,ConsoleLogWriter:()=>Ii,ColumnTableAliasProxyHandler:()=>Vi,ColumnBuilder:()=>et,ColumnAliasProxyHandler:()=>qi,Column:()=>Si,Client:()=>Mn,CONSTANTS:()=>Yt,BaseName:()=>Hi,AggregatedField:()=>gt});import Di from"crypto";import wo,{existsSync as vi,readdirSync as Bi}from"fs";import{join as Qi}from"path";function jo(n){if(wo.existsSync(`${n.migrationsFolder}/meta/_journal.json`))throw Error('We detected that you have old drizzle-kit migration folders. You must upgrade drizzle-kit and run "drizzle-kit up"');let o=n.migrationsFolder,i=[],l=Bi(o).map((e)=>({path:Qi(o,e,"migration.sql"),name:e})).filter((e)=>vi(e.path));l.sort((e,A)=>e.name.localeCompare(A.name));for(let e of l){let A=e.path,_=e.name.slice(0,14),T=wo.readFileSync(A).toString(),M=T.split("--> statement-breakpoint").map((C)=>{return C}),x=Fo(_);i.push({sql:M,bps:!0,folderMillis:x,hash:Di.createHash("sha256").update(T).digest("hex"),name:e.name})}return i}function ao(n,o){if(Array.isArray(o)||"migrationsJournal"in o){let l=Array.isArray(o)?o:o.migrationsJournal,e=Array.isArray(o)?void 0:o.migrationsTable,A=l.map((_)=>({sql:_.sql.split("--> statement-breakpoint"),folderMillis:_.timestamp,hash:"",bps:!0,name:_.name}));return n.dialect.migrate(A,n.session,{migrationsTable:e})}let i=jo(o);return n.dialect.migrate(i,n.session,o)}function fo(n){return V`count(${n||V.raw("*")})`.mapWith(Number)}function bo(n){return V`count(distinct ${n})`.mapWith(Number)}function ho(n){return V`avg(${n})`.mapWith(String)}function nr(n){return V`avg(distinct ${n})`.mapWith(String)}function or(n){return V`sum(${n})`.mapWith(String)}function rr(n){return V`sum(distinct ${n})`.mapWith(String)}function ir(n){return V`max(${n})`.mapWith(uo(n,yo)?n:String)}function tr(n){return V`min(${n})`.mapWith(uo(n,yo)?n:String)}import oo from"path";var Un={};On(Un,{workspaceID:()=>De,useEffect:()=>Qe,use:()=>Be,make:()=>ve,invalidate:()=>Le,has:()=>Ie,get:()=>xo,directory:()=>no,context:()=>Ho,bind:()=>$e});import{EventEmitter as ie}from"events";var Rn=new ie;var Lo=new Set;function xr(n){return Lo.add(n),()=>{Lo.delete(n)}}async function Go(n){await Promise.allSettled([...Lo].map((o)=>o(n)))}function En(n){return n()}var jr={};On(jr,{setInitialized:()=>se,list:()=>ge,layer:()=>Fr,get:()=>le,fromRow:()=>_n,defaultLayer:()=>Co,UpdateInput:()=>fe,Service:()=>Gn,Info:()=>Vr,Event:()=>wr});import*as F from"fs/promises";import*as cr from"os";import*as Dn from"path";var te=N.String.pipe(N.brand("ProjectID")),w=te.pipe(Fn((n)=>({global:n.make("global"),zod:a.string().pipe(a.custom())})));import*as Qn from"fs/promises";import*as b from"path";import*as Er from"crypto";async function Jo(n){let o=b.resolve(n);while(!0){let i=b.join(o,".git"),l=await Qn.stat(i).catch(()=>null);if(l){if(l.isDirectory())return i;let _=(await Qn.readFile(i,"utf-8")).trim().match(/^gitdir:\s*(.+)$/);if(!_)return null;let T=b.isAbsolute(_[1])?_[1]:b.resolve(o,_[1]);return b.resolve(T,"../..")}let e=b.dirname(o);if(e===o)return null;o=e}}async function Kr(n){let o=await Qn.readFile(n,"utf-8").catch(()=>null);if(o===null)return null;return o.trim()||null}async function Rr(n){let o=await Kr(n);if(o)return o;let i=Er.randomUUID();try{return await Qn.writeFile(n,i,{flag:"wx"}),i}catch(l){if(l.code!=="EEXIST")throw l;let e=await Kr(n);if(e)return e;throw Error(`Project ID file was concurrently created but is empty: ${n}`)}}async function Pr(n){let o=await Jo(n);if(o){let l=b.join(o,"qitqode-project-id");return w.make(await Rr(l))}let i=b.join(n,".qitqode-project-id");return w.make(await Rr(i))}async function me(n){let o=await Jo(n);if(!o)return;let i=Dn.join(n,".qitqode-project-id"),l=Dn.join(o,"qitqode-project-id"),e=(T)=>F.access(T).then(()=>!0).catch(()=>!1);if(await e(i)){if(!await e(l)){let T=await F.readFile(i,"utf-8");await F.writeFile(l,T)}await F.unlink(i).catch(()=>{})}let A=Dn.join(o,"info","exclude");if(await F.mkdir(Dn.dirname(A),{recursive:!0}),!(await F.readFile(A,"utf-8").catch(()=>"")).includes(".qitqode-project-id"))await F.appendFile(A,`
2
+ import{Ql as an,Rl as _i,Sl as bn,Tl as Ni,Vl as Yr,Wl as zr}from"./chunk-aq75kv5f.js";import{$l as mr,Am as lo,Bm as so,Cm as _o,Dm as No,Em as po,Fm as Ao,Gm as To,Hm as Ir,Im as Oo,Jm as $o,Km as Do,Lm as Lr,Mm as vo,Nm as dr,Om as Bo,Pm as Gr,Qm as Jr,Rm as Mr,Sm as Sr,Tm as Cr,Um as Hr,Vm as Qo,Wm as Io,Xl as uo,Xm as Fo,Yl as yo,_l as er,am as ur,an as ui,bm as yr,cm as fr,dm as gr,em as lr,fm as sr,gm as _r,hm as Nr,im as pr,jm as Ar,km as V,lm as Tr,mm as Or,nm as $r,om as Dr,pm as vr,qm as Br,rm as j,sm as v,tm as yn,um as un,vm as Xo,wm as Qr,xm as Z,ym as go,zm as Kn}from"./chunk-1851skhm.js";import{Hn as Fn,Ln as jn}from"./chunk-z66xdxkg.js";import{Mn as gi}from"./chunk-jt94rhev.js";import{Nn as Mo}from"./chunk-2ts2s8b4.js";import{Ar as ni,ur as Wn,vr as hn,wr as Nn,xr as hr,yr as ti}from"./chunk-xgdst5n5.js";import{Br as ri}from"./chunk-yzxcjr6y.js";import{Cs as gn}from"./chunk-3be70hxy.js";import{$s as ro}from"./chunk-mbma071k.js";import{dt as Ro}from"./chunk-dpm5x19e.js";import{Mt as nn,Vt as c}from"./chunk-6g3bzap8.js";import{$t as qo,Yt as Xr,au as k,eu as mo,ju as $n}from"./chunk-mrh5q4s6.js";import{ku as a}from"./chunk-w623r5kb.js";import{$z as pn,hA as Jn,vA as Cn}from"./chunk-00krzh3y.js";import{CF as h,KE as Ko,RE as Xn,SO as N,YE as ln,dI as r,gL as Zr,hK as Uo,kC as cn,lJ as Ln,mF as Ur,yC as vn}from"./chunk-hk8m8vax.js";import{tP as On}from"./chunk-0xf12tf3.js";var Vo={};On(Vo,{run:()=>$i});var mn={time_created:j().notNull().$default(()=>Date.now()),time_updated:j().notNull().$onUpdate(()=>Date.now())};var J=un("project",{id:v().$type().primaryKey(),worktree:v().notNull(),vcs:v(),name:v(),icon_url:v(),icon_color:v(),...mn,time_initialized:j(),sandboxes:v({mode:"json"}).notNull().$type(),commands:v({mode:"json"}).$type()});var fn=un("session",{id:v().$type().primaryKey(),project_id:v().$type().notNull().references(()=>J.id,{onDelete:"cascade"}),workspace_id:v().$type(),parent_id:v().$type(),context_from:v().$type(),context_watermark:v().$type(),slug:v().notNull(),directory:v().notNull(),title:v().notNull(),version:v().notNull(),share_url:v(),summary_additions:j(),summary_deletions:j(),summary_files:j(),summary_diffs:v({mode:"json"}).$type(),revert:v({mode:"json"}).$type(),permission:v({mode:"json"}).$type(),...mn,time_compacting:j(),time_archived:j(),last_checkpoint_message_id:v().$type()},(n)=>[yn("session_project_idx").on(n.project_id),yn("session_workspace_idx").on(n.workspace_id),yn("session_parent_idx").on(n.parent_id),yn("session_context_from_idx").on(n.context_from)]),eo=un("message",{id:v().$type().primaryKey(),session_id:v().$type().notNull().references(()=>fn.id,{onDelete:"cascade"}),agent_id:v().notNull().default("main"),...mn,data:v({mode:"json"}).notNull().$type()},(n)=>[yn("message_session_time_created_id_idx").on(n.session_id,n.time_created,n.id),yn("message_session_agent_idx").on(n.session_id,n.agent_id,n.id)]),Yo=un("part",{id:v().$type().primaryKey(),message_id:v().$type().notNull().references(()=>eo.id,{onDelete:"cascade"}),session_id:v().$type().notNull(),...mn,data:v({mode:"json"}).notNull().$type()},(n)=>[yn("part_message_id_id_idx").on(n.message_id,n.id),yn("part_session_idx").on(n.session_id)]),zo=un("todo",{session_id:v().$type().notNull().references(()=>fn.id,{onDelete:"cascade"}),content:v().notNull(),status:v().notNull(),position:j().notNull(),...mn},(n)=>[Xo({columns:[n.session_id,n.position]}),yn("todo_session_idx").on(n.session_id)]),co=un("permission",{project_id:v().primaryKey().references(()=>J.id,{onDelete:"cascade"}),...mn,data:v({mode:"json"}).notNull().$type()});var ko=un("session_share",{session_id:v().primaryKey().references(()=>fn.id,{onDelete:"cascade"}),id:v().notNull(),secret:v().notNull(),url:v().notNull(),...mn});import z from"path";var U=c.create({service:"json-migration"});async function $i(n,o){let i=z.join($n.Path.data,"storage");if(!await mo.exists(i))return U.info("storage directory does not exist, skipping migration"),{projects:0,sessions:0,messages:0,parts:0,todos:0,permissions:0,shares:0,errors:[]};U.info("starting json to sqlite migration",{storageDir:i});let l=performance.now();n.run("PRAGMA journal_mode = WAL"),n.run("PRAGMA synchronous = OFF"),n.run("PRAGMA cache_size = 10000"),n.run("PRAGMA temp_store = MEMORY");let e={projects:0,sessions:0,messages:0,parts:0,todos:0,permissions:0,shares:0,errors:[]},A={sessions:0,todos:0,permissions:0,shares:0},_=e.errors,T=1000,M=Date.now();async function x(f){return qo.scan(f,{cwd:i,absolute:!0})}async function C(f,d,S){let B=S-d,p=Array(B);for(let E=0;E<B;E++)p[E]=mo.readJson(f[d+E]);let G=await Promise.allSettled(p),W=Array(B);for(let E=0;E<G.length;E++){let q=G[E];if(q.status==="fulfilled"){W[E]=q.value;continue}_.push(`failed to read ${f[d+E]}: ${q.reason}`)}return W}function H(f,d,S){if(f.length===0)return 0;try{return n.insert(d).values(f).onConflictDoNothing().run(),f.length}catch(B){return _.push(`failed to migrate ${S} batch: ${B}`),0}}U.info("scanning files...");let[K,$,Q,L,g,s,m]=await Promise.all([x("project/*.json"),x("session/*/*.json"),x("message/*/*.json"),x("part/*/*.json"),x("todo/*.json"),x("permission/*.json"),x("session_share/*.json")]);U.info("file scan complete",{projects:K.length,sessions:$.length,messages:Q.length,parts:L.length,todos:g.length,permissions:s.length,shares:m.length});let y=Math.max(1,K.length+$.length+Q.length+L.length+g.length+s.length+m.length),t=o?.progress,u=0,D=(f,d)=>{u=Math.min(y,u+d),t?.({current:u,total:y,label:f})};t?.({current:u,total:y,label:"starting"}),n.run("BEGIN TRANSACTION");let I=new Set,O=[];for(let f=0;f<K.length;f+=T){let d=Math.min(f+T,K.length),S=await C(K,f,d);O.length=0;for(let B=0;B<S.length;B++){let p=S[B];if(!p)continue;let G=z.basename(K[f+B],".json");I.add(G),O.push({id:G,worktree:p.worktree??"/",vcs:p.vcs,name:p.name??void 0,icon_url:p.icon?.url,icon_color:p.icon?.color,time_created:p.time?.created??M,time_updated:p.time?.updated??M,time_initialized:p.time?.initialized,sandboxes:p.sandboxes??[],commands:p.commands})}e.projects+=H(O,J,"project"),D("projects",d-f)}U.info("migrated projects",{count:e.projects,duration:Math.round(performance.now()-l)});let P=$.map((f)=>z.basename(z.dirname(f))),Y=new Set,en=[];for(let f=0;f<$.length;f+=T){let d=Math.min(f+T,$.length),S=await C($,f,d);en.length=0;for(let B=0;B<S.length;B++){let p=S[B];if(!p)continue;let G=z.basename($[f+B],".json"),W=P[f+B];if(!I.has(W)){A.sessions++;continue}Y.add(G),en.push({id:G,project_id:W,parent_id:p.parentID??null,slug:p.slug??"",directory:p.directory??"",title:p.title??"",version:p.version??"",share_url:p.share?.url??null,summary_additions:p.summary?.additions??null,summary_deletions:p.summary?.deletions??null,summary_files:p.summary?.files??null,summary_diffs:p.summary?.diffs??null,revert:p.revert??null,permission:p.permission??null,time_created:p.time?.created??M,time_updated:p.time?.updated??M,time_compacting:p.time?.compacting??null,time_archived:p.time?.archived??null})}e.sessions+=H(en,fn,"session"),D("sessions",d-f)}if(U.info("migrated sessions",{count:e.sessions}),A.sessions>0)U.warn("skipped orphaned sessions",{count:A.sessions});let sn=[],R=[],kn=new Map;for(let f of Q){let d=z.basename(z.dirname(f));if(!Y.has(d))continue;sn.push(f),R.push(d)}for(let f=0;f<sn.length;f+=T){let d=Math.min(f+T,sn.length),S=await C(sn,f,d),B=Array(S.length),p=0;for(let G=0;G<S.length;G++){let W=S[G];if(!W)continue;let E=sn[f+G],q=z.basename(E,".json"),xn=R[f+G];kn.set(q,xn);let Bn=W;delete Bn.id,delete Bn.sessionID,B[p++]={id:q,session_id:xn,time_created:W.time?.created??M,time_updated:W.time?.updated??M,data:Bn}}B.length=p,e.messages+=H(B,eo,"message"),D("messages",d-f)}U.info("migrated messages",{count:e.messages});for(let f=0;f<L.length;f+=T){let d=Math.min(f+T,L.length),S=await C(L,f,d),B=Array(S.length),p=0;for(let G=0;G<S.length;G++){let W=S[G];if(!W)continue;let E=L[f+G],q=z.basename(E,".json"),xn=z.basename(z.dirname(E)),Bn=kn.get(xn);if(!Bn){_.push(`part missing message session: ${E}`);continue}if(!Y.has(Bn))continue;let wn=W;delete wn.id,delete wn.messageID,delete wn.sessionID,B[p++]={id:q,message_id:xn,session_id:Bn,time_created:W.time?.created??M,time_updated:W.time?.updated??M,data:wn}}B.length=p,e.parts+=H(B,Yo,"part"),D("parts",d-f)}U.info("migrated parts",{count:e.parts});let Tn=g.map((f)=>z.basename(f,".json"));for(let f=0;f<g.length;f+=T){let d=Math.min(f+T,g.length),S=await C(g,f,d),B=[];for(let p=0;p<S.length;p++){let G=S[p];if(!G)continue;let W=Tn[f+p];if(!Y.has(W)){A.todos++;continue}if(!Array.isArray(G)){_.push(`todo not an array: ${g[f+p]}`);continue}for(let E=0;E<G.length;E++){let q=G[E];if(!q?.content||!q?.status)continue;B.push({session_id:W,content:q.content,status:q.status,position:E,time_created:M,time_updated:M})}}e.todos+=H(B,zo,"todo"),D("todos",d-f)}if(U.info("migrated todos",{count:e.todos}),A.todos>0)U.warn("skipped orphaned todos",{count:A.todos});let qn=s.map((f)=>z.basename(f,".json")),Hn=[];for(let f=0;f<s.length;f+=T){let d=Math.min(f+T,s.length),S=await C(s,f,d);Hn.length=0;for(let B=0;B<S.length;B++){let p=S[B];if(!p)continue;let G=qn[f+B];if(!I.has(G)){A.permissions++;continue}Hn.push({project_id:G,data:p})}e.permissions+=H(Hn,co,"permission"),D("permissions",d-f)}if(U.info("migrated permissions",{count:e.permissions}),A.permissions>0)U.warn("skipped orphaned permissions",{count:A.permissions});let Vn=m.map((f)=>z.basename(f,".json")),dn=[];for(let f=0;f<m.length;f+=T){let d=Math.min(f+T,m.length),S=await C(m,f,d);dn.length=0;for(let B=0;B<S.length;B++){let p=S[B];if(!p)continue;let G=Vn[f+B];if(!Y.has(G)){A.shares++;continue}if(!p?.id||!p?.secret||!p?.url){_.push(`session_share missing id/secret/url: ${m[f+B]}`);continue}dn.push({session_id:G,id:p.id,secret:p.secret,url:p.url})}e.shares+=H(dn,ko,"session_share"),D("shares",d-f)}if(U.info("migrated session shares",{count:e.shares}),A.shares>0)U.warn("skipped orphaned session shares",{count:A.shares});if(n.run("COMMIT"),U.info("json migration complete",{projects:e.projects,sessions:e.sessions,messages:e.messages,parts:e.parts,todos:e.todos,permissions:e.permissions,shares:e.shares,errorCount:e.errors.length,duration:Math.round(performance.now()-l)}),e.errors.length>0)U.warn("migration errors",{errors:e.errors.slice(0,20)});return t?.({current:y,total:y,label:"complete"}),e}var In={};On(In,{use:()=>Ce,transaction:()=>xe,textDecoder:()=>re,sumDistinct:()=>rr,sum:()=>or,sql:()=>V,relationsOrderToSQL:()=>Rt,relationsFilterToSQL:()=>Kt,relationToSQL:()=>xt,relationExtrasToSQL:()=>Ht,processRelations:()=>Ct,placeholder:()=>Or,param:()=>Ar,orderSelectedFields:()=>oe,orderByOperators:()=>St,or:()=>lo,operators:()=>Mt,notLike:()=>Gr,notInArray:()=>Ir,notIlike:()=>Mr,notExists:()=>Lr,notBetween:()=>dr,not:()=>so,noopMapper:()=>Nr,noopEncoder:()=>_r,noopDecoder:()=>sr,ne:()=>go,name:()=>gr,min:()=>tr,max:()=>ir,mapUpdateSet:()=>ne,mapResultRow:()=>ht,mapRelationalRow:()=>Jt,mapColumnsInSQLToAlias:()=>it,mapColumnsInAliasedSQLToAlias:()=>rt,lte:()=>Ao,lt:()=>po,like:()=>Bo,l2Distance:()=>Xt,l1Distance:()=>Zt,jaccardDistance:()=>Ut,isWithEnum:()=>bt,isView:()=>vr,isTable:()=>Yi,isSQLWrapper:()=>mr,isNull:()=>Oo,isNotNull:()=>$o,isDriverValueEncoder:()=>lr,isConfig:()=>at,is:()=>Mi,innerProduct:()=>Wt,inArray:()=>To,ilike:()=>Jr,haveSameKeys:()=>jt,hasOwnEntityKind:()=>Ji,hammingDistance:()=>Pt,gte:()=>No,gt:()=>_o,getViewSelectedFields:()=>Ft,getViewName:()=>Br,getTableUniqueName:()=>Xi,getTableName:()=>Zi,getTableLikeName:()=>wt,getTableColumns:()=>Vt,getTableAsAliasSQL:()=>Gt,getOriginalColumnFromAlias:()=>ot,getOrderByOperators:()=>dt,getColumns:()=>qt,getColumnTable:()=>Ci,getColumnNameAndConfig:()=>kt,getChannelPath:()=>li,fillPlaceholders:()=>$r,fieldSelectionToSQL:()=>Lt,extractTablesFromSchema:()=>It,extractExtendedColumnType:()=>mt,exists:()=>Do,eq:()=>Z,entityKind:()=>Gi,effect:()=>He,desc:()=>Io,defineRelationsPart:()=>Qt,defineRelations:()=>Bt,createRelationsHelper:()=>vt,countDistinct:()=>bo,count:()=>fo,cosineDistance:()=>Et,close:()=>Se,buildRelationsParts:()=>Dt,buildRelations:()=>$t,bindIfParam:()=>Qr,between:()=>vo,avgDistinct:()=>nr,avg:()=>ho,assertUnreachable:()=>ct,asc:()=>Qo,arrayOverlaps:()=>Hr,arrayContains:()=>Sr,arrayContained:()=>Cr,applyMixins:()=>zt,and:()=>Kn,aliasedTableColumn:()=>nt,aliasedTable:()=>hi,aliasedRelation:()=>bi,aliasedColumn:()=>ai,WithSubquery:()=>ci,ViewSelectionAliasProxyHandler:()=>ji,ViewBaseConfig:()=>ki,View:()=>Dr,TransactionRollbackError:()=>ft,TableSchema:()=>Ui,TableColumns:()=>Wi,TableAliasProxyHandler:()=>Fi,Table:()=>Pi,Subquery:()=>zi,StringChunk:()=>ur,SQL:()=>yr,RelationsHelperStatic:()=>Ot,RelationsBuilderTable:()=>Tt,RelationsBuilderJunctionColumn:()=>At,RelationsBuilderColumn:()=>pt,RelationTableAliasProxyHandler:()=>wi,Relation:()=>Nt,QueryPromise:()=>tt,Placeholder:()=>Tr,Path:()=>Eo,Param:()=>pr,OriginalName:()=>Ei,One:()=>_t,NotFoundError:()=>Me,NoopLogger:()=>di,Name:()=>fr,Many:()=>st,IsAlias:()=>Ri,FakePrimitiveParam:()=>er,ExtraConfigColumns:()=>Ki,ExtraConfigBuilder:()=>xi,DrizzleQueryError:()=>yt,DrizzleError:()=>ut,DefaultLogger:()=>Li,Count:()=>lt,ConsoleLogWriter:()=>Ii,ColumnTableAliasProxyHandler:()=>Vi,ColumnBuilder:()=>et,ColumnAliasProxyHandler:()=>qi,Column:()=>Si,Client:()=>Mn,CONSTANTS:()=>Yt,BaseName:()=>Hi,AggregatedField:()=>gt});import Di from"crypto";import wo,{existsSync as vi,readdirSync as Bi}from"fs";import{join as Qi}from"path";function jo(n){if(wo.existsSync(`${n.migrationsFolder}/meta/_journal.json`))throw Error('We detected that you have old drizzle-kit migration folders. You must upgrade drizzle-kit and run "drizzle-kit up"');let o=n.migrationsFolder,i=[],l=Bi(o).map((e)=>({path:Qi(o,e,"migration.sql"),name:e})).filter((e)=>vi(e.path));l.sort((e,A)=>e.name.localeCompare(A.name));for(let e of l){let A=e.path,_=e.name.slice(0,14),T=wo.readFileSync(A).toString(),M=T.split("--> statement-breakpoint").map((C)=>{return C}),x=Fo(_);i.push({sql:M,bps:!0,folderMillis:x,hash:Di.createHash("sha256").update(T).digest("hex"),name:e.name})}return i}function ao(n,o){if(Array.isArray(o)||"migrationsJournal"in o){let l=Array.isArray(o)?o:o.migrationsJournal,e=Array.isArray(o)?void 0:o.migrationsTable,A=l.map((_)=>({sql:_.sql.split("--> statement-breakpoint"),folderMillis:_.timestamp,hash:"",bps:!0,name:_.name}));return n.dialect.migrate(A,n.session,{migrationsTable:e})}let i=jo(o);return n.dialect.migrate(i,n.session,o)}function fo(n){return V`count(${n||V.raw("*")})`.mapWith(Number)}function bo(n){return V`count(distinct ${n})`.mapWith(Number)}function ho(n){return V`avg(${n})`.mapWith(String)}function nr(n){return V`avg(distinct ${n})`.mapWith(String)}function or(n){return V`sum(${n})`.mapWith(String)}function rr(n){return V`sum(distinct ${n})`.mapWith(String)}function ir(n){return V`max(${n})`.mapWith(uo(n,yo)?n:String)}function tr(n){return V`min(${n})`.mapWith(uo(n,yo)?n:String)}import oo from"path";var Un={};On(Un,{workspaceID:()=>De,useEffect:()=>Qe,use:()=>Be,make:()=>ve,invalidate:()=>Le,has:()=>Ie,get:()=>xo,directory:()=>no,context:()=>Ho,bind:()=>$e});import{EventEmitter as ie}from"events";var Rn=new ie;var Lo=new Set;function xr(n){return Lo.add(n),()=>{Lo.delete(n)}}async function Go(n){await Promise.allSettled([...Lo].map((o)=>o(n)))}function En(n){return n()}var jr={};On(jr,{setInitialized:()=>se,list:()=>ge,layer:()=>Fr,get:()=>le,fromRow:()=>_n,defaultLayer:()=>Co,UpdateInput:()=>fe,Service:()=>Gn,Info:()=>Vr,Event:()=>wr});import*as F from"fs/promises";import*as cr from"os";import*as Dn from"path";var te=N.String.pipe(N.brand("ProjectID")),w=te.pipe(Fn((n)=>({global:n.make("global"),zod:a.string().pipe(a.custom())})));import*as Qn from"fs/promises";import*as b from"path";import*as Er from"crypto";async function Jo(n){let o=b.resolve(n);while(!0){let i=b.join(o,".git"),l=await Qn.stat(i).catch(()=>null);if(l){if(l.isDirectory())return i;let _=(await Qn.readFile(i,"utf-8")).trim().match(/^gitdir:\s*(.+)$/);if(!_)return null;let T=b.isAbsolute(_[1])?_[1]:b.resolve(o,_[1]);return b.resolve(T,"../..")}let e=b.dirname(o);if(e===o)return null;o=e}}async function Kr(n){let o=await Qn.readFile(n,"utf-8").catch(()=>null);if(o===null)return null;return o.trim()||null}async function Rr(n){let o=await Kr(n);if(o)return o;let i=Er.randomUUID();try{return await Qn.writeFile(n,i,{flag:"wx"}),i}catch(l){if(l.code!=="EEXIST")throw l;let e=await Kr(n);if(e)return e;throw Error(`Project ID file was concurrently created but is empty: ${n}`)}}async function Pr(n){let o=await Jo(n);if(o){let l=b.join(o,"qitqode-project-id");return w.make(await Rr(l))}let i=b.join(n,".qitqode-project-id");return w.make(await Rr(i))}async function me(n){let o=await Jo(n);if(!o)return;let i=Dn.join(n,".qitqode-project-id"),l=Dn.join(o,"qitqode-project-id"),e=(T)=>F.access(T).then(()=>!0).catch(()=>!1);if(await e(i)){if(!await e(l)){let T=await F.readFile(i,"utf-8");await F.writeFile(l,T)}await F.unlink(i).catch(()=>{})}let A=Dn.join(o,"info","exclude");if(await F.mkdir(Dn.dirname(A),{recursive:!0}),!(await F.readFile(A,"utf-8").catch(()=>"")).includes(".qitqode-project-id"))await F.appendFile(A,`
3
3
  .qitqode-project-id
4
4
  `)}var Wr=c.create({service:"project"}),ue=262144,So=N.Literal("git"),kr=N.Struct({url:N.optional(N.String),override:N.optional(N.String),color:N.optional(N.String)}),qr=N.Struct({start:N.optional(N.String.annotate({description:"Startup script to run when creating a new workspace (worktree)"}))}),ye=N.Struct({created:N.Number,updated:N.Number,initialized:N.optional(N.Number)}),Vr=N.Struct({id:w,worktree:N.String,vcs:N.optional(So),name:N.optional(N.String),icon:N.optional(kr),commands:N.optional(qr),time:ye,sandboxes:N.Array(N.String)}).annotate({identifier:"Project"}).pipe(Fn((n)=>({zod:jn(n)}))),wr={Updated:zr.define("project.updated",Vr.zod)};function _n(n){let o=n.icon_url||n.icon_color?{url:n.icon_url??void 0,color:n.icon_color??void 0}:void 0;return{id:n.id,worktree:n.worktree,vcs:n.vcs?N.decodeUnknownSync(So)(n.vcs):void 0,name:n.name??void 0,icon:o,time:{created:n.time_created,updated:n.time_updated,initialized:n.time_initialized??void 0},sandboxes:n.sandboxes,commands:n.commands??void 0}}var fe=a.object({projectID:w.zod,name:a.string().optional(),icon:jn(kr).optional(),commands:jn(qr).optional()});class Gn extends vn.Service()("@qitqode/Project"){}var Fr=h.effect(Gn,r.gen(function*(){let n=yield*k.Service,o=yield*Zr.Path,i=yield*an.ChildProcessSpawner,l=r.fnUntraced(function*(t,u){return yield*Yr(i,t,u)},r.catch(()=>r.succeed({code:1,text:"",stderr:""}))),e=(t)=>r.sync(()=>In.use(t)),A=(t)=>r.sync(()=>Rn.emit("event",{directory:"global",project:t.id,payload:{type:wr.Updated.type,properties:t}})),_=N.decodeUnknownSync(N.optional(So))(nn.QITQODE_FAKE_VCS),T=(t,u)=>{if(!u)return t;if(u=u.replace(/[\r\n]+$/,""),!u)return t;if(u=k.windowsPath(u),o.isAbsolute(u))return o.normalize(u);return o.resolve(t,u)},M=yield*Ur.Scope,x=r.fn("Project.fromDirectory")(function*(t){Wr.info("fromDirectory",{directory:t});let u=yield*r.gen(function*(){if(nn.QITQODE_DISABLE_GIT)return{id:w.global,worktree:t,sandbox:t,vcs:_};let Y=(yield*n.up({targets:[".git"],start:t}).pipe(r.orDie))[0];if(!Y)return{id:w.global,worktree:"/",sandbox:"/",vcs:_};let en=o.dirname(Y),sn=process.env.HOME??process.env.USERPROFILE??cr.homedir();if(en===sn||Dn.parse(en).root===en)return Wr.warn("ignoring .git at home or filesystem root, snapshots disabled",{dotgit:Y}),{id:w.global,worktree:t,sandbox:t,vcs:_};let R=en,kn=yield*r.sync(()=>Mo("git")),Tn;if(!kn)return{id:Tn??w.global,worktree:R,sandbox:R,vcs:_};let qn=yield*l(["rev-parse","--git-common-dir"],{cwd:R});if(qn.code!==0)return{id:Tn??w.global,worktree:R,sandbox:R,vcs:_};let Hn=(()=>{let dn=T(R,qn.text.trim());return dn===R?R:o.dirname(dn)})();if(Tn==null)yield*r.promise(()=>me(R)),Tn=yield*r.promise(()=>Pr(R));let Vn=yield*l(["rev-parse","--show-toplevel"],{cwd:R});if(Vn.code!==0)return{id:Tn,worktree:R,sandbox:R,vcs:_};return R=T(R,Vn.text.trim()),{id:Tn,sandbox:R,worktree:Hn,vcs:"git"}}),D=yield*e((P)=>P.select().from(J).where(Z(J.id,u.id)).get()),I=D?_n(D):{id:u.id,worktree:u.worktree,vcs:u.vcs,sandboxes:[],time:{created:Date.now(),updated:Date.now()}};if(nn.QITQODE_EXPERIMENTAL_ICON_DISCOVERY)yield*C(I).pipe(r.ignore,r.forkIn(M));let O={...I,worktree:u.worktree,vcs:u.vcs,time:{...I.time,updated:Date.now()}};if(u.sandbox!==O.worktree&&!O.sandboxes.includes(u.sandbox))O.sandboxes.push(u.sandbox);if(O.sandboxes=yield*r.forEach(O.sandboxes,(P)=>n.exists(P).pipe(r.orDie,r.map((Y)=>Y?P:void 0)),{concurrency:16}).pipe(r.map((P)=>P.filter((Y)=>Y!==void 0))),yield*e((P)=>P.insert(J).values({id:O.id,worktree:O.worktree,vcs:O.vcs??null,name:O.name,icon_url:O.icon?.url,icon_color:O.icon?.color,time_created:O.time.created,time_updated:O.time.updated,time_initialized:O.time.initialized,sandboxes:O.sandboxes,commands:O.commands}).onConflictDoUpdate({target:J.id,set:{worktree:O.worktree,vcs:O.vcs??null,name:O.name,icon_url:O.icon?.url,icon_color:O.icon?.color,time_updated:O.time.updated,time_initialized:O.time.initialized,sandboxes:O.sandboxes,commands:O.commands}}).run()),u.id!==w.global)yield*e((P)=>P.update(fn).set({project_id:u.id}).where(Kn(Z(fn.project_id,w.global),Z(fn.directory,u.worktree))).run());return yield*A(O),{project:O,sandbox:u.sandbox}}),C=r.fn("Project.discover")(function*(t){if(t.vcs!=="git")return;if(t.icon?.override)return;if(t.icon?.url)return;let D=(yield*n.glob("**/favicon.{ico,png,svg,jpg,jpeg,webp}",{cwd:t.worktree,absolute:!0,include:"file"}).pipe(r.orDie)).sort((sn,R)=>sn.length-R.length)[0];if(!D)return;let I=yield*n.stat(D).pipe(r.orDie);if(Number(I.size)>ue)return;let O=yield*n.readFile(D).pipe(r.orDie),P=Buffer.from(O).toString("base64"),en=`data:${k.mimeType(D)};base64,${P}`;yield*$({projectID:t.id,icon:{url:en}})}),H=r.fn("Project.list")(function*(){return yield*e((t)=>t.select().from(J).all().map(_n))}),K=r.fn("Project.get")(function*(t){let u=yield*e((D)=>D.select().from(J).where(Z(J.id,t)).get());return u?_n(u):void 0}),$=r.fn("Project.update")(function*(t){let u=yield*e((I)=>I.update(J).set({name:t.name,icon_url:t.icon?.url,icon_color:t.icon?.color,commands:t.commands,time_updated:Date.now()}).where(Z(J.id,t.projectID)).returning().get());if(!u)throw Error(`Project not found: ${t.projectID}`);let D=_n(u);return yield*A(D),D}),Q=r.fn("Project.initGit")(function*(t){if(t.project.vcs==="git")return t.project;if(!(yield*r.sync(()=>Mo("git"))))throw Error("Git is not installed");let u=yield*l(["init","--quiet"],{cwd:t.directory});if(u.code!==0)throw Error(u.stderr.trim()||u.text.trim()||"Failed to initialize git repository");let{project:D}=yield*x(t.directory);return D}),L=r.fn("Project.setInitialized")(function*(t){yield*e((u)=>u.update(J).set({time_initialized:Date.now()}).where(Z(J.id,t)).run())}),g=r.fn("Project.sandboxes")(function*(t){let u=yield*e((I)=>I.select().from(J).where(Z(J.id,t)).get());if(!u)return[];let D=_n(u);return yield*r.forEach(D.sandboxes,(I)=>n.isDir(I).pipe(r.orDie,r.map((O)=>O?I:void 0)),{concurrency:16}).pipe(r.map((I)=>I.filter((O)=>O!==void 0)))}),s=r.fnUntraced(function*(t,u){let D=yield*e((I)=>I.update(J).set({sandboxes:u,time_updated:Date.now()}).where(Z(J.id,t)).returning().get());if(!D)throw Error(`Project not found: ${t}`);yield*A(_n(D))}),m=r.fn("Project.addSandbox")(function*(t,u){let D=yield*e((O)=>O.select().from(J).where(Z(J.id,t)).get());if(!D)throw Error(`Project not found: ${t}`);let I=[...D.sandboxes];if(!I.includes(u))I.push(u);yield*s(t,I)}),y=r.fn("Project.removeSandbox")(function*(t,u){let D=yield*e((O)=>O.select().from(J).where(Z(J.id,t)).get());if(!D)throw Error(`Project not found: ${t}`);let I=D.sandboxes.filter((O)=>O!==u);yield*s(t,I)});return Gn.of({fromDirectory:x,discover:C,list:H,get:K,update:$,initGit:Q,setInitialized:L,sandboxes:g,addSandbox:m,removeSandbox:y})})),Co=Fr.pipe(h.provide(bn),h.provide(k.defaultLayer),h.provide(Xr.layer));function ge(){return In.use((n)=>n.select().from(J).all().map((o)=>_n(o)))}function le(n){let o=In.use((i)=>i.select().from(J).where(Z(J.id,n)).get());if(!o)return;return _n(o)}function se(n){In.use((o)=>o.update(J).set({time_initialized:Date.now()}).where(Z(J.id,n)).run())}import{parse as _e}from"path";var rn=gn.create("instance");hr(()=>rn.use());var tn=new Map,Ne=ni(Gn,Co),pe=new Set(["/etc","/proc","/sys","/dev","/boot","/root","/var","/private/etc","/private/var"]);function Ae(n){if(n===_e(n).root)return"filesystem root is not a valid project directory";for(let o of pe)if(n===o||k.contains(o,n))return"target is a protected system directory";return null}function Te(n){let o=Ae(n);if(o)throw Error("Access denied: "+o)}var Pn={all:void 0};function ar(n){return En(async()=>{let o=n.project&&n.worktree?{directory:n.directory,worktree:n.worktree,project:n.project}:await Ne.runPromise((i)=>i.fromDirectory(n.directory)).then(({project:i,sandbox:l})=>({directory:n.directory,worktree:l,project:i}));return await rn.provide(o,async()=>{await n.init?.()}),o})}function br(n,o){let i=o.catch((l)=>{if(tn.get(n)===i)tn.delete(n);throw l});return tn.set(n,i),i}var on={async provide(n){let o=k.resolve(n.directory);Te(o);let i=tn.get(o);if(!i)c.Default.info("creating instance",{directory:o}),i=br(o,ar({directory:o,init:n.init}));let l=await i;return rn.provide(l,async()=>{return n.fn()})},get current(){return rn.use()},get directory(){return rn.use().directory},get worktree(){return rn.use().worktree},get project(){return rn.use().project},containsPath(n,o){let i=o??on;if(k.contains(i.directory,n))return!0;if(i.worktree==="/")return!1;return k.contains(i.worktree,n)},bind(n){let o=rn.use();return(...i)=>rn.provide(o,()=>n(...i))},restore(n,o){return rn.provide(n,o)},async reload(n){let o=k.resolve(n.directory);c.Default.info("reloading instance",{directory:o}),await Go(o),tn.delete(o);let i=br(o,ar({...n,directory:o}));return Rn.emit("event",{directory:o,project:n.project?.id,workspace:Nn.workspaceID,payload:{type:"server.instance.disposed",properties:{directory:o}}}),await i},async dispose(){let{directory:n,project:o}=on;c.Default.info("disposing instance",{directory:n}),await Go(n),tn.delete(n),Rn.emit("event",{directory:n,project:o.id,workspace:Nn.workspaceID,payload:{type:"server.instance.disposed",properties:{directory:n}}})},async disposeAll(){if(Pn.all)return Pn.all;return Pn.all=En(async()=>{c.Default.info("disposing all instances");let n=[...tn.entries()];for(let[o,i]of n){if(tn.get(o)!==i)continue;let l=await i.catch((e)=>{c.Default.warn("instance dispose failed",{key:o,error:e});return});if(!l){if(tn.get(o)===i)tn.delete(o);continue}if(tn.get(o)!==i)continue;await rn.provide(l,async()=>{await on.dispose()})}}).finally(()=>{Pn.all=void 0}),Pn.all}};var oi="~qitqode/InstanceState",$e=(n)=>{try{return on.bind(n)}catch(l){if(!(l instanceof gn.NotFound))throw l}let o=Ln.getCurrent(),i=o?vn.getReferenceUnsafe(o.context,Wn):void 0;if(!i)return n;return(...l)=>on.restore(i,()=>n(...l))},Ho=r.gen(function*(){return(yield*Wn)??on.current}),De=r.gen(function*(){return(yield*hn)??Nn.workspaceID}),no=r.map(Ho,(n)=>n.directory),ve=(n)=>r.gen(function*(){let o=yield*Jn.make({capacity:Number.POSITIVE_INFINITY,lookup:()=>r.gen(function*(){return yield*n(yield*Ho)})}),i=xr((l)=>r.runPromise(Jn.invalidate(o,l).pipe(r.provide(ri))));return yield*r.addFinalizer(()=>r.sync(i)),{[oi]:oi,cache:o}}),xo=(n)=>r.gen(function*(){return yield*Jn.get(n.cache,yield*no)}),Be=(n,o)=>r.map(xo(n),o),Qe=(n,o)=>r.flatMap(xo(n),o),Ie=(n)=>r.gen(function*(){return yield*Jn.has(n.cache,yield*no)}),Le=(n)=>r.gen(function*(){return yield*Jn.invalidate(n.cache,yield*no)});var ei={};On(ei,{make:()=>de});function ii(n,o,i){if(n&&o!==void 0)return Nn.restore(o,()=>on.restore(n,i));if(n)return on.restore(n,i);if(o!==void 0)return Nn.restore(o,i);return i()}function de(){return r.gen(function*(){let n=yield*r.context(),i=(yield*Wn)??(()=>{try{return on.current}catch(_){if(!(_ instanceof gn.NotFound))throw _}})(),l=(yield*hn)??Nn.workspaceID,e=(_)=>ti(_,{instance:i,workspace:l}),A=(_)=>e(_).pipe(r.provide(n));return{promise:(_)=>ii(i,l,()=>r.runPromise(A(_))),fork:(_)=>ii(i,l,()=>r.runFork(A(_)))}})}var mi={};On(mi,{make:()=>Ge,Cancelled:()=>Zn});class Zn extends N.TaggedErrorClass()("RunnerCancelled",{}){}var Ge=(n,o)=>{let i=pn.makeUnsafe({_tag:"Idle"}),l=o?.onIdle??r.void,e=o?.onBusy??r.void,A=o?.onInterrupt,_=0,T=()=>pn.getUnsafe(i),M=()=>{return _+=1,_},x=(m,y)=>Xn.isFailure(y)&&Ko.hasInterruptsOnly(y.cause)?ln.fail(m,new Zn).pipe(r.asVoid):ln.done(m,y).pipe(r.asVoid),C=()=>pn.modify(i,(m)=>[m._tag==="Idle"?l:r.void,m]).pipe(r.flatten),H=(m,y,t)=>pn.modify(i,(u)=>[r.gen(function*(){if(u._tag==="Running"&&u.run.id===m)yield*l;yield*x(y,t)}),u._tag==="Running"&&u.run.id===m?{_tag:"Idle"}:u]).pipe(r.flatten),K=(m,y)=>r.gen(function*(){let t=M(),u=yield*m.pipe(r.onExit((D)=>H(t,y,D)),r.forkIn(n));return{id:t,done:y,fiber:u}}),$=(m)=>pn.modifyEffect(i,r.fnUntraced(function*(y){if(y._tag==="Shell"&&y.shell.id===m)return[l,{_tag:"Idle"}];if(y._tag==="ShellThenRun"&&y.shell.id===m){let t=yield*K(y.run.work,y.run.done);return[r.void,{_tag:"Running",run:t}]}return[r.void,y]})).pipe(r.flatten),Q=(m)=>Ln.interrupt(m.fiber),L=(m)=>pn.modifyEffect(i,r.fnUntraced(function*(y){switch(y._tag){case"Running":case"ShellThenRun":if(o?.onReentryWarn)yield*o.onReentryWarn({label:o.label??"(unlabeled)",existingRunId:y.run.id});return[ln.await(y.run.done),y];case"Shell":{let t={id:M(),done:yield*ln.make(),work:m};return[ln.await(t.done),{_tag:"ShellThenRun",shell:y.shell,run:t}]}case"Idle":{let t=yield*ln.make(),u=yield*K(m,t);return[ln.await(t),{_tag:"Running",run:u}]}}})).pipe(r.flatten,r.catch((y)=>y instanceof Zn?A??r.die(y):r.fail(y))),g=(m)=>pn.modifyEffect(i,r.fnUntraced(function*(y){if(y._tag!=="Idle")return[r.sync(()=>{if(o?.busy)o.busy();throw Error("Runner is busy")}),y];yield*e;let t=M(),u=yield*m.pipe(r.ensuring($(t)),r.forkChild),D={id:t,fiber:u};return[r.gen(function*(){let I=yield*Ln.await(u);if(Xn.isSuccess(I))return I.value;if(Ko.hasInterruptsOnly(I.cause)&&A)return yield*A;return yield*r.failCause(I.cause)}),{_tag:"Shell",shell:D}]})).pipe(r.flatten),s=pn.modify(i,(m)=>{switch(m._tag){case"Idle":return[r.void,m];case"Running":return[r.gen(function*(){yield*Ln.interrupt(m.run.fiber);let y=yield*Ln.await(m.run.fiber);yield*x(m.run.done,y),yield*ln.await(m.run.done).pipe(r.exit,r.asVoid),yield*C()}),{_tag:"Idle"}];case"Shell":return[r.gen(function*(){yield*Q(m.shell),yield*C()}),{_tag:"Idle"}];case"ShellThenRun":return[r.gen(function*(){yield*ln.fail(m.run.done,new Zn).pipe(r.asVoid),yield*Q(m.shell),yield*C()}),{_tag:"Idle"}]}}).pipe(r.flatten);return{get state(){return T()},get busy(){return T()._tag!=="Idle"},ensureRunning:L,startShell:g,cancel:s}};import{Database as Je}from"bun:sqlite";function yi(n){let o=new Je(n,{create:!0});return ui({client:o})}var Me=ro.create("NotFoundError",a.object({message:a.string()})),fi=c.create({service:"db"});function li(){if(["latest","beta","prod"].includes(Ro)||nn.QITQODE_DISABLE_CHANNEL_DB)return oo.join($n.Path.data,"qitqode.db");let n=Ro.replace(/[^a-zA-Z0-9._-]/g,"-");return oo.join($n.Path.data,`qitqode-${n}.db`)}var Eo=En(()=>{if(nn.QITQODE_DB){if(nn.QITQODE_DB===":memory:"||oo.isAbsolute(nn.QITQODE_DB))return nn.QITQODE_DB;return oo.join($n.Path.data,nn.QITQODE_DB)}return li()}),Mn=gi(()=>{fi.info("opening database",{path:Eo});let n=yi(Eo);n.run("PRAGMA journal_mode = WAL"),n.run("PRAGMA synchronous = NORMAL"),n.run("PRAGMA busy_timeout = 5000"),n.run("PRAGMA cache_size = -64000"),n.run("PRAGMA foreign_keys = ON"),n.run("PRAGMA wal_checkpoint(PASSIVE)");let o=[{sql:"CREATE TABLE `project` (\n\t`id` text PRIMARY KEY,\n\t`worktree` text NOT NULL,\n\t`vcs` text,\n\t`name` text,\n\t`icon_url` text,\n\t`icon_color` text,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\t`time_initialized` integer,\n\t`sandboxes` text NOT NULL\n);\n--> statement-breakpoint\nCREATE TABLE `message` (\n\t`id` text PRIMARY KEY,\n\t`session_id` text NOT NULL,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\t`data` text NOT NULL,\n\tCONSTRAINT `fk_message_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nCREATE TABLE `part` (\n\t`id` text PRIMARY KEY,\n\t`message_id` text NOT NULL,\n\t`session_id` text NOT NULL,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\t`data` text NOT NULL,\n\tCONSTRAINT `fk_part_message_id_message_id_fk` FOREIGN KEY (`message_id`) REFERENCES `message`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nCREATE TABLE `permission` (\n\t`project_id` text PRIMARY KEY,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\t`data` text NOT NULL,\n\tCONSTRAINT `fk_permission_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nCREATE TABLE `session` (\n\t`id` text PRIMARY KEY,\n\t`project_id` text NOT NULL,\n\t`parent_id` text,\n\t`slug` text NOT NULL,\n\t`directory` text NOT NULL,\n\t`title` text NOT NULL,\n\t`version` text NOT NULL,\n\t`share_url` text,\n\t`summary_additions` integer,\n\t`summary_deletions` integer,\n\t`summary_files` integer,\n\t`summary_diffs` text,\n\t`revert` text,\n\t`permission` text,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\t`time_compacting` integer,\n\t`time_archived` integer,\n\tCONSTRAINT `fk_session_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nCREATE TABLE `todo` (\n\t`session_id` text NOT NULL,\n\t`content` text NOT NULL,\n\t`status` text NOT NULL,\n\t`priority` text NOT NULL,\n\t`position` integer NOT NULL,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\tCONSTRAINT `todo_pk` PRIMARY KEY(`session_id`, `position`),\n\tCONSTRAINT `fk_todo_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nCREATE TABLE `session_share` (\n\t`session_id` text PRIMARY KEY,\n\t`id` text NOT NULL,\n\t`secret` text NOT NULL,\n\t`url` text NOT NULL,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\tCONSTRAINT `fk_session_share_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nCREATE INDEX `message_session_idx` ON `message` (`session_id`);--> statement-breakpoint\nCREATE INDEX `part_message_idx` ON `part` (`message_id`);--> statement-breakpoint\nCREATE INDEX `part_session_idx` ON `part` (`session_id`);--> statement-breakpoint\nCREATE INDEX `session_project_idx` ON `session` (`project_id`);--> statement-breakpoint\nCREATE INDEX `session_parent_idx` ON `session` (`parent_id`);--> statement-breakpoint\nCREATE INDEX `todo_session_idx` ON `todo` (`session_id`);",timestamp:1769552633000,name:"20260127222353_familiar_lady_ursula"},{sql:"ALTER TABLE `project` ADD `commands` text;",timestamp:1770830228000,name:"20260211171708_add_project_commands"},{sql:"CREATE TABLE `control_account` (\n\t`email` text NOT NULL,\n\t`url` text NOT NULL,\n\t`access_token` text NOT NULL,\n\t`refresh_token` text NOT NULL,\n\t`token_expiry` integer,\n\t`active` integer NOT NULL,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\tCONSTRAINT `control_account_pk` PRIMARY KEY(`email`, `url`)\n);\n",timestamp:1770993676000,name:"20260213144116_wakeful_the_professor"},{sql:"CREATE TABLE `workspace` (\n\t`id` text PRIMARY KEY,\n\t`branch` text,\n\t`project_id` text NOT NULL,\n\t`config` text NOT NULL,\n\tCONSTRAINT `fk_workspace_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE\n);\n",timestamp:1772056728000,name:"20260225215848_workspace"},{sql:"ALTER TABLE `session` ADD `workspace_id` text;--> statement-breakpoint\nCREATE INDEX `session_workspace_idx` ON `session` (`workspace_id`);",timestamp:1772228279000,name:"20260227213759_add_session_workspace_id"},{sql:"CREATE TABLE `account` (\n\t`id` text PRIMARY KEY,\n\t`email` text NOT NULL,\n\t`url` text NOT NULL,\n\t`access_token` text NOT NULL,\n\t`refresh_token` text NOT NULL,\n\t`token_expiry` integer,\n\t`selected_org_id` text,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL\n);\n--> statement-breakpoint\nCREATE TABLE `account_state` (\n\t`id` integer PRIMARY KEY NOT NULL,\n\t`active_account_id` text,\n\tFOREIGN KEY (`active_account_id`) REFERENCES `account`(`id`) ON UPDATE no action ON DELETE set null\n);\n",timestamp:1772310750000,name:"20260228203230_blue_harpoon"},{sql:"ALTER TABLE `workspace` ADD `type` text NOT NULL;--> statement-breakpoint\nALTER TABLE `workspace` ADD `name` text;--> statement-breakpoint\nALTER TABLE `workspace` ADD `directory` text;--> statement-breakpoint\nALTER TABLE `workspace` ADD `extra` text;--> statement-breakpoint\nALTER TABLE `workspace` DROP COLUMN `config`;",timestamp:1772579546000,name:"20260303231226_add_workspace_fields"},{sql:"ALTER TABLE `account_state` ADD `active_org_id` text;--> statement-breakpoint\nUPDATE `account_state` SET `active_org_id` = (SELECT `selected_org_id` FROM `account` WHERE `account`.`id` = `account_state`.`active_account_id`);--> statement-breakpoint\nALTER TABLE `account` DROP COLUMN `selected_org_id`;\n",timestamp:1773097200000,name:"20260309230000_move_org_to_state"},{sql:"DROP INDEX IF EXISTS `message_session_idx`;--> statement-breakpoint\nDROP INDEX IF EXISTS `part_message_idx`;--> statement-breakpoint\nCREATE INDEX `message_session_time_created_id_idx` ON `message` (`session_id`,`time_created`,`id`);--> statement-breakpoint\nCREATE INDEX `part_message_id_id_idx` ON `part` (`message_id`,`id`);",timestamp:1773290071000,name:"20260312043431_session_message_cursor"},{sql:"CREATE TABLE `event_sequence` (\n\t`aggregate_id` text PRIMARY KEY,\n\t`seq` integer NOT NULL\n);\n--> statement-breakpoint\nCREATE TABLE `event` (\n\t`id` text PRIMARY KEY,\n\t`aggregate_id` text NOT NULL,\n\t`seq` integer NOT NULL,\n\t`type` text NOT NULL,\n\t`data` text NOT NULL,\n\tCONSTRAINT `fk_event_aggregate_id_event_sequence_aggregate_id_fk` FOREIGN KEY (`aggregate_id`) REFERENCES `event_sequence`(`aggregate_id`) ON DELETE CASCADE\n);\n",timestamp:1774309702000,name:"20260323234822_events"},{sql:"PRAGMA foreign_keys=OFF;--> statement-breakpoint\nCREATE TABLE `__new_workspace` (\n\t`id` text PRIMARY KEY,\n\t`type` text NOT NULL,\n\t`name` text DEFAULT '' NOT NULL,\n\t`branch` text,\n\t`directory` text,\n\t`extra` text,\n\t`project_id` text NOT NULL,\n\tCONSTRAINT `fk_workspace_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nINSERT INTO `__new_workspace`(`id`, `type`, `branch`, `name`, `directory`, `extra`, `project_id`) SELECT `id`, `type`, `branch`, `name`, `directory`, `extra`, `project_id` FROM `workspace`;--> statement-breakpoint\nDROP TABLE `workspace`;--> statement-breakpoint\nALTER TABLE `__new_workspace` RENAME TO `workspace`;--> statement-breakpoint\nPRAGMA foreign_keys=ON;",timestamp:1775843113000,name:"20260410174513_workspace-name"},{sql:"CREATE TABLE `session_entry` (\n\t`id` text PRIMARY KEY,\n\t`session_id` text NOT NULL,\n\t`type` text NOT NULL,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\t`data` text NOT NULL,\n\tCONSTRAINT `fk_session_entry_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nCREATE INDEX `session_entry_session_idx` ON `session_entry` (`session_id`);--> statement-breakpoint\nCREATE INDEX `session_entry_session_type_idx` ON `session_entry` (`session_id`,`type`);--> statement-breakpoint\nCREATE INDEX `session_entry_time_created_idx` ON `session_entry` (`time_created`);",timestamp:1776103196000,name:"20260413175956_chief_energizer"},{sql:"ALTER TABLE `session` ADD `context_from` text;--> statement-breakpoint\nALTER TABLE `session` ADD `context_watermark` text;--> statement-breakpoint\nCREATE INDEX `session_context_from_idx` ON `session` (`context_from`);\n",timestamp:1776873600000,name:"20260422160000_context_inheritance"},{sql:"CREATE TABLE `task_registry` (\n `id` text PRIMARY KEY,\n `parent_session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE CASCADE,\n `status` text NOT NULL,\n `agent` text NOT NULL,\n `description` text NOT NULL,\n `context_mode` text NOT NULL,\n `background` integer NOT NULL,\n `last_turn_time` integer NOT NULL,\n `turn_count` integer NOT NULL DEFAULT 0,\n `error` text,\n `time_completed` integer,\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL\n);--> statement-breakpoint\nCREATE INDEX `task_registry_parent_idx` ON `task_registry` (`parent_session_id`);--> statement-breakpoint\nCREATE INDEX `task_registry_status_idx` ON `task_registry` (`status`);--> statement-breakpoint\nCREATE INDEX `task_registry_status_last_turn_idx` ON `task_registry` (`status`, `last_turn_time`);\n",timestamp:1776877200000,name:"20260422170000_task_registry"},{sql:"DROP INDEX IF EXISTS `session_entry_session_idx`;--> statement-breakpoint\nDROP INDEX IF EXISTS `session_entry_session_type_idx`;--> statement-breakpoint\nDROP INDEX IF EXISTS `session_entry_time_created_idx`;--> statement-breakpoint\nDROP TABLE IF EXISTS `session_entry`;\n",timestamp:1776956061000,name:"20260423145421_remove_session_entry"},{sql:"DROP INDEX IF EXISTS `task_registry_parent_idx`;--> statement-breakpoint\nDROP INDEX IF EXISTS `task_registry_status_idx`;--> statement-breakpoint\nDROP INDEX IF EXISTS `task_registry_status_last_turn_idx`;--> statement-breakpoint\nALTER TABLE `task_registry` RENAME TO `actor_registry`;--> statement-breakpoint\nCREATE INDEX `actor_registry_parent_idx` ON `actor_registry` (`parent_session_id`);--> statement-breakpoint\nCREATE INDEX `actor_registry_status_idx` ON `actor_registry` (`status`);--> statement-breakpoint\nCREATE INDEX `actor_registry_status_last_turn_idx` ON `actor_registry` (`status`, `last_turn_time`);\n",timestamp:1778803200000,name:"20260515000000_actor_rename"},{sql:"CREATE TABLE `memory_fts` (\n `path` text PRIMARY KEY NOT NULL,\n `scope` text NOT NULL,\n `scope_id` text DEFAULT '' NOT NULL,\n `type` text NOT NULL,\n `body` text NOT NULL,\n `fingerprint` text NOT NULL,\n `last_indexed_at` integer NOT NULL\n);\n--> statement-breakpoint\nCREATE INDEX `memory_fts_scope_idx` ON `memory_fts` (`scope`, `scope_id`);\n--> statement-breakpoint\nCREATE INDEX `memory_fts_type_idx` ON `memory_fts` (`type`);\n--> statement-breakpoint\nCREATE VIRTUAL TABLE `memory_fts_idx` USING fts5(\n body,\n content='memory_fts',\n content_rowid='rowid',\n tokenize='unicode61 remove_diacritics 1'\n);\n--> statement-breakpoint\nCREATE TRIGGER `memory_fts_ai` AFTER INSERT ON `memory_fts` BEGIN\n INSERT INTO `memory_fts_idx`(rowid, body) VALUES (NEW.rowid, NEW.body);\nEND;\n--> statement-breakpoint\nCREATE TRIGGER `memory_fts_ad` AFTER DELETE ON `memory_fts` BEGIN\n DELETE FROM `memory_fts_idx` WHERE rowid = OLD.rowid;\nEND;\n--> statement-breakpoint\nCREATE TRIGGER `memory_fts_au` AFTER UPDATE ON `memory_fts` BEGIN\n DELETE FROM `memory_fts_idx` WHERE rowid = OLD.rowid;\n INSERT INTO `memory_fts_idx`(rowid, body) VALUES (NEW.rowid, NEW.body);\nEND;\n",timestamp:1778806800000,name:"20260515010000_memory_fts"},{sql:"CREATE TABLE `task` (\n `id` text NOT NULL,\n `session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE CASCADE,\n `parent_task_id` text,\n `kind` text NOT NULL DEFAULT 'user',\n `status` text NOT NULL,\n `focus` integer NOT NULL DEFAULT 0,\n `summary` text NOT NULL,\n `created_at` integer NOT NULL,\n `last_event_at` integer NOT NULL,\n `ended_at` integer,\n `cleanup_after` integer,\n PRIMARY KEY (`session_id`, `id`)\n);--> statement-breakpoint\nCREATE INDEX `task_session_idx` ON `task` (`session_id`);--> statement-breakpoint\nCREATE INDEX `task_parent_idx` ON `task` (`session_id`, `parent_task_id`);--> statement-breakpoint\nCREATE INDEX `task_status_idx` ON `task` (`status`);--> statement-breakpoint\nCREATE INDEX `task_kind_idx` ON `task` (`kind`);--> statement-breakpoint\nCREATE UNIQUE INDEX `task_focus_per_session_idx` ON `task` (`session_id`) WHERE focus = 1;--> statement-breakpoint\nCREATE TABLE `task_event` (\n `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n `session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE CASCADE,\n `task_id` text NOT NULL,\n `at` integer NOT NULL,\n `kind` text NOT NULL,\n `summary` text,\n FOREIGN KEY (`session_id`, `task_id`) REFERENCES `task`(`session_id`, `id`) ON DELETE CASCADE\n);--> statement-breakpoint\nCREATE INDEX `task_event_task_idx` ON `task_event` (`session_id`, `task_id`, `at`);\n",timestamp:1778810400000,name:"20260515020000_user_task"},{sql:"ALTER TABLE `session` ADD `last_checkpoint_message_id` text;\n",timestamp:1779148800000,name:"20260519000000_last_checkpoint_message_id"},{sql:"ALTER TABLE `message` ADD `agent_id` text;--> statement-breakpoint\nCREATE INDEX `message_session_agent_idx` ON `message` (`session_id`,`agent_id`,`id`);\n",timestamp:1779321600000,name:"20260521000000_message_agent_id"},{sql:"DROP TABLE `actor_registry`;--> statement-breakpoint\nCREATE TABLE `actor_registry` (\n `session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE CASCADE,\n `actor_id` text NOT NULL,\n `mode` text NOT NULL,\n `parent_actor_id` text,\n `status` text NOT NULL,\n `agent` text NOT NULL,\n `description` text NOT NULL,\n `context_mode` text NOT NULL,\n `context_watermark` text,\n `background` integer NOT NULL,\n `tools` text,\n `last_turn_time` integer NOT NULL,\n `turn_count` integer NOT NULL DEFAULT 0,\n `error` text,\n `time_completed` integer,\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL,\n PRIMARY KEY (`session_id`, `actor_id`)\n);--> statement-breakpoint\nCREATE INDEX `actor_registry_session_agent_idx` ON `actor_registry` (`session_id`, `agent`);--> statement-breakpoint\nCREATE INDEX `actor_registry_session_parent_idx` ON `actor_registry` (`session_id`, `parent_actor_id`);--> statement-breakpoint\nCREATE INDEX `actor_registry_status_idx` ON `actor_registry` (`status`);--> statement-breakpoint\nCREATE INDEX `actor_registry_status_last_turn_idx` ON `actor_registry` (`status`, `last_turn_time`);\n",timestamp:1779321660000,name:"20260521000100_actor_registry_v6"},{sql:"DROP TRIGGER IF EXISTS `memory_fts_ai`;--> statement-breakpoint\nDROP TRIGGER IF EXISTS `memory_fts_ad`;--> statement-breakpoint\nDROP TRIGGER IF EXISTS `memory_fts_au`;--> statement-breakpoint\nDROP TABLE IF EXISTS `memory_fts_idx`;--> statement-breakpoint\nDROP TABLE IF EXISTS `memory_fts`;--> statement-breakpoint\nCREATE TABLE `memory_fts` (\n `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n `path` text NOT NULL UNIQUE,\n `scope` text NOT NULL,\n `scope_id` text DEFAULT '' NOT NULL,\n `type` text NOT NULL,\n `body` text NOT NULL,\n `fingerprint` text NOT NULL,\n `last_indexed_at` integer NOT NULL\n);--> statement-breakpoint\nCREATE INDEX `memory_fts_scope_idx` ON `memory_fts` (`scope`, `scope_id`);--> statement-breakpoint\nCREATE INDEX `memory_fts_type_idx` ON `memory_fts` (`type`);--> statement-breakpoint\nCREATE VIRTUAL TABLE `memory_fts_idx` USING fts5(\n body,\n content='memory_fts',\n content_rowid='id',\n tokenize='unicode61 remove_diacritics 1'\n);--> statement-breakpoint\nCREATE TRIGGER `memory_fts_ai` AFTER INSERT ON `memory_fts` BEGIN\n INSERT INTO `memory_fts_idx`(rowid, body) VALUES (NEW.id, NEW.body);\nEND;--> statement-breakpoint\nCREATE TRIGGER `memory_fts_ad` AFTER DELETE ON `memory_fts` BEGIN\n DELETE FROM `memory_fts_idx` WHERE rowid = OLD.id;\nEND;--> statement-breakpoint\nCREATE TRIGGER `memory_fts_au` AFTER UPDATE ON `memory_fts` BEGIN\n DELETE FROM `memory_fts_idx` WHERE rowid = OLD.id;\n INSERT INTO `memory_fts_idx`(rowid, body) VALUES (NEW.id, NEW.body);\nEND;\n",timestamp:1779325200000,name:"20260521010000_memory_fts_v6"},{sql:"-- Fix v6.1 trigger pattern: external content FTS5 vtab requires the 'delete'\n-- magic command to remove OLD body's tokens, NOT a plain DELETE FROM the vtab.\n-- The previous DELETE FROM pattern was contentless-mode syntax misapplied to\n-- external-content mode, leaving stale tokens accumulating until vtab corrupts.\nDROP TRIGGER IF EXISTS `memory_fts_ai`;--> statement-breakpoint\nDROP TRIGGER IF EXISTS `memory_fts_ad`;--> statement-breakpoint\nDROP TRIGGER IF EXISTS `memory_fts_au`;--> statement-breakpoint\nCREATE TRIGGER `memory_fts_ai` AFTER INSERT ON `memory_fts` BEGIN\n INSERT INTO `memory_fts_idx`(rowid, body) VALUES (NEW.id, NEW.body);\nEND;--> statement-breakpoint\nCREATE TRIGGER `memory_fts_ad` AFTER DELETE ON `memory_fts` BEGIN\n INSERT INTO `memory_fts_idx`(`memory_fts_idx`, rowid, body) VALUES('delete', OLD.id, OLD.body);\nEND;--> statement-breakpoint\nCREATE TRIGGER `memory_fts_au` AFTER UPDATE ON `memory_fts` BEGIN\n INSERT INTO `memory_fts_idx`(`memory_fts_idx`, rowid, body) VALUES('delete', OLD.id, OLD.body);\n INSERT INTO `memory_fts_idx`(rowid, body) VALUES (NEW.id, NEW.body);\nEND;\n",timestamp:1779328800000,name:"20260521020000_memory_fts_triggers"},{sql:"UPDATE `message` SET `agent_id` = 'main' WHERE `agent_id` IS NULL;--> statement-breakpoint\nCREATE TABLE `message_new` (\n `id` text PRIMARY KEY NOT NULL,\n `session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE CASCADE,\n `agent_id` text NOT NULL DEFAULT 'main',\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL,\n `data` text NOT NULL\n);--> statement-breakpoint\nINSERT INTO `message_new` SELECT `id`, `session_id`, COALESCE(`agent_id`, 'main'), `time_created`, `time_updated`, `data` FROM `message`;--> statement-breakpoint\nDROP TABLE `message`;--> statement-breakpoint\nALTER TABLE `message_new` RENAME TO `message`;--> statement-breakpoint\nCREATE INDEX `message_session_time_created_id_idx` ON `message` (`session_id`,`time_created`,`id`);--> statement-breakpoint\nCREATE INDEX `message_session_agent_idx` ON `message` (`session_id`,`agent_id`,`id`);\n",timestamp:1779753600000,name:"20260526000000_agent_id_main"},{sql:"ALTER TABLE `actor_registry` ADD COLUMN `last_outcome` text;--> statement-breakpoint\nALTER TABLE `actor_registry` ADD COLUMN `lifecycle` text NOT NULL DEFAULT 'ephemeral';--> statement-breakpoint\nALTER TABLE `actor_registry` RENAME COLUMN `error` TO `last_error`;--> statement-breakpoint\nUPDATE `actor_registry` SET `last_outcome` = 'success' WHERE `status` = 'completed';--> statement-breakpoint\nUPDATE `actor_registry` SET `last_outcome` = 'failure' WHERE `status` = 'failed';--> statement-breakpoint\nUPDATE `actor_registry` SET `last_outcome` = 'cancelled' WHERE `status` = 'cancelled';--> statement-breakpoint\nUPDATE `actor_registry` SET `status` = 'idle' WHERE `status` IN ('completed','failed','cancelled');--> statement-breakpoint\nUPDATE `actor_registry` SET `lifecycle` = CASE `mode` WHEN 'peer' THEN 'persistent' WHEN 'main' THEN 'persistent' ELSE 'ephemeral' END;\n",timestamp:1779840000000,name:"20260527000000_actor_lifecycle"},{sql:"CREATE TABLE `inbox` (\n `id` text PRIMARY KEY NOT NULL,\n `receiver_session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE CASCADE,\n `receiver_actor_id` text NOT NULL,\n `sender_session_id` text,\n `sender_actor_id` text,\n `type` text NOT NULL DEFAULT 'text',\n `content` text NOT NULL,\n `created_at` integer NOT NULL\n);--> statement-breakpoint\nCREATE INDEX `inbox_receiver_idx` ON `inbox` (`receiver_session_id`,`receiver_actor_id`,`id`);--> statement-breakpoint\nCREATE INDEX `inbox_created_idx` ON `inbox` (`created_at`);\n",timestamp:1779840060000,name:"20260527000100_inbox"},{sql:"-- todo: drop priority column\nALTER TABLE `todo` DROP COLUMN `priority`;\n--> statement-breakpoint\n\n-- task: drop focus-dependent index before dropping its column\nDROP INDEX `task_focus_per_session_idx`;\n--> statement-breakpoint\nDROP INDEX `task_kind_idx`;\n--> statement-breakpoint\nALTER TABLE `task` DROP COLUMN `focus`;\n--> statement-breakpoint\nALTER TABLE `task` DROP COLUMN `kind`;\n--> statement-breakpoint\n\n-- migrate status values: proposed/active -> open\nUPDATE `task` SET `status` = 'open' WHERE `status` IN ('proposed', 'active');\n",timestamp:1780012800000,name:"20260529000000_task_todo_redesign"},{sql:"ALTER TABLE `task` ADD COLUMN `owner` text;\n",timestamp:1780444800000,name:"20260603000000_task_in_progress_owner"},{sql:"CREATE TABLE `workflow_run` (\n `id` text PRIMARY KEY NOT NULL,\n `session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE CASCADE,\n `name` text NOT NULL,\n `status` text NOT NULL,\n `running` integer NOT NULL DEFAULT 0,\n `succeeded` integer NOT NULL DEFAULT 0,\n `failed` integer NOT NULL DEFAULT 0,\n `current_phase` text,\n `parent_actor_id` text,\n `args` text,\n `error` text,\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL\n);--> statement-breakpoint\nCREATE INDEX `workflow_run_session_idx` ON `workflow_run` (`session_id`);--> statement-breakpoint\nCREATE INDEX `workflow_run_status_idx` ON `workflow_run` (`status`);\n",timestamp:1780444800000,name:"20260603000000_workflow_run"},{sql:"ALTER TABLE `workflow_run` ADD COLUMN `script_sha` text;\n",timestamp:1780531200000,name:"20260604000000_workflow_script_sha"},{sql:"CREATE TABLE `claude_import` (\n `source_uuid` text PRIMARY KEY NOT NULL,\n `session_id` text NOT NULL,\n `source_path` text NOT NULL,\n `source_mtime` integer NOT NULL,\n `time_imported` integer NOT NULL\n);\n",timestamp:1780876800000,name:"20260608000000_claude_import"},{sql:"ALTER TABLE `claude_import` ADD `message_ids` text;\n",timestamp:1780880400000,name:"20260608010000_claude_import_message_ids"},{sql:"CREATE TABLE `history_fts` (\n `part_id` text PRIMARY KEY NOT NULL,\n `session_id` text NOT NULL,\n `message_id` text NOT NULL,\n `project_id` text NOT NULL,\n `kind` text NOT NULL,\n `tool_name` text,\n `body` text NOT NULL,\n `time_created` integer NOT NULL\n);--> statement-breakpoint\nCREATE INDEX `history_fts_session_idx` ON `history_fts` (`session_id`, `time_created`);--> statement-breakpoint\nCREATE INDEX `history_fts_project_idx` ON `history_fts` (`project_id`, `time_created`);--> statement-breakpoint\nCREATE INDEX `history_fts_message_idx` ON `history_fts` (`message_id`);--> statement-breakpoint\nCREATE VIRTUAL TABLE `history_fts_idx` USING fts5(\n body,\n content='history_fts',\n content_rowid='rowid',\n tokenize='unicode61 remove_diacritics 1'\n);--> statement-breakpoint\nCREATE TRIGGER `history_fts_ai` AFTER INSERT ON `history_fts` BEGIN\n INSERT INTO `history_fts_idx`(rowid, body) VALUES (NEW.rowid, NEW.body);\nEND;--> statement-breakpoint\nCREATE TRIGGER `history_fts_ad` AFTER DELETE ON `history_fts` BEGIN\n INSERT INTO `history_fts_idx`(`history_fts_idx`, rowid, body) VALUES('delete', OLD.rowid, OLD.body);\nEND;--> statement-breakpoint\nCREATE TRIGGER `history_fts_au` AFTER UPDATE ON `history_fts` BEGIN\n INSERT INTO `history_fts_idx`(`history_fts_idx`, rowid, body) VALUES('delete', OLD.rowid, OLD.body);\n INSERT INTO `history_fts_idx`(rowid, body) VALUES (NEW.rowid, NEW.body);\nEND;\n",timestamp:1780963200000,name:"20260609000000_history_fts"},{sql:"ALTER TABLE `workflow_run` ADD COLUMN `agent_timeout_ms` integer;\n",timestamp:1781046000000,name:"20260609230000_workflow_agent_timeout"},{sql:"CREATE TABLE `external_import` (\n `source` text NOT NULL,\n `source_key` text NOT NULL,\n `session_id` text NOT NULL,\n `source_path` text NOT NULL,\n `source_mtime` integer NOT NULL,\n `time_imported` integer NOT NULL,\n `message_ids` text,\n PRIMARY KEY (`source`, `source_key`)\n);\n\nINSERT INTO `external_import` (`source`, `source_key`, `session_id`, `source_path`, `source_mtime`, `time_imported`, `message_ids`)\nSELECT 'cc', `source_uuid`, `session_id`, `source_path`, `source_mtime`, `time_imported`, `message_ids`\nFROM `claude_import`;\n\nDROP TABLE `claude_import`;\n",timestamp:1781222400000,name:"20260612000000_external_import"}];if(o.length>0){if(fi.info("applying migrations",{count:o.length,mode:"bundled"}),nn.QITQODE_SKIP_MIGRATIONS)for(let i of o)i.sql="select 1;";ao(n,o)}return n});function Se(){Mn().$client.close(),Mn.reset()}var Yn=gn.create("database");function Ce(n){try{return n(Yn.use().tx)}catch(o){if(o instanceof gn.NotFound){let i=[],l=Yn.provide({effects:i,tx:Mn()},()=>n(Mn()));for(let e of i)e();return l}throw o}}function He(n){let o=Un.bind(n);try{Yn.use().effects.push(o)}catch{o()}}function xe(n,o){try{return n(Yn.use().tx)}catch(i){if(i instanceof gn.NotFound){let l=[],e=Un.bind((_)=>Yn.provide({tx:_,effects:l},()=>n(_))),A=Mn().transaction(e,{behavior:o?.behavior});for(let _ of l)_();return A}throw i}}var Oi={};On(Oi,{layer:()=>Ti,defaultLayer:()=>we,Service:()=>to,NotFoundError:()=>Zo});import X from"path";var Sn={};On(Sn,{layer:()=>pi,defaultLayer:()=>Ee,Service:()=>io,Git:()=>Sn});var Ke=["--no-optional-locks","-c","core.autocrlf=false","-c","core.fsmonitor=false","-c","core.longpaths=true","-c","core.symlinks=true","-c","core.quotepath=false"],zn=(n)=>n.text().trim(),Po=(n)=>n.split("\x00").filter(Boolean),Re=(n)=>({exitCode:1,text:()=>"",stdout:Buffer.alloc(0),stderr:Buffer.from(n instanceof Error?n.message:String(n))}),si=(n)=>{if(n==="??")return"added";if(n.includes("U"))return"modified";if(n.includes("A")&&!n.includes("D"))return"added";if(n.includes("D")&&!n.includes("A"))return"deleted";return"modified"};class io extends vn.Service()("@qitqode/Git"){}var pi=h.effect(io,r.gen(function*(){let n=yield*an.ChildProcessSpawner,o=r.fn("Git.run")(function*(g,s){let m=_i.make("git",[...Ke,...g],{cwd:s.cwd,env:s.env,extendEnv:!0,stdin:"ignore",stdout:"pipe",stderr:"pipe"}),y=yield*Ni(n,m);return{exitCode:y.code,text:()=>y.text,stdout:Buffer.from(y.text),stderr:Buffer.from(y.stderr)}},r.scoped,r.catch((g)=>r.succeed(Re(g)))),i=r.fn("Git.text")(function*(g,s){return(yield*o(g,s)).text()}),l=r.fn("Git.lines")(function*(g,s){return(yield*i(g,s)).split(/\r?\n/).map((m)=>m.trim()).filter(Boolean)}),e=r.fnUntraced(function*(g){return yield*l(["for-each-ref","--format=%(refname:short)","refs/heads"],{cwd:g})}),A=r.fnUntraced(function*(g,s){let m=yield*o(["config","init.defaultBranch"],{cwd:g}),y=zn(m);if(!y||!s.includes(y))return;return{name:y,ref:y}}),_=r.fnUntraced(function*(g){let s=yield*l(["remote"],{cwd:g});if(s.includes("origin"))return"origin";if(s.length===1)return s[0];if(s.includes("upstream"))return"upstream";return s[0]}),T=r.fn("Git.branch")(function*(g){let s=yield*o(["symbolic-ref","--quiet","--short","HEAD"],{cwd:g});if(s.exitCode!==0)return;return zn(s)||void 0}),M=r.fn("Git.prefix")(function*(g){let s=yield*o(["rev-parse","--show-prefix"],{cwd:g});if(s.exitCode!==0)return"";return zn(s)}),x=r.fn("Git.defaultBranch")(function*(g){let s=yield*_(g);if(s){let t=yield*o(["symbolic-ref",`refs/remotes/${s}/HEAD`],{cwd:g});if(t.exitCode===0){let u=zn(t).replace(/^refs\/remotes\//,""),D=u.startsWith(`${s}/`)?u.slice(`${s}/`.length):"";if(D)return{name:D,ref:u}}}let m=yield*e(g),y=yield*A(g,m);if(y)return y;if(m.includes("main"))return{name:"main",ref:"main"};if(m.includes("master"))return{name:"master",ref:"master"}}),C=r.fn("Git.hasHead")(function*(g){return(yield*o(["rev-parse","--verify","HEAD"],{cwd:g})).exitCode===0}),H=r.fn("Git.mergeBase")(function*(g,s,m="HEAD"){let y=yield*o(["merge-base",s,m],{cwd:g});if(y.exitCode!==0)return;return zn(y)||void 0}),K=r.fn("Git.show")(function*(g,s,m,y=""){let t=y?`${y}${m}`:m,u=yield*o(["show",`${s}:${t}`],{cwd:g});if(u.exitCode!==0)return"";if(u.stdout.includes(0))return"";return u.text()}),$=r.fn("Git.status")(function*(g){return Po(yield*i(["status","--porcelain=v1","--untracked-files=all","--no-renames","-z","--","."],{cwd:g})).flatMap((s)=>{let m=s.slice(3);if(!m)return[];let y=s.slice(0,2);return[{file:m,code:y,status:si(y)}]})}),Q=r.fn("Git.diff")(function*(g,s){let m=Po(yield*i(["diff","--no-ext-diff","--no-renames","--name-status","-z",s,"--","."],{cwd:g}));return m.flatMap((y,t)=>{if(t%2!==0)return[];let u=m[t+1];if(!y||!u)return[];return[{file:u,code:y,status:si(y)}]})}),L=r.fn("Git.stats")(function*(g,s){return Po(yield*i(["diff","--no-ext-diff","--no-renames","--numstat","-z",s,"--","."],{cwd:g})).flatMap((m)=>{let y=m.indexOf("\t"),t=m.indexOf("\t",y+1);if(y===-1||t===-1)return[];let u=m.slice(t+1);if(!u)return[];let D=m.slice(0,y),I=m.slice(y+1,t),O=D==="-"?0:Number.parseInt(D||"0",10),P=I==="-"?0:Number.parseInt(I||"0",10);return[{file:u,additions:Number.isFinite(O)?O:0,deletions:Number.isFinite(P)?P:0}]})});return io.of({run:o,branch:T,prefix:M,defaultBranch:x,hasHead:C,mergeBase:H,show:K,status:$,diff:Q,stats:L})})),Ee=pi.pipe(h.provide(bn));var An=c.create({service:"storage"}),Zo=ro.create("NotFoundError",a.object({message:a.string()})),Pe=N.Struct({path:N.optional(N.Struct({root:N.optional(N.String)}))}),We=N.Struct({id:N.String}),Ue=N.Struct({id:N.String}),Ze=N.Struct({additions:N.Number,deletions:N.Number}),Xe=N.Struct({id:N.String,projectID:N.String,summary:N.Struct({diffs:N.Array(Ze)})}),Ye=N.decodeUnknownOption(Pe),ze=N.decodeUnknownOption(We),ce=N.decodeUnknownOption(Ue),ke=N.decodeUnknownOption(Xe);class to extends vn.Service()("@qitqode/Storage"){}function qe(n,o){return X.join(n,...o)+".json"}function Wo(n){if(!n||typeof n!=="object")return!1;if("code"in n&&n.code==="ENOENT")return!0;if("reason"in n&&n.reason&&typeof n.reason==="object"&&"_tag"in n.reason)return n.reason._tag==="NotFound";return!1}function Ve(n){let o=Number.parseInt(n,10);return Number.isNaN(o)?0:o}var Ai=[r.fn("Storage.migration.1")(function*(n,o,i){let l=X.resolve(n,"../project");if(!(yield*o.isDir(l)))return;let e=yield*o.glob("*",{cwd:l,include:"all"});for(let A of e){let _=X.join(l,A);if(!(yield*o.isDir(_)))continue;An.info(`migrating project ${A}`);let T=A,M="/";if(T!=="global"){for(let H of yield*o.glob("storage/session/message/*/*.json",{cwd:_,absolute:!0})){let K=Ye(yield*o.readJson(H),{onExcessProperty:"preserve"}),$=cn.isSome(K)?K.value.path?.root:void 0;if(!$)continue;M=$;break}if(!M)continue;if(!(yield*o.isDir(M)))continue;let x=yield*i.run(["rev-list","--max-parents=0","--all"],{cwd:M}),[C]=x.text().split(`
5
- `).filter(Boolean).map((H)=>H.trim()).toSorted();if(!C)continue;T=C,yield*o.writeWithDirs(X.join(n,"project",T+".json"),JSON.stringify({id:C,vcs:"git",worktree:M,time:{created:Date.now(),initialized:Date.now()}},null,2)),An.info(`migrating sessions for project ${T}`);for(let H of yield*o.glob("storage/session/info/*.json",{cwd:_,absolute:!0})){let K=X.join(n,"session",T,X.basename(H));An.info("copying",{sessionFile:H,dest:K});let $=yield*o.readJson(H),Q=ze($,{onExcessProperty:"preserve"});if(yield*o.writeWithDirs(K,JSON.stringify($,null,2)),cn.isNone(Q))continue;An.info(`migrating messages for session ${Q.value.id}`);for(let L of yield*o.glob(`storage/session/message/${Q.value.id}/*.json`,{cwd:_,absolute:!0})){let g=X.join(n,"message",Q.value.id,X.basename(L));An.info("copying",{msgFile:L,dest:g});let s=yield*o.readJson(L),m=ce(s,{onExcessProperty:"preserve"});if(yield*o.writeWithDirs(g,JSON.stringify(s,null,2)),cn.isNone(m))continue;An.info(`migrating parts for message ${m.value.id}`);for(let y of yield*o.glob(`storage/session/part/${Q.value.id}/${m.value.id}/*.json`,{cwd:_,absolute:!0})){let t=X.join(n,"part",m.value.id,X.basename(y)),u=yield*o.readJson(y);An.info("copying",{partFile:y,dest:t}),yield*o.writeWithDirs(t,JSON.stringify(u,null,2))}}}}}}),r.fn("Storage.migration.2")(function*(n,o){for(let i of yield*o.glob("session/*/*.json",{cwd:n,absolute:!0})){let l=yield*o.readJson(i),e=ke(l,{onExcessProperty:"preserve"});if(cn.isNone(e))continue;let A=e.value.summary.diffs;yield*o.writeWithDirs(X.join(n,"session_diff",e.value.id+".json"),JSON.stringify(A,null,2)),yield*o.writeWithDirs(X.join(n,"session",e.value.projectID,e.value.id+".json"),JSON.stringify({...l,summary:{additions:A.reduce((_,T)=>_+T.additions,0),deletions:A.reduce((_,T)=>_+T.deletions,0)}},null,2))}})],Ti=h.effect(to,r.gen(function*(){let n=yield*k.Service,o=yield*Sn.Service,i=yield*Uo.make({lookup:()=>Cn.make(),idleTimeToLive:0}),l=yield*r.cached(r.gen(function*(){let $=X.join($n.Path.data,"storage"),Q=X.join($,"migration"),L=yield*n.readFileString(Q).pipe(r.map(Ve),r.catchIf(Wo,()=>r.succeed(0)),r.orElseSucceed(()=>0));for(let g=L;g<Ai.length;g++){An.info("running migration",{index:g});let s=Ai[g],m=yield*r.exit(s($,n,o));if(Xn.isFailure(m)){An.error("failed to run migration",{index:g,cause:m.cause});break}yield*n.writeWithDirs(Q,String(g+1))}return{dir:$}})),e=($)=>r.fail(new Zo({message:`Resource not found: ${$}`})),A=($,Q)=>Q.pipe(r.catchIf(Wo,()=>e($))),_=r.fnUntraced(function*($,Q){yield*n.writeWithDirs($,JSON.stringify(Q,null,2))}),T=($,Q)=>r.scoped(r.gen(function*(){let L=qe((yield*l).dir,$);return yield*Q(L,yield*Uo.get(i,L))})),M=r.fn("Storage.remove")(function*($){yield*T($,(Q,L)=>Cn.withWriteLock(L,n.remove(Q).pipe(r.catchIf(Wo,()=>r.void))))}),x=($)=>r.gen(function*(){return yield*T($,(L,g)=>Cn.withReadLock(g,A(L,n.readJson(L))))}),C=($,Q)=>r.gen(function*(){return yield*T($,(g,s)=>Cn.withWriteLock(s,r.gen(function*(){let m=yield*A(g,n.readJson(g));return Q(m),yield*_(g,m),m})))}),H=($,Q)=>r.gen(function*(){yield*T($,(L,g)=>Cn.withWriteLock(g,_(L,Q)))}),K=r.fn("Storage.list")(function*($){let Q=(yield*l).dir,L=X.join(Q,...$);return(yield*n.glob("**/*",{cwd:L,include:"file"}).pipe(r.catch(()=>r.succeed([])))).map((s)=>[...$,...s.slice(0,-5).split(X.sep)]).toSorted((s,m)=>s.join("/").localeCompare(m.join("/")))});return to.of({remove:M,read:x,update:C,write:H,list:K})})),we=Ti.pipe(h.provide(k.defaultLayer),h.provide(Sn.defaultLayer));export{Rn as ml,xr as nl,En as ol,mn as pl,J as ql,fn as rl,eo as sl,Yo as tl,zo as ul,co as vl,ko as wl,Vo as xl,fo as yl,In as zl,Sn as Al,Zo as Bl,Oi as Cl,w as Dl,Jo as El,Pr as Fl,se as Gl,jr as Hl,Ae as Il,on as Jl,Un as Kl,de as Ll,ei as Ml,mi as Nl};
5
+ `).filter(Boolean).map((H)=>H.trim()).toSorted();if(!C)continue;T=C,yield*o.writeWithDirs(X.join(n,"project",T+".json"),JSON.stringify({id:C,vcs:"git",worktree:M,time:{created:Date.now(),initialized:Date.now()}},null,2)),An.info(`migrating sessions for project ${T}`);for(let H of yield*o.glob("storage/session/info/*.json",{cwd:_,absolute:!0})){let K=X.join(n,"session",T,X.basename(H));An.info("copying",{sessionFile:H,dest:K});let $=yield*o.readJson(H),Q=ze($,{onExcessProperty:"preserve"});if(yield*o.writeWithDirs(K,JSON.stringify($,null,2)),cn.isNone(Q))continue;An.info(`migrating messages for session ${Q.value.id}`);for(let L of yield*o.glob(`storage/session/message/${Q.value.id}/*.json`,{cwd:_,absolute:!0})){let g=X.join(n,"message",Q.value.id,X.basename(L));An.info("copying",{msgFile:L,dest:g});let s=yield*o.readJson(L),m=ce(s,{onExcessProperty:"preserve"});if(yield*o.writeWithDirs(g,JSON.stringify(s,null,2)),cn.isNone(m))continue;An.info(`migrating parts for message ${m.value.id}`);for(let y of yield*o.glob(`storage/session/part/${Q.value.id}/${m.value.id}/*.json`,{cwd:_,absolute:!0})){let t=X.join(n,"part",m.value.id,X.basename(y)),u=yield*o.readJson(y);An.info("copying",{partFile:y,dest:t}),yield*o.writeWithDirs(t,JSON.stringify(u,null,2))}}}}}}),r.fn("Storage.migration.2")(function*(n,o){for(let i of yield*o.glob("session/*/*.json",{cwd:n,absolute:!0})){let l=yield*o.readJson(i),e=ke(l,{onExcessProperty:"preserve"});if(cn.isNone(e))continue;let A=e.value.summary.diffs;yield*o.writeWithDirs(X.join(n,"session_diff",e.value.id+".json"),JSON.stringify(A,null,2)),yield*o.writeWithDirs(X.join(n,"session",e.value.projectID,e.value.id+".json"),JSON.stringify({...l,summary:{additions:A.reduce((_,T)=>_+T.additions,0),deletions:A.reduce((_,T)=>_+T.deletions,0)}},null,2))}})],Ti=h.effect(to,r.gen(function*(){let n=yield*k.Service,o=yield*Sn.Service,i=yield*Uo.make({lookup:()=>Cn.make(),idleTimeToLive:0}),l=yield*r.cached(r.gen(function*(){let $=X.join($n.Path.data,"storage"),Q=X.join($,"migration"),L=yield*n.readFileString(Q).pipe(r.map(Ve),r.catchIf(Wo,()=>r.succeed(0)),r.orElseSucceed(()=>0));for(let g=L;g<Ai.length;g++){An.info("running migration",{index:g});let s=Ai[g],m=yield*r.exit(s($,n,o));if(Xn.isFailure(m)){An.error("failed to run migration",{index:g,cause:m.cause});break}yield*n.writeWithDirs(Q,String(g+1))}return{dir:$}})),e=($)=>r.fail(new Zo({message:`Resource not found: ${$}`})),A=($,Q)=>Q.pipe(r.catchIf(Wo,()=>e($))),_=r.fnUntraced(function*($,Q){yield*n.writeWithDirs($,JSON.stringify(Q,null,2))}),T=($,Q)=>r.scoped(r.gen(function*(){let L=qe((yield*l).dir,$);return yield*Q(L,yield*Uo.get(i,L))})),M=r.fn("Storage.remove")(function*($){yield*T($,(Q,L)=>Cn.withWriteLock(L,n.remove(Q).pipe(r.catchIf(Wo,()=>r.void))))}),x=($)=>r.gen(function*(){return yield*T($,(L,g)=>Cn.withReadLock(g,A(L,n.readJson(L))))}),C=($,Q)=>r.gen(function*(){return yield*T($,(g,s)=>Cn.withWriteLock(s,r.gen(function*(){let m=yield*A(g,n.readJson(g));return Q(m),yield*_(g,m),m})))}),H=($,Q)=>r.gen(function*(){yield*T($,(L,g)=>Cn.withWriteLock(g,_(L,Q)))}),K=r.fn("Storage.list")(function*($){let Q=(yield*l).dir,L=X.join(Q,...$);return(yield*n.glob("**/*",{cwd:L,include:"file"}).pipe(r.catch(()=>r.succeed([])))).map((s)=>[...$,...s.slice(0,-5).split(X.sep)]).toSorted((s,m)=>s.join("/").localeCompare(m.join("/")))});return to.of({remove:M,read:x,update:C,write:H,list:K})})),we=Ti.pipe(h.provide(k.defaultLayer),h.provide(Sn.defaultLayer));export{Rn as nl,xr as ol,En as pl,mn as ql,J as rl,fn as sl,eo as tl,Yo as ul,zo as vl,co as wl,ko as xl,Vo as yl,fo as zl,In as Al,Sn as Bl,Zo as Cl,Oi as Dl,w as El,Jo as Fl,Pr as Gl,se as Hl,jr as Il,Ae as Jl,on as Kl,Un as Ll,de as Ml,ei as Nl,mi as Ol};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{oP as D}from"./chunk-wbt31xap.js";import{pP as C}from"./chunk-9pj10pgd.js";import{rP as B}from"./chunk-djfrkbd5.js";var H=B((q)=>{Object.defineProperty(q,"__esModule",{value:!0});q.getMachineId=void 0;var E=D(),F=C();async function G(){try{let f=(await(0,E.execAsync)('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split(`
2
+ import{pP as D}from"./chunk-0w77vhg4.js";import{qP as C}from"./chunk-t4kma6mq.js";import{sP as B}from"./chunk-0xf12tf3.js";var H=B((q)=>{Object.defineProperty(q,"__esModule",{value:!0});q.getMachineId=void 0;var E=D(),F=C();async function G(){try{let f=(await(0,E.execAsync)('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split(`
3
3
  `).find((z)=>z.includes("IOPlatformUUID"));if(!f)return;let k=f.split('" = "');if(k.length===2)return k[1].slice(0,-1)}catch(b){F.diag.debug(`error reading machine id: ${b}`)}return}q.getMachineId=G});export default H();
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import"./chunk-0xf12tf3.js";var a="./highlights-x6tmsnaa.scm";export{a as default};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  function i(f,r){let e=JSON.parse(JSON.stringify(f));if("nullable"in e&&e.nullable===!0){if(e.type)if(Array.isArray(e.type)){if(!e.type.includes("null"))e.type.push("null")}else e.type=[e.type,"null"];else e.type=["null"];delete e.nullable}if(e.$schema)delete e.$schema;if(["properties","additionalProperties","items","additionalItems","allOf","anyOf","oneOf","not","if","then","else","definitions","$defs","patternProperties","propertyNames","contains"].forEach((s)=>{if(e[s]&&(typeof e[s]==="object"||Array.isArray(e[s])))if(s==="properties"||s==="definitions"||s==="$defs"||s==="patternProperties")for(let n in e[s])e[s][n]=i(e[s][n],r);else if(s==="allOf"||s==="anyOf"||s==="oneOf")e[s]=e[s].map((n)=>i(n,r));else if(s==="items")if(Array.isArray(e[s]))e[s]=e[s].map((n)=>i(n,r));else e[s]=i(e[s],r);else e[s]=i(e[s],r)}),e.ref||e.$id){let{ref:s,$id:n,...t}=e,a=s||n;return r.components.schemas={...r.components.schemas,[a]:t},{$ref:`#/components/schemas/${a}`}}else if(e.$ref){let{$ref:s,$defs:n,...t}=e;if(s.includes("://"))return Object.keys(t).length>0?t:{type:"string"};let a=s.split("/").pop();return r.components.schemas={...r.components.schemas,...n},{$ref:`#/components/schemas/${a}`}}return e}
3
- export{i as Kf};
3
+ export{i as Lf};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ae as b,Be as c,Ce as d,De as e,Ee as f,Fe as g,ze as a}from"./chunk-p863r97y.js";import"./chunk-6jb4mnvq.js";import"./chunk-ec1bwa7f.js";import"./chunk-hcd0k14e.js";import"./chunk-0xf12tf3.js";export{g as fromEnv,c as ENV_SESSION,b as ENV_SECRET,a as ENV_KEY,d as ENV_EXPIRATION,e as ENV_CREDENTIAL_SCOPE,f as ENV_ACCOUNT_ID};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Oe as oe}from"./chunk-ccdjzn2m.js";import{Df as _}from"./chunk-2fbkw84y.js";import{qP as m,uP as ee}from"./chunk-djfrkbd5.js";var p=m(_(),1);var K=(e)=>e&&(typeof e.sso_start_url==="string"||typeof e.sso_account_id==="string"||typeof e.sso_session==="string"||typeof e.sso_region==="string"||typeof e.sso_role_name==="string");var R=m(oe(),1);var c=m(_(),1);var b=300000,k="To refresh this SSO session run 'aws sso login' with the corresponding profile.";var H=async(e,o={},r)=>{let{SSOOIDCClient:t}=await import("./chunk-v8rqgt7h.js"),n=(f)=>o.clientConfig?.[f]??o.parentClientConfig?.[f]??r?.[f];return new t(Object.assign({},o.clientConfig??{},{region:e??o.clientConfig?.region,logger:n("logger"),userAgentAppId:n("userAgentAppId")}))};var U=async(e,o,r={},t)=>{let{CreateTokenCommand:n}=await import("./chunk-v8rqgt7h.js");return(await H(o,r,t)).send(new n({clientId:e.clientId,clientSecret:e.clientSecret,refreshToken:e.refreshToken,grantType:"refresh_token"}))};var q=m(_(),1);var C=(e)=>{if(e.expiration&&e.expiration.getTime()<Date.now())throw new q.TokenProviderError(`Token is expired. ${k}`,!1)};var W=m(_(),1);var w=(e,o,r=!1)=>{if(typeof o>"u")throw new W.TokenProviderError(`Value not present for '${e}' in SSO Token${r?". Cannot refresh":""}. ${k}`,!1)};var j=m(_(),1);import{promises as Q}from"fs";var{writeFile:Z}=Q,X=(e,o)=>{let r=j.getSSOTokenFilepath(e),t=JSON.stringify(o,null,2);return Z(r,t)};var z=new Date(0),J=(e={})=>async({callerClientConfig:o}={})=>{e.logger?.debug("@aws-sdk/token-providers - fromSso");let r=await c.parseKnownFiles(e),t=c.getProfileName({profile:e.profile??o?.profile}),n=r[t];if(!n)throw new c.TokenProviderError(`Profile '${t}' could not be found in shared credentials file.`,!1);else if(!n.sso_session)throw new c.TokenProviderError(`Profile '${t}' is missing required property 'sso_session'.`);let a=n.sso_session,S=(await c.loadSsoSessionData(e))[a];if(!S)throw new c.TokenProviderError(`Sso session '${a}' could not be found in shared credentials file.`,!1);for(let i of["sso_start_url","sso_region"])if(!S[i])throw new c.TokenProviderError(`Sso session '${a}' is missing required property '${i}'.`,!1);let{sso_start_url:g,sso_region:O}=S,s;try{s=await c.getSSOTokenFromFile(a)}catch(i){throw new c.TokenProviderError(`The SSO session token associated with profile=${t} was not found or is invalid. ${k}`,!1)}w("accessToken",s.accessToken),w("expiresAt",s.expiresAt);let{accessToken:x,expiresAt:T}=s,l={token:x,expiration:new Date(T)};if(l.expiration.getTime()-Date.now()>b)return l;if(Date.now()-z.getTime()<30000)return C(l),l;w("clientId",s.clientId,!0),w("clientSecret",s.clientSecret,!0),w("refreshToken",s.refreshToken,!0);try{z.setTime(Date.now());let i=await U(s,O,e,o);w("accessToken",i.accessToken),w("expiresIn",i.expiresIn);let y=new Date(Date.now()+i.expiresIn*1000);try{await X(a,{...s,accessToken:i.accessToken,expiresAt:y.toISOString(),refreshToken:i.refreshToken})}catch(I){}return{token:i.accessToken,expiration:y}}catch(i){return C(l),l}};var d=m(_(),1),E=!1,v=async({ssoStartUrl:e,ssoSession:o,ssoAccountId:r,ssoRegion:t,ssoRoleName:n,ssoClient:a,clientConfig:f,parentClientConfig:S,callerClientConfig:g,profile:O,filepath:s,configFilepath:x,ignoreCache:T,logger:l})=>{let i,y="To refresh this SSO session run aws sso login with the corresponding profile.";if(o)try{let h=await J({profile:O,filepath:s,configFilepath:x,ignoreCache:T})();i={accessToken:h.token,expiresAt:new Date(h.expiration).toISOString()}}catch(h){throw new d.CredentialsProviderError(h.message,{tryNextLink:E,logger:l})}else try{i=await d.getSSOTokenFromFile(e)}catch(h){throw new d.CredentialsProviderError("The SSO session associated with this profile is invalid. To refresh this SSO session run aws sso login with the corresponding profile.",{tryNextLink:E,logger:l})}if(new Date(i.expiresAt).getTime()-Date.now()<=0)throw new d.CredentialsProviderError("The SSO session associated with this profile has expired. To refresh this SSO session run aws sso login with the corresponding profile.",{tryNextLink:E,logger:l});let{accessToken:I}=i,{SSOClient:u,GetRoleCredentialsCommand:A}=await import("./chunk-h6z86aay.js"),B=a||new u(Object.assign({},f??{},{logger:f?.logger??g?.logger??S?.logger,region:f?.region??t,userAgentAppId:f?.userAgentAppId??g?.userAgentAppId??S?.userAgentAppId})),F;try{F=await B.send(new A({accountId:r,roleName:n,accessToken:I}))}catch(h){throw new d.CredentialsProviderError(h,{tryNextLink:E,logger:l})}let{roleCredentials:{accessKeyId:P,secretAccessKey:D,sessionToken:$,expiration:L,credentialScope:M,accountId:G}={}}=F;if(!P||!D||!$||!L)throw new d.CredentialsProviderError("SSO returns an invalid temporary credential.",{tryNextLink:E,logger:l});let N={accessKeyId:P,secretAccessKey:D,sessionToken:$,expiration:new Date(L),...M&&{credentialScope:M},...G&&{accountId:G}};if(o)R.setCredentialFeature(N,"CREDENTIALS_SSO","s");else R.setCredentialFeature(N,"CREDENTIALS_SSO_LEGACY","u");return N};var V=m(_(),1),Y=(e,o)=>{let{sso_start_url:r,sso_account_id:t,sso_region:n,sso_role_name:a}=e;if(!r||!t||!n||!a)throw new V.CredentialsProviderError(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(e).join(", ")}
3
- Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`,{tryNextLink:!1,logger:o});return e};var Oe=(e={})=>async({callerClientConfig:o}={})=>{e.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");let{ssoStartUrl:r,ssoAccountId:t,ssoRegion:n,ssoRoleName:a,ssoSession:f}=e,{ssoClient:S}=e,g=p.getProfileName({profile:e.profile??o?.profile});if(!r&&!t&&!n&&!a&&!f){let s=(await p.parseKnownFiles(e))[g];if(!s)throw new p.CredentialsProviderError(`Profile ${g} was not found.`,{logger:e.logger});if(!K(s))throw new p.CredentialsProviderError(`Profile ${g} is not configured with SSO credentials.`,{logger:e.logger});if(s?.sso_session){let u=(await p.loadSsoSessionData(e))[s.sso_session],A=` configurations in profile ${g} and sso-session ${s.sso_session}`;if(n&&n!==u.sso_region)throw new p.CredentialsProviderError("Conflicting SSO region"+A,{tryNextLink:!1,logger:e.logger});if(r&&r!==u.sso_start_url)throw new p.CredentialsProviderError("Conflicting SSO start_url"+A,{tryNextLink:!1,logger:e.logger});s.sso_region=u.sso_region,s.sso_start_url=u.sso_start_url}let{sso_start_url:x,sso_account_id:T,sso_region:l,sso_role_name:i,sso_session:y}=Y(s,e.logger);return v({ssoStartUrl:x,ssoSession:y,ssoAccountId:T,ssoRegion:l,ssoRoleName:i,ssoClient:S,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:g,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger})}else if(!r||!t||!n||!a)throw new p.CredentialsProviderError('Incomplete configuration. The fromSSO() argument hash must include "ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"',{tryNextLink:!1,logger:e.logger});else return v({ssoStartUrl:r,ssoSession:f,ssoAccountId:t,ssoRegion:n,ssoRoleName:a,ssoClient:S,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:g,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger})};export{K as de,Y as ee,Oe as fe};
2
+ import{Pe as oe}from"./chunk-6jb4mnvq.js";import{Ef as _}from"./chunk-hcd0k14e.js";import{rP as m,vP as ee}from"./chunk-0xf12tf3.js";var p=m(_(),1);var K=(e)=>e&&(typeof e.sso_start_url==="string"||typeof e.sso_account_id==="string"||typeof e.sso_session==="string"||typeof e.sso_region==="string"||typeof e.sso_role_name==="string");var R=m(oe(),1);var c=m(_(),1);var b=300000,k="To refresh this SSO session run 'aws sso login' with the corresponding profile.";var H=async(e,o={},r)=>{let{SSOOIDCClient:t}=await import("./chunk-5psekq9f.js"),n=(f)=>o.clientConfig?.[f]??o.parentClientConfig?.[f]??r?.[f];return new t(Object.assign({},o.clientConfig??{},{region:e??o.clientConfig?.region,logger:n("logger"),userAgentAppId:n("userAgentAppId")}))};var U=async(e,o,r={},t)=>{let{CreateTokenCommand:n}=await import("./chunk-5psekq9f.js");return(await H(o,r,t)).send(new n({clientId:e.clientId,clientSecret:e.clientSecret,refreshToken:e.refreshToken,grantType:"refresh_token"}))};var q=m(_(),1);var C=(e)=>{if(e.expiration&&e.expiration.getTime()<Date.now())throw new q.TokenProviderError(`Token is expired. ${k}`,!1)};var W=m(_(),1);var w=(e,o,r=!1)=>{if(typeof o>"u")throw new W.TokenProviderError(`Value not present for '${e}' in SSO Token${r?". Cannot refresh":""}. ${k}`,!1)};var j=m(_(),1);import{promises as Q}from"fs";var{writeFile:Z}=Q,X=(e,o)=>{let r=j.getSSOTokenFilepath(e),t=JSON.stringify(o,null,2);return Z(r,t)};var z=new Date(0),J=(e={})=>async({callerClientConfig:o}={})=>{e.logger?.debug("@aws-sdk/token-providers - fromSso");let r=await c.parseKnownFiles(e),t=c.getProfileName({profile:e.profile??o?.profile}),n=r[t];if(!n)throw new c.TokenProviderError(`Profile '${t}' could not be found in shared credentials file.`,!1);else if(!n.sso_session)throw new c.TokenProviderError(`Profile '${t}' is missing required property 'sso_session'.`);let a=n.sso_session,S=(await c.loadSsoSessionData(e))[a];if(!S)throw new c.TokenProviderError(`Sso session '${a}' could not be found in shared credentials file.`,!1);for(let i of["sso_start_url","sso_region"])if(!S[i])throw new c.TokenProviderError(`Sso session '${a}' is missing required property '${i}'.`,!1);let{sso_start_url:g,sso_region:O}=S,s;try{s=await c.getSSOTokenFromFile(a)}catch(i){throw new c.TokenProviderError(`The SSO session token associated with profile=${t} was not found or is invalid. ${k}`,!1)}w("accessToken",s.accessToken),w("expiresAt",s.expiresAt);let{accessToken:x,expiresAt:T}=s,l={token:x,expiration:new Date(T)};if(l.expiration.getTime()-Date.now()>b)return l;if(Date.now()-z.getTime()<30000)return C(l),l;w("clientId",s.clientId,!0),w("clientSecret",s.clientSecret,!0),w("refreshToken",s.refreshToken,!0);try{z.setTime(Date.now());let i=await U(s,O,e,o);w("accessToken",i.accessToken),w("expiresIn",i.expiresIn);let y=new Date(Date.now()+i.expiresIn*1000);try{await X(a,{...s,accessToken:i.accessToken,expiresAt:y.toISOString(),refreshToken:i.refreshToken})}catch(I){}return{token:i.accessToken,expiration:y}}catch(i){return C(l),l}};var d=m(_(),1),E=!1,v=async({ssoStartUrl:e,ssoSession:o,ssoAccountId:r,ssoRegion:t,ssoRoleName:n,ssoClient:a,clientConfig:f,parentClientConfig:S,callerClientConfig:g,profile:O,filepath:s,configFilepath:x,ignoreCache:T,logger:l})=>{let i,y="To refresh this SSO session run aws sso login with the corresponding profile.";if(o)try{let h=await J({profile:O,filepath:s,configFilepath:x,ignoreCache:T})();i={accessToken:h.token,expiresAt:new Date(h.expiration).toISOString()}}catch(h){throw new d.CredentialsProviderError(h.message,{tryNextLink:E,logger:l})}else try{i=await d.getSSOTokenFromFile(e)}catch(h){throw new d.CredentialsProviderError("The SSO session associated with this profile is invalid. To refresh this SSO session run aws sso login with the corresponding profile.",{tryNextLink:E,logger:l})}if(new Date(i.expiresAt).getTime()-Date.now()<=0)throw new d.CredentialsProviderError("The SSO session associated with this profile has expired. To refresh this SSO session run aws sso login with the corresponding profile.",{tryNextLink:E,logger:l});let{accessToken:I}=i,{SSOClient:u,GetRoleCredentialsCommand:A}=await import("./chunk-v9yxkbz7.js"),B=a||new u(Object.assign({},f??{},{logger:f?.logger??g?.logger??S?.logger,region:f?.region??t,userAgentAppId:f?.userAgentAppId??g?.userAgentAppId??S?.userAgentAppId})),F;try{F=await B.send(new A({accountId:r,roleName:n,accessToken:I}))}catch(h){throw new d.CredentialsProviderError(h,{tryNextLink:E,logger:l})}let{roleCredentials:{accessKeyId:P,secretAccessKey:D,sessionToken:$,expiration:L,credentialScope:M,accountId:G}={}}=F;if(!P||!D||!$||!L)throw new d.CredentialsProviderError("SSO returns an invalid temporary credential.",{tryNextLink:E,logger:l});let N={accessKeyId:P,secretAccessKey:D,sessionToken:$,expiration:new Date(L),...M&&{credentialScope:M},...G&&{accountId:G}};if(o)R.setCredentialFeature(N,"CREDENTIALS_SSO","s");else R.setCredentialFeature(N,"CREDENTIALS_SSO_LEGACY","u");return N};var V=m(_(),1),Y=(e,o)=>{let{sso_start_url:r,sso_account_id:t,sso_region:n,sso_role_name:a}=e;if(!r||!t||!n||!a)throw new V.CredentialsProviderError(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(e).join(", ")}
3
+ Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`,{tryNextLink:!1,logger:o});return e};var Oe=(e={})=>async({callerClientConfig:o}={})=>{e.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");let{ssoStartUrl:r,ssoAccountId:t,ssoRegion:n,ssoRoleName:a,ssoSession:f}=e,{ssoClient:S}=e,g=p.getProfileName({profile:e.profile??o?.profile});if(!r&&!t&&!n&&!a&&!f){let s=(await p.parseKnownFiles(e))[g];if(!s)throw new p.CredentialsProviderError(`Profile ${g} was not found.`,{logger:e.logger});if(!K(s))throw new p.CredentialsProviderError(`Profile ${g} is not configured with SSO credentials.`,{logger:e.logger});if(s?.sso_session){let u=(await p.loadSsoSessionData(e))[s.sso_session],A=` configurations in profile ${g} and sso-session ${s.sso_session}`;if(n&&n!==u.sso_region)throw new p.CredentialsProviderError("Conflicting SSO region"+A,{tryNextLink:!1,logger:e.logger});if(r&&r!==u.sso_start_url)throw new p.CredentialsProviderError("Conflicting SSO start_url"+A,{tryNextLink:!1,logger:e.logger});s.sso_region=u.sso_region,s.sso_start_url=u.sso_start_url}let{sso_start_url:x,sso_account_id:T,sso_region:l,sso_role_name:i,sso_session:y}=Y(s,e.logger);return v({ssoStartUrl:x,ssoSession:y,ssoAccountId:T,ssoRegion:l,ssoRoleName:i,ssoClient:S,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:g,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger})}else if(!r||!t||!n||!a)throw new p.CredentialsProviderError('Incomplete configuration. The fromSSO() argument hash must include "ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"',{tryNextLink:!1,logger:e.logger});else return v({ssoStartUrl:r,ssoSession:f,ssoAccountId:t,ssoRegion:n,ssoRoleName:a,ssoClient:S,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:g,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger})};export{K as ee,Y as fe,Oe as ge};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{$g as r}from"./chunk-c1c8ch3g.js";import{Ij as e}from"./chunk-s27cz24e.js";import{Vl as t}from"./chunk-dx7rexx3.js";import{Kn as l}from"./chunk-qdafm7qg.js";import{ju as a}from"./chunk-15bjhfav.js";import{RO as o}from"./chunk-2zjet9tx.js";var S={PromptAppend:t.define("tui.prompt.append",a.object({text:a.string()})),CommandExecute:t.define("tui.command.execute",a.object({command:a.union([a.enum(["session.list","session.new","session.share","session.interrupt","session.compact","session.page.up","session.page.down","session.line.up","session.line.down","session.half.page.up","session.half.page.down","session.first","session.last","prompt.clear","prompt.submit","agent.cycle"]),a.string()])})),ToastShow:t.define("tui.toast.show",a.object({title:a.string().optional(),message:a.string(),variant:a.enum(["info","success","warning","error"]),duration:a.number().default(5000).optional().describe("Duration in milliseconds")})),SessionSelect:t.define("tui.session.select",a.object({sessionID:e.zod.describe("Session ID to navigate to")})),InstructionsLoaded:r};class m extends o.Class("ConsoleState")({consoleManagedProviders:o.mutable(o.Array(o.String)),activeOrgName:o.optional(o.String),switchableOrgCount:o.Number}){static zod=l(this)}var f=m.make({consoleManagedProviders:[],activeOrgName:void 0,switchableOrgCount:0});
3
- export{S as vg,m as wg,f as xg};
2
+ import{ah as r}from"./chunk-cv3xdp8q.js";import{Jj as e}from"./chunk-z4gczap3.js";import{Wl as t}from"./chunk-aq75kv5f.js";import{Ln as l}from"./chunk-z66xdxkg.js";import{ku as a}from"./chunk-w623r5kb.js";import{SO as o}from"./chunk-hk8m8vax.js";var S={PromptAppend:t.define("tui.prompt.append",a.object({text:a.string()})),CommandExecute:t.define("tui.command.execute",a.object({command:a.union([a.enum(["session.list","session.new","session.share","session.interrupt","session.compact","session.page.up","session.page.down","session.line.up","session.line.down","session.half.page.up","session.half.page.down","session.first","session.last","prompt.clear","prompt.submit","agent.cycle"]),a.string()])})),ToastShow:t.define("tui.toast.show",a.object({title:a.string().optional(),message:a.string(),variant:a.enum(["info","success","warning","error"]),duration:a.number().default(5000).optional().describe("Duration in milliseconds")})),SessionSelect:t.define("tui.session.select",a.object({sessionID:e.zod.describe("Session ID to navigate to")})),InstructionsLoaded:r};class m extends o.Class("ConsoleState")({consoleManagedProviders:o.mutable(o.Array(o.String)),activeOrgName:o.optional(o.String),switchableOrgCount:o.Number}){static zod=l(this)}var f=m.make({consoleManagedProviders:[],activeOrgName:void 0,switchableOrgCount:0});
3
+ export{S as wg,m as xg,f as yg};
@@ -5,4 +5,4 @@ Lifetime used`):new P("Lifetime not alive")}},J=class extends Q{constructor(W,Y)
5
5
  Then, failed to dispose scope: ${Z.message}`,disposeError:Z}),Y;if(Y||Z)throw Y||Z}var z=class W extends q{constructor(){super(...arguments);this._disposables=new Q(new Set),this.manage=(Y)=>(this._disposables.value.add(Y),Y)}static withScope(Y){let Z=new W,$;try{return Y(Z)}catch(X){throw $=X,X}finally{E(Z,$)}}static withScopeMaybeAsync(Y,Z){return XW(void 0,function*($){let X=new W,j;try{return yield*$.of(Z.call(Y,$,X))}catch(G){throw j=G,G}finally{E(X,j)}})}static async withScopeAsync(Y){let Z=new W,$;try{return await Y(Z)}catch(X){throw $=X,X}finally{E(Z,$)}}get alive(){return this._disposables.alive}dispose(){let Y=Array.from(this._disposables.value.values()).reverse();for(let Z of Y)Z.alive&&Z.dispose();this._disposables.dispose()}};function jW(W){let Y=W?Array.from(W):[];function Z(){return Y.forEach((X)=>X.alive?X.dispose():void 0)}function $(){return Y.some((X)=>X.alive)}return Object.defineProperty(Y,S,{configurable:!0,enumerable:!1,value:Z}),Object.defineProperty(Y,"dispose",{configurable:!0,enumerable:!1,value:Z}),Object.defineProperty(Y,"alive",{configurable:!0,enumerable:!1,get:$}),Y}function F(W){return!!(W&&(typeof W=="object"||typeof W=="function")&&("alive"in W)&&typeof W.alive=="boolean"&&("dispose"in W)&&typeof W.dispose=="function")}var f=class W extends q{static success(Y){return new KW(Y)}static fail(Y,Z){return new GW(Y,Z)}static is(Y){return Y instanceof W}},KW=class extends f{constructor(W){super();this.value=W}get alive(){return F(this.value)?this.value.alive:!0}dispose(){F(this.value)&&this.value.dispose()}unwrap(){return this.value}unwrapOr(W){return this.value}},GW=class extends f{constructor(W,Y){super();this.error=W,this.onUnwrap=Y}get alive(){return F(this.error)?this.error.alive:!0}dispose(){F(this.error)&&this.error.dispose()}unwrap(){throw this.onUnwrap(this),this.error}unwrapOr(W){return W}},w=f,VW=class extends q{constructor(W){super();this.resolve=(Y)=>{this.resolveHandle.alive&&(this.context.unwrapResult(this.context.callFunction(this.resolveHandle,this.context.undefined,Y||this.context.undefined)).dispose(),this.disposeResolvers(),this.onSettled())},this.reject=(Y)=>{this.rejectHandle.alive&&(this.context.unwrapResult(this.context.callFunction(this.rejectHandle,this.context.undefined,Y||this.context.undefined)).dispose(),this.disposeResolvers(),this.onSettled())},this.dispose=()=>{this.handle.alive&&this.handle.dispose(),this.disposeResolvers()},this.context=W.context,this.owner=W.context.runtime,this.handle=W.promiseHandle,this.settled=new Promise((Y)=>{this.onSettled=Y}),this.resolveHandle=W.resolveHandle,this.rejectHandle=W.rejectHandle}get alive(){return this.handle.alive||this.resolveHandle.alive||this.rejectHandle.alive}disposeResolvers(){this.resolveHandle.alive&&this.resolveHandle.dispose(),this.rejectHandle.alive&&this.rejectHandle.dispose()}},t=class{constructor(W){this.module=W}toPointerArray(W){let Y=new Int32Array(W.map((X)=>X.value)),Z=Y.length*Y.BYTES_PER_ELEMENT,$=this.module._malloc(Z);return new Uint8Array(this.module.HEAPU8.buffer,$,Z).set(new Uint8Array(Y.buffer)),new Q($,void 0,(X)=>this.module._free(X))}newTypedArray(W,Y){let Z=new W(Array(Y).fill(0)),$=Z.length*Z.BYTES_PER_ELEMENT,X=this.module._malloc($),j=new W(this.module.HEAPU8.buffer,X,Y);return j.set(Z),new Q({typedArray:j,ptr:X},void 0,(G)=>this.module._free(G.ptr))}newMutablePointerArray(W){return this.newTypedArray(Int32Array,W)}newHeapCharPointer(W){let Y=this.module.lengthBytesUTF8(W),Z=Y+1,$=this.module._malloc(Z);return this.module.stringToUTF8(W,$,Z),new Q({ptr:$,strlen:Y},void 0,(X)=>this.module._free(X.ptr))}newHeapBufferPointer(W){let Y=W.byteLength,Z=this.module._malloc(Y);return this.module.HEAPU8.set(W,Z),new Q({pointer:Z,numBytes:Y},void 0,($)=>this.module._free($.pointer))}consumeHeapCharPointer(W){let Y=this.module.UTF8ToString(W);return this.module._free(W),Y}},FW=Symbol("Unstable"),OW=Object.freeze({BaseObjects:!0,Date:!0,Eval:!0,StringNormalize:!0,RegExp:!0,JSON:!0,Proxy:!0,MapSet:!0,TypedArrays:!0,Promise:!0});function TW(W){if(!W)return 0;let Y=0;for(let[Z,$]of Object.entries(W)){if(!(Z in O))throw new n(Z);$&&(Y|=O[Z])}return Y}function QW(W){if(typeof W=="number")return W;if(W===void 0)return 0;let{type:Y,strict:Z,strip:$,compileOnly:X,backtraceBarrier:j}=W,G=0;return Y==="global"&&(G|=L.JS_EVAL_TYPE_GLOBAL),Y==="module"&&(G|=L.JS_EVAL_TYPE_MODULE),Z&&(G|=L.JS_EVAL_FLAG_STRICT),$&&(G|=L.JS_EVAL_FLAG_STRIP),X&&(G|=L.JS_EVAL_FLAG_COMPILE_ONLY),j&&(G|=L.JS_EVAL_FLAG_BACKTRACE_BARRIER),G}function zW(W){if(typeof W=="number")return W;if(W===void 0)return 0;let{strings:Y,symbols:Z,quickjsPrivate:$,onlyEnumerable:X,numbers:j,numbersAsStrings:G}=W,K=0;return Y&&(K|=U.JS_GPN_STRING_MASK),Z&&(K|=U.JS_GPN_SYMBOL_MASK),$&&(K|=U.JS_GPN_PRIVATE_MASK),X&&(K|=U.JS_GPN_ENUM_ONLY),j&&(K|=U.QTS_GPN_NUMBER_MASK),G&&(K|=U.QTS_STANDARD_COMPLIANT_NUMBER),K}function qW(...W){let Y=[];for(let Z of W)Z!==void 0&&(Y=Y.concat(Z));return Y}var CW=class extends q{constructor(W,Y){super();this.handle=W,this.context=Y,this._isDone=!1,this.owner=Y.runtime}[Symbol.iterator](){return this}next(W){if(!this.alive||this._isDone)return{done:!0,value:void 0};let Y=this._next??(this._next=this.context.getProp(this.handle,"next"));return this.callIteratorMethod(Y,W)}return(W){if(!this.alive)return{done:!0,value:void 0};let Y=this.context.getProp(this.handle,"return");if(Y===this.context.undefined&&W===void 0)return this.dispose(),{done:!0,value:void 0};let Z=this.callIteratorMethod(Y,W);return Y.dispose(),this.dispose(),Z}throw(W){if(!this.alive)return{done:!0,value:void 0};let Y=W instanceof Q?W:this.context.newError(W),Z=this.context.getProp(this.handle,"throw"),$=this.callIteratorMethod(Z,W);return Y.alive&&Y.dispose(),Z.dispose(),this.dispose(),$}get alive(){return this.handle.alive}dispose(){this._isDone=!0,this.handle.dispose(),this._next?.dispose()}callIteratorMethod(W,Y){let Z=Y?this.context.callFunction(W,this.handle,Y):this.context.callFunction(W,this.handle);if(Z.error)return this.dispose(),{value:Z};let $=this.context.getProp(Z.value,"done").consume((j)=>this.context.dump(j)),X=this.context.getProp(Z.value,"value");return Z.value.dispose(),$&&this.dispose(),{value:w.success(X),done:$}}},g=-2147483648,m=2147483647,A=0;function H(W){return W>>8}var BW=class{constructor(){this.nextId=g,this.freelist=[],this.groups=new Map}put(W){let Y=this.allocateId(),Z=H(Y),$=this.groups.get(Z);return $||($=new Map,this.groups.set(Z,$)),$.set(Y,W),Y}get(W){if(W===A)throw new C("no host reference id defined");let Y=H(W),Z=this.groups.get(Y);if(!Z)throw new C(`host reference id ${W} is not defined`);let $=Z.get(W);if(!$)throw new C(`host reference id ${W} is not defined`);return $}delete(W){if(W===A)throw new C("no host reference id defined");let Y=H(W),Z=this.groups.get(Y);if(!Z)throw new C(`host reference id ${W} is not defined`);Z.delete(W),Z.size===0&&this.groups.delete(Y),this.freelist.push(W)}allocateId(){if(this.freelist.length>0)return this.freelist.shift();if(this.nextId===A&&this.nextId++,this.nextId>m)throw new s(`HostRefMap: too many host refs created without disposing. Max simultaneous host refs: ${m-g}`);return this.nextId++}},c=class extends q{constructor(W,Y,Z){if(Z===A)throw new C("cannot create HostRef with undefined id");super();this.runtime=W,this.handle=Y,this.id=Z}get alive(){return this.handle.alive}dispose(){this.handle.dispose()}get value(){return this.runtime.hostRefs.get(this.id)}},LW=class extends t{constructor(W){super(W.module);this.scope=new z,this.copyJSValue=(Y)=>this.ffi.QTS_DupValuePointer(this.ctx.value,Y),this.freeJSValue=(Y)=>{this.ffi.QTS_FreeValuePointer(this.ctx.value,Y)},W.ownedLifetimes?.forEach((Y)=>this.scope.manage(Y)),this.owner=W.owner,this.module=W.module,this.ffi=W.ffi,this.rt=W.rt,this.ctx=this.scope.manage(W.ctx)}get alive(){return this.scope.alive}dispose(){return this.scope.dispose()}[Symbol.dispose](){return this.dispose()}manage(W){return this.scope.manage(W)}consumeJSCharPointer(W){let Y=this.module.UTF8ToString(W);return this.ffi.QTS_FreeCString(this.ctx.value,W),Y}heapValueHandle(W,Y){let Z=Y?($)=>{Y(),this.freeJSValue($)}:this.freeJSValue;return new Q(W,this.copyJSValue,Z,this.owner)}staticHeapValueHandle(W){return this.manage(this.heapValueHandle(W)),new J(W,this.owner)}},UW=class extends q{constructor(W){super();this._undefined=void 0,this._null=void 0,this._false=void 0,this._true=void 0,this._global=void 0,this._BigInt=void 0,this._Symbol=void 0,this._SymbolIterator=void 0,this._SymbolAsyncIterator=void 0,this.cToHostCallbacks={callFunction:(Y,Z,$,X,j)=>{if(Y!==this.ctx.value)throw Error("QuickJSContext instance received C -> JS call with mismatched ctx");let G=this.getFunction(j);return z.withScopeMaybeAsync(this,function*(K,V){let B=V.manage(new h(Z,this.memory.copyJSValue,this.memory.freeJSValue,this.runtime)),D=Array($);for(let T=0;T<$;T++){let M=this.ffi.QTS_ArgvGetJSValueConstPointer(X,T);D[T]=V.manage(new h(M,this.memory.copyJSValue,this.memory.freeJSValue,this.runtime))}try{let T=yield*K(G.apply(B,D));if(T){if("error"in T&&T.error)throw this.runtime.debugLog("throw error",T.error),T.error;let M=V.manage(T instanceof Q?T:T.value);return this.ffi.QTS_DupValuePointer(this.ctx.value,M.value)}return 0}catch(T){return this.errorToHandle(T).consume((M)=>this.ffi.QTS_Throw(this.ctx.value,M.value))}})}},this.runtime=W.runtime,this.module=W.module,this.ffi=W.ffi,this.rt=W.rt,this.ctx=W.ctx,this.memory=new LW({...W,owner:this.runtime}),W.callbacks.setContextCallbacks(this.ctx.value,this.cToHostCallbacks),this.dump=this.dump.bind(this),this.getString=this.getString.bind(this),this.getNumber=this.getNumber.bind(this),this.resolvePromise=this.resolvePromise.bind(this),this.uint32Out=this.memory.manage(this.memory.newTypedArray(Uint32Array,1))}get alive(){return this.memory.alive}dispose(){this.memory.dispose()}get undefined(){if(this._undefined)return this._undefined;let W=this.ffi.QTS_GetUndefined();return this._undefined=new J(W)}get null(){if(this._null)return this._null;let W=this.ffi.QTS_GetNull();return this._null=new J(W)}get true(){if(this._true)return this._true;let W=this.ffi.QTS_GetTrue();return this._true=new J(W)}get false(){if(this._false)return this._false;let W=this.ffi.QTS_GetFalse();return this._false=new J(W)}get global(){if(this._global)return this._global;let W=this.ffi.QTS_GetGlobalObject(this.ctx.value);return this._global=this.memory.staticHeapValueHandle(W),this._global}newNumber(W){return this.memory.heapValueHandle(this.ffi.QTS_NewFloat64(this.ctx.value,W))}newString(W){let Y=this.memory.newHeapCharPointer(W).consume((Z)=>this.ffi.QTS_NewString(this.ctx.value,Z.value.ptr));return this.memory.heapValueHandle(Y)}newUniqueSymbol(W){let Y=(typeof W=="symbol"?W.description:W)??"",Z=this.memory.newHeapCharPointer(Y).consume(($)=>this.ffi.QTS_NewSymbol(this.ctx.value,$.value.ptr,0));return this.memory.heapValueHandle(Z)}newSymbolFor(W){let Y=(typeof W=="symbol"?W.description:W)??"",Z=this.memory.newHeapCharPointer(Y).consume(($)=>this.ffi.QTS_NewSymbol(this.ctx.value,$.value.ptr,1));return this.memory.heapValueHandle(Z)}getWellKnownSymbol(W){return this._Symbol??(this._Symbol=this.memory.manage(this.getProp(this.global,"Symbol"))),this.getProp(this._Symbol,W)}newBigInt(W){if(!this._BigInt){let $=this.getProp(this.global,"BigInt");this.memory.manage($),this._BigInt=new J($.value,this.runtime)}let Y=this._BigInt,Z=String(W);return this.newString(Z).consume(($)=>this.unwrapResult(this.callFunction(Y,this.undefined,$)))}newObject(W){W&&this.runtime.assertOwned(W);let Y=W?this.ffi.QTS_NewObjectProto(this.ctx.value,W.value):this.ffi.QTS_NewObject(this.ctx.value);return this.memory.heapValueHandle(Y)}newArray(){let W=this.ffi.QTS_NewArray(this.ctx.value);return this.memory.heapValueHandle(W)}newArrayBuffer(W){let Y=new Uint8Array(W),Z=this.memory.newHeapBufferPointer(Y),$=this.ffi.QTS_NewArrayBuffer(this.ctx.value,Z.value.pointer,Y.length);return this.memory.heapValueHandle($)}newPromise(W){let Y=z.withScope((Z)=>{let $=Z.manage(this.memory.newMutablePointerArray(2)),X=this.ffi.QTS_NewPromiseCapability(this.ctx.value,$.value.ptr),j=this.memory.heapValueHandle(X),[G,K]=Array.from($.value.typedArray).map((V)=>this.memory.heapValueHandle(V));return new VW({context:this,promiseHandle:j,resolveHandle:G,rejectHandle:K})});return W&&typeof W=="function"&&(W=new Promise(W)),W&&Promise.resolve(W).then(Y.resolve,(Z)=>Z instanceof Q?Y.reject(Z):this.newError(Z).consume(Y.reject)),Y}newFunction(W,Y){let Z=typeof W=="function"?W:Y;if(!Z)throw TypeError("Expected a function");return this.newFunctionWithOptions({name:typeof W=="string"?W:void 0,length:Z.length,isConstructor:!1,fn:Z})}newConstructorFunction(W,Y){let Z=typeof W=="function"?W:Y;if(!Z)throw TypeError("Expected a function");return this.newFunctionWithOptions({name:typeof W=="string"?W:void 0,length:Z.length,isConstructor:!0,fn:Z})}newFunctionWithOptions(W){let{name:Y,length:Z,isConstructor:$,fn:X}=W,j=this.runtime.hostRefs.put(X);try{return this.memory.heapValueHandle(this.ffi.QTS_NewFunction(this.ctx.value,Y??"",Z,$,j))}catch(G){throw this.runtime.hostRefs.delete(j),G}}newError(W){let Y=this.memory.heapValueHandle(this.ffi.QTS_NewError(this.ctx.value));return W&&typeof W=="object"?(W.name!==void 0&&this.newString(W.name).consume((Z)=>this.setProp(Y,"name",Z)),W.message!==void 0&&this.newString(W.message).consume((Z)=>this.setProp(Y,"message",Z))):typeof W=="string"?this.newString(W).consume((Z)=>this.setProp(Y,"message",Z)):W!==void 0&&this.newString(String(W)).consume((Z)=>this.setProp(Y,"message",Z)),Y}newHostRef(W){let Y=this.runtime.hostRefs.put(W);try{let Z=this.memory.heapValueHandle(this.ffi.QTS_NewHostRef(this.ctx.value,Y));return new c(this.runtime,Z,Y)}catch(Z){throw this.runtime.hostRefs.delete(Y),Z}}toHostRef(W){let Y=this.ffi.QTS_GetHostRefId(W.value);if(Y!==0)return this.runtime.hostRefs.get(Y),new c(this.runtime,W.dup(),Y)}unwrapHostRef(W){let Y=this.ffi.QTS_GetHostRefId(W.value);if(Y===0)throw new C("handle is not a HostRef");return this.runtime.hostRefs.get(Y)}typeof(W){return this.runtime.assertOwned(W),this.memory.consumeHeapCharPointer(this.ffi.QTS_Typeof(this.ctx.value,W.value))}getNumber(W){return this.runtime.assertOwned(W),this.ffi.QTS_GetFloat64(this.ctx.value,W.value)}getString(W){return this.runtime.assertOwned(W),this.memory.consumeJSCharPointer(this.ffi.QTS_GetString(this.ctx.value,W.value))}getSymbol(W){this.runtime.assertOwned(W);let Y=this.memory.consumeJSCharPointer(this.ffi.QTS_GetSymbolDescriptionOrKey(this.ctx.value,W.value));return this.ffi.QTS_IsGlobalSymbol(this.ctx.value,W.value)?Symbol.for(Y):Symbol(Y)}getBigInt(W){this.runtime.assertOwned(W);let Y=this.getString(W);return BigInt(Y)}getArrayBuffer(W){this.runtime.assertOwned(W);let Y=this.ffi.QTS_GetArrayBufferLength(this.ctx.value,W.value),Z=this.ffi.QTS_GetArrayBuffer(this.ctx.value,W.value);if(!Z)throw Error("Couldn't allocate memory to get ArrayBuffer");return new Q(this.module.HEAPU8.subarray(Z,Z+Y),void 0,()=>this.module._free(Z))}getPromiseState(W){this.runtime.assertOwned(W);let Y=this.ffi.QTS_PromiseState(this.ctx.value,W.value);if(Y<0)return{type:"fulfilled",value:W,notAPromise:!0};if(Y===I.Pending)return{type:"pending",get error(){return new l("Cannot unwrap a pending promise")}};let Z=this.ffi.QTS_PromiseResult(this.ctx.value,W.value),$=this.memory.heapValueHandle(Z);if(Y===I.Fulfilled)return{type:"fulfilled",value:$};if(Y===I.Rejected)return{type:"rejected",error:$};throw $.dispose(),Error(`Unknown JSPromiseStateEnum: ${Y}`)}resolvePromise(W){this.runtime.assertOwned(W);let Y=z.withScope((Z)=>{let $=Z.manage(this.getProp(this.global,"Promise")),X=Z.manage(this.getProp($,"resolve"));return this.callFunction(X,$,W)});return Y.error?Promise.resolve(Y):new Promise((Z)=>{z.withScope(($)=>{let X=$.manage(this.newFunction("resolve",(V)=>{Z(this.success(V&&V.dup()))})),j=$.manage(this.newFunction("reject",(V)=>{Z(this.fail(V&&V.dup()))})),G=$.manage(Y.value),K=$.manage(this.getProp(G,"then"));this.callFunction(K,G,X,j).unwrap().dispose()})})}isEqual(W,Y,Z=R.IsStrictlyEqual){if(W===Y)return!0;this.runtime.assertOwned(W),this.runtime.assertOwned(Y);let $=this.ffi.QTS_IsEqual(this.ctx.value,W.value,Y.value,Z);if($===-1)throw new p("WASM variant does not expose equality");return!!$}eq(W,Y){return this.isEqual(W,Y,R.IsStrictlyEqual)}sameValue(W,Y){return this.isEqual(W,Y,R.IsSameValue)}sameValueZero(W,Y){return this.isEqual(W,Y,R.IsSameValueZero)}getProp(W,Y){this.runtime.assertOwned(W);let Z;return typeof Y=="number"&&Y>=0?Z=this.ffi.QTS_GetPropNumber(this.ctx.value,W.value,Y):Z=this.borrowPropertyKey(Y).consume(($)=>this.ffi.QTS_GetProp(this.ctx.value,W.value,$.value)),this.memory.heapValueHandle(Z)}getLength(W){if(this.runtime.assertOwned(W),!(this.ffi.QTS_GetLength(this.ctx.value,this.uint32Out.value.ptr,W.value)<0))return this.uint32Out.value.typedArray[0]}getOwnPropertyNames(W,Y={strings:!0,numbersAsStrings:!0}){this.runtime.assertOwned(W),W.value;let Z=zW(Y);if(Z===0)throw new o("No options set, will return an empty array");return z.withScope(($)=>{let X=$.manage(this.memory.newMutablePointerArray(1)),j=this.ffi.QTS_GetOwnPropertyNames(this.ctx.value,X.value.ptr,this.uint32Out.value.ptr,W.value,Z);if(j)return this.fail(this.memory.heapValueHandle(j));let G=this.uint32Out.value.typedArray[0],K=X.value.typedArray[0],V=new Uint32Array(this.module.HEAP8.buffer,K,G),B=Array.from(V).map((D)=>this.memory.heapValueHandle(D));return this.ffi.QTS_FreeVoidPointer(this.ctx.value,K),this.success(jW(B))})}getIterator(W){let Y=this._SymbolIterator??(this._SymbolIterator=this.memory.manage(this.getWellKnownSymbol("iterator")));return z.withScope((Z)=>{let $=Z.manage(this.getProp(W,Y)),X=this.callFunction($,W);return X.error?X:this.success(new CW(X.value,this))})}setProp(W,Y,Z){this.runtime.assertOwned(W),this.borrowPropertyKey(Y).consume(($)=>this.ffi.QTS_SetProp(this.ctx.value,W.value,$.value,Z.value))}defineProp(W,Y,Z){this.runtime.assertOwned(W),z.withScope(($)=>{let X=$.manage(this.borrowPropertyKey(Y)),j=Z.value||this.undefined,G=!!Z.configurable,K=!!Z.enumerable,V=!!Z.value,B=Z.get?$.manage(this.newFunction(Z.get.name,Z.get)):this.undefined,D=Z.set?$.manage(this.newFunction(Z.set.name,Z.set)):this.undefined;this.ffi.QTS_DefineProp(this.ctx.value,W.value,X.value,j.value,B.value,D.value,G,K,V)})}callFunction(W,Y,...Z){this.runtime.assertOwned(W);let $,X=Z[0];X===void 0||Array.isArray(X)?$=X??[]:$=Z;let j=this.memory.toPointerArray($).consume((K)=>this.ffi.QTS_Call(this.ctx.value,W.value,Y.value,$.length,K.value)),G=this.ffi.QTS_ResolveException(this.ctx.value,j);return G?(this.ffi.QTS_FreeValuePointer(this.ctx.value,j),this.fail(this.memory.heapValueHandle(G))):this.success(this.memory.heapValueHandle(j))}callMethod(W,Y,Z=[]){return this.getProp(W,Y).consume(($)=>this.callFunction($,W,Z))}evalCode(W,Y="eval.js",Z){let $=Z===void 0?1:0,X=QW(Z),j=this.memory.newHeapCharPointer(W).consume((K)=>this.ffi.QTS_Eval(this.ctx.value,K.value.ptr,K.value.strlen,Y,$,X)),G=this.ffi.QTS_ResolveException(this.ctx.value,j);return G?(this.ffi.QTS_FreeValuePointer(this.ctx.value,j),this.fail(this.memory.heapValueHandle(G))):this.success(this.memory.heapValueHandle(j))}throw(W){return this.errorToHandle(W).consume((Y)=>this.ffi.QTS_Throw(this.ctx.value,Y.value))}borrowPropertyKey(W){return typeof W=="number"?this.newNumber(W):typeof W=="string"?this.newString(W):new J(W.value,this.runtime)}getMemory(W){if(W===this.rt.value)return this.memory;throw Error("Private API. Cannot get memory from a different runtime")}dump(W){this.runtime.assertOwned(W);let Y=this.typeof(W);if(Y==="string")return this.getString(W);if(Y==="number")return this.getNumber(W);if(Y==="bigint")return this.getBigInt(W);if(Y==="undefined")return;if(Y==="symbol")return this.getSymbol(W);let Z=this.getPromiseState(W);if(Z.type==="fulfilled"&&!Z.notAPromise)return W.dispose(),{type:Z.type,value:Z.value.consume(this.dump)};if(Z.type==="pending")return W.dispose(),{type:Z.type};if(Z.type==="rejected")return W.dispose(),{type:Z.type,error:Z.error.consume(this.dump)};let $=this.memory.consumeJSCharPointer(this.ffi.QTS_Dump(this.ctx.value,W.value));try{return JSON.parse($)}catch{return $}}unwrapResult(W){if(W.error){let Y="context"in W.error?W.error.context:this,Z=W.error.consume(($)=>this.dump($));if(Z&&typeof Z=="object"&&typeof Z.message=="string"){let{message:$,name:X,stack:j,...G}=Z,K=new _(Z,Y);typeof X=="string"&&(K.name=Z.name),K.message=$;let V=K.stack;throw typeof j=="string"&&(K.stack=`${X}: ${$}
6
6
  ${Z.stack}Host: ${V}`),Object.assign(K,G),K}throw new _(Z)}return W.value}[Symbol.for("nodejs.util.inspect.custom")](){return this.alive?`${this.constructor.name} { ctx: ${this.ctx.value} rt: ${this.rt.value} }`:`${this.constructor.name} { disposed }`}getFunction(W){let Y=this.runtime.hostRefs.get(W);if(typeof Y!="function")throw Error(`Host reference ${W} is not a function`);return Y}errorToHandle(W){return W instanceof Q?W:this.newError(W)}encodeBinaryJSON(W){let Y=this.ffi.QTS_bjson_encode(this.ctx.value,W.value);return this.memory.heapValueHandle(Y)}decodeBinaryJSON(W){let Y=this.ffi.QTS_bjson_decode(this.ctx.value,W.value);return this.memory.heapValueHandle(Y)}success(W){return w.success(W)}fail(W){return w.fail(W,(Y)=>this.unwrapResult(Y))}},JW=class extends q{constructor(W){super();this.scope=new z,this.contextMap=new Map,this.hostRefs=new BW,this._debugMode=!1,this.cToHostCallbacks={freeHostRef:(Y,Z)=>{if(Y!==this.rt.value)throw Error("Runtime pointer mismatch");this.hostRefs.delete(Z)},shouldInterrupt:(Y)=>{if(Y!==this.rt.value)throw Error("QuickJSContext instance received C -> JS interrupt with mismatched rt");let Z=this.interruptHandler;if(!Z)throw Error("QuickJSContext had no interrupt handler");return Z(this)?1:0},loadModuleSource:v(this,function*(Y,Z,$,X){let j=this.moduleLoader;if(!j)throw Error("Runtime has no module loader");if(Z!==this.rt.value)throw Error("Runtime pointer mismatch");let G=this.contextMap.get($)??this.newContext({contextPointer:$});try{let K=yield*Y(j(X,G));if(typeof K=="object"&&"error"in K&&K.error)throw this.debugLog("cToHostLoadModule: loader returned error",K.error),K.error;let V=typeof K=="string"?K:("value"in K)?K.value:K;return this.memory.newHeapCharPointer(V).value.ptr}catch(K){return this.debugLog("cToHostLoadModule: caught error",K),G.throw(K),0}}),normalizeModule:v(this,function*(Y,Z,$,X,j){let G=this.moduleNormalizer;if(!G)throw Error("Runtime has no module normalizer");if(Z!==this.rt.value)throw Error("Runtime pointer mismatch");let K=this.contextMap.get($)??this.newContext({contextPointer:$});try{let V=yield*Y(G(X,j,K));if(typeof V=="object"&&"error"in V&&V.error)throw this.debugLog("cToHostNormalizeModule: normalizer returned error",V.error),V.error;let B=typeof V=="string"?V:V.value;return K.getMemory(this.rt.value).newHeapCharPointer(B).value.ptr}catch(V){return this.debugLog("normalizeModule: caught error",V),K.throw(V),0}})},W.ownedLifetimes?.forEach((Y)=>this.scope.manage(Y)),this.module=W.module,this.memory=new t(this.module),this.ffi=W.ffi,this.rt=W.rt,this.callbacks=W.callbacks,this.scope.manage(this.rt),this.callbacks.setRuntimeCallbacks(this.rt.value,this.cToHostCallbacks),this.executePendingJobs=this.executePendingJobs.bind(this),x&&this.setDebugMode(!0)}get alive(){return this.scope.alive}dispose(){return this.scope.dispose()}newContext(W={}){let Y=TW(W.intrinsics),Z=new Q(W.contextPointer||this.ffi.QTS_NewContext(this.rt.value,Y),void 0,(X)=>{this.contextMap.delete(X),this.callbacks.deleteContext(X),this.ffi.QTS_FreeContext(X)}),$=new UW({module:this.module,ctx:Z,ffi:this.ffi,rt:this.rt,ownedLifetimes:W.ownedLifetimes,runtime:this,callbacks:this.callbacks});return this.contextMap.set(Z.value,$),$}setModuleLoader(W,Y){this.moduleLoader=W,this.moduleNormalizer=Y,this.ffi.QTS_RuntimeEnableModuleLoader(this.rt.value,this.moduleNormalizer?1:0)}removeModuleLoader(){this.moduleLoader=void 0,this.ffi.QTS_RuntimeDisableModuleLoader(this.rt.value)}hasPendingJob(){return!!this.ffi.QTS_IsJobPending(this.rt.value)}setInterruptHandler(W){let Y=this.interruptHandler;this.interruptHandler=W,Y||this.ffi.QTS_RuntimeEnableInterruptHandler(this.rt.value)}removeInterruptHandler(){this.interruptHandler&&(this.ffi.QTS_RuntimeDisableInterruptHandler(this.rt.value),this.interruptHandler=void 0)}executePendingJobs(W=-1){let Y=this.memory.newMutablePointerArray(1),Z=this.ffi.QTS_ExecutePendingJob(this.rt.value,W??-1,Y.value.ptr),$=Y.value.typedArray[0];if(Y.dispose(),$===0)return this.ffi.QTS_FreeValuePointerRuntime(this.rt.value,Z),w.success(0);let X=this.contextMap.get($)??this.newContext({contextPointer:$}),j=X.getMemory(this.rt.value).heapValueHandle(Z);if(X.typeof(j)==="number"){let G=X.getNumber(j);return j.dispose(),w.success(G)}else{let G=Object.assign(j,{context:X});return w.fail(G,(K)=>X.unwrapResult(K))}}setMemoryLimit(W){if(W<0&&W!==-1)throw Error("Cannot set memory limit to negative number. To unset, pass -1");this.ffi.QTS_RuntimeSetMemoryLimit(this.rt.value,W)}computeMemoryUsage(){let W=this.getSystemContext().getMemory(this.rt.value);return W.heapValueHandle(this.ffi.QTS_RuntimeComputeMemoryUsage(this.rt.value,W.ctx.value))}dumpMemoryUsage(){return this.memory.consumeHeapCharPointer(this.ffi.QTS_RuntimeDumpMemoryUsage(this.rt.value))}setMaxStackSize(W){if(W<0)throw Error("Cannot set memory limit to negative number. To unset, pass 0.");this.ffi.QTS_RuntimeSetMaxStackSize(this.rt.value,W)}assertOwned(W){if(W.owner&&W.owner.rt!==this.rt)throw new u(`Handle is not owned by this runtime: ${W.owner.rt.value} != ${this.rt.value}`)}setDebugMode(W){this._debugMode=W,this.ffi.DEBUG&&this.rt.alive&&this.ffi.QTS_SetDebugLogEnabled(this.rt.value,W?1:0)}isDebugMode(){return this._debugMode}debugLog(...W){this._debugMode&&console.log("quickjs-emscripten:",...W)}[Symbol.for("nodejs.util.inspect.custom")](){return this.alive?`${this.constructor.name} { rt: ${this.rt.value} }`:`${this.constructor.name} { disposed }`}getSystemContext(){return this.context||(this.context=this.scope.manage(this.newContext())),this.context}},DW=class{constructor(W){this.freeHostRef=W.freeHostRef,this.callFunction=W.callFunction,this.shouldInterrupt=W.shouldInterrupt,this.loadModuleSource=W.loadModuleSource,this.normalizeModule=W.normalizeModule}},wW=class{constructor(W){this.contextCallbacks=new Map,this.runtimeCallbacks=new Map,this.suspendedCount=0,this.cToHostCallbacks=new DW({freeHostRef:(Y,Z,$)=>{let X=this.runtimeCallbacks.get(Z);if(!X)throw Error(`QuickJSRuntime(rt = ${Z}) not found when trying to free HostRef(id = ${$})`);X.freeHostRef(Z,$)},callFunction:(Y,Z,$,X,j,G)=>this.handleAsyncify(Y,()=>{try{let K=this.contextCallbacks.get(Z);if(!K)throw Error(`QuickJSContext(ctx = ${Z}) not found for C function call "${G}"`);return K.callFunction(Z,$,X,j,G)}catch(K){return console.error("[C to host error: returning null]",K),0}}),shouldInterrupt:(Y,Z)=>this.handleAsyncify(Y,()=>{try{let $=this.runtimeCallbacks.get(Z);if(!$)throw Error(`QuickJSRuntime(rt = ${Z}) not found for C interrupt`);return $.shouldInterrupt(Z)}catch($){return console.error("[C to host interrupt: returning error]",$),1}}),loadModuleSource:(Y,Z,$,X)=>this.handleAsyncify(Y,()=>{try{let j=this.runtimeCallbacks.get(Z);if(!j)throw Error(`QuickJSRuntime(rt = ${Z}) not found for C module loader`);let G=j.loadModuleSource;if(!G)throw Error(`QuickJSRuntime(rt = ${Z}) does not support module loading`);return G(Z,$,X)}catch(j){return console.error("[C to host module loader error: returning null]",j),0}}),normalizeModule:(Y,Z,$,X,j)=>this.handleAsyncify(Y,()=>{try{let G=this.runtimeCallbacks.get(Z);if(!G)throw Error(`QuickJSRuntime(rt = ${Z}) not found for C module loader`);let K=G.normalizeModule;if(!K)throw Error(`QuickJSRuntime(rt = ${Z}) does not support module loading`);return K(Z,$,X,j)}catch(G){return console.error("[C to host module loader error: returning null]",G),0}})}),this.module=W,this.module.callbacks=this.cToHostCallbacks}setRuntimeCallbacks(W,Y){this.runtimeCallbacks.set(W,Y)}deleteRuntime(W){this.runtimeCallbacks.delete(W)}setContextCallbacks(W,Y){this.contextCallbacks.set(W,Y)}deleteContext(W){this.contextCallbacks.delete(W)}handleAsyncify(W,Y){if(W)return W.handleSleep(($)=>{try{let X=Y();if(!(X instanceof Promise)){N("asyncify.handleSleep: not suspending:",X),$(X);return}if(this.suspended)throw new d(`Already suspended at: ${this.suspended.stack}
7
7
  Attempted to suspend at:`);this.suspended=new i(`(${this.suspendedCount++})`),N("asyncify.handleSleep: suspending:",this.suspended),X.then((j)=>{this.suspended=void 0,N("asyncify.handleSleep: resolved:",j),$(j)},(j)=>{N("asyncify.handleSleep: rejected:",j),console.error("QuickJS: cannot handle error in suspended function",j),this.suspended=void 0})}catch(X){throw N("asyncify.handleSleep: error:",X),this.suspended=void 0,X}});let Z=Y();if(Z instanceof Promise)throw Error("Promise return value not supported in non-asyncify context.");return Z}};function MW(W,Y){Y.interruptHandler&&W.setInterruptHandler(Y.interruptHandler),Y.maxStackSizeBytes!==void 0&&W.setMaxStackSize(Y.maxStackSizeBytes),Y.memoryLimitBytes!==void 0&&W.setMemoryLimit(Y.memoryLimitBytes)}function RW(W,Y){Y.moduleLoader&&W.setModuleLoader(Y.moduleLoader),Y.shouldInterrupt&&W.setInterruptHandler(Y.shouldInterrupt),Y.memoryLimitBytes!==void 0&&W.setMemoryLimit(Y.memoryLimitBytes),Y.maxStackSizeBytes!==void 0&&W.setMaxStackSize(Y.maxStackSizeBytes)}var EW=class{constructor(W,Y){this.module=W,this.ffi=Y,this.callbacks=new wW(W)}newRuntime(W={}){let Y=new Q(this.ffi.QTS_NewRuntime(),void 0,($)=>{this.ffi.QTS_FreeRuntime($),this.callbacks.deleteRuntime($)}),Z=new JW({module:this.module,callbacks:this.callbacks,ffi:this.ffi,rt:Y});return MW(Z,W),W.moduleLoader&&Z.setModuleLoader(W.moduleLoader),Z}newContext(W={}){let Y=this.newRuntime(),Z=Y.newContext({...W,ownedLifetimes:qW(Y,W.ownedLifetimes)});return Y.context=Z,Z}evalCode(W,Y={}){return z.withScope((Z)=>{let $=Z.manage(this.newContext());RW($.runtime,Y);let X=$.evalCode(W,"eval.js");if(Y.memoryLimitBytes!==void 0&&$.runtime.setMemoryLimit(-1),X.error)throw $.dump(Z.manage(X.error));return $.dump(Z.manage(X.value))})}getWasmMemory(){let W=this.module.quickjsEmscriptenInit?.(()=>{})?.getWasmMemory?.();if(!W)throw Error("Variant does not support getting WebAssembly.Memory");return W}getFFI(){return this.ffi}};
8
- export{p as Ah,Q as Bh,z as Ch,TW as Dh,QW as Eh,UW as Fh,JW as Gh,wW as Hh,MW as Ih,RW as Jh,EW as Kh};
8
+ export{p as Bh,Q as Ch,z as Dh,TW as Eh,QW as Fh,UW as Gh,JW as Hh,wW as Ih,MW as Jh,RW as Kh,EW as Lh};