@madarco/agentbox 0.26.1 → 0.27.1

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 (263) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +1 -1
  3. package/dist/{_cloud-attach-7WRQH6XZ.js → _cloud-attach-WDGM6FL5.js} +4 -4
  4. package/dist/{chunk-UIFL7F2G.js → chunk-26IKZRTT.js} +2 -2
  5. package/dist/chunk-G3H2L3O2.js +0 -0
  6. package/dist/{chunk-DJQMK4RN.js → chunk-HR7NHH5J.js} +14 -9
  7. package/dist/chunk-HR7NHH5J.js.map +1 -0
  8. package/dist/{chunk-K5KOLYIL.js → chunk-IDH5A4RR.js} +2 -2
  9. package/dist/{chunk-ZY7M7MXH.js → chunk-JE6UI5YR.js} +10 -10
  10. package/dist/chunk-JGZSA5ZI.js +0 -0
  11. package/dist/{chunk-7ZZAZPYX.js → chunk-KWOEUFVA.js} +2 -2
  12. package/dist/{chunk-BA2VLJVU.js → chunk-LL7NCMUU.js} +3 -3
  13. package/dist/{chunk-I2OAJS3L.js → chunk-NEF6MDJO.js} +4 -4
  14. package/dist/{chunk-I2OAJS3L.js.map → chunk-NEF6MDJO.js.map} +1 -1
  15. package/dist/{dist-YA7EXBGG.js → chunk-SJ75AIA2.js} +486 -92
  16. package/dist/chunk-SJ75AIA2.js.map +1 -0
  17. package/dist/{chunk-PK2QF4IR.js → chunk-UJEH2NJT.js} +27 -14
  18. package/dist/chunk-UJEH2NJT.js.map +1 -0
  19. package/dist/{chunk-DQHMDDAT.js → chunk-V5XXJH63.js} +2 -2
  20. package/dist/chunk-WJFZJZIM.js +0 -0
  21. package/dist/cloud-poller-SUNA6ZQC-7M5LJHHE.js +0 -0
  22. package/dist/{dist-DTNYMBQ5.js → dist-FTKS2GI4.js} +5 -5
  23. package/dist/{dist-5IICYSR6.js → dist-KQTMCVME.js} +5 -5
  24. package/dist/{dist-5IICYSR6.js.map → dist-KQTMCVME.js.map} +1 -1
  25. package/dist/{dist-AR5CHRSV.js → dist-O3LKOIE7.js} +5 -5
  26. package/dist/{dist-POVRY7HO.js → dist-OO52HARR.js} +3 -3
  27. package/dist/{dist-K4LNH3EC.js → dist-TSFVB7AI.js} +5 -5
  28. package/dist/dist-U2SVLJUQ.js +0 -0
  29. package/dist/{dist-XYY6SIKG.js → dist-WVYAURMF.js} +5 -5
  30. package/dist/dist-Z6L5MM5D.js +46 -0
  31. package/dist/index.js +392 -211
  32. package/dist/index.js.map +1 -1
  33. package/dist/{prepared-state-75DIZ55S-W6NU3S3B.js → prepared-state-75DIZ55S-TNJXWMXV.js} +2 -2
  34. package/dist/prepared-state-75DIZ55S-TNJXWMXV.js.map +1 -0
  35. package/package.json +31 -29
  36. package/runtime/_shared/agentbox-checkpoint-cleanup +0 -0
  37. package/runtime/_shared/agentbox-dockerd-start +0 -0
  38. package/runtime/_shared/agentbox-open +0 -0
  39. package/runtime/_shared/agentbox-portless-trust +0 -0
  40. package/runtime/_shared/agentbox-vnc-start +0 -0
  41. package/runtime/_shared/ctl.cjs +0 -0
  42. package/runtime/_shared/gh-shim +0 -0
  43. package/runtime/_shared/git-shim +0 -0
  44. package/runtime/_shared/linear-shim +0 -0
  45. package/runtime/_shared/ntn-shim +0 -0
  46. package/runtime/digitalocean/agentbox-checkpoint-cleanup +0 -0
  47. package/runtime/digitalocean/agentbox-dockerd-start +0 -0
  48. package/runtime/digitalocean/agentbox-open +0 -0
  49. package/runtime/digitalocean/agentbox-portless-trust +0 -0
  50. package/runtime/digitalocean/agentbox-vnc-start +0 -0
  51. package/runtime/digitalocean/ctl.cjs +0 -0
  52. package/runtime/digitalocean/gh-shim +0 -0
  53. package/runtime/digitalocean/git-shim +0 -0
  54. package/runtime/digitalocean/linear-shim +0 -0
  55. package/runtime/digitalocean/ntn-shim +0 -0
  56. package/runtime/digitalocean/scripts/install-box.sh +0 -0
  57. package/runtime/docker/packages/ctl/dist/bin.cjs +0 -0
  58. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-checkpoint-cleanup +0 -0
  59. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-dockerd-start +0 -0
  60. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-open +0 -0
  61. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-portless-trust +0 -0
  62. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-sshd-start +0 -0
  63. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-vnc-start +0 -0
  64. package/runtime/docker/packages/sandbox-docker/scripts/chromium-resolver +0 -0
  65. package/runtime/docker/packages/sandbox-docker/scripts/gh-shim +0 -0
  66. package/runtime/docker/packages/sandbox-docker/scripts/git-shim +0 -0
  67. package/runtime/docker/packages/sandbox-docker/scripts/linear-shim +0 -0
  68. package/runtime/docker/packages/sandbox-docker/scripts/ntn-shim +0 -0
  69. package/runtime/e2b/agentbox-checkpoint-cleanup +0 -0
  70. package/runtime/e2b/agentbox-dockerd-start +0 -0
  71. package/runtime/e2b/agentbox-open +0 -0
  72. package/runtime/e2b/agentbox-vnc-start +0 -0
  73. package/runtime/e2b/ctl.cjs +0 -0
  74. package/runtime/e2b/gh-shim +0 -0
  75. package/runtime/e2b/git-shim +0 -0
  76. package/runtime/e2b/linear-shim +0 -0
  77. package/runtime/e2b/ntn-shim +0 -0
  78. package/runtime/e2b/scripts/build-template.sh +0 -0
  79. package/runtime/hetzner/agentbox-checkpoint-cleanup +0 -0
  80. package/runtime/hetzner/agentbox-dockerd-start +0 -0
  81. package/runtime/hetzner/agentbox-open +0 -0
  82. package/runtime/hetzner/agentbox-portless-trust +0 -0
  83. package/runtime/hetzner/agentbox-vnc-start +0 -0
  84. package/runtime/hetzner/ctl.cjs +0 -0
  85. package/runtime/hetzner/gh-shim +0 -0
  86. package/runtime/hetzner/git-shim +0 -0
  87. package/runtime/hetzner/linear-shim +0 -0
  88. package/runtime/hetzner/ntn-shim +0 -0
  89. package/runtime/hetzner/scripts/install-box.sh +0 -0
  90. package/runtime/hub/apps/hub/.next/BUILD_ID +1 -1
  91. package/runtime/hub/apps/hub/.next/app-path-routes-manifest.json +3 -0
  92. package/runtime/hub/apps/hub/.next/build-manifest.json +3 -3
  93. package/runtime/hub/apps/hub/.next/prerender-manifest.json +3 -3
  94. package/runtime/hub/apps/hub/.next/routes-manifest.json +22 -0
  95. package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route.js +1 -1
  96. package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route.js.nft.json +1 -1
  97. package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page_client-reference-manifest.js +1 -1
  98. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/docs/route.js +2 -1
  99. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/docs/route.js.nft.json +1 -1
  100. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route/app-paths-manifest.json +3 -0
  101. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route/build-manifest.json +9 -0
  102. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route/server-reference-manifest.json +4 -0
  103. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route.js +8 -0
  104. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route.js.map +5 -0
  105. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route.js.nft.json +1 -0
  106. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route_client-reference-manifest.js +3 -0
  107. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route/app-paths-manifest.json +3 -0
  108. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route/build-manifest.json +9 -0
  109. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route/server-reference-manifest.json +4 -0
  110. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route.js +8 -0
  111. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route.js.map +5 -0
  112. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route.js.nft.json +1 -0
  113. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route_client-reference-manifest.js +3 -0
  114. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route/app-paths-manifest.json +3 -0
  115. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route/build-manifest.json +9 -0
  116. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route/server-reference-manifest.json +4 -0
  117. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route.js +9 -0
  118. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route.js.map +5 -0
  119. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route.js.nft.json +1 -0
  120. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route_client-reference-manifest.js +3 -0
  121. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/openapi.json/route.js +2 -1
  122. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/openapi.json/route.js.nft.json +1 -1
  123. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page/server-reference-manifest.json +1 -1
  124. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page_client-reference-manifest.js +1 -1
  125. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page/server-reference-manifest.json +12 -12
  126. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page.js.nft.json +1 -1
  127. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page_client-reference-manifest.js +1 -1
  128. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page/server-reference-manifest.json +11 -11
  129. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  130. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  131. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page/server-reference-manifest.json +8 -8
  132. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page.js.nft.json +1 -1
  133. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page_client-reference-manifest.js +1 -1
  134. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page.js.nft.json +1 -1
  135. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
  136. package/runtime/hub/apps/hub/.next/server/app/_global-error.html +1 -1
  137. package/runtime/hub/apps/hub/.next/server/app/_global-error.rsc +1 -1
  138. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  139. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  140. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  141. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  142. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  143. package/runtime/hub/apps/hub/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  144. package/runtime/hub/apps/hub/.next/server/app-paths-manifest.json +3 -0
  145. package/runtime/hub/apps/hub/.next/server/chunks/044u_hub__next-internal_server_app_(dashboard)_api_v1_hosts_route_actions_0b_404_.js +3 -0
  146. package/runtime/hub/apps/hub/.next/server/chunks/0web_next-internal_server_app_(dashboard)_api_v1_hosts_[alias]_route_actions_0swypy5.js +3 -0
  147. package/runtime/hub/apps/hub/.next/server/chunks/0zhp_better-auth_dist_adapters_kysely-adapter_index_mjs_1rl4qnh._.js +3 -0
  148. package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_hosts_[alias]_bake_route_actions_1-_pu3n.js +3 -0
  149. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0a7djvw._.js +3 -0
  150. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0bmro0b._.js +3 -0
  151. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0d1lmiq._.js +5 -5
  152. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0keu6we._.js +1 -1
  153. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0t4qmv-._.js +3 -0
  154. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0xh14bo._.js +3 -0
  155. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1-9g0ae._.js +1 -1
  156. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__13ioh5z._.js +3 -0
  157. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1k8g143._.js → [root-of-the-server]__19pc87s._.js} +2 -2
  158. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1h4xycg._.js +3 -0
  159. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1hqla7-._.js +1 -1
  160. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1md9kdw._.js +3 -0
  161. package/runtime/hub/apps/hub/.next/server/chunks/_0760z6y._.js +4 -4
  162. package/runtime/hub/apps/hub/.next/server/chunks/_1bng7w9._.js +3 -0
  163. package/runtime/hub/apps/hub/.next/server/chunks/apps_hub_app_(dashboard)_api_v1_lib_openapi_ts_1yokmzt._.js +14 -0
  164. package/runtime/hub/apps/hub/.next/server/chunks/ssr/044u_hub__next-internal_server_app_(dashboard)_projects_[id]_page_actions_15f56np.js +1 -1
  165. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_0xy-j7z._.js +1 -1
  166. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_1uccfbf._.js +1 -1
  167. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_010858m.js +1 -1
  168. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_04zwxnx.js +1 -1
  169. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_06exuc7.js +1 -1
  170. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_0f2ldrt.js +1 -1
  171. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_0f2tzep.js +1 -1
  172. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_116nh32.js +1 -1
  173. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_11dyjcb.js +1 -1
  174. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_1_4knli.js +1 -1
  175. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__08-1wwu._.js +1 -1
  176. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0c9mbcn._.js +1 -1
  177. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0gdfxj4._.js +1 -1
  178. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0kc-hwp._.js +1 -1
  179. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0lu73p6._.js +1 -1
  180. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__10bfmwi._.js +1 -1
  181. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__18qvdzb._.js +1 -1
  182. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__1l2urlw._.js +1 -1
  183. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_03s-ah2._.js +3 -0
  184. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0kpdmm-._.js +1 -1
  185. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0ozyjt1._.js +1 -1
  186. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0r4px38._.js +3 -0
  187. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_18w2zeh._.js +3 -0
  188. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_0od97-d._.js +3 -0
  189. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(dashboard)_approvals_page_actions_1mi0bpn.js +1 -1
  190. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(dashboard)_boxes_[id]_page_actions_0k7kgn2.js +1 -1
  191. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(dashboard)_page_actions_1t3u0xy.js +1 -1
  192. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_boxes_[id]_page_tsx_1-j_972._.js +1 -1
  193. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_boxes_components_box-table_tsx_0a9pyn_._.js +1 -1
  194. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_settings_page_tsx_0hv6n82._.js +3 -0
  195. package/runtime/hub/apps/hub/.next/server/functions-config-manifest.json +3 -0
  196. package/runtime/hub/apps/hub/.next/server/middleware-build-manifest.js +3 -3
  197. package/runtime/hub/apps/hub/.next/server/pages/500.html +1 -1
  198. package/runtime/hub/apps/hub/.next/server/server-reference-manifest.js +1 -1
  199. package/runtime/hub/apps/hub/.next/server/server-reference-manifest.json +18 -18
  200. package/runtime/hub/apps/hub/.next/static/chunks/070w7h5rh5ja6.js +1 -0
  201. package/runtime/hub/apps/hub/.next/static/chunks/1_ur0im1g7_s9.js +1 -0
  202. package/runtime/hub/apps/hub/.next/static/chunks/{000a1sa7te1h8.js → 2awpm9w8crker.js} +1 -1
  203. package/runtime/hub/apps/hub/.next/static/chunks/{3-zanu4ioia5i.js → 2gfw8-qyx5xi_.js} +1 -1
  204. package/runtime/hub/apps/hub/.next/static/chunks/30de2x24ntwkg.js +1 -0
  205. package/runtime/hub/apps/hub/.next/static/chunks/3e5n630psqst8.js +1 -0
  206. package/runtime/hub/apps/hub/.next/static/chunks/3tqnniym2yvpb.js +1 -0
  207. package/runtime/hub/apps/hub/.next/static/chunks/{3dfjrxx-dy644.css → 42uysd_max-yq.css} +1 -1
  208. package/runtime/hub/apps/hub/{chunk-BARD2DI6.js → chunk-EHBJKZCL.js} +13 -8
  209. package/runtime/hub/apps/hub/{chunk-4QY2VZCF.js → chunk-RXYOWSSN.js} +19 -13
  210. package/runtime/hub/apps/hub/{chunk-XZZXPEVV.js → chunk-YJ5MJOXK.js} +1 -1
  211. package/runtime/hub/apps/hub/{dist-3ENKQN5G.js → dist-3I7KUI6W.js} +3 -3
  212. package/runtime/hub/apps/hub/{dist-WAZKGVYL.js → dist-6FPPUSWZ.js} +2 -2
  213. package/runtime/hub/apps/hub/{dist-NNBELNA7.js → dist-DX6IYMAH.js} +300 -109
  214. package/runtime/hub/apps/hub/{dist-RJJ2SDYO.js → dist-G6TXUSPZ.js} +3 -3
  215. package/runtime/hub/apps/hub/{dist-AE6IV4FV.js → dist-GTVVXCBP.js} +3 -3
  216. package/runtime/hub/apps/hub/{dist-6VGJOQYK.js → dist-JG45OFT2.js} +3 -3
  217. package/runtime/hub/apps/hub/{dist-TU7D6UTB.js → dist-LYDHYTP2.js} +3 -3
  218. package/runtime/hub/apps/hub/{prepared-state-75DIZ55S-NYEDSU2U.js → prepared-state-75DIZ55S-2IFNUHHM.js} +1 -1
  219. package/runtime/hub/apps/hub/server.js +136 -19
  220. package/runtime/relay/bin.cjs +0 -0
  221. package/runtime/vercel/agentbox-checkpoint-cleanup +0 -0
  222. package/runtime/vercel/agentbox-dockerd-start +0 -0
  223. package/runtime/vercel/agentbox-open +0 -0
  224. package/runtime/vercel/agentbox-vnc-start +0 -0
  225. package/runtime/vercel/ctl.cjs +0 -0
  226. package/runtime/vercel/gh-shim +0 -0
  227. package/runtime/vercel/git-shim +0 -0
  228. package/runtime/vercel/linear-shim +0 -0
  229. package/runtime/vercel/ntn-shim +0 -0
  230. package/runtime/vercel/scripts/provision.sh +0 -0
  231. package/LICENSE +0 -21
  232. package/dist/chunk-DJQMK4RN.js.map +0 -1
  233. package/dist/chunk-PK2QF4IR.js.map +0 -1
  234. package/dist/chunk-ZYKNSHOH.js +0 -259
  235. package/dist/chunk-ZYKNSHOH.js.map +0 -1
  236. package/dist/dist-YA7EXBGG.js.map +0 -1
  237. package/runtime/hub/apps/hub/.next/server/chunks/0-fj_better-auth_dist_adapters_kysely-adapter_index_mjs_0btft52._.js +0 -3
  238. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1bqbkd5._.js +0 -14
  239. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1qa4a0v._.js +0 -14
  240. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_09gdzmo._.js +0 -3
  241. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0tgpglr._.js +0 -3
  242. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_1laion6._.js +0 -3
  243. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_0b_hsjl._.js +0 -3
  244. package/runtime/hub/apps/hub/.next/static/chunks/1c5w3kqosumog.js +0 -1
  245. package/runtime/hub/apps/hub/.next/static/chunks/1o3ot_9-8jgzc.js +0 -1
  246. package/runtime/hub/apps/hub/.next/static/chunks/1z4elhg8gyq98.js +0 -1
  247. package/runtime/hub/apps/hub/.next/static/chunks/3uq9hf-roasav.js +0 -1
  248. /package/dist/{_cloud-attach-7WRQH6XZ.js.map → _cloud-attach-WDGM6FL5.js.map} +0 -0
  249. /package/dist/{chunk-UIFL7F2G.js.map → chunk-26IKZRTT.js.map} +0 -0
  250. /package/dist/{chunk-K5KOLYIL.js.map → chunk-IDH5A4RR.js.map} +0 -0
  251. /package/dist/{chunk-ZY7M7MXH.js.map → chunk-JE6UI5YR.js.map} +0 -0
  252. /package/dist/{chunk-7ZZAZPYX.js.map → chunk-KWOEUFVA.js.map} +0 -0
  253. /package/dist/{chunk-BA2VLJVU.js.map → chunk-LL7NCMUU.js.map} +0 -0
  254. /package/dist/{chunk-DQHMDDAT.js.map → chunk-V5XXJH63.js.map} +0 -0
  255. /package/dist/{dist-DTNYMBQ5.js.map → dist-FTKS2GI4.js.map} +0 -0
  256. /package/dist/{dist-AR5CHRSV.js.map → dist-O3LKOIE7.js.map} +0 -0
  257. /package/dist/{dist-POVRY7HO.js.map → dist-OO52HARR.js.map} +0 -0
  258. /package/dist/{dist-K4LNH3EC.js.map → dist-TSFVB7AI.js.map} +0 -0
  259. /package/dist/{dist-XYY6SIKG.js.map → dist-WVYAURMF.js.map} +0 -0
  260. /package/dist/{prepared-state-75DIZ55S-W6NU3S3B.js.map → dist-Z6L5MM5D.js.map} +0 -0
  261. /package/runtime/hub/apps/hub/.next/static/{mJYh9UHTsLaGGyRjBSvme → PWF2iHQOg9-rRyfqVDLrh}/_buildManifest.js +0 -0
  262. /package/runtime/hub/apps/hub/.next/static/{mJYh9UHTsLaGGyRjBSvme → PWF2iHQOg9-rRyfqVDLrh}/_clientMiddlewareManifest.js +0 -0
  263. /package/runtime/hub/apps/hub/.next/static/{mJYh9UHTsLaGGyRjBSvme → PWF2iHQOg9-rRyfqVDLrh}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},96253,(e,t,r)=>{"use strict";t.exports=e.r(18622)},85132,(e,t,r)=>{"use strict";t.exports=e.r(96253).vendored["react-rsc"].React},86109,(e,t,r)=>{"use strict";var n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i={},u={RequestCookies:()=>g,ResponseCookies:()=>h,parseCookie:()=>p,parseSetCookie:()=>d,stringifyCookie:()=>c};for(var l in u)n(i,l,{get:u[l],enumerable:!0});function c(e){var t;let r=["path"in e&&e.path&&`Path=${e.path}`,"expires"in e&&(e.expires||0===e.expires)&&`Expires=${("number"==typeof e.expires?new Date(e.expires):e.expires).toUTCString()}`,"maxAge"in e&&"number"==typeof e.maxAge&&`Max-Age=${e.maxAge}`,"domain"in e&&e.domain&&`Domain=${e.domain}`,"secure"in e&&e.secure&&"Secure","httpOnly"in e&&e.httpOnly&&"HttpOnly","sameSite"in e&&e.sameSite&&`SameSite=${e.sameSite}`,"partitioned"in e&&e.partitioned&&"Partitioned","priority"in e&&e.priority&&`Priority=${e.priority}`].filter(Boolean),n=`${e.name}=${encodeURIComponent(null!=(t=e.value)?t:"")}`;return 0===r.length?n:`${n}; ${r.join("; ")}`}function p(e){let t=new Map;for(let r of e.split(/; */)){if(!r)continue;let e=r.indexOf("=");if(-1===e){t.set(r,"true");continue}let[n,o]=[r.slice(0,e),r.slice(e+1)];try{t.set(n,decodeURIComponent(null!=o?o:"true"))}catch{}}return t}function d(e){if(!e)return;let[[t,r],...n]=p(e),{domain:o,expires:s,httponly:a,maxage:i,path:u,samesite:l,secure:c,partitioned:d,priority:g}=Object.fromEntries(n.map(([e,t])=>[e.toLowerCase().replace(/-/g,""),t]));{var h,b,v={name:t,value:decodeURIComponent(r),domain:o,...s&&{expires:new Date(s)},...a&&{httpOnly:!0},..."string"==typeof i&&{maxAge:Number(i)},path:u,...l&&{sameSite:f.includes(h=(h=l).toLowerCase())?h:void 0},...c&&{secure:!0},...g&&{priority:m.includes(b=(b=g).toLowerCase())?b:void 0},...d&&{partitioned:!0}};let e={};for(let t in v)v[t]&&(e[t]=v[t]);return e}}t.exports=((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of s(t))a.call(e,i)||void 0===i||n(e,i,{get:()=>t[i],enumerable:!(r=o(t,i))||r.enumerable});return e})(n({},"__esModule",{value:!0}),i);var f=["strict","lax","none"],m=["low","medium","high"],g=class{constructor(e){this._parsed=new Map,this._headers=e;const t=e.get("cookie");if(t)for(const[e,r]of p(t))this._parsed.set(e,{name:e,value:r})}[Symbol.iterator](){return this._parsed[Symbol.iterator]()}get size(){return this._parsed.size}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed);if(!e.length)return r.map(([e,t])=>t);let n="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(([e])=>e===n).map(([e,t])=>t)}has(e){return this._parsed.has(e)}set(...e){let[t,r]=1===e.length?[e[0].name,e[0].value]:e,n=this._parsed;return n.set(t,{name:t,value:r}),this._headers.set("cookie",Array.from(n).map(([e,t])=>c(t)).join("; ")),this}delete(e){let t=this._parsed,r=Array.isArray(e)?e.map(e=>t.delete(e)):t.delete(e);return this._headers.set("cookie",Array.from(t).map(([e,t])=>c(t)).join("; ")),r}clear(){return this.delete(Array.from(this._parsed.keys())),this}[Symbol.for("edge-runtime.inspect.custom")](){return`RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(e=>`${e.name}=${encodeURIComponent(e.value)}`).join("; ")}},h=class{constructor(e){var t,r,n;this._parsed=new Map,this._headers=e;const o=null!=(n=null!=(r=null==(t=e.getSetCookie)?void 0:t.call(e))?r:e.get("set-cookie"))?n:[];for(const e of Array.isArray(o)?o:function(e){if(!e)return[];var t,r,n,o,s,a=[],i=0;function u(){for(;i<e.length&&/\s/.test(e.charAt(i));)i+=1;return i<e.length}for(;i<e.length;){for(t=i,s=!1;u();)if(","===(r=e.charAt(i))){for(n=i,i+=1,u(),o=i;i<e.length&&"="!==(r=e.charAt(i))&&";"!==r&&","!==r;)i+=1;i<e.length&&"="===e.charAt(i)?(s=!0,i=o,a.push(e.substring(t,n)),t=i):i=n+1}else i+=1;(!s||i>=e.length)&&a.push(e.substring(t,e.length))}return a}(o)){const t=d(e);t&&this._parsed.set(t.name,t)}}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed.values());if(!e.length)return r;let n="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(e=>e.name===n)}has(e){return this._parsed.has(e)}set(...e){let[t,r,n]=1===e.length?[e[0].name,e[0].value,e[0]]:e,o=this._parsed;return o.set(t,function(e={name:"",value:""}){return"number"==typeof e.expires&&(e.expires=new Date(e.expires)),e.maxAge&&(e.expires=new Date(Date.now()+1e3*e.maxAge)),(null===e.path||void 0===e.path)&&(e.path="/"),e}({name:t,value:r,...n})),function(e,t){for(let[,r]of(t.delete("set-cookie"),e)){let e=c(r);t.append("set-cookie",e)}}(o,this._headers),this}delete(...e){let[t,r]="string"==typeof e[0]?[e[0]]:[e[0].name,e[0]];return this.set({...r,name:t,value:"",expires:new Date(0)})}[Symbol.for("edge-runtime.inspect.custom")](){return`ResponseCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(c).join("; ")}}},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},54799,(e,t,r)=>{t.exports=e.x("crypto",()=>require("crypto"))},24868,(e,t,r)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},5365,(e,t,r)=>{t.exports=e.x("process",()=>require("process"))},874,(e,t,r)=>{t.exports=e.x("buffer",()=>require("buffer"))},53733,e=>{"use strict";let t={invalid_request:400,unauthorized:401,not_found:404,conflict:409,backend_unavailable:503,internal:500};function r(e,r,n){let o=t[e];return Response.json({error:{code:e,message:r,...void 0===n?{}:{details:n}}},{status:o})}e.s(["fail",0,r,"failFromAction",0,function(e){return r(/\b(not found|no such|does not exist)\b/i.test(e)||/\bunknown (project|box)\b/i.test(e)||/no pending approval/i.test(e)?"not_found":"conflict",e)},"ok",0,function(e,t=200){return Response.json(e,{status:t})}])},82477,e=>{"use strict";var t=e.i(89551);function r(e){if(e.originUrl){let t=e.originUrl.replace(/\.git$/,"").split(/[/:]/).pop();if(t)return t}return e.name}function n(e){var t;return t=e.originUrl??e.name,Buffer.from(t).toString("base64url")}function o(e){return{claude:e?.claude,codex:e?.codex,opencode:e?.opencode}}function s(e){if(!e)return"stopped";let{claude:t,codex:r,opencode:n}=o(e);return[t?.state,r?.state,n?.state].includes("error")?"error":t?.sessionRunning||r?.sessionRunning||n?.sessionRunning?"running":"stopped"}let a=null;async function i(){var t;let i=process.env.POSTGRES_URL??process.env.RELAY_STORE_URL;if(!i)throw Error("hub: POSTGRES_URL required for the hosted source");let u=await (!a&&(a=(async()=>{let{PostgresStore:t}=await e.A(59249),r=new t({connectionString:i});return await r.migrate(),r})().catch(e=>{throw a=null,e})),a),l=await u.listBoxes(),c=new Map((await u.listStatuses()).map(e=>[e.boxId,e.status])),p=[];for(let e of l)for(let r of(await u.listPendingPrompts(e.boxId)))p.push((t=e.boxId,{id:r.ev.id,boxId:t,message:r.ev.message,detail:r.ev.detail,command:r.ev.context?.command,cwd:r.ev.context?.cwd,argv:r.ev.context?.argv,defaultAnswer:r.ev.defaultAnswer??"n",createdAt:Date.parse(r.createdAt)||Date.now()}));return{user:{login:"hub",name:"hub"},github:{available:!1,installed:!1,appName:"GitHub App",account:"",installedAt:0,repos:[]},projects:function(e){let t=new Map;for(let o of e){let e=n(o),s=Date.parse(o.createdAt??o.registeredAt)||Date.now(),a=t.get(e);a?s<a.createdAt&&(a.createdAt=s):t.set(e,{key:e,name:r(o),createdAt:s})}return[...t.values()].map(e=>({id:e.key,name:e.name,repo:e.name,defaultBranch:"main",provider:"cloud",createdAt:e.createdAt})).sort((e,t)=>t.createdAt-e.createdAt)}(l),boxes:l.map(e=>(function(e,t){let{claude:a,codex:i,opencode:u}=o(t),l=Date.parse(e.createdAt??e.registeredAt)||Date.now();return{id:e.boxId,projectId:n(e),repo:r(e),branch:e.worktrees?.[0]?.branch??"",task:a?.sessionTitle??i?.sessionTitle??u?.sessionTitle??e.name,agent:i?.sessionRunning?"codex":u?.sessionRunning?"opencode":"claude",status:s(t),createdAt:l,lastActivity:l,host:e.backend?`${e.kind??"cloud"} \xb7 ${e.backend}`:e.kind??"cloud",provider:e.kind??"docker",commits:null,filesTouched:null,error:"error"===s(t)?a?.sessionTitle??"Agent reported an error":null,webUrl:null,vncUrl:null}})(e,c.get(e.boxId))),approvals:p,providers:[]}}async function u(){let e=globalThis.__AGENTBOX_HUB_BACKEND;return e?{...await e.getData(),authMode:(0,t.authMode)()}:process.env.POSTGRES_URL??process.env.RELAY_STORE_URL?{...await i(),authMode:(0,t.authMode)()}:{user:{login:"user",name:"user"},github:{available:!1,installed:!1,appName:"GitHub App",account:"",installedAt:0,repos:[]},projects:[],boxes:[],approvals:[],providers:[],authMode:(0,t.authMode)()}}async function l(){return u()}e.s(["backendOrNull",0,function(){return globalThis.__AGENTBOX_HUB_BACKEND??null},"readState",0,l],82477)},49714,e=>{"use strict";let t=["claude","codex","opencode","none"],r=["docker","daytona","hetzner","vercel","e2b","digitalocean","remote-docker"],n=["start","pause","resume","stop","destroy","screen"];function o(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let s=["checkout","branch","pull","push","push-host"],a=["claude","codex","herdr","cmux","vscode","iterm2","finder"];function i(e,t){return void 0===e?{ok:!0,value:void 0}:"string"!=typeof e?{ok:!1,message:`${t} must be a string`}:{ok:!0,value:e}}function u(e,t){return void 0===e?{ok:!0,value:void 0}:"boolean"!=typeof e?{ok:!1,message:`${t} must be a boolean`}:{ok:!0,value:e}}async function l(e){let t=await e.text();if(0===t.trim().length)return{ok:!0,value:{}};try{return{ok:!0,value:JSON.parse(t)}}catch{return{ok:!1,message:"body is not valid JSON"}}}e.s(["GIT_OPS",0,s,"LIFECYCLE_ACTIONS",0,n,"isGitOp",0,function(e){return s.includes(e)},"isLifecycleAction",0,function(e){return n.includes(e)},"isProviderId",0,function(e){return r.includes(e)},"parseAnswer",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{answer:t}=e;return"y"!==t&&"n"!==t?{ok:!1,message:"answer must be 'y' or 'n'"}:{ok:!0,value:t}},"parseCreateBox",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{projectId:n,agent:s,provider:a,name:l,prompt:c,fromBranch:p,setupWizard:d}=e;if("string"!=typeof n||0===n.length)return{ok:!1,message:"projectId is required (string)"};if("string"!=typeof s||!t.includes(s))return{ok:!1,message:`agent must be one of ${t.join(", ")}`,details:{got:s}};if(void 0!==a&&("string"!=typeof a||!r.includes(a)))return{ok:!1,message:`provider must be one of ${r.join(", ")}`,details:{got:a}};if(void 0!==l&&"string"!=typeof l)return{ok:!1,message:"name must be a string"};if(void 0!==c&&"string"!=typeof c)return{ok:!1,message:"prompt must be a string"};let f=i(p,"fromBranch");if(!f.ok)return f;let m=u(d,"setupWizard");return m.ok?{ok:!0,value:{projectId:n,agent:s,provider:a,name:l,prompt:c,fromBranch:f.value,setupWizard:m.value}}:m},"parseGitBranch",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{name:t,from:r}=e;if("string"!=typeof t||0===t.trim().length)return{ok:!1,message:"name is required (non-empty string)"};let n=i(r,"from");return n.ok?{ok:!0,value:{name:t,from:n.value}}:n},"parseGitCheckout",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{branch:t}=e;return"string"!=typeof t||0===t.trim().length?{ok:!1,message:"branch is required (non-empty string)"}:{ok:!0,value:{branch:t}}},"parseGitPull",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let t=i(e.remote,"remote");if(!t.ok)return t;let r=u(e.ffOnly,"ffOnly");return r.ok?{ok:!0,value:{remote:t.value,ffOnly:r.value}}:r},"parseGitPush",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let t=i(e.remote,"remote");if(!t.ok)return t;let r=u(e.force,"force");return r.ok?{ok:!0,value:{remote:t.value,force:r.value}}:r},"parseGitPushHost",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let t=i(e.as,"as");if(!t.ok)return t;let r=u(e.force,"force");return r.ok?{ok:!0,value:{as:t.value,force:r.value}}:r},"parseLoginCode",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{code:t}=e;return"string"!=typeof t||0===t.trim().length?{ok:!1,message:"code is required (non-empty string)"}:{ok:!0,value:{code:t.trim()}}},"parseOpenIn",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{app:t}=e;return"string"==typeof t&&a.includes(t)?{ok:!0,value:{app:t}}:{ok:!1,message:`app must be one of ${a.join(", ")}`,details:{got:t}}},"parseProject",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{path:t}=e;return"string"!=typeof t||0===t.length?{ok:!1,message:"path is required (absolute directory path)"}:{ok:!0,value:{path:t}}},"parseProviderCredentials",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let t={};for(let[r,n]of Object.entries(e)){if("string"!=typeof n)return{ok:!1,message:`field ${r} must be a string`};t[r]=n}return 0===Object.keys(t).length?{ok:!1,message:"at least one credential field is required"}:{ok:!0,value:t}},"parseProviderPrepare",0,function(e){if(null==e)return{ok:!0,value:{}};if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{force:t,claudeInstall:r}=e,n=u(t,"force");return n.ok?void 0!==r&&"native"!==r&&"npm"!==r?{ok:!1,message:"claudeInstall must be 'native' or 'npm'"}:{ok:!0,value:{force:n.value,claudeInstall:r}}:n},"parseRenameBox",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{displayName:t}=e;return"string"!=typeof t?{ok:!1,message:"displayName is required (string; empty string clears the label)"}:t.trim().length>60?{ok:!1,message:"displayName too long (max 60 chars)"}:{ok:!0,value:{displayName:t}}},"parseServiceRestart",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let t=i(e.name,"name");return t.ok?{ok:!0,value:{name:t.value}}:t},"readJson",0,l])}];
1
+ module.exports=[93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},96253,(e,t,r)=>{"use strict";t.exports=e.r(18622)},85132,(e,t,r)=>{"use strict";t.exports=e.r(96253).vendored["react-rsc"].React},86109,(e,t,r)=>{"use strict";var n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i={},u={RequestCookies:()=>g,ResponseCookies:()=>h,parseCookie:()=>p,parseSetCookie:()=>d,stringifyCookie:()=>c};for(var l in u)n(i,l,{get:u[l],enumerable:!0});function c(e){var t;let r=["path"in e&&e.path&&`Path=${e.path}`,"expires"in e&&(e.expires||0===e.expires)&&`Expires=${("number"==typeof e.expires?new Date(e.expires):e.expires).toUTCString()}`,"maxAge"in e&&"number"==typeof e.maxAge&&`Max-Age=${e.maxAge}`,"domain"in e&&e.domain&&`Domain=${e.domain}`,"secure"in e&&e.secure&&"Secure","httpOnly"in e&&e.httpOnly&&"HttpOnly","sameSite"in e&&e.sameSite&&`SameSite=${e.sameSite}`,"partitioned"in e&&e.partitioned&&"Partitioned","priority"in e&&e.priority&&`Priority=${e.priority}`].filter(Boolean),n=`${e.name}=${encodeURIComponent(null!=(t=e.value)?t:"")}`;return 0===r.length?n:`${n}; ${r.join("; ")}`}function p(e){let t=new Map;for(let r of e.split(/; */)){if(!r)continue;let e=r.indexOf("=");if(-1===e){t.set(r,"true");continue}let[n,o]=[r.slice(0,e),r.slice(e+1)];try{t.set(n,decodeURIComponent(null!=o?o:"true"))}catch{}}return t}function d(e){if(!e)return;let[[t,r],...n]=p(e),{domain:o,expires:s,httponly:a,maxage:i,path:u,samesite:l,secure:c,partitioned:d,priority:g}=Object.fromEntries(n.map(([e,t])=>[e.toLowerCase().replace(/-/g,""),t]));{var h,b,v={name:t,value:decodeURIComponent(r),domain:o,...s&&{expires:new Date(s)},...a&&{httpOnly:!0},..."string"==typeof i&&{maxAge:Number(i)},path:u,...l&&{sameSite:f.includes(h=(h=l).toLowerCase())?h:void 0},...c&&{secure:!0},...g&&{priority:m.includes(b=(b=g).toLowerCase())?b:void 0},...d&&{partitioned:!0}};let e={};for(let t in v)v[t]&&(e[t]=v[t]);return e}}t.exports=((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of s(t))a.call(e,i)||void 0===i||n(e,i,{get:()=>t[i],enumerable:!(r=o(t,i))||r.enumerable});return e})(n({},"__esModule",{value:!0}),i);var f=["strict","lax","none"],m=["low","medium","high"],g=class{constructor(e){this._parsed=new Map,this._headers=e;const t=e.get("cookie");if(t)for(const[e,r]of p(t))this._parsed.set(e,{name:e,value:r})}[Symbol.iterator](){return this._parsed[Symbol.iterator]()}get size(){return this._parsed.size}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed);if(!e.length)return r.map(([e,t])=>t);let n="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(([e])=>e===n).map(([e,t])=>t)}has(e){return this._parsed.has(e)}set(...e){let[t,r]=1===e.length?[e[0].name,e[0].value]:e,n=this._parsed;return n.set(t,{name:t,value:r}),this._headers.set("cookie",Array.from(n).map(([e,t])=>c(t)).join("; ")),this}delete(e){let t=this._parsed,r=Array.isArray(e)?e.map(e=>t.delete(e)):t.delete(e);return this._headers.set("cookie",Array.from(t).map(([e,t])=>c(t)).join("; ")),r}clear(){return this.delete(Array.from(this._parsed.keys())),this}[Symbol.for("edge-runtime.inspect.custom")](){return`RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(e=>`${e.name}=${encodeURIComponent(e.value)}`).join("; ")}},h=class{constructor(e){var t,r,n;this._parsed=new Map,this._headers=e;const o=null!=(n=null!=(r=null==(t=e.getSetCookie)?void 0:t.call(e))?r:e.get("set-cookie"))?n:[];for(const e of Array.isArray(o)?o:function(e){if(!e)return[];var t,r,n,o,s,a=[],i=0;function u(){for(;i<e.length&&/\s/.test(e.charAt(i));)i+=1;return i<e.length}for(;i<e.length;){for(t=i,s=!1;u();)if(","===(r=e.charAt(i))){for(n=i,i+=1,u(),o=i;i<e.length&&"="!==(r=e.charAt(i))&&";"!==r&&","!==r;)i+=1;i<e.length&&"="===e.charAt(i)?(s=!0,i=o,a.push(e.substring(t,n)),t=i):i=n+1}else i+=1;(!s||i>=e.length)&&a.push(e.substring(t,e.length))}return a}(o)){const t=d(e);t&&this._parsed.set(t.name,t)}}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed.values());if(!e.length)return r;let n="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(e=>e.name===n)}has(e){return this._parsed.has(e)}set(...e){let[t,r,n]=1===e.length?[e[0].name,e[0].value,e[0]]:e,o=this._parsed;return o.set(t,function(e={name:"",value:""}){return"number"==typeof e.expires&&(e.expires=new Date(e.expires)),e.maxAge&&(e.expires=new Date(Date.now()+1e3*e.maxAge)),(null===e.path||void 0===e.path)&&(e.path="/"),e}({name:t,value:r,...n})),function(e,t){for(let[,r]of(t.delete("set-cookie"),e)){let e=c(r);t.append("set-cookie",e)}}(o,this._headers),this}delete(...e){let[t,r]="string"==typeof e[0]?[e[0]]:[e[0].name,e[0]];return this.set({...r,name:t,value:"",expires:new Date(0)})}[Symbol.for("edge-runtime.inspect.custom")](){return`ResponseCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(c).join("; ")}}},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},54799,(e,t,r)=>{t.exports=e.x("crypto",()=>require("crypto"))},24868,(e,t,r)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},5365,(e,t,r)=>{t.exports=e.x("process",()=>require("process"))},874,(e,t,r)=>{t.exports=e.x("buffer",()=>require("buffer"))},53733,e=>{"use strict";let t={invalid_request:400,unauthorized:401,not_found:404,conflict:409,backend_unavailable:503,internal:500};function r(e,r,n){let o=t[e];return Response.json({error:{code:e,message:r,...void 0===n?{}:{details:n}}},{status:o})}e.s(["fail",0,r,"failFromAction",0,function(e){return r(/\b(not found|no such|does not exist)\b/i.test(e)||/\bunknown (project|box)\b/i.test(e)||/no pending approval/i.test(e)?"not_found":"conflict",e)},"ok",0,function(e,t=200){return Response.json(e,{status:t})}])},82477,e=>{"use strict";var t=e.i(89551);function r(e){if(e.originUrl){let t=e.originUrl.replace(/\.git$/,"").split(/[/:]/).pop();if(t)return t}return e.name}function n(e){var t;return t=e.originUrl??e.name,Buffer.from(t).toString("base64url")}function o(e){return{claude:e?.claude,codex:e?.codex,opencode:e?.opencode}}function s(e){if(!e)return"stopped";let{claude:t,codex:r,opencode:n}=o(e);return[t?.state,r?.state,n?.state].includes("error")?"error":t?.sessionRunning||r?.sessionRunning||n?.sessionRunning?"running":"stopped"}let a=null;async function i(){var t;let i=process.env.POSTGRES_URL??process.env.RELAY_STORE_URL;if(!i)throw Error("hub: POSTGRES_URL required for the hosted source");let u=await (!a&&(a=(async()=>{let{PostgresStore:t}=await e.A(59249),r=new t({connectionString:i});return await r.migrate(),r})().catch(e=>{throw a=null,e})),a),l=await u.listBoxes(),c=new Map((await u.listStatuses()).map(e=>[e.boxId,e.status])),p=[];for(let e of l)for(let r of(await u.listPendingPrompts(e.boxId)))p.push((t=e.boxId,{id:r.ev.id,boxId:t,message:r.ev.message,detail:r.ev.detail,command:r.ev.context?.command,cwd:r.ev.context?.cwd,argv:r.ev.context?.argv,defaultAnswer:r.ev.defaultAnswer??"n",createdAt:Date.parse(r.createdAt)||Date.now()}));return{user:{login:"hub",name:"hub"},github:{available:!1,installed:!1,appName:"GitHub App",account:"",installedAt:0,repos:[]},projects:function(e){let t=new Map;for(let o of e){let e=n(o),s=Date.parse(o.createdAt??o.registeredAt)||Date.now(),a=t.get(e);a?s<a.createdAt&&(a.createdAt=s):t.set(e,{key:e,name:r(o),createdAt:s})}return[...t.values()].map(e=>({id:e.key,name:e.name,repo:e.name,defaultBranch:"main",provider:"cloud",createdAt:e.createdAt})).sort((e,t)=>t.createdAt-e.createdAt)}(l),boxes:l.map(e=>(function(e,t){let{claude:a,codex:i,opencode:u}=o(t),l=Date.parse(e.createdAt??e.registeredAt)||Date.now();return{id:e.boxId,projectId:n(e),repo:r(e),branch:e.worktrees?.[0]?.branch??"",task:a?.sessionTitle??i?.sessionTitle??u?.sessionTitle??e.name,agent:i?.sessionRunning?"codex":u?.sessionRunning?"opencode":"claude",status:s(t),createdAt:l,lastActivity:l,host:e.backend?`${e.kind??"cloud"} \xb7 ${e.backend}`:e.kind??"cloud",provider:e.kind??"docker",commits:null,filesTouched:null,error:"error"===s(t)?a?.sessionTitle??"Agent reported an error":null,webUrl:null,vncUrl:null}})(e,c.get(e.boxId))),approvals:p,providers:[]}}async function u(){let e=globalThis.__AGENTBOX_HUB_BACKEND;return e?{...await e.getData(),authMode:(0,t.authMode)()}:process.env.POSTGRES_URL??process.env.RELAY_STORE_URL?{...await i(),authMode:(0,t.authMode)()}:{user:{login:"user",name:"user"},github:{available:!1,installed:!1,appName:"GitHub App",account:"",installedAt:0,repos:[]},projects:[],boxes:[],approvals:[],providers:[],authMode:(0,t.authMode)()}}async function l(){return u()}e.s(["backendOrNull",0,function(){return globalThis.__AGENTBOX_HUB_BACKEND??null},"readState",0,l],82477)},49714,e=>{"use strict";let t=["claude","codex","opencode","none"],r=["docker","daytona","hetzner","vercel","e2b","digitalocean","remote-docker"],n=["start","pause","resume","stop","destroy","screen"];function o(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let s=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,a=["checkout","branch","pull","push","push-host"],i=["claude","codex","herdr","cmux","vscode","iterm2","finder"];function u(e,t){return void 0===e?{ok:!0,value:void 0}:"string"!=typeof e?{ok:!1,message:`${t} must be a string`}:{ok:!0,value:e}}function l(e,t){return void 0===e?{ok:!0,value:void 0}:"boolean"!=typeof e?{ok:!1,message:`${t} must be a boolean`}:{ok:!0,value:e}}async function c(e){let t=await e.text();if(0===t.trim().length)return{ok:!0,value:{}};try{return{ok:!0,value:JSON.parse(t)}}catch{return{ok:!1,message:"body is not valid JSON"}}}e.s(["GIT_OPS",0,a,"LIFECYCLE_ACTIONS",0,n,"isGitOp",0,function(e){return a.includes(e)},"isLifecycleAction",0,function(e){return n.includes(e)},"isProviderId",0,function(e){return r.includes(e)},"parseAnswer",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{answer:t}=e;return"y"!==t&&"n"!==t?{ok:!1,message:"answer must be 'y' or 'n'"}:{ok:!0,value:t}},"parseCreateBox",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{projectId:n,agent:s,provider:a,name:i,prompt:c,fromBranch:p,setupWizard:d}=e;if("string"!=typeof n||0===n.length)return{ok:!1,message:"projectId is required (string)"};if("string"!=typeof s||!t.includes(s))return{ok:!1,message:`agent must be one of ${t.join(", ")}`,details:{got:s}};let f="string"==typeof a&&/^(?:docker|remote-docker):[A-Za-z0-9][A-Za-z0-9._-]*$/.test(a);if(void 0!==a&&!f&&("string"!=typeof a||!r.includes(a)))return{ok:!1,message:`provider must be one of ${r.join(", ")} (or a docker:<host> spec)`,details:{got:a}};if(void 0!==i&&"string"!=typeof i)return{ok:!1,message:"name must be a string"};if(void 0!==c&&"string"!=typeof c)return{ok:!1,message:"prompt must be a string"};let m=u(p,"fromBranch");if(!m.ok)return m;let g=l(d,"setupWizard");return g.ok?{ok:!0,value:{projectId:n,agent:s,provider:a,name:i,prompt:c,fromBranch:m.value,setupWizard:g.value}}:g},"parseGitBranch",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{name:t,from:r}=e;if("string"!=typeof t||0===t.trim().length)return{ok:!1,message:"name is required (non-empty string)"};let n=u(r,"from");return n.ok?{ok:!0,value:{name:t,from:n.value}}:n},"parseGitCheckout",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{branch:t}=e;return"string"!=typeof t||0===t.trim().length?{ok:!1,message:"branch is required (non-empty string)"}:{ok:!0,value:{branch:t}}},"parseGitPull",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let t=u(e.remote,"remote");if(!t.ok)return t;let r=l(e.ffOnly,"ffOnly");return r.ok?{ok:!0,value:{remote:t.value,ffOnly:r.value}}:r},"parseGitPush",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let t=u(e.remote,"remote");if(!t.ok)return t;let r=l(e.force,"force");return r.ok?{ok:!0,value:{remote:t.value,force:r.value}}:r},"parseGitPushHost",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let t=u(e.as,"as");if(!t.ok)return t;let r=l(e.force,"force");return r.ok?{ok:!0,value:{as:t.value,force:r.value}}:r},"parseHostUpsert",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{alias:t,ssh:r,default:n}=e;if("string"!=typeof t||!s.test(t))return{ok:!1,message:"alias must be a plain name (letters, digits, ., _, -; no @, :, /)"};if("string"!=typeof r||0===r.trim().length)return{ok:!1,message:"ssh is required (an ~/.ssh/config alias or [user@]host[:port])"};let a=l(n,"default");return a.ok?{ok:!0,value:{alias:t,ssh:r.trim(),default:a.value}}:a},"parseLoginCode",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{code:t}=e;return"string"!=typeof t||0===t.trim().length?{ok:!1,message:"code is required (non-empty string)"}:{ok:!0,value:{code:t.trim()}}},"parseOpenIn",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{app:t}=e;return"string"==typeof t&&i.includes(t)?{ok:!0,value:{app:t}}:{ok:!1,message:`app must be one of ${i.join(", ")}`,details:{got:t}}},"parseProject",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{path:t}=e;return"string"!=typeof t||0===t.length?{ok:!1,message:"path is required (absolute directory path)"}:{ok:!0,value:{path:t}}},"parseProviderCredentials",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let t={};for(let[r,n]of Object.entries(e)){if("string"!=typeof n)return{ok:!1,message:`field ${r} must be a string`};t[r]=n}return 0===Object.keys(t).length?{ok:!1,message:"at least one credential field is required"}:{ok:!0,value:t}},"parseProviderPrepare",0,function(e){if(null==e)return{ok:!0,value:{}};if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{force:t,claudeInstall:r}=e,n=l(t,"force");return n.ok?void 0!==r&&"native"!==r&&"npm"!==r?{ok:!1,message:"claudeInstall must be 'native' or 'npm'"}:{ok:!0,value:{force:n.value,claudeInstall:r}}:n},"parseRenameBox",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{displayName:t}=e;return"string"!=typeof t?{ok:!1,message:"displayName is required (string; empty string clears the label)"}:t.trim().length>60?{ok:!1,message:"displayName too long (max 60 chars)"}:{ok:!0,value:{displayName:t}}},"parseServiceRestart",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let t=u(e.name,"name");return t.ok?{ok:!0,value:{name:t.value}}:t},"readJson",0,c])}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__0keu6we._.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},96253,(e,t,r)=>{"use strict";t.exports=e.r(18622)},85132,(e,t,r)=>{"use strict";t.exports=e.r(96253).vendored["react-rsc"].React},86109,(e,t,r)=>{"use strict";var n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,o={},l={RequestCookies:()=>f,ResponseCookies:()=>g,parseCookie:()=>d,parseSetCookie:()=>c,stringifyCookie:()=>u};for(var p in l)n(o,p,{get:l[p],enumerable:!0});function u(e){var t;let r=["path"in e&&e.path&&`Path=${e.path}`,"expires"in e&&(e.expires||0===e.expires)&&`Expires=${("number"==typeof e.expires?new Date(e.expires):e.expires).toUTCString()}`,"maxAge"in e&&"number"==typeof e.maxAge&&`Max-Age=${e.maxAge}`,"domain"in e&&e.domain&&`Domain=${e.domain}`,"secure"in e&&e.secure&&"Secure","httpOnly"in e&&e.httpOnly&&"HttpOnly","sameSite"in e&&e.sameSite&&`SameSite=${e.sameSite}`,"partitioned"in e&&e.partitioned&&"Partitioned","priority"in e&&e.priority&&`Priority=${e.priority}`].filter(Boolean),n=`${e.name}=${encodeURIComponent(null!=(t=e.value)?t:"")}`;return 0===r.length?n:`${n}; ${r.join("; ")}`}function d(e){let t=new Map;for(let r of e.split(/; */)){if(!r)continue;let e=r.indexOf("=");if(-1===e){t.set(r,"true");continue}let[n,a]=[r.slice(0,e),r.slice(e+1)];try{t.set(n,decodeURIComponent(null!=a?a:"true"))}catch{}}return t}function c(e){if(!e)return;let[[t,r],...n]=d(e),{domain:a,expires:i,httponly:s,maxage:o,path:l,samesite:p,secure:u,partitioned:c,priority:f}=Object.fromEntries(n.map(([e,t])=>[e.toLowerCase().replace(/-/g,""),t]));{var g,v,x={name:t,value:decodeURIComponent(r),domain:a,...i&&{expires:new Date(i)},...s&&{httpOnly:!0},..."string"==typeof o&&{maxAge:Number(o)},path:l,...p&&{sameSite:h.includes(g=(g=p).toLowerCase())?g:void 0},...u&&{secure:!0},...f&&{priority:m.includes(v=(v=f).toLowerCase())?v:void 0},...c&&{partitioned:!0}};let e={};for(let t in x)x[t]&&(e[t]=x[t]);return e}}t.exports=((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of i(t))s.call(e,o)||void 0===o||n(e,o,{get:()=>t[o],enumerable:!(r=a(t,o))||r.enumerable});return e})(n({},"__esModule",{value:!0}),o);var h=["strict","lax","none"],m=["low","medium","high"],f=class{constructor(e){this._parsed=new Map,this._headers=e;const t=e.get("cookie");if(t)for(const[e,r]of d(t))this._parsed.set(e,{name:e,value:r})}[Symbol.iterator](){return this._parsed[Symbol.iterator]()}get size(){return this._parsed.size}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed);if(!e.length)return r.map(([e,t])=>t);let n="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(([e])=>e===n).map(([e,t])=>t)}has(e){return this._parsed.has(e)}set(...e){let[t,r]=1===e.length?[e[0].name,e[0].value]:e,n=this._parsed;return n.set(t,{name:t,value:r}),this._headers.set("cookie",Array.from(n).map(([e,t])=>u(t)).join("; ")),this}delete(e){let t=this._parsed,r=Array.isArray(e)?e.map(e=>t.delete(e)):t.delete(e);return this._headers.set("cookie",Array.from(t).map(([e,t])=>u(t)).join("; ")),r}clear(){return this.delete(Array.from(this._parsed.keys())),this}[Symbol.for("edge-runtime.inspect.custom")](){return`RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(e=>`${e.name}=${encodeURIComponent(e.value)}`).join("; ")}},g=class{constructor(e){var t,r,n;this._parsed=new Map,this._headers=e;const a=null!=(n=null!=(r=null==(t=e.getSetCookie)?void 0:t.call(e))?r:e.get("set-cookie"))?n:[];for(const e of Array.isArray(a)?a:function(e){if(!e)return[];var t,r,n,a,i,s=[],o=0;function l(){for(;o<e.length&&/\s/.test(e.charAt(o));)o+=1;return o<e.length}for(;o<e.length;){for(t=o,i=!1;l();)if(","===(r=e.charAt(o))){for(n=o,o+=1,l(),a=o;o<e.length&&"="!==(r=e.charAt(o))&&";"!==r&&","!==r;)o+=1;o<e.length&&"="===e.charAt(o)?(i=!0,o=a,s.push(e.substring(t,n)),t=o):o=n+1}else o+=1;(!i||o>=e.length)&&s.push(e.substring(t,e.length))}return s}(a)){const t=c(e);t&&this._parsed.set(t.name,t)}}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed.values());if(!e.length)return r;let n="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(e=>e.name===n)}has(e){return this._parsed.has(e)}set(...e){let[t,r,n]=1===e.length?[e[0].name,e[0].value,e[0]]:e,a=this._parsed;return a.set(t,function(e={name:"",value:""}){return"number"==typeof e.expires&&(e.expires=new Date(e.expires)),e.maxAge&&(e.expires=new Date(Date.now()+1e3*e.maxAge)),(null===e.path||void 0===e.path)&&(e.path="/"),e}({name:t,value:r,...n})),function(e,t){for(let[,r]of(t.delete("set-cookie"),e)){let e=u(r);t.append("set-cookie",e)}}(a,this._headers),this}delete(...e){let[t,r]="string"==typeof e[0]?[e[0]]:[e[0].name,e[0]];return this.set({...r,name:t,value:"",expires:new Date(0)})}[Symbol.for("edge-runtime.inspect.custom")](){return`ResponseCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(u).join("; ")}}},79924,e=>{"use strict";var t=e.i(56710),r=e.i(82809),n=e.i(74001),a=e.i(73300),i=e.i(68744),s=e.i(98570),o=e.i(56147),l=e.i(32931),p=e.i(61810),u=e.i(59963),d=e.i(44491),c=e.i(74916),h=e.i(33073),m=e.i(98603),f=e.i(93317),g=e.i(93695);e.i(95533);var v=e.i(75616),x=e.i(48806);e.s(["GET",0,function(){return Response.json((0,x.buildOpenApi)())},"dynamic",0,"force-dynamic","runtime",0,"nodejs"],59172);var y=e.i(59172);let R=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/(dashboard)/api/v1/openapi.json/route",pathname:"/api/v1/openapi.json",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/apps/hub/app/(dashboard)/api/v1/openapi.json/route.ts",nextConfigOutput:"standalone",userland:y,...{}}),{workAsyncStorage:w,workUnitAsyncStorage:b,serverHooks:A}=R;async function C(e,t,n){n.requestMeta&&(0,a.setRequestMeta)(e,n.requestMeta),R.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let x="/(dashboard)/api/v1/openapi.json/route";x=x.replace(/\/index$/,"")||"/";let y=await R.prepare(e,t,{srcPage:x,multiZoneDraftMode:!1});if(!y)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:w,deploymentId:b,params:A,nextConfig:C,parsedUrl:_,isDraftMode:E,prerenderManifest:S,routerServerContext:O,isOnDemandRevalidate:j,revalidateOnlyGenerated:k,resolvedPathname:P,clientReferenceManifest:N,serverActionsManifest:T}=y,q=(0,o.normalizeAppPath)(x),$=!!(S.dynamicRoutes[q]||S.routes[P]),D=async()=>((null==O?void 0:O.render404)?await O.render404(e,t,_,!1):t.end("This page could not be found"),null);if($&&!E){let e=!!S.routes[P],t=S.dynamicRoutes[q];if(t&&!1===t.fallback&&!e){if(C.adapterPath)return await D();throw new g.NoFallbackError}}let U=null;!$||R.isDev||E||(U="/index"===(U=P)?"/":U);let I=!0===R.isDev||!$,M=$&&!I;T&&N&&(0,s.setManifestsSingleton)({page:x,clientReferenceManifest:N,serverActionsManifest:T});let H=e.method||"GET",F=(0,i.getTracer)(),K=F.getActiveScopeSpan(),L=!!(null==O?void 0:O.isWrappedByNextServer),B=!!(0,a.getRequestMeta)(e,"minimalMode"),G=(0,a.getRequestMeta)(e,"incrementalCache")||await R.getIncrementalCache(e,C,S,B);null==G||G.resetRequestCache(),globalThis.__incrementalCache=G;let z={params:A,previewProps:S.preview,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts},cacheComponents:!!C.cacheComponents,supportsDynamicResponse:I,incrementalCache:G,cacheLifeProfiles:C.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>R.onRequestError(e,t,n,a,O)},sharedContext:{buildId:w,deploymentId:b}},V=new l.NodeNextRequest(e),W=new l.NodeNextResponse(t),X=p.NextRequestAdapter.fromNodeNextRequest(V,(0,p.signalFromNodeResponse)(t));try{let a,s=async e=>R.handle(X,z).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=F.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${H} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t),a&&a!==e&&(a.setAttribute("http.route",n),a.updateName(t))}else e.updateName(`${H} ${x}`)}),o=async a=>{var i,o;let l=async({previousCacheEntry:r})=>{try{if(!B&&j&&k&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let i=await s(a);e.fetchMetrics=z.renderOpts.fetchMetrics;let o=z.renderOpts.pendingWaitUntil;o&&n.waitUntil&&(n.waitUntil(o),o=void 0);let l=z.renderOpts.collectedTags;if(!$)return await (0,c.sendResponse)(V,W,i,z.renderOpts.pendingWaitUntil),null;{let e=await i.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(i.headers);l&&(t[f.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==z.renderOpts.collectedRevalidate&&!(z.renderOpts.collectedRevalidate>=f.INFINITE_CACHE)&&z.renderOpts.collectedRevalidate,n=void 0===z.renderOpts.collectedExpire||z.renderOpts.collectedExpire>=f.INFINITE_CACHE?void 0:z.renderOpts.collectedExpire;return{value:{kind:v.CachedRouteKind.APP_ROUTE,status:i.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await R.onRequestError(e,t,{routerKind:"App Router",routePath:x,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:j})},!1,O),t}},p=await R.handleResponse({req:e,nextConfig:C,cacheKey:U,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:S,isRoutePPREnabled:!1,isOnDemandRevalidate:j,revalidateOnlyGenerated:k,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:B});if(!$)return null;if((null==p||null==(i=p.value)?void 0:i.kind)!==v.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==p||null==(o=p.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});B||t.setHeader("x-nextjs-cache",j?"REVALIDATED":p.isMiss?"MISS":p.isStale?"STALE":"HIT"),E&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,h.fromNodeOutgoingHttpHeaders)(p.value.headers);return B&&$||u.delete(f.NEXT_CACHE_TAGS_HEADER),!p.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,m.getCacheControlHeader)(p.cacheControl)),await (0,c.sendResponse)(V,W,new Response(p.value.body,{headers:u,status:p.value.status||200})),null};L&&K?await o(K):(a=F.getActiveScopeSpan(),await F.withPropagatedContext(e.headers,()=>F.trace(u.BaseServerSpan.handleRequest,{spanName:`${H} ${x}`,kind:i.SpanKind.SERVER,attributes:{"http.method":H,"http.target":e.url}},o),void 0,!L))}catch(t){if(t instanceof g.NoFallbackError||await R.onRequestError(e,t,{routerKind:"App Router",routePath:q,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:j})},!1,O),$)throw t;return await (0,c.sendResponse)(V,W,new Response(null,{status:500})),null}}e.s(["handler",0,C,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:w,workUnitAsyncStorage:b})},"routeModule",0,R,"serverHooks",0,A,"workAsyncStorage",0,w,"workUnitAsyncStorage",0,b],79924)}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__0t4qmv-._.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},96253,(e,t,r)=>{"use strict";t.exports=e.r(18622)},85132,(e,t,r)=>{"use strict";t.exports=e.r(96253).vendored["react-rsc"].React},86109,(e,t,r)=>{"use strict";var n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,i={},l={RequestCookies:()=>m,ResponseCookies:()=>g,parseCookie:()=>p,parseSetCookie:()=>c,stringifyCookie:()=>d};for(var u in l)n(i,u,{get:l[u],enumerable:!0});function d(e){var t;let r=["path"in e&&e.path&&`Path=${e.path}`,"expires"in e&&(e.expires||0===e.expires)&&`Expires=${("number"==typeof e.expires?new Date(e.expires):e.expires).toUTCString()}`,"maxAge"in e&&"number"==typeof e.maxAge&&`Max-Age=${e.maxAge}`,"domain"in e&&e.domain&&`Domain=${e.domain}`,"secure"in e&&e.secure&&"Secure","httpOnly"in e&&e.httpOnly&&"HttpOnly","sameSite"in e&&e.sameSite&&`SameSite=${e.sameSite}`,"partitioned"in e&&e.partitioned&&"Partitioned","priority"in e&&e.priority&&`Priority=${e.priority}`].filter(Boolean),n=`${e.name}=${encodeURIComponent(null!=(t=e.value)?t:"")}`;return 0===r.length?n:`${n}; ${r.join("; ")}`}function p(e){let t=new Map;for(let r of e.split(/; */)){if(!r)continue;let e=r.indexOf("=");if(-1===e){t.set(r,"true");continue}let[n,a]=[r.slice(0,e),r.slice(e+1)];try{t.set(n,decodeURIComponent(null!=a?a:"true"))}catch{}}return t}function c(e){if(!e)return;let[[t,r],...n]=p(e),{domain:a,expires:o,httponly:s,maxage:i,path:l,samesite:u,secure:d,partitioned:c,priority:m}=Object.fromEntries(n.map(([e,t])=>[e.toLowerCase().replace(/-/g,""),t]));{var g,v,x={name:t,value:decodeURIComponent(r),domain:a,...o&&{expires:new Date(o)},...s&&{httpOnly:!0},..."string"==typeof i&&{maxAge:Number(i)},path:l,...u&&{sameSite:h.includes(g=(g=u).toLowerCase())?g:void 0},...d&&{secure:!0},...m&&{priority:f.includes(v=(v=m).toLowerCase())?v:void 0},...c&&{partitioned:!0}};let e={};for(let t in x)x[t]&&(e[t]=x[t]);return e}}t.exports=((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of o(t))s.call(e,i)||void 0===i||n(e,i,{get:()=>t[i],enumerable:!(r=a(t,i))||r.enumerable});return e})(n({},"__esModule",{value:!0}),i);var h=["strict","lax","none"],f=["low","medium","high"],m=class{constructor(e){this._parsed=new Map,this._headers=e;const t=e.get("cookie");if(t)for(const[e,r]of p(t))this._parsed.set(e,{name:e,value:r})}[Symbol.iterator](){return this._parsed[Symbol.iterator]()}get size(){return this._parsed.size}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed);if(!e.length)return r.map(([e,t])=>t);let n="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(([e])=>e===n).map(([e,t])=>t)}has(e){return this._parsed.has(e)}set(...e){let[t,r]=1===e.length?[e[0].name,e[0].value]:e,n=this._parsed;return n.set(t,{name:t,value:r}),this._headers.set("cookie",Array.from(n).map(([e,t])=>d(t)).join("; ")),this}delete(e){let t=this._parsed,r=Array.isArray(e)?e.map(e=>t.delete(e)):t.delete(e);return this._headers.set("cookie",Array.from(t).map(([e,t])=>d(t)).join("; ")),r}clear(){return this.delete(Array.from(this._parsed.keys())),this}[Symbol.for("edge-runtime.inspect.custom")](){return`RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(e=>`${e.name}=${encodeURIComponent(e.value)}`).join("; ")}},g=class{constructor(e){var t,r,n;this._parsed=new Map,this._headers=e;const a=null!=(n=null!=(r=null==(t=e.getSetCookie)?void 0:t.call(e))?r:e.get("set-cookie"))?n:[];for(const e of Array.isArray(a)?a:function(e){if(!e)return[];var t,r,n,a,o,s=[],i=0;function l(){for(;i<e.length&&/\s/.test(e.charAt(i));)i+=1;return i<e.length}for(;i<e.length;){for(t=i,o=!1;l();)if(","===(r=e.charAt(i))){for(n=i,i+=1,l(),a=i;i<e.length&&"="!==(r=e.charAt(i))&&";"!==r&&","!==r;)i+=1;i<e.length&&"="===e.charAt(i)?(o=!0,i=a,s.push(e.substring(t,n)),t=i):i=n+1}else i+=1;(!o||i>=e.length)&&s.push(e.substring(t,e.length))}return s}(a)){const t=c(e);t&&this._parsed.set(t.name,t)}}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed.values());if(!e.length)return r;let n="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(e=>e.name===n)}has(e){return this._parsed.has(e)}set(...e){let[t,r,n]=1===e.length?[e[0].name,e[0].value,e[0]]:e,a=this._parsed;return a.set(t,function(e={name:"",value:""}){return"number"==typeof e.expires&&(e.expires=new Date(e.expires)),e.maxAge&&(e.expires=new Date(Date.now()+1e3*e.maxAge)),(null===e.path||void 0===e.path)&&(e.path="/"),e}({name:t,value:r,...n})),function(e,t){for(let[,r]of(t.delete("set-cookie"),e)){let e=d(r);t.append("set-cookie",e)}}(a,this._headers),this}delete(...e){let[t,r]="string"==typeof e[0]?[e[0]]:[e[0].name,e[0]];return this.set({...r,name:t,value:"",expires:new Date(0)})}[Symbol.for("edge-runtime.inspect.custom")](){return`ResponseCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(d).join("; ")}}},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},54799,(e,t,r)=>{t.exports=e.x("crypto",()=>require("crypto"))},24868,(e,t,r)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},5365,(e,t,r)=>{t.exports=e.x("process",()=>require("process"))},874,(e,t,r)=>{t.exports=e.x("buffer",()=>require("buffer"))},53733,e=>{"use strict";let t={invalid_request:400,unauthorized:401,not_found:404,conflict:409,backend_unavailable:503,internal:500};function r(e,r,n){let a=t[e];return Response.json({error:{code:e,message:r,...void 0===n?{}:{details:n}}},{status:a})}e.s(["fail",0,r,"failFromAction",0,function(e){return r(/\b(not found|no such|does not exist)\b/i.test(e)||/\bunknown (project|box)\b/i.test(e)||/no pending approval/i.test(e)?"not_found":"conflict",e)},"ok",0,function(e,t=200){return Response.json(e,{status:t})}])},82477,e=>{"use strict";var t=e.i(89551);function r(e){if(e.originUrl){let t=e.originUrl.replace(/\.git$/,"").split(/[/:]/).pop();if(t)return t}return e.name}function n(e){var t;return t=e.originUrl??e.name,Buffer.from(t).toString("base64url")}function a(e){return{claude:e?.claude,codex:e?.codex,opencode:e?.opencode}}function o(e){if(!e)return"stopped";let{claude:t,codex:r,opencode:n}=a(e);return[t?.state,r?.state,n?.state].includes("error")?"error":t?.sessionRunning||r?.sessionRunning||n?.sessionRunning?"running":"stopped"}let s=null;async function i(){var t;let i=process.env.POSTGRES_URL??process.env.RELAY_STORE_URL;if(!i)throw Error("hub: POSTGRES_URL required for the hosted source");let l=await (!s&&(s=(async()=>{let{PostgresStore:t}=await e.A(59249),r=new t({connectionString:i});return await r.migrate(),r})().catch(e=>{throw s=null,e})),s),u=await l.listBoxes(),d=new Map((await l.listStatuses()).map(e=>[e.boxId,e.status])),p=[];for(let e of u)for(let r of(await l.listPendingPrompts(e.boxId)))p.push((t=e.boxId,{id:r.ev.id,boxId:t,message:r.ev.message,detail:r.ev.detail,command:r.ev.context?.command,cwd:r.ev.context?.cwd,argv:r.ev.context?.argv,defaultAnswer:r.ev.defaultAnswer??"n",createdAt:Date.parse(r.createdAt)||Date.now()}));return{user:{login:"hub",name:"hub"},github:{available:!1,installed:!1,appName:"GitHub App",account:"",installedAt:0,repos:[]},projects:function(e){let t=new Map;for(let a of e){let e=n(a),o=Date.parse(a.createdAt??a.registeredAt)||Date.now(),s=t.get(e);s?o<s.createdAt&&(s.createdAt=o):t.set(e,{key:e,name:r(a),createdAt:o})}return[...t.values()].map(e=>({id:e.key,name:e.name,repo:e.name,defaultBranch:"main",provider:"cloud",createdAt:e.createdAt})).sort((e,t)=>t.createdAt-e.createdAt)}(u),boxes:u.map(e=>(function(e,t){let{claude:s,codex:i,opencode:l}=a(t),u=Date.parse(e.createdAt??e.registeredAt)||Date.now();return{id:e.boxId,projectId:n(e),repo:r(e),branch:e.worktrees?.[0]?.branch??"",task:s?.sessionTitle??i?.sessionTitle??l?.sessionTitle??e.name,agent:i?.sessionRunning?"codex":l?.sessionRunning?"opencode":"claude",status:o(t),createdAt:u,lastActivity:u,host:e.backend?`${e.kind??"cloud"} \xb7 ${e.backend}`:e.kind??"cloud",provider:e.kind??"docker",commits:null,filesTouched:null,error:"error"===o(t)?s?.sessionTitle??"Agent reported an error":null,webUrl:null,vncUrl:null}})(e,d.get(e.boxId))),approvals:p,providers:[]}}async function l(){let e=globalThis.__AGENTBOX_HUB_BACKEND;return e?{...await e.getData(),authMode:(0,t.authMode)()}:process.env.POSTGRES_URL??process.env.RELAY_STORE_URL?{...await i(),authMode:(0,t.authMode)()}:{user:{login:"user",name:"user"},github:{available:!1,installed:!1,appName:"GitHub App",account:"",installedAt:0,repos:[]},projects:[],boxes:[],approvals:[],providers:[],authMode:(0,t.authMode)()}}async function u(){return l()}e.s(["backendOrNull",0,function(){return globalThis.__AGENTBOX_HUB_BACKEND??null},"readState",0,u],82477)},43090,e=>{"use strict";var t=e.i(56710),r=e.i(82809),n=e.i(74001),a=e.i(73300),o=e.i(68744),s=e.i(98570),i=e.i(56147),l=e.i(32931),u=e.i(61810),d=e.i(59963),p=e.i(44491),c=e.i(74916),h=e.i(33073),f=e.i(98603),m=e.i(93317),g=e.i(93695);e.i(95533);var v=e.i(75616),x=e.i(82477),b=e.i(53733);async function R(e,t){let{alias:r}=await t.params,n=(0,x.backendOrNull)();if(!n)return(0,b.fail)("backend_unavailable","hub backend unavailable (run the hub server)");if(!(await n.listRemoteDockerHosts()).some(e=>e.alias===r))return(0,b.fail)("not_found",`unknown host alias ${r}`);let a=await n.removeRemoteDockerHost(r);return a.ok?(0,b.ok)({ok:!0,boxesAffected:a.boxesAffected}):(0,b.fail)("conflict",a.error)}e.s(["DELETE",0,R,"dynamic",0,"force-dynamic","runtime",0,"nodejs"],82956);var w=e.i(82956);let y=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/(dashboard)/api/v1/hosts/[alias]/route",pathname:"/api/v1/hosts/[alias]",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/apps/hub/app/(dashboard)/api/v1/hosts/[alias]/route.ts",nextConfigOutput:"standalone",userland:w,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:_,serverHooks:E}=y;async function k(e,t,n){n.requestMeta&&(0,a.setRequestMeta)(e,n.requestMeta),y.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let x="/(dashboard)/api/v1/hosts/[alias]/route";x=x.replace(/\/index$/,"")||"/";let b=await y.prepare(e,t,{srcPage:x,multiZoneDraftMode:!1});if(!b)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:R,deploymentId:w,params:A,nextConfig:_,parsedUrl:E,isDraftMode:k,prerenderManifest:C,routerServerContext:S,isOnDemandRevalidate:O,revalidateOnlyGenerated:T,resolvedPathname:j,clientReferenceManifest:N,serverActionsManifest:P}=b,q=(0,i.normalizeAppPath)(x),D=!!(C.dynamicRoutes[q]||C.routes[j]),U=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,E,!1):t.end("This page could not be found"),null);if(D&&!k){let e=!!C.routes[j],t=C.dynamicRoutes[q];if(t&&!1===t.fallback&&!e){if(_.adapterPath)return await U();throw new g.NoFallbackError}}let M=null;!D||y.isDev||k||(M="/index"===(M=j)?"/":M);let $=!0===y.isDev||!D,I=D&&!$;P&&N&&(0,s.setManifestsSingleton)({page:x,clientReferenceManifest:N,serverActionsManifest:P});let H=e.method||"GET",B=(0,o.getTracer)(),L=B.getActiveScopeSpan(),G=!!(null==S?void 0:S.isWrappedByNextServer),K=!!(0,a.getRequestMeta)(e,"minimalMode"),F=(0,a.getRequestMeta)(e,"incrementalCache")||await y.getIncrementalCache(e,_,C,K);null==F||F.resetRequestCache(),globalThis.__incrementalCache=F;let X={params:A,previewProps:C.preview,renderOpts:{experimental:{authInterrupts:!!_.experimental.authInterrupts},cacheComponents:!!_.cacheComponents,supportsDynamicResponse:$,incrementalCache:F,cacheLifeProfiles:_.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>y.onRequestError(e,t,n,a,S)},sharedContext:{buildId:R,deploymentId:w}},z=new l.NodeNextRequest(e),V=new l.NodeNextResponse(t),W=u.NextRequestAdapter.fromNodeNextRequest(z,(0,u.signalFromNodeResponse)(t));try{let a,s=async e=>y.handle(W,X).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=B.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${H} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t),a&&a!==e&&(a.setAttribute("http.route",n),a.updateName(t))}else e.updateName(`${H} ${x}`)}),i=async a=>{var o,i;let l=async({previousCacheEntry:r})=>{try{if(!K&&O&&T&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let o=await s(a);e.fetchMetrics=X.renderOpts.fetchMetrics;let i=X.renderOpts.pendingWaitUntil;i&&n.waitUntil&&(n.waitUntil(i),i=void 0);let l=X.renderOpts.collectedTags;if(!D)return await (0,c.sendResponse)(z,V,o,X.renderOpts.pendingWaitUntil),null;{let e=await o.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(o.headers);l&&(t[m.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==X.renderOpts.collectedRevalidate&&!(X.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&X.renderOpts.collectedRevalidate,n=void 0===X.renderOpts.collectedExpire||X.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:X.renderOpts.collectedExpire;return{value:{kind:v.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await y.onRequestError(e,t,{routerKind:"App Router",routePath:x,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:I,isOnDemandRevalidate:O})},!1,S),t}},u=await y.handleResponse({req:e,nextConfig:_,cacheKey:M,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:C,isRoutePPREnabled:!1,isOnDemandRevalidate:O,revalidateOnlyGenerated:T,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:K});if(!D)return null;if((null==u||null==(o=u.value)?void 0:o.kind)!==v.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(i=u.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",O?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),k&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let d=(0,h.fromNodeOutgoingHttpHeaders)(u.value.headers);return K&&D||d.delete(m.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||d.get("Cache-Control")||d.set("Cache-Control",(0,f.getCacheControlHeader)(u.cacheControl)),await (0,c.sendResponse)(z,V,new Response(u.value.body,{headers:d,status:u.value.status||200})),null};G&&L?await i(L):(a=B.getActiveScopeSpan(),await B.withPropagatedContext(e.headers,()=>B.trace(d.BaseServerSpan.handleRequest,{spanName:`${H} ${x}`,kind:o.SpanKind.SERVER,attributes:{"http.method":H,"http.target":e.url}},i),void 0,!G))}catch(t){if(t instanceof g.NoFallbackError||await y.onRequestError(e,t,{routerKind:"App Router",routePath:q,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:I,isOnDemandRevalidate:O})},!1,S),D)throw t;return await (0,c.sendResponse)(z,V,new Response(null,{status:500})),null}}e.s(["handler",0,k,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:_})},"routeModule",0,y,"serverHooks",0,E,"workAsyncStorage",0,A,"workUnitAsyncStorage",0,_],43090)},59249,e=>{e.v(t=>Promise.all(["server/chunks/[root-of-the-server]__0a7djvw._.js","server/chunks/packages_relay_dist_control-plane_03a-9aj.js"].map(t=>e.l(t))).then(()=>t(63003)))}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__0xh14bo._.js.map
@@ -59,7 +59,7 @@ module.exports=[2157,(e,t,r)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},
59
59
 
60
60
  `)}t.write("payload.value = newResult;"),t.write("return payload;");let s=t.compile();return(t,r)=>s(e,t,r)})(t.shape)),l=r(l,d),c)?r4([],u,l,d,n,e):l:i(l,d):(l.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),l)}});function r9(e,t,r,n){for(let r of e)if(0===r.issues.length)return t.value=r.value,t;let i=e.filter(e=>!e0(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>e6(e,n,eT())))}),t)}let r7=e_("$ZodUnion",(e,t)=>{rA.init(e,t),e$(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),e$(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),e$(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),e$(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>eC(e.source)).join("|")})$`)}});let r=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(n,i)=>{if(r)return r(n,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:n.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(0===t.issues.length)return t;o.push(t)}}return a?Promise.all(o).then(t=>r9(t,n,e,i)):r9(o,n,e,i)}});function ne(e,t,r,n){let i=e.filter(e=>0===e.issues.length);return 1===i.length?t.value=i[0].value:0===i.length?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>e6(e,n,eT())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t}(e,t)=>{r7.init(e,t),t.inclusive=!1;let r=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(n,i)=>{if(r)return r(n,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:n.value,issues:[]},i);t instanceof Promise?(o.push(t),a=!0):o.push(t)}return a?Promise.all(o).then(t=>ne(t,n,e,i)):ne(o,n,e,i)}},(e,t)=>{t.inclusive=!1,r7.init(e,t);let r=e._zod.parse;e$(e._zod,"propValues",()=>{let e={};for(let r of t.options){let n=r._zod.propValues;if(!n||0===Object.keys(n).length)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let[t,r]of Object.entries(n))for(let n of(e[t]||(e[t]=new Set),r))e[t].add(n)}return e});let n=eO(()=>{let e=t.options,r=new Map;for(let n of e){let e=n._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let t of e){if(r.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,n)}}return r});e._zod.parse=(i,a)=>{let o=i.value;if(!eq(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:e}),i;let s=n.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||"backward"===a.direction?r(i,a):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}};let nt=e_("$ZodIntersection",(e,t)=>{rA.init(e,t),e._zod.parse=(e,r)=>{let n=e.value,i=t.left._zod.run({value:n,issues:[]},r),a=t.right._zod.run({value:n,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,r])=>nr(e,t,r)):nr(e,i,a)}});function nr(e,t,r){let n,i=new Map;for(let r of t.issues)if("unrecognized_keys"===r.code)for(let e of(n??(n=r),r.keys))i.has(e)||i.set(e,{}),i.get(e).l=!0;else e.issues.push(r);for(let t of r.issues)if("unrecognized_keys"===t.code)for(let e of t.keys)i.has(e)||i.set(e,{}),i.get(e).r=!0;else e.issues.push(t);let a=[...i].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&n&&e.issues.push({...n,keys:a}),e0(e))return e;let o=function e(t,r){if(t===r||t instanceof Date&&r instanceof Date&&+t==+r)return{valid:!0,data:t};if(eV(t)&&eV(r)){let n=Object.keys(r),i=Object.keys(t).filter(e=>-1!==n.indexOf(e)),a={...t,...r};for(let n of i){let i=e(t[n],r[n]);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};a[n]=i.data}return{valid:!0,data:a}}if(Array.isArray(t)&&Array.isArray(r)){if(t.length!==r.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let i=0;i<t.length;i++){let a=e(t[i],r[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}(t.value,r.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}let nn=e_("$ZodTuple",(e,t)=>{rA.init(e,t);let r=t.items;e._zod.parse=(n,i)=>{let a=n.value;if(!Array.isArray(a))return n.issues.push({input:a,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let o=[],s=ni(r,"optin"),c=ni(r,"optout");if(!t.rest){if(a.length<s)return n.issues.push({code:"too_small",minimum:s,inclusive:!0,input:a,inst:e,origin:"array"}),n;a.length>r.length&&n.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:a,inst:e,origin:"array"})}let l=Array(r.length);for(let e=0;e<r.length;e++){let t=r[e]._zod.run({value:a[e],issues:[]},i);t instanceof Promise?o.push(t.then(t=>{l[e]=t})):l[e]=t}if(t.rest){let e=r.length-1;for(let s of a.slice(r.length)){e++;let r=t.rest._zod.run({value:s,issues:[]},i);r instanceof Promise?o.push(r.then(t=>na(t,n,e))):na(r,n,e)}}return o.length?Promise.all(o).then(()=>no(l,n,r,a,c)):no(l,n,r,a,c)}});function ni(e,t){for(let r=e.length-1;r>=0;r--)if("optional"!==e[r]._zod[t])return r+1;return 0}function na(e,t,r){e.issues.length&&t.issues.push(...e2(r,e.issues)),t.value[r]=e.value}function no(e,t,r,n,i){for(let a=0;a<r.length;a++){let r=e[a],o=a<n.length;if(r.issues.length){if(!o&&a>=i){t.value.length=a;break}t.issues.push(...e2(a,r.issues))}t.value[a]=r.value}for(let e=t.value.length-1;e>=n.length;e--)if("optional"===r[e]._zod.optout&&void 0===t.value[e])t.value.length=e;else break;return t}let ns=e_("$ZodRecord",(e,t)=>{rA.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!eV(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let a=[],o=t.keyType._zod.values;if(o){let s;r.value={};let c=new Set;for(let s of o)if("string"==typeof s||"number"==typeof s||"symbol"==typeof s){c.add("number"==typeof s?s.toString():s);let o=t.keyType._zod.run({value:s,issues:[]},n);if(o instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(o.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:o.issues.map(e=>e6(e,n,eT())),input:s,path:[s],inst:e});continue}let l=o.value,d=t.valueType._zod.run({value:i[s],issues:[]},n);d instanceof Promise?a.push(d.then(e=>{e.issues.length&&r.issues.push(...e2(s,e.issues)),r.value[l]=e.value})):(d.issues.length&&r.issues.push(...e2(s,d.issues)),r.value[l]=d.value)}for(let e in i)c.has(e)||(s=s??[]).push(e);s&&s.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:s})}else for(let o of(r.value={},Reflect.ownKeys(i))){if("__proto__"===o||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},n);if(s instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof o&&tP.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},n);if(e instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===e.issues.length&&(s=e)}if(s.issues.length){"loose"===t.mode?r.value[o]=i[o]:r.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map(e=>e6(e,n,eT())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},n);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&r.issues.push(...e2(o,e.issues)),r.value[s.value]=e.value})):(c.issues.length&&r.issues.push(...e2(o,c.issues)),r.value[s.value]=c.value)}return a.length?Promise.all(a).then(()=>r):r}});function nc(e,t,r,n,i,a,o){e.issues.length&&(eK.has(typeof n)?r.issues.push(...e2(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:i,inst:a,issues:e.issues.map(e=>e6(e,o,eT()))})),t.issues.length&&(eK.has(typeof n)?r.issues.push(...e2(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:i,inst:a,key:n,issues:t.issues.map(e=>e6(e,o,eT()))})),r.value.set(e.value,t.value)}function nl(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}(e,t)=>{rA.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let a=[];for(let[o,s]of(r.value=new Map,i)){let c=t.keyType._zod.run({value:o,issues:[]},n),l=t.valueType._zod.run({value:s,issues:[]},n);c instanceof Promise||l instanceof Promise?a.push(Promise.all([c,l]).then(([t,a])=>{nc(t,a,r,o,i,e,n)})):nc(c,l,r,o,i,e,n)}return a.length?Promise.all(a).then(()=>r):r}},(e,t)=>{rA.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let a=[];for(let e of(r.value=new Set,i)){let i=t.valueType._zod.run({value:e,issues:[]},n);i instanceof Promise?a.push(i.then(e=>nl(e,r))):nl(i,r)}return a.length?Promise.all(a).then(()=>r):r}};let nd=e_("$ZodEnum",(e,t)=>{rA.init(e,t);let r=eI(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=RegExp(`^(${r.filter(e=>eK.has(typeof e)).map(e=>"string"==typeof e?eF(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{let a=t.value;return n.has(a)||t.issues.push({code:"invalid_value",values:r,input:a,inst:e}),t}}),nu=((e,t)=>{if(rA.init(e,t),0===t.values.length)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=RegExp(`^(${t.values.map(e=>"string"==typeof e?eF(e):e?eF(e.toString()):String(e)).join("|")})$`),e._zod.parse=(n,i)=>{let a=n.value;return r.has(a)||n.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),n}},e_("$ZodTransform",(e,t)=>{rA.init(e,t),e._zod.optin="optional",e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new ex(e.constructor.name);let i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(r.value=e,r.fallback=!0,r));if(i instanceof Promise)throw new eS;return r.value=i,r.fallback=!0,r}}));function np(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let nf=e_("$ZodOptional",(e,t)=>{rA.init(e,t),e._zod.optin="optional",e._zod.optout="optional",e$(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),e$(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${eC(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){let n=e.value,i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(e=>np(e,n)):np(i,n)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),nh=e_("$ZodExactOptional",(e,t)=>{nf.init(e,t),e$(e._zod,"values",()=>t.innerType._zod.values),e$(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),nm=e_("$ZodNullable",(e,t)=>{rA.init(e,t),e$(e._zod,"optin",()=>t.innerType._zod.optin),e$(e._zod,"optout",()=>t.innerType._zod.optout),e$(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${eC(e.source)}|null)$`):void 0}),e$(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),ny=e_("$ZodDefault",(e,t)=>{rA.init(e,t),e._zod.optin="optional",e$(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(e=>ng(e,t)):ng(n,t)}});function ng(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let nw=e_("$ZodPrefault",(e,t)=>{rA.init(e,t),e._zod.optin="optional",e$(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),nb=e_("$ZodNonOptional",(e,t)=>{rA.init(e,t),e$(e._zod,"values",()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,n)=>{let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(t=>nA(t,e)):nA(i,e)}});function nA(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}(e,t)=>{rA.init(e,t),e._zod.parse=(e,r)=>{if("backward"===r.direction)throw new ex("ZodSuccess");let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(t=>(e.value=0===t.issues.length,e)):(e.value=0===n.issues.length,e)}};let nE=e_("$ZodCatch",(e,t)=>{rA.init(e,t),e._zod.optin="optional",e$(e._zod,"optout",()=>t.innerType._zod.optout),e$(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(n=>(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>e6(e,r,eT()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>e6(e,r,eT()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),nv=((e,t)=>{rA.init(e,t),e._zod.parse=(t,r)=>("number"==typeof t.value&&Number.isNaN(t.value)||t.issues.push({input:t.value,inst:e,expected:"nan",code:"invalid_type"}),t)},e_("$ZodPipe",(e,t)=>{rA.init(e,t),e$(e._zod,"values",()=>t.in._zod.values),e$(e._zod,"optin",()=>t.in._zod.optin),e$(e._zod,"optout",()=>t.out._zod.optout),e$(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){let n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>nk(e,t.in,r)):nk(n,t.in,r)}let n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>nk(e,t.out,r)):nk(n,t.out,r)}}));function nk(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}function n_(e,t,r){if(e.issues.length)return e.aborted=!0,e;if("forward"===(r.direction||"forward")){let n=t.transform(e.value,e);return n instanceof Promise?n.then(n=>nS(e,n,t.out,r)):nS(e,n,t.out,r)}{let n=t.reverseTransform(e.value,e);return n instanceof Promise?n.then(n=>nS(e,n,t.in,r)):nS(e,n,t.in,r)}}function nS(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}(e,t)=>{rA.init(e,t),e$(e._zod,"values",()=>t.in._zod.values),e$(e._zod,"optin",()=>t.in._zod.optin),e$(e._zod,"optout",()=>t.out._zod.optout),e$(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("forward"===(r.direction||"forward")){let n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>n_(e,t,r)):n_(n,t,r)}{let n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>n_(e,t,r)):n_(n,t,r)}}},(e,t)=>{nv.init(e,t)};let nx=e_("$ZodReadonly",(e,t)=>{rA.init(e,t),e$(e._zod,"propValues",()=>t.innerType._zod.propValues),e$(e._zod,"values",()=>t.innerType._zod.values),e$(e._zod,"optin",()=>t.innerType?._zod?.optin),e$(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(nR):nR(n)}});function nR(e){return e.value=Object.freeze(e.value),e}(e,t)=>{rA.init(e,t);let r=[];for(let e of t.parts)if("object"==typeof e&&null!==e){if(!e._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...e._zod.traits].shift()}`);let t=e._zod.pattern instanceof RegExp?e._zod.pattern.source:e._zod.pattern;if(!t)throw Error(`Invalid template literal part: ${e._zod.traits}`);let n=+!!t.startsWith("^"),i=t.endsWith("$")?t.length-1:t.length;r.push(t.slice(n,i))}else if(null===e||eW.has(typeof e))r.push(eF(`${e}`));else throw Error(`Invalid template literal part: ${e}`);e._zod.pattern=RegExp(`^${r.join("")}$`),e._zod.parse=(r,n)=>("string"!=typeof r.value?r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(r.value)||r.issues.push({input:r.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source})),r)},(e,t)=>{rA.init(e,t),e$(e._zod,"innerType",()=>(t._cachedInner||(t._cachedInner=t.getter()),t._cachedInner)),e$(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),e$(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),e$(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),e$(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,r)=>e._zod.innerType._zod.run(t,r)};let nT=e_("$ZodCustom",(e,t)=>{tG.init(e,t),rA.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{let n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(t=>nI(t,r,n,e));nI(i,r,n,e)}});function nI(e,t,r,n){if(!e){let e={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push(e3(e))}}Symbol("ZodOutput"),Symbol("ZodInput");(m=globalThis).__zod_globalRegistry??(m.__zod_globalRegistry=new class e{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];return this._map.set(e,r),r&&"object"==typeof r&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});let nU=globalThis.__zod_globalRegistry;function nO(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...eZ(t)})}function nP(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...eZ(t)})}function nC(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...eZ(t)})}function nD(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...eZ(t)})}function nL(e,t){return new tY({check:"less_than",...eZ(t),value:e,inclusive:!1})}function n$(e,t){return new tY({check:"less_than",...eZ(t),value:e,inclusive:!0})}function nz(e,t){return new tX({check:"greater_than",...eZ(t),value:e,inclusive:!1})}function nN(e,t){return new tX({check:"greater_than",...eZ(t),value:e,inclusive:!0})}function nj(e,t){return new t0({check:"multiple_of",...eZ(t),value:e})}function nH(e,t){return new t8({check:"max_length",...eZ(t),maximum:e})}function nB(e,t){return new t3({check:"min_length",...eZ(t),minimum:e})}function nq(e,t){return new t9({check:"length_equals",...eZ(t),length:e})}function nM(e){return new ro({check:"overwrite",tx:e})}e.i(10107);var nV=e.i(2721),nV=nV;function nK(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??nU,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function nW(e,t,r={path:[],schemaPath:[]}){var n;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,r.schemaPath.includes(e)&&(a.cycle=r.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let n={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,n);else{let r=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,r,n)}let a=e._zod.parent;a&&(o.ref||(o.ref=a),nW(a,t,n),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),"input"===t.io&&function e(t,r){let n=r??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);let i=t._zod.def;if("transform"===i.type)return!0;if("array"===i.type)return e(i.element,n);if("set"===i.type)return e(i.valueType,n);if("lazy"===i.type)return e(i.getter(),n);if("promise"===i.type||"optional"===i.type||"nonoptional"===i.type||"nullable"===i.type||"readonly"===i.type||"default"===i.type||"prefault"===i.type)return e(i.innerType,n);if("intersection"===i.type)return e(i.left,n)||e(i.right,n);if("record"===i.type||"map"===i.type)return e(i.keyType,n)||e(i.valueType,n);if("pipe"===i.type)return!!t._zod.traits.has("$ZodCodec")||e(i.in,n)||e(i.out,n);if("object"===i.type){for(let t in i.shape)if(e(i.shape[t],n))return!0;return!1}if("union"===i.type){for(let t of i.options)if(e(t,n))return!0;return!1}if("tuple"===i.type){for(let t of i.items)if(e(t,n))return!0;if(i.rest&&e(i.rest,n))return!0}return!1}(e)&&(delete o.schema.examples,delete o.schema.default),"input"===t.io&&"_prefault"in o.schema&&((n=o.schema).default??(n.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function nF(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let t of e.seen.entries()){let r=e.metadataRegistry.get(t[0])?.id;if(r){let e=n.get(r);if(e&&e!==t[0])throw Error(`Duplicate schema id "${r}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(r,t[0])}}let i=t=>{if(t[1].schema.$ref)return;let n=t[1],{ref:i,defId:a}=(t=>{let n="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){let r=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(r)return{ref:i(r)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i("__shared")}#/${n}/${a}`}}if(t[1]===r)return{ref:"#"};let i=`#/${n}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}})(t);n.def={...n.schema},a&&(n.defId=a);let o=n.schema;for(let e in o)delete o[e];o.$ref=i};if("throw"===e.cycles)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>
61
61
 
62
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let r of e.seen.entries()){let n=r[1];if(t===r[0]){i(r);continue}if(e.external){let n=e.external.registry.get(r[0])?.id;if(t!==r[0]&&n){i(r);continue}}if(e.metadataRegistry.get(r[0])?.id||n.cycle||n.count>1&&"ref"===e.reused){i(r);continue}}}function nJ(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=t=>{let r=e.seen.get(t);if(null===r.ref)return;let i=r.def??r.schema,a={...i},o=r.ref;if(r.ref=null,o){n(o);let r=e.seen.get(o),s=r.schema;if(s.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)"$ref"!==e&&"allOf"!==e&&(e in a||delete i[e]);if(s.$ref&&r.def)for(let e in i)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(i[e])===JSON.stringify(r.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){n(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:r.path??[]})};for(let t of[...e.seen.entries()].reverse())n(t[0]);let i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let r=e.external.registry.get(t)?.id;if(!r)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(r)}Object.assign(i,r.def??r.schema);let a=e.metadataRegistry.get(t)?.id;void 0!==a&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?i.$defs=o:i.definitions=o);try{let r=JSON.parse(JSON.stringify(i));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:nZ(t,"input",e.processors),output:nZ(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw Error("Error converting schema to JSON.")}}let nZ=(e,t,r={})=>n=>{let{libraryOptions:i,target:a}=n??{},o=nK({...i??{},target:a,io:t,processors:r});return nW(e,o),nF(o,e),nJ(o,e)},nG={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},nQ=(e,t,r,n)=>{let i=e._zod.def;nW(i.innerType,t,n),t.seen.get(e).ref=i.innerType},nY=e_("ZodISODateTime",(e,t)=>{rD.init(e,t),ip.init(e,t)}),nX=e_("ZodISODate",(e,t)=>{rL.init(e,t),ip.init(e,t)}),n0=e_("ZodISOTime",(e,t)=>{r$.init(e,t),ip.init(e,t)}),n1=e_("ZodISODuration",(e,t)=>{rz.init(e,t),ip.init(e,t)}),n2=e_("ZodError",(e,t)=>{rl.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>(function(e,t=e=>e.message){let r={_errors:[]},n=(e,i=[])=>{for(let a of e.issues)if("invalid_union"===a.code&&a.errors.length)a.errors.map(e=>n({issues:e},[...i,...a.path]));else if("invalid_key"===a.code)n({issues:a.issues},[...i,...a.path]);else if("invalid_element"===a.code)n({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(0===e.length)r._errors.push(t(a));else{let n=r,i=0;for(;i<e.length;){let r=e[i];i===e.length-1?(n[r]=n[r]||{_errors:[]},n[r]._errors.push(t(a))):n[r]=n[r]||{_errors:[]},n=n[r],i++}}}};return n(e),r})(e,t)},flatten:{value:t=>(function(e,t=e=>e.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}})(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,eU,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,eU,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),n5=ru(n2),n6=rf(n2),n4=rm(n2),n8=rg(n2),n3=(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return ru(n2)(e,t,n)},n9=(e,t,r)=>ru(n2)(e,t,r),n7=async(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return rf(n2)(e,t,n)},ie=async(e,t,r)=>rf(n2)(e,t,r),it=(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return rm(n2)(e,t,n)},ir=(e,t,r)=>rm(n2)(e,t,r),ii=async(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return rg(n2)(e,t,n)},ia=async(e,t,r)=>rg(n2)(e,t,r),io=new WeakMap;function is(e,t,r){let n=Object.getPrototypeOf(e),i=io.get(n);if(i||(i=new Set,io.set(n,i)),!i.has(t))for(let e in i.add(t),r){let t=r[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,get(){let r=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:r}),r},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}let ic=e_("ZodType",(e,t)=>(rA.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:nZ(e,"input"),output:nZ(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{let n=nK({...r,processors:t});return nW(e,n),nF(n,e),nJ(n,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,r)=>n5(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>n4(e,t,r),e.parseAsync=async(t,r)=>n6(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>n8(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>n3(e,t,r),e.decode=(t,r)=>n9(e,t,r),e.encodeAsync=async(t,r)=>n7(e,t,r),e.decodeAsync=async(t,r)=>ie(e,t,r),e.safeEncode=(t,r)=>it(e,t,r),e.safeDecode=(t,r)=>ir(e,t,r),e.safeEncodeAsync=async(t,r)=>ii(e,t,r),e.safeDecodeAsync=async(t,r)=>ia(e,t,r),is(e,"ZodType",{check(...e){let t=this.def;return this.clone(nV.mergeDefs(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return eJ(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return new aa({type:"custom",check:"custom",fn:e,...eZ(t)})}(e,t))},superRefine(e,t){return this.check(function(e,t){var r;let n,i;return r=t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(e3(e,t.value,n._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=t.value),e.inst??(e.inst=n),e.continue??(e.continue=!n._zod.def.abort),t.issues.push(e3(e)))},e(t.value,t)),(i=new tG({check:"custom",...eZ(t)}))._zod.check=r,n=i}(e,t))},overwrite(e){return this.check(nM(e))},optional(){return i6(this)},exactOptional(){var e;return e=this,new i4({type:"optional",innerType:e})},nullable(){return i3(this)},nullish(){return i6(i3(this))},nonoptional(e){var t,r;return t=this,r=e,new ae({type:"nonoptional",innerType:t,...nV.normalizeParams(r)})},array(){return iF(this)},or(e){return new iG({type:"union",options:[this,e],...nV.normalizeParams(void 0)})},and(e){var t;return t=this,new iQ({type:"intersection",left:t,right:e})},transform(e){return an(this,new i2({type:"transform",transform:e}))},default(e){var t,r;return t=this,r=e,new i9({type:"default",innerType:t,get defaultValue(){return"function"==typeof r?r():nV.shallowClone(r)}})},prefault(e){var t,r;return t=this,r=e,new i7({type:"prefault",innerType:t,get defaultValue(){return"function"==typeof r?r():nV.shallowClone(r)}})},catch(e){var t,r;return t=this,new at({type:"catch",innerType:t,catchValue:"function"==typeof(r=e)?r:()=>r})},pipe(e){return an(this,e)},readonly(){var e;return e=this,new ai({type:"readonly",innerType:e})},describe(e){let t=this.clone();return nU.add(t,{description:e}),t},meta(...e){if(0===e.length)return nU.get(this);let t=this.clone();return nU.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>nU.get(e)?.description,configurable:!0}),e)),il=e_("_ZodString",(e,t)=>{rE.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{r.type="string";let{minimum:i,maximum:a,format:o,patterns:s,contentEncoding:c}=e._zod.bag;if("number"==typeof i&&(r.minLength=i),"number"==typeof a&&(r.maxLength=a),o&&(r.format=nG[o]??o,""===r.format&&delete r.format,"time"===o&&delete r.format),c&&(r.contentEncoding=c),s&&s.size>0){let e=[...s];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,r,0);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,is(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new re({check:"string_format",format:"regex",...eZ(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new rn({check:"string_format",format:"includes",...eZ(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new ri({check:"string_format",format:"starts_with",...eZ(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new ra({check:"string_format",format:"ends_with",...eZ(t),suffix:e})}(...e))},min(...e){return this.check(nB(...e))},max(...e){return this.check(nH(...e))},length(...e){return this.check(nq(...e))},nonempty(...e){return this.check(nB(1,...e))},lowercase(e){return this.check(new rt({check:"string_format",format:"lowercase",...eZ(e)}))},uppercase(e){return this.check(new rr({check:"string_format",format:"uppercase",...eZ(e)}))},trim(){return this.check(nM(e=>e.trim()))},normalize(...e){return this.check(function(e){return nM(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(nM(e=>e.toLowerCase()))},toUpperCase(){return this.check(nM(e=>e.toUpperCase()))},slugify(){return this.check(nM(e=>eH(e)))}})}),id=e_("ZodString",(e,t)=>{rE.init(e,t),il.init(e,t),e.email=t=>e.check(nO(ih,t)),e.url=t=>e.check(new ig({type:"string",format:"url",check:"string_format",abort:!1,...eZ(t)})),e.jwt=t=>e.check(new iP({type:"string",format:"jwt",check:"string_format",abort:!1,...eZ(t)})),e.emoji=t=>e.check(new iw({type:"string",format:"emoji",check:"string_format",abort:!1,...eZ(t)})),e.guid=t=>e.check(nP(im,t)),e.uuid=t=>e.check(new iy({type:"string",format:"uuid",check:"string_format",abort:!1,...eZ(t)})),e.uuidv4=t=>e.check(new iy({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...eZ(t)})),e.uuidv6=t=>e.check(new iy({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...eZ(t)})),e.uuidv7=t=>e.check(new iy({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...eZ(t)})),e.nanoid=t=>e.check(new ib({type:"string",format:"nanoid",check:"string_format",abort:!1,...eZ(t)})),e.guid=t=>e.check(nP(im,t)),e.cuid=t=>e.check(new iA({type:"string",format:"cuid",check:"string_format",abort:!1,...eZ(t)})),e.cuid2=t=>e.check(new iE({type:"string",format:"cuid2",check:"string_format",abort:!1,...eZ(t)})),e.ulid=t=>e.check(new iv({type:"string",format:"ulid",check:"string_format",abort:!1,...eZ(t)})),e.base64=t=>e.check(new iI({type:"string",format:"base64",check:"string_format",abort:!1,...eZ(t)})),e.base64url=t=>e.check(new iU({type:"string",format:"base64url",check:"string_format",abort:!1,...eZ(t)})),e.xid=t=>e.check(new ik({type:"string",format:"xid",check:"string_format",abort:!1,...eZ(t)})),e.ksuid=t=>e.check(new i_({type:"string",format:"ksuid",check:"string_format",abort:!1,...eZ(t)})),e.ipv4=t=>e.check(nC(iS,t)),e.ipv6=t=>e.check(nD(ix,t)),e.cidrv4=t=>e.check(new iR({type:"string",format:"cidrv4",check:"string_format",abort:!1,...eZ(t)})),e.cidrv6=t=>e.check(new iT({type:"string",format:"cidrv6",check:"string_format",abort:!1,...eZ(t)})),e.e164=t=>e.check(new iO({type:"string",format:"e164",check:"string_format",abort:!1,...eZ(t)})),e.datetime=t=>e.check(new nY({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...eZ(t)})),e.date=t=>e.check(new nX({type:"string",format:"date",check:"string_format",...eZ(t)})),e.time=t=>e.check(new n0({type:"string",format:"time",check:"string_format",precision:null,...eZ(t)})),e.duration=t=>e.check(new n1({type:"string",format:"duration",check:"string_format",...eZ(t)}))});function iu(e){return new id({type:"string",...eZ(e)})}let ip=e_("ZodStringFormat",(e,t)=>{rv.init(e,t),il.init(e,t)}),ih=e_("ZodEmail",(e,t)=>{rS.init(e,t),ip.init(e,t)}),im=e_("ZodGUID",(e,t)=>{rk.init(e,t),ip.init(e,t)}),iy=e_("ZodUUID",(e,t)=>{r_.init(e,t),ip.init(e,t)}),ig=e_("ZodURL",(e,t)=>{rx.init(e,t),ip.init(e,t)}),iw=e_("ZodEmoji",(e,t)=>{rR.init(e,t),ip.init(e,t)}),ib=e_("ZodNanoID",(e,t)=>{rT.init(e,t),ip.init(e,t)}),iA=e_("ZodCUID",(e,t)=>{rI.init(e,t),ip.init(e,t)}),iE=e_("ZodCUID2",(e,t)=>{rU.init(e,t),ip.init(e,t)}),iv=e_("ZodULID",(e,t)=>{rO.init(e,t),ip.init(e,t)}),ik=e_("ZodXID",(e,t)=>{rP.init(e,t),ip.init(e,t)}),i_=e_("ZodKSUID",(e,t)=>{rC.init(e,t),ip.init(e,t)}),iS=e_("ZodIPv4",(e,t)=>{rN.init(e,t),ip.init(e,t)}),ix=e_("ZodIPv6",(e,t)=>{rj.init(e,t),ip.init(e,t)}),iR=e_("ZodCIDRv4",(e,t)=>{rH.init(e,t),ip.init(e,t)}),iT=e_("ZodCIDRv6",(e,t)=>{rB.init(e,t),ip.init(e,t)}),iI=e_("ZodBase64",(e,t)=>{rM.init(e,t),ip.init(e,t)}),iU=e_("ZodBase64URL",(e,t)=>{rV.init(e,t),ip.init(e,t)}),iO=e_("ZodE164",(e,t)=>{rK.init(e,t),ip.init(e,t)}),iP=e_("ZodJWT",(e,t)=>{rW.init(e,t),ip.init(e,t)}),iC=e_("ZodNumber",(e,t)=>{rF.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{let{minimum:i,maximum:a,format:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l}=e._zod.bag;"string"==typeof o&&o.includes("int")?r.type="integer":r.type="number";let d="number"==typeof l&&l>=(i??-1/0),u="number"==typeof c&&c<=(a??1/0),p="draft-04"===t.target||"openapi-3.0"===t.target;d?p?(r.minimum=l,r.exclusiveMinimum=!0):r.exclusiveMinimum=l:"number"==typeof i&&(r.minimum=i),u?p?(r.maximum=c,r.exclusiveMaximum=!0):r.exclusiveMaximum=c:"number"==typeof a&&(r.maximum=a),"number"==typeof s&&(r.multipleOf=s)})(e,t,r,0),is(e,"ZodNumber",{gt(e,t){return this.check(nz(e,t))},gte(e,t){return this.check(nN(e,t))},min(e,t){return this.check(nN(e,t))},lt(e,t){return this.check(nL(e,t))},lte(e,t){return this.check(n$(e,t))},max(e,t){return this.check(n$(e,t))},int(e){return this.check(i$(e))},safe(e){return this.check(i$(e))},positive(e){return this.check(nz(0,e))},nonnegative(e){return this.check(nN(0,e))},negative(e){return this.check(nL(0,e))},nonpositive(e){return this.check(n$(0,e))},multipleOf(e,t){return this.check(nj(e,t))},step(e,t){return this.check(nj(e,t))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??-1/0,r.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(r.maximum??1/0,r.exclusiveMaximum??1/0)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function iD(e){return new iC({type:"number",checks:[],...eZ(e)})}let iL=e_("ZodNumberFormat",(e,t)=>{rJ.init(e,t),iC.init(e,t)});function i$(e){return new iL({type:"number",check:"number_format",abort:!1,format:"safeint",...eZ(e)})}let iz=e_("ZodBoolean",(e,t)=>{rZ.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{t.type="boolean"}});function iN(e){return new iz({type:"boolean",...eZ(e)})}let ij=e_("ZodBigInt",(e,t)=>{rG.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("BigInt cannot be represented in JSON Schema")})(0,e,0,0),e.gte=(t,r)=>e.check(nN(t,r)),e.min=(t,r)=>e.check(nN(t,r)),e.gt=(t,r)=>e.check(nz(t,r)),e.gte=(t,r)=>e.check(nN(t,r)),e.min=(t,r)=>e.check(nN(t,r)),e.lt=(t,r)=>e.check(nL(t,r)),e.lte=(t,r)=>e.check(n$(t,r)),e.max=(t,r)=>e.check(n$(t,r)),e.positive=t=>e.check(nz(BigInt(0),t)),e.negative=t=>e.check(nL(BigInt(0),t)),e.nonpositive=t=>e.check(n$(BigInt(0),t)),e.nonnegative=t=>e.check(nN(BigInt(0),t)),e.multipleOf=(t,r)=>e.check(nj(t,r));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null}),iH=e_("ZodAny",(e,t)=>{rQ.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function iB(){return new iH({type:"any"})}let iq=e_("ZodUnknown",(e,t)=>{rY.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function iM(){return new iq({type:"unknown"})}let iV=e_("ZodNever",(e,t)=>{rX.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{t.not={}}}),iK=e_("ZodDate",(e,t)=>{r0.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Date cannot be represented in JSON Schema")})(0,e,0,0),e.min=(t,r)=>e.check(nN(t,r)),e.max=(t,r)=>e.check(n$(t,r));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null}),iW=e_("ZodArray",(e,t)=>{r2.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{let i=e._zod.def,{minimum:a,maximum:o}=e._zod.bag;"number"==typeof a&&(r.minItems=a),"number"==typeof o&&(r.maxItems=o),r.type="array",r.items=nW(i.element,t,{...n,path:[...n.path,"items"]})})(e,t,r,n),e.element=t.element,is(e,"ZodArray",{min(e,t){return this.check(nB(e,t))},nonempty(e){return this.check(nB(1,e))},max(e,t){return this.check(nH(e,t))},length(e,t){return this.check(nq(e,t))},unwrap(){return this.element}})});function iF(e,t){return new iW({type:"array",element:e,...eZ(t)})}let iJ=e_("ZodObject",(e,t)=>{r3.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{let i=e._zod.def;r.type="object",r.properties={};let a=i.shape;for(let e in a)r.properties[e]=nW(a[e],t,{...n,path:[...n.path,"properties",e]});let o=new Set([...new Set(Object.keys(a))].filter(e=>{let r=i.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));o.size>0&&(r.required=Array.from(o)),i.catchall?._zod.def.type==="never"?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=nW(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(r.additionalProperties=!1)})(e,t,r,n),nV.defineLazy(e,"shape",()=>t.shape),is(e,"ZodObject",{keyof(){return i1(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:iM()})},loose(){return this.clone({...this._zod.def,catchall:iM()})},strict(){return this.clone({...this._zod.def,catchall:new iV({type:"never",...eZ(void 0)})})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return nV.extend(this,e)},safeExtend(e){return nV.safeExtend(this,e)},merge(e){return nV.merge(this,e)},pick(e){return nV.pick(this,e)},omit(e){return nV.omit(this,e)},partial(...e){return nV.partial(i5,this,e[0])},required(...e){return nV.required(ae,this,e[0])}})});function iZ(e,t){return new iJ({type:"object",shape:e??{},...nV.normalizeParams(t)})}let iG=e_("ZodUnion",(e,t)=>{r7.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{var i,a,o,s;let c,l,d;return i=e,a=t,o=r,s=n,l=!1===(c=i._zod.def).inclusive,d=c.options.map((e,t)=>nW(e,a,{...s,path:[...s.path,l?"oneOf":"anyOf",t]})),void(l?o.oneOf=d:o.anyOf=d)},e.options=t.options}),iQ=e_("ZodIntersection",(e,t)=>{nt.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i,a,o,s;return a=nW((i=e._zod.def).left,t,{...n,path:[...n.path,"allOf",0]}),o=nW(i.right,t,{...n,path:[...n.path,"allOf",1]}),void(r.allOf=[...(s=e=>"allOf"in e&&1===Object.keys(e).length)(a)?a.allOf:[a],...s(o)?o.allOf:[o]])}}),iY=e_("ZodRecord",(e,t)=>{ns.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{let i=e._zod.def;r.type="object";let a=i.keyType,o=a._zod.bag,s=o?.patterns;if("loose"===i.mode&&s&&s.size>0){let e=nW(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});for(let t of(r.patternProperties={},s))r.patternProperties[t.source]=e}else("draft-07"===t.target||"draft-2020-12"===t.target)&&(r.propertyNames=nW(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),r.additionalProperties=nW(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let c=a._zod.values;if(c){let e=[...c].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(r.required=e)}})(e,t,r,n),e.keyType=t.keyType,e.valueType=t.valueType});function iX(e,t,r){return new iY(t&&t._zod?{type:"record",keyType:e,valueType:t,...nV.normalizeParams(r)}:{type:"record",keyType:iu(),valueType:e,...nV.normalizeParams(t)})}let i0=e_("ZodEnum",(e,t)=>{nd.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i;(i=eI(e._zod.def.entries)).every(e=>"number"==typeof e)&&(r.type="number"),i.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=i},e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(e,n)=>{let i={};for(let n of e)if(r.has(n))i[n]=t.entries[n];else throw Error(`Key ${n} not found in enum`);return new i0({...t,checks:[],...nV.normalizeParams(n),entries:i})},e.exclude=(e,n)=>{let i={...t.entries};for(let t of e)if(r.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new i0({...t,checks:[],...nV.normalizeParams(n),entries:i})}});function i1(e,t){return new i0({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...nV.normalizeParams(t)})}let i2=e_("ZodTransform",(e,t)=>{nu.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")})(0,e,0,0),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new ex(e.constructor.name);r.addIssue=n=>{"string"==typeof n?r.issues.push(nV.issue(n,r.value,t)):(n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=e),r.issues.push(nV.issue(n)))};let i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r.fallback=!0,r)):(r.value=i,r.fallback=!0,r)}}),i5=e_("ZodOptional",(e,t)=>{nf.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>nQ(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function i6(e){return new i5({type:"optional",innerType:e})}let i4=e_("ZodExactOptional",(e,t)=>{nh.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>nQ(e,t,r,n),e.unwrap=()=>e._zod.def.innerType}),i8=e_("ZodNullable",(e,t)=>{nm.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i,a,o;return a=nW((i=e._zod.def).innerType,t,n),o=t.seen.get(e),void("openapi-3.0"===t.target?(o.ref=i.innerType,r.nullable=!0):r.anyOf=[a,{type:"null"}])},e.unwrap=()=>e._zod.def.innerType});function i3(e){return new i8({type:"nullable",innerType:e})}let i9=e_("ZodDefault",(e,t)=>{ny.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i;nW((i=e._zod.def).innerType,t,n),t.seen.get(e).ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),i7=e_("ZodPrefault",(e,t)=>{nw.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i;nW((i=e._zod.def).innerType,t,n),t.seen.get(e).ref=i.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},e.unwrap=()=>e._zod.def.innerType}),ae=e_("ZodNonOptional",(e,t)=>{nb.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i;nW((i=e._zod.def).innerType,t,n),t.seen.get(e).ref=i.innerType},e.unwrap=()=>e._zod.def.innerType}),at=e_("ZodCatch",(e,t)=>{nE.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{let i,a=e._zod.def;nW(a.innerType,t,n),t.seen.get(e).ref=a.innerType;try{i=a.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),ar=e_("ZodPipe",(e,t)=>{nv.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i,a,o;return a=(i=e._zod.def).in._zod.traits.has("$ZodTransform"),void(nW(o="input"===t.io?a?i.out:i.in:i.out,t,n),t.seen.get(e).ref=o)},e.in=t.in,e.out=t.out});function an(e,t){return new ar({type:"pipe",in:e,out:t})}let ai=e_("ZodReadonly",(e,t)=>{nx.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i;nW((i=e._zod.def).innerType,t,n),t.seen.get(e).ref=i.innerType,r.readOnly=!0},e.unwrap=()=>e._zod.def.innerType}),aa=e_("ZodCustom",(e,t)=>{nT.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")})(0,e,0,0)}),ao={};function as(e){switch(e.constructor.name){case"ZodString":default:return"string";case"ZodNumber":return"number";case"ZodBoolean":return"boolean";case"ZodObject":return"object";case"ZodArray":return"array"}}function ac(e){let t=[];return e.metadata?.openapi?.parameters?t.push(...e.metadata.openapi.parameters):e.query instanceof iJ&&Object.entries(e.query.shape).forEach(([e,r])=>{r instanceof iJ&&t.push({name:e,in:"query",schema:{type:as(r),..."minLength"in r&&r.minLength?{minLength:r.minLength}:{},description:r.description}})}),t}function al(e){return{400:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}},required:["message"]}}},description:"Bad Request. Usually due to missing parameters, or invalid parameters."},401:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}},required:["message"]}}},description:"Unauthorized. Due to missing or invalid authentication."},403:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}}}}},description:"Forbidden. You do not have permission to access this resource or to perform this action."},404:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}}}}},description:"Not Found. The requested resource was not found."},429:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}}}}},description:"Too Many Requests. You have exceeded the rate limit. Try again later."},500:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}}}}},description:"Internal Server Error. This is a problem with the server that you cannot fix."},...e}}async function ad(e,t){return Object.entries(e).forEach(([e,t])=>{let r=t.options;if(!(!t.path||r.metadata?.SERVER_ONLY)&&("GET"===r.method&&(ao[t.path]={get:{tags:["Default",...r.metadata?.openapi?.tags||[]],description:r.metadata?.openapi?.description,operationId:r.metadata?.openapi?.operationId,security:[{bearerAuth:[]}],parameters:ac(r),responses:al(r.metadata?.openapi?.responses)}}),"POST"===r.method)){let e=function(e){if(e.metadata?.openapi?.requestBody)return e.metadata.openapi.requestBody;if(e.body&&(e.body instanceof iJ||e.body instanceof i5)){let t=e.body.shape;if(!t)return;let r={},n=[];return Object.entries(t).forEach(([e,t])=>{t instanceof iJ&&(r[e]={type:as(t),description:t.description},t instanceof i5||n.push(e))}),{required:!(e.body instanceof i5)&&!!e.body,content:{"application/json":{schema:{type:"object",properties:r,required:n}}}}}}(r);ao[t.path]={post:{tags:["Default",...r.metadata?.openapi?.tags||[]],description:r.metadata?.openapi?.description,operationId:r.metadata?.openapi?.operationId,security:[{bearerAuth:[]}],parameters:ac(r),...e?{requestBody:e}:{requestBody:{content:{"application/json":{schema:{type:"object",properties:{}}}}}},responses:al(r.metadata?.openapi?.responses)}}}}),{openapi:"3.1.1",info:{title:"Better Auth",description:"API Reference for your Better Auth Instance",version:"1.1.0"},components:{schemas:{}},security:[{apiKeyCookie:[]}],servers:[{url:t?.url}],tags:[{name:"Default",description:"Default endpoints that are included with Better Auth by default. These endpoints are not part of any plugin."}],paths:ao}}let au=((o=function(){}).prototype=Object.create(null),Object.freeze(o.prototype),o);function ap(){return{root:{key:""},static:new au}}function af(e){let[t,...r]=e.split("/");return""===r[r.length-1]?r.slice(0,-1):r}function ah(e,t){let r=new au;for(let[n,i]of t){let t=n<0?e.slice(-(n+1)).join("/"):e[n];if("string"==typeof i)r[i]=t;else{let e=t.match(i);if(e)for(let t in e.groups)r[t]=e.groups[t]}}return r}function am(e,t="",r,n){t=t.toUpperCase(),47!==r.charCodeAt(0)&&(r=`/${r}`);let i=af(r=r.replace(/\\:/g,"%3A")),a=e.root,o=0,s=[],c=[];for(let e=0;e<i.length;e++){let t=i[e];if(t.startsWith("**")){a.wildcard||(a.wildcard={key:"**"}),a=a.wildcard,s.push([-(e+1),t.split(":")[1]||"_",2===t.length]);break}if("*"===t||t.includes(":")){if(a.param||(a.param={key:"*"}),a=a.param,"*"===t)s.push([e,`_${o++}`,!0]);else if(t.includes(":",1)){let r=function(e){let t=e.replace(/:(\w+)/g,(e,t)=>`(?<${t}>[^/]+)`).replace(/\./g,"\\.");return RegExp(`^${t}$`)}(t);c[e]=r,a.hasRegexParam=!0,s.push([e,r,!1])}else s.push([e,t.slice(1),!1]);continue}"\\*"===t?t=i[e]="*":"\\*\\*"===t&&(t=i[e]="**");let r=a.static?.[t];if(r)a=r;else{let e={key:t};a.static||(a.static=new au),a.static[t]=e,a=e}}let l=s.length>0;a.methods||(a.methods=new au),a.methods[t]??=[],a.methods[t].push({data:n||null,paramsRegexp:c,paramsMap:l?s:void 0}),l||(e.static["/"+i.join("/")]=a)}function ay(e){return e instanceof X.APIError||e instanceof Y.APIError||e?.name==="APIError"}let ag=ek(async()=>({})),aw=ek.create({use:[ag,ek(async()=>({}))]}),ab=[ag];function aA(e,t,r){let n="string"==typeof e?e:void 0,i="object"==typeof t?t:e,a="function"==typeof t?t:r,o=async e=>{try{return await Q(e,()=>a(e))}catch(r){var t;throw t=e.responseHeaders,ay(r)&&t&&Object.defineProperty(r,X.kAPIErrorHeaderSymbol,{enumerable:!1,configurable:!0,value:t,writable:!1}),r}};return n?ev(n,{...i,use:[...i?.use||[],...ab]},o):ev({...i,use:[...i?.use||[],...ab]},o)}aA.serverOnly=(e,t)=>aA({...e,metadata:{...e.metadata,SERVER_ONLY:!0}},t);var aE=e.i(89551),av=e.i(12714),ak=e.i(50227),a_=e.i(43651),aS=e.i(80527);async function ax(t,r){let n;if(t.database)n="function"==typeof t.database?t.database(t):await r(t);else{let r=Object.keys((0,a_.getAuthTables)(t)).reduce((e,t)=>(e[t]=[],e),{}),{memoryAdapter:i}=await e.A(16432);n=i(r)(t)}return n.transaction||(aS.logger.warn("Adapter does not correctly implement transaction function, patching it automatically. Please update your adapter implementation."),n.transaction=async e=>e(n)),n}async function aR(t){return ax(t,async t=>{let{createKyselyAdapter:r}=await e.A(92291),{kysely:n,databaseType:i,transaction:a}=await r(t);if(!n)throw new Y.BetterAuthError("Failed to initialize database adapter");let{kyselyAdapter:o}=await e.A(92291);return o(n,{type:i||"sqlite",debugLogs:!!t.database&&"debugLogs"in t.database&&t.database.debugLogs,transaction:a})(t)})}var aT=e.i(13906),aI=e.i(15272),aU=e.i(97495),aO=e.i(29401);let aP={postgres:{string:["character varying","varchar","text","uuid"],number:["int4","integer","bigint","smallint","numeric","real","double precision"],boolean:["bool","boolean"],date:["timestamptz","timestamp","date"],json:["json","jsonb"]},mysql:{string:["varchar","text","uuid"],number:["integer","int","bigint","smallint","decimal","float","double"],boolean:["boolean","tinyint"],date:["timestamp","datetime","date"],json:["json"]},sqlite:{string:["TEXT"],number:["INTEGER","REAL"],boolean:["INTEGER","BOOLEAN"],date:["DATE","INTEGER"],json:["TEXT"]},mssql:{string:["varchar","nvarchar","uniqueidentifier"],number:["int","bigint","smallint","decimal","float","double"],boolean:["bit","smallint"],date:["datetime2","date","datetime"],json:["varchar","nvarchar"]}};async function aC(e){try{let t=await aO.sql`SHOW search_path`.execute(e),r=t.rows[0]?.search_path??t.rows[0]?.searchPath;if(r)return r.split(",").map(e=>e.trim()).map(e=>e.replace(/^["']|["']$/g,"")).filter(e=>!e.startsWith("$")&&!e.startsWith("\\$"))[0]||"public"}catch{}return"public"}async function aD(e){let t=function(e){let t=(0,a_.getAuthTables)(e),r={};for(let e in t){let n=t[e],i=n.fields,a={};if(Object.entries(i).forEach(([e,r])=>{if(a[r.fieldName||e]=r,r.references){let n=t[r.references.model];n&&(a[r.fieldName||e].references={...r.references,model:n.modelName,field:r.references.field})}}),r[n.modelName]){r[n.modelName].fields={...r[n.modelName].fields,...a},n.disableMigrations&&(r[n.modelName].disableMigrations=!0);continue}r[n.modelName]={fields:a,order:n.order||1/0,disableMigrations:n.disableMigrations}}return r}(e),r=(0,aS.createLogger)(e.logger),{kysely:n,databaseType:i}=await (0,aT.createKyselyAdapter)(e);i||(r.warn("Could not determine database type, defaulting to sqlite. Please provide a type in the database options to avoid this."),i="sqlite"),n||(r.error("Only kysely adapter is supported for migrations. You can use `generate` command to generate the schema, if you're using a different adapter."),process.exit(1));let a="public";if("postgres"===i){a=await aC(n),r.debug(`PostgreSQL migration: Using schema '${a}' (from search_path)`);try{let e=await aO.sql`
62
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let r of e.seen.entries()){let n=r[1];if(t===r[0]){i(r);continue}if(e.external){let n=e.external.registry.get(r[0])?.id;if(t!==r[0]&&n){i(r);continue}}if(e.metadataRegistry.get(r[0])?.id||n.cycle||n.count>1&&"ref"===e.reused){i(r);continue}}}function nJ(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=t=>{let r=e.seen.get(t);if(null===r.ref)return;let i=r.def??r.schema,a={...i},o=r.ref;if(r.ref=null,o){n(o);let r=e.seen.get(o),s=r.schema;if(s.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)"$ref"!==e&&"allOf"!==e&&(e in a||delete i[e]);if(s.$ref&&r.def)for(let e in i)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(i[e])===JSON.stringify(r.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){n(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:r.path??[]})};for(let t of[...e.seen.entries()].reverse())n(t[0]);let i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let r=e.external.registry.get(t)?.id;if(!r)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(r)}Object.assign(i,r.def??r.schema);let a=e.metadataRegistry.get(t)?.id;void 0!==a&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?i.$defs=o:i.definitions=o);try{let r=JSON.parse(JSON.stringify(i));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:nZ(t,"input",e.processors),output:nZ(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw Error("Error converting schema to JSON.")}}let nZ=(e,t,r={})=>n=>{let{libraryOptions:i,target:a}=n??{},o=nK({...i??{},target:a,io:t,processors:r});return nW(e,o),nF(o,e),nJ(o,e)},nG={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},nQ=(e,t,r,n)=>{let i=e._zod.def;nW(i.innerType,t,n),t.seen.get(e).ref=i.innerType},nY=e_("ZodISODateTime",(e,t)=>{rD.init(e,t),ip.init(e,t)}),nX=e_("ZodISODate",(e,t)=>{rL.init(e,t),ip.init(e,t)}),n0=e_("ZodISOTime",(e,t)=>{r$.init(e,t),ip.init(e,t)}),n1=e_("ZodISODuration",(e,t)=>{rz.init(e,t),ip.init(e,t)}),n2=e_("ZodError",(e,t)=>{rl.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>(function(e,t=e=>e.message){let r={_errors:[]},n=(e,i=[])=>{for(let a of e.issues)if("invalid_union"===a.code&&a.errors.length)a.errors.map(e=>n({issues:e},[...i,...a.path]));else if("invalid_key"===a.code)n({issues:a.issues},[...i,...a.path]);else if("invalid_element"===a.code)n({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(0===e.length)r._errors.push(t(a));else{let n=r,i=0;for(;i<e.length;){let r=e[i];i===e.length-1?(n[r]=n[r]||{_errors:[]},n[r]._errors.push(t(a))):n[r]=n[r]||{_errors:[]},n=n[r],i++}}}};return n(e),r})(e,t)},flatten:{value:t=>(function(e,t=e=>e.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}})(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,eU,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,eU,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),n5=ru(n2),n6=rf(n2),n4=rm(n2),n8=rg(n2),n3=(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return ru(n2)(e,t,n)},n9=(e,t,r)=>ru(n2)(e,t,r),n7=async(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return rf(n2)(e,t,n)},ie=async(e,t,r)=>rf(n2)(e,t,r),it=(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return rm(n2)(e,t,n)},ir=(e,t,r)=>rm(n2)(e,t,r),ii=async(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return rg(n2)(e,t,n)},ia=async(e,t,r)=>rg(n2)(e,t,r),io=new WeakMap;function is(e,t,r){let n=Object.getPrototypeOf(e),i=io.get(n);if(i||(i=new Set,io.set(n,i)),!i.has(t))for(let e in i.add(t),r){let t=r[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,get(){let r=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:r}),r},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}let ic=e_("ZodType",(e,t)=>(rA.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:nZ(e,"input"),output:nZ(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{let n=nK({...r,processors:t});return nW(e,n),nF(n,e),nJ(n,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,r)=>n5(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>n4(e,t,r),e.parseAsync=async(t,r)=>n6(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>n8(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>n3(e,t,r),e.decode=(t,r)=>n9(e,t,r),e.encodeAsync=async(t,r)=>n7(e,t,r),e.decodeAsync=async(t,r)=>ie(e,t,r),e.safeEncode=(t,r)=>it(e,t,r),e.safeDecode=(t,r)=>ir(e,t,r),e.safeEncodeAsync=async(t,r)=>ii(e,t,r),e.safeDecodeAsync=async(t,r)=>ia(e,t,r),is(e,"ZodType",{check(...e){let t=this.def;return this.clone(nV.mergeDefs(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return eJ(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return new aa({type:"custom",check:"custom",fn:e,...eZ(t)})}(e,t))},superRefine(e,t){return this.check(function(e,t){var r;let n,i;return r=t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(e3(e,t.value,n._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=t.value),e.inst??(e.inst=n),e.continue??(e.continue=!n._zod.def.abort),t.issues.push(e3(e)))},e(t.value,t)),(i=new tG({check:"custom",...eZ(t)}))._zod.check=r,n=i}(e,t))},overwrite(e){return this.check(nM(e))},optional(){return i6(this)},exactOptional(){var e;return e=this,new i4({type:"optional",innerType:e})},nullable(){return i3(this)},nullish(){return i6(i3(this))},nonoptional(e){var t,r;return t=this,r=e,new ae({type:"nonoptional",innerType:t,...nV.normalizeParams(r)})},array(){return iF(this)},or(e){return new iG({type:"union",options:[this,e],...nV.normalizeParams(void 0)})},and(e){var t;return t=this,new iQ({type:"intersection",left:t,right:e})},transform(e){return an(this,new i2({type:"transform",transform:e}))},default(e){var t,r;return t=this,r=e,new i9({type:"default",innerType:t,get defaultValue(){return"function"==typeof r?r():nV.shallowClone(r)}})},prefault(e){var t,r;return t=this,r=e,new i7({type:"prefault",innerType:t,get defaultValue(){return"function"==typeof r?r():nV.shallowClone(r)}})},catch(e){var t,r;return t=this,new at({type:"catch",innerType:t,catchValue:"function"==typeof(r=e)?r:()=>r})},pipe(e){return an(this,e)},readonly(){var e;return e=this,new ai({type:"readonly",innerType:e})},describe(e){let t=this.clone();return nU.add(t,{description:e}),t},meta(...e){if(0===e.length)return nU.get(this);let t=this.clone();return nU.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>nU.get(e)?.description,configurable:!0}),e)),il=e_("_ZodString",(e,t)=>{rE.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{r.type="string";let{minimum:i,maximum:a,format:o,patterns:s,contentEncoding:c}=e._zod.bag;if("number"==typeof i&&(r.minLength=i),"number"==typeof a&&(r.maxLength=a),o&&(r.format=nG[o]??o,""===r.format&&delete r.format,"time"===o&&delete r.format),c&&(r.contentEncoding=c),s&&s.size>0){let e=[...s];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,r,0);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,is(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new re({check:"string_format",format:"regex",...eZ(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new rn({check:"string_format",format:"includes",...eZ(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new ri({check:"string_format",format:"starts_with",...eZ(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new ra({check:"string_format",format:"ends_with",...eZ(t),suffix:e})}(...e))},min(...e){return this.check(nB(...e))},max(...e){return this.check(nH(...e))},length(...e){return this.check(nq(...e))},nonempty(...e){return this.check(nB(1,...e))},lowercase(e){return this.check(new rt({check:"string_format",format:"lowercase",...eZ(e)}))},uppercase(e){return this.check(new rr({check:"string_format",format:"uppercase",...eZ(e)}))},trim(){return this.check(nM(e=>e.trim()))},normalize(...e){return this.check(function(e){return nM(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(nM(e=>e.toLowerCase()))},toUpperCase(){return this.check(nM(e=>e.toUpperCase()))},slugify(){return this.check(nM(e=>eH(e)))}})}),id=e_("ZodString",(e,t)=>{rE.init(e,t),il.init(e,t),e.email=t=>e.check(nO(ih,t)),e.url=t=>e.check(new ig({type:"string",format:"url",check:"string_format",abort:!1,...eZ(t)})),e.jwt=t=>e.check(new iP({type:"string",format:"jwt",check:"string_format",abort:!1,...eZ(t)})),e.emoji=t=>e.check(new iw({type:"string",format:"emoji",check:"string_format",abort:!1,...eZ(t)})),e.guid=t=>e.check(nP(im,t)),e.uuid=t=>e.check(new iy({type:"string",format:"uuid",check:"string_format",abort:!1,...eZ(t)})),e.uuidv4=t=>e.check(new iy({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...eZ(t)})),e.uuidv6=t=>e.check(new iy({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...eZ(t)})),e.uuidv7=t=>e.check(new iy({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...eZ(t)})),e.nanoid=t=>e.check(new ib({type:"string",format:"nanoid",check:"string_format",abort:!1,...eZ(t)})),e.guid=t=>e.check(nP(im,t)),e.cuid=t=>e.check(new iA({type:"string",format:"cuid",check:"string_format",abort:!1,...eZ(t)})),e.cuid2=t=>e.check(new iE({type:"string",format:"cuid2",check:"string_format",abort:!1,...eZ(t)})),e.ulid=t=>e.check(new iv({type:"string",format:"ulid",check:"string_format",abort:!1,...eZ(t)})),e.base64=t=>e.check(new iI({type:"string",format:"base64",check:"string_format",abort:!1,...eZ(t)})),e.base64url=t=>e.check(new iU({type:"string",format:"base64url",check:"string_format",abort:!1,...eZ(t)})),e.xid=t=>e.check(new ik({type:"string",format:"xid",check:"string_format",abort:!1,...eZ(t)})),e.ksuid=t=>e.check(new i_({type:"string",format:"ksuid",check:"string_format",abort:!1,...eZ(t)})),e.ipv4=t=>e.check(nC(iS,t)),e.ipv6=t=>e.check(nD(ix,t)),e.cidrv4=t=>e.check(new iR({type:"string",format:"cidrv4",check:"string_format",abort:!1,...eZ(t)})),e.cidrv6=t=>e.check(new iT({type:"string",format:"cidrv6",check:"string_format",abort:!1,...eZ(t)})),e.e164=t=>e.check(new iO({type:"string",format:"e164",check:"string_format",abort:!1,...eZ(t)})),e.datetime=t=>e.check(new nY({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...eZ(t)})),e.date=t=>e.check(new nX({type:"string",format:"date",check:"string_format",...eZ(t)})),e.time=t=>e.check(new n0({type:"string",format:"time",check:"string_format",precision:null,...eZ(t)})),e.duration=t=>e.check(new n1({type:"string",format:"duration",check:"string_format",...eZ(t)}))});function iu(e){return new id({type:"string",...eZ(e)})}let ip=e_("ZodStringFormat",(e,t)=>{rv.init(e,t),il.init(e,t)}),ih=e_("ZodEmail",(e,t)=>{rS.init(e,t),ip.init(e,t)}),im=e_("ZodGUID",(e,t)=>{rk.init(e,t),ip.init(e,t)}),iy=e_("ZodUUID",(e,t)=>{r_.init(e,t),ip.init(e,t)}),ig=e_("ZodURL",(e,t)=>{rx.init(e,t),ip.init(e,t)}),iw=e_("ZodEmoji",(e,t)=>{rR.init(e,t),ip.init(e,t)}),ib=e_("ZodNanoID",(e,t)=>{rT.init(e,t),ip.init(e,t)}),iA=e_("ZodCUID",(e,t)=>{rI.init(e,t),ip.init(e,t)}),iE=e_("ZodCUID2",(e,t)=>{rU.init(e,t),ip.init(e,t)}),iv=e_("ZodULID",(e,t)=>{rO.init(e,t),ip.init(e,t)}),ik=e_("ZodXID",(e,t)=>{rP.init(e,t),ip.init(e,t)}),i_=e_("ZodKSUID",(e,t)=>{rC.init(e,t),ip.init(e,t)}),iS=e_("ZodIPv4",(e,t)=>{rN.init(e,t),ip.init(e,t)}),ix=e_("ZodIPv6",(e,t)=>{rj.init(e,t),ip.init(e,t)}),iR=e_("ZodCIDRv4",(e,t)=>{rH.init(e,t),ip.init(e,t)}),iT=e_("ZodCIDRv6",(e,t)=>{rB.init(e,t),ip.init(e,t)}),iI=e_("ZodBase64",(e,t)=>{rM.init(e,t),ip.init(e,t)}),iU=e_("ZodBase64URL",(e,t)=>{rV.init(e,t),ip.init(e,t)}),iO=e_("ZodE164",(e,t)=>{rK.init(e,t),ip.init(e,t)}),iP=e_("ZodJWT",(e,t)=>{rW.init(e,t),ip.init(e,t)}),iC=e_("ZodNumber",(e,t)=>{rF.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{let{minimum:i,maximum:a,format:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l}=e._zod.bag;"string"==typeof o&&o.includes("int")?r.type="integer":r.type="number";let d="number"==typeof l&&l>=(i??-1/0),u="number"==typeof c&&c<=(a??1/0),p="draft-04"===t.target||"openapi-3.0"===t.target;d?p?(r.minimum=l,r.exclusiveMinimum=!0):r.exclusiveMinimum=l:"number"==typeof i&&(r.minimum=i),u?p?(r.maximum=c,r.exclusiveMaximum=!0):r.exclusiveMaximum=c:"number"==typeof a&&(r.maximum=a),"number"==typeof s&&(r.multipleOf=s)})(e,t,r,0),is(e,"ZodNumber",{gt(e,t){return this.check(nz(e,t))},gte(e,t){return this.check(nN(e,t))},min(e,t){return this.check(nN(e,t))},lt(e,t){return this.check(nL(e,t))},lte(e,t){return this.check(n$(e,t))},max(e,t){return this.check(n$(e,t))},int(e){return this.check(i$(e))},safe(e){return this.check(i$(e))},positive(e){return this.check(nz(0,e))},nonnegative(e){return this.check(nN(0,e))},negative(e){return this.check(nL(0,e))},nonpositive(e){return this.check(n$(0,e))},multipleOf(e,t){return this.check(nj(e,t))},step(e,t){return this.check(nj(e,t))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??-1/0,r.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(r.maximum??1/0,r.exclusiveMaximum??1/0)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function iD(e){return new iC({type:"number",checks:[],...eZ(e)})}let iL=e_("ZodNumberFormat",(e,t)=>{rJ.init(e,t),iC.init(e,t)});function i$(e){return new iL({type:"number",check:"number_format",abort:!1,format:"safeint",...eZ(e)})}let iz=e_("ZodBoolean",(e,t)=>{rZ.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{t.type="boolean"}});function iN(e){return new iz({type:"boolean",...eZ(e)})}let ij=e_("ZodBigInt",(e,t)=>{rG.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("BigInt cannot be represented in JSON Schema")})(0,e,0,0),e.gte=(t,r)=>e.check(nN(t,r)),e.min=(t,r)=>e.check(nN(t,r)),e.gt=(t,r)=>e.check(nz(t,r)),e.gte=(t,r)=>e.check(nN(t,r)),e.min=(t,r)=>e.check(nN(t,r)),e.lt=(t,r)=>e.check(nL(t,r)),e.lte=(t,r)=>e.check(n$(t,r)),e.max=(t,r)=>e.check(n$(t,r)),e.positive=t=>e.check(nz(BigInt(0),t)),e.negative=t=>e.check(nL(BigInt(0),t)),e.nonpositive=t=>e.check(n$(BigInt(0),t)),e.nonnegative=t=>e.check(nN(BigInt(0),t)),e.multipleOf=(t,r)=>e.check(nj(t,r));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null}),iH=e_("ZodAny",(e,t)=>{rQ.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function iB(){return new iH({type:"any"})}let iq=e_("ZodUnknown",(e,t)=>{rY.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function iM(){return new iq({type:"unknown"})}let iV=e_("ZodNever",(e,t)=>{rX.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{t.not={}}}),iK=e_("ZodDate",(e,t)=>{r0.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Date cannot be represented in JSON Schema")})(0,e,0,0),e.min=(t,r)=>e.check(nN(t,r)),e.max=(t,r)=>e.check(n$(t,r));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null}),iW=e_("ZodArray",(e,t)=>{r2.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{let i=e._zod.def,{minimum:a,maximum:o}=e._zod.bag;"number"==typeof a&&(r.minItems=a),"number"==typeof o&&(r.maxItems=o),r.type="array",r.items=nW(i.element,t,{...n,path:[...n.path,"items"]})})(e,t,r,n),e.element=t.element,is(e,"ZodArray",{min(e,t){return this.check(nB(e,t))},nonempty(e){return this.check(nB(1,e))},max(e,t){return this.check(nH(e,t))},length(e,t){return this.check(nq(e,t))},unwrap(){return this.element}})});function iF(e,t){return new iW({type:"array",element:e,...eZ(t)})}let iJ=e_("ZodObject",(e,t)=>{r3.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{let i=e._zod.def;r.type="object",r.properties={};let a=i.shape;for(let e in a)r.properties[e]=nW(a[e],t,{...n,path:[...n.path,"properties",e]});let o=new Set([...new Set(Object.keys(a))].filter(e=>{let r=i.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));o.size>0&&(r.required=Array.from(o)),i.catchall?._zod.def.type==="never"?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=nW(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(r.additionalProperties=!1)})(e,t,r,n),nV.defineLazy(e,"shape",()=>t.shape),is(e,"ZodObject",{keyof(){return i1(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:iM()})},loose(){return this.clone({...this._zod.def,catchall:iM()})},strict(){return this.clone({...this._zod.def,catchall:new iV({type:"never",...eZ(void 0)})})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return nV.extend(this,e)},safeExtend(e){return nV.safeExtend(this,e)},merge(e){return nV.merge(this,e)},pick(e){return nV.pick(this,e)},omit(e){return nV.omit(this,e)},partial(...e){return nV.partial(i5,this,e[0])},required(...e){return nV.required(ae,this,e[0])}})});function iZ(e,t){return new iJ({type:"object",shape:e??{},...nV.normalizeParams(t)})}let iG=e_("ZodUnion",(e,t)=>{r7.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{var i,a,o,s;let c,l,d;return i=e,a=t,o=r,s=n,l=!1===(c=i._zod.def).inclusive,d=c.options.map((e,t)=>nW(e,a,{...s,path:[...s.path,l?"oneOf":"anyOf",t]})),void(l?o.oneOf=d:o.anyOf=d)},e.options=t.options}),iQ=e_("ZodIntersection",(e,t)=>{nt.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i,a,o,s;return a=nW((i=e._zod.def).left,t,{...n,path:[...n.path,"allOf",0]}),o=nW(i.right,t,{...n,path:[...n.path,"allOf",1]}),void(r.allOf=[...(s=e=>"allOf"in e&&1===Object.keys(e).length)(a)?a.allOf:[a],...s(o)?o.allOf:[o]])}}),iY=e_("ZodRecord",(e,t)=>{ns.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{let i=e._zod.def;r.type="object";let a=i.keyType,o=a._zod.bag,s=o?.patterns;if("loose"===i.mode&&s&&s.size>0){let e=nW(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});for(let t of(r.patternProperties={},s))r.patternProperties[t.source]=e}else("draft-07"===t.target||"draft-2020-12"===t.target)&&(r.propertyNames=nW(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),r.additionalProperties=nW(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let c=a._zod.values;if(c){let e=[...c].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(r.required=e)}})(e,t,r,n),e.keyType=t.keyType,e.valueType=t.valueType});function iX(e,t,r){return new iY(t&&t._zod?{type:"record",keyType:e,valueType:t,...nV.normalizeParams(r)}:{type:"record",keyType:iu(),valueType:e,...nV.normalizeParams(t)})}let i0=e_("ZodEnum",(e,t)=>{nd.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i;(i=eI(e._zod.def.entries)).every(e=>"number"==typeof e)&&(r.type="number"),i.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=i},e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(e,n)=>{let i={};for(let n of e)if(r.has(n))i[n]=t.entries[n];else throw Error(`Key ${n} not found in enum`);return new i0({...t,checks:[],...nV.normalizeParams(n),entries:i})},e.exclude=(e,n)=>{let i={...t.entries};for(let t of e)if(r.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new i0({...t,checks:[],...nV.normalizeParams(n),entries:i})}});function i1(e,t){return new i0({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...nV.normalizeParams(t)})}let i2=e_("ZodTransform",(e,t)=>{nu.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")})(0,e,0,0),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new ex(e.constructor.name);r.addIssue=n=>{"string"==typeof n?r.issues.push(nV.issue(n,r.value,t)):(n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=e),r.issues.push(nV.issue(n)))};let i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r.fallback=!0,r)):(r.value=i,r.fallback=!0,r)}}),i5=e_("ZodOptional",(e,t)=>{nf.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>nQ(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function i6(e){return new i5({type:"optional",innerType:e})}let i4=e_("ZodExactOptional",(e,t)=>{nh.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>nQ(e,t,r,n),e.unwrap=()=>e._zod.def.innerType}),i8=e_("ZodNullable",(e,t)=>{nm.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i,a,o;return a=nW((i=e._zod.def).innerType,t,n),o=t.seen.get(e),void("openapi-3.0"===t.target?(o.ref=i.innerType,r.nullable=!0):r.anyOf=[a,{type:"null"}])},e.unwrap=()=>e._zod.def.innerType});function i3(e){return new i8({type:"nullable",innerType:e})}let i9=e_("ZodDefault",(e,t)=>{ny.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i;nW((i=e._zod.def).innerType,t,n),t.seen.get(e).ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),i7=e_("ZodPrefault",(e,t)=>{nw.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i;nW((i=e._zod.def).innerType,t,n),t.seen.get(e).ref=i.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},e.unwrap=()=>e._zod.def.innerType}),ae=e_("ZodNonOptional",(e,t)=>{nb.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i;nW((i=e._zod.def).innerType,t,n),t.seen.get(e).ref=i.innerType},e.unwrap=()=>e._zod.def.innerType}),at=e_("ZodCatch",(e,t)=>{nE.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{let i,a=e._zod.def;nW(a.innerType,t,n),t.seen.get(e).ref=a.innerType;try{i=a.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),ar=e_("ZodPipe",(e,t)=>{nv.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i,a,o;return a=(i=e._zod.def).in._zod.traits.has("$ZodTransform"),void(nW(o="input"===t.io?a?i.out:i.in:i.out,t,n),t.seen.get(e).ref=o)},e.in=t.in,e.out=t.out});function an(e,t){return new ar({type:"pipe",in:e,out:t})}let ai=e_("ZodReadonly",(e,t)=>{nx.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i;nW((i=e._zod.def).innerType,t,n),t.seen.get(e).ref=i.innerType,r.readOnly=!0},e.unwrap=()=>e._zod.def.innerType}),aa=e_("ZodCustom",(e,t)=>{nT.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")})(0,e,0,0)}),ao={};function as(e){switch(e.constructor.name){case"ZodString":default:return"string";case"ZodNumber":return"number";case"ZodBoolean":return"boolean";case"ZodObject":return"object";case"ZodArray":return"array"}}function ac(e){let t=[];return e.metadata?.openapi?.parameters?t.push(...e.metadata.openapi.parameters):e.query instanceof iJ&&Object.entries(e.query.shape).forEach(([e,r])=>{r instanceof iJ&&t.push({name:e,in:"query",schema:{type:as(r),..."minLength"in r&&r.minLength?{minLength:r.minLength}:{},description:r.description}})}),t}function al(e){return{400:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}},required:["message"]}}},description:"Bad Request. Usually due to missing parameters, or invalid parameters."},401:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}},required:["message"]}}},description:"Unauthorized. Due to missing or invalid authentication."},403:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}}}}},description:"Forbidden. You do not have permission to access this resource or to perform this action."},404:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}}}}},description:"Not Found. The requested resource was not found."},429:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}}}}},description:"Too Many Requests. You have exceeded the rate limit. Try again later."},500:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}}}}},description:"Internal Server Error. This is a problem with the server that you cannot fix."},...e}}async function ad(e,t){return Object.entries(e).forEach(([e,t])=>{let r=t.options;if(!(!t.path||r.metadata?.SERVER_ONLY)&&("GET"===r.method&&(ao[t.path]={get:{tags:["Default",...r.metadata?.openapi?.tags||[]],description:r.metadata?.openapi?.description,operationId:r.metadata?.openapi?.operationId,security:[{bearerAuth:[]}],parameters:ac(r),responses:al(r.metadata?.openapi?.responses)}}),"POST"===r.method)){let e=function(e){if(e.metadata?.openapi?.requestBody)return e.metadata.openapi.requestBody;if(e.body&&(e.body instanceof iJ||e.body instanceof i5)){let t=e.body.shape;if(!t)return;let r={},n=[];return Object.entries(t).forEach(([e,t])=>{t instanceof iJ&&(r[e]={type:as(t),description:t.description},t instanceof i5||n.push(e))}),{required:!(e.body instanceof i5)&&!!e.body,content:{"application/json":{schema:{type:"object",properties:r,required:n}}}}}}(r);ao[t.path]={post:{tags:["Default",...r.metadata?.openapi?.tags||[]],description:r.metadata?.openapi?.description,operationId:r.metadata?.openapi?.operationId,security:[{bearerAuth:[]}],parameters:ac(r),...e?{requestBody:e}:{requestBody:{content:{"application/json":{schema:{type:"object",properties:{}}}}}},responses:al(r.metadata?.openapi?.responses)}}}}),{openapi:"3.1.1",info:{title:"Better Auth",description:"API Reference for your Better Auth Instance",version:"1.1.0"},components:{schemas:{}},security:[{apiKeyCookie:[]}],servers:[{url:t?.url}],tags:[{name:"Default",description:"Default endpoints that are included with Better Auth by default. These endpoints are not part of any plugin."}],paths:ao}}let au=((o=function(){}).prototype=Object.create(null),Object.freeze(o.prototype),o);function ap(){return{root:{key:""},static:new au}}function af(e){let[t,...r]=e.split("/");return""===r[r.length-1]?r.slice(0,-1):r}function ah(e,t){let r=new au;for(let[n,i]of t){let t=n<0?e.slice(-(n+1)).join("/"):e[n];if("string"==typeof i)r[i]=t;else{let e=t.match(i);if(e)for(let t in e.groups)r[t]=e.groups[t]}}return r}function am(e,t="",r,n){t=t.toUpperCase(),47!==r.charCodeAt(0)&&(r=`/${r}`);let i=af(r=r.replace(/\\:/g,"%3A")),a=e.root,o=0,s=[],c=[];for(let e=0;e<i.length;e++){let t=i[e];if(t.startsWith("**")){a.wildcard||(a.wildcard={key:"**"}),a=a.wildcard,s.push([-(e+1),t.split(":")[1]||"_",2===t.length]);break}if("*"===t||t.includes(":")){if(a.param||(a.param={key:"*"}),a=a.param,"*"===t)s.push([e,`_${o++}`,!0]);else if(t.includes(":",1)){let r=function(e){let t=e.replace(/:(\w+)/g,(e,t)=>`(?<${t}>[^/]+)`).replace(/\./g,"\\.");return RegExp(`^${t}$`)}(t);c[e]=r,a.hasRegexParam=!0,s.push([e,r,!1])}else s.push([e,t.slice(1),!1]);continue}"\\*"===t?t=i[e]="*":"\\*\\*"===t&&(t=i[e]="**");let r=a.static?.[t];if(r)a=r;else{let e={key:t};a.static||(a.static=new au),a.static[t]=e,a=e}}let l=s.length>0;a.methods||(a.methods=new au),a.methods[t]??=[],a.methods[t].push({data:n||null,paramsRegexp:c,paramsMap:l?s:void 0}),l||(e.static["/"+i.join("/")]=a)}function ay(e){return e instanceof X.APIError||e instanceof Y.APIError||e?.name==="APIError"}let ag=ek(async()=>({})),aw=ek.create({use:[ag,ek(async()=>({}))]}),ab=[ag];function aA(e,t,r){let n="string"==typeof e?e:void 0,i="object"==typeof t?t:e,a="function"==typeof t?t:r,o=async e=>{try{return await Q(e,()=>a(e))}catch(r){var t;throw t=e.responseHeaders,ay(r)&&t&&Object.defineProperty(r,X.kAPIErrorHeaderSymbol,{enumerable:!1,configurable:!0,value:t,writable:!1}),r}};return n?ev(n,{...i,use:[...i?.use||[],...ab]},o):ev({...i,use:[...i?.use||[],...ab]},o)}aA.serverOnly=(e,t)=>aA({...e,metadata:{...e.metadata,SERVER_ONLY:!0}},t);var aE=e.i(89551),av=e.i(12714),ak=e.i(50227),a_=e.i(43651),aS=e.i(80527);async function ax(t,r){let n;if(t.database)n="function"==typeof t.database?t.database(t):await r(t);else{let r=Object.keys((0,a_.getAuthTables)(t)).reduce((e,t)=>(e[t]=[],e),{}),{memoryAdapter:i}=await e.A(16432);n=i(r)(t)}return n.transaction||(aS.logger.warn("Adapter does not correctly implement transaction function, patching it automatically. Please update your adapter implementation."),n.transaction=async e=>e(n)),n}async function aR(t){return ax(t,async t=>{let{createKyselyAdapter:r}=await e.A(19783),{kysely:n,databaseType:i,transaction:a}=await r(t);if(!n)throw new Y.BetterAuthError("Failed to initialize database adapter");let{kyselyAdapter:o}=await e.A(19783);return o(n,{type:i||"sqlite",debugLogs:!!t.database&&"debugLogs"in t.database&&t.database.debugLogs,transaction:a})(t)})}var aT=e.i(13906),aI=e.i(15272),aU=e.i(97495),aO=e.i(29401);let aP={postgres:{string:["character varying","varchar","text","uuid"],number:["int4","integer","bigint","smallint","numeric","real","double precision"],boolean:["bool","boolean"],date:["timestamptz","timestamp","date"],json:["json","jsonb"]},mysql:{string:["varchar","text","uuid"],number:["integer","int","bigint","smallint","decimal","float","double"],boolean:["boolean","tinyint"],date:["timestamp","datetime","date"],json:["json"]},sqlite:{string:["TEXT"],number:["INTEGER","REAL"],boolean:["INTEGER","BOOLEAN"],date:["DATE","INTEGER"],json:["TEXT"]},mssql:{string:["varchar","nvarchar","uniqueidentifier"],number:["int","bigint","smallint","decimal","float","double"],boolean:["bit","smallint"],date:["datetime2","date","datetime"],json:["varchar","nvarchar"]}};async function aC(e){try{let t=await aO.sql`SHOW search_path`.execute(e),r=t.rows[0]?.search_path??t.rows[0]?.searchPath;if(r)return r.split(",").map(e=>e.trim()).map(e=>e.replace(/^["']|["']$/g,"")).filter(e=>!e.startsWith("$")&&!e.startsWith("\\$"))[0]||"public"}catch{}return"public"}async function aD(e){let t=function(e){let t=(0,a_.getAuthTables)(e),r={};for(let e in t){let n=t[e],i=n.fields,a={};if(Object.entries(i).forEach(([e,r])=>{if(a[r.fieldName||e]=r,r.references){let n=t[r.references.model];n&&(a[r.fieldName||e].references={...r.references,model:n.modelName,field:r.references.field})}}),r[n.modelName]){r[n.modelName].fields={...r[n.modelName].fields,...a},n.disableMigrations&&(r[n.modelName].disableMigrations=!0);continue}r[n.modelName]={fields:a,order:n.order||1/0,disableMigrations:n.disableMigrations}}return r}(e),r=(0,aS.createLogger)(e.logger),{kysely:n,databaseType:i}=await (0,aT.createKyselyAdapter)(e);i||(r.warn("Could not determine database type, defaulting to sqlite. Please provide a type in the database options to avoid this."),i="sqlite"),n||(r.error("Only kysely adapter is supported for migrations. You can use `generate` command to generate the schema, if you're using a different adapter."),process.exit(1));let a="public";if("postgres"===i){a=await aC(n),r.debug(`PostgreSQL migration: Using schema '${a}' (from search_path)`);try{let e=await aO.sql`
63
63
  SELECT schema_name
64
64
  FROM information_schema.schemata
65
65
  WHERE schema_name = ${a}
@@ -0,0 +1,3 @@
1
+ module.exports=[63003,e=>{"use strict";e.i(7876);var s=e.i(13272);e.i(73835),e.s(["PostgresStore",()=>s.PostgresStore])},6194,e=>{e.v(s=>Promise.all(["server/chunks/[externals]_pg_15jfwkh._.js"].map(s=>e.l(s))).then(()=>s(8844)))}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__13ioh5z._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},96253,(e,t,r)=>{"use strict";t.exports=e.r(18622)},85132,(e,t,r)=>{"use strict";t.exports=e.r(96253).vendored["react-rsc"].React},86109,(e,t,r)=>{"use strict";var s=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o={},p={RequestCookies:()=>f,ResponseCookies:()=>g,parseCookie:()=>d,parseSetCookie:()=>c,stringifyCookie:()=>u};for(var l in p)s(o,l,{get:p[l],enumerable:!0});function u(e){var t;let r=["path"in e&&e.path&&`Path=${e.path}`,"expires"in e&&(e.expires||0===e.expires)&&`Expires=${("number"==typeof e.expires?new Date(e.expires):e.expires).toUTCString()}`,"maxAge"in e&&"number"==typeof e.maxAge&&`Max-Age=${e.maxAge}`,"domain"in e&&e.domain&&`Domain=${e.domain}`,"secure"in e&&e.secure&&"Secure","httpOnly"in e&&e.httpOnly&&"HttpOnly","sameSite"in e&&e.sameSite&&`SameSite=${e.sameSite}`,"partitioned"in e&&e.partitioned&&"Partitioned","priority"in e&&e.priority&&`Priority=${e.priority}`].filter(Boolean),s=`${e.name}=${encodeURIComponent(null!=(t=e.value)?t:"")}`;return 0===r.length?s:`${s}; ${r.join("; ")}`}function d(e){let t=new Map;for(let r of e.split(/; */)){if(!r)continue;let e=r.indexOf("=");if(-1===e){t.set(r,"true");continue}let[s,n]=[r.slice(0,e),r.slice(e+1)];try{t.set(s,decodeURIComponent(null!=n?n:"true"))}catch{}}return t}function c(e){if(!e)return;let[[t,r],...s]=d(e),{domain:n,expires:i,httponly:a,maxage:o,path:p,samesite:l,secure:u,partitioned:c,priority:f}=Object.fromEntries(s.map(([e,t])=>[e.toLowerCase().replace(/-/g,""),t]));{var g,x,_={name:t,value:decodeURIComponent(r),domain:n,...i&&{expires:new Date(i)},...a&&{httpOnly:!0},..."string"==typeof o&&{maxAge:Number(o)},path:p,...l&&{sameSite:h.includes(g=(g=l).toLowerCase())?g:void 0},...u&&{secure:!0},...f&&{priority:m.includes(x=(x=f).toLowerCase())?x:void 0},...c&&{partitioned:!0}};let e={};for(let t in _)_[t]&&(e[t]=_[t]);return e}}t.exports=((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of i(t))a.call(e,o)||void 0===o||s(e,o,{get:()=>t[o],enumerable:!(r=n(t,o))||r.enumerable});return e})(s({},"__esModule",{value:!0}),o);var h=["strict","lax","none"],m=["low","medium","high"],f=class{constructor(e){this._parsed=new Map,this._headers=e;const t=e.get("cookie");if(t)for(const[e,r]of d(t))this._parsed.set(e,{name:e,value:r})}[Symbol.iterator](){return this._parsed[Symbol.iterator]()}get size(){return this._parsed.size}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed);if(!e.length)return r.map(([e,t])=>t);let s="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(([e])=>e===s).map(([e,t])=>t)}has(e){return this._parsed.has(e)}set(...e){let[t,r]=1===e.length?[e[0].name,e[0].value]:e,s=this._parsed;return s.set(t,{name:t,value:r}),this._headers.set("cookie",Array.from(s).map(([e,t])=>u(t)).join("; ")),this}delete(e){let t=this._parsed,r=Array.isArray(e)?e.map(e=>t.delete(e)):t.delete(e);return this._headers.set("cookie",Array.from(t).map(([e,t])=>u(t)).join("; ")),r}clear(){return this.delete(Array.from(this._parsed.keys())),this}[Symbol.for("edge-runtime.inspect.custom")](){return`RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(e=>`${e.name}=${encodeURIComponent(e.value)}`).join("; ")}},g=class{constructor(e){var t,r,s;this._parsed=new Map,this._headers=e;const n=null!=(s=null!=(r=null==(t=e.getSetCookie)?void 0:t.call(e))?r:e.get("set-cookie"))?s:[];for(const e of Array.isArray(n)?n:function(e){if(!e)return[];var t,r,s,n,i,a=[],o=0;function p(){for(;o<e.length&&/\s/.test(e.charAt(o));)o+=1;return o<e.length}for(;o<e.length;){for(t=o,i=!1;p();)if(","===(r=e.charAt(o))){for(s=o,o+=1,p(),n=o;o<e.length&&"="!==(r=e.charAt(o))&&";"!==r&&","!==r;)o+=1;o<e.length&&"="===e.charAt(o)?(i=!0,o=n,a.push(e.substring(t,s)),t=o):o=s+1}else o+=1;(!i||o>=e.length)&&a.push(e.substring(t,e.length))}return a}(n)){const t=c(e);t&&this._parsed.set(t.name,t)}}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed.values());if(!e.length)return r;let s="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(e=>e.name===s)}has(e){return this._parsed.has(e)}set(...e){let[t,r,s]=1===e.length?[e[0].name,e[0].value,e[0]]:e,n=this._parsed;return n.set(t,function(e={name:"",value:""}){return"number"==typeof e.expires&&(e.expires=new Date(e.expires)),e.maxAge&&(e.expires=new Date(Date.now()+1e3*e.maxAge)),(null===e.path||void 0===e.path)&&(e.path="/"),e}({name:t,value:r,...s})),function(e,t){for(let[,r]of(t.delete("set-cookie"),e)){let e=u(r);t.append("set-cookie",e)}}(n,this._headers),this}delete(...e){let[t,r]="string"==typeof e[0]?[e[0]]:[e[0].name,e[0]];return this.set({...r,name:t,value:"",expires:new Date(0)})}[Symbol.for("edge-runtime.inspect.custom")](){return`ResponseCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(u).join("; ")}}},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},54799,(e,t,r)=>{t.exports=e.x("crypto",()=>require("crypto"))},24868,(e,t,r)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},5365,(e,t,r)=>{t.exports=e.x("process",()=>require("process"))},874,(e,t,r)=>{t.exports=e.x("buffer",()=>require("buffer"))},12714,(e,t,r)=>{t.exports=e.x("node:fs/promises",()=>require("node:fs/promises"))},5086,e=>{"use strict";e.s(["DialectAdapterBase",0,class{get supportsCreateIfNotExists(){return!0}get supportsMultipleConnections(){return!0}get supportsTransactionalDdl(){return!1}get supportsReturning(){return!1}get supportsOutput(){return!1}}])},2350,e=>{"use strict";var t=e.i(44700);let r=/"/g,s=/[\\'"]/g;class n extends t.DefaultQueryCompiler{visitOrAction(e){this.append("or "),this.append(e.action)}getCurrentParameterPlaceholder(){return"?"}getLeftExplainOptionsWrapper(){return""}getRightExplainOptionsWrapper(){return""}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getAutoIncrement(){return"autoincrement"}sanitizeIdentifier(e){return e.replace(r,'""')}sanitizeJSONPathMemberValue(e){return e.replace(s,e=>"\\"===e?"\\\\":"'"===e?"''":'\\"')}visitDefaultInsertValue(e){this.append("null")}}e.s(["SqliteQueryCompiler",0,n])},39844,e=>{"use strict";var t=e.i(5086);class r extends t.DialectAdapterBase{get supportsMultipleConnections(){return!1}get supportsTransactionalDdl(){return!1}get supportsReturning(){return!0}async acquireMigrationLock(e,t){}async releaseMigrationLock(e,t){}}e.s(["SqliteAdapter",0,r])},66680,(e,t,r)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},19741,e=>{e.v(t=>Promise.all(["server/chunks/0d-b_next_dist_server_app-render_after-task-async-storage_external_0-exn7p.js","server/chunks/09xn_next_0tn6frk._.js"].map(t=>e.l(t))).then(()=>t(41422)))},16432,e=>{e.v(t=>Promise.all(["server/chunks/09mp_@better-auth_memory-adapter_dist_index_mjs_0ti_30h._.js"].map(t=>e.l(t))).then(()=>t(71100)))},92291,e=>{e.v(t=>Promise.all(["server/chunks/0-fj_better-auth_dist_adapters_kysely-adapter_index_mjs_0btft52._.js"].map(t=>e.l(t))).then(()=>t(83844)))},46358,e=>{e.v(e=>Promise.resolve().then(()=>e(57762)))},16909,e=>{e.v(t=>Promise.all(["server/chunks/01te_@better-auth_kysely-adapter_dist_0z6cvsk._.js"].map(t=>e.l(t))).then(()=>t(94336)))},12008,e=>{e.v(t=>Promise.all(["server/chunks/01te_@better-auth_kysely-adapter_dist_0jw_ngm._.js"].map(t=>e.l(t))).then(()=>t(88543)))},33387,e=>{e.v(t=>Promise.all(["server/chunks/01te_@better-auth_kysely-adapter_dist_210bxd8._.js"].map(t=>e.l(t))).then(()=>t(400)))},6194,e=>{e.v(t=>Promise.all(["server/chunks/[externals]_pg_15jfwkh._.js"].map(t=>e.l(t))).then(()=>t(8844)))}];
1
+ module.exports=[93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},96253,(e,t,r)=>{"use strict";t.exports=e.r(18622)},85132,(e,t,r)=>{"use strict";t.exports=e.r(96253).vendored["react-rsc"].React},86109,(e,t,r)=>{"use strict";var s=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o={},p={RequestCookies:()=>f,ResponseCookies:()=>g,parseCookie:()=>d,parseSetCookie:()=>c,stringifyCookie:()=>u};for(var l in p)s(o,l,{get:p[l],enumerable:!0});function u(e){var t;let r=["path"in e&&e.path&&`Path=${e.path}`,"expires"in e&&(e.expires||0===e.expires)&&`Expires=${("number"==typeof e.expires?new Date(e.expires):e.expires).toUTCString()}`,"maxAge"in e&&"number"==typeof e.maxAge&&`Max-Age=${e.maxAge}`,"domain"in e&&e.domain&&`Domain=${e.domain}`,"secure"in e&&e.secure&&"Secure","httpOnly"in e&&e.httpOnly&&"HttpOnly","sameSite"in e&&e.sameSite&&`SameSite=${e.sameSite}`,"partitioned"in e&&e.partitioned&&"Partitioned","priority"in e&&e.priority&&`Priority=${e.priority}`].filter(Boolean),s=`${e.name}=${encodeURIComponent(null!=(t=e.value)?t:"")}`;return 0===r.length?s:`${s}; ${r.join("; ")}`}function d(e){let t=new Map;for(let r of e.split(/; */)){if(!r)continue;let e=r.indexOf("=");if(-1===e){t.set(r,"true");continue}let[s,n]=[r.slice(0,e),r.slice(e+1)];try{t.set(s,decodeURIComponent(null!=n?n:"true"))}catch{}}return t}function c(e){if(!e)return;let[[t,r],...s]=d(e),{domain:n,expires:i,httponly:a,maxage:o,path:p,samesite:l,secure:u,partitioned:c,priority:f}=Object.fromEntries(s.map(([e,t])=>[e.toLowerCase().replace(/-/g,""),t]));{var g,x,_={name:t,value:decodeURIComponent(r),domain:n,...i&&{expires:new Date(i)},...a&&{httpOnly:!0},..."string"==typeof o&&{maxAge:Number(o)},path:p,...l&&{sameSite:h.includes(g=(g=l).toLowerCase())?g:void 0},...u&&{secure:!0},...f&&{priority:m.includes(x=(x=f).toLowerCase())?x:void 0},...c&&{partitioned:!0}};let e={};for(let t in _)_[t]&&(e[t]=_[t]);return e}}t.exports=((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of i(t))a.call(e,o)||void 0===o||s(e,o,{get:()=>t[o],enumerable:!(r=n(t,o))||r.enumerable});return e})(s({},"__esModule",{value:!0}),o);var h=["strict","lax","none"],m=["low","medium","high"],f=class{constructor(e){this._parsed=new Map,this._headers=e;const t=e.get("cookie");if(t)for(const[e,r]of d(t))this._parsed.set(e,{name:e,value:r})}[Symbol.iterator](){return this._parsed[Symbol.iterator]()}get size(){return this._parsed.size}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed);if(!e.length)return r.map(([e,t])=>t);let s="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(([e])=>e===s).map(([e,t])=>t)}has(e){return this._parsed.has(e)}set(...e){let[t,r]=1===e.length?[e[0].name,e[0].value]:e,s=this._parsed;return s.set(t,{name:t,value:r}),this._headers.set("cookie",Array.from(s).map(([e,t])=>u(t)).join("; ")),this}delete(e){let t=this._parsed,r=Array.isArray(e)?e.map(e=>t.delete(e)):t.delete(e);return this._headers.set("cookie",Array.from(t).map(([e,t])=>u(t)).join("; ")),r}clear(){return this.delete(Array.from(this._parsed.keys())),this}[Symbol.for("edge-runtime.inspect.custom")](){return`RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(e=>`${e.name}=${encodeURIComponent(e.value)}`).join("; ")}},g=class{constructor(e){var t,r,s;this._parsed=new Map,this._headers=e;const n=null!=(s=null!=(r=null==(t=e.getSetCookie)?void 0:t.call(e))?r:e.get("set-cookie"))?s:[];for(const e of Array.isArray(n)?n:function(e){if(!e)return[];var t,r,s,n,i,a=[],o=0;function p(){for(;o<e.length&&/\s/.test(e.charAt(o));)o+=1;return o<e.length}for(;o<e.length;){for(t=o,i=!1;p();)if(","===(r=e.charAt(o))){for(s=o,o+=1,p(),n=o;o<e.length&&"="!==(r=e.charAt(o))&&";"!==r&&","!==r;)o+=1;o<e.length&&"="===e.charAt(o)?(i=!0,o=n,a.push(e.substring(t,s)),t=o):o=s+1}else o+=1;(!i||o>=e.length)&&a.push(e.substring(t,e.length))}return a}(n)){const t=c(e);t&&this._parsed.set(t.name,t)}}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed.values());if(!e.length)return r;let s="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(e=>e.name===s)}has(e){return this._parsed.has(e)}set(...e){let[t,r,s]=1===e.length?[e[0].name,e[0].value,e[0]]:e,n=this._parsed;return n.set(t,function(e={name:"",value:""}){return"number"==typeof e.expires&&(e.expires=new Date(e.expires)),e.maxAge&&(e.expires=new Date(Date.now()+1e3*e.maxAge)),(null===e.path||void 0===e.path)&&(e.path="/"),e}({name:t,value:r,...s})),function(e,t){for(let[,r]of(t.delete("set-cookie"),e)){let e=u(r);t.append("set-cookie",e)}}(n,this._headers),this}delete(...e){let[t,r]="string"==typeof e[0]?[e[0]]:[e[0].name,e[0]];return this.set({...r,name:t,value:"",expires:new Date(0)})}[Symbol.for("edge-runtime.inspect.custom")](){return`ResponseCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(u).join("; ")}}},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},54799,(e,t,r)=>{t.exports=e.x("crypto",()=>require("crypto"))},24868,(e,t,r)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},5365,(e,t,r)=>{t.exports=e.x("process",()=>require("process"))},874,(e,t,r)=>{t.exports=e.x("buffer",()=>require("buffer"))},12714,(e,t,r)=>{t.exports=e.x("node:fs/promises",()=>require("node:fs/promises"))},5086,e=>{"use strict";e.s(["DialectAdapterBase",0,class{get supportsCreateIfNotExists(){return!0}get supportsMultipleConnections(){return!0}get supportsTransactionalDdl(){return!1}get supportsReturning(){return!1}get supportsOutput(){return!1}}])},2350,e=>{"use strict";var t=e.i(44700);let r=/"/g,s=/[\\'"]/g;class n extends t.DefaultQueryCompiler{visitOrAction(e){this.append("or "),this.append(e.action)}getCurrentParameterPlaceholder(){return"?"}getLeftExplainOptionsWrapper(){return""}getRightExplainOptionsWrapper(){return""}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getAutoIncrement(){return"autoincrement"}sanitizeIdentifier(e){return e.replace(r,'""')}sanitizeJSONPathMemberValue(e){return e.replace(s,e=>"\\"===e?"\\\\":"'"===e?"''":'\\"')}visitDefaultInsertValue(e){this.append("null")}}e.s(["SqliteQueryCompiler",0,n])},39844,e=>{"use strict";var t=e.i(5086);class r extends t.DialectAdapterBase{get supportsMultipleConnections(){return!1}get supportsTransactionalDdl(){return!1}get supportsReturning(){return!0}async acquireMigrationLock(e,t){}async releaseMigrationLock(e,t){}}e.s(["SqliteAdapter",0,r])},66680,(e,t,r)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},19741,e=>{e.v(t=>Promise.all(["server/chunks/0d-b_next_dist_server_app-render_after-task-async-storage_external_0-exn7p.js","server/chunks/09xn_next_0tn6frk._.js"].map(t=>e.l(t))).then(()=>t(41422)))},16432,e=>{e.v(t=>Promise.all(["server/chunks/09mp_@better-auth_memory-adapter_dist_index_mjs_0ti_30h._.js"].map(t=>e.l(t))).then(()=>t(71100)))},19783,e=>{e.v(t=>Promise.all(["server/chunks/0zhp_better-auth_dist_adapters_kysely-adapter_index_mjs_1rl4qnh._.js"].map(t=>e.l(t))).then(()=>t(49457)))},46358,e=>{e.v(e=>Promise.resolve().then(()=>e(57762)))},16909,e=>{e.v(t=>Promise.all(["server/chunks/01te_@better-auth_kysely-adapter_dist_0z6cvsk._.js"].map(t=>e.l(t))).then(()=>t(94336)))},12008,e=>{e.v(t=>Promise.all(["server/chunks/01te_@better-auth_kysely-adapter_dist_0jw_ngm._.js"].map(t=>e.l(t))).then(()=>t(88543)))},33387,e=>{e.v(t=>Promise.all(["server/chunks/01te_@better-auth_kysely-adapter_dist_210bxd8._.js"].map(t=>e.l(t))).then(()=>t(400)))},6194,e=>{e.v(t=>Promise.all(["server/chunks/[externals]_pg_15jfwkh._.js"].map(t=>e.l(t))).then(()=>t(8844)))}];
2
2
 
3
- //# sourceMappingURL=%5Broot-of-the-server%5D__1k8g143._.js.map
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__19pc87s._.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},96253,(e,t,r)=>{"use strict";t.exports=e.r(18622)},85132,(e,t,r)=>{"use strict";t.exports=e.r(96253).vendored["react-rsc"].React},86109,(e,t,r)=>{"use strict";var n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,i={},l={RequestCookies:()=>m,ResponseCookies:()=>g,parseCookie:()=>p,parseSetCookie:()=>c,stringifyCookie:()=>d};for(var u in l)n(i,u,{get:l[u],enumerable:!0});function d(e){var t;let r=["path"in e&&e.path&&`Path=${e.path}`,"expires"in e&&(e.expires||0===e.expires)&&`Expires=${("number"==typeof e.expires?new Date(e.expires):e.expires).toUTCString()}`,"maxAge"in e&&"number"==typeof e.maxAge&&`Max-Age=${e.maxAge}`,"domain"in e&&e.domain&&`Domain=${e.domain}`,"secure"in e&&e.secure&&"Secure","httpOnly"in e&&e.httpOnly&&"HttpOnly","sameSite"in e&&e.sameSite&&`SameSite=${e.sameSite}`,"partitioned"in e&&e.partitioned&&"Partitioned","priority"in e&&e.priority&&`Priority=${e.priority}`].filter(Boolean),n=`${e.name}=${encodeURIComponent(null!=(t=e.value)?t:"")}`;return 0===r.length?n:`${n}; ${r.join("; ")}`}function p(e){let t=new Map;for(let r of e.split(/; */)){if(!r)continue;let e=r.indexOf("=");if(-1===e){t.set(r,"true");continue}let[n,a]=[r.slice(0,e),r.slice(e+1)];try{t.set(n,decodeURIComponent(null!=a?a:"true"))}catch{}}return t}function c(e){if(!e)return;let[[t,r],...n]=p(e),{domain:a,expires:o,httponly:s,maxage:i,path:l,samesite:u,secure:d,partitioned:c,priority:m}=Object.fromEntries(n.map(([e,t])=>[e.toLowerCase().replace(/-/g,""),t]));{var g,v,x={name:t,value:decodeURIComponent(r),domain:a,...o&&{expires:new Date(o)},...s&&{httpOnly:!0},..."string"==typeof i&&{maxAge:Number(i)},path:l,...u&&{sameSite:h.includes(g=(g=u).toLowerCase())?g:void 0},...d&&{secure:!0},...m&&{priority:f.includes(v=(v=m).toLowerCase())?v:void 0},...c&&{partitioned:!0}};let e={};for(let t in x)x[t]&&(e[t]=x[t]);return e}}t.exports=((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of o(t))s.call(e,i)||void 0===i||n(e,i,{get:()=>t[i],enumerable:!(r=a(t,i))||r.enumerable});return e})(n({},"__esModule",{value:!0}),i);var h=["strict","lax","none"],f=["low","medium","high"],m=class{constructor(e){this._parsed=new Map,this._headers=e;const t=e.get("cookie");if(t)for(const[e,r]of p(t))this._parsed.set(e,{name:e,value:r})}[Symbol.iterator](){return this._parsed[Symbol.iterator]()}get size(){return this._parsed.size}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed);if(!e.length)return r.map(([e,t])=>t);let n="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(([e])=>e===n).map(([e,t])=>t)}has(e){return this._parsed.has(e)}set(...e){let[t,r]=1===e.length?[e[0].name,e[0].value]:e,n=this._parsed;return n.set(t,{name:t,value:r}),this._headers.set("cookie",Array.from(n).map(([e,t])=>d(t)).join("; ")),this}delete(e){let t=this._parsed,r=Array.isArray(e)?e.map(e=>t.delete(e)):t.delete(e);return this._headers.set("cookie",Array.from(t).map(([e,t])=>d(t)).join("; ")),r}clear(){return this.delete(Array.from(this._parsed.keys())),this}[Symbol.for("edge-runtime.inspect.custom")](){return`RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(e=>`${e.name}=${encodeURIComponent(e.value)}`).join("; ")}},g=class{constructor(e){var t,r,n;this._parsed=new Map,this._headers=e;const a=null!=(n=null!=(r=null==(t=e.getSetCookie)?void 0:t.call(e))?r:e.get("set-cookie"))?n:[];for(const e of Array.isArray(a)?a:function(e){if(!e)return[];var t,r,n,a,o,s=[],i=0;function l(){for(;i<e.length&&/\s/.test(e.charAt(i));)i+=1;return i<e.length}for(;i<e.length;){for(t=i,o=!1;l();)if(","===(r=e.charAt(i))){for(n=i,i+=1,l(),a=i;i<e.length&&"="!==(r=e.charAt(i))&&";"!==r&&","!==r;)i+=1;i<e.length&&"="===e.charAt(i)?(o=!0,i=a,s.push(e.substring(t,n)),t=i):i=n+1}else i+=1;(!o||i>=e.length)&&s.push(e.substring(t,e.length))}return s}(a)){const t=c(e);t&&this._parsed.set(t.name,t)}}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed.values());if(!e.length)return r;let n="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(e=>e.name===n)}has(e){return this._parsed.has(e)}set(...e){let[t,r,n]=1===e.length?[e[0].name,e[0].value,e[0]]:e,a=this._parsed;return a.set(t,function(e={name:"",value:""}){return"number"==typeof e.expires&&(e.expires=new Date(e.expires)),e.maxAge&&(e.expires=new Date(Date.now()+1e3*e.maxAge)),(null===e.path||void 0===e.path)&&(e.path="/"),e}({name:t,value:r,...n})),function(e,t){for(let[,r]of(t.delete("set-cookie"),e)){let e=d(r);t.append("set-cookie",e)}}(a,this._headers),this}delete(...e){let[t,r]="string"==typeof e[0]?[e[0]]:[e[0].name,e[0]];return this.set({...r,name:t,value:"",expires:new Date(0)})}[Symbol.for("edge-runtime.inspect.custom")](){return`ResponseCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(d).join("; ")}}},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},54799,(e,t,r)=>{t.exports=e.x("crypto",()=>require("crypto"))},24868,(e,t,r)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},5365,(e,t,r)=>{t.exports=e.x("process",()=>require("process"))},874,(e,t,r)=>{t.exports=e.x("buffer",()=>require("buffer"))},53733,e=>{"use strict";let t={invalid_request:400,unauthorized:401,not_found:404,conflict:409,backend_unavailable:503,internal:500};function r(e,r,n){let a=t[e];return Response.json({error:{code:e,message:r,...void 0===n?{}:{details:n}}},{status:a})}e.s(["fail",0,r,"failFromAction",0,function(e){return r(/\b(not found|no such|does not exist)\b/i.test(e)||/\bunknown (project|box)\b/i.test(e)||/no pending approval/i.test(e)?"not_found":"conflict",e)},"ok",0,function(e,t=200){return Response.json(e,{status:t})}])},82477,e=>{"use strict";var t=e.i(89551);function r(e){if(e.originUrl){let t=e.originUrl.replace(/\.git$/,"").split(/[/:]/).pop();if(t)return t}return e.name}function n(e){var t;return t=e.originUrl??e.name,Buffer.from(t).toString("base64url")}function a(e){return{claude:e?.claude,codex:e?.codex,opencode:e?.opencode}}function o(e){if(!e)return"stopped";let{claude:t,codex:r,opencode:n}=a(e);return[t?.state,r?.state,n?.state].includes("error")?"error":t?.sessionRunning||r?.sessionRunning||n?.sessionRunning?"running":"stopped"}let s=null;async function i(){var t;let i=process.env.POSTGRES_URL??process.env.RELAY_STORE_URL;if(!i)throw Error("hub: POSTGRES_URL required for the hosted source");let l=await (!s&&(s=(async()=>{let{PostgresStore:t}=await e.A(59249),r=new t({connectionString:i});return await r.migrate(),r})().catch(e=>{throw s=null,e})),s),u=await l.listBoxes(),d=new Map((await l.listStatuses()).map(e=>[e.boxId,e.status])),p=[];for(let e of u)for(let r of(await l.listPendingPrompts(e.boxId)))p.push((t=e.boxId,{id:r.ev.id,boxId:t,message:r.ev.message,detail:r.ev.detail,command:r.ev.context?.command,cwd:r.ev.context?.cwd,argv:r.ev.context?.argv,defaultAnswer:r.ev.defaultAnswer??"n",createdAt:Date.parse(r.createdAt)||Date.now()}));return{user:{login:"hub",name:"hub"},github:{available:!1,installed:!1,appName:"GitHub App",account:"",installedAt:0,repos:[]},projects:function(e){let t=new Map;for(let a of e){let e=n(a),o=Date.parse(a.createdAt??a.registeredAt)||Date.now(),s=t.get(e);s?o<s.createdAt&&(s.createdAt=o):t.set(e,{key:e,name:r(a),createdAt:o})}return[...t.values()].map(e=>({id:e.key,name:e.name,repo:e.name,defaultBranch:"main",provider:"cloud",createdAt:e.createdAt})).sort((e,t)=>t.createdAt-e.createdAt)}(u),boxes:u.map(e=>(function(e,t){let{claude:s,codex:i,opencode:l}=a(t),u=Date.parse(e.createdAt??e.registeredAt)||Date.now();return{id:e.boxId,projectId:n(e),repo:r(e),branch:e.worktrees?.[0]?.branch??"",task:s?.sessionTitle??i?.sessionTitle??l?.sessionTitle??e.name,agent:i?.sessionRunning?"codex":l?.sessionRunning?"opencode":"claude",status:o(t),createdAt:u,lastActivity:u,host:e.backend?`${e.kind??"cloud"} \xb7 ${e.backend}`:e.kind??"cloud",provider:e.kind??"docker",commits:null,filesTouched:null,error:"error"===o(t)?s?.sessionTitle??"Agent reported an error":null,webUrl:null,vncUrl:null}})(e,d.get(e.boxId))),approvals:p,providers:[]}}async function l(){let e=globalThis.__AGENTBOX_HUB_BACKEND;return e?{...await e.getData(),authMode:(0,t.authMode)()}:process.env.POSTGRES_URL??process.env.RELAY_STORE_URL?{...await i(),authMode:(0,t.authMode)()}:{user:{login:"user",name:"user"},github:{available:!1,installed:!1,appName:"GitHub App",account:"",installedAt:0,repos:[]},projects:[],boxes:[],approvals:[],providers:[],authMode:(0,t.authMode)()}}async function u(){return l()}e.s(["backendOrNull",0,function(){return globalThis.__AGENTBOX_HUB_BACKEND??null},"readState",0,u],82477)},39516,e=>{"use strict";var t=e.i(56710),r=e.i(82809),n=e.i(74001),a=e.i(73300),o=e.i(68744),s=e.i(98570),i=e.i(56147),l=e.i(32931),u=e.i(61810),d=e.i(59963),p=e.i(44491),c=e.i(74916),h=e.i(33073),f=e.i(98603),m=e.i(93317),g=e.i(93695);e.i(95533);var v=e.i(75616),x=e.i(82477),b=e.i(53733);async function R(e,t){let{alias:r}=await t.params,n=(0,x.backendOrNull)();if(!n)return(0,b.fail)("backend_unavailable","hub backend unavailable (run the hub server)");let a=await n.bakeRemoteDockerHost(r);return a.ok?(0,b.ok)({jobId:a.jobId},202):(0,b.failFromAction)(a.error)}e.s(["POST",0,R,"dynamic",0,"force-dynamic","runtime",0,"nodejs"],24371);var y=e.i(24371);let w=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/(dashboard)/api/v1/hosts/[alias]/bake/route",pathname:"/api/v1/hosts/[alias]/bake",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/apps/hub/app/(dashboard)/api/v1/hosts/[alias]/bake/route.ts",nextConfigOutput:"standalone",userland:y,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:_,serverHooks:k}=w;async function E(e,t,n){n.requestMeta&&(0,a.setRequestMeta)(e,n.requestMeta),w.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let x="/(dashboard)/api/v1/hosts/[alias]/bake/route";x=x.replace(/\/index$/,"")||"/";let b=await w.prepare(e,t,{srcPage:x,multiZoneDraftMode:!1});if(!b)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:R,deploymentId:y,params:A,nextConfig:_,parsedUrl:k,isDraftMode:E,prerenderManifest:C,routerServerContext:S,isOnDemandRevalidate:O,revalidateOnlyGenerated:T,resolvedPathname:j,clientReferenceManifest:P,serverActionsManifest:N}=b,q=(0,i.normalizeAppPath)(x),U=!!(C.dynamicRoutes[q]||C.routes[j]),D=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,k,!1):t.end("This page could not be found"),null);if(U&&!E){let e=!!C.routes[j],t=C.dynamicRoutes[q];if(t&&!1===t.fallback&&!e){if(_.adapterPath)return await D();throw new g.NoFallbackError}}let I=null;!U||w.isDev||E||(I="/index"===(I=j)?"/":I);let M=!0===w.isDev||!U,$=U&&!M;N&&P&&(0,s.setManifestsSingleton)({page:x,clientReferenceManifest:P,serverActionsManifest:N});let H=e.method||"GET",B=(0,o.getTracer)(),L=B.getActiveScopeSpan(),F=!!(null==S?void 0:S.isWrappedByNextServer),G=!!(0,a.getRequestMeta)(e,"minimalMode"),K=(0,a.getRequestMeta)(e,"incrementalCache")||await w.getIncrementalCache(e,_,C,G);null==K||K.resetRequestCache(),globalThis.__incrementalCache=K;let z={params:A,previewProps:C.preview,renderOpts:{experimental:{authInterrupts:!!_.experimental.authInterrupts},cacheComponents:!!_.cacheComponents,supportsDynamicResponse:M,incrementalCache:K,cacheLifeProfiles:_.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>w.onRequestError(e,t,n,a,S)},sharedContext:{buildId:R,deploymentId:y}},X=new l.NodeNextRequest(e),V=new l.NodeNextResponse(t),W=u.NextRequestAdapter.fromNodeNextRequest(X,(0,u.signalFromNodeResponse)(t));try{let a,s=async e=>w.handle(W,z).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=B.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${H} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t),a&&a!==e&&(a.setAttribute("http.route",n),a.updateName(t))}else e.updateName(`${H} ${x}`)}),i=async a=>{var o,i;let l=async({previousCacheEntry:r})=>{try{if(!G&&O&&T&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let o=await s(a);e.fetchMetrics=z.renderOpts.fetchMetrics;let i=z.renderOpts.pendingWaitUntil;i&&n.waitUntil&&(n.waitUntil(i),i=void 0);let l=z.renderOpts.collectedTags;if(!U)return await (0,c.sendResponse)(X,V,o,z.renderOpts.pendingWaitUntil),null;{let e=await o.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(o.headers);l&&(t[m.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==z.renderOpts.collectedRevalidate&&!(z.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&z.renderOpts.collectedRevalidate,n=void 0===z.renderOpts.collectedExpire||z.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:z.renderOpts.collectedExpire;return{value:{kind:v.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await w.onRequestError(e,t,{routerKind:"App Router",routePath:x,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:O})},!1,S),t}},u=await w.handleResponse({req:e,nextConfig:_,cacheKey:I,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:C,isRoutePPREnabled:!1,isOnDemandRevalidate:O,revalidateOnlyGenerated:T,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:G});if(!U)return null;if((null==u||null==(o=u.value)?void 0:o.kind)!==v.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(i=u.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});G||t.setHeader("x-nextjs-cache",O?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),E&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let d=(0,h.fromNodeOutgoingHttpHeaders)(u.value.headers);return G&&U||d.delete(m.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||d.get("Cache-Control")||d.set("Cache-Control",(0,f.getCacheControlHeader)(u.cacheControl)),await (0,c.sendResponse)(X,V,new Response(u.value.body,{headers:d,status:u.value.status||200})),null};F&&L?await i(L):(a=B.getActiveScopeSpan(),await B.withPropagatedContext(e.headers,()=>B.trace(d.BaseServerSpan.handleRequest,{spanName:`${H} ${x}`,kind:o.SpanKind.SERVER,attributes:{"http.method":H,"http.target":e.url}},i),void 0,!F))}catch(t){if(t instanceof g.NoFallbackError||await w.onRequestError(e,t,{routerKind:"App Router",routePath:q,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:O})},!1,S),U)throw t;return await (0,c.sendResponse)(X,V,new Response(null,{status:500})),null}}e.s(["handler",0,E,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:_})},"routeModule",0,w,"serverHooks",0,k,"workAsyncStorage",0,A,"workUnitAsyncStorage",0,_],39516)},59249,e=>{e.v(t=>Promise.all(["server/chunks/[root-of-the-server]__13ioh5z._.js","server/chunks/packages_relay_dist_control-plane_03a-9aj.js"].map(t=>e.l(t))).then(()=>t(63003)))}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__1h4xycg._.js.map