@qitqode/qitqode-android-arm64 0.1.25 → 0.1.27

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 (420) hide show
  1. package/bundle/chunk-02y04bsz.js +2 -0
  2. package/bundle/{chunk-23f6rc7a.js → chunk-04tw0r4s.js} +1 -1
  3. package/bundle/chunk-07ws99b1.js +2 -0
  4. package/bundle/chunk-09c4ngag.js +2 -0
  5. package/bundle/{chunk-ym4ydwrz.js → chunk-09kba1hg.js} +2 -2
  6. package/bundle/{chunk-pfn1db1m.js → chunk-0a0vat1h.js} +2 -2
  7. package/bundle/{chunk-pepn5jp4.js → chunk-0eqwm9a8.js} +2 -2
  8. package/bundle/chunk-0jgst767.js +2 -0
  9. package/bundle/chunk-0psrr9vp.js +2 -0
  10. package/bundle/chunk-0srrmwqs.js +2 -0
  11. package/bundle/{chunk-3xna2rk5.js → chunk-0x3sbyny.js} +2 -2
  12. package/bundle/chunk-0zkejr6k.js +2 -0
  13. package/bundle/{chunk-xw283h2r.js → chunk-12bssxd4.js} +2 -2
  14. package/bundle/chunk-14n6rvh2.js +2 -0
  15. package/bundle/{chunk-meaybtcc.js → chunk-17psxhve.js} +3 -3
  16. package/bundle/{chunk-jgs6ngte.js → chunk-1bhvt33f.js} +1 -1
  17. package/bundle/{chunk-78h5dd4t.js → chunk-1dwcga8g.js} +2 -2
  18. package/bundle/{chunk-5mdsrv0a.js → chunk-1fbeendk.js} +1 -1
  19. package/bundle/chunk-1fja3j80.js +2 -0
  20. package/bundle/chunk-1j73cnvz.js +2 -0
  21. package/bundle/{chunk-fgw420gb.js → chunk-1qshjfzm.js} +1 -1
  22. package/bundle/{chunk-bpnpxdyv.js → chunk-1rp1cvmc.js} +2 -2
  23. package/bundle/{chunk-b50t4jc5.js → chunk-1sgby720.js} +1 -1
  24. package/bundle/{chunk-3tnek022.js → chunk-1t9jne14.js} +1 -1
  25. package/bundle/chunk-1yddn03z.js +2 -0
  26. package/bundle/{chunk-3fy57jcy.js → chunk-26nfphsg.js} +1 -1
  27. package/bundle/{chunk-754varfr.js → chunk-27yxgy03.js} +2 -2
  28. package/bundle/{chunk-ydsen7w0.js → chunk-2ahqhh4z.js} +1 -1
  29. package/bundle/{chunk-ey4ktbyb.js → chunk-2bn4b42t.js} +1 -1
  30. package/bundle/{chunk-0hsb4knd.js → chunk-2dzk5txw.js} +1 -1
  31. package/bundle/{chunk-vq6bh2z9.js → chunk-2jmxt3fb.js} +1 -1
  32. package/bundle/{chunk-xjrt0dta.js → chunk-2km50rd3.js} +1 -1
  33. package/bundle/{chunk-1e8mja6v.js → chunk-2q96x1t5.js} +1 -1
  34. package/bundle/{chunk-7rjf9b8n.js → chunk-2rs39vj2.js} +2 -2
  35. package/bundle/{chunk-5zw7knvd.js → chunk-2tnarng3.js} +1 -1
  36. package/bundle/{chunk-4wgb80jm.js → chunk-2vepzgek.js} +2 -2
  37. package/bundle/{chunk-4pssh5d3.js → chunk-2wcv3sq5.js} +2 -2
  38. package/bundle/{chunk-6rrmjrm2.js → chunk-371r2111.js} +1 -1
  39. package/bundle/{chunk-kb14wxcs.js → chunk-37n34pzd.js} +2 -2
  40. package/bundle/chunk-38g8yzw0.js +2 -0
  41. package/bundle/chunk-3bkd0ar3.js +2 -0
  42. package/bundle/{chunk-c27rpvdz.js → chunk-3bmzjznz.js} +1 -1
  43. package/bundle/chunk-3c7d3dqt.js +3 -0
  44. package/bundle/{chunk-xy4t5qf8.js → chunk-3nwve06r.js} +1 -1
  45. package/bundle/{chunk-veev25yg.js → chunk-3nyqh1d6.js} +1 -1
  46. package/bundle/{chunk-grkkzrg1.js → chunk-463f9wre.js} +2 -2
  47. package/bundle/{chunk-vqq5vmh1.js → chunk-47b084yv.js} +204 -202
  48. package/bundle/{chunk-6s2f5sv4.js → chunk-48fvrggx.js} +1 -1
  49. package/bundle/chunk-4amgp4yd.js +3 -0
  50. package/bundle/chunk-4k7kbhps.js +2 -0
  51. package/bundle/{chunk-e075v4e9.js → chunk-4qqkqrn9.js} +2 -2
  52. package/bundle/chunk-4sz3jbc5.js +2 -0
  53. package/bundle/{chunk-zny2qaqa.js → chunk-4tbwha3m.js} +2 -2
  54. package/bundle/{chunk-dgggvses.js → chunk-4ypcf4tg.js} +1 -1
  55. package/bundle/chunk-4z4p492c.js +3 -0
  56. package/bundle/chunk-55b9699f.js +2 -0
  57. package/bundle/{chunk-1ce5jpdc.js → chunk-5a5t01ka.js} +1 -1
  58. package/bundle/{chunk-1n1dh6zj.js → chunk-5fgx6fa4.js} +1 -1
  59. package/bundle/{chunk-2k2axg73.js → chunk-5fz8tph5.js} +1 -1
  60. package/bundle/{chunk-99p5m2f1.js → chunk-5qam3c8r.js} +1 -1
  61. package/bundle/{chunk-0jaxgrq0.js → chunk-61c62e5s.js} +2 -2
  62. package/bundle/chunk-6d9wsjxm.js +2 -0
  63. package/bundle/{chunk-mybpgrjj.js → chunk-6fp8a9ek.js} +2 -2
  64. package/bundle/chunk-6gz9cthq.js +2 -0
  65. package/bundle/{chunk-692vn48b.js → chunk-6hv59ere.js} +1 -1
  66. package/bundle/{chunk-av290sja.js → chunk-6nbzdb0r.js} +1 -1
  67. package/bundle/{chunk-8ahpk8td.js → chunk-6p7yg5sr.js} +1 -1
  68. package/bundle/chunk-6q87abbr.js +2 -0
  69. package/bundle/{chunk-3nhth7c2.js → chunk-6qy1ghrx.js} +1 -1
  70. package/bundle/chunk-730a2d1k.js +2 -0
  71. package/bundle/chunk-7bd0x9vf.js +2 -0
  72. package/bundle/chunk-7czkntef.js +2 -0
  73. package/bundle/chunk-7ex57nyh.js +2 -0
  74. package/bundle/chunk-7gpczxbh.js +2 -0
  75. package/bundle/chunk-7j0bgeh2.js +2 -0
  76. package/bundle/{chunk-hvpe07pt.js → chunk-7jbz3dgt.js} +1 -1
  77. package/bundle/{chunk-qe0sfafy.js → chunk-7ppd2phw.js} +2 -2
  78. package/bundle/chunk-7py443fe.js +2 -0
  79. package/bundle/{chunk-8jcx4tep.js → chunk-7yrhe3xq.js} +2 -2
  80. package/bundle/{chunk-8za87zkr.js → chunk-89q1y7tc.js} +1 -1
  81. package/bundle/{chunk-vfj5nwab.js → chunk-89v6dgpp.js} +2 -2
  82. package/bundle/chunk-8cdm8gh2.js +2 -0
  83. package/bundle/chunk-90q5sae0.js +2 -0
  84. package/bundle/chunk-90zd5rss.js +5 -0
  85. package/bundle/chunk-9grvepmd.js +2 -0
  86. package/bundle/chunk-9hrh15p2.js +2 -0
  87. package/bundle/{chunk-xqa6qkx2.js → chunk-9j1qqdr2.js} +1 -1
  88. package/bundle/{chunk-p80dc6kt.js → chunk-9t84mh6t.js} +2 -2
  89. package/bundle/{chunk-9dpn4792.js → chunk-a1p2f16h.js} +2 -2
  90. package/bundle/{chunk-c1ypbbka.js → chunk-a1pw9r6f.js} +2 -2
  91. package/bundle/chunk-a2qz9m10.js +2 -0
  92. package/bundle/{chunk-gvtw9c44.js → chunk-ab6cabxh.js} +1 -1
  93. package/bundle/{chunk-rjcptzem.js → chunk-ad46r434.js} +2 -2
  94. package/bundle/{chunk-9r6bvkp4.js → chunk-ak5ngp50.js} +2 -2
  95. package/bundle/{chunk-xyn3xxfs.js → chunk-apbgb4h0.js} +1 -1
  96. package/bundle/chunk-av6ezvxm.js +2 -0
  97. package/bundle/{chunk-0rmmg3g4.js → chunk-aztre27e.js} +1 -1
  98. package/bundle/{chunk-ddxjc803.js → chunk-b0syck9r.js} +2 -2
  99. package/bundle/{chunk-8gy99gfb.js → chunk-b2z0kjss.js} +2 -2
  100. package/bundle/{chunk-wrgg270f.js → chunk-b3dqcbsc.js} +1 -1
  101. package/bundle/{chunk-aw0q4y3s.js → chunk-b75gpv0q.js} +1 -1
  102. package/bundle/chunk-b7mg883n.js +3 -0
  103. package/bundle/{chunk-zh808d4t.js → chunk-b8tw709r.js} +1 -1
  104. package/bundle/{chunk-pvee151a.js → chunk-b9za12y1.js} +1 -1
  105. package/bundle/{chunk-cjxp72dv.js → chunk-baet4zev.js} +2 -2
  106. package/bundle/{chunk-jhq5bvhs.js → chunk-be216spx.js} +2 -2
  107. package/bundle/chunk-beksar7w.js +2 -0
  108. package/bundle/chunk-bg66rqrx.js +2 -0
  109. package/bundle/{chunk-h19ty95q.js → chunk-brpx707p.js} +1 -1
  110. package/bundle/{chunk-ykfq8bem.js → chunk-bss414qz.js} +1 -1
  111. package/bundle/{chunk-3dvyfmgc.js → chunk-btneef3z.js} +1 -1
  112. package/bundle/{chunk-7v4fzkbb.js → chunk-btz9jvec.js} +1 -1
  113. package/bundle/{chunk-bsqcfqya.js → chunk-bvkq0a5q.js} +1 -1
  114. package/bundle/{chunk-mkdyknbz.js → chunk-c01z3cvg.js} +2 -2
  115. package/bundle/{chunk-dd11kryy.js → chunk-c0796v8j.js} +2 -2
  116. package/bundle/{chunk-qpm5afdz.js → chunk-c5e6sk9c.js} +1 -1
  117. package/bundle/chunk-c7yy1km8.js +2 -0
  118. package/bundle/{chunk-453wpzg6.js → chunk-c8k32724.js} +1 -1
  119. package/bundle/{chunk-mbh1pdv9.js → chunk-cafzcmrg.js} +2 -2
  120. package/bundle/{chunk-d1bsxz2t.js → chunk-cdhmc0t0.js} +1 -1
  121. package/bundle/{chunk-t0amhhsk.js → chunk-chmrvbbj.js} +1 -1
  122. package/bundle/{chunk-jqzejny3.js → chunk-cpmmvwgw.js} +1 -1
  123. package/bundle/{chunk-zbdbsagd.js → chunk-crx18k6g.js} +2 -2
  124. package/bundle/{chunk-ybn8tb09.js → chunk-ct48575c.js} +1 -1
  125. package/bundle/chunk-ct6dv8st.js +2 -0
  126. package/bundle/{chunk-4wyjapes.js → chunk-cvdxgsq1.js} +2 -2
  127. package/bundle/{chunk-qdnxv55k.js → chunk-cvwa142e.js} +1 -1
  128. package/bundle/chunk-cy9s1ma5.js +2 -0
  129. package/bundle/{chunk-qnqqrvvs.js → chunk-d5bxan80.js} +2 -2
  130. package/bundle/{chunk-hmfefq0d.js → chunk-d6r4xwtg.js} +4 -4
  131. package/bundle/{chunk-g3s2z5xa.js → chunk-deae0y1j.js} +1 -1
  132. package/bundle/{chunk-a27yjp71.js → chunk-dfnv7vkn.js} +1 -1
  133. package/bundle/{chunk-4kb2efq3.js → chunk-dhjp0zx2.js} +1 -1
  134. package/bundle/{chunk-se79ke63.js → chunk-dq9kpj4a.js} +2 -2
  135. package/bundle/{chunk-zss93r48.js → chunk-dqed63ek.js} +1 -1
  136. package/bundle/{chunk-nqefvn28.js → chunk-drs1gv2b.js} +1 -1
  137. package/bundle/{chunk-t2tsyazc.js → chunk-ds69qc8b.js} +1 -1
  138. package/bundle/chunk-dtv1vp0d.js +2 -0
  139. package/bundle/chunk-dvk2wwjj.js +2 -0
  140. package/bundle/{chunk-d5b0bqbr.js → chunk-dzxzcb2e.js} +1 -1
  141. package/bundle/chunk-e0jy9qxd.js +2 -0
  142. package/bundle/{chunk-nhx2xp2x.js → chunk-eb9mytjq.js} +1 -1
  143. package/bundle/{chunk-gsz1wqy6.js → chunk-ecn8gbtz.js} +1 -1
  144. package/bundle/chunk-erg0ske8.js +2 -0
  145. package/bundle/chunk-ew51rwdp.js +9 -0
  146. package/bundle/{chunk-2rxt1s22.js → chunk-exh6cg1r.js} +2 -2
  147. package/bundle/{chunk-tdmaxc6n.js → chunk-f45tp3e3.js} +1 -1
  148. package/bundle/chunk-f72pppr7.js +2 -0
  149. package/bundle/{chunk-k8bp3jjv.js → chunk-fddsgvjy.js} +1 -1
  150. package/bundle/{chunk-4w5t515p.js → chunk-fff3151r.js} +1 -1
  151. package/bundle/{chunk-pk0tytcm.js → chunk-fkgv2hqd.js} +1 -1
  152. package/bundle/{chunk-f84cd0a1.js → chunk-fnbpap62.js} +2 -2
  153. package/bundle/{chunk-hwbxehhf.js → chunk-g1dwbvkg.js} +1 -1
  154. package/bundle/{chunk-dk3z4k46.js → chunk-g3dhsmbt.js} +3 -3
  155. package/bundle/{chunk-n8dcmjph.js → chunk-g7rjtehn.js} +1 -1
  156. package/bundle/chunk-gbyy8sh5.js +2 -0
  157. package/bundle/{chunk-z015twaq.js → chunk-gf0pdgjs.js} +2 -2
  158. package/bundle/{chunk-9f6pqped.js → chunk-ggqst87g.js} +1 -1
  159. package/bundle/chunk-gk34kh8p.js +2 -0
  160. package/bundle/{chunk-j5b5h08g.js → chunk-gm85xefs.js} +1 -1
  161. package/bundle/chunk-gn50xqbd.js +2 -0
  162. package/bundle/{chunk-wmrq9qqf.js → chunk-gsez13bg.js} +1 -1
  163. package/bundle/{chunk-3f054f69.js → chunk-gsvdt4kq.js} +7 -7
  164. package/bundle/{chunk-3jhx8g5d.js → chunk-h0rpmne5.js} +1 -1
  165. package/bundle/chunk-h7s2w1e2.js +2 -0
  166. package/bundle/chunk-h7yya9pv.js +7610 -0
  167. package/bundle/{chunk-5mp82az0.js → chunk-h9pvnp5c.js} +1 -1
  168. package/bundle/chunk-hgxdg1y5.js +2 -0
  169. package/bundle/{chunk-t07a5431.js → chunk-hj5y7fvk.js} +1 -1
  170. package/bundle/chunk-hmv2cdnz.js +2 -0
  171. package/bundle/chunk-ht81ensf.js +2 -0
  172. package/bundle/chunk-j59ktwny.js +2 -0
  173. package/bundle/{chunk-08ba67f4.js → chunk-j5kb0y1m.js} +1 -1
  174. package/bundle/{chunk-rgecc41f.js → chunk-j5y10dn6.js} +2 -2
  175. package/bundle/{chunk-jv98gw88.js → chunk-j6emx6jn.js} +2 -2
  176. package/bundle/{chunk-x36jhtex.js → chunk-j8efst22.js} +1 -1
  177. package/bundle/{chunk-mczw8e3s.js → chunk-j94bdaav.js} +2 -2
  178. package/bundle/{chunk-g73drh98.js → chunk-j9pcnkkq.js} +3 -3
  179. package/bundle/{chunk-nf8gkxbk.js → chunk-jg7s9rqz.js} +2 -2
  180. package/bundle/chunk-jh3nw7fd.js +2 -0
  181. package/bundle/chunk-jh6yvzee.js +2 -0
  182. package/bundle/{chunk-9jncnqbj.js → chunk-jje0srjq.js} +2 -2
  183. package/bundle/{chunk-3e8p4a3y.js → chunk-jm1ptn8n.js} +1 -1
  184. package/bundle/chunk-jmz2mq3t.js +2 -0
  185. package/bundle/{chunk-6ddp36ar.js → chunk-jnabd9gn.js} +1 -1
  186. package/bundle/chunk-k309zez0.js +3 -0
  187. package/bundle/chunk-k3fn3yed.js +2 -0
  188. package/bundle/{chunk-0x7dbj5e.js → chunk-k7gq9bra.js} +1 -1
  189. package/bundle/{chunk-8cty50g7.js → chunk-k9b1jcqw.js} +1 -1
  190. package/bundle/{chunk-2s28fdbp.js → chunk-kavhpdvb.js} +1 -1
  191. package/bundle/{chunk-qm9ezq93.js → chunk-kdcnder5.js} +1 -1
  192. package/bundle/{chunk-b2xya6pq.js → chunk-kfsb2stm.js} +1 -1
  193. package/bundle/{chunk-z3zx6g09.js → chunk-knpt9n8f.js} +1 -1
  194. package/bundle/chunk-kpw6nghv.js +2 -0
  195. package/bundle/{chunk-4stgw33j.js → chunk-kqn9h2gk.js} +1 -1
  196. package/bundle/{chunk-gw0j8hr9.js → chunk-ksyh6h3a.js} +2 -2
  197. package/bundle/{chunk-jtrcnpm7.js → chunk-m02zt1a3.js} +2 -2
  198. package/bundle/{chunk-p883sz67.js → chunk-m1h5a4vg.js} +1 -1
  199. package/bundle/{chunk-m2ang7yb.js → chunk-m2ekhbdp.js} +1 -1
  200. package/bundle/{chunk-3j7skhxg.js → chunk-m2x9xhha.js} +2 -2
  201. package/bundle/chunk-m5ghbt5y.js +2 -0
  202. package/bundle/{chunk-9va5eh9s.js → chunk-m612agnk.js} +1 -1
  203. package/bundle/{chunk-42t25nkb.js → chunk-m67tcnk4.js} +1 -1
  204. package/bundle/{chunk-2sy1wx99.js → chunk-m8yv4sd2.js} +1 -1
  205. package/bundle/{chunk-x6b99nt3.js → chunk-mdck9s88.js} +1 -1
  206. package/bundle/{chunk-psveqqv2.js → chunk-mgk9sh16.js} +1 -1
  207. package/bundle/{chunk-7d6jhzng.js → chunk-mk6cddvd.js} +1 -1
  208. package/bundle/chunk-mn41f9qv.js +2 -0
  209. package/bundle/chunk-mqjf9sbm.js +2 -0
  210. package/bundle/{chunk-7ws3gdjq.js → chunk-msegx0t7.js} +1 -1
  211. package/bundle/{chunk-evmfntm3.js → chunk-mskwkcgj.js} +1 -1
  212. package/bundle/chunk-n5gwrrbb.js +2 -0
  213. package/bundle/{chunk-dee1a3yk.js → chunk-n8h6x2en.js} +2 -2
  214. package/bundle/chunk-nfjhem1c.js +2 -0
  215. package/bundle/{chunk-hznsed5n.js → chunk-ngchsw2g.js} +2 -2
  216. package/bundle/chunk-nj4d554m.js +11 -0
  217. package/bundle/{chunk-msm3r7ny.js → chunk-njnwdgvd.js} +2 -2
  218. package/bundle/{chunk-pf7cj4jd.js → chunk-nt4e3em9.js} +1 -1
  219. package/bundle/chunk-nx90tvwg.js +2 -0
  220. package/bundle/{chunk-bqs6a1ts.js → chunk-nxbkh4k9.js} +2 -2
  221. package/bundle/chunk-nxyyn2ra.js +2 -0
  222. package/bundle/{chunk-vb4e7y4d.js → chunk-nzehfpxp.js} +1 -1
  223. package/bundle/chunk-p5tceb4k.js +2 -0
  224. package/bundle/{chunk-wb69d52j.js → chunk-p68rwmhc.js} +2 -2
  225. package/bundle/{chunk-nmnsf3fc.js → chunk-pekm54ce.js} +1 -1
  226. package/bundle/{chunk-syhay5ye.js → chunk-pget15wc.js} +1 -1
  227. package/bundle/{chunk-p409grvp.js → chunk-phxrg7aw.js} +2 -2
  228. package/bundle/{chunk-14qvaxtp.js → chunk-ppfjf7qx.js} +1 -1
  229. package/bundle/{chunk-mr7agwgn.js → chunk-q1v2pytx.js} +1 -1
  230. package/bundle/{chunk-kyny0t2g.js → chunk-q6ztpfcs.js} +2 -2
  231. package/bundle/{chunk-xdde80rf.js → chunk-qhc90p4a.js} +2 -2
  232. package/bundle/chunk-qjgm3e2p.js +2 -0
  233. package/bundle/{chunk-7fx6x8x9.js → chunk-qjjch1zt.js} +2 -2
  234. package/bundle/{chunk-h2fh1g8g.js → chunk-qjn86fc0.js} +1 -1
  235. package/bundle/{chunk-yhqk8bzk.js → chunk-qrey2gwb.js} +2 -2
  236. package/bundle/chunk-qt1wffbh.js +3 -0
  237. package/bundle/{chunk-jvaffe5d.js → chunk-qt2c4bty.js} +1 -1
  238. package/bundle/{chunk-kgsq240v.js → chunk-qv2s39dv.js} +2 -2
  239. package/bundle/chunk-r08957sm.js +11 -0
  240. package/bundle/chunk-r1616dce.js +2 -0
  241. package/bundle/chunk-s07j8hfy.js +2 -0
  242. package/bundle/{chunk-sx5m81em.js → chunk-s3yna2wm.js} +1 -1
  243. package/bundle/{chunk-0vqrakhw.js → chunk-s6bar2f9.js} +1 -1
  244. package/bundle/chunk-sbyey0qb.js +2 -0
  245. package/bundle/{chunk-aqm597px.js → chunk-scnz207s.js} +2 -2
  246. package/bundle/{chunk-rjf21v5c.js → chunk-sermjas1.js} +1 -1
  247. package/bundle/chunk-sj5v361q.js +2 -0
  248. package/bundle/chunk-smtvgr3w.js +2 -0
  249. package/bundle/{chunk-ag9thqkv.js → chunk-snm5q21k.js} +2 -2
  250. package/bundle/{chunk-bnc4626b.js → chunk-srh4xvsj.js} +1 -1
  251. package/bundle/{chunk-y0xt5a6g.js → chunk-stezw26z.js} +1 -1
  252. package/bundle/{chunk-rq4hqwjy.js → chunk-szr0f7k2.js} +1 -1
  253. package/bundle/{chunk-vmgknvxs.js → chunk-t12xrrfr.js} +2 -2
  254. package/bundle/{chunk-6gbaw2pk.js → chunk-tj78jsp9.js} +1 -1
  255. package/bundle/chunk-tpndnprb.js +2 -0
  256. package/bundle/{chunk-yzchwmb4.js → chunk-tr8sf0dk.js} +1 -1
  257. package/bundle/{chunk-e1pwnf0b.js → chunk-v2zp22r3.js} +2 -2
  258. package/bundle/{chunk-2armxd20.js → chunk-v4xcysh0.js} +1 -1
  259. package/bundle/{chunk-amx3x4kd.js → chunk-v965rsr8.js} +2 -2
  260. package/bundle/{chunk-0304b7xg.js → chunk-va316nee.js} +1 -1
  261. package/bundle/chunk-vfdhqf4h.js +28 -0
  262. package/bundle/{chunk-gaen9ya4.js → chunk-vg2fmyje.js} +2 -2
  263. package/bundle/{chunk-kdcspxvq.js → chunk-vj62pc0h.js} +1 -1
  264. package/bundle/{chunk-3h08jdq8.js → chunk-vkskqhag.js} +2 -2
  265. package/bundle/{chunk-zsnbxsdx.js → chunk-vn7nkrqb.js} +2 -2
  266. package/bundle/{chunk-58680z2j.js → chunk-vsjyr170.js} +2 -2
  267. package/bundle/chunk-vwxfgea7.js +2 -0
  268. package/bundle/chunk-w0kgcz1t.js +2 -0
  269. package/bundle/{chunk-1txkz6dt.js → chunk-w87a3mzm.js} +1 -1
  270. package/bundle/chunk-wajmd3r7.js +2 -0
  271. package/bundle/{chunk-d0m7nbbx.js → chunk-whxjkz9a.js} +2 -2
  272. package/bundle/chunk-wksczmes.js +2 -0
  273. package/bundle/{chunk-0xmx2zfg.js → chunk-wnqwb6fd.js} +1 -1
  274. package/bundle/chunk-wrw22v0a.js +616 -0
  275. package/bundle/chunk-wsxta33r.js +2 -0
  276. package/bundle/{chunk-8atry88r.js → chunk-wsy0m70r.js} +1 -1
  277. package/bundle/{chunk-kdct3e8s.js → chunk-wy46mbwt.js} +1 -1
  278. package/bundle/{chunk-tf1me2r4.js → chunk-wz0zcddf.js} +3 -3
  279. package/bundle/{chunk-ggeena9t.js → chunk-x067eetw.js} +1 -1
  280. package/bundle/{chunk-eg7drzzt.js → chunk-xc5044tm.js} +1 -1
  281. package/bundle/chunk-xck0sq3k.js +2 -0
  282. package/bundle/chunk-xjyhtm8r.js +2 -0
  283. package/bundle/{chunk-j9s62g01.js → chunk-xn2ds2s4.js} +2 -2
  284. package/bundle/{chunk-qnv2v02g.js → chunk-xpc2zgj7.js} +2 -2
  285. package/bundle/{chunk-54pk7nna.js → chunk-xrxyrr00.js} +1 -1
  286. package/bundle/{chunk-f55txcsa.js → chunk-xs3xtz6x.js} +1 -1
  287. package/bundle/{chunk-crap29f6.js → chunk-xxbqhg9n.js} +1 -1
  288. package/bundle/{chunk-2je5tp0x.js → chunk-y062spw2.js} +1 -1
  289. package/bundle/{chunk-v4xgceeq.js → chunk-y2v09y71.js} +1 -1
  290. package/bundle/chunk-y9p87bfd.js +2 -0
  291. package/bundle/{chunk-g4qwkcdv.js → chunk-yajd975f.js} +1 -1
  292. package/bundle/{chunk-2z35ewwc.js → chunk-ydp0q1hk.js} +1 -1
  293. package/bundle/{chunk-gfmfrkxc.js → chunk-yfkvjphe.js} +1 -1
  294. package/bundle/chunk-ygc5qegv.js +2 -0
  295. package/bundle/{chunk-eaatrmcg.js → chunk-yhk7d1j0.js} +1 -1
  296. package/bundle/chunk-yhwx62yf.js +2 -0
  297. package/bundle/chunk-yjqmzm51.js +2 -0
  298. package/bundle/{chunk-9jvnc14g.js → chunk-yjtdgcq5.js} +1 -1
  299. package/bundle/{chunk-61ks7c71.js → chunk-yp0a8q29.js} +3 -3
  300. package/bundle/{chunk-mkyrg7gt.js → chunk-yq3m8190.js} +2 -2
  301. package/bundle/{chunk-rze20q68.js → chunk-yt3f3j35.js} +1 -1
  302. package/bundle/{chunk-tfggzzqw.js → chunk-ywkvq7zb.js} +1 -1
  303. package/bundle/chunk-z4z8hk7e.js +2 -0
  304. package/bundle/chunk-z7y9pdj7.js +2 -0
  305. package/bundle/chunk-z8g819cz.js +2 -0
  306. package/bundle/{chunk-h56jxxvj.js → chunk-z8v2tsz2.js} +1 -1
  307. package/bundle/{chunk-rs1mm5ef.js → chunk-zb0me4kk.js} +1 -1
  308. package/bundle/{chunk-gefh32jb.js → chunk-zcm2jdr5.js} +1 -1
  309. package/bundle/chunk-zqv7fx25.js +2 -0
  310. package/bundle/{chunk-jq81hb32.js → chunk-zrc54vc4.js} +2 -2
  311. package/bundle/chunk-zs2a1f20.js +2 -0
  312. package/bundle/chunk-zt1nbwmm.js +2 -0
  313. package/bundle/{chunk-2zj3h3xj.js → chunk-ztc3gm8y.js} +2 -2
  314. package/bundle/{chunk-v7ah9gg0.js → chunk-zxaaxb99.js} +2 -2
  315. package/bundle/{chunk-ww8ear80.js → chunk-zyhdxggp.js} +2 -2
  316. package/bundle/index.js +3 -3
  317. package/bundle/parser.worker.js +2 -2
  318. package/bundle/qffi.node +0 -0
  319. package/bundle/worker.js +1 -1
  320. package/package.json +1 -1
  321. package/bundle/chunk-0eneddjj.js +0 -2
  322. package/bundle/chunk-0ke6x10y.js +0 -5
  323. package/bundle/chunk-0yb4pxjv.js +0 -2
  324. package/bundle/chunk-129kq1w7.js +0 -2
  325. package/bundle/chunk-1a5hq7d5.js +0 -2
  326. package/bundle/chunk-1w3y1dkk.js +0 -2
  327. package/bundle/chunk-26qt44f1.js +0 -3
  328. package/bundle/chunk-2pkake0h.js +0 -2
  329. package/bundle/chunk-32188rww.js +0 -2
  330. package/bundle/chunk-334tc1rh.js +0 -2
  331. package/bundle/chunk-3ff94m8r.js +0 -2
  332. package/bundle/chunk-4aqd2bty.js +0 -2
  333. package/bundle/chunk-4wa0gf8y.js +0 -28
  334. package/bundle/chunk-4xg5ptk9.js +0 -2
  335. package/bundle/chunk-5nm36wxa.js +0 -2
  336. package/bundle/chunk-64jet8nc.js +0 -2
  337. package/bundle/chunk-6584d9m8.js +0 -2
  338. package/bundle/chunk-66hv9bbw.js +0 -2
  339. package/bundle/chunk-6a1g6jzn.js +0 -2
  340. package/bundle/chunk-6be8p915.js +0 -2
  341. package/bundle/chunk-6f03158n.js +0 -2
  342. package/bundle/chunk-7jnjttqx.js +0 -2
  343. package/bundle/chunk-7q5srx7q.js +0 -3
  344. package/bundle/chunk-7q8pa6s8.js +0 -2
  345. package/bundle/chunk-7qvkyjjg.js +0 -2
  346. package/bundle/chunk-7w84hfxs.js +0 -3
  347. package/bundle/chunk-87x607rz.js +0 -8223
  348. package/bundle/chunk-8casywce.js +0 -2
  349. package/bundle/chunk-8hxwxt5p.js +0 -2
  350. package/bundle/chunk-8y8140dm.js +0 -2
  351. package/bundle/chunk-9dqcyt6x.js +0 -2
  352. package/bundle/chunk-9he248a8.js +0 -2
  353. package/bundle/chunk-9qmmse2n.js +0 -2
  354. package/bundle/chunk-9w5rx0fb.js +0 -3
  355. package/bundle/chunk-aabrsxrq.js +0 -2
  356. package/bundle/chunk-atd0q4v8.js +0 -3
  357. package/bundle/chunk-avaba4sr.js +0 -2
  358. package/bundle/chunk-bdy1etja.js +0 -2
  359. package/bundle/chunk-bqdvqmjc.js +0 -2
  360. package/bundle/chunk-cdws8ggq.js +0 -2
  361. package/bundle/chunk-cqs9a2cs.js +0 -2
  362. package/bundle/chunk-d0rjst58.js +0 -2
  363. package/bundle/chunk-d833a2fj.js +0 -2
  364. package/bundle/chunk-dday4nm2.js +0 -2
  365. package/bundle/chunk-e2sj30hk.js +0 -2
  366. package/bundle/chunk-enc0fykg.js +0 -2
  367. package/bundle/chunk-evan93av.js +0 -2
  368. package/bundle/chunk-f600dzsr.js +0 -2
  369. package/bundle/chunk-f6jzwydk.js +0 -2
  370. package/bundle/chunk-fv67ng8z.js +0 -2
  371. package/bundle/chunk-gevazsx3.js +0 -2
  372. package/bundle/chunk-gh18pzkx.js +0 -2
  373. package/bundle/chunk-gnvvgr4y.js +0 -2
  374. package/bundle/chunk-gsbjs2ws.js +0 -2
  375. package/bundle/chunk-j7pdz979.js +0 -2
  376. package/bundle/chunk-jfe2qbv8.js +0 -2
  377. package/bundle/chunk-k6zvb8xm.js +0 -2
  378. package/bundle/chunk-kcht9kvx.js +0 -2
  379. package/bundle/chunk-knvsa1d4.js +0 -2
  380. package/bundle/chunk-kp6d68hd.js +0 -2
  381. package/bundle/chunk-kwm87f18.js +0 -2
  382. package/bundle/chunk-me78p9x4.js +0 -2
  383. package/bundle/chunk-mv1d7wyt.js +0 -2
  384. package/bundle/chunk-n8xmmxh5.js +0 -2
  385. package/bundle/chunk-n90219q9.js +0 -2
  386. package/bundle/chunk-nckg3ydx.js +0 -2
  387. package/bundle/chunk-nhaenjw3.js +0 -2
  388. package/bundle/chunk-nhtrt5ec.js +0 -2
  389. package/bundle/chunk-p72n0tfq.js +0 -2
  390. package/bundle/chunk-p8enedkf.js +0 -3
  391. package/bundle/chunk-pd33qvr0.js +0 -2
  392. package/bundle/chunk-pq3622ae.js +0 -2
  393. package/bundle/chunk-qatj4h6b.js +0 -2
  394. package/bundle/chunk-qfz0a58d.js +0 -2
  395. package/bundle/chunk-qjwfj51e.js +0 -2
  396. package/bundle/chunk-qkg73rs9.js +0 -2
  397. package/bundle/chunk-qvcfst7n.js +0 -11
  398. package/bundle/chunk-rmsqb6r4.js +0 -10
  399. package/bundle/chunk-rqrpbcm6.js +0 -2
  400. package/bundle/chunk-s76hdgw6.js +0 -2
  401. package/bundle/chunk-s7vhjg9e.js +0 -2
  402. package/bundle/chunk-sec3a60m.js +0 -2
  403. package/bundle/chunk-sjnt5e6w.js +0 -2
  404. package/bundle/chunk-sntb757q.js +0 -2
  405. package/bundle/chunk-svscftd7.js +0 -2
  406. package/bundle/chunk-sx0cabcs.js +0 -2
  407. package/bundle/chunk-tmdm6vm6.js +0 -2
  408. package/bundle/chunk-v6g0ksks.js +0 -2
  409. package/bundle/chunk-vbf73c7z.js +0 -2
  410. package/bundle/chunk-vbf9jpas.js +0 -2
  411. package/bundle/chunk-vrcf5q4s.js +0 -2
  412. package/bundle/chunk-vxrsp6n7.js +0 -2
  413. package/bundle/chunk-w8ax3pvh.js +0 -2
  414. package/bundle/chunk-w98r39gd.js +0 -9
  415. package/bundle/chunk-xk2cmh49.js +0 -2
  416. package/bundle/chunk-xzhkfctf.js +0 -2
  417. package/bundle/chunk-ydmrvx7q.js +0 -2
  418. package/bundle/chunk-z2rtcgad.js +0 -3
  419. package/bundle/chunk-z9b3t2jm.js +0 -2
  420. package/bundle/chunk-zzr8smtm.js +0 -2
