gemi 0.184.0 → 0.186.0

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 (209) hide show
  1. package/dist/ai/client/index.d.ts +1 -1
  2. package/dist/ai/client/index.d.ts.map +1 -1
  3. package/dist/ai/client/index.js +20 -4
  4. package/dist/ai/client/index.js.map +1 -1
  5. package/dist/ai/generate.d.ts +29 -0
  6. package/dist/ai/generate.d.ts.map +1 -1
  7. package/dist/ai/index.d.ts +3 -1
  8. package/dist/ai/index.d.ts.map +1 -1
  9. package/dist/ai/index.js +90 -90
  10. package/dist/ai/index.js.map +2 -2
  11. package/dist/ai/partialJson.d.ts +68 -0
  12. package/dist/ai/partialJson.d.ts.map +1 -0
  13. package/dist/ai/useChat.d.ts +29 -3
  14. package/dist/ai/useChat.d.ts.map +1 -1
  15. package/dist/app/index.js +1 -1
  16. package/dist/bun/plugin.js +1 -1
  17. package/dist/bun/preload.js +1 -1
  18. package/dist/{chunk-adsbv4rm.js → chunk-00sj67nx.js} +2 -2
  19. package/dist/{chunk-adsbv4rm.js.map → chunk-00sj67nx.js.map} +1 -1
  20. package/dist/{chunk-r1sjx2q9.js → chunk-0ahecas6.js} +2 -2
  21. package/dist/{chunk-r1sjx2q9.js.map → chunk-0ahecas6.js.map} +1 -1
  22. package/dist/{chunk-g06f1xf3.js → chunk-0rkastve.js} +4 -4
  23. package/dist/{chunk-g06f1xf3.js.map → chunk-0rkastve.js.map} +1 -1
  24. package/dist/{chunk-neh2zrp0.js → chunk-288ee6av.js} +2 -2
  25. package/dist/{chunk-neh2zrp0.js.map → chunk-288ee6av.js.map} +1 -1
  26. package/dist/{chunk-vm3ayd1b.js → chunk-2qac05gb.js} +3 -3
  27. package/dist/{chunk-vm3ayd1b.js.map → chunk-2qac05gb.js.map} +1 -1
  28. package/dist/{chunk-k6x35rn5.js → chunk-2rpz1p8g.js} +1 -1
  29. package/dist/{chunk-ztvewkks.js → chunk-3derdn99.js} +3 -3
  30. package/dist/{chunk-ztvewkks.js.map → chunk-3derdn99.js.map} +1 -1
  31. package/dist/{chunk-g57cg31m.js → chunk-3fm7gmp5.js} +2 -2
  32. package/dist/{chunk-g57cg31m.js.map → chunk-3fm7gmp5.js.map} +1 -1
  33. package/dist/{chunk-yrd14jjt.js → chunk-3jpj6hjh.js} +1 -1
  34. package/dist/{chunk-7g90w0t6.js → chunk-64r5cs5g.js} +1 -1
  35. package/dist/{chunk-6s7bb50m.js → chunk-6d3527qt.js} +3 -3
  36. package/dist/{chunk-6s7bb50m.js.map → chunk-6d3527qt.js.map} +1 -1
  37. package/dist/{chunk-3jnnma7m.js → chunk-6daabbfj.js} +2 -2
  38. package/dist/{chunk-3jnnma7m.js.map → chunk-6daabbfj.js.map} +1 -1
  39. package/dist/{chunk-am9gmm5a.js → chunk-6tferehw.js} +2 -2
  40. package/dist/{chunk-am9gmm5a.js.map → chunk-6tferehw.js.map} +1 -1
  41. package/dist/{chunk-q9xsgn2s.js → chunk-7b10n8m8.js} +2 -2
  42. package/dist/{chunk-q9xsgn2s.js.map → chunk-7b10n8m8.js.map} +1 -1
  43. package/dist/{chunk-rz6npg3r.js → chunk-7bz43qbt.js} +3 -3
  44. package/dist/{chunk-rz6npg3r.js.map → chunk-7bz43qbt.js.map} +1 -1
  45. package/dist/{chunk-07ttfngb.js → chunk-7dhvb6nn.js} +2 -2
  46. package/dist/{chunk-07ttfngb.js.map → chunk-7dhvb6nn.js.map} +1 -1
  47. package/dist/{chunk-ambptjfh.js → chunk-7gnspwra.js} +2 -2
  48. package/dist/{chunk-ambptjfh.js.map → chunk-7gnspwra.js.map} +1 -1
  49. package/dist/{chunk-njrnn5dw.js → chunk-7tm669mw.js} +2 -2
  50. package/dist/{chunk-njrnn5dw.js.map → chunk-7tm669mw.js.map} +1 -1
  51. package/dist/{chunk-btt706nx.js → chunk-810nrvt4.js} +2 -2
  52. package/dist/{chunk-btt706nx.js.map → chunk-810nrvt4.js.map} +1 -1
  53. package/dist/{chunk-7fzwgvyg.js → chunk-84j5b07n.js} +1 -1
  54. package/dist/{chunk-tr8s1z7k.js → chunk-87nekrjj.js} +3 -3
  55. package/dist/{chunk-tr8s1z7k.js.map → chunk-87nekrjj.js.map} +1 -1
  56. package/dist/{chunk-1kcv4dyh.js → chunk-87pn20z5.js} +2 -2
  57. package/dist/{chunk-1kcv4dyh.js.map → chunk-87pn20z5.js.map} +1 -1
  58. package/dist/{chunk-nhyx0gec.js → chunk-894xp2a6.js} +2 -2
  59. package/dist/{chunk-nhyx0gec.js.map → chunk-894xp2a6.js.map} +1 -1
  60. package/dist/{chunk-t797crcj.js → chunk-96r16t57.js} +3 -3
  61. package/dist/{chunk-t797crcj.js.map → chunk-96r16t57.js.map} +1 -1
  62. package/dist/{chunk-vfaen5tf.js → chunk-9mf6qzxy.js} +2 -2
  63. package/dist/{chunk-vfaen5tf.js.map → chunk-9mf6qzxy.js.map} +1 -1
  64. package/dist/{chunk-fzwaybhd.js → chunk-a1414jdv.js} +3 -3
  65. package/dist/{chunk-fzwaybhd.js.map → chunk-a1414jdv.js.map} +1 -1
  66. package/dist/chunk-a1r1r1z7.js +42 -0
  67. package/dist/{chunk-91vxf94n.js.map → chunk-a1r1r1z7.js.map} +5 -4
  68. package/dist/{chunk-pt159v3n.js → chunk-b55zt46z.js} +2 -2
  69. package/dist/{chunk-pt159v3n.js.map → chunk-b55zt46z.js.map} +1 -1
  70. package/dist/{chunk-1863jd18.js → chunk-beqhakdf.js} +2 -2
  71. package/dist/{chunk-1863jd18.js.map → chunk-beqhakdf.js.map} +1 -1
  72. package/dist/{chunk-s9etcqcq.js → chunk-bg2e7stx.js} +2 -2
  73. package/dist/{chunk-s9etcqcq.js.map → chunk-bg2e7stx.js.map} +1 -1
  74. package/dist/{chunk-skyt9hyg.js → chunk-bm3pyh9m.js} +2 -2
  75. package/dist/{chunk-skyt9hyg.js.map → chunk-bm3pyh9m.js.map} +1 -1
  76. package/dist/{chunk-wa7rtfkk.js → chunk-c07s6w45.js} +1 -1
  77. package/dist/{chunk-g09qz75d.js → chunk-cf5a958j.js} +2 -2
  78. package/dist/{chunk-g09qz75d.js.map → chunk-cf5a958j.js.map} +1 -1
  79. package/dist/{chunk-5d6h1znx.js → chunk-d5ftst76.js} +2 -2
  80. package/dist/{chunk-5d6h1znx.js.map → chunk-d5ftst76.js.map} +1 -1
  81. package/dist/{chunk-tvvqhwa3.js → chunk-d9pnjkxr.js} +2 -2
  82. package/dist/{chunk-tvvqhwa3.js.map → chunk-d9pnjkxr.js.map} +1 -1
  83. package/dist/{chunk-7pbwmt7j.js → chunk-dezd1fn5.js} +2 -2
  84. package/dist/{chunk-7pbwmt7j.js.map → chunk-dezd1fn5.js.map} +1 -1
  85. package/dist/{chunk-6dzm2pv7.js → chunk-dh4ax9cj.js} +2 -2
  86. package/dist/{chunk-6dzm2pv7.js.map → chunk-dh4ax9cj.js.map} +1 -1
  87. package/dist/{chunk-eyehyb9v.js → chunk-e38xa29v.js} +2 -2
  88. package/dist/{chunk-eyehyb9v.js.map → chunk-e38xa29v.js.map} +1 -1
  89. package/dist/{chunk-h5s56wzw.js → chunk-ecv4mtgh.js} +2 -2
  90. package/dist/{chunk-h5s56wzw.js.map → chunk-ecv4mtgh.js.map} +1 -1
  91. package/dist/chunk-f25x1sn1.js +5 -0
  92. package/dist/{chunk-y82d4w0m.js.map → chunk-f25x1sn1.js.map} +1 -1
  93. package/dist/{chunk-9beqhac6.js → chunk-f2tjtwm0.js} +2 -2
  94. package/dist/{chunk-9beqhac6.js.map → chunk-f2tjtwm0.js.map} +1 -1
  95. package/dist/{chunk-vgmmftm2.js → chunk-fdpvgeey.js} +2 -2
  96. package/dist/{chunk-vgmmftm2.js.map → chunk-fdpvgeey.js.map} +1 -1
  97. package/dist/{chunk-3m791vwf.js → chunk-g32mpf79.js} +2 -2
  98. package/dist/{chunk-3m791vwf.js.map → chunk-g32mpf79.js.map} +1 -1
  99. package/dist/{chunk-gprc53rf.js → chunk-gtdf51jz.js} +1 -1
  100. package/dist/{chunk-xnfkz18n.js → chunk-h2t135y3.js} +3 -3
  101. package/dist/{chunk-xnfkz18n.js.map → chunk-h2t135y3.js.map} +1 -1
  102. package/dist/{chunk-9brq77q6.js → chunk-hq710s2a.js} +3 -3
  103. package/dist/{chunk-9brq77q6.js.map → chunk-hq710s2a.js.map} +1 -1
  104. package/dist/{chunk-k1v0xgwe.js → chunk-kcvzs31p.js} +2 -2
  105. package/dist/{chunk-k1v0xgwe.js.map → chunk-kcvzs31p.js.map} +1 -1
  106. package/dist/{chunk-5f4k3n9x.js → chunk-krgwft9w.js} +2 -2
  107. package/dist/{chunk-5f4k3n9x.js.map → chunk-krgwft9w.js.map} +1 -1
  108. package/dist/{chunk-7rmsc511.js → chunk-kzv3v0tm.js} +3 -3
  109. package/dist/{chunk-7rmsc511.js.map → chunk-kzv3v0tm.js.map} +1 -1
  110. package/dist/{chunk-8z1z4zbq.js → chunk-m906xc76.js} +2 -2
  111. package/dist/{chunk-8z1z4zbq.js.map → chunk-m906xc76.js.map} +1 -1
  112. package/dist/{chunk-xh3qqmbk.js → chunk-mpreff3t.js} +2 -2
  113. package/dist/{chunk-xh3qqmbk.js.map → chunk-mpreff3t.js.map} +1 -1
  114. package/dist/{chunk-6bf04rk5.js → chunk-mpt1zsfv.js} +2 -2
  115. package/dist/{chunk-6bf04rk5.js.map → chunk-mpt1zsfv.js.map} +1 -1
  116. package/dist/{chunk-ry9jard2.js → chunk-nadkwh8a.js} +3 -3
  117. package/dist/{chunk-ry9jard2.js.map → chunk-nadkwh8a.js.map} +1 -1
  118. package/dist/{chunk-g0ps09h7.js → chunk-przahq2e.js} +2 -2
  119. package/dist/{chunk-g0ps09h7.js.map → chunk-przahq2e.js.map} +1 -1
  120. package/dist/{chunk-y16jhwrv.js → chunk-q19cs1qf.js} +2 -2
  121. package/dist/{chunk-y16jhwrv.js.map → chunk-q19cs1qf.js.map} +1 -1
  122. package/dist/{chunk-p9avgpzd.js → chunk-q6rse2fh.js} +2 -2
  123. package/dist/{chunk-p9avgpzd.js.map → chunk-q6rse2fh.js.map} +1 -1
  124. package/dist/{chunk-62v0y132.js → chunk-rdnxkecg.js} +2 -2
  125. package/dist/{chunk-62v0y132.js.map → chunk-rdnxkecg.js.map} +1 -1
  126. package/dist/{chunk-n6hd9swg.js → chunk-skq4g7qa.js} +2 -2
  127. package/dist/{chunk-n6hd9swg.js.map → chunk-skq4g7qa.js.map} +1 -1
  128. package/dist/{chunk-yantbc9e.js → chunk-sn31ps9c.js} +2 -2
  129. package/dist/{chunk-yantbc9e.js.map → chunk-sn31ps9c.js.map} +1 -1
  130. package/dist/{chunk-n31hppcx.js → chunk-spmxhsze.js} +2 -2
  131. package/dist/{chunk-n31hppcx.js.map → chunk-spmxhsze.js.map} +1 -1
  132. package/dist/{chunk-f3s8pz3m.js → chunk-srsmhbpt.js} +2 -2
  133. package/dist/{chunk-f3s8pz3m.js.map → chunk-srsmhbpt.js.map} +1 -1
  134. package/dist/{chunk-zscd52sv.js → chunk-tvkdqnhv.js} +3 -3
  135. package/dist/{chunk-zscd52sv.js.map → chunk-tvkdqnhv.js.map} +1 -1
  136. package/dist/{chunk-fagkv8sm.js → chunk-ty3kycy4.js} +2 -2
  137. package/dist/{chunk-fagkv8sm.js.map → chunk-ty3kycy4.js.map} +1 -1
  138. package/dist/{chunk-4b5rpya9.js → chunk-vhyabcw9.js} +2 -2
  139. package/dist/{chunk-4b5rpya9.js.map → chunk-vhyabcw9.js.map} +1 -1
  140. package/dist/{chunk-dcwsya9e.js → chunk-vv8vjjez.js} +2 -2
  141. package/dist/{chunk-dcwsya9e.js.map → chunk-vv8vjjez.js.map} +1 -1
  142. package/dist/{chunk-5467avf1.js → chunk-vvg3yxrc.js} +2 -2
  143. package/dist/{chunk-5467avf1.js.map → chunk-vvg3yxrc.js.map} +1 -1
  144. package/dist/{chunk-73svx8gr.js → chunk-wtdmwmm7.js} +3 -3
  145. package/dist/{chunk-73svx8gr.js.map → chunk-wtdmwmm7.js.map} +1 -1
  146. package/dist/{chunk-syqvk994.js → chunk-xgg9w7ep.js} +2 -2
  147. package/dist/{chunk-syqvk994.js.map → chunk-xgg9w7ep.js.map} +1 -1
  148. package/dist/{chunk-0jery7ys.js → chunk-xjb2kzkj.js} +4 -4
  149. package/dist/{chunk-0jery7ys.js.map → chunk-xjb2kzkj.js.map} +1 -1
  150. package/dist/{chunk-5sjteb6f.js → chunk-xmjzyzn6.js} +3 -3
  151. package/dist/{chunk-5sjteb6f.js.map → chunk-xmjzyzn6.js.map} +1 -1
  152. package/dist/{chunk-jc48hhha.js → chunk-yaacfbky.js} +2 -2
  153. package/dist/{chunk-jc48hhha.js.map → chunk-yaacfbky.js.map} +1 -1
  154. package/dist/{chunk-j1j0438r.js → chunk-ye72q3kx.js} +2 -2
  155. package/dist/{chunk-j1j0438r.js.map → chunk-ye72q3kx.js.map} +1 -1
  156. package/dist/{chunk-cxh9qe1c.js → chunk-yx03gndz.js} +2 -2
  157. package/dist/{chunk-cxh9qe1c.js.map → chunk-yx03gndz.js.map} +1 -1
  158. package/dist/{chunk-7stvx6x7.js → chunk-z2k8m02z.js} +2 -2
  159. package/dist/{chunk-7stvx6x7.js.map → chunk-z2k8m02z.js.map} +1 -1
  160. package/dist/{chunk-7n6vnmtv.js → chunk-z65e3vdy.js} +2 -2
  161. package/dist/{chunk-7n6vnmtv.js.map → chunk-z65e3vdy.js.map} +1 -1
  162. package/dist/{chunk-5nqwxjf1.js → chunk-zenfs4e2.js} +3 -3
  163. package/dist/{chunk-5nqwxjf1.js.map → chunk-zenfs4e2.js.map} +1 -1
  164. package/dist/{chunk-xwvm54dx.js → chunk-zyzhqnbm.js} +2 -2
  165. package/dist/{chunk-xwvm54dx.js.map → chunk-zyzhqnbm.js.map} +1 -1
  166. package/dist/config/index.js +1 -1
  167. package/dist/console/run.js +2 -2
  168. package/dist/console/run.js.map +1 -1
  169. package/dist/container/index.js +2 -2
  170. package/dist/container/index.js.map +1 -1
  171. package/dist/database/index.js +2 -2
  172. package/dist/database/index.js.map +1 -1
  173. package/dist/email/index.js +2 -2
  174. package/dist/email/index.js.map +1 -1
  175. package/dist/facades/index.js +2 -2
  176. package/dist/facades/index.js.map +1 -1
  177. package/dist/foundation/index.js +2 -2
  178. package/dist/foundation/index.js.map +1 -1
  179. package/dist/http/index.js +2 -2
  180. package/dist/http/index.js.map +1 -1
  181. package/dist/i18n/dictionaryRuntime.js +2 -2
  182. package/dist/i18n/dictionaryRuntime.js.map +1 -1
  183. package/dist/i18n/index.js +2 -2
  184. package/dist/i18n/index.js.map +1 -1
  185. package/dist/kernel/index.js +2 -2
  186. package/dist/kernel/index.js.map +1 -1
  187. package/dist/orm/index.js +2 -2
  188. package/dist/orm/index.js.map +1 -1
  189. package/dist/probe/index.js +2 -2
  190. package/dist/probe/index.js.map +1 -1
  191. package/dist/server/index.js +2 -2
  192. package/dist/server/index.js.map +1 -1
  193. package/dist/services/index.js +2 -2
  194. package/dist/services/index.js.map +1 -1
  195. package/dist/services/queue/work.js +2 -2
  196. package/dist/services/queue/work.js.map +1 -1
  197. package/dist/stats/route-table.js +1 -1
  198. package/dist/support/index.js +2 -2
  199. package/dist/support/index.js.map +1 -1
  200. package/dist/vitest/index.js +1 -1
  201. package/package.json +1 -1
  202. package/dist/chunk-91vxf94n.js +0 -41
  203. package/dist/chunk-y82d4w0m.js +0 -5
  204. /package/dist/{chunk-k6x35rn5.js.map → chunk-2rpz1p8g.js.map} +0 -0
  205. /package/dist/{chunk-yrd14jjt.js.map → chunk-3jpj6hjh.js.map} +0 -0
  206. /package/dist/{chunk-7g90w0t6.js.map → chunk-64r5cs5g.js.map} +0 -0
  207. /package/dist/{chunk-7fzwgvyg.js.map → chunk-84j5b07n.js.map} +0 -0
  208. /package/dist/{chunk-wa7rtfkk.js.map → chunk-c07s6w45.js.map} +0 -0
  209. /package/dist/{chunk-gprc53rf.js.map → chunk-gtdf51jz.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Fa as E}from"../chunk-07ttfngb.js";import{ab as p}from"../chunk-am9gmm5a.js";import{bb as H}from"../chunk-y82d4w0m.js";import{Cb as L,Db as Q,Eb as T,Ib as U,Jb as y,Kb as F,Lb as C,Ob as D,Pb as I,Sb as b,Vb as f,Wb as k,Xb as m,ob as g,pb as W,qb as _,rb as l,sb as P,tb as u,ub as $,vb as V,wb as q,xb as B,yb as K}from"../chunk-eyehyb9v.js";import"../chunk-91vxf94n.js";import"../chunk-5sjteb6f.js";import"../chunk-skyt9hyg.js";import{be as h}from"../chunk-tr8s1z7k.js";import"../chunk-6s7bb50m.js";import"../chunk-y16jhwrv.js";import{Fg as w,Ge as a,He as d,Jg as A,Ng as R,Ze as n,_e as v}from"../chunk-g06f1xf3.js";import"../chunk-vm3ayd1b.js";import"../chunk-ztvewkks.js";import"../chunk-5nqwxjf1.js";import"../chunk-p9avgpzd.js";import"../chunk-n31hppcx.js";import"../chunk-rz6npg3r.js";import{pj as M}from"../chunk-fzwaybhd.js";import"../chunk-4b5rpya9.js";import"../chunk-xwvm54dx.js";import"../chunk-dcwsya9e.js";import"../chunk-h5s56wzw.js";import"../chunk-73svx8gr.js";import"../chunk-ambptjfh.js";import"../chunk-cxh9qe1c.js";import"../chunk-t797crcj.js";import"../chunk-g09qz75d.js";import{gl as O,il as z}from"../chunk-ry9jard2.js";import"../chunk-5f4k3n9x.js";import"../chunk-7stvx6x7.js";import"../chunk-8z1z4zbq.js";import"../chunk-62v0y132.js";import"../chunk-r1sjx2q9.js";import"../chunk-xh3qqmbk.js";var N=[C,I,E,T,L,k,B,Q,D,y,_,U,f,V,F,H,b,K,q,m,$];class S{config={};providers=[];services=[];serviceInstances=[];serviceTokens=new Set;servicesBooted=!1;models=[];app=new z;boot(){if(this.models.length>0)p(...this.models);else s();this.app.config.merge(this.config),z.setInstance(this.app),this.app.registerMany([...N,...this.providers]),this.registerServices()}registerServices(){let j=this.serviceTokens;this.serviceInstances=[],this.serviceTokens=new Set,this.servicesBooted=!1;let X=new Map;for(let G of this.services){let J=typeof G==="function"?new G:G,x=J.constructor;if(!x.token)throw Error(`Service [${x.name}] is listed in \`services\` but does not declare a \`static token\`.`);let Y=X.get(x.token);if(Y)throw Error(`Services [${Y}] and [${x.name}] both declare the token "${x.token}". Tokens are the container's keys, so they must be unique.`);X.set(x.token,x.name);let Z=x;if(!j.has(x.token)&&this.app.bound(Z))throw Error(`Service [${x.name}] declares the token "${x.token}", which is already bound in the container by the framework or a provider. Binding it would replace that service everywhere, so pick a token nothing else owns.`);this.app.instance(Z,J),this.serviceInstances.push(J),this.serviceTokens.add(x.token)}}async waitForBoot(){await this.app.boot(),await this.bootServices(),l(this.app)}async bootServices(){if(this.servicesBooted)return;for(let j of this.serviceInstances)await j.boot();this.servicesBooted=!0}shutdown(j){return this.run(()=>this.app.shutdown(j))}run(j){return O.run(this.app,j)}resolve(j){return this.app.make(j)}apiRoutes(){return this.app.make(A)}viewRoutes(){return this.app.make(w)}domains(){return this.app.make(R)}queue(){return this.app.make(h)}mcpHttp(){return this.app.config.get("route.mcp.remote.enabled")===!0?this.app.make(g):null}sockets(){return this.app.config.get("route.channels")?this.app.make(u):null}globalMiddleware(j){return P(j)}destroy(){if(this.app.resolved(W))this.app.make(W).stop();if(this.app.flush(),z.getInstance()===this.app)z.setInstance(void 0);O.disable()}}function s(){if(Bun.env.NODE_ENV==="production")return;let j=M();if(j.length===0)return;console.warn(`[gemi] ${j.length} model${j.length===1?" is":"s are"} registered, but Kernel.models is empty.
2
+ import{Fa as E}from"../chunk-7dhvb6nn.js";import{ab as p}from"../chunk-6tferehw.js";import{bb as H}from"../chunk-f25x1sn1.js";import{Cb as L,Db as Q,Eb as T,Ib as U,Jb as y,Kb as F,Lb as C,Ob as D,Pb as I,Sb as b,Vb as f,Wb as k,Xb as m,ob as g,pb as W,qb as _,rb as l,sb as P,tb as u,ub as $,vb as V,wb as q,xb as B,yb as K}from"../chunk-e38xa29v.js";import"../chunk-a1r1r1z7.js";import"../chunk-xmjzyzn6.js";import"../chunk-bm3pyh9m.js";import{ce as h}from"../chunk-87nekrjj.js";import"../chunk-6d3527qt.js";import"../chunk-q19cs1qf.js";import{$e as v,Gg as w,He as a,Ie as d,Kg as A,Og as R,_e as n}from"../chunk-0rkastve.js";import"../chunk-2qac05gb.js";import"../chunk-3derdn99.js";import"../chunk-zenfs4e2.js";import"../chunk-q6rse2fh.js";import"../chunk-spmxhsze.js";import"../chunk-7bz43qbt.js";import{qj as M}from"../chunk-a1414jdv.js";import"../chunk-vhyabcw9.js";import"../chunk-zyzhqnbm.js";import"../chunk-vv8vjjez.js";import"../chunk-ecv4mtgh.js";import"../chunk-wtdmwmm7.js";import"../chunk-7gnspwra.js";import"../chunk-yx03gndz.js";import"../chunk-96r16t57.js";import"../chunk-cf5a958j.js";import{hl as O,jl as z}from"../chunk-nadkwh8a.js";import"../chunk-krgwft9w.js";import"../chunk-z2k8m02z.js";import"../chunk-m906xc76.js";import"../chunk-rdnxkecg.js";import"../chunk-0ahecas6.js";import"../chunk-mpreff3t.js";var N=[C,I,E,T,L,k,B,Q,D,y,_,U,f,V,F,H,b,K,q,m,$];class S{config={};providers=[];services=[];serviceInstances=[];serviceTokens=new Set;servicesBooted=!1;models=[];app=new z;boot(){if(this.models.length>0)p(...this.models);else s();this.app.config.merge(this.config),z.setInstance(this.app),this.app.registerMany([...N,...this.providers]),this.registerServices()}registerServices(){let j=this.serviceTokens;this.serviceInstances=[],this.serviceTokens=new Set,this.servicesBooted=!1;let X=new Map;for(let G of this.services){let J=typeof G==="function"?new G:G,x=J.constructor;if(!x.token)throw Error(`Service [${x.name}] is listed in \`services\` but does not declare a \`static token\`.`);let Y=X.get(x.token);if(Y)throw Error(`Services [${Y}] and [${x.name}] both declare the token "${x.token}". Tokens are the container's keys, so they must be unique.`);X.set(x.token,x.name);let Z=x;if(!j.has(x.token)&&this.app.bound(Z))throw Error(`Service [${x.name}] declares the token "${x.token}", which is already bound in the container by the framework or a provider. Binding it would replace that service everywhere, so pick a token nothing else owns.`);this.app.instance(Z,J),this.serviceInstances.push(J),this.serviceTokens.add(x.token)}}async waitForBoot(){await this.app.boot(),await this.bootServices(),l(this.app)}async bootServices(){if(this.servicesBooted)return;for(let j of this.serviceInstances)await j.boot();this.servicesBooted=!0}shutdown(j){return this.run(()=>this.app.shutdown(j))}run(j){return O.run(this.app,j)}resolve(j){return this.app.make(j)}apiRoutes(){return this.app.make(A)}viewRoutes(){return this.app.make(w)}domains(){return this.app.make(R)}queue(){return this.app.make(h)}mcpHttp(){return this.app.config.get("route.mcp.remote.enabled")===!0?this.app.make(g):null}sockets(){return this.app.config.get("route.channels")?this.app.make(u):null}globalMiddleware(j){return P(j)}destroy(){if(this.app.resolved(W))this.app.make(W).stop();if(this.app.flush(),z.getInstance()===this.app)z.setInstance(void 0);O.disable()}}function s(){if(Bun.env.NODE_ENV==="production")return;let j=M();if(j.length===0)return;console.warn(`[gemi] ${j.length} model${j.length===1?" is":"s are"} registered, but Kernel.models is empty.
3
3
  Nested relation reads resolve a model by name, so a policy on a subclass that does not own its
4
4
  `+" name is skipped inside every include \u2014 scoped at the root, "+`unscoped in an include, with nothing
5
5
  to notice it. Declaring the modules registers each class under its own name and audits the set:
@@ -13,4 +13,4 @@ import{Fa as E}from"../chunk-07ttfngb.js";import{ab as p}from"../chunk-am9gmm5a.
13
13
 
14
14
  See docs/orm.md#your-model-class. Development only; this never prints in production.`)}export{d as oneTimeSecretMatches,a as hashOneTimeSecret,N as frameworkProviders,v as UserProvider,n as SESSION_SELECT,S as Kernel};
