@leanspec/ui 0.2.6 → 0.2.7-dev.20251126090633

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 (747) hide show
  1. package/.next/standalone/node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/build/Release/better_sqlite3.node +0 -0
  2. package/.next/standalone/packages/ui/.next/BUILD_ID +1 -1
  3. package/.next/standalone/packages/ui/.next/build-manifest.json +8 -8
  4. package/.next/standalone/packages/ui/.next/prerender-manifest.json +3 -3
  5. package/.next/standalone/packages/ui/.next/required-server-files.json +10 -4
  6. package/.next/standalone/packages/ui/.next/server/app/_global-error/page/build-manifest.json +6 -6
  7. package/.next/standalone/packages/ui/.next/server/app/_global-error/page.js +2 -2
  8. package/.next/standalone/packages/ui/.next/server/app/_global-error/page.js.nft.json +1 -1
  9. package/.next/standalone/packages/ui/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  10. package/.next/standalone/packages/ui/.next/server/app/_global-error.html +2 -2
  11. package/.next/standalone/packages/ui/.next/server/app/_global-error.rsc +7 -7
  12. package/.next/standalone/packages/ui/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
  13. package/.next/standalone/packages/ui/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
  14. package/.next/standalone/packages/ui/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
  15. package/.next/standalone/packages/ui/.next/server/app/_global-error.segments/_tree.segment.rsc +3 -3
  16. package/.next/standalone/packages/ui/.next/server/app/_not-found/page/build-manifest.json +6 -6
  17. package/.next/standalone/packages/ui/.next/server/app/_not-found/page.js +2 -2
  18. package/.next/standalone/packages/ui/.next/server/app/_not-found/page.js.nft.json +1 -1
  19. package/.next/standalone/packages/ui/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  20. package/.next/standalone/packages/ui/.next/server/app/_not-found.html +2 -2
  21. package/.next/standalone/packages/ui/.next/server/app/_not-found.rsc +19 -19
  22. package/.next/standalone/packages/ui/.next/server/app/_not-found.segments/_full.segment.rsc +19 -19
  23. package/.next/standalone/packages/ui/.next/server/app/_not-found.segments/_index.segment.rsc +12 -12
  24. package/.next/standalone/packages/ui/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +3 -3
  25. package/.next/standalone/packages/ui/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  26. package/.next/standalone/packages/ui/.next/server/app/_not-found.segments/_tree.segment.rsc +5 -5
  27. package/.next/standalone/packages/ui/.next/server/app/api/local-projects/[id]/route.js.nft.json +1 -1
  28. package/.next/standalone/packages/ui/.next/server/app/api/local-projects/discover/route.js +2 -2
  29. package/.next/standalone/packages/ui/.next/server/app/api/local-projects/discover/route.js.nft.json +1 -1
  30. package/.next/standalone/packages/ui/.next/server/app/api/local-projects/list-directory/route.js +2 -2
  31. package/.next/standalone/packages/ui/.next/server/app/api/local-projects/list-directory/route.js.nft.json +1 -1
  32. package/.next/standalone/packages/ui/.next/server/app/api/local-projects/route.js +2 -2
  33. package/.next/standalone/packages/ui/.next/server/app/api/local-projects/route.js.nft.json +1 -1
  34. package/.next/standalone/packages/ui/.next/server/app/api/projects/[id]/route.js.nft.json +1 -1
  35. package/.next/standalone/packages/ui/.next/server/app/api/projects/[id]/specs/[spec]/route.js +2 -2
  36. package/.next/standalone/packages/ui/.next/server/app/api/projects/[id]/specs/[spec]/route.js.nft.json +1 -1
  37. package/.next/standalone/packages/ui/.next/server/app/api/projects/[id]/specs/[spec]/status/route.js.nft.json +1 -1
  38. package/.next/standalone/packages/ui/.next/server/app/api/projects/[id]/specs/route.js +2 -2
  39. package/.next/standalone/packages/ui/.next/server/app/api/projects/[id]/specs/route.js.nft.json +1 -1
  40. package/.next/standalone/packages/ui/.next/server/app/api/projects/[id]/stats/route.js.nft.json +1 -1
  41. package/.next/standalone/packages/ui/.next/server/app/api/projects/route.js +2 -2
  42. package/.next/standalone/packages/ui/.next/server/app/api/projects/route.js.nft.json +1 -1
  43. package/.next/standalone/packages/ui/.next/server/app/api/revalidate/route.js +2 -2
  44. package/.next/standalone/packages/ui/.next/server/app/api/revalidate/route.js.nft.json +1 -1
  45. package/.next/standalone/packages/ui/.next/server/app/api/specs/[id]/dependency-graph/route.js +2 -2
  46. package/.next/standalone/packages/ui/.next/server/app/api/specs/[id]/dependency-graph/route.js.nft.json +1 -1
  47. package/.next/standalone/packages/ui/.next/server/app/api/specs/[id]/route.js +2 -2
  48. package/.next/standalone/packages/ui/.next/server/app/api/specs/[id]/route.js.nft.json +1 -1
  49. package/.next/standalone/packages/ui/.next/server/app/api/specs/[id]/status/route.js +2 -2
  50. package/.next/standalone/packages/ui/.next/server/app/api/specs/[id]/status/route.js.nft.json +1 -1
  51. package/.next/standalone/packages/ui/.next/server/app/api/specs/[id]/subspecs/[file]/route.js +2 -2
  52. package/.next/standalone/packages/ui/.next/server/app/api/specs/[id]/subspecs/[file]/route.js.nft.json +1 -1
  53. package/.next/standalone/packages/ui/.next/server/app/api/stats/route.js +2 -2
  54. package/.next/standalone/packages/ui/.next/server/app/api/stats/route.js.nft.json +1 -1
  55. package/.next/standalone/packages/ui/.next/server/app/page/build-manifest.json +6 -6
  56. package/.next/standalone/packages/ui/.next/server/app/page.js.nft.json +1 -1
  57. package/.next/standalone/packages/ui/.next/server/app/page_client-reference-manifest.js +1 -1
  58. package/.next/standalone/packages/ui/.next/server/app/projects/[projectId]/page/build-manifest.json +6 -6
  59. package/.next/standalone/packages/ui/.next/server/app/projects/[projectId]/page.js +2 -2
  60. package/.next/standalone/packages/ui/.next/server/app/projects/[projectId]/page.js.nft.json +1 -1
  61. package/.next/standalone/packages/ui/.next/server/app/projects/[projectId]/page_client-reference-manifest.js +1 -1
  62. package/.next/standalone/packages/ui/.next/server/app/projects/[projectId]/specs/[specId]/page/build-manifest.json +6 -6
  63. package/.next/standalone/packages/ui/.next/server/app/projects/[projectId]/specs/[specId]/page.js +2 -2
  64. package/.next/standalone/packages/ui/.next/server/app/projects/[projectId]/specs/[specId]/page.js.nft.json +1 -1
  65. package/.next/standalone/packages/ui/.next/server/app/projects/[projectId]/specs/[specId]/page_client-reference-manifest.js +1 -1
  66. package/.next/standalone/packages/ui/.next/server/app/projects/[projectId]/specs/page/build-manifest.json +6 -6
  67. package/.next/standalone/packages/ui/.next/server/app/projects/[projectId]/specs/page.js +2 -2
  68. package/.next/standalone/packages/ui/.next/server/app/projects/[projectId]/specs/page.js.nft.json +1 -1
  69. package/.next/standalone/packages/ui/.next/server/app/projects/[projectId]/specs/page_client-reference-manifest.js +1 -1
  70. package/.next/standalone/packages/ui/.next/server/app/projects/page/build-manifest.json +6 -6
  71. package/.next/standalone/packages/ui/.next/server/app/projects/page.js +2 -2
  72. package/.next/standalone/packages/ui/.next/server/app/projects/page.js.nft.json +1 -1
  73. package/.next/standalone/packages/ui/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  74. package/.next/standalone/packages/ui/.next/server/app/projects.html +2 -2
  75. package/.next/standalone/packages/ui/.next/server/app/projects.rsc +28 -29
  76. package/.next/standalone/packages/ui/.next/server/app/projects.segments/_full.segment.rsc +28 -29
  77. package/.next/standalone/packages/ui/.next/server/app/projects.segments/_index.segment.rsc +12 -12
  78. package/.next/standalone/packages/ui/.next/server/app/projects.segments/_tree.segment.rsc +5 -5
  79. package/.next/standalone/packages/ui/.next/server/app/projects.segments/projects/__PAGE__.segment.rsc +4 -4
  80. package/.next/standalone/packages/ui/.next/server/app/projects.segments/projects.segment.rsc +3 -3
  81. package/.next/standalone/packages/ui/.next/server/app/specs/[id]/page/build-manifest.json +6 -6
  82. package/.next/standalone/packages/ui/.next/server/app/specs/[id]/page.js +2 -2
  83. package/.next/standalone/packages/ui/.next/server/app/specs/[id]/page.js.nft.json +1 -1
  84. package/.next/standalone/packages/ui/.next/server/app/specs/[id]/page_client-reference-manifest.js +1 -1
  85. package/.next/standalone/packages/ui/.next/server/app/specs/page/build-manifest.json +6 -6
  86. package/.next/standalone/packages/ui/.next/server/app/specs/page.js +2 -2
  87. package/.next/standalone/packages/ui/.next/server/app/specs/page.js.nft.json +1 -1
  88. package/.next/standalone/packages/ui/.next/server/app/specs/page_client-reference-manifest.js +1 -1
  89. package/.next/standalone/packages/ui/.next/server/app/stats/page/build-manifest.json +6 -6
  90. package/.next/standalone/packages/ui/.next/server/app/stats/page.js +2 -2
  91. package/.next/standalone/packages/ui/.next/server/app/stats/page.js.nft.json +1 -1
  92. package/.next/standalone/packages/ui/.next/server/app/stats/page_client-reference-manifest.js +1 -1
  93. package/.next/standalone/packages/ui/.next/server/chunks/6681a__next-internal_server_app_api_specs_[id]_subspecs_[file]_route_actions_556a9993.js +1 -1
  94. package/.next/standalone/packages/ui/.next/server/chunks/6e9bd_next_952b10e2._.js +2 -2
  95. package/.next/standalone/packages/ui/.next/server/chunks/730ea_ui__next-internal_server_app_api_local-projects_[id]_route_actions_664abe9c.js +1 -1
  96. package/.next/standalone/packages/ui/.next/server/chunks/730ea_ui__next-internal_server_app_api_local-projects_discover_route_actions_e6ec3fa7.js +1 -1
  97. package/.next/standalone/packages/ui/.next/server/chunks/730ea_ui__next-internal_server_app_api_projects_[id]_specs_route_actions_6d03fd1f.js +1 -1
  98. package/.next/standalone/packages/ui/.next/server/chunks/730ea_ui__next-internal_server_app_api_projects_[id]_stats_route_actions_a0bb04a8.js +1 -1
  99. package/.next/standalone/packages/ui/.next/server/chunks/730ea_ui__next-internal_server_app_api_specs_[id]_status_route_actions_5d700407.js +1 -1
  100. package/.next/standalone/packages/ui/.next/server/chunks/[root-of-the-server]__0fbfea15._.js +1 -1
  101. package/.next/standalone/packages/ui/.next/server/chunks/[root-of-the-server]__126dea7b._.js +1 -1
  102. package/.next/standalone/packages/ui/.next/server/chunks/[root-of-the-server]__1f037512._.js +1 -1
  103. package/.next/standalone/packages/ui/.next/server/chunks/[root-of-the-server]__3559376c._.js +4 -4
  104. package/.next/standalone/packages/ui/.next/server/chunks/[root-of-the-server]__548e27d4._.js +1 -1
  105. package/.next/standalone/packages/ui/.next/server/chunks/[root-of-the-server]__65667b70._.js +1 -1
  106. package/.next/standalone/packages/ui/.next/server/chunks/[root-of-the-server]__675a763e._.js +1 -1
  107. package/.next/standalone/packages/ui/.next/server/chunks/[root-of-the-server]__803d07f0._.js +1 -1
  108. package/.next/standalone/packages/ui/.next/server/chunks/[root-of-the-server]__8075fe29._.js +1 -1
  109. package/.next/standalone/packages/ui/.next/server/chunks/[root-of-the-server]__8233e09b._.js +1 -1
  110. package/.next/standalone/packages/ui/.next/server/chunks/[root-of-the-server]__84cdc14a._.js +1 -1
  111. package/.next/standalone/packages/ui/.next/server/chunks/[root-of-the-server]__9ce722b4._.js +1 -1
  112. package/.next/standalone/packages/ui/.next/server/chunks/[root-of-the-server]__a2d7cbed._.js +1 -1
  113. package/.next/standalone/packages/ui/.next/server/chunks/[root-of-the-server]__aa677b0d._.js +1 -1
  114. package/.next/standalone/packages/ui/.next/server/chunks/[root-of-the-server]__ac744182._.js +1 -1
  115. package/.next/standalone/packages/ui/.next/server/chunks/[root-of-the-server]__ae726e9c._.js +1 -1
  116. package/.next/standalone/packages/ui/.next/server/chunks/[root-of-the-server]__bb9fca84._.js +2 -2
  117. package/.next/standalone/packages/ui/.next/server/chunks/[root-of-the-server]__bdc3963a._.js +1 -1
  118. package/.next/standalone/packages/ui/.next/server/chunks/[root-of-the-server]__f06435b0._.js +1 -1
  119. package/.next/standalone/packages/ui/.next/server/chunks/[root-of-the-server]__f5c6d6b8._.js +1 -1
  120. package/.next/standalone/packages/ui/.next/server/chunks/[root-of-the-server]__fb91986f._.js +1 -1
  121. package/.next/standalone/packages/ui/.next/server/chunks/e0876_tiktoken_3efea2dc._.js +1 -1
  122. package/.next/standalone/packages/ui/.next/server/chunks/f825c_server_app_api_local-projects_list-directory_route_actions_d620ec1a.js +1 -1
  123. package/.next/standalone/packages/ui/.next/server/chunks/f825c_server_app_api_projects_[id]_specs_[spec]_status_route_actions_e9f1bdc5.js +1 -1
  124. package/.next/standalone/packages/ui/.next/server/chunks/node_modules__pnpm_731b55aa._.js +1 -1
  125. package/.next/standalone/packages/ui/.next/server/chunks/packages_ui__next-internal_server_app_api_local-projects_route_actions_9142d5ad.js +1 -1
  126. package/.next/standalone/packages/ui/.next/server/chunks/packages_ui__next-internal_server_app_api_projects_route_actions_73e4c2a1.js +1 -1
  127. package/.next/standalone/packages/ui/.next/server/chunks/packages_ui__next-internal_server_app_api_revalidate_route_actions_a8bf21b5.js +1 -1
  128. package/.next/standalone/packages/ui/.next/server/chunks/packages_ui__next-internal_server_app_api_specs_[id]_route_actions_0793bd75.js +1 -1
  129. package/.next/standalone/packages/ui/.next/server/chunks/packages_ui__next-internal_server_app_api_stats_route_actions_8e042245.js +1 -1
  130. package/.next/standalone/packages/ui/.next/server/chunks/packages_ui_src_lib_db_index_ts_556307fa._.js +4 -4
  131. package/.next/standalone/packages/ui/.next/server/chunks/packages_ui_src_lib_specs_sources_database-source_ts_0bd881ee._.js +1 -1
  132. package/.next/standalone/packages/ui/.next/server/chunks/packages_ui_src_lib_specs_sources_database-source_ts_baa0160d._.js +1 -1
  133. package/.next/standalone/packages/ui/.next/server/chunks/ssr/1ce3b_dagre-d3-es_src_dagre_index_f9cad90b.js +3 -0
  134. package/.next/standalone/packages/ui/.next/server/chunks/ssr/38a22_sonner_dist_index_mjs_207730fe._.js +1 -1
  135. package/.next/standalone/packages/ui/.next/server/chunks/ssr/4e76f_cytoscape_dist_cytoscape_esm_mjs_56d6d0a1._.js +3 -0
  136. package/.next/standalone/packages/ui/.next/server/chunks/ssr/54964_d3-scale_src_c504aad0._.js +3 -0
  137. package/.next/standalone/packages/ui/.next/server/chunks/ssr/54964_d3-scale_src_linear_5b8914dd.js +3 -0
  138. package/.next/standalone/packages/ui/.next/server/chunks/ssr/641df_lodash-es_057c0674._.js +3 -0
  139. package/.next/standalone/packages/ui/.next/server/chunks/ssr/641df_lodash-es_4b57a3a3._.js +3 -0
  140. package/.next/standalone/packages/ui/.next/server/chunks/ssr/641df_lodash-es_4d3de843._.js +3 -0
  141. package/.next/standalone/packages/ui/.next/server/chunks/ssr/641df_lodash-es_5f3103e1._.js +3 -0
  142. package/.next/standalone/packages/ui/.next/server/chunks/ssr/641df_lodash-es_bcc35893._.js +3 -0
  143. package/.next/standalone/packages/ui/.next/server/chunks/ssr/641df_lodash-es_f2ef1919._.js +3 -0
  144. package/.next/standalone/packages/ui/.next/server/chunks/ssr/676f9_@mermaid-js_parser_dist_chunks_mermaid-parser_core_info-NVLQJR56_mjs_cc500a11._.js +3 -0
  145. package/.next/standalone/packages/ui/.next/server/chunks/ssr/676f9_@mermaid-js_parser_dist_chunks_mermaid-parser_core_packet-BFZMPI3H_mjs_06a9c7d7._.js +3 -0
  146. package/.next/standalone/packages/ui/.next/server/chunks/ssr/676f9_@mermaid-js_parser_dist_chunks_mermaid-parser_core_pie-7BOR55EZ_mjs_1167f1a1._.js +3 -0
  147. package/.next/standalone/packages/ui/.next/server/chunks/ssr/676f9_@mermaid-js_parser_dist_chunks_mermaid-parser_core_radar-NHE76QYJ_mjs_962e6256._.js +3 -0
  148. package/.next/standalone/packages/ui/.next/server/chunks/ssr/676f9_@mermaid-js_parser_dist_chunks_mermaid-parser_core_treemap-KMMF4GRG_mjs_a12f0fad._.js +3 -0
  149. package/.next/standalone/packages/ui/.next/server/chunks/ssr/6e9bd_next_40720940._.js +2 -2
  150. package/.next/standalone/packages/ui/.next/server/chunks/ssr/6e9bd_next_dist_1decfd3f._.js +1 -1
  151. package/.next/standalone/packages/ui/.next/server/chunks/ssr/6e9bd_next_dist_69a12422._.js +2 -2
  152. package/.next/standalone/packages/ui/.next/server/chunks/ssr/6e9bd_next_dist_7af75658._.js +1 -1
  153. package/.next/standalone/packages/ui/.next/server/chunks/ssr/6e9bd_next_dist_client_components_0f429de8._.js +1 -1
  154. package/.next/standalone/packages/ui/.next/server/chunks/ssr/6e9bd_next_dist_client_components_builtin_global-error_3666c25c.js +1 -1
  155. package/.next/standalone/packages/ui/.next/server/chunks/ssr/6e9bd_next_dist_client_components_builtin_unauthorized_78af867c.js +1 -1
  156. package/.next/standalone/packages/ui/.next/server/chunks/ssr/6e9bd_next_dist_df5dcbe9._.js +2 -2
  157. package/.next/standalone/packages/ui/.next/server/chunks/ssr/6e9bd_next_dist_esm_25672c28._.js +2 -2
  158. package/.next/standalone/packages/ui/.next/server/chunks/ssr/6e9bd_next_dist_esm_build_templates_app-page_4f278283.js +2 -2
  159. package/.next/standalone/packages/ui/.next/server/chunks/ssr/730ea_ui__next-internal_server_app_projects_[projectId]_specs_page_actions_82e32fe4.js +1 -1
  160. package/.next/standalone/packages/ui/.next/server/chunks/ssr/8b009_parser_dist_chunks_mermaid-parser_core_architecture-U656AL7Q_mjs_64f0e692._.js +3 -0
  161. package/.next/standalone/packages/ui/.next/server/chunks/ssr/8b009_parser_dist_chunks_mermaid-parser_core_gitGraph-F6HP7TQM_mjs_6383c425._.js +3 -0
  162. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_0b254b71._.js +3 -0
  163. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_8167bfdd._.js +17 -0
  164. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_blockDiagram-VD42YOAC_mjs_99bfbaf9._.js +119 -0
  165. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_c4Diagram-YG6GDRKO_mjs_0683be9f._.js +7 -0
  166. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_c5b1d4f9._.js +17 -0
  167. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_chunk-ABZYJK2D_mjs_4034a85b._.js +79 -0
  168. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_chunk-B4BG7PRW_mjs_3190ac39._.js +162 -0
  169. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_chunk-DI55MBZ5_mjs_2e49cdd9._.js +217 -0
  170. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_chunk-FMBD7UC4_mjs_69c9238e._.js +17 -0
  171. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_chunk-JA3XYJ7Z_mjs_4c9b0254._.js +62 -0
  172. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_chunk-JZLCHNYA_mjs_e1210981._.js +55 -0
  173. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_chunk-MI3HLSF2_mjs_4494daf0._.js +3 -0
  174. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_chunk-QXUST7PY_mjs_3e69582d._.js +9 -0
  175. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_chunk-S3R3BYOJ_mjs_0c8df0bf._.js +4 -0
  176. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_chunk-TZMSLE5B_mjs_72a0311f._.js +3 -0
  177. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_dagre-6UL2VRFP_mjs_2a0e551c._.js +3 -0
  178. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_diagram-PSM6KHXK_mjs_f109b802._.js +26 -0
  179. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_erDiagram-Q2GNP2WA_mjs_2956542e._.js +57 -0
  180. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_f71564d9._.js +3 -0
  181. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_ffd8fbee._.js +3 -0
  182. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_flowDiagram-NV44I4VS_mjs_c11db931._.js +154 -0
  183. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_gitGraphDiagram-NY62KEGX_mjs_fe41f076._.js +65 -0
  184. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_journeyDiagram-XKPGCS4Q_mjs_8b9c3e68._.js +136 -0
  185. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_kanban-definition-3W4ZIXB7_mjs_d8e6de34._.js +81 -0
  186. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_quadrantDiagram-AYHSOK5B_mjs_50c2110d._.js +3 -0
  187. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_requirementDiagram-UZGBJVZJ_mjs_8f86dea7._.js +61 -0
  188. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_sankeyDiagram-TZEHDZUN_mjs_9fa014df._.js +6 -0
  189. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_sequenceDiagram-WL72ISMW_mjs_4d5ee2b1._.js +138 -0
  190. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_stateDiagram-FKZM4ZOC_mjs_2bd67ce9._.js +3 -0
  191. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_timeline-definition-IT6M3QCI_mjs_96b04d43._.js +58 -0
  192. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_chunks_mermaid_core_xychartDiagram-PRI3JC2R_mjs_7eec04e0._.js +3 -0
  193. package/.next/standalone/packages/ui/.next/server/chunks/ssr/931bf_mermaid_dist_mermaid_core_mjs_1c407865._.js +9 -0
  194. package/.next/standalone/packages/ui/.next/server/chunks/ssr/[externals]_better-sqlite3_a1cc22cb._.js +1 -1
  195. package/.next/standalone/packages/ui/.next/server/chunks/ssr/[root-of-the-server]__015fceb2._.js +1 -1
  196. package/.next/standalone/packages/ui/.next/server/chunks/ssr/[root-of-the-server]__01bfc8ff._.js +1 -1
  197. package/.next/standalone/packages/ui/.next/server/chunks/ssr/[root-of-the-server]__0f0dade1._.js +1 -1
  198. package/.next/standalone/packages/ui/.next/server/chunks/ssr/[root-of-the-server]__1d0c2012._.js +1 -1
  199. package/.next/standalone/packages/ui/.next/server/chunks/ssr/[root-of-the-server]__2977636f._.js +3 -3
  200. package/.next/standalone/packages/ui/.next/server/chunks/ssr/[root-of-the-server]__338c65fe._.js +1 -1
  201. package/.next/standalone/packages/ui/.next/server/chunks/ssr/[root-of-the-server]__4ec37765._.js +1 -1
  202. package/.next/standalone/packages/ui/.next/server/chunks/ssr/[root-of-the-server]__50122e7e._.js +1 -1
  203. package/.next/standalone/packages/ui/.next/server/chunks/ssr/[root-of-the-server]__5382b397._.js +1 -1
  204. package/.next/standalone/packages/ui/.next/server/chunks/ssr/[root-of-the-server]__73f60f12._.js +2 -2
  205. package/.next/standalone/packages/ui/.next/server/chunks/ssr/[root-of-the-server]__7f55abaa._.js +1 -1
  206. package/.next/standalone/packages/ui/.next/server/chunks/ssr/[root-of-the-server]__88a691ee._.js +1 -1
  207. package/.next/standalone/packages/ui/.next/server/chunks/ssr/[root-of-the-server]__8b019a26._.js +1 -1
  208. package/.next/standalone/packages/ui/.next/server/chunks/ssr/[root-of-the-server]__a7ae8552._.js +2 -2
  209. package/.next/standalone/packages/ui/.next/server/chunks/ssr/[root-of-the-server]__bdbbba01._.js +1 -1
  210. package/.next/standalone/packages/ui/.next/server/chunks/ssr/[root-of-the-server]__cc589a54._.js +1 -1
  211. package/.next/standalone/packages/ui/.next/server/chunks/ssr/[root-of-the-server]__daee3355._.js +3 -0
  212. package/.next/standalone/packages/ui/.next/server/chunks/ssr/[root-of-the-server]__e4a2bcdd._.js +64 -0
  213. package/.next/standalone/packages/ui/.next/server/chunks/ssr/[root-of-the-server]__ec5b96a5._.js +1 -1
  214. package/.next/standalone/packages/ui/.next/server/chunks/ssr/[root-of-the-server]__fd80e4dd._.js +1 -1
  215. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_000dd317._.js +1 -1
  216. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_0f9ffe32._.js +3 -0
  217. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_14118969._.js +3 -0
  218. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_22274047._.js +3 -0
  219. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_39562b2a._.js +2 -2
  220. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_3b617676._.js +1 -1
  221. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_3fac7eca._.js +1 -1
  222. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_4129cc0f._.js +1 -1
  223. package/.next/standalone/packages/ui/.next/server/chunks/ssr/{_196b5a83._.js → _497c8b73._.js} +2 -2
  224. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_85effc18._.js +2 -2
  225. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_8f9656c4._.js +2 -2
  226. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_911f204b._.js +1 -1
  227. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_ac867463._.js +3 -0
  228. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_ad8c1e99._.js +1 -1
  229. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_b6ac86b4._.js +3 -0
  230. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_b9dc2415._.js +2 -2
  231. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_bae6d2b8._.js +2 -2
  232. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_c2f54661._.js +3 -3
  233. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_f7344ef6._.js +2 -2
  234. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_fdd7780b._.js +2 -2
  235. package/.next/standalone/packages/ui/.next/server/chunks/ssr/c7b92_d3-shape_src_arc_9341f572.js +3 -0
  236. package/.next/standalone/packages/ui/.next/server/chunks/ssr/f0bdc_katex_dist_katex_mjs_27a6c950._.js +3 -0
  237. package/.next/standalone/packages/ui/.next/server/chunks/ssr/f825c_server_app_projects_[projectId]_specs_[specId]_page_actions_22d9c35e.js +1 -1
  238. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_03d68913._.js +62 -0
  239. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_1aec4342._.js +17 -0
  240. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_2a29db83._.js +3 -0
  241. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_3ba1438c._.js +3 -0
  242. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_472d6274._.js +3 -0
  243. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_50944832._.js +1 -1
  244. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_5237fdd7._.js +3 -0
  245. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_69372f5b._.js +3 -0
  246. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_76d4233c._.js +17 -0
  247. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_7791e3b8._.js +3 -0
  248. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_79befbed._.js +3 -0
  249. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_88c8b88b._.js +3 -0
  250. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_a01fbd8e._.js +3 -0
  251. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_a3f2a370._.js +3 -0
  252. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_ab5a8afc._.js +3 -0
  253. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_b23175bb._.js +38 -0
  254. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_b247a526._.js +264 -0
  255. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_b5a3d3a5._.js +3 -0
  256. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_c17f27b1._.js +45 -0
  257. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_c22df304._.js +17 -0
  258. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_c766836f._.js +3 -0
  259. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_cb5a045f._.js +3 -0
  260. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_d8037b10._.js +3 -0
  261. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_e175b92a._.js +31 -0
  262. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_e440897f._.js +3 -0
  263. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_ea1bddc7._.js +3 -0
  264. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_f5b29533._.js +3 -0
  265. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_f732d0bb._.js +26 -0
  266. package/.next/standalone/packages/ui/.next/server/chunks/ssr/packages_ui__next-internal_server_app__global-error_page_actions_e9e4a8e1.js +1 -1
  267. package/.next/standalone/packages/ui/.next/server/chunks/ssr/packages_ui__next-internal_server_app__not-found_page_actions_428c805d.js +1 -1
  268. package/.next/standalone/packages/ui/.next/server/chunks/ssr/packages_ui__next-internal_server_app_page_actions_f4c42a31.js +1 -1
  269. package/.next/standalone/packages/ui/.next/server/chunks/ssr/packages_ui__next-internal_server_app_projects_[projectId]_page_actions_f2986585.js +1 -1
  270. package/.next/standalone/packages/ui/.next/server/chunks/ssr/packages_ui__next-internal_server_app_projects_page_actions_715940ea.js +1 -1
  271. package/.next/standalone/packages/ui/.next/server/chunks/ssr/packages_ui__next-internal_server_app_specs_[id]_page_actions_555bb544.js +1 -1
  272. package/.next/standalone/packages/ui/.next/server/chunks/ssr/packages_ui__next-internal_server_app_specs_page_actions_b92ceb22.js +1 -1
  273. package/.next/standalone/packages/ui/.next/server/chunks/ssr/packages_ui__next-internal_server_app_stats_page_actions_35d53654.js +1 -1
  274. package/.next/standalone/packages/ui/.next/server/chunks/ssr/packages_ui_src_19541980._.js +1 -1
  275. package/.next/standalone/packages/ui/.next/server/chunks/ssr/packages_ui_src_app_error_tsx_7bf5aa01._.js +1 -1
  276. package/.next/standalone/packages/ui/.next/server/chunks/ssr/packages_ui_src_app_error_tsx_d8203bfe._.js +1 -1
  277. package/.next/standalone/packages/ui/.next/server/chunks/ssr/packages_ui_src_app_loading_tsx_9304a706._.js +1 -1
  278. package/.next/standalone/packages/ui/.next/server/chunks/ssr/packages_ui_src_app_projects_[projectId]_be242d6c._.js +1 -1
  279. package/.next/standalone/packages/ui/.next/server/chunks/ssr/packages_ui_src_app_projects_[projectId]_project-context-syncer_tsx_7954ea3b._.js +1 -1
  280. package/.next/standalone/packages/ui/.next/server/chunks/ssr/packages_ui_src_app_projects_page_tsx_6e166c8e._.js +1 -1
  281. package/.next/standalone/packages/ui/.next/server/chunks/ssr/packages_ui_src_app_specs_specs-client_tsx_0bb8f8f8._.js +1 -1
  282. package/.next/standalone/packages/ui/.next/server/chunks/ssr/packages_ui_src_components_specs-nav-sidebar_tsx_8237ed13._.js +1 -1
  283. package/.next/standalone/packages/ui/.next/server/chunks/ssr/packages_ui_src_components_ui_select_tsx_7e21d40f._.js +1 -1
  284. package/.next/standalone/packages/ui/.next/server/chunks/ssr/packages_ui_src_lib_specs_sources_database-source_ts_f7186c2a._.js +2 -2
  285. package/.next/standalone/packages/ui/.next/server/chunks/ssr/packages_ui_src_lib_utils_ts_259f88e4._.js +1 -1
  286. package/.next/standalone/packages/ui/.next/server/chunks/ssr/packages_ui_src_lib_utils_ts_c47f8e19._.js +1 -1
  287. package/.next/standalone/packages/ui/.next/server/middleware-build-manifest.js +6 -6
  288. package/.next/standalone/packages/ui/.next/server/pages/404.html +2 -2
  289. package/.next/standalone/packages/ui/.next/server/pages/500.html +2 -2
  290. package/.next/standalone/packages/ui/.next/server/server-reference-manifest.js +1 -1
  291. package/.next/standalone/packages/ui/.next/server/server-reference-manifest.json +1 -1
  292. package/.next/standalone/packages/ui/.next/static/chunks/038fb2d565c88582.js +2 -0
  293. package/.next/standalone/packages/ui/.next/static/chunks/0f108f65249f8820.js +19 -0
  294. package/.next/standalone/packages/ui/.next/static/chunks/1104de0c16e0b792.js +59 -0
  295. package/.next/standalone/packages/ui/.next/static/chunks/1490995adc7829e2.js +136 -0
  296. package/.next/standalone/packages/ui/.next/static/chunks/16b742746668b9d6.js +56 -0
  297. package/.next/standalone/packages/ui/.next/static/chunks/16ff9833ae1bb3ae.js +1 -0
  298. package/.next/standalone/packages/ui/.next/static/chunks/192b2f6118d057e2.js +60 -0
  299. package/.next/standalone/packages/ui/.next/static/chunks/1a910f137d27fff0.js +63 -0
  300. package/.next/standalone/packages/ui/.next/static/chunks/1f052e076ca9a3ff.js +1 -0
  301. package/.next/standalone/packages/ui/.next/static/chunks/20f4141ccb5d4eb4.js +1 -0
  302. package/.next/standalone/packages/ui/.next/static/chunks/2136b3131f74188f.js +1 -0
  303. package/.next/standalone/packages/ui/.next/static/chunks/2204c0f16b23ec4c.js +3 -0
  304. package/.next/standalone/packages/ui/.next/static/chunks/294dea6dbec43ca6.js +1 -0
  305. package/.next/standalone/packages/ui/.next/static/chunks/2a33b9246ea4be03.js +2 -0
  306. package/.next/standalone/packages/ui/.next/static/chunks/2c85b8059e42248a.js +1 -0
  307. package/.next/standalone/packages/ui/.next/static/chunks/305b74f3c20cb4ef.js +1 -0
  308. package/.next/standalone/packages/ui/.next/static/chunks/3276ca6fd9005903.js +13 -0
  309. package/.next/standalone/packages/ui/.next/static/chunks/37f2e45cf97245d9.js +117 -0
  310. package/.next/standalone/packages/ui/.next/static/chunks/39691fae9a3463fe.js +262 -0
  311. package/.next/standalone/packages/ui/.next/static/chunks/3b6b058ebd14dbed.js +1 -0
  312. package/.next/standalone/packages/ui/.next/static/chunks/3ed1465109fecc2d.js +1 -0
  313. package/.next/standalone/packages/ui/.next/static/chunks/3f94c1ef6e27c8bd.js +1 -0
  314. package/.next/standalone/packages/ui/.next/static/chunks/414a78f7b9b58d11.js +53 -0
  315. package/.next/standalone/packages/ui/.next/static/chunks/4e85dea329906168.js +1 -0
  316. package/.next/standalone/packages/ui/.next/static/chunks/525d6cb99a13c44a.js +215 -0
  317. package/.next/standalone/packages/ui/.next/static/chunks/5295f0e82fd2a6d3.js +24 -0
  318. package/.next/standalone/packages/ui/.next/static/chunks/567bc31005c31006.js +1 -0
  319. package/.next/standalone/packages/ui/.next/static/chunks/56894ea818ee2a54.js +1 -0
  320. package/.next/standalone/packages/ui/.next/static/chunks/569b4347ce55d973.js +1 -0
  321. package/.next/standalone/packages/ui/.next/static/chunks/5fffdea0623d8a25.js +1 -0
  322. package/.next/standalone/packages/ui/.next/static/chunks/642374ace530e2bd.js +1 -0
  323. package/.next/standalone/packages/ui/.next/static/chunks/64543dbd7a7a99b7.js +1 -0
  324. package/.next/standalone/packages/ui/.next/static/chunks/6483096c16d96f2c.js +15 -0
  325. package/.next/standalone/packages/ui/.next/static/chunks/66d3fa1af3ff1fbf.js +1 -0
  326. package/.next/standalone/packages/ui/.next/static/chunks/67a1d37727697340.js +1 -0
  327. package/.next/standalone/packages/ui/.next/static/chunks/6f3c460ef90843d6.js +215 -0
  328. package/.next/standalone/packages/ui/.next/static/chunks/6ff7b0a8653036b2.js +1 -0
  329. package/.next/standalone/packages/ui/.next/static/chunks/72dde43947381f78.js +1 -0
  330. package/.next/standalone/packages/ui/.next/static/chunks/7590e65bcaa41e8b.js +1 -0
  331. package/.next/standalone/packages/ui/.next/static/chunks/762fe8c3999a1965.js +1 -0
  332. package/.next/standalone/packages/ui/.next/static/chunks/794f3931f1ca12d2.js +1 -0
  333. package/.next/standalone/packages/ui/.next/static/chunks/7b70989270600907.js +148 -0
  334. package/.next/standalone/packages/ui/.next/static/chunks/8287406f2fe1c1c3.js +1 -0
  335. package/.next/standalone/packages/ui/.next/static/chunks/839e44eec90aa73d.js +60 -0
  336. package/.next/standalone/packages/ui/.next/static/chunks/85b2b8ec762b7c79.js +62 -0
  337. package/.next/standalone/packages/ui/.next/static/chunks/89a8f922ce491ce9.js +93 -0
  338. package/.next/standalone/packages/ui/.next/static/chunks/8ff23db3e3143bc7.js +5 -0
  339. package/.next/standalone/packages/ui/.next/static/chunks/942cf63b4032c808.js +29 -0
  340. package/.next/standalone/packages/ui/.next/static/chunks/95bd0faa6092d8ba.js +1 -0
  341. package/.next/standalone/packages/ui/.next/static/chunks/97bd44afaee5f129.js +1 -0
  342. package/.next/standalone/packages/ui/.next/static/chunks/97c8160044aea609.js +77 -0
  343. package/.next/standalone/packages/ui/.next/static/chunks/9d06bd5d701ace73.js +1 -0
  344. package/.next/standalone/packages/ui/.next/static/chunks/a0b34f852bfa3d1b.js +36 -0
  345. package/.next/standalone/packages/ui/.next/static/chunks/a1ca5af350378f72.js +1 -0
  346. package/.next/standalone/packages/ui/.next/static/chunks/af643629ba393b18.js +15 -0
  347. package/.next/standalone/packages/ui/.next/static/chunks/b6976cf6c48996e5.js +1 -0
  348. package/.next/standalone/packages/ui/.next/static/chunks/b6ffd44cbe740f15.js +1 -0
  349. package/.next/standalone/packages/ui/.next/static/chunks/b8353eb8c6fb895e.js +1 -0
  350. package/.next/standalone/packages/ui/.next/static/chunks/b845813463167db0.js +5 -0
  351. package/.next/standalone/packages/ui/.next/static/chunks/b900efab2eee69a0.js +15 -0
  352. package/.next/standalone/packages/ui/.next/static/chunks/bd9893e28f8f6a9a.css +1 -0
  353. package/.next/standalone/packages/ui/.next/static/chunks/c762baa705e11b30.js +1 -0
  354. package/.next/standalone/packages/ui/.next/static/chunks/cbfb9d957f708c08.js +1 -0
  355. package/.next/standalone/packages/ui/.next/static/chunks/cca4441cde342ae3.js +1 -0
  356. package/.next/standalone/packages/ui/.next/static/chunks/cf53882a2c15630f.js +1 -0
  357. package/.next/standalone/packages/ui/.next/static/chunks/d43971093c91d3b2.js +160 -0
  358. package/.next/standalone/packages/ui/.next/static/chunks/d784d84d5b880e48.js +1 -0
  359. package/.next/standalone/packages/ui/.next/static/chunks/db44023a744297d1.js +1 -0
  360. package/.next/standalone/packages/ui/.next/static/chunks/dbe7840308be36b8.js +1 -0
  361. package/.next/standalone/packages/ui/.next/static/chunks/dc0a4df8f7080b29.js +1 -0
  362. package/.next/standalone/packages/ui/.next/static/chunks/dd8e053aa48c6398.js +1 -0
  363. package/.next/standalone/packages/ui/.next/static/chunks/ddc7726e19e5e25c.js +43 -0
  364. package/.next/standalone/packages/ui/.next/static/chunks/df7e61b074dee049.js +152 -0
  365. package/.next/standalone/packages/ui/.next/static/chunks/e20849e3abe63aa5.js +55 -0
  366. package/.next/standalone/packages/ui/.next/static/chunks/e2792c100b4041a1.js +15 -0
  367. package/.next/standalone/packages/ui/.next/static/chunks/e2dce648399ad4d4.js +1 -0
  368. package/.next/standalone/packages/ui/.next/static/chunks/e3bc96a996e2a314.js +24 -0
  369. package/.next/standalone/packages/ui/.next/static/chunks/e5aab2c562822175.js +1 -0
  370. package/.next/standalone/packages/ui/.next/static/chunks/efbbc4dc4b32a270.js +4 -0
  371. package/.next/standalone/packages/ui/.next/static/chunks/f0376ba3b56dbf10.js +4 -0
  372. package/.next/standalone/packages/ui/.next/static/chunks/f88536b96f1df686.js +1 -0
  373. package/.next/standalone/packages/ui/.next/static/chunks/turbopack-5fa55215af0efb15.js +3 -0
  374. package/.next/standalone/packages/ui/next.config.ts +5 -0
  375. package/.next/standalone/packages/ui/package.json +2 -1
  376. package/.next/standalone/packages/ui/scripts/post-build.mjs +15 -1
  377. package/.next/standalone/packages/ui/server.js +1 -1
  378. package/.next/standalone/packages/ui/src/app/globals.css +25 -0
  379. package/.next/standalone/packages/ui/src/app/specs/specs-client.tsx +180 -140
  380. package/.next/standalone/packages/ui/src/components/main-sidebar.tsx +3 -3
  381. package/.next/standalone/packages/ui/src/components/mermaid-diagram.test.ts +92 -0
  382. package/.next/standalone/packages/ui/src/components/mermaid-diagram.tsx +139 -0
  383. package/.next/standalone/packages/ui/src/components/spec-detail-client.tsx +47 -7
  384. package/.next/standalone/packages/ui/src/components/specs-nav-sidebar.tsx +3 -13
  385. package/.next/standalone/packages/ui/src/contexts/project-context.tsx +14 -14
  386. package/.next/standalone/packages/ui/tsconfig.tsbuildinfo +1 -1
  387. package/.next/static/chunks/038fb2d565c88582.js +2 -0
  388. package/.next/static/chunks/0f108f65249f8820.js +19 -0
  389. package/.next/static/chunks/1104de0c16e0b792.js +59 -0
  390. package/.next/static/chunks/1490995adc7829e2.js +136 -0
  391. package/.next/static/chunks/16b742746668b9d6.js +56 -0
  392. package/.next/static/chunks/16ff9833ae1bb3ae.js +1 -0
  393. package/.next/static/chunks/192b2f6118d057e2.js +60 -0
  394. package/.next/static/chunks/1a910f137d27fff0.js +63 -0
  395. package/.next/static/chunks/1f052e076ca9a3ff.js +1 -0
  396. package/.next/static/chunks/20f4141ccb5d4eb4.js +1 -0
  397. package/.next/static/chunks/2136b3131f74188f.js +1 -0
  398. package/.next/static/chunks/2204c0f16b23ec4c.js +3 -0
  399. package/.next/static/chunks/294dea6dbec43ca6.js +1 -0
  400. package/.next/static/chunks/2a33b9246ea4be03.js +2 -0
  401. package/.next/static/chunks/2c85b8059e42248a.js +1 -0
  402. package/.next/static/chunks/305b74f3c20cb4ef.js +1 -0
  403. package/.next/static/chunks/3276ca6fd9005903.js +13 -0
  404. package/.next/static/chunks/37f2e45cf97245d9.js +117 -0
  405. package/.next/static/chunks/39691fae9a3463fe.js +262 -0
  406. package/.next/static/chunks/3b6b058ebd14dbed.js +1 -0
  407. package/.next/static/chunks/3ed1465109fecc2d.js +1 -0
  408. package/.next/static/chunks/3f94c1ef6e27c8bd.js +1 -0
  409. package/.next/static/chunks/414a78f7b9b58d11.js +53 -0
  410. package/.next/static/chunks/4e85dea329906168.js +1 -0
  411. package/.next/static/chunks/525d6cb99a13c44a.js +215 -0
  412. package/.next/static/chunks/5295f0e82fd2a6d3.js +24 -0
  413. package/.next/static/chunks/567bc31005c31006.js +1 -0
  414. package/.next/static/chunks/56894ea818ee2a54.js +1 -0
  415. package/.next/static/chunks/569b4347ce55d973.js +1 -0
  416. package/.next/static/chunks/5fffdea0623d8a25.js +1 -0
  417. package/.next/static/chunks/642374ace530e2bd.js +1 -0
  418. package/.next/static/chunks/64543dbd7a7a99b7.js +1 -0
  419. package/.next/static/chunks/6483096c16d96f2c.js +15 -0
  420. package/.next/static/chunks/66d3fa1af3ff1fbf.js +1 -0
  421. package/.next/static/chunks/67a1d37727697340.js +1 -0
  422. package/.next/static/chunks/6f3c460ef90843d6.js +215 -0
  423. package/.next/static/chunks/6ff7b0a8653036b2.js +1 -0
  424. package/.next/static/chunks/72dde43947381f78.js +1 -0
  425. package/.next/static/chunks/7590e65bcaa41e8b.js +1 -0
  426. package/.next/static/chunks/762fe8c3999a1965.js +1 -0
  427. package/.next/static/chunks/794f3931f1ca12d2.js +1 -0
  428. package/.next/static/chunks/7b70989270600907.js +148 -0
  429. package/.next/static/chunks/8287406f2fe1c1c3.js +1 -0
  430. package/.next/static/chunks/839e44eec90aa73d.js +60 -0
  431. package/.next/static/chunks/85b2b8ec762b7c79.js +62 -0
  432. package/.next/static/chunks/89a8f922ce491ce9.js +93 -0
  433. package/.next/static/chunks/8ff23db3e3143bc7.js +5 -0
  434. package/.next/static/chunks/942cf63b4032c808.js +29 -0
  435. package/.next/static/chunks/95bd0faa6092d8ba.js +1 -0
  436. package/.next/static/chunks/97bd44afaee5f129.js +1 -0
  437. package/.next/static/chunks/97c8160044aea609.js +77 -0
  438. package/.next/static/chunks/9d06bd5d701ace73.js +1 -0
  439. package/.next/static/chunks/a0b34f852bfa3d1b.js +36 -0
  440. package/.next/static/chunks/a1ca5af350378f72.js +1 -0
  441. package/.next/static/chunks/af643629ba393b18.js +15 -0
  442. package/.next/static/chunks/b6976cf6c48996e5.js +1 -0
  443. package/.next/static/chunks/b6ffd44cbe740f15.js +1 -0
  444. package/.next/static/chunks/b8353eb8c6fb895e.js +1 -0
  445. package/.next/static/chunks/b845813463167db0.js +5 -0
  446. package/.next/static/chunks/b900efab2eee69a0.js +15 -0
  447. package/.next/static/chunks/bd9893e28f8f6a9a.css +1 -0
  448. package/.next/static/chunks/c762baa705e11b30.js +1 -0
  449. package/.next/static/chunks/cbfb9d957f708c08.js +1 -0
  450. package/.next/static/chunks/cca4441cde342ae3.js +1 -0
  451. package/.next/static/chunks/cf53882a2c15630f.js +1 -0
  452. package/.next/static/chunks/d43971093c91d3b2.js +160 -0
  453. package/.next/static/chunks/d784d84d5b880e48.js +1 -0
  454. package/.next/static/chunks/db44023a744297d1.js +1 -0
  455. package/.next/static/chunks/dbe7840308be36b8.js +1 -0
  456. package/.next/static/chunks/dc0a4df8f7080b29.js +1 -0
  457. package/.next/static/chunks/dd8e053aa48c6398.js +1 -0
  458. package/.next/static/chunks/ddc7726e19e5e25c.js +43 -0
  459. package/.next/static/chunks/df7e61b074dee049.js +152 -0
  460. package/.next/static/chunks/e20849e3abe63aa5.js +55 -0
  461. package/.next/static/chunks/e2792c100b4041a1.js +15 -0
  462. package/.next/static/chunks/e2dce648399ad4d4.js +1 -0
  463. package/.next/static/chunks/e3bc96a996e2a314.js +24 -0
  464. package/.next/static/chunks/e5aab2c562822175.js +1 -0
  465. package/.next/static/chunks/efbbc4dc4b32a270.js +4 -0
  466. package/.next/static/chunks/f0376ba3b56dbf10.js +4 -0
  467. package/.next/static/chunks/f88536b96f1df686.js +1 -0
  468. package/.next/static/chunks/turbopack-5fa55215af0efb15.js +3 -0
  469. package/package.json +3 -2
  470. package/.next/standalone/packages/ui/.next/server/chunks/ssr/[root-of-the-server]__c592f5d1._.js +0 -3
  471. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_6174313a._.js +0 -3
  472. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_6e4dd8b6._.js +0 -3
  473. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_7fa1d4b1._.js +0 -3
  474. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_e1889307._.js +0 -3
  475. package/.next/standalone/packages/ui/.next/server/chunks/ssr/_f1e82b43._.js +0 -3
  476. package/.next/standalone/packages/ui/.next/server/chunks/ssr/node_modules__pnpm_af9d3830._.js +0 -3
  477. package/.next/standalone/packages/ui/.next/static/chunks/07f48b316e895080.js +0 -1
  478. package/.next/standalone/packages/ui/.next/static/chunks/0a7be410b438418a.js +0 -1
  479. package/.next/standalone/packages/ui/.next/static/chunks/1089ca88f6bef846.js +0 -1
  480. package/.next/standalone/packages/ui/.next/static/chunks/17471c87082c392c.js +0 -5
  481. package/.next/standalone/packages/ui/.next/static/chunks/220ba5cb8fe4dd69.js +0 -1
  482. package/.next/standalone/packages/ui/.next/static/chunks/35ccd3286e538bd2.js +0 -1
  483. package/.next/standalone/packages/ui/.next/static/chunks/4a7396c9a77e64d5.js +0 -1
  484. package/.next/standalone/packages/ui/.next/static/chunks/50aead33b660f05c.js +0 -1
  485. package/.next/standalone/packages/ui/.next/static/chunks/571033caca823138.js +0 -1
  486. package/.next/standalone/packages/ui/.next/static/chunks/5a6fc30cd64085b4.css +0 -1
  487. package/.next/standalone/packages/ui/.next/static/chunks/5c2072ad938de8ed.js +0 -1
  488. package/.next/standalone/packages/ui/.next/static/chunks/7f732ea69e643219.js +0 -2
  489. package/.next/standalone/packages/ui/.next/static/chunks/843e1dfdc28e1385.js +0 -1
  490. package/.next/standalone/packages/ui/.next/static/chunks/9dad7fd31627df80.js +0 -1
  491. package/.next/standalone/packages/ui/.next/static/chunks/a02c1f50ff00204f.js +0 -1
  492. package/.next/standalone/packages/ui/.next/static/chunks/a055d4b2866ff8d4.js +0 -1
  493. package/.next/standalone/packages/ui/.next/static/chunks/afb7c5a4255f4081.js +0 -3
  494. package/.next/standalone/packages/ui/.next/static/chunks/b760a3a9c2c8be28.js +0 -1
  495. package/.next/standalone/packages/ui/.next/static/chunks/b9b9d7565bc2c2ad.js +0 -1
  496. package/.next/standalone/packages/ui/.next/static/chunks/db281fdc89c063c5.js +0 -1
  497. package/.next/standalone/packages/ui/.next/static/chunks/dcdd95180149fa10.js +0 -1
  498. package/.next/standalone/packages/ui/.next/static/chunks/ebd89051637b9a47.js +0 -4
  499. package/.next/standalone/packages/ui/.next/static/chunks/f3ec9fd77a8618b1.js +0 -19
  500. package/.next/standalone/packages/ui/.next/static/chunks/f9db24028d8c058e.js +0 -1
  501. package/.next/standalone/packages/ui/.next/static/chunks/fb640f50455ba34f.js +0 -1
  502. package/.next/standalone/packages/ui/.next/static/chunks/turbopack-b9690cacbf9fe48c.js +0 -3
  503. package/.next/standalone/packages/ui/dist/BUILD_ID +0 -1
  504. package/.next/standalone/packages/ui/dist/public/f864aa7e7061c0600e35cf3d879b27cf.txt +0 -1
  505. package/.next/standalone/packages/ui/dist/public/favicon.ico +0 -0
  506. package/.next/standalone/packages/ui/dist/public/file.svg +0 -1
  507. package/.next/standalone/packages/ui/dist/public/github-mark-white.svg +0 -1
  508. package/.next/standalone/packages/ui/dist/public/github-mark.svg +0 -1
  509. package/.next/standalone/packages/ui/dist/public/globe.svg +0 -1
  510. package/.next/standalone/packages/ui/dist/public/icon.svg +0 -7
  511. package/.next/standalone/packages/ui/dist/public/logo-dark-bg.svg +0 -17
  512. package/.next/standalone/packages/ui/dist/public/logo-with-bg.svg +0 -17
  513. package/.next/standalone/packages/ui/dist/public/logo.svg +0 -17
  514. package/.next/standalone/packages/ui/dist/public/next.svg +0 -1
  515. package/.next/standalone/packages/ui/dist/public/vercel.svg +0 -1
  516. package/.next/standalone/packages/ui/dist/public/window.svg +0 -1
  517. package/.next/standalone/packages/ui/dist/standalone/packages/web/README.md +0 -196
  518. package/.next/standalone/packages/ui/dist/standalone/packages/web/leanspec.db +0 -0
  519. package/.next/standalone/packages/ui/dist/standalone/packages/web/package.json +0 -75
  520. package/.next/standalone/packages/ui/dist/standalone/packages/web/server.js +0 -44
  521. package/.next/standalone/packages/ui/dist/standalone/specs/014-complete-custom-frontmatter/README.md +0 -175
  522. package/.next/standalone/packages/ui/dist/standalone/specs/016-github-action/README.md +0 -317
  523. package/.next/standalone/packages/ui/dist/standalone/specs/017-vscode-extension/README.md +0 -261
  524. package/.next/standalone/packages/ui/dist/standalone/specs/018-spec-validation/CLI-DESIGN.md +0 -380
  525. package/.next/standalone/packages/ui/dist/standalone/specs/018-spec-validation/CONFIGURATION-EXAMPLES.md +0 -230
  526. package/.next/standalone/packages/ui/dist/standalone/specs/018-spec-validation/CONFIGURATION.md +0 -285
  527. package/.next/standalone/packages/ui/dist/standalone/specs/018-spec-validation/IMPLEMENTATION.md +0 -358
  528. package/.next/standalone/packages/ui/dist/standalone/specs/018-spec-validation/README.md +0 -303
  529. package/.next/standalone/packages/ui/dist/standalone/specs/018-spec-validation/TESTING.md +0 -368
  530. package/.next/standalone/packages/ui/dist/standalone/specs/018-spec-validation/VALIDATION-RULES.md +0 -327
  531. package/.next/standalone/packages/ui/dist/standalone/specs/024-pattern-aware-list-grouping/README.md +0 -117
  532. package/.next/standalone/packages/ui/dist/standalone/specs/025-template-config-updates/README.md +0 -73
  533. package/.next/standalone/packages/ui/dist/standalone/specs/026-init-pattern-selection/README.md +0 -109
  534. package/.next/standalone/packages/ui/dist/standalone/specs/034-copilot-slash-commands/README.md +0 -107
  535. package/.next/standalone/packages/ui/dist/standalone/specs/035-live-specs-showcase/ARCHITECTURE.md +0 -244
  536. package/.next/standalone/packages/ui/dist/standalone/specs/035-live-specs-showcase/IMPLEMENTATION.md +0 -429
  537. package/.next/standalone/packages/ui/dist/standalone/specs/035-live-specs-showcase/README.md +0 -302
  538. package/.next/standalone/packages/ui/dist/standalone/specs/036-pm-integrations/README.md +0 -158
  539. package/.next/standalone/packages/ui/dist/standalone/specs/043-official-launch-02/DEMO-AI-ASSISTED.md +0 -359
  540. package/.next/standalone/packages/ui/dist/standalone/specs/043-official-launch-02/DEMO-FULL-LIFECYCLE.md +0 -86
  541. package/.next/standalone/packages/ui/dist/standalone/specs/043-official-launch-02/DEMO-REAL-FEATURE.md +0 -437
  542. package/.next/standalone/packages/ui/dist/standalone/specs/043-official-launch-02/DEMO-SCRIPT.md +0 -365
  543. package/.next/standalone/packages/ui/dist/standalone/specs/043-official-launch-02/DOGFOODING-FINAL.md +0 -203
  544. package/.next/standalone/packages/ui/dist/standalone/specs/043-official-launch-02/DOGFOODING-SESSION-2025-11-06.md +0 -174
  545. package/.next/standalone/packages/ui/dist/standalone/specs/043-official-launch-02/DOGFOODING-SUMMARY.md +0 -156
  546. package/.next/standalone/packages/ui/dist/standalone/specs/043-official-launch-02/IMPLEMENTATION.md +0 -183
  547. package/.next/standalone/packages/ui/dist/standalone/specs/043-official-launch-02/MARKETING.md +0 -229
  548. package/.next/standalone/packages/ui/dist/standalone/specs/043-official-launch-02/NEXT-STEPS-DEMO.md +0 -243
  549. package/.next/standalone/packages/ui/dist/standalone/specs/043-official-launch-02/README.md +0 -217
  550. package/.next/standalone/packages/ui/dist/standalone/specs/043-official-launch-02/SESSION-2025-11-06.md +0 -166
  551. package/.next/standalone/packages/ui/dist/standalone/specs/043-official-launch-02/TESTING.md +0 -126
  552. package/.next/standalone/packages/ui/dist/standalone/specs/045-unified-dashboard/ACTUAL-IMPLEMENTATION.md +0 -108
  553. package/.next/standalone/packages/ui/dist/standalone/specs/045-unified-dashboard/DESIGN.md +0 -382
  554. package/.next/standalone/packages/ui/dist/standalone/specs/045-unified-dashboard/IMPLEMENTATION.md +0 -144
  555. package/.next/standalone/packages/ui/dist/standalone/specs/045-unified-dashboard/RATIONALE.md +0 -146
  556. package/.next/standalone/packages/ui/dist/standalone/specs/045-unified-dashboard/README.md +0 -208
  557. package/.next/standalone/packages/ui/dist/standalone/specs/045-unified-dashboard/TESTING.md +0 -182
  558. package/.next/standalone/packages/ui/dist/standalone/specs/047-git-backfill-timestamps/README.md +0 -314
  559. package/.next/standalone/packages/ui/dist/standalone/specs/048-spec-complexity-analysis/FINDINGS.md +0 -113
  560. package/.next/standalone/packages/ui/dist/standalone/specs/048-spec-complexity-analysis/GUIDELINES.md +0 -237
  561. package/.next/standalone/packages/ui/dist/standalone/specs/048-spec-complexity-analysis/README.md +0 -149
  562. package/.next/standalone/packages/ui/dist/standalone/specs/049-leanspec-first-principles/ANALYSIS-COMPARISONS.md +0 -175
  563. package/.next/standalone/packages/ui/dist/standalone/specs/049-leanspec-first-principles/ANALYSIS-CONSTRAINTS.md +0 -254
  564. package/.next/standalone/packages/ui/dist/standalone/specs/049-leanspec-first-principles/FIRST-PRINCIPLES.md +0 -376
  565. package/.next/standalone/packages/ui/dist/standalone/specs/049-leanspec-first-principles/OPERATIONALIZATION-ROADMAP.md +0 -240
  566. package/.next/standalone/packages/ui/dist/standalone/specs/049-leanspec-first-principles/OPERATIONALIZATION-TOOLS.md +0 -175
  567. package/.next/standalone/packages/ui/dist/standalone/specs/049-leanspec-first-principles/README.md +0 -374
  568. package/.next/standalone/packages/ui/dist/standalone/specs/051-docs-system-prompt-principles/README.md +0 -339
  569. package/.next/standalone/packages/ui/dist/standalone/specs/052-branding-assets/README.md +0 -128
  570. package/.next/standalone/packages/ui/dist/standalone/specs/053-spec-assets-philosophy/README.md +0 -97
  571. package/.next/standalone/packages/ui/dist/standalone/specs/054-validate-output-lint-style/DESIGN-DECISIONS.md +0 -93
  572. package/.next/standalone/packages/ui/dist/standalone/specs/054-validate-output-lint-style/OUTPUT-FORMAT-SPEC.md +0 -146
  573. package/.next/standalone/packages/ui/dist/standalone/specs/054-validate-output-lint-style/README.md +0 -175
  574. package/.next/standalone/packages/ui/dist/standalone/specs/055-readme-redesign-ai-first/ANALYSIS-PART1.md +0 -397
  575. package/.next/standalone/packages/ui/dist/standalone/specs/055-readme-redesign-ai-first/ANALYSIS-PART2.md +0 -342
  576. package/.next/standalone/packages/ui/dist/standalone/specs/055-readme-redesign-ai-first/ANALYSIS.md +0 -44
  577. package/.next/standalone/packages/ui/dist/standalone/specs/055-readme-redesign-ai-first/CHANGES.md +0 -150
  578. package/.next/standalone/packages/ui/dist/standalone/specs/055-readme-redesign-ai-first/CONCERNS-ANALYSIS.md +0 -351
  579. package/.next/standalone/packages/ui/dist/standalone/specs/055-readme-redesign-ai-first/DOCS-ALIGNMENT-ANALYSIS.md +0 -238
  580. package/.next/standalone/packages/ui/dist/standalone/specs/055-readme-redesign-ai-first/README.md +0 -280
  581. package/.next/standalone/packages/ui/dist/standalone/specs/055-readme-redesign-ai-first/REDESIGN-DRAFT.md +0 -372
  582. package/.next/standalone/packages/ui/dist/standalone/specs/055-readme-redesign-ai-first/REDESIGN-REFINED.md +0 -466
  583. package/.next/standalone/packages/ui/dist/standalone/specs/056-docs-site-accuracy-audit/AUDIT-RESULTS.md +0 -178
  584. package/.next/standalone/packages/ui/dist/standalone/specs/056-docs-site-accuracy-audit/README.md +0 -174
  585. package/.next/standalone/packages/ui/dist/standalone/specs/057-docs-validation-comprehensive/README.md +0 -295
  586. package/.next/standalone/packages/ui/dist/standalone/specs/057-docs-validation-comprehensive/VALIDATION-RESULTS.md +0 -487
  587. package/.next/standalone/packages/ui/dist/standalone/specs/058-docs-overview-polish/ANALYSIS.md +0 -241
  588. package/.next/standalone/packages/ui/dist/standalone/specs/058-docs-overview-polish/DESIGN.md +0 -279
  589. package/.next/standalone/packages/ui/dist/standalone/specs/058-docs-overview-polish/IMPLEMENTATION.md +0 -642
  590. package/.next/standalone/packages/ui/dist/standalone/specs/058-docs-overview-polish/NOTES.md +0 -125
  591. package/.next/standalone/packages/ui/dist/standalone/specs/058-docs-overview-polish/README.md +0 -286
  592. package/.next/standalone/packages/ui/dist/standalone/specs/059-programmatic-spec-management/ARCHITECTURE.md +0 -392
  593. package/.next/standalone/packages/ui/dist/standalone/specs/059-programmatic-spec-management/COMMANDS.md +0 -1002
  594. package/.next/standalone/packages/ui/dist/standalone/specs/059-programmatic-spec-management/CONTEXT-ENGINEERING.md +0 -411
  595. package/.next/standalone/packages/ui/dist/standalone/specs/059-programmatic-spec-management/IMPLEMENTATION.md +0 -812
  596. package/.next/standalone/packages/ui/dist/standalone/specs/059-programmatic-spec-management/README.md +0 -504
  597. package/.next/standalone/packages/ui/dist/standalone/specs/059-programmatic-spec-management/TESTING.md +0 -724
  598. package/.next/standalone/packages/ui/dist/standalone/specs/060-core-concepts-coherence/README.md +0 -125
  599. package/.next/standalone/packages/ui/dist/standalone/specs/061-ai-assisted-spec-writing/README.md +0 -299
  600. package/.next/standalone/packages/ui/dist/standalone/specs/062-docs-info-architecture-v2/IMPLEMENTATION-PLAN.md +0 -174
  601. package/.next/standalone/packages/ui/dist/standalone/specs/062-docs-info-architecture-v2/PAGE-SPECIFICATIONS.md +0 -265
  602. package/.next/standalone/packages/ui/dist/standalone/specs/062-docs-info-architecture-v2/PROBLEM-ANALYSIS.md +0 -36
  603. package/.next/standalone/packages/ui/dist/standalone/specs/062-docs-info-architecture-v2/README.md +0 -243
  604. package/.next/standalone/packages/ui/dist/standalone/specs/062-docs-info-architecture-v2/SOLUTION-DESIGN.md +0 -82
  605. package/.next/standalone/packages/ui/dist/standalone/specs/063-migration-from-existing-tools/DESIGN.md +0 -338
  606. package/.next/standalone/packages/ui/dist/standalone/specs/063-migration-from-existing-tools/EXAMPLES.md +0 -354
  607. package/.next/standalone/packages/ui/dist/standalone/specs/063-migration-from-existing-tools/IMPLEMENTATION.md +0 -189
  608. package/.next/standalone/packages/ui/dist/standalone/specs/063-migration-from-existing-tools/README.md +0 -119
  609. package/.next/standalone/packages/ui/dist/standalone/specs/064-docs-site-zh-translation/README.md +0 -170
  610. package/.next/standalone/packages/ui/dist/standalone/specs/065-v03-planning/README.md +0 -158
  611. package/.next/standalone/packages/ui/dist/standalone/specs/066-context-economy-thresholds-refinement/README.md +0 -842
  612. package/.next/standalone/packages/ui/dist/standalone/specs/067-monorepo-core-extraction/README.md +0 -358
  613. package/.next/standalone/packages/ui/dist/standalone/specs/068-live-specs-ux-enhancements/DESIGN.md +0 -444
  614. package/.next/standalone/packages/ui/dist/standalone/specs/068-live-specs-ux-enhancements/README.md +0 -357
  615. package/.next/standalone/packages/ui/dist/standalone/specs/069-token-counting-utils/README.md +0 -551
  616. package/.next/standalone/packages/ui/dist/standalone/specs/070-mcp-token-counting-tool/README.md +0 -372
  617. package/.next/standalone/packages/ui/dist/standalone/specs/071-simplified-token-validation/README.md +0 -489
  618. package/.next/standalone/packages/ui/dist/standalone/specs/072-ai-agent-first-use-workflow/README.md +0 -285
  619. package/.next/standalone/packages/ui/dist/standalone/specs/073-template-engine-agents-md/README.md +0 -323
  620. package/.next/standalone/packages/ui/dist/standalone/specs/074-content-at-creation/README.md +0 -136
  621. package/.next/standalone/packages/ui/dist/standalone/specs/075-intelligent-search-engine/README.md +0 -399
  622. package/.next/standalone/packages/ui/dist/standalone/specs/076-programmatic-spec-relationships/README.md +0 -301
  623. package/.next/standalone/packages/ui/dist/standalone/specs/077-archiving-strategy/README.md +0 -235
  624. package/.next/standalone/packages/ui/dist/standalone/specs/078-sub-spec-template-system/README.md +0 -303
  625. package/.next/standalone/packages/ui/dist/standalone/specs/079-cli-alphabetical-organization/README.md +0 -196
  626. package/.next/standalone/packages/ui/dist/standalone/specs/080-mcp-server-modular-architecture/README.md +0 -388
  627. package/.next/standalone/packages/ui/dist/standalone/specs/081-web-app-ux-redesign/README.md +0 -824
  628. package/.next/standalone/packages/ui/dist/standalone/specs/082-web-realtime-sync-architecture/DATABASE.md +0 -111
  629. package/.next/standalone/packages/ui/dist/standalone/specs/082-web-realtime-sync-architecture/DEPLOYMENT.md +0 -69
  630. package/.next/standalone/packages/ui/dist/standalone/specs/082-web-realtime-sync-architecture/FILESYSTEM.md +0 -77
  631. package/.next/standalone/packages/ui/dist/standalone/specs/082-web-realtime-sync-architecture/IMPLEMENTATION.md +0 -184
  632. package/.next/standalone/packages/ui/dist/standalone/specs/082-web-realtime-sync-architecture/README.md +0 -496
  633. package/.next/standalone/packages/ui/dist/standalone/specs/083-web-navigation-performance/README.md +0 -490
  634. package/.next/standalone/packages/ui/dist/standalone/specs/084-sub-spec-visibility-in-tools/README.md +0 -389
  635. package/.next/standalone/packages/ui/dist/standalone/specs/085-cli-relationship-commands/README.md +0 -920
  636. package/.next/standalone/packages/ui/dist/standalone/specs/086-template-component-deduplication/README.md +0 -146
  637. package/.next/standalone/packages/ui/dist/standalone/specs/087-cli-ui-command/README.md +0 -607
  638. package/.next/standalone/packages/ui/dist/standalone/specs/088-core-concepts-terminology-only/README.md +0 -104
  639. package/.next/standalone/packages/ui/dist/standalone/specs/089-sdd-practical-tutorials/README.md +0 -124
  640. package/.next/standalone/packages/ui/dist/standalone/specs/090-leanspec-sdd-case-studies/README.md +0 -129
  641. package/.next/standalone/packages/ui/dist/standalone/specs/091-chinese-localization-strategy/README.md +0 -244
  642. package/.next/standalone/packages/ui/dist/standalone/specs/092-docs-site-submodule-migration/README.md +0 -148
  643. package/.next/standalone/packages/ui/dist/standalone/specs/093-spec-detail-ui-improvements/README.md +0 -54
  644. package/.next/standalone/packages/ui/dist/standalone/specs/archived/001-typescript-cli-migration/README.md +0 -37
  645. package/.next/standalone/packages/ui/dist/standalone/specs/archived/002-template-system-redesign/README.md +0 -60
  646. package/.next/standalone/packages/ui/dist/standalone/specs/archived/003-init-system-redesign/README.md +0 -113
  647. package/.next/standalone/packages/ui/dist/standalone/specs/archived/004-existing-project-integration/README.md +0 -69
  648. package/.next/standalone/packages/ui/dist/standalone/specs/archived/004-existing-project-integration/SUMMARY.md +0 -112
  649. package/.next/standalone/packages/ui/dist/standalone/specs/archived/005-structured-frontmatter/README.md +0 -229
  650. package/.next/standalone/packages/ui/dist/standalone/specs/archived/006-pm-visualization-tools/README.md +0 -406
  651. package/.next/standalone/packages/ui/dist/standalone/specs/archived/007-system-prompt-updates/README.md +0 -168
  652. package/.next/standalone/packages/ui/dist/standalone/specs/archived/008-commander-migration/README.md +0 -174
  653. package/.next/standalone/packages/ui/dist/standalone/specs/archived/009-cli-ux-enhancement/README.md +0 -212
  654. package/.next/standalone/packages/ui/dist/standalone/specs/archived/010-commands-refactor/README.md +0 -249
  655. package/.next/standalone/packages/ui/dist/standalone/specs/archived/011-test-results/README.md +0 -60
  656. package/.next/standalone/packages/ui/dist/standalone/specs/archived/011-test-results/TEST_SUMMARY.md +0 -139
  657. package/.next/standalone/packages/ui/dist/standalone/specs/archived/012-sub-spec-files/README.md +0 -722
  658. package/.next/standalone/packages/ui/dist/standalone/specs/archived/013-custom-spec-templates/README.md +0 -413
  659. package/.next/standalone/packages/ui/dist/standalone/specs/archived/015-npm-publishing/README.md +0 -255
  660. package/.next/standalone/packages/ui/dist/standalone/specs/archived/019-readme-improvement/README.md +0 -252
  661. package/.next/standalone/packages/ui/dist/standalone/specs/archived/020-documentation-website/README.md +0 -253
  662. package/.next/standalone/packages/ui/dist/standalone/specs/archived/021-docusaurus-vercel-migration/README.md +0 -612
  663. package/.next/standalone/packages/ui/dist/standalone/specs/archived/022-flexible-folder-structure/README.md +0 -794
  664. package/.next/standalone/packages/ui/dist/standalone/specs/archived/023-folder-structure-improvements/DESIGN.md +0 -834
  665. package/.next/standalone/packages/ui/dist/standalone/specs/archived/023-folder-structure-improvements/README.md +0 -255
  666. package/.next/standalone/packages/ui/dist/standalone/specs/archived/027-cli-ui-ux-optimization/README.md +0 -454
  667. package/.next/standalone/packages/ui/dist/standalone/specs/archived/028-cli-ui-modernization/README.md +0 -172
  668. package/.next/standalone/packages/ui/dist/standalone/specs/archived/029-visualization-improvements/IMPLEMENTATION.md +0 -152
  669. package/.next/standalone/packages/ui/dist/standalone/specs/archived/029-visualization-improvements/README.md +0 -95
  670. package/.next/standalone/packages/ui/dist/standalone/specs/archived/030-created-date-format-bug/README.md +0 -87
  671. package/.next/standalone/packages/ui/dist/standalone/specs/archived/031-gantt-ux-improvements/README.md +0 -230
  672. package/.next/standalone/packages/ui/dist/standalone/specs/archived/032-console-log-chalk-security/README.md +0 -89
  673. package/.next/standalone/packages/ui/dist/standalone/specs/archived/033-mcp-server/README.md +0 -89
  674. package/.next/standalone/packages/ui/dist/standalone/specs/archived/037-docs-overhaul/README.md +0 -166
  675. package/.next/standalone/packages/ui/dist/standalone/specs/archived/038-flat-structure-migration/README.md +0 -276
  676. package/.next/standalone/packages/ui/dist/standalone/specs/archived/038-mcp-frontmatter-bug-fix/README.md +0 -122
  677. package/.next/standalone/packages/ui/dist/standalone/specs/archived/039-simplify-viewer-commands/README.md +0 -198
  678. package/.next/standalone/packages/ui/dist/standalone/specs/archived/039-template-variable-sync/README.md +0 -192
  679. package/.next/standalone/packages/ui/dist/standalone/specs/archived/040-spec-viewer-commands/README.md +0 -171
  680. package/.next/standalone/packages/ui/dist/standalone/specs/archived/042-mcp-error-handling/README.md +0 -200
  681. package/.next/standalone/packages/ui/dist/standalone/specs/archived/044-spec-relationships-clarity/README.md +0 -317
  682. package/.next/standalone/packages/ui/dist/standalone/specs/archived/046-stats-dashboard-refactor/DESIGN.md +0 -276
  683. package/.next/standalone/packages/ui/dist/standalone/specs/archived/046-stats-dashboard-refactor/IMPLEMENTATION.md +0 -241
  684. package/.next/standalone/packages/ui/dist/standalone/specs/archived/046-stats-dashboard-refactor/README.md +0 -139
  685. package/.next/standalone/packages/ui/dist/standalone/specs/archived/046-stats-dashboard-refactor/TESTING.md +0 -328
  686. package/.next/standalone/packages/ui/dist/standalone/specs/archived/050-tool-redesign-first-principles/README.md +0 -400
  687. package/.next/standalone/packages/ui/dist/static/chunks/0c19c69aa7625475.js +0 -1
  688. package/.next/standalone/packages/ui/dist/static/chunks/116800b03245a1e5.js +0 -1
  689. package/.next/standalone/packages/ui/dist/static/chunks/15843a3d7584e314.js +0 -1
  690. package/.next/standalone/packages/ui/dist/static/chunks/19e80edf527aef5c.js +0 -1
  691. package/.next/standalone/packages/ui/dist/static/chunks/465954d5af3284a9.js +0 -1
  692. package/.next/standalone/packages/ui/dist/static/chunks/5abeeb89f1412a80.js +0 -3
  693. package/.next/standalone/packages/ui/dist/static/chunks/5c2072ad938de8ed.js +0 -1
  694. package/.next/standalone/packages/ui/dist/static/chunks/6a05a93ec8fa7b83.js +0 -1
  695. package/.next/standalone/packages/ui/dist/static/chunks/778e42188e450b39.css +0 -1
  696. package/.next/standalone/packages/ui/dist/static/chunks/a02c1f50ff00204f.js +0 -1
  697. package/.next/standalone/packages/ui/dist/static/chunks/a45464b9776dd88e.js +0 -1
  698. package/.next/standalone/packages/ui/dist/static/chunks/a6dad97d9634a72d.js +0 -1
  699. package/.next/standalone/packages/ui/dist/static/chunks/b0ea0ac61604f843.js +0 -1
  700. package/.next/standalone/packages/ui/dist/static/chunks/c06e85b449720194.js +0 -1
  701. package/.next/standalone/packages/ui/dist/static/chunks/c557ac675be79771.js +0 -1
  702. package/.next/standalone/packages/ui/dist/static/chunks/cad005a57ffbb2d3.js +0 -1
  703. package/.next/standalone/packages/ui/dist/static/chunks/cdf6fe33bc65efbc.js +0 -1
  704. package/.next/standalone/packages/ui/dist/static/chunks/d12ed5dbe44caed7.js +0 -1
  705. package/.next/standalone/packages/ui/dist/static/chunks/d1ebe5c1a344f4ca.js +0 -5
  706. package/.next/standalone/packages/ui/dist/static/chunks/d42cf1682bc46652.js +0 -1
  707. package/.next/standalone/packages/ui/dist/static/chunks/dde5d8bddd7fbfcf.js +0 -1
  708. package/.next/standalone/packages/ui/dist/static/chunks/ebd89051637b9a47.js +0 -4
  709. package/.next/standalone/packages/ui/dist/static/chunks/ec82875d18b29f47.js +0 -2
  710. package/.next/standalone/packages/ui/dist/static/chunks/f0b701df9769bcc5.js +0 -19
  711. package/.next/standalone/packages/ui/dist/static/chunks/turbopack-1c09a99f4c9e28d3.js +0 -3
  712. package/.next/standalone/packages/ui/leanspec.db +0 -0
  713. package/.next/static/T_KGFP0pHt_xSaaYUJa3L/_buildManifest.js +0 -11
  714. package/.next/static/T_KGFP0pHt_xSaaYUJa3L/_clientMiddlewareManifest.json +0 -1
  715. package/.next/static/T_KGFP0pHt_xSaaYUJa3L/_ssgManifest.js +0 -1
  716. package/.next/static/chunks/07f48b316e895080.js +0 -1
  717. package/.next/static/chunks/0a7be410b438418a.js +0 -1
  718. package/.next/static/chunks/1089ca88f6bef846.js +0 -1
  719. package/.next/static/chunks/17471c87082c392c.js +0 -5
  720. package/.next/static/chunks/220ba5cb8fe4dd69.js +0 -1
  721. package/.next/static/chunks/35ccd3286e538bd2.js +0 -1
  722. package/.next/static/chunks/4a7396c9a77e64d5.js +0 -1
  723. package/.next/static/chunks/50aead33b660f05c.js +0 -1
  724. package/.next/static/chunks/571033caca823138.js +0 -1
  725. package/.next/static/chunks/5a6fc30cd64085b4.css +0 -1
  726. package/.next/static/chunks/5c2072ad938de8ed.js +0 -1
  727. package/.next/static/chunks/7f732ea69e643219.js +0 -2
  728. package/.next/static/chunks/843e1dfdc28e1385.js +0 -1
  729. package/.next/static/chunks/9dad7fd31627df80.js +0 -1
  730. package/.next/static/chunks/a02c1f50ff00204f.js +0 -1
  731. package/.next/static/chunks/a055d4b2866ff8d4.js +0 -1
  732. package/.next/static/chunks/afb7c5a4255f4081.js +0 -3
  733. package/.next/static/chunks/b760a3a9c2c8be28.js +0 -1
  734. package/.next/static/chunks/b9b9d7565bc2c2ad.js +0 -1
  735. package/.next/static/chunks/db281fdc89c063c5.js +0 -1
  736. package/.next/static/chunks/dcdd95180149fa10.js +0 -1
  737. package/.next/static/chunks/ebd89051637b9a47.js +0 -4
  738. package/.next/static/chunks/f3ec9fd77a8618b1.js +0 -19
  739. package/.next/static/chunks/f9db24028d8c058e.js +0 -1
  740. package/.next/static/chunks/fb640f50455ba34f.js +0 -1
  741. package/.next/static/chunks/turbopack-b9690cacbf9fe48c.js +0 -3
  742. /package/.next/standalone/packages/ui/.next/static/{T_KGFP0pHt_xSaaYUJa3L → gmEkSwWc7AIWzMK9b0WXr}/_buildManifest.js +0 -0
  743. /package/.next/standalone/packages/ui/.next/static/{T_KGFP0pHt_xSaaYUJa3L → gmEkSwWc7AIWzMK9b0WXr}/_clientMiddlewareManifest.json +0 -0
  744. /package/.next/standalone/packages/ui/.next/static/{T_KGFP0pHt_xSaaYUJa3L → gmEkSwWc7AIWzMK9b0WXr}/_ssgManifest.js +0 -0
  745. /package/.next/{standalone/packages/ui/dist/static/4ZnYN1WbN4LGJQOwP6FkT → static/gmEkSwWc7AIWzMK9b0WXr}/_buildManifest.js +0 -0
  746. /package/.next/{standalone/packages/ui/dist/static/4ZnYN1WbN4LGJQOwP6FkT → static/gmEkSwWc7AIWzMK9b0WXr}/_clientMiddlewareManifest.json +0 -0
  747. /package/.next/{standalone/packages/ui/dist/static/4ZnYN1WbN4LGJQOwP6FkT → static/gmEkSwWc7AIWzMK9b0WXr}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[92942,s=>{"use strict";s.s([])}];