@@ -1,10 +0,0 @@
1
- // @bun
2
- var J=Symbol.for("drizzle:entityKind");function D(X,Y){if(!X||typeof X!=="object")return!1;if(X instanceof Y)return!0;if(!Object.prototype.hasOwnProperty.call(Y,J))throw Error(`Class "${Y.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let Z=Object.getPrototypeOf(X)?.constructor;if(Z)while(Z){if(J in Z&&Z[J]===Y[J])return!0;Z=Object.getPrototypeOf(Z)}return!1}var T1=Symbol.for("drizzle:OriginalColumn");var N=class{static[J]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;length;isLengthExact;isAlias;config;table;onInit(){}constructor(X,Y){this.config=Y,this.onInit(),this.table=X,this.name=Y.name,this.isAlias=!1,this.keyAsName=Y.keyAsName,this.notNull=Y.notNull,this.default=Y.default,this.defaultFn=Y.defaultFn,this.onUpdateFn=Y.onUpdateFn,this.hasDefault=Y.hasDefault,this.primary=Y.primaryKey,this.isUnique=Y.isUnique,this.uniqueName=Y.uniqueName,this.uniqueType=Y.uniqueType,this.dataType=Y.dataType,this.columnType=Y.columnType,this.generated=Y.generated,this.generatedIdentity=Y.generatedIdentity,this.length=Y.length,this.isLengthExact=Y.isLengthExact}mapFromDriverValue(X){return X}mapToDriverValue(X){return X}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}[T1](){return this}};var r=Symbol.for("drizzle:Name");var G1=Symbol.for("drizzle:Schema"),n=Symbol.for("drizzle:Columns"),GY=Symbol.for("drizzle:ExtraConfigColumns"),U1=Symbol.for("drizzle:OriginalName"),QX=Symbol.for("drizzle:BaseName"),_1=Symbol.for("drizzle:IsAlias"),WY=Symbol.for("drizzle:ExtraConfigBuilder"),X0=Symbol.for("drizzle:IsDrizzleTable"),A=class{static[J]="Table";static Symbol={Name:r,Schema:G1,OriginalName:U1,Columns:n,ExtraConfigColumns:GY,BaseName:QX,IsAlias:_1,ExtraConfigBuilder:WY};[r];[U1];[G1];[n];[GY];[QX];[_1]=!1;[X0]=!0;[WY]=void 0;constructor(X,Y,Z){this[r]=this[U1]=X,this[G1]=Y,this[QX]=Z}};function z1(X){return X[r]}function A1(X){return`${X[G1]??"public"}.${X[r]}`}var T=class{static[J]="Subquery";constructor(X,Y,Z,$=!1,G=[]){this._={brand:"Subquery",sql:X,selectedFields:Y,alias:Z,isWith:$,usedTables:G}}},WX=class extends T{static[J]="WithSubquery"};function JY(X,...Y){return X(...Y)}var HY={startActiveSpan(X,Y){return Y()}};var Q=Symbol.for("drizzle:ViewBaseConfig");var Y0=class{static[J]="FakePrimitiveParam"};function E1(X){return X!==null&&X!==void 0&&typeof X.getSQL==="function"}function Z0(X){let Y={sql:"",params:[]};for(let Z of X)if(Y.sql+=Z.sql,Y.params.push(...Z.params),Z.typings?.length){if(!Y.typings)Y.typings=[];Y.typings.push(...Z.typings)}return Y}var h=class{static[J]="StringChunk";value;constructor(X){this.value=Array.isArray(X)?X:[X]}getSQL(){return new x([this])}},x=class X{static[J]="SQL";decoder=C1;shouldInlineParams=!1;usedTables=[];constructor(Y){this.queryChunks=Y;for(let Z of Y)if(D(Z,A)){let $=Z[A.Symbol.Schema];this.usedTables.push($===void 0?Z[A.Symbol.Name]:$+"."+Z[A.Symbol.Name])}}append(Y){return this.queryChunks.push(...Y.queryChunks),this}toQuery(Y){return HY.startActiveSpan("drizzle.buildSQL",(Z)=>{let $=this.buildQueryFromSourceParams(this.queryChunks,Y);return Z?.setAttributes({"drizzle.query.text":$.sql,"drizzle.query.params":JSON.stringify($.params)}),$})}buildQueryFromSourceParams(Y,Z){let $=Object.assign({},Z,{inlineParams:Z.inlineParams||this.shouldInlineParams,paramStartIndex:Z.paramStartIndex||{value:0}}),{casing:G,escapeName:H,escapeParam:_,prepareTyping:z,inlineParams:O,paramStartIndex:E,invokeSource:U}=$;return Z0(Y.map((F)=>{if(D(F,h))return{sql:F.value.join(""),params:[]};if(D(F,S1))return{sql:H(F.value),params:[]};if(F===void 0)return{sql:"",params:[]};if(Array.isArray(F)){let M=[new h("(")];for(let[I,L]of F.entries())if(M.push(L),I<F.length-1)M.push(new h(", "));return M.push(new h(")")),this.buildQueryFromSourceParams(M,$)}if(D(F,X))return this.buildQueryFromSourceParams(F.queryChunks,{...$,inlineParams:O||F.shouldInlineParams});if(D(F,A)){let M=F[A.Symbol.Schema],I=F[A.Symbol.Name];if(U==="mssql-view-with-schemabinding")return{sql:(M===void 0?H("dbo"):H(M))+"."+H(I),params:[]};return{sql:M===void 0||F[_1]?H(I):H(M)+"."+H(I),params:[]}}if(D(F,N)){let M=G.getColumnCasing(F);if(Z.invokeSource==="indexes")return{sql:H(M),params:[]};let I=U==="mssql-check"?void 0:F.table[A.Symbol.Schema];return{sql:F.isAlias?H(F.name):F.table[_1]||I===void 0?H(F.table[A.Symbol.Name])+"."+H(M):H(I)+"."+H(F.table[A.Symbol.Name])+"."+H(M),params:[]}}if(D(F,y)){let M=F[Q].schema,I=F[Q].name;return{sql:M===void 0||F[Q].isAlias?H(I):H(M)+"."+H(I),params:[]}}if(D(F,g)){if(D(F.value,l))return{sql:_(E.value++,F),params:[F],typings:["none"]};let M=F.value===null?null:F.encoder.mapToDriverValue(F.value);if(D(M,X))return this.buildQueryFromSourceParams([M],$);if(O)return{sql:this.mapInlineParam(M,$),params:[]};let I=["none"];if(z)I=[z(F.encoder)];return{sql:_(E.value++,M),params:[M],typings:I}}if(D(F,l))return{sql:_(E.value++,F),params:[F],typings:["none"]};if(D(F,X.Aliased)&&F.fieldAlias!==void 0)return{sql:(F.origin!==void 0?H(F.origin)+".":"")+H(F.fieldAlias),params:[]};if(D(F,T)){if(F._.isWith)return{sql:H(F._.alias),params:[]};return this.buildQueryFromSourceParams([new h("("),F._.sql,new h(") "),new S1(F._.alias)],$)}if(typeof F==="function"&&"enumName"in F){if("schema"in F&&F.schema)return{sql:H(F.schema)+"."+H(F.enumName),params:[]};return{sql:H(F.enumName),params:[]}}if(E1(F)){if(F.shouldOmitSQLParens?.())return this.buildQueryFromSourceParams([F.getSQL()],$);return this.buildQueryFromSourceParams([new h("("),F.getSQL(),new h(")")],$)}if(O)return{sql:this.mapInlineParam(F,$),params:[]};return{sql:_(E.value++,F),params:[F],typings:["none"]}}))}mapInlineParam(Y,{escapeString:Z}){if(Y===null)return"null";if(typeof Y==="number"||typeof Y==="boolean"||typeof Y==="bigint")return Y.toString();if(typeof Y==="string")return Z(Y);if(typeof Y==="object"){let $=Y.toString();if($==="[object Object]")return Z(JSON.stringify(Y));return Z($)}throw Error("Unexpected param value: "+Y)}getSQL(){return this}as(Y){if(Y===void 0)return this;return new X.Aliased(this,Y)}mapWith(Y){return this.decoder=typeof Y==="function"?{mapFromDriverValue:Y}:Y,this}inlineParams(){return this.shouldInlineParams=!0,this}if(Y){return Y?this:void 0}},S1=class{static[J]="Name";brand;constructor(X){this.value=X}getSQL(){return new x([this])}};function $0(X){return new S1(X)}function PX(X){return typeof X==="object"&&X!==null&&"mapToDriverValue"in X&&typeof X.mapToDriverValue==="function"}var C1={mapFromDriverValue:(X)=>X},LX={mapToDriverValue:(X)=>X},G0={...C1,...LX},g=class{static[J]="Param";brand;constructor(X,Y=LX){this.value=X,this.encoder=Y}getSQL(){return new x([this])}};function W0(X,Y){return new g(X,Y)}function W(X,...Y){let Z=[];if(Y.length>0||X.length>0&&X[0]!=="")Z.push(new h(X[0]));for(let[$,G]of Y.entries())Z.push(G,new h(X[$+1]));return new x(Z)}(function(X){function Y(){return new x([])}X.empty=Y;function Z(O){return new x(O)}X.fromList=Z;function $(O){return new x([new h(O)])}X.raw=$;function G(O,E){let U=[];for(let[F,M]of O.entries()){if(F>0&&E!==void 0)U.push(E);U.push(M)}return new x(U)}X.join=G;function H(O){return new S1(O)}X.identifier=H;function _(O){return new l(O)}X.placeholder=_;function z(O,E){return new g(O,E)}X.param=z})(W||(W={}));(function(X){class Y{static[J]="SQL.Aliased";isSelectionField=!1;origin;constructor(Z,$){this.sql=Z,this.fieldAlias=$}getSQL(){return this.sql}clone(){return new Y(this.sql,this.fieldAlias)}}X.Aliased=Y})(x||(x={}));var l=class{static[J]="Placeholder";constructor(X){this.name=X}getSQL(){return new x([this])}};function J0(X){return new l(X)}function D1(X,Y){return X.map((Z)=>{if(D(Z,l)){if(!(Z.name in Y))throw Error(`No value for placeholder "${Z.name}" was provided`);return Y[Z.name]}if(D(Z,g)&&D(Z.value,l)){if(!(Z.value.name in Y))throw Error(`No value for placeholder "${Z.value.name}" was provided`);return Z.encoder.mapToDriverValue(Y[Z.value.name])}return Z})}var _Y=Symbol.for("drizzle:IsDrizzleView"),y=class{static[J]="View";[Q];[_Y]=!0;get[r](){return this[Q].name}get[G1](){return this[Q].schema}get[_1](){return this[Q].isAlias}get[U1](){return this[Q].originalName}get[n](){return this[Q].selectedFields}constructor({name:X,schema:Y,selectedFields:Z,query:$}){this[Q]={name:X,originalName:X,schema:Y,selectedFields:Z,query:$,isExisting:!$,isAlias:!1}}};function H0(X){return typeof X==="object"&&X!==null&&_Y in X}function _0(X){return X[Q].name}N.prototype.getSQL=function(){return new x([this])};T.prototype.getSQL=function(){return new x([this])};function BX(X,Y,Z){let $={},G=X.reduce((H,{path:_,field:z},O)=>{let E;if(D(z,N))E=z;else if(D(z,x))E=z.decoder;else if(D(z,T))E=z._.sql.decoder;else E=z.sql.decoder;let U=H;for(let[F,M]of _.entries())if(F<_.length-1){if(!(M in U))U[M]={};U=U[M]}else{let I=Y[O],L=U[M]=I===null?null:E.mapFromDriverValue(I);if(Z&&D(z,N)&&_.length===2){let P=_[0];if(!(P in $))$[P]=L===null?z1(z.table):!1;else if(typeof $[P]==="string"&&$[P]!==z1(z.table))$[P]=!1}}return H},{});if(Z&&Object.keys($).length>0){for(let[H,_]of Object.entries($))if(typeof _==="string"&&!Z[_])G[H]=null}return G}function i(X,Y){return Object.entries(X).reduce((Z,[$,G])=>{if(typeof $!=="string")return Z;let H=Y?[...Y,$]:[$];if(D(G,N)||D(G,x)||D(G,x.Aliased)||D(G,T))Z.push({path:H,field:G});else if(D(G,A))Z.push(...i(G[A.Symbol.Columns],H));else Z.push(...i(G,H));return Z},[])}function q1(X,Y){let Z=Object.keys(X),$=Object.keys(Y);if(Z.length!==$.length)return!1;for(let[G,H]of Z.entries())if(H!==$[G])return!1;return!0}function JX(X,Y){let Z=Object.entries(Y).filter(([,$])=>$!==void 0).map(([$,G])=>{if(D(G,x)||D(G,N))return[$,G];else return[$,new g(G,X[A.Symbol.Columns][$])]});if(Z.length===0)throw Error("No values to set");return Object.fromEntries(Z)}function zY(X,Y){for(let Z of Y)for(let $ of Object.getOwnPropertyNames(Z.prototype)){if($==="constructor")continue;Object.defineProperty(X.prototype,$,Object.getOwnPropertyDescriptor(Z.prototype,$)||Object.create(null))}}function EY(X){return X[A.Symbol.Columns]}function v1(X){return D(X,T)?X._.alias:D(X,y)?X[Q].name:D(X,x)?void 0:X[A.Symbol.IsAlias]?X[A.Symbol.Name]:X[A.Symbol.BaseName]}function k(X,Y){return{name:typeof X==="string"&&X.length>0?X:"",config:typeof X==="object"?X:Y}}var jX=typeof TextDecoder>"u"?null:new TextDecoder;var D3={INT8_MIN:-128,INT8_MAX:127,INT8_UNSIGNED_MAX:255,INT16_MIN:-32768,INT16_MAX:32767,INT16_UNSIGNED_MAX:65535,INT24_MIN:-8388608,INT24_MAX:8388607,INT24_UNSIGNED_MAX:16777215,INT32_MIN:-2147483648,INT32_MAX:2147483647,INT32_UNSIGNED_MAX:4294967295,INT48_MIN:-140737488355328,INT48_MAX:140737488355327,INT48_UNSIGNED_MAX:281474976710655,INT64_MIN:-9223372036854775808n,INT64_MAX:9223372036854775807n,INT64_UNSIGNED_MAX:18446744073709551615n};var z0=class{static[J]="ConsoleLogWriter";write(X){console.log(X)}},DY=class{static[J]="DefaultLogger";writer;constructor(X){this.writer=X?.writer??new z0}logQuery(X,Y){let Z=Y.map((G)=>{try{return JSON.stringify(G)}catch{return String(G)}}),$=Z.length?` -- params: [${Z.join(", ")}]`:"";this.writer.write(`Query: ${X}${$}`)}},OY=class{static[J]="NoopLogger";logQuery(){}};var FY=class{static[J]="ColumnBuilder";config;constructor(X,Y,Z){this.config={name:X,keyAsName:X==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:Y,columnType:Z,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(X){return this.config.default=X,this.config.hasDefault=!0,this}$defaultFn(X){return this.config.defaultFn=X,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(X){return this.config.onUpdateFn=X,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(X){if(this.config.name!=="")return;this.config.name=X}};var HX=class{static[J]="SQLiteForeignKeyBuilder";reference;_onUpdate;_onDelete;constructor(X,Y){if(this.reference=()=>{let{name:Z,columns:$,foreignColumns:G}=X();return{name:Z,columns:$,foreignTable:G[0].table,foreignColumns:G}},Y)this._onUpdate=Y.onUpdate,this._onDelete=Y.onDelete}onUpdate(X){return this._onUpdate=X,this}onDelete(X){return this._onDelete=X,this}build(X){return new UY(X,this)}},UY=class{static[J]="SQLiteForeignKey";reference;onUpdate;onDelete;constructor(X,Y){this.table=X,this.reference=Y.reference,this.onUpdate=Y._onUpdate,this.onDelete=Y._onDelete}getName(){let{name:X,columns:Y,foreignColumns:Z}=this.reference(),$=Y.map((_)=>_.name),G=Z.map((_)=>_.name),H=[this.table[r],...$,Z[0].table[r],...G];return X??`${H.join("_")}_fk`}isNameExplicit(){return!!this.reference().name}};function E0(X){function Y(){if(typeof X==="function"){let{name:Z,columns:$,foreignColumns:G}=X();return{name:Z,columns:$,foreignColumns:G}}return X}return new HX(Y)}var f=class extends FY{static[J]="SQLiteColumnBuilder";foreignKeyConfigs=[];references(X,Y={}){return this.foreignKeyConfigs.push({ref:X,actions:Y}),this}unique(X){return this.config.isUnique=!0,this.config.uniqueName=X,this}generatedAlwaysAs(X,Y){return this.config.generated={as:X,type:"always",mode:Y?.mode??"virtual"},this}buildForeignKeys(X,Y){return this.foreignKeyConfigs.map(({ref:Z,actions:$})=>{return((G,H)=>{let _=new HX(()=>{let z=G();return{columns:[X],foreignColumns:[z]}});if(H.onUpdate)_.onUpdate(H.onUpdate);if(H.onDelete)_.onDelete(H.onDelete);return _.build(Y)})(Z,$)})}},S=class extends N{static[J]="SQLiteColumn";table;constructor(X,Y){super(X,Y);this.table=X}};var _X=class extends f{static[J]="SQLiteBaseIntegerBuilder";constructor(X,Y,Z){super(X,Y,Z);this.config.autoIncrement=!1}primaryKey(X){if(X?.autoIncrement)this.config.autoIncrement=!0;return this.config.hasDefault=!0,super.primaryKey()}},zX=class extends S{static[J]="SQLiteBaseInteger";autoIncrement=this.config.autoIncrement;getSQLType(){return"integer"}},AY=class extends _X{static[J]="SQLiteIntegerBuilder";constructor(X){super(X,"number int53","SQLiteInteger")}build(X){return new VY(X,this.config)}},VY=class extends zX{static[J]="SQLiteInteger"},IY=class extends _X{static[J]="SQLiteTimestampBuilder";constructor(X,Y){super(X,"object date","SQLiteTimestamp");this.config.mode=Y}defaultNow(){return this.default(W`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build(X){return new MY(X,this.config)}},MY=class extends zX{static[J]="SQLiteTimestamp";mode=this.config.mode;mapFromDriverValue(X){if(typeof X==="string")return new Date(X.replaceAll('"',""));if(this.config.mode==="timestamp")return new Date(X*1000);return new Date(X)}mapToDriverValue(X){if(typeof X==="number")return X;let Y=X.getTime();if(this.config.mode==="timestamp")return Math.floor(Y/1000);return Y}},xY=class extends _X{static[J]="SQLiteBooleanBuilder";constructor(X,Y){super(X,"boolean","SQLiteBoolean");this.config.mode=Y}build(X){return new KY(X,this.config)}},KY=class extends zX{static[J]="SQLiteBoolean";mode=this.config.mode;mapFromDriverValue(X){return Number(X)===1}mapToDriverValue(X){return X?1:0}};function TX(X,Y){let{name:Z,config:$}=k(X,Y);if($?.mode==="timestamp"||$?.mode==="timestamp_ms")return new IY(Z,$.mode);if($?.mode==="boolean")return new xY(Z,$.mode);return new AY(Z)}var kY=class extends f{static[J]="SQLiteTextBuilder";constructor(X,Y){super(X,Y.enum?.length?"string enum":"string","SQLiteText");this.config.enumValues=Y.enum,this.config.length=Y.length}build(X){return new NY(X,this.config)}},NY=class extends S{static[J]="SQLiteText";enumValues=this.config.enumValues;constructor(X,Y){super(X,Y)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:""}`}},RY=class extends f{static[J]="SQLiteTextJsonBuilder";constructor(X){super(X,"object json","SQLiteTextJson")}build(X){return new wY(X,this.config)}},wY=class extends S{static[J]="SQLiteTextJson";getSQLType(){return"text"}mapFromDriverValue(X){return JSON.parse(X)}mapToDriverValue(X){return JSON.stringify(X)}};function SX(X,Y={}){let{name:Z,config:$}=k(X,Y);if($.mode==="json")return new RY(Z);return new kY(Z,$)}var QY=class{static[J]="SQLiteIndexBuilderOn";constructor(X,Y){this.name=X,this.unique=Y}on(...X){return new PY(this.name,X,this.unique)}},PY=class{static[J]="SQLiteIndexBuilder";config;constructor(X,Y,Z){this.config={name:X,columns:Y,unique:Z,where:void 0}}where(X){return this.config.where=X,this}build(X){return new LY(this.config,X)}},LY=class{static[J]="SQLiteIndex";config;isNameExplicit;constructor(X,Y){this.config={...X,table:Y},this.isNameExplicit=!!X.name}};function D0(X){return new QY(X,!1)}function BY(X){let Y="";for(let Z=0;Z<X.length;Z+=2){let $=X.slice(Z,Z+2),G=Number.parseInt($,16);Y+=String.fromCodePoint(G)}return Y}var O0=class extends f{static[J]="SQLiteBigIntBuilder";constructor(X){super(X,"bigint int64","SQLiteBigInt")}build(X){return new F0(X,this.config)}},F0=class extends S{static[J]="SQLiteBigInt";getSQLType(){return"blob"}mapFromDriverValue(X){if(typeof X==="string")return BigInt(BY(X));if(typeof Buffer<"u"&&Buffer.from){let Y=Buffer.isBuffer(X)?X:X instanceof ArrayBuffer?Buffer.from(X):X.buffer?Buffer.from(X.buffer,X.byteOffset,X.byteLength):Buffer.from(X);return BigInt(Y.toString("utf8"))}return BigInt(jX.decode(X))}mapToDriverValue(X){return Buffer.from(X.toString())}},U0=class extends f{static[J]="SQLiteBlobJsonBuilder";constructor(X){super(X,"object json","SQLiteBlobJson")}build(X){return new A0(X,this.config)}},A0=class extends S{static[J]="SQLiteBlobJson";getSQLType(){return"blob"}mapFromDriverValue(X){if(typeof X==="string")return JSON.parse(BY(X));if(typeof Buffer<"u"&&Buffer.from){let Y=Buffer.isBuffer(X)?X:X instanceof ArrayBuffer?Buffer.from(X):X.buffer?Buffer.from(X.buffer,X.byteOffset,X.byteLength):Buffer.from(X);return JSON.parse(Y.toString("utf8"))}return JSON.parse(jX.decode(X))}mapToDriverValue(X){return Buffer.from(JSON.stringify(X))}},V0=class extends f{static[J]="SQLiteBlobBufferBuilder";constructor(X){super(X,"object buffer","SQLiteBlobBuffer")}build(X){return new I0(X,this.config)}},I0=class extends S{static[J]="SQLiteBlobBuffer";mapFromDriverValue(X){if(Buffer.isBuffer(X))return X;if(typeof X==="string")return Buffer.from(X,"hex");return Buffer.from(X)}getSQLType(){return"blob"}};function jY(X,Y){let{name:Z,config:$}=k(X,Y);if($?.mode==="json")return new U0(Z);if($?.mode==="bigint")return new O0(Z);return new V0(Z)}var M0=class extends f{static[J]="SQLiteCustomColumnBuilder";constructor(X,Y,Z){super(X,"custom","SQLiteCustomColumn");this.config.fieldConfig=Y,this.config.customTypeParams=Z}build(X){return new x0(X,this.config)}},x0=class extends S{static[J]="SQLiteCustomColumn";sqlName;mapTo;mapFrom;mapJson;forJsonSelect;constructor(X,Y){super(X,Y);this.sqlName=Y.customTypeParams.dataType(Y.fieldConfig),this.mapTo=Y.customTypeParams.toDriver,this.mapFrom=Y.customTypeParams.fromDriver,this.mapJson=Y.customTypeParams.fromJson,this.forJsonSelect=Y.customTypeParams.forJsonSelect}getSQLType(){return this.sqlName}mapFromDriverValue(X){return typeof this.mapFrom==="function"?this.mapFrom(X):X}mapFromJsonValue(X){return typeof this.mapJson==="function"?this.mapJson(X):this.mapFromDriverValue(X)}jsonSelectIdentifier(X,Y){if(typeof this.forJsonSelect==="function")return this.forJsonSelect(X,Y);let Z=this.getSQLType().toLowerCase(),$=Z.indexOf("(");switch($+1?Z.slice(0,$):Z){case"numeric":case"decimal":case"bigint":return Y`cast(${X} as text)`;case"blob":return Y`hex(${X})`;default:return X}}mapToDriverValue(X){return typeof this.mapTo==="function"?this.mapTo(X):X}};function TY(X){return(Y,Z)=>{let{name:$,config:G}=k(Y,Z);return new M0($,G,X)}}var K0=class extends f{static[J]="SQLiteNumericBuilder";constructor(X){super(X,"string numeric","SQLiteNumeric")}build(X){return new k0(X,this.config)}},k0=class extends S{static[J]="SQLiteNumeric";mapFromDriverValue(X){if(typeof X==="string")return X;return String(X)}getSQLType(){return"numeric"}},N0=class extends f{static[J]="SQLiteNumericNumberBuilder";constructor(X){super(X,"number","SQLiteNumericNumber")}build(X){return new R0(X,this.config)}},R0=class extends S{static[J]="SQLiteNumericNumber";mapFromDriverValue(X){if(typeof X==="number")return X;return Number(X)}mapToDriverValue=String;getSQLType(){return"numeric"}},w0=class extends f{static[J]="SQLiteNumericBigIntBuilder";constructor(X){super(X,"bigint int64","SQLiteNumericBigInt")}build(X){return new Q0(X,this.config)}},Q0=class extends S{static[J]="SQLiteNumericBigInt";mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return"numeric"}};function SY(X,Y){let{name:Z,config:$}=k(X,Y),G=$?.mode;return G==="number"?new N0(Z):G==="bigint"?new w0(Z):new K0(Z)}var P0=class extends f{static[J]="SQLiteRealBuilder";constructor(X){super(X,"number double","SQLiteReal")}build(X){return new L0(X,this.config)}},L0=class extends S{static[J]="SQLiteReal";getSQLType(){return"real"}};function CY(X){return new P0(X??"")}function qY(){return{blob:jY,customType:TY,integer:TX,numeric:SY,real:CY,text:SX}}var EX=Symbol.for("drizzle:SQLiteInlineForeignKeys"),v=class extends A{static[J]="SQLiteTable";static Symbol=Object.assign({},A.Symbol,{InlineForeignKeys:EX});[A.Symbol.Columns];[EX]=[];[A.Symbol.ExtraConfigBuilder]=void 0};function B0(X,Y,Z,$,G=X){let H=new v(X,$,G),_=typeof Y==="function"?Y(qY()):Y,z=Object.fromEntries(Object.entries(_).map(([E,U])=>{let F=U;F.setName(E);let M=F.build(H);return H[EX].push(...F.buildForeignKeys(M,H)),[E,M]})),O=Object.assign(H,z);if(O[A.Symbol.Columns]=z,O[A.Symbol.ExtraConfigColumns]=z,Z)O[v.Symbol.ExtraConfigBuilder]=Z;return O}var j0=(X,Y,Z)=>{return B0(X,Y,Z)};function T0(...X){if(X[0].columns)return new CX(X[0].columns,X[0].name);return new CX(X)}var CX=class{static[J]="SQLitePrimaryKeyBuilder";columns;name;constructor(X,Y){this.columns=X,this.name=Y}build(X){return new vY(X,this.columns,this.name)}},vY=class{static[J]="SQLitePrimaryKey";columns;name;isNameExplicit;constructor(X,Y,Z){this.table=X,this.columns=Y,this.name=Z,this.isNameExplicit=!!Z}getName(){return this.name??`${this.table[v.Symbol.Name]}_${this.columns.map((X)=>X.name).join("_")}_pk`}};function q(X,Y){if(PX(Y)&&!E1(X)&&!D(X,g)&&!D(X,l)&&!D(X,N)&&!D(X,A)&&!D(X,y))return new g(X,Y);return X}var a=(X,Y)=>{return W`${X} = ${q(Y,X)}`},h1=(X,Y)=>{return W`${X} <> ${q(Y,X)}`};function m(...X){let Y=X.filter((Z)=>Z!==void 0);if(Y.length===0)return;if(Y.length===1)return new x(Y);return new x([new h("("),W.join(Y,new h(" and ")),new h(")")])}function V1(...X){let Y=X.filter((Z)=>Z!==void 0);if(Y.length===0)return;if(Y.length===1)return new x(Y);return new x([new h("("),W.join(Y,new h(" or ")),new h(")")])}function I1(X){return W`not ${X}`}var p1=(X,Y)=>{return W`${X} > ${q(Y,X)}`},y1=(X,Y)=>{return W`${X} >= ${q(Y,X)}`},f1=(X,Y)=>{return W`${X} < ${q(Y,X)}`},b1=(X,Y)=>{return W`${X} <= ${q(Y,X)}`};function d1(X,Y){if(Array.isArray(Y)){if(Y.length===0)return W`false`;return W`${X} in ${Y.map((Z)=>q(Z,X))}`}return W`${X} in ${q(Y,X)}`}function g1(X,Y){if(Array.isArray(Y)){if(Y.length===0)return W`true`;return W`${X} not in ${Y.map((Z)=>q(Z,X))}`}return W`${X} not in ${q(Y,X)}`}function m1(X){return W`(${X} is null)`}function c1(X){return W`(${X} is not null)`}function k1(X){return W`exists ${X}`}function N1(X){return W`not exists ${X}`}function u1(X,Y,Z){return W`${X} between ${q(Y,X)} and ${q(Z,X)}`}function r1(X,Y,Z){return W`${X} not between ${q(Y,X)} and ${q(Z,X)}`}function o1(X,Y){return W`${X} like ${Y}`}function s1(X,Y){return W`${X} not like ${Y}`}function t1(X,Y){return W`${X} ilike ${Y}`}function n1(X,Y){return W`${X} not ilike ${Y}`}function qX(X,Y){if(Array.isArray(Y)){if(Y.length===0)throw Error("arrayContains requires at least one value");let Z=q(Y,X);return W`${X} @> ${W`${Array.isArray(Z)?new g(Z):Z}`}`}return W`${X} @> ${q(Y,X)}`}function vX(X,Y){if(Array.isArray(Y)){if(Y.length===0)throw Error("arrayContained requires at least one value");let Z=q(Y,X);return W`${X} <@ ${W`${Array.isArray(Z)?new g(Z):Z}`}`}return W`${X} <@ ${q(Y,X)}`}function hX(X,Y){if(Array.isArray(Y)){if(Y.length===0)throw Error("arrayOverlaps requires at least one value");let Z=q(Y,X);return W`${X} && ${W`${Array.isArray(Z)?new g(Z):Z}`}`}return W`${X} && ${q(Y,X)}`}function M1(X){return W`${X} asc`}function i1(X){return W`${X} desc`}function hY(X,Y,Z){for(let $=Y;$<X.length;$++){let G=X[$];if(G==="\\"){$++;continue}if(G==='"')return[X.slice(Y,$).replace(/\\/g,""),$+1];if(Z)continue;if(G===","||G==="}")return[X.slice(Y,$).replace(/\\/g,""),$]}return[X.slice(Y).replace(/\\/g,""),X.length]}function pY(X,Y=0){let Z=[],$=Y,G=!1;while($<X.length){let H=X[$];if(H===","){if(G||$===Y)Z.push("");G=!0,$++;continue}if(G=!1,H==="\\"){$+=2;continue}if(H==='"'){let[O,E]=hY(X,$+1,!0);Z.push(O),$=E;continue}if(H==="}")return[Z,$+1];if(H==="{"){let[O,E]=pY(X,$+1);Z.push(O),$=E;continue}let[_,z]=hY(X,$,!1);Z.push(_),$=z}return[Z,$]}function DX(X){let[Y]=pY(X,1);return Y}function pX(X){return`{${X.map((Y)=>{if(Array.isArray(Y))return pX(Y);if(typeof Y==="string")return`"${Y.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}"`;return`${Y}`}).join(",")}}`}var yY=class{static[J]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor(X,Y){if(this.reference=()=>{let{name:Z,columns:$,foreignColumns:G}=X();return{name:Z,columns:$,foreignTable:G[0].table,foreignColumns:G}},Y)this._onUpdate=Y.onUpdate,this._onDelete=Y.onDelete}onUpdate(X){return this._onUpdate=X===void 0?"no action":X,this}onDelete(X){return this._onDelete=X===void 0?"no action":X,this}build(X){return new S0(X,this)}},S0=class{static[J]="PgForeignKey";reference;onUpdate;onDelete;name;constructor(X,Y){this.table=X,this.reference=Y.reference,this.onUpdate=Y._onUpdate,this.onDelete=Y._onDelete}getName(){let{name:X,columns:Y,foreignColumns:Z}=this.reference(),$=Y.map((_)=>_.name),G=Z.map((_)=>_.name),H=[this.table[r],...$,Z[0].table[r],...G];return X??`${H.join("_")}_fk`}isNameExplicit(){return!!this.reference().name}};var K=class{static[J]="PgColumnBuilder";foreignKeyConfigs=[];config;constructor(X,Y,Z){this.config={name:X,keyAsName:X==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:Y,columnType:Z,generated:void 0,defaultFn:void 0,onUpdateFn:void 0,generatedIdentity:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(X){return this.config.default=X,this.config.hasDefault=!0,this}$defaultFn(X){return this.config.defaultFn=X,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(X){return this.config.onUpdateFn=X,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(X){if(this.config.name!=="")return;this.config.name=X}array(X){let Y=X??"[]";return this.config.dimensions=Y.length/2,this}references(X,Y={}){return this.foreignKeyConfigs.push({ref:X,config:Y}),this}unique(X,Y){return this.config.isUnique=!0,this.config.uniqueName=X,this.config.uniqueType=Y?.nulls,this}generatedAlwaysAs(X){return this.config.generated={as:X,type:"always",mode:"stored"},this}buildForeignKeys(X,Y){return this.foreignKeyConfigs.map(({ref:Z,config:$})=>{return JY((G,H)=>{let _=new yY(()=>{let z=G();return{name:H.name,columns:[X],foreignColumns:[z]}});if(H.onUpdate)_.onUpdate(H.onUpdate);if(H.onDelete)_.onDelete(H.onDelete);return _.build(Y)},Z,$)})}buildExtraConfigColumn(X){return new C0(X,{...this.config,dimensions:this.config.dimensions??0})}},V=class extends N{static[J]="PgColumn";table;dimensions;constructor(X,Y){super(X,Y);if(this.table=X,this.dimensions=Y.dimensions??0,this.dimensions){let Z=this.mapFromDriverValue.bind(this),$=this.mapToDriverValue.bind(this);this.mapFromDriverValue=(G)=>{if(G===null)return G;let H=typeof G==="string"?DX(G):G;return this.mapArrayElements(H,Z,this.dimensions)},this.mapToDriverValue=(G)=>{if(G===null)return G;return pX(this.mapArrayElements(G,$,this.dimensions))}}}mapArrayElements(X,Y,Z){if(Z>0&&Array.isArray(X))return X.map(($)=>$===null?null:this.mapArrayElements($,Y,Z-1));return Y(X)}},C0=class extends V{static[J]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(X){return this.indexConfig.opClass=X,this}};var O1=class extends K{static[J]="PgIntColumnBaseBuilder";generatedAlwaysAsIdentity(X){if(X){let{name:Y,...Z}=X;this.config.generatedIdentity={type:"always",sequenceName:Y,sequenceOptions:Z}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity(X){if(X){let{name:Y,...Z}=X;this.config.generatedIdentity={type:"byDefault",sequenceName:Y,sequenceOptions:Z}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}};var q0=class extends O1{static[J]="PgBigInt53Builder";constructor(X){super(X,"number int53","PgBigInt53")}build(X){return new v0(X,this.config)}},v0=class extends V{static[J]="PgBigInt53";getSQLType(){return"bigint"}mapFromDriverValue(X){if(typeof X==="number")return X;return Number(X)}},h0=class extends O1{static[J]="PgBigInt64Builder";constructor(X){super(X,"bigint int64","PgBigInt64")}build(X){return new p0(X,this.config)}},p0=class extends V{static[J]="PgBigInt64";getSQLType(){return"bigint"}mapFromDriverValue(X){return BigInt(X)}},y0=class extends O1{static[J]="PgBigIntStringBuilder";constructor(X){super(X,"string int64","PgBigIntString")}build(X){return new f0(X,this.config)}},f0=class extends V{static[J]="PgBigIntString";getSQLType(){return"bigint"}mapFromDriverValue(X){if(typeof X==="string")return X;return String(X)}};function fY(X,Y){let{name:Z,config:$}=k(X,Y);if($.mode==="number")return new q0(Z);if($.mode==="string")return new y0(Z);return new h0(Z)}var b0=class extends K{static[J]="PgBigSerial53Builder";constructor(X){super(X,"number int53","PgBigSerial53");this.config.hasDefault=!0,this.config.notNull=!0}build(X){return new d0(X,this.config)}},d0=class extends V{static[J]="PgBigSerial53";getSQLType(){return"bigserial"}mapFromDriverValue(X){if(typeof X==="number")return X;return Number(X)}},g0=class extends K{static[J]="PgBigSerial64Builder";constructor(X){super(X,"bigint int64","PgBigSerial64");this.config.hasDefault=!0,this.config.notNull=!0}build(X){return new m0(X,this.config)}},m0=class extends V{static[J]="PgBigSerial64";getSQLType(){return"bigserial"}mapFromDriverValue(X){return BigInt(X)}};function bY(X,Y){let{name:Z,config:$}=k(X,Y);if($.mode==="number")return new b0(Z);return new g0(Z)}var c0=class extends K{static[J]="PgBooleanBuilder";constructor(X){super(X,"boolean","PgBoolean")}build(X){return new u0(X,this.config)}},u0=class extends V{static[J]="PgBoolean";getSQLType(){return"boolean"}};function dY(X){return new c0(X??"")}var r0=class extends K{static[J]="PgCharBuilder";constructor(X,Y){super(X,Y.enum?.length?"string enum":"string","PgChar");this.config.length=Y.length??1,this.config.setLength=Y.length!==void 0,this.config.enumValues=Y.enum}build(X){return new o0(X,this.config)}},o0=class extends V{static[J]="PgChar";enumValues;setLength;constructor(X,Y){super(X,Y);this.enumValues=Y.enumValues,this.setLength=Y.setLength}getSQLType(){return this.setLength?`char(${this.length})`:"char"}};function gY(X,Y={}){let{name:Z,config:$}=k(X,Y);return new r0(Z,$)}var s0=class extends K{static[J]="PgCidrBuilder";constructor(X){super(X,"string cidr","PgCidr")}build(X){return new t0(X,this.config)}},t0=class extends V{static[J]="PgCidr";getSQLType(){return"cidr"}};function mY(X){return new s0(X??"")}var n0=class extends K{static[J]="PgCustomColumnBuilder";constructor(X,Y,Z){super(X,"custom","PgCustomColumn");this.config.fieldConfig=Y,this.config.customTypeParams=Z}build(X){return new i0(X,this.config)}},i0=class extends V{static[J]="PgCustomColumn";sqlName;mapTo;mapFrom;mapJson;forJsonSelect;constructor(X,Y){super(X,Y);if(this.sqlName=Y.customTypeParams.dataType(Y.fieldConfig),this.mapTo=Y.customTypeParams.toDriver,this.mapFrom=Y.customTypeParams.fromDriver,this.mapJson=Y.customTypeParams.fromJson,this.forJsonSelect=Y.customTypeParams.forJsonSelect,this.dimensions){let Z=($)=>{if(typeof this.mapJson==="function")return this.mapJson($);if(typeof this.mapFrom==="function")return this.mapFrom($);return $};this.mapFromJsonValue=($)=>{if($===null)return $;let G=typeof $==="string"?DX($):$;return this.mapJsonArrayElements(G,Z,this.dimensions)}}}mapJsonArrayElements(X,Y,Z){if(Z>0&&Array.isArray(X))return X.map(($)=>$===null?null:this.mapJsonArrayElements($,Y,Z-1));return Y(X)}getSQLType(){return this.sqlName}mapFromDriverValue(X){return typeof this.mapFrom==="function"?this.mapFrom(X):X}mapFromJsonValue(X){return typeof this.mapJson==="function"?this.mapJson(X):this.mapFromDriverValue(X)}jsonSelectIdentifier(X,Y,Z){if(typeof this.forJsonSelect==="function")return this.forJsonSelect(X,Y,Z);let $=this.getSQLType().toLowerCase(),G=$.indexOf("(");switch(G+1?$.slice(0,G):$){case"bytea":case"geometry":case"timestamp":case"numeric":case"bigint":{let H="[]".repeat(Z??0);return Y`${X}::text${Y.raw(H).if(Z)}`}default:return X}}mapToDriverValue(X){return typeof this.mapTo==="function"?this.mapTo(X):X}};function cY(X){return(Y,Z)=>{let{name:$,config:G}=k(Y,Z);return new n0($,G,X)}}var F1=class extends K{static[J]="PgDateColumnBaseBuilder";defaultNow(){return this.default(W`now()`)}};var l0=class extends F1{static[J]="PgDateBuilder";constructor(X){super(X,"object date","PgDate")}build(X){return new a0(X,this.config)}},a0=class extends V{static[J]="PgDate";getSQLType(){return"date"}mapFromDriverValue(X){if(typeof X==="string")return new Date(X);return X}mapToDriverValue(X){if(typeof X==="string")return X;return X.toISOString()}},e0=class extends F1{static[J]="PgDateStringBuilder";constructor(X){super(X,"string date","PgDateString")}build(X){return new X8(X,this.config)}},X8=class extends V{static[J]="PgDateString";getSQLType(){return"date"}mapFromDriverValue(X){if(typeof X==="string")return X;return X.toISOString().slice(0,-14)}mapToDriverValue(X){if(typeof X==="string")return X;return X.toISOString()}};function uY(X,Y){let{name:Z,config:$}=k(X,Y);if($?.mode==="date")return new l0(Z);return new e0(Z)}var Y8=class extends K{static[J]="PgDoublePrecisionBuilder";constructor(X){super(X,"number double","PgDoublePrecision")}build(X){return new Z8(X,this.config)}},Z8=class extends V{static[J]="PgDoublePrecision";getSQLType(){return"double precision"}mapFromDriverValue(X){if(typeof X==="string")return Number.parseFloat(X);return X}};function rY(X){return new Y8(X??"")}var $8=class extends K{static[J]="PgInetBuilder";constructor(X){super(X,"string inet","PgInet")}build(X){return new G8(X,this.config)}},G8=class extends V{static[J]="PgInet";getSQLType(){return"inet"}};function oY(X){return new $8(X??"")}var W8=class extends O1{static[J]="PgIntegerBuilder";constructor(X){super(X,"number int32","PgInteger")}build(X){return new J8(X,this.config)}},J8=class extends V{static[J]="PgInteger";getSQLType(){return"integer"}mapFromDriverValue(X){if(typeof X==="string")return Number.parseInt(X);return X}};function sY(X){return new W8(X??"")}var H8=class extends K{static[J]="PgIntervalBuilder";constructor(X,Y){super(X,"string interval","PgInterval");this.config.intervalConfig=Y}build(X){return new _8(X,this.config)}},_8=class extends V{static[J]="PgInterval";fields;precision;constructor(X,Y){super(X,Y);this.fields=Y.intervalConfig.fields,this.precision=Y.intervalConfig.precision}getSQLType(){return`interval${this.fields?` ${this.fields}`:""}${this.precision?`(${this.precision})`:""}`}};function tY(X,Y={}){let{name:Z,config:$}=k(X,Y);return new H8(Z,$)}var z8=class extends K{static[J]="PgJsonBuilder";constructor(X){super(X,"object json","PgJson")}build(X){return new E8(X,this.config)}},E8=class extends V{static[J]="PgJson";constructor(X,Y){super(X,Y)}getSQLType(){return"json"}mapToDriverValue(X){return JSON.stringify(X)}mapFromDriverValue(X){if(typeof X==="string")try{return JSON.parse(X)}catch{return X}return X}};function nY(X){return new z8(X??"")}var D8=class extends K{static[J]="PgJsonbBuilder";constructor(X){super(X,"object json","PgJsonb")}build(X){return new O8(X,this.config)}},O8=class extends V{static[J]="PgJsonb";constructor(X,Y){super(X,Y)}getSQLType(){return"jsonb"}mapToDriverValue(X){return JSON.stringify(X)}mapFromDriverValue(X){if(typeof X==="string")try{return JSON.parse(X)}catch{return X}return X}};function iY(X){return new D8(X??"")}var F8=class extends K{static[J]="PgLineBuilder";constructor(X){super(X,"array line","PgLine")}build(X){return new U8(X,this.config)}},U8=class extends V{static[J]="PgLine";mode="tuple";getSQLType(){return"line"}mapFromDriverValue(X){let[Y,Z,$]=X.slice(1,-1).split(",");return[Number.parseFloat(Y),Number.parseFloat(Z),Number.parseFloat($)]}mapToDriverValue(X){return`{${X[0]},${X[1]},${X[2]}}`}},A8=class extends K{static[J]="PgLineABCBuilder";constructor(X){super(X,"object line","PgLineABC")}build(X){return new V8(X,this.config)}},V8=class extends V{static[J]="PgLineABC";mode="abc";getSQLType(){return"line"}mapFromDriverValue(X){let[Y,Z,$]=X.slice(1,-1).split(",");return{a:Number.parseFloat(Y),b:Number.parseFloat(Z),c:Number.parseFloat($)}}mapToDriverValue(X){return`{${X.a},${X.b},${X.c}}`}};function lY(X,Y){let{name:Z,config:$}=k(X,Y);if(!$?.mode||$.mode==="tuple")return new F8(Z);return new A8(Z)}var I8=class extends K{static[J]="PgMacaddrBuilder";constructor(X){super(X,"string macaddr","PgMacaddr")}build(X){return new M8(X,this.config)}},M8=class extends V{static[J]="PgMacaddr";getSQLType(){return"macaddr"}};function aY(X){return new I8(X??"")}var x8=class extends K{static[J]="PgMacaddr8Builder";constructor(X){super(X,"string macaddr8","PgMacaddr8")}build(X){return new K8(X,this.config)}},K8=class extends V{static[J]="PgMacaddr8";getSQLType(){return"macaddr8"}};function eY(X){return new x8(X??"")}var k8=class extends K{static[J]="PgNumericBuilder";constructor(X,Y,Z){super(X,"string numeric","PgNumeric");this.config.precision=Y,this.config.scale=Z}build(X){return new N8(X,this.config)}},N8=class extends V{static[J]="PgNumeric";precision;scale;constructor(X,Y){super(X,Y);this.precision=Y.precision,this.scale=Y.scale}mapFromDriverValue(X){if(typeof X==="string")return X;return String(X)}getSQLType(){if(this.precision!==void 0&&this.scale!==void 0)return`numeric(${this.precision}, ${this.scale})`;else if(this.precision===void 0)return"numeric";else return`numeric(${this.precision})`}},R8=class extends K{static[J]="PgNumericNumberBuilder";constructor(X,Y,Z){super(X,"number","PgNumericNumber");this.config.precision=Y,this.config.scale=Z}build(X){return new w8(X,this.config)}},w8=class extends V{static[J]="PgNumericNumber";precision;scale;constructor(X,Y){super(X,Y);this.precision=Y.precision,this.scale=Y.scale}mapFromDriverValue(X){if(typeof X==="number")return X;return Number(X)}mapToDriverValue(X){return String(X)}getSQLType(){if(this.precision!==void 0&&this.scale!==void 0)return`numeric(${this.precision}, ${this.scale})`;else if(this.precision===void 0)return"numeric";else return`numeric(${this.precision})`}},Q8=class extends K{static[J]="PgNumericBigIntBuilder";constructor(X,Y,Z){super(X,"bigint int64","PgNumericBigInt");this.config.precision=Y,this.config.scale=Z}build(X){return new P8(X,this.config)}},P8=class extends V{static[J]="PgNumericBigInt";precision;scale;constructor(X,Y){super(X,Y);this.precision=Y.precision,this.scale=Y.scale}mapFromDriverValue(X){return BigInt(X)}mapToDriverValue(X){return String(X)}getSQLType(){if(this.precision!==void 0&&this.scale!==void 0)return`numeric(${this.precision}, ${this.scale})`;else if(this.precision===void 0)return"numeric";else return`numeric(${this.precision})`}};function XZ(X,Y){let{name:Z,config:$}=k(X,Y),G=$?.mode;return G==="number"?new R8(Z,$?.precision,$?.scale):G==="bigint"?new Q8(Z,$?.precision,$?.scale):new k8(Z,$?.precision,$?.scale)}var L8=class extends K{static[J]="PgPointTupleBuilder";constructor(X){super(X,"array point","PgPointTuple")}build(X){return new B8(X,this.config)}},B8=class extends V{static[J]="PgPointTuple";mode="tuple";getSQLType(){return"point"}mapFromDriverValue(X){if(typeof X==="string"){let[Y,Z]=X.slice(1,-1).split(",");return[Number.parseFloat(Y),Number.parseFloat(Z)]}return[X.x,X.y]}mapToDriverValue(X){return`(${X[0]},${X[1]})`}},j8=class extends K{static[J]="PgPointObjectBuilder";constructor(X){super(X,"object point","PgPointObject")}build(X){return new T8(X,this.config)}},T8=class extends V{static[J]="PgPointObject";mode="xy";getSQLType(){return"point"}mapFromDriverValue(X){if(typeof X==="string"){let[Y,Z]=X.slice(1,-1).split(",");return{x:Number.parseFloat(Y),y:Number.parseFloat(Z)}}return X}mapToDriverValue(X){return`(${X.x},${X.y})`}};function YZ(X,Y){let{name:Z,config:$}=k(X,Y);if(!$?.mode||$.mode==="tuple")return new L8(Z);return new j8(Z)}function S8(X){let Y=[];for(let Z=0;Z<X.length;Z+=2)Y.push(Number.parseInt(X.slice(Z,Z+2),16));return new Uint8Array(Y)}function ZZ(X,Y){let $=new DataView(new ArrayBuffer(8));for(let G=0;G<8;G++)$.setUint8(G,X[Y+G]);return $.getFloat64(0,!0)}function yX(X){let Y=S8(X),Z=0,$=Y[Z];Z+=1;let G=new DataView(Y.buffer),H=G.getUint32(Z,$===1);Z+=4;let _;if(H&536870912)_=G.getUint32(Z,$===1),Z+=4;if((H&65535)===1){let z=ZZ(Y,Z);Z+=8;let O=ZZ(Y,Z);return Z+=8,{srid:_,point:[z,O]}}throw Error("Unsupported geometry type")}var C8=class extends K{static[J]="PgGeometryBuilder";constructor(X,Y){super(X,"array geometry","PgGeometry");this.config.srid=Y}build(X){return new q8(X,this.config)}},q8=class extends V{static[J]="PgGeometry";srid=this.config.srid;mode="tuple";getSQLType(){return`geometry(point${this.srid===void 0?"":`,${this.srid}`})`}mapFromDriverValue(X){if(typeof X!=="string")return X;return yX(X).point}mapToDriverValue(X){return`point(${X[0]} ${X[1]})`}},v8=class extends K{static[J]="PgGeometryObjectBuilder";constructor(X,Y){super(X,"object geometry","PgGeometryObject");this.config.srid=Y}build(X){return new h8(X,this.config)}},h8=class extends V{static[J]="PgGeometryObject";srid=this.config.srid;mode="object";getSQLType(){return`geometry(point${this.srid===void 0?"":`,${this.srid}`})`}mapFromDriverValue(X){let Y=yX(X);return{x:Y.point[0],y:Y.point[1]}}mapToDriverValue(X){return`point(${X.x} ${X.y})`}};function $Z(X,Y){let{name:Z,config:$}=k(X,Y);if(!$?.mode||$.mode==="tuple")return new C8(Z,$?.srid);return new v8(Z,$?.srid)}var p8=class extends K{static[J]="PgRealBuilder";constructor(X,Y){super(X,"number float","PgReal");this.config.length=Y}build(X){return new y8(X,this.config)}},y8=class extends V{static[J]="PgReal";constructor(X,Y){super(X,Y)}getSQLType(){return"real"}mapFromDriverValue(X){if(typeof X==="string")return Number.parseFloat(X);return X}};function GZ(X){return new p8(X??"")}var f8=class extends K{static[J]="PgSerialBuilder";constructor(X){super(X,"number int32","PgSerial");this.config.hasDefault=!0,this.config.notNull=!0}build(X){return new b8(X,this.config)}},b8=class extends V{static[J]="PgSerial";getSQLType(){return"serial"}};function WZ(X){return new f8(X??"")}var d8=class extends O1{static[J]="PgSmallIntBuilder";constructor(X){super(X,"number int16","PgSmallInt")}build(X){return new g8(X,this.config)}},g8=class extends V{static[J]="PgSmallInt";getSQLType(){return"smallint"}mapFromDriverValue(X){if(typeof X==="string")return Number(X);return X}};function JZ(X){return new d8(X??"")}var m8=class extends K{static[J]="PgSmallSerialBuilder";constructor(X){super(X,"number int16","PgSmallSerial");this.config.hasDefault=!0,this.config.notNull=!0}build(X){return new c8(X,this.config)}},c8=class extends V{static[J]="PgSmallSerial";getSQLType(){return"smallserial"}};function HZ(X){return new m8(X??"")}var u8=class extends K{static[J]="PgTextBuilder";constructor(X,Y){super(X,Y.enum?.length?"string enum":"string","PgText");this.config.enumValues=Y.enum}build(X){return new r8(X,this.config,this.config.enumValues)}},r8=class extends V{static[J]="PgText";enumValues;constructor(X,Y,Z){super(X,Y);this.enumValues=Z}getSQLType(){return"text"}};function _Z(X,Y={}){let{name:Z,config:$}=k(X,Y);return new u8(Z,$)}var o8=class extends F1{static[J]="PgTimeBuilder";constructor(X,Y,Z){super(X,"string time","PgTime");this.withTimezone=Y,this.precision=Z,this.config.withTimezone=Y,this.config.precision=Z}build(X){return new s8(X,this.config)}},s8=class extends V{static[J]="PgTime";withTimezone;precision;constructor(X,Y){super(X,Y);this.withTimezone=Y.withTimezone,this.precision=Y.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}};function zZ(X,Y={}){let{name:Z,config:$}=k(X,Y);return new o8(Z,$.withTimezone??!1,$.precision)}var t8=class extends F1{static[J]="PgTimestampBuilder";constructor(X,Y,Z){super(X,"object date","PgTimestamp");this.config.withTimezone=Y,this.config.precision=Z}build(X){return new n8(X,this.config)}},n8=class extends V{static[J]="PgTimestamp";withTimezone;precision;constructor(X,Y){super(X,Y);this.withTimezone=Y.withTimezone,this.precision=Y.precision}getSQLType(){return`timestamp${this.precision===void 0?"":` (${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue(X){if(typeof X==="string")return new Date(this.withTimezone?X:X+"+0000");return X}mapToDriverValue(X){if(typeof X==="string")return X;return X.toISOString()}},i8=class extends F1{static[J]="PgTimestampStringBuilder";constructor(X,Y,Z){super(X,"string timestamp","PgTimestampString");this.config.withTimezone=Y,this.config.precision=Z}build(X){return new l8(X,this.config)}},l8=class extends V{static[J]="PgTimestampString";withTimezone;precision;constructor(X,Y){super(X,Y);this.withTimezone=Y.withTimezone,this.precision=Y.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue(X){if(typeof X==="string")return X;let Y=X.toISOString().slice(0,-1).replace("T"," ");if(this.withTimezone)return`${Y}+00`;return Y}mapToDriverValue(X){if(typeof X==="string")return X;return X.toISOString()}};function EZ(X,Y={}){let{name:Z,config:$}=k(X,Y);if($?.mode==="string")return new i8(Z,$.withTimezone??!1,$.precision);return new t8(Z,$?.withTimezone??!1,$?.precision)}var a8=class extends K{static[J]="PgUUIDBuilder";constructor(X){super(X,"string uuid","PgUUID")}defaultRandom(){return this.default(W`gen_random_uuid()`)}build(X){return new e8(X,this.config)}},e8=class extends V{static[J]="PgUUID";getSQLType(){return"uuid"}};function DZ(X){return new a8(X??"")}var X2=class extends K{static[J]="PgVarcharBuilder";constructor(X,Y){super(X,Y.enum?.length?"string enum":"string","PgVarchar");this.config.length=Y.length,this.config.enumValues=Y.enum}build(X){return new Y2(X,this.config)}},Y2=class extends V{static[J]="PgVarchar";enumValues;constructor(X,Y){super(X,Y);this.enumValues=Y.enumValues}getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}};function OZ(X,Y={}){let{name:Z,config:$}=k(X,Y);return new X2(Z,$)}var Z2=class extends K{static[J]="PgBinaryVectorBuilder";constructor(X,Y){super(X,"string binary","PgBinaryVector");this.config.length=Y.dimensions,this.config.isLengthExact=!0}build(X){return new $2(X,this.config)}},$2=class extends V{static[J]="PgBinaryVector";getSQLType(){return`bit(${this.length})`}};function FZ(X,Y){let{name:Z,config:$}=k(X,Y);return new Z2(Z,$)}var G2=class extends K{static[J]="PgHalfVectorBuilder";constructor(X,Y){super(X,"array halfvector","PgHalfVector");this.config.length=Y.dimensions,this.config.isLengthExact=!0}build(X){return new W2(X,this.config)}},W2=class extends V{static[J]="PgHalfVector";getSQLType(){return`halfvec(${this.length})`}mapToDriverValue(X){return JSON.stringify(X)}mapFromDriverValue(X){return X.slice(1,-1).split(",").map((Y)=>Number.parseFloat(Y))}};function UZ(X,Y){let{name:Z,config:$}=k(X,Y);return new G2(Z,$)}var J2=class extends K{static[J]="PgSparseVectorBuilder";constructor(X,Y){super(X,"string sparsevec","PgSparseVector");this.config.vectorDimensions=Y.dimensions}build(X){return new H2(X,this.config)}},H2=class extends V{static[J]="PgSparseVector";vectorDimensions=this.config.vectorDimensions;getSQLType(){return`sparsevec(${this.vectorDimensions})`}};function AZ(X,Y){let{name:Z,config:$}=k(X,Y);return new J2(Z,$)}var _2=class extends K{static[J]="PgVectorBuilder";constructor(X,Y){super(X,"array vector","PgVector");this.config.length=Y.dimensions,this.config.isLengthExact=!0}build(X){return new z2(X,this.config)}},z2=class extends V{static[J]="PgVector";getSQLType(){return`vector(${this.length})`}mapToDriverValue(X){return JSON.stringify(X)}mapFromDriverValue(X){return X.slice(1,-1).split(",").map((Y)=>Number.parseFloat(Y))}};function VZ(X,Y){let{name:Z,config:$}=k(X,Y);return new _2(Z,$)}function IZ(){return{bigint:fY,bigserial:bY,boolean:dY,char:gY,cidr:mY,customType:cY,date:uY,doublePrecision:rY,inet:oY,integer:sY,interval:tY,json:nY,jsonb:iY,line:lY,macaddr:aY,macaddr8:eY,numeric:XZ,point:YZ,geometry:$Z,real:GZ,serial:WZ,smallint:JZ,smallserial:HZ,text:_Z,time:zZ,timestamp:EZ,uuid:DZ,varchar:OZ,bit:FZ,halfvec:UZ,sparsevec:AZ,vector:VZ}}var fX=Symbol.for("drizzle:PgInlineForeignKeys"),bX=Symbol.for("drizzle:EnableRLS"),l1=class extends A{static[J]="PgTable";static Symbol=Object.assign({},A.Symbol,{InlineForeignKeys:fX,EnableRLS:bX});[fX]=[];[bX]=!1;[A.Symbol.ExtraConfigBuilder]=void 0;[A.Symbol.ExtraConfigColumns]={}};function MZ(X,Y,Z,$,G=X){let H=new l1(X,$,G),_=typeof Y==="function"?Y(IZ()):Y,z=Object.fromEntries(Object.entries(_).map(([U,F])=>{let M=F;M.setName(U);let I=M.build(H);return H[fX].push(...M.buildForeignKeys(I,H)),[U,I]})),O=Object.fromEntries(Object.entries(_).map(([U,F])=>{let M=F;return M.setName(U),[U,M.buildExtraConfigColumn(H)]})),E=Object.assign(H,z);if(E[A.Symbol.Columns]=z,E[A.Symbol.ExtraConfigColumns]=O,Z)E[l1.Symbol.ExtraConfigBuilder]=Z;return Object.assign(E,{enableRLS:()=>{return E[l1.Symbol.EnableRLS]=!0,E}})}var E2=(X,Y,Z)=>{return MZ(X,Y,Z,void 0)},D2=(X,Y,Z)=>{let $=MZ(X,Y,Z,void 0);return $[bX]=!0,$},GG=Object.assign(E2,{withRLS:D2});var xZ=class{static[J]="PgPrimaryKeyBuilder";columns;name;constructor(X,Y){this.columns=X,this.name=Y}build(X){return new O2(X,this.columns,this.name)}},O2=class{static[J]="PgPrimaryKey";columns;name;isNameExplicit;constructor(X,Y,Z){this.table=X,this.columns=Y,this.name=Z,this.isNameExplicit=!!Z}getName(){return this.name??`${this.table[l1.Symbol.Name]}_${this.columns.map((X)=>X.name).join("_")}_pk`}};var KZ=class{static[J]="Relation";referencedTableName;fieldName;constructor(X,Y,Z){this.sourceTable=X,this.referencedTable=Y,this.relationName=Z,this.referencedTableName=Y[A.Symbol.Name]}},F2=class{static[J]="Relations";constructor(X,Y){this.table=X,this.config=Y}},R1=class X extends KZ{static[J]="One";constructor(Y,Z,$,G){super(Y,Z,$?.relationName);this.config=$,this.isNullable=G}withFieldName(Y){let Z=new X(this.sourceTable,this.referencedTable,this.config,this.isNullable);return Z.fieldName=Y,Z}},dX=class X extends KZ{static[J]="Many";constructor(Y,Z,$){super(Y,Z,$?.relationName);this.config=$}withFieldName(Y){let Z=new X(this.sourceTable,this.referencedTable,this.config);return Z.fieldName=Y,Z}};function kZ(){return{and:m,between:u1,eq:a,exists:k1,gt:p1,gte:y1,ilike:t1,inArray:d1,isNull:m1,isNotNull:c1,like:o1,lt:f1,lte:b1,ne:h1,not:I1,notBetween:r1,notExists:N1,notLike:s1,notIlike:n1,notInArray:g1,or:V1,sql:W}}function NZ(){return{sql:W,asc:M1,desc:i1}}function RZ(X,Y){if(Object.keys(X).length===1&&"default"in X&&!D(X.default,A))X=X.default;let Z={},$={},G={};for(let[H,_]of Object.entries(X))if(D(_,A)){let z=A1(_),O=$[z];Z[z]=H,G[H]={tsName:H,dbName:_[A.Symbol.Name],schema:_[A.Symbol.Schema],columns:_[A.Symbol.Columns],relations:O?.relations??{},primaryKey:O?.primaryKey??[]};for(let U of Object.values(_[A.Symbol.Columns]))if(U.primary)G[H].primaryKey.push(U);let E=_[A.Symbol.ExtraConfigBuilder]?.(_[A.Symbol.ExtraConfigColumns]);if(E){for(let U of Object.values(E))if(D(U,xZ))G[H].primaryKey.push(...U.columns)}}else if(D(_,F2)){let z=A1(_.table),O=Z[z],E=_.config(Y(_.table));for(let[U,F]of Object.entries(E))if(O){let M=G[O];M.relations[U]=F}else{if(!(z in $))$[z]={relations:{}};$[z].relations[U]=F}}return{tables:G,tableNamesMap:Z}}function U2(X){return function(Z,$){return new R1(X,Z,$,$?.fields.reduce((G,H)=>G&&H.notNull,!0)??!1)}}function A2(X){return function(Z,$){return new dX(X,Z,$)}}function wZ(X,Y,Z){if(D(Z,R1)&&Z.config)return{fields:Z.config.fields,references:Z.config.references};let $=Y[A1(Z.referencedTable)];if(!$)throw Error(`Table "${Z.referencedTable[A.Symbol.Name]}" not found in schema`);let G=X[$];if(!G)throw Error(`Table "${$}" not found in schema`);let H=Z.sourceTable,_=Y[A1(H)];if(!_)throw Error(`Table "${H[A.Symbol.Name]}" not found in schema`);let z=[];for(let O of Object.values(G.relations))if(Z.relationName&&Z!==O&&O.relationName===Z.relationName||!Z.relationName&&O.referencedTable===Z.sourceTable)z.push(O);if(z.length>1)throw Z.relationName?Error(`There are multiple relations with name "${Z.relationName}" in table "${$}"`):Error(`There are multiple relations between "${$}" and "${Z.sourceTable[A.Symbol.Name]}". Please specify relation name`);if(z[0]&&D(z[0],R1)&&z[0].config)return{fields:z[0].config.references,references:z[0].config.fields};throw Error(`There is not enough information to infer relation "${_}.${Z.fieldName}"`)}function QZ(X){return{one:U2(X),many:A2(X)}}function OX(X,Y,Z,$,G=(H)=>H){let H={};for(let[_,z]of $.entries())if(z.isJson){let O=Y.relations[z.tsKey],E=Z[_],U=typeof E==="string"?JSON.parse(E):E;H[z.tsKey]=D(O,R1)?U&&OX(X,X[z.relationTableTsKey],U,z.selection,G):U.map((F)=>OX(X,X[z.relationTableTsKey],F,z.selection,G))}else{let O=G(Z[_]),E=z.field,U;if(D(E,N))U=E;else if(D(E,x))U=E.decoder;else U=E.sql.decoder;H[z.tsKey]=O===null?null:U.mapFromDriverValue(O)}return H}var c=class{static[J]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(X){return this.then(void 0,X)}finally(X){return this.then((Y)=>{return X?.(),Y},(Y)=>{throw X?.(),Y})}then(X,Y){return this.execute().then(X,Y)}};var LZ=class{static[J]="SQLiteAsyncRelationalQueryBuilder";constructor(X,Y,Z,$,G,H,_,z){this.mode=X,this.fullSchema=Y,this.schema=Z,this.tableNamesMap=$,this.table=G,this.tableConfig=H,this.dialect=_,this.session=z}findMany(X){return this.mode==="sync"?new PZ(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,X?X:{},"many"):new mX(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,X?X:{},"many")}findFirst(X){return this.mode==="sync"?new PZ(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,X?{...X,limit:1}:{limit:1},"first"):new mX(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,X?{...X,limit:1}:{limit:1},"first")}},mX=class extends c{static[J]="SQLiteAsyncRelationalQuery";mode;constructor(X,Y,Z,$,G,H,_,z,O){super();this.fullSchema=X,this.schema=Y,this.tableNamesMap=Z,this.table=$,this.tableConfig=G,this.dialect=H,this.session=_,this.config=z,this.mode=O}getSQL(){return this.dialect._buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}).sql}_prepare(X=!1){let{query:Y,builtQuery:Z}=this._toSQL();return this.session[X?"prepareOneTimeQuery":"prepareQuery"](Z,void 0,this.mode==="first"?"get":"all",!0,($,G)=>{let H=$.map((_)=>OX(this.schema,this.tableConfig,_,Y.selection,G));if(this.mode==="first")return H[0];return H})}prepare(){return this._prepare(!1)}_toSQL(){let X=this.dialect._buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName});return{query:X,builtQuery:this.dialect.sqlToQuery(X.sql)}}toSQL(){return this._toSQL().builtQuery}executeRaw(){if(this.mode==="first")return this._prepare(!1).get();return this._prepare(!1).all()}async execute(){return this.executeRaw()}},PZ=class extends mX{static[J]="SQLiteSyncRelationalQuery";sync(){return this.executeRaw()}};var BZ=class X extends x{sql;static[J]="SQLiteCountBuilderAsync";[Symbol.toStringTag]="SQLiteCountBuilderAsync";session;static buildEmbeddedCount(Y,Z){return W`(select count(*) from ${Y}${W.raw(" where ").if(Z)}${Z})`}static buildCount(Y,Z){return W`select count(*) from ${Y}${W.raw(" where ").if(Z)}${Z}`}constructor(Y){super(X.buildEmbeddedCount(Y.source,Y.filters).queryChunks);this.params=Y,this.session=Y.session,this.sql=X.buildCount(Y.source,Y.filters)}then(Y,Z){return Promise.resolve(this.session.count(this.sql)).then(Y,Z)}catch(Y){return this.then(void 0,Y)}finally(Y){return this.then((Z)=>{return Y?.(),Z},(Z)=>{throw Y?.(),Z})}};var w1=class{static[J]="ColumnTableAliasProxyHandler";constructor(X,Y){this.table=X,this.ignoreColumnAlias=Y}get(X,Y){if(Y==="table")return this.table;if(Y==="isAlias"&&this.ignoreColumnAlias)return!1;return X[Y]}},jZ=class{static[J]="ViewSelectionAliasProxyHandler";constructor(X,Y,Z){this.view=X,this.selection=Y,this.ignoreColumnAlias=Z}get(X,Y){let Z=X[Y];if(D(Z,N))return new Proxy(Z,new w1(this.view,this.ignoreColumnAlias));if(D(Z,T)||D(Z,x)||D(Z,x.Aliased)||E1(Z)||typeof Z!=="object"||Z===null)return Z;return new Proxy(Z,this)}},FX=class{static[J]="TableAliasProxyHandler";constructor(X,Y,Z){this.alias=X,this.replaceOriginalName=Y,this.ignoreColumnAlias=Z}get(X,Y){if(Y===A.Symbol.IsAlias)return!0;if(Y===A.Symbol.Name)return this.alias;if(this.replaceOriginalName&&Y===A.Symbol.OriginalName)return this.alias;if(Y===Q)return{...X[Q],name:this.alias,isAlias:!0,selectedFields:new Proxy(X[Q].selectedFields,new jZ(new Proxy(X,this),X[Q].selectedFields,this.ignoreColumnAlias))};if(Y===A.Symbol.Columns){let $=X[A.Symbol.Columns];if(!$)return $;if(D(X,y))return new Proxy(X[A.Symbol.Columns],new jZ(new Proxy(X,this),X[A.Symbol.Columns],this.ignoreColumnAlias));let G={};return Object.keys($).map((H)=>{G[H]=new Proxy($[H],new w1(new Proxy(X,this),this.ignoreColumnAlias))}),G}let Z=X[Y];if(D(Z,N))return new Proxy(Z,new w1(new Proxy(X,this),this.ignoreColumnAlias));return Z}},V2=class{static[J]="ColumnAliasProxyHandler";constructor(X){this.alias=X}get(X,Y){if(Y==="isAlias")return!0;if(Y==="name")return this.alias;if(Y==="keyAsName")return!1;if(Y===T1)return()=>X;return X[Y]}};function Y1(X,Y){return new Proxy(X,new FX(Y,!1,!1))}function I2(X,Y){return new Proxy(X,new V2(Y))}function Z1(X,Y){return new Proxy(X,new w1(new Proxy(X.table,new FX(Y,!1,!1)),!1))}function cX(X,Y){return new x.Aliased(a1(X.sql,Y),X.fieldAlias)}function a1(X,Y){return W.join(X.queryChunks.map((Z)=>{if(D(Z,N))return Z1(Z,Y);if(D(Z,x))return a1(Z,Y);if(D(Z,x.Aliased))return cX(Z,Y);return Z}))}N.prototype.as=function(X){return I2(this,X)};function e1(X){return X[T1]()}var W1=class extends Error{static[J]="DrizzleError";constructor({message:X,cause:Y}){super(X);this.name="DrizzleError",this.cause=Y}},x1=class X extends Error{static[J]="DrizzleQueryError";constructor(Y,Z,$){super(`Failed query: ${Y}
3
- params: ${Z}`);if(this.query=Y,this.params=Z,this.cause=$,Error.captureStackTrace(this,X),$)this.cause=$}},TZ=class extends W1{static[J]="TransactionRollbackError";constructor(){super({message:"Rollback"})}};var M2=class{static[J]="RelationV2";fieldName;sourceColumns;targetColumns;alias;where;sourceTable;targetTable;through;throughTable;isReversed;sourceColumnTableNames=[];targetColumnTableNames=[];constructor(X,Y){this.targetTableName=Y,this.targetTable=X}},SZ=class extends M2{static[J]="OneV2";relationType="one";optional;constructor(X,Y,Z,$){super(Y,Z);if(this.alias=$?.alias,this.where=$?.where,$?.from)this.sourceColumns=(Array.isArray($.from)?$.from:[$.from]).map((G)=>{return this.throughTable??=G._.through?X[G._.through._.tableName]:void 0,this.sourceColumnTableNames.push(G._.tableName),G._.column});if($?.to)this.targetColumns=(Array.isArray($.to)?$.to:[$.to]).map((G)=>{return this.throughTable??=G._.through?X[G._.through._.tableName]:void 0,this.targetColumnTableNames.push(G._.tableName),G._.column});if(this.throughTable)this.through={source:(Array.isArray($?.from)?$.from:($?.from)?[$.from]:[]).map((G)=>G._.through),target:(Array.isArray($?.to)?$.to:($?.to)?[$.to]:[]).map((G)=>G._.through)};this.optional=$?.optional??!0}};var Q1={and:m,between:u1,eq:a,exists:k1,gt:p1,gte:y1,ilike:t1,inArray:d1,arrayContains:qX,arrayContained:vX,arrayOverlaps:hX,isNull:m1,isNotNull:c1,like:o1,lt:f1,lte:b1,ne:h1,not:I1,notBetween:r1,notExists:N1,notLike:s1,notIlike:n1,notInArray:g1,or:V1,sql:W},x2={sql:W,asc:M1,desc:i1};function AX(X,Y,Z=(_)=>_,$=!1,G=!1,H){for(let _ of Y){if(_.selection){let U=`${H?`${H}.`:""}${_.key}`;if(X[_.key]===null)continue;if($){if(X[_.key]=JSON.parse(X[_.key]),X[_.key]===null)continue}if(G&&typeof X[_.key]==="string")X[_.key]=JSON.parse(X[_.key]);if(_.isArray){for(let F of X[_.key])AX(F,_.selection,Z,!1,G,U);continue}AX(X[_.key],_.selection,Z,!1,G,U);continue}let z=_.field,O=Z(X[_.key]);if(O===null)continue;let E;if(D(z,N))E=z;else if(D(z,x))E=z.decoder;else if(D(z,x.Aliased))E=z.sql.decoder;else if(D(z,A)||D(z,y))E=C1;else E=z.getSQL().decoder;X[_.key]="mapFromJsonValue"in E?E.mapFromJsonValue(O):E.mapFromDriverValue(O)}return X}function CZ(X,Y){let Z=X[n][Y];return Z?D(Z,N)?Z:D(Z,x.Aliased)?W`${X}.${W.identifier(Z.fieldAlias)}`:W`${X}.${W.identifier(Y)}`:W`${X}.${W.identifier(Y)}`}function UX(X,Y){if(typeof Y!=="object"||D(Y,l))return a(X,Y);let Z=Object.entries(Y);if(!Z.length)return;let $=[];for(let[G,H]of Z){if(H===void 0)continue;switch(G){case"NOT":{let _=UX(X,H);if(!_)continue;$.push(I1(_));continue}case"OR":if(!H.length)continue;$.push(V1(...H.map((_)=>UX(X,_))));continue;case"AND":if(!H.length)continue;$.push(m(...H.map((_)=>UX(X,_))));continue;case"isNotNull":case"isNull":if(!H)continue;$.push(Q1[G](X));continue;case"in":$.push(Q1.inArray(X,H));continue;case"notIn":$.push(Q1.notInArray(X,H));continue;default:$.push(Q1[G](X,H));continue}}if(!$.length)return;return m(...$)}function J1(X,Y,Z={},$={},G,H=0){let _=Object.entries(Y);if(!_.length)return;let z=[];for(let[O,E]of _){if(E===void 0)continue;switch(O){case"RAW":{let U=typeof E==="function"?E(X,Q1):E.getSQL();z.push(U);continue}case"OR":if(!E?.length)continue;z.push(V1(...E.map((U)=>J1(X,U,Z,$,G,H))));continue;case"AND":if(!E?.length)continue;z.push(m(...E.map((U)=>J1(X,U,Z,$,G,H))));continue;case"NOT":{if(E===void 0)continue;let U=J1(X,E,Z,$,G,H);if(!U)continue;z.push(I1(U));continue}default:{if(X[n][O]){let R=UX(CZ(X,O),E);if(R)z.push(R);continue}let U=Z[O];if(!U)throw new W1({message:`Unknown relational filter field: "${O}"`});let F=Y1(U.targetTable,`f${H}`),M=U.throughTable?Y1(U.throughTable,`ft${H}`):void 0,I=$[U.targetTableName],{filter:L,joinCondition:P}=uX(G,U,X,F,M),B=m(L,typeof E==="boolean"?void 0:J1(F,E,I.relations,$,G,H+1)),d=M?W`(select * from ${P1(F)} inner join ${P1(M)} on ${P}${W` where ${B}`.if(B)} limit 1)`:W`(select * from ${P1(F)}${W` where ${B}`.if(B)} limit 1)`;if(B)z.push((E?k1:N1)(d))}}}return m(...z)}function qZ(X,Y){if(typeof Y==="function"){let $=Y(X,x2);return D($,x)?$:Array.isArray($)?$.length?W.join($.map((G)=>D(G,x)?G:M1(G)),W`, `):void 0:D($,N)?M1($):void 0}let Z=Object.entries(Y).filter(([$,G])=>G);if(!Z.length)return;return W.join(Z.map(([$,G])=>(G==="asc"?M1:i1)(CZ(X,$))),W`, `)}function vZ(X,Y){let Z=[],$=[];for(let[G,H]of Object.entries(Y)){if(!H)continue;let _=typeof H==="function"?H(X,{sql:Q1.sql}):H,z=W`(${_.getSQL()}) as ${W.identifier(G)}`;z.decoder=_.getSQL().decoder,Z.push(z),$.push({key:G,field:z})}return{sql:Z.length?W.join(Z,W`, `):void 0,selection:$}}function uX(X,Y,Z,$,G){if(Y.through){let H=Y.sourceColumns.map((z,O)=>{let E=Y.through.source[O];return a(W`${Z}.${W.identifier(X.getColumnCasing(z))}`,W`${G}.${W.identifier(D(E._.column,N)?X.getColumnCasing(E._.column):E._.key)}`)}),_=Y.targetColumns.map((z,O)=>{let E=Y.through.target[O];return a(W`${G}.${W.identifier(D(E._.column,N)?X.getColumnCasing(E._.column):E._.key)}`,W`${$}.${W.identifier(X.getColumnCasing(z))}`)});return{filter:m(Y.where?J1(Y.isReversed?Z:$,Y.where):void 0,...H),joinCondition:m(..._)}}return{filter:m(...Y.sourceColumns.map((H,_)=>{let z=Y.targetColumns[_];return a(W`${Z}.${W.identifier(X.getColumnCasing(H))}`,W`${$}.${W.identifier(X.getColumnCasing(z))}`)}),Y.where?J1(Y.isReversed?Z:$,Y.where):void 0)}}function P1(X){return W`${X[_1]?W`${W`${W.identifier(X[G1]??"")}.`.if(X[G1])}${W.identifier(X[U1])} as ${X}`:X}`}var pZ=class{static[J]="SQLiteAsyncRelationalQueryBuilderV2";constructor(X,Y,Z,$,G,H,_,z){this.mode=X,this.schema=Y,this.table=Z,this.tableConfig=$,this.dialect=G,this.session=H,this.rowMode=_,this.forbidJsonb=z}findMany(X){return this.mode==="sync"?new hZ(this.schema,this.table,this.tableConfig,this.dialect,this.session,X??!0,"many",this.rowMode,this.forbidJsonb):new rX(this.schema,this.table,this.tableConfig,this.dialect,this.session,X??!0,"many",this.rowMode,this.forbidJsonb)}findFirst(X){return this.mode==="sync"?new hZ(this.schema,this.table,this.tableConfig,this.dialect,this.session,X??!0,"first",this.rowMode,this.forbidJsonb):new rX(this.schema,this.table,this.tableConfig,this.dialect,this.session,X??!0,"first",this.rowMode,this.forbidJsonb)}},rX=class extends c{static[J]="SQLiteAsyncRelationalQueryV2";mode;table;constructor(X,Y,Z,$,G,H,_,z,O){super();this.schema=X,this.tableConfig=Z,this.dialect=$,this.session=G,this.config=H,this.rowMode=z,this.forbidJsonb=O,this.mode=_,this.table=Y}getSQL(){return this.dialect.buildRelationalQuery({schema:this.schema,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,mode:this.mode,jsonb:this.forbidJsonb?W`json`:W`jsonb`}).sql}_prepare(X=!0){let{query:Y,builtQuery:Z}=this._toSQL();return this.session[X?"prepareOneTimeRelationalQuery":"prepareRelationalQuery"](Z,void 0,this.mode==="first"?"get":"all",($,G)=>{let H=$.map((_)=>AX(_,Y.selection,G,!this.rowMode));if(this.mode==="first")return H[0];return H})}prepare(){return this._prepare(!1)}_getQuery(){let X=this.forbidJsonb?W`json`:W`jsonb`,Y=this.dialect.buildRelationalQuery({schema:this.schema,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,mode:this.mode,isNested:this.rowMode,jsonb:X});if(this.rowMode)Y.sql=W`select json_object(${W.join(Y.selection.map((Z)=>{return W`${W.raw(this.dialect.escapeString(Z.key))}, ${Z.selection?W`${X}(${W.identifier(Z.key)})`:W.identifier(Z.key)}`}),W`, `)}) as ${W.identifier("r")} from (${Y.sql}) as ${W.identifier("t")}`;return Y}_toSQL(){let X=this._getQuery();return{query:X,builtQuery:this.dialect.sqlToQuery(X.sql)}}toSQL(){return this._toSQL().builtQuery}executeRaw(){if(this.mode==="first")return this._prepare().get();return this._prepare().all()}async execute(){return this.executeRaw()}},hZ=class extends rX{static[J]="SQLiteSyncRelationalQueryV2";sync(){return this.executeRaw()}};var XX=class extends c{static[J]="SQLiteRaw";config;constructor(X,Y,Z,$,G){super();this.execute=X,this.getSQL=Y,this.dialect=$,this.mapBatchResult=G,this.config={action:Z}}getQuery(){return{...this.dialect.sqlToQuery(this.getSQL()),method:this.config.action}}mapResult(X,Y){return Y?this.mapBatchResult(X):X}_prepare(){return this}isResponseInArrayMode(){return!1}};var b=class X{static[J]="SelectionProxyHandler";config;constructor(Y){this.config={...Y}}get(Y,Z){if(Z==="_")return{...Y._,selectedFields:new Proxy(Y._.selectedFields,this)};if(Z===Q)return{...Y[Q],selectedFields:new Proxy(Y[Q].selectedFields,this)};if(typeof Z==="symbol")return Y[Z];let $=(D(Y,T)?Y._.selectedFields:D(Y,y)?Y[Q].selectedFields:Y)[Z];if(D($,x.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!$.isSelectionField)return $.sql;let G=$.clone();return G.isSelectionField=!0,G.origin=this.config.alias,G}if(D($,x)){if(this.config.sqlBehavior==="sql")return $;throw Error(`You tried to reference "${Z}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}if(D($,N)){if(this.config.alias)return new Proxy($,new w1(new Proxy($.table,new FX(this.config.alias,this.config.replaceOriginalName??!1,!0)),!0));return $}if(typeof $!=="object"||$===null)return $;return new Proxy($,new X(this.config))}};function e(X){if(D(X,v))return[`${X[A.Symbol.BaseName]}`];if(D(X,T))return X._.usedTables??[];if(D(X,x))return X.usedTables??[];return[]}var VX=class extends c{static[J]="SQLiteDelete";config;constructor(X,Y,Z,$){super();this.table=X,this.session=Y,this.dialect=Z,this.config={table:X,withList:$}}where(X){return this.config.where=X,this}orderBy(...X){if(typeof X[0]==="function"){let Y=X[0](new Proxy(this.config.table[A.Symbol.Columns],new b({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),Z=Array.isArray(Y)?Y:[Y];this.config.orderBy=Z}else{let Y=X;this.config.orderBy=Y}return this}limit(X){return this.config.limit=X,this}returning(X=this.table[v.Symbol.Columns]){return this.config.returning=i(X),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:X,...Y}=this.dialect.sqlToQuery(this.getSQL());return Y}_prepare(X=!0){return this.session[X?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"delete",tables:e(this.config.table)})}prepare(){return this._prepare(!1)}run=(X)=>{return this._prepare().run(X)};all=(X)=>{return this._prepare().all(X)};get=(X)=>{return this._prepare().get(X)};values=(X)=>{return this._prepare().values(X)};async execute(X){return this._prepare().execute(X)}$dynamic(){return this}};var L1=class extends y{static[J]="SQLiteViewBase"};var yZ=class{static[J]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}};var X1=class{static[J]="SQLiteSelectBuilder";fields;session;dialect;withList;distinct;constructor(X){this.fields=X.fields,this.session=X.session,this.dialect=X.dialect,this.withList=X.withList,this.distinct=X.distinct}from(X){let Y=!!this.fields,Z;if(this.fields)Z=this.fields;else if(D(X,T))Z=Object.fromEntries(Object.keys(X._.selectedFields).map(($)=>[$,X[$]]));else if(D(X,L1))Z=X[Q].selectedFields;else if(D(X,x))Z={};else Z=EY(X);return new oX({table:X,fields:Z,isPartialSelect:Y,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct})}},fZ=class extends yZ{static[J]="SQLiteSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:X,fields:Y,isPartialSelect:Z,session:$,dialect:G,withList:H,distinct:_}){super();this.config={withList:H,table:X,fields:{...Y},distinct:_,setOperators:[]},this.isPartialSelect=Z,this.session=$,this.dialect=G,this._={selectedFields:Y,config:this.config},this.tableName=v1(X),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{};for(let z of e(X))this.usedTables.add(z)}getUsedTables(){return[...this.usedTables]}createJoin(X){return(Y,Z)=>{let $=this.tableName,G=v1(Y);for(let H of e(Y))this.usedTables.add(H);if(typeof G==="string"&&this.config.joins?.some((H)=>H.alias===G))throw Error(`Alias "${G}" is already used in this query`);if(!this.isPartialSelect){if(Object.keys(this.joinsNotNullableMap).length===1&&typeof $==="string")this.config.fields={[$]:this.config.fields};if(typeof G==="string"&&!D(Y,x)){let H=D(Y,T)?Y._.selectedFields:D(Y,y)?Y[Q].selectedFields:Y[A.Symbol.Columns];this.config.fields[G]=H}}if(typeof Z==="function")Z=Z(new Proxy(this.config.fields,new b({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));if(!this.config.joins)this.config.joins=[];if(this.config.joins.push({on:Z,table:Y,joinType:X,alias:G}),typeof G==="string")switch(X){case"left":this.joinsNotNullableMap[G]=!1;break;case"right":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([H])=>[H,!1])),this.joinsNotNullableMap[G]=!0;break;case"cross":case"inner":this.joinsNotNullableMap[G]=!0;break;case"full":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([H])=>[H,!1])),this.joinsNotNullableMap[G]=!1;break}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");crossJoin=this.createJoin("cross");createSetOperator(X,Y){return(Z)=>{let $=typeof Z==="function"?Z(K2()):Z;if(!q1(this.getSelectedFields(),$.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:X,isAll:Y,rightSelect:$}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);except=this.createSetOperator("except",!1);addSetOperators(X){return this.config.setOperators.push(...X),this}where(X){if(typeof X==="function")X=X(new Proxy(this.config.fields,new b({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.where=X,this}having(X){if(typeof X==="function")X=X(new Proxy(this.config.fields,new b({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.having=X,this}groupBy(...X){if(typeof X[0]==="function"){let Y=X[0](new Proxy(this.config.fields,new b({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(Y)?Y:[Y]}else this.config.groupBy=X;return this}orderBy(...X){if(typeof X[0]==="function"){let Y=X[0](new Proxy(this.config.fields,new b({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),Z=Array.isArray(Y)?Y:[Y];if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=Z;else this.config.orderBy=Z}else{let Y=X;if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=Y;else this.config.orderBy=Y}return this}limit(X){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).limit=X;else this.config.limit=X;return this}offset(X){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).offset=X;else this.config.offset=X;return this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:X,...Y}=this.dialect.sqlToQuery(this.getSQL());return Y}as(X){let Y=[];if(Y.push(...e(this.config.table)),this.config.joins)for(let Z of this.config.joins)Y.push(...e(Z.table));return new Proxy(new T(this.getSQL(),this.config.fields,X,!1,[...new Set(Y)]),new b({alias:X,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new b({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}},oX=class extends fZ{static[J]="SQLiteSelect";_prepare(X=!0){if(!this.session)throw Error("Cannot execute a query on a query builder. Please use a database instance instead.");let Y=i(this.config.fields),Z=this.session[X?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),Y,"all",!0,void 0,{type:"select",tables:[...this.usedTables]},this.cacheConfig);return Z.joinsNotNullableMap=this.joinsNotNullableMap,Z}$withCache(X){return this.cacheConfig=X===void 0?{config:{},enabled:!0,autoInvalidate:!0}:X===!1?{enabled:!1}:{enabled:!0,autoInvalidate:!0,...X},this}prepare(){return this._prepare(!1)}run=(X)=>{return this._prepare().run(X)};all=(X)=>{return this._prepare().all(X)};get=(X)=>{return this._prepare().get(X)};values=(X)=>{return this._prepare().values(X)};async execute(){return this.all()}};zY(oX,[c]);function IX(X,Y){return(Z,$,...G)=>{let H=[$,...G].map((_)=>({type:X,isAll:Y,rightSelect:_}));for(let _ of H)if(!q1(Z.getSelectedFields(),_.rightSelect.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return Z.addSetOperators(H)}}var K2=()=>({union:bZ,unionAll:dZ,intersect:gZ,except:mZ}),bZ=IX("union",!1),dZ=IX("union",!0),gZ=IX("intersect",!1),mZ=IX("except",!1);function _J(X){let Y=parseInt(X.slice(0,4),10),Z=parseInt(X.slice(4,6),10)-1,$=parseInt(X.slice(6,8),10),G=parseInt(X.slice(8,10),10),H=parseInt(X.slice(10,12),10),_=parseInt(X.slice(12,14),10);return Date.UTC(Y,Z,$,G,H,_)}function cZ(X){let{localMigrations:Y,dbMigrations:Z}=X,$=new Set(Z.map((G)=>G.name).filter((G)=>G!==null));return Y.filter((G)=>!G.name||!$.has(G.name))}var uZ=1;function k2(X){if(X.includes("name"))return 1;return 0}function sX(X,Y,Z=()=>[]){let $=X.all(Y);if($.length===0)return[];if(Array.isArray($[0]))return $.map((G)=>Z(G));return $}function rZ(X,Y,Z){if(sX(Y,W`SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ${X}`,(G)=>({"1":G[0]})).length===0)return{newDb:!0};let $=k2(sX(Y,W`SELECT name as column_name FROM pragma_table_info(${X})`,(G)=>({column_name:G[0]})).map((G)=>G.column_name));for(let G=$;G<uZ;G++){let H=N2[G];if(!H)throw Error(`No upgrade path from migration table version ${G} to ${G+1}`);H(X,Y,Z)}return{prevVersion:$,currentVersion:uZ}}var N2={0:(X,Y,Z)=>{let $=W`${W.identifier(X)}`,G=sX(Y,W`SELECT id, hash, created_at FROM ${$} ORDER BY id ASC`,(E)=>({id:E[0],hash:E[1],created_at:E[2]}));Z.sort((E,U)=>E.folderMillis!==U.folderMillis?E.folderMillis-U.folderMillis:(E.name??"").localeCompare(U.name??""));let H=new Map,_=new Map;for(let E of Z){if(!H.has(E.folderMillis))H.set(E.folderMillis,[]);H.get(E.folderMillis).push(E),_.set(E.hash,E)}let z=[],O=[];for(let E of G){let U=String(E.created_at),F=Number(U.substring(0,U.length-3)+"000"),M=H.get(F),I,L=null;if(M&&M.length===1)I=M[0],L="millis";else if(M&&M.length>1){if(I=M.find((P)=>P.hash&&E.hash&&P.hash===E.hash),I)L="hash"}else if(I=_.get(E.hash),I)L="hash";if(I)z.push({id:E.id,name:I.name,hash:E.hash,created_at:U,matchedBy:E.id?"id":L});else O.push(E)}if(O.length>0)throw Error(`While upgrading your database migrations table we found ${O.length} (${O.map((E)=>`[id: ${E.id}, created_at: ${E.created_at}]`).join(", ")}) migrations in the database that do not match any local migration. This means that some migrations were applied to the database but are missing from the local environment`);Y.transaction((E)=>{E.run(W`ALTER TABLE ${$} ADD COLUMN ${W.identifier("name")} text`),E.run(W`ALTER TABLE ${$} ADD COLUMN ${W.identifier("applied_at")} TEXT`);for(let U of z){let F=W`UPDATE ${$} SET ${W.identifier("name")} = ${U.name}, ${W.identifier("applied_at")} = NULL WHERE`;if(U.id)F.append(W` ${W.identifier("id")} = ${U.id}`);else if(U.matchedBy==="millis")F.append(W` ${W.identifier("created_at")} = ${U.created_at}`);else F.append(W` ${W.identifier("hash")} = ${U.hash}`);E.run(F)}})}};function R2(X){return(X.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map((Y)=>Y.toLowerCase()).join("_")}function w2(X){return(X.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((Y,Z,$)=>{return Y+($===0?Z.toLowerCase():`${Z[0].toUpperCase()}${Z.slice(1)}`)},"")}function Q2(X){return X}var oZ=class{static[J]="CasingCache";cache={};cachedTables={};convert;constructor(X){this.convert=X==="snake_case"?R2:X==="camelCase"?w2:Q2}getColumnCasing(X){if(!X.keyAsName)return X.name;let Y=`${X.table[A.Symbol.Schema]??"public"}.${X.table[A.Symbol.OriginalName]}.${X.name}`;if(!this.cache[Y])this.cacheTable(X.table);return this.cache[Y]}cacheTable(X){let Y=`${X[A.Symbol.Schema]??"public"}.${X[A.Symbol.OriginalName]}`;if(!this.cachedTables[Y]){for(let Z of Object.values(X[A.Symbol.Columns])){if(!D(Z,N))continue;let $=`${Y}.${Z.name}`;this.cache[$]=this.convert(Z.name)}this.cachedTables[Y]=!0}}clearCache(){this.cache={},this.cachedTables={}}};var MX=class{static[J]="SQLiteDialect";casing;constructor(X){this.casing=new oZ(X?.casing)}escapeName(X){return`"${X}"`}escapeParam(X){return"?"}escapeString(X){return`'${X.replace(/'/g,"''")}'`}buildWithCTE(X){if(!X?.length)return;let Y=[W`with `];for(let[Z,$]of X.entries())if(Y.push(W`${W.identifier($._.alias)} as (${$._.sql})`),Z<X.length-1)Y.push(W`, `);return Y.push(W` `),W.join(Y)}buildDeleteQuery({table:X,where:Y,returning:Z,withList:$,limit:G,orderBy:H}){let _=this.buildWithCTE($),z=Z?W` returning ${this.buildSelection(Z,{isSingleTable:!0})}`:void 0;return W`${_}delete from ${X}${Y?W` where ${Y}`:void 0}${z}${this.buildOrderBy(H)}${this.buildLimit(G)}`}buildUpdateSet(X,Y){let Z=X[A.Symbol.Columns],$=Object.keys(Z).filter((H)=>Y[H]!==void 0||Z[H]?.onUpdateFn!==void 0),G=$.length;return W.join($.flatMap((H,_)=>{let z=Z[H],O=z.onUpdateFn?.(),E=Y[H]??(D(O,x)?O:W.param(O,z)),U=W`${W.identifier(this.casing.getColumnCasing(z))} = ${E}`;if(_<G-1)return[U,W.raw(", ")];return[U]}))}buildUpdateQuery({table:X,set:Y,where:Z,returning:$,withList:G,joins:H,from:_,limit:z,orderBy:O}){let E=this.buildWithCTE(G),U=this.buildUpdateSet(X,Y),F=_&&W.join([W.raw(" from "),this.buildFromTable(_)]),M=this.buildJoins(H),I=$?W` returning ${this.buildSelection($,{isSingleTable:!0})}`:void 0;return W`${E}update ${X} set ${U}${F}${M}${Z?W` where ${Z}`:void 0}${I}${this.buildOrderBy(O)}${this.buildLimit(z)}`}buildSelection(X,{isSingleTable:Y=!1}={}){let Z=X.length,$=X.flatMap(({field:G},H)=>{let _=[];if(D(G,x.Aliased)&&G.isSelectionField){if(!Y&&G.origin!==void 0)_.push(W.identifier(G.origin),W.raw("."));_.push(W.identifier(G.fieldAlias))}else if(D(G,x.Aliased)||D(G,x)){let z=D(G,x.Aliased)?G.sql:G;if(Y){let O=new x(z.queryChunks.map((E)=>{if(D(E,N))return W.identifier(this.casing.getColumnCasing(E));return E}));_.push(z.shouldInlineParams?O.inlineParams():O)}else _.push(z);if(D(G,x.Aliased))_.push(W` as ${W.identifier(G.fieldAlias)}`)}else if(D(G,N))if(G.columnType==="SQLiteNumericBigInt")if(Y)_.push(G.isAlias?W`cast(${W.identifier(this.casing.getColumnCasing(e1(G)))} as text) as ${G}`:W`cast(${W.identifier(this.casing.getColumnCasing(G))} as text)`);else _.push(G.isAlias?W`cast(${e1(G)} as text) as ${G}`:W`cast(${G} as text)`);else if(Y)_.push(G.isAlias?W`${W.identifier(this.casing.getColumnCasing(e1(G)))} as ${G}`:W.identifier(this.casing.getColumnCasing(G)));else _.push(G.isAlias?W`${e1(G)} as ${G}`:G);else if(D(G,T)){let z=Object.entries(G._.selectedFields);if(z.length===1){let O=z[0][1],E=D(O,x)?O.decoder:D(O,N)?{mapFromDriverValue:(U)=>O.mapFromDriverValue(U)}:O.sql.decoder;if(E)G._.sql.decoder=E}_.push(G)}if(H<Z-1)_.push(W`, `);return _});return W.join($)}buildJoins(X){if(!X||X.length===0)return;let Y=[];if(X)for(let[Z,$]of X.entries()){if(Z===0)Y.push(W` `);let G=$.table,H=$.on?W` on ${$.on}`:void 0;if(D(G,v)){let _=G[v.Symbol.Name],z=G[v.Symbol.Schema],O=G[v.Symbol.OriginalName],E=_===O?void 0:$.alias;Y.push(W`${W.raw($.joinType)} join ${z?W`${W.identifier(z)}.`:void 0}${W.identifier(O)}${E&&W` ${W.identifier(E)}`}${H}`)}else Y.push(W`${W.raw($.joinType)} join ${G}${H}`);if(Z<X.length-1)Y.push(W` `)}return W.join(Y)}buildLimit(X){return typeof X==="object"||typeof X==="number"&&X>=0?W` limit ${X}`:void 0}buildOrderBy(X){let Y=[];if(X){for(let[Z,$]of X.entries())if(Y.push($),Z<X.length-1)Y.push(W`, `)}return Y.length>0?W` order by ${W.join(Y)}`:void 0}buildFromTable(X){if(D(X,A)&&X[A.Symbol.IsAlias])return W`${W`${W.identifier(X[A.Symbol.Schema]??"")}.`.if(X[A.Symbol.Schema])}${W.identifier(X[A.Symbol.OriginalName])} ${W.identifier(X[A.Symbol.Name])}`;if(D(X,y)&&X[Q].isAlias){let Y=W`${W.identifier(X[Q].originalName)}`;if(X[Q].schema)Y=W`${W.identifier(X[Q].schema)}.${Y}`;return W`${Y} ${W.identifier(X[Q].name)}`}return X}buildSelectQuery({withList:X,fields:Y,fieldsFlat:Z,where:$,having:G,table:H,joins:_,orderBy:z,groupBy:O,limit:E,offset:U,distinct:F,setOperators:M}){let I=Z??i(Y);for(let C of I)if(D(C.field,N)&&z1(C.field.table)!==(D(H,T)?H._.alias:D(H,L1)?H[Q].name:D(H,x)?void 0:z1(H))&&!((u)=>_?.some(({alias:t})=>t===(u[A.Symbol.IsAlias]?z1(u):u[A.Symbol.BaseName])))(C.field.table)){let u=z1(C.field.table);throw Error(`Your "${C.path.join("->")}" field references a column "${u}"."${C.field.name}", but the table "${u}" is not part of the query! Did you forget to join it?`)}let L=!_||_.length===0,P=this.buildWithCTE(X),B=F?W` distinct`:void 0,d=this.buildSelection(I,{isSingleTable:L}),R=this.buildFromTable(H),s=this.buildJoins(_),o=$?W` where ${$}`:void 0,p=G?W` having ${G}`:void 0,w=[];if(O){for(let[C,u]of O.entries())if(w.push(u),C<O.length-1)w.push(W`, `)}let j=W`${P}select${B} ${d} from ${R}${s}${o}${w.length>0?W` group by ${W.join(w)}`:void 0}${p}${this.buildOrderBy(z)}${this.buildLimit(E)}${U?W` offset ${U}`:void 0}`;if(M.length>0)return this.buildSetOperations(j,M);return j}buildSetOperations(X,Y){let[Z,...$]=Y;if(!Z)throw Error("Cannot pass undefined values to any set operator");if($.length===0)return this.buildSetOperationQuery({leftSelect:X,setOperator:Z});return this.buildSetOperations(this.buildSetOperationQuery({leftSelect:X,setOperator:Z}),$)}buildSetOperationQuery({leftSelect:X,setOperator:{type:Y,isAll:Z,rightSelect:$,limit:G,orderBy:H,offset:_}}){let z=W`${X.getSQL()} `,O=W`${$.getSQL()}`,E;if(H&&H.length>0){let I=[];for(let L of H)if(D(L,S))I.push(W.identifier(L.name));else if(D(L,x)){for(let P=0;P<L.queryChunks.length;P++){let B=L.queryChunks[P];if(D(B,S))L.queryChunks[P]=W.identifier(this.casing.getColumnCasing(B))}I.push(W`${L}`)}else I.push(W`${L}`);E=W` order by ${W.join(I,W`, `)}`}let U=typeof G==="object"||typeof G==="number"&&G>=0?W` limit ${G}`:void 0,F=W.raw(`${Y} ${Z?"all ":""}`),M=_?W` offset ${_}`:void 0;return W`${z}${F}${O}${E}${U}${M}`}buildInsertQuery({table:X,values:Y,onConflict:Z,returning:$,withList:G,select:H}){let _=[],z=X[A.Symbol.Columns],O=Object.entries(z).filter(([I,L])=>!L.shouldDisableInsert()),E=O.map(([,I])=>W.identifier(this.casing.getColumnCasing(I)));if(H){let I=Y;if(D(I,x))_.push(I);else _.push(I.getSQL())}else{let I=Y;_.push(W.raw("values "));for(let[L,P]of I.entries()){let B=[];for(let[d,R]of O){let s=P[d];if(s===void 0||D(s,g)&&s.value===void 0){let o;if(R.default!==null&&R.default!==void 0)o=D(R.default,x)?R.default:W.param(R.default,R);else if(R.defaultFn!==void 0){let p=R.defaultFn();o=D(p,x)?p:W.param(p,R)}else if(!R.default&&R.onUpdateFn!==void 0){let p=R.onUpdateFn();o=D(p,x)?p:W.param(p,R)}else o=W`null`;B.push(o)}else B.push(s)}if(_.push(B),L<I.length-1)_.push(W`, `)}}let U=this.buildWithCTE(G),F=W.join(_),M=$?W` returning ${this.buildSelection($,{isSingleTable:!0})}`:void 0;return W`${U}insert into ${X} ${E} ${F}${Z?.length?W.join(Z):void 0}${M}`}sqlToQuery(X,Y){return X.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,invokeSource:Y})}_buildRelationalQuery({fullSchema:X,schema:Y,tableNamesMap:Z,table:$,tableConfig:G,queryConfig:H,tableAlias:_,nestedQueryRelation:z,joinOn:O}){let E=[],U,F,M=[],I,L=[];if(H===!0)E=Object.entries(G.columns).map(([B,d])=>({dbKey:d.name,tsKey:B,field:Z1(d,_),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let B=Object.fromEntries(Object.entries(G.columns).map(([w,j])=>[w,Z1(j,_)]));if(H.where){let w=typeof H.where==="function"?H.where(B,kZ()):H.where;I=w&&a1(w,_)}let d=[],R=[];if(H.columns){let w=!1;for(let[j,C]of Object.entries(H.columns)){if(C===void 0)continue;if(j in G.columns){if(!w&&C===!0)w=!0;R.push(j)}}if(R.length>0)R=w?R.filter((j)=>H.columns?.[j]===!0):Object.keys(G.columns).filter((j)=>!R.includes(j))}else R=Object.keys(G.columns);for(let w of R){let j=G.columns[w];d.push({tsKey:w,value:j})}let s=[];if(H.with)s=Object.entries(H.with).filter((w)=>!!w[1]).map(([w,j])=>({tsKey:w,queryConfig:j,relation:G.relations[w]}));let o;if(H.extras){o=typeof H.extras==="function"?H.extras(B,{sql:W}):H.extras;for(let[w,j]of Object.entries(o))d.push({tsKey:w,value:cX(j,_)})}for(let{tsKey:w,value:j}of d)E.push({dbKey:D(j,x.Aliased)?j.fieldAlias:G.columns[w].name,tsKey:w,field:D(j,N)?Z1(j,_):j,relationTableTsKey:void 0,isJson:!1,selection:[]});let p=typeof H.orderBy==="function"?H.orderBy(B,NZ()):H.orderBy??[];if(!Array.isArray(p))p=[p];M=p.map((w)=>{if(D(w,N))return Z1(w,_);return a1(w,_)}),U=H.limit,F=H.offset;for(let{tsKey:w,queryConfig:j,relation:C}of s){let u=wZ(Y,Z,C),t=Z[A1(C.referencedTable)],H1=`${_}_${w}`,$1=m(...u.fields.map((j1,wX)=>a(Z1(u.references[wX],H1),Z1(j1,_)))),K1=this._buildRelationalQuery({fullSchema:X,schema:Y,tableNamesMap:Z,table:X[t],tableConfig:Y[t],queryConfig:D(C,R1)?j===!0?{limit:1}:{...j,limit:1}:j,tableAlias:H1,joinOn:$1,nestedQueryRelation:C}),B1=W`(${K1.sql})`.as(w);E.push({dbKey:w,tsKey:w,field:B1,relationTableTsKey:t,isJson:!0,selection:K1.selection})}}if(E.length===0)throw new W1({message:`No fields selected for table "${G.tsName}" ("${_}"). You need to have at least one item in "columns", "with" or "extras". If you need to select all columns, omit the "columns" key or set it to undefined.`});let P;if(I=m(O,I),z){let B=W`json_array(${W.join(E.map(({field:R})=>D(R,S)?W.identifier(this.casing.getColumnCasing(R)):D(R,x.Aliased)?R.sql:R),W`, `)})`;if(D(z,dX))B=W`coalesce(json_group_array(${B}), json_array())`;let d=[{dbKey:"data",tsKey:"data",field:B.as("data"),isJson:!0,relationTableTsKey:G.tsName,selection:E}];if(U!==void 0||F!==void 0||M.length>0)P=this.buildSelectQuery({table:Y1($,_),fields:{},fieldsFlat:[{path:[],field:W.raw("*")}],where:I,limit:U,offset:F,orderBy:M,setOperators:[]}),I=void 0,U=void 0,F=void 0,M=void 0;else P=Y1($,_);P=this.buildSelectQuery({table:D(P,v)?P:new T(P,{},_),fields:{},fieldsFlat:d.map(({field:R})=>({path:[],field:D(R,N)?Z1(R,_):R})),joins:L,where:I,limit:U,offset:F,orderBy:M,setOperators:[]})}else P=this.buildSelectQuery({table:Y1($,_),fields:{},fieldsFlat:E.map(({field:B})=>({path:[],field:D(B,N)?Z1(B,_):B})),joins:L,where:I,limit:U,offset:F,orderBy:M,setOperators:[]});return{tableTsKey:G.tsName,sql:P,selection:E}}nestedSelectionerror(){throw new W1({message:"Views with nested selections are not supported by the relational query builder"})}buildRqbColumn(X,Y,Z){if(D(Y,N)){let $=W`${X}.${W.identifier(this.casing.getColumnCasing(Y))}`;switch(Y.columnType){case"SQLiteBigInt":case"SQLiteBlobJson":case"SQLiteBlobBuffer":return W`hex(${$}) as ${W.identifier(Z)}`;case"SQLiteNumeric":case"SQLiteNumericNumber":case"SQLiteNumericBigInt":return W`cast(${$} as text) as ${W.identifier(Z)}`;case"SQLiteCustomColumn":return W`${Y.jsonSelectIdentifier($,W)} as ${W.identifier(Z)}`;default:return W`${$} as ${W.identifier(Z)}`}}return W`${X}.${D(Y,x.Aliased)?W.identifier(Y.fieldAlias):E1(Y)?W.identifier(Z):this.nestedSelectionerror()} as ${W.identifier(Z)}`}unwrapAllColumns=(X,Y)=>{return W.join(Object.entries(X[n]).map(([Z,$])=>{return Y.push({key:Z,field:$}),this.buildRqbColumn(X,$,Z)}),W`, `)};getSelectedTableColumns=(X,Y)=>{let Z=[],$=X[n],G=Object.entries(Y),H;for(let[_,z]of G){if(z===void 0)continue;if(H=H||z,z){let O=$[_];Z.push({column:O,tsName:_})}}if(H===!1)for(let[_,z]of Object.entries($)){if(Y[_]===!1)continue;Z.push({column:z,tsName:_})}return Z};buildColumns=(X,Y,Z)=>Z?.columns?(()=>{let $=[],G=this.getSelectedTableColumns(X,Z?.columns);for(let{column:H,tsName:_}of G)$.push(this.buildRqbColumn(X,H,_)),Y.push({key:_,field:H});return $.length?W.join($,W`, `):void 0})():this.unwrapAllColumns(X,Y);buildRelationalQuery({schema:X,table:Y,tableConfig:Z,queryConfig:$,relationWhere:G,mode:H,isNested:_,errorPath:z,depth:O,throughJoin:E,jsonb:U}){let F=[],M=H==="first",I=$===!0?void 0:$,L=z??"",P=O??0;if(!P)Y=Y1(Y,`d${P}`);let B=M?1:I?.limit,d=I?.offset,R=this.buildColumns(Y,F,I),s=I?.where&&G?m(J1(Y,I.where,Z.relations,X,this.casing),G):I?.where?J1(Y,I.where,Z.relations,X,this.casing):G,o=I?.orderBy?qZ(Y,I.orderBy):void 0,p=I?.extras?vZ(Y,I.extras):void 0;if(p)F.push(...p.selection);let w=I?(()=>{let{with:C}=I;if(!C)return;let u=Object.entries(C).filter(([t,H1])=>H1);if(!u.length)return;return W.join(u.map(([t,H1])=>{let $1=Z.relations[t],K1=D($1,SZ),B1=Y1($1.targetTable,`d${P+1}`),j1=$1.throughTable?Y1($1.throughTable,`tr${P}`):void 0,{filter:wX,joinCondition:aZ}=uX(this.casing,$1,Y,B1,j1),eZ=j1?W` inner join ${P1(j1)} on ${aZ}`:void 0,$X=this.buildRelationalQuery({table:B1,mode:K1?"first":"many",schema:X,queryConfig:H1,tableConfig:X[$1.targetTableName],relationWhere:wX,isNested:!0,errorPath:`${L.length?`${L}.`:""}${t}`,depth:P+1,throughJoin:eZ,jsonb:U});F.push({field:B1,key:t,selection:$X.selection,isArray:!K1,isOptional:($1.optional??!1)||H1!==!0&&!!H1.where});let ZY=W.join($X.selection.map((GX)=>{return W`${W.raw(this.escapeString(GX.key))}, ${GX.selection?W`${U}(${W.identifier(GX.key)})`:W.identifier(GX.key)}`}),W`, `),$Y=_?U:W`json`;return K1?W`(select ${$Y}_object(${ZY}) as ${W.identifier("r")} from (${$X.sql}) as ${W.identifier("t")}) as ${W.identifier(t)}`:W`coalesce((select ${$Y}_group_array(json_object(${ZY})) as ${W.identifier("r")} from (${$X.sql}) as ${W.identifier("t")}), ${U}_array()) as ${W.identifier(t)}`}),W`, `)})():void 0,j=[R,p?.sql,w].filter((C)=>C!==void 0);if(!j.length)throw new W1({message:`No fields selected for table "${Z.name}"${L?` ("${L}")`:""}`});return{sql:W`select ${W.join(j,W`, `)} from ${P1(Y)}${E}${W` where ${s}`.if(s)}${W` order by ${o}`.if(o)}${W` limit ${B}`.if(B!==void 0)}${W` offset ${d}`.if(d!==void 0)}`,selection:F}}},xX=class extends MX{static[J]="SQLiteSyncDialect";migrate(X,Y,Z){let $=Z===void 0?"__drizzle_migrations":typeof Z==="string"?"__drizzle_migrations":Z.migrationsTable??"__drizzle_migrations",{newDb:G}=rZ($,Y,X);if(G){let z=W`
4
- CREATE TABLE IF NOT EXISTS ${W.identifier($)} (
5
- id INTEGER PRIMARY KEY,
6
- hash text NOT NULL,
7
- created_at numeric,
8
- name text,
9
- applied_at TEXT
10
- )`;Y.run(z)}let H=Y.all(W`SELECT id, hash, created_at, name FROM ${W.identifier($)}`);if(typeof Z==="object"&&Z.init){if(H.length)return{exitCode:"databaseMigrations"};if(X.length>1)return{exitCode:"localMigrations"};let[z]=X;if(!z)return;Y.run(W`insert into ${W.identifier($)} ("hash", "created_at", "name", "applied_at") values(${z.hash}, ${z.folderMillis}, ${z.name}, ${new Date().toISOString()})`);return}let _=cZ({localMigrations:X,dbMigrations:H});Y.run(W`BEGIN`);try{for(let z of _){for(let O of z.sql)Y.run(W.raw(O));Y.run(W`INSERT INTO ${W.identifier($)} ("hash", "created_at", "name", "applied_at") values(${z.hash}, ${z.folderMillis}, ${z.name}, ${new Date().toISOString()})`)}Y.run(W`COMMIT`)}catch(z){throw Y.run(W`ROLLBACK`),z}}};var YX=class{static[J]="SQLiteQueryBuilder";dialect;dialectConfig;constructor(X){this.dialect=D(X,MX)?X:void 0,this.dialectConfig=D(X,MX)?void 0:X}$with=(X,Y)=>{let Z=this;return{as:(G)=>{if(typeof G==="function")G=G(Z);return new Proxy(new WX(G.getSQL(),Y??("getSelectedFields"in G?G.getSelectedFields()??{}:{}),X,!0),new b({alias:X,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};with(...X){let Y=this;function Z(G){return new X1({fields:G??void 0,session:void 0,dialect:Y.getDialect(),withList:X})}function $(G){return new X1({fields:G??void 0,session:void 0,dialect:Y.getDialect(),withList:X,distinct:!0})}return{select:Z,selectDistinct:$}}select(X){return new X1({fields:X??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(X){return new X1({fields:X??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}getDialect(){if(!this.dialect)this.dialect=new xX(this.dialectConfig);return this.dialect}};var KX=class{static[J]="SQLiteInsertBuilder";constructor(X,Y,Z,$){this.table=X,this.session=Y,this.dialect=Z,this.withList=$}values(X){if(X=Array.isArray(X)?X:[X],X.length===0)throw Error("values() must be called with at least one value");let Y=X.map((Z)=>{let $={},G=this.table[A.Symbol.Columns];for(let H of Object.keys(Z)){let _=Z[H];$[H]=D(_,x)?_:new g(_,G[H])}return $});return new tX(this.table,Y,this.session,this.dialect,this.withList)}select(X){let Y=typeof X==="function"?X(new YX):X;if(!D(Y,x)&&!q1(this.table[n],Y._.selectedFields))throw Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");return new tX(this.table,Y,this.session,this.dialect,this.withList,!0)}},tX=class extends c{static[J]="SQLiteInsert";config;constructor(X,Y,Z,$,G,H){super();this.session=Z,this.dialect=$,this.config={table:X,values:Y,withList:G,select:H}}returning(X=this.config.table[v.Symbol.Columns]){return this.config.returning=i(X),this}onConflictDoNothing(X={}){if(!this.config.onConflict)this.config.onConflict=[];if(X.target===void 0)this.config.onConflict.push(W` on conflict do nothing`);else{let Y=Array.isArray(X.target)?W`${X.target}`:W`${[X.target]}`,Z=X.where?W` where ${X.where}`:W``;this.config.onConflict.push(W` on conflict ${Y} do nothing${Z}`)}return this}onConflictDoUpdate(X){if(X.where&&(X.targetWhere||X.setWhere))throw Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');if(!this.config.onConflict)this.config.onConflict=[];let Y=X.where?W` where ${X.where}`:void 0,Z=X.targetWhere?W` where ${X.targetWhere}`:void 0,$=X.setWhere?W` where ${X.setWhere}`:void 0,G=Array.isArray(X.target)?W`${X.target}`:W`${[X.target]}`,H=this.dialect.buildUpdateSet(this.config.table,JX(this.config.table,X.set));return this.config.onConflict.push(W` on conflict ${G}${Z} do update set ${H}${Y}${$}`),this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:X,...Y}=this.dialect.sqlToQuery(this.getSQL());return Y}_prepare(X=!0){return this.session[X?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"insert",tables:e(this.config.table)})}prepare(){return this._prepare(!1)}run=(X)=>{return this._prepare().run(X)};all=(X)=>{return this._prepare().all(X)};get=(X)=>{return this._prepare().get(X)};values=(X)=>{return this._prepare().values(X)};async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}};var kX=class{static[J]="SQLiteUpdateBuilder";constructor(X,Y,Z,$){this.table=X,this.session=Y,this.dialect=Z,this.withList=$}set(X){return new sZ(this.table,JX(this.table,X),this.session,this.dialect,this.withList)}},sZ=class extends c{static[J]="SQLiteUpdate";config;constructor(X,Y,Z,$,G){super();this.session=Z,this.dialect=$,this.config={set:Y,table:X,withList:G,joins:[]}}from(X){return this.config.from=X,this}createJoin(X){return(Y,Z)=>{let $=v1(Y);if(typeof $==="string"&&this.config.joins.some((G)=>G.alias===$))throw Error(`Alias "${$}" is already used in this query`);if(typeof Z==="function"){let G=this.config.from?D(Y,v)?Y[A.Symbol.Columns]:D(Y,T)?Y._.selectedFields:D(Y,L1)?Y[Q].selectedFields:void 0:void 0;Z=Z(new Proxy(this.config.table[A.Symbol.Columns],new b({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),G&&new Proxy(G,new b({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}return this.config.joins.push({on:Z,table:Y,joinType:X,alias:$}),this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where(X){return this.config.where=X,this}orderBy(...X){if(typeof X[0]==="function"){let Y=X[0](new Proxy(this.config.table[A.Symbol.Columns],new b({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),Z=Array.isArray(Y)?Y:[Y];this.config.orderBy=Z}else{let Y=X;this.config.orderBy=Y}return this}limit(X){return this.config.limit=X,this}returning(X=this.config.table[v.Symbol.Columns]){return this.config.returning=i(X),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:X,...Y}=this.dialect.sqlToQuery(this.getSQL());return Y}_prepare(X=!0){return this.session[X?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"insert",tables:e(this.config.table)})}prepare(){return this._prepare(!1)}run=(X)=>{return this._prepare().run(X)};all=(X)=>{return this._prepare().all(X)};get=(X)=>{return this._prepare().get(X)};values=(X)=>{return this._prepare().values(X)};async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}};var NX=class{static[J]="BaseSQLiteDatabase";_query;query;constructor(X,Y,Z,$,G,H,_){this.resultKind=X,this.dialect=Y,this.session=Z,this.rowModeRQB=H,this.forbidJsonb=_,this._=G?{schema:G.schema,fullSchema:G.fullSchema,tableNamesMap:G.tableNamesMap,relations:$}:{schema:void 0,fullSchema:{},tableNamesMap:{},relations:$},this._query={};let z=this._query;if(this._.schema)for(let[O,E]of Object.entries(this._.schema))z[O]=new LZ(X,G.fullSchema,this._.schema,this._.tableNamesMap,G.fullSchema[O],E,Y,Z);this.query={};for(let[O,E]of Object.entries($))this.query[O]=new pZ(X,$,$[E.name].table,E,Y,Z,H,_);this.$cache={invalidate:async(O)=>{}}}$with=(X,Y)=>{let Z=this;return{as:(G)=>{if(typeof G==="function")G=G(new YX(Z.dialect));return new Proxy(new WX(G.getSQL(),Y??("getSelectedFields"in G?G.getSelectedFields()??{}:{}),X,!0),new b({alias:X,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};$count(X,Y){return new BZ({source:X,filters:Y,session:this.session})}with(...X){let Y=this;function Z(z){return new X1({fields:z??void 0,session:Y.session,dialect:Y.dialect,withList:X})}function $(z){return new X1({fields:z??void 0,session:Y.session,dialect:Y.dialect,withList:X,distinct:!0})}function G(z){return new kX(z,Y.session,Y.dialect,X)}function H(z){return new KX(z,Y.session,Y.dialect,X)}function _(z){return new VX(z,Y.session,Y.dialect,X)}return{select:Z,selectDistinct:$,update:G,insert:H,delete:_}}select(X){return new X1({fields:X??void 0,session:this.session,dialect:this.dialect})}selectDistinct(X){return new X1({fields:X??void 0,session:this.session,dialect:this.dialect,distinct:!0})}update(X){return new kX(X,this.session,this.dialect)}$cache;insert(X){return new KX(X,this.session,this.dialect)}delete(X){return new VX(X,this.session,this.dialect)}run(X){let Y=typeof X==="string"?W.raw(X):X.getSQL();if(this.resultKind==="async")return new XX(async()=>this.session.run(Y),()=>Y,"run",this.dialect,this.session.extractRawRunValueFromBatchResult.bind(this.session));return this.session.run(Y)}all(X){let Y=typeof X==="string"?W.raw(X):X.getSQL();if(this.resultKind==="async")return new XX(async()=>this.session.all(Y),()=>Y,"all",this.dialect,this.session.extractRawAllValueFromBatchResult.bind(this.session));return this.session.all(Y)}get(X){let Y=typeof X==="string"?W.raw(X):X.getSQL();if(this.resultKind==="async")return new XX(async()=>this.session.get(Y),()=>Y,"get",this.dialect,this.session.extractRawGetValueFromBatchResult.bind(this.session));return this.session.get(Y)}values(X){let Y=typeof X==="string"?W.raw(X):X.getSQL();if(this.resultKind==="async")return new XX(async()=>this.session.values(Y),()=>Y,"values",this.dialect,this.session.extractRawValuesValueFromBatchResult.bind(this.session));return this.session.values(Y)}transaction(X,Y){return this.session.transaction(X,Y)}};var P2=class{static[J]="Cache"},tZ=class extends P2{static[J]="NoopCache";strategy(){return"all"}async get(X){}async put(X,Y,Z,$){}async onMutate(X){}};async function nX(X,Y){let Z=`${X}-${JSON.stringify(Y,(H,_)=>typeof _==="bigint"?`${_}n`:_)}`,$=new TextEncoder().encode(Z),G=await crypto.subtle.digest("SHA-256",$);return[...new Uint8Array(G)].map((H)=>H.toString(16).padStart(2,"0")).join("")}var nZ=class extends c{static[J]="ExecuteResultSync";constructor(X){super();this.resultCb=X}async execute(){return this.resultCb()}sync(){return this.resultCb()}},iX=class{static[J]="PreparedQuery";joinsNotNullableMap;constructor(X,Y,Z,$,G,H){if(this.mode=X,this.executeMethod=Y,this.query=Z,this.cache=$,this.queryMetadata=G,this.cacheConfig=H,$&&$.strategy()==="all"&&H===void 0)this.cacheConfig={enabled:!0,autoInvalidate:!0};if(!this.cacheConfig?.enabled)this.cacheConfig=void 0}async queryWithCache(X,Y,Z){if(this.cache===void 0||D(this.cache,tZ)||this.queryMetadata===void 0)try{return await Z()}catch($){throw new x1(X,Y,$)}if(this.cacheConfig&&!this.cacheConfig.enabled)try{return await Z()}catch($){throw new x1(X,Y,$)}if((this.queryMetadata.type==="insert"||this.queryMetadata.type==="update"||this.queryMetadata.type==="delete")&&this.queryMetadata.tables.length>0)try{let[$]=await Promise.all([Z(),this.cache.onMutate({tables:this.queryMetadata.tables})]);return $}catch($){throw new x1(X,Y,$)}if(!this.cacheConfig)try{return await Z()}catch($){throw new x1(X,Y,$)}if(this.queryMetadata.type==="select"){let $=await this.cache.get(this.cacheConfig.tag??await nX(X,Y),this.queryMetadata.tables,this.cacheConfig.tag!==void 0,this.cacheConfig.autoInvalidate);if($===void 0){let G;try{G=await Z()}catch(H){throw new x1(X,Y,H)}return await this.cache.put(this.cacheConfig.tag??await nX(X,Y),G,this.cacheConfig.autoInvalidate?this.queryMetadata.tables:[],this.cacheConfig.tag!==void 0,this.cacheConfig.config),G}return $}try{return await Z()}catch($){throw new x1(X,Y,$)}}getQuery(){return this.query}mapRunResult(X,Y){return X}mapAllResult(X,Y){throw Error("Not implemented")}mapGetResult(X,Y){throw Error("Not implemented")}execute(X){if(this.mode==="async")return this[this.executeMethod](X);return new nZ(()=>this[this.executeMethod](X))}mapResult(X,Y){switch(this.executeMethod){case"run":return this.mapRunResult(X,Y);case"all":return this.mapAllResult(X,Y);case"get":return this.mapGetResult(X,Y)}}},lX=class{static[J]="SQLiteSession";constructor(X){this.dialect=X}prepareOneTimeQuery(X,Y,Z,$,G,H,_){return this.prepareQuery(X,Y,Z,$,G,H,_)}prepareOneTimeRelationalQuery(X,Y,Z,$){return this.prepareRelationalQuery(X,Y,Z,$)}run(X){let Y=this.dialect.sqlToQuery(X);try{return this.prepareOneTimeQuery(Y,void 0,"run",!1).run()}catch(Z){throw new W1({cause:Z,message:`Failed to run the query '${Y.sql}'`})}}extractRawRunValueFromBatchResult(X){return X}all(X){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(X),void 0,"run",!1).all()}extractRawAllValueFromBatchResult(X){throw Error("Not implemented")}get(X){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(X),void 0,"run",!1).get()}extractRawGetValueFromBatchResult(X){throw Error("Not implemented")}values(X){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(X),void 0,"run",!1).values()}async count(X){return(await this.values(X))[0][0]}extractRawValuesValueFromBatchResult(X){throw Error("Not implemented")}},aX=class extends NX{static[J]="SQLiteTransaction";constructor(X,Y,Z,$,G,H=0,_,z){super(X,Y,Z,$,G,_,z);this.relations=$,this.schema=G,this.nestedIndex=H}rollback(){throw new TZ}};var XY=class extends lX{static[J]="SQLiteBunSession";logger;constructor(X,Y,Z,$,G={}){super(Y);this.client=X,this.relations=Z,this.schema=$,this.logger=G.logger??new OY}exec(X){this.client.exec(X)}prepareQuery(X,Y,Z,$,G){return new eX(this.client.prepare(X.sql),X,this.logger,Y,Z,$,G)}prepareRelationalQuery(X,Y,Z,$){return new eX(this.client.prepare(X.sql),X,this.logger,Y,Z,!1,$,!0)}transaction(X,Y={}){let Z=new iZ("sync",this.dialect,this,this.relations,this.schema),$;return this.client.transaction(()=>{$=X(Z)})[Y.behavior??"deferred"](),$}},iZ=class X extends aX{static[J]="SQLiteBunTransaction";transaction(Y){let Z=`sp${this.nestedIndex}`,$=new X("sync",this.dialect,this.session,this.relations,this.schema,this.nestedIndex+1);this.session.run(W.raw(`savepoint ${Z}`));try{let G=Y($);return this.session.run(W.raw(`release savepoint ${Z}`)),G}catch(G){throw this.session.run(W.raw(`rollback to savepoint ${Z}`)),G}}},eX=class extends iX{static[J]="SQLiteBunPreparedQuery";constructor(X,Y,Z,$,G,H,_,z){super("sync",G,Y);this.stmt=X,this.logger=Z,this.fields=$,this._isResponseInArrayMode=H,this.customResultMapper=_,this.isRqbV2Query=z}run(X){let Y=D1(this.query.params,X??{});return this.logger.logQuery(this.query.sql,Y),this.stmt.run(...Y)}all(X){if(this.isRqbV2Query)return this.allRqbV2(X);let{fields:Y,query:Z,logger:$,joinsNotNullableMap:G,stmt:H,customResultMapper:_}=this;if(!Y&&!_){let O=D1(Z.params,X??{});return $.logQuery(Z.sql,O),H.all(...O)}let z=this.values(X);if(_)return _(z);return z.map((O)=>BX(Y,O,G))}get(X){if(this.isRqbV2Query)return this.getRqbV2(X);let Y=D1(this.query.params,X??{});this.logger.logQuery(this.query.sql,Y);let{fields:Z,joinsNotNullableMap:$,customResultMapper:G}=this;if(!Z&&!G){let _=this.stmt.get(...Y);if(!_)return;return _}let H=this.stmt.values(...Y)[0];if(!H)return;if(G)return G([H]);return BX(Z,H,$)}allRqbV2(X){let{query:Y,logger:Z,stmt:$,customResultMapper:G}=this,H=D1(Y.params,X??{});return Z.logQuery(Y.sql,H),G($.all(...H))}getRqbV2(X){let Y=D1(this.query.params,X??{});this.logger.logQuery(this.query.sql,Y);let{stmt:Z,customResultMapper:$}=this,G=Z.get(...Y);if(!G)return;return $([G])}values(X){let Y=D1(this.query.params,X??{});return this.logger.logQuery(this.query.sql,Y),this.stmt.values(...Y)}isResponseInArrayMode(){return this._isResponseInArrayMode}};import{Database as RX}from"bun:sqlite";var lZ=class extends NX{static[J]="SQLiteBunDatabase"};function ZX(X,Y={}){let Z=new xX({casing:Y.casing}),$;if(Y.logger===!0)$=new DY;else if(Y.logger!==!1)$=Y.logger;let G;if(Y.schema){let z=RZ(Y.schema,QZ);G={fullSchema:Y.schema,schema:z.tables,tableNamesMap:z.tableNamesMap}}let H=Y.relations??{},_=new lZ("sync",Z,new XY(X,Z,H,G,{logger:$}),H,G);return _.$client=X,_}function YY(...X){if(X[0]===void 0||typeof X[0]==="string")return ZX(X[0]===void 0?new RX:new RX(X[0]),X[1]);let{connection:Y,client:Z,...$}=X[0];if(Z)return ZX(Z,$);if(typeof Y==="object"){let{source:G,...H}=Y;return ZX(new RX(G,Object.values(H).filter((_)=>_!==void 0).length?H:void 0),$)}return ZX(new RX(Y),$)}(function(X){function Y(Z){return ZX({},Z)}X.mock=Y})(YY||(YY={}));export{D as $l,N as am,E0 as bm,Y0 as cm,E1 as dm,h as em,x as fm,S1 as gm,$0 as hm,PX as im,C1 as jm,LX as km,G0 as lm,g as mm,W0 as nm,W as om,l as pm,J0 as qm,D1 as rm,y as sm,H0 as tm,_0 as um,TX as vm,SX as wm,D0 as xm,j0 as ym,T0 as zm,q as Am,a as Bm,h1 as Cm,m as Dm,V1 as Em,I1 as Fm,p1 as Gm,y1 as Hm,f1 as Im,b1 as Jm,d1 as Km,g1 as Lm,m1 as Mm,c1 as Nm,k1 as Om,N1 as Pm,u1 as Qm,r1 as Rm,o1 as Sm,s1 as Tm,t1 as Um,n1 as Vm,qX as Wm,vX as Xm,hX as Ym,M1 as Zm,i1 as _m,_J as $m,XY as an,iZ as bn,eX as cn,lZ as dn,YY as en};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Vp as a,Wp as b}from"./chunk-qpm5afdz.js";import"./chunk-0rmmg3g4.js";export{a as generateSecret,b as generateCodeChallengeFromVerifier};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{$d as a,ae as b,be as c,ce as d,de as e,ee as f,fe as g,ge as h,he as i,ie as j,je as k}from"./chunk-7rjf9b8n.js";import"./chunk-se79ke63.js";import"./chunk-4wyjapes.js";import"./chunk-0rmmg3g4.js";export{c as providerConfigFromInit,d as httpRequest,j as getInstanceMetadataEndpoint,k as fromInstanceMetadata,h as fromContainerMetadata,i as Endpoint,f as ENV_CMDS_RELATIVE_URI,e as ENV_CMDS_FULL_URI,g as ENV_CMDS_AUTH_TOKEN,a as DEFAULT_TIMEOUT,b as DEFAULT_MAX_RETRIES};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{m as a,n as b}from"./chunk-vqq5vmh1.js";import"./chunk-3xna2rk5.js";import"./chunk-gw0j8hr9.js";import"./chunk-453wpzg6.js";import"./chunk-pepn5jp4.js";import"./chunk-0vqrakhw.js";import"./chunk-rze20q68.js";import"./chunk-3h08jdq8.js";import"./chunk-hmfefq0d.js";import"./chunk-mczw8e3s.js";import"./chunk-54pk7nna.js";import"./chunk-qm9ezq93.js";import"./chunk-754varfr.js";import"./chunk-hznsed5n.js";import"./chunk-4wgb80jm.js";import"./chunk-grkkzrg1.js";import"./chunk-qe0sfafy.js";import"./chunk-2rxt1s22.js";import"./chunk-w98r39gd.js";import"./chunk-9w5rx0fb.js";import"./chunk-wb69d52j.js";import"./chunk-3f054f69.js";import"./chunk-26qt44f1.js";import"./chunk-0ke6x10y.js";import"./chunk-meaybtcc.js";import"./chunk-rmsqb6r4.js";import"./chunk-3j7skhxg.js";import"./chunk-4pssh5d3.js";import"./chunk-9dpn4792.js";import"./chunk-pf7cj4jd.js";import"./chunk-9r6bvkp4.js";import"./chunk-amx3x4kd.js";import"./chunk-b50t4jc5.js";import"./chunk-nf8gkxbk.js";import"./chunk-zny2qaqa.js";import"./chunk-9va5eh9s.js";import"./chunk-mkyrg7gt.js";import"./chunk-7v4fzkbb.js";import"./chunk-cqtkxwd8.js";import"./chunk-pk0tytcm.js";import"./chunk-ww8ear80.js";import"./chunk-kyny0t2g.js";import"./chunk-3e8p4a3y.js";import"./chunk-qpm5afdz.js";import"./chunk-dd11kryy.js";import"./chunk-msm3r7ny.js";import"./chunk-e075v4e9.js";import"./chunk-jv98gw88.js";import"./chunk-jhq5bvhs.js";import"./chunk-xw283h2r.js";import"./chunk-8cty50g7.js";import"./chunk-v7ah9gg0.js";import"./chunk-d0m7nbbx.js";import"./chunk-vfj5nwab.js";import"./chunk-7w84hfxs.js";import"./chunk-ym4ydwrz.js";import"./chunk-vmgknvxs.js";import"./chunk-p409grvp.js";import"./chunk-ag9thqkv.js";import"./chunk-7fx6x8x9.js";import"./chunk-0rmmg3g4.js";export{b as tui,a as rendererConfig};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import"./chunk-0rmmg3g4.js";var e="./libopentui-c48jzvfh.so";export{e as default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{hO as t}from"./chunk-0rmmg3g4.js";var e=await import("./chunk-mv1d7wyt.js",{with:{type:"file"}}),a=e.default;export{a as default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Gf as a}from"./chunk-0jaxgrq0.js";import"./chunk-4wgb80jm.js";import"./chunk-0rmmg3g4.js";export default a();
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{go as a,ho as b,io as c,jo as d,ko as e,lo as f,mo as g,no as h,oo as i}from"./chunk-zny2qaqa.js";import"./chunk-mkyrg7gt.js";import"./chunk-7v4fzkbb.js";import"./chunk-cqtkxwd8.js";import"./chunk-pk0tytcm.js";import"./chunk-ww8ear80.js";import"./chunk-7w84hfxs.js";import"./chunk-ym4ydwrz.js";import"./chunk-vmgknvxs.js";import"./chunk-0rmmg3g4.js";export{i as gateway,h as createGatewayProvider,h as createGateway,g as GatewayResponseError,d as GatewayRateLimitError,e as GatewayModelNotFoundError,c as GatewayInvalidRequestError,f as GatewayInternalServerError,a as GatewayError,b as GatewayAuthenticationError};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import"./chunk-0rmmg3g4.js";var E="./tree-sitter-markdown_inline-j5349f42.wasm";export{E as default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{n as L}from"./chunk-vqq5vmh1.js";import"./chunk-3xna2rk5.js";import{z as K}from"./chunk-gw0j8hr9.js";import{A as N}from"./chunk-wmrq9qqf.js";import{B as F,D as J}from"./chunk-453wpzg6.js";import"./chunk-pepn5jp4.js";import"./chunk-0vqrakhw.js";import"./chunk-rze20q68.js";import"./chunk-3h08jdq8.js";import{O as M}from"./chunk-zbdbsagd.js";import"./chunk-hmfefq0d.js";import"./chunk-mczw8e3s.js";import"./chunk-54pk7nna.js";import"./chunk-qm9ezq93.js";import"./chunk-754varfr.js";import{Qd as B}from"./chunk-g4qwkcdv.js";import"./chunk-hznsed5n.js";import"./chunk-4wgb80jm.js";import"./chunk-grkkzrg1.js";import{Uf as z}from"./chunk-qe0sfafy.js";import"./chunk-2rxt1s22.js";import"./chunk-w98r39gd.js";import"./chunk-9w5rx0fb.js";import"./chunk-wb69d52j.js";import"./chunk-3f054f69.js";import"./chunk-26qt44f1.js";import"./chunk-0ke6x10y.js";import"./chunk-meaybtcc.js";import"./chunk-rmsqb6r4.js";import"./chunk-3j7skhxg.js";import"./chunk-4pssh5d3.js";import"./chunk-9dpn4792.js";import"./chunk-pf7cj4jd.js";import"./chunk-9r6bvkp4.js";import"./chunk-amx3x4kd.js";import"./chunk-b50t4jc5.js";import"./chunk-nf8gkxbk.js";import"./chunk-zny2qaqa.js";import"./chunk-9va5eh9s.js";import"./chunk-mkyrg7gt.js";import"./chunk-7v4fzkbb.js";import"./chunk-cqtkxwd8.js";import"./chunk-pk0tytcm.js";import"./chunk-ww8ear80.js";import"./chunk-kyny0t2g.js";import"./chunk-3e8p4a3y.js";import"./chunk-qpm5afdz.js";import"./chunk-dd11kryy.js";import"./chunk-msm3r7ny.js";import"./chunk-e075v4e9.js";import"./chunk-jv98gw88.js";import"./chunk-jhq5bvhs.js";import"./chunk-xw283h2r.js";import"./chunk-8cty50g7.js";import"./chunk-v7ah9gg0.js";import"./chunk-d0m7nbbx.js";import"./chunk-vfj5nwab.js";import"./chunk-7w84hfxs.js";import"./chunk-ym4ydwrz.js";import"./chunk-vmgknvxs.js";import"./chunk-p409grvp.js";import"./chunk-ag9thqkv.js";import"./chunk-7fx6x8x9.js";import"./chunk-0rmmg3g4.js";var x=B({command:"attach <url>",describe:"attach to a running qitqode server",builder:(j)=>j.positional("url",{type:"string",describe:"http://localhost:4096",demandOption:!0}).option("dir",{type:"string",description:"directory to run in"}).option("continue",{alias:["c"],describe:"continue the last session",type:"boolean"}).option("session",{alias:["s"],type:"string",describe:"session id to continue"}).option("fork",{type:"boolean",describe:"fork the session when continuing (use with --continue or --session)"}).option("password",{alias:["p"],type:"string",describe:"basic auth password (defaults to QITQODE_SERVER_PASSWORD)"}),handler:async(j)=>{let Q=J();try{F();let q=N(j);if(q){z.error(q),process.exitCode=1;return}let R=(()=>{if(!j.dir)return;try{return process.chdir(j.dir),process.cwd()}catch{return j.dir}})(),S=M({password:j.password}),V=await K.get();await L({url:j.url,config:V,args:{continue:j.continue,sessionID:j.session,fork:j.fork},directory:R,headers:S})}finally{Q?.()}}});export{x as AttachCommand};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Bf as a}from"./chunk-qfz0a58d.js";import"./chunk-tfggzzqw.js";import"./chunk-nfg7nt13.js";import"./chunk-aqm597px.js";import"./chunk-0rmmg3g4.js";export{a as default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{wd as a}from"./chunk-0304b7xg.js";import"./chunk-54pk7nna.js";import"./chunk-0rmmg3g4.js";export{a as dict};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import"./chunk-0rmmg3g4.js";var G="./tree-sitter-bash-hq5s6fxb.wasm";export{G as default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{td as a,ud as b}from"./chunk-mczw8e3s.js";import"./chunk-b50t4jc5.js";import"./chunk-d0m7nbbx.js";import"./chunk-vfj5nwab.js";import"./chunk-p409grvp.js";import"./chunk-ag9thqkv.js";import"./chunk-0rmmg3g4.js";export{a as read,b as copy};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Qp as a,Rp as b,Sp as c}from"./chunk-kyny0t2g.js";import"./chunk-3e8p4a3y.js";import"./chunk-0rmmg3g4.js";export{a as openApp,c as default,b as apps};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import"./chunk-0rmmg3g4.js";var t="./highlights-r812a2qc.scm";export{t as default};
@@ -1,9 +0,0 @@
1
- // @bun
2
- import{Eh as U}from"./chunk-wb69d52j.js";import{$n as d,Nn as a,Xn as y}from"./chunk-9r6bvkp4.js";import{Cs as s,ts as o}from"./chunk-v7ah9gg0.js";import{TG as M}from"./chunk-ag9thqkv.js";class G extends Error{cause;constructor(J,Z){super(J);this.name="ForgewiseError",this.cause=Z}}class q extends G{constructor(J="Device flow is not supported by this issuer."){super(J);this.name="DeviceFlowUnsupportedError"}}var r="https://app.forgewise.tech",e="forgewise-cli";function I(...J){return J.find((Z)=>Z!==void 0&&Z.trim().length>0)}function J1(){return!!process.env.REPLIT_DEV_DOMAIN}async function K(){let J=process.env.ACCOUNTS_ISSUER,Z=process.env.FORGEWISE_CLIENT_ID;if(J&&Z)return{issuer:J.replace(/\/+$/,""),clientId:Z};let $;try{$=await y()}catch{$=void 0}let X=I(J,$?.issuer,r).replace(/\/+$/,""),Y=I(Z,$?.clientId,e);return{issuer:X,clientId:Y}}function P(J,Z,$){if(J>=200&&J<300)return{kind:"success"};let X=Z?.error??"";if(X==="authorization_pending")return{kind:"wait",intervalMs:$};if(X==="slow_down")return{kind:"wait",intervalMs:$+5000};if(X==="access_denied")return{kind:"fatal",message:"Sign-in was denied in the browser."};if(X==="expired_token")return{kind:"fatal",message:"The sign-in code expired before it was approved. Try again."};return{kind:"fatal",message:`Device sign-in failed: ${Z?.error_description||X||`HTTP ${J}`}`}}import E from"http";var v="/callback",b=[51737,51738],L=new Set;function k(J){return J.replace(/[&<>\"']/g,(Z)=>{switch(Z){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";default:return"&#39;"}})}function C(J){return`http://127.0.0.1:${J}${v}`}async function Z1(J){return new Promise((Z,$)=>{let X=E.createServer();X.listen(J,"127.0.0.1",()=>{X.close(()=>Z(J))}),X.on("error",$)})}async function h(){for(let J of b){if(L.has(J))continue;L.add(J);try{return await Z1(J)}catch{L.delete(J)}}throw new G(`Could not bind to any loopback port (tried ${b.join(", ")}). Free one of those ports and retry.`)}function O(J,Z,$,X){return new Promise((Y,V)=>{let x=()=>L.delete(J),N=E.createServer((z,Q)=>{try{let W=new URL(z.url??"/",`http://localhost:${J}`);if(W.pathname!==v){Q.writeHead(404),Q.end();return}let B=W.searchParams.get("code"),D=W.searchParams.get("state"),S=W.searchParams.get("error"),j=W.searchParams.get("error_description");if(S){let t=`${k(S)}${j?": "+k(j):""}`;Q.writeHead(200,{"Content-Type":"text/html"}),Q.end(`<html><body style="font-family:sans-serif;padding:2rem"><h2>Authorization failed</h2><p>${t}</p><p>You can close this tab.</p></body></html>`),N.close(),V(new G(`Authorization error: ${S}${j?" \u2014 "+j:""}`));return}if(!B||D!==Z){Q.writeHead(400),Q.end("Invalid request");return}Q.writeHead(200,{"Content-Type":"text/html"}),Q.end('<html><body style="font-family:sans-serif;padding:2rem"><h2>Signed in! You can close this tab.</h2><p>Return to your terminal to continue.</p></body></html>'),N.close(),Y({code:B})}catch(W){N.close(),V(W)}});if($?.aborted){x(),V(new G("Login cancelled"));return}let H=()=>{x(),N.close(()=>V(new G("Login cancelled")))};if($?.addEventListener("abort",H,{once:!0}),$?.aborted){H();return}N.listen(J,"127.0.0.1",()=>{x(),X?.()}),N.on("error",(z)=>{x(),V(z)})})}function g(J,Z){return new Promise(($,X)=>{if(Z?.aborted){X(new G("Login cancelled"));return}let Y,V=()=>{clearTimeout(Y),Z?.removeEventListener("abort",V),X(new G("Login cancelled"))};if(Y=setTimeout(()=>{Z?.removeEventListener("abort",V),$()},J),Z?.addEventListener("abort",V,{once:!0}),Z?.aborted)V()})}function m(J,Z=300000){if(!J)return!1;return Date.now()>=J-Z}async function $1(J){let{issuer:Z}=await K();return d({issuer:Z,...J.accessToken?{accessToken:J.accessToken}:{}})}import R from"crypto";var u="openid profile email",F=(J)=>J.toString("base64url");function p(){let J=F(R.randomBytes(32)),Z=F(R.createHash("sha256").update(J).digest()),$=F(R.randomBytes(16));return{verifier:J,challenge:Z,state:$}}function c(J){let Z=new URL(`${J.issuer}/api/oauth/authorize`);return Z.searchParams.set("response_type","code"),Z.searchParams.set("client_id",J.clientId),Z.searchParams.set("redirect_uri",J.redirectUri),Z.searchParams.set("scope",u),Z.searchParams.set("state",J.state),Z.searchParams.set("code_challenge",J.challenge),Z.searchParams.set("code_challenge_method","S256"),Z.toString()}async function T(J,Z){let $=await fetch(`${J}/api/oauth/userinfo`,{headers:{Authorization:`Bearer ${Z.access_token}`}});if(!$.ok)throw new G(`Failed to fetch user profile (${$.status})`);let X=await $.json();if(!X.sub)throw new G("Userinfo response is missing required 'sub' field \u2014 the server returned an invalid user profile.");return{sub:X.sub,name:X.name??"",email:X.email??"",access_token:Z.access_token,expires_at:Date.now()+(Z.expires_in??3600)*1000,...Z.refresh_token?{refresh_token:Z.refresh_token}:{}}}async function f(J){let Z=await fetch(`${J.issuer}/api/oauth/token`,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",code:J.code,redirect_uri:J.redirectUri,client_id:J.clientId,code_verifier:J.verifier}).toString(),signal:J.signal??null});if(!Z.ok){let X=await Z.text().catch(()=>"");throw new G(`Token exchange failed (${Z.status}): ${X}`)}let $=await Z.json();return T(J.issuer,$)}async function X1(J,Z,$=5000){let X=new AbortController,Y=setTimeout(()=>X.abort(),$);try{let V=await fetch(`${J}/api/oauth/userinfo`,{headers:{Authorization:`Bearer ${Z}`},signal:X.signal});if(V.status===401||V.status===403)return!1;if(!V.ok)return null;return!0}catch{return null}finally{clearTimeout(Y)}}async function w(J){let{issuer:Z,clientId:$}=await K(),X;try{X=await fetch(`${Z}/api/oauth/token`,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",client_id:$,refresh_token:J}).toString()})}catch(V){throw new G(`Could not reach the sign-in server to refresh the session: ${V instanceof Error?V.message:String(V)}`,V)}if(!X.ok){let V=await X.json().catch(()=>{return});if(V?.error==="invalid_grant")return"invalid_grant";throw new G(`Token refresh failed (${X.status}): ${V?.error??""}`)}let Y=await X.json();return T(Z,Y)}async function i(J){let Z;try{Z=await fetch(`${J.issuer}/api/oauth/device_authorization`,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:J.clientId,scope:u}).toString(),signal:J.signal??null})}catch{if(J.signal?.aborted)throw new G("Login cancelled");throw new q}if(Z.status===404||Z.status===405||Z.status===501)throw new q;if(!Z.ok){let X=await Z.text().catch(()=>"");throw new G(`Device authorization failed (${Z.status}): ${X}`)}let $;try{$=await Z.json()}catch{throw new q}if(!$.device_code||!$.user_code||!$.verification_uri)throw new q;return{deviceCode:$.device_code,info:{userCode:$.user_code,verificationUri:$.verification_uri,verificationUriComplete:$.verification_uri_complete,expiresAt:Date.now()+($.expires_in??900)*1000},intervalMs:Math.max(1,$.interval??5)*1000}}async function l(J){let Z;try{Z=await fetch(`${J.issuer}/api/oauth/token`,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:J.deviceCode,client_id:J.clientId}).toString(),signal:J.signal??null})}catch{if(J.signal?.aborted)throw new G("Login cancelled");return{kind:"wait",intervalMs:J.currentIntervalMs}}let $;try{$=await Z.json()}catch{$=void 0}let X=P(Z.status,$,J.currentIntervalMs);if(X.kind==="success"){if(!$?.access_token)throw new G("Token endpoint returned success without an access_token.");return{kind:"success",profile:await T(J.issuer,{access_token:$.access_token,expires_in:$.expires_in})}}if(X.kind==="fatal")throw new G(X.message);return{kind:"wait",intervalMs:X.intervalMs}}var A="forgewise",V1=()=>M.gen(function*(){let J=yield*a.Service,Z=yield*J.get(A);if(!Z||Z.type!=="api")return;let $=Z.metadata??{},X=$.access_token;if(!X)return;let Y=Number($.access_token_expires_at??0);if(!m(Y))return X;let V=$.refresh_token;if(!V)return;let x=yield*M.promise(()=>w(V).catch(()=>null));if(!x||x==="invalid_grant")return;let N=yield*J.get(A);if(!N||N.type!=="api"||N.key!==Z.key)return x.access_token;let H={...N,metadata:{...N.metadata??{},access_token:x.access_token,access_token_expires_at:String(x.expires_at),...x.refresh_token?{refresh_token:x.refresh_token}:{}}};return yield*M.orElseSucceed(J.set(A,H),()=>{return}),x.access_token}),Y1=(J)=>M.gen(function*(){if(J.method==="sso")return{key:J.key,method:"sso",accessToken:J.key};let Z=yield*V1();return{key:J.key,method:"api-key",accessToken:Z}});var x1=300000;async function n(){let{issuer:J,clientId:Z}=await K(),{verifier:$,challenge:X,state:Y}=p(),V=await h(),x=C(V),N=c({issuer:J,clientId:Z,redirectUri:x,challenge:X,state:Y});return{issuer:J,clientId:Z,verifier:$,port:V,redirectUri:x,authorizeStr:N,state:Y}}async function G1(J){let{issuer:Z,clientId:$}=await K(),{deviceCode:X,info:Y,intervalMs:V}=await i({issuer:Z,clientId:$,signal:J.signal});if(J.onCode(Y),J.tryOpen){let N=Y.verificationUriComplete??Y.verificationUri;U(N)}let x=V;while(Date.now()<Y.expiresAt){await g(x,J.signal);let N=await l({issuer:Z,clientId:$,deviceCode:X,currentIntervalMs:x,signal:J.signal});if(N.kind==="success")return N.profile;x=N.intervalMs}throw new G("The sign-in code expired before it was approved. Try again.")}async function N1(){let{issuer:J,clientId:Z,verifier:$,port:X,redirectUri:Y,authorizeStr:V,state:x}=await n();process.stdout.write(`
3
- `),process.stdout.write(` Opening Forgewise sign-in in your browser...
4
- `),process.stdout.write(" Sign-in URL: "+V+`
5
- `),process.stdout.write(`
6
- `),process.stdout.write(` Waiting for the browser to complete sign-in... (ctrl+c to cancel)
7
- `);let{code:N}=await O(X,x,void 0,()=>{U(V)});return process.stdout.write(`
8
- Exchanging authorization code...
9
- `),f({issuer:J,clientId:Z,code:N,redirectUri:Y,verifier:$})}async function Q1(J={}){if(J.signal?.aborted)throw new G("Login cancelled");let{issuer:Z,clientId:$,verifier:X,port:Y,redirectUri:V,authorizeStr:x,state:N}=await n(),H=()=>{if(J.onUrl?.(x),J.tryOpen!==!1)U(x)},z=new AbortController,Q=()=>z.abort();J.signal?.addEventListener("abort",Q,{once:!0});let W=!1,B=setTimeout(()=>{W=!0,z.abort()},x1);try{let{code:D}=await O(Y,N,z.signal,H);return await f({issuer:Z,clientId:$,code:D,redirectUri:V,verifier:X,signal:z.signal})}catch(D){if(W)throw new G("Sign-in timed out. Run login again to retry.");throw D}finally{clearTimeout(B),J.signal?.removeEventListener("abort",Q)}}var _=s.create({service:"auth.forgewise.checkout"}),W1="qitqode",z1=5000;async function q1(J){let $=`${new URL(o.QITQODE_BACKEND_URL).origin}/auth/keys/checkout`;try{let X=await fetch($,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${J}`},body:JSON.stringify({app:W1}),signal:AbortSignal.timeout(z1)});if(!X.ok)return _.warn("API key checkout returned non-200; falling back to Bearer credential",{status:X.status,url:$}),null;let Y=await X.json();if(typeof Y?.key!=="string"||!Y.key)return _.warn("API key checkout response missing key field; falling back to Bearer credential",{url:$}),null;return _.info("API key checkout succeeded; credential upgraded to api-key method",{url:$}),Y.key}catch(X){return _.warn("API key checkout failed; falling back to Bearer credential",{url:$,error:X instanceof Error?X.message:String(X)}),null}}export{G as rg,q as sg,J1 as tg,K as ug,P as vg,C as wg,m as xg,$1 as yg,X1 as zg,w as Ag,Y1 as Bg,G1 as Cg,N1 as Dg,Q1 as Eg,q1 as Fg};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import"./chunk-0rmmg3g4.js";var L="./opentui-c5en9p2g.dll";export{L as default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{dl as a}from"./chunk-3f054f69.js";import"./chunk-26qt44f1.js";import"./chunk-0ke6x10y.js";import"./chunk-meaybtcc.js";import"./chunk-rmsqb6r4.js";import"./chunk-3j7skhxg.js";import"./chunk-4pssh5d3.js";import"./chunk-9dpn4792.js";import"./chunk-pf7cj4jd.js";import"./chunk-9r6bvkp4.js";import"./chunk-amx3x4kd.js";import"./chunk-b50t4jc5.js";import"./chunk-nf8gkxbk.js";import"./chunk-zny2qaqa.js";import"./chunk-9va5eh9s.js";import"./chunk-mkyrg7gt.js";import"./chunk-7v4fzkbb.js";import"./chunk-cqtkxwd8.js";import"./chunk-pk0tytcm.js";import"./chunk-ww8ear80.js";import"./chunk-kyny0t2g.js";import"./chunk-3e8p4a3y.js";import"./chunk-qpm5afdz.js";import"./chunk-dd11kryy.js";import"./chunk-msm3r7ny.js";import"./chunk-e075v4e9.js";import"./chunk-jv98gw88.js";import"./chunk-jhq5bvhs.js";import"./chunk-xw283h2r.js";import"./chunk-8cty50g7.js";import"./chunk-v7ah9gg0.js";import"./chunk-d0m7nbbx.js";import"./chunk-vfj5nwab.js";import"./chunk-7w84hfxs.js";import"./chunk-ym4ydwrz.js";import"./chunk-vmgknvxs.js";import"./chunk-p409grvp.js";import"./chunk-ag9thqkv.js";import"./chunk-7fx6x8x9.js";import"./chunk-0rmmg3g4.js";export{a as Session};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Nh as f,Oh as q,Ph as w,Qh as x}from"./chunk-h56jxxvj.js";import"./chunk-0rmmg3g4.js";export{w as applyModuleEvalRuntimeOptions,q as applyBaseRuntimeOptions,x as QuickJSWASMModule,f as QuickJSModuleCallbacks};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{$f as E}from"./chunk-bqs6a1ts.js";import"./chunk-cjxp72dv.js";import"./chunk-2rxt1s22.js";import"./chunk-w98r39gd.js";import"./chunk-atd0q4v8.js";import"./chunk-nfg7nt13.js";import"./chunk-aqm597px.js";import"./chunk-8gy99gfb.js";import"./chunk-87x607rz.js";import"./chunk-9w5rx0fb.js";import"./chunk-wb69d52j.js";import"./chunk-pfn1db1m.js";import"./chunk-h56jxxvj.js";import"./chunk-x36jhtex.js";import"./chunk-c1ypbbka.js";import"./chunk-qnqqrvvs.js";import"./chunk-3f054f69.js";import"./chunk-26qt44f1.js";import"./chunk-0ke6x10y.js";import"./chunk-meaybtcc.js";import"./chunk-rmsqb6r4.js";import"./chunk-3j7skhxg.js";import"./chunk-4pssh5d3.js";import"./chunk-9dpn4792.js";import"./chunk-pf7cj4jd.js";import"./chunk-9r6bvkp4.js";import"./chunk-amx3x4kd.js";import"./chunk-b50t4jc5.js";import"./chunk-nf8gkxbk.js";import"./chunk-zny2qaqa.js";import"./chunk-9va5eh9s.js";import"./chunk-mkyrg7gt.js";import"./chunk-7v4fzkbb.js";import"./chunk-cqtkxwd8.js";import"./chunk-pk0tytcm.js";import"./chunk-ww8ear80.js";import"./chunk-kyny0t2g.js";import"./chunk-3e8p4a3y.js";import"./chunk-qpm5afdz.js";import"./chunk-jtrcnpm7.js";import"./chunk-gaen9ya4.js";import"./chunk-dd11kryy.js";import"./chunk-msm3r7ny.js";import"./chunk-e075v4e9.js";import"./chunk-jv98gw88.js";import"./chunk-jhq5bvhs.js";import"./chunk-xw283h2r.js";import"./chunk-8cty50g7.js";import"./chunk-v7ah9gg0.js";import"./chunk-d0m7nbbx.js";import"./chunk-vfj5nwab.js";import"./chunk-7w84hfxs.js";import"./chunk-ym4ydwrz.js";import"./chunk-vmgknvxs.js";import"./chunk-p409grvp.js";import"./chunk-ag9thqkv.js";import"./chunk-qnv2v02g.js";import"./chunk-7fx6x8x9.js";import{hO as z}from"./chunk-0rmmg3g4.js";var J={command:"generate",handler:async()=>{let A=await E.openapi();for(let q of Object.values(A.paths))for(let y of["get","post","put","delete","patch"]){let k=q[y];if(!k?.operationId)continue;k["x-codeSamples"]=[{lang:"js",source:['import { createQitQodeClient } from "@qitqode/sdk"',"","const client = createQitQodeClient()",`await client.${k.operationId}({`," ...","})"].join(`
3
- `)}]}let F=JSON.stringify(A,null,2),B=await import("./chunk-dk3z4k46.js"),C=await import("./chunk-tdmaxc6n.js"),D=await import("./chunk-6rrmjrm2.js"),G=await(B.format??B.default?.format)(F,{parser:"json",plugins:[C.default??C,D.default??D],printWidth:120});await new Promise((q,y)=>{process.stdout.write(G,(k)=>{if(k)y(k);else q()})})}};export{J as GenerateCommand};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{hf as a}from"./chunk-tf1me2r4.js";import"./chunk-0rmmg3g4.js";export default a();
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{th as a,uh as b}from"./chunk-87x607rz.js";import"./chunk-9w5rx0fb.js";import"./chunk-wb69d52j.js";import"./chunk-pfn1db1m.js";import"./chunk-h56jxxvj.js";import"./chunk-x36jhtex.js";import"./chunk-c1ypbbka.js";import"./chunk-qnqqrvvs.js";import"./chunk-3f054f69.js";import"./chunk-26qt44f1.js";import"./chunk-0ke6x10y.js";import"./chunk-meaybtcc.js";import"./chunk-rmsqb6r4.js";import"./chunk-3j7skhxg.js";import"./chunk-4pssh5d3.js";import"./chunk-9dpn4792.js";import"./chunk-pf7cj4jd.js";import"./chunk-9r6bvkp4.js";import"./chunk-amx3x4kd.js";import"./chunk-b50t4jc5.js";import"./chunk-nf8gkxbk.js";import"./chunk-zny2qaqa.js";import"./chunk-9va5eh9s.js";import"./chunk-mkyrg7gt.js";import"./chunk-7v4fzkbb.js";import"./chunk-cqtkxwd8.js";import"./chunk-pk0tytcm.js";import"./chunk-ww8ear80.js";import"./chunk-kyny0t2g.js";import"./chunk-3e8p4a3y.js";import"./chunk-qpm5afdz.js";import"./chunk-jtrcnpm7.js";import"./chunk-gaen9ya4.js";import"./chunk-dd11kryy.js";import"./chunk-msm3r7ny.js";import"./chunk-e075v4e9.js";import"./chunk-jv98gw88.js";import"./chunk-jhq5bvhs.js";import"./chunk-xw283h2r.js";import"./chunk-8cty50g7.js";import"./chunk-v7ah9gg0.js";import"./chunk-d0m7nbbx.js";import"./chunk-vfj5nwab.js";import"./chunk-7w84hfxs.js";import"./chunk-ym4ydwrz.js";import"./chunk-vmgknvxs.js";import"./chunk-p409grvp.js";import"./chunk-ag9thqkv.js";import"./chunk-qnv2v02g.js";import"./chunk-7fx6x8x9.js";import"./chunk-0rmmg3g4.js";export{b as AppRuntime,a as AppLayer};