15
15
 
16
- //# debugId=46FDB729A1C0F7EC64756E2164756E21
16
+ //# debugId=F34BFDBA86E4CE8864756E2164756E21
@@ -6,6 +6,6 @@
6
6
  "import { McpHttpServer } from \"../services/mcp/http/McpHttpServer\";\nimport { Application } from \"../foundation/Application\";\nimport type { ServiceProviderConstructor, ShutdownReport } from \"../foundation/Application\";\nimport type { ServiceToken } from \"../container/Container\";\nimport type { ConfigItems } from \"../support/Repository\";\nimport type { Service, ServiceConstructor } from \"../support/Service\";\nimport { registerModels } from \"../orm/registration\";\nimport { registeredNames } from \"../orm/registry\";\nimport { Scheduler } from \"../services/cron/Scheduler\";\nimport { QueueManager } from \"../services/queue/QueueManager\";\nimport { startClaimingIfServing } from \"../services/queue/QueueServiceProvider\";\nimport { ApiRouteDispatcher } from \"../services/router/ApiRouteDispatcher\";\nimport { ViewRouteDispatcher } from \"../services/router/ViewRouteDispatcher\";\nimport { DomainRouter } from \"../services/router/DomainRouter\";\nimport { runGlobalMiddleware } from \"../services/router/globalMiddleware\";\nimport { SocketHub } from \"../services/broadcast/SocketHub\";\nimport { kernelContext } from \"./context\";\nimport { frameworkProviders } from \"./providers\";\n\n/**\n * The app's entry point into the framework. A Kernel subclass declares what the\n * app adds — its `config` slices and any extra `providers` — and everything\n * else lives in the Application container it owns.\n */\nexport class Kernel {\n /**\n * App-level config, merged over the framework defaults. Each key is a config\n * slice: `{ mail: { ... }, route: { ... } }`, normally the modules under\n * `app/config`.\n */\n protected config: ConfigItems = {};\n\n /**\n * App-level providers, registered after the framework's own so they can\n * rebind anything the framework bound.\n */\n protected providers: ServiceProviderConstructor[] = [];\n\n /**\n * The app's own singleton services. Each is constructed during the\n * synchronous boot phase and its `boot()` awaited during the asynchronous\n * one, in the order listed — so a service whose `boot()` depends on another\n * goes after it.\n *\n * An entry is either the class itself or a configured instance from\n * `Service.with({ ... })`. Listing is explicit rather than discovered because\n * the order is load-bearing here, and because a service is always imported by\n * whatever injects it — there is no file the import graph would miss.\n */\n protected services: Array<ServiceConstructor | Service> = [];\n\n private serviceInstances: Service[] = [];\n private serviceTokens = new Set<string>();\n private servicesBooted = false;\n\n /**\n * The modules holding the app's model classes — normally\n * `[generated, models]`, the generated namespace and the barrel of subclasses\n * written over it. Every model class they export is registered under the name\n * its schema carries, later modules winning, and the whole set is audited\n * before anything else boots.\n *\n * ### Why this is a Kernel field and not a line in a file somewhere\n *\n * Registration used to be `register(\"User\", User)` next to each subclass, and\n * the failure mode of forgetting it is an authorization hole that nothing\n * reports: a relation read resolves its target by name, so an unregistered\n * policied subclass leaves the generated base owning the name and every\n * nested `include` of that model comes back unscoped. No error at the root\n * either, because `$exec`'s divergence guard begins `registered !== this` and\n * the base it is running on *is* the registered one. A model only ever read\n * through an include — a membership, a pivot, the kind that carries a tenant\n * scope — never trips anything.\n *\n * Listing the modules here says it once, in the same place the app already\n * declares its config slices and providers, and turns the mistake into a\n * failure to boot rather than a quiet cross-tenant read.\n *\n * It sees the modules it is given, so a model class in a file that no barrel\n * re-exports is still invisible. That is the residual, and it is a smaller\n * one: a barrel is a place to notice an omission, and thirteen `register`\n * lines scattered across thirteen files is not.\n */\n protected models: Array<Record<string, unknown>> = [];\n\n readonly app = new Application();\n\n /**\n * Phase one, synchronous: every provider is constructed and its `register()`\n * runs. Only bindings are recorded here — no service is instantiated, so this\n * is safe to call from a synchronous constructor (`new App({ kernel })`).\n * Phase two is `waitForBoot()`.\n */\n boot() {\n // Before the container, deliberately. This throws on a model whose policies\n // would be skipped, and the useful moment for that is the one where nothing\n // has been constructed and no request can be in flight.\n if (this.models.length > 0) registerModels(...this.models);\n else warnIfModelsAreRegisteredButUndeclared();\n\n this.app.config.merge(this.config);\n Application.setInstance(this.app);\n this.app.registerMany([...frameworkProviders, ...this.providers]);\n this.registerServices();\n }\n\n /**\n * Constructs every listed service and binds it into the container. Runs after\n * the providers have registered, so a provider's `boot()` can `inject()` one;\n * a `Service` constructor does no I/O, so doing this synchronously costs\n * nothing beyond the field initializers.\n */\n private registerServices() {\n // What a previous pass bound, so re-running this on the same kernel is not\n // mistaken for a collision with something else.\n const ours = this.serviceTokens;\n\n this.serviceInstances = [];\n this.serviceTokens = new Set();\n this.servicesBooted = false;\n\n const owners = new Map<string, string>();\n\n for (const declaration of this.services) {\n const instance =\n typeof declaration === \"function\" ? new declaration() : declaration;\n const ctor = instance.constructor as ServiceConstructor;\n\n if (!ctor.token) {\n throw new Error(\n `Service [${ctor.name}] is listed in \\`services\\` but does not declare a \\`static token\\`.`,\n );\n }\n\n // Two services under one token is the failure this refuses to have\n // silently: the second would replace the first in the container, and\n // every `inject()` written against either would hand back whichever was\n // listed last.\n const owner = owners.get(ctor.token);\n if (owner) {\n throw new Error(\n `Services [${owner}] and [${ctor.name}] both declare the token \"${ctor.token}\". Tokens are the container's keys, so they must be unique.`,\n );\n }\n owners.set(ctor.token, ctor.name);\n\n // The same failure one level out. `Container.instance()` writes into\n // `instances`, which `make()` consults before `bindings`, so a token that\n // is already spoken for is not shared with its owner — it replaces it, for\n // every `app()` and `inject()` in the process. An app service that named\n // itself \"mail\" would leave `Mail.send()` resolving to an object with no\n // `send`, and the boot that caused it would report nothing. Providers have\n // all registered by now, so anything bound here belongs to somebody else.\n const token = ctor as unknown as ServiceToken<Service>;\n if (!ours.has(ctor.token) && this.app.bound(token)) {\n throw new Error(\n `Service [${ctor.name}] declares the token \"${ctor.token}\", which is already bound in the container by the framework or a provider. Binding it would replace that service everywhere, so pick a token nothing else owns.`,\n );\n }\n\n this.app.instance(token, instance);\n this.serviceInstances.push(instance);\n this.serviceTokens.add(ctor.token);\n }\n }\n\n /**\n * Phase two, asynchronous: every provider's `boot()` runs, in registration\n * order, after all of them have registered. Idempotent.\n */\n async waitForBoot() {\n await this.app.boot();\n await this.bootServices();\n // Last, once every job — queued listeners included — is registered.\n startClaimingIfServing(this.app);\n }\n\n /**\n * Phase two for services, after every provider's `boot()` — so a service may\n * use the facades and anything else a provider owns. Idempotent, like the\n * provider phase it follows.\n */\n private async bootServices() {\n if (this.servicesBooted) {\n return;\n }\n for (const service of this.serviceInstances) {\n await service.boot();\n }\n this.servicesBooted = true;\n }\n\n /**\n * Every provider's `shutdown()`, in reverse registration order, inside the\n * application context — so a hook may use the facades, as a cron tick or a\n * request would. See `Application.shutdown` for the deadline and the\n * report. Idempotent.\n */\n shutdown(options?: { timeoutMs?: number }): Promise<ShutdownReport> {\n return this.run(() => this.app.shutdown(options));\n }\n\n run<T>(cb: () => T) {\n return kernelContext.run(this.app, cb);\n }\n\n /**\n * Resolve a service by token. Callers outside this module should prefer the\n * named accessors below or `app()`; this exists for tooling that holds a\n * Kernel but no ambient context.\n */\n resolve<T>(token: ServiceToken<T>): T {\n return this.app.make(token);\n }\n\n // Named accessors. `app/App.ts` goes through these rather than importing the\n // service classes itself — see the note in that file about the two copies of\n // gemi that coexist at build time.\n apiRoutes(): ApiRouteDispatcher {\n return this.app.make(ApiRouteDispatcher);\n }\n\n viewRoutes(): ViewRouteDispatcher {\n return this.app.make(ViewRouteDispatcher);\n }\n\n domains(): DomainRouter {\n return this.app.make(DomainRouter);\n }\n\n queue(): QueueManager {\n return this.app.make(QueueManager);\n }\n\n /** The MCP endpoint, or `null` when `route.mcp.remote` is not enabled. */\n mcpHttp(): McpHttpServer | null {\n return this.app.config.get(\"route.mcp.remote.enabled\") === true\n ? this.app.make(McpHttpServer)\n : null;\n }\n\n /**\n * The broadcast WebSocket endpoint, or `null` when the app declares no\n * `route.channels` (nothing could be subscribed to, so nothing is upgraded).\n */\n sockets(): SocketHub | null {\n return this.app.config.get(\"route.channels\") ? this.app.make(SocketHub) : null;\n }\n\n /** The `global` middleware list for one request. Call it inside `run`. */\n globalMiddleware(req: Request) {\n return runGlobalMiddleware(req);\n }\n\n destroy() {\n // Only touch services that were actually resolved — resolving one here\n // would construct it purely to tear it down.\n if (this.app.resolved(Scheduler)) {\n this.app.make(Scheduler).stop();\n }\n\n this.app.flush();\n\n if (Application.getInstance() === this.app) {\n Application.setInstance(undefined);\n }\n\n kernelContext.disable();\n }\n}\n\n/**\n * Says something to an application that has models and has not declared them.\n *\n * Without this the fix for #316 defaults to off. `models` is `[]`, `boot()`\n * no-ops, and an app upgrading from 0.48 is in exactly the state the issue\n * describes until somebody edits their Kernel by hand — while the only place\n * that says to is the **Setup** section of `docs/orm.md`, which an existing app\n * read once and will not read again. #316 was filed by an app mid-migration\n * with a 79-model schema, which is precisely the reader who never sees it.\n *\n * The condition is what makes this worth printing. A populated registry with an\n * empty `models` means the generated `index.ts` was imported and its bases are\n * what every nested read resolves to — so if any policy lives on a subclass, it\n * is being skipped inside includes right now. A Kernel with no ORM at all has\n * an empty registry and hears nothing.\n *\n * Development only, and a warning rather than a throw: an app in this state is\n * running today, and turning a working deploy into a failure to start over an\n * arrangement that *might* be fine is not a patch-level thing to do. The\n * failure it points at is silent, so the fix for it has to be noisy somewhere,\n * and the terminal an author is already looking at is the cheapest somewhere\n * there is.\n */\nfunction warnIfModelsAreRegisteredButUndeclared(): void {\n if (process.env.NODE_ENV === \"production\") return;\n\n const registered = registeredNames();\n if (registered.length === 0) return;\n\n console.warn(\n `[gemi] ${registered.length} model${registered.length === 1 ? \" is\" : \"s are\"} ` +\n `registered, but Kernel.models is empty.\\n` +\n ` Nested relation reads resolve a model by name, so a policy on a ` +\n `subclass that does not own its\\n` +\n ` name is skipped inside every include — scoped at the root, ` +\n `unscoped in an include, with nothing\\n` +\n ` to notice it. Declaring the modules registers each class under ` +\n `its own name and audits the set:\\n\\n` +\n ` import * as generated from \"../models/generated\"\\n` +\n ` import * as models from \"../models\"\\n\\n` +\n ` export default class extends Kernel {\\n` +\n ` models = [generated, models]\\n` +\n ` }\\n\\n` +\n ` See docs/orm.md#your-model-class. Development only; this never ` +\n `prints in production.`,\n );\n}\n"
