d1s 0.2.11 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (318) hide show
  1. package/dist/.next/.next/BUILD_ID +1 -1
  2. package/dist/.next/.next/app-build-manifest.json +28 -28
  3. package/dist/.next/.next/app-path-routes-manifest.json +1 -1
  4. package/dist/.next/.next/build-manifest.json +3 -3
  5. package/dist/.next/.next/cache/.rscinfo +1 -1
  6. package/dist/.next/.next/cache/.tsbuildinfo +1 -1
  7. package/dist/.next/.next/cache/webpack/client-production/0.pack +0 -0
  8. package/dist/.next/.next/cache/webpack/client-production/1.pack +0 -0
  9. package/dist/.next/.next/cache/webpack/client-production/10.pack +0 -0
  10. package/dist/.next/.next/cache/webpack/client-production/11.pack +0 -0
  11. package/dist/.next/.next/cache/webpack/client-production/12.pack +0 -0
  12. package/dist/.next/.next/cache/webpack/client-production/2.pack +0 -0
  13. package/dist/.next/.next/cache/webpack/client-production/3.pack +0 -0
  14. package/dist/.next/.next/cache/webpack/client-production/4.pack +0 -0
  15. package/dist/.next/.next/cache/webpack/client-production/5.pack +0 -0
  16. package/dist/.next/.next/cache/webpack/client-production/6.pack +0 -0
  17. package/dist/.next/.next/cache/webpack/client-production/7.pack +0 -0
  18. package/dist/.next/.next/cache/webpack/client-production/8.pack +0 -0
  19. package/dist/.next/.next/cache/webpack/client-production/9.pack +0 -0
  20. package/dist/.next/.next/cache/webpack/client-production/index.pack +0 -0
  21. package/dist/.next/.next/cache/webpack/client-production/index.pack.old +0 -0
  22. package/dist/.next/.next/cache/webpack/edge-server-production/index.pack +0 -0
  23. package/dist/.next/.next/cache/webpack/server-production/0.pack +0 -0
  24. package/dist/.next/.next/cache/webpack/server-production/1.pack +0 -0
  25. package/dist/.next/.next/cache/webpack/server-production/2.pack +0 -0
  26. package/dist/.next/.next/cache/webpack/server-production/3.pack +0 -0
  27. package/dist/.next/.next/cache/webpack/server-production/index.pack +0 -0
  28. package/dist/.next/.next/cache/webpack/server-production/index.pack.old +0 -0
  29. package/dist/.next/.next/next-minimal-server.js.nft.json +1 -1
  30. package/dist/.next/.next/next-server.js.nft.json +1 -1
  31. package/dist/.next/.next/prerender-manifest.json +1 -1
  32. package/dist/.next/.next/required-server-files.json +1 -1
  33. package/dist/.next/.next/server/app/_not-found/page.js +1 -1
  34. package/dist/.next/.next/server/app/_not-found/page.js.nft.json +1 -1
  35. package/dist/.next/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  36. package/dist/.next/.next/server/app/_not-found.html +1 -1
  37. package/dist/.next/.next/server/app/_not-found.rsc +4 -4
  38. package/dist/.next/.next/server/app/api/cloudflare/route.js +1 -1
  39. package/dist/.next/.next/server/app/api/cloudflare/route_client-reference-manifest.js +1 -1
  40. package/dist/.next/.next/server/app/api/databases/route.js +1 -1
  41. package/dist/.next/.next/server/app/api/databases/route_client-reference-manifest.js +1 -1
  42. package/dist/.next/.next/server/app/api/migrations/sync/route.js +5 -5
  43. package/dist/.next/.next/server/app/api/migrations/sync/route_client-reference-manifest.js +1 -1
  44. package/dist/.next/.next/server/app/api/migrations/sync-files/route.js +3 -3
  45. package/dist/.next/.next/server/app/api/migrations/sync-files/route_client-reference-manifest.js +1 -1
  46. package/dist/.next/.next/server/app/api/pull-data/confirm/route.js +1 -1
  47. package/dist/.next/.next/server/app/api/pull-data/confirm/route_client-reference-manifest.js +1 -1
  48. package/dist/.next/.next/server/app/api/pull-remote/confirm/route.js +2 -2
  49. package/dist/.next/.next/server/app/api/pull-remote/confirm/route_client-reference-manifest.js +1 -1
  50. package/dist/.next/.next/server/app/api/pull-remote/preview/route.js +4 -4
  51. package/dist/.next/.next/server/app/api/pull-remote/preview/route_client-reference-manifest.js +1 -1
  52. package/dist/.next/.next/server/app/api/push-remote/confirm/route.js +5 -5
  53. package/dist/.next/.next/server/app/api/push-remote/confirm/route_client-reference-manifest.js +1 -1
  54. package/dist/.next/.next/server/app/api/push-remote/preview/route.js +4 -4
  55. package/dist/.next/.next/server/app/api/push-remote/preview/route_client-reference-manifest.js +1 -1
  56. package/dist/.next/.next/server/app/api/query/route.js +3 -3
  57. package/dist/.next/.next/server/app/api/query/route_client-reference-manifest.js +1 -1
  58. package/dist/.next/.next/server/app/api/tables/[name]/route.js +5 -5
  59. package/dist/.next/.next/server/app/api/tables/[name]/route_client-reference-manifest.js +1 -1
  60. package/dist/.next/.next/server/app/api/tables/route.js +2 -2
  61. package/dist/.next/.next/server/app/api/tables/route_client-reference-manifest.js +1 -1
  62. package/dist/.next/.next/server/app/api/update/route.js +1 -1
  63. package/dist/.next/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  64. package/dist/.next/.next/server/app/index.html +2 -2
  65. package/dist/.next/.next/server/app/index.rsc +5 -5
  66. package/dist/.next/.next/server/app/page.js +7 -7
  67. package/dist/.next/.next/server/app/page.js.nft.json +1 -1
  68. package/dist/.next/.next/server/app/page_client-reference-manifest.js +1 -1
  69. package/dist/.next/.next/server/app-paths-manifest.json +1 -1
  70. package/dist/.next/.next/server/chunks/226.js +12 -12
  71. package/dist/.next/.next/server/chunks/391.js +1 -1
  72. package/dist/.next/.next/server/chunks/572.js +1 -0
  73. package/dist/.next/.next/server/chunks/992.js +3 -3
  74. package/dist/.next/.next/server/middleware-build-manifest.js +1 -1
  75. package/dist/.next/.next/server/next-font-manifest.js +1 -1
  76. package/dist/.next/.next/server/next-font-manifest.json +1 -1
  77. package/dist/.next/.next/server/pages/404.html +1 -1
  78. package/dist/.next/.next/server/pages/500.html +1 -1
  79. package/dist/.next/.next/server/server-reference-manifest.json +1 -1
  80. package/dist/.next/.next/static/chunks/{576-c4daf274bb6469a1.js → 576-18a2209e1ed26aad.js} +1 -1
  81. package/dist/.next/.next/static/chunks/{92-c4466e0f1ca8a3a8.js → 92-5f7522943fcb72a8.js} +1 -1
  82. package/dist/.next/.next/static/chunks/app/{layout-be6ee67cf0c92654.js → layout-40ec07d04681ba81.js} +1 -1
  83. package/dist/.next/.next/static/chunks/app/page-f05cd0fc436bf9bc.js +1 -0
  84. package/dist/.next/.next/static/chunks/app/page-f2bc307c0d8acdaa.js +1 -0
  85. package/dist/.next/.next/static/chunks/{main-app-fa35024de9bd9284.js → main-app-4506e88db72db4b7.js} +1 -1
  86. package/dist/.next/.next/static/css/{9f6c25c5400f83d3.css → 7c16f57d325d0d7d.css} +1 -1
  87. package/dist/.next/.next/static/ejYPqJ2kVicVp5EFWOZIC/_buildManifest.js +1 -0
  88. package/dist/.next/.next/static/ejYPqJ2kVicVp5EFWOZIC/_ssgManifest.js +1 -0
  89. package/dist/.next/.next/static/gABGrAoO8IPArDo_Ns_7g/_buildManifest.js +1 -0
  90. package/dist/.next/.next/static/gABGrAoO8IPArDo_Ns_7g/_ssgManifest.js +1 -0
  91. package/dist/.next/.next/static/gh-QfIUVo4FTTduYCVKT6/_buildManifest.js +1 -0
  92. package/dist/.next/.next/static/gh-QfIUVo4FTTduYCVKT6/_ssgManifest.js +1 -0
  93. package/dist/.next/.next/static/media/8d697b304b401681-s.woff2 +0 -0
  94. package/dist/.next/.next/static/media/9610d9e46709d722-s.woff2 +0 -0
  95. package/dist/.next/.next/static/thaCy2qVeNqYYhdayr13C/_buildManifest.js +1 -0
  96. package/dist/.next/.next/static/thaCy2qVeNqYYhdayr13C/_ssgManifest.js +1 -0
  97. package/dist/.next/.next/static/ybCx6L6gHqtODbKmlhU-d/_buildManifest.js +1 -0
  98. package/dist/.next/.next/static/ybCx6L6gHqtODbKmlhU-d/_ssgManifest.js +1 -0
  99. package/dist/.next/.next/trace +3 -3
  100. package/dist/.next/.next/types/app/api/cloudflare/route.ts +1 -1
  101. package/dist/.next/.next/types/app/api/databases/route.ts +1 -1
  102. package/dist/.next/.next/types/app/api/migrations/sync/route.ts +1 -1
  103. package/dist/.next/.next/types/app/api/migrations/sync-files/route.ts +1 -1
  104. package/dist/.next/.next/types/app/api/pull-data/confirm/route.ts +1 -1
  105. package/dist/.next/.next/types/app/api/pull-remote/confirm/route.ts +1 -1
  106. package/dist/.next/.next/types/app/api/pull-remote/preview/route.ts +1 -1
  107. package/dist/.next/.next/types/app/api/push-remote/confirm/route.ts +1 -1
  108. package/dist/.next/.next/types/app/api/push-remote/preview/route.ts +1 -1
  109. package/dist/.next/.next/types/app/api/query/route.ts +1 -1
  110. package/dist/.next/.next/types/app/api/tables/[name]/route.ts +1 -1
  111. package/dist/.next/.next/types/app/api/tables/route.ts +1 -1
  112. package/dist/.next/.next/types/app/api/update/route.ts +1 -1
  113. package/dist/.next/.next/types/app/page.ts +1 -1
  114. package/dist/.next/BUILD_ID +1 -1
  115. package/dist/.next/app-build-manifest.json +28 -28
  116. package/dist/.next/app-path-routes-manifest.json +1 -1
  117. package/dist/.next/build-manifest.json +3 -3
  118. package/dist/.next/cache/.rscinfo +1 -1
  119. package/dist/.next/cache/.tsbuildinfo +1 -1
  120. package/dist/.next/cache/webpack/client-production/0.pack +0 -0
  121. package/dist/.next/cache/webpack/client-production/1.pack +0 -0
  122. package/dist/.next/cache/webpack/client-production/2.pack +0 -0
  123. package/dist/.next/cache/webpack/client-production/index.pack +0 -0
  124. package/dist/.next/cache/webpack/client-production/index.pack.old +0 -0
  125. package/dist/.next/cache/webpack/edge-server-production/index.pack +0 -0
  126. package/dist/.next/cache/webpack/server-production/0.pack +0 -0
  127. package/dist/.next/cache/webpack/server-production/index.pack +0 -0
  128. package/dist/.next/next-minimal-server.js.nft.json +1 -1
  129. package/dist/.next/next-server.js.nft.json +1 -1
  130. package/dist/.next/prerender-manifest.json +1 -1
  131. package/dist/.next/required-server-files.json +1 -1
  132. package/dist/.next/server/app/_not-found/page.js +1 -1
  133. package/dist/.next/server/app/_not-found/page.js.nft.json +1 -1
  134. package/dist/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  135. package/dist/.next/server/app/_not-found.html +1 -1
  136. package/dist/.next/server/app/_not-found.rsc +4 -4
  137. package/dist/.next/server/app/api/cloudflare/route.js +1 -1
  138. package/dist/.next/server/app/api/cloudflare/route_client-reference-manifest.js +1 -1
  139. package/dist/.next/server/app/api/databases/route.js +1 -1
  140. package/dist/.next/server/app/api/databases/route_client-reference-manifest.js +1 -1
  141. package/dist/.next/server/app/api/migrations/sync/route.js +5 -5
  142. package/dist/.next/server/app/api/migrations/sync/route_client-reference-manifest.js +1 -1
  143. package/dist/.next/server/app/api/migrations/sync-files/route.js +3 -3
  144. package/dist/.next/server/app/api/migrations/sync-files/route_client-reference-manifest.js +1 -1
  145. package/dist/.next/server/app/api/pull-data/confirm/route.js +1 -1
  146. package/dist/.next/server/app/api/pull-data/confirm/route_client-reference-manifest.js +1 -1
  147. package/dist/.next/server/app/api/pull-remote/confirm/route.js +2 -2
  148. package/dist/.next/server/app/api/pull-remote/confirm/route_client-reference-manifest.js +1 -1
  149. package/dist/.next/server/app/api/pull-remote/preview/route.js +4 -4
  150. package/dist/.next/server/app/api/pull-remote/preview/route_client-reference-manifest.js +1 -1
  151. package/dist/.next/server/app/api/push-remote/confirm/route.js +5 -5
  152. package/dist/.next/server/app/api/push-remote/confirm/route_client-reference-manifest.js +1 -1
  153. package/dist/.next/server/app/api/push-remote/preview/route.js +4 -4
  154. package/dist/.next/server/app/api/push-remote/preview/route_client-reference-manifest.js +1 -1
  155. package/dist/.next/server/app/api/query/route.js +3 -3
  156. package/dist/.next/server/app/api/query/route_client-reference-manifest.js +1 -1
  157. package/dist/.next/server/app/api/tables/[name]/route.js +5 -5
  158. package/dist/.next/server/app/api/tables/[name]/route_client-reference-manifest.js +1 -1
  159. package/dist/.next/server/app/api/tables/route.js +2 -2
  160. package/dist/.next/server/app/api/tables/route_client-reference-manifest.js +1 -1
  161. package/dist/.next/server/app/api/update/route.js +1 -1
  162. package/dist/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  163. package/dist/.next/server/app/index.html +2 -2
  164. package/dist/.next/server/app/index.rsc +5 -5
  165. package/dist/.next/server/app/page.js +7 -7
  166. package/dist/.next/server/app/page.js.nft.json +1 -1
  167. package/dist/.next/server/app/page_client-reference-manifest.js +1 -1
  168. package/dist/.next/server/app-paths-manifest.json +1 -1
  169. package/dist/.next/server/chunks/226.js +12 -12
  170. package/dist/.next/server/chunks/391.js +1 -1
  171. package/dist/.next/server/chunks/572.js +1 -0
  172. package/dist/.next/server/chunks/992.js +3 -3
  173. package/dist/.next/server/middleware-build-manifest.js +1 -1
  174. package/dist/.next/server/next-font-manifest.js +1 -1
  175. package/dist/.next/server/next-font-manifest.json +1 -1
  176. package/dist/.next/server/pages/404.html +1 -1
  177. package/dist/.next/server/pages/500.html +1 -1
  178. package/dist/.next/server/server-reference-manifest.json +1 -1
  179. package/dist/.next/static/IX-QLbm7scYnyqWeeimal/_buildManifest.js +1 -0
  180. package/dist/.next/static/IX-QLbm7scYnyqWeeimal/_ssgManifest.js +1 -0
  181. package/dist/.next/static/chunks/{576-c4daf274bb6469a1.js → 576-18a2209e1ed26aad.js} +1 -1
  182. package/dist/.next/static/chunks/{92-c4466e0f1ca8a3a8.js → 92-5f7522943fcb72a8.js} +1 -1
  183. package/dist/.next/static/chunks/app/{layout-be6ee67cf0c92654.js → layout-40ec07d04681ba81.js} +1 -1
  184. package/dist/.next/static/chunks/app/page-f05cd0fc436bf9bc.js +1 -0
  185. package/dist/.next/static/chunks/{main-app-fa35024de9bd9284.js → main-app-4506e88db72db4b7.js} +1 -1
  186. package/dist/.next/static/css/{9f6c25c5400f83d3.css → 7c16f57d325d0d7d.css} +1 -1
  187. package/dist/.next/static/media/8d697b304b401681-s.woff2 +0 -0
  188. package/dist/.next/static/media/9610d9e46709d722-s.woff2 +0 -0
  189. package/dist/.next/trace +3 -14
  190. package/dist/.next/types/app/api/cloudflare/route.ts +1 -1
  191. package/dist/.next/types/app/api/databases/route.ts +1 -1
  192. package/dist/.next/types/app/api/migrations/sync/route.ts +1 -1
  193. package/dist/.next/types/app/api/migrations/sync-files/route.ts +1 -1
  194. package/dist/.next/types/app/api/pull-data/confirm/route.ts +1 -1
  195. package/dist/.next/types/app/api/pull-remote/confirm/route.ts +1 -1
  196. package/dist/.next/types/app/api/pull-remote/preview/route.ts +1 -1
  197. package/dist/.next/types/app/api/push-remote/confirm/route.ts +1 -1
  198. package/dist/.next/types/app/api/push-remote/preview/route.ts +1 -1
  199. package/dist/.next/types/app/api/query/route.ts +1 -1
  200. package/dist/.next/types/app/api/tables/[name]/route.ts +1 -1
  201. package/dist/.next/types/app/api/tables/route.ts +1 -1
  202. package/dist/.next/types/app/api/update/route.ts +1 -1
  203. package/dist/.next/types/app/page.ts +1 -1
  204. package/dist/app/api/tables/[name]/route.js +22 -10
  205. package/dist/app/globals.css +39 -0
  206. package/dist/d1-studio.js +2 -2
  207. package/dist/lib/data-type-handlers.js +426 -0
  208. package/dist/lib/sql-operations.js +32 -8
  209. package/dist/lib/sql-sanitizer.js +233 -0
  210. package/package.json +3 -9
  211. package/dist/.next/.next/server/chunks/90.js +0 -1
  212. package/dist/.next/.next/static/chunks/app/page-36ed30b2266617f3.js +0 -1
  213. package/dist/.next/server/chunks/90.js +0 -1
  214. package/dist/.next/static/chunks/app/page-36ed30b2266617f3.js +0 -1
  215. package/dist/app/app/api/cloudflare/route.js +0 -150
  216. package/dist/app/app/api/databases/route.js +0 -71
  217. package/dist/app/app/api/migrations/sync/route.js +0 -174
  218. package/dist/app/app/api/migrations/sync-files/route.js +0 -172
  219. package/dist/app/app/api/pull-data/confirm/route.js +0 -230
  220. package/dist/app/app/api/pull-remote/confirm/route.js +0 -278
  221. package/dist/app/app/api/pull-remote/preview/route.js +0 -144
  222. package/dist/app/app/api/push-remote/confirm/route.js +0 -196
  223. package/dist/app/app/api/push-remote/preview/route.js +0 -179
  224. package/dist/app/app/api/query/route.js +0 -168
  225. package/dist/app/app/api/tables/[name]/route.js +0 -174
  226. package/dist/app/app/api/tables/route.js +0 -178
  227. package/dist/app/app/api/update/route.js +0 -45
  228. package/dist/app/app/globals.css +0 -93
  229. package/dist/app/app/layout.jsx +0 -35
  230. package/dist/app/app/page.jsx +0 -34
  231. package/next.config.mjs +0 -18
  232. package/postcss.config.mjs +0 -8
  233. package/scripts/studio.js +0 -199
  234. package/scripts/test.js +0 -366
  235. package/src/app/api/cloudflare/route.js +0 -150
  236. package/src/app/api/databases/route.js +0 -71
  237. package/src/app/api/migrations/sync/route.js +0 -174
  238. package/src/app/api/migrations/sync-files/route.js +0 -172
  239. package/src/app/api/pull-data/confirm/route.js +0 -230
  240. package/src/app/api/pull-remote/confirm/route.js +0 -278
  241. package/src/app/api/pull-remote/preview/route.js +0 -144
  242. package/src/app/api/push-remote/confirm/route.js +0 -196
  243. package/src/app/api/push-remote/preview/route.js +0 -179
  244. package/src/app/api/query/route.js +0 -168
  245. package/src/app/api/tables/[name]/route.js +0 -174
  246. package/src/app/api/tables/route.js +0 -178
  247. package/src/app/api/update/route.js +0 -45
  248. package/src/app/globals.css +0 -93
  249. package/src/app/layout.jsx +0 -35
  250. package/src/app/page.jsx +0 -34
  251. package/src/components/cloudflare-credentials-modal.jsx +0 -94
  252. package/src/components/column-selector.jsx +0 -133
  253. package/src/components/column-sorting.jsx +0 -65
  254. package/src/components/delete-records-dialog.jsx +0 -64
  255. package/src/components/download-button.jsx +0 -205
  256. package/src/components/edit-error-alert.jsx +0 -30
  257. package/src/components/editable-cell.jsx +0 -163
  258. package/src/components/editable-row.jsx +0 -169
  259. package/src/components/environment-handler.jsx +0 -332
  260. package/src/components/environment-select.jsx +0 -62
  261. package/src/components/pull-preview-toast.jsx +0 -215
  262. package/src/components/push-error-alert.jsx +0 -72
  263. package/src/components/push-preview-toast.jsx +0 -183
  264. package/src/components/query-results.jsx +0 -112
  265. package/src/components/refresh-button.jsx +0 -61
  266. package/src/components/resize-columns.jsx +0 -101
  267. package/src/components/sidebar.jsx +0 -254
  268. package/src/components/sql-editor.jsx +0 -411
  269. package/src/components/sql-error-display.jsx +0 -167
  270. package/src/components/sync-migrations-button.jsx +0 -87
  271. package/src/components/table-error-dialog.jsx +0 -65
  272. package/src/components/table-toolbar.jsx +0 -285
  273. package/src/components/table-view.jsx +0 -843
  274. package/src/components/ui/alert.jsx +0 -47
  275. package/src/components/ui/button.jsx +0 -48
  276. package/src/components/ui/card.jsx +0 -50
  277. package/src/components/ui/checkbox.jsx +0 -24
  278. package/src/components/ui/collapsible.jsx +0 -11
  279. package/src/components/ui/dialog.jsx +0 -96
  280. package/src/components/ui/dropdown-menu.jsx +0 -158
  281. package/src/components/ui/input.jsx +0 -19
  282. package/src/components/ui/scroll-area.jsx +0 -40
  283. package/src/components/ui/select.jsx +0 -121
  284. package/src/components/ui/separator.jsx +0 -25
  285. package/src/components/ui/sheet.jsx +0 -109
  286. package/src/components/ui/sidebar.jsx +0 -620
  287. package/src/components/ui/skeleton.jsx +0 -14
  288. package/src/components/ui/table.jsx +0 -86
  289. package/src/components/ui/tabs.jsx +0 -43
  290. package/src/components/ui/toast.jsx +0 -86
  291. package/src/components/ui/toaster.jsx +0 -35
  292. package/src/components/ui/tooltip.jsx +0 -28
  293. package/src/components/update-banner.jsx +0 -93
  294. package/src/context/database-context.js +0 -510
  295. package/src/hooks/use-mobile.jsx +0 -19
  296. package/src/hooks/use-sql-error.ts +0 -23
  297. package/src/hooks/use-toast.js +0 -155
  298. package/src/lib/database-queue.js +0 -37
  299. package/src/lib/error.js +0 -20
  300. package/src/lib/find-wrangler-config.js +0 -74
  301. package/src/lib/license.js +0 -99
  302. package/src/lib/logger.js +0 -58
  303. package/src/lib/migrations.js +0 -415
  304. package/src/lib/parse-sql-error.js +0 -200
  305. package/src/lib/request-deduplication.js +0 -24
  306. package/src/lib/schema-operations.js +0 -106
  307. package/src/lib/sql-error-types.js +0 -14
  308. package/src/lib/sql-operations.js +0 -647
  309. package/src/lib/utils.js +0 -6
  310. package/src/lib/version-utils.js +0 -34
  311. /package/dist/.next/.next/static/{OUHnbB-64afrrZQL0Srn5 → FEsQ9jwPUQv5A3fwg6Opl}/_buildManifest.js +0 -0
  312. /package/dist/.next/.next/static/{OUHnbB-64afrrZQL0Srn5 → FEsQ9jwPUQv5A3fwg6Opl}/_ssgManifest.js +0 -0
  313. /package/dist/.next/.next/static/{ZBTCAyp1kO5FdEHMU-Dw2 → Y9mYu4WBghepP5oT_3OdR}/_buildManifest.js +0 -0
  314. /package/dist/.next/.next/static/{ZBTCAyp1kO5FdEHMU-Dw2 → Y9mYu4WBghepP5oT_3OdR}/_ssgManifest.js +0 -0
  315. /package/dist/.next/.next/static/{bHYW7fgIBDF8-Q33_WPoE → ae3gNmoSGm-R5LJC4UagI}/_buildManifest.js +0 -0
  316. /package/dist/.next/.next/static/{bHYW7fgIBDF8-Q33_WPoE → ae3gNmoSGm-R5LJC4UagI}/_ssgManifest.js +0 -0
  317. /package/dist/.next/{static/ZBTCAyp1kO5FdEHMU-Dw2 → .next/static/bKfUJeuvAQlBmR3TjrfkH}/_buildManifest.js +0 -0
  318. /package/dist/.next/{static/ZBTCAyp1kO5FdEHMU-Dw2 → .next/static/bKfUJeuvAQlBmR3TjrfkH}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- {"version":1,"files":["../../../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../node_modules/next/dist/server/app-render/action-async-storage-instance.js","../../../node_modules/next/dist/server/app-render/action-async-storage.external.js","../../../node_modules/next/dist/server/app-render/after-task-async-storage-instance.js","../../../node_modules/next/dist/server/app-render/after-task-async-storage.external.js","../../../node_modules/next/dist/server/app-render/async-local-storage.js","../../../node_modules/next/dist/server/app-render/clean-async-snapshot-instance.js","../../../node_modules/next/dist/server/app-render/clean-async-snapshot.external.js","../../../node_modules/next/dist/server/app-render/work-async-storage-instance.js","../../../node_modules/next/dist/server/app-render/work-async-storage.external.js","../../../node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js","../../../node_modules/next/dist/server/app-render/work-unit-async-storage.external.js","../../../node_modules/next/dist/server/lib/trace/constants.js","../../../node_modules/next/dist/server/lib/trace/tracer.js","../../../node_modules/next/dist/shared/lib/is-thenable.js","../../../node_modules/next/package.json","../../package.json","../chunks/638.js","../chunks/90.js","../chunks/992.js","../webpack-runtime.js","page_client-reference-manifest.js"]}