1
+ module.exports=[192942,s=>{"use strict";s.s([])}];
2
2
 
3
3
  //# sourceMappingURL=packages_ui__next-internal_server_app_api_local-projects_route_actions_9142d5ad.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[19665,s=>{"use strict";s.s([])}];
1
+ module.exports=[219665,s=>{"use strict";s.s([])}];
2
2
 
3
3
  //# sourceMappingURL=packages_ui__next-internal_server_app_api_projects_route_actions_73e4c2a1.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[13911,s=>{"use strict";s.s([])}];
1
+ module.exports=[113911,s=>{"use strict";s.s([])}];
2
2
 
3
3
  //# sourceMappingURL=packages_ui__next-internal_server_app_api_revalidate_route_actions_a8bf21b5.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[77571,s=>{"use strict";s.s([])}];
1
+ module.exports=[777571,s=>{"use strict";s.s([])}];
2
2
 
3
3
  //# sourceMappingURL=packages_ui__next-internal_server_app_api_specs_%5Bid%5D_route_actions_0793bd75.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[39081,s=>{"use strict";s.s([])}];
1
+ module.exports=[739081,s=>{"use strict";s.s([])}];
2
2
 
3
3
  //# sourceMappingURL=packages_ui__next-internal_server_app_api_stats_route_actions_8e042245.js.map