7
7
  ],
8
8
  "mappings": ";u9CA2CO,DAAM,HAAmD,JAC9D,HACA,HACA,HAIA,HAGA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,JACF,HC9CO,CAAM,JAAO,JAMR,EAAsB,JAAC,HAMvB,KAA0C,JAAC,EAa3C,SAAgD,CAAC,EAEnD,iBAA8B,CAAC,EAC/B,cAAgB,IAAI,IACpB,eAAiB,GA8Bf,OAAyC,CAAC,EAE3C,IAAM,IAAI,EAQnB,IAAI,EAAG,CAIL,GAAI,KAAK,OAAO,OAAS,EAAG,EAAe,GAAG,KAAK,MAAM,EACpD,OAAuC,EAE5C,KAAK,IAAI,OAAO,MAAM,KAAK,MAAM,EACjC,EAAY,YAAY,KAAK,GAAG,EAChC,KAAK,IAAI,aAAa,CAAC,GAAG,EAAoB,GAAG,KAAK,SAAS,CAAC,EAChE,KAAK,iBAAiB,EAShB,gBAAgB,EAAG,CAGzB,IAAM,EAAO,KAAK,cAElB,KAAK,iBAAmB,CAAC,EACzB,KAAK,cAAgB,IAAI,IACzB,KAAK,eAAiB,GAEtB,IAAM,EAAS,IAAI,IAEnB,QAAW,KAAe,KAAK,SAAU,CACvC,IAAM,EACJ,OAAO,IAAgB,WAAa,IAAI,EAAgB,EACpD,EAAO,EAAS,YAEtB,GAAI,CAAC,EAAK,MACR,MAAU,MACR,YAAY,EAAK,0EACnB,EAOF,IAAM,EAAQ,EAAO,IAAI,EAAK,KAAK,EACnC,GAAI,EACF,MAAU,MACR,aAAa,WAAe,EAAK,iCAAiC,EAAK,kEACzE,EAEF,EAAO,IAAI,EAAK,MAAO,EAAK,IAAI,EAShC,IAAM,EAAQ,EACd,GAAI,CAAC,EAAK,IAAI,EAAK,KAAK,GAAK,KAAK,IAAI,MAAM,CAAK,EAC/C,MAAU,MACR,YAAY,EAAK,6BAA6B,EAAK,sKACrD,EAGF,KAAK,IAAI,SAAS,EAAO,CAAQ,EACjC,KAAK,iBAAiB,KAAK,CAAQ,EACnC,KAAK,cAAc,IAAI,EAAK,KAAK,QAQ/B,YAAW,EAAG,CAClB,MAAM,KAAK,IAAI,KAAK,EACpB,MAAM,KAAK,aAAa,EAExB,EAAuB,KAAK,GAAG,OAQnB,aAAY,EAAG,CAC3B,GAAI,KAAK,eACP,OAEF,QAAW,KAAW,KAAK,iBACzB,MAAM,EAAQ,KAAK,EAErB,KAAK,eAAiB,GASxB,QAAQ,CAAC,EAA2D,CAClE,OAAO,KAAK,IAAI,IAAM,KAAK,IAAI,SAAS,CAAO,CAAC,EAGlD,GAAM,CAAC,EAAa,CAClB,OAAO,EAAc,IAAI,KAAK,IAAK,CAAE,EAQvC,OAAU,CAAC,EAA2B,CACpC,OAAO,KAAK,IAAI,KAAK,CAAK,EAM5B,SAAS,EAAuB,CAC9B,OAAO,KAAK,IAAI,KAAK,CAAkB,EAGzC,UAAU,EAAwB,CAChC,OAAO,KAAK,IAAI,KAAK,CAAmB,EAG1C,OAAO,EAAiB,CACtB,OAAO,KAAK,IAAI,KAAK,CAAY,EAGnC,KAAK,EAAiB,CACpB,OAAO,KAAK,IAAI,KAAK,CAAY,EAInC,OAAO,EAAyB,CAC9B,OAAO,KAAK,IAAI,OAAO,IAAI,0BAA0B,IAAM,GACvD,KAAK,IAAI,KAAK,CAAa,EAC3B,KAON,OAAO,EAAqB,CAC1B,OAAO,KAAK,IAAI,OAAO,IAAI,gBAAgB,EAAI,KAAK,IAAI,KAAK,CAAS,EAAI,KAI5E,gBAAgB,CAAC,EAAc,CAC7B,OAAO,EAAoB,CAAG,EAGhC,OAAO,EAAG,CAGR,GAAI,KAAK,IAAI,SAAS,CAAS,EAC7B,KAAK,IAAI,KAAK,CAAS,EAAE,KAAK,EAKhC,GAFA,KAAK,IAAI,MAAM,EAEX,EAAY,YAAY,IAAM,KAAK,IACrC,EAAY,YAAY,MAAS,EAGnC,EAAc,QAAQ,EAE1B,CAyBA,SAAS,CAAsC,EAAS,CACtD,GAAI,mBAAyB,aAAc,OAE3C,IAAM,EAAa,EAAgB,EACnC,GAAI,EAAW,SAAW,EAAG,OAE7B,QAAQ,KACN,UAAU,EAAW,eAAe,EAAW,SAAW,EAAI,MAAQ;AAAA;AAAA,EAIpE,2EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6FAUJ",
9
- "debugId": "46FDB729A1C0F7EC64756E2164756E21",
9
+ "debugId": "F34BFDBA86E4CE8864756E2164756E21",
10
10
  "names": []
11
11
  }