1
+ {"version":1,"files":["../../../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../node_modules/next/dist/server/app-render/action-async-storage-instance.js","../../../node_modules/next/dist/server/app-render/action-async-storage.external.js","../../../node_modules/next/dist/server/app-render/after-task-async-storage-instance.js","../../../node_modules/next/dist/server/app-render/after-task-async-storage.external.js","../../../node_modules/next/dist/server/app-render/async-local-storage.js","../../../node_modules/next/dist/server/app-render/clean-async-snapshot-instance.js","../../../node_modules/next/dist/server/app-render/clean-async-snapshot.external.js","../../../node_modules/next/dist/server/app-render/work-async-storage-instance.js","../../../node_modules/next/dist/server/app-render/work-async-storage.external.js","../../../node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js","../../../node_modules/next/dist/server/app-render/work-unit-async-storage.external.js","../../../node_modules/next/dist/server/lib/trace/constants.js","../../../node_modules/next/dist/server/lib/trace/tracer.js","../../../node_modules/next/dist/shared/lib/is-thenable.js","../../../node_modules/next/package.json","../../package.json","../chunks/572.js","../chunks/638.js","../chunks/992.js","../webpack-runtime.js","page_client-reference-manifest.js"]}
@@ -1 +1 @@
1
- globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/page"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"33":{"*":{"id":"2899","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"7174","name":"*","chunks":[],"async":false}},"2624":{"*":{"id":"4535","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"7190","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"3875","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"8903","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"4178","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"2652","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"1365","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"6959","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/Users/kona/Desktop/d1studio/node_modules/next/dist/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Users/kona/Desktop/d1studio/node_modules/next/dist/esm/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Users/kona/Desktop/d1studio/node_modules/next/dist/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Users/kona/Desktop/d1studio/node_modules/next/dist/esm/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Users/kona/Desktop/d1studio/node_modules/next/dist/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Users/kona/Desktop/d1studio/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Users/kona/Desktop/d1studio/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Users/kona/Desktop/d1studio/node_modules/next/dist/esm/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Users/kona/Desktop/d1studio/node_modules/next/dist/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Users/kona/Desktop/d1studio/node_modules/next/dist/esm/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Users/kona/Desktop/d1studio/node_modules/next/dist/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Users/kona/Desktop/d1studio/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Users/kona/Desktop/d1studio/node_modules/next/dist/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Users/kona/Desktop/d1studio/node_modules/next/dist/esm/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Users/kona/Desktop/d1studio/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.jsx\",\"import\":\"Geist\",\"arguments\":[{\"variable\":\"--font-geist-sans\",\"subsets\":[\"latin\"]}],\"variableName\":\"geistSans\"}":{"id":5613,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-be6ee67cf0c92654.js"],"async":false},"/Users/kona/Desktop/d1studio/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.jsx\",\"import\":\"Geist_Mono\",\"arguments\":[{\"variable\":\"--font-geist-mono\",\"subsets\":[\"latin\"]}],\"variableName\":\"geistMono\"}":{"id":7207,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-be6ee67cf0c92654.js"],"async":false},"/Users/kona/Desktop/d1studio/src/app/globals.css":{"id":347,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-be6ee67cf0c92654.js"],"async":false},"/Users/kona/Desktop/d1studio/src/components/ui/toaster.jsx":{"id":6124,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-be6ee67cf0c92654.js"],"async":false},"/Users/kona/Desktop/d1studio/src/context/database-context.js":{"id":33,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-be6ee67cf0c92654.js"],"async":false},"/Users/kona/Desktop/d1studio/src/app/page.jsx":{"id":2624,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","576","static/chunks/576-c4daf274bb6469a1.js","735","static/chunks/735-b885dfec6353171d.js","974","static/chunks/app/page-36ed30b2266617f3.js"],"async":false}},"entryCSSFiles":{"/Users/kona/Desktop/d1studio/src/":[],"/Users/kona/Desktop/d1studio/src/app/layout":[{"inlined":false,"path":"static/css/9f6c25c5400f83d3.css"}],"/Users/kona/Desktop/d1studio/src/app/page":[]},"rscModuleMapping":{"33":{"*":{"id":"1831","name":"*","chunks":[],"async":false}},"347":{"*":{"id":"1135","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"802","name":"*","chunks":[],"async":false}},"2624":{"*":{"id":"8868","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"8530","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"4863","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"5155","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"9350","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"3164","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"8921","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"3219","name":"*","chunks":[],"async":false}}},"edgeRscModuleMapping":{}}
1
+ globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/page"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"33":{"*":{"id":"2899","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"7174","name":"*","chunks":[],"async":false}},"2624":{"*":{"id":"4535","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"7190","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"3875","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"8903","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"4178","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"2652","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"1365","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"6959","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.jsx\",\"import\":\"Geist\",\"arguments\":[{\"variable\":\"--font-geist-sans\",\"subsets\":[\"latin\"]}],\"variableName\":\"geistSans\"}":{"id":5613,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-5f7522943fcb72a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-40ec07d04681ba81.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.jsx\",\"import\":\"Geist_Mono\",\"arguments\":[{\"variable\":\"--font-geist-mono\",\"subsets\":[\"latin\"]}],\"variableName\":\"geistMono\"}":{"id":7207,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-5f7522943fcb72a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-40ec07d04681ba81.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/app/globals.css":{"id":347,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-5f7522943fcb72a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-40ec07d04681ba81.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/components/ui/toaster.jsx":{"id":6124,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-5f7522943fcb72a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-40ec07d04681ba81.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/context/database-context.js":{"id":33,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-5f7522943fcb72a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-40ec07d04681ba81.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/app/page.jsx":{"id":2624,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","576","static/chunks/576-18a2209e1ed26aad.js","735","static/chunks/735-b885dfec6353171d.js","974","static/chunks/app/page-f05cd0fc436bf9bc.js"],"async":false}},"entryCSSFiles":{"/Volumes/ProjectSpace/_wip/d1studio/src/":[],"/Volumes/ProjectSpace/_wip/d1studio/src/app/layout":[{"inlined":false,"path":"static/css/7c16f57d325d0d7d.css"}],"/Volumes/ProjectSpace/_wip/d1studio/src/app/page":[]},"rscModuleMapping":{"33":{"*":{"id":"1831","name":"*","chunks":[],"async":false}},"347":{"*":{"id":"1135","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"802","name":"*","chunks":[],"async":false}},"2624":{"*":{"id":"8868","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"8530","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"4863","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"5155","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"9350","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"3164","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"8921","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"3219","name":"*","chunks":[],"async":false}}},"edgeRscModuleMapping":{}}
@@ -1,4 +1,5 @@
1
1
  {
2
+ "/_not-found/page": "app/_not-found/page.js",
2
3
  "/api/cloudflare/route": "app/api/cloudflare/route.js",
3
4
  "/api/databases/route": "app/api/databases/route.js",
4
5
  "/api/migrations/sync-files/route": "app/api/migrations/sync-files/route.js",
@@ -10,7 +11,6 @@
10
11
  "/api/push-remote/preview/route": "app/api/push-remote/preview/route.js",
11
12
  "/api/query/route": "app/api/query/route.js",
12
13
  "/api/tables/route": "app/api/tables/route.js",
13
- "/_not-found/page": "app/_not-found/page.js",
14
14
  "/api/update/route": "app/api/update/route.js",
15
15
  "/api/tables/[name]/route": "app/api/tables/[name]/route.js",
16
16
  "/page": "app/page.js"
@@ -1,30 +1,30 @@
1
- exports.id=226,exports.ids=[226],exports.modules={6487:()=>{},8335:()=>{},5949:(t,e,r)=>{"use strict";r.d(e,{S:()=>c});var s=r(9748),n=r(3149),i=r(2537),a=r(6789),E=r(1804);let l=null,o=null;async function c(t){try{let e;if(!t||"string"!=typeof t)throw Error("Project path is required and must be a string");if(l&&o===t)return l;let r=null,c=null;for(let e of["wrangler.toml","wrangler.json","wrangler.jsonc"])if(r=await (0,n.dJ)(e,{cwd:t})){c=e;break}if(!r)return E.A.warn(`No Wrangler configuration file found in: ${t}`),null;E.A.info(`Found ${c} at: ${r}`);let u=await (0,s.readFile)(r,"utf-8");return c.endsWith(".toml")?e=(0,i.parse)(u):(c.endsWith(".jsonc")&&(u=(0,a.A)(u)),e=JSON.parse(u)),l={config:e,projectPath:t},o=t,l}catch(t){throw E.A.error(`Error reading Wrangler configuration: ${t.message}`),t}}},1804:(t,e,r)=>{"use strict";r.d(e,{A:()=>u});var s=r(6399);let{combine:n,timestamp:i,printf:a,colorize:E}=s.format,l="true"===process.env.DEBUG,o=a(({level:t,message:e,timestamp:r,...s})=>{let n=`${r} ${t}: ${e}`;return Object.keys(s).length>0&&(n+=` ${JSON.stringify(s)}`),n}),c=s.createLogger({level:l?"debug":"warn",format:n(i({format:"YYYY-MM-DD HH:mm:ss"}),E(),o),transports:[new s.transports.Console({level:l?"debug":"warn",silent:!1})]});c.logRequest=(t,e,r={})=>{c.debug(`Request: ${t} ${e}`,r)},c.logError=(t,e="unknown")=>{c.error(`Error in ${e}: ${t.message}`,{error:t.stack||t.message,source:e})},c.shouldLog=t=>{let e=c.level,r={error:0,warn:1,info:2,debug:3};return r[t]<=r[e]};let u=c},4218:(t,e,r)=>{"use strict";r.d(e,{IC:()=>a,ZX:()=>i});var s=r(9421),n=r(1804);async function i(t,e,r={},a=!1){let E=`
1
+ exports.id=226,exports.ids=[226],exports.modules={6487:()=>{},8335:()=>{},5949:(t,e,r)=>{"use strict";r.d(e,{S:()=>c});var s=r(9748),n=r(3149),a=r(2537),i=r(6789),E=r(1804);let l=null,o=null;async function c(t){try{let e;if(!t||"string"!=typeof t)throw Error("Project path is required and must be a string");if(l&&o===t)return l;let r=null,c=null;for(let e of["wrangler.toml","wrangler.json","wrangler.jsonc"])if(r=await (0,n.dJ)(e,{cwd:t})){c=e;break}if(!r)return E.A.warn(`No Wrangler configuration file found in: ${t}`),null;E.A.info(`Found ${c} at: ${r}`);let u=await (0,s.readFile)(r,"utf-8");return c.endsWith(".toml")?e=(0,a.parse)(u):(c.endsWith(".jsonc")&&(u=(0,i.A)(u)),e=JSON.parse(u)),l={config:e,projectPath:t},o=t,l}catch(t){throw E.A.error(`Error reading Wrangler configuration: ${t.message}`),t}}},1804:(t,e,r)=>{"use strict";r.d(e,{A:()=>u});var s=r(6399);let{combine:n,timestamp:a,printf:i,colorize:E}=s.format,l="true"===process.env.DEBUG,o=i(({level:t,message:e,timestamp:r,...s})=>{let n=`${r} ${t}: ${e}`;return Object.keys(s).length>0&&(n+=` ${JSON.stringify(s)}`),n}),c=s.createLogger({level:l?"debug":"warn",format:n(a({format:"YYYY-MM-DD HH:mm:ss"}),E(),o),transports:[new s.transports.Console({level:l?"debug":"warn",silent:!1})]});c.logRequest=(t,e,r={})=>{c.debug(`Request: ${t} ${e}`,r)},c.logError=(t,e="unknown")=>{c.error(`Error in ${e}: ${t.message}`,{error:t.stack||t.message,source:e})},c.shouldLog=t=>{let e=c.level,r={error:0,warn:1,info:2,debug:3};return r[t]<=r[e]};let u=c},4218:(t,e,r)=>{"use strict";r.d(e,{IC:()=>i,ZX:()=>a});var s=r(9421),n=r(1804);async function a(t,e,r={},i=!1){let E=`
2
2
  SELECT name, type, sql
3
3
  FROM sqlite_master
4
4
  WHERE type IN ('table', 'index', 'trigger')
5
5
  AND name NOT LIKE 'sqlite_%'
6
6
  AND name != 'd1_migrations';
7
- `;try{let n=await (0,s.KK)(t,e,E,r,a),i=JSON.parse(n);return i[0]?.results||[]}catch(t){throw n.A.error("Failed to get current schema:",t),{type:s.wU.EXECUTION_ERROR,message:"Failed to get current schema",details:{error:t.message,suggestions:["Check database permissions"]}}}}function a(t){let e=new Map;return t.filter(t=>"DATA_MODIFICATION"!==t.type).forEach(t=>{let r=(t.name||t.tableName).toLowerCase();if(e.has(r)||e.set(r,new Set),"CREATE_TABLE"===t.type){let s=t.sql.match(/FOREIGN\s+KEY\s*\([^)]+\)\s+REFERENCES\s+(\w+)/gi);s&&s.forEach(t=>{let s=t.match(/REFERENCES\s+(\w+)/i)[1].toLowerCase();e.get(r).add(s)})}}),function(t){let e=[],r=new Set,s=new Set;for(let n of t.keys())r.has(n)||function n(i){if(s.has(i))throw Error(`Circular dependency detected for table: ${i}`);if(!r.has(i)){for(let e of(s.add(i),t.get(i)||new Set)){if(!t.has(e))throw Error(`Missing table dependency: ${e}`);n(e)}s.delete(i),r.add(i),e.push(i)}}(n);return e}(e)}},9421:(t,e,r)=>{"use strict";r.d(e,{By:()=>c,F9:()=>f,Gq:()=>u,KK:()=>N,Pg:()=>E,QQ:()=>o,bp:()=>A,h3:()=>O,mA:()=>d,sP:()=>g,tn:()=>$,wU:()=>l,xk:()=>p,z6:()=>I});var s=r(8354),n=r(9646),i=r(1804);let a=(0,s.promisify)(n.exec),E={CREATE_TABLE:"CREATE_TABLE",ALTER_TABLE:"ALTER_TABLE",DROP_TABLE:"DROP_TABLE",CREATE_INDEX:"CREATE_INDEX",DROP_INDEX:"DROP_INDEX",DATA_MODIFICATION:"DATA_MODIFICATION"},l={VALIDATION_ERROR:"VALIDATION_ERROR",SYNTAX_ERROR:"SYNTAX_ERROR",EXECUTION_ERROR:"EXECUTION_ERROR",DEPENDENCY_ERROR:"DEPENDENCY_ERROR"};function o(t){return t.type!==E.DATA_MODIFICATION}function c(t){let e=t.trim().replace(/\s+/g," "),r=e.toUpperCase();if(r.startsWith("CREATE TABLE"))return{type:E.CREATE_TABLE,tableName:m(e,"CREATE TABLE"),sql:e,description:"create-table"};if(r.startsWith("ALTER TABLE")){let t=m(e,"ALTER TABLE"),s="";if(r.includes("RENAME")){let t=e.match(/RENAME\s+(?:COLUMN\s+)?([\w$]+)\s+TO\s+([\w$]+)/i);t&&(s=`rename-${t[1]}-to-${t[2]}`)}else if(r.includes("ADD COLUMN")){let t=e.match(/ADD\s+COLUMN\s+([\w$]+)(\s+[\w()]+)?/i);if(t){let e=t[1],r=t[2]?t[2].trim().replace(/\s+/g,"-"):"";s=r?`add-${e}-${r}`:`add-${e}`}}else if(r.includes("DROP COLUMN")){let t=e.match(/DROP\s+COLUMN\s+([\w$]+)/i);t&&(s=`drop-${t[1]}`)}else if(r.includes("MODIFY COLUMN")||r.includes("CHANGE COLUMN")){let t=e.match(/(?:MODIFY|CHANGE)\s+COLUMN\s+([\w$]+)(\s+[\w()]+)?/i);if(t){let e=t[1],r=t[2]?t[2].trim().replace(/\s+/g,"-"):"";s=r?`modify-${e}-to-${r}`:`modify-${e}`}}return{type:E.ALTER_TABLE,tableName:t,sql:e,description:s}}if(r.startsWith("DROP TABLE"))return{type:E.DROP_TABLE,tableName:m(e,"DROP TABLE"),sql:e,description:"drop-table"};if(r.startsWith("CREATE INDEX")||r.startsWith("CREATE UNIQUE INDEX")){let t=T(e),r=e.match(/INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?([\w$]+)/i),s=r?r[1]:"";return{type:E.CREATE_INDEX,tableName:t,sql:e,description:s}}if(r.startsWith("DROP INDEX")){let t=T(e),r=e.match(/DROP\s+INDEX\s+(?:IF\s+EXISTS\s+)?([\w$]+)/i),s=r?r[1]:"";return{type:E.DROP_INDEX,tableName:t,sql:e,description:s?`drop-index-${s}`:"drop-index"}}return{type:E.DATA_MODIFICATION,sql:e,description:"data-modification"}}function u(t){if(t.type!==E.DATA_MODIFICATION&&!t.tableName)throw{type:l.VALIDATION_ERROR,message:`Invalid SQL statement: unable to determine table name for "${t.type}".`,details:{sql:t.sql}};return t}function m(t,e){let r=t.match(RegExp(`${e}\\s+(?:IF\\s+(?:NOT\\s+)?EXISTS\\s+)?([\\w_]+)`,"i"));return r?r[1]:null}function T(t){let e=t.match(/ON\s+([\w_]+)/i);return e?e[1]:null}async function R(t){let e=t.match(/^\d+_create[-_]table[_-](.+)\.sql$/i);return e||(e=t.match(/^\d+_create[-](.+)-table\.sql$/i))||(e=t.match(/^\d+_alter[-_]table[_-](.+?)(?:[_-].+)?\.sql$/i))||(e=t.match(/^\d+_alter[-](.+?)-table(?:[_-].+)?\.sql$/i))||(e=t.match(/^\d+_create[-_]index[-_](.+)\.sql$/i))?e[1]:null}function A(t){return t.split("\n").filter(t=>!t.trim().startsWith("--")).join("\n").trim()}async function f(t,e,r,s,n=!1){let i=`SELECT name FROM sqlite_master WHERE type='table' AND name = '${s}' COLLATE NOCASE;`,a=await N(t,e,i,r,n);try{let t=a.indexOf("[");if(-1!==t){let e=a.substring(t),r=JSON.parse(e);return(r[0]?.results||[]).length>0}return!1}catch(t){return console.error("Error parsing tableExists result:",t),!1}}function d(t){return t.replace(/--.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").trim().split(";").map(t=>t.trim()).filter(t=>t.length>0).map(t=>c(t+";"))}async function N(t,e,r,s={},n=!1){try{let E=r.trim().replace(/\s+/g," "),l=E.toUpperCase();(l.startsWith("CREATE INDEX")||l.startsWith("CREATE UNIQUE INDEX"))&&!l.includes("IF NOT EXISTS")&&(E=l.startsWith("CREATE UNIQUE INDEX")?E.replace(/CREATE\s+UNIQUE\s+INDEX/i,"CREATE UNIQUE INDEX IF NOT EXISTS"):E.replace(/CREATE\s+INDEX/i,"CREATE INDEX IF NOT EXISTS"));let o="win32"===process.platform,c=`${o?"npx.cmd":"npx"} wrangler d1 execute ${e} ${n?"--remote":"--local"} --command="${E.replace(/"/g,'\\"')}"`;i.A.shouldLog("debug")&&i.A.debug("Executing command:",c);let u={cwd:t,env:{...process.env,...s},maxBuffer:0xa00000,shell:!0},{stdout:m,stderr:T}=await a(c,u);if(T&&!T.includes("\uD83C\uDF00"))throw Error(T);try{let t=m.indexOf("[");if(-1!==t)return m.substring(t)}catch(t){console.warn("JSON parse warning:",t)}return m}catch(t){throw console.error("SQL Execution error:",t),{type:l.EXECUTION_ERROR,message:"Failed to execute SQL command",details:{command:t.cmd,stderr:t.stderr,stdout:t.stdout,originalError:t.message,suggestions:["Ensure Node.js and Wrangler are installed","Check npx in PATH","Verify the D1 database exists and is configured","Check wrangler.toml configuration"]}}}}async function O(t,e,r,s,n,a="id"){let E=`SELECT * FROM "${r}" ORDER BY "${a}" DESC LIMIT ${n};`;try{let r=await N(t,e,E,s,!0),n=r.indexOf("[");if(-1===n)throw Error(`Unexpected result format: ${r}`);let i=r.substring(n),a=JSON.parse(i);return a[0]?.results||[]}catch(t){throw i.A.error(`Error fetching remote data for table ${r}:`,t),t}}function p(t,e){if(!e||0===e.length)return"";let r=Object.keys(e[0]),s=r.map(t=>`"${t}"`).join(", "),n=e.map(t=>{let e=r.map(e=>{let r=t[e];return null==r?"NULL":`'${String(r).replace(/'/g,"''")}'`}).join(", ");return`(${e})`}).join(", ");return`INSERT INTO "${t}" (${s}) VALUES ${n};`}function I(t){let e=t.trim(),r=e.toUpperCase();return r.startsWith("CREATE TABLE")?function(t){let e=t.match(/CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(\w+)\s*\(([\s\S]*)\)/i);if(!e)return t;let[,r,s]=e,n=h(s).map(t=>t.trim()).filter(Boolean);return`CREATE TABLE ${r} (
7
+ `;try{let n=await (0,s.KK)(t,e,E,r,i),a=JSON.parse(n);return a[0]?.results||[]}catch(t){throw n.A.error("Failed to get current schema:",t),{type:s.wU.EXECUTION_ERROR,message:"Failed to get current schema",details:{error:t.message,suggestions:["Check database permissions"]}}}}function i(t){let e=new Map;return t.filter(t=>"DATA_MODIFICATION"!==t.type).forEach(t=>{let r=(t.name||t.tableName).toLowerCase();if(e.has(r)||e.set(r,new Set),"CREATE_TABLE"===t.type){let s=t.sql.match(/FOREIGN\s+KEY\s*\([^)]+\)\s+REFERENCES\s+(\w+)/gi);s&&s.forEach(t=>{let s=t.match(/REFERENCES\s+(\w+)/i)[1].toLowerCase();e.get(r).add(s)})}}),function(t){let e=[],r=new Set,s=new Set;for(let n of t.keys())r.has(n)||function n(a){if(s.has(a))throw Error(`Circular dependency detected for table: ${a}`);if(!r.has(a)){for(let e of(s.add(a),t.get(a)||new Set)){if(!t.has(e))throw Error(`Missing table dependency: ${e}`);n(e)}s.delete(a),r.add(a),e.push(a)}}(n);return e}(e)}},9421:(t,e,r)=>{"use strict";r.d(e,{By:()=>u,F9:()=>f,Gq:()=>m,KK:()=>I,Pg:()=>l,QQ:()=>c,bp:()=>d,h3:()=>O,mA:()=>N,sP:()=>L,tn:()=>g,wU:()=>o,xk:()=>p,z6:()=>h});var s=r(8354),n=r(9646),a=r(3648),i=r(1804);let E=(0,s.promisify)(n.exec),l={CREATE_TABLE:"CREATE_TABLE",ALTER_TABLE:"ALTER_TABLE",DROP_TABLE:"DROP_TABLE",CREATE_INDEX:"CREATE_INDEX",DROP_INDEX:"DROP_INDEX",DATA_MODIFICATION:"DATA_MODIFICATION"},o={VALIDATION_ERROR:"VALIDATION_ERROR",SYNTAX_ERROR:"SYNTAX_ERROR",EXECUTION_ERROR:"EXECUTION_ERROR",DEPENDENCY_ERROR:"DEPENDENCY_ERROR"};function c(t){return t.type!==l.DATA_MODIFICATION}function u(t){let e=t.trim().replace(/\s+/g," "),r=e.toUpperCase();if(r.startsWith("CREATE TABLE"))return{type:l.CREATE_TABLE,tableName:T(e,"CREATE TABLE"),sql:e,description:"create-table"};if(r.startsWith("ALTER TABLE")){let t=T(e,"ALTER TABLE"),s="";if(r.includes("RENAME")){let t=e.match(/RENAME\s+(?:COLUMN\s+)?([\w$]+)\s+TO\s+([\w$]+)/i);t&&(s=`rename-${t[1]}-to-${t[2]}`)}else if(r.includes("ADD COLUMN")){let t=e.match(/ADD\s+COLUMN\s+([\w$]+)(\s+[\w()]+)?/i);if(t){let e=t[1],r=t[2]?t[2].trim().replace(/\s+/g,"-"):"";s=r?`add-${e}-${r}`:`add-${e}`}}else if(r.includes("DROP COLUMN")){let t=e.match(/DROP\s+COLUMN\s+([\w$]+)/i);t&&(s=`drop-${t[1]}`)}else if(r.includes("MODIFY COLUMN")||r.includes("CHANGE COLUMN")){let t=e.match(/(?:MODIFY|CHANGE)\s+COLUMN\s+([\w$]+)(\s+[\w()]+)?/i);if(t){let e=t[1],r=t[2]?t[2].trim().replace(/\s+/g,"-"):"";s=r?`modify-${e}-to-${r}`:`modify-${e}`}}return{type:l.ALTER_TABLE,tableName:t,sql:e,description:s}}if(r.startsWith("DROP TABLE"))return{type:l.DROP_TABLE,tableName:T(e,"DROP TABLE"),sql:e,description:"drop-table"};if(r.startsWith("CREATE INDEX")||r.startsWith("CREATE UNIQUE INDEX")){let t=R(e),r=e.match(/INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?([\w$]+)/i),s=r?r[1]:"";return{type:l.CREATE_INDEX,tableName:t,sql:e,description:s}}if(r.startsWith("DROP INDEX")){let t=R(e),r=e.match(/DROP\s+INDEX\s+(?:IF\s+EXISTS\s+)?([\w$]+)/i),s=r?r[1]:"";return{type:l.DROP_INDEX,tableName:t,sql:e,description:s?`drop-index-${s}`:"drop-index"}}return{type:l.DATA_MODIFICATION,sql:e,description:"data-modification"}}function m(t){if(t.type!==l.DATA_MODIFICATION&&!t.tableName)throw{type:o.VALIDATION_ERROR,message:`Invalid SQL statement: unable to determine table name for "${t.type}".`,details:{sql:t.sql}};return t}function T(t,e){let r=t.match(RegExp(`${e}\\s+(?:IF\\s+(?:NOT\\s+)?EXISTS\\s+)?([\\w_]+)`,"i"));return r?r[1]:null}function R(t){let e=t.match(/ON\s+([\w_]+)/i);return e?e[1]:null}async function A(t){let e=t.match(/^\d+_create[-_]table[_-](.+)\.sql$/i);return e||(e=t.match(/^\d+_create[-](.+)-table\.sql$/i))||(e=t.match(/^\d+_alter[-_]table[_-](.+?)(?:[_-].+)?\.sql$/i))||(e=t.match(/^\d+_alter[-](.+?)-table(?:[_-].+)?\.sql$/i))||(e=t.match(/^\d+_create[-_]index[-_](.+)\.sql$/i))?e[1]:null}function d(t){return t.split("\n").filter(t=>!t.trim().startsWith("--")).join("\n").trim()}async function f(t,e,r,s,n=!1){try{(0,a.nZ)(s)}catch(t){return i.A.error("Invalid table name:",s,t.message),!1}let E=`SELECT name FROM sqlite_master WHERE type='table' AND name = '${s.replace(/'/g,"''")}' COLLATE NOCASE;`,l=await I(t,e,E,r,n);try{let t=l.indexOf("[");if(-1!==t){let e=l.substring(t),r=JSON.parse(e);return(r[0]?.results||[]).length>0}return!1}catch(t){return console.error("Error parsing tableExists result:",t),!1}}function N(t){return t.replace(/--.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").trim().split(";").map(t=>t.trim()).filter(t=>t.length>0).map(t=>u(t+";"))}async function I(t,e,r,s={},n=!1){try{let a=r.trim().replace(/\s+/g," "),l=a.toUpperCase();if((l.startsWith("CREATE INDEX")||l.startsWith("CREATE UNIQUE INDEX"))&&!l.includes("IF NOT EXISTS")&&(a=l.startsWith("CREATE UNIQUE INDEX")?a.replace(/CREATE\s+UNIQUE\s+INDEX/i,"CREATE UNIQUE INDEX IF NOT EXISTS"):a.replace(/CREATE\s+INDEX/i,"CREATE INDEX IF NOT EXISTS")),!e||"string"!=typeof e||!/^[a-zA-Z0-9_-]+$/.test(e))throw Error("Invalid database name for security reasons");let o="win32"===process.platform,c=a.replace(/"/g,'\\"').replace(/\$/g,"\\$"),u=`${o?"npx.cmd":"npx"} wrangler d1 execute ${e} ${n?"--remote":"--local"} --command="${c}"`;i.A.shouldLog("debug")&&i.A.debug("Executing command:",u);let m={cwd:t,env:{...process.env,...s},maxBuffer:0xa00000,shell:!0},{stdout:T,stderr:R}=await E(u,m);if(R&&!R.includes("\uD83C\uDF00"))throw Error(R);try{let t=T.indexOf("[");if(-1!==t)return T.substring(t)}catch(t){console.warn("JSON parse warning:",t)}return T}catch(t){throw console.error("SQL Execution error:",t),{type:o.EXECUTION_ERROR,message:"Failed to execute SQL command",details:{command:t.cmd,stderr:t.stderr,stdout:t.stdout,originalError:t.message,suggestions:["Ensure Node.js and Wrangler are installed","Check npx in PATH","Verify the D1 database exists and is configured","Check wrangler.toml configuration"]}}}}async function O(t,e,r,s,n,E="id"){let l=(0,a.nZ)(r),o=(0,a.r0)(E),c=Math.max(1,Math.min(parseInt(n)||50,1e3)),u=`SELECT * FROM ${l} ORDER BY ${o} DESC LIMIT ${c};`;try{let r=await I(t,e,u,s,!0),n=r.indexOf("[");if(-1===n)throw Error(`Unexpected result format: ${r}`);let a=r.substring(n),i=JSON.parse(a);return i[0]?.results||[]}catch(t){throw i.A.error(`Error fetching remote data for table ${r}:`,t),t}}function p(t,e){if(!e||0===e.length)return"";let r=(0,a.nZ)(t),s=Object.keys(e[0]),n=s.map(t=>(0,a.r0)(t)).join(", "),i=e.map(t=>{let e=s.map(e=>{let r=t[e];return null==r?"NULL":`'${String(r).replace(/'/g,"''")}'`}).join(", ");return`(${e})`}).join(", ");return`INSERT INTO ${r} (${n}) VALUES ${i};`}function h(t){let e=t.trim(),r=e.toUpperCase();return r.startsWith("CREATE TABLE")?function(t){let e=t.match(/CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(\w+)\s*\(([\s\S]*)\)/i);if(!e)return t;let[,r,s]=e,n=$(s).map(t=>t.trim()).filter(Boolean);return`CREATE TABLE ${r} (
8
8
  ${n.join(",\n ")}
9
- );`}(e):r.startsWith("CREATE INDEX")||r.startsWith("CREATE UNIQUE INDEX")?function(t){let e=t.match(/CREATE\s+(UNIQUE\s+)?INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?(\w+)\s+ON\s+(\w+)\s*\((.*)\)/i);if(!e)return t;let[,r,s,n,i]=e,a=i.split(",").map(t=>t.trim()).join(", ");return`CREATE ${r||""}INDEX ${s} ON ${n} (${a});`}(e):r.startsWith("ALTER TABLE")?function(t){let e=t.match(/ALTER\s+TABLE\s+(\w+)\s+(.*)/i);if(!e)return t;let[,r,s]=e,n=h(s);return 1===n.length?`ALTER TABLE ${r} ${n[0]};`:`ALTER TABLE ${r}
10
- ${n.map((t,e)=>` ${t}${e<n.length-1?",":";"}`).join("\n")}`}(e):r.startsWith("DROP TABLE")||r.startsWith("DROP INDEX")?function(t){let e=t.match(/DROP\s+(TABLE|INDEX)\s+(?:IF\s+EXISTS\s+)?(\w+)/i);if(!e)return t;let[,r,s]=e;return`DROP ${r} IF EXISTS ${s};`}(e):r.startsWith("INSERT INTO")?function(t){let e=t.match(/INSERT\s+INTO\s+(\w+)\s*(\([^)]+\))?\s*VALUES\s*(.+)/i);if(!e)return t;let[,r,s,n]=e,i=h(n);return`INSERT INTO ${r}${s?` ${s}`:""}
9
+ );`}(e):r.startsWith("CREATE INDEX")||r.startsWith("CREATE UNIQUE INDEX")?function(t){let e=t.match(/CREATE\s+(UNIQUE\s+)?INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?(\w+)\s+ON\s+(\w+)\s*\((.*)\)/i);if(!e)return t;let[,r,s,n,a]=e,i=a.split(",").map(t=>t.trim()).join(", ");return`CREATE ${r||""}INDEX ${s} ON ${n} (${i});`}(e):r.startsWith("ALTER TABLE")?function(t){let e=t.match(/ALTER\s+TABLE\s+(\w+)\s+(.*)/i);if(!e)return t;let[,r,s]=e,n=$(s);return 1===n.length?`ALTER TABLE ${r} ${n[0]};`:`ALTER TABLE ${r}
10
+ ${n.map((t,e)=>` ${t}${e<n.length-1?",":";"}`).join("\n")}`}(e):r.startsWith("DROP TABLE")||r.startsWith("DROP INDEX")?function(t){let e=t.match(/DROP\s+(TABLE|INDEX)\s+(?:IF\s+EXISTS\s+)?(\w+)/i);if(!e)return t;let[,r,s]=e;return`DROP ${r} IF EXISTS ${s};`}(e):r.startsWith("INSERT INTO")?function(t){let e=t.match(/INSERT\s+INTO\s+(\w+)\s*(\([^)]+\))?\s*VALUES\s*(.+)/i);if(!e)return t;let[,r,s,n]=e,a=$(n);return`INSERT INTO ${r}${s?` ${s}`:""}
11
11
  VALUES
12
- `+i.map((t,e)=>` ${t}${e<i.length-1?",":";"}`).join("\n")}(e):r.startsWith("UPDATE")?function(t){let e=t.match(/UPDATE\s+(\w+)\s+SET\s+(.+?)(?:\s+WHERE\s+(.+))?$/i);if(!e)return t;let[,r,s,n]=e,i=h(s),a=`UPDATE ${r}
12
+ `+a.map((t,e)=>` ${t}${e<a.length-1?",":";"}`).join("\n")}(e):r.startsWith("UPDATE")?function(t){let e=t.match(/UPDATE\s+(\w+)\s+SET\s+(.+?)(?:\s+WHERE\s+(.+))?$/i);if(!e)return t;let[,r,s,n]=e,a=$(s),i=`UPDATE ${r}
13
13
  SET
14
- ${i.map(t=>` ${t.trim()}`).join(",\n")}`;return n&&(a+=`
14
+ ${a.map(t=>` ${t.trim()}`).join(",\n")}`;return n&&(i+=`
15
15
  WHERE
16
- ${n.trim()}`),a+";"}(e):r.startsWith("DELETE FROM")?function(t){let e=t.match(/DELETE\s+FROM\s+(\w+)(?:\s+WHERE\s+(.+))?$/i);if(!e)return t;let[,r,s]=e,n=`DELETE FROM ${r}`;return s&&(n+=`
16
+ ${n.trim()}`),i+";"}(e):r.startsWith("DELETE FROM")?function(t){let e=t.match(/DELETE\s+FROM\s+(\w+)(?:\s+WHERE\s+(.+))?$/i);if(!e)return t;let[,r,s]=e,n=`DELETE FROM ${r}`;return s&&(n+=`
17
17
  WHERE
18
- ${s.trim()}`),n+";"}(e):r.startsWith("SELECT")?function(t){let e=t.match(/SELECT\s+(.+?)\s+FROM\s+(.+?)(?:\s+WHERE\s+(.+?))?(?:\s+GROUP\s+BY\s+(.+?))?(?:\s+HAVING\s+(.+?))?(?:\s+ORDER\s+BY\s+(.+?))?(?:\s+LIMIT\s+(.+?))?$/i);if(!e)return t;let[,r,s,n,i,a,E,l]=e,o=`SELECT
18
+ ${s.trim()}`),n+";"}(e):r.startsWith("SELECT")?function(t){let e=t.match(/SELECT\s+(.+?)\s+FROM\s+(.+?)(?:\s+WHERE\s+(.+?))?(?:\s+GROUP\s+BY\s+(.+?))?(?:\s+HAVING\s+(.+?))?(?:\s+ORDER\s+BY\s+(.+?))?(?:\s+LIMIT\s+(.+?))?$/i);if(!e)return t;let[,r,s,n,a,i,E,l]=e,o=`SELECT
19
19
  ${r.split(",").map(t=>t.trim()).join(",\n ")}
20
20
  FROM
21
21
  ${s.trim()}`;return n&&(o+=`
22
22
  WHERE
23
- ${n.trim()}`),i&&(o+=`
23
+ ${n.trim()}`),a&&(o+=`
24
24
  GROUP BY
25
- ${i.trim()}`),a&&(o+=`
25
+ ${a.trim()}`),i&&(o+=`
26
26
  HAVING
27
- ${a.trim()}`),E&&(o+=`
27
+ ${i.trim()}`),E&&(o+=`
28
28
  ORDER BY
29
29
  ${E.trim()}`),l&&(o+=`
30
- LIMIT ${l.trim()}`),o+";"}(e):e+";"}function h(t){let e=[],r="",s=0,n=!1,i="";for(let a of t)'"'===a&&"\\"!==i&&(n=!n),!n&&("("===a&&s++,")"===a&&s--),","!==a||0!==s||n?r+=a:(e.push(r.trim()),r=""),i=a;return r.trim()&&e.push(r.trim()),e}function $(t){return t.split(";").map(t=>t.trim()).filter(t=>t.length>0).map(t=>I(t)).join("\n\n")+"\n"}async function g(t,e,r,s){try{let n;let i=await R(r);if(i&&!r.includes("create-index")){let r=await N(t,e,`SELECT sql FROM sqlite_master WHERE type='table' AND name='${i}';`,s,!0);try{let t=JSON.parse(r);n=t[0]?.results?.[0]?.sql}catch(t){console.error("Error parsing sqlite_master result:",t)}}if(!n&&r.includes("create-index")){let i=r.match(/create-index[_-](.+)\.sql$/i);if(i){let r=i[1],a=await N(t,e,`SELECT sql FROM sqlite_master WHERE type='index' AND name='${r}' COLLATE NOCASE;`,s,!0),E=JSON.parse(a);if(!(n=E[0]?.results?.[0]?.sql)){let i=r.split("-")[0];a=await N(t,e,`SELECT sql FROM sqlite_master WHERE type='index' AND name='${i}' COLLATE NOCASE;`,s,!0),E=JSON.parse(a),n=E[0]?.results?.[0]?.sql}}}if(!n&&i&&!r.includes("create-index")){let r=await N(t,e,`SELECT sql FROM sqlite_master WHERE name LIKE '%${i}%' LIMIT 1;`,s,!0);try{let t=JSON.parse(r);n=t[0]?.results?.[0]?.sql}catch(t){console.error("Error parsing fallback result:",t)}}if(!n)throw Error(`Could not retrieve SQL content for migration: ${r}`);return n+";"}catch(t){throw{type:l.EXECUTION_ERROR,message:`Failed to get migration file content: ${t.message}`,details:{file:r,error:t.message,suggestions:["Check if the table exists in the remote database","Verify the migration filename follows the expected pattern","Ensure you have permissions to access the remote database"]}}}}}};
30
+ LIMIT ${l.trim()}`),o+";"}(e):e+";"}function $(t){let e=[],r="",s=0,n=!1,a="";for(let i of t)'"'===i&&"\\"!==a&&(n=!n),!n&&("("===i&&s++,")"===i&&s--),","!==i||0!==s||n?r+=i:(e.push(r.trim()),r=""),a=i;return r.trim()&&e.push(r.trim()),e}function g(t){return t.split(";").map(t=>t.trim()).filter(t=>t.length>0).map(t=>h(t)).join("\n\n")+"\n"}async function L(t,e,r,s){try{let n;let a=await A(r);if(a&&!r.includes("create-index")){let r=await I(t,e,`SELECT sql FROM sqlite_master WHERE type='table' AND name='${a}';`,s,!0);try{let t=JSON.parse(r);n=t[0]?.results?.[0]?.sql}catch(t){console.error("Error parsing sqlite_master result:",t)}}if(!n&&r.includes("create-index")){let a=r.match(/create-index[_-](.+)\.sql$/i);if(a){let r=a[1],i=await I(t,e,`SELECT sql FROM sqlite_master WHERE type='index' AND name='${r}' COLLATE NOCASE;`,s,!0),E=JSON.parse(i);if(!(n=E[0]?.results?.[0]?.sql)){let a=r.split("-")[0];i=await I(t,e,`SELECT sql FROM sqlite_master WHERE type='index' AND name='${a}' COLLATE NOCASE;`,s,!0),E=JSON.parse(i),n=E[0]?.results?.[0]?.sql}}}if(!n&&a&&!r.includes("create-index")){let r=await I(t,e,`SELECT sql FROM sqlite_master WHERE name LIKE '%${a}%' LIMIT 1;`,s,!0);try{let t=JSON.parse(r);n=t[0]?.results?.[0]?.sql}catch(t){console.error("Error parsing fallback result:",t)}}if(!n)throw Error(`Could not retrieve SQL content for migration: ${r}`);return n+";"}catch(t){throw{type:o.EXECUTION_ERROR,message:`Failed to get migration file content: ${t.message}`,details:{file:r,error:t.message,suggestions:["Check if the table exists in the remote database","Verify the migration filename follows the expected pattern","Ensure you have permissions to access the remote database"]}}}}},3648:(t,e,r)=>{"use strict";function s(t){if(!t||"string"!=typeof t)throw Error("Table name must be a non-empty string");if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t))throw Error(`Invalid table name: ${t}. Must start with letter or underscore and contain only letters, digits, and underscores.`);if(["SELECT","FROM","WHERE","INSERT","UPDATE","DELETE","CREATE","DROP","ALTER","TABLE","INDEX","VIEW","TRIGGER","PRAGMA","VACUUM","REINDEX","EXPLAIN","QUERY","PLAN","TRANSACTION","BEGIN","COMMIT","ROLLBACK"].includes(t.toUpperCase()))throw Error(`Table name cannot be a reserved word: ${t}`);return`"${t}"`}function n(t){if(!t||"string"!=typeof t)throw Error("Column name must be a non-empty string");if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t))throw Error(`Invalid column name: ${t}. Must start with letter or underscore and contain only letters, digits, and underscores.`);return`"${t}"`}r.d(e,{nZ:()=>s,r0:()=>n})}};
@@ -20,4 +20,4 @@ ${t}`,c.pop(),`[${e}]`}let n=Object.keys(h),g=n.length;if(0===g)return"{}";if(b<
20
20
  ${d}`,w="",v="",x=Math.min(g,y);l(h)&&(w+=u(h,m,y),n=n.slice(h.length),x-=h.length,v=m),i&&(n=o(n,a)),c.push(h);for(let e=0;e<x;e++){let t=n[e],r=_(t,h[t],c,f,d);void 0!==r&&(w+=`${v}${s(t)}: ${r}`,v=m)}if(g>y){let e=g-y;w+=`${v}"...": "${p(e)} not stringified"`,v=m}return""!==v&&(w=`
21
21
  ${d}${w}
22
22
  ${t}`),c.pop(),`{${w}}`}case"number":return isFinite(h)?String(h):t?t(h):"null";case"boolean":return!0===h?"true":"false";case"undefined":return;case"bigint":if(n)return String(h);default:return t?t(h):void 0}}function x(e,h,c){switch(typeof h){case"string":return s(h);case"object":{if(null===h)return"null";if("function"==typeof h.toJSON){if("object"!=typeof(h=h.toJSON(e)))return x(e,h,c);if(null===h)return"null"}if(-1!==c.indexOf(h))return r;let t="",n=void 0!==h.length;if(n&&Array.isArray(h)){if(0===h.length)return"[]";if(b<c.length+1)return'"[Array]"';c.push(h);let e=Math.min(h.length,y),r=0;for(;r<e-1;r++){let e=x(String(r),h[r],c);t+=void 0!==e?e:"null",t+=","}let n=x(String(r),h[r],c);if(t+=void 0!==n?n:"null",h.length-1>y){let e=h.length-y-1;t+=`,"... ${p(e)} not stringified"`}return c.pop(),`[${t}]`}let f=Object.keys(h),d=f.length;if(0===d)return"{}";if(b<c.length+1)return'"[Object]"';let g="",m=Math.min(d,y);n&&l(h)&&(t+=u(h,",",y),f=f.slice(h.length),m-=h.length,g=","),i&&(f=o(f,a)),c.push(h);for(let e=0;e<m;e++){let r=f[e],n=x(r,h[r],c);void 0!==n&&(t+=`${g}${s(r)}:${n}`,g=",")}if(d>y){let e=d-y;t+=`${g}"...":"${p(e)} not stringified"`}return c.pop(),`{${t}}`}case"number":return isFinite(h)?String(h):t?t(h):"null";case"boolean":return!0===h?"true":"false";case"undefined":return;case"bigint":if(n)return String(h);default:return t?t(h):void 0}}return function(e,t,r){if(arguments.length>1){let n="";if("number"==typeof r?n=" ".repeat(Math.min(r,10)):"string"==typeof r&&(n=r.slice(0,10)),null!=t){if("function"==typeof t)return w("",{"":e},[],t,n,"");if(Array.isArray(t))return v("",e,[],g(t),n,"")}if(0!==n.length)return _("",e,[],n,"")}return x("",e,[])}}},9312:(e,t)=>{function r(e){for(var t in e)this[t]=e[t]}t.get=function(e){var r=Error.stackTraceLimit;Error.stackTraceLimit=1/0;var n={},i=Error.prepareStackTrace;Error.prepareStackTrace=function(e,t){return t},Error.captureStackTrace(n,e||t.get);var s=n.stack;return Error.prepareStackTrace=i,Error.stackTraceLimit=r,s},t.parse=function(e){if(!e.stack)return[];var t=this;return e.stack.split("\n").slice(1).map(function(e){if(e.match(/^\s*[-]{4,}$/))return t._createParsedCallSite({fileName:e,lineNumber:null,functionName:null,typeName:null,methodName:null,columnNumber:null,native:null});var r=e.match(/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/);if(r){var n=null,i=null,s=null,o=null,a=null,l="native"===r[5];if(r[1]){var u=(s=r[1]).lastIndexOf(".");if("."==s[u-1]&&u--,u>0){n=s.substr(0,u),i=s.substr(u+1);var h=n.indexOf(".Module");h>0&&(s=s.substr(h+1),n=n.substr(0,h))}o=null}i&&(o=n,a=i),"<anonymous>"===i&&(a=null,s=null);var c={fileName:r[2]||null,lineNumber:parseInt(r[3],10)||null,functionName:s,typeName:o,methodName:a,columnNumber:parseInt(r[4],10)||null,native:l};return t._createParsedCallSite(c)}}).filter(function(e){return!!e})};var n=["topLevel","eval","native","constructor"];["this","typeName","functionName","methodName","fileName","lineNumber","columnNumber","function","evalOrigin"].forEach(function(e){r.prototype[e]=null,r.prototype["get"+e[0].toUpperCase()+e.substr(1)]=function(){return this[e]}}),n.forEach(function(e){r.prototype[e]=!1,r.prototype["is"+e[0].toUpperCase()+e.substr(1)]=function(){return this[e]}}),t._createParsedCallSite=function(e){return new r(e)}},8333:(e,t,r)=>{"use strict";var n=r(5957).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(e){var t;if(!e)return"utf8";for(;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function o(e){var t=s(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw Error("Unknown encoding: "+e);return t||e}function a(e){var t;switch(this.encoding=o(e),this.encoding){case"utf16le":this.text=p,this.end=g,t=4;break;case"utf8":this.fillLast=c,t=4;break;case"base64":this.text=m,this.end=b,t=3;break;default:this.write=y,this.end=w;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function l(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function u(e,t,r){var n=t.length-1;if(n<r)return 0;var i=l(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||-2===i?0:(i=l(t[n]))>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||-2===i?0:(i=l(t[n]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}function h(e,t,r){if((192&t[0])!=128)return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if((192&t[1])!=128)return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&(192&t[2])!=128)return e.lastNeed=2,"�"}}function c(e){var t=this.lastTotal-this.lastNeed,r=h(this,e,t);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):void(e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length)}function f(e,t){var r=u(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)}function d(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t}function p(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function g(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function m(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function b(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function y(e){return e.toString(this.encoding)}function w(e){return e&&e.length?this.write(e):""}t.I=a,a.prototype.write=function(e){var t,r;if(0===e.length)return"";if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},a.prototype.end=d,a.prototype.text=f,a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},1292:(e,t)=>{"use strict";t.levels={error:0,warn:1,help:2,data:3,info:4,debug:5,prompt:6,verbose:7,input:8,silly:9},t.colors={error:"red",warn:"yellow",help:"cyan",data:"grey",info:"green",debug:"blue",prompt:"grey",verbose:"cyan",input:"grey",silly:"magenta"}},7062:(e,t,r)=>{"use strict";Object.defineProperty(t,"cli",{value:r(1292)}),Object.defineProperty(t,"npm",{value:r(2e3)}),Object.defineProperty(t,"syslog",{value:r(7349)})},2e3:(e,t)=>{"use strict";t.levels={error:0,warn:1,info:2,http:3,verbose:4,debug:5,silly:6},t.colors={error:"red",warn:"yellow",info:"green",http:"green",verbose:"cyan",debug:"blue",silly:"magenta"}},7349:(e,t)=>{"use strict";t.levels={emerg:0,alert:1,crit:2,error:3,warning:4,notice:5,info:6,debug:7},t.colors={emerg:"red",alert:"yellow",crit:"red",error:"red",warning:"red",notice:"yellow",info:"green",debug:"blue"}},2239:(e,t,r)=>{"use strict";Object.defineProperty(t,"LEVEL",{value:Symbol.for("level")}),Object.defineProperty(t,"MESSAGE",{value:Symbol.for("message")}),Object.defineProperty(t,"SPLAT",{value:Symbol.for("splat")}),Object.defineProperty(t,"configs",{value:r(7062)})},1387:(e,t,r)=>{e.exports=r(8354).deprecate},9747:(e,t,r)=>{"use strict";e.exports=r(3744),e.exports.LegacyTransportStream=r(1352)},1352:(e,t,r)=>{"use strict";let n=r(8354),{LEVEL:i}=r(2239),s=r(3744),o=e.exports=function(e={}){if(s.call(this,e),!e.transport||"function"!=typeof e.transport.log)throw Error("Invalid transport, must be an object with a log method.");function t(e){this.emit("error",e,this.transport)}this.transport=e.transport,this.level=this.level||e.transport.level,this.handleExceptions=this.handleExceptions||e.transport.handleExceptions,this._deprecated(),this.transport.__winstonError||(this.transport.__winstonError=t.bind(this),this.transport.on("error",this.transport.__winstonError))};n.inherits(o,s),o.prototype._write=function(e,t,r){if(this.silent||!0===e.exception&&!this.handleExceptions)return r(null);(!this.level||this.levels[this.level]>=this.levels[e[i]])&&this.transport.log(e[i],e.message,e,this._nop),r(null)},o.prototype._writev=function(e,t){for(let t=0;t<e.length;t++)this._accept(e[t])&&(this.transport.log(e[t].chunk[i],e[t].chunk.message,e[t].chunk,this._nop),e[t].callback());return t(null)},o.prototype._deprecated=function(){console.error(`${this.transport.name} is a legacy winston transport. Consider upgrading:
23
- - Upgrade docs: https://github.com/winstonjs/winston/blob/master/UPGRADE-3.0.md`)},o.prototype.close=function(){this.transport.close&&this.transport.close(),this.transport.__winstonError&&(this.transport.removeListener("error",this.transport.__winstonError),this.transport.__winstonError=null)}},3744:(e,t,r)=>{"use strict";let n=r(8354),i=r(6324),{LEVEL:s}=r(2239),o=e.exports=function(e={}){i.call(this,{objectMode:!0,highWaterMark:e.highWaterMark}),this.format=e.format,this.level=e.level,this.handleExceptions=e.handleExceptions,this.handleRejections=e.handleRejections,this.silent=e.silent,e.log&&(this.log=e.log),e.logv&&(this.logv=e.logv),e.close&&(this.close=e.close),this.once("pipe",e=>{this.levels=e.levels,this.parent=e}),this.once("unpipe",e=>{e===this.parent&&(this.parent=null,this.close&&this.close())})};n.inherits(o,i),o.prototype._write=function(e,t,r){if(this.silent||!0===e.exception&&!this.handleExceptions)return r(null);let n=this.level||this.parent&&this.parent.level;if(!n||this.levels[n]>=this.levels[e[s]]){let t,n;if(e&&!this.format)return this.log(e,r);try{n=this.format.transform(Object.assign({},e),this.format.options)}catch(e){t=e}if(t||!n){if(r(),t)throw t;return}return this.log(n,r)}return this._writableState.sync=!1,r(null)},o.prototype._writev=function(e,t){if(this.logv){let r=e.filter(this._accept,this);return r.length?this.logv(r,t):t(null)}for(let r=0;r<e.length;r++){let n,i;if(this._accept(e[r])){if(e[r].chunk&&!this.format){this.log(e[r].chunk,e[r].callback);continue}try{i=this.format.transform(Object.assign({},e[r].chunk),this.format.options)}catch(e){n=e}if(n||!i){if(e[r].callback(),n)throw t(null),n}else this.log(i,e[r].callback)}}return t(null)},o.prototype._accept=function(e){let t=e.chunk;if(this.silent)return!1;let r=this.level||this.parent&&this.parent.level;return(!0===t.exception||!r||this.levels[r]>=this.levels[t[s]])&&(!!this.handleExceptions||!0!==t.exception)},o.prototype._nop=function(){}},6399:(e,t,r)=>{"use strict";let n=r(51),{warn:i}=r(3563);t.version=r(5040).version,t.transports=r(4279),t.config=r(5211),t.addColors=n.levels,t.format=n.format,t.createLogger=r(6747),t.Logger=r(1190),t.ExceptionHandler=r(608),t.RejectionHandler=r(3930),t.Container=r(6735),t.Transport=r(9747),t.loggers=new t.Container;let s=t.createLogger();Object.keys(t.config.npm.levels).concat(["log","query","stream","add","remove","clear","profile","startTimer","handleExceptions","unhandleExceptions","handleRejections","unhandleRejections","configure","child"]).forEach(e=>t[e]=(...t)=>s[e](...t)),Object.defineProperty(t,"level",{get:()=>s.level,set(e){s.level=e}}),Object.defineProperty(t,"exceptions",{get:()=>s.exceptions}),Object.defineProperty(t,"rejections",{get:()=>s.rejections}),["exitOnError"].forEach(e=>{Object.defineProperty(t,e,{get:()=>s[e],set(t){s[e]=t}})}),Object.defineProperty(t,"default",{get:()=>({exceptionHandlers:s.exceptionHandlers,rejectionHandlers:s.rejectionHandlers,transports:s.transports})}),i.deprecated(t,"setLevels"),i.forFunctions(t,"useFormat",["cli"]),i.forProperties(t,"useFormat",["padLevels","stripColors"]),i.forFunctions(t,"deprecated",["addRewriter","addFilter","clone","extend"]),i.forProperties(t,"deprecated",["emitErrs","levelLength"])},3563:(e,t,r)=>{"use strict";let{format:n}=r(8354);t.warn={deprecated:e=>()=>{throw Error(n("{ %s } was removed in winston@3.0.0.",e))},useFormat:e=>()=>{throw Error([n("{ %s } was removed in winston@3.0.0.",e),"Use a custom winston.format = winston.format(function) instead."].join("\n"))},forFunctions(e,r,n){n.forEach(n=>{e[n]=t.warn[r](n)})},forProperties(e,r,n){n.forEach(n=>{let i=t.warn[r](n);Object.defineProperty(e,n,{get:i,set:i})})}}},5211:(e,t,r)=>{"use strict";let n=r(51),{configs:i}=r(2239);t.cli=n.levels(i.cli),t.npm=n.levels(i.npm),t.syslog=n.levels(i.syslog),t.addColors=n.levels},6735:(e,t,r)=>{"use strict";let n=r(6747);e.exports=class{constructor(e={}){this.loggers=new Map,this.options=e}add(e,t){if(!this.loggers.has(e)){let r=(t=Object.assign({},t||this.options)).transports||this.options.transports;r?t.transports=Array.isArray(r)?r.slice():[r]:t.transports=[];let i=n(t);i.on("close",()=>this._delete(e)),this.loggers.set(e,i)}return this.loggers.get(e)}get(e,t){return this.add(e,t)}has(e){return!!this.loggers.has(e)}close(e){if(e)return this._removeLogger(e);this.loggers.forEach((e,t)=>this._removeLogger(t))}_removeLogger(e){this.loggers.has(e)&&(this.loggers.get(e).close(),this._delete(e))}_delete(e){this.loggers.delete(e)}}},6747:(e,t,r)=>{"use strict";let{LEVEL:n}=r(2239),i=r(5211),s=r(1190),o=r(1298)("winston:create-logger");function a(e){return"is"+e.charAt(0).toUpperCase()+e.slice(1)+"Enabled"}e.exports=function(e={}){e.levels=e.levels||i.npm.levels;class t extends s{constructor(e){super(e)}}let r=new t(e);return Object.keys(e.levels).forEach(function(e){if(o('Define prototype method for "%s"',e),"log"===e){console.warn('Level "log" not defined: conflicts with the method "log". Use a different level name.');return}t.prototype[e]=function(...t){let i=this||r;if(1===t.length){let[s]=t,o=s&&s.message&&s||{message:s};return o.level=o[n]=e,i._addDefaultMeta(o),i.write(o),this||r}return 0===t.length?(i.log(e,""),i):i.log(e,...t)},t.prototype[a(e)]=function(){return(this||r).isLevelEnabled(e)}}),r}},608:(e,t,r)=>{"use strict";let n=r(1820),i=r(3529),s=r(1298)("winston:exception"),o=r(3927),a=r(9312),l=r(5002);e.exports=class{constructor(e){if(!e)throw Error("Logger is required to handle exceptions");this.logger=e,this.handlers=new Map}handle(...e){e.forEach(e=>{if(Array.isArray(e))return e.forEach(e=>this._addHandler(e));this._addHandler(e)}),this.catcher||(this.catcher=this._uncaughtException.bind(this),process.on("uncaughtException",this.catcher))}unhandle(){this.catcher&&(process.removeListener("uncaughtException",this.catcher),this.catcher=!1,Array.from(this.handlers.values()).forEach(e=>this.logger.unpipe(e)))}getAllInfo(e){let t=null;return e&&(t="string"==typeof e?e:e.message),{error:e,level:"error",message:[`uncaughtException: ${t||"(no error message)"}`,e&&e.stack||" No stack trace"].join("\n"),stack:e&&e.stack,exception:!0,date:new Date().toString(),process:this.getProcessInfo(),os:this.getOsInfo(),trace:this.getTrace(e)}}getProcessInfo(){return{pid:process.pid,uid:process.getuid?process.getuid():null,gid:process.getgid?process.getgid():null,cwd:process.cwd(),execPath:process.execPath,version:process.version,argv:process.argv,memoryUsage:process.memoryUsage()}}getOsInfo(){return{loadavg:n.loadavg(),uptime:n.uptime()}}getTrace(e){return(e?a.parse(e):a.get()).map(e=>({column:e.getColumnNumber(),file:e.getFileName(),function:e.getFunctionName(),line:e.getLineNumber(),method:e.getMethodName(),native:e.isNative()}))}_addHandler(e){if(!this.handlers.has(e)){e.handleExceptions=!0;let t=new l(e);this.handlers.set(e,t),this.logger.pipe(t)}}_uncaughtException(e){let t;let r=this.getAllInfo(e),n=this._getExceptionHandlers(),a="function"==typeof this.logger.exitOnError?this.logger.exitOnError(e):this.logger.exitOnError;function l(){s("doExit",a),s("process._exiting",process._exiting),a&&!process._exiting&&(t&&clearTimeout(t),process.exit(1))}if(!n.length&&a&&(console.warn("winston: exitOnError cannot be true with no exception handlers."),console.warn("winston: not exiting process."),a=!1),!n||0===n.length)return process.nextTick(l);i(n,(e,t)=>{let r=o(t),n=e.transport||e;function i(e){return()=>{s(e),r()}}n._ending=!0,n.once("finish",i("finished")),n.once("error",i("error"))},()=>a&&l()),this.logger.log(r),a&&(t=setTimeout(l,3e3))}_getExceptionHandlers(){return this.logger.transports.filter(e=>(e.transport||e).handleExceptions)}}},5002:(e,t,r)=>{"use strict";let{Writable:n}=r(2826);e.exports=class extends n{constructor(e){if(super({objectMode:!0}),!e)throw Error("ExceptionStream requires a TransportStream instance.");this.handleExceptions=!0,this.transport=e}_write(e,t,r){return e.exception?this.transport.log(e,r):(r(),!0)}}},1190:(e,t,r)=>{"use strict";let{Stream:n,Transform:i}=r(2826),s=r(3529),{LEVEL:o,SPLAT:a}=r(2239),l=r(6696),u=r(608),h=r(3930),c=r(1352),f=r(3659),{warn:d}=r(3563),p=r(5211),g=/%[scdjifoO%]/g;class m extends i{constructor(e){super({objectMode:!0}),this.configure(e)}child(e){let t=this;return Object.create(t,{write:{value:function(r){let n=Object.assign({},e,r);r instanceof Error&&(n.stack=r.stack,n.message=r.message),t.write(n)}}})}configure({silent:e,format:t,defaultMeta:n,levels:i,level:s="info",exitOnError:o=!0,transports:a,colors:l,emitErrs:c,formatters:f,padLevels:d,rewriters:g,stripColors:m,exceptionHandlers:b,rejectionHandlers:y}={}){if(this.transports.length&&this.clear(),this.silent=e,this.format=t||this.format||r(9161)(),this.defaultMeta=n||null,this.levels=i||this.levels||p.npm.levels,this.level=s,this.exceptions&&this.exceptions.unhandle(),this.rejections&&this.rejections.unhandle(),this.exceptions=new u(this),this.rejections=new h(this),this.profilers={},this.exitOnError=o,a&&(a=Array.isArray(a)?a:[a]).forEach(e=>this.add(e)),l||c||f||d||g||m)throw Error("{ colors, emitErrs, formatters, padLevels, rewriters, stripColors } were removed in winston@3.0.0.\nUse a custom winston.format(function) instead.\nSee: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md");b&&this.exceptions.handle(b),y&&this.rejections.handle(y)}isLevelEnabled(e){let t=b(this.levels,e);if(null===t)return!1;let r=b(this.levels,this.level);return null!==r&&(this.transports&&0!==this.transports.length?-1!==this.transports.findIndex(e=>{let n=b(this.levels,e.level);return null===n&&(n=r),n>=t}):r>=t)}log(e,t,...r){if(1==arguments.length)return e[o]=e.level,this._addDefaultMeta(e),this.write(e),this;if(2==arguments.length)return t&&"object"==typeof t?t[o]=t.level=e:t={[o]:e,level:e,message:t},this._addDefaultMeta(t),this.write(t),this;let[n]=r;if("object"==typeof n&&null!==n&&!(t&&t.match&&t.match(g))){let i=Object.assign({},this.defaultMeta,n,{[o]:e,[a]:r,level:e,message:t});return n.message&&(i.message=`${i.message} ${n.message}`),n.stack&&(i.stack=n.stack),n.cause&&(i.cause=n.cause),this.write(i),this}return this.write(Object.assign({},this.defaultMeta,{[o]:e,[a]:r,level:e,message:t})),this}_transform(e,t,r){if(this.silent)return r();e[o]||(e[o]=e.level),this.levels[e[o]]||0===this.levels[e[o]]||console.error("[winston] Unknown logger level: %s",e[o]),this._readableState.pipes||console.error("[winston] Attempt to write logs with no transports, which can increase memory usage: %j",e);try{this.push(this.format.transform(e,this.format.options))}finally{this._writableState.sync=!1,r()}}_final(e){s(this.transports.slice(),(e,t)=>{if(!e||e.finished)return setImmediate(t);e.once("finish",t),e.end()},e)}add(e){let t=!l(e)||e.log.length>2?new c({transport:e}):e;if(!t._writableState||!t._writableState.objectMode)throw Error("Transports must WritableStreams in objectMode. Set { objectMode: true }.");return this._onEvent("error",t),this._onEvent("warn",t),this.pipe(t),e.handleExceptions&&this.exceptions.handle(),e.handleRejections&&this.rejections.handle(),this}remove(e){if(!e)return this;let t=e;return(!l(e)||e.log.length>2)&&(t=this.transports.filter(t=>t.transport===e)[0]),t&&this.unpipe(t),this}clear(){return this.unpipe(),this}close(){return this.exceptions.unhandle(),this.rejections.unhandle(),this.clear(),this.emit("close"),this}setLevels(){d.deprecated("setLevels")}query(e,t){"function"==typeof e&&(t=e,e={});let r={},n=Object.assign({},(e=e||{}).query||{});function i(t,r){e.query&&"function"==typeof t.formatQuery&&(e.query=t.formatQuery(n)),t.query(e,(n,i)=>{if(n)return r(n);"function"==typeof t.formatResults&&(i=t.formatResults(i,e.format)),r(null,i)})}function o(e,t){i(e,(n,i)=>{t&&((i=n||i)&&(r[e.name]=i),t()),t=null})}s(this.transports.filter(e=>!!e.query),o,()=>t(null,r))}stream(e={}){let t=new n,r=[];return t._streams=r,t.destroy=()=>{let e=r.length;for(;e--;)r[e].destroy()},this.transports.filter(e=>!!e.stream).forEach(n=>{let i=n.stream(e);i&&(r.push(i),i.on("log",e=>{e.transport=e.transport||[],e.transport.push(n.name),t.emit("log",e)}),i.on("error",e=>{e.transport=e.transport||[],e.transport.push(n.name),t.emit("error",e)}))}),t}startTimer(){return new f(this)}profile(e,...t){let r=Date.now();if(this.profilers[e]){let n=this.profilers[e];delete this.profilers[e],"function"==typeof t[t.length-2]&&(console.warn("Callback function no longer supported as of winston@3.0.0"),t.pop());let i="object"==typeof t[t.length-1]?t.pop():{};return i.level=i.level||"info",i.durationMs=r-n,i.message=i.message||e,this.write(i)}return this.profilers[e]=r,this}handleExceptions(...e){console.warn("Deprecated: .handleExceptions() will be removed in winston@4. Use .exceptions.handle()"),this.exceptions.handle(...e)}unhandleExceptions(...e){console.warn("Deprecated: .unhandleExceptions() will be removed in winston@4. Use .exceptions.unhandle()"),this.exceptions.unhandle(...e)}cli(){throw Error("Logger.cli() was removed in winston@3.0.0\nUse a custom winston.formats.cli() instead.\nSee: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md")}_onEvent(e,t){function r(r){"error"!==e||this.transports.includes(t)||this.add(t),this.emit(e,r,t)}t["__winston"+e]||(t["__winston"+e]=r.bind(this),t.on(e,t["__winston"+e]))}_addDefaultMeta(e){this.defaultMeta&&Object.assign(e,this.defaultMeta)}}function b(e,t){let r=e[t];return r||0===r?r:null}Object.defineProperty(m.prototype,"transports",{configurable:!1,enumerable:!0,get(){let{pipes:e}=this._readableState;return Array.isArray(e)?e:[e].filter(Boolean)}}),e.exports=m},3659:(e,t,r)=>{"use strict";class n{constructor(e){let t=r(1190);if("object"!=typeof e||Array.isArray(e)||!(e instanceof t))throw Error("Logger is required for profiling");this.logger=e,this.start=Date.now()}done(...e){"function"==typeof e[e.length-1]&&(console.warn("Callback function no longer supported as of winston@3.0.0"),e.pop());let t="object"==typeof e[e.length-1]?e.pop():{};return t.level=t.level||"info",t.durationMs=Date.now()-this.start,this.logger.write(t)}}e.exports=n},3930:(e,t,r)=>{"use strict";let n=r(1820),i=r(3529),s=r(1298)("winston:rejection"),o=r(3927),a=r(9312),l=r(3448);e.exports=class{constructor(e){if(!e)throw Error("Logger is required to handle rejections");this.logger=e,this.handlers=new Map}handle(...e){e.forEach(e=>{if(Array.isArray(e))return e.forEach(e=>this._addHandler(e));this._addHandler(e)}),this.catcher||(this.catcher=this._unhandledRejection.bind(this),process.on("unhandledRejection",this.catcher))}unhandle(){this.catcher&&(process.removeListener("unhandledRejection",this.catcher),this.catcher=!1,Array.from(this.handlers.values()).forEach(e=>this.logger.unpipe(e)))}getAllInfo(e){let t=null;return e&&(t="string"==typeof e?e:e.message),{error:e,level:"error",message:[`unhandledRejection: ${t||"(no error message)"}`,e&&e.stack||" No stack trace"].join("\n"),stack:e&&e.stack,rejection:!0,date:new Date().toString(),process:this.getProcessInfo(),os:this.getOsInfo(),trace:this.getTrace(e)}}getProcessInfo(){return{pid:process.pid,uid:process.getuid?process.getuid():null,gid:process.getgid?process.getgid():null,cwd:process.cwd(),execPath:process.execPath,version:process.version,argv:process.argv,memoryUsage:process.memoryUsage()}}getOsInfo(){return{loadavg:n.loadavg(),uptime:n.uptime()}}getTrace(e){return(e?a.parse(e):a.get()).map(e=>({column:e.getColumnNumber(),file:e.getFileName(),function:e.getFunctionName(),line:e.getLineNumber(),method:e.getMethodName(),native:e.isNative()}))}_addHandler(e){if(!this.handlers.has(e)){e.handleRejections=!0;let t=new l(e);this.handlers.set(e,t),this.logger.pipe(t)}}_unhandledRejection(e){let t;let r=this.getAllInfo(e),n=this._getRejectionHandlers(),a="function"==typeof this.logger.exitOnError?this.logger.exitOnError(e):this.logger.exitOnError;function l(){s("doExit",a),s("process._exiting",process._exiting),a&&!process._exiting&&(t&&clearTimeout(t),process.exit(1))}if(!n.length&&a&&(console.warn("winston: exitOnError cannot be true with no rejection handlers."),console.warn("winston: not exiting process."),a=!1),!n||0===n.length)return process.nextTick(l);i(n,(e,t)=>{let r=o(t),n=e.transport||e;function i(e){return()=>{s(e),r()}}n._ending=!0,n.once("finish",i("finished")),n.once("error",i("error"))},()=>a&&l()),this.logger.log(r),a&&(t=setTimeout(l,3e3))}_getRejectionHandlers(){return this.logger.transports.filter(e=>(e.transport||e).handleRejections)}}},3448:(e,t,r)=>{"use strict";let{Writable:n}=r(2826);e.exports=class extends n{constructor(e){if(super({objectMode:!0}),!e)throw Error("RejectionStream requires a TransportStream instance.");this.handleRejections=!0,this.transport=e}_write(e,t,r){return e.rejection?this.transport.log(e,r):(r(),!0)}}},7539:(e,t,r)=>{"use strict";let n=r(9021),{StringDecoder:i}=r(1204),{Stream:s}=r(2826);function o(){}e.exports=(e,t)=>{let r=Buffer.alloc(65536),a=new i("utf8"),l=new s,u="",h=0,c=0;return(-1===e.start&&delete e.start,l.readable=!0,l.destroy=()=>{l.destroyed=!0,l.emit("end"),l.emit("close")},n.open(e.file,"a+","0644",(i,s)=>{if(i){t?t(i):l.emit("error",i),l.destroy();return}!function i(){if(l.destroyed){n.close(s,o);return}return n.read(s,r,0,r.length,h,(n,s)=>{if(n){t?t(n):l.emit("error",n),l.destroy();return}if(!s)return u&&((null==e.start||c>e.start)&&(t?t(null,u):l.emit("line",u)),c++,u=""),setTimeout(i,1e3);let o=a.write(r.slice(0,s));t||l.emit("data",o);let f=(o=(u+o).split(/\n+/)).length-1,d=0;for(;d<f;d++)(null==e.start||c>e.start)&&(t?t(null,o[d]):l.emit("line",o[d])),c++;return u=o[f],h+=s,i()})}()}),t)?l.destroy:l}},6718:(e,t,r)=>{"use strict";let n=r(1820),{LEVEL:i,MESSAGE:s}=r(2239),o=r(9747);e.exports=class extends o{constructor(e={}){super(e),this.name=e.name||"console",this.stderrLevels=this._stringArrayToSet(e.stderrLevels),this.consoleWarnLevels=this._stringArrayToSet(e.consoleWarnLevels),this.eol="string"==typeof e.eol?e.eol:n.EOL,this.forceConsole=e.forceConsole||!1,this._consoleLog=console.log.bind(console),this._consoleWarn=console.warn.bind(console),this._consoleError=console.error.bind(console),this.setMaxListeners(30)}log(e,t){if(setImmediate(()=>this.emit("logged",e)),this.stderrLevels[e[i]]){console._stderr&&!this.forceConsole?console._stderr.write(`${e[s]}${this.eol}`):this._consoleError(e[s]),t&&t();return}if(this.consoleWarnLevels[e[i]]){console._stderr&&!this.forceConsole?console._stderr.write(`${e[s]}${this.eol}`):this._consoleWarn(e[s]),t&&t();return}console._stdout&&!this.forceConsole?console._stdout.write(`${e[s]}${this.eol}`):this._consoleLog(e[s]),t&&t()}_stringArrayToSet(e,t){if(!e)return{};if(t=t||"Cannot make set from type other than Array of string elements",!Array.isArray(e))throw Error(t);return e.reduce((e,r)=>{if("string"!=typeof r)throw Error(t);return e[r]=!0,e},{})}}},2089:(e,t,r)=>{"use strict";let n=r(9021),i=r(3873),s=r(3258),o=r(4075),{MESSAGE:a}=r(2239),{Stream:l,PassThrough:u}=r(2826),h=r(9747),c=r(1298)("winston:file"),f=r(1820),d=r(7539);e.exports=class extends h{constructor(e={}){function t(r,...n){n.slice(1).forEach(t=>{if(e[t])throw Error(`Cannot set ${t} and ${r} together`)})}if(super(e),this.name=e.name||"file",this._stream=new u,this._stream.setMaxListeners(30),this._onError=this._onError.bind(this),e.filename||e.dirname)t("filename or dirname","stream"),this._basename=this.filename=e.filename?i.basename(e.filename):"winston.log",this.dirname=e.dirname||i.dirname(e.filename),this.options=e.options||{flags:"a"};else if(e.stream)console.warn("options.stream will be removed in winston@4. Use winston.transports.Stream"),t("stream","filename","maxsize"),this._dest=this._stream.pipe(this._setupStream(e.stream)),this.dirname=i.dirname(this._dest.path);else throw Error("Cannot log to file without filename or stream.");this.maxsize=e.maxsize||null,this.rotationFormat=e.rotationFormat||!1,this.zippedArchive=e.zippedArchive||!1,this.maxFiles=e.maxFiles||null,this.eol="string"==typeof e.eol?e.eol:f.EOL,this.tailable=e.tailable||!1,this.lazy=e.lazy||!1,this._size=0,this._pendingSize=0,this._created=0,this._drain=!1,this._opening=!1,this._ending=!1,this._fileExist=!1,this.dirname&&this._createLogDirIfNotExist(this.dirname),this.lazy||this.open()}finishIfEnding(){this._ending&&(this._opening?this.once("open",()=>{this._stream.once("finish",()=>this.emit("finish")),setImmediate(()=>this._stream.end())}):(this._stream.once("finish",()=>this.emit("finish")),setImmediate(()=>this._stream.end())))}log(e,t=()=>{}){if(this.silent)return t(),!0;if(this._drain){this._stream.once("drain",()=>{this._drain=!1,this.log(e,t)});return}if(this._rotate){this._stream.once("rotate",()=>{this._rotate=!1,this.log(e,t)});return}if(this.lazy){if(!this._fileExist){this._opening||this.open(),this.once("open",()=>{this._fileExist=!0,this.log(e,t)});return}if(this._needsNewFile(this._pendingSize)){this._dest.once("close",()=>{this._opening||this.open(),this.once("open",()=>{this.log(e,t)})});return}}let r=`${e[a]}${this.eol}`,n=Buffer.byteLength(r);function i(){if(this._size+=n,this._pendingSize-=n,c("logged %s %s",this._size,r),this.emit("logged",e),!this._rotate&&!this._opening&&this._needsNewFile()){if(this.lazy){this._endStream(()=>{this.emit("fileclosed")});return}this._rotate=!0,this._endStream(()=>this._rotateFile())}}this._pendingSize+=n,this._opening&&!this.rotatedWhileOpening&&this._needsNewFile(this._size+this._pendingSize)&&(this.rotatedWhileOpening=!0);let s=this._stream.write(r,i.bind(this));return s?t():(this._drain=!0,this._stream.once("drain",()=>{this._drain=!1,t()})),c("written",s,this._drain),this.finishIfEnding(),s}query(e,t){"function"==typeof e&&(t=e,e={}),e=f(e);let r=i.join(this.dirname,this.filename),s="",o=[],a=0,l=n.createReadStream(r,{encoding:"utf8"});function u(e,t){try{let t=JSON.parse(e);c(t)&&h(t)}catch(e){t||l.emit("error",e)}}function h(t){if(e.rows&&o.length>=e.rows&&"desc"!==e.order){l.readable&&l.destroy();return}e.fields&&(t=e.fields.reduce((e,r)=>(e[r]=t[r],e),{})),"desc"===e.order&&o.length>=e.rows&&o.shift(),o.push(t)}function c(t){if(!t||"object"!=typeof t)return;let r=new Date(t.timestamp);if((!e.from||!(r<e.from))&&(!e.until||!(r>e.until))&&(!e.level||e.level===t.level))return!0}function f(e){return(e=e||{}).rows=e.rows||e.limit||10,e.start=e.start||0,e.until=e.until||new Date,"object"!=typeof e.until&&(e.until=new Date(e.until)),e.from=e.from||e.until-864e5,"object"!=typeof e.from&&(e.from=new Date(e.from)),e.order=e.order||"desc",e}l.on("error",e=>{if(l.readable&&l.destroy(),t)return"ENOENT"!==e.code?t(e):t(null,o)}),l.on("data",t=>{let r=(t=(s+t).split(/\n+/)).length-1,n=0;for(;n<r;n++)(!e.start||a>=e.start)&&u(t[n]),a++;s=t[r]}),l.on("close",()=>{s&&u(s,!0),"desc"===e.order&&(o=o.reverse()),t&&t(null,o)})}stream(e={}){let t=i.join(this.dirname,this.filename),r=new l,n={file:t,start:e.start};return r.destroy=d(n,(e,t)=>{if(e)return r.emit("error",e);try{r.emit("data",t),t=JSON.parse(t),r.emit("log",t)}catch(e){r.emit("error",e)}}),r}open(){this.filename&&(this._opening||(this._opening=!0,this.stat((e,t)=>{if(e)return this.emit("error",e);c("stat done: %s { size: %s }",this.filename,t),this._size=t,this._dest=this._createStream(this._stream),this._opening=!1,this.once("open",()=>{this._stream.emit("rotate")||(this._rotate=!1)})})))}stat(e){let t=this._getFile(),r=i.join(this.dirname,t);n.stat(r,(n,i)=>n&&"ENOENT"===n.code?(c("ENOENT\xa0ok",r),this.filename=t,e(null,0)):n?(c(`err ${n.code} ${r}`),e(n)):!i||this._needsNewFile(i.size)?this._incFile(()=>this.stat(e)):void(this.filename=t,e(null,i.size)))}close(e){this._stream&&this._stream.end(()=>{e&&e(),this.emit("flush"),this.emit("closed")})}_needsNewFile(e){return e=e||this._size,this.maxsize&&e>=this.maxsize}_onError(e){this.emit("error",e)}_setupStream(e){return e.on("error",this._onError),e}_cleanupStream(e){return e.removeListener("error",this._onError),e.destroy(),e}_rotateFile(){this._incFile(()=>this.open())}_endStream(e=()=>{}){this._dest?(this._stream.unpipe(this._dest),this._dest.end(()=>{this._cleanupStream(this._dest),e()})):e()}_createStream(e){let t=i.join(this.dirname,this.filename);c("create stream start",t,this.options);let r=n.createWriteStream(t,this.options).on("error",e=>c(e)).on("close",()=>c("close",r.path,r.bytesWritten)).on("open",()=>{c("file open ok",t),this.emit("open",t),e.pipe(r),this.rotatedWhileOpening&&(this._stream=new u,this._stream.setMaxListeners(30),this._rotateFile(),this.rotatedWhileOpening=!1,this._cleanupStream(r),e.end())});return c("create stream ok",t),r}_incFile(e){c("_incFile",this.filename);let t=i.extname(this._basename),r=i.basename(this._basename,t),n=[];this.zippedArchive&&n.push((function(e){let n=this._created>0&&!this.tailable?this._created:"";this._compressFile(i.join(this.dirname,`${r}${n}${t}`),i.join(this.dirname,`${r}${n}${t}.gz`),e)}).bind(this)),n.push((function(e){this.tailable?this._checkMaxFilesTailable(t,r,e):(this._created+=1,this._checkMaxFilesIncrementing(t,r,e))}).bind(this)),s(n,e)}_getFile(){let e=i.extname(this._basename),t=i.basename(this._basename,e),r=this.rotationFormat?this.rotationFormat():this._created;return!this.tailable&&this._created?`${t}${r}${e}`:`${t}${e}`}_checkMaxFilesIncrementing(e,t,r){if(!this.maxFiles||this._created<this.maxFiles)return setImmediate(r);let s=this._created-this.maxFiles,o=0!==s?s:"",a=this.zippedArchive?".gz":"",l=`${t}${o}${e}${a}`,u=i.join(this.dirname,l);n.unlink(u,r)}_checkMaxFilesTailable(e,t,r){let o=[];if(!this.maxFiles)return;let a=this.zippedArchive?".gz":"";for(let r=this.maxFiles-1;r>1;r--)o.push((function(r,s){let o=`${t}${r-1}${e}${a}`,l=i.join(this.dirname,o);n.exists(l,u=>{if(!u)return s(null);o=`${t}${r}${e}${a}`,n.rename(l,i.join(this.dirname,o),s)})}).bind(this,r));s(o,()=>{n.rename(i.join(this.dirname,`${t}${e}${a}`),i.join(this.dirname,`${t}1${e}${a}`),r)})}_compressFile(e,t,r){n.access(e,n.F_OK,i=>{if(i)return r();var s=o.createGzip(),a=n.createReadStream(e),l=n.createWriteStream(t);l.on("finish",()=>{n.unlink(e,r)}),a.pipe(s).pipe(l)})}_createLogDirIfNotExist(e){n.existsSync(e)||n.mkdirSync(e,{recursive:!0})}}},5307:(e,t,r)=>{"use strict";let n=r(1630),i=r(5591),{Stream:s}=r(2826),o=r(9747),{configure:a}=r(900);e.exports=class extends o{constructor(e={}){super(e),this.options=e,this.name=e.name||"http",this.ssl=!!e.ssl,this.host=e.host||"localhost",this.port=e.port,this.auth=e.auth,this.path=e.path||"",this.maximumDepth=e.maximumDepth,this.agent=e.agent,this.headers=e.headers||{},this.headers["content-type"]="application/json",this.batch=e.batch||!1,this.batchInterval=e.batchInterval||5e3,this.batchCount=e.batchCount||10,this.batchOptions=[],this.batchTimeoutID=-1,this.batchCallback={},this.port||(this.port=this.ssl?443:80)}log(e,t){this._request(e,null,null,(t,r)=>{r&&200!==r.statusCode&&(t=Error(`Invalid HTTP Status Code: ${r.statusCode}`)),t?this.emit("warn",t):this.emit("logged",e)}),t&&setImmediate(t)}query(e,t){"function"==typeof e&&(t=e,e={});let r=(e={method:"query",params:this.normalizeQuery(e)}).params.auth||null;delete e.params.auth;let n=e.params.path||null;delete e.params.path,this._request(e,r,n,(e,r,n)=>{if(r&&200!==r.statusCode&&(e=Error(`Invalid HTTP Status Code: ${r.statusCode}`)),e)return t(e);if("string"==typeof n)try{n=JSON.parse(n)}catch(e){return t(e)}t(null,n)})}stream(e={}){let t=new s,r=(e={method:"stream",params:e}).params.path||null;delete e.params.path;let n=e.params.auth||null;delete e.params.auth;let i="",o=this._request(e,n,r);return t.destroy=()=>o.destroy(),o.on("data",e=>{let r=(e=(i+e).split(/\n+/)).length-1,n=0;for(;n<r;n++)try{t.emit("log",JSON.parse(e[n]))}catch(e){t.emit("error",e)}i=e[r]}),o.on("error",e=>t.emit("error",e)),t}_request(e,t,r,n){e=e||{},t=t||this.auth,r=r||this.path||"",this.batch?this._doBatch(e,n,t,r):this._doRequest(e,n,t,r)}_doBatch(e,t,r,n){if(this.batchOptions.push(e),1===this.batchOptions.length){let e=this;this.batchCallback=t,this.batchTimeoutID=setTimeout(function(){e.batchTimeoutID=-1,e._doBatchRequest(e.batchCallback,r,n)},this.batchInterval)}this.batchOptions.length===this.batchCount&&this._doBatchRequest(this.batchCallback,r,n)}_doBatchRequest(e,t,r){this.batchTimeoutID>0&&(clearTimeout(this.batchTimeoutID),this.batchTimeoutID=-1);let n=this.batchOptions.slice();this.batchOptions=[],this._doRequest(n,e,t,r)}_doRequest(e,t,r,s){let o=Object.assign({},this.headers);r&&r.bearer&&(o.Authorization=`Bearer ${r.bearer}`);let l=(this.ssl?i:n).request({...this.options,method:"POST",host:this.host,port:this.port,path:`/${s.replace(/^\//,"")}`,headers:o,auth:r&&r.username&&r.password?`${r.username}:${r.password}`:"",agent:this.agent});l.on("error",t),l.on("response",e=>e.on("end",()=>t(null,e)).resume());let u=a({...this.maximumDepth&&{maximumDepth:this.maximumDepth}});l.end(Buffer.from(u(e,this.options.replacer),"utf8"))}}},4279:(e,t,r)=>{"use strict";Object.defineProperty(t,"Console",{configurable:!0,enumerable:!0,get:()=>r(6718)}),Object.defineProperty(t,"File",{configurable:!0,enumerable:!0,get:()=>r(2089)}),Object.defineProperty(t,"Http",{configurable:!0,enumerable:!0,get:()=>r(5307)}),Object.defineProperty(t,"Stream",{configurable:!0,enumerable:!0,get:()=>r(1171)})},1171:(e,t,r)=>{"use strict";let n=r(6696),{MESSAGE:i}=r(2239),s=r(1820),o=r(9747);e.exports=class extends o{constructor(e={}){if(super(e),!e.stream||!n(e.stream))throw Error("options.stream is required.");this._stream=e.stream,this._stream.setMaxListeners(1/0),this.isObjectMode=e.stream._writableState.objectMode,this.eol="string"==typeof e.eol?e.eol:s.EOL}log(e,t){if(setImmediate(()=>this.emit("logged",e)),this.isObjectMode){this._stream.write(e),t&&t();return}this._stream.write(`${e[i]}${this.eol}`),t&&t()}}},3149:(e,t,r)=>{"use strict";r.d(t,{dJ:()=>x});var n=r(6760),i=r(1708),s=r(3024),o=r(3136);class a{value;next;constructor(e){this.value=e}}class l{#e;#t;#r;constructor(){this.clear()}enqueue(e){let t=new a(e);this.#e?this.#t.next=t:this.#e=t,this.#t=t,this.#r++}dequeue(){let e=this.#e;if(e)return this.#e=this.#e.next,this.#r--,e.value}peek(){if(this.#e)return this.#e.value}clear(){this.#e=void 0,this.#t=void 0,this.#r=0}get size(){return this.#r}*[Symbol.iterator](){let e=this.#e;for(;e;)yield e.value,e=e.next}}function u(e){if(!((Number.isInteger(e)||e===Number.POSITIVE_INFINITY)&&e>0))throw TypeError("Expected `concurrency` to be a number from 1 and up");let t=new l,r=0,n=()=>{r--,t.size>0&&t.dequeue()()},i=async(e,t,i)=>{r++;let s=(async()=>e(...i))();t(s);try{await s}catch{}n()},s=(n,s,o)=>{t.enqueue(i.bind(void 0,n,s,o)),(async()=>{await Promise.resolve(),r<e&&t.size>0&&t.dequeue()()})()},o=(e,...t)=>new Promise(r=>{s(e,r,t)});return Object.defineProperties(o,{activeCount:{get:()=>r},pendingCount:{get:()=>t.size},clearQueue:{value:()=>{t.clear()}}}),o}class h extends Error{constructor(e){super(),this.value=e}}let c=async(e,t)=>t(await e),f=async e=>{let t=await Promise.all(e);if(!0===t[1])throw new h(t[0]);return!1};async function d(e,t,{concurrency:r=Number.POSITIVE_INFINITY,preserveOrder:n=!0}={}){let i=u(r),s=[...e].map(e=>[e,i(c,e,t)]),o=u(n?1:Number.POSITIVE_INFINITY);try{await Promise.all(s.map(e=>o(f,e)))}catch(e){if(e instanceof h)return e.value;throw e}}let p={directory:"isDirectory",file:"isFile"};function g(e){if(!Object.hasOwnProperty.call(p,e))throw Error(`Invalid type specified: ${e}`)}let m=(e,t)=>t[p[e]](),b=e=>e instanceof URL?(0,o.fileURLToPath)(e):e;async function y(e,{cwd:t=i.cwd(),type:r="file",allowSymlinks:o=!0,concurrency:a,preserveOrder:l}={}){g(r),t=b(t);let u=o?s.promises.stat:s.promises.lstat;return d(e,async e=>{try{let i=await u(n.resolve(t,e));return m(r,i)}catch{return!1}},{concurrency:a,preserveOrder:l})}function w(e){return e instanceof URL?(0,o.fileURLToPath)(e):e}let v=Symbol("findUpStop");async function _(e,t={}){let r=n.resolve(w(t.cwd)??""),{root:i}=n.parse(r),s=n.resolve(r,w(t.stopAt??i)),o=t.limit??Number.POSITIVE_INFINITY,a=[e].flat(),l=async t=>{if("function"!=typeof e)return y(a,t);let r=await e(t.cwd);return"string"==typeof r?y([r],t):r},u=[];for(;;){let e=await l({...t,cwd:r});if(e===v||(e&&u.push(n.resolve(r,e)),r===s||u.length>=o))break;r=n.dirname(r)}return u}async function x(e,t={}){return(await _(e,{...t,limit:1}))[0]}},6789:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});let n=Symbol("singleComment"),i=Symbol("multiComment"),s=()=>"",o=(e,t,r)=>e.slice(t,r).replace(/\S/g," "),a=(e,t)=>{let r=t-1,n=0;for(;"\\"===e[r];)r-=1,n+=1;return!!(n%2)};function l(e,{whitespace:t=!0,trailingCommas:r=!1}={}){if("string"!=typeof e)throw TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof e}\``);let u=t?o:s,h=!1,c=!1,f=0,d="",p="",g=-1;for(let t=0;t<e.length;t++){let s=e[t],o=e[t+1];if(c||'"'!==s||a(e,t)||(h=!h),!h){if(c||s+o!=="//"){if(c===n&&s+o==="\r\n"){c=!1,d+=u(e,f,++t),f=t;continue}if(c===n&&"\n"===s)c=!1,d+=u(e,f,t),f=t;else if(c||s+o!=="/*"){if(c===i&&s+o==="*/"){c=!1,d+=u(e,f,++t+1),f=t+1;continue}r&&!c&&(-1!==g?"}"===s||"]"===s?(d+=e.slice(f,t),p+=u(d,0,1)+d.slice(1),d="",f=t,g=-1):" "!==s&&" "!==s&&"\r"!==s&&"\n"!==s&&(d+=e.slice(f,t),f=t,g=-1):","===s&&(p+=d+e.slice(f,t),d="",f=t,g=t))}else{d+=e.slice(f,t),f=t,c=i,t++;continue}}else d+=e.slice(f,t),f=t,c=n,t++}}return p+d+(c?u(e.slice(f)):e.slice(f))}},5040:e=>{"use strict";e.exports={version:"3.17.0"}}};
23
+ - Upgrade docs: https://github.com/winstonjs/winston/blob/master/UPGRADE-3.0.md`)},o.prototype.close=function(){this.transport.close&&this.transport.close(),this.transport.__winstonError&&(this.transport.removeListener("error",this.transport.__winstonError),this.transport.__winstonError=null)}},3744:(e,t,r)=>{"use strict";let n=r(8354),i=r(6324),{LEVEL:s}=r(2239),o=e.exports=function(e={}){i.call(this,{objectMode:!0,highWaterMark:e.highWaterMark}),this.format=e.format,this.level=e.level,this.handleExceptions=e.handleExceptions,this.handleRejections=e.handleRejections,this.silent=e.silent,e.log&&(this.log=e.log),e.logv&&(this.logv=e.logv),e.close&&(this.close=e.close),this.once("pipe",e=>{this.levels=e.levels,this.parent=e}),this.once("unpipe",e=>{e===this.parent&&(this.parent=null,this.close&&this.close())})};n.inherits(o,i),o.prototype._write=function(e,t,r){if(this.silent||!0===e.exception&&!this.handleExceptions)return r(null);let n=this.level||this.parent&&this.parent.level;if(!n||this.levels[n]>=this.levels[e[s]]){let t,n;if(e&&!this.format)return this.log(e,r);try{n=this.format.transform(Object.assign({},e),this.format.options)}catch(e){t=e}if(t||!n){if(r(),t)throw t;return}return this.log(n,r)}return this._writableState.sync=!1,r(null)},o.prototype._writev=function(e,t){if(this.logv){let r=e.filter(this._accept,this);return r.length?this.logv(r,t):t(null)}for(let r=0;r<e.length;r++){let n,i;if(this._accept(e[r])){if(e[r].chunk&&!this.format){this.log(e[r].chunk,e[r].callback);continue}try{i=this.format.transform(Object.assign({},e[r].chunk),this.format.options)}catch(e){n=e}if(n||!i){if(e[r].callback(),n)throw t(null),n}else this.log(i,e[r].callback)}}return t(null)},o.prototype._accept=function(e){let t=e.chunk;if(this.silent)return!1;let r=this.level||this.parent&&this.parent.level;return(!0===t.exception||!r||this.levels[r]>=this.levels[t[s]])&&(!!this.handleExceptions||!0!==t.exception)},o.prototype._nop=function(){}},6399:(e,t,r)=>{"use strict";let n=r(51),{warn:i}=r(3563);t.version=r(5040).version,t.transports=r(4279),t.config=r(5211),t.addColors=n.levels,t.format=n.format,t.createLogger=r(6747),t.Logger=r(1190),t.ExceptionHandler=r(608),t.RejectionHandler=r(3930),t.Container=r(6735),t.Transport=r(9747),t.loggers=new t.Container;let s=t.createLogger();Object.keys(t.config.npm.levels).concat(["log","query","stream","add","remove","clear","profile","startTimer","handleExceptions","unhandleExceptions","handleRejections","unhandleRejections","configure","child"]).forEach(e=>t[e]=(...t)=>s[e](...t)),Object.defineProperty(t,"level",{get:()=>s.level,set(e){s.level=e}}),Object.defineProperty(t,"exceptions",{get:()=>s.exceptions}),Object.defineProperty(t,"rejections",{get:()=>s.rejections}),["exitOnError"].forEach(e=>{Object.defineProperty(t,e,{get:()=>s[e],set(t){s[e]=t}})}),Object.defineProperty(t,"default",{get:()=>({exceptionHandlers:s.exceptionHandlers,rejectionHandlers:s.rejectionHandlers,transports:s.transports})}),i.deprecated(t,"setLevels"),i.forFunctions(t,"useFormat",["cli"]),i.forProperties(t,"useFormat",["padLevels","stripColors"]),i.forFunctions(t,"deprecated",["addRewriter","addFilter","clone","extend"]),i.forProperties(t,"deprecated",["emitErrs","levelLength"])},3563:(e,t,r)=>{"use strict";let{format:n}=r(8354);t.warn={deprecated:e=>()=>{throw Error(n("{ %s } was removed in winston@3.0.0.",e))},useFormat:e=>()=>{throw Error([n("{ %s } was removed in winston@3.0.0.",e),"Use a custom winston.format = winston.format(function) instead."].join("\n"))},forFunctions(e,r,n){n.forEach(n=>{e[n]=t.warn[r](n)})},forProperties(e,r,n){n.forEach(n=>{let i=t.warn[r](n);Object.defineProperty(e,n,{get:i,set:i})})}}},5211:(e,t,r)=>{"use strict";let n=r(51),{configs:i}=r(2239);t.cli=n.levels(i.cli),t.npm=n.levels(i.npm),t.syslog=n.levels(i.syslog),t.addColors=n.levels},6735:(e,t,r)=>{"use strict";let n=r(6747);e.exports=class{constructor(e={}){this.loggers=new Map,this.options=e}add(e,t){if(!this.loggers.has(e)){let r=(t=Object.assign({},t||this.options)).transports||this.options.transports;r?t.transports=Array.isArray(r)?r.slice():[r]:t.transports=[];let i=n(t);i.on("close",()=>this._delete(e)),this.loggers.set(e,i)}return this.loggers.get(e)}get(e,t){return this.add(e,t)}has(e){return!!this.loggers.has(e)}close(e){if(e)return this._removeLogger(e);this.loggers.forEach((e,t)=>this._removeLogger(t))}_removeLogger(e){this.loggers.has(e)&&(this.loggers.get(e).close(),this._delete(e))}_delete(e){this.loggers.delete(e)}}},6747:(e,t,r)=>{"use strict";let{LEVEL:n}=r(2239),i=r(5211),s=r(1190),o=r(1298)("winston:create-logger");function a(e){return"is"+e.charAt(0).toUpperCase()+e.slice(1)+"Enabled"}e.exports=function(e={}){e.levels=e.levels||i.npm.levels;class t extends s{constructor(e){super(e)}}let r=new t(e);return Object.keys(e.levels).forEach(function(e){if(o('Define prototype method for "%s"',e),"log"===e){console.warn('Level "log" not defined: conflicts with the method "log". Use a different level name.');return}t.prototype[e]=function(...t){let i=this||r;if(1===t.length){let[s]=t,o=s&&s.message&&s||{message:s};return o.level=o[n]=e,i._addDefaultMeta(o),i.write(o),this||r}return 0===t.length?(i.log(e,""),i):i.log(e,...t)},t.prototype[a(e)]=function(){return(this||r).isLevelEnabled(e)}}),r}},608:(e,t,r)=>{"use strict";let n=r(1820),i=r(3529),s=r(1298)("winston:exception"),o=r(3927),a=r(9312),l=r(5002);e.exports=class{constructor(e){if(!e)throw Error("Logger is required to handle exceptions");this.logger=e,this.handlers=new Map}handle(...e){e.forEach(e=>{if(Array.isArray(e))return e.forEach(e=>this._addHandler(e));this._addHandler(e)}),this.catcher||(this.catcher=this._uncaughtException.bind(this),process.on("uncaughtException",this.catcher))}unhandle(){this.catcher&&(process.removeListener("uncaughtException",this.catcher),this.catcher=!1,Array.from(this.handlers.values()).forEach(e=>this.logger.unpipe(e)))}getAllInfo(e){let t=null;return e&&(t="string"==typeof e?e:e.message),{error:e,level:"error",message:[`uncaughtException: ${t||"(no error message)"}`,e&&e.stack||" No stack trace"].join("\n"),stack:e&&e.stack,exception:!0,date:new Date().toString(),process:this.getProcessInfo(),os:this.getOsInfo(),trace:this.getTrace(e)}}getProcessInfo(){return{pid:process.pid,uid:process.getuid?process.getuid():null,gid:process.getgid?process.getgid():null,cwd:process.cwd(),execPath:process.execPath,version:process.version,argv:process.argv,memoryUsage:process.memoryUsage()}}getOsInfo(){return{loadavg:n.loadavg(),uptime:n.uptime()}}getTrace(e){return(e?a.parse(e):a.get()).map(e=>({column:e.getColumnNumber(),file:e.getFileName(),function:e.getFunctionName(),line:e.getLineNumber(),method:e.getMethodName(),native:e.isNative()}))}_addHandler(e){if(!this.handlers.has(e)){e.handleExceptions=!0;let t=new l(e);this.handlers.set(e,t),this.logger.pipe(t)}}_uncaughtException(e){let t;let r=this.getAllInfo(e),n=this._getExceptionHandlers(),a="function"==typeof this.logger.exitOnError?this.logger.exitOnError(e):this.logger.exitOnError;function l(){s("doExit",a),s("process._exiting",process._exiting),a&&!process._exiting&&(t&&clearTimeout(t),process.exit(1))}if(!n.length&&a&&(console.warn("winston: exitOnError cannot be true with no exception handlers."),console.warn("winston: not exiting process."),a=!1),!n||0===n.length)return process.nextTick(l);i(n,(e,t)=>{let r=o(t),n=e.transport||e;function i(e){return()=>{s(e),r()}}n._ending=!0,n.once("finish",i("finished")),n.once("error",i("error"))},()=>a&&l()),this.logger.log(r),a&&(t=setTimeout(l,3e3))}_getExceptionHandlers(){return this.logger.transports.filter(e=>(e.transport||e).handleExceptions)}}},5002:(e,t,r)=>{"use strict";let{Writable:n}=r(2826);e.exports=class extends n{constructor(e){if(super({objectMode:!0}),!e)throw Error("ExceptionStream requires a TransportStream instance.");this.handleExceptions=!0,this.transport=e}_write(e,t,r){return e.exception?this.transport.log(e,r):(r(),!0)}}},1190:(e,t,r)=>{"use strict";let{Stream:n,Transform:i}=r(2826),s=r(3529),{LEVEL:o,SPLAT:a}=r(2239),l=r(6696),u=r(608),h=r(3930),c=r(1352),f=r(3659),{warn:d}=r(3563),p=r(5211),g=/%[scdjifoO%]/g;class m extends i{constructor(e){super({objectMode:!0}),this.configure(e)}child(e){let t=this;return Object.create(t,{write:{value:function(r){let n=Object.assign({},e,r);r instanceof Error&&(n.stack=r.stack,n.message=r.message),t.write(n)}}})}configure({silent:e,format:t,defaultMeta:n,levels:i,level:s="info",exitOnError:o=!0,transports:a,colors:l,emitErrs:c,formatters:f,padLevels:d,rewriters:g,stripColors:m,exceptionHandlers:b,rejectionHandlers:y}={}){if(this.transports.length&&this.clear(),this.silent=e,this.format=t||this.format||r(9161)(),this.defaultMeta=n||null,this.levels=i||this.levels||p.npm.levels,this.level=s,this.exceptions&&this.exceptions.unhandle(),this.rejections&&this.rejections.unhandle(),this.exceptions=new u(this),this.rejections=new h(this),this.profilers={},this.exitOnError=o,a&&(a=Array.isArray(a)?a:[a]).forEach(e=>this.add(e)),l||c||f||d||g||m)throw Error("{ colors, emitErrs, formatters, padLevels, rewriters, stripColors } were removed in winston@3.0.0.\nUse a custom winston.format(function) instead.\nSee: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md");b&&this.exceptions.handle(b),y&&this.rejections.handle(y)}isLevelEnabled(e){let t=b(this.levels,e);if(null===t)return!1;let r=b(this.levels,this.level);return null!==r&&(this.transports&&0!==this.transports.length?-1!==this.transports.findIndex(e=>{let n=b(this.levels,e.level);return null===n&&(n=r),n>=t}):r>=t)}log(e,t,...r){if(1==arguments.length)return e[o]=e.level,this._addDefaultMeta(e),this.write(e),this;if(2==arguments.length)return t&&"object"==typeof t?t[o]=t.level=e:t={[o]:e,level:e,message:t},this._addDefaultMeta(t),this.write(t),this;let[n]=r;if("object"==typeof n&&null!==n&&!(t&&t.match&&t.match(g))){let i=Object.assign({},this.defaultMeta,n,{[o]:e,[a]:r,level:e,message:t});return n.message&&(i.message=`${i.message} ${n.message}`),n.stack&&(i.stack=n.stack),n.cause&&(i.cause=n.cause),this.write(i),this}return this.write(Object.assign({},this.defaultMeta,{[o]:e,[a]:r,level:e,message:t})),this}_transform(e,t,r){if(this.silent)return r();e[o]||(e[o]=e.level),this.levels[e[o]]||0===this.levels[e[o]]||console.error("[winston] Unknown logger level: %s",e[o]),this._readableState.pipes||console.error("[winston] Attempt to write logs with no transports, which can increase memory usage: %j",e);try{this.push(this.format.transform(e,this.format.options))}finally{this._writableState.sync=!1,r()}}_final(e){s(this.transports.slice(),(e,t)=>{if(!e||e.finished)return setImmediate(t);e.once("finish",t),e.end()},e)}add(e){let t=!l(e)||e.log.length>2?new c({transport:e}):e;if(!t._writableState||!t._writableState.objectMode)throw Error("Transports must WritableStreams in objectMode. Set { objectMode: true }.");return this._onEvent("error",t),this._onEvent("warn",t),this.pipe(t),e.handleExceptions&&this.exceptions.handle(),e.handleRejections&&this.rejections.handle(),this}remove(e){if(!e)return this;let t=e;return(!l(e)||e.log.length>2)&&(t=this.transports.filter(t=>t.transport===e)[0]),t&&this.unpipe(t),this}clear(){return this.unpipe(),this}close(){return this.exceptions.unhandle(),this.rejections.unhandle(),this.clear(),this.emit("close"),this}setLevels(){d.deprecated("setLevels")}query(e,t){"function"==typeof e&&(t=e,e={});let r={},n=Object.assign({},(e=e||{}).query||{});function i(t,r){e.query&&"function"==typeof t.formatQuery&&(e.query=t.formatQuery(n)),t.query(e,(n,i)=>{if(n)return r(n);"function"==typeof t.formatResults&&(i=t.formatResults(i,e.format)),r(null,i)})}function o(e,t){i(e,(n,i)=>{t&&((i=n||i)&&(r[e.name]=i),t()),t=null})}s(this.transports.filter(e=>!!e.query),o,()=>t(null,r))}stream(e={}){let t=new n,r=[];return t._streams=r,t.destroy=()=>{let e=r.length;for(;e--;)r[e].destroy()},this.transports.filter(e=>!!e.stream).forEach(n=>{let i=n.stream(e);i&&(r.push(i),i.on("log",e=>{e.transport=e.transport||[],e.transport.push(n.name),t.emit("log",e)}),i.on("error",e=>{e.transport=e.transport||[],e.transport.push(n.name),t.emit("error",e)}))}),t}startTimer(){return new f(this)}profile(e,...t){let r=Date.now();if(this.profilers[e]){let n=this.profilers[e];delete this.profilers[e],"function"==typeof t[t.length-2]&&(console.warn("Callback function no longer supported as of winston@3.0.0"),t.pop());let i="object"==typeof t[t.length-1]?t.pop():{};return i.level=i.level||"info",i.durationMs=r-n,i.message=i.message||e,this.write(i)}return this.profilers[e]=r,this}handleExceptions(...e){console.warn("Deprecated: .handleExceptions() will be removed in winston@4. Use .exceptions.handle()"),this.exceptions.handle(...e)}unhandleExceptions(...e){console.warn("Deprecated: .unhandleExceptions() will be removed in winston@4. Use .exceptions.unhandle()"),this.exceptions.unhandle(...e)}cli(){throw Error("Logger.cli() was removed in winston@3.0.0\nUse a custom winston.formats.cli() instead.\nSee: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md")}_onEvent(e,t){function r(r){"error"!==e||this.transports.includes(t)||this.add(t),this.emit(e,r,t)}t["__winston"+e]||(t["__winston"+e]=r.bind(this),t.on(e,t["__winston"+e]))}_addDefaultMeta(e){this.defaultMeta&&Object.assign(e,this.defaultMeta)}}function b(e,t){let r=e[t];return r||0===r?r:null}Object.defineProperty(m.prototype,"transports",{configurable:!1,enumerable:!0,get(){let{pipes:e}=this._readableState;return Array.isArray(e)?e:[e].filter(Boolean)}}),e.exports=m},3659:(e,t,r)=>{"use strict";class n{constructor(e){let t=r(1190);if("object"!=typeof e||Array.isArray(e)||!(e instanceof t))throw Error("Logger is required for profiling");this.logger=e,this.start=Date.now()}done(...e){"function"==typeof e[e.length-1]&&(console.warn("Callback function no longer supported as of winston@3.0.0"),e.pop());let t="object"==typeof e[e.length-1]?e.pop():{};return t.level=t.level||"info",t.durationMs=Date.now()-this.start,this.logger.write(t)}}e.exports=n},3930:(e,t,r)=>{"use strict";let n=r(1820),i=r(3529),s=r(1298)("winston:rejection"),o=r(3927),a=r(9312),l=r(3448);e.exports=class{constructor(e){if(!e)throw Error("Logger is required to handle rejections");this.logger=e,this.handlers=new Map}handle(...e){e.forEach(e=>{if(Array.isArray(e))return e.forEach(e=>this._addHandler(e));this._addHandler(e)}),this.catcher||(this.catcher=this._unhandledRejection.bind(this),process.on("unhandledRejection",this.catcher))}unhandle(){this.catcher&&(process.removeListener("unhandledRejection",this.catcher),this.catcher=!1,Array.from(this.handlers.values()).forEach(e=>this.logger.unpipe(e)))}getAllInfo(e){let t=null;return e&&(t="string"==typeof e?e:e.message),{error:e,level:"error",message:[`unhandledRejection: ${t||"(no error message)"}`,e&&e.stack||" No stack trace"].join("\n"),stack:e&&e.stack,rejection:!0,date:new Date().toString(),process:this.getProcessInfo(),os:this.getOsInfo(),trace:this.getTrace(e)}}getProcessInfo(){return{pid:process.pid,uid:process.getuid?process.getuid():null,gid:process.getgid?process.getgid():null,cwd:process.cwd(),execPath:process.execPath,version:process.version,argv:process.argv,memoryUsage:process.memoryUsage()}}getOsInfo(){return{loadavg:n.loadavg(),uptime:n.uptime()}}getTrace(e){return(e?a.parse(e):a.get()).map(e=>({column:e.getColumnNumber(),file:e.getFileName(),function:e.getFunctionName(),line:e.getLineNumber(),method:e.getMethodName(),native:e.isNative()}))}_addHandler(e){if(!this.handlers.has(e)){e.handleRejections=!0;let t=new l(e);this.handlers.set(e,t),this.logger.pipe(t)}}_unhandledRejection(e){let t;let r=this.getAllInfo(e),n=this._getRejectionHandlers(),a="function"==typeof this.logger.exitOnError?this.logger.exitOnError(e):this.logger.exitOnError;function l(){s("doExit",a),s("process._exiting",process._exiting),a&&!process._exiting&&(t&&clearTimeout(t),process.exit(1))}if(!n.length&&a&&(console.warn("winston: exitOnError cannot be true with no rejection handlers."),console.warn("winston: not exiting process."),a=!1),!n||0===n.length)return process.nextTick(l);i(n,(e,t)=>{let r=o(t),n=e.transport||e;function i(e){return()=>{s(e),r()}}n._ending=!0,n.once("finish",i("finished")),n.once("error",i("error"))},()=>a&&l()),this.logger.log(r),a&&(t=setTimeout(l,3e3))}_getRejectionHandlers(){return this.logger.transports.filter(e=>(e.transport||e).handleRejections)}}},3448:(e,t,r)=>{"use strict";let{Writable:n}=r(2826);e.exports=class extends n{constructor(e){if(super({objectMode:!0}),!e)throw Error("RejectionStream requires a TransportStream instance.");this.handleRejections=!0,this.transport=e}_write(e,t,r){return e.rejection?this.transport.log(e,r):(r(),!0)}}},7539:(e,t,r)=>{"use strict";let n=r(9021),{StringDecoder:i}=r(1204),{Stream:s}=r(2826);function o(){}e.exports=(e,t)=>{let r=Buffer.alloc(65536),a=new i("utf8"),l=new s,u="",h=0,c=0;return(-1===e.start&&delete e.start,l.readable=!0,l.destroy=()=>{l.destroyed=!0,l.emit("end"),l.emit("close")},n.open(e.file,"a+","0644",(i,s)=>{if(i){t?t(i):l.emit("error",i),l.destroy();return}!function i(){if(l.destroyed){n.close(s,o);return}return n.read(s,r,0,r.length,h,(n,s)=>{if(n){t?t(n):l.emit("error",n),l.destroy();return}if(!s)return u&&((null==e.start||c>e.start)&&(t?t(null,u):l.emit("line",u)),c++,u=""),setTimeout(i,1e3);let o=a.write(r.slice(0,s));t||l.emit("data",o);let f=(o=(u+o).split(/\n+/)).length-1,d=0;for(;d<f;d++)(null==e.start||c>e.start)&&(t?t(null,o[d]):l.emit("line",o[d])),c++;return u=o[f],h+=s,i()})}()}),t)?l.destroy:l}},6718:(e,t,r)=>{"use strict";let n=r(1820),{LEVEL:i,MESSAGE:s}=r(2239),o=r(9747);e.exports=class extends o{constructor(e={}){super(e),this.name=e.name||"console",this.stderrLevels=this._stringArrayToSet(e.stderrLevels),this.consoleWarnLevels=this._stringArrayToSet(e.consoleWarnLevels),this.eol="string"==typeof e.eol?e.eol:n.EOL,this.forceConsole=e.forceConsole||!1,this._consoleLog=console.log.bind(console),this._consoleWarn=console.warn.bind(console),this._consoleError=console.error.bind(console),this.setMaxListeners(30)}log(e,t){if(setImmediate(()=>this.emit("logged",e)),this.stderrLevels[e[i]]){console._stderr&&!this.forceConsole?console._stderr.write(`${e[s]}${this.eol}`):this._consoleError(e[s]),t&&t();return}if(this.consoleWarnLevels[e[i]]){console._stderr&&!this.forceConsole?console._stderr.write(`${e[s]}${this.eol}`):this._consoleWarn(e[s]),t&&t();return}console._stdout&&!this.forceConsole?console._stdout.write(`${e[s]}${this.eol}`):this._consoleLog(e[s]),t&&t()}_stringArrayToSet(e,t){if(!e)return{};if(t=t||"Cannot make set from type other than Array of string elements",!Array.isArray(e))throw Error(t);return e.reduce((e,r)=>{if("string"!=typeof r)throw Error(t);return e[r]=!0,e},{})}}},2089:(e,t,r)=>{"use strict";let n=r(9021),i=r(3873),s=r(3258),o=r(4075),{MESSAGE:a}=r(2239),{Stream:l,PassThrough:u}=r(2826),h=r(9747),c=r(1298)("winston:file"),f=r(1820),d=r(7539);e.exports=class extends h{constructor(e={}){function t(r,...n){n.slice(1).forEach(t=>{if(e[t])throw Error(`Cannot set ${t} and ${r} together`)})}if(super(e),this.name=e.name||"file",this._stream=new u,this._stream.setMaxListeners(30),this._onError=this._onError.bind(this),e.filename||e.dirname)t("filename or dirname","stream"),this._basename=this.filename=e.filename?i.basename(e.filename):"winston.log",this.dirname=e.dirname||i.dirname(e.filename),this.options=e.options||{flags:"a"};else if(e.stream)console.warn("options.stream will be removed in winston@4. Use winston.transports.Stream"),t("stream","filename","maxsize"),this._dest=this._stream.pipe(this._setupStream(e.stream)),this.dirname=i.dirname(this._dest.path);else throw Error("Cannot log to file without filename or stream.");this.maxsize=e.maxsize||null,this.rotationFormat=e.rotationFormat||!1,this.zippedArchive=e.zippedArchive||!1,this.maxFiles=e.maxFiles||null,this.eol="string"==typeof e.eol?e.eol:f.EOL,this.tailable=e.tailable||!1,this.lazy=e.lazy||!1,this._size=0,this._pendingSize=0,this._created=0,this._drain=!1,this._opening=!1,this._ending=!1,this._fileExist=!1,this.dirname&&this._createLogDirIfNotExist(this.dirname),this.lazy||this.open()}finishIfEnding(){this._ending&&(this._opening?this.once("open",()=>{this._stream.once("finish",()=>this.emit("finish")),setImmediate(()=>this._stream.end())}):(this._stream.once("finish",()=>this.emit("finish")),setImmediate(()=>this._stream.end())))}log(e,t=()=>{}){if(this.silent)return t(),!0;if(this._drain){this._stream.once("drain",()=>{this._drain=!1,this.log(e,t)});return}if(this._rotate){this._stream.once("rotate",()=>{this._rotate=!1,this.log(e,t)});return}if(this.lazy){if(!this._fileExist){this._opening||this.open(),this.once("open",()=>{this._fileExist=!0,this.log(e,t)});return}if(this._needsNewFile(this._pendingSize)){this._dest.once("close",()=>{this._opening||this.open(),this.once("open",()=>{this.log(e,t)})});return}}let r=`${e[a]}${this.eol}`,n=Buffer.byteLength(r);function i(){if(this._size+=n,this._pendingSize-=n,c("logged %s %s",this._size,r),this.emit("logged",e),!this._rotate&&!this._opening&&this._needsNewFile()){if(this.lazy){this._endStream(()=>{this.emit("fileclosed")});return}this._rotate=!0,this._endStream(()=>this._rotateFile())}}this._pendingSize+=n,this._opening&&!this.rotatedWhileOpening&&this._needsNewFile(this._size+this._pendingSize)&&(this.rotatedWhileOpening=!0);let s=this._stream.write(r,i.bind(this));return s?t():(this._drain=!0,this._stream.once("drain",()=>{this._drain=!1,t()})),c("written",s,this._drain),this.finishIfEnding(),s}query(e,t){"function"==typeof e&&(t=e,e={}),e=f(e);let r=i.join(this.dirname,this.filename),s="",o=[],a=0,l=n.createReadStream(r,{encoding:"utf8"});function u(e,t){try{let t=JSON.parse(e);c(t)&&h(t)}catch(e){t||l.emit("error",e)}}function h(t){if(e.rows&&o.length>=e.rows&&"desc"!==e.order){l.readable&&l.destroy();return}e.fields&&(t=e.fields.reduce((e,r)=>(e[r]=t[r],e),{})),"desc"===e.order&&o.length>=e.rows&&o.shift(),o.push(t)}function c(t){if(!t||"object"!=typeof t)return;let r=new Date(t.timestamp);if((!e.from||!(r<e.from))&&(!e.until||!(r>e.until))&&(!e.level||e.level===t.level))return!0}function f(e){return(e=e||{}).rows=e.rows||e.limit||10,e.start=e.start||0,e.until=e.until||new Date,"object"!=typeof e.until&&(e.until=new Date(e.until)),e.from=e.from||e.until-864e5,"object"!=typeof e.from&&(e.from=new Date(e.from)),e.order=e.order||"desc",e}l.on("error",e=>{if(l.readable&&l.destroy(),t)return"ENOENT"!==e.code?t(e):t(null,o)}),l.on("data",t=>{let r=(t=(s+t).split(/\n+/)).length-1,n=0;for(;n<r;n++)(!e.start||a>=e.start)&&u(t[n]),a++;s=t[r]}),l.on("close",()=>{s&&u(s,!0),"desc"===e.order&&(o=o.reverse()),t&&t(null,o)})}stream(e={}){let t=i.join(this.dirname,this.filename),r=new l,n={file:t,start:e.start};return r.destroy=d(n,(e,t)=>{if(e)return r.emit("error",e);try{r.emit("data",t),t=JSON.parse(t),r.emit("log",t)}catch(e){r.emit("error",e)}}),r}open(){this.filename&&(this._opening||(this._opening=!0,this.stat((e,t)=>{if(e)return this.emit("error",e);c("stat done: %s { size: %s }",this.filename,t),this._size=t,this._dest=this._createStream(this._stream),this._opening=!1,this.once("open",()=>{this._stream.emit("rotate")||(this._rotate=!1)})})))}stat(e){let t=this._getFile(),r=i.join(this.dirname,t);n.stat(r,(n,i)=>n&&"ENOENT"===n.code?(c("ENOENT\xa0ok",r),this.filename=t,e(null,0)):n?(c(`err ${n.code} ${r}`),e(n)):!i||this._needsNewFile(i.size)?this._incFile(()=>this.stat(e)):void(this.filename=t,e(null,i.size)))}close(e){this._stream&&this._stream.end(()=>{e&&e(),this.emit("flush"),this.emit("closed")})}_needsNewFile(e){return e=e||this._size,this.maxsize&&e>=this.maxsize}_onError(e){this.emit("error",e)}_setupStream(e){return e.on("error",this._onError),e}_cleanupStream(e){return e.removeListener("error",this._onError),e.destroy(),e}_rotateFile(){this._incFile(()=>this.open())}_endStream(e=()=>{}){this._dest?(this._stream.unpipe(this._dest),this._dest.end(()=>{this._cleanupStream(this._dest),e()})):e()}_createStream(e){let t=i.join(this.dirname,this.filename);c("create stream start",t,this.options);let r=n.createWriteStream(t,this.options).on("error",e=>c(e)).on("close",()=>c("close",r.path,r.bytesWritten)).on("open",()=>{c("file open ok",t),this.emit("open",t),e.pipe(r),this.rotatedWhileOpening&&(this._stream=new u,this._stream.setMaxListeners(30),this._rotateFile(),this.rotatedWhileOpening=!1,this._cleanupStream(r),e.end())});return c("create stream ok",t),r}_incFile(e){c("_incFile",this.filename);let t=i.extname(this._basename),r=i.basename(this._basename,t),n=[];this.zippedArchive&&n.push((function(e){let n=this._created>0&&!this.tailable?this._created:"";this._compressFile(i.join(this.dirname,`${r}${n}${t}`),i.join(this.dirname,`${r}${n}${t}.gz`),e)}).bind(this)),n.push((function(e){this.tailable?this._checkMaxFilesTailable(t,r,e):(this._created+=1,this._checkMaxFilesIncrementing(t,r,e))}).bind(this)),s(n,e)}_getFile(){let e=i.extname(this._basename),t=i.basename(this._basename,e),r=this.rotationFormat?this.rotationFormat():this._created;return!this.tailable&&this._created?`${t}${r}${e}`:`${t}${e}`}_checkMaxFilesIncrementing(e,t,r){if(!this.maxFiles||this._created<this.maxFiles)return setImmediate(r);let s=this._created-this.maxFiles,o=0!==s?s:"",a=this.zippedArchive?".gz":"",l=`${t}${o}${e}${a}`,u=i.join(this.dirname,l);n.unlink(u,r)}_checkMaxFilesTailable(e,t,r){let o=[];if(!this.maxFiles)return;let a=this.zippedArchive?".gz":"";for(let r=this.maxFiles-1;r>1;r--)o.push((function(r,s){let o=`${t}${r-1}${e}${a}`,l=i.join(this.dirname,o);n.exists(l,u=>{if(!u)return s(null);o=`${t}${r}${e}${a}`,n.rename(l,i.join(this.dirname,o),s)})}).bind(this,r));s(o,()=>{n.rename(i.join(this.dirname,`${t}${e}${a}`),i.join(this.dirname,`${t}1${e}${a}`),r)})}_compressFile(e,t,r){n.access(e,n.F_OK,i=>{if(i)return r();var s=o.createGzip(),a=n.createReadStream(e),l=n.createWriteStream(t);l.on("finish",()=>{n.unlink(e,r)}),a.pipe(s).pipe(l)})}_createLogDirIfNotExist(e){n.existsSync(e)||n.mkdirSync(e,{recursive:!0})}}},5307:(e,t,r)=>{"use strict";let n=r(1630),i=r(5591),{Stream:s}=r(2826),o=r(9747),{configure:a}=r(900);e.exports=class extends o{constructor(e={}){super(e),this.options=e,this.name=e.name||"http",this.ssl=!!e.ssl,this.host=e.host||"localhost",this.port=e.port,this.auth=e.auth,this.path=e.path||"",this.maximumDepth=e.maximumDepth,this.agent=e.agent,this.headers=e.headers||{},this.headers["content-type"]="application/json",this.batch=e.batch||!1,this.batchInterval=e.batchInterval||5e3,this.batchCount=e.batchCount||10,this.batchOptions=[],this.batchTimeoutID=-1,this.batchCallback={},this.port||(this.port=this.ssl?443:80)}log(e,t){this._request(e,null,null,(t,r)=>{r&&200!==r.statusCode&&(t=Error(`Invalid HTTP Status Code: ${r.statusCode}`)),t?this.emit("warn",t):this.emit("logged",e)}),t&&setImmediate(t)}query(e,t){"function"==typeof e&&(t=e,e={});let r=(e={method:"query",params:this.normalizeQuery(e)}).params.auth||null;delete e.params.auth;let n=e.params.path||null;delete e.params.path,this._request(e,r,n,(e,r,n)=>{if(r&&200!==r.statusCode&&(e=Error(`Invalid HTTP Status Code: ${r.statusCode}`)),e)return t(e);if("string"==typeof n)try{n=JSON.parse(n)}catch(e){return t(e)}t(null,n)})}stream(e={}){let t=new s,r=(e={method:"stream",params:e}).params.path||null;delete e.params.path;let n=e.params.auth||null;delete e.params.auth;let i="",o=this._request(e,n,r);return t.destroy=()=>o.destroy(),o.on("data",e=>{let r=(e=(i+e).split(/\n+/)).length-1,n=0;for(;n<r;n++)try{t.emit("log",JSON.parse(e[n]))}catch(e){t.emit("error",e)}i=e[r]}),o.on("error",e=>t.emit("error",e)),t}_request(e,t,r,n){e=e||{},t=t||this.auth,r=r||this.path||"",this.batch?this._doBatch(e,n,t,r):this._doRequest(e,n,t,r)}_doBatch(e,t,r,n){if(this.batchOptions.push(e),1===this.batchOptions.length){let e=this;this.batchCallback=t,this.batchTimeoutID=setTimeout(function(){e.batchTimeoutID=-1,e._doBatchRequest(e.batchCallback,r,n)},this.batchInterval)}this.batchOptions.length===this.batchCount&&this._doBatchRequest(this.batchCallback,r,n)}_doBatchRequest(e,t,r){this.batchTimeoutID>0&&(clearTimeout(this.batchTimeoutID),this.batchTimeoutID=-1);let n=this.batchOptions.slice();this.batchOptions=[],this._doRequest(n,e,t,r)}_doRequest(e,t,r,s){let o=Object.assign({},this.headers);r&&r.bearer&&(o.Authorization=`Bearer ${r.bearer}`);let l=(this.ssl?i:n).request({...this.options,method:"POST",host:this.host,port:this.port,path:`/${s.replace(/^\//,"")}`,headers:o,auth:r&&r.username&&r.password?`${r.username}:${r.password}`:"",agent:this.agent});l.on("error",t),l.on("response",e=>e.on("end",()=>t(null,e)).resume());let u=a({...this.maximumDepth&&{maximumDepth:this.maximumDepth}});l.end(Buffer.from(u(e,this.options.replacer),"utf8"))}}},4279:(e,t,r)=>{"use strict";Object.defineProperty(t,"Console",{configurable:!0,enumerable:!0,get:()=>r(6718)}),Object.defineProperty(t,"File",{configurable:!0,enumerable:!0,get:()=>r(2089)}),Object.defineProperty(t,"Http",{configurable:!0,enumerable:!0,get:()=>r(5307)}),Object.defineProperty(t,"Stream",{configurable:!0,enumerable:!0,get:()=>r(1171)})},1171:(e,t,r)=>{"use strict";let n=r(6696),{MESSAGE:i}=r(2239),s=r(1820),o=r(9747);e.exports=class extends o{constructor(e={}){if(super(e),!e.stream||!n(e.stream))throw Error("options.stream is required.");this._stream=e.stream,this._stream.setMaxListeners(1/0),this.isObjectMode=e.stream._writableState.objectMode,this.eol="string"==typeof e.eol?e.eol:s.EOL}log(e,t){if(setImmediate(()=>this.emit("logged",e)),this.isObjectMode){this._stream.write(e),t&&t();return}this._stream.write(`${e[i]}${this.eol}`),t&&t()}}},3149:(e,t,r)=>{"use strict";r.d(t,{dJ:()=>x});var n=r(4379),i=r(1708),s=r(643),o=r(3136);class a{value;next;constructor(e){this.value=e}}class l{#e;#t;#r;constructor(){this.clear()}enqueue(e){let t=new a(e);this.#e?this.#t.next=t:this.#e=t,this.#t=t,this.#r++}dequeue(){let e=this.#e;if(e)return this.#e=this.#e.next,this.#r--,e.value}peek(){if(this.#e)return this.#e.value}clear(){this.#e=void 0,this.#t=void 0,this.#r=0}get size(){return this.#r}*[Symbol.iterator](){let e=this.#e;for(;e;)yield e.value,e=e.next}}function u(e){if(!((Number.isInteger(e)||e===Number.POSITIVE_INFINITY)&&e>0))throw TypeError("Expected `concurrency` to be a number from 1 and up");let t=new l,r=0,n=()=>{r--,t.size>0&&t.dequeue()()},i=async(e,t,i)=>{r++;let s=(async()=>e(...i))();t(s);try{await s}catch{}n()},s=(n,s,o)=>{t.enqueue(i.bind(void 0,n,s,o)),(async()=>{await Promise.resolve(),r<e&&t.size>0&&t.dequeue()()})()},o=(e,...t)=>new Promise(r=>{s(e,r,t)});return Object.defineProperties(o,{activeCount:{get:()=>r},pendingCount:{get:()=>t.size},clearQueue:{value:()=>{t.clear()}}}),o}class h extends Error{constructor(e){super(),this.value=e}}let c=async(e,t)=>t(await e),f=async e=>{let t=await Promise.all(e);if(!0===t[1])throw new h(t[0]);return!1};async function d(e,t,{concurrency:r=Number.POSITIVE_INFINITY,preserveOrder:n=!0}={}){let i=u(r),s=[...e].map(e=>[e,i(c,e,t)]),o=u(n?1:Number.POSITIVE_INFINITY);try{await Promise.all(s.map(e=>o(f,e)))}catch(e){if(e instanceof h)return e.value;throw e}}let p={directory:"isDirectory",file:"isFile"};function g(e){if(!Object.hasOwnProperty.call(p,e))throw Error(`Invalid type specified: ${e}`)}let m=(e,t)=>t[p[e]](),b=e=>e instanceof URL?(0,o.fileURLToPath)(e):e;async function y(e,{cwd:t=i.cwd(),type:r="file",allowSymlinks:o=!0,concurrency:a,preserveOrder:l}={}){g(r),t=b(t);let u=o?s.promises.stat:s.promises.lstat;return d(e,async e=>{try{let i=await u(n.resolve(t,e));return m(r,i)}catch{return!1}},{concurrency:a,preserveOrder:l})}function w(e){return e instanceof URL?(0,o.fileURLToPath)(e):e}let v=Symbol("findUpStop");async function _(e,t={}){let r=n.resolve(w(t.cwd)??""),{root:i}=n.parse(r),s=n.resolve(r,w(t.stopAt??i)),o=t.limit??Number.POSITIVE_INFINITY,a=[e].flat(),l=async t=>{if("function"!=typeof e)return y(a,t);let r=await e(t.cwd);return"string"==typeof r?y([r],t):r},u=[];for(;;){let e=await l({...t,cwd:r});if(e===v||(e&&u.push(n.resolve(r,e)),r===s||u.length>=o))break;r=n.dirname(r)}return u}async function x(e,t={}){return(await _(e,{...t,limit:1}))[0]}},6789:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});let n=Symbol("singleComment"),i=Symbol("multiComment"),s=()=>"",o=(e,t,r)=>e.slice(t,r).replace(/\S/g," "),a=(e,t)=>{let r=t-1,n=0;for(;"\\"===e[r];)r-=1,n+=1;return!!(n%2)};function l(e,{whitespace:t=!0,trailingCommas:r=!1}={}){if("string"!=typeof e)throw TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof e}\``);let u=t?o:s,h=!1,c=!1,f=0,d="",p="",g=-1;for(let t=0;t<e.length;t++){let s=e[t],o=e[t+1];if(c||'"'!==s||a(e,t)||(h=!h),!h){if(c||s+o!=="//"){if(c===n&&s+o==="\r\n"){c=!1,d+=u(e,f,++t),f=t;continue}if(c===n&&"\n"===s)c=!1,d+=u(e,f,t),f=t;else if(c||s+o!=="/*"){if(c===i&&s+o==="*/"){c=!1,d+=u(e,f,++t+1),f=t+1;continue}r&&!c&&(-1!==g?"}"===s||"]"===s?(d+=e.slice(f,t),p+=u(d,0,1)+d.slice(1),d="",f=t,g=-1):" "!==s&&" "!==s&&"\r"!==s&&"\n"!==s&&(d+=e.slice(f,t),f=t,g=-1):","===s&&(p+=d+e.slice(f,t),d="",f=t,g=t))}else{d+=e.slice(f,t),f=t,c=i,t++;continue}}else d+=e.slice(f,t),f=t,c=n,t++}}return p+d+(c?u(e.slice(f)):e.slice(f))}},5040:e=>{"use strict";e.exports={version:"3.17.0"}}};
@@ -0,0 +1 @@
1
+ exports.id=572,exports.ids=[572],exports.modules={4807:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,3219,23)),Promise.resolve().then(r.t.bind(r,4863,23)),Promise.resolve().then(r.t.bind(r,5155,23)),Promise.resolve().then(r.t.bind(r,802,23)),Promise.resolve().then(r.t.bind(r,9350,23)),Promise.resolve().then(r.t.bind(r,8530,23)),Promise.resolve().then(r.t.bind(r,8921,23))},6655:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,6959,23)),Promise.resolve().then(r.t.bind(r,3875,23)),Promise.resolve().then(r.t.bind(r,8903,23)),Promise.resolve().then(r.t.bind(r,7174,23)),Promise.resolve().then(r.t.bind(r,4178,23)),Promise.resolve().then(r.t.bind(r,7190,23)),Promise.resolve().then(r.t.bind(r,1365,23))},5988:(e,t,r)=>{Promise.resolve().then(r.bind(r,3164)),Promise.resolve().then(r.bind(r,1831))},2020:(e,t,r)=>{Promise.resolve().then(r.bind(r,2652)),Promise.resolve().then(r.bind(r,2899))},2652:(e,t,r)=>{"use strict";r.d(t,{Toaster:()=>v});var a=r(5512),s=r(6888),o=r(8009),i=r(8952),n=r(1643),c=r(1255),l=r(3603);let d=i.Kq,u=o.forwardRef(({className:e,...t},r)=>(0,a.jsx)(i.LM,{ref:r,className:(0,l.cn)("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));u.displayName=i.LM.displayName;let h=(0,n.F)("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),p=o.forwardRef(({className:e,variant:t,...r},s)=>(0,a.jsx)(i.bL,{ref:s,className:(0,l.cn)(h({variant:t}),e),...r}));p.displayName=i.bL.displayName,o.forwardRef(({className:e,...t},r)=>(0,a.jsx)(i.rc,{ref:r,className:(0,l.cn)("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t})).displayName=i.rc.displayName;let m=o.forwardRef(({className:e,...t},r)=>(0,a.jsx)(i.bm,{ref:r,className:(0,l.cn)("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:(0,a.jsx)(c.A,{className:"h-4 w-4"})}));m.displayName=i.bm.displayName;let f=o.forwardRef(({className:e,...t},r)=>(0,a.jsx)(i.hE,{ref:r,className:(0,l.cn)("text-sm font-semibold [&+div]:text-xs",e),...t}));f.displayName=i.hE.displayName;let b=o.forwardRef(({className:e,...t},r)=>(0,a.jsx)(i.VY,{ref:r,className:(0,l.cn)("text-sm opacity-90",e),...t}));function v(){let{toasts:e}=(0,s.dj)();return(0,a.jsxs)(d,{children:[e.map(function({id:e,title:t,description:r,action:s,...o}){return(0,a.jsxs)(p,{...o,children:[(0,a.jsxs)("div",{className:"grid gap-1",children:[t&&(0,a.jsx)(f,{children:t}),r&&(0,a.jsx)(b,{children:r})]}),s,(0,a.jsx)(m,{})]},e)}),(0,a.jsx)(u,{})]})}b.displayName=i.VY.displayName},8180:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>u,metadata:()=>d});var a=r(2740),s=r(7944),o=r.n(s),i=r(5510),n=r.n(i);r(1135);var c=r(1831),l=r(3164);let d={title:"d1-studio",description:"Native D1 database studio."};function u({children:e}){return(0,a.jsx)("html",{lang:"en",children:(0,a.jsx)("body",{className:`${o().variable} ${n().variable} antialiased`,children:(0,a.jsxs)(c.DatabaseProvider,{children:[e,(0,a.jsx)(l.Toaster,{})," "]})})})}},3164:(e,t,r)=>{"use strict";r.d(t,{Toaster:()=>a});let a=(0,r(6760).registerClientReference)(function(){throw Error("Attempted to call Toaster() from the server but Toaster is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Volumes/ProjectSpace/_wip/d1studio/src/components/ui/toaster.jsx","Toaster")},1135:()=>{},2899:(e,t,r)=>{"use strict";r.d(t,{DatabaseProvider:()=>u,t:()=>h});var a=r(5512),s=r(8009),o=r(6888);let i=new Map;function n(e,t,r=2e3){let a=i.get(e);if(a&&Date.now()-a.timestamp<r)return a.promise;let s=t();return i.set(e,{promise:s,timestamp:Date.now()}),s.finally(()=>{setTimeout(()=>{i.delete(e)},r)}),s}let c=(0,s.createContext)(void 0);class l{constructor(){this.cache=new Map}get(e){return this.cache.get(e)||null}set(e,t,r,a){this.cache.set(e,{data:t,schema:r,meta:a,timestamp:Date.now()})}update(e,t,r,a){let s=this.cache.get(e);s&&this.cache.set(e,{data:t||s.data,schema:r||s.schema,meta:a||s.meta,timestamp:Date.now()})}invalidate(e){this.cache.delete(e)}clear(){this.cache.clear()}}class d{constructor(){this.queue=[],this.processing=!1}async add(e){return new Promise((t,r)=>{this.queue.push({operation:e,resolve:t,reject:r}),this.process()})}async process(){if(this.processing||0===this.queue.length)return;this.processing=!0;let{operation:e,resolve:t,reject:r}=this.queue.shift();try{let r=await e();t(r)}catch(e){r(e)}finally{this.processing=!1,this.process()}}}function u({children:e}){let{toast:t}=(0,o.dj)(),[r,i]=(0,s.useState)([]),[u,h]=(0,s.useState)(!0),[p,m]=(0,s.useState)(null),[f,b]=(0,s.useState)(null);(0,s.useRef)(new d);let[v,w]=(0,s.useState)(null),y=(0,s.useRef)(new l).current,g=(0,s.useCallback)((e,t=1,r=50)=>{let a=`table-${e}-${t}-${r}`;return y.get(a)},[]),x=(0,s.useCallback)(e=>{y.cache.forEach((t,r)=>{r.startsWith(`table-${e}-`)&&y.invalidate(r)})},[]),S=(0,s.useCallback)((e,t,r,a,s=1,o=50)=>{let i=`table-${e}-${s}-${o}`;y.update(i,t,r,a)},[]),T=(0,s.useCallback)(async e=>n(`query-${e}`,async()=>{try{let t=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e})});if(!t.ok){let e="Failed to execute query";try{let r=await t.json();e=r?.error?.message||e}catch(e){}throw Error(e)}let r=await t.json();if(!r.success)throw Error(r.error||"Query execution failed");return r}catch(e){throw e||Error("An unknown error occurred")}},1e3),[]),j=(0,s.useCallback)(async e=>{try{let t=await fetch(`/api/tables/${e}`),r=await t.json();if(!t.ok||!r.success)throw Error(r.error||"Failed to fetch table schema");return r.schema||[]}catch(e){throw console.error("Schema fetch error:",e),t({variant:"destructive",title:"Schema Fetch Failed",description:e.message}),e}},[t]),P=(0,s.useCallback)(async(e,r={})=>{let{forceFetch:a=!1,page:s=1,limit:o=50}=r,i=`table-${e}-${s}-${o}`;if(!a){let e=y.get(i);if(e)return e}return n(`table-${e}-${s}-${o}`,async()=>{try{let t=await fetch(`/api/tables/${e}?page=${s}&limit=${o}`,{headers:{"Cache-Control":"no-cache",Pragma:"no-cache"}});if(!t.ok)throw Error("Failed to fetch table data");let r=await t.json();if(!r.success)throw Error(r.error||"Failed to fetch table data");return y.set(i,r.data,r.schema,r.meta),r}catch(e){throw console.error("Error fetching table data:",e),t({variant:"destructive",title:"Data Fetch Failed",description:e.message}),e}},1e3)},[t]),E=(0,s.useCallback)(async e=>{try{return y.invalidate(e),await P(e,{forceFetch:!0})}catch(e){throw console.error("Error updating table data:",e),t({variant:"destructive",title:"Update Failed",description:e.message}),e}},[P,t]),C=(0,s.useCallback)(async(e,t={})=>(w(e),await P(e,t)),[P]),k=(0,s.useCallback)(async()=>n("refresh-tables",async()=>{h(!0),m(null);try{let e=await fetch("/api/tables");if(!e.ok)throw Error("Failed to fetch tables");let t=await e.json();if(t.error)throw Error(t.error);return i(t.tables||[]),t.tables||[]}catch(e){throw m(e.message),t({variant:"destructive",title:"Refresh Failed",description:e.message}),e}finally{h(!1)}},2e3),[t]),N=(0,s.useCallback)(async e=>{try{await T(e),y.clear(),await k(),t({title:"Success",description:"Table created successfully"})}catch(e){throw t({variant:"destructive",title:"Create Table Failed",description:e.message}),Error(`Failed to create table: ${e.message}`)}},[T,k,t]),D=(0,s.useCallback)(async e=>{try{await T(`DROP TABLE ${e};`),y.invalidate(e),await k(),t({title:"Success",description:"Table dropped successfully"})}catch(e){throw t({variant:"destructive",title:"Drop Table Failed",description:e.message}),Error(`Failed to drop table: ${e.message}`)}},[T,k,t]),$=(0,s.useCallback)(async e=>{try{let r=await fetch("/api/migrations/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok){let e=await r.json();throw Error(e.error?.message||"Failed to sync migrations")}let a=await r.json();return t({title:"Success",description:"Migrations synced successfully"}),a}catch(e){throw console.error("Error syncing migrations:",e),t({variant:"destructive",title:"Sync Failed",description:e.message}),e}},[t]),F=(0,s.useCallback)(async()=>{try{let e=localStorage.getItem("cf_credentials");if(!e)throw Error("No Cloudflare credentials found. Please connect to Cloudflare first.");let t=JSON.parse(e);if(!t.accountId||!t.apiToken)throw Error("Invalid credentials stored. Please reconnect to Cloudflare.");let r=await fetch("/api/pull-remote/confirm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accountId:t.accountId,apiToken:t.apiToken})}),a=await r.json();if(!r.ok||!a.success)throw Error(a.error?.message||"Failed to pull from remote");return y.clear(),await k(),a}catch(e){throw console.error("Error pulling from remote:",e),t({variant:"destructive",title:"Pull Failed",description:e.message}),e}},[k,t]),O=(0,s.useCallback)(async e=>{try{let t=await fetch("/api/push-remote",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),r=await t.json();if(!t.ok)throw Error(r.error?.message||"Failed to push to remote");return r}catch(e){throw console.error("Error pushing to remote:",e),e}},[t]),A=(0,s.useMemo)(()=>({tables:r,currentDatabase:f,isLoading:u,error:p,activeTable:v,refreshTables:k,executeQuery:T,fetchTableSchema:j,fetchTableData:P,updateTableData:E,createTable:N,dropTable:D,syncMigrations:$,pullFromRemote:F,pushToRemote:O,getCachedTable:g,updateTableCache:S,invalidateTable:x,switchTable:C}),[r,f,u,p,v,k,T,j,P,E,N,D,$,F,O,g,S,x,C]);return(0,a.jsx)(c.Provider,{value:A,children:e})}function h(){let e=(0,s.useContext)(c);if(!e)throw Error("useDatabase must be used within a DatabaseProvider");return e}},6888:(e,t,r)=>{"use strict";r.d(t,{dj:()=>h});var a=r(8009);let s=0,o=new Map,i=e=>{if(o.has(e))return;let t=setTimeout(()=>{o.delete(e),d({type:"REMOVE_TOAST",toastId:e})},1e6);o.set(e,t)},n=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:r}=t;return r?i(r):e.toasts.forEach(e=>{i(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===r||void 0===r?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},c=[],l={toasts:[]};function d(e){l=n(l,e),c.forEach(e=>{e(l)})}function u({...e}){let t=(s=(s+1)%Number.MAX_SAFE_INTEGER).toString(),r=()=>d({type:"DISMISS_TOAST",toastId:t});return d({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:t}})}}function h(){let[e,t]=a.useState(l);return a.useEffect(()=>(c.push(t),()=>{let e=c.indexOf(t);e>-1&&c.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>d({type:"DISMISS_TOAST",toastId:e})}}},3603:(e,t,r)=>{"use strict";r.d(t,{cn:()=>o});var a=r(2281),s=r(4805);function o(...e){return(0,s.QP)((0,a.$)(e))}},1831:(e,t,r)=>{"use strict";r.d(t,{DatabaseProvider:()=>s});var a=r(6760);let s=(0,a.registerClientReference)(function(){throw Error("Attempted to call DatabaseProvider() from the server but DatabaseProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Volumes/ProjectSpace/_wip/d1studio/src/context/database-context.js","DatabaseProvider");(0,a.registerClientReference)(function(){throw Error("Attempted to call useDatabase() from the server but useDatabase is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Volumes/ProjectSpace/_wip/d1studio/src/context/database-context.js","useDatabase")}};