@@ -1,16 +1,16 @@
1
- module.exports=[5271,22124,79174,31585,e=>{"use strict";let t,i;var s,r=e.i(25372);let n=Symbol.for("drizzle:entityKind");function a(e,t){if(!e||"object"!=typeof e)return!1;if(e instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,n))throw Error(`Class "${t.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let i=Object.getPrototypeOf(e).constructor;if(i)for(;i;){if(n in i&&i[n]===t[n])return!0;i=Object.getPrototypeOf(i)}return!1}Symbol.for("drizzle:hasOwnEntityKind");class l{static [n]="ConsoleLogWriter";write(e){console.log(e)}}class o{static [n]="DefaultLogger";writer;constructor(e){this.writer=e?.writer??new l}logQuery(e,t){let i=t.map(e=>{try{return JSON.stringify(e)}catch{return String(e)}}),s=i.length?` -- params: [${i.join(", ")}]`:"";this.writer.write(`Query: ${e}${s}`)}}class u{static [n]="NoopLogger";logQuery(){}}let c=Symbol.for("drizzle:Name"),h=Symbol.for("drizzle:Schema"),d=Symbol.for("drizzle:Columns"),m=Symbol.for("drizzle:ExtraConfigColumns"),f=Symbol.for("drizzle:OriginalName"),p=Symbol.for("drizzle:BaseName"),g=Symbol.for("drizzle:IsAlias"),y=Symbol.for("drizzle:ExtraConfigBuilder"),b=Symbol.for("drizzle:IsDrizzleTable");class S{static [n]="Table";static Symbol={Name:c,Schema:h,OriginalName:f,Columns:d,ExtraConfigColumns:m,BaseName:p,IsAlias:g,ExtraConfigBuilder:y};[c];[f];[h];[d];[m];[p];[g]=!1;[b]=!0;[y]=void 0;constructor(e,t,i){this[c]=this[f]=e,this[h]=t,this[p]=i}}function w(e){return`${e[h]??"public"}.${e[c]}`}class T{constructor(e,t){this.table=e,this.config=t,this.name=t.name,this.keyAsName=t.keyAsName,this.notNull=t.notNull,this.default=t.default,this.defaultFn=t.defaultFn,this.onUpdateFn=t.onUpdateFn,this.hasDefault=t.hasDefault,this.primary=t.primaryKey,this.isUnique=t.isUnique,this.uniqueName=t.uniqueName,this.uniqueType=t.uniqueType,this.dataType=t.dataType,this.columnType=t.columnType,this.generated=t.generated,this.generatedIdentity=t.generatedIdentity}static [n]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(e){return e}mapToDriverValue(e){return e}shouldDisableInsert(){return void 0!==this.config.generated&&"byDefault"!==this.config.generated.type}}class N{static [n]="ColumnBuilder";config;constructor(e,t,i){this.config={name:e,keyAsName:""===e,notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:t,columnType:i,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(e){""===this.config.name&&(this.config.name=e)}}class v{static [n]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor(e,t){this.reference=()=>{let{name:t,columns:i,foreignColumns:s}=e();return{name:t,columns:i,foreignTable:s[0].table,foreignColumns:s}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=void 0===e?"no action":e,this}onDelete(e){return this._onDelete=void 0===e?"no action":e,this}build(e){return new L(e,this)}}class L{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static [n]="PgForeignKey";reference;onUpdate;onDelete;getName(){let{name:e,columns:t,foreignColumns:i}=this.reference(),s=t.map(e=>e.name),r=i.map(e=>e.name),n=[this.table[c],...s,i[0].table[c],...r];return e??`${n.join("_")}_fk`}}function x(e,...t){return e(...t)}function $(e,t){return`${e[c]}_${t.join("_")}_unique`}class Q{constructor(e,t){this.name=t,this.columns=e}static [n]="PgUniqueConstraintBuilder";columns;nullsNotDistinctConfig=!1;nullsNotDistinct(){return this.nullsNotDistinctConfig=!0,this}build(e){return new C(e,this.columns,this.nullsNotDistinctConfig,this.name)}}class P{static [n]="PgUniqueOnConstraintBuilder";name;constructor(e){this.name=e}on(...e){return new Q(e,this.name)}}class C{constructor(e,t,i,s){this.table=e,this.columns=t,this.name=s??$(this.table,this.columns.map(e=>e.name)),this.nullsNotDistinct=i}static [n]="PgUniqueConstraint";columns;name;nullsNotDistinct=!1;getName(){return this.name}}function E(e,t,i){for(let s=t;s<e.length;s++){let r=e[s];if("\\"===r){s++;continue}if('"'===r)return[e.slice(t,s).replace(/\\/g,""),s+1];if(!i&&(","===r||"}"===r))return[e.slice(t,s).replace(/\\/g,""),s]}return[e.slice(t).replace(/\\/g,""),e.length]}class B extends N{foreignKeyConfigs=[];static [n]="PgColumnBuilder";array(e){return new O(this.config.name,this,e)}references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e,t){return this.config.isUnique=!0,this.config.uniqueName=e,this.config.uniqueType=t?.nulls,this}generatedAlwaysAs(e){return this.config.generated={as:e,type:"always",mode:"stored"},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:i,actions:s})=>x((i,s)=>{let r=new v(()=>({columns:[e],foreignColumns:[i()]}));return s.onUpdate&&r.onUpdate(s.onUpdate),s.onDelete&&r.onDelete(s.onDelete),r.build(t)},i,s))}buildExtraConfigColumn(e){return new q(e,this.config)}}class _ extends T{constructor(e,t){t.uniqueName||(t.uniqueName=$(e,[t.name])),super(e,t),this.table=e}static [n]="PgColumn"}class q extends _{static [n]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(e){return this.indexConfig.opClass=e,this}}class D{static [n]="IndexedColumn";constructor(e,t,i,s){this.name=e,this.keyAsName=t,this.type=i,this.indexConfig=s}name;keyAsName;type;indexConfig}class O extends B{static [n]="PgArrayBuilder";constructor(e,t,i){super(e,"array","PgArray"),this.config.baseBuilder=t,this.config.size=i}build(e){let t=this.config.baseBuilder.build(e);return new A(e,this.config,t)}}class A extends _{constructor(e,t,i,s){super(e,t),this.baseColumn=i,this.range=s,this.size=t.size}size;static [n]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${"number"==typeof this.size?this.size:""}]`}mapFromDriverValue(e){return"string"==typeof e&&(e=function(e){let[t]=function e(t,i=0){let s=[],r=i,n=!1;for(;r<t.length;){let a=t[r];if(","===a){(n||r===i)&&s.push(""),n=!0,r++;continue}if(n=!1,"\\"===a){r+=2;continue}if('"'===a){let[e,i]=E(t,r+1,!0);s.push(e),r=i;continue}if("}"===a)return[s,r+1];if("{"===a){let[i,n]=e(t,r+1);s.push(i),r=n;continue}let[l,o]=E(t,r,!1);s.push(l),r=o}return[s,r]}(e,1);return t}(e)),e.map(e=>this.baseColumn.mapFromDriverValue(e))}mapToDriverValue(e,t=!1){let i=e.map(e=>null===e?null:a(this.baseColumn,A)?this.baseColumn.mapToDriverValue(e,!0):this.baseColumn.mapToDriverValue(e));return t?i:function e(t){return`{${t.map(t=>Array.isArray(t)?e(t):"string"==typeof t?`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:`${t}`).join(",")}}`}(i)}}let F=Symbol.for("drizzle:isPgEnum");class j extends B{static [n]="PgEnumColumnBuilder";constructor(e,t){super(e,"string","PgEnumColumn"),this.config.enum=t}build(e){return new I(e,this.config)}}class I extends _{static [n]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor(e,t){super(e,t),this.enum=t.enum}getSQLType(){return this.enum.enumName}}class R{static [n]="Subquery";constructor(e,t,i,s=!1){this._={brand:"Subquery",sql:e,selectedFields:t,alias:i,isWith:s}}}class V extends R{static [n]="WithSubquery"}let U=(e,s)=>t?(i||(i=t.trace.getTracer("drizzle-orm","0.38.4")),x((t,i)=>i.startActiveSpan(e,e=>{try{return s(e)}catch(i){throw e.setStatus({code:t.SpanStatusCode.ERROR,message:i instanceof Error?i.message:"Unknown error"}),i}finally{e.end()}}),t,i)):s(),z=Symbol.for("drizzle:ViewBaseConfig");class M{static [n]="FakePrimitiveParam"}function K(e){return null!=e&&"function"==typeof e.getSQL}class k{static [n]="StringChunk";value;constructor(e){this.value=Array.isArray(e)?e:[e]}getSQL(){return new J([this])}}class J{constructor(e){this.queryChunks=e}static [n]="SQL";decoder=G;shouldInlineParams=!1;append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return U("drizzle.buildSQL",t=>{let i=this.buildQueryFromSourceParams(this.queryChunks,e);return t?.setAttributes({"drizzle.query.text":i.sql,"drizzle.query.params":JSON.stringify(i.params)}),i})}buildQueryFromSourceParams(e,t){let i=Object.assign({},t,{inlineParams:t.inlineParams||this.shouldInlineParams,paramStartIndex:t.paramStartIndex||{value:0}}),{casing:s,escapeName:r,escapeParam:n,prepareTyping:l,inlineParams:o,paramStartIndex:u}=i;var c=e.map(e=>{if(a(e,k))return{sql:e.value.join(""),params:[]};if(a(e,X))return{sql:r(e.value),params:[]};if(void 0===e)return{sql:"",params:[]};if(Array.isArray(e)){let t=[new k("(")];for(let[i,s]of e.entries())t.push(s),i<e.length-1&&t.push(new k(", "));return t.push(new k(")")),this.buildQueryFromSourceParams(t,i)}if(a(e,J))return this.buildQueryFromSourceParams(e.queryChunks,{...i,inlineParams:o||e.shouldInlineParams});if(a(e,S)){let t=e[S.Symbol.Schema],i=e[S.Symbol.Name];return{sql:void 0===t?r(i):r(t)+"."+r(i),params:[]}}if(a(e,T)){let i=s.getColumnCasing(e);if("indexes"===t.invokeSource)return{sql:r(i),params:[]};let n=e.table[S.Symbol.Schema];return{sql:e.table[g]||void 0===n?r(e.table[S.Symbol.Name])+"."+r(i):r(n)+"."+r(e.table[S.Symbol.Name])+"."+r(i),params:[]}}if(a(e,er)){let t=e[z].schema,i=e[z].name;return{sql:void 0===t?r(i):r(t)+"."+r(i),params:[]}}if(a(e,Y)){if(a(e.value,et))return{sql:n(u.value++,e),params:[e],typings:["none"]};let t=null===e.value?null:e.encoder.mapToDriverValue(e.value);if(a(t,J))return this.buildQueryFromSourceParams([t],i);if(o)return{sql:this.mapInlineParam(t,i),params:[]};let s=["none"];return l&&(s=[l(e.encoder)]),{sql:n(u.value++,t),params:[t],typings:s}}return a(e,et)?{sql:n(u.value++,e),params:[e],typings:["none"]}:a(e,J.Aliased)&&void 0!==e.fieldAlias?{sql:r(e.fieldAlias),params:[]}:a(e,R)?e._.isWith?{sql:r(e._.alias),params:[]}:this.buildQueryFromSourceParams([new k("("),e._.sql,new k(") "),new X(e._.alias)],i):e&&"function"==typeof e&&F in e&&!0===e[F]?e.schema?{sql:r(e.schema)+"."+r(e.enumName),params:[]}:{sql:r(e.enumName),params:[]}:K(e)?e.shouldOmitSQLParens?.()?this.buildQueryFromSourceParams([e.getSQL()],i):this.buildQueryFromSourceParams([new k("("),e.getSQL(),new k(")")],i):o?{sql:this.mapInlineParam(e,i),params:[]}:{sql:n(u.value++,e),params:[e],typings:["none"]}});let h={sql:"",params:[]};for(let e of c)h.sql+=e.sql,h.params.push(...e.params),e.typings?.length&&(h.typings||(h.typings=[]),h.typings.push(...e.typings));return h}mapInlineParam(e,{escapeString:t}){if(null===e)return"null";if("number"==typeof e||"boolean"==typeof e)return e.toString();if("string"==typeof e)return t(e);if("object"==typeof e){let i=e.toString();return"[object Object]"===i?t(JSON.stringify(e)):t(i)}throw Error("Unexpected param value: "+e)}getSQL(){return this}as(e){return void 0===e?this:new J.Aliased(this,e)}mapWith(e){return this.decoder="function"==typeof e?{mapFromDriverValue:e}:e,this}inlineParams(){return this.shouldInlineParams=!0,this}if(e){return e?this:void 0}}class X{constructor(e){this.value=e}static [n]="Name";brand;getSQL(){return new J([this])}}let G={mapFromDriverValue:e=>e},W={mapToDriverValue:e=>e};({...G,...W});class Y{constructor(e,t=W){this.value=e,this.encoder=t}static [n]="Param";brand;getSQL(){return new J([this])}}function H(e,...t){let i=[];for(let[s,r]of((t.length>0||e.length>0&&""!==e[0])&&i.push(new k(e[0])),t.entries()))i.push(r,new k(e[s+1]));return new J(i)}(s=H||(H={})).empty=function(){return new J([])},s.fromList=function(e){return new J(e)},s.raw=function(e){return new J([new k(e)])},s.join=function(e,t){let i=[];for(let[s,r]of e.entries())s>0&&void 0!==t&&i.push(t),i.push(r);return new J(i)},s.identifier=function(e){return new X(e)},s.placeholder=function(e){return new et(e)},s.param=function(e,t){return new Y(e,t)};var Z=J||(J={});class ee{constructor(e,t){this.sql=e,this.fieldAlias=t}static [n]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new ee(this.sql,this.fieldAlias)}}Z.Aliased=ee;class et{constructor(e){this.name=e}static [n]="Placeholder";getSQL(){return new J([this])}}function ei(e,t){return e.map(e=>{if(a(e,et)){if(!(e.name in t))throw Error(`No value for placeholder "${e.name}" was provided`);return t[e.name]}if(a(e,Y)&&a(e.value,et)){if(!(e.value.name in t))throw Error(`No value for placeholder "${e.value.name}" was provided`);return e.encoder.mapToDriverValue(t[e.value.name])}return e})}let es=Symbol.for("drizzle:IsDrizzleView");class er{static [n]="View";[z];[es]=!0;constructor({name:e,schema:t,selectedFields:i,query:s}){this[z]={name:e,originalName:e,schema:t,selectedFields:i,query:s,isExisting:!s,isAlias:!1}}getSQL(){return new J([this])}}function en(e,t,i){let s={},r=e.reduce((e,{path:r,field:n},l)=>{let o;o=a(n,T)?n:a(n,J)?n.decoder:n.sql.decoder;let u=e;for(let[e,h]of r.entries())if(e<r.length-1)h in u||(u[h]={}),u=u[h];else{let e=t[l],d=u[h]=null===e?null:o.mapFromDriverValue(e);if(i&&a(n,T)&&2===r.length){let e=r[0];e in s?"string"==typeof s[e]&&s[e]!==n.table[c]&&(s[e]=!1):s[e]=null===d&&n.table[c]}}return e},{});if(i&&Object.keys(s).length>0)for(let[e,t]of Object.entries(s))"string"!=typeof t||i[t]||(r[e]=null);return r}function ea(e,t){return Object.entries(e).reduce((e,[i,s])=>{if("string"!=typeof i)return e;let r=t?[...t,i]:[i];return a(s,T)||a(s,J)||a(s,J.Aliased)?e.push({path:r,field:s}):a(s,S)?e.push(...ea(s[S.Symbol.Columns],r)):e.push(...ea(s,r)),e},[])}function el(e,t){let i=Object.keys(e),s=Object.keys(t);if(i.length!==s.length)return!1;for(let[e,t]of i.entries())if(t!==s[e])return!1;return!0}function eo(e,t){let i=Object.entries(t).filter(([,e])=>void 0!==e).map(([t,i])=>a(i,J)||a(i,T)?[t,i]:[t,new Y(i,e[S.Symbol.Columns][t])]);if(0===i.length)throw Error("No values to set");return Object.fromEntries(i)}function eu(e){return a(e,R)?e._.alias:a(e,er)?e[z].name:a(e,J)?void 0:e[S.Symbol.IsAlias]?e[S.Symbol.Name]:e[S.Symbol.BaseName]}function ec(e,t){return{name:"string"==typeof e&&e.length>0?e:"",config:"object"==typeof e?e:t}}T.prototype.getSQL=function(){return new J([this])},S.prototype.getSQL=function(){return new J([this])},R.prototype.getSQL=function(){return new J([this])};class eh extends B{static [n]="PgIntColumnBaseBuilder";generatedAlwaysAsIdentity(e){if(e){let{name:t,...i}=e;this.config.generatedIdentity={type:"always",sequenceName:t,sequenceOptions:i}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity(e){if(e){let{name:t,...i}=e;this.config.generatedIdentity={type:"byDefault",sequenceName:t,sequenceOptions:i}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}}class ed extends eh{static [n]="PgBigInt53Builder";constructor(e){super(e,"number","PgBigInt53")}build(e){return new em(e,this.config)}}class em extends _{static [n]="PgBigInt53";getSQLType(){return"bigint"}mapFromDriverValue(e){return"number"==typeof e?e:Number(e)}}class ef extends eh{static [n]="PgBigInt64Builder";constructor(e){super(e,"bigint","PgBigInt64")}build(e){return new ep(e,this.config)}}class ep extends _{static [n]="PgBigInt64";getSQLType(){return"bigint"}mapFromDriverValue(e){return BigInt(e)}}class eg extends B{static [n]="PgBigSerial53Builder";constructor(e){super(e,"number","PgBigSerial53"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new ey(e,this.config)}}class ey extends _{static [n]="PgBigSerial53";getSQLType(){return"bigserial"}mapFromDriverValue(e){return"number"==typeof e?e:Number(e)}}class eb extends B{static [n]="PgBigSerial64Builder";constructor(e){super(e,"bigint","PgBigSerial64"),this.config.hasDefault=!0}build(e){return new eS(e,this.config)}}class eS extends _{static [n]="PgBigSerial64";getSQLType(){return"bigserial"}mapFromDriverValue(e){return BigInt(e)}}class ew extends B{static [n]="PgBooleanBuilder";constructor(e){super(e,"boolean","PgBoolean")}build(e){return new eT(e,this.config)}}class eT extends _{static [n]="PgBoolean";getSQLType(){return"boolean"}}class eN extends B{static [n]="PgCharBuilder";constructor(e,t){super(e,"string","PgChar"),this.config.length=t.length,this.config.enumValues=t.enum}build(e){return new ev(e,this.config)}}class ev extends _{static [n]="PgChar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return void 0===this.length?"char":`char(${this.length})`}}class eL extends B{static [n]="PgCidrBuilder";constructor(e){super(e,"string","PgCidr")}build(e){return new ex(e,this.config)}}class ex extends _{static [n]="PgCidr";getSQLType(){return"cidr"}}class e$ extends B{static [n]="PgCustomColumnBuilder";constructor(e,t,i){super(e,"custom","PgCustomColumn"),this.config.fieldConfig=t,this.config.customTypeParams=i}build(e){return new eQ(e,this.config)}}class eQ extends _{static [n]="PgCustomColumn";sqlName;mapTo;mapFrom;constructor(e,t){super(e,t),this.sqlName=t.customTypeParams.dataType(t.fieldConfig),this.mapTo=t.customTypeParams.toDriver,this.mapFrom=t.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(e){return"function"==typeof this.mapFrom?this.mapFrom(e):e}mapToDriverValue(e){return"function"==typeof this.mapTo?this.mapTo(e):e}}class eP extends B{static [n]="PgDateColumnBaseBuilder";defaultNow(){return this.default(H`now()`)}}class eC extends eP{static [n]="PgDateBuilder";constructor(e){super(e,"date","PgDate")}build(e){return new eE(e,this.config)}}class eE extends _{static [n]="PgDate";getSQLType(){return"date"}mapFromDriverValue(e){return new Date(e)}mapToDriverValue(e){return e.toISOString()}}class eB extends eP{static [n]="PgDateStringBuilder";constructor(e){super(e,"string","PgDateString")}build(e){return new e_(e,this.config)}}class e_ extends _{static [n]="PgDateString";getSQLType(){return"date"}}class eq extends B{static [n]="PgDoublePrecisionBuilder";constructor(e){super(e,"number","PgDoublePrecision")}build(e){return new eD(e,this.config)}}class eD extends _{static [n]="PgDoublePrecision";getSQLType(){return"double precision"}mapFromDriverValue(e){return"string"==typeof e?Number.parseFloat(e):e}}class eO extends B{static [n]="PgInetBuilder";constructor(e){super(e,"string","PgInet")}build(e){return new eA(e,this.config)}}class eA extends _{static [n]="PgInet";getSQLType(){return"inet"}}class eF extends eh{static [n]="PgIntegerBuilder";constructor(e){super(e,"number","PgInteger")}build(e){return new ej(e,this.config)}}class ej extends _{static [n]="PgInteger";getSQLType(){return"integer"}mapFromDriverValue(e){return"string"==typeof e?Number.parseInt(e):e}}class eI extends B{static [n]="PgIntervalBuilder";constructor(e,t){super(e,"string","PgInterval"),this.config.intervalConfig=t}build(e){return new eR(e,this.config)}}class eR extends _{static [n]="PgInterval";fields=this.config.intervalConfig.fields;precision=this.config.intervalConfig.precision;getSQLType(){let e=this.fields?` ${this.fields}`:"",t=this.precision?`(${this.precision})`:"";return`interval${e}${t}`}}class eV extends B{static [n]="PgJsonBuilder";constructor(e){super(e,"json","PgJson")}build(e){return new eU(e,this.config)}}class eU extends _{static [n]="PgJson";constructor(e,t){super(e,t)}getSQLType(){return"json"}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if("string"==typeof e)try{return JSON.parse(e)}catch{}return e}}class ez extends B{static [n]="PgJsonbBuilder";constructor(e){super(e,"json","PgJsonb")}build(e){return new eM(e,this.config)}}class eM extends _{static [n]="PgJsonb";constructor(e,t){super(e,t)}getSQLType(){return"jsonb"}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if("string"==typeof e)try{return JSON.parse(e)}catch{}return e}}class eK extends B{static [n]="PgLineBuilder";constructor(e){super(e,"array","PgLine")}build(e){return new ek(e,this.config)}}class ek extends _{static [n]="PgLine";getSQLType(){return"line"}mapFromDriverValue(e){let[t,i,s]=e.slice(1,-1).split(",");return[Number.parseFloat(t),Number.parseFloat(i),Number.parseFloat(s)]}mapToDriverValue(e){return`{${e[0]},${e[1]},${e[2]}}`}}class eJ extends B{static [n]="PgLineABCBuilder";constructor(e){super(e,"json","PgLineABC")}build(e){return new eX(e,this.config)}}class eX extends _{static [n]="PgLineABC";getSQLType(){return"line"}mapFromDriverValue(e){let[t,i,s]=e.slice(1,-1).split(",");return{a:Number.parseFloat(t),b:Number.parseFloat(i),c:Number.parseFloat(s)}}mapToDriverValue(e){return`{${e.a},${e.b},${e.c}}`}}class eG extends B{static [n]="PgMacaddrBuilder";constructor(e){super(e,"string","PgMacaddr")}build(e){return new eW(e,this.config)}}class eW extends _{static [n]="PgMacaddr";getSQLType(){return"macaddr"}}class eY extends B{static [n]="PgMacaddr8Builder";constructor(e){super(e,"string","PgMacaddr8")}build(e){return new eH(e,this.config)}}class eH extends _{static [n]="PgMacaddr8";getSQLType(){return"macaddr8"}}class eZ extends B{static [n]="PgNumericBuilder";constructor(e,t,i){super(e,"string","PgNumeric"),this.config.precision=t,this.config.scale=i}build(e){return new e0(e,this.config)}}class e0 extends _{static [n]="PgNumeric";precision;scale;constructor(e,t){super(e,t),this.precision=t.precision,this.scale=t.scale}getSQLType(){return void 0!==this.precision&&void 0!==this.scale?`numeric(${this.precision}, ${this.scale})`:void 0===this.precision?"numeric":`numeric(${this.precision})`}}class e1 extends B{static [n]="PgPointTupleBuilder";constructor(e){super(e,"array","PgPointTuple")}build(e){return new e2(e,this.config)}}class e2 extends _{static [n]="PgPointTuple";getSQLType(){return"point"}mapFromDriverValue(e){if("string"==typeof e){let[t,i]=e.slice(1,-1).split(",");return[Number.parseFloat(t),Number.parseFloat(i)]}return[e.x,e.y]}mapToDriverValue(e){return`(${e[0]},${e[1]})`}}class e5 extends B{static [n]="PgPointObjectBuilder";constructor(e){super(e,"json","PgPointObject")}build(e){return new e4(e,this.config)}}class e4 extends _{static [n]="PgPointObject";getSQLType(){return"point"}mapFromDriverValue(e){if("string"==typeof e){let[t,i]=e.slice(1,-1).split(",");return{x:Number.parseFloat(t),y:Number.parseFloat(i)}}return e}mapToDriverValue(e){return`(${e.x},${e.y})`}}function e3(e,t){let i=new DataView(new ArrayBuffer(8));for(let s=0;s<8;s++)i.setUint8(s,e[t+s]);return i.getFloat64(0,!0)}function e8(e){let t=function(e){let t=[];for(let i=0;i<e.length;i+=2)t.push(Number.parseInt(e.slice(i,i+2),16));return new Uint8Array(t)}(e),i=0,s=t[0];i+=1;let r=new DataView(t.buffer),n=r.getUint32(i,1===s);if(i+=4,0x20000000&n&&(r.getUint32(i,1===s),i+=4),(65535&n)==1){let e=e3(t,i),s=e3(t,i+=8);return i+=8,[e,s]}throw Error("Unsupported geometry type")}class e6 extends B{static [n]="PgGeometryBuilder";constructor(e){super(e,"array","PgGeometry")}build(e){return new e7(e,this.config)}}class e7 extends _{static [n]="PgGeometry";getSQLType(){return"geometry(point)"}mapFromDriverValue(e){return e8(e)}mapToDriverValue(e){return`point(${e[0]} ${e[1]})`}}class e9 extends B{static [n]="PgGeometryObjectBuilder";constructor(e){super(e,"json","PgGeometryObject")}build(e){return new te(e,this.config)}}class te extends _{static [n]="PgGeometryObject";getSQLType(){return"geometry(point)"}mapFromDriverValue(e){let t=e8(e);return{x:t[0],y:t[1]}}mapToDriverValue(e){return`point(${e.x} ${e.y})`}}class tt extends B{static [n]="PgRealBuilder";constructor(e,t){super(e,"number","PgReal"),this.config.length=t}build(e){return new ti(e,this.config)}}class ti extends _{static [n]="PgReal";constructor(e,t){super(e,t)}getSQLType(){return"real"}mapFromDriverValue=e=>"string"==typeof e?Number.parseFloat(e):e}class ts extends B{static [n]="PgSerialBuilder";constructor(e){super(e,"number","PgSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new tr(e,this.config)}}class tr extends _{static [n]="PgSerial";getSQLType(){return"serial"}}class tn extends eh{static [n]="PgSmallIntBuilder";constructor(e){super(e,"number","PgSmallInt")}build(e){return new ta(e,this.config)}}class ta extends _{static [n]="PgSmallInt";getSQLType(){return"smallint"}mapFromDriverValue=e=>"string"==typeof e?Number(e):e}class tl extends B{static [n]="PgSmallSerialBuilder";constructor(e){super(e,"number","PgSmallSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new to(e,this.config)}}class to extends _{static [n]="PgSmallSerial";getSQLType(){return"smallserial"}}class tu extends B{static [n]="PgTextBuilder";constructor(e,t){super(e,"string","PgText"),this.config.enumValues=t.enum}build(e){return new tc(e,this.config)}}class tc extends _{static [n]="PgText";enumValues=this.config.enumValues;getSQLType(){return"text"}}class th extends eP{constructor(e,t,i){super(e,"string","PgTime"),this.withTimezone=t,this.precision=i,this.config.withTimezone=t,this.config.precision=i}static [n]="PgTimeBuilder";build(e){return new td(e,this.config)}}class td extends _{static [n]="PgTime";withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){let e=void 0===this.precision?"":`(${this.precision})`;return`time${e}${this.withTimezone?" with time zone":""}`}}class tm extends eP{static [n]="PgTimestampBuilder";constructor(e,t,i){super(e,"date","PgTimestamp"),this.config.withTimezone=t,this.config.precision=i}build(e){return new tf(e,this.config)}}class tf extends _{static [n]="PgTimestamp";withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){let e=void 0===this.precision?"":` (${this.precision})`;return`timestamp${e}${this.withTimezone?" with time zone":""}`}mapFromDriverValue=e=>new Date(this.withTimezone?e:e+"+0000");mapToDriverValue=e=>e.toISOString()}class tp extends eP{static [n]="PgTimestampStringBuilder";constructor(e,t,i){super(e,"string","PgTimestampString"),this.config.withTimezone=t,this.config.precision=i}build(e){return new tg(e,this.config)}}class tg extends _{static [n]="PgTimestampString";withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){let e=void 0===this.precision?"":`(${this.precision})`;return`timestamp${e}${this.withTimezone?" with time zone":""}`}}class ty extends B{static [n]="PgUUIDBuilder";constructor(e){super(e,"string","PgUUID")}defaultRandom(){return this.default(H`gen_random_uuid()`)}build(e){return new tb(e,this.config)}}class tb extends _{static [n]="PgUUID";getSQLType(){return"uuid"}}class tS extends B{static [n]="PgVarcharBuilder";constructor(e,t){super(e,"string","PgVarchar"),this.config.length=t.length,this.config.enumValues=t.enum}build(e){return new tw(e,this.config)}}class tw extends _{static [n]="PgVarchar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return void 0===this.length?"varchar":`varchar(${this.length})`}}class tT extends B{static [n]="PgBinaryVectorBuilder";constructor(e,t){super(e,"string","PgBinaryVector"),this.config.dimensions=t.dimensions}build(e){return new tN(e,this.config)}}class tN extends _{static [n]="PgBinaryVector";dimensions=this.config.dimensions;getSQLType(){return`bit(${this.dimensions})`}}class tv extends B{static [n]="PgHalfVectorBuilder";constructor(e,t){super(e,"array","PgHalfVector"),this.config.dimensions=t.dimensions}build(e){return new tL(e,this.config)}}class tL extends _{static [n]="PgHalfVector";dimensions=this.config.dimensions;getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){return e.slice(1,-1).split(",").map(e=>Number.parseFloat(e))}}class tx extends B{static [n]="PgSparseVectorBuilder";constructor(e,t){super(e,"string","PgSparseVector"),this.config.dimensions=t.dimensions}build(e){return new t$(e,this.config)}}class t$ extends _{static [n]="PgSparseVector";dimensions=this.config.dimensions;getSQLType(){return`sparsevec(${this.dimensions})`}}class tQ extends B{static [n]="PgVectorBuilder";constructor(e,t){super(e,"array","PgVector"),this.config.dimensions=t.dimensions}build(e){return new tP(e,this.config)}}class tP extends _{static [n]="PgVector";dimensions=this.config.dimensions;getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){return e.slice(1,-1).split(",").map(e=>Number.parseFloat(e))}}let tC=Symbol.for("drizzle:PgInlineForeignKeys"),tE=Symbol.for("drizzle:EnableRLS");class tB extends S{static [n]="PgTable";static Symbol=Object.assign({},S.Symbol,{InlineForeignKeys:tC,EnableRLS:tE});[tC]=[];[tE]=!1;[S.Symbol.ExtraConfigBuilder]=void 0}class t_{static [n]="PgPrimaryKeyBuilder";columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new tq(e,this.columns,this.name)}}class tq{constructor(e,t,i){this.table=e,this.columns=t,this.name=i}static [n]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[tB.Symbol.Name]}_${this.columns.map(e=>e.name).join("_")}_pk`}}function tD(e,t){return"object"!=typeof t||null===t||!("mapToDriverValue"in t)||"function"!=typeof t.mapToDriverValue||K(e)||a(e,Y)||a(e,et)||a(e,T)||a(e,S)||a(e,er)?e:new Y(e,t)}let tO=(e,t)=>H`${e} = ${tD(t,e)}`,tA=(e,t)=>H`${e} <> ${tD(t,e)}`;function tF(...e){let t=e.filter(e=>void 0!==e);if(0!==t.length)return new J(1===t.length?t:[new k("("),H.join(t,new k(" and ")),new k(")")])}function tj(...e){let t=e.filter(e=>void 0!==e);if(0!==t.length)return new J(1===t.length?t:[new k("("),H.join(t,new k(" or ")),new k(")")])}function tI(e){return H`not ${e}`}let tR=(e,t)=>H`${e} > ${tD(t,e)}`,tV=(e,t)=>H`${e} >= ${tD(t,e)}`,tU=(e,t)=>H`${e} < ${tD(t,e)}`,tz=(e,t)=>H`${e} <= ${tD(t,e)}`;function tM(e,t){return Array.isArray(t)?0===t.length?H`false`:H`${e} in ${t.map(t=>tD(t,e))}`:H`${e} in ${tD(t,e)}`}function tK(e,t){return Array.isArray(t)?0===t.length?H`true`:H`${e} not in ${t.map(t=>tD(t,e))}`:H`${e} not in ${tD(t,e)}`}function tk(e){return H`${e} is null`}function tJ(e){return H`${e} is not null`}function tX(e){return H`exists ${e}`}function tG(e){return H`not exists ${e}`}function tW(e,t,i){return H`${e} between ${tD(t,e)} and ${tD(i,e)}`}function tY(e,t,i){return H`${e} not between ${tD(t,e)} and ${tD(i,e)}`}function tH(e,t){return H`${e} like ${t}`}function tZ(e,t){return H`${e} not like ${t}`}function t0(e,t){return H`${e} ilike ${t}`}function t1(e,t){return H`${e} not ilike ${t}`}function t2(e){return H`${e} asc`}function t5(e){return H`${e} desc`}e.s(["and",()=>tF,"between",()=>tW,"eq",()=>tO,"exists",()=>tX,"gt",()=>tR,"gte",()=>tV,"ilike",()=>t0,"inArray",()=>tM,"isNotNull",()=>tJ,"isNull",()=>tk,"like",()=>tH,"lt",()=>tU,"lte",()=>tz,"ne",()=>tA,"not",()=>tI,"notBetween",()=>tY,"notExists",()=>tG,"notIlike",()=>t1,"notInArray",()=>tK,"notLike",()=>tZ,"or",()=>tj],22124),e.s(["asc",()=>t2,"desc",()=>t5],79174);class t4{constructor(e,t,i){this.sourceTable=e,this.referencedTable=t,this.relationName=i,this.referencedTableName=t[S.Symbol.Name]}static [n]="Relation";referencedTableName;fieldName}class t3{constructor(e,t){this.table=e,this.config=t}static [n]="Relations"}class t8 extends t4{constructor(e,t,i,s){super(e,t,i?.relationName),this.config=i,this.isNullable=s}static [n]="One";withFieldName(e){let t=new t8(this.sourceTable,this.referencedTable,this.config,this.isNullable);return t.fieldName=e,t}}class t6 extends t4{constructor(e,t,i){super(e,t,i?.relationName),this.config=i}static [n]="Many";withFieldName(e){let t=new t6(this.sourceTable,this.referencedTable,this.config);return t.fieldName=e,t}}function t7(e,t){return new t3(e,e=>Object.fromEntries(Object.entries(t(e)).map(([e,t])=>[e,t.withFieldName(e)])))}function t9(e){return{one:function(t,i){return new t8(e,t,i,i?.fields.reduce((e,t)=>e&&t.notNull,!0)??!1)},many:function(t,i){return new t6(e,t,i)}}}class ie{constructor(e){this.table=e}static [n]="ColumnAliasProxyHandler";get(e,t){return"table"===t?this.table:e[t]}}class it{constructor(e,t){this.alias=e,this.replaceOriginalName=t}static [n]="TableAliasProxyHandler";get(e,t){if(t===S.Symbol.IsAlias)return!0;if(t===S.Symbol.Name||this.replaceOriginalName&&t===S.Symbol.OriginalName)return this.alias;if(t===z)return{...e[z],name:this.alias,isAlias:!0};if(t===S.Symbol.Columns){let t=e[S.Symbol.Columns];if(!t)return t;let i={};return Object.keys(t).map(s=>{i[s]=new Proxy(t[s],new ie(new Proxy(e,this)))}),i}let i=e[t];return a(i,T)?new Proxy(i,new ie(new Proxy(e,this))):i}}class ii{constructor(e){this.alias=e}static [n]="RelationTableAliasProxyHandler";get(e,t){return"sourceTable"===t?is(e.sourceTable,this.alias):e[t]}}function is(e,t){return new Proxy(e,new it(t,!1))}function ir(e,t){return new Proxy(e,new ie(new Proxy(e.table,new it(t,!1))))}function ia(e,t){return new J.Aliased(il(e.sql,t),e.fieldAlias)}function il(e,t){return H.join(e.queryChunks.map(e=>a(e,T)?ir(e,t):a(e,J)?il(e,t):a(e,J.Aliased)?ia(e,t):e))}class io{static [n]="SelectionProxyHandler";config;constructor(e){this.config={...e}}get(e,t){if("_"===t)return{...e._,selectedFields:new Proxy(e._.selectedFields,this)};if(t===z)return{...e[z],selectedFields:new Proxy(e[z].selectedFields,this)};if("symbol"==typeof t)return e[t];let i=(a(e,R)?e._.selectedFields:a(e,er)?e[z].selectedFields:e)[t];if(a(i,J.Aliased)){if("sql"===this.config.sqlAliasedBehavior&&!i.isSelectionField)return i.sql;let e=i.clone();return e.isSelectionField=!0,e}if(a(i,J)){if("sql"===this.config.sqlBehavior)return i;throw Error(`You tried to reference "${t}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return a(i,T)?this.config.alias?new Proxy(i,new ie(new Proxy(i.table,new it(this.config.alias,this.config.replaceOriginalName??!1)))):i:"object"!=typeof i||null===i?i:new Proxy(i,new io(this.config))}}function iu(e){return(e.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map(e=>e.toLowerCase()).join("_")}function ic(e){return(e.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((e,t,i)=>e+(0===i?t.toLowerCase():`${t[0].toUpperCase()}${t.slice(1)}`),"")}function ih(e){return e}class id{static [n]="CasingCache";cache={};cachedTables={};convert;constructor(e){this.convert="snake_case"===e?iu:"camelCase"===e?ic:ih}getColumnCasing(e){if(!e.keyAsName)return e.name;let t=e.table[S.Symbol.Schema]??"public",i=e.table[S.Symbol.OriginalName],s=`${t}.${i}.${e.name}`;return this.cache[s]||this.cacheTable(e.table),this.cache[s]}cacheTable(e){let t=e[S.Symbol.Schema]??"public",i=e[S.Symbol.OriginalName],s=`${t}.${i}`;if(!this.cachedTables[s]){for(let t of Object.values(e[S.Symbol.Columns])){let e=`${s}.${t.name}`;this.cache[e]=this.convert(t.name)}this.cachedTables[s]=!0}}clearCache(){this.cache={},this.cachedTables={}}}class im extends Error{static [n]="DrizzleError";constructor({message:e,cause:t}){super(e),this.name="DrizzleError",this.cause=t}}class ip extends im{static [n]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}class ig{static [n]="SQLiteForeignKeyBuilder";reference;_onUpdate;_onDelete;constructor(e,t){this.reference=()=>{let{name:t,columns:i,foreignColumns:s}=e();return{name:t,columns:i,foreignTable:s[0].table,foreignColumns:s}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=e,this}onDelete(e){return this._onDelete=e,this}build(e){return new iy(e,this)}}class iy{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static [n]="SQLiteForeignKey";reference;onUpdate;onDelete;getName(){let{name:e,columns:t,foreignColumns:i}=this.reference(),s=t.map(e=>e.name),r=i.map(e=>e.name),n=[this.table[c],...s,i[0].table[c],...r];return e??`${n.join("_")}_fk`}}function ib(e,t){return`${e[c]}_${t.join("_")}_unique`}class iS{constructor(e,t){this.name=t,this.columns=e}static [n]="SQLiteUniqueConstraintBuilder";columns;build(e){return new iT(e,this.columns,this.name)}}class iw{static [n]="SQLiteUniqueOnConstraintBuilder";name;constructor(e){this.name=e}on(...e){return new iS(e,this.name)}}class iT{constructor(e,t,i){this.table=e,this.columns=t,this.name=i??ib(this.table,this.columns.map(e=>e.name))}static [n]="SQLiteUniqueConstraint";columns;name;getName(){return this.name}}class iN extends N{static [n]="SQLiteColumnBuilder";foreignKeyConfigs=[];references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e){return this.config.isUnique=!0,this.config.uniqueName=e,this}generatedAlwaysAs(e,t){return this.config.generated={as:e,type:"always",mode:t?.mode??"virtual"},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:i,actions:s})=>{let r;return r=new ig(()=>({columns:[e],foreignColumns:[i()]})),s.onUpdate&&r.onUpdate(s.onUpdate),s.onDelete&&r.onDelete(s.onDelete),r.build(t)})}}class iv extends T{constructor(e,t){t.uniqueName||(t.uniqueName=ib(e,[t.name])),super(e,t),this.table=e}static [n]="SQLiteColumn"}class iL extends iN{static [n]="SQLiteBigIntBuilder";constructor(e){super(e,"bigint","SQLiteBigInt")}build(e){return new ix(e,this.config)}}class ix extends iv{static [n]="SQLiteBigInt";getSQLType(){return"blob"}mapFromDriverValue(e){return Buffer.isBuffer(e)?BigInt(e.toString()):e instanceof ArrayBuffer?BigInt(new TextDecoder().decode(e)):BigInt(String.fromCodePoint(...e))}mapToDriverValue(e){return Buffer.from(e.toString())}}class i$ extends iN{static [n]="SQLiteBlobJsonBuilder";constructor(e){super(e,"json","SQLiteBlobJson")}build(e){return new iQ(e,this.config)}}class iQ extends iv{static [n]="SQLiteBlobJson";getSQLType(){return"blob"}mapFromDriverValue(e){return Buffer.isBuffer(e)?JSON.parse(e.toString()):e instanceof ArrayBuffer?JSON.parse(new TextDecoder().decode(e)):JSON.parse(String.fromCodePoint(...e))}mapToDriverValue(e){return Buffer.from(JSON.stringify(e))}}class iP extends iN{static [n]="SQLiteBlobBufferBuilder";constructor(e){super(e,"buffer","SQLiteBlobBuffer")}build(e){return new iC(e,this.config)}}class iC extends iv{static [n]="SQLiteBlobBuffer";getSQLType(){return"blob"}}function iE(e,t){let{name:i,config:s}=ec(e,t);return s?.mode==="json"?new i$(i):s?.mode==="bigint"?new iL(i):new iP(i)}class iB extends iN{static [n]="SQLiteCustomColumnBuilder";constructor(e,t,i){super(e,"custom","SQLiteCustomColumn"),this.config.fieldConfig=t,this.config.customTypeParams=i}build(e){return new i_(e,this.config)}}class i_ extends iv{static [n]="SQLiteCustomColumn";sqlName;mapTo;mapFrom;constructor(e,t){super(e,t),this.sqlName=t.customTypeParams.dataType(t.fieldConfig),this.mapTo=t.customTypeParams.toDriver,this.mapFrom=t.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(e){return"function"==typeof this.mapFrom?this.mapFrom(e):e}mapToDriverValue(e){return"function"==typeof this.mapTo?this.mapTo(e):e}}function iq(e){return(t,i)=>{let{name:s,config:r}=ec(t,i);return new iB(s,r,e)}}class iD extends iN{static [n]="SQLiteBaseIntegerBuilder";constructor(e,t,i){super(e,t,i),this.config.autoIncrement=!1}primaryKey(e){return e?.autoIncrement&&(this.config.autoIncrement=!0),this.config.hasDefault=!0,super.primaryKey()}}class iO extends iv{static [n]="SQLiteBaseInteger";autoIncrement=this.config.autoIncrement;getSQLType(){return"integer"}}class iA extends iD{static [n]="SQLiteIntegerBuilder";constructor(e){super(e,"number","SQLiteInteger")}build(e){return new iF(e,this.config)}}class iF extends iO{static [n]="SQLiteInteger"}class ij extends iD{static [n]="SQLiteTimestampBuilder";constructor(e,t){super(e,"date","SQLiteTimestamp"),this.config.mode=t}defaultNow(){return this.default(H`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build(e){return new iI(e,this.config)}}class iI extends iO{static [n]="SQLiteTimestamp";mode=this.config.mode;mapFromDriverValue(e){return new Date("timestamp"===this.config.mode?1e3*e:e)}mapToDriverValue(e){let t=e.getTime();return"timestamp"===this.config.mode?Math.floor(t/1e3):t}}class iR extends iD{static [n]="SQLiteBooleanBuilder";constructor(e,t){super(e,"boolean","SQLiteBoolean"),this.config.mode=t}build(e){return new iV(e,this.config)}}class iV extends iO{static [n]="SQLiteBoolean";mode=this.config.mode;mapFromDriverValue(e){return 1===Number(e)}mapToDriverValue(e){return+!!e}}function iU(e,t){let{name:i,config:s}=ec(e,t);return s?.mode==="timestamp"||s?.mode==="timestamp_ms"?new ij(i,s.mode):s?.mode==="boolean"?new iR(i,s.mode):new iA(i)}class iz extends iN{static [n]="SQLiteNumericBuilder";constructor(e){super(e,"string","SQLiteNumeric")}build(e){return new iM(e,this.config)}}class iM extends iv{static [n]="SQLiteNumeric";getSQLType(){return"numeric"}}function iK(e){return new iz(e??"")}class ik extends iN{static [n]="SQLiteRealBuilder";constructor(e){super(e,"number","SQLiteReal")}build(e){return new iJ(e,this.config)}}class iJ extends iv{static [n]="SQLiteReal";getSQLType(){return"real"}}function iX(e){return new ik(e??"")}class iG extends iN{static [n]="SQLiteTextBuilder";constructor(e,t){super(e,"string","SQLiteText"),this.config.enumValues=t.enum,this.config.length=t.length}build(e){return new iW(e,this.config)}}class iW extends iv{static [n]="SQLiteText";enumValues=this.config.enumValues;length=this.config.length;constructor(e,t){super(e,t)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:""}`}}class iY extends iN{static [n]="SQLiteTextJsonBuilder";constructor(e){super(e,"json","SQLiteTextJson")}build(e){return new iH(e,this.config)}}class iH extends iv{static [n]="SQLiteTextJson";getSQLType(){return"text"}mapFromDriverValue(e){return JSON.parse(e)}mapToDriverValue(e){return JSON.stringify(e)}}function iZ(e,t={}){let{name:i,config:s}=ec(e,t);return"json"===s.mode?new iY(i):new iG(i,s)}let i0=Symbol.for("drizzle:SQLiteInlineForeignKeys");class i1 extends S{static [n]="SQLiteTable";static Symbol=Object.assign({},S.Symbol,{InlineForeignKeys:i0});[S.Symbol.Columns];[i0]=[];[S.Symbol.ExtraConfigBuilder]=void 0}let i2=(e,t,i)=>(function(e,t,i,s,r=e){let n=new i1(e,void 0,r),a=Object.fromEntries(Object.entries("function"==typeof t?t({blob:iE,customType:iq,integer:iU,numeric:iK,real:iX,text:iZ}):t).map(([e,t])=>{t.setName(e);let i=t.build(n);return n[i0].push(...t.buildForeignKeys(i,n)),[e,i]})),l=Object.assign(n,a);return l[S.Symbol.Columns]=a,l[S.Symbol.ExtraConfigColumns]=a,i&&(l[i1.Symbol.ExtraConfigBuilder]=i),l})(e,t,i);class i5 extends er{static [n]="SQLiteViewBase"}class i4{static [n]="SQLiteDialect";casing;constructor(e){this.casing=new id(e?.casing)}escapeName(e){return`"${e}"`}escapeParam(e){return"?"}escapeString(e){return`'${e.replace(/'/g,"''")}'`}buildWithCTE(e){if(!e?.length)return;let t=[H`with `];for(let[i,s]of e.entries())t.push(H`${H.identifier(s._.alias)} as (${s._.sql})`),i<e.length-1&&t.push(H`, `);return t.push(H` `),H.join(t)}buildDeleteQuery({table:e,where:t,returning:i,withList:s,limit:r,orderBy:n}){let a=this.buildWithCTE(s),l=i?H` returning ${this.buildSelection(i,{isSingleTable:!0})}`:void 0,o=t?H` where ${t}`:void 0,u=this.buildOrderBy(n),c=this.buildLimit(r);return H`${a}delete from ${e}${o}${l}${u}${c}`}buildUpdateSet(e,t){let i=e[S.Symbol.Columns],s=Object.keys(i).filter(e=>void 0!==t[e]||i[e]?.onUpdateFn!==void 0),r=s.length;return H.join(s.flatMap((e,s)=>{let n=i[e],a=t[e]??H.param(n.onUpdateFn(),n),l=H`${H.identifier(this.casing.getColumnCasing(n))} = ${a}`;return s<r-1?[l,H.raw(", ")]:[l]}))}buildUpdateQuery({table:e,set:t,where:i,returning:s,withList:r,joins:n,from:a,limit:l,orderBy:o}){let u=this.buildWithCTE(r),c=this.buildUpdateSet(e,t),h=a&&H.join([H.raw(" from "),this.buildFromTable(a)]),d=this.buildJoins(n),m=s?H` returning ${this.buildSelection(s,{isSingleTable:!0})}`:void 0,f=i?H` where ${i}`:void 0,p=this.buildOrderBy(o),g=this.buildLimit(l);return H`${u}update ${e} set ${c}${h}${d}${f}${m}${p}${g}`}buildSelection(e,{isSingleTable:t=!1}={}){let i=e.length,s=e.flatMap(({field:e},s)=>{let r=[];if(a(e,J.Aliased)&&e.isSelectionField)r.push(H.identifier(e.fieldAlias));else if(a(e,J.Aliased)||a(e,J)){let i=a(e,J.Aliased)?e.sql:e;t?r.push(new J(i.queryChunks.map(e=>a(e,T)?H.identifier(this.casing.getColumnCasing(e)):e))):r.push(i),a(e,J.Aliased)&&r.push(H` as ${H.identifier(e.fieldAlias)}`)}else if(a(e,T)){let i=e.table[S.Symbol.Name];t?r.push(H.identifier(this.casing.getColumnCasing(e))):r.push(H`${H.identifier(i)}.${H.identifier(this.casing.getColumnCasing(e))}`)}return s<i-1&&r.push(H`, `),r});return H.join(s)}buildJoins(e){if(!e||0===e.length)return;let t=[];if(e)for(let[i,s]of e.entries()){0===i&&t.push(H` `);let r=s.table;if(a(r,i1)){let e=r[i1.Symbol.Name],i=r[i1.Symbol.Schema],n=r[i1.Symbol.OriginalName],a=e===n?void 0:s.alias;t.push(H`${H.raw(s.joinType)} join ${i?H`${H.identifier(i)}.`:void 0}${H.identifier(n)}${a&&H` ${H.identifier(a)}`} on ${s.on}`)}else t.push(H`${H.raw(s.joinType)} join ${r} on ${s.on}`);i<e.length-1&&t.push(H` `)}return H.join(t)}buildLimit(e){return"object"==typeof e||"number"==typeof e&&e>=0?H` limit ${e}`:void 0}buildOrderBy(e){let t=[];if(e)for(let[i,s]of e.entries())t.push(s),i<e.length-1&&t.push(H`, `);return t.length>0?H` order by ${H.join(t)}`:void 0}buildFromTable(e){return a(e,S)&&e[S.Symbol.OriginalName]!==e[S.Symbol.Name]?H`${H.identifier(e[S.Symbol.OriginalName])} ${H.identifier(e[S.Symbol.Name])}`:e}buildSelectQuery({withList:e,fields:t,fieldsFlat:i,where:s,having:r,table:n,joins:l,orderBy:o,groupBy:u,limit:h,offset:d,distinct:m,setOperators:f}){let p=i??ea(t);for(let e of p){let t;if(a(e.field,T)&&e.field.table[c]!==(a(n,R)?n._.alias:a(n,i5)?n[z].name:a(n,J)?void 0:n[c])&&(t=e.field.table,!l?.some(({alias:e})=>e===(t[S.Symbol.IsAlias]?t[c]:t[S.Symbol.BaseName])))){let t=e.field.table[c];throw Error(`Your "${e.path.join("->")}" field references a column "${t}"."${e.field.name}", but the table "${t}" is not part of the query! Did you forget to join it?`)}}let g=!l||0===l.length,y=this.buildWithCTE(e),b=m?H` distinct`:void 0,w=this.buildSelection(p,{isSingleTable:g}),N=this.buildFromTable(n),v=this.buildJoins(l),L=s?H` where ${s}`:void 0,x=r?H` having ${r}`:void 0,$=[];if(u)for(let[e,t]of u.entries())$.push(t),e<u.length-1&&$.push(H`, `);let Q=$.length>0?H` group by ${H.join($)}`:void 0,P=this.buildOrderBy(o),C=this.buildLimit(h),E=d?H` offset ${d}`:void 0,B=H`${y}select${b} ${w} from ${N}${v}${L}${Q}${x}${P}${C}${E}`;return f.length>0?this.buildSetOperations(B,f):B}buildSetOperations(e,t){let[i,...s]=t;if(!i)throw Error("Cannot pass undefined values to any set operator");return 0===s.length?this.buildSetOperationQuery({leftSelect:e,setOperator:i}):this.buildSetOperations(this.buildSetOperationQuery({leftSelect:e,setOperator:i}),s)}buildSetOperationQuery({leftSelect:e,setOperator:{type:t,isAll:i,rightSelect:s,limit:r,orderBy:n,offset:l}}){let o,u=H`${e.getSQL()} `,c=H`${s.getSQL()}`;if(n&&n.length>0){let e=[];for(let t of n)if(a(t,iv))e.push(H.identifier(t.name));else if(a(t,J)){for(let e=0;e<t.queryChunks.length;e++){let i=t.queryChunks[e];a(i,iv)&&(t.queryChunks[e]=H.identifier(this.casing.getColumnCasing(i)))}e.push(H`${t}`)}else e.push(H`${t}`);o=H` order by ${H.join(e,H`, `)}`}let h="object"==typeof r||"number"==typeof r&&r>=0?H` limit ${r}`:void 0,d=H.raw(`${t} ${i?"all ":""}`),m=l?H` offset ${l}`:void 0;return H`${u}${d}${c}${o}${h}${m}`}buildInsertQuery({table:e,values:t,onConflict:i,returning:s,withList:r,select:n}){let l=[],o=Object.entries(e[S.Symbol.Columns]).filter(([e,t])=>!t.shouldDisableInsert()),u=o.map(([,e])=>H.identifier(this.casing.getColumnCasing(e)));if(n)a(t,J)?l.push(t):l.push(t.getSQL());else for(let[e,i]of(l.push(H.raw("values ")),t.entries())){let s=[];for(let[e,t]of o){let r=i[e];if(void 0===r||a(r,Y)&&void 0===r.value){let e;if(null!==t.default&&void 0!==t.default)e=a(t.default,J)?t.default:H.param(t.default,t);else if(void 0!==t.defaultFn){let i=t.defaultFn();e=a(i,J)?i:H.param(i,t)}else if(t.default||void 0===t.onUpdateFn)e=H`null`;else{let i=t.onUpdateFn();e=a(i,J)?i:H.param(i,t)}s.push(e)}else s.push(r)}l.push(s),e<t.length-1&&l.push(H`, `)}let c=this.buildWithCTE(r),h=H.join(l),d=s?H` returning ${this.buildSelection(s,{isSingleTable:!0})}`:void 0,m=i?H` on conflict ${i}`:void 0;return H`${c}insert into ${e} ${u} ${h}${m}${d}`}sqlToQuery(e,t){return e.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,invokeSource:t})}buildRelationalQuery({fullSchema:e,schema:t,tableNamesMap:i,table:s,tableConfig:r,queryConfig:n,tableAlias:l,nestedQueryRelation:o,joinOn:u}){let c,h=[],d,m,f=[],p,g=[];if(!0===n)h=Object.entries(r.columns).map(([e,t])=>({dbKey:t.name,tsKey:e,field:ir(t,l),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let s=Object.fromEntries(Object.entries(r.columns).map(([e,t])=>[e,ir(t,l)]));if(n.where){let e="function"==typeof n.where?n.where(s,{and:tF,between:tW,eq:tO,exists:tX,gt:tR,gte:tV,ilike:t0,inArray:tM,isNull:tk,isNotNull:tJ,like:tH,lt:tU,lte:tz,ne:tA,not:tI,notBetween:tY,notExists:tG,notLike:tZ,notIlike:t1,notInArray:tK,or:tj,sql:H}):n.where;p=e&&il(e,l)}let o=[],u=[];if(n.columns){let e=!1;for(let[t,i]of Object.entries(n.columns))void 0!==i&&t in r.columns&&(e||!0!==i||(e=!0),u.push(t));u.length>0&&(u=e?u.filter(e=>n.columns?.[e]===!0):Object.keys(r.columns).filter(e=>!u.includes(e)))}else u=Object.keys(r.columns);for(let e of u){let t=r.columns[e];o.push({tsKey:e,value:t})}let c=[];if(n.with&&(c=Object.entries(n.with).filter(e=>!!e[1]).map(([e,t])=>({tsKey:e,queryConfig:t,relation:r.relations[e]}))),n.extras)for(let[e,t]of Object.entries("function"==typeof n.extras?n.extras(s,{sql:H}):n.extras))o.push({tsKey:e,value:ia(t,l)});for(let{tsKey:e,value:t}of o)h.push({dbKey:a(t,J.Aliased)?t.fieldAlias:r.columns[e].name,tsKey:e,field:a(t,T)?ir(t,l):t,relationTableTsKey:void 0,isJson:!1,selection:[]});let g="function"==typeof n.orderBy?n.orderBy(s,{sql:H,asc:t2,desc:t5}):n.orderBy??[];for(let{tsKey:s,queryConfig:r,relation:o}of(Array.isArray(g)||(g=[g]),f=g.map(e=>a(e,T)?ir(e,l):il(e,l)),d=n.limit,m=n.offset,c)){let n=function(e,t,i){if(a(i,t8)&&i.config)return{fields:i.config.fields,references:i.config.references};let s=t[w(i.referencedTable)];if(!s)throw Error(`Table "${i.referencedTable[S.Symbol.Name]}" not found in schema`);let r=e[s];if(!r)throw Error(`Table "${s}" not found in schema`);let n=i.sourceTable,l=t[w(n)];if(!l)throw Error(`Table "${n[S.Symbol.Name]}" not found in schema`);let o=[];for(let e of Object.values(r.relations))(i.relationName&&i!==e&&e.relationName===i.relationName||!i.relationName&&e.referencedTable===i.sourceTable)&&o.push(e);if(o.length>1)throw i.relationName?Error(`There are multiple relations with name "${i.relationName}" in table "${s}"`):Error(`There are multiple relations between "${s}" and "${i.sourceTable[S.Symbol.Name]}". Please specify relation name`);if(o[0]&&a(o[0],t8)&&o[0].config)return{fields:o[0].config.references,references:o[0].config.fields};throw Error(`There is not enough information to infer relation "${l}.${i.fieldName}"`)}(t,i,o),u=i[w(o.referencedTable)],c=`${l}_${s}`,d=tF(...n.fields.map((e,t)=>tO(ir(n.references[t],c),ir(e,l)))),m=this.buildRelationalQuery({fullSchema:e,schema:t,tableNamesMap:i,table:e[u],tableConfig:t[u],queryConfig:a(o,t8)?!0===r?{limit:1}:{...r,limit:1}:r,tableAlias:c,joinOn:d,nestedQueryRelation:o}),f=H`(${m.sql})`.as(s);h.push({dbKey:s,tsKey:s,field:f,relationTableTsKey:u,isJson:!0,selection:m.selection})}}if(0===h.length)throw new im({message:`No fields selected for table "${r.tsName}" ("${l}"). You need to have at least one item in "columns", "with" or "extras". If you need to select all columns, omit the "columns" key or set it to undefined.`});if(p=tF(u,p),o){let e=H`json_array(${H.join(h.map(({field:e})=>a(e,iv)?H.identifier(this.casing.getColumnCasing(e)):a(e,J.Aliased)?e.sql:e),H`, `)})`;a(o,t6)&&(e=H`coalesce(json_group_array(${e}), json_array())`);let t=[{dbKey:"data",tsKey:"data",field:e.as("data"),isJson:!0,relationTableTsKey:r.tsName,selection:h}];void 0!==d||void 0!==m||f.length>0?(c=this.buildSelectQuery({table:is(s,l),fields:{},fieldsFlat:[{path:[],field:H.raw("*")}],where:p,limit:d,offset:m,orderBy:f,setOperators:[]}),p=void 0,d=void 0,m=void 0,f=void 0):c=is(s,l),c=this.buildSelectQuery({table:a(c,i1)?c:new R(c,{},l),fields:{},fieldsFlat:t.map(({field:e})=>({path:[],field:a(e,T)?ir(e,l):e})),joins:g,where:p,limit:d,offset:m,orderBy:f,setOperators:[]})}else c=this.buildSelectQuery({table:is(s,l),fields:{},fieldsFlat:h.map(({field:e})=>({path:[],field:a(e,T)?ir(e,l):e})),joins:g,where:p,limit:d,offset:m,orderBy:f,setOperators:[]});return{tableTsKey:r.tsName,sql:c,selection:h}}}class i3 extends i4{static [n]="SQLiteSyncDialect";migrate(e,t,i){let s=void 0===i||"string"==typeof i?"__drizzle_migrations":i.migrationsTable??"__drizzle_migrations",r=H`
1
+ module.exports=[605271,422124,679174,431585,e=>{"use strict";let t,i;var s,r=e.i(925372);let n=Symbol.for("drizzle:entityKind");function a(e,t){if(!e||"object"!=typeof e)return!1;if(e instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,n))throw Error(`Class "${t.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let i=Object.getPrototypeOf(e).constructor;if(i)for(;i;){if(n in i&&i[n]===t[n])return!0;i=Object.getPrototypeOf(i)}return!1}Symbol.for("drizzle:hasOwnEntityKind");class l{static [n]="ConsoleLogWriter";write(e){console.log(e)}}class o{static [n]="DefaultLogger";writer;constructor(e){this.writer=e?.writer??new l}logQuery(e,t){let i=t.map(e=>{try{return JSON.stringify(e)}catch{return String(e)}}),s=i.length?` -- params: [${i.join(", ")}]`:"";this.writer.write(`Query: ${e}${s}`)}}class u{static [n]="NoopLogger";logQuery(){}}let c=Symbol.for("drizzle:Name"),h=Symbol.for("drizzle:Schema"),d=Symbol.for("drizzle:Columns"),m=Symbol.for("drizzle:ExtraConfigColumns"),f=Symbol.for("drizzle:OriginalName"),p=Symbol.for("drizzle:BaseName"),g=Symbol.for("drizzle:IsAlias"),y=Symbol.for("drizzle:ExtraConfigBuilder"),b=Symbol.for("drizzle:IsDrizzleTable");class S{static [n]="Table";static Symbol={Name:c,Schema:h,OriginalName:f,Columns:d,ExtraConfigColumns:m,BaseName:p,IsAlias:g,ExtraConfigBuilder:y};[c];[f];[h];[d];[m];[p];[g]=!1;[b]=!0;[y]=void 0;constructor(e,t,i){this[c]=this[f]=e,this[h]=t,this[p]=i}}function w(e){return`${e[h]??"public"}.${e[c]}`}class T{constructor(e,t){this.table=e,this.config=t,this.name=t.name,this.keyAsName=t.keyAsName,this.notNull=t.notNull,this.default=t.default,this.defaultFn=t.defaultFn,this.onUpdateFn=t.onUpdateFn,this.hasDefault=t.hasDefault,this.primary=t.primaryKey,this.isUnique=t.isUnique,this.uniqueName=t.uniqueName,this.uniqueType=t.uniqueType,this.dataType=t.dataType,this.columnType=t.columnType,this.generated=t.generated,this.generatedIdentity=t.generatedIdentity}static [n]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(e){return e}mapToDriverValue(e){return e}shouldDisableInsert(){return void 0!==this.config.generated&&"byDefault"!==this.config.generated.type}}class N{static [n]="ColumnBuilder";config;constructor(e,t,i){this.config={name:e,keyAsName:""===e,notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:t,columnType:i,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(e){""===this.config.name&&(this.config.name=e)}}class v{static [n]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor(e,t){this.reference=()=>{let{name:t,columns:i,foreignColumns:s}=e();return{name:t,columns:i,foreignTable:s[0].table,foreignColumns:s}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=void 0===e?"no action":e,this}onDelete(e){return this._onDelete=void 0===e?"no action":e,this}build(e){return new L(e,this)}}class L{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static [n]="PgForeignKey";reference;onUpdate;onDelete;getName(){let{name:e,columns:t,foreignColumns:i}=this.reference(),s=t.map(e=>e.name),r=i.map(e=>e.name),n=[this.table[c],...s,i[0].table[c],...r];return e??`${n.join("_")}_fk`}}function x(e,...t){return e(...t)}function $(e,t){return`${e[c]}_${t.join("_")}_unique`}class Q{constructor(e,t){this.name=t,this.columns=e}static [n]="PgUniqueConstraintBuilder";columns;nullsNotDistinctConfig=!1;nullsNotDistinct(){return this.nullsNotDistinctConfig=!0,this}build(e){return new C(e,this.columns,this.nullsNotDistinctConfig,this.name)}}class P{static [n]="PgUniqueOnConstraintBuilder";name;constructor(e){this.name=e}on(...e){return new Q(e,this.name)}}class C{constructor(e,t,i,s){this.table=e,this.columns=t,this.name=s??$(this.table,this.columns.map(e=>e.name)),this.nullsNotDistinct=i}static [n]="PgUniqueConstraint";columns;name;nullsNotDistinct=!1;getName(){return this.name}}function E(e,t,i){for(let s=t;s<e.length;s++){let r=e[s];if("\\"===r){s++;continue}if('"'===r)return[e.slice(t,s).replace(/\\/g,""),s+1];if(!i&&(","===r||"}"===r))return[e.slice(t,s).replace(/\\/g,""),s]}return[e.slice(t).replace(/\\/g,""),e.length]}class B extends N{foreignKeyConfigs=[];static [n]="PgColumnBuilder";array(e){return new O(this.config.name,this,e)}references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e,t){return this.config.isUnique=!0,this.config.uniqueName=e,this.config.uniqueType=t?.nulls,this}generatedAlwaysAs(e){return this.config.generated={as:e,type:"always",mode:"stored"},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:i,actions:s})=>x((i,s)=>{let r=new v(()=>({columns:[e],foreignColumns:[i()]}));return s.onUpdate&&r.onUpdate(s.onUpdate),s.onDelete&&r.onDelete(s.onDelete),r.build(t)},i,s))}buildExtraConfigColumn(e){return new q(e,this.config)}}class _ extends T{constructor(e,t){t.uniqueName||(t.uniqueName=$(e,[t.name])),super(e,t),this.table=e}static [n]="PgColumn"}class q extends _{static [n]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(e){return this.indexConfig.opClass=e,this}}class D{static [n]="IndexedColumn";constructor(e,t,i,s){this.name=e,this.keyAsName=t,this.type=i,this.indexConfig=s}name;keyAsName;type;indexConfig}class O extends B{static [n]="PgArrayBuilder";constructor(e,t,i){super(e,"array","PgArray"),this.config.baseBuilder=t,this.config.size=i}build(e){let t=this.config.baseBuilder.build(e);return new A(e,this.config,t)}}class A extends _{constructor(e,t,i,s){super(e,t),this.baseColumn=i,this.range=s,this.size=t.size}size;static [n]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${"number"==typeof this.size?this.size:""}]`}mapFromDriverValue(e){return"string"==typeof e&&(e=function(e){let[t]=function e(t,i=0){let s=[],r=i,n=!1;for(;r<t.length;){let a=t[r];if(","===a){(n||r===i)&&s.push(""),n=!0,r++;continue}if(n=!1,"\\"===a){r+=2;continue}if('"'===a){let[e,i]=E(t,r+1,!0);s.push(e),r=i;continue}if("}"===a)return[s,r+1];if("{"===a){let[i,n]=e(t,r+1);s.push(i),r=n;continue}let[l,o]=E(t,r,!1);s.push(l),r=o}return[s,r]}(e,1);return t}(e)),e.map(e=>this.baseColumn.mapFromDriverValue(e))}mapToDriverValue(e,t=!1){let i=e.map(e=>null===e?null:a(this.baseColumn,A)?this.baseColumn.mapToDriverValue(e,!0):this.baseColumn.mapToDriverValue(e));return t?i:function e(t){return`{${t.map(t=>Array.isArray(t)?e(t):"string"==typeof t?`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:`${t}`).join(",")}}`}(i)}}let F=Symbol.for("drizzle:isPgEnum");class j extends B{static [n]="PgEnumColumnBuilder";constructor(e,t){super(e,"string","PgEnumColumn"),this.config.enum=t}build(e){return new I(e,this.config)}}class I extends _{static [n]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor(e,t){super(e,t),this.enum=t.enum}getSQLType(){return this.enum.enumName}}class R{static [n]="Subquery";constructor(e,t,i,s=!1){this._={brand:"Subquery",sql:e,selectedFields:t,alias:i,isWith:s}}}class V extends R{static [n]="WithSubquery"}let U=(e,s)=>t?(i||(i=t.trace.getTracer("drizzle-orm","0.38.4")),x((t,i)=>i.startActiveSpan(e,e=>{try{return s(e)}catch(i){throw e.setStatus({code:t.SpanStatusCode.ERROR,message:i instanceof Error?i.message:"Unknown error"}),i}finally{e.end()}}),t,i)):s(),z=Symbol.for("drizzle:ViewBaseConfig");class M{static [n]="FakePrimitiveParam"}function K(e){return null!=e&&"function"==typeof e.getSQL}class k{static [n]="StringChunk";value;constructor(e){this.value=Array.isArray(e)?e:[e]}getSQL(){return new J([this])}}class J{constructor(e){this.queryChunks=e}static [n]="SQL";decoder=G;shouldInlineParams=!1;append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return U("drizzle.buildSQL",t=>{let i=this.buildQueryFromSourceParams(this.queryChunks,e);return t?.setAttributes({"drizzle.query.text":i.sql,"drizzle.query.params":JSON.stringify(i.params)}),i})}buildQueryFromSourceParams(e,t){let i=Object.assign({},t,{inlineParams:t.inlineParams||this.shouldInlineParams,paramStartIndex:t.paramStartIndex||{value:0}}),{casing:s,escapeName:r,escapeParam:n,prepareTyping:l,inlineParams:o,paramStartIndex:u}=i;var c=e.map(e=>{if(a(e,k))return{sql:e.value.join(""),params:[]};if(a(e,X))return{sql:r(e.value),params:[]};if(void 0===e)return{sql:"",params:[]};if(Array.isArray(e)){let t=[new k("(")];for(let[i,s]of e.entries())t.push(s),i<e.length-1&&t.push(new k(", "));return t.push(new k(")")),this.buildQueryFromSourceParams(t,i)}if(a(e,J))return this.buildQueryFromSourceParams(e.queryChunks,{...i,inlineParams:o||e.shouldInlineParams});if(a(e,S)){let t=e[S.Symbol.Schema],i=e[S.Symbol.Name];return{sql:void 0===t?r(i):r(t)+"."+r(i),params:[]}}if(a(e,T)){let i=s.getColumnCasing(e);if("indexes"===t.invokeSource)return{sql:r(i),params:[]};let n=e.table[S.Symbol.Schema];return{sql:e.table[g]||void 0===n?r(e.table[S.Symbol.Name])+"."+r(i):r(n)+"."+r(e.table[S.Symbol.Name])+"."+r(i),params:[]}}if(a(e,er)){let t=e[z].schema,i=e[z].name;return{sql:void 0===t?r(i):r(t)+"."+r(i),params:[]}}if(a(e,Y)){if(a(e.value,et))return{sql:n(u.value++,e),params:[e],typings:["none"]};let t=null===e.value?null:e.encoder.mapToDriverValue(e.value);if(a(t,J))return this.buildQueryFromSourceParams([t],i);if(o)return{sql:this.mapInlineParam(t,i),params:[]};let s=["none"];return l&&(s=[l(e.encoder)]),{sql:n(u.value++,t),params:[t],typings:s}}return a(e,et)?{sql:n(u.value++,e),params:[e],typings:["none"]}:a(e,J.Aliased)&&void 0!==e.fieldAlias?{sql:r(e.fieldAlias),params:[]}:a(e,R)?e._.isWith?{sql:r(e._.alias),params:[]}:this.buildQueryFromSourceParams([new k("("),e._.sql,new k(") "),new X(e._.alias)],i):e&&"function"==typeof e&&F in e&&!0===e[F]?e.schema?{sql:r(e.schema)+"."+r(e.enumName),params:[]}:{sql:r(e.enumName),params:[]}:K(e)?e.shouldOmitSQLParens?.()?this.buildQueryFromSourceParams([e.getSQL()],i):this.buildQueryFromSourceParams([new k("("),e.getSQL(),new k(")")],i):o?{sql:this.mapInlineParam(e,i),params:[]}:{sql:n(u.value++,e),params:[e],typings:["none"]}});let h={sql:"",params:[]};for(let e of c)h.sql+=e.sql,h.params.push(...e.params),e.typings?.length&&(h.typings||(h.typings=[]),h.typings.push(...e.typings));return h}mapInlineParam(e,{escapeString:t}){if(null===e)return"null";if("number"==typeof e||"boolean"==typeof e)return e.toString();if("string"==typeof e)return t(e);if("object"==typeof e){let i=e.toString();return"[object Object]"===i?t(JSON.stringify(e)):t(i)}throw Error("Unexpected param value: "+e)}getSQL(){return this}as(e){return void 0===e?this:new J.Aliased(this,e)}mapWith(e){return this.decoder="function"==typeof e?{mapFromDriverValue:e}:e,this}inlineParams(){return this.shouldInlineParams=!0,this}if(e){return e?this:void 0}}class X{constructor(e){this.value=e}static [n]="Name";brand;getSQL(){return new J([this])}}let G={mapFromDriverValue:e=>e},W={mapToDriverValue:e=>e};({...G,...W});class Y{constructor(e,t=W){this.value=e,this.encoder=t}static [n]="Param";brand;getSQL(){return new J([this])}}function H(e,...t){let i=[];for(let[s,r]of((t.length>0||e.length>0&&""!==e[0])&&i.push(new k(e[0])),t.entries()))i.push(r,new k(e[s+1]));return new J(i)}(s=H||(H={})).empty=function(){return new J([])},s.fromList=function(e){return new J(e)},s.raw=function(e){return new J([new k(e)])},s.join=function(e,t){let i=[];for(let[s,r]of e.entries())s>0&&void 0!==t&&i.push(t),i.push(r);return new J(i)},s.identifier=function(e){return new X(e)},s.placeholder=function(e){return new et(e)},s.param=function(e,t){return new Y(e,t)};var Z=J||(J={});class ee{constructor(e,t){this.sql=e,this.fieldAlias=t}static [n]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new ee(this.sql,this.fieldAlias)}}Z.Aliased=ee;class et{constructor(e){this.name=e}static [n]="Placeholder";getSQL(){return new J([this])}}function ei(e,t){return e.map(e=>{if(a(e,et)){if(!(e.name in t))throw Error(`No value for placeholder "${e.name}" was provided`);return t[e.name]}if(a(e,Y)&&a(e.value,et)){if(!(e.value.name in t))throw Error(`No value for placeholder "${e.value.name}" was provided`);return e.encoder.mapToDriverValue(t[e.value.name])}return e})}let es=Symbol.for("drizzle:IsDrizzleView");class er{static [n]="View";[z];[es]=!0;constructor({name:e,schema:t,selectedFields:i,query:s}){this[z]={name:e,originalName:e,schema:t,selectedFields:i,query:s,isExisting:!s,isAlias:!1}}getSQL(){return new J([this])}}function en(e,t,i){let s={},r=e.reduce((e,{path:r,field:n},l)=>{let o;o=a(n,T)?n:a(n,J)?n.decoder:n.sql.decoder;let u=e;for(let[e,h]of r.entries())if(e<r.length-1)h in u||(u[h]={}),u=u[h];else{let e=t[l],d=u[h]=null===e?null:o.mapFromDriverValue(e);if(i&&a(n,T)&&2===r.length){let e=r[0];e in s?"string"==typeof s[e]&&s[e]!==n.table[c]&&(s[e]=!1):s[e]=null===d&&n.table[c]}}return e},{});if(i&&Object.keys(s).length>0)for(let[e,t]of Object.entries(s))"string"!=typeof t||i[t]||(r[e]=null);return r}function ea(e,t){return Object.entries(e).reduce((e,[i,s])=>{if("string"!=typeof i)return e;let r=t?[...t,i]:[i];return a(s,T)||a(s,J)||a(s,J.Aliased)?e.push({path:r,field:s}):a(s,S)?e.push(...ea(s[S.Symbol.Columns],r)):e.push(...ea(s,r)),e},[])}function el(e,t){let i=Object.keys(e),s=Object.keys(t);if(i.length!==s.length)return!1;for(let[e,t]of i.entries())if(t!==s[e])return!1;return!0}function eo(e,t){let i=Object.entries(t).filter(([,e])=>void 0!==e).map(([t,i])=>a(i,J)||a(i,T)?[t,i]:[t,new Y(i,e[S.Symbol.Columns][t])]);if(0===i.length)throw Error("No values to set");return Object.fromEntries(i)}function eu(e){return a(e,R)?e._.alias:a(e,er)?e[z].name:a(e,J)?void 0:e[S.Symbol.IsAlias]?e[S.Symbol.Name]:e[S.Symbol.BaseName]}function ec(e,t){return{name:"string"==typeof e&&e.length>0?e:"",config:"object"==typeof e?e:t}}T.prototype.getSQL=function(){return new J([this])},S.prototype.getSQL=function(){return new J([this])},R.prototype.getSQL=function(){return new J([this])};class eh extends B{static [n]="PgIntColumnBaseBuilder";generatedAlwaysAsIdentity(e){if(e){let{name:t,...i}=e;this.config.generatedIdentity={type:"always",sequenceName:t,sequenceOptions:i}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity(e){if(e){let{name:t,...i}=e;this.config.generatedIdentity={type:"byDefault",sequenceName:t,sequenceOptions:i}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}}class ed extends eh{static [n]="PgBigInt53Builder";constructor(e){super(e,"number","PgBigInt53")}build(e){return new em(e,this.config)}}class em extends _{static [n]="PgBigInt53";getSQLType(){return"bigint"}mapFromDriverValue(e){return"number"==typeof e?e:Number(e)}}class ef extends eh{static [n]="PgBigInt64Builder";constructor(e){super(e,"bigint","PgBigInt64")}build(e){return new ep(e,this.config)}}class ep extends _{static [n]="PgBigInt64";getSQLType(){return"bigint"}mapFromDriverValue(e){return BigInt(e)}}class eg extends B{static [n]="PgBigSerial53Builder";constructor(e){super(e,"number","PgBigSerial53"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new ey(e,this.config)}}class ey extends _{static [n]="PgBigSerial53";getSQLType(){return"bigserial"}mapFromDriverValue(e){return"number"==typeof e?e:Number(e)}}class eb extends B{static [n]="PgBigSerial64Builder";constructor(e){super(e,"bigint","PgBigSerial64"),this.config.hasDefault=!0}build(e){return new eS(e,this.config)}}class eS extends _{static [n]="PgBigSerial64";getSQLType(){return"bigserial"}mapFromDriverValue(e){return BigInt(e)}}class ew extends B{static [n]="PgBooleanBuilder";constructor(e){super(e,"boolean","PgBoolean")}build(e){return new eT(e,this.config)}}class eT extends _{static [n]="PgBoolean";getSQLType(){return"boolean"}}class eN extends B{static [n]="PgCharBuilder";constructor(e,t){super(e,"string","PgChar"),this.config.length=t.length,this.config.enumValues=t.enum}build(e){return new ev(e,this.config)}}class ev extends _{static [n]="PgChar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return void 0===this.length?"char":`char(${this.length})`}}class eL extends B{static [n]="PgCidrBuilder";constructor(e){super(e,"string","PgCidr")}build(e){return new ex(e,this.config)}}class ex extends _{static [n]="PgCidr";getSQLType(){return"cidr"}}class e$ extends B{static [n]="PgCustomColumnBuilder";constructor(e,t,i){super(e,"custom","PgCustomColumn"),this.config.fieldConfig=t,this.config.customTypeParams=i}build(e){return new eQ(e,this.config)}}class eQ extends _{static [n]="PgCustomColumn";sqlName;mapTo;mapFrom;constructor(e,t){super(e,t),this.sqlName=t.customTypeParams.dataType(t.fieldConfig),this.mapTo=t.customTypeParams.toDriver,this.mapFrom=t.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(e){return"function"==typeof this.mapFrom?this.mapFrom(e):e}mapToDriverValue(e){return"function"==typeof this.mapTo?this.mapTo(e):e}}class eP extends B{static [n]="PgDateColumnBaseBuilder";defaultNow(){return this.default(H`now()`)}}class eC extends eP{static [n]="PgDateBuilder";constructor(e){super(e,"date","PgDate")}build(e){return new eE(e,this.config)}}class eE extends _{static [n]="PgDate";getSQLType(){return"date"}mapFromDriverValue(e){return new Date(e)}mapToDriverValue(e){return e.toISOString()}}class eB extends eP{static [n]="PgDateStringBuilder";constructor(e){super(e,"string","PgDateString")}build(e){return new e_(e,this.config)}}class e_ extends _{static [n]="PgDateString";getSQLType(){return"date"}}class eq extends B{static [n]="PgDoublePrecisionBuilder";constructor(e){super(e,"number","PgDoublePrecision")}build(e){return new eD(e,this.config)}}class eD extends _{static [n]="PgDoublePrecision";getSQLType(){return"double precision"}mapFromDriverValue(e){return"string"==typeof e?Number.parseFloat(e):e}}class eO extends B{static [n]="PgInetBuilder";constructor(e){super(e,"string","PgInet")}build(e){return new eA(e,this.config)}}class eA extends _{static [n]="PgInet";getSQLType(){return"inet"}}class eF extends eh{static [n]="PgIntegerBuilder";constructor(e){super(e,"number","PgInteger")}build(e){return new ej(e,this.config)}}class ej extends _{static [n]="PgInteger";getSQLType(){return"integer"}mapFromDriverValue(e){return"string"==typeof e?Number.parseInt(e):e}}class eI extends B{static [n]="PgIntervalBuilder";constructor(e,t){super(e,"string","PgInterval"),this.config.intervalConfig=t}build(e){return new eR(e,this.config)}}class eR extends _{static [n]="PgInterval";fields=this.config.intervalConfig.fields;precision=this.config.intervalConfig.precision;getSQLType(){let e=this.fields?` ${this.fields}`:"",t=this.precision?`(${this.precision})`:"";return`interval${e}${t}`}}class eV extends B{static [n]="PgJsonBuilder";constructor(e){super(e,"json","PgJson")}build(e){return new eU(e,this.config)}}class eU extends _{static [n]="PgJson";constructor(e,t){super(e,t)}getSQLType(){return"json"}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if("string"==typeof e)try{return JSON.parse(e)}catch{}return e}}class ez extends B{static [n]="PgJsonbBuilder";constructor(e){super(e,"json","PgJsonb")}build(e){return new eM(e,this.config)}}class eM extends _{static [n]="PgJsonb";constructor(e,t){super(e,t)}getSQLType(){return"jsonb"}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if("string"==typeof e)try{return JSON.parse(e)}catch{}return e}}class eK extends B{static [n]="PgLineBuilder";constructor(e){super(e,"array","PgLine")}build(e){return new ek(e,this.config)}}class ek extends _{static [n]="PgLine";getSQLType(){return"line"}mapFromDriverValue(e){let[t,i,s]=e.slice(1,-1).split(",");return[Number.parseFloat(t),Number.parseFloat(i),Number.parseFloat(s)]}mapToDriverValue(e){return`{${e[0]},${e[1]},${e[2]}}`}}class eJ extends B{static [n]="PgLineABCBuilder";constructor(e){super(e,"json","PgLineABC")}build(e){return new eX(e,this.config)}}class eX extends _{static [n]="PgLineABC";getSQLType(){return"line"}mapFromDriverValue(e){let[t,i,s]=e.slice(1,-1).split(",");return{a:Number.parseFloat(t),b:Number.parseFloat(i),c:Number.parseFloat(s)}}mapToDriverValue(e){return`{${e.a},${e.b},${e.c}}`}}class eG extends B{static [n]="PgMacaddrBuilder";constructor(e){super(e,"string","PgMacaddr")}build(e){return new eW(e,this.config)}}class eW extends _{static [n]="PgMacaddr";getSQLType(){return"macaddr"}}class eY extends B{static [n]="PgMacaddr8Builder";constructor(e){super(e,"string","PgMacaddr8")}build(e){return new eH(e,this.config)}}class eH extends _{static [n]="PgMacaddr8";getSQLType(){return"macaddr8"}}class eZ extends B{static [n]="PgNumericBuilder";constructor(e,t,i){super(e,"string","PgNumeric"),this.config.precision=t,this.config.scale=i}build(e){return new e0(e,this.config)}}class e0 extends _{static [n]="PgNumeric";precision;scale;constructor(e,t){super(e,t),this.precision=t.precision,this.scale=t.scale}getSQLType(){return void 0!==this.precision&&void 0!==this.scale?`numeric(${this.precision}, ${this.scale})`:void 0===this.precision?"numeric":`numeric(${this.precision})`}}class e1 extends B{static [n]="PgPointTupleBuilder";constructor(e){super(e,"array","PgPointTuple")}build(e){return new e2(e,this.config)}}class e2 extends _{static [n]="PgPointTuple";getSQLType(){return"point"}mapFromDriverValue(e){if("string"==typeof e){let[t,i]=e.slice(1,-1).split(",");return[Number.parseFloat(t),Number.parseFloat(i)]}return[e.x,e.y]}mapToDriverValue(e){return`(${e[0]},${e[1]})`}}class e4 extends B{static [n]="PgPointObjectBuilder";constructor(e){super(e,"json","PgPointObject")}build(e){return new e3(e,this.config)}}class e3 extends _{static [n]="PgPointObject";getSQLType(){return"point"}mapFromDriverValue(e){if("string"==typeof e){let[t,i]=e.slice(1,-1).split(",");return{x:Number.parseFloat(t),y:Number.parseFloat(i)}}return e}mapToDriverValue(e){return`(${e.x},${e.y})`}}function e5(e,t){let i=new DataView(new ArrayBuffer(8));for(let s=0;s<8;s++)i.setUint8(s,e[t+s]);return i.getFloat64(0,!0)}function e6(e){let t=function(e){let t=[];for(let i=0;i<e.length;i+=2)t.push(Number.parseInt(e.slice(i,i+2),16));return new Uint8Array(t)}(e),i=0,s=t[0];i+=1;let r=new DataView(t.buffer),n=r.getUint32(i,1===s);if(i+=4,0x20000000&n&&(r.getUint32(i,1===s),i+=4),(65535&n)==1){let e=e5(t,i),s=e5(t,i+=8);return i+=8,[e,s]}throw Error("Unsupported geometry type")}class e8 extends B{static [n]="PgGeometryBuilder";constructor(e){super(e,"array","PgGeometry")}build(e){return new e7(e,this.config)}}class e7 extends _{static [n]="PgGeometry";getSQLType(){return"geometry(point)"}mapFromDriverValue(e){return e6(e)}mapToDriverValue(e){return`point(${e[0]} ${e[1]})`}}class e9 extends B{static [n]="PgGeometryObjectBuilder";constructor(e){super(e,"json","PgGeometryObject")}build(e){return new te(e,this.config)}}class te extends _{static [n]="PgGeometryObject";getSQLType(){return"geometry(point)"}mapFromDriverValue(e){let t=e6(e);return{x:t[0],y:t[1]}}mapToDriverValue(e){return`point(${e.x} ${e.y})`}}class tt extends B{static [n]="PgRealBuilder";constructor(e,t){super(e,"number","PgReal"),this.config.length=t}build(e){return new ti(e,this.config)}}class ti extends _{static [n]="PgReal";constructor(e,t){super(e,t)}getSQLType(){return"real"}mapFromDriverValue=e=>"string"==typeof e?Number.parseFloat(e):e}class ts extends B{static [n]="PgSerialBuilder";constructor(e){super(e,"number","PgSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new tr(e,this.config)}}class tr extends _{static [n]="PgSerial";getSQLType(){return"serial"}}class tn extends eh{static [n]="PgSmallIntBuilder";constructor(e){super(e,"number","PgSmallInt")}build(e){return new ta(e,this.config)}}class ta extends _{static [n]="PgSmallInt";getSQLType(){return"smallint"}mapFromDriverValue=e=>"string"==typeof e?Number(e):e}class tl extends B{static [n]="PgSmallSerialBuilder";constructor(e){super(e,"number","PgSmallSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new to(e,this.config)}}class to extends _{static [n]="PgSmallSerial";getSQLType(){return"smallserial"}}class tu extends B{static [n]="PgTextBuilder";constructor(e,t){super(e,"string","PgText"),this.config.enumValues=t.enum}build(e){return new tc(e,this.config)}}class tc extends _{static [n]="PgText";enumValues=this.config.enumValues;getSQLType(){return"text"}}class th extends eP{constructor(e,t,i){super(e,"string","PgTime"),this.withTimezone=t,this.precision=i,this.config.withTimezone=t,this.config.precision=i}static [n]="PgTimeBuilder";build(e){return new td(e,this.config)}}class td extends _{static [n]="PgTime";withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){let e=void 0===this.precision?"":`(${this.precision})`;return`time${e}${this.withTimezone?" with time zone":""}`}}class tm extends eP{static [n]="PgTimestampBuilder";constructor(e,t,i){super(e,"date","PgTimestamp"),this.config.withTimezone=t,this.config.precision=i}build(e){return new tf(e,this.config)}}class tf extends _{static [n]="PgTimestamp";withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){let e=void 0===this.precision?"":` (${this.precision})`;return`timestamp${e}${this.withTimezone?" with time zone":""}`}mapFromDriverValue=e=>new Date(this.withTimezone?e:e+"+0000");mapToDriverValue=e=>e.toISOString()}class tp extends eP{static [n]="PgTimestampStringBuilder";constructor(e,t,i){super(e,"string","PgTimestampString"),this.config.withTimezone=t,this.config.precision=i}build(e){return new tg(e,this.config)}}class tg extends _{static [n]="PgTimestampString";withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){let e=void 0===this.precision?"":`(${this.precision})`;return`timestamp${e}${this.withTimezone?" with time zone":""}`}}class ty extends B{static [n]="PgUUIDBuilder";constructor(e){super(e,"string","PgUUID")}defaultRandom(){return this.default(H`gen_random_uuid()`)}build(e){return new tb(e,this.config)}}class tb extends _{static [n]="PgUUID";getSQLType(){return"uuid"}}class tS extends B{static [n]="PgVarcharBuilder";constructor(e,t){super(e,"string","PgVarchar"),this.config.length=t.length,this.config.enumValues=t.enum}build(e){return new tw(e,this.config)}}class tw extends _{static [n]="PgVarchar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return void 0===this.length?"varchar":`varchar(${this.length})`}}class tT extends B{static [n]="PgBinaryVectorBuilder";constructor(e,t){super(e,"string","PgBinaryVector"),this.config.dimensions=t.dimensions}build(e){return new tN(e,this.config)}}class tN extends _{static [n]="PgBinaryVector";dimensions=this.config.dimensions;getSQLType(){return`bit(${this.dimensions})`}}class tv extends B{static [n]="PgHalfVectorBuilder";constructor(e,t){super(e,"array","PgHalfVector"),this.config.dimensions=t.dimensions}build(e){return new tL(e,this.config)}}class tL extends _{static [n]="PgHalfVector";dimensions=this.config.dimensions;getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){return e.slice(1,-1).split(",").map(e=>Number.parseFloat(e))}}class tx extends B{static [n]="PgSparseVectorBuilder";constructor(e,t){super(e,"string","PgSparseVector"),this.config.dimensions=t.dimensions}build(e){return new t$(e,this.config)}}class t$ extends _{static [n]="PgSparseVector";dimensions=this.config.dimensions;getSQLType(){return`sparsevec(${this.dimensions})`}}class tQ extends B{static [n]="PgVectorBuilder";constructor(e,t){super(e,"array","PgVector"),this.config.dimensions=t.dimensions}build(e){return new tP(e,this.config)}}class tP extends _{static [n]="PgVector";dimensions=this.config.dimensions;getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){return e.slice(1,-1).split(",").map(e=>Number.parseFloat(e))}}let tC=Symbol.for("drizzle:PgInlineForeignKeys"),tE=Symbol.for("drizzle:EnableRLS");class tB extends S{static [n]="PgTable";static Symbol=Object.assign({},S.Symbol,{InlineForeignKeys:tC,EnableRLS:tE});[tC]=[];[tE]=!1;[S.Symbol.ExtraConfigBuilder]=void 0}class t_{static [n]="PgPrimaryKeyBuilder";columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new tq(e,this.columns,this.name)}}class tq{constructor(e,t,i){this.table=e,this.columns=t,this.name=i}static [n]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[tB.Symbol.Name]}_${this.columns.map(e=>e.name).join("_")}_pk`}}function tD(e,t){return"object"!=typeof t||null===t||!("mapToDriverValue"in t)||"function"!=typeof t.mapToDriverValue||K(e)||a(e,Y)||a(e,et)||a(e,T)||a(e,S)||a(e,er)?e:new Y(e,t)}let tO=(e,t)=>H`${e} = ${tD(t,e)}`,tA=(e,t)=>H`${e} <> ${tD(t,e)}`;function tF(...e){let t=e.filter(e=>void 0!==e);if(0!==t.length)return new J(1===t.length?t:[new k("("),H.join(t,new k(" and ")),new k(")")])}function tj(...e){let t=e.filter(e=>void 0!==e);if(0!==t.length)return new J(1===t.length?t:[new k("("),H.join(t,new k(" or ")),new k(")")])}function tI(e){return H`not ${e}`}let tR=(e,t)=>H`${e} > ${tD(t,e)}`,tV=(e,t)=>H`${e} >= ${tD(t,e)}`,tU=(e,t)=>H`${e} < ${tD(t,e)}`,tz=(e,t)=>H`${e} <= ${tD(t,e)}`;function tM(e,t){return Array.isArray(t)?0===t.length?H`false`:H`${e} in ${t.map(t=>tD(t,e))}`:H`${e} in ${tD(t,e)}`}function tK(e,t){return Array.isArray(t)?0===t.length?H`true`:H`${e} not in ${t.map(t=>tD(t,e))}`:H`${e} not in ${tD(t,e)}`}function tk(e){return H`${e} is null`}function tJ(e){return H`${e} is not null`}function tX(e){return H`exists ${e}`}function tG(e){return H`not exists ${e}`}function tW(e,t,i){return H`${e} between ${tD(t,e)} and ${tD(i,e)}`}function tY(e,t,i){return H`${e} not between ${tD(t,e)} and ${tD(i,e)}`}function tH(e,t){return H`${e} like ${t}`}function tZ(e,t){return H`${e} not like ${t}`}function t0(e,t){return H`${e} ilike ${t}`}function t1(e,t){return H`${e} not ilike ${t}`}function t2(e){return H`${e} asc`}function t4(e){return H`${e} desc`}e.s(["and",()=>tF,"between",()=>tW,"eq",()=>tO,"exists",()=>tX,"gt",()=>tR,"gte",()=>tV,"ilike",()=>t0,"inArray",()=>tM,"isNotNull",()=>tJ,"isNull",()=>tk,"like",()=>tH,"lt",()=>tU,"lte",()=>tz,"ne",()=>tA,"not",()=>tI,"notBetween",()=>tY,"notExists",()=>tG,"notIlike",()=>t1,"notInArray",()=>tK,"notLike",()=>tZ,"or",()=>tj],422124),e.s(["asc",()=>t2,"desc",()=>t4],679174);class t3{constructor(e,t,i){this.sourceTable=e,this.referencedTable=t,this.relationName=i,this.referencedTableName=t[S.Symbol.Name]}static [n]="Relation";referencedTableName;fieldName}class t5{constructor(e,t){this.table=e,this.config=t}static [n]="Relations"}class t6 extends t3{constructor(e,t,i,s){super(e,t,i?.relationName),this.config=i,this.isNullable=s}static [n]="One";withFieldName(e){let t=new t6(this.sourceTable,this.referencedTable,this.config,this.isNullable);return t.fieldName=e,t}}class t8 extends t3{constructor(e,t,i){super(e,t,i?.relationName),this.config=i}static [n]="Many";withFieldName(e){let t=new t8(this.sourceTable,this.referencedTable,this.config);return t.fieldName=e,t}}function t7(e,t){return new t5(e,e=>Object.fromEntries(Object.entries(t(e)).map(([e,t])=>[e,t.withFieldName(e)])))}function t9(e){return{one:function(t,i){return new t6(e,t,i,i?.fields.reduce((e,t)=>e&&t.notNull,!0)??!1)},many:function(t,i){return new t8(e,t,i)}}}class ie{constructor(e){this.table=e}static [n]="ColumnAliasProxyHandler";get(e,t){return"table"===t?this.table:e[t]}}class it{constructor(e,t){this.alias=e,this.replaceOriginalName=t}static [n]="TableAliasProxyHandler";get(e,t){if(t===S.Symbol.IsAlias)return!0;if(t===S.Symbol.Name||this.replaceOriginalName&&t===S.Symbol.OriginalName)return this.alias;if(t===z)return{...e[z],name:this.alias,isAlias:!0};if(t===S.Symbol.Columns){let t=e[S.Symbol.Columns];if(!t)return t;let i={};return Object.keys(t).map(s=>{i[s]=new Proxy(t[s],new ie(new Proxy(e,this)))}),i}let i=e[t];return a(i,T)?new Proxy(i,new ie(new Proxy(e,this))):i}}class ii{constructor(e){this.alias=e}static [n]="RelationTableAliasProxyHandler";get(e,t){return"sourceTable"===t?is(e.sourceTable,this.alias):e[t]}}function is(e,t){return new Proxy(e,new it(t,!1))}function ir(e,t){return new Proxy(e,new ie(new Proxy(e.table,new it(t,!1))))}function ia(e,t){return new J.Aliased(il(e.sql,t),e.fieldAlias)}function il(e,t){return H.join(e.queryChunks.map(e=>a(e,T)?ir(e,t):a(e,J)?il(e,t):a(e,J.Aliased)?ia(e,t):e))}class io{static [n]="SelectionProxyHandler";config;constructor(e){this.config={...e}}get(e,t){if("_"===t)return{...e._,selectedFields:new Proxy(e._.selectedFields,this)};if(t===z)return{...e[z],selectedFields:new Proxy(e[z].selectedFields,this)};if("symbol"==typeof t)return e[t];let i=(a(e,R)?e._.selectedFields:a(e,er)?e[z].selectedFields:e)[t];if(a(i,J.Aliased)){if("sql"===this.config.sqlAliasedBehavior&&!i.isSelectionField)return i.sql;let e=i.clone();return e.isSelectionField=!0,e}if(a(i,J)){if("sql"===this.config.sqlBehavior)return i;throw Error(`You tried to reference "${t}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return a(i,T)?this.config.alias?new Proxy(i,new ie(new Proxy(i.table,new it(this.config.alias,this.config.replaceOriginalName??!1)))):i:"object"!=typeof i||null===i?i:new Proxy(i,new io(this.config))}}function iu(e){return(e.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map(e=>e.toLowerCase()).join("_")}function ic(e){return(e.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((e,t,i)=>e+(0===i?t.toLowerCase():`${t[0].toUpperCase()}${t.slice(1)}`),"")}function ih(e){return e}class id{static [n]="CasingCache";cache={};cachedTables={};convert;constructor(e){this.convert="snake_case"===e?iu:"camelCase"===e?ic:ih}getColumnCasing(e){if(!e.keyAsName)return e.name;let t=e.table[S.Symbol.Schema]??"public",i=e.table[S.Symbol.OriginalName],s=`${t}.${i}.${e.name}`;return this.cache[s]||this.cacheTable(e.table),this.cache[s]}cacheTable(e){let t=e[S.Symbol.Schema]??"public",i=e[S.Symbol.OriginalName],s=`${t}.${i}`;if(!this.cachedTables[s]){for(let t of Object.values(e[S.Symbol.Columns])){let e=`${s}.${t.name}`;this.cache[e]=this.convert(t.name)}this.cachedTables[s]=!0}}clearCache(){this.cache={},this.cachedTables={}}}class im extends Error{static [n]="DrizzleError";constructor({message:e,cause:t}){super(e),this.name="DrizzleError",this.cause=t}}class ip extends im{static [n]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}class ig{static [n]="SQLiteForeignKeyBuilder";reference;_onUpdate;_onDelete;constructor(e,t){this.reference=()=>{let{name:t,columns:i,foreignColumns:s}=e();return{name:t,columns:i,foreignTable:s[0].table,foreignColumns:s}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=e,this}onDelete(e){return this._onDelete=e,this}build(e){return new iy(e,this)}}class iy{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static [n]="SQLiteForeignKey";reference;onUpdate;onDelete;getName(){let{name:e,columns:t,foreignColumns:i}=this.reference(),s=t.map(e=>e.name),r=i.map(e=>e.name),n=[this.table[c],...s,i[0].table[c],...r];return e??`${n.join("_")}_fk`}}function ib(e,t){return`${e[c]}_${t.join("_")}_unique`}class iS{constructor(e,t){this.name=t,this.columns=e}static [n]="SQLiteUniqueConstraintBuilder";columns;build(e){return new iT(e,this.columns,this.name)}}class iw{static [n]="SQLiteUniqueOnConstraintBuilder";name;constructor(e){this.name=e}on(...e){return new iS(e,this.name)}}class iT{constructor(e,t,i){this.table=e,this.columns=t,this.name=i??ib(this.table,this.columns.map(e=>e.name))}static [n]="SQLiteUniqueConstraint";columns;name;getName(){return this.name}}class iN extends N{static [n]="SQLiteColumnBuilder";foreignKeyConfigs=[];references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e){return this.config.isUnique=!0,this.config.uniqueName=e,this}generatedAlwaysAs(e,t){return this.config.generated={as:e,type:"always",mode:t?.mode??"virtual"},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:i,actions:s})=>{let r;return r=new ig(()=>({columns:[e],foreignColumns:[i()]})),s.onUpdate&&r.onUpdate(s.onUpdate),s.onDelete&&r.onDelete(s.onDelete),r.build(t)})}}class iv extends T{constructor(e,t){t.uniqueName||(t.uniqueName=ib(e,[t.name])),super(e,t),this.table=e}static [n]="SQLiteColumn"}class iL extends iN{static [n]="SQLiteBigIntBuilder";constructor(e){super(e,"bigint","SQLiteBigInt")}build(e){return new ix(e,this.config)}}class ix extends iv{static [n]="SQLiteBigInt";getSQLType(){return"blob"}mapFromDriverValue(e){return Buffer.isBuffer(e)?BigInt(e.toString()):e instanceof ArrayBuffer?BigInt(new TextDecoder().decode(e)):BigInt(String.fromCodePoint(...e))}mapToDriverValue(e){return Buffer.from(e.toString())}}class i$ extends iN{static [n]="SQLiteBlobJsonBuilder";constructor(e){super(e,"json","SQLiteBlobJson")}build(e){return new iQ(e,this.config)}}class iQ extends iv{static [n]="SQLiteBlobJson";getSQLType(){return"blob"}mapFromDriverValue(e){return Buffer.isBuffer(e)?JSON.parse(e.toString()):e instanceof ArrayBuffer?JSON.parse(new TextDecoder().decode(e)):JSON.parse(String.fromCodePoint(...e))}mapToDriverValue(e){return Buffer.from(JSON.stringify(e))}}class iP extends iN{static [n]="SQLiteBlobBufferBuilder";constructor(e){super(e,"buffer","SQLiteBlobBuffer")}build(e){return new iC(e,this.config)}}class iC extends iv{static [n]="SQLiteBlobBuffer";getSQLType(){return"blob"}}function iE(e,t){let{name:i,config:s}=ec(e,t);return s?.mode==="json"?new i$(i):s?.mode==="bigint"?new iL(i):new iP(i)}class iB extends iN{static [n]="SQLiteCustomColumnBuilder";constructor(e,t,i){super(e,"custom","SQLiteCustomColumn"),this.config.fieldConfig=t,this.config.customTypeParams=i}build(e){return new i_(e,this.config)}}class i_ extends iv{static [n]="SQLiteCustomColumn";sqlName;mapTo;mapFrom;constructor(e,t){super(e,t),this.sqlName=t.customTypeParams.dataType(t.fieldConfig),this.mapTo=t.customTypeParams.toDriver,this.mapFrom=t.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(e){return"function"==typeof this.mapFrom?this.mapFrom(e):e}mapToDriverValue(e){return"function"==typeof this.mapTo?this.mapTo(e):e}}function iq(e){return(t,i)=>{let{name:s,config:r}=ec(t,i);return new iB(s,r,e)}}class iD extends iN{static [n]="SQLiteBaseIntegerBuilder";constructor(e,t,i){super(e,t,i),this.config.autoIncrement=!1}primaryKey(e){return e?.autoIncrement&&(this.config.autoIncrement=!0),this.config.hasDefault=!0,super.primaryKey()}}class iO extends iv{static [n]="SQLiteBaseInteger";autoIncrement=this.config.autoIncrement;getSQLType(){return"integer"}}class iA extends iD{static [n]="SQLiteIntegerBuilder";constructor(e){super(e,"number","SQLiteInteger")}build(e){return new iF(e,this.config)}}class iF extends iO{static [n]="SQLiteInteger"}class ij extends iD{static [n]="SQLiteTimestampBuilder";constructor(e,t){super(e,"date","SQLiteTimestamp"),this.config.mode=t}defaultNow(){return this.default(H`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build(e){return new iI(e,this.config)}}class iI extends iO{static [n]="SQLiteTimestamp";mode=this.config.mode;mapFromDriverValue(e){return new Date("timestamp"===this.config.mode?1e3*e:e)}mapToDriverValue(e){let t=e.getTime();return"timestamp"===this.config.mode?Math.floor(t/1e3):t}}class iR extends iD{static [n]="SQLiteBooleanBuilder";constructor(e,t){super(e,"boolean","SQLiteBoolean"),this.config.mode=t}build(e){return new iV(e,this.config)}}class iV extends iO{static [n]="SQLiteBoolean";mode=this.config.mode;mapFromDriverValue(e){return 1===Number(e)}mapToDriverValue(e){return+!!e}}function iU(e,t){let{name:i,config:s}=ec(e,t);return s?.mode==="timestamp"||s?.mode==="timestamp_ms"?new ij(i,s.mode):s?.mode==="boolean"?new iR(i,s.mode):new iA(i)}class iz extends iN{static [n]="SQLiteNumericBuilder";constructor(e){super(e,"string","SQLiteNumeric")}build(e){return new iM(e,this.config)}}class iM extends iv{static [n]="SQLiteNumeric";getSQLType(){return"numeric"}}function iK(e){return new iz(e??"")}class ik extends iN{static [n]="SQLiteRealBuilder";constructor(e){super(e,"number","SQLiteReal")}build(e){return new iJ(e,this.config)}}class iJ extends iv{static [n]="SQLiteReal";getSQLType(){return"real"}}function iX(e){return new ik(e??"")}class iG extends iN{static [n]="SQLiteTextBuilder";constructor(e,t){super(e,"string","SQLiteText"),this.config.enumValues=t.enum,this.config.length=t.length}build(e){return new iW(e,this.config)}}class iW extends iv{static [n]="SQLiteText";enumValues=this.config.enumValues;length=this.config.length;constructor(e,t){super(e,t)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:""}`}}class iY extends iN{static [n]="SQLiteTextJsonBuilder";constructor(e){super(e,"json","SQLiteTextJson")}build(e){return new iH(e,this.config)}}class iH extends iv{static [n]="SQLiteTextJson";getSQLType(){return"text"}mapFromDriverValue(e){return JSON.parse(e)}mapToDriverValue(e){return JSON.stringify(e)}}function iZ(e,t={}){let{name:i,config:s}=ec(e,t);return"json"===s.mode?new iY(i):new iG(i,s)}let i0=Symbol.for("drizzle:SQLiteInlineForeignKeys");class i1 extends S{static [n]="SQLiteTable";static Symbol=Object.assign({},S.Symbol,{InlineForeignKeys:i0});[S.Symbol.Columns];[i0]=[];[S.Symbol.ExtraConfigBuilder]=void 0}let i2=(e,t,i)=>(function(e,t,i,s,r=e){let n=new i1(e,void 0,r),a=Object.fromEntries(Object.entries("function"==typeof t?t({blob:iE,customType:iq,integer:iU,numeric:iK,real:iX,text:iZ}):t).map(([e,t])=>{t.setName(e);let i=t.build(n);return n[i0].push(...t.buildForeignKeys(i,n)),[e,i]})),l=Object.assign(n,a);return l[S.Symbol.Columns]=a,l[S.Symbol.ExtraConfigColumns]=a,i&&(l[i1.Symbol.ExtraConfigBuilder]=i),l})(e,t,i);class i4 extends er{static [n]="SQLiteViewBase"}class i3{static [n]="SQLiteDialect";casing;constructor(e){this.casing=new id(e?.casing)}escapeName(e){return`"${e}"`}escapeParam(e){return"?"}escapeString(e){return`'${e.replace(/'/g,"''")}'`}buildWithCTE(e){if(!e?.length)return;let t=[H`with `];for(let[i,s]of e.entries())t.push(H`${H.identifier(s._.alias)} as (${s._.sql})`),i<e.length-1&&t.push(H`, `);return t.push(H` `),H.join(t)}buildDeleteQuery({table:e,where:t,returning:i,withList:s,limit:r,orderBy:n}){let a=this.buildWithCTE(s),l=i?H` returning ${this.buildSelection(i,{isSingleTable:!0})}`:void 0,o=t?H` where ${t}`:void 0,u=this.buildOrderBy(n),c=this.buildLimit(r);return H`${a}delete from ${e}${o}${l}${u}${c}`}buildUpdateSet(e,t){let i=e[S.Symbol.Columns],s=Object.keys(i).filter(e=>void 0!==t[e]||i[e]?.onUpdateFn!==void 0),r=s.length;return H.join(s.flatMap((e,s)=>{let n=i[e],a=t[e]??H.param(n.onUpdateFn(),n),l=H`${H.identifier(this.casing.getColumnCasing(n))} = ${a}`;return s<r-1?[l,H.raw(", ")]:[l]}))}buildUpdateQuery({table:e,set:t,where:i,returning:s,withList:r,joins:n,from:a,limit:l,orderBy:o}){let u=this.buildWithCTE(r),c=this.buildUpdateSet(e,t),h=a&&H.join([H.raw(" from "),this.buildFromTable(a)]),d=this.buildJoins(n),m=s?H` returning ${this.buildSelection(s,{isSingleTable:!0})}`:void 0,f=i?H` where ${i}`:void 0,p=this.buildOrderBy(o),g=this.buildLimit(l);return H`${u}update ${e} set ${c}${h}${d}${f}${m}${p}${g}`}buildSelection(e,{isSingleTable:t=!1}={}){let i=e.length,s=e.flatMap(({field:e},s)=>{let r=[];if(a(e,J.Aliased)&&e.isSelectionField)r.push(H.identifier(e.fieldAlias));else if(a(e,J.Aliased)||a(e,J)){let i=a(e,J.Aliased)?e.sql:e;t?r.push(new J(i.queryChunks.map(e=>a(e,T)?H.identifier(this.casing.getColumnCasing(e)):e))):r.push(i),a(e,J.Aliased)&&r.push(H` as ${H.identifier(e.fieldAlias)}`)}else if(a(e,T)){let i=e.table[S.Symbol.Name];t?r.push(H.identifier(this.casing.getColumnCasing(e))):r.push(H`${H.identifier(i)}.${H.identifier(this.casing.getColumnCasing(e))}`)}return s<i-1&&r.push(H`, `),r});return H.join(s)}buildJoins(e){if(!e||0===e.length)return;let t=[];if(e)for(let[i,s]of e.entries()){0===i&&t.push(H` `);let r=s.table;if(a(r,i1)){let e=r[i1.Symbol.Name],i=r[i1.Symbol.Schema],n=r[i1.Symbol.OriginalName],a=e===n?void 0:s.alias;t.push(H`${H.raw(s.joinType)} join ${i?H`${H.identifier(i)}.`:void 0}${H.identifier(n)}${a&&H` ${H.identifier(a)}`} on ${s.on}`)}else t.push(H`${H.raw(s.joinType)} join ${r} on ${s.on}`);i<e.length-1&&t.push(H` `)}return H.join(t)}buildLimit(e){return"object"==typeof e||"number"==typeof e&&e>=0?H` limit ${e}`:void 0}buildOrderBy(e){let t=[];if(e)for(let[i,s]of e.entries())t.push(s),i<e.length-1&&t.push(H`, `);return t.length>0?H` order by ${H.join(t)}`:void 0}buildFromTable(e){return a(e,S)&&e[S.Symbol.OriginalName]!==e[S.Symbol.Name]?H`${H.identifier(e[S.Symbol.OriginalName])} ${H.identifier(e[S.Symbol.Name])}`:e}buildSelectQuery({withList:e,fields:t,fieldsFlat:i,where:s,having:r,table:n,joins:l,orderBy:o,groupBy:u,limit:h,offset:d,distinct:m,setOperators:f}){let p=i??ea(t);for(let e of p){let t;if(a(e.field,T)&&e.field.table[c]!==(a(n,R)?n._.alias:a(n,i4)?n[z].name:a(n,J)?void 0:n[c])&&(t=e.field.table,!l?.some(({alias:e})=>e===(t[S.Symbol.IsAlias]?t[c]:t[S.Symbol.BaseName])))){let t=e.field.table[c];throw Error(`Your "${e.path.join("->")}" field references a column "${t}"."${e.field.name}", but the table "${t}" is not part of the query! Did you forget to join it?`)}}let g=!l||0===l.length,y=this.buildWithCTE(e),b=m?H` distinct`:void 0,w=this.buildSelection(p,{isSingleTable:g}),N=this.buildFromTable(n),v=this.buildJoins(l),L=s?H` where ${s}`:void 0,x=r?H` having ${r}`:void 0,$=[];if(u)for(let[e,t]of u.entries())$.push(t),e<u.length-1&&$.push(H`, `);let Q=$.length>0?H` group by ${H.join($)}`:void 0,P=this.buildOrderBy(o),C=this.buildLimit(h),E=d?H` offset ${d}`:void 0,B=H`${y}select${b} ${w} from ${N}${v}${L}${Q}${x}${P}${C}${E}`;return f.length>0?this.buildSetOperations(B,f):B}buildSetOperations(e,t){let[i,...s]=t;if(!i)throw Error("Cannot pass undefined values to any set operator");return 0===s.length?this.buildSetOperationQuery({leftSelect:e,setOperator:i}):this.buildSetOperations(this.buildSetOperationQuery({leftSelect:e,setOperator:i}),s)}buildSetOperationQuery({leftSelect:e,setOperator:{type:t,isAll:i,rightSelect:s,limit:r,orderBy:n,offset:l}}){let o,u=H`${e.getSQL()} `,c=H`${s.getSQL()}`;if(n&&n.length>0){let e=[];for(let t of n)if(a(t,iv))e.push(H.identifier(t.name));else if(a(t,J)){for(let e=0;e<t.queryChunks.length;e++){let i=t.queryChunks[e];a(i,iv)&&(t.queryChunks[e]=H.identifier(this.casing.getColumnCasing(i)))}e.push(H`${t}`)}else e.push(H`${t}`);o=H` order by ${H.join(e,H`, `)}`}let h="object"==typeof r||"number"==typeof r&&r>=0?H` limit ${r}`:void 0,d=H.raw(`${t} ${i?"all ":""}`),m=l?H` offset ${l}`:void 0;return H`${u}${d}${c}${o}${h}${m}`}buildInsertQuery({table:e,values:t,onConflict:i,returning:s,withList:r,select:n}){let l=[],o=Object.entries(e[S.Symbol.Columns]).filter(([e,t])=>!t.shouldDisableInsert()),u=o.map(([,e])=>H.identifier(this.casing.getColumnCasing(e)));if(n)a(t,J)?l.push(t):l.push(t.getSQL());else for(let[e,i]of(l.push(H.raw("values ")),t.entries())){let s=[];for(let[e,t]of o){let r=i[e];if(void 0===r||a(r,Y)&&void 0===r.value){let e;if(null!==t.default&&void 0!==t.default)e=a(t.default,J)?t.default:H.param(t.default,t);else if(void 0!==t.defaultFn){let i=t.defaultFn();e=a(i,J)?i:H.param(i,t)}else if(t.default||void 0===t.onUpdateFn)e=H`null`;else{let i=t.onUpdateFn();e=a(i,J)?i:H.param(i,t)}s.push(e)}else s.push(r)}l.push(s),e<t.length-1&&l.push(H`, `)}let c=this.buildWithCTE(r),h=H.join(l),d=s?H` returning ${this.buildSelection(s,{isSingleTable:!0})}`:void 0,m=i?H` on conflict ${i}`:void 0;return H`${c}insert into ${e} ${u} ${h}${m}${d}`}sqlToQuery(e,t){return e.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,invokeSource:t})}buildRelationalQuery({fullSchema:e,schema:t,tableNamesMap:i,table:s,tableConfig:r,queryConfig:n,tableAlias:l,nestedQueryRelation:o,joinOn:u}){let c,h=[],d,m,f=[],p,g=[];if(!0===n)h=Object.entries(r.columns).map(([e,t])=>({dbKey:t.name,tsKey:e,field:ir(t,l),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let s=Object.fromEntries(Object.entries(r.columns).map(([e,t])=>[e,ir(t,l)]));if(n.where){let e="function"==typeof n.where?n.where(s,{and:tF,between:tW,eq:tO,exists:tX,gt:tR,gte:tV,ilike:t0,inArray:tM,isNull:tk,isNotNull:tJ,like:tH,lt:tU,lte:tz,ne:tA,not:tI,notBetween:tY,notExists:tG,notLike:tZ,notIlike:t1,notInArray:tK,or:tj,sql:H}):n.where;p=e&&il(e,l)}let o=[],u=[];if(n.columns){let e=!1;for(let[t,i]of Object.entries(n.columns))void 0!==i&&t in r.columns&&(e||!0!==i||(e=!0),u.push(t));u.length>0&&(u=e?u.filter(e=>n.columns?.[e]===!0):Object.keys(r.columns).filter(e=>!u.includes(e)))}else u=Object.keys(r.columns);for(let e of u){let t=r.columns[e];o.push({tsKey:e,value:t})}let c=[];if(n.with&&(c=Object.entries(n.with).filter(e=>!!e[1]).map(([e,t])=>({tsKey:e,queryConfig:t,relation:r.relations[e]}))),n.extras)for(let[e,t]of Object.entries("function"==typeof n.extras?n.extras(s,{sql:H}):n.extras))o.push({tsKey:e,value:ia(t,l)});for(let{tsKey:e,value:t}of o)h.push({dbKey:a(t,J.Aliased)?t.fieldAlias:r.columns[e].name,tsKey:e,field:a(t,T)?ir(t,l):t,relationTableTsKey:void 0,isJson:!1,selection:[]});let g="function"==typeof n.orderBy?n.orderBy(s,{sql:H,asc:t2,desc:t4}):n.orderBy??[];for(let{tsKey:s,queryConfig:r,relation:o}of(Array.isArray(g)||(g=[g]),f=g.map(e=>a(e,T)?ir(e,l):il(e,l)),d=n.limit,m=n.offset,c)){let n=function(e,t,i){if(a(i,t6)&&i.config)return{fields:i.config.fields,references:i.config.references};let s=t[w(i.referencedTable)];if(!s)throw Error(`Table "${i.referencedTable[S.Symbol.Name]}" not found in schema`);let r=e[s];if(!r)throw Error(`Table "${s}" not found in schema`);let n=i.sourceTable,l=t[w(n)];if(!l)throw Error(`Table "${n[S.Symbol.Name]}" not found in schema`);let o=[];for(let e of Object.values(r.relations))(i.relationName&&i!==e&&e.relationName===i.relationName||!i.relationName&&e.referencedTable===i.sourceTable)&&o.push(e);if(o.length>1)throw i.relationName?Error(`There are multiple relations with name "${i.relationName}" in table "${s}"`):Error(`There are multiple relations between "${s}" and "${i.sourceTable[S.Symbol.Name]}". Please specify relation name`);if(o[0]&&a(o[0],t6)&&o[0].config)return{fields:o[0].config.references,references:o[0].config.fields};throw Error(`There is not enough information to infer relation "${l}.${i.fieldName}"`)}(t,i,o),u=i[w(o.referencedTable)],c=`${l}_${s}`,d=tF(...n.fields.map((e,t)=>tO(ir(n.references[t],c),ir(e,l)))),m=this.buildRelationalQuery({fullSchema:e,schema:t,tableNamesMap:i,table:e[u],tableConfig:t[u],queryConfig:a(o,t6)?!0===r?{limit:1}:{...r,limit:1}:r,tableAlias:c,joinOn:d,nestedQueryRelation:o}),f=H`(${m.sql})`.as(s);h.push({dbKey:s,tsKey:s,field:f,relationTableTsKey:u,isJson:!0,selection:m.selection})}}if(0===h.length)throw new im({message:`No fields selected for table "${r.tsName}" ("${l}"). You need to have at least one item in "columns", "with" or "extras". If you need to select all columns, omit the "columns" key or set it to undefined.`});if(p=tF(u,p),o){let e=H`json_array(${H.join(h.map(({field:e})=>a(e,iv)?H.identifier(this.casing.getColumnCasing(e)):a(e,J.Aliased)?e.sql:e),H`, `)})`;a(o,t8)&&(e=H`coalesce(json_group_array(${e}), json_array())`);let t=[{dbKey:"data",tsKey:"data",field:e.as("data"),isJson:!0,relationTableTsKey:r.tsName,selection:h}];void 0!==d||void 0!==m||f.length>0?(c=this.buildSelectQuery({table:is(s,l),fields:{},fieldsFlat:[{path:[],field:H.raw("*")}],where:p,limit:d,offset:m,orderBy:f,setOperators:[]}),p=void 0,d=void 0,m=void 0,f=void 0):c=is(s,l),c=this.buildSelectQuery({table:a(c,i1)?c:new R(c,{},l),fields:{},fieldsFlat:t.map(({field:e})=>({path:[],field:a(e,T)?ir(e,l):e})),joins:g,where:p,limit:d,offset:m,orderBy:f,setOperators:[]})}else c=this.buildSelectQuery({table:is(s,l),fields:{},fieldsFlat:h.map(({field:e})=>({path:[],field:a(e,T)?ir(e,l):e})),joins:g,where:p,limit:d,offset:m,orderBy:f,setOperators:[]});return{tableTsKey:r.tsName,sql:c,selection:h}}}class i5 extends i3{static [n]="SQLiteSyncDialect";migrate(e,t,i){let s=void 0===i||"string"==typeof i?"__drizzle_migrations":i.migrationsTable??"__drizzle_migrations",r=H`
2
2
  CREATE TABLE IF NOT EXISTS ${H.identifier(s)} (
3
3
  id SERIAL PRIMARY KEY,
4
4
  hash text NOT NULL,
5
5
  created_at numeric
6
6
  )
7
- `;t.run(r);let n=t.values(H`SELECT id, hash, created_at FROM ${H.identifier(s)} ORDER BY created_at DESC LIMIT 1`)[0]??void 0;t.run(H`BEGIN`);try{for(let i of e)if(!n||Number(n[2])<i.folderMillis){for(let e of i.sql)t.run(H.raw(e));t.run(H`INSERT INTO ${H.identifier(s)} ("hash", "created_at") VALUES(${i.hash}, ${i.folderMillis})`)}t.run(H`COMMIT`)}catch(e){throw t.run(H`ROLLBACK`),e}}}class i8 extends i4{static [n]="SQLiteAsyncDialect";async migrate(e,t,i){let s=void 0===i||"string"==typeof i?"__drizzle_migrations":i.migrationsTable??"__drizzle_migrations",r=H`
7
+ `;t.run(r);let n=t.values(H`SELECT id, hash, created_at FROM ${H.identifier(s)} ORDER BY created_at DESC LIMIT 1`)[0]??void 0;t.run(H`BEGIN`);try{for(let i of e)if(!n||Number(n[2])<i.folderMillis){for(let e of i.sql)t.run(H.raw(e));t.run(H`INSERT INTO ${H.identifier(s)} ("hash", "created_at") VALUES(${i.hash}, ${i.folderMillis})`)}t.run(H`COMMIT`)}catch(e){throw t.run(H`ROLLBACK`),e}}}class i6 extends i3{static [n]="SQLiteAsyncDialect";async migrate(e,t,i){let s=void 0===i||"string"==typeof i?"__drizzle_migrations":i.migrationsTable??"__drizzle_migrations",r=H`
8
8
  CREATE TABLE IF NOT EXISTS ${H.identifier(s)} (
9
9
  id SERIAL PRIMARY KEY,
10
10
  hash text NOT NULL,
11
11
  created_at numeric
12
12
  )
13
- `;await t.run(r);let n=(await t.values(H`SELECT id, hash, created_at FROM ${H.identifier(s)} ORDER BY created_at DESC LIMIT 1`))[0]??void 0;await t.transaction(async t=>{for(let i of e)if(!n||Number(n[2])<i.folderMillis){for(let e of i.sql)await t.run(H.raw(e));await t.run(H`INSERT INTO ${H.identifier(s)} ("hash", "created_at") VALUES(${i.hash}, ${i.folderMillis})`)}})}}class i6{static [n]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}class i7{static [n]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}then(e,t){return this.execute().then(e,t)}}class i9{static [n]="SQLiteSelectBuilder";fields;session;dialect;withList;distinct;constructor(e){this.fields=e.fields,this.session=e.session,this.dialect=e.dialect,this.withList=e.withList,this.distinct=e.distinct}from(e){let t,i=!!this.fields;return t=this.fields?this.fields:a(e,R)?Object.fromEntries(Object.keys(e._.selectedFields).map(t=>[t,e[t]])):a(e,i5)?e[z].selectedFields:a(e,J)?{}:e[S.Symbol.Columns],new st({table:e,fields:t,isPartialSelect:i,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct})}}class se extends i6{static [n]="SQLiteSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;constructor({table:e,fields:t,isPartialSelect:i,session:s,dialect:r,withList:n,distinct:a}){super(),this.config={withList:n,table:e,fields:{...t},distinct:a,setOperators:[]},this.isPartialSelect=i,this.session=s,this.dialect=r,this._={selectedFields:t},this.tableName=eu(e),this.joinsNotNullableMap="string"==typeof this.tableName?{[this.tableName]:!0}:{}}createJoin(e){return(t,i)=>{let s=this.tableName,r=eu(t);if("string"==typeof r&&this.config.joins?.some(e=>e.alias===r))throw Error(`Alias "${r}" is already used in this query`);if(!this.isPartialSelect&&(1===Object.keys(this.joinsNotNullableMap).length&&"string"==typeof s&&(this.config.fields={[s]:this.config.fields}),"string"==typeof r&&!a(t,J))){let e=a(t,R)?t._.selectedFields:a(t,er)?t[z].selectedFields:t[S.Symbol.Columns];this.config.fields[r]=e}if("function"==typeof i&&(i=i(new Proxy(this.config.fields,new io({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:i,table:t,joinType:e,alias:r}),"string"==typeof r)switch(e){case"left":this.joinsNotNullableMap[r]=!1;break;case"right":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[r]=!0;break;case"inner":this.joinsNotNullableMap[r]=!0;break;case"full":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[r]=!1}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");createSetOperator(e,t){return i=>{let s="function"==typeof i?i(ss()):i;if(!el(this.getSelectedFields(),s.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:e,isAll:t,rightSelect:s}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);except=this.createSetOperator("except",!1);addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){return"function"==typeof e&&(e=e(new Proxy(this.config.fields,new io({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.where=e,this}having(e){return"function"==typeof e&&(e=e(new Proxy(this.config.fields,new io({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.having=e,this}groupBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.fields,new io({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(t)?t:[t]}else this.config.groupBy=e;return this}orderBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.fields,new io({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=i:this.config.orderBy=i}else this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=e:this.config.orderBy=e;return this}limit(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).limit=e:this.config.limit=e,this}offset(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).offset=e:this.config.offset=e,this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}as(e){return new Proxy(new R(this.getSQL(),this.config.fields,e),new io({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new io({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}}class st extends se{static [n]="SQLiteSelect";_prepare(e=!0){if(!this.session)throw Error("Cannot execute a query on a query builder. Please use a database instance instead.");let t=ea(this.config.fields),i=this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),t,"all",!0);return i.joinsNotNullableMap=this.joinsNotNullableMap,i}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.all()}}for(let e of[i7])for(let t of Object.getOwnPropertyNames(e.prototype))"constructor"!==t&&Object.defineProperty(st.prototype,t,Object.getOwnPropertyDescriptor(e.prototype,t)||Object.create(null));function si(e,t){return(i,s,...r)=>{let n=[s,...r].map(i=>({type:e,isAll:t,rightSelect:i}));for(let e of n)if(!el(i.getSelectedFields(),e.rightSelect.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return i.addSetOperators(n)}}let ss=()=>({union:sr,unionAll:sn,intersect:sa,except:sl}),sr=si("union",!1),sn=si("union",!0),sa=si("intersect",!1),sl=si("except",!1);class so{static [n]="SQLiteQueryBuilder";dialect;dialectConfig;constructor(e){this.dialect=a(e,i4)?e:void 0,this.dialectConfig=a(e,i4)?void 0:e}$with(e){let t=this;return{as:i=>("function"==typeof i&&(i=i(t)),new Proxy(new V(i.getSQL(),i.getSelectedFields(),e,!0),new io({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}}with(...e){let t=this;return{select:function(i){return new i9({fields:i??void 0,session:void 0,dialect:t.getDialect(),withList:e})},selectDistinct:function(i){return new i9({fields:i??void 0,session:void 0,dialect:t.getDialect(),withList:e,distinct:!0})}}}select(e){return new i9({fields:e??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(e){return new i9({fields:e??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}getDialect(){return this.dialect||(this.dialect=new i3(this.dialectConfig)),this.dialect}}class su extends i7{constructor(e,t,i,s){super(),this.table=e,this.session=t,this.dialect=i,this.config={table:e,withList:s}}static [n]="SQLiteDelete";config;where(e){return this.config.where=e,this}orderBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.table[S.Symbol.Columns],new io({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.orderBy=i}else this.config.orderBy=e;return this}limit(e){return this.config.limit=e,this}returning(e=this.table[i1.Symbol.Columns]){return this.config.returning=ea(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0)}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(e){return this._prepare().execute(e)}$dynamic(){return this}}class sc{constructor(e,t,i,s){this.table=e,this.session=t,this.dialect=i,this.withList=s}static [n]="SQLiteInsertBuilder";values(e){if(0===(e=Array.isArray(e)?e:[e]).length)throw Error("values() must be called with at least one value");let t=e.map(e=>{let t={},i=this.table[S.Symbol.Columns];for(let s of Object.keys(e)){let r=e[s];t[s]=a(r,J)?r:new Y(r,i[s])}return t});return new sh(this.table,t,this.session,this.dialect,this.withList)}select(e){let t="function"==typeof e?e(new so):e;if(!a(t,J)&&!el(this.table[d],t._.selectedFields))throw Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");return new sh(this.table,t,this.session,this.dialect,this.withList,!0)}}class sh extends i7{constructor(e,t,i,s,r,n){super(),this.session=i,this.dialect=s,this.config={table:e,values:t,withList:r,select:n}}static [n]="SQLiteInsert";config;returning(e=this.config.table[i1.Symbol.Columns]){return this.config.returning=ea(e),this}onConflictDoNothing(e={}){if(void 0===e.target)this.config.onConflict=H`do nothing`;else{let t=Array.isArray(e.target)?H`${e.target}`:H`${[e.target]}`,i=e.where?H` where ${e.where}`:H``;this.config.onConflict=H`${t} do nothing${i}`}return this}onConflictDoUpdate(e){if(e.where&&(e.targetWhere||e.setWhere))throw Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');let t=e.where?H` where ${e.where}`:void 0,i=e.targetWhere?H` where ${e.targetWhere}`:void 0,s=e.setWhere?H` where ${e.setWhere}`:void 0,r=Array.isArray(e.target)?H`${e.target}`:H`${[e.target]}`,n=this.dialect.buildUpdateSet(this.config.table,eo(this.config.table,e.set));return this.config.onConflict=H`${r}${i} do update set ${n}${t}${s}`,this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0)}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}}class sd{constructor(e,t,i,s){this.table=e,this.session=t,this.dialect=i,this.withList=s}static [n]="SQLiteUpdateBuilder";set(e){return new sm(this.table,eo(this.table,e),this.session,this.dialect,this.withList)}}class sm extends i7{constructor(e,t,i,s,r){super(),this.session=i,this.dialect=s,this.config={set:t,table:e,withList:r,joins:[]}}static [n]="SQLiteUpdate";config;from(e){return this.config.from=e,this}createJoin(e){return(t,i)=>{let s=eu(t);if("string"==typeof s&&this.config.joins.some(e=>e.alias===s))throw Error(`Alias "${s}" is already used in this query`);if("function"==typeof i){let e=this.config.from?a(t,i1)?t[S.Symbol.Columns]:a(t,R)?t._.selectedFields:a(t,i5)?t[z].selectedFields:void 0:void 0;i=i(new Proxy(this.config.table[S.Symbol.Columns],new io({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),e&&new Proxy(e,new io({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}return this.config.joins.push({on:i,table:t,joinType:e,alias:s}),this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where(e){return this.config.where=e,this}orderBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.table[S.Symbol.Columns],new io({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.orderBy=i}else this.config.orderBy=e;return this}limit(e){return this.config.limit=e,this}returning(e=this.config.table[i1.Symbol.Columns]){return this.config.returning=ea(e),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0)}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}}class sf extends J{constructor(e){super(sf.buildEmbeddedCount(e.source,e.filters).queryChunks),this.params=e,this.session=e.session,this.sql=sf.buildCount(e.source,e.filters)}sql;static [n]="SQLiteCountBuilderAsync";[Symbol.toStringTag]="SQLiteCountBuilderAsync";session;static buildEmbeddedCount(e,t){return H`(select count(*) from ${e}${H.raw(" where ").if(t)}${t})`}static buildCount(e,t){return H`select count(*) from ${e}${H.raw(" where ").if(t)}${t}`}then(e,t){return Promise.resolve(this.session.count(this.sql)).then(e,t)}catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}}class sp{constructor(e,t,i,s,r,n,a,l){this.mode=e,this.fullSchema=t,this.schema=i,this.tableNamesMap=s,this.table=r,this.tableConfig=n,this.dialect=a,this.session=l}static [n]="SQLiteAsyncRelationalQueryBuilder";findMany(e){return"sync"===this.mode?new sy(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},"many"):new sg(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},"many")}findFirst(e){return"sync"===this.mode?new sy(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first"):new sg(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first")}}class sg extends i7{constructor(e,t,i,s,r,n,a,l,o){super(),this.fullSchema=e,this.schema=t,this.tableNamesMap=i,this.table=s,this.tableConfig=r,this.dialect=n,this.session=a,this.config=l,this.mode=o}static [n]="SQLiteAsyncRelationalQuery";mode;getSQL(){return this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}).sql}_prepare(e=!1){let{query:t,builtQuery:i}=this._toSQL();return this.session[e?"prepareOneTimeQuery":"prepareQuery"](i,void 0,"first"===this.mode?"get":"all",!0,(e,i)=>{let s=e.map(e=>(function e(t,i,s,r,n=e=>e){let l={};for(let[o,u]of r.entries())if(u.isJson){let r=i.relations[u.tsKey],c=s[o],h="string"==typeof c?JSON.parse(c):c;l[u.tsKey]=a(r,t8)?h&&e(t,t[u.relationTableTsKey],h,u.selection,n):h.map(i=>e(t,t[u.relationTableTsKey],i,u.selection,n))}else{let e,t=n(s[o]),i=u.field;e=a(i,T)?i:a(i,J)?i.decoder:i.sql.decoder,l[u.tsKey]=null===t?null:e.mapFromDriverValue(t)}return l})(this.schema,this.tableConfig,e,t.selection,i));return"first"===this.mode?s[0]:s})}prepare(){return this._prepare(!1)}_toSQL(){let e=this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}),t=this.dialect.sqlToQuery(e.sql);return{query:e,builtQuery:t}}toSQL(){return this._toSQL().builtQuery}executeRaw(){return"first"===this.mode?this._prepare(!1).get():this._prepare(!1).all()}async execute(){return this.executeRaw()}}class sy extends sg{static [n]="SQLiteSyncRelationalQuery";sync(){return this.executeRaw()}}class sb extends i7{constructor(e,t,i,s,r){super(),this.execute=e,this.getSQL=t,this.dialect=s,this.mapBatchResult=r,this.config={action:i}}static [n]="SQLiteRaw";config;getQuery(){return{...this.dialect.sqlToQuery(this.getSQL()),method:this.config.action}}mapResult(e,t){return t?this.mapBatchResult(e):e}_prepare(){return this}isResponseInArrayMode(){return!1}}class sS{constructor(e,t,i,s){this.resultKind=e,this.dialect=t,this.session=i,this._=s?{schema:s.schema,fullSchema:s.fullSchema,tableNamesMap:s.tableNamesMap}:{schema:void 0,fullSchema:{},tableNamesMap:{}},this.query={};const r=this.query;if(this._.schema)for(const[n,a]of Object.entries(this._.schema))r[n]=new sp(e,s.fullSchema,this._.schema,this._.tableNamesMap,s.fullSchema[n],a,t,i)}static [n]="BaseSQLiteDatabase";query;$with(e){let t=this;return{as:i=>("function"==typeof i&&(i=i(new so(t.dialect))),new Proxy(new V(i.getSQL(),i.getSelectedFields(),e,!0),new io({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}}$count(e,t){return new sf({source:e,filters:t,session:this.session})}with(...e){let t=this;return{select:function(i){return new i9({fields:i??void 0,session:t.session,dialect:t.dialect,withList:e})},selectDistinct:function(i){return new i9({fields:i??void 0,session:t.session,dialect:t.dialect,withList:e,distinct:!0})},update:function(i){return new sd(i,t.session,t.dialect,e)},insert:function(i){return new sc(i,t.session,t.dialect,e)},delete:function(i){return new su(i,t.session,t.dialect,e)}}}select(e){return new i9({fields:e??void 0,session:this.session,dialect:this.dialect})}selectDistinct(e){return new i9({fields:e??void 0,session:this.session,dialect:this.dialect,distinct:!0})}update(e){return new sd(e,this.session,this.dialect)}insert(e){return new sc(e,this.session,this.dialect)}delete(e){return new su(e,this.session,this.dialect)}run(e){let t="string"==typeof e?H.raw(e):e.getSQL();return"async"===this.resultKind?new sb(async()=>this.session.run(t),()=>t,"run",this.dialect,this.session.extractRawRunValueFromBatchResult.bind(this.session)):this.session.run(t)}all(e){let t="string"==typeof e?H.raw(e):e.getSQL();return"async"===this.resultKind?new sb(async()=>this.session.all(t),()=>t,"all",this.dialect,this.session.extractRawAllValueFromBatchResult.bind(this.session)):this.session.all(t)}get(e){let t="string"==typeof e?H.raw(e):e.getSQL();return"async"===this.resultKind?new sb(async()=>this.session.get(t),()=>t,"get",this.dialect,this.session.extractRawGetValueFromBatchResult.bind(this.session)):this.session.get(t)}values(e){let t="string"==typeof e?H.raw(e):e.getSQL();return"async"===this.resultKind?new sb(async()=>this.session.values(t),()=>t,"values",this.dialect,this.session.extractRawValuesValueFromBatchResult.bind(this.session)):this.session.values(t)}transaction(e,t){return this.session.transaction(e,t)}}class sw extends i7{constructor(e){super(),this.resultCb=e}static [n]="ExecuteResultSync";async execute(){return this.resultCb()}sync(){return this.resultCb()}}class sT{constructor(e,t,i){this.mode=e,this.executeMethod=t,this.query=i}static [n]="PreparedQuery";joinsNotNullableMap;getQuery(){return this.query}mapRunResult(e,t){return e}mapAllResult(e,t){throw Error("Not implemented")}mapGetResult(e,t){throw Error("Not implemented")}execute(e){return"async"===this.mode?this[this.executeMethod](e):new sw(()=>this[this.executeMethod](e))}mapResult(e,t){switch(this.executeMethod){case"run":return this.mapRunResult(e,t);case"all":return this.mapAllResult(e,t);case"get":return this.mapGetResult(e,t)}}}class sN{constructor(e){this.dialect=e}static [n]="SQLiteSession";prepareOneTimeQuery(e,t,i,s){return this.prepareQuery(e,t,i,s)}run(e){let t=this.dialect.sqlToQuery(e);try{return this.prepareOneTimeQuery(t,void 0,"run",!1).run()}catch(e){throw new im({cause:e,message:`Failed to run the query '${t.sql}'`})}}extractRawRunValueFromBatchResult(e){return e}all(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",!1).all()}extractRawAllValueFromBatchResult(e){throw Error("Not implemented")}get(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",!1).get()}extractRawGetValueFromBatchResult(e){throw Error("Not implemented")}values(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",!1).values()}async count(e){return(await this.values(e))[0][0]}extractRawValuesValueFromBatchResult(e){throw Error("Not implemented")}}class sv extends sS{constructor(e,t,i,s,r=0){super(e,t,i,s),this.schema=s,this.nestedIndex=r}static [n]="SQLiteTransaction";rollback(){throw new ip}}class sL extends sN{constructor(e,t,i,s={}){super(t),this.client=e,this.schema=i,this.logger=s.logger??new u}static [n]="BetterSQLiteSession";logger;prepareQuery(e,t,i,s,r){return new s$(this.client.prepare(e.sql),e,this.logger,t,i,s,r)}transaction(e,t={}){let i=new sx("sync",this.dialect,this,this.schema);return this.client.transaction(e)[t.behavior??"deferred"](i)}}class sx extends sv{static [n]="BetterSQLiteTransaction";transaction(e){let t=`sp${this.nestedIndex}`,i=new sx("sync",this.dialect,this.session,this.schema,this.nestedIndex+1);this.session.run(H.raw(`savepoint ${t}`));try{let s=e(i);return this.session.run(H.raw(`release savepoint ${t}`)),s}catch(e){throw this.session.run(H.raw(`rollback to savepoint ${t}`)),e}}}class s$ extends sT{constructor(e,t,i,s,r,n,a){super("sync",r,t),this.stmt=e,this.logger=i,this.fields=s,this._isResponseInArrayMode=n,this.customResultMapper=a}static [n]="BetterSQLitePreparedQuery";run(e){let t=ei(this.query.params,e??{});return this.logger.logQuery(this.query.sql,t),this.stmt.run(...t)}all(e){let{fields:t,joinsNotNullableMap:i,query:s,logger:r,stmt:n,customResultMapper:a}=this;if(!t&&!a){let t=ei(s.params,e??{});return r.logQuery(s.sql,t),n.all(...t)}let l=this.values(e);return a?a(l):l.map(e=>en(t,e,i))}get(e){let t=ei(this.query.params,e??{});this.logger.logQuery(this.query.sql,t);let{fields:i,stmt:s,joinsNotNullableMap:r,customResultMapper:n}=this;if(!i&&!n)return s.get(...t);let a=s.raw().get(...t);if(a)return n?n([a]):en(i,a,r)}values(e){let t=ei(this.query.params,e??{});return this.logger.logQuery(this.query.sql,t),this.stmt.raw().all(...t)}isResponseInArrayMode(){return this._isResponseInArrayMode}}class sQ extends sS{static [n]="BetterSQLite3Database"}function sP(e,t={}){let i,s,r=new i3({casing:t.casing});if(!0===t.logger?i=new o:!1!==t.logger&&(i=t.logger),t.schema){let e=function(e,t){1===Object.keys(e).length&&"default"in e&&!a(e.default,S)&&(e=e.default);let i={},s={},r={};for(let[n,l]of Object.entries(e))if(a(l,S)){let e=w(l),t=s[e];for(let s of(i[e]=n,r[n]={tsName:n,dbName:l[S.Symbol.Name],schema:l[S.Symbol.Schema],columns:l[S.Symbol.Columns],relations:t?.relations??{},primaryKey:t?.primaryKey??[]},Object.values(l[S.Symbol.Columns])))s.primary&&r[n].primaryKey.push(s);let o=l[S.Symbol.ExtraConfigBuilder]?.(l[S.Symbol.ExtraConfigColumns]);if(o)for(let e of Object.values(o))a(e,t_)&&r[n].primaryKey.push(...e.columns)}else if(a(l,t3)){let e,n=w(l.table),a=i[n];for(let[i,o]of Object.entries(l.config(t(l.table))))if(a){let t=r[a];t.relations[i]=o,e&&t.primaryKey.push(...e)}else n in s||(s[n]={relations:{},primaryKey:e}),s[n].relations[i]=o}return{tables:r,tableNamesMap:i}}(t.schema,t9);s={fullSchema:t.schema,schema:e.tables,tableNamesMap:e.tableNamesMap}}let n=new sL(e,r,s,{logger:i}),l=new sQ("sync",r,n,s);return l.$client=e,l}function sC(...e){if(void 0===e[0]||"string"==typeof e[0])return sP(void 0===e[0]?new r.default:new r.default(e[0]),e[1]);if(function(e){if("object"!=typeof e||null===e||"Object"!==e.constructor.name)return!1;if("logger"in e){let t=typeof e.logger;return"boolean"===t||"object"===t&&"function"==typeof e.logger.logQuery||"undefined"===t}if("schema"in e){let t=typeof e.logger;return"object"===t||"undefined"===t}if("casing"in e){let t=typeof e.logger;return"string"===t||"undefined"===t}if("mode"in e)return"default"===e.mode&&"planetscale"===e.mode&&void 0===e.mode;if("connection"in e){let t=typeof e.connection;return"string"===t||"object"===t||"undefined"===t}if("client"in e){let t=typeof e.client;return"object"===t||"function"===t||"undefined"===t}return 0===Object.keys(e).length}(e[0])){let{connection:t,client:i,...s}=e[0];if(i)return sP(i,s);if("object"==typeof t){let{source:e,...i}=t;return sP(new r.default(e,i),s)}return sP(new r.default(t),s)}return sP(e[0],e[1])}(sC||(sC={})).mock=function(e){return sP({},e)};class sE{constructor(e,t){this.name=e,this.unique=t}static [n]="SQLiteIndexBuilderOn";on(...e){return new sB(this.name,e,this.unique)}}class sB{static [n]="SQLiteIndexBuilder";config;constructor(e,t,i){this.config={name:e,columns:t,unique:i,where:void 0}}where(e){return this.config.where=e,this}build(e){return new s_(this.config,e)}}class s_{static [n]="SQLiteIndex";config;constructor(e,t){this.config={...e,table:t}}}let sq=i2("projects",{id:iZ("id").primaryKey(),githubOwner:iZ("github_owner").notNull(),githubRepo:iZ("github_repo").notNull(),displayName:iZ("display_name"),description:iZ("description"),homepageUrl:iZ("homepage_url"),stars:iU("stars").default(0),isPublic:iU("is_public",{mode:"boolean"}).default(!0),isFeatured:iU("is_featured",{mode:"boolean"}).default(!1),lastSyncedAt:iU("last_synced_at",{mode:"timestamp"}),createdAt:iU("created_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date),updatedAt:iU("updated_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date)}),sD=i2("specs",{id:iZ("id").primaryKey(),projectId:iZ("project_id").notNull().references(()=>sq.id,{onDelete:"cascade"}),specNumber:iU("spec_number"),specName:iZ("spec_name").notNull(),title:iZ("title"),status:iZ("status",{enum:["planned","in-progress","complete","archived"]}),priority:iZ("priority",{enum:["low","medium","high","critical"]}),tags:iZ("tags"),assignee:iZ("assignee"),contentMd:iZ("content_md").notNull(),contentHtml:iZ("content_html"),createdAt:iU("created_at",{mode:"timestamp"}),updatedAt:iU("updated_at",{mode:"timestamp"}),completedAt:iU("completed_at",{mode:"timestamp"}),filePath:iZ("file_path").notNull(),githubUrl:iZ("github_url"),syncedAt:iU("synced_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date)},e=>({uniqueSpecNumber:new sE("unique_spec_number",!0).on(e.projectId,e.specNumber)})),sO=i2("spec_relationships",{id:iZ("id").primaryKey(),specId:iZ("spec_id").notNull().references(()=>sD.id,{onDelete:"cascade"}),relatedSpecId:iZ("related_spec_id").notNull().references(()=>sD.id,{onDelete:"cascade"}),relationshipType:iZ("relationship_type",{enum:["depends_on","related"]}).notNull(),createdAt:iU("created_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date)}),sA=i2("sync_logs",{id:iZ("id").primaryKey(),projectId:iZ("project_id").notNull().references(()=>sq.id,{onDelete:"cascade"}),status:iZ("status",{enum:["pending","running","success","failed"]}).notNull(),specsAdded:iU("specs_added").default(0),specsUpdated:iU("specs_updated").default(0),specsDeleted:iU("specs_deleted").default(0),errorMessage:iZ("error_message"),startedAt:iU("started_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date),completedAt:iU("completed_at",{mode:"timestamp"}),durationMs:iU("duration_ms")}),sF=t7(sq,({many:e})=>({specs:e(sD),syncLogs:e(sA)})),sj=t7(sD,({one:e,many:t})=>({project:e(sq,{fields:[sD.projectId],references:[sq.id]}),dependencies:t(sO,{relationName:"spec"}),dependents:t(sO,{relationName:"relatedSpec"})})),sI=t7(sO,({one:e})=>({spec:e(sD,{fields:[sO.specId],references:[sD.id],relationName:"spec"}),relatedSpec:e(sD,{fields:[sO.relatedSpecId],references:[sD.id],relationName:"relatedSpec"})})),sR=t7(sA,({one:e})=>({project:e(sq,{fields:[sA.projectId],references:[sq.id]})}));e.s(["projects",0,sq,"projectsRelations",0,sF,"specRelationships",0,sO,"specRelationshipsRelations",0,sI,"specs",0,sD,"specsRelations",0,sj,"syncLogs",0,sA,"syncLogsRelations",0,sR],65239);var sV=e.i(65239),sU=e.i(14747);let sz=null,sM=null,sK=new Proxy({},{get:(e,t,i)=>Reflect.get(function(){if(!sz){let e=process.env.DATABASE_PATH||(0,sU.join)(process.cwd(),"leanspec.db");(function(e){e.pragma("foreign_keys = ON");let t=t=>!!e.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = ?").get(t);t("projects")||e.exec(`
13
+ `;await t.run(r);let n=(await t.values(H`SELECT id, hash, created_at FROM ${H.identifier(s)} ORDER BY created_at DESC LIMIT 1`))[0]??void 0;await t.transaction(async t=>{for(let i of e)if(!n||Number(n[2])<i.folderMillis){for(let e of i.sql)await t.run(H.raw(e));await t.run(H`INSERT INTO ${H.identifier(s)} ("hash", "created_at") VALUES(${i.hash}, ${i.folderMillis})`)}})}}class i8{static [n]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}class i7{static [n]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}then(e,t){return this.execute().then(e,t)}}class i9{static [n]="SQLiteSelectBuilder";fields;session;dialect;withList;distinct;constructor(e){this.fields=e.fields,this.session=e.session,this.dialect=e.dialect,this.withList=e.withList,this.distinct=e.distinct}from(e){let t,i=!!this.fields;return t=this.fields?this.fields:a(e,R)?Object.fromEntries(Object.keys(e._.selectedFields).map(t=>[t,e[t]])):a(e,i4)?e[z].selectedFields:a(e,J)?{}:e[S.Symbol.Columns],new st({table:e,fields:t,isPartialSelect:i,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct})}}class se extends i8{static [n]="SQLiteSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;constructor({table:e,fields:t,isPartialSelect:i,session:s,dialect:r,withList:n,distinct:a}){super(),this.config={withList:n,table:e,fields:{...t},distinct:a,setOperators:[]},this.isPartialSelect=i,this.session=s,this.dialect=r,this._={selectedFields:t},this.tableName=eu(e),this.joinsNotNullableMap="string"==typeof this.tableName?{[this.tableName]:!0}:{}}createJoin(e){return(t,i)=>{let s=this.tableName,r=eu(t);if("string"==typeof r&&this.config.joins?.some(e=>e.alias===r))throw Error(`Alias "${r}" is already used in this query`);if(!this.isPartialSelect&&(1===Object.keys(this.joinsNotNullableMap).length&&"string"==typeof s&&(this.config.fields={[s]:this.config.fields}),"string"==typeof r&&!a(t,J))){let e=a(t,R)?t._.selectedFields:a(t,er)?t[z].selectedFields:t[S.Symbol.Columns];this.config.fields[r]=e}if("function"==typeof i&&(i=i(new Proxy(this.config.fields,new io({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:i,table:t,joinType:e,alias:r}),"string"==typeof r)switch(e){case"left":this.joinsNotNullableMap[r]=!1;break;case"right":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[r]=!0;break;case"inner":this.joinsNotNullableMap[r]=!0;break;case"full":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[r]=!1}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");createSetOperator(e,t){return i=>{let s="function"==typeof i?i(ss()):i;if(!el(this.getSelectedFields(),s.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:e,isAll:t,rightSelect:s}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);except=this.createSetOperator("except",!1);addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){return"function"==typeof e&&(e=e(new Proxy(this.config.fields,new io({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.where=e,this}having(e){return"function"==typeof e&&(e=e(new Proxy(this.config.fields,new io({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.having=e,this}groupBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.fields,new io({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(t)?t:[t]}else this.config.groupBy=e;return this}orderBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.fields,new io({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=i:this.config.orderBy=i}else this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=e:this.config.orderBy=e;return this}limit(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).limit=e:this.config.limit=e,this}offset(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).offset=e:this.config.offset=e,this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}as(e){return new Proxy(new R(this.getSQL(),this.config.fields,e),new io({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new io({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}}class st extends se{static [n]="SQLiteSelect";_prepare(e=!0){if(!this.session)throw Error("Cannot execute a query on a query builder. Please use a database instance instead.");let t=ea(this.config.fields),i=this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),t,"all",!0);return i.joinsNotNullableMap=this.joinsNotNullableMap,i}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.all()}}for(let e of[i7])for(let t of Object.getOwnPropertyNames(e.prototype))"constructor"!==t&&Object.defineProperty(st.prototype,t,Object.getOwnPropertyDescriptor(e.prototype,t)||Object.create(null));function si(e,t){return(i,s,...r)=>{let n=[s,...r].map(i=>({type:e,isAll:t,rightSelect:i}));for(let e of n)if(!el(i.getSelectedFields(),e.rightSelect.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return i.addSetOperators(n)}}let ss=()=>({union:sr,unionAll:sn,intersect:sa,except:sl}),sr=si("union",!1),sn=si("union",!0),sa=si("intersect",!1),sl=si("except",!1);class so{static [n]="SQLiteQueryBuilder";dialect;dialectConfig;constructor(e){this.dialect=a(e,i3)?e:void 0,this.dialectConfig=a(e,i3)?void 0:e}$with(e){let t=this;return{as:i=>("function"==typeof i&&(i=i(t)),new Proxy(new V(i.getSQL(),i.getSelectedFields(),e,!0),new io({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}}with(...e){let t=this;return{select:function(i){return new i9({fields:i??void 0,session:void 0,dialect:t.getDialect(),withList:e})},selectDistinct:function(i){return new i9({fields:i??void 0,session:void 0,dialect:t.getDialect(),withList:e,distinct:!0})}}}select(e){return new i9({fields:e??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(e){return new i9({fields:e??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}getDialect(){return this.dialect||(this.dialect=new i5(this.dialectConfig)),this.dialect}}class su extends i7{constructor(e,t,i,s){super(),this.table=e,this.session=t,this.dialect=i,this.config={table:e,withList:s}}static [n]="SQLiteDelete";config;where(e){return this.config.where=e,this}orderBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.table[S.Symbol.Columns],new io({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.orderBy=i}else this.config.orderBy=e;return this}limit(e){return this.config.limit=e,this}returning(e=this.table[i1.Symbol.Columns]){return this.config.returning=ea(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0)}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(e){return this._prepare().execute(e)}$dynamic(){return this}}class sc{constructor(e,t,i,s){this.table=e,this.session=t,this.dialect=i,this.withList=s}static [n]="SQLiteInsertBuilder";values(e){if(0===(e=Array.isArray(e)?e:[e]).length)throw Error("values() must be called with at least one value");let t=e.map(e=>{let t={},i=this.table[S.Symbol.Columns];for(let s of Object.keys(e)){let r=e[s];t[s]=a(r,J)?r:new Y(r,i[s])}return t});return new sh(this.table,t,this.session,this.dialect,this.withList)}select(e){let t="function"==typeof e?e(new so):e;if(!a(t,J)&&!el(this.table[d],t._.selectedFields))throw Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");return new sh(this.table,t,this.session,this.dialect,this.withList,!0)}}class sh extends i7{constructor(e,t,i,s,r,n){super(),this.session=i,this.dialect=s,this.config={table:e,values:t,withList:r,select:n}}static [n]="SQLiteInsert";config;returning(e=this.config.table[i1.Symbol.Columns]){return this.config.returning=ea(e),this}onConflictDoNothing(e={}){if(void 0===e.target)this.config.onConflict=H`do nothing`;else{let t=Array.isArray(e.target)?H`${e.target}`:H`${[e.target]}`,i=e.where?H` where ${e.where}`:H``;this.config.onConflict=H`${t} do nothing${i}`}return this}onConflictDoUpdate(e){if(e.where&&(e.targetWhere||e.setWhere))throw Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');let t=e.where?H` where ${e.where}`:void 0,i=e.targetWhere?H` where ${e.targetWhere}`:void 0,s=e.setWhere?H` where ${e.setWhere}`:void 0,r=Array.isArray(e.target)?H`${e.target}`:H`${[e.target]}`,n=this.dialect.buildUpdateSet(this.config.table,eo(this.config.table,e.set));return this.config.onConflict=H`${r}${i} do update set ${n}${t}${s}`,this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0)}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}}class sd{constructor(e,t,i,s){this.table=e,this.session=t,this.dialect=i,this.withList=s}static [n]="SQLiteUpdateBuilder";set(e){return new sm(this.table,eo(this.table,e),this.session,this.dialect,this.withList)}}class sm extends i7{constructor(e,t,i,s,r){super(),this.session=i,this.dialect=s,this.config={set:t,table:e,withList:r,joins:[]}}static [n]="SQLiteUpdate";config;from(e){return this.config.from=e,this}createJoin(e){return(t,i)=>{let s=eu(t);if("string"==typeof s&&this.config.joins.some(e=>e.alias===s))throw Error(`Alias "${s}" is already used in this query`);if("function"==typeof i){let e=this.config.from?a(t,i1)?t[S.Symbol.Columns]:a(t,R)?t._.selectedFields:a(t,i4)?t[z].selectedFields:void 0:void 0;i=i(new Proxy(this.config.table[S.Symbol.Columns],new io({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),e&&new Proxy(e,new io({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}return this.config.joins.push({on:i,table:t,joinType:e,alias:s}),this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where(e){return this.config.where=e,this}orderBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.table[S.Symbol.Columns],new io({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.orderBy=i}else this.config.orderBy=e;return this}limit(e){return this.config.limit=e,this}returning(e=this.config.table[i1.Symbol.Columns]){return this.config.returning=ea(e),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0)}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}}class sf extends J{constructor(e){super(sf.buildEmbeddedCount(e.source,e.filters).queryChunks),this.params=e,this.session=e.session,this.sql=sf.buildCount(e.source,e.filters)}sql;static [n]="SQLiteCountBuilderAsync";[Symbol.toStringTag]="SQLiteCountBuilderAsync";session;static buildEmbeddedCount(e,t){return H`(select count(*) from ${e}${H.raw(" where ").if(t)}${t})`}static buildCount(e,t){return H`select count(*) from ${e}${H.raw(" where ").if(t)}${t}`}then(e,t){return Promise.resolve(this.session.count(this.sql)).then(e,t)}catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}}class sp{constructor(e,t,i,s,r,n,a,l){this.mode=e,this.fullSchema=t,this.schema=i,this.tableNamesMap=s,this.table=r,this.tableConfig=n,this.dialect=a,this.session=l}static [n]="SQLiteAsyncRelationalQueryBuilder";findMany(e){return"sync"===this.mode?new sy(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},"many"):new sg(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},"many")}findFirst(e){return"sync"===this.mode?new sy(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first"):new sg(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first")}}class sg extends i7{constructor(e,t,i,s,r,n,a,l,o){super(),this.fullSchema=e,this.schema=t,this.tableNamesMap=i,this.table=s,this.tableConfig=r,this.dialect=n,this.session=a,this.config=l,this.mode=o}static [n]="SQLiteAsyncRelationalQuery";mode;getSQL(){return this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}).sql}_prepare(e=!1){let{query:t,builtQuery:i}=this._toSQL();return this.session[e?"prepareOneTimeQuery":"prepareQuery"](i,void 0,"first"===this.mode?"get":"all",!0,(e,i)=>{let s=e.map(e=>(function e(t,i,s,r,n=e=>e){let l={};for(let[o,u]of r.entries())if(u.isJson){let r=i.relations[u.tsKey],c=s[o],h="string"==typeof c?JSON.parse(c):c;l[u.tsKey]=a(r,t6)?h&&e(t,t[u.relationTableTsKey],h,u.selection,n):h.map(i=>e(t,t[u.relationTableTsKey],i,u.selection,n))}else{let e,t=n(s[o]),i=u.field;e=a(i,T)?i:a(i,J)?i.decoder:i.sql.decoder,l[u.tsKey]=null===t?null:e.mapFromDriverValue(t)}return l})(this.schema,this.tableConfig,e,t.selection,i));return"first"===this.mode?s[0]:s})}prepare(){return this._prepare(!1)}_toSQL(){let e=this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}),t=this.dialect.sqlToQuery(e.sql);return{query:e,builtQuery:t}}toSQL(){return this._toSQL().builtQuery}executeRaw(){return"first"===this.mode?this._prepare(!1).get():this._prepare(!1).all()}async execute(){return this.executeRaw()}}class sy extends sg{static [n]="SQLiteSyncRelationalQuery";sync(){return this.executeRaw()}}class sb extends i7{constructor(e,t,i,s,r){super(),this.execute=e,this.getSQL=t,this.dialect=s,this.mapBatchResult=r,this.config={action:i}}static [n]="SQLiteRaw";config;getQuery(){return{...this.dialect.sqlToQuery(this.getSQL()),method:this.config.action}}mapResult(e,t){return t?this.mapBatchResult(e):e}_prepare(){return this}isResponseInArrayMode(){return!1}}class sS{constructor(e,t,i,s){this.resultKind=e,this.dialect=t,this.session=i,this._=s?{schema:s.schema,fullSchema:s.fullSchema,tableNamesMap:s.tableNamesMap}:{schema:void 0,fullSchema:{},tableNamesMap:{}},this.query={};const r=this.query;if(this._.schema)for(const[n,a]of Object.entries(this._.schema))r[n]=new sp(e,s.fullSchema,this._.schema,this._.tableNamesMap,s.fullSchema[n],a,t,i)}static [n]="BaseSQLiteDatabase";query;$with(e){let t=this;return{as:i=>("function"==typeof i&&(i=i(new so(t.dialect))),new Proxy(new V(i.getSQL(),i.getSelectedFields(),e,!0),new io({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}}$count(e,t){return new sf({source:e,filters:t,session:this.session})}with(...e){let t=this;return{select:function(i){return new i9({fields:i??void 0,session:t.session,dialect:t.dialect,withList:e})},selectDistinct:function(i){return new i9({fields:i??void 0,session:t.session,dialect:t.dialect,withList:e,distinct:!0})},update:function(i){return new sd(i,t.session,t.dialect,e)},insert:function(i){return new sc(i,t.session,t.dialect,e)},delete:function(i){return new su(i,t.session,t.dialect,e)}}}select(e){return new i9({fields:e??void 0,session:this.session,dialect:this.dialect})}selectDistinct(e){return new i9({fields:e??void 0,session:this.session,dialect:this.dialect,distinct:!0})}update(e){return new sd(e,this.session,this.dialect)}insert(e){return new sc(e,this.session,this.dialect)}delete(e){return new su(e,this.session,this.dialect)}run(e){let t="string"==typeof e?H.raw(e):e.getSQL();return"async"===this.resultKind?new sb(async()=>this.session.run(t),()=>t,"run",this.dialect,this.session.extractRawRunValueFromBatchResult.bind(this.session)):this.session.run(t)}all(e){let t="string"==typeof e?H.raw(e):e.getSQL();return"async"===this.resultKind?new sb(async()=>this.session.all(t),()=>t,"all",this.dialect,this.session.extractRawAllValueFromBatchResult.bind(this.session)):this.session.all(t)}get(e){let t="string"==typeof e?H.raw(e):e.getSQL();return"async"===this.resultKind?new sb(async()=>this.session.get(t),()=>t,"get",this.dialect,this.session.extractRawGetValueFromBatchResult.bind(this.session)):this.session.get(t)}values(e){let t="string"==typeof e?H.raw(e):e.getSQL();return"async"===this.resultKind?new sb(async()=>this.session.values(t),()=>t,"values",this.dialect,this.session.extractRawValuesValueFromBatchResult.bind(this.session)):this.session.values(t)}transaction(e,t){return this.session.transaction(e,t)}}class sw extends i7{constructor(e){super(),this.resultCb=e}static [n]="ExecuteResultSync";async execute(){return this.resultCb()}sync(){return this.resultCb()}}class sT{constructor(e,t,i){this.mode=e,this.executeMethod=t,this.query=i}static [n]="PreparedQuery";joinsNotNullableMap;getQuery(){return this.query}mapRunResult(e,t){return e}mapAllResult(e,t){throw Error("Not implemented")}mapGetResult(e,t){throw Error("Not implemented")}execute(e){return"async"===this.mode?this[this.executeMethod](e):new sw(()=>this[this.executeMethod](e))}mapResult(e,t){switch(this.executeMethod){case"run":return this.mapRunResult(e,t);case"all":return this.mapAllResult(e,t);case"get":return this.mapGetResult(e,t)}}}class sN{constructor(e){this.dialect=e}static [n]="SQLiteSession";prepareOneTimeQuery(e,t,i,s){return this.prepareQuery(e,t,i,s)}run(e){let t=this.dialect.sqlToQuery(e);try{return this.prepareOneTimeQuery(t,void 0,"run",!1).run()}catch(e){throw new im({cause:e,message:`Failed to run the query '${t.sql}'`})}}extractRawRunValueFromBatchResult(e){return e}all(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",!1).all()}extractRawAllValueFromBatchResult(e){throw Error("Not implemented")}get(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",!1).get()}extractRawGetValueFromBatchResult(e){throw Error("Not implemented")}values(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",!1).values()}async count(e){return(await this.values(e))[0][0]}extractRawValuesValueFromBatchResult(e){throw Error("Not implemented")}}class sv extends sS{constructor(e,t,i,s,r=0){super(e,t,i,s),this.schema=s,this.nestedIndex=r}static [n]="SQLiteTransaction";rollback(){throw new ip}}class sL extends sN{constructor(e,t,i,s={}){super(t),this.client=e,this.schema=i,this.logger=s.logger??new u}static [n]="BetterSQLiteSession";logger;prepareQuery(e,t,i,s,r){return new s$(this.client.prepare(e.sql),e,this.logger,t,i,s,r)}transaction(e,t={}){let i=new sx("sync",this.dialect,this,this.schema);return this.client.transaction(e)[t.behavior??"deferred"](i)}}class sx extends sv{static [n]="BetterSQLiteTransaction";transaction(e){let t=`sp${this.nestedIndex}`,i=new sx("sync",this.dialect,this.session,this.schema,this.nestedIndex+1);this.session.run(H.raw(`savepoint ${t}`));try{let s=e(i);return this.session.run(H.raw(`release savepoint ${t}`)),s}catch(e){throw this.session.run(H.raw(`rollback to savepoint ${t}`)),e}}}class s$ extends sT{constructor(e,t,i,s,r,n,a){super("sync",r,t),this.stmt=e,this.logger=i,this.fields=s,this._isResponseInArrayMode=n,this.customResultMapper=a}static [n]="BetterSQLitePreparedQuery";run(e){let t=ei(this.query.params,e??{});return this.logger.logQuery(this.query.sql,t),this.stmt.run(...t)}all(e){let{fields:t,joinsNotNullableMap:i,query:s,logger:r,stmt:n,customResultMapper:a}=this;if(!t&&!a){let t=ei(s.params,e??{});return r.logQuery(s.sql,t),n.all(...t)}let l=this.values(e);return a?a(l):l.map(e=>en(t,e,i))}get(e){let t=ei(this.query.params,e??{});this.logger.logQuery(this.query.sql,t);let{fields:i,stmt:s,joinsNotNullableMap:r,customResultMapper:n}=this;if(!i&&!n)return s.get(...t);let a=s.raw().get(...t);if(a)return n?n([a]):en(i,a,r)}values(e){let t=ei(this.query.params,e??{});return this.logger.logQuery(this.query.sql,t),this.stmt.raw().all(...t)}isResponseInArrayMode(){return this._isResponseInArrayMode}}class sQ extends sS{static [n]="BetterSQLite3Database"}function sP(e,t={}){let i,s,r=new i5({casing:t.casing});if(!0===t.logger?i=new o:!1!==t.logger&&(i=t.logger),t.schema){let e=function(e,t){1===Object.keys(e).length&&"default"in e&&!a(e.default,S)&&(e=e.default);let i={},s={},r={};for(let[n,l]of Object.entries(e))if(a(l,S)){let e=w(l),t=s[e];for(let s of(i[e]=n,r[n]={tsName:n,dbName:l[S.Symbol.Name],schema:l[S.Symbol.Schema],columns:l[S.Symbol.Columns],relations:t?.relations??{},primaryKey:t?.primaryKey??[]},Object.values(l[S.Symbol.Columns])))s.primary&&r[n].primaryKey.push(s);let o=l[S.Symbol.ExtraConfigBuilder]?.(l[S.Symbol.ExtraConfigColumns]);if(o)for(let e of Object.values(o))a(e,t_)&&r[n].primaryKey.push(...e.columns)}else if(a(l,t5)){let e,n=w(l.table),a=i[n];for(let[i,o]of Object.entries(l.config(t(l.table))))if(a){let t=r[a];t.relations[i]=o,e&&t.primaryKey.push(...e)}else n in s||(s[n]={relations:{},primaryKey:e}),s[n].relations[i]=o}return{tables:r,tableNamesMap:i}}(t.schema,t9);s={fullSchema:t.schema,schema:e.tables,tableNamesMap:e.tableNamesMap}}let n=new sL(e,r,s,{logger:i}),l=new sQ("sync",r,n,s);return l.$client=e,l}function sC(...e){if(void 0===e[0]||"string"==typeof e[0])return sP(void 0===e[0]?new r.default:new r.default(e[0]),e[1]);if(function(e){if("object"!=typeof e||null===e||"Object"!==e.constructor.name)return!1;if("logger"in e){let t=typeof e.logger;return"boolean"===t||"object"===t&&"function"==typeof e.logger.logQuery||"undefined"===t}if("schema"in e){let t=typeof e.logger;return"object"===t||"undefined"===t}if("casing"in e){let t=typeof e.logger;return"string"===t||"undefined"===t}if("mode"in e)return"default"===e.mode&&"planetscale"===e.mode&&void 0===e.mode;if("connection"in e){let t=typeof e.connection;return"string"===t||"object"===t||"undefined"===t}if("client"in e){let t=typeof e.client;return"object"===t||"function"===t||"undefined"===t}return 0===Object.keys(e).length}(e[0])){let{connection:t,client:i,...s}=e[0];if(i)return sP(i,s);if("object"==typeof t){let{source:e,...i}=t;return sP(new r.default(e,i),s)}return sP(new r.default(t),s)}return sP(e[0],e[1])}(sC||(sC={})).mock=function(e){return sP({},e)};class sE{constructor(e,t){this.name=e,this.unique=t}static [n]="SQLiteIndexBuilderOn";on(...e){return new sB(this.name,e,this.unique)}}class sB{static [n]="SQLiteIndexBuilder";config;constructor(e,t,i){this.config={name:e,columns:t,unique:i,where:void 0}}where(e){return this.config.where=e,this}build(e){return new s_(this.config,e)}}class s_{static [n]="SQLiteIndex";config;constructor(e,t){this.config={...e,table:t}}}let sq=i2("projects",{id:iZ("id").primaryKey(),githubOwner:iZ("github_owner").notNull(),githubRepo:iZ("github_repo").notNull(),displayName:iZ("display_name"),description:iZ("description"),homepageUrl:iZ("homepage_url"),stars:iU("stars").default(0),isPublic:iU("is_public",{mode:"boolean"}).default(!0),isFeatured:iU("is_featured",{mode:"boolean"}).default(!1),lastSyncedAt:iU("last_synced_at",{mode:"timestamp"}),createdAt:iU("created_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date),updatedAt:iU("updated_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date)}),sD=i2("specs",{id:iZ("id").primaryKey(),projectId:iZ("project_id").notNull().references(()=>sq.id,{onDelete:"cascade"}),specNumber:iU("spec_number"),specName:iZ("spec_name").notNull(),title:iZ("title"),status:iZ("status",{enum:["planned","in-progress","complete","archived"]}),priority:iZ("priority",{enum:["low","medium","high","critical"]}),tags:iZ("tags"),assignee:iZ("assignee"),contentMd:iZ("content_md").notNull(),contentHtml:iZ("content_html"),createdAt:iU("created_at",{mode:"timestamp"}),updatedAt:iU("updated_at",{mode:"timestamp"}),completedAt:iU("completed_at",{mode:"timestamp"}),filePath:iZ("file_path").notNull(),githubUrl:iZ("github_url"),syncedAt:iU("synced_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date)},e=>({uniqueSpecNumber:new sE("unique_spec_number",!0).on(e.projectId,e.specNumber)})),sO=i2("spec_relationships",{id:iZ("id").primaryKey(),specId:iZ("spec_id").notNull().references(()=>sD.id,{onDelete:"cascade"}),relatedSpecId:iZ("related_spec_id").notNull().references(()=>sD.id,{onDelete:"cascade"}),relationshipType:iZ("relationship_type",{enum:["depends_on","related"]}).notNull(),createdAt:iU("created_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date)}),sA=i2("sync_logs",{id:iZ("id").primaryKey(),projectId:iZ("project_id").notNull().references(()=>sq.id,{onDelete:"cascade"}),status:iZ("status",{enum:["pending","running","success","failed"]}).notNull(),specsAdded:iU("specs_added").default(0),specsUpdated:iU("specs_updated").default(0),specsDeleted:iU("specs_deleted").default(0),errorMessage:iZ("error_message"),startedAt:iU("started_at",{mode:"timestamp"}).notNull().$defaultFn(()=>new Date),completedAt:iU("completed_at",{mode:"timestamp"}),durationMs:iU("duration_ms")}),sF=t7(sq,({many:e})=>({specs:e(sD),syncLogs:e(sA)})),sj=t7(sD,({one:e,many:t})=>({project:e(sq,{fields:[sD.projectId],references:[sq.id]}),dependencies:t(sO,{relationName:"spec"}),dependents:t(sO,{relationName:"relatedSpec"})})),sI=t7(sO,({one:e})=>({spec:e(sD,{fields:[sO.specId],references:[sD.id],relationName:"spec"}),relatedSpec:e(sD,{fields:[sO.relatedSpecId],references:[sD.id],relationName:"relatedSpec"})})),sR=t7(sA,({one:e})=>({project:e(sq,{fields:[sA.projectId],references:[sq.id]})}));e.s(["projects",0,sq,"projectsRelations",0,sF,"specRelationships",0,sO,"specRelationshipsRelations",0,sI,"specs",0,sD,"specsRelations",0,sj,"syncLogs",0,sA,"syncLogsRelations",0,sR],365239);var sV=e.i(365239),sU=e.i(814747);let sz=null,sM=null,sK=new Proxy({},{get:(e,t,i)=>Reflect.get(function(){if(!sz){let e=process.env.DATABASE_PATH||(0,sU.join)(process.cwd(),"leanspec.db");(function(e){e.pragma("foreign_keys = ON");let t=t=>!!e.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = ?").get(t);t("projects")||e.exec(`
14
14
  CREATE TABLE IF NOT EXISTS "projects" (
15
15
  "id" TEXT PRIMARY KEY NOT NULL,
16
16
  "github_owner" TEXT NOT NULL,
@@ -69,6 +69,6 @@ module.exports=[5271,22124,79174,31585,e=>{"use strict";let t,i;var s,r=e.i(2537
69
69
  `),e.prepare("SELECT name FROM sqlite_master WHERE type='index' AND name = ?").get("unique_spec_number")||e.exec(`
70
70
  CREATE UNIQUE INDEX IF NOT EXISTS "unique_spec_number"
71
71
  ON "specs" ("project_id", "spec_number");
72
- `)})(sM=new r.default(e)),sz=sC(sM,{schema:sV})}return sz}(),t,i)});e.s(["db",0,sK],5271),e.s(["schema",0,sV],31585)}];
72
+ `)})(sM=new r.default(e)),sz=sC(sM,{schema:sV})}return sz}(),t,i)});e.s(["db",0,sK],605271),e.s(["schema",0,sV],431585)}];
73
73
 
74
74
  //# sourceMappingURL=packages_ui_src_lib_db_index_ts_556307fa._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[14430,e=>{e.v(s=>Promise.all(["server/chunks/[root-of-the-server]__f06435b0._.js","server/chunks/packages_ui_src_lib_db_index_ts_556307fa._.js"].map(s=>e.l(s))).then(()=>s(18146)))}];
1
+ module.exports=[614430,e=>{e.v(s=>Promise.all(["server/chunks/[root-of-the-server]__f06435b0._.js","server/chunks/packages_ui_src_lib_db_index_ts_556307fa._.js"].map(s=>e.l(s))).then(()=>s(318146)))}];
2
2
 
3
3
  //# sourceMappingURL=packages_ui_src_lib_specs_sources_database-source_ts_0bd881ee._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[18146,e=>{"use strict";var s=e.i(5271),c=e.i(31585),t=e.i(22124);class a{async getAllSpecs(e){let a=e?s.db.select().from(c.schema.specs).where((0,t.eq)(c.schema.specs.projectId,e)):s.db.select().from(c.schema.specs);return await a.orderBy(c.schema.specs.specNumber)}async getSpec(e,a){if(!a)return null;let r=parseInt(e.split("-")[0],10);if(isNaN(r))return null;let l=await s.db.select().from(c.schema.specs).where((0,t.and)((0,t.eq)(c.schema.specs.projectId,a),(0,t.eq)(c.schema.specs.specNumber,r))).limit(1);return l.length>0?l[0]:null}async getSpecsByStatus(e,a){let r=[(0,t.eq)(c.schema.specs.status,e)];return a&&r.push((0,t.eq)(c.schema.specs.projectId,a)),await s.db.select().from(c.schema.specs).where((0,t.and)(...r)).orderBy(c.schema.specs.specNumber)}async searchSpecs(e,s){let c=await this.getAllSpecs(s),t=e.toLowerCase();return c.filter(e=>e.specName.toLowerCase().includes(t)||e.title?.toLowerCase().includes(t)||e.contentMd.toLowerCase().includes(t))}invalidateCache(){}}e.s(["DatabaseSource",()=>a])}];
1
+ module.exports=[318146,e=>{"use strict";var s=e.i(605271),c=e.i(431585),t=e.i(422124);class a{async getAllSpecs(e){let a=e?s.db.select().from(c.schema.specs).where((0,t.eq)(c.schema.specs.projectId,e)):s.db.select().from(c.schema.specs);return await a.orderBy(c.schema.specs.specNumber)}async getSpec(e,a){if(!a)return null;let r=parseInt(e.split("-")[0],10);if(isNaN(r))return null;let l=await s.db.select().from(c.schema.specs).where((0,t.and)((0,t.eq)(c.schema.specs.projectId,a),(0,t.eq)(c.schema.specs.specNumber,r))).limit(1);return l.length>0?l[0]:null}async getSpecsByStatus(e,a){let r=[(0,t.eq)(c.schema.specs.status,e)];return a&&r.push((0,t.eq)(c.schema.specs.projectId,a)),await s.db.select().from(c.schema.specs).where((0,t.and)(...r)).orderBy(c.schema.specs.specNumber)}async searchSpecs(e,s){let c=await this.getAllSpecs(s),t=e.toLowerCase();return c.filter(e=>e.specName.toLowerCase().includes(t)||e.title?.toLowerCase().includes(t)||e.contentMd.toLowerCase().includes(t))}invalidateCache(){}}e.s(["DatabaseSource",()=>a])}];
2
2
 