package/dist/orm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ca as v6}from"../chunk-pt159v3n.js";import{$a as w6,Ga as J9,Ha as Y9,Ia as l,Ja as b9,Ka as b3,La as S6,Ma as b6,Na as q0,Oa as e5,Pa as q3,Qa as q6,Ra as Z3,Sa as I0,Ta as e4,Ua as $7,Va as Z7,Wa as d5,Xa as X7,Ya as z7,Za as J7,_a as E6,ab as x6}from"../chunk-am9gmm5a.js";import{lh as U6,mh as N6,nh as F6,oh as O6,ph as A6}from"../chunk-vm3ayd1b.js";import{Ah as _6,Bh as z5,Ch as C6,Dh as u3,Eh as k,Fh as L6,Gh as T6,Hh as R6,Ih as I6,Jh as a5,qh as A0,rh as o,sh as j,th as n,wh as R,xh as x,yh as c,zh as Q6}from"../chunk-ztvewkks.js";import"../chunk-n31hppcx.js";import{Aj as t4,Bj as r4,Cj as a4,mj as H6,nj as a,oj as d,pj as D3,qj as y0,sj as j6,tj as K6,yj as l4,zj as o4}from"../chunk-fzwaybhd.js";import{$j as n5,Dj as K,Ej as T,Fj as k0,Gj as g,Hj as a8,Ij as $0,Jj as e8,Kj as c5,Lj as $6,Mj as C5,Nj as Z6,Pj as X6,Qj as s5,Rj as z6,Sj as J6,Tj as i5,Uj as T3,Vj as f0,Wj as d3,Xj as c3,Yj as s,Zj as Y6,_j as g0}from"../chunk-4b5rpya9.js";import{gk as W6,hk as $3,ik as T0,jk as O3,mk as M6,ok as B6,pk as D6,qk as l5,rk as o5,sk as m5,tk as A3,uk as P6,vk as t5,wk as r5}from"../chunk-73svx8gr.js";import{Hk as V6,Jk as G6,Lk as p5}from"../chunk-ambptjfh.js";import{jl as u5}from"../chunk-ry9jard2.js";import"../chunk-5f4k3n9x.js";import"../chunk-xh3qqmbk.js";function N0($,Z,X,z,J,Y){let H=X0($,Z),G=B0($,H,Z,Y),V=X.quoteIdent(z),W=`${V}.`,M=G.parentFields.map((Q,C)=>{let F=`${W}${X.quoteIdent(X3(H,Z,G.childFields[C]))}`,N=`${J}${X.quoteIdent(X3($,Z,Q))}`;return`${F} = ${N}`}).join(" and ");if(!G.join)return{child:H,source:`${X.quoteIdent(H.table)} as ${V}`,correlation:M,qualifier:W};let B=`${W}${X.quoteIdent(X3(H,Z,G.childFields[0]))}`,D=`${J}${X.quoteIdent(X3($,Z,G.parentFields[0]))}`,P=X.quoteIdent(`${z}j`);return{child:H,source:`${X.quoteIdent(H.table)} as ${V} join ${X.quoteIdent(G.join.table)} as ${P} on ${P}.${X.quoteIdent(G.join.childColumn)} = ${B}`,correlation:`${P}.${X.quoteIdent(G.join.parentColumn)} = ${D}`,qualifier:W}}function X3($,Z,X){let z=$.fields[X];if(!z)throw new s($.name,Z.name,`it joins on '${X}', which is not a field on ${$.name}.`);return z.column}function u($,Z,X){let z=z3($);if(typeof Z!=="object"||Z===null||Array.isArray(Z))throw X9($,X,z);let J=Object.keys(Z).filter((H)=>Z[H]!==void 0),Y=Z;for(let H of z){if(H.length===1&&J.includes(H[0]))return Z9($,X,H[0],Y[H[0]]),H;let G=H.join("_");if(H.length>1&&J.includes(G)){let V=Y[G];if(V&&typeof V==="object"&&!Array.isArray(V))for(let W of H)Z9($,X,`${G}.${W}`,V[W]);return H}}throw X9($,X,z)}function v3($){if($===null||$===void 0)return!1;let Z=typeof $;if(Z!=="object")return Z!=="function"&&Z!=="symbol";if(Array.isArray($))return!1;if($ instanceof Date||ArrayBuffer.isView($))return!0;let X=Object.getPrototypeOf($);return X!==Object.prototype&&X!==null}function Z9($,Z,X,z){if(z===void 0||v3(z))return;throw new T(`${Z.argument}.${X}`,Z.model,Z.operation,`A unique key takes a plain value to match, not ${z===null?"null":Array.isArray(z)?"an array":"a filter object"}. Use findFirst/findMany (or updateMany/deleteMany) to filter on ${$.name}.${X.split(".").pop()}.`)}function k3($,Z,X){u($,Z,{model:$.name,operation:X,argument:"where"})}function z3($){let Z=[];if($.primaryKey.length>0)Z.push($.primaryKey);for(let X of $.uniques)Z.push(X);return Z}function X9($,Z,X){let z=X.map((H)=>H.length===1?H[0]:H.join("_")).join(", "),Y=Z.argument.startsWith("data.")?`Name it by one of those, or reach it through the ${$.name} model directly.`:`Use ${Z.operation==="delete"||Z.operation==="update"?`${Z.operation}Many`:"findFirst"} to query on anything else.`;return new K(Z.argument,Z.model,Z.operation,`${$.name} needs a unique field here. It declares: ${z}. ${Y}`)}function y($,Z,X){let z=Z.castParameter($);if(!z)return n(X);return n((J,Y)=>{let H=X(J,Y);if(H===null||H===void 0)return null;let G=k(H);if(G==="db")return null;if(G==="json")return"null";if(G==="any")throw Error("gemi ORM bug: Prisma.AnyNull reached the parameter binder. It is a filter operand only, and both the filter and write paths are supposed to have handled it before this point.");return JSON.stringify(H)},z)}function f($,Z,X,z){if(Z===void 0||Z===null)return null;if(typeof Z!=="object"||Array.isArray(Z))throw new T("where",$.name,X.operation,"Expected an object.");let J=[];for(let Y of Object.keys(Z).sort()){let H=Z[Y];if(H===void 0)continue;let G=(W)=>z(W)?.[Y];if(Y==="AND"||Y==="OR"){let W=z9($,H,X,G,Y);if(W)J.push(W);continue}if(Y===z0){J.push(K7($,H,X,G));continue}if(Y==="NOT"){let W=z9($,H,X,G,"AND");if(W)J.push(R(j("not "),w0(W)));continue}if(Y in $.relations){let W=D7($,$.relations[Y],H,X,G);if(W)J.push(W);continue}let V=$.fields[Y];if(!V){let W=j7($,Y,H,X,G);if(W){J.push(W);continue}throw new g(Y,$.name,Object.keys($.fields))}J.push(m3($,V,H,X,G))}if(J.length===0)return null;if(J.length===1)return J[0];return t(J," and ")}function D7($,Z,X,z,J){let Y=J9(Z.kind),H=P7($,Z,X,Y,z),G=z.relationDepth??0,V=z.dialect,W=z.qualifier??`${V.quoteIdent($.table)}.`,M=N0($,Z,V,`_r${G}`,W,z.operation),B=M.child,D=j(M.correlation),P={...z,qualifier:M.qualifier,relationDepth:G+1},Q=[];for(let C of Y){if(!(C in H))continue;let F=H[C],N=(I)=>H.direct?J(I):J(I)?.[C];if(F===null){Q.push(f3(M,D,null,C==="is"));continue}let L=f(B,F,P,N);if(C==="every"){if(!L)continue;Q.push(f3(M,D,R(j("not "),w0(L)),!0));continue}let _=C==="none"||C==="isNot";Q.push(f3(M,D,L,_))}if(Q.length===0)return null;if(Q.length===1)return Q[0];return t(Q," and ")}function f3($,Z,X,z){let J=[j(`${z?"not ":""}exists (select 1 from ${$.source} where `),Z];if(X)J.push(j(" and "),X);return J.push(j(")")),R(...J)}function P7($,Z,X,z,J){let Y=`where.${Z.name}`,H=Z.kind==="many";if(X===null){if(H)throw new K(Y,$.name,J.operation,`${Z.name} is a to-many relation, so null is not a filter for it. Use { none: {} } for "has no related rows".`);return{is:null,direct:!0}}if(typeof X!=="object"||Array.isArray(X))throw new T(Y,$.name,J.operation,H?`Expected an object holding ${z.join(", ")}.`:"Expected an object, or null.");if(Y9(X,z))return X;if(H)throw new K(Y,$.name,J.operation,`Expected one of ${z.join(", ")}. A to-many relation has no `+"single reading of a bare filter \u2014 { some: \u2026 } and { every: \u2026 } mean "+"different things.");return{is:X,direct:!0}}function j7($,Z,X,z,J){let Y=z3($).find((V)=>V.length>1&&V.join("_")===Z);if(!Y)return null;if(typeof X!=="object"||X===null||Array.isArray(X))throw new T(`where.${Z}`,$.name,z.operation,`Expected an object holding ${Y.join(" and ")}.`);let H=X,G=[];for(let V of Y){if(H[V]===void 0)throw new K(`where.${Z}`,$.name,z.operation,`Missing '${V}'. A composite key needs all of ${Y.join(", ")}.`);if(!v3(H[V]))throw new T(`where.${Z}.${V}`,$.name,z.operation,`A composite key takes a plain value for each of ${Y.join(", ")}, not a filter, an array or null.`);G.push(m3($,$.fields[V],H[V],z,(W)=>J(W)?.[V]))}return G.length===1?G[0]:t(G," and ")}function z9($,Z,X,z,J){let Y=[];if(Array.isArray(Z))for(let H=0;H<Z.length;H++){let G=f($,Z[H],X,(V)=>z(V)?.[H]);if(G)Y.push(G)}else{let H=f($,Z,X,z);if(H)Y.push(H)}if(Y.length===0)return J==="AND"?null:H9;if(Y.length===1)return Y[0];return t(Y,J==="AND"?" and ":" or ")}var H9=j("false");function t($,Z){return R(j("("),x($,Z),j(")"))}function w0($){return $.text.startsWith("(")?$:t([$],"")}var h3=new Set(["equals","not","in","notIn","lt","lte","gt","gte","contains","startsWith","endsWith","mode"]),V9={lt:"<",lte:"<=",gt:">",gte:">="},z0="$compositeIn",G9=Symbol("gemi.orm.compositeInFromPlanner");function W9($,Z){return{[G9]:!0,fields:$,values:Z}}function K7($,Z,X,z){let{dialect:J}=X,H=Q7($,Z,X).map((V)=>{let W=$.fields[V];if(!W)throw new g(V,$.name,Object.keys($.fields));return W}),G=H.map((V)=>`${X.qualifier??""}${J.quoteIdent(V.column)}`);return J.compositeIn(G,H.map((V)=>V.type),(V)=>z(V).values)}function Q7($,Z,X){let z=()=>{throw new g(z0,$.name,Object.keys($.fields))};if(typeof Z!=="object"||Z===null||Array.isArray(Z))return z();if(Z[G9]!==!0)return z();let J=(G)=>{throw new K(z0,$.name,X.operation,G)},{fields:Y,values:H}=Z;if(!Array.isArray(Y)||Y.length===0)return J(`the planner built a '${z0}' with no fields.`);if(!Y.every((G)=>typeof G==="string"))return J(`the planner built a '${z0}' with a non-string field.`);if(!Array.isArray(H))return J(`the planner built a '${z0}' with no values.`);if(!H.every((G)=>Array.isArray(G)&&G.length===Y.length))return J(`the planner built a '${z0}' whose tuples do not all have ${Y.length} value(s).`);return Y}var _7=["equals","has","hasEvery","hasSome","isEmpty"],g3=new Set(_7);function C7($,Z,X,z,J,Y){let{dialect:H}=J;if(O0($,Z,`where.${Z.name}`,J.operation,H),Array.isArray(z))throw new T(`where.${Z.name}`,$.name,J.operation,`'${Z.name}' is a scalar list, and a bare array is not a filter on `+"one \u2014 Prisma rejects it here too. Say which comparison you mean: "+`{ ${Z.name}: { equals: [...] } } for the whole list, or { ${Z.name}: { hasEvery: [...] } } for "contains all of these". A bare array *is* accepted as a value in \`data\`.`);if(!p3(z))throw new T(`where.${Z.name}`,$.name,J.operation,`'${Z.name}' is a scalar list. Expected an object holding ${[...g3].sort().join(", ")}; received ${z===null?"null":typeof z}.`);let G=z,V=[];for(let W of Object.keys(G).sort()){let M=G[W];if(M===void 0)continue;if(!g3.has(W))throw new T(`where.${Z.name}.${W}`,$.name,J.operation,`'${Z.name}' is a scalar list, and a list filter takes ${[...g3].sort().join(", ")}. The scalar operators \u2014 `+`${[...h3].sort().join(", ")} \u2014 apply to a single value and `+"Prisma does not offer them here.");let B=(D)=>Y(D)?.[W];V.push(L7($,Z,X,W,M,J,B))}if(V.length===0)return j("true");if(V.length===1)return V[0];return t(V," and ")}function L7($,Z,X,z,J,Y,H){let{dialect:G}=Y;if(z==="equals")return T7($,Z,X,J,Y,H);if(z==="isEmpty"){if(typeof J!=="boolean")throw new T(`where.${Z.name}.isEmpty`,$.name,Y.operation,`Expected true or false, received ${J===null?"null":typeof J}.`);return G.listIsEmpty(X,J)}if(z==="has"){let W=R7(Z);return G.listHas(X,y(W,G,F0(W,G,H)))}if(!Array.isArray(J))throw new T(`where.${Z.name}.${z}`,$.name,Y.operation,`Expected an array, received ${J===null?"null":typeof J}.`);let V=y(Z,G,F0(Z,G,H));return z==="hasEvery"?G.listHasEvery(X,V):G.listHasSome(X,V)}function T7($,Z,X,z,J,Y){let{dialect:H}=J;if(z===null)return j(`${X} is null`);if(!Array.isArray(z))throw new T(`where.${Z.name}.equals`,$.name,J.operation,`'${Z.name}' is a scalar list, so it compares against an array. Received ${typeof z}. For "is this element present", use { ${Z.name}: { has: \u2026 } }.`);return R(j(`${X} = `),y(Z,H,F0(Z,H,Y)))}function R7($){return{...$,isList:!1}}function O0($,Z,X,z,J){if(J.listFilters.size>0)return;throw new K(X,$.name,z,`'${Z.name}' is a scalar list, and ${J.name} has no array type to hold one. Prisma refuses the column itself on ${J.name} \u2014 `+'"the current connector does not support lists of primitive types" \u2014 so '+`this is a difference between the databases rather than a gap in the ORM. The generated artifact is dialect-agnostic, which is why this surfaces here rather than at \`prisma generate\`: the schema was generated against Postgres and DATABASE_URL names a ${J.name} database, which has no '${Z.column}' column either. It works on postgres.`)}var I7=["equals","not","string_contains","string_starts_with","string_ends_with","array_contains","lt","lte","gt","gte"],y3=new Set(I7),U7=["has_key","has_some_keys","has_every_key"],J3=new Set(U7);function M9($,Z,X,z,J,Y,H,G){let V=z!=="has_key",W=`where.${Z.name}.${z}`,M=(D)=>{if(!(V?Array.isArray(D)&&D.every((Q)=>typeof Q==="string"):typeof D==="string"))throw new T(W,$.name,Y.operation,V?"Expected an array of key names, like ['a', 'b'].":"Expected a key name, like 'a'.");return D};M(J);let B=(D,P)=>M(G(D,P));return Y.dialect.jsonHasKeys(X,H,B,z==="has_key"?"one":z==="has_some_keys"?"some":"every",Array.isArray(J)?J.length:0)}function N7($,Z,X,z,J,Y){let{dialect:H}=J;if(Z.type!=="Json")throw new K(`${Z.name}.path`,$.name,J.operation,`A 'path' filter reads inside a JSON document, and '${Z.name}' is a ${Z.type} column.`);S7($,Z,z.path,J);let G=(M)=>Y(M)?.path,V=Object.keys(z).filter((M)=>M!=="path"&&z[M]!==void 0).sort();if(V.length===0)throw new K(`${Z.name}.path`,$.name,J.operation,`A 'path' needs a filter beside it \u2014 ${[...y3,...J3].sort().join(", ")}. Prisma refuses a bare path too.`);let W=[];for(let M of V){if(J3.has(M)){W.push(M9($,Z,X,M,z[M],J,G,(P)=>Y(P)?.[M]));continue}if(!y3.has(M))throw new K(`${Z.name}.${M}`,$.name,J.operation,`A JSON path filter takes ${[...y3,...J3].sort().join(", ")}.`);if(!H.jsonFilters.has(M))throw new K(`${Z.name}.${M}`,$.name,J.operation,`'${M}' on a JSON path is not available on ${H.name}. Prisma refuses it here too, so this is a difference between the databases rather than a gap in the ORM. It works on postgres.`);let B=z[M],D=B===null?"json":k(B);if(D&&(M==="equals"||M==="not")){W.push(F7(D,X,G,Z,H,M==="not"));continue}if(D&&B!==null){let P=M==="array_contains"?"'array_contains' tests containment against a document, and a sentinel is not one":`'${M}' compares an extracted value against a scalar, and a sentinel is not one`;throw new T(`where.${Z.name}.${M}`,$.name,J.operation,`${x0(D)} asks which kind of null a value is, which `+`only 'equals' and 'not' can express \u2014 ${P}. Prisma refuses it under this operator too. Write { ${Z.name}: { path: [\u2026], equals: ${x0(D)} } }, `+"or filter the column itself \u2014 "+`{ ${Z.name}: { equals: ${x0(D)} } }.`)}if(B9(B))throw new T(`where.${Z.name}.${M}`,$.name,J.operation,"Prisma.AnyNull is a question rather than a value \u2014 'either kind of "+"null' \u2014 so it cannot appear inside a document. Ask it directly: "+`{ ${Z.name}: { path: [\u2026], equals: Prisma.AnyNull } }.`);O7(M,B,$,Z,J),W.push(A7(M,X,G,Z,H,(P)=>Y(P)?.[M]))}return W.length===1?W[0]:t(W," and ")}function F7($,Z,X,z,J,Y){let H=()=>R(J.jsonValueAt(Z,X),j(Y?" is not null":" is null")),G=()=>R(J.jsonValueAt(Z,X),j(Y?" <> ":" = "),y(z,J,()=>J.encode(u3,z)));if($==="db")return H();if($==="json")return G();return t([G(),H()],Y?" and ":" or ")}function O7($,Z,X,z,J){let Y=$==="string_contains"||$==="string_starts_with"||$==="string_ends_with";if(Y&&typeof Z!=="string")throw new T(`where.${z.name}.${$}`,X.name,J.operation,`Expected a string, received ${Z===null?"null":typeof Z}. Prisma raises here too \u2014 without this the pattern becomes `+`'%${String(Z)}%', which runs and returns the wrong rows.`);if(Z===null)throw new T(`where.${z.name}.${$}`,X.name,J.operation,$==="array_contains"?"null cannot be tested for containment through a JSON path: the operand binds as SQL NULL rather than as the JSON value, and "+"'x @> NULL' is NULL rather than true \u2014 the query would run and "+`match nothing. A null *inside* the document is an ordinary value and still compiles: { ${z.name}: { path: [\u2026], array_contains: [null] } }.`:`null cannot be compared through a JSON path with '${$}', which `+"compares the extracted value as a number \u2014 the comparison against "+`NULL is NULL rather than true, so the query would run and match nothing. Prisma refuses it here too. For "the value at this path is a JSON null", use equals or not: { ${z.name}: { path: [\u2026], equals: null } }.`);if($==="array_contains"||Y)return;if(typeof Z==="object")throw new K(`where.${z.name}.${$}`,X.name,J.operation,`'${$}' on a JSON path compares the extracted value as a scalar, so `+"an object or array operand cannot be expressed \u2014 it would bind as "+`'${String(Z)}' and match nothing. Prisma accepts one here; gemi does not yet. Use array_contains for containment, or narrow the path until it names a scalar.`)}function A7($,Z,X,z,J,Y){if($==="array_contains")return J.jsonArrayContains(Z,X,Y);let H=$==="string_contains"||$==="string_starts_with"||$==="string_ends_with",G=J.jsonExtract(Z,X,!0);if(H){let B=$==="string_contains"?(D)=>`%${D}%`:$==="string_starts_with"?(D)=>`${D}%`:(D)=>`%${D}`;return R(j("("),G,j(") like "),n((D,P)=>{let Q=Y(D,P);return Q===null||Q===void 0?null:B(String(Q))}))}let V=$==="equals"?"=":$==="not"?"<>":V9[$],W=$!=="equals"&&$!=="not",M=W?R(j("cast(("),G,j(") as real)")):R(j("("),G,j(")"));return R(M,j(` ${V} `),n((B,D)=>{let P=Y(B,D);if(P===null||P===void 0)return null;if(W)return Number(P);return J.jsonComparesAsText?String(P):P}))}function S7($,Z,X,z){let{dialect:J}=z,Y=J.jsonPathSyntax==="array"?"array":"jsonpath",H=Array.isArray(X)?"array":typeof X==="string"?"jsonpath":"other";if(Array.isArray(X)&&X.length===0||X==="")throw new K(`${Z.name}.path`,$.name,z.operation,`A JSON path cannot be empty. ${J.jsonPathSyntax==="array"?`On ${J.name} an empty array selects the whole document, `+"which is a filter on the column rather than on a path \u2014 write "+`{ ${Z.name}: { equals: \u2026 } } if that is what you meant.`:`On ${J.name} an empty string raises inside json_extract.`}`);if(H===Y){if(Y!=="array")return;let V=X.findIndex((B)=>typeof B!=="string");if(V===-1)return;let W=X[V],M=W===null?"null":W===void 0?"undefined":Array.isArray(W)?"an array":typeof W==="object"?"an object":`a ${typeof W}`;throw new K(`${Z.name}.path`,$.name,z.operation,`A JSON path is an array of strings, and path[${V}] is ${M}. `+(typeof W==="number"?'An array index is a key too \u2014 write ["items", "0"] rather than '+`["items", 0]; it reaches the same element, because ${J.name} takes the path as text. Prisma's path is string[] and its client refuses a number here too.`:"Prisma's path is string[] too."))}throw new K(`${Z.name}.path`,$.name,z.operation,J.jsonPathSyntax==="array"?`On ${J.name} a JSON path is an array of keys \u2014 ["a", "b"] \u2014 `+"not a JSONPath string. Prisma splits them the same way, and refuses the other form on each database.":`On ${J.name} a JSON path is a JSONPath string \u2014 "$.a.b" \u2014 not `+"an array of keys. Prisma splits them the same way, and refuses the other form on each database.")}function m3($,Z,X,z,J){let{dialect:Y}=z,H=`${z.qualifier??""}${Y.quoteIdent(Z.column)}`,G=k(X);if(G)throw new T(`where.${Z.name}`,$.name,z.operation,`${x0(G)} is not a filter on `+"its own \u2014 Prisma rejects it here too. Write it as an explicit "+`comparison: { ${Z.name}: { equals: ${x0(G)} } }.`);if(Z.isList)return C7($,Z,H,X,z,J);if(!p3(X))return Y3(H,Z,X,Y,J);let V=X,W=Object.keys(V).sort();if(V.path!==void 0)return N7($,Z,H,V,z,J);let M=V.mode==="insensitive";if(V.mode!==void 0&&V.mode!=="default"){if(!M)throw new T(`mode: ${JSON.stringify(V.mode)}`,$.name,z.operation,"Prisma takes 'default' or 'insensitive'.");if(!Y.supportsInsensitiveMode)throw new K('mode: "insensitive"',$.name,z.operation,`The ${Y.name} dialect cannot express it \u2014 Prisma rejects it `+"here too. Note SQLite's LIKE is already case-insensitive for ASCII.")}let B=[];for(let D of W){let P=V[D];if(P===void 0||D==="mode")continue;if(Z.type==="Json"&&J3.has(D)){B.push(M9($,Z,H,D,P,z,void 0,(C)=>J(C)?.[D]));continue}if(!h3.has(D))throw new T(`where.${Z.name}.${D}`,$.name,z.operation,`A scalar filter takes ${[...h3].sort().join(", ")}.`);if(D!=="equals"&&D!=="not"&&B9(P))throw new T(`where.${Z.name}.${D}`,$.name,z.operation,`Prisma.AnyNull means 'either kind of null', which only 'equals' and 'not' can express. Write { ${Z.name}: { equals: Prisma.AnyNull } }, or name the one you mean with Prisma.DbNull or Prisma.JsonNull.`);let Q=(C)=>J(C)?.[D];switch(D){case"equals":B.push(Y3(H,Z,P,Y,Q));break;case"not":B.push(b7($,Z,P,z,Q,H));break;case"in":case"notIn":B.push(E7($,H,Z,P,z,Q,D==="notIn"));break;case"lt":case"lte":case"gt":case"gte":B.push(R(j(`${H} ${V9[D]} `),y(Z,Y,F0(Z,Y,Q))));break;case"contains":case"startsWith":case"endsWith":if(typeof P!=="string")throw new T(`where.${Z.name}.${D}`,$.name,z.operation,`Expected a string, received ${P===null?"null":typeof P}.`);if(Z.type!=="String")throw new K(`where.${Z.name}.${D}`,$.name,z.operation,`'${Z.name}' is a ${Z.type}, and ${D} only applies to strings.`);B.push(Y.like(H,M,w7(D,Q)));break}}if(B.length===0)return j("true");if(B.length===1)return B[0];return t(B," and ")}function x0($){return`Prisma.${$==="db"?"DbNull":$==="json"?"JsonNull":"AnyNull"}`}function B9($){if(k($)==="any")return!0;return Array.isArray($)&&$.some((Z)=>k(Z)==="any")}function b7($,Z,X,z,J,Y){if(X===null||k(X)==="db")return j(`${Y} is not null`);if(k(X)==="json")return R(j("not "),w0(Y3(Y,Z,X,z.dialect,J)));if(k(X)==="any")return R(j("not "),w0(Y3(Y,Z,X,z.dialect,J)));if(!p3(X))return R(j(`${Y} <> `),y(Z,z.dialect,F0(Z,z.dialect,J)));let H=m3($,Z,X,z,J);return R(j("not "),w0(H))}function Y3($,Z,X,z,J){if(X===null||k(X)==="db")return j(`${$} is null`);if(k(X)==="any")return t([j(`${$} is null`),q7($,Z,z)]," or ");return R(j(`${$} = `),y(Z,z,F0(Z,z,J)))}function q7($,Z,X){return R(j(`${$} = `),y(Z,X,()=>X.encode(u3,Z)))}function E7($,Z,X,z,J,Y,H){let{dialect:G}=J;if(!Array.isArray(z))throw new T(`where.${X.name}.${H?"notIn":"in"}`,$.name,J.operation,"Expected an array.");if(z.length===0)return H?j("true"):H9;return G.inList(Z,H,z.length,(V)=>{return Y(V).map((M)=>G.encode(M,X))})}function w7($,Z){return(X)=>{let z=String(Z(X));if($==="contains")return`%${z}%`;if($==="startsWith")return`${z}%`;return`%${z}`}}function F0($,Z,X){return(z)=>Z.encode(X(z),$)}function p3($){return typeof $==="object"&&$!==null&&!Array.isArray($)&&!($ instanceof Date)&&!ArrayBuffer.isView($)}function D9($,Z,X,z,J,Y,H){let G=`orderBy.${Z.name}`;if(typeof X!=="object"||X===null||Array.isArray(X))throw new T(G,$.name,z,Z.kind==="many"?'Expected { _count: "asc" | "desc" }.':`Expected an object naming one field of ${Z.model}.`);let V=X,W=Object.keys(V).filter((C)=>C!=="where");if(W.length!==1)throw new K(G,$.name,z,W.length===0?"Name the field to order by.":`Name exactly one field to order by; got ${W.join(", ")}. `+"Order by several with an array: [{ a: \u2026 }, { b: \u2026 }].");let[M]=W,B=N0($,Z,J,`_o${H}`,`${J.quoteIdent($.table)}.`,z),D=x7($,Z,B.child,M,V[M],z,B.qualifier,J),P=f(B.child,V.where,{dialect:J,operation:z,qualifier:B.qualifier},(C)=>Y(C)?.where),Q=[j(`(select ${D.expression} from ${B.source} where ${B.correlation}`)];if(P)Q.push(j(" and "),P);return Q.push(j(")")),{expression:R(...Q),direction:D.direction,nulls:D.nulls}}function x7($,Z,X,z,J,Y,H,G){let V=`orderBy.${Z.name}.${z}`,{direction:W,nulls:M}=v7($,V,J,Y);if(z===l){if(Z.kind!=="many")throw new K(V,$.name,Y,`${Z.name} is a to-one relation, so its count is 0 or 1. Order by one of ${X.name}'s fields instead.`);return{expression:"count(*)",direction:W,nulls:M}}if(Z.kind==="many")throw new K(V,$.name,Y,`${Z.name} is a to-many relation, so ordering by '${z}' has no single answer for a parent with several children. Only `+"{ _count: \u2026 } is supported.");let B=X.fields[z];if(!B)throw new K(V,$.name,Y,`'${z}' is not a field on ${X.name}. Known fields: ${Object.keys(X.fields).join(", ")}.`);return{expression:`${H}${G.quoteIdent(B.column)}`,direction:W,nulls:M}}function v7($,Z,X,z){if(X==="asc"||X==="desc")return{direction:X};if(typeof X==="object"&&X!==null){let{sort:J,nulls:Y}=X;if(J!=="asc"&&J!=="desc")throw new T(Z,$.name,z,'Expected "asc" or "desc".');if(Y===void 0)return{direction:J};if(Y!=="first"&&Y!=="last")throw new K(`${Z}.nulls`,$.name,z,'Expected "first" or "last".');return{direction:J,nulls:Y}}throw new K(Z,$.name,z,'Expected "asc", "desc", or { sort, nulls }.')}var k7=new Set(["asc","desc"]),f7=new Set(["first","last"]);function D0($,Z,X,z){if(Z===void 0||Z===null)return[];let J=Array.isArray(Z),Y=J?Z:[Z],H=[];for(let G=0;G<Y.length;G++){let V=Y[G],W=(M)=>{let B=z?.locate(M);return J?B?.[G]:B};if(typeof V!=="object"||V===null)throw new T("orderBy",$.name,X,"Expected an object or an array of objects.");for(let[M,B]of Object.entries(V)){if(B===void 0)continue;if(M in $.relations){if(!z)throw new K(`orderBy.${M}`,$.name,X,"Ordering by a relation is not implemented here.");let P=D9($,$.relations[M],B,X,z.dialect,(Q)=>W(Q)?.[M],H.length);H.push({column:M,direction:P.direction,...P.nulls?{nulls:P.nulls}:{},expression:P.expression});continue}let D=$.fields[M];if(!D)throw new g(M,$.name,Object.keys($.fields));H.push({column:D.column,...P9($,M,B,X)})}}return H}function P9($,Z,X,z){if(typeof X==="string"){if(!k7.has(X))throw new T(`orderBy.${Z}: ${JSON.stringify(X)}`,$.name,z,'Expected "asc" or "desc".');return{direction:X}}if(typeof X==="object"&&X!==null){let{sort:J,nulls:Y}=X,H=P9($,Z,J,z).direction;if(Y===void 0)return{direction:H};if(typeof Y!=="string"||!f7.has(Y))throw new K(`orderBy.${Z}.nulls: ${JSON.stringify(Y)}`,$.name,z,'Expected "first" or "last".');return{direction:H,nulls:Y}}throw new K(`orderBy.${Z}`,$.name,z,'Expected "asc", "desc", or { sort, nulls }.')}function H3($){return $.map((Z)=>({...Z,direction:Z.direction==="asc"?"desc":"asc",...Z.nulls?{nulls:Z.nulls==="first"?"last":"first"}:{}}))}function r($,Z,X){if($.length===0)return null;return x($.map((z)=>{let J=` ${z.direction}`+(z.nulls?` nulls ${z.nulls}`:"");if(z.expression)return x([z.expression,j(J)],"");return j(`${X??""}${Z.quoteIdent(z.column)}${J}`)}),", ")}function V3($,Z,X,z,J){if(typeof J!=="number"||!Number.isInteger(J))throw new T(X,$,Z,`Expected an integer, got ${JSON.stringify(J)}.`);if(z==="skip"&&J<0)throw new T(X,$,Z,"A 'skip' counts rows to pass over, so it cannot be negative. Prisma rejects one too.")}function Q0($,Z,X,z,J,Y=!1){if(X?.take!==void 0)V3($.name,Z,"take","take",X.take);if(X?.skip!==void 0)V3($.name,Z,"skip","skip",X.skip);let H=Y?1:X?.take,G=X?.skip,V=J;if((H!==void 0||G!==void 0)&&V.length===0&&!Y)V=$.primaryKey.map((P)=>({column:$.fields[P]?.column??P,direction:"asc"}));let M=typeof H==="number"&&H<0;if(M)V=H3(V);let B=H===void 0?null:Y?()=>1:(P)=>Math.abs(Number(P?.take)),D=G===void 0?null:(P)=>Number(P?.skip);return{clause:z.paginate(B,D),terms:V,reversed:M}}function J0($,Z,X){let z=Z?.select,J=Z?.omit;if(z!==void 0&&Z?.include!==void 0)throw new K("select + include",$.name,X,"Prisma allows only one of them on the same query.");if(z!==void 0&&J!==void 0)throw new K("select + omit",$.name,X,"'select' names what to keep and 'omit' what to drop, so the two describe different column lists. Prisma allows only one of them on "+"the same query. Drop the 'omit' \u2014 a 'select' already excludes "+"everything it does not name.");if(z===void 0||z===null)return g7($,J,X);if(typeof z!=="object"||Array.isArray(z))throw new T("select",$.name,X,"Expected an object.");let Y=[];for(let[G,V]of Object.entries($.fields))if(z[G]===!0)Y.push(V);let H=0;for(let G of Object.keys(z)){let V=z[G];if(V===void 0)continue;if(G in $.relations){if(V!==!1)H++;continue}if(G===l){if(V!==!1)H++;continue}if(!(G in $.fields))throw new g(G,$.name,Object.keys($.fields));if(typeof V!=="boolean")throw new T(`select.${G}`,$.name,X,"Expected true or false.")}if(Y.length===0&&H===0)throw new K("select",$.name,X,"At least one field must be selected.");return Y}function g7($,Z,X){if(Z===void 0||Z===null)return Object.values($.fields);if(typeof Z!=="object"||Array.isArray(Z))throw new T("omit",$.name,X,"Expected an object of fields.");let z=new Set;for(let Y of Object.keys(Z)){let H=Z[Y];if(H===void 0)continue;if(Y in $.relations)throw new K(`omit.${Y}`,$.name,X,`'${Y}' is a relation, not a column. A relation is already absent unless an 'include' asks for it.`);if(!(Y in $.fields))throw new g(Y,$.name,Object.keys($.fields));if(typeof H!=="boolean")throw new T(`omit.${Y}`,$.name,X,"Expected true or false.");if(H)z.add(Y)}let J=Object.values($.fields).filter((Y)=>!z.has(Y.name));if(J.length===0)throw new K("omit",$.name,X,`It omits every field on ${$.name}, which leaves no column to select. Prisma rejects that too.`);return J}function G3($,Z,X){if(X.length===0)return{fields:Z};let z=new Set(Z.map((H)=>H.name)),J=X.filter((H)=>!z.has(H));if(J.length===0)return{fields:Z};let Y=new Set([...z,...J]);return{fields:Object.values($.fields).filter((H)=>Y.has(H.name)),hidden:J}}var j9=new Set(["where","orderBy","select","omit","include","take","skip"]),K9=new Set(["where","select","omit","include"]),B3=10;function h0($){return[...new Set($.map((Z)=>Z.strategy))].sort()}function S0($,Z,X,z,J=P0){let Y=u0($,Z,z);if(Y.length===0)return{plans:[],keyFields:[]};let H=[],G=new Set;for(let V of Y){T9($,V,z);let W=U9($,V);R9(W,V.node,z,2);let M=J.plan({parent:$,child:W,relation:V.relation,as:V.as,node:V.node,locate:V.locate,dialect:X,operation:z});H.push(M);for(let B of M.parentFields)G.add(B)}return{plans:H,keyFields:[...G]}}async function P3($,Z,X,z,J){let Y=Array.isArray(X)?X:X===null||X===void 0?[]:[X];if(Y.length===0)return;for(let H of $){if(H.root)continue;await H.load(Y,z,J)}if(Z&&Z.length>0)for(let H of Y)for(let G of Z)delete H[G]}function u0($,Z,X){if(Z===void 0||Z===null)return[];let{include:z,select:J}=Z;L9($,z,J,X);let Y=[];if(z!==void 0&&z!==null){if(typeof z!=="object"||Array.isArray(z))throw new T("include",$.name,X,"Expected an object.");for(let H of Object.keys(z).sort()){let G=z[H];if(G===void 0||G===!1)continue;if(H===l)continue;let V=$.relations[H];if(!V)throw new f0(H,$.name,Object.keys($.relations));Y.push({as:H,relation:V,node:G,locate:(W)=>W?.include?.[H]})}return Y}if(J!==void 0&&J!==null&&typeof J==="object")for(let H of Object.keys(J).sort()){let G=J[H];if(G===void 0||G===!1)continue;let V=$.relations[H];if(!V)continue;Y.push({as:H,relation:V,node:G,locate:(W)=>W?.select?.[H]})}return Y}function L9($,Z,X,z,J){if(Z===void 0||X===void 0)return;throw new K(J?`${J}: select + include`:"select + include",$.name,z,"Prisma allows only one of them on the same query, at any level.")}function T9($,Z,X){let z=Z.node;if(z===!0)return;if(typeof z!=="object"||z===null||Array.isArray(z))throw new T(Z.as,$.name,X,"Expected true or an object of relation arguments.");let J=z;L9($,J.include,J.select,X,Z.as);let Y=Z.relation.kind==="many";for(let H of Object.keys(J).sort()){if(J[H]===void 0)continue;if(Y&&(H==="take"||H==="skip")){y7($,Z,X,H,J[H]);continue}if(Y?j9.has(H):K9.has(H))continue;if(H==="lock")throw new k0(`${Z.as}.lock`,$.name,X,"'lock' locks the rows of the model being queried, not an included relation's. Lock the related rows with their own locking read in the same transaction.");if(H==="orderBy"&&!Y)throw new K(`${Z.as}.orderBy`,$.name,X,"Prisma does not accept 'orderBy' on a to-one relation \u2014 there is at "+"most one row to order.");if(H==="take"||H==="skip")throw new K(`${Z.as}.${H}`,$.name,X,`Prisma does not accept '${H}' on a to-one relation.`);throw new K(`${Z.as}.${H}`,$.name,X,`A relation node takes ${[...Y?j9:K9].sort().join(", ")}.`)}}function y7($,Z,X,z,J){V3($.name,X,`${Z.as}.${z}`,z,J)}function s3($,Z){let X=$.node;if(typeof X!=="object"||X===null||Array.isArray(X))return;for(let z of["take","skip"]){if(X[z]===void 0)continue;throw new K(`${$.as}.${z}`,$.parent.name,$.operation,`A '${z}' inside a to-many relation is per parent, and the batched `+"relation planner serves every parent from one query \u2014 so the only "+`limit it could emit would page every parent's children as one set. Only the lateral join strategy can express it, by paginating inside a subquery that already runs once per parent row, and it needs Postgres: ${Z}. Load '${$.as}' as its own query, or narrow it with 'where'.`)}}function R9($,Z,X,z){if(typeof Z!=="object"||Z===null||Array.isArray(Z))return;if(Z.select!==void 0)J0($,Z,X);let J=u0($,Z,X);if(J.length===0)return;if(z>B3)throw new d3($.name,B3);for(let Y of J)T9($,Y,X),R9(U9($,Y),Y.node,X,z+1)}function I9($,Z,X,z){if($.parentFields.length!==1)throw new K(X.name,Z.name,z,`${X.name} joins on ${$.parentFields.length} fields (${$.parentFields.join(", ")}), and it is planned through a join table, which links two models by a single primary key each side. Prisma does not build an implicit many-to-many over a composite key.`);return{parentField:$.parentFields[0],childField:$.childFields[0],join:$.join}}function B0($,Z,X,z){if(X.joinTable)return u7($,Z,X);if(X.from.length>0)return Q9($,X,X.from,X.to,z);let J=h7($,Z,X);if(J.from.length===0)throw new s($.name,X.name,`neither ${$.name}.${X.name} nor ${Z.name}.${J.name} holds the foreign key.`);return Q9($,X,J.to,J.from,z)}function Q9($,Z,X,z,J){if(X.length===0)throw new K(Z.name,$.name,J,`${Z.name} names no join fields.`);if(X.length!==z.length)throw new s($.name,Z.name,`it joins ${X.length} field(s) to ${z.length}: ${X.join(", ")} against ${z.join(", ")}.`);return{parentFields:X,childFields:z}}function h7($,Z,X){let z=Object.values(Z.relations).filter((J)=>J.relationName===X.relationName&&!(Z.name===$.name&&J.name===X.name));if(z.length!==1)throw new s($.name,X.name,z.length===0?`${Z.name} declares no relation named '${X.relationName}'.`:`${Z.name} declares ${z.length} relations named '${X.relationName}'.`);return z[0]}function u7($,Z,X){let{table:z,a:J,b:Y}=X.joinTable;if(J===Y){let G=X.joinTable.ownerColumn;if(!G)throw new K(X.name,$.name,"include",`${X.name} is a self-referential implicit many-to-many, and the generated artifact predates support for one. Re-run \`prisma generate\`.`);return{parentFields:[W3($,X)],childFields:[W3(Z,X)],join:{table:z,parentColumn:G,childColumn:G==="A"?"B":"A"}}}if($.name!==J&&$.name!==Y)throw new s($.name,X.name,`the join table '${z}' connects ${J} and ${Y}, neither of which is ${$.name}.`);let H=$.name===J?"A":"B";return{parentFields:[W3($,X)],childFields:[W3(Z,X)],join:{table:z,parentColumn:H,childColumn:H==="A"?"B":"A"}}}function W3($,Z){if($.primaryKey.length!==1)throw new s($.name,Z.name,`an implicit many-to-many joins on ${$.name}'s primary key, which has ${$.primaryKey.length} fields.`);return $.primaryKey[0]}function M3($,Z,X){let z=$.fields[X];if(!z)throw new s($.name,Z.name,`it joins on '${X}', which is not a field on ${$.name}.`);return z}function U9($,Z){return X0($,Z.relation,Z.as)}function X0($,Z,X=Z.name){let z=Z.model;if(!a(z))throw new c3($.name,X,z,D3());let J=d(z)?.$schema;if(!J)throw new g0(z);return J}var _9="batched",P0={name:_9,plan($){s3($,"this query planned with the batched strategy");let Z=B0($.parent,$.child,$.relation,$.operation);for(let Y of Z.parentFields)C9($.parent,$.relation,M3($.parent,$.relation,Y));for(let Y of Z.childFields)C9($.child,$.relation,M3($.child,$.relation,Y));let X=M3($.parent,$.relation,Z.parentFields[0]),z=M3($.child,$.relation,Z.childFields[0]),J=$.relation.kind==="many";return{as:$.as,model:$.relation.model,kind:$.relation.kind,parentFields:Z.parentFields,strategy:_9,load(Y,H,G){let V={parentKeyField:X,childKeyField:z,many:J,parents:Y,args:H,executor:G};return Z.join?p7($,Z,V):m7($,Z,V)}}}};async function m7($,Z,X){let{keys:z,byKey:J}=O9(X.parents,Z.parentFields);if(z.length===0)return;let Y=$.locate(X.args),H=N9(Y,Z.childFields,z,$.child,$.dialect),G=await X.executor.exec($.relation.model,"findMany",H.args,!0);for(let V of G){let W=J.get(v0(Z.childFields.map((M)=>V[M])));if(!W)continue;for(let M of W)F9(M,$.as,V,X.many)}if(H.hidden)for(let V of G)for(let W of Z.childFields)delete V[W]}async function p7($,Z,X){let{keys:z,byKey:J}=O9(X.parents,Z.parentFields);if(z.length===0)return;let{dialect:Y}=$,H=Z.join,G=await d7(Y,H,z.map((P)=>Y.encode(P[0],X.parentKeyField)),X.executor),V=new Map,W=[];for(let P of G){let Q=v0([Y.decode(P[H.parentColumn],X.parentKeyField)]),C=J.get(Q);if(!C)continue;let F=Y.decode(P[H.childColumn],X.childKeyField),N=v0([F]),L=V.get(N);if(L===void 0)L=[],V.set(N,L),W.push([F]);for(let _ of C)L.push(_)}if(W.length===0)return;let M=$.locate(X.args),B=N9(M,Z.childFields,W,$.child,$.dialect),D=await X.executor.exec($.relation.model,"findMany",B.args,!0);for(let P of D){let Q=V.get(v0([P[Z.childFields[0]]]));if(!Q)continue;for(let C of Q)F9(C,$.as,P,X.many)}if(B.hidden)for(let P of D)delete P[Z.childFields[0]]}async function d7($,Z,X,z){let J=R(j(`select ${$.quoteIdent(Z.parentColumn)}, ${$.quoteIdent(Z.childColumn)} from ${$.quoteIdent(Z.table)} where `),$.inList($.quoteIdent(Z.parentColumn),!1,X.length,()=>X)),{text:Y,binders:H}=c(J,$,{model:Z.table,operation:"include"}),G=A0();return z.query(Y,H.map((V)=>V(void 0,G)))}function N9($,Z,X,z,J){let Y=$===!0||$===null||typeof $!=="object"?{}:$,H=Z.length===1?{[Z[0]]:{in:X.map((B)=>B[0])}}:c7(z,Z,X,J),G={where:Y.where===void 0?H:{AND:[Y.where,H]}};if(Y.orderBy!==void 0)G.orderBy=Y.orderBy;if(Y.include!==void 0)G.include=Y.include;let V=Y.omit;if(V!==void 0){let B=Z.filter((D)=>V[D]===!0);if(B.length===0)G.omit=V;else{let D={...V};for(let P of B)delete D[P];return G.omit=D,{args:G,hidden:!0}}}let W=Y.select;if(W===void 0)return{args:G,hidden:!1};let M=Z.filter((B)=>W[B]!==!0);if(M.length===0)return G.select=W,{args:G,hidden:!1};G.select={...W};for(let B of M)G.select[B]=!0;return{args:G,hidden:!0}}function c7($,Z,X,z){let J=Z.map((Y)=>$.fields[Y]?.type);if(J.every((Y)=>Y!==void 0)&&z.canBindCompositeIn(J))return{[z0]:W9(Z,X)};return{OR:X.map((Y)=>Object.fromEntries(Z.map((H,G)=>[H,Y[G]])))}}function v0($){return JSON.stringify($.map(s7))}function F9($,Z,X,z){if(z){$[Z].push(X);return}if($[Z]===null)$[Z]=X}function O9($,Z){let X=new Map,z=[];for(let J of $){let Y=Z.map((V)=>J[V]);if(Y.some((V)=>V===null||V===void 0))continue;let H=v0(Y),G=X.get(H);if(G===void 0)G=[],X.set(H,G),z.push(Y);G.push(J)}return{keys:z,byKey:X}}function s7($){if(typeof $!=="object"||$===null)return $;if($ instanceof Date)return $.getTime();if(ArrayBuffer.isView($)){let Z=new Uint8Array($.buffer,$.byteOffset,$.byteLength),X="";for(let z of Z)X+=z.toString(16).padStart(2,"0");return`bytes:${X}`}throw Error(`Cannot key a relation stitch on ${Object.prototype.toString.call($)}.`)}function C9($,Z,X){if(X.isList)throw new s($.name,Z.name,`it joins on '${X.name}', a ${X.type} list \u2014 which decodes to a new `+"array per row and so cannot be compared between the two sides.");if(X.type!=="Json")return;throw new s($.name,Z.name,`it joins on '${X.name}', a ${X.type} \u2014 which decodes to a new object `+"per row and so cannot be compared between the two sides.")}var A9=(()=>{try{return Function("return 1")()===1}catch{return!1}})(),S9=!0;function i7($){S9=$}function n7(){return A9}function m0($,Z,X=[]){if(A9&&S9)return l7($,Z,X);return i3($,Z,X)}function i3($,Z,X=[]){let z=$.map((G)=>({key:G.name,column:G.column,field:G,decode:Z.needsDecode(G)})),J=z.length,Y=X.map((G)=>({key:G.key,many:G.kind==="many"})),H=Y.length;return(G)=>{let V=[];for(let W=0;W<G.length;W++){let M=G[W],B={};for(let D=0;D<J;D++){let P=z[D],Q=M[P.column];B[P.key]=P.decode?Z.decode(Q,P.field):Q??null}for(let D=0;D<H;D++)B[Y[D].key]=Y[D].many?[]:null;V.push(B)}return V}}function l7($,Z,X){let z=[];for(let Y=0;Y<$.length;Y++){let H=$[Y],G=JSON.stringify(H.name),V=JSON.stringify(H.column);z.push(Z.needsDecode(H)?`${G}: d.decode(row[${V}], f[${Y}])`:`${G}: row[${V}] ?? null`)}for(let Y of X)z.push(`${JSON.stringify(Y.key)}: ${Y.kind==="many"?"[]":"null"}`);let J=`
2
+ import{ca as v6}from"../chunk-b55zt46z.js";import{$a as w6,Ga as J9,Ha as Y9,Ia as l,Ja as b9,Ka as b3,La as S6,Ma as b6,Na as q0,Oa as e5,Pa as q3,Qa as q6,Ra as Z3,Sa as I0,Ta as e4,Ua as $7,Va as Z7,Wa as d5,Xa as X7,Ya as z7,Za as J7,_a as E6,ab as x6}from"../chunk-6tferehw.js";import{mh as U6,nh as N6,oh as F6,ph as O6,qh as A6}from"../chunk-2qac05gb.js";import{Ah as Q6,Bh as _6,Ch as z5,Dh as C6,Eh as u3,Fh as k,Gh as L6,Hh as T6,Ih as R6,Jh as I6,Kh as a5,rh as A0,sh as o,th as j,uh as n,xh as R,yh as x,zh as c}from"../chunk-3derdn99.js";import"../chunk-spmxhsze.js";import{Aj as o4,Bj as t4,Cj as r4,Dj as a4,nj as H6,oj as a,pj as d,qj as D3,rj as y0,tj as j6,uj as K6,zj as l4}from"../chunk-a1414jdv.js";import{$j as g0,Ej as K,Fj as T,Gj as k0,Hj as g,Ij as a8,Jj as $0,Kj as e8,Lj as c5,Mj as $6,Nj as C5,Oj as Z6,Qj as X6,Rj as s5,Sj as z6,Tj as J6,Uj as i5,Vj as T3,Wj as f0,Xj as d3,Yj as c3,Zj as s,_j as Y6,ak as n5}from"../chunk-vhyabcw9.js";import{hk as W6,ik as $3,jk as T0,kk as O3,nk as M6,pk as B6,qk as D6,rk as l5,sk as o5,tk as m5,uk as A3,vk as P6,wk as t5,xk as r5}from"../chunk-wtdmwmm7.js";import{Ik as V6,Kk as G6,Mk as p5}from"../chunk-7gnspwra.js";import{kl as u5}from"../chunk-nadkwh8a.js";import"../chunk-krgwft9w.js";import"../chunk-mpreff3t.js";function N0($,Z,X,z,J,Y){let H=X0($,Z),G=B0($,H,Z,Y),V=X.quoteIdent(z),W=`${V}.`,M=G.parentFields.map((Q,C)=>{let F=`${W}${X.quoteIdent(X3(H,Z,G.childFields[C]))}`,N=`${J}${X.quoteIdent(X3($,Z,Q))}`;return`${F} = ${N}`}).join(" and ");if(!G.join)return{child:H,source:`${X.quoteIdent(H.table)} as ${V}`,correlation:M,qualifier:W};let B=`${W}${X.quoteIdent(X3(H,Z,G.childFields[0]))}`,D=`${J}${X.quoteIdent(X3($,Z,G.parentFields[0]))}`,P=X.quoteIdent(`${z}j`);return{child:H,source:`${X.quoteIdent(H.table)} as ${V} join ${X.quoteIdent(G.join.table)} as ${P} on ${P}.${X.quoteIdent(G.join.childColumn)} = ${B}`,correlation:`${P}.${X.quoteIdent(G.join.parentColumn)} = ${D}`,qualifier:W}}function X3($,Z,X){let z=$.fields[X];if(!z)throw new s($.name,Z.name,`it joins on '${X}', which is not a field on ${$.name}.`);return z.column}function u($,Z,X){let z=z3($);if(typeof Z!=="object"||Z===null||Array.isArray(Z))throw X9($,X,z);let J=Object.keys(Z).filter((H)=>Z[H]!==void 0),Y=Z;for(let H of z){if(H.length===1&&J.includes(H[0]))return Z9($,X,H[0],Y[H[0]]),H;let G=H.join("_");if(H.length>1&&J.includes(G)){let V=Y[G];if(V&&typeof V==="object"&&!Array.isArray(V))for(let W of H)Z9($,X,`${G}.${W}`,V[W]);return H}}throw X9($,X,z)}function v3($){if($===null||$===void 0)return!1;let Z=typeof $;if(Z!=="object")return Z!=="function"&&Z!=="symbol";if(Array.isArray($))return!1;if($ instanceof Date||ArrayBuffer.isView($))return!0;let X=Object.getPrototypeOf($);return X!==Object.prototype&&X!==null}function Z9($,Z,X,z){if(z===void 0||v3(z))return;throw new T(`${Z.argument}.${X}`,Z.model,Z.operation,`A unique key takes a plain value to match, not ${z===null?"null":Array.isArray(z)?"an array":"a filter object"}. Use findFirst/findMany (or updateMany/deleteMany) to filter on ${$.name}.${X.split(".").pop()}.`)}function k3($,Z,X){u($,Z,{model:$.name,operation:X,argument:"where"})}function z3($){let Z=[];if($.primaryKey.length>0)Z.push($.primaryKey);for(let X of $.uniques)Z.push(X);return Z}function X9($,Z,X){let z=X.map((H)=>H.length===1?H[0]:H.join("_")).join(", "),Y=Z.argument.startsWith("data.")?`Name it by one of those, or reach it through the ${$.name} model directly.`:`Use ${Z.operation==="delete"||Z.operation==="update"?`${Z.operation}Many`:"findFirst"} to query on anything else.`;return new K(Z.argument,Z.model,Z.operation,`${$.name} needs a unique field here. It declares: ${z}. ${Y}`)}function y($,Z,X){let z=Z.castParameter($);if(!z)return n(X);return n((J,Y)=>{let H=X(J,Y);if(H===null||H===void 0)return null;let G=k(H);if(G==="db")return null;if(G==="json")return"null";if(G==="any")throw Error("gemi ORM bug: Prisma.AnyNull reached the parameter binder. It is a filter operand only, and both the filter and write paths are supposed to have handled it before this point.");return JSON.stringify(H)},z)}function f($,Z,X,z){if(Z===void 0||Z===null)return null;if(typeof Z!=="object"||Array.isArray(Z))throw new T("where",$.name,X.operation,"Expected an object.");let J=[];for(let Y of Object.keys(Z).sort()){let H=Z[Y];if(H===void 0)continue;let G=(W)=>z(W)?.[Y];if(Y==="AND"||Y==="OR"){let W=z9($,H,X,G,Y);if(W)J.push(W);continue}if(Y===z0){J.push(K7($,H,X,G));continue}if(Y==="NOT"){let W=z9($,H,X,G,"AND");if(W)J.push(R(j("not "),w0(W)));continue}if(Y in $.relations){let W=D7($,$.relations[Y],H,X,G);if(W)J.push(W);continue}let V=$.fields[Y];if(!V){let W=j7($,Y,H,X,G);if(W){J.push(W);continue}throw new g(Y,$.name,Object.keys($.fields))}J.push(m3($,V,H,X,G))}if(J.length===0)return null;if(J.length===1)return J[0];return t(J," and ")}function D7($,Z,X,z,J){let Y=J9(Z.kind),H=P7($,Z,X,Y,z),G=z.relationDepth??0,V=z.dialect,W=z.qualifier??`${V.quoteIdent($.table)}.`,M=N0($,Z,V,`_r${G}`,W,z.operation),B=M.child,D=j(M.correlation),P={...z,qualifier:M.qualifier,relationDepth:G+1},Q=[];for(let C of Y){if(!(C in H))continue;let F=H[C],N=(I)=>H.direct?J(I):J(I)?.[C];if(F===null){Q.push(f3(M,D,null,C==="is"));continue}let L=f(B,F,P,N);if(C==="every"){if(!L)continue;Q.push(f3(M,D,R(j("not "),w0(L)),!0));continue}let _=C==="none"||C==="isNot";Q.push(f3(M,D,L,_))}if(Q.length===0)return null;if(Q.length===1)return Q[0];return t(Q," and ")}function f3($,Z,X,z){let J=[j(`${z?"not ":""}exists (select 1 from ${$.source} where `),Z];if(X)J.push(j(" and "),X);return J.push(j(")")),R(...J)}function P7($,Z,X,z,J){let Y=`where.${Z.name}`,H=Z.kind==="many";if(X===null){if(H)throw new K(Y,$.name,J.operation,`${Z.name} is a to-many relation, so null is not a filter for it. Use { none: {} } for "has no related rows".`);return{is:null,direct:!0}}if(typeof X!=="object"||Array.isArray(X))throw new T(Y,$.name,J.operation,H?`Expected an object holding ${z.join(", ")}.`:"Expected an object, or null.");if(Y9(X,z))return X;if(H)throw new K(Y,$.name,J.operation,`Expected one of ${z.join(", ")}. A to-many relation has no `+"single reading of a bare filter \u2014 { some: \u2026 } and { every: \u2026 } mean "+"different things.");return{is:X,direct:!0}}function j7($,Z,X,z,J){let Y=z3($).find((V)=>V.length>1&&V.join("_")===Z);if(!Y)return null;if(typeof X!=="object"||X===null||Array.isArray(X))throw new T(`where.${Z}`,$.name,z.operation,`Expected an object holding ${Y.join(" and ")}.`);let H=X,G=[];for(let V of Y){if(H[V]===void 0)throw new K(`where.${Z}`,$.name,z.operation,`Missing '${V}'. A composite key needs all of ${Y.join(", ")}.`);if(!v3(H[V]))throw new T(`where.${Z}.${V}`,$.name,z.operation,`A composite key takes a plain value for each of ${Y.join(", ")}, not a filter, an array or null.`);G.push(m3($,$.fields[V],H[V],z,(W)=>J(W)?.[V]))}return G.length===1?G[0]:t(G," and ")}function z9($,Z,X,z,J){let Y=[];if(Array.isArray(Z))for(let H=0;H<Z.length;H++){let G=f($,Z[H],X,(V)=>z(V)?.[H]);if(G)Y.push(G)}else{let H=f($,Z,X,z);if(H)Y.push(H)}if(Y.length===0)return J==="AND"?null:H9;if(Y.length===1)return Y[0];return t(Y,J==="AND"?" and ":" or ")}var H9=j("false");function t($,Z){return R(j("("),x($,Z),j(")"))}function w0($){return $.text.startsWith("(")?$:t([$],"")}var h3=new Set(["equals","not","in","notIn","lt","lte","gt","gte","contains","startsWith","endsWith","mode"]),V9={lt:"<",lte:"<=",gt:">",gte:">="},z0="$compositeIn",G9=Symbol("gemi.orm.compositeInFromPlanner");function W9($,Z){return{[G9]:!0,fields:$,values:Z}}function K7($,Z,X,z){let{dialect:J}=X,H=Q7($,Z,X).map((V)=>{let W=$.fields[V];if(!W)throw new g(V,$.name,Object.keys($.fields));return W}),G=H.map((V)=>`${X.qualifier??""}${J.quoteIdent(V.column)}`);return J.compositeIn(G,H.map((V)=>V.type),(V)=>z(V).values)}function Q7($,Z,X){let z=()=>{throw new g(z0,$.name,Object.keys($.fields))};if(typeof Z!=="object"||Z===null||Array.isArray(Z))return z();if(Z[G9]!==!0)return z();let J=(G)=>{throw new K(z0,$.name,X.operation,G)},{fields:Y,values:H}=Z;if(!Array.isArray(Y)||Y.length===0)return J(`the planner built a '${z0}' with no fields.`);if(!Y.every((G)=>typeof G==="string"))return J(`the planner built a '${z0}' with a non-string field.`);if(!Array.isArray(H))return J(`the planner built a '${z0}' with no values.`);if(!H.every((G)=>Array.isArray(G)&&G.length===Y.length))return J(`the planner built a '${z0}' whose tuples do not all have ${Y.length} value(s).`);return Y}var _7=["equals","has","hasEvery","hasSome","isEmpty"],g3=new Set(_7);function C7($,Z,X,z,J,Y){let{dialect:H}=J;if(O0($,Z,`where.${Z.name}`,J.operation,H),Array.isArray(z))throw new T(`where.${Z.name}`,$.name,J.operation,`'${Z.name}' is a scalar list, and a bare array is not a filter on `+"one \u2014 Prisma rejects it here too. Say which comparison you mean: "+`{ ${Z.name}: { equals: [...] } } for the whole list, or { ${Z.name}: { hasEvery: [...] } } for "contains all of these". A bare array *is* accepted as a value in \`data\`.`);if(!p3(z))throw new T(`where.${Z.name}`,$.name,J.operation,`'${Z.name}' is a scalar list. Expected an object holding ${[...g3].sort().join(", ")}; received ${z===null?"null":typeof z}.`);let G=z,V=[];for(let W of Object.keys(G).sort()){let M=G[W];if(M===void 0)continue;if(!g3.has(W))throw new T(`where.${Z.name}.${W}`,$.name,J.operation,`'${Z.name}' is a scalar list, and a list filter takes ${[...g3].sort().join(", ")}. The scalar operators \u2014 `+`${[...h3].sort().join(", ")} \u2014 apply to a single value and `+"Prisma does not offer them here.");let B=(D)=>Y(D)?.[W];V.push(L7($,Z,X,W,M,J,B))}if(V.length===0)return j("true");if(V.length===1)return V[0];return t(V," and ")}function L7($,Z,X,z,J,Y,H){let{dialect:G}=Y;if(z==="equals")return T7($,Z,X,J,Y,H);if(z==="isEmpty"){if(typeof J!=="boolean")throw new T(`where.${Z.name}.isEmpty`,$.name,Y.operation,`Expected true or false, received ${J===null?"null":typeof J}.`);return G.listIsEmpty(X,J)}if(z==="has"){let W=R7(Z);return G.listHas(X,y(W,G,F0(W,G,H)))}if(!Array.isArray(J))throw new T(`where.${Z.name}.${z}`,$.name,Y.operation,`Expected an array, received ${J===null?"null":typeof J}.`);let V=y(Z,G,F0(Z,G,H));return z==="hasEvery"?G.listHasEvery(X,V):G.listHasSome(X,V)}function T7($,Z,X,z,J,Y){let{dialect:H}=J;if(z===null)return j(`${X} is null`);if(!Array.isArray(z))throw new T(`where.${Z.name}.equals`,$.name,J.operation,`'${Z.name}' is a scalar list, so it compares against an array. Received ${typeof z}. For "is this element present", use { ${Z.name}: { has: \u2026 } }.`);return R(j(`${X} = `),y(Z,H,F0(Z,H,Y)))}function R7($){return{...$,isList:!1}}function O0($,Z,X,z,J){if(J.listFilters.size>0)return;throw new K(X,$.name,z,`'${Z.name}' is a scalar list, and ${J.name} has no array type to hold one. Prisma refuses the column itself on ${J.name} \u2014 `+'"the current connector does not support lists of primitive types" \u2014 so '+`this is a difference between the databases rather than a gap in the ORM. The generated artifact is dialect-agnostic, which is why this surfaces here rather than at \`prisma generate\`: the schema was generated against Postgres and DATABASE_URL names a ${J.name} database, which has no '${Z.column}' column either. It works on postgres.`)}var I7=["equals","not","string_contains","string_starts_with","string_ends_with","array_contains","lt","lte","gt","gte"],y3=new Set(I7),U7=["has_key","has_some_keys","has_every_key"],J3=new Set(U7);function M9($,Z,X,z,J,Y,H,G){let V=z!=="has_key",W=`where.${Z.name}.${z}`,M=(D)=>{if(!(V?Array.isArray(D)&&D.every((Q)=>typeof Q==="string"):typeof D==="string"))throw new T(W,$.name,Y.operation,V?"Expected an array of key names, like ['a', 'b'].":"Expected a key name, like 'a'.");return D};M(J);let B=(D,P)=>M(G(D,P));return Y.dialect.jsonHasKeys(X,H,B,z==="has_key"?"one":z==="has_some_keys"?"some":"every",Array.isArray(J)?J.length:0)}function N7($,Z,X,z,J,Y){let{dialect:H}=J;if(Z.type!=="Json")throw new K(`${Z.name}.path`,$.name,J.operation,`A 'path' filter reads inside a JSON document, and '${Z.name}' is a ${Z.type} column.`);S7($,Z,z.path,J);let G=(M)=>Y(M)?.path,V=Object.keys(z).filter((M)=>M!=="path"&&z[M]!==void 0).sort();if(V.length===0)throw new K(`${Z.name}.path`,$.name,J.operation,`A 'path' needs a filter beside it \u2014 ${[...y3,...J3].sort().join(", ")}. Prisma refuses a bare path too.`);let W=[];for(let M of V){if(J3.has(M)){W.push(M9($,Z,X,M,z[M],J,G,(P)=>Y(P)?.[M]));continue}if(!y3.has(M))throw new K(`${Z.name}.${M}`,$.name,J.operation,`A JSON path filter takes ${[...y3,...J3].sort().join(", ")}.`);if(!H.jsonFilters.has(M))throw new K(`${Z.name}.${M}`,$.name,J.operation,`'${M}' on a JSON path is not available on ${H.name}. Prisma refuses it here too, so this is a difference between the databases rather than a gap in the ORM. It works on postgres.`);let B=z[M],D=B===null?"json":k(B);if(D&&(M==="equals"||M==="not")){W.push(F7(D,X,G,Z,H,M==="not"));continue}if(D&&B!==null){let P=M==="array_contains"?"'array_contains' tests containment against a document, and a sentinel is not one":`'${M}' compares an extracted value against a scalar, and a sentinel is not one`;throw new T(`where.${Z.name}.${M}`,$.name,J.operation,`${x0(D)} asks which kind of null a value is, which `+`only 'equals' and 'not' can express \u2014 ${P}. Prisma refuses it under this operator too. Write { ${Z.name}: { path: [\u2026], equals: ${x0(D)} } }, `+"or filter the column itself \u2014 "+`{ ${Z.name}: { equals: ${x0(D)} } }.`)}if(B9(B))throw new T(`where.${Z.name}.${M}`,$.name,J.operation,"Prisma.AnyNull is a question rather than a value \u2014 'either kind of "+"null' \u2014 so it cannot appear inside a document. Ask it directly: "+`{ ${Z.name}: { path: [\u2026], equals: Prisma.AnyNull } }.`);O7(M,B,$,Z,J),W.push(A7(M,X,G,Z,H,(P)=>Y(P)?.[M]))}return W.length===1?W[0]:t(W," and ")}function F7($,Z,X,z,J,Y){let H=()=>R(J.jsonValueAt(Z,X),j(Y?" is not null":" is null")),G=()=>R(J.jsonValueAt(Z,X),j(Y?" <> ":" = "),y(z,J,()=>J.encode(u3,z)));if($==="db")return H();if($==="json")return G();return t([G(),H()],Y?" and ":" or ")}function O7($,Z,X,z,J){let Y=$==="string_contains"||$==="string_starts_with"||$==="string_ends_with";if(Y&&typeof Z!=="string")throw new T(`where.${z.name}.${$}`,X.name,J.operation,`Expected a string, received ${Z===null?"null":typeof Z}. Prisma raises here too \u2014 without this the pattern becomes `+`'%${String(Z)}%', which runs and returns the wrong rows.`);if(Z===null)throw new T(`where.${z.name}.${$}`,X.name,J.operation,$==="array_contains"?"null cannot be tested for containment through a JSON path: the operand binds as SQL NULL rather than as the JSON value, and "+"'x @> NULL' is NULL rather than true \u2014 the query would run and "+`match nothing. A null *inside* the document is an ordinary value and still compiles: { ${z.name}: { path: [\u2026], array_contains: [null] } }.`:`null cannot be compared through a JSON path with '${$}', which `+"compares the extracted value as a number \u2014 the comparison against "+`NULL is NULL rather than true, so the query would run and match nothing. Prisma refuses it here too. For "the value at this path is a JSON null", use equals or not: { ${z.name}: { path: [\u2026], equals: null } }.`);if($==="array_contains"||Y)return;if(typeof Z==="object")throw new K(`where.${z.name}.${$}`,X.name,J.operation,`'${$}' on a JSON path compares the extracted value as a scalar, so `+"an object or array operand cannot be expressed \u2014 it would bind as "+`'${String(Z)}' and match nothing. Prisma accepts one here; gemi does not yet. Use array_contains for containment, or narrow the path until it names a scalar.`)}function A7($,Z,X,z,J,Y){if($==="array_contains")return J.jsonArrayContains(Z,X,Y);let H=$==="string_contains"||$==="string_starts_with"||$==="string_ends_with",G=J.jsonExtract(Z,X,!0);if(H){let B=$==="string_contains"?(D)=>`%${D}%`:$==="string_starts_with"?(D)=>`${D}%`:(D)=>`%${D}`;return R(j("("),G,j(") like "),n((D,P)=>{let Q=Y(D,P);return Q===null||Q===void 0?null:B(String(Q))}))}let V=$==="equals"?"=":$==="not"?"<>":V9[$],W=$!=="equals"&&$!=="not",M=W?R(j("cast(("),G,j(") as real)")):R(j("("),G,j(")"));return R(M,j(` ${V} `),n((B,D)=>{let P=Y(B,D);if(P===null||P===void 0)return null;if(W)return Number(P);return J.jsonComparesAsText?String(P):P}))}function S7($,Z,X,z){let{dialect:J}=z,Y=J.jsonPathSyntax==="array"?"array":"jsonpath",H=Array.isArray(X)?"array":typeof X==="string"?"jsonpath":"other";if(Array.isArray(X)&&X.length===0||X==="")throw new K(`${Z.name}.path`,$.name,z.operation,`A JSON path cannot be empty. ${J.jsonPathSyntax==="array"?`On ${J.name} an empty array selects the whole document, `+"which is a filter on the column rather than on a path \u2014 write "+`{ ${Z.name}: { equals: \u2026 } } if that is what you meant.`:`On ${J.name} an empty string raises inside json_extract.`}`);if(H===Y){if(Y!=="array")return;let V=X.findIndex((B)=>typeof B!=="string");if(V===-1)return;let W=X[V],M=W===null?"null":W===void 0?"undefined":Array.isArray(W)?"an array":typeof W==="object"?"an object":`a ${typeof W}`;throw new K(`${Z.name}.path`,$.name,z.operation,`A JSON path is an array of strings, and path[${V}] is ${M}. `+(typeof W==="number"?'An array index is a key too \u2014 write ["items", "0"] rather than '+`["items", 0]; it reaches the same element, because ${J.name} takes the path as text. Prisma's path is string[] and its client refuses a number here too.`:"Prisma's path is string[] too."))}throw new K(`${Z.name}.path`,$.name,z.operation,J.jsonPathSyntax==="array"?`On ${J.name} a JSON path is an array of keys \u2014 ["a", "b"] \u2014 `+"not a JSONPath string. Prisma splits them the same way, and refuses the other form on each database.":`On ${J.name} a JSON path is a JSONPath string \u2014 "$.a.b" \u2014 not `+"an array of keys. Prisma splits them the same way, and refuses the other form on each database.")}function m3($,Z,X,z,J){let{dialect:Y}=z,H=`${z.qualifier??""}${Y.quoteIdent(Z.column)}`,G=k(X);if(G)throw new T(`where.${Z.name}`,$.name,z.operation,`${x0(G)} is not a filter on `+"its own \u2014 Prisma rejects it here too. Write it as an explicit "+`comparison: { ${Z.name}: { equals: ${x0(G)} } }.`);if(Z.isList)return C7($,Z,H,X,z,J);if(!p3(X))return Y3(H,Z,X,Y,J);let V=X,W=Object.keys(V).sort();if(V.path!==void 0)return N7($,Z,H,V,z,J);let M=V.mode==="insensitive";if(V.mode!==void 0&&V.mode!=="default"){if(!M)throw new T(`mode: ${JSON.stringify(V.mode)}`,$.name,z.operation,"Prisma takes 'default' or 'insensitive'.");if(!Y.supportsInsensitiveMode)throw new K('mode: "insensitive"',$.name,z.operation,`The ${Y.name} dialect cannot express it \u2014 Prisma rejects it `+"here too. Note SQLite's LIKE is already case-insensitive for ASCII.")}let B=[];for(let D of W){let P=V[D];if(P===void 0||D==="mode")continue;if(Z.type==="Json"&&J3.has(D)){B.push(M9($,Z,H,D,P,z,void 0,(C)=>J(C)?.[D]));continue}if(!h3.has(D))throw new T(`where.${Z.name}.${D}`,$.name,z.operation,`A scalar filter takes ${[...h3].sort().join(", ")}.`);if(D!=="equals"&&D!=="not"&&B9(P))throw new T(`where.${Z.name}.${D}`,$.name,z.operation,`Prisma.AnyNull means 'either kind of null', which only 'equals' and 'not' can express. Write { ${Z.name}: { equals: Prisma.AnyNull } }, or name the one you mean with Prisma.DbNull or Prisma.JsonNull.`);let Q=(C)=>J(C)?.[D];switch(D){case"equals":B.push(Y3(H,Z,P,Y,Q));break;case"not":B.push(b7($,Z,P,z,Q,H));break;case"in":case"notIn":B.push(E7($,H,Z,P,z,Q,D==="notIn"));break;case"lt":case"lte":case"gt":case"gte":B.push(R(j(`${H} ${V9[D]} `),y(Z,Y,F0(Z,Y,Q))));break;case"contains":case"startsWith":case"endsWith":if(typeof P!=="string")throw new T(`where.${Z.name}.${D}`,$.name,z.operation,`Expected a string, received ${P===null?"null":typeof P}.`);if(Z.type!=="String")throw new K(`where.${Z.name}.${D}`,$.name,z.operation,`'${Z.name}' is a ${Z.type}, and ${D} only applies to strings.`);B.push(Y.like(H,M,w7(D,Q)));break}}if(B.length===0)return j("true");if(B.length===1)return B[0];return t(B," and ")}function x0($){return`Prisma.${$==="db"?"DbNull":$==="json"?"JsonNull":"AnyNull"}`}function B9($){if(k($)==="any")return!0;return Array.isArray($)&&$.some((Z)=>k(Z)==="any")}function b7($,Z,X,z,J,Y){if(X===null||k(X)==="db")return j(`${Y} is not null`);if(k(X)==="json")return R(j("not "),w0(Y3(Y,Z,X,z.dialect,J)));if(k(X)==="any")return R(j("not "),w0(Y3(Y,Z,X,z.dialect,J)));if(!p3(X))return R(j(`${Y} <> `),y(Z,z.dialect,F0(Z,z.dialect,J)));let H=m3($,Z,X,z,J);return R(j("not "),w0(H))}function Y3($,Z,X,z,J){if(X===null||k(X)==="db")return j(`${$} is null`);if(k(X)==="any")return t([j(`${$} is null`),q7($,Z,z)]," or ");return R(j(`${$} = `),y(Z,z,F0(Z,z,J)))}function q7($,Z,X){return R(j(`${$} = `),y(Z,X,()=>X.encode(u3,Z)))}function E7($,Z,X,z,J,Y,H){let{dialect:G}=J;if(!Array.isArray(z))throw new T(`where.${X.name}.${H?"notIn":"in"}`,$.name,J.operation,"Expected an array.");if(z.length===0)return H?j("true"):H9;return G.inList(Z,H,z.length,(V)=>{return Y(V).map((M)=>G.encode(M,X))})}function w7($,Z){return(X)=>{let z=String(Z(X));if($==="contains")return`%${z}%`;if($==="startsWith")return`${z}%`;return`%${z}`}}function F0($,Z,X){return(z)=>Z.encode(X(z),$)}function p3($){return typeof $==="object"&&$!==null&&!Array.isArray($)&&!($ instanceof Date)&&!ArrayBuffer.isView($)}function D9($,Z,X,z,J,Y,H){let G=`orderBy.${Z.name}`;if(typeof X!=="object"||X===null||Array.isArray(X))throw new T(G,$.name,z,Z.kind==="many"?'Expected { _count: "asc" | "desc" }.':`Expected an object naming one field of ${Z.model}.`);let V=X,W=Object.keys(V).filter((C)=>C!=="where");if(W.length!==1)throw new K(G,$.name,z,W.length===0?"Name the field to order by.":`Name exactly one field to order by; got ${W.join(", ")}. `+"Order by several with an array: [{ a: \u2026 }, { b: \u2026 }].");let[M]=W,B=N0($,Z,J,`_o${H}`,`${J.quoteIdent($.table)}.`,z),D=x7($,Z,B.child,M,V[M],z,B.qualifier,J),P=f(B.child,V.where,{dialect:J,operation:z,qualifier:B.qualifier},(C)=>Y(C)?.where),Q=[j(`(select ${D.expression} from ${B.source} where ${B.correlation}`)];if(P)Q.push(j(" and "),P);return Q.push(j(")")),{expression:R(...Q),direction:D.direction,nulls:D.nulls}}function x7($,Z,X,z,J,Y,H,G){let V=`orderBy.${Z.name}.${z}`,{direction:W,nulls:M}=v7($,V,J,Y);if(z===l){if(Z.kind!=="many")throw new K(V,$.name,Y,`${Z.name} is a to-one relation, so its count is 0 or 1. Order by one of ${X.name}'s fields instead.`);return{expression:"count(*)",direction:W,nulls:M}}if(Z.kind==="many")throw new K(V,$.name,Y,`${Z.name} is a to-many relation, so ordering by '${z}' has no single answer for a parent with several children. Only `+"{ _count: \u2026 } is supported.");let B=X.fields[z];if(!B)throw new K(V,$.name,Y,`'${z}' is not a field on ${X.name}. Known fields: ${Object.keys(X.fields).join(", ")}.`);return{expression:`${H}${G.quoteIdent(B.column)}`,direction:W,nulls:M}}function v7($,Z,X,z){if(X==="asc"||X==="desc")return{direction:X};if(typeof X==="object"&&X!==null){let{sort:J,nulls:Y}=X;if(J!=="asc"&&J!=="desc")throw new T(Z,$.name,z,'Expected "asc" or "desc".');if(Y===void 0)return{direction:J};if(Y!=="first"&&Y!=="last")throw new K(`${Z}.nulls`,$.name,z,'Expected "first" or "last".');return{direction:J,nulls:Y}}throw new K(Z,$.name,z,'Expected "asc", "desc", or { sort, nulls }.')}var k7=new Set(["asc","desc"]),f7=new Set(["first","last"]);function D0($,Z,X,z){if(Z===void 0||Z===null)return[];let J=Array.isArray(Z),Y=J?Z:[Z],H=[];for(let G=0;G<Y.length;G++){let V=Y[G],W=(M)=>{let B=z?.locate(M);return J?B?.[G]:B};if(typeof V!=="object"||V===null)throw new T("orderBy",$.name,X,"Expected an object or an array of objects.");for(let[M,B]of Object.entries(V)){if(B===void 0)continue;if(M in $.relations){if(!z)throw new K(`orderBy.${M}`,$.name,X,"Ordering by a relation is not implemented here.");let P=D9($,$.relations[M],B,X,z.dialect,(Q)=>W(Q)?.[M],H.length);H.push({column:M,direction:P.direction,...P.nulls?{nulls:P.nulls}:{},expression:P.expression});continue}let D=$.fields[M];if(!D)throw new g(M,$.name,Object.keys($.fields));H.push({column:D.column,...P9($,M,B,X)})}}return H}function P9($,Z,X,z){if(typeof X==="string"){if(!k7.has(X))throw new T(`orderBy.${Z}: ${JSON.stringify(X)}`,$.name,z,'Expected "asc" or "desc".');return{direction:X}}if(typeof X==="object"&&X!==null){let{sort:J,nulls:Y}=X,H=P9($,Z,J,z).direction;if(Y===void 0)return{direction:H};if(typeof Y!=="string"||!f7.has(Y))throw new K(`orderBy.${Z}.nulls: ${JSON.stringify(Y)}`,$.name,z,'Expected "first" or "last".');return{direction:H,nulls:Y}}throw new K(`orderBy.${Z}`,$.name,z,'Expected "asc", "desc", or { sort, nulls }.')}function H3($){return $.map((Z)=>({...Z,direction:Z.direction==="asc"?"desc":"asc",...Z.nulls?{nulls:Z.nulls==="first"?"last":"first"}:{}}))}function r($,Z,X){if($.length===0)return null;return x($.map((z)=>{let J=` ${z.direction}`+(z.nulls?` nulls ${z.nulls}`:"");if(z.expression)return x([z.expression,j(J)],"");return j(`${X??""}${Z.quoteIdent(z.column)}${J}`)}),", ")}function V3($,Z,X,z,J){if(typeof J!=="number"||!Number.isInteger(J))throw new T(X,$,Z,`Expected an integer, got ${JSON.stringify(J)}.`);if(z==="skip"&&J<0)throw new T(X,$,Z,"A 'skip' counts rows to pass over, so it cannot be negative. Prisma rejects one too.")}function Q0($,Z,X,z,J,Y=!1){if(X?.take!==void 0)V3($.name,Z,"take","take",X.take);if(X?.skip!==void 0)V3($.name,Z,"skip","skip",X.skip);let H=Y?1:X?.take,G=X?.skip,V=J;if((H!==void 0||G!==void 0)&&V.length===0&&!Y)V=$.primaryKey.map((P)=>({column:$.fields[P]?.column??P,direction:"asc"}));let M=typeof H==="number"&&H<0;if(M)V=H3(V);let B=H===void 0?null:Y?()=>1:(P)=>Math.abs(Number(P?.take)),D=G===void 0?null:(P)=>Number(P?.skip);return{clause:z.paginate(B,D),terms:V,reversed:M}}function J0($,Z,X){let z=Z?.select,J=Z?.omit;if(z!==void 0&&Z?.include!==void 0)throw new K("select + include",$.name,X,"Prisma allows only one of them on the same query.");if(z!==void 0&&J!==void 0)throw new K("select + omit",$.name,X,"'select' names what to keep and 'omit' what to drop, so the two describe different column lists. Prisma allows only one of them on "+"the same query. Drop the 'omit' \u2014 a 'select' already excludes "+"everything it does not name.");if(z===void 0||z===null)return g7($,J,X);if(typeof z!=="object"||Array.isArray(z))throw new T("select",$.name,X,"Expected an object.");let Y=[];for(let[G,V]of Object.entries($.fields))if(z[G]===!0)Y.push(V);let H=0;for(let G of Object.keys(z)){let V=z[G];if(V===void 0)continue;if(G in $.relations){if(V!==!1)H++;continue}if(G===l){if(V!==!1)H++;continue}if(!(G in $.fields))throw new g(G,$.name,Object.keys($.fields));if(typeof V!=="boolean")throw new T(`select.${G}`,$.name,X,"Expected true or false.")}if(Y.length===0&&H===0)throw new K("select",$.name,X,"At least one field must be selected.");return Y}function g7($,Z,X){if(Z===void 0||Z===null)return Object.values($.fields);if(typeof Z!=="object"||Array.isArray(Z))throw new T("omit",$.name,X,"Expected an object of fields.");let z=new Set;for(let Y of Object.keys(Z)){let H=Z[Y];if(H===void 0)continue;if(Y in $.relations)throw new K(`omit.${Y}`,$.name,X,`'${Y}' is a relation, not a column. A relation is already absent unless an 'include' asks for it.`);if(!(Y in $.fields))throw new g(Y,$.name,Object.keys($.fields));if(typeof H!=="boolean")throw new T(`omit.${Y}`,$.name,X,"Expected true or false.");if(H)z.add(Y)}let J=Object.values($.fields).filter((Y)=>!z.has(Y.name));if(J.length===0)throw new K("omit",$.name,X,`It omits every field on ${$.name}, which leaves no column to select. Prisma rejects that too.`);return J}function G3($,Z,X){if(X.length===0)return{fields:Z};let z=new Set(Z.map((H)=>H.name)),J=X.filter((H)=>!z.has(H));if(J.length===0)return{fields:Z};let Y=new Set([...z,...J]);return{fields:Object.values($.fields).filter((H)=>Y.has(H.name)),hidden:J}}var j9=new Set(["where","orderBy","select","omit","include","take","skip"]),K9=new Set(["where","select","omit","include"]),B3=10;function h0($){return[...new Set($.map((Z)=>Z.strategy))].sort()}function S0($,Z,X,z,J=P0){let Y=u0($,Z,z);if(Y.length===0)return{plans:[],keyFields:[]};let H=[],G=new Set;for(let V of Y){T9($,V,z);let W=U9($,V);R9(W,V.node,z,2);let M=J.plan({parent:$,child:W,relation:V.relation,as:V.as,node:V.node,locate:V.locate,dialect:X,operation:z});H.push(M);for(let B of M.parentFields)G.add(B)}return{plans:H,keyFields:[...G]}}async function P3($,Z,X,z,J){let Y=Array.isArray(X)?X:X===null||X===void 0?[]:[X];if(Y.length===0)return;for(let H of $){if(H.root)continue;await H.load(Y,z,J)}if(Z&&Z.length>0)for(let H of Y)for(let G of Z)delete H[G]}function u0($,Z,X){if(Z===void 0||Z===null)return[];let{include:z,select:J}=Z;L9($,z,J,X);let Y=[];if(z!==void 0&&z!==null){if(typeof z!=="object"||Array.isArray(z))throw new T("include",$.name,X,"Expected an object.");for(let H of Object.keys(z).sort()){let G=z[H];if(G===void 0||G===!1)continue;if(H===l)continue;let V=$.relations[H];if(!V)throw new f0(H,$.name,Object.keys($.relations));Y.push({as:H,relation:V,node:G,locate:(W)=>W?.include?.[H]})}return Y}if(J!==void 0&&J!==null&&typeof J==="object")for(let H of Object.keys(J).sort()){let G=J[H];if(G===void 0||G===!1)continue;let V=$.relations[H];if(!V)continue;Y.push({as:H,relation:V,node:G,locate:(W)=>W?.select?.[H]})}return Y}function L9($,Z,X,z,J){if(Z===void 0||X===void 0)return;throw new K(J?`${J}: select + include`:"select + include",$.name,z,"Prisma allows only one of them on the same query, at any level.")}function T9($,Z,X){let z=Z.node;if(z===!0)return;if(typeof z!=="object"||z===null||Array.isArray(z))throw new T(Z.as,$.name,X,"Expected true or an object of relation arguments.");let J=z;L9($,J.include,J.select,X,Z.as);let Y=Z.relation.kind==="many";for(let H of Object.keys(J).sort()){if(J[H]===void 0)continue;if(Y&&(H==="take"||H==="skip")){y7($,Z,X,H,J[H]);continue}if(Y?j9.has(H):K9.has(H))continue;if(H==="lock")throw new k0(`${Z.as}.lock`,$.name,X,"'lock' locks the rows of the model being queried, not an included relation's. Lock the related rows with their own locking read in the same transaction.");if(H==="orderBy"&&!Y)throw new K(`${Z.as}.orderBy`,$.name,X,"Prisma does not accept 'orderBy' on a to-one relation \u2014 there is at "+"most one row to order.");if(H==="take"||H==="skip")throw new K(`${Z.as}.${H}`,$.name,X,`Prisma does not accept '${H}' on a to-one relation.`);throw new K(`${Z.as}.${H}`,$.name,X,`A relation node takes ${[...Y?j9:K9].sort().join(", ")}.`)}}function y7($,Z,X,z,J){V3($.name,X,`${Z.as}.${z}`,z,J)}function s3($,Z){let X=$.node;if(typeof X!=="object"||X===null||Array.isArray(X))return;for(let z of["take","skip"]){if(X[z]===void 0)continue;throw new K(`${$.as}.${z}`,$.parent.name,$.operation,`A '${z}' inside a to-many relation is per parent, and the batched `+"relation planner serves every parent from one query \u2014 so the only "+`limit it could emit would page every parent's children as one set. Only the lateral join strategy can express it, by paginating inside a subquery that already runs once per parent row, and it needs Postgres: ${Z}. Load '${$.as}' as its own query, or narrow it with 'where'.`)}}function R9($,Z,X,z){if(typeof Z!=="object"||Z===null||Array.isArray(Z))return;if(Z.select!==void 0)J0($,Z,X);let J=u0($,Z,X);if(J.length===0)return;if(z>B3)throw new d3($.name,B3);for(let Y of J)T9($,Y,X),R9(U9($,Y),Y.node,X,z+1)}function I9($,Z,X,z){if($.parentFields.length!==1)throw new K(X.name,Z.name,z,`${X.name} joins on ${$.parentFields.length} fields (${$.parentFields.join(", ")}), and it is planned through a join table, which links two models by a single primary key each side. Prisma does not build an implicit many-to-many over a composite key.`);return{parentField:$.parentFields[0],childField:$.childFields[0],join:$.join}}function B0($,Z,X,z){if(X.joinTable)return u7($,Z,X);if(X.from.length>0)return Q9($,X,X.from,X.to,z);let J=h7($,Z,X);if(J.from.length===0)throw new s($.name,X.name,`neither ${$.name}.${X.name} nor ${Z.name}.${J.name} holds the foreign key.`);return Q9($,X,J.to,J.from,z)}function Q9($,Z,X,z,J){if(X.length===0)throw new K(Z.name,$.name,J,`${Z.name} names no join fields.`);if(X.length!==z.length)throw new s($.name,Z.name,`it joins ${X.length} field(s) to ${z.length}: ${X.join(", ")} against ${z.join(", ")}.`);return{parentFields:X,childFields:z}}function h7($,Z,X){let z=Object.values(Z.relations).filter((J)=>J.relationName===X.relationName&&!(Z.name===$.name&&J.name===X.name));if(z.length!==1)throw new s($.name,X.name,z.length===0?`${Z.name} declares no relation named '${X.relationName}'.`:`${Z.name} declares ${z.length} relations named '${X.relationName}'.`);return z[0]}function u7($,Z,X){let{table:z,a:J,b:Y}=X.joinTable;if(J===Y){let G=X.joinTable.ownerColumn;if(!G)throw new K(X.name,$.name,"include",`${X.name} is a self-referential implicit many-to-many, and the generated artifact predates support for one. Re-run \`prisma generate\`.`);return{parentFields:[W3($,X)],childFields:[W3(Z,X)],join:{table:z,parentColumn:G,childColumn:G==="A"?"B":"A"}}}if($.name!==J&&$.name!==Y)throw new s($.name,X.name,`the join table '${z}' connects ${J} and ${Y}, neither of which is ${$.name}.`);let H=$.name===J?"A":"B";return{parentFields:[W3($,X)],childFields:[W3(Z,X)],join:{table:z,parentColumn:H,childColumn:H==="A"?"B":"A"}}}function W3($,Z){if($.primaryKey.length!==1)throw new s($.name,Z.name,`an implicit many-to-many joins on ${$.name}'s primary key, which has ${$.primaryKey.length} fields.`);return $.primaryKey[0]}function M3($,Z,X){let z=$.fields[X];if(!z)throw new s($.name,Z.name,`it joins on '${X}', which is not a field on ${$.name}.`);return z}function U9($,Z){return X0($,Z.relation,Z.as)}function X0($,Z,X=Z.name){let z=Z.model;if(!a(z))throw new c3($.name,X,z,D3());let J=d(z)?.$schema;if(!J)throw new g0(z);return J}var _9="batched",P0={name:_9,plan($){s3($,"this query planned with the batched strategy");let Z=B0($.parent,$.child,$.relation,$.operation);for(let Y of Z.parentFields)C9($.parent,$.relation,M3($.parent,$.relation,Y));for(let Y of Z.childFields)C9($.child,$.relation,M3($.child,$.relation,Y));let X=M3($.parent,$.relation,Z.parentFields[0]),z=M3($.child,$.relation,Z.childFields[0]),J=$.relation.kind==="many";return{as:$.as,model:$.relation.model,kind:$.relation.kind,parentFields:Z.parentFields,strategy:_9,load(Y,H,G){let V={parentKeyField:X,childKeyField:z,many:J,parents:Y,args:H,executor:G};return Z.join?p7($,Z,V):m7($,Z,V)}}}};async function m7($,Z,X){let{keys:z,byKey:J}=O9(X.parents,Z.parentFields);if(z.length===0)return;let Y=$.locate(X.args),H=N9(Y,Z.childFields,z,$.child,$.dialect),G=await X.executor.exec($.relation.model,"findMany",H.args,!0);for(let V of G){let W=J.get(v0(Z.childFields.map((M)=>V[M])));if(!W)continue;for(let M of W)F9(M,$.as,V,X.many)}if(H.hidden)for(let V of G)for(let W of Z.childFields)delete V[W]}async function p7($,Z,X){let{keys:z,byKey:J}=O9(X.parents,Z.parentFields);if(z.length===0)return;let{dialect:Y}=$,H=Z.join,G=await d7(Y,H,z.map((P)=>Y.encode(P[0],X.parentKeyField)),X.executor),V=new Map,W=[];for(let P of G){let Q=v0([Y.decode(P[H.parentColumn],X.parentKeyField)]),C=J.get(Q);if(!C)continue;let F=Y.decode(P[H.childColumn],X.childKeyField),N=v0([F]),L=V.get(N);if(L===void 0)L=[],V.set(N,L),W.push([F]);for(let _ of C)L.push(_)}if(W.length===0)return;let M=$.locate(X.args),B=N9(M,Z.childFields,W,$.child,$.dialect),D=await X.executor.exec($.relation.model,"findMany",B.args,!0);for(let P of D){let Q=V.get(v0([P[Z.childFields[0]]]));if(!Q)continue;for(let C of Q)F9(C,$.as,P,X.many)}if(B.hidden)for(let P of D)delete P[Z.childFields[0]]}async function d7($,Z,X,z){let J=R(j(`select ${$.quoteIdent(Z.parentColumn)}, ${$.quoteIdent(Z.childColumn)} from ${$.quoteIdent(Z.table)} where `),$.inList($.quoteIdent(Z.parentColumn),!1,X.length,()=>X)),{text:Y,binders:H}=c(J,$,{model:Z.table,operation:"include"}),G=A0();return z.query(Y,H.map((V)=>V(void 0,G)))}function N9($,Z,X,z,J){let Y=$===!0||$===null||typeof $!=="object"?{}:$,H=Z.length===1?{[Z[0]]:{in:X.map((B)=>B[0])}}:c7(z,Z,X,J),G={where:Y.where===void 0?H:{AND:[Y.where,H]}};if(Y.orderBy!==void 0)G.orderBy=Y.orderBy;if(Y.include!==void 0)G.include=Y.include;let V=Y.omit;if(V!==void 0){let B=Z.filter((D)=>V[D]===!0);if(B.length===0)G.omit=V;else{let D={...V};for(let P of B)delete D[P];return G.omit=D,{args:G,hidden:!0}}}let W=Y.select;if(W===void 0)return{args:G,hidden:!1};let M=Z.filter((B)=>W[B]!==!0);if(M.length===0)return G.select=W,{args:G,hidden:!1};G.select={...W};for(let B of M)G.select[B]=!0;return{args:G,hidden:!0}}function c7($,Z,X,z){let J=Z.map((Y)=>$.fields[Y]?.type);if(J.every((Y)=>Y!==void 0)&&z.canBindCompositeIn(J))return{[z0]:W9(Z,X)};return{OR:X.map((Y)=>Object.fromEntries(Z.map((H,G)=>[H,Y[G]])))}}function v0($){return JSON.stringify($.map(s7))}function F9($,Z,X,z){if(z){$[Z].push(X);return}if($[Z]===null)$[Z]=X}function O9($,Z){let X=new Map,z=[];for(let J of $){let Y=Z.map((V)=>J[V]);if(Y.some((V)=>V===null||V===void 0))continue;let H=v0(Y),G=X.get(H);if(G===void 0)G=[],X.set(H,G),z.push(Y);G.push(J)}return{keys:z,byKey:X}}function s7($){if(typeof $!=="object"||$===null)return $;if($ instanceof Date)return $.getTime();if(ArrayBuffer.isView($)){let Z=new Uint8Array($.buffer,$.byteOffset,$.byteLength),X="";for(let z of Z)X+=z.toString(16).padStart(2,"0");return`bytes:${X}`}throw Error(`Cannot key a relation stitch on ${Object.prototype.toString.call($)}.`)}function C9($,Z,X){if(X.isList)throw new s($.name,Z.name,`it joins on '${X.name}', a ${X.type} list \u2014 which decodes to a new `+"array per row and so cannot be compared between the two sides.");if(X.type!=="Json")return;throw new s($.name,Z.name,`it joins on '${X.name}', a ${X.type} \u2014 which decodes to a new object `+"per row and so cannot be compared between the two sides.")}var A9=(()=>{try{return Function("return 1")()===1}catch{return!1}})(),S9=!0;function i7($){S9=$}function n7(){return A9}function m0($,Z,X=[]){if(A9&&S9)return l7($,Z,X);return i3($,Z,X)}function i3($,Z,X=[]){let z=$.map((G)=>({key:G.name,column:G.column,field:G,decode:Z.needsDecode(G)})),J=z.length,Y=X.map((G)=>({key:G.key,many:G.kind==="many"})),H=Y.length;return(G)=>{let V=[];for(let W=0;W<G.length;W++){let M=G[W],B={};for(let D=0;D<J;D++){let P=z[D],Q=M[P.column];B[P.key]=P.decode?Z.decode(Q,P.field):Q??null}for(let D=0;D<H;D++)B[Y[D].key]=Y[D].many?[]:null;V.push(B)}return V}}function l7($,Z,X){let z=[];for(let Y=0;Y<$.length;Y++){let H=$[Y],G=JSON.stringify(H.name),V=JSON.stringify(H.column);z.push(Z.needsDecode(H)?`${G}: d.decode(row[${V}], f[${Y}])`:`${G}: row[${V}] ?? null`)}for(let Y of X)z.push(`${JSON.stringify(Y.key)}: ${Y.kind==="many"?"[]":"null"}`);let J=`
3
3
  return function shape(rows) {
4
4
  const out = [];
5
5
  for (let i = 0; i < rows.length; i++) {
@@ -12,4 +12,4 @@ import{ca as v6}from"../chunk-pt159v3n.js";import{$a as w6,Ga as J9,Ha as Y9,Ia
12
12
  Columns marked [sensitive] hold secrets: never select them.`:"";return X.join(`
13
13
  `)+z}function n8($){let Z=$.column===$.field?$.field:`${$.field}@${$.column}`,X=($.enum?`${$.enum}(enum)`:$.type)+($.list?"[]":""),z=[$.primaryKey?"pk":null,$.unique?"unique":null,$.sensitive?"sensitive":null].filter(Boolean);return`${Z}:${X}${$.nullable?"?":""}${z.length>0?` [${z.join(", ")}]`:""}`}function l8($){let Z=`${$.model}${$.kind==="many"?"[]":$.nullable?"?":""}`;if($.joinTable)return`${$.name} -> ${Z} via "${$.joinTable}"`;if($.from.length>0){let X=$.from.map((z,J)=>`${z} = ${$.model}.${$.to[J]??"?"}`).join(" and ");return`${$.name} -> ${Z} on ${X}`}return`${$.name} -> ${Z}`}function o8($,Z,X){let z=X.find((J)=>J.name===$.model);return{name:$.name,model:$.model,kind:$.kind,nullable:$.nullable,from:$.from.map(Z),to:$.to.map((J)=>z?.fields[J]?.column??J),...$.joinTable?{joinTable:$.joinTable.table}:{}}}function t8($){return typeof $==="object"&&$!==null&&typeof $.name==="string"&&typeof $.table==="string"&&typeof $.fields==="object"&&typeof $.relations==="object"}function r8($){if($!==void 0)return(Array.isArray($)?$:Object.values($)).filter(t8);let Z=new Set,X=[];for(let z of D3()){let J=d(z).$schema;if(!J||Z.has(J.name))continue;Z.add(J.name),X.push(J)}return X}export{r5 as withTransaction,O6 as unsafeSql,D6 as transactionDepth,N3 as track,h0 as strategiesOf,U6 as sql,q8 as softDeletes,w8 as softDeleteMany,E8 as softDelete,n7 as shaperCompilationAvailable,i7 as setShaperCompilation,t5 as runAsUser,o5 as runAsSystem,v6 as rotateEncryptedColumns,a3 as resolveStrategy,F3 as resnapshot,A6 as renderFragment,y0 as registry,x6 as registerModels,H6 as register,q6 as redactNullable,R0 as provenanceOf,b3 as policyContext,q0 as policiesFor,S0 as planRelations,k4 as planKey,F8 as planCacheStats,s8 as paginate,R6 as ormSupports,W6 as ormContext,i0 as lateralStrategy,k as jsonNullKind,N6 as join,$6 as isUniqueConstraintError,S8 as isTracked,l5 as isSystemScope,e8 as isRecordNotFoundError,i9 as isClientSideDefault,n0 as hasClientSideValue,a0 as getOrCompile,I6 as everyDialect,F6 as empty,a5 as dialectFor,M7 as describeSchemaModels,i8 as describeSchema,p9 as defaultStrategy,Z3 as currentUser,$3 as currentTransaction,P6 as currentActor,t9 as createUuid,o9 as createUlid,l9 as createNanoid,n9 as createCuid,A0 as createBindContext,T5 as compileWrite,r3 as compileRead,x5 as compile,J5 as clientSideValue,O8 as clearPlanCache,g5 as changedFields,V0 as canonicalShape,m0 as buildRowShaper,i3 as buildInterpretedShaper,P0 as batchedStrategy,w6 as auditModelRegistrations,P3 as attachRelations,D2 as assertSchemaArtifactVersion,E6 as assertPoliciesRegistered,q3 as applyRedaction,e5 as applyPolicies,M6 as afterCommit,K as UnsupportedQueryError,T6 as UnsupportedDialectError,k0 as UnsupportedByDesignError,c3 as UnregisteredRelationTargetError,s5 as UnregisteredPolicyClassError,f0 as UnknownRelationError,g as UnknownFieldError,V6 as UnknownConnectionError,c5 as UniqueConstraintError,B6 as TransactionDependencyError,$5 as StaleSchemaArtifactError,L6 as SqliteDialect,b6 as ScopedPolicy,X6 as ScopeEscapeError,A5 as ScalarColumnError,B2 as SCHEMA_ARTIFACT_VERSION,C5 as ReturningUnsupportedError,d3 as RelationDepthExceededError,$0 as RecordNotFoundError,Q6 as PostgresDialect,Z6 as PolicyDeniedError,S6 as Policy,i5 as ParameterLimitError,Y6 as ModelNotRegisteredError,E3 as Model,T3 as MissingRequiredValueError,g0 as MissingModelSchemaError,s as MalformedRelationError,B3 as MAX_RELATION_DEPTH,n5 as LockOutsideTransactionError,z5 as JsonNull,O5 as JsonColumnError,z6 as InvalidPolicyEntryError,T as InvalidArgumentError,j6 as EncryptionKeyError,K6 as DecryptionError,a8 as DecodeError,_6 as DbNull,G6 as CrossConnectionTransactionError,C6 as AnyNull,J6 as AmbiguousModelRegistrationError,G7 as ActiveRecordModel};
14
14
 
15
- //# debugId=74E2DC31601C469164756E2164756E21
15
+ //# debugId=E120EBEC6F6BA1EB64756E2164756E21