3
3
  //# sourceMappingURL=packages_ui_src_lib_specs_sources_database-source_ts_baa0160d._.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[58736,535660,a=>{"use strict";var b,c=a.i(106433),d=a.i(991434),e=0;let f=function(a){var b=++e;return(0,d.default)(a)+b};var g=a.i(726938),h=a.i(593917),i=a.i(653800),j=Math.ceil,k=Math.max;let l=function(a,b,c,d){for(var e=-1,f=k(j((b-a)/(c||1)),0),g=Array(f);f--;)g[d?f:++e]=a,a+=c;return g};var m=a.i(31565),n=a.i(871821);let o=function(a,b,c){return c&&"number"!=typeof c&&(0,m.default)(a,b,c)&&(b=c=void 0),a=(0,n.default)(a),void 0===b?(b=a,a=0):b=(0,n.default)(b),c=void 0===c?a<b?1:-1:(0,n.default)(c),l(a,b,c,void 0)};a.i(670537);var p=a.i(692655);class q{constructor(){var a={};a._next=a._prev=a,this._sentinel=a}dequeue(){var a=this._sentinel,b=a._prev;if(b!==a)return r(b),b}enqueue(a){var b=this._sentinel;a._prev&&a._next&&r(a),a._next=b._next,b._next._prev=a,b._next=a,a._prev=b}toString(){for(var a=[],b=this._sentinel,c=b._prev;c!==b;)a.push(JSON.stringify(c,s)),c=c._prev;return"["+a.join(", ")+"]"}}function r(a){a._prev._next=a._next,a._next._prev=a._prev,delete a._next,delete a._prev}function s(a,b){if("_next"!==a&&"_prev"!==a)return b}var t=g.constant(1);function u(a,b,d,e,f){var g=f?[]:void 0;return c.forEach(a.inEdges(e.v),function(c){var e=a.edge(c),h=a.node(c.v);f&&g.push({v:c.v,w:c.w}),h.out-=e,v(b,d,h)}),c.forEach(a.outEdges(e.v),function(c){var e=a.edge(c),f=c.w,g=a.node(f);g.in-=e,v(b,d,g)}),a.removeNode(e.v),g}function v(a,b,c){c.out?c.in?a[c.out-c.in+b].enqueue(c):a[a.length-1].enqueue(c):a[0].enqueue(c)}function w(a){var b,d,e,g,j,k="greedy"===a.graph().acyclicer?function(a,b){if(1>=a.nodeCount())return[];var d,e,f,g,j,k,l,m=(d=a,e=b||t,f=new p.Graph,g=0,j=0,c.forEach(d.nodes(),function(a){f.setNode(a,{v:a,in:0,out:0})}),c.forEach(d.edges(),function(a){var b=f.edge(a.v,a.w)||0,c=e(a);f.setEdge(a.v,a.w,b+c),j=Math.max(j,f.node(a.v).out+=c),g=Math.max(g,f.node(a.w).in+=c)}),k=o(j+g+3).map(function(){return new q}),l=g+1,c.forEach(f.nodes(),function(a){v(k,l,f.node(a))}),{graph:f,buckets:k,zeroIdx:l}),n=function(a,b,c){for(var d,e=[],f=b[b.length-1],g=b[0];a.nodeCount();){for(;d=g.dequeue();)u(a,b,c,d);for(;d=f.dequeue();)u(a,b,c,d);if(a.nodeCount()){for(var h=b.length-2;h>0;--h)if(d=b[h].dequeue()){e=e.concat(u(a,b,c,d,!0));break}}}return e}(m.graph,m.buckets,m.zeroIdx);return h.flatten(i.map(n,function(b){return a.outEdges(b.v,b.w)}))}(a,(b=a,function(a){return b.edge(a).weight})):(d=a,e=[],g={},j={},c.forEach(d.nodes(),function a(b){Object.prototype.hasOwnProperty.call(j,b)||(j[b]=!0,g[b]=!0,c.forEach(d.outEdges(b),function(b){Object.prototype.hasOwnProperty.call(g,b.w)?e.push(b):a(b.w)}),delete g[b])}),e);c.forEach(k,function(b){var c=a.edge(b);a.removeEdge(b),c.forwardName=b.name,c.reversed=!0,a.setEdge(b.w,b.v,c,f("rev"))})}function x(a){c.forEach(a.edges(),function(b){var c=a.edge(b);if(c.reversed){a.removeEdge(b);var d=c.forwardName;delete c.reversed,delete c.forwardName,a.setEdge(b.w,b.v,c,d)}})}a.s(["run",()=>w,"undo",()=>x],566850),a.i(566850);var y=a.i(881239),y=y,z=a.i(647168),A=a.i(534791),B=a.i(150455),C=a.i(904600),D=a.i(601398),E=(b=function(a,b){return null==a?{}:(0,z.default)(a,b,function(b,c){return(0,A.default)(a,c)})},(0,D.default)((0,C.default)(b,void 0,B.default),b+"")),F=a.i(707895),G=a.i(155917);let H=function(a,b){return a>b};var I=a.i(245279);let J=function(a){return a&&a.length?(0,G.default)(a,I.default,H):void 0};var K=a.i(583151),L=a.i(106488),M=a.i(516020),N=a.i(323754);let O=function(a,b){var c={};return b=(0,N.default)(b,3),(0,M.default)(a,function(a,d,e){(0,L.default)(c,d,b(a,d,e))}),c};var P=a.i(762993);let Q=function(a,b,c){for(var d=-1,e=a.length,f=b.length,g={};++d<e;){var h=d<f?b[d]:void 0;c(g,a[d],h)}return g};var R=a.i(840042),S=a.i(391986),S=S,T=a.i(996524),U=a.i(171955);let V=function(){return U.default.Date.now()};function W(a,b,c,d){var e;do e=f(d);while(a.hasNode(e))return c.dummy=b,a.setNode(e,c),e}function X(a){var b=new p.Graph({multigraph:a.isMultigraph()}).setGraph(a.graph());return c.forEach(a.nodes(),function(c){a.children(c).length||b.setNode(c,a.node(c))}),c.forEach(a.edges(),function(c){b.setEdge(c,a.edge(c))}),b}function Y(a,b){var c,d,e=a.x,f=a.y,g=b.x-e,h=b.y-f,i=a.width/2,j=a.height/2;if(!g&&!h)throw Error("Not possible to find intersection inside of the rectangle");return Math.abs(h)*i>Math.abs(g)*j?(h<0&&(j=-j),c=j*g/h,d=j):(g<0&&(i=-i),c=i,d=i*h/g),{x:e+c,y:f+d}}function Z(a){var b=i.map(o(_(a)+1),function(){return[]});return c.forEach(a.nodes(),function(c){var d=a.node(c),e=d.rank;R.isUndefined(e)||(b[e][d.order]=c)}),b}function $(a,b,c,d){var e={width:0,height:0};return arguments.length>=4&&(e.rank=c,e.order=d),W(a,"border",e,b)}function _(a){return J(i.map(a.nodes(),function(b){var c=a.node(b).rank;if(!R.isUndefined(c))return c}))}function aa(a,b){var c=V();try{return b()}finally{console.log(a+" time: "+(V()-c)+"ms")}}function ab(a,b){return b()}function ac(a,b,c,d,e,f){var g=e[b][f-1],h=W(a,"border",{width:0,height:0,rank:f,borderType:b},c);e[b][f]=h,a.setParent(h,d),g&&a.setEdge(g,h,{weight:1})}function ad(a){c.forEach(a.nodes(),function(b){ae(a.node(b))}),c.forEach(a.edges(),function(b){ae(a.edge(b))})}function ae(a){var b=a.width;a.width=a.height,a.height=b}function af(a){a.y=-a.y}function ag(a){var b=a.x;a.x=a.y,a.y=b}function ah(a){a.graph().dummyChains=[],c.forEach(a.edges(),function(b){!function(a,b){var c,d,e=b.v,f=a.node(e).rank,g=b.w,h=a.node(g).rank,i=b.name,j=a.edge(b),k=j.labelRank;if(h!==f+1){a.removeEdge(b);var l=void 0;for(d=0,++f;f<h;++d,++f)j.points=[],c=W(a,"edge",l={width:0,height:0,edgeLabel:j,edgeObj:b,rank:f},"_d"),f===k&&(l.width=j.width,l.height=j.height,l.dummy="edge-label",l.labelpos=j.labelpos),a.setEdge(e,c,{weight:j.weight},i),0===d&&a.graph().dummyChains.push(c),e=c;a.setEdge(e,g,{weight:j.weight},i)}}(a,b)})}function ai(a){c.forEach(a.graph().dummyChains,function(b){var c,d=a.node(b),e=d.edgeLabel;for(a.setEdge(d.edgeObj,e);d.dummy;)c=a.successors(b)[0],a.removeNode(b),e.points.push({x:d.x,y:d.y}),"edge-label"===d.dummy&&(e.x=d.x,e.y=d.y,e.width=d.width,e.height=d.height),b=c,d=a.node(b)})}a.s(["run",()=>ah,"undo",()=>ai],515695);var aj=a.i(556553);let ak=function(a,b){return a&&a.length?(0,G.default)(a,(0,N.default)(b,2),aj.default):void 0};var S=S;function al(a){var b={};c.forEach(a.sources(),function c(d){var e=a.node(d);if(Object.prototype.hasOwnProperty.call(b,d))return e.rank;b[d]=!0;var f=S.default(i.map(a.outEdges(d),function(b){return c(b.w)-a.edge(b).minlen}));return(f===1/0||null==f)&&(f=0),e.rank=f})}function am(a,b){return a.node(b.w).rank-a.node(b.v).rank-a.edge(b).minlen}function an(a){var b,d,e,f,g=new p.Graph({directed:!1}),h=a.nodes()[0],i=a.nodeCount();for(g.setNode(h,{});b=g,d=a,c.forEach(b.nodes(),function a(e){c.forEach(d.nodeEdges(e),function(c){var f=c.v,g=e===f?c.w:f;b.hasNode(g)||am(d,c)||(b.setNode(g,{}),b.setEdge(e,g,{}),a(g))})}),b.nodeCount()<i;)e=function(a,b){return ak(b.edges(),function(c){if(a.hasNode(c.v)!==a.hasNode(c.w))return am(b,c)})}(g,a),f=g.hasNode(e.v)?am(a,e):-am(a,e),function(a,b,d){c.forEach(a.nodes(),function(a){b.node(a).rank+=d})}(g,a,f);return g}var ao=a.i(705395),ap=a.i(295089),aq=a.i(15681);g.constant(1),a.i(30167),a.i(776438),a.i(604636);var ar=a.i(947891);a.i(100612),a.i(116320),a.i(53597),a.i(519181),g.constant(1);var as=a.i(989131),at=a.i(681900),au=a.i(501897),av=a.i(600639),aw=(0,a.i(373792).default)("length"),ax=a.i(515624),ay="\ud800-\udfff",az="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",aA="\ud83c[\udffb-\udfff]",aB="[^"+ay+"]",aC="(?:\ud83c[\udde6-\uddff]){2}",aD="[\ud800-\udbff][\udc00-\udfff]",aE="(?:"+az+"|"+aA+")?",aF="[\\ufe0e\\ufe0f]?",aG="(?:\\u200d(?:"+[aB,aC,aD].join("|")+")"+aF+aE+")*",aH=RegExp(aA+"(?="+aA+")|"+("(?:"+[aB+az+"?",az,aC,aD,"["+ay+"]"].join("|"))+")"+(aF+aE+aG),"g");function aI(){}aI.prototype=Error();var aJ=a.i(429054);function aK(a,b,c){aJ.isArray(b)||(b=[b]);var d=(a.isDirected()?a.successors:a.neighbors).bind(a),e=[],f={};return aq.each(b,function(b){if(!a.hasNode(b))throw Error("Graph does not have node: "+b);!function a(b,c,d,e,f,g){!Object.prototype.hasOwnProperty.call(e,c)&&(e[c]=!0,d||g.push(c),aq.each(f(c),function(c){a(b,c,d,e,f,g)}),d&&g.push(c))}(a,b,"post"===c,f,d,e)}),e}function aL(a){b=a,d=new p.Graph().setGraph(b.graph()),c.forEach(b.nodes(),function(a){d.setNode(a,b.node(a))}),c.forEach(b.edges(),function(a){var c=d.edge(a.v,a.w)||{weight:0,minlen:1},e=b.edge(a);d.setEdge(a.v,a.w,{weight:c.weight+e.weight,minlen:Math.max(c.minlen,e.minlen)})}),al(a=d);var b,d,e,f,g=an(a);for(aO(g),aM(g,a);e=aP(g);)f=aQ(g,a,e),aR(g,a,e,f)}function aM(a,b){var d=aK(a,a.nodes(),"post");d=d.slice(0,d.length-1),c.forEach(d,function(c){var d,e,f,g;d=a,e=b,f=c,g=d.node(f).parent,d.edge(f,g).cutvalue=aN(d,e,f)})}function aN(a,b,d){var e=a.node(d).parent,f=!0,g=b.edge(d,e),h=0;return g||(f=!1,g=b.edge(e,d)),h=g.weight,c.forEach(b.nodeEdges(d),function(c){var g=c.v===d,i=g?c.w:c.v;if(i!==e){var j,k,l,m=g===f,n=b.edge(c).weight;if(h+=m?n:-n,j=a,k=d,l=i,j.hasEdge(k,l)){var o=a.edge(d,i).cutvalue;h+=m?-o:o}}}),h}function aO(a,b){arguments.length<2&&(b=a.nodes()[0]),function a(b,d,e,f,g){var h=e,i=b.node(f);return d[f]=!0,c.forEach(b.neighbors(f),function(c){Object.prototype.hasOwnProperty.call(d,c)||(e=a(b,d,e,c,f))}),i.low=h,i.lim=e++,g?i.parent=g:delete i.parent,e}(a,{},1,b)}function aP(a){return ao.find(a.edges(),function(b){return a.edge(b).cutvalue<0})}function aQ(a,b,c){var d=c.v,e=c.w;b.hasEdge(d,e)||(d=c.w,e=c.v);var f=a.node(d),g=a.node(e),h=f,i=!1;return f.lim>g.lim&&(h=g,i=!0),ak(ap.filter(b.edges(),function(b){return i===aS(a,a.node(b.v),h)&&i!==aS(a,a.node(b.w),h)}),function(a){return am(b,a)})}function aR(a,b,d,e){var f,g,h,i,j=d.v,k=d.w;a.removeEdge(j,k),a.setEdge(e.v,e.w,{}),aO(a),aM(a,b),f=a,g=b,h=ao.find(f.nodes(),function(a){return!g.node(a).parent}),i=(i=aK(f,h,"pre")).slice(1),c.forEach(i,function(a){var b=f.node(a).parent,c=g.edge(a,b),d=!1;c||(c=g.edge(b,a),d=!0),g.node(a).rank=g.node(b).rank+(d?c.minlen:-c.minlen)})}function aS(a,b,c){return c.low<=b.lim&&b.lim<=c.lim}aL.initLowLimValues=aO,aL.initCutValues=aM,aL.calcCutValue=aN,aL.leaveEdge=aP,aL.enterEdge=aQ,aL.exchangeEdges=aR;var aT=a.i(441633),aU=a.i(156616),aV=a.i(78869),aW=a.i(403307),aX=a.i(664355),aY=a.i(505553),aZ=a.i(897766);let a$=function(a,b){var c=a.length;for(a.sort(b);c--;)a[c]=a[c].value;return a};var a_=a.i(854645),a0=a.i(936914);let a1=function(a,b){if(a!==b){var c=void 0!==a,d=null===a,e=a==a,f=(0,a0.default)(a),g=void 0!==b,h=null===b,i=b==b,j=(0,a0.default)(b);if(!h&&!j&&!f&&a>b||f&&g&&i&&!h&&!j||d&&g&&i||!c&&i||!e)return 1;if(!d&&!f&&!j&&a<b||j&&c&&e&&!d&&!f||h&&c&&e||!g&&e||!i)return -1}return 0},a2=function(a,b,c){for(var d=-1,e=a.criteria,f=b.criteria,g=e.length,h=c.length;++d<g;){var i=a1(e[d],f[d]);if(i){if(d>=h)return i;return i*("desc"==c[d]?-1:1)}}return a.index-b.index},a3=function(a,b,c){b=b.length?(0,aX.default)(b,function(a){return(0,ar.default)(a)?function(b){return(0,aY.default)(b,1===a.length?a[0]:a)}:a}):[I.default];var d=-1;return b=(0,aX.default)(b,(0,a_.default)(N.default)),a$((0,aZ.default)(a,function(a,c,e){return{criteria:(0,aX.default)(b,function(b){return b(a)}),index:++d,value:a}}),function(a,b){return a2(a,b,c)})};var a4=(0,a.i(878788).default)(function(a,b){if(null==a)return[];var c=b.length;return c>1&&(0,m.default)(a,b[0],b[1])?b=[]:c>2&&(0,m.default)(b[0],b[1],b[2])&&(b=[b[0]]),a3(a,(0,aW.default)(b,1),[])});function a5(a,b,c){for(var d;b.length&&(d=K.last(b)).i<=c;)b.pop(),a.push(d.vs),c++;return c}function a6(a,b,d){return i.map(b,function(b){var e,g;return e=function(a){for(var b;a.hasNode(b=f("_root")););return b}(a),g=new p.Graph({compound:!0}).setGraph({root:e}).setDefaultNodeLabel(function(b){return a.node(b)}),c.forEach(a.nodes(),function(f){var h=a.node(f),i=a.parent(f);(h.rank===b||h.minRank<=b&&b<=h.maxRank)&&(g.setNode(f),g.setParent(f,i||e),c.forEach(a[d](f),function(b){var c=b.v===f?b.w:b.v,d=g.edge(c,f),e=R.isUndefined(d)?0:d.weight;g.setEdge(c,f,{weight:a.edge(b).weight+e})}),Object.prototype.hasOwnProperty.call(h,"minRank")&&g.setNode(f,{borderLeft:h.borderLeft[b],borderRight:h.borderRight[b]}))}),g})}function a7(a,b){c.forEach(b,function(b){c.forEach(b,function(b,c){a.node(b).order=c})})}var a8=a.i(311450),a9=a.i(258186),ba=a.i(658484),S=S,y=y;function bb(a,b,c){if(b>c){var d=b;b=c,c=d}Object.prototype.hasOwnProperty.call(a,b)||Object.defineProperty(a,b,{enumerable:!0,configurable:!0,value:{},writable:!0}),Object.defineProperty(a[b],c,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function bc(a,b){var d=b&&b.debugTiming?aa:ab;d("layout",()=>{var b=d(" buildLayoutGraph",()=>{var b,d,e;return b=a,d=new p.Graph({multigraph:!0,compound:!0}),e=bm(b.graph()),d.setGraph(y.default({},be,bl(e,bd),E(e,bf))),c.forEach(b.nodes(),function(a){var c=bm(b.node(a));d.setNode(a,F.defaults(bl(c,bg),bh)),d.setParent(a,b.parent(a))}),c.forEach(b.edges(),function(a){var c=bm(b.edge(a));d.setEdge(a,y.default({},bj,bl(c,bi),E(c,bk)))}),d});d(" runLayout",()=>{var a,e;return a=b,void((e=d)(" makeSpaceForEdgeLabels",()=>{var b,d;return d=(b=a).graph(),void(d.ranksep/=2,c.forEach(b.edges(),function(a){var c=b.edge(a);c.minlen*=2,"c"!==c.labelpos.toLowerCase()&&("TB"===d.rankdir||"BT"===d.rankdir?c.width+=c.labeloffset:c.height+=c.labeloffset)}))}),e(" removeSelfEdges",()=>{var b;return b=a,void c.forEach(b.edges(),function(a){if(a.v===a.w){var c=b.node(a.v);c.selfEdges||(c.selfEdges=[]),c.selfEdges.push({e:a,label:b.edge(a)}),b.removeEdge(a)}})}),e(" acyclic",()=>w(a)),e(" nestingGraph.run",()=>{var b,d,e,f,g,h,i,j;return b=W(a,"root",{},"_root"),h=a,i={},c.forEach(h.children(),function(a){!function a(b,d){var e=h.children(b);e&&e.length&&c.forEach(e,function(b){a(b,d+1)}),i[b]=d}(a,1)}),d=i,f=2*(e=J(aT.values(d))-1)+1,a.graph().nestingRoot=b,c.forEach(a.edges(),function(b){a.edge(b).minlen*=f}),g=(j=a,aU.reduce(j.edges(),function(a,b){return a+j.edge(b).weight},0)+1),void(c.forEach(a.children(),function(h){!function a(b,d,e,f,g,h,i){var j=b.children(i);if(!j.length){i!==d&&b.setEdge(d,i,{weight:0,minlen:e});return}var k=$(b,"_bt"),l=$(b,"_bb"),m=b.node(i);b.setParent(k,i),m.borderTop=k,b.setParent(l,i),m.borderBottom=l,c.forEach(j,function(c){a(b,d,e,f,g,h,c);var j=b.node(c),m=j.borderTop?j.borderTop:c,n=j.borderBottom?j.borderBottom:c,o=j.borderTop?f:2*f,p=m!==n?1:g-h[i]+1;b.setEdge(k,m,{weight:o,minlen:p,nestingEdge:!0}),b.setEdge(n,l,{weight:o,minlen:p,nestingEdge:!0})}),b.parent(i)||b.setEdge(d,k,{weight:0,minlen:g+h[i]})}(a,b,f,g,e,d,h)}),a.graph().nodeRankFactor=f)}),e(" rank",()=>(function(a){switch(a.graph().ranker){case"network-simplex":default:aL(a);break;case"tight-tree":var b;al(b=a),an(b);break;case"longest-path":al(a)}})(X(a))),e(" injectEdgeLabelProxies",()=>{var b;return b=a,void c.forEach(b.edges(),function(a){var c=b.edge(a);if(c.width&&c.height){var d=b.node(a.v),e={rank:(b.node(a.w).rank-d.rank)/2+d.rank,e:a};W(b,"edge-proxy",e,"_ep")}})}),e(" removeEmptyRanks",()=>{var b,d,e,f;return b=S.default(i.map(a.nodes(),function(b){return a.node(b).rank})),d=[],c.forEach(a.nodes(),function(c){var e=a.node(c).rank-b;d[e]||(d[e]=[]),d[e].push(c)}),e=0,f=a.graph().nodeRankFactor,void c.forEach(d,function(b,d){R.isUndefined(b)&&d%f!=0?--e:e&&c.forEach(b,function(b){a.node(b).rank+=e})})}),e(" nestingGraph.cleanup",()=>{var b;return b=a.graph(),void(a.removeNode(b.nestingRoot),delete b.nestingRoot,c.forEach(a.edges(),function(b){a.edge(b).nestingEdge&&a.removeEdge(b)}))}),e(" normalizeRanks",()=>{var b;return b=S.default(i.map(a.nodes(),function(b){return a.node(b).rank})),void c.forEach(a.nodes(),function(c){var d=a.node(c);T.has(d,"rank")&&(d.rank-=b)})}),e(" assignRankMinMax",()=>{var b,d;return b=a,d=0,void(c.forEach(b.nodes(),function(a){var c=b.node(a);c.borderTop&&(c.minRank=b.node(c.borderTop).rank,c.maxRank=b.node(c.borderBottom).rank,d=J(d,c.maxRank))}),b.graph().maxRank=d)}),e(" removeEdgeLabelProxies",()=>{var b;return b=a,void c.forEach(b.nodes(),function(a){var c=b.node(a);"edge-proxy"===c.dummy&&(b.edge(c.e).labelRank=c.rank,b.removeNode(a))})}),e(" normalize.run",()=>ah(a)),e(" parentDummyChains",()=>{var b,d,e,f;return d=a,e={},f=0,c.forEach(d.children(),function a(b){var g=f;c.forEach(d.children(b),a),e[b]={low:g,lim:f++}}),b=e,void c.forEach(a.graph().dummyChains,function(c){for(var d=a.node(c),e=d.edgeObj,f=function(a,b,c,d){var e,f,g=[],h=[],i=Math.min(b[c].low,b[d].low),j=Math.max(b[c].lim,b[d].lim);e=c;do g.push(e=a.parent(e));while(e&&(b[e].low>i||j>b[e].lim))for(f=e,e=d;(e=a.parent(e))!==f;)h.push(e);return{path:g.concat(h.reverse()),lca:f}}(a,b,e.v,e.w),g=f.path,h=f.lca,i=0,j=g[0],k=!0;c!==e.w;){if(d=a.node(c),k){for(;(j=g[i])!==h&&a.node(j).maxRank<d.rank;)i++;j===h&&(k=!1)}if(!k){for(;i<g.length-1&&a.node(j=g[i+1]).minRank<=d.rank;)i++;j=g[i]}a.setParent(c,j),c=a.successors(c)[0]}})}),e(" addBorderSegments",()=>{c.forEach(a.children(),function b(d){var e=a.children(d),f=a.node(d);if(e.length&&c.forEach(e,b),Object.prototype.hasOwnProperty.call(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(var g=f.minRank,h=f.maxRank+1;g<h;++g)ac(a,"borderLeft","_bl",d,f,g),ac(a,"borderRight","_br",d,f,g)}})}),e(" order",()=>(function(a){var b=_(a),d=a6(a,o(1,b+1),"inEdges"),e=a6(a,o(b-1,-1,-1),"outEdges"),f=(g={},j=ap.filter(a.nodes(),function(b){return!a.children(b).length}),k=J(i.map(j,function(b){return a.node(b).rank})),l=i.map(o(k+1),function(){return[]}),m=a4(j,function(b){return a.node(b).rank}),c.forEach(m,function b(d){T.has(g,d)||(g[d]=!0,l[a.node(d).rank].push(d),c.forEach(a.successors(d),b))}),l);a7(a,f);for(var g,j,k,l,m,n,q=1/0,r=0,s=0;s<4;++r,++s){(function(a,b){var d=new p.Graph;c.forEach(a,function(a){var e,f,g,j=a.graph().root,k=function a(b,d,e,f){var g,j,k,l,m,n,o,p,q,r,s,t,u=b.children(d),v=b.node(d),w=v?v.borderLeft:void 0,x=v?v.borderRight:void 0,y={};w&&(u=ap.filter(u,function(a){return a!==w&&a!==x}));var z=(g=u,i.map(g,function(a){var c=b.inEdges(a);if(!c.length)return{v:a};var d=aU.reduce(c,function(a,c){var d=b.edge(c),e=b.node(c.v);return{sum:a.sum+d.weight*e.order,weight:a.weight+d.weight}},{sum:0,weight:0});return{v:a,barycenter:d.sum/d.weight,weight:d.weight}}));c.forEach(z,function(c){if(b.children(c.v).length){var d,g,h=a(b,c.v,e,f);y[c.v]=h,Object.prototype.hasOwnProperty.call(h,"barycenter")&&(d=c,g=h,R.isUndefined(d.barycenter)?(d.barycenter=g.barycenter,d.weight=g.weight):(d.barycenter=(d.barycenter*d.weight+g.barycenter*g.weight)/(d.weight+g.weight),d.weight+=g.weight))}});var A=(j={},c.forEach(z,function(a,b){var c=j[a.v]={indegree:0,in:[],out:[],vs:[a.v],i:b};R.isUndefined(a.barycenter)||(c.barycenter=a.barycenter,c.weight=a.weight)}),c.forEach(e.edges(),function(a){var b=j[a.v],c=j[a.w];R.isUndefined(b)||R.isUndefined(c)||(c.indegree++,b.out.push(j[a.w]))}),function(a){for(var b=[];a.length;){var d=a.pop();b.push(d),c.forEach(d.in.reverse(),function(a){return function(b){!b.merged&&(R.isUndefined(b.barycenter)||R.isUndefined(a.barycenter)||b.barycenter>=a.barycenter)&&function(a,b){var c=0,d=0;a.weight&&(c+=a.barycenter*a.weight,d+=a.weight),b.weight&&(c+=b.barycenter*b.weight,d+=b.weight),a.vs=b.vs.concat(a.vs),a.barycenter=c/d,a.weight=d,a.i=Math.min(b.i,a.i),b.merged=!0}(a,b)}}(d)),c.forEach(d.out,function(b){return function(c){c.in.push(b),0==--c.indegree&&a.push(c)}}(d))}return i.map(ap.filter(b,function(a){return!a.merged}),function(a){return E(a,["vs","i","barycenter","weight"])})}(ap.filter(j,function(a){return!a.indegree})));!function(a,b){c.forEach(a,function(a){a.vs=h.flatten(a.vs.map(function(a){return b[a]?b[a].vs:a}))})}(A,y);var B=(n=(k=function(a){return Object.prototype.hasOwnProperty.call(a,"barycenter")},l={lhs:[],rhs:[]},c.forEach(A,function(a){k(a)?l.lhs.push(a):l.rhs.push(a)}),m=l).lhs,o=a4(m.rhs,function(a){return-a.i}),p=[],q=0,r=0,s=0,n.sort(function(a){return function(b,c){return b.barycenter<c.barycenter?-1:b.barycenter>c.barycenter?1:a?c.i-b.i:b.i-c.i}}(!!f)),s=a5(p,o,s),c.forEach(n,function(a){s+=a.vs.length,p.push(a.vs),q+=a.barycenter*a.weight,r+=a.weight,s=a5(p,o,s)}),t={vs:h.flatten(p)},r&&(t.barycenter=q/r,t.weight=r),t);if(w&&(B.vs=h.flatten([w,B.vs,x]),b.predecessors(w).length)){var C=b.node(b.predecessors(w)[0]),D=b.node(b.predecessors(x)[0]);Object.prototype.hasOwnProperty.call(B,"barycenter")||(B.barycenter=0,B.weight=0),B.barycenter=(B.barycenter*B.weight+C.order+D.order)/(B.weight+2),B.weight+=2}return B}(a,j,d,b);c.forEach(k.vs,function(b,c){a.node(b).order=c}),e=k.vs,g={},c.forEach(e,function(b){for(var c,e,h=a.parent(b);h;){if((c=a.parent(h))?(e=g[c],g[c]=h):(e=f,f=h),e&&e!==h)return void d.setEdge(e,h);h=c}})})})(r%2?d:e,r%4>=2),f=Z(a);var t,u=function(a,b){for(var d=0,e=1;e<b.length;++e)d+=function(a,b,d){for(var e=Q(d||[],i.map(d,function(a,b){return b})||[],P.default),f=h.flatten(i.map(b,function(b){return a4(i.map(a.outEdges(b),function(b){return{pos:e[b.w],weight:a.edge(b).weight}}),"pos")})),g=1;g<d.length;)g<<=1;var j=2*g-1;g-=1;var k=i.map(Array(j),function(){return 0}),l=0;return c.forEach(f.forEach(function(a){var b=a.pos+g;k[b]+=a.weight;for(var c=0;b>0;)b%2&&(c+=k[b+1]),b=b-1>>1,k[b]+=a.weight;l+=a.weight*c})),l}(a,b[e-1],b[e]);return d}(a,f);u<q&&(s=0,t=f,n=(0,aV.default)(t,5),q=u)}a7(a,n)})(a)),e(" insertSelfEdges",()=>{var b,d;return d=Z(b=a),void c.forEach(d,function(a){var d=0;c.forEach(a,function(a,e){var f=b.node(a);f.order=e+d,c.forEach(f.selfEdges,function(a){W(b,"selfedge",{width:a.label.width,height:a.label.height,rank:f.rank,order:e+ ++d,e:a.e,label:a.label},"_se")}),delete f.selfEdges})})}),e(" adjustCoordinateSystem",()=>{var b;("lr"===(b=a.graph().rankdir.toLowerCase())||"rl"===b)&&ad(a)}),e(" position",()=>{var b,d,e,f,g,h,j,k,l,m,n,q,r,s,t,u,v;t=Z(s=b=X(b=a)),u=s.graph().ranksep,v=0,c.forEach(t,function(a){var b=J(i.map(a,function(a){return s.node(a).height}));c.forEach(a,function(a){s.node(a).y=v+b/2}),v+=b+u}),f=Z(d=b),h=y.default((g={},aU.reduce(f,function(a,b){var e=0,f=0,h=a.length,i=K.last(b);return c.forEach(b,function(a,j){var k=function(a,b){if(a.node(b).dummy)return ao.find(a.predecessors(b),function(b){return a.node(b).dummy})}(d,a),l=k?d.node(k).order:h;(k||a===i)&&(c.forEach(b.slice(f,j+1),function(a){c.forEach(d.predecessors(a),function(b){var c=d.node(b),f=c.order;(f<e||l<f)&&!(c.dummy&&d.node(a).dummy)&&bb(g,b,a)})}),f=j+1,e=l)}),b}),g),function(a,b){var d={};function e(b,e,f,g,h){var i;c.forEach(o(e,f),function(e){i=b[e],a.node(i).dummy&&c.forEach(a.predecessors(i),function(b){var c=a.node(b);c.dummy&&(c.order<g||c.order>h)&&bb(d,b,i)})})}return aU.reduce(b,function(b,d){var f,g=-1,h=0;return c.forEach(d,function(c,i){if("border"===a.node(c).dummy){var j=a.predecessors(c);j.length&&(f=a.node(j[0]).order,e(d,h,i,g,f),h=i,g=f)}e(d,h,d.length,f,b.length)}),d}),d}(d,f)),j={},c.forEach(["u","d"],function(a){e="u"===a?f:aT.values(f).reverse(),c.forEach(["l","r"],function(b){"r"===b&&(e=i.map(e,function(a){return aT.values(a).reverse()}));var f,g,k,l,m=("u"===a?d.predecessors:d.successors).bind(d),n=(f=e,g={},k={},l={},c.forEach(f,function(a){c.forEach(a,function(a,b){g[a]=a,k[a]=a,l[a]=b})}),c.forEach(f,function(a){var b=-1;c.forEach(a,function(a){var c=m(a);if(c.length)for(var d=((c=a4(c,function(a){return l[a]})).length-1)/2,e=Math.floor(d),f=Math.ceil(d);e<=f;++e){var i=c[e];k[a]===a&&b<l[i]&&!function(a,b,c){if(b>c){var d=b;b=c,c=d}return!!a[b]&&Object.prototype.hasOwnProperty.call(a[b],c)}(h,a,i)&&(k[i]=a,k[a]=g[a]=g[i],b=l[i])}})}),{root:g,align:k}),o=function(a,b,d,e,f){var g,h,i,j,k,l,m,n,o,q,r={},s=(g=a,h=b,i=d,j=f,n=new p.Graph,q=(k=(o=g.graph()).nodesep,l=o.edgesep,m=j,function(a,b,c){var d,e,f=a.node(b),g=a.node(c);if(d=0+f.width/2,Object.prototype.hasOwnProperty.call(f,"labelpos"))switch(f.labelpos.toLowerCase()){case"l":e=-f.width/2;break;case"r":e=f.width/2}if(e&&(d+=m?e:-e),e=0,d+=(f.dummy?l:k)/2,d+=(g.dummy?l:k)/2,d+=g.width/2,Object.prototype.hasOwnProperty.call(g,"labelpos"))switch(g.labelpos.toLowerCase()){case"l":e=g.width/2;break;case"r":e=-g.width/2}return e&&(d+=m?e:-e),e=0,d}),c.forEach(h,function(a){var b;c.forEach(a,function(a){var c=i[a];if(n.setNode(c),b){var d=i[b],e=n.edge(d,c);n.setEdge(d,c,Math.max(q(g,a,b),e||0))}b=a})}),n),t=f?"borderLeft":"borderRight";function u(a,b){for(var c=s.nodes(),d=c.pop(),e={};d;)e[d]?a(d):(e[d]=!0,c.push(d),c=c.concat(b(d))),d=c.pop()}return u(function(a){r[a]=s.inEdges(a).reduce(function(a,b){return Math.max(a,r[b.v]+s.edge(b))},0)},s.predecessors.bind(s)),u(function(b){var c=s.outEdges(b).reduce(function(a,b){return Math.min(a,r[b.w]-s.edge(b))},1/0),d=a.node(b);c!==1/0&&d.borderType!==t&&(r[b]=Math.max(r[b],c))},s.successors.bind(s)),c.forEach(e,function(a){r[a]=r[d[a]]}),r}(d,e,n.root,n.align,"r"===b);"r"===b&&(o=O(o,function(a){return-a})),j[a+b]=o})}),k=ak(aT.values(j),function(a){var b,c=-1/0,e=1/0;return b=function(a,b){var f,g,h=(f=d,g=b,f.node(g).width/2);c=Math.max(a+h,c),e=Math.min(a-h,e)},null==a||(0,a9.default)(a,(0,a8.default)(b),ba.default),c-e}),l=aT.values(k),m=S.default(l),n=J(l),c.forEach(["u","d"],function(a){c.forEach(["l","r"],function(b){var c,d=a+b,e=j[d];if(e!==k){var f=aT.values(e);(c="l"===b?m-S.default(f):n-J(f))&&(j[d]=O(e,function(a){return a+c}))}})}),q=d.graph().align,r=O(j.ul,function(a,b){if(q)return j[q.toLowerCase()][b];var c=a4(i.map(j,b));return(c[1]+c[2])/2}),r&&(0,M.default)(r,(0,a8.default)(function(a,c){b.node(c).x=a}))}),e(" positionSelfEdges",()=>{var b;return b=a,void c.forEach(b.nodes(),function(a){var c=b.node(a);if("selfedge"===c.dummy){var d=b.node(c.e.v),e=d.x+d.width/2,f=d.y,g=c.x-e,h=d.height/2;b.setEdge(c.e,c.label),b.removeNode(a),c.label.points=[{x:e+2*g/3,y:f-h},{x:e+5*g/6,y:f-h},{x:e+g,y:f},{x:e+5*g/6,y:f+h},{x:e+2*g/3,y:f+h}],c.label.x=c.x,c.label.y=c.y}})}),e(" removeBorderNodes",()=>{var b;return b=a,void(c.forEach(b.nodes(),function(a){if(b.children(a).length){var c=b.node(a),d=b.node(c.borderTop),e=b.node(c.borderBottom),f=b.node(K.last(c.borderLeft)),g=b.node(K.last(c.borderRight));c.width=Math.abs(g.x-f.x),c.height=Math.abs(e.y-d.y),c.x=f.x+c.width/2,c.y=d.y+c.height/2}}),c.forEach(b.nodes(),function(a){"border"===b.node(a).dummy&&b.removeNode(a)}))}),e(" normalize.undo",()=>ai(a)),e(" fixupEdgeLabelCoords",()=>{var b;return b=a,void c.forEach(b.edges(),function(a){var c=b.edge(a);if(Object.prototype.hasOwnProperty.call(c,"x"))switch(("l"===c.labelpos||"r"===c.labelpos)&&(c.width-=c.labeloffset),c.labelpos){case"l":c.x-=c.width/2+c.labeloffset;break;case"r":c.x+=c.width/2+c.labeloffset}})}),e(" undoCoordinateSystem",()=>{var b,d,e;("bt"===(b=a.graph().rankdir.toLowerCase())||"rl"===b)&&(d=a,c.forEach(d.nodes(),function(a){af(d.node(a))}),c.forEach(d.edges(),function(a){var b=d.edge(a);c.forEach(b.points,af),Object.prototype.hasOwnProperty.call(b,"y")&&af(b)})),("lr"===b||"rl"===b)&&(e=a,c.forEach(e.nodes(),function(a){ag(e.node(a))}),c.forEach(e.edges(),function(a){var b=e.edge(a);c.forEach(b.points,ag),Object.prototype.hasOwnProperty.call(b,"x")&&ag(b)}),ad(a))}),e(" translateGraph",()=>(function(a){var b=1/0,d=0,e=1/0,f=0,g=a.graph(),h=g.marginx||0,i=g.marginy||0;function j(a){var c=a.x,g=a.y,h=a.width,i=a.height;b=Math.min(b,c-h/2),d=Math.max(d,c+h/2),e=Math.min(e,g-i/2),f=Math.max(f,g+i/2)}c.forEach(a.nodes(),function(b){j(a.node(b))}),c.forEach(a.edges(),function(b){var c=a.edge(b);Object.prototype.hasOwnProperty.call(c,"x")&&j(c)}),b-=h,e-=i,c.forEach(a.nodes(),function(c){var d=a.node(c);d.x-=b,d.y-=e}),c.forEach(a.edges(),function(d){var f=a.edge(d);c.forEach(f.points,function(a){a.x-=b,a.y-=e}),Object.prototype.hasOwnProperty.call(f,"x")&&(f.x-=b),Object.prototype.hasOwnProperty.call(f,"y")&&(f.y-=e)}),g.width=d-b+h,g.height=f-e+i})(a)),e(" assignNodeIntersects",()=>{var b;return b=a,void c.forEach(b.edges(),function(a){var c,d,e=b.edge(a),f=b.node(a.v),g=b.node(a.w);e.points?(c=e.points[0],d=e.points[e.points.length-1]):(e.points=[],c=g,d=f),e.points.unshift(Y(f,c)),e.points.push(Y(g,d))})}),e(" reversePoints",()=>{var b;return b=a,void c.forEach(b.edges(),function(a){var c=b.edge(a);c.reversed&&c.points.reverse()})}),e(" acyclic.undo",()=>x(a)))}),d(" updateInputGraph",()=>{var d,e;return d=a,e=b,void(c.forEach(d.nodes(),function(a){var b=d.node(a),c=e.node(a);b&&(b.x=c.x,b.y=c.y,e.children(a).length&&(b.width=c.width,b.height=c.height))}),c.forEach(d.edges(),function(a){var b=d.edge(a),c=e.edge(a);b.points=c.points,Object.prototype.hasOwnProperty.call(c,"x")&&(b.x=c.x,b.y=c.y)}),d.graph().width=e.graph().width,d.graph().height=e.graph().height)})})}var bd=["nodesep","edgesep","ranksep","marginx","marginy"],be={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},bf=["acyclicer","ranker","rankdir","align"],bg=["width","height"],bh={width:0,height:0},bi=["minlen","weight","width","height","labeloffset"],bj={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},bk=["labelpos"];function bl(a,b){return O(E(a,b),Number)}function bm(a){var b={};return c.forEach(a,function(a,c){b[c.toLowerCase()]=a}),b}a.s(["layout",()=>bc],535660),a.i(515695),a.s([],58736)}];
2
+
3
+ //# sourceMappingURL=1ce3b_dagre-d3-es_src_dagre_index_f9cad90b.js.map