vansrouter 0.8.6 → 0.8.7

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 (312) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +9 -9
  3. package/app/.next-cli-build/build-manifest.json +3 -3
  4. package/app/.next-cli-build/prerender-manifest.json +3 -3
  5. package/app/.next-cli-build/react-loadable-manifest.json +2 -2
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  28. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  29. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  30. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  31. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  32. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  33. package/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  34. package/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
  35. package/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
  36. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  37. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  38. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  39. package/app/.next-cli-build/server/app/_not-found.rsc +4 -4
  40. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +4 -4
  41. package/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
  42. package/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +4 -4
  43. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  44. package/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  45. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  46. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +4 -4
  47. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  48. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
  49. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +2 -2
  50. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
  51. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +2 -2
  52. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +2 -2
  53. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +2 -2
  54. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
  55. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +2 -2
  56. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +1 -1
  57. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +2 -2
  58. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -2
  59. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
  60. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  61. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +2 -2
  62. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js +1 -1
  63. package/app/.next-cli-build/server/app/api/models/route.js +1 -1
  64. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  65. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
  66. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
  67. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js +1 -1
  68. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js +1 -1
  69. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js +1 -1
  70. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js +1 -1
  71. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
  72. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  73. package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  74. package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  75. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  76. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
  77. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +2 -2
  78. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  79. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  80. package/app/.next-cli-build/server/app/callback.html +1 -1
  81. package/app/.next-cli-build/server/app/callback.rsc +4 -4
  82. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +4 -4
  83. package/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
  84. package/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +4 -4
  85. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
  86. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  87. package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
  88. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  89. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +6 -6
  90. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
  91. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
  92. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  93. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  94. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +6 -6
  95. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
  96. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +4 -4
  97. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
  98. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  99. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +6 -6
  100. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  101. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  102. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  103. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  104. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
  105. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  106. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +4 -4
  107. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
  108. package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  109. package/app/.next-cli-build/server/app/dashboard/combos.rsc +6 -6
  110. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  111. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  112. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  113. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  114. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +6 -6
  115. package/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  116. package/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +4 -4
  117. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
  118. package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  119. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +6 -6
  120. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  121. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  122. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  123. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  124. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +6 -6
  125. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  126. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +4 -4
  127. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
  128. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  129. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +6 -6
  130. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
  131. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
  132. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
  133. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  134. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  135. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +6 -6
  136. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
  137. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +4 -4
  138. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
  139. package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  140. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +6 -6
  141. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  142. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
  143. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  144. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  145. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
  146. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
  147. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +4 -4
  148. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
  149. package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  150. package/app/.next-cli-build/server/app/dashboard/profile.rsc +6 -6
  151. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  152. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  153. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  154. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  155. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +6 -6
  156. package/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  157. package/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +4 -4
  158. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
  159. package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  160. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +6 -6
  161. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  162. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  163. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  164. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  165. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  166. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +6 -6
  167. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  168. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +4 -4
  169. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
  170. package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  171. package/app/.next-cli-build/server/app/dashboard/providers.rsc +6 -6
  172. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  173. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  174. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  175. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  176. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +6 -6
  177. package/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  178. package/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +4 -4
  179. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
  180. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  181. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +6 -6
  182. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  183. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
  184. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  185. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  186. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +6 -6
  187. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
  188. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +4 -4
  189. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
  190. package/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
  191. package/app/.next-cli-build/server/app/dashboard/quota.rsc +7 -7
  192. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
  193. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  194. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  195. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  196. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +7 -7
  197. package/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  198. package/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +4 -4
  199. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
  200. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  201. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  202. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +4 -4
  203. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
  204. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  205. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
  206. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  207. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  208. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  209. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  210. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  211. package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  212. package/app/.next-cli-build/server/app/dashboard/skills.rsc +6 -6
  213. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
  214. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills.segment.rsc +1 -1
  215. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  216. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  217. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +6 -6
  218. package/app/.next-cli-build/server/app/dashboard/skills.segments/_head.segment.rsc +1 -1
  219. package/app/.next-cli-build/server/app/dashboard/skills.segments/_index.segment.rsc +4 -4
  220. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
  221. package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  222. package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +6 -6
  223. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +2 -2
  224. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver.segment.rsc +1 -1
  225. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  226. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  227. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +6 -6
  228. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_head.segment.rsc +1 -1
  229. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_index.segment.rsc +4 -4
  230. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
  231. package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  232. package/app/.next-cli-build/server/app/dashboard/translator.rsc +6 -6
  233. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  234. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  235. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  236. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  237. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +6 -6
  238. package/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  239. package/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +4 -4
  240. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
  241. package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  242. package/app/.next-cli-build/server/app/dashboard/usage.rsc +6 -6
  243. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  244. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  245. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  246. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  247. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +6 -6
  248. package/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  249. package/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +4 -4
  250. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
  251. package/app/.next-cli-build/server/app/dashboard.html +1 -1
  252. package/app/.next-cli-build/server/app/dashboard.rsc +6 -6
  253. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  254. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  255. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  256. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +6 -6
  257. package/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
  258. package/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +4 -4
  259. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
  260. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  261. package/app/.next-cli-build/server/app/landing.html +1 -1
  262. package/app/.next-cli-build/server/app/landing.rsc +4 -4
  263. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +4 -4
  264. package/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
  265. package/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +4 -4
  266. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
  267. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  268. package/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
  269. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  270. package/app/.next-cli-build/server/app/login.html +1 -1
  271. package/app/.next-cli-build/server/app/login.rsc +5 -5
  272. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +5 -5
  273. package/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
  274. package/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +4 -4
  275. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
  276. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  277. package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
  278. package/app/.next-cli-build/server/app/masuk/page_client-reference-manifest.js +1 -1
  279. package/app/.next-cli-build/server/app-paths-manifest.json +9 -9
  280. package/app/.next-cli-build/server/chunks/1536.js +1 -1
  281. package/app/.next-cli-build/server/chunks/2557.js +3 -3
  282. package/app/.next-cli-build/server/chunks/3141.js +1 -1
  283. package/app/.next-cli-build/server/chunks/383.js +1 -1
  284. package/app/.next-cli-build/server/chunks/404.js +1 -1
  285. package/app/.next-cli-build/server/chunks/4105.js +1 -1
  286. package/app/.next-cli-build/server/chunks/4418.js +1 -1
  287. package/app/.next-cli-build/server/chunks/4574.js +3 -3
  288. package/app/.next-cli-build/server/chunks/5006.js +1 -1
  289. package/app/.next-cli-build/server/chunks/5598.js +1 -1
  290. package/app/.next-cli-build/server/chunks/6085.js +1 -1
  291. package/app/.next-cli-build/server/chunks/6159.js +1 -1
  292. package/app/.next-cli-build/server/chunks/6975.js +1 -1
  293. package/app/.next-cli-build/server/chunks/7164.js +1 -1
  294. package/app/.next-cli-build/server/chunks/7916.js +1 -1
  295. package/app/.next-cli-build/server/chunks/8121.js +1 -1
  296. package/app/.next-cli-build/server/chunks/9765.js +1 -1
  297. package/app/.next-cli-build/server/chunks/9984.js +1 -1
  298. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  299. package/app/.next-cli-build/server/middleware-react-loadable-manifest.js +1 -1
  300. package/app/.next-cli-build/server/pages/404.html +1 -1
  301. package/app/.next-cli-build/server/pages/500.html +1 -1
  302. package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
  303. package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
  304. package/app/.next-cli-build/static/chunks/4385-441c57680060bf32.js +1 -0
  305. package/app/.next-cli-build/static/chunks/5737-2c60294f03134f58.js +1 -0
  306. package/app/.next-cli-build/static/chunks/{webpack-2665aecb28daf463.js → webpack-cc748d6f373bfbd0.js} +1 -1
  307. package/app/package.json +1 -1
  308. package/package.json +1 -1
  309. package/app/.next-cli-build/static/chunks/4385-c2e7af2b9e78db47.js +0 -1
  310. package/app/.next-cli-build/static/chunks/5737-45b185e25643dee4.js +0 -1
  311. /package/app/.next-cli-build/static/{7Gql1mhUkge2snWgAfnx3 → KPZsvYf9k_ul1qX5v-XQj}/_buildManifest.js +0 -0
  312. /package/app/.next-cli-build/static/{7Gql1mhUkge2snWgAfnx3 → KPZsvYf9k_ul1qX5v-XQj}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- "use strict";(()=>{var a={};a.id=1704,a.ids=[1704,6820],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},21820:a=>{a.exports=require("os")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},46293:a=>{a.exports=require("sql.js")},46820:(a,b,c)=>{c.d(b,{Fh:()=>d.Fh,L9:()=>d.L9,Mc:()=>d.Mc,OM:()=>d.OM,P:()=>d.getProviderConnections,Pc:()=>d.Pc,Q_:()=>d.Q_,Qu:()=>d.Qu,S8:()=>d.S8,Yd:()=>d.Yd,ZO:()=>d.ZO,c:()=>d.c,createProviderConnection:()=>d.iE,fK:()=>d.fK,fv:()=>d.fv,ho:()=>d.ho,hr:()=>d.hr,i0:()=>d.i0,o5:()=>d.o5,op:()=>d.op,rj:()=>d.updateProviderConnection,uL:()=>d.uL,ui:()=>d.ui,uv:()=>d.uv});var d=c(94164)},47221:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>E,patchFetch:()=>D,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var d={};c.r(d),c.d(d,{POST:()=>y});var e=c(12334),f=c(59399),g=c(8894),h=c(83760),i=c(34958),j=c(970),k=c(261),l=c(28112),m=c(52194),n=c(9410),o=c(68673),p=c(47471),q=c(13093),r=c(98563),s=c(7572),t=c(86439),u=c(33610),v=c(77231),w=c(98327),x=c(46820);async function y(a){try{let{apiKey:b,region:c}=await a.json();if(!b||"string"!=typeof b||!b.trim())return v.NextResponse.json({error:"API key is required"},{status:400});let d=new w.v,e=await d.validateApiKey(b,c||"us-east-1"),f=d.extractEmailFromJWT(e.accessToken),g=await (0,x.createProviderConnection)({provider:"kiro",authType:"api_key",accessToken:e.accessToken,refreshToken:null,expiresAt:new Date(Date.now()+31536e6).toISOString(),email:f||null,providerSpecificData:{profileArn:e.profileArn,region:e.region,authMethod:"api_key",provider:"API Key"},testStatus:"active"});return v.NextResponse.json({success:!0,connection:{id:g.id,provider:g.provider,email:g.email}})}catch(a){return console.log("Kiro API key import error:",a),v.NextResponse.json({error:"API key validation failed"},{status:500})}}let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/oauth/kiro/api-key/route",pathname:"/api/oauth/kiro/api-key",filename:"route",bundlePath:"app/api/oauth/kiro/api-key/route"},distDir:".next-cli-build",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/VansRouter/VansRouter/src/app/api/oauth/kiro/api-key/route.js",nextConfigOutput:"standalone",userland:d,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function D(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function E(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/oauth/kiro/api-key/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},55511:a=>{a.exports=require("crypto")},59824:(a,b,c)=>{c.d(b,{DI:()=>i,Hp:()=>k,LT:()=>j,MZ:()=>v,Nl:()=>z,Nu:()=>p,OV:()=>h,Op:()=>A,S6:()=>s,Tx:()=>q,WN:()=>t,Ww:()=>B,YT:()=>n,ZL:()=>m,cD:()=>o,f7:()=>y,hF:()=>l,lB:()=>w,t:()=>u,w1:()=>x});var d=c(21820),e=c(24567),f=c(68711);function g(){let a=(0,d.platform)(),b=(0,d.arch)();return"darwin"===a?"arm64"===b?2:1:"linux"===a?"arm64"===b?4:3:5*("win32"===a)}let h={...f.sr.claude},i={...f.sr.codex},j={...e.w3,...f.sr["gemini-cli"]},k={...f.sr.qwen},l={...f.sr.qoder},m={...f.sr.iflow},n={...e.XP,...f.sr.antigravity,loadCodeAssistClientMetadata:JSON.stringify({ideType:9,platform:g(),pluginType:2})};function o(){return{ideType:9,platform:g(),pluginType:2}}({...f.sr.openai});let p={...f.sr.github},q={...f.sr.kiro},r=/^[a-z]{2}-[a-z]+-\d{1,2}$/;function s(a){if("string"!=typeof a||!r.test(a))throw Error("Invalid region");return a}let t={...f.sr.cursor,tokenStoragePaths:{linux:"~/.config/Cursor/User/globalStorage/state.vscdb",macos:"/Users/<user>/Library/Application Support/Cursor/User/globalStorage/state.vscdb",windows:"%APPDATA%\\Cursor\\User\\globalStorage\\state.vscdb"}},u={...f.sr["kimi-coding"],clientId:process.env.KIMI_CODING_OAUTH_CLIENT_ID||f.xq["kimi-coding"]?.clientId},v={...f.sr.kilocode},w={...f.sr.cline},x={...f.sr.clinepass},y={...f.sr.gitlab},z={...f.sr["codebuddy-cn"]},A={...f.sr.zcode},B=3e5},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{a.exports=require("node:fs")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},87550:a=>{a.exports=require("better-sqlite3")},94164:(a,b,c)=>{c.d(b,{CG:()=>d.CG,Dj:()=>d.Dj,Fh:()=>d.Fh,Iq:()=>d.Iq,K1:()=>d.K1,KJ:()=>d.KJ,L:()=>d.L,L9:()=>d.L9,Lh:()=>d.Lh,Mc:()=>d.Mc,OM:()=>d.OM,PX:()=>d.PX,Pc:()=>d.Pc,Q_:()=>d.Q_,Qu:()=>d.Qu,S8:()=>d.S8,Uv:()=>d.Uv,VT:()=>d.VT,XW:()=>d.XW,Xx:()=>d.Xx,Yd:()=>d.Yd,ZO:()=>d.ZO,bI:()=>d.bI,c:()=>d.c,ek:()=>d.ek,fK:()=>d.fK,fv:()=>d.fv,getProviderConnections:()=>d.P,ho:()=>d.ho,hr:()=>d.hr,i0:()=>d.i0,iE:()=>d.iE,jd:()=>d.jd,mt:()=>d.mt,o5:()=>d.o5,oG:()=>d.oG,op:()=>d.op,r4:()=>d.r4,uL:()=>d.uL,ui:()=>d.ui,updateProviderConnection:()=>d.rj,uv:()=>d.uv,yF:()=>d.yF,yg:()=>d.yg,zP:()=>d.zP});var d=c(45479)},94735:a=>{a.exports=require("events")},98327:(a,b,c)=>{c.d(b,{v:()=>f});var d=c(59824);let e="https://prod.us-east-1.auth.desktop.kiro.dev";class f{async registerClient(a="us-east-1"){(0,d.S6)(a);let b=`https://oidc.${a}.amazonaws.com/client/register`,c=await fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientName:d.Tx.clientName,clientType:d.Tx.clientType,scopes:d.Tx.scopes,grantTypes:d.Tx.grantTypes,issuerUrl:d.Tx.issuerUrl})});if(!c.ok){let a=await c.text();throw Error(`Failed to register client: ${a}`)}let e=await c.json();return{clientId:e.clientId,clientSecret:e.clientSecret,clientSecretExpiresAt:e.clientSecretExpiresAt}}async startDeviceAuthorization(a,b,c,e="us-east-1"){(0,d.S6)(e);let f=`https://oidc.${e}.amazonaws.com/device_authorization`,g=await fetch(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:a,clientSecret:b,startUrl:c})});if(!g.ok){let a=await g.text();throw Error(`Failed to start device authorization: ${a}`)}let h=await g.json();return{deviceCode:h.deviceCode,userCode:h.userCode,verificationUri:h.verificationUri,verificationUriComplete:h.verificationUriComplete,expiresIn:h.expiresIn,interval:h.interval||5}}async pollDeviceToken(a,b,c,e="us-east-1"){(0,d.S6)(e);let f=`https://oidc.${e}.amazonaws.com/token`,g=await fetch(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:a,clientSecret:b,deviceCode:c,grantType:"urn:ietf:params:oauth:grant-type:device_code"})}),h=await g.json();return!g.ok||h.error?{success:!1,error:h.error,errorDescription:h.error_description,pending:"authorization_pending"===h.error||"slow_down"===h.error}:{success:!0,tokens:{accessToken:h.accessToken,refreshToken:h.refreshToken,expiresIn:h.expiresIn,tokenType:h.tokenType}}}buildSocialLoginUrl(a,b,c){return`${e}/login?idp=${"google"===a?"Google":"Github"}&redirect_uri=${encodeURIComponent("kiro://kiro.kiroAgent/authenticate-success")}&code_challenge=${b}&code_challenge_method=S256&state=${c}&prompt=select_account`}async exchangeSocialCode(a,b){let c=await fetch(`${e}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,code_verifier:b,redirect_uri:"kiro://kiro.kiroAgent/authenticate-success"})});if(!c.ok){let a=await c.text();throw Error(`Token exchange failed: ${a}`)}let d=await c.json();return{accessToken:d.accessToken,refreshToken:d.refreshToken,profileArn:d.profileArn,expiresIn:d.expiresIn||3600}}async refreshToken(a,b={}){let{authMethod:c,clientId:f,clientSecret:g,region:h}=b;if(f&&g){let b=h||"us-east-1";(0,d.S6)(b);let c=`https://oidc.${b}.amazonaws.com/token`,e=await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:f,clientSecret:g,refreshToken:a,grantType:"refresh_token"})});if(!e.ok){let a=await e.text();throw Error(`Token refresh failed: ${a}`)}let i=await e.json();return{accessToken:i.accessToken,refreshToken:i.refreshToken||a,profileArn:i.profileArn,expiresIn:i.expiresIn}}let i=await fetch(`${e}/refreshToken`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:a})});if(!i.ok){let a=await i.text();throw Error(`Token refresh failed: ${a}`)}let j=await i.json();return{accessToken:j.accessToken,refreshToken:j.refreshToken||a,profileArn:j.profileArn,expiresIn:j.expiresIn||3600}}async validateImportToken(a){if(!a.startsWith("aorAAAAAG"))throw Error("Invalid token format. Token should start with aorAAAAAG...");try{let b=await this.refreshToken(a);return{accessToken:b.accessToken,refreshToken:b.refreshToken||a,profileArn:b.profileArn,expiresIn:b.expiresIn,authMethod:"imported"}}catch(a){throw Error(`Token validation failed: ${a.message}`)}}async listAvailableProfiles(a,b="us-east-1"){(0,d.S6)(b);let c=`https://codewhisperer.${b}.amazonaws.com`,e=await fetch(c,{method:"POST",headers:{"Content-Type":"application/x-amz-json-1.0","x-amz-target":"AmazonCodeWhispererService.ListAvailableProfiles",Authorization:`Bearer ${a}`,Accept:"application/json"},body:JSON.stringify({maxResults:10})});if(!e.ok){let a=await e.text();throw Error(`Failed to list profiles: ${a}`)}let f=await e.json(),g=Array.isArray(f?.profiles)?f.profiles:[],h=a=>a?.arn||a?.profileArn||null,i=g.find(a=>h(a)?.split(":")[3]===b)||g[0];return h(i)}async validateApiKey(a,b="us-east-1"){if(!a||"string"!=typeof a||!a.trim())throw Error("API key is required");let c=a.trim(),d=null;try{d=await this.listAvailableProfiles(c,b)}catch(a){throw Error(`API key validation failed: ${a.message}`)}return{accessToken:c,refreshToken:null,profileArn:d,region:b,authMethod:"api_key"}}async listAvailableModels(a,b){let c=await fetch("https://codewhisperer.us-east-1.amazonaws.com",{method:"POST",headers:{"Content-Type":"application/x-amz-json-1.0","x-amz-target":"AmazonCodeWhispererService.ListAvailableModels",Authorization:`Bearer ${a}`,Accept:"application/json"},body:JSON.stringify({origin:"AI_EDITOR",profileArn:b})});if(!c.ok){let a=await c.text();throw Error(`Failed to list models: ${a}`)}return((await c.json()).models||[]).map(a=>({id:a.modelId,name:a.modelName||a.modelId,description:a.description,rateMultiplier:a.rateMultiplier,rateUnit:a.rateUnit,maxInputTokens:a.tokenLimits?.maxInputTokens||0}))}extractEmailFromJWT(a){try{let b=a.split(".");if(3!==b.length)return null;let c=b[1];for(;c.length%4;)c+="=";let d=JSON.parse(atob(c.replace(/-/g,"+").replace(/_/g,"/")));return d.email||d.preferred_username||d.sub}catch{return null}}}}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[1348,4777,9633,9765,8711],()=>b(b.s=47221));module.exports=c})();
1
+ "use strict";(()=>{var a={};a.id=1704,a.ids=[1704,6820],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},21820:a=>{a.exports=require("os")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},46293:a=>{a.exports=require("sql.js")},46820:(a,b,c)=>{c.d(b,{Fh:()=>d.Fh,L9:()=>d.L9,Mc:()=>d.Mc,OM:()=>d.OM,P:()=>d.getProviderConnections,Pc:()=>d.Pc,Q_:()=>d.Q_,Qu:()=>d.Qu,S8:()=>d.S8,Yd:()=>d.Yd,ZO:()=>d.ZO,c:()=>d.c,createProviderConnection:()=>d.iE,fK:()=>d.fK,fv:()=>d.fv,ho:()=>d.ho,hr:()=>d.hr,i0:()=>d.i0,o5:()=>d.o5,op:()=>d.op,rj:()=>d.updateProviderConnection,uL:()=>d.uL,ui:()=>d.ui,uv:()=>d.uv});var d=c(94164)},47221:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>E,patchFetch:()=>D,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var d={};c.r(d),c.d(d,{POST:()=>y});var e=c(12334),f=c(59399),g=c(8894),h=c(83760),i=c(34958),j=c(970),k=c(261),l=c(28112),m=c(52194),n=c(9410),o=c(68673),p=c(47471),q=c(13093),r=c(98563),s=c(7572),t=c(86439),u=c(33610),v=c(77231),w=c(98327),x=c(46820);async function y(a){try{let{apiKey:b,region:c}=await a.json();if(!b||"string"!=typeof b||!b.trim())return v.NextResponse.json({error:"API key is required"},{status:400});let d=new w.v,e=await d.validateApiKey(b,c||"us-east-1"),f=d.extractEmailFromJWT(e.accessToken),g=await (0,x.createProviderConnection)({provider:"kiro",authType:"api_key",accessToken:e.accessToken,refreshToken:null,expiresAt:new Date(Date.now()+31536e6).toISOString(),email:f||null,providerSpecificData:{profileArn:e.profileArn,region:e.region,authMethod:"api_key",provider:"API Key"},testStatus:"active"});return v.NextResponse.json({success:!0,connection:{id:g.id,provider:g.provider,email:g.email}})}catch(a){return console.log("Kiro API key import error:",a),v.NextResponse.json({error:"API key validation failed"},{status:500})}}let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/oauth/kiro/api-key/route",pathname:"/api/oauth/kiro/api-key",filename:"route",bundlePath:"app/api/oauth/kiro/api-key/route"},distDir:".next-cli-build",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/VansRouter/VansRouter/src/app/api/oauth/kiro/api-key/route.js",nextConfigOutput:"standalone",userland:d,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function D(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function E(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/oauth/kiro/api-key/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},55511:a=>{a.exports=require("crypto")},59824:(a,b,c)=>{c.d(b,{DI:()=>i,Hp:()=>k,LT:()=>j,MZ:()=>v,Nl:()=>y,Nu:()=>p,OV:()=>h,Op:()=>z,S6:()=>s,Tx:()=>q,WN:()=>t,Ww:()=>A,YT:()=>n,ZL:()=>m,cD:()=>o,f7:()=>x,hF:()=>l,lB:()=>w,t:()=>u});var d=c(21820),e=c(24567),f=c(68711);function g(){let a=(0,d.platform)(),b=(0,d.arch)();return"darwin"===a?"arm64"===b?2:1:"linux"===a?"arm64"===b?4:3:5*("win32"===a)}let h={...f.sr.claude},i={...f.sr.codex},j={...e.w3,...f.sr["gemini-cli"]},k={...f.sr.qwen},l={...f.sr.qoder},m={...f.sr.iflow},n={...e.XP,...f.sr.antigravity,loadCodeAssistClientMetadata:JSON.stringify({ideType:9,platform:g(),pluginType:2})};function o(){return{ideType:9,platform:g(),pluginType:2}}({...f.sr.openai});let p={...f.sr.github},q={...f.sr.kiro},r=/^[a-z]{2}-[a-z]+-\d{1,2}$/;function s(a){if("string"!=typeof a||!r.test(a))throw Error("Invalid region");return a}let t={...f.sr.cursor,tokenStoragePaths:{linux:"~/.config/Cursor/User/globalStorage/state.vscdb",macos:"/Users/<user>/Library/Application Support/Cursor/User/globalStorage/state.vscdb",windows:"%APPDATA%\\Cursor\\User\\globalStorage\\state.vscdb"}},u={...f.sr["kimi-coding"],clientId:process.env.KIMI_CODING_OAUTH_CLIENT_ID||f.xq["kimi-coding"]?.clientId},v={...f.sr.kilocode},w={...f.sr.cline},x={...f.sr.gitlab},y={...f.sr["codebuddy-cn"]},z={...f.sr.zcode},A=3e5},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{a.exports=require("node:fs")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},87550:a=>{a.exports=require("better-sqlite3")},94164:(a,b,c)=>{c.d(b,{CG:()=>d.CG,Dj:()=>d.Dj,Fh:()=>d.Fh,Iq:()=>d.Iq,K1:()=>d.K1,KJ:()=>d.KJ,L:()=>d.L,L9:()=>d.L9,Lh:()=>d.Lh,Mc:()=>d.Mc,OM:()=>d.OM,PX:()=>d.PX,Pc:()=>d.Pc,Q_:()=>d.Q_,Qu:()=>d.Qu,S8:()=>d.S8,Uv:()=>d.Uv,VT:()=>d.VT,XW:()=>d.XW,Xx:()=>d.Xx,Yd:()=>d.Yd,ZO:()=>d.ZO,bI:()=>d.bI,c:()=>d.c,ek:()=>d.ek,fK:()=>d.fK,fv:()=>d.fv,getProviderConnections:()=>d.P,ho:()=>d.ho,hr:()=>d.hr,i0:()=>d.i0,iE:()=>d.iE,jd:()=>d.jd,mt:()=>d.mt,o5:()=>d.o5,oG:()=>d.oG,op:()=>d.op,r4:()=>d.r4,uL:()=>d.uL,ui:()=>d.ui,updateProviderConnection:()=>d.rj,uv:()=>d.uv,yF:()=>d.yF,yg:()=>d.yg,zP:()=>d.zP});var d=c(45479)},94735:a=>{a.exports=require("events")},98327:(a,b,c)=>{c.d(b,{v:()=>f});var d=c(59824);let e="https://prod.us-east-1.auth.desktop.kiro.dev";class f{async registerClient(a="us-east-1"){(0,d.S6)(a);let b=`https://oidc.${a}.amazonaws.com/client/register`,c=await fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientName:d.Tx.clientName,clientType:d.Tx.clientType,scopes:d.Tx.scopes,grantTypes:d.Tx.grantTypes,issuerUrl:d.Tx.issuerUrl})});if(!c.ok){let a=await c.text();throw Error(`Failed to register client: ${a}`)}let e=await c.json();return{clientId:e.clientId,clientSecret:e.clientSecret,clientSecretExpiresAt:e.clientSecretExpiresAt}}async startDeviceAuthorization(a,b,c,e="us-east-1"){(0,d.S6)(e);let f=`https://oidc.${e}.amazonaws.com/device_authorization`,g=await fetch(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:a,clientSecret:b,startUrl:c})});if(!g.ok){let a=await g.text();throw Error(`Failed to start device authorization: ${a}`)}let h=await g.json();return{deviceCode:h.deviceCode,userCode:h.userCode,verificationUri:h.verificationUri,verificationUriComplete:h.verificationUriComplete,expiresIn:h.expiresIn,interval:h.interval||5}}async pollDeviceToken(a,b,c,e="us-east-1"){(0,d.S6)(e);let f=`https://oidc.${e}.amazonaws.com/token`,g=await fetch(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:a,clientSecret:b,deviceCode:c,grantType:"urn:ietf:params:oauth:grant-type:device_code"})}),h=await g.json();return!g.ok||h.error?{success:!1,error:h.error,errorDescription:h.error_description,pending:"authorization_pending"===h.error||"slow_down"===h.error}:{success:!0,tokens:{accessToken:h.accessToken,refreshToken:h.refreshToken,expiresIn:h.expiresIn,tokenType:h.tokenType}}}buildSocialLoginUrl(a,b,c){return`${e}/login?idp=${"google"===a?"Google":"Github"}&redirect_uri=${encodeURIComponent("kiro://kiro.kiroAgent/authenticate-success")}&code_challenge=${b}&code_challenge_method=S256&state=${c}&prompt=select_account`}async exchangeSocialCode(a,b){let c=await fetch(`${e}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,code_verifier:b,redirect_uri:"kiro://kiro.kiroAgent/authenticate-success"})});if(!c.ok){let a=await c.text();throw Error(`Token exchange failed: ${a}`)}let d=await c.json();return{accessToken:d.accessToken,refreshToken:d.refreshToken,profileArn:d.profileArn,expiresIn:d.expiresIn||3600}}async refreshToken(a,b={}){let{authMethod:c,clientId:f,clientSecret:g,region:h}=b;if(f&&g){let b=h||"us-east-1";(0,d.S6)(b);let c=`https://oidc.${b}.amazonaws.com/token`,e=await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:f,clientSecret:g,refreshToken:a,grantType:"refresh_token"})});if(!e.ok){let a=await e.text();throw Error(`Token refresh failed: ${a}`)}let i=await e.json();return{accessToken:i.accessToken,refreshToken:i.refreshToken||a,profileArn:i.profileArn,expiresIn:i.expiresIn}}let i=await fetch(`${e}/refreshToken`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:a})});if(!i.ok){let a=await i.text();throw Error(`Token refresh failed: ${a}`)}let j=await i.json();return{accessToken:j.accessToken,refreshToken:j.refreshToken||a,profileArn:j.profileArn,expiresIn:j.expiresIn||3600}}async validateImportToken(a){if(!a.startsWith("aorAAAAAG"))throw Error("Invalid token format. Token should start with aorAAAAAG...");try{let b=await this.refreshToken(a);return{accessToken:b.accessToken,refreshToken:b.refreshToken||a,profileArn:b.profileArn,expiresIn:b.expiresIn,authMethod:"imported"}}catch(a){throw Error(`Token validation failed: ${a.message}`)}}async listAvailableProfiles(a,b="us-east-1"){(0,d.S6)(b);let c=`https://codewhisperer.${b}.amazonaws.com`,e=await fetch(c,{method:"POST",headers:{"Content-Type":"application/x-amz-json-1.0","x-amz-target":"AmazonCodeWhispererService.ListAvailableProfiles",Authorization:`Bearer ${a}`,Accept:"application/json"},body:JSON.stringify({maxResults:10})});if(!e.ok){let a=await e.text();throw Error(`Failed to list profiles: ${a}`)}let f=await e.json(),g=Array.isArray(f?.profiles)?f.profiles:[],h=a=>a?.arn||a?.profileArn||null,i=g.find(a=>h(a)?.split(":")[3]===b)||g[0];return h(i)}async validateApiKey(a,b="us-east-1"){if(!a||"string"!=typeof a||!a.trim())throw Error("API key is required");let c=a.trim(),d=null;try{d=await this.listAvailableProfiles(c,b)}catch(a){throw Error(`API key validation failed: ${a.message}`)}return{accessToken:c,refreshToken:null,profileArn:d,region:b,authMethod:"api_key"}}async listAvailableModels(a,b){let c=await fetch("https://codewhisperer.us-east-1.amazonaws.com",{method:"POST",headers:{"Content-Type":"application/x-amz-json-1.0","x-amz-target":"AmazonCodeWhispererService.ListAvailableModels",Authorization:`Bearer ${a}`,Accept:"application/json"},body:JSON.stringify({origin:"AI_EDITOR",profileArn:b})});if(!c.ok){let a=await c.text();throw Error(`Failed to list models: ${a}`)}return((await c.json()).models||[]).map(a=>({id:a.modelId,name:a.modelName||a.modelId,description:a.description,rateMultiplier:a.rateMultiplier,rateUnit:a.rateUnit,maxInputTokens:a.tokenLimits?.maxInputTokens||0}))}extractEmailFromJWT(a){try{let b=a.split(".");if(3!==b.length)return null;let c=b[1];for(;c.length%4;)c+="=";let d=JSON.parse(atob(c.replace(/-/g,"+").replace(/_/g,"/")));return d.email||d.preferred_username||d.sub}catch{return null}}}}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[1348,4777,9633,9765,8711],()=>b(b.s=47221));module.exports=c})();
@@ -1 +1 @@
1
- "use strict";(()=>{var a={};a.id=7429,a.ids=[6820,7429],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},21820:a=>{a.exports=require("os")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},46293:a=>{a.exports=require("sql.js")},46820:(a,b,c)=>{c.d(b,{Fh:()=>d.Fh,L9:()=>d.L9,Mc:()=>d.Mc,OM:()=>d.OM,P:()=>d.getProviderConnections,Pc:()=>d.Pc,Q_:()=>d.Q_,Qu:()=>d.Qu,S8:()=>d.S8,Yd:()=>d.Yd,ZO:()=>d.ZO,c:()=>d.c,createProviderConnection:()=>d.iE,fK:()=>d.fK,fv:()=>d.fv,ho:()=>d.ho,hr:()=>d.hr,i0:()=>d.i0,o5:()=>d.o5,op:()=>d.op,rj:()=>d.updateProviderConnection,uL:()=>d.uL,ui:()=>d.ui,uv:()=>d.uv});var d=c(94164)},55511:a=>{a.exports=require("crypto")},59824:(a,b,c)=>{c.d(b,{DI:()=>i,Hp:()=>k,LT:()=>j,MZ:()=>v,Nl:()=>z,Nu:()=>p,OV:()=>h,Op:()=>A,S6:()=>s,Tx:()=>q,WN:()=>t,Ww:()=>B,YT:()=>n,ZL:()=>m,cD:()=>o,f7:()=>y,hF:()=>l,lB:()=>w,t:()=>u,w1:()=>x});var d=c(21820),e=c(24567),f=c(68711);function g(){let a=(0,d.platform)(),b=(0,d.arch)();return"darwin"===a?"arm64"===b?2:1:"linux"===a?"arm64"===b?4:3:5*("win32"===a)}let h={...f.sr.claude},i={...f.sr.codex},j={...e.w3,...f.sr["gemini-cli"]},k={...f.sr.qwen},l={...f.sr.qoder},m={...f.sr.iflow},n={...e.XP,...f.sr.antigravity,loadCodeAssistClientMetadata:JSON.stringify({ideType:9,platform:g(),pluginType:2})};function o(){return{ideType:9,platform:g(),pluginType:2}}({...f.sr.openai});let p={...f.sr.github},q={...f.sr.kiro},r=/^[a-z]{2}-[a-z]+-\d{1,2}$/;function s(a){if("string"!=typeof a||!r.test(a))throw Error("Invalid region");return a}let t={...f.sr.cursor,tokenStoragePaths:{linux:"~/.config/Cursor/User/globalStorage/state.vscdb",macos:"/Users/<user>/Library/Application Support/Cursor/User/globalStorage/state.vscdb",windows:"%APPDATA%\\Cursor\\User\\globalStorage\\state.vscdb"}},u={...f.sr["kimi-coding"],clientId:process.env.KIMI_CODING_OAUTH_CLIENT_ID||f.xq["kimi-coding"]?.clientId},v={...f.sr.kilocode},w={...f.sr.cline},x={...f.sr.clinepass},y={...f.sr.gitlab},z={...f.sr["codebuddy-cn"]},A={...f.sr.zcode},B=3e5},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{a.exports=require("node:fs")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},87550:a=>{a.exports=require("better-sqlite3")},89650:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>E,patchFetch:()=>D,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var d={};c.r(d),c.d(d,{POST:()=>y});var e=c(12334),f=c(59399),g=c(8894),h=c(83760),i=c(34958),j=c(970),k=c(261),l=c(28112),m=c(52194),n=c(9410),o=c(68673),p=c(47471),q=c(13093),r=c(98563),s=c(7572),t=c(86439),u=c(33610),v=c(77231),w=c(98327),x=c(46820);async function y(a){try{let{refreshToken:b,clientId:c,clientSecret:d,region:e,authMethod:f,profileArn:g}=await a.json();if(!b||"string"!=typeof b)return v.NextResponse.json({error:"Refresh token is required"},{status:400});let h=new w.v,i=!!(c&&d),j=await h.refreshToken(b.trim(),i?{clientId:c,clientSecret:d,region:e||"us-east-1",authMethod:"idc"}:{}),k=h.extractEmailFromJWT(j.accessToken),l=g||j.profileArn||null,m=await (0,x.createProviderConnection)({provider:"kiro",authType:"oauth",accessToken:j.accessToken,refreshToken:j.refreshToken||b.trim(),expiresAt:new Date(Date.now()+1e3*(j.expiresIn||3600)).toISOString(),email:k||null,providerSpecificData:{profileArn:l,authMethod:i?"idc":"imported",provider:i?"Enterprise":"Imported",...i?{clientId:c,clientSecret:d,region:e||"us-east-1"}:{}},testStatus:"active"});return v.NextResponse.json({success:!0,connection:{id:m.id,provider:m.provider,email:m.email}})}catch(a){return console.log("Kiro import token error:",a),v.NextResponse.json({error:a.message},{status:500})}}let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/oauth/kiro/import/route",pathname:"/api/oauth/kiro/import",filename:"route",bundlePath:"app/api/oauth/kiro/import/route"},distDir:".next-cli-build",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/VansRouter/VansRouter/src/app/api/oauth/kiro/import/route.js",nextConfigOutput:"standalone",userland:d,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function D(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function E(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/oauth/kiro/import/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},94164:(a,b,c)=>{c.d(b,{CG:()=>d.CG,Dj:()=>d.Dj,Fh:()=>d.Fh,Iq:()=>d.Iq,K1:()=>d.K1,KJ:()=>d.KJ,L:()=>d.L,L9:()=>d.L9,Lh:()=>d.Lh,Mc:()=>d.Mc,OM:()=>d.OM,PX:()=>d.PX,Pc:()=>d.Pc,Q_:()=>d.Q_,Qu:()=>d.Qu,S8:()=>d.S8,Uv:()=>d.Uv,VT:()=>d.VT,XW:()=>d.XW,Xx:()=>d.Xx,Yd:()=>d.Yd,ZO:()=>d.ZO,bI:()=>d.bI,c:()=>d.c,ek:()=>d.ek,fK:()=>d.fK,fv:()=>d.fv,getProviderConnections:()=>d.P,ho:()=>d.ho,hr:()=>d.hr,i0:()=>d.i0,iE:()=>d.iE,jd:()=>d.jd,mt:()=>d.mt,o5:()=>d.o5,oG:()=>d.oG,op:()=>d.op,r4:()=>d.r4,uL:()=>d.uL,ui:()=>d.ui,updateProviderConnection:()=>d.rj,uv:()=>d.uv,yF:()=>d.yF,yg:()=>d.yg,zP:()=>d.zP});var d=c(45479)},94735:a=>{a.exports=require("events")},98327:(a,b,c)=>{c.d(b,{v:()=>f});var d=c(59824);let e="https://prod.us-east-1.auth.desktop.kiro.dev";class f{async registerClient(a="us-east-1"){(0,d.S6)(a);let b=`https://oidc.${a}.amazonaws.com/client/register`,c=await fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientName:d.Tx.clientName,clientType:d.Tx.clientType,scopes:d.Tx.scopes,grantTypes:d.Tx.grantTypes,issuerUrl:d.Tx.issuerUrl})});if(!c.ok){let a=await c.text();throw Error(`Failed to register client: ${a}`)}let e=await c.json();return{clientId:e.clientId,clientSecret:e.clientSecret,clientSecretExpiresAt:e.clientSecretExpiresAt}}async startDeviceAuthorization(a,b,c,e="us-east-1"){(0,d.S6)(e);let f=`https://oidc.${e}.amazonaws.com/device_authorization`,g=await fetch(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:a,clientSecret:b,startUrl:c})});if(!g.ok){let a=await g.text();throw Error(`Failed to start device authorization: ${a}`)}let h=await g.json();return{deviceCode:h.deviceCode,userCode:h.userCode,verificationUri:h.verificationUri,verificationUriComplete:h.verificationUriComplete,expiresIn:h.expiresIn,interval:h.interval||5}}async pollDeviceToken(a,b,c,e="us-east-1"){(0,d.S6)(e);let f=`https://oidc.${e}.amazonaws.com/token`,g=await fetch(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:a,clientSecret:b,deviceCode:c,grantType:"urn:ietf:params:oauth:grant-type:device_code"})}),h=await g.json();return!g.ok||h.error?{success:!1,error:h.error,errorDescription:h.error_description,pending:"authorization_pending"===h.error||"slow_down"===h.error}:{success:!0,tokens:{accessToken:h.accessToken,refreshToken:h.refreshToken,expiresIn:h.expiresIn,tokenType:h.tokenType}}}buildSocialLoginUrl(a,b,c){return`${e}/login?idp=${"google"===a?"Google":"Github"}&redirect_uri=${encodeURIComponent("kiro://kiro.kiroAgent/authenticate-success")}&code_challenge=${b}&code_challenge_method=S256&state=${c}&prompt=select_account`}async exchangeSocialCode(a,b){let c=await fetch(`${e}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,code_verifier:b,redirect_uri:"kiro://kiro.kiroAgent/authenticate-success"})});if(!c.ok){let a=await c.text();throw Error(`Token exchange failed: ${a}`)}let d=await c.json();return{accessToken:d.accessToken,refreshToken:d.refreshToken,profileArn:d.profileArn,expiresIn:d.expiresIn||3600}}async refreshToken(a,b={}){let{authMethod:c,clientId:f,clientSecret:g,region:h}=b;if(f&&g){let b=h||"us-east-1";(0,d.S6)(b);let c=`https://oidc.${b}.amazonaws.com/token`,e=await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:f,clientSecret:g,refreshToken:a,grantType:"refresh_token"})});if(!e.ok){let a=await e.text();throw Error(`Token refresh failed: ${a}`)}let i=await e.json();return{accessToken:i.accessToken,refreshToken:i.refreshToken||a,profileArn:i.profileArn,expiresIn:i.expiresIn}}let i=await fetch(`${e}/refreshToken`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:a})});if(!i.ok){let a=await i.text();throw Error(`Token refresh failed: ${a}`)}let j=await i.json();return{accessToken:j.accessToken,refreshToken:j.refreshToken||a,profileArn:j.profileArn,expiresIn:j.expiresIn||3600}}async validateImportToken(a){if(!a.startsWith("aorAAAAAG"))throw Error("Invalid token format. Token should start with aorAAAAAG...");try{let b=await this.refreshToken(a);return{accessToken:b.accessToken,refreshToken:b.refreshToken||a,profileArn:b.profileArn,expiresIn:b.expiresIn,authMethod:"imported"}}catch(a){throw Error(`Token validation failed: ${a.message}`)}}async listAvailableProfiles(a,b="us-east-1"){(0,d.S6)(b);let c=`https://codewhisperer.${b}.amazonaws.com`,e=await fetch(c,{method:"POST",headers:{"Content-Type":"application/x-amz-json-1.0","x-amz-target":"AmazonCodeWhispererService.ListAvailableProfiles",Authorization:`Bearer ${a}`,Accept:"application/json"},body:JSON.stringify({maxResults:10})});if(!e.ok){let a=await e.text();throw Error(`Failed to list profiles: ${a}`)}let f=await e.json(),g=Array.isArray(f?.profiles)?f.profiles:[],h=a=>a?.arn||a?.profileArn||null,i=g.find(a=>h(a)?.split(":")[3]===b)||g[0];return h(i)}async validateApiKey(a,b="us-east-1"){if(!a||"string"!=typeof a||!a.trim())throw Error("API key is required");let c=a.trim(),d=null;try{d=await this.listAvailableProfiles(c,b)}catch(a){throw Error(`API key validation failed: ${a.message}`)}return{accessToken:c,refreshToken:null,profileArn:d,region:b,authMethod:"api_key"}}async listAvailableModels(a,b){let c=await fetch("https://codewhisperer.us-east-1.amazonaws.com",{method:"POST",headers:{"Content-Type":"application/x-amz-json-1.0","x-amz-target":"AmazonCodeWhispererService.ListAvailableModels",Authorization:`Bearer ${a}`,Accept:"application/json"},body:JSON.stringify({origin:"AI_EDITOR",profileArn:b})});if(!c.ok){let a=await c.text();throw Error(`Failed to list models: ${a}`)}return((await c.json()).models||[]).map(a=>({id:a.modelId,name:a.modelName||a.modelId,description:a.description,rateMultiplier:a.rateMultiplier,rateUnit:a.rateUnit,maxInputTokens:a.tokenLimits?.maxInputTokens||0}))}extractEmailFromJWT(a){try{let b=a.split(".");if(3!==b.length)return null;let c=b[1];for(;c.length%4;)c+="=";let d=JSON.parse(atob(c.replace(/-/g,"+").replace(/_/g,"/")));return d.email||d.preferred_username||d.sub}catch{return null}}}}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[1348,4777,9633,9765,8711],()=>b(b.s=89650));module.exports=c})();
1
+ "use strict";(()=>{var a={};a.id=7429,a.ids=[6820,7429],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},21820:a=>{a.exports=require("os")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},46293:a=>{a.exports=require("sql.js")},46820:(a,b,c)=>{c.d(b,{Fh:()=>d.Fh,L9:()=>d.L9,Mc:()=>d.Mc,OM:()=>d.OM,P:()=>d.getProviderConnections,Pc:()=>d.Pc,Q_:()=>d.Q_,Qu:()=>d.Qu,S8:()=>d.S8,Yd:()=>d.Yd,ZO:()=>d.ZO,c:()=>d.c,createProviderConnection:()=>d.iE,fK:()=>d.fK,fv:()=>d.fv,ho:()=>d.ho,hr:()=>d.hr,i0:()=>d.i0,o5:()=>d.o5,op:()=>d.op,rj:()=>d.updateProviderConnection,uL:()=>d.uL,ui:()=>d.ui,uv:()=>d.uv});var d=c(94164)},55511:a=>{a.exports=require("crypto")},59824:(a,b,c)=>{c.d(b,{DI:()=>i,Hp:()=>k,LT:()=>j,MZ:()=>v,Nl:()=>y,Nu:()=>p,OV:()=>h,Op:()=>z,S6:()=>s,Tx:()=>q,WN:()=>t,Ww:()=>A,YT:()=>n,ZL:()=>m,cD:()=>o,f7:()=>x,hF:()=>l,lB:()=>w,t:()=>u});var d=c(21820),e=c(24567),f=c(68711);function g(){let a=(0,d.platform)(),b=(0,d.arch)();return"darwin"===a?"arm64"===b?2:1:"linux"===a?"arm64"===b?4:3:5*("win32"===a)}let h={...f.sr.claude},i={...f.sr.codex},j={...e.w3,...f.sr["gemini-cli"]},k={...f.sr.qwen},l={...f.sr.qoder},m={...f.sr.iflow},n={...e.XP,...f.sr.antigravity,loadCodeAssistClientMetadata:JSON.stringify({ideType:9,platform:g(),pluginType:2})};function o(){return{ideType:9,platform:g(),pluginType:2}}({...f.sr.openai});let p={...f.sr.github},q={...f.sr.kiro},r=/^[a-z]{2}-[a-z]+-\d{1,2}$/;function s(a){if("string"!=typeof a||!r.test(a))throw Error("Invalid region");return a}let t={...f.sr.cursor,tokenStoragePaths:{linux:"~/.config/Cursor/User/globalStorage/state.vscdb",macos:"/Users/<user>/Library/Application Support/Cursor/User/globalStorage/state.vscdb",windows:"%APPDATA%\\Cursor\\User\\globalStorage\\state.vscdb"}},u={...f.sr["kimi-coding"],clientId:process.env.KIMI_CODING_OAUTH_CLIENT_ID||f.xq["kimi-coding"]?.clientId},v={...f.sr.kilocode},w={...f.sr.cline},x={...f.sr.gitlab},y={...f.sr["codebuddy-cn"]},z={...f.sr.zcode},A=3e5},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{a.exports=require("node:fs")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},87550:a=>{a.exports=require("better-sqlite3")},89650:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>E,patchFetch:()=>D,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var d={};c.r(d),c.d(d,{POST:()=>y});var e=c(12334),f=c(59399),g=c(8894),h=c(83760),i=c(34958),j=c(970),k=c(261),l=c(28112),m=c(52194),n=c(9410),o=c(68673),p=c(47471),q=c(13093),r=c(98563),s=c(7572),t=c(86439),u=c(33610),v=c(77231),w=c(98327),x=c(46820);async function y(a){try{let{refreshToken:b,clientId:c,clientSecret:d,region:e,authMethod:f,profileArn:g}=await a.json();if(!b||"string"!=typeof b)return v.NextResponse.json({error:"Refresh token is required"},{status:400});let h=new w.v,i=!!(c&&d),j=await h.refreshToken(b.trim(),i?{clientId:c,clientSecret:d,region:e||"us-east-1",authMethod:"idc"}:{}),k=h.extractEmailFromJWT(j.accessToken),l=g||j.profileArn||null,m=await (0,x.createProviderConnection)({provider:"kiro",authType:"oauth",accessToken:j.accessToken,refreshToken:j.refreshToken||b.trim(),expiresAt:new Date(Date.now()+1e3*(j.expiresIn||3600)).toISOString(),email:k||null,providerSpecificData:{profileArn:l,authMethod:i?"idc":"imported",provider:i?"Enterprise":"Imported",...i?{clientId:c,clientSecret:d,region:e||"us-east-1"}:{}},testStatus:"active"});return v.NextResponse.json({success:!0,connection:{id:m.id,provider:m.provider,email:m.email}})}catch(a){return console.log("Kiro import token error:",a),v.NextResponse.json({error:a.message},{status:500})}}let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/oauth/kiro/import/route",pathname:"/api/oauth/kiro/import",filename:"route",bundlePath:"app/api/oauth/kiro/import/route"},distDir:".next-cli-build",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/VansRouter/VansRouter/src/app/api/oauth/kiro/import/route.js",nextConfigOutput:"standalone",userland:d,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function D(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function E(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/oauth/kiro/import/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},94164:(a,b,c)=>{c.d(b,{CG:()=>d.CG,Dj:()=>d.Dj,Fh:()=>d.Fh,Iq:()=>d.Iq,K1:()=>d.K1,KJ:()=>d.KJ,L:()=>d.L,L9:()=>d.L9,Lh:()=>d.Lh,Mc:()=>d.Mc,OM:()=>d.OM,PX:()=>d.PX,Pc:()=>d.Pc,Q_:()=>d.Q_,Qu:()=>d.Qu,S8:()=>d.S8,Uv:()=>d.Uv,VT:()=>d.VT,XW:()=>d.XW,Xx:()=>d.Xx,Yd:()=>d.Yd,ZO:()=>d.ZO,bI:()=>d.bI,c:()=>d.c,ek:()=>d.ek,fK:()=>d.fK,fv:()=>d.fv,getProviderConnections:()=>d.P,ho:()=>d.ho,hr:()=>d.hr,i0:()=>d.i0,iE:()=>d.iE,jd:()=>d.jd,mt:()=>d.mt,o5:()=>d.o5,oG:()=>d.oG,op:()=>d.op,r4:()=>d.r4,uL:()=>d.uL,ui:()=>d.ui,updateProviderConnection:()=>d.rj,uv:()=>d.uv,yF:()=>d.yF,yg:()=>d.yg,zP:()=>d.zP});var d=c(45479)},94735:a=>{a.exports=require("events")},98327:(a,b,c)=>{c.d(b,{v:()=>f});var d=c(59824);let e="https://prod.us-east-1.auth.desktop.kiro.dev";class f{async registerClient(a="us-east-1"){(0,d.S6)(a);let b=`https://oidc.${a}.amazonaws.com/client/register`,c=await fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientName:d.Tx.clientName,clientType:d.Tx.clientType,scopes:d.Tx.scopes,grantTypes:d.Tx.grantTypes,issuerUrl:d.Tx.issuerUrl})});if(!c.ok){let a=await c.text();throw Error(`Failed to register client: ${a}`)}let e=await c.json();return{clientId:e.clientId,clientSecret:e.clientSecret,clientSecretExpiresAt:e.clientSecretExpiresAt}}async startDeviceAuthorization(a,b,c,e="us-east-1"){(0,d.S6)(e);let f=`https://oidc.${e}.amazonaws.com/device_authorization`,g=await fetch(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:a,clientSecret:b,startUrl:c})});if(!g.ok){let a=await g.text();throw Error(`Failed to start device authorization: ${a}`)}let h=await g.json();return{deviceCode:h.deviceCode,userCode:h.userCode,verificationUri:h.verificationUri,verificationUriComplete:h.verificationUriComplete,expiresIn:h.expiresIn,interval:h.interval||5}}async pollDeviceToken(a,b,c,e="us-east-1"){(0,d.S6)(e);let f=`https://oidc.${e}.amazonaws.com/token`,g=await fetch(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:a,clientSecret:b,deviceCode:c,grantType:"urn:ietf:params:oauth:grant-type:device_code"})}),h=await g.json();return!g.ok||h.error?{success:!1,error:h.error,errorDescription:h.error_description,pending:"authorization_pending"===h.error||"slow_down"===h.error}:{success:!0,tokens:{accessToken:h.accessToken,refreshToken:h.refreshToken,expiresIn:h.expiresIn,tokenType:h.tokenType}}}buildSocialLoginUrl(a,b,c){return`${e}/login?idp=${"google"===a?"Google":"Github"}&redirect_uri=${encodeURIComponent("kiro://kiro.kiroAgent/authenticate-success")}&code_challenge=${b}&code_challenge_method=S256&state=${c}&prompt=select_account`}async exchangeSocialCode(a,b){let c=await fetch(`${e}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,code_verifier:b,redirect_uri:"kiro://kiro.kiroAgent/authenticate-success"})});if(!c.ok){let a=await c.text();throw Error(`Token exchange failed: ${a}`)}let d=await c.json();return{accessToken:d.accessToken,refreshToken:d.refreshToken,profileArn:d.profileArn,expiresIn:d.expiresIn||3600}}async refreshToken(a,b={}){let{authMethod:c,clientId:f,clientSecret:g,region:h}=b;if(f&&g){let b=h||"us-east-1";(0,d.S6)(b);let c=`https://oidc.${b}.amazonaws.com/token`,e=await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:f,clientSecret:g,refreshToken:a,grantType:"refresh_token"})});if(!e.ok){let a=await e.text();throw Error(`Token refresh failed: ${a}`)}let i=await e.json();return{accessToken:i.accessToken,refreshToken:i.refreshToken||a,profileArn:i.profileArn,expiresIn:i.expiresIn}}let i=await fetch(`${e}/refreshToken`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:a})});if(!i.ok){let a=await i.text();throw Error(`Token refresh failed: ${a}`)}let j=await i.json();return{accessToken:j.accessToken,refreshToken:j.refreshToken||a,profileArn:j.profileArn,expiresIn:j.expiresIn||3600}}async validateImportToken(a){if(!a.startsWith("aorAAAAAG"))throw Error("Invalid token format. Token should start with aorAAAAAG...");try{let b=await this.refreshToken(a);return{accessToken:b.accessToken,refreshToken:b.refreshToken||a,profileArn:b.profileArn,expiresIn:b.expiresIn,authMethod:"imported"}}catch(a){throw Error(`Token validation failed: ${a.message}`)}}async listAvailableProfiles(a,b="us-east-1"){(0,d.S6)(b);let c=`https://codewhisperer.${b}.amazonaws.com`,e=await fetch(c,{method:"POST",headers:{"Content-Type":"application/x-amz-json-1.0","x-amz-target":"AmazonCodeWhispererService.ListAvailableProfiles",Authorization:`Bearer ${a}`,Accept:"application/json"},body:JSON.stringify({maxResults:10})});if(!e.ok){let a=await e.text();throw Error(`Failed to list profiles: ${a}`)}let f=await e.json(),g=Array.isArray(f?.profiles)?f.profiles:[],h=a=>a?.arn||a?.profileArn||null,i=g.find(a=>h(a)?.split(":")[3]===b)||g[0];return h(i)}async validateApiKey(a,b="us-east-1"){if(!a||"string"!=typeof a||!a.trim())throw Error("API key is required");let c=a.trim(),d=null;try{d=await this.listAvailableProfiles(c,b)}catch(a){throw Error(`API key validation failed: ${a.message}`)}return{accessToken:c,refreshToken:null,profileArn:d,region:b,authMethod:"api_key"}}async listAvailableModels(a,b){let c=await fetch("https://codewhisperer.us-east-1.amazonaws.com",{method:"POST",headers:{"Content-Type":"application/x-amz-json-1.0","x-amz-target":"AmazonCodeWhispererService.ListAvailableModels",Authorization:`Bearer ${a}`,Accept:"application/json"},body:JSON.stringify({origin:"AI_EDITOR",profileArn:b})});if(!c.ok){let a=await c.text();throw Error(`Failed to list models: ${a}`)}return((await c.json()).models||[]).map(a=>({id:a.modelId,name:a.modelName||a.modelId,description:a.description,rateMultiplier:a.rateMultiplier,rateUnit:a.rateUnit,maxInputTokens:a.tokenLimits?.maxInputTokens||0}))}extractEmailFromJWT(a){try{let b=a.split(".");if(3!==b.length)return null;let c=b[1];for(;c.length%4;)c+="=";let d=JSON.parse(atob(c.replace(/-/g,"+").replace(/_/g,"/")));return d.email||d.preferred_username||d.sub}catch{return null}}}}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[1348,4777,9633,9765,8711],()=>b(b.s=89650));module.exports=c})();
@@ -1 +1 @@
1
- (()=>{var a={};a.id=9069,a.ids=[9069],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},13674:()=>{},21820:a=>{"use strict";a.exports=require("os")},26254:(a,b,c)=>{"use strict";c.d(b,{$N:()=>f,OK:()=>g,Zl:()=>h,lz:()=>i});var d=c(55511),e=c.n(d);function f(a=32){return e().randomBytes(a).toString("base64url")}function g(a){return e().createHash("sha256").update(a).digest("base64url")}function h(){return e().randomBytes(32).toString("base64url")}function i(a=32){let b=f(a),c=g(b);return{codeVerifier:b,codeChallenge:c,state:h()}}},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},53570:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>E,patchFetch:()=>D,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var d={};c.r(d),c.d(d,{GET:()=>y});var e=c(12334),f=c(59399),g=c(8894),h=c(83760),i=c(34958),j=c(970),k=c(261),l=c(28112),m=c(52194),n=c(9410),o=c(68673),p=c(47471),q=c(13093),r=c(98563),s=c(7572),t=c(86439),u=c(33610),v=c(77231),w=c(26254),x=c(98327);async function y(a){try{let{searchParams:b}=new URL(a.url),c=b.get("provider");if(!c||!["google","github"].includes(c))return v.NextResponse.json({error:"Invalid provider. Use 'google' or 'github'"},{status:400});let{codeVerifier:d,codeChallenge:e,state:f}=(0,w.lz)(),g=new x.v().buildSocialLoginUrl(c,e,f);return v.NextResponse.json({authUrl:g,state:f,codeVerifier:d,codeChallenge:e,provider:c})}catch(a){return console.log("Kiro social authorize error:",a),v.NextResponse.json({error:a.message},{status:500})}}let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/oauth/kiro/social-authorize/route",pathname:"/api/oauth/kiro/social-authorize",filename:"route",bundlePath:"app/api/oauth/kiro/social-authorize/route"},distDir:".next-cli-build",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/VansRouter/VansRouter/src/app/api/oauth/kiro/social-authorize/route.js",nextConfigOutput:"standalone",userland:d,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function D(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function E(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/oauth/kiro/social-authorize/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},55511:a=>{"use strict";a.exports=require("crypto")},59824:(a,b,c)=>{"use strict";c.d(b,{DI:()=>i,Hp:()=>k,LT:()=>j,MZ:()=>v,Nl:()=>z,Nu:()=>p,OV:()=>h,Op:()=>A,S6:()=>s,Tx:()=>q,WN:()=>t,Ww:()=>B,YT:()=>n,ZL:()=>m,cD:()=>o,f7:()=>y,hF:()=>l,lB:()=>w,t:()=>u,w1:()=>x});var d=c(21820),e=c(24567),f=c(68711);function g(){let a=(0,d.platform)(),b=(0,d.arch)();return"darwin"===a?"arm64"===b?2:1:"linux"===a?"arm64"===b?4:3:5*("win32"===a)}let h={...f.sr.claude},i={...f.sr.codex},j={...e.w3,...f.sr["gemini-cli"]},k={...f.sr.qwen},l={...f.sr.qoder},m={...f.sr.iflow},n={...e.XP,...f.sr.antigravity,loadCodeAssistClientMetadata:JSON.stringify({ideType:9,platform:g(),pluginType:2})};function o(){return{ideType:9,platform:g(),pluginType:2}}({...f.sr.openai});let p={...f.sr.github},q={...f.sr.kiro},r=/^[a-z]{2}-[a-z]+-\d{1,2}$/;function s(a){if("string"!=typeof a||!r.test(a))throw Error("Invalid region");return a}let t={...f.sr.cursor,tokenStoragePaths:{linux:"~/.config/Cursor/User/globalStorage/state.vscdb",macos:"/Users/<user>/Library/Application Support/Cursor/User/globalStorage/state.vscdb",windows:"%APPDATA%\\Cursor\\User\\globalStorage\\state.vscdb"}},u={...f.sr["kimi-coding"],clientId:process.env.KIMI_CODING_OAUTH_CLIENT_ID||f.xq["kimi-coding"]?.clientId},v={...f.sr.kilocode},w={...f.sr.cline},x={...f.sr.clinepass},y={...f.sr.gitlab},z={...f.sr["codebuddy-cn"]},A={...f.sr.zcode},B=3e5},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},95522:()=>{},98327:(a,b,c)=>{"use strict";c.d(b,{v:()=>f});var d=c(59824);let e="https://prod.us-east-1.auth.desktop.kiro.dev";class f{async registerClient(a="us-east-1"){(0,d.S6)(a);let b=`https://oidc.${a}.amazonaws.com/client/register`,c=await fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientName:d.Tx.clientName,clientType:d.Tx.clientType,scopes:d.Tx.scopes,grantTypes:d.Tx.grantTypes,issuerUrl:d.Tx.issuerUrl})});if(!c.ok){let a=await c.text();throw Error(`Failed to register client: ${a}`)}let e=await c.json();return{clientId:e.clientId,clientSecret:e.clientSecret,clientSecretExpiresAt:e.clientSecretExpiresAt}}async startDeviceAuthorization(a,b,c,e="us-east-1"){(0,d.S6)(e);let f=`https://oidc.${e}.amazonaws.com/device_authorization`,g=await fetch(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:a,clientSecret:b,startUrl:c})});if(!g.ok){let a=await g.text();throw Error(`Failed to start device authorization: ${a}`)}let h=await g.json();return{deviceCode:h.deviceCode,userCode:h.userCode,verificationUri:h.verificationUri,verificationUriComplete:h.verificationUriComplete,expiresIn:h.expiresIn,interval:h.interval||5}}async pollDeviceToken(a,b,c,e="us-east-1"){(0,d.S6)(e);let f=`https://oidc.${e}.amazonaws.com/token`,g=await fetch(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:a,clientSecret:b,deviceCode:c,grantType:"urn:ietf:params:oauth:grant-type:device_code"})}),h=await g.json();return!g.ok||h.error?{success:!1,error:h.error,errorDescription:h.error_description,pending:"authorization_pending"===h.error||"slow_down"===h.error}:{success:!0,tokens:{accessToken:h.accessToken,refreshToken:h.refreshToken,expiresIn:h.expiresIn,tokenType:h.tokenType}}}buildSocialLoginUrl(a,b,c){return`${e}/login?idp=${"google"===a?"Google":"Github"}&redirect_uri=${encodeURIComponent("kiro://kiro.kiroAgent/authenticate-success")}&code_challenge=${b}&code_challenge_method=S256&state=${c}&prompt=select_account`}async exchangeSocialCode(a,b){let c=await fetch(`${e}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,code_verifier:b,redirect_uri:"kiro://kiro.kiroAgent/authenticate-success"})});if(!c.ok){let a=await c.text();throw Error(`Token exchange failed: ${a}`)}let d=await c.json();return{accessToken:d.accessToken,refreshToken:d.refreshToken,profileArn:d.profileArn,expiresIn:d.expiresIn||3600}}async refreshToken(a,b={}){let{authMethod:c,clientId:f,clientSecret:g,region:h}=b;if(f&&g){let b=h||"us-east-1";(0,d.S6)(b);let c=`https://oidc.${b}.amazonaws.com/token`,e=await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:f,clientSecret:g,refreshToken:a,grantType:"refresh_token"})});if(!e.ok){let a=await e.text();throw Error(`Token refresh failed: ${a}`)}let i=await e.json();return{accessToken:i.accessToken,refreshToken:i.refreshToken||a,profileArn:i.profileArn,expiresIn:i.expiresIn}}let i=await fetch(`${e}/refreshToken`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:a})});if(!i.ok){let a=await i.text();throw Error(`Token refresh failed: ${a}`)}let j=await i.json();return{accessToken:j.accessToken,refreshToken:j.refreshToken||a,profileArn:j.profileArn,expiresIn:j.expiresIn||3600}}async validateImportToken(a){if(!a.startsWith("aorAAAAAG"))throw Error("Invalid token format. Token should start with aorAAAAAG...");try{let b=await this.refreshToken(a);return{accessToken:b.accessToken,refreshToken:b.refreshToken||a,profileArn:b.profileArn,expiresIn:b.expiresIn,authMethod:"imported"}}catch(a){throw Error(`Token validation failed: ${a.message}`)}}async listAvailableProfiles(a,b="us-east-1"){(0,d.S6)(b);let c=`https://codewhisperer.${b}.amazonaws.com`,e=await fetch(c,{method:"POST",headers:{"Content-Type":"application/x-amz-json-1.0","x-amz-target":"AmazonCodeWhispererService.ListAvailableProfiles",Authorization:`Bearer ${a}`,Accept:"application/json"},body:JSON.stringify({maxResults:10})});if(!e.ok){let a=await e.text();throw Error(`Failed to list profiles: ${a}`)}let f=await e.json(),g=Array.isArray(f?.profiles)?f.profiles:[],h=a=>a?.arn||a?.profileArn||null,i=g.find(a=>h(a)?.split(":")[3]===b)||g[0];return h(i)}async validateApiKey(a,b="us-east-1"){if(!a||"string"!=typeof a||!a.trim())throw Error("API key is required");let c=a.trim(),d=null;try{d=await this.listAvailableProfiles(c,b)}catch(a){throw Error(`API key validation failed: ${a.message}`)}return{accessToken:c,refreshToken:null,profileArn:d,region:b,authMethod:"api_key"}}async listAvailableModels(a,b){let c=await fetch("https://codewhisperer.us-east-1.amazonaws.com",{method:"POST",headers:{"Content-Type":"application/x-amz-json-1.0","x-amz-target":"AmazonCodeWhispererService.ListAvailableModels",Authorization:`Bearer ${a}`,Accept:"application/json"},body:JSON.stringify({origin:"AI_EDITOR",profileArn:b})});if(!c.ok){let a=await c.text();throw Error(`Failed to list models: ${a}`)}return((await c.json()).models||[]).map(a=>({id:a.modelId,name:a.modelName||a.modelId,description:a.description,rateMultiplier:a.rateMultiplier,rateUnit:a.rateUnit,maxInputTokens:a.tokenLimits?.maxInputTokens||0}))}extractEmailFromJWT(a){try{let b=a.split(".");if(3!==b.length)return null;let c=b[1];for(;c.length%4;)c+="=";let d=JSON.parse(atob(c.replace(/-/g,"+").replace(/_/g,"/")));return d.email||d.preferred_username||d.sub}catch{return null}}}}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[1348,4777,9765,8711],()=>b(b.s=53570));module.exports=c})();
1
+ (()=>{var a={};a.id=9069,a.ids=[9069],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},13674:()=>{},21820:a=>{"use strict";a.exports=require("os")},26254:(a,b,c)=>{"use strict";c.d(b,{$N:()=>f,OK:()=>g,Zl:()=>h,lz:()=>i});var d=c(55511),e=c.n(d);function f(a=32){return e().randomBytes(a).toString("base64url")}function g(a){return e().createHash("sha256").update(a).digest("base64url")}function h(){return e().randomBytes(32).toString("base64url")}function i(a=32){let b=f(a),c=g(b);return{codeVerifier:b,codeChallenge:c,state:h()}}},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},53570:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>E,patchFetch:()=>D,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var d={};c.r(d),c.d(d,{GET:()=>y});var e=c(12334),f=c(59399),g=c(8894),h=c(83760),i=c(34958),j=c(970),k=c(261),l=c(28112),m=c(52194),n=c(9410),o=c(68673),p=c(47471),q=c(13093),r=c(98563),s=c(7572),t=c(86439),u=c(33610),v=c(77231),w=c(26254),x=c(98327);async function y(a){try{let{searchParams:b}=new URL(a.url),c=b.get("provider");if(!c||!["google","github"].includes(c))return v.NextResponse.json({error:"Invalid provider. Use 'google' or 'github'"},{status:400});let{codeVerifier:d,codeChallenge:e,state:f}=(0,w.lz)(),g=new x.v().buildSocialLoginUrl(c,e,f);return v.NextResponse.json({authUrl:g,state:f,codeVerifier:d,codeChallenge:e,provider:c})}catch(a){return console.log("Kiro social authorize error:",a),v.NextResponse.json({error:a.message},{status:500})}}let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/oauth/kiro/social-authorize/route",pathname:"/api/oauth/kiro/social-authorize",filename:"route",bundlePath:"app/api/oauth/kiro/social-authorize/route"},distDir:".next-cli-build",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/VansRouter/VansRouter/src/app/api/oauth/kiro/social-authorize/route.js",nextConfigOutput:"standalone",userland:d,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function D(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function E(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/oauth/kiro/social-authorize/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},55511:a=>{"use strict";a.exports=require("crypto")},59824:(a,b,c)=>{"use strict";c.d(b,{DI:()=>i,Hp:()=>k,LT:()=>j,MZ:()=>v,Nl:()=>y,Nu:()=>p,OV:()=>h,Op:()=>z,S6:()=>s,Tx:()=>q,WN:()=>t,Ww:()=>A,YT:()=>n,ZL:()=>m,cD:()=>o,f7:()=>x,hF:()=>l,lB:()=>w,t:()=>u});var d=c(21820),e=c(24567),f=c(68711);function g(){let a=(0,d.platform)(),b=(0,d.arch)();return"darwin"===a?"arm64"===b?2:1:"linux"===a?"arm64"===b?4:3:5*("win32"===a)}let h={...f.sr.claude},i={...f.sr.codex},j={...e.w3,...f.sr["gemini-cli"]},k={...f.sr.qwen},l={...f.sr.qoder},m={...f.sr.iflow},n={...e.XP,...f.sr.antigravity,loadCodeAssistClientMetadata:JSON.stringify({ideType:9,platform:g(),pluginType:2})};function o(){return{ideType:9,platform:g(),pluginType:2}}({...f.sr.openai});let p={...f.sr.github},q={...f.sr.kiro},r=/^[a-z]{2}-[a-z]+-\d{1,2}$/;function s(a){if("string"!=typeof a||!r.test(a))throw Error("Invalid region");return a}let t={...f.sr.cursor,tokenStoragePaths:{linux:"~/.config/Cursor/User/globalStorage/state.vscdb",macos:"/Users/<user>/Library/Application Support/Cursor/User/globalStorage/state.vscdb",windows:"%APPDATA%\\Cursor\\User\\globalStorage\\state.vscdb"}},u={...f.sr["kimi-coding"],clientId:process.env.KIMI_CODING_OAUTH_CLIENT_ID||f.xq["kimi-coding"]?.clientId},v={...f.sr.kilocode},w={...f.sr.cline},x={...f.sr.gitlab},y={...f.sr["codebuddy-cn"]},z={...f.sr.zcode},A=3e5},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},95522:()=>{},98327:(a,b,c)=>{"use strict";c.d(b,{v:()=>f});var d=c(59824);let e="https://prod.us-east-1.auth.desktop.kiro.dev";class f{async registerClient(a="us-east-1"){(0,d.S6)(a);let b=`https://oidc.${a}.amazonaws.com/client/register`,c=await fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientName:d.Tx.clientName,clientType:d.Tx.clientType,scopes:d.Tx.scopes,grantTypes:d.Tx.grantTypes,issuerUrl:d.Tx.issuerUrl})});if(!c.ok){let a=await c.text();throw Error(`Failed to register client: ${a}`)}let e=await c.json();return{clientId:e.clientId,clientSecret:e.clientSecret,clientSecretExpiresAt:e.clientSecretExpiresAt}}async startDeviceAuthorization(a,b,c,e="us-east-1"){(0,d.S6)(e);let f=`https://oidc.${e}.amazonaws.com/device_authorization`,g=await fetch(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:a,clientSecret:b,startUrl:c})});if(!g.ok){let a=await g.text();throw Error(`Failed to start device authorization: ${a}`)}let h=await g.json();return{deviceCode:h.deviceCode,userCode:h.userCode,verificationUri:h.verificationUri,verificationUriComplete:h.verificationUriComplete,expiresIn:h.expiresIn,interval:h.interval||5}}async pollDeviceToken(a,b,c,e="us-east-1"){(0,d.S6)(e);let f=`https://oidc.${e}.amazonaws.com/token`,g=await fetch(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:a,clientSecret:b,deviceCode:c,grantType:"urn:ietf:params:oauth:grant-type:device_code"})}),h=await g.json();return!g.ok||h.error?{success:!1,error:h.error,errorDescription:h.error_description,pending:"authorization_pending"===h.error||"slow_down"===h.error}:{success:!0,tokens:{accessToken:h.accessToken,refreshToken:h.refreshToken,expiresIn:h.expiresIn,tokenType:h.tokenType}}}buildSocialLoginUrl(a,b,c){return`${e}/login?idp=${"google"===a?"Google":"Github"}&redirect_uri=${encodeURIComponent("kiro://kiro.kiroAgent/authenticate-success")}&code_challenge=${b}&code_challenge_method=S256&state=${c}&prompt=select_account`}async exchangeSocialCode(a,b){let c=await fetch(`${e}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,code_verifier:b,redirect_uri:"kiro://kiro.kiroAgent/authenticate-success"})});if(!c.ok){let a=await c.text();throw Error(`Token exchange failed: ${a}`)}let d=await c.json();return{accessToken:d.accessToken,refreshToken:d.refreshToken,profileArn:d.profileArn,expiresIn:d.expiresIn||3600}}async refreshToken(a,b={}){let{authMethod:c,clientId:f,clientSecret:g,region:h}=b;if(f&&g){let b=h||"us-east-1";(0,d.S6)(b);let c=`https://oidc.${b}.amazonaws.com/token`,e=await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:f,clientSecret:g,refreshToken:a,grantType:"refresh_token"})});if(!e.ok){let a=await e.text();throw Error(`Token refresh failed: ${a}`)}let i=await e.json();return{accessToken:i.accessToken,refreshToken:i.refreshToken||a,profileArn:i.profileArn,expiresIn:i.expiresIn}}let i=await fetch(`${e}/refreshToken`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:a})});if(!i.ok){let a=await i.text();throw Error(`Token refresh failed: ${a}`)}let j=await i.json();return{accessToken:j.accessToken,refreshToken:j.refreshToken||a,profileArn:j.profileArn,expiresIn:j.expiresIn||3600}}async validateImportToken(a){if(!a.startsWith("aorAAAAAG"))throw Error("Invalid token format. Token should start with aorAAAAAG...");try{let b=await this.refreshToken(a);return{accessToken:b.accessToken,refreshToken:b.refreshToken||a,profileArn:b.profileArn,expiresIn:b.expiresIn,authMethod:"imported"}}catch(a){throw Error(`Token validation failed: ${a.message}`)}}async listAvailableProfiles(a,b="us-east-1"){(0,d.S6)(b);let c=`https://codewhisperer.${b}.amazonaws.com`,e=await fetch(c,{method:"POST",headers:{"Content-Type":"application/x-amz-json-1.0","x-amz-target":"AmazonCodeWhispererService.ListAvailableProfiles",Authorization:`Bearer ${a}`,Accept:"application/json"},body:JSON.stringify({maxResults:10})});if(!e.ok){let a=await e.text();throw Error(`Failed to list profiles: ${a}`)}let f=await e.json(),g=Array.isArray(f?.profiles)?f.profiles:[],h=a=>a?.arn||a?.profileArn||null,i=g.find(a=>h(a)?.split(":")[3]===b)||g[0];return h(i)}async validateApiKey(a,b="us-east-1"){if(!a||"string"!=typeof a||!a.trim())throw Error("API key is required");let c=a.trim(),d=null;try{d=await this.listAvailableProfiles(c,b)}catch(a){throw Error(`API key validation failed: ${a.message}`)}return{accessToken:c,refreshToken:null,profileArn:d,region:b,authMethod:"api_key"}}async listAvailableModels(a,b){let c=await fetch("https://codewhisperer.us-east-1.amazonaws.com",{method:"POST",headers:{"Content-Type":"application/x-amz-json-1.0","x-amz-target":"AmazonCodeWhispererService.ListAvailableModels",Authorization:`Bearer ${a}`,Accept:"application/json"},body:JSON.stringify({origin:"AI_EDITOR",profileArn:b})});if(!c.ok){let a=await c.text();throw Error(`Failed to list models: ${a}`)}return((await c.json()).models||[]).map(a=>({id:a.modelId,name:a.modelName||a.modelId,description:a.description,rateMultiplier:a.rateMultiplier,rateUnit:a.rateUnit,maxInputTokens:a.tokenLimits?.maxInputTokens||0}))}extractEmailFromJWT(a){try{let b=a.split(".");if(3!==b.length)return null;let c=b[1];for(;c.length%4;)c+="=";let d=JSON.parse(atob(c.replace(/-/g,"+").replace(/_/g,"/")));return d.email||d.preferred_username||d.sub}catch{return null}}}}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[1348,4777,9765,8711],()=>b(b.s=53570));module.exports=c})();
@@ -1 +1 @@
1
- "use strict";(()=>{var a={};a.id=1451,a.ids=[1451,6820],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},21820:a=>{a.exports=require("os")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},46293:a=>{a.exports=require("sql.js")},46820:(a,b,c)=>{c.d(b,{Fh:()=>d.Fh,L9:()=>d.L9,Mc:()=>d.Mc,OM:()=>d.OM,P:()=>d.getProviderConnections,Pc:()=>d.Pc,Q_:()=>d.Q_,Qu:()=>d.Qu,S8:()=>d.S8,Yd:()=>d.Yd,ZO:()=>d.ZO,c:()=>d.c,createProviderConnection:()=>d.iE,fK:()=>d.fK,fv:()=>d.fv,ho:()=>d.ho,hr:()=>d.hr,i0:()=>d.i0,o5:()=>d.o5,op:()=>d.op,rj:()=>d.updateProviderConnection,uL:()=>d.uL,ui:()=>d.ui,uv:()=>d.uv});var d=c(94164)},55511:a=>{a.exports=require("crypto")},59824:(a,b,c)=>{c.d(b,{DI:()=>i,Hp:()=>k,LT:()=>j,MZ:()=>v,Nl:()=>z,Nu:()=>p,OV:()=>h,Op:()=>A,S6:()=>s,Tx:()=>q,WN:()=>t,Ww:()=>B,YT:()=>n,ZL:()=>m,cD:()=>o,f7:()=>y,hF:()=>l,lB:()=>w,t:()=>u,w1:()=>x});var d=c(21820),e=c(24567),f=c(68711);function g(){let a=(0,d.platform)(),b=(0,d.arch)();return"darwin"===a?"arm64"===b?2:1:"linux"===a?"arm64"===b?4:3:5*("win32"===a)}let h={...f.sr.claude},i={...f.sr.codex},j={...e.w3,...f.sr["gemini-cli"]},k={...f.sr.qwen},l={...f.sr.qoder},m={...f.sr.iflow},n={...e.XP,...f.sr.antigravity,loadCodeAssistClientMetadata:JSON.stringify({ideType:9,platform:g(),pluginType:2})};function o(){return{ideType:9,platform:g(),pluginType:2}}({...f.sr.openai});let p={...f.sr.github},q={...f.sr.kiro},r=/^[a-z]{2}-[a-z]+-\d{1,2}$/;function s(a){if("string"!=typeof a||!r.test(a))throw Error("Invalid region");return a}let t={...f.sr.cursor,tokenStoragePaths:{linux:"~/.config/Cursor/User/globalStorage/state.vscdb",macos:"/Users/<user>/Library/Application Support/Cursor/User/globalStorage/state.vscdb",windows:"%APPDATA%\\Cursor\\User\\globalStorage\\state.vscdb"}},u={...f.sr["kimi-coding"],clientId:process.env.KIMI_CODING_OAUTH_CLIENT_ID||f.xq["kimi-coding"]?.clientId},v={...f.sr.kilocode},w={...f.sr.cline},x={...f.sr.clinepass},y={...f.sr.gitlab},z={...f.sr["codebuddy-cn"]},A={...f.sr.zcode},B=3e5},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{a.exports=require("node:fs")},74628:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>E,patchFetch:()=>D,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var d={};c.r(d),c.d(d,{POST:()=>y});var e=c(12334),f=c(59399),g=c(8894),h=c(83760),i=c(34958),j=c(970),k=c(261),l=c(28112),m=c(52194),n=c(9410),o=c(68673),p=c(47471),q=c(13093),r=c(98563),s=c(7572),t=c(86439),u=c(33610),v=c(77231),w=c(98327),x=c(46820);async function y(a){try{let{code:b,codeVerifier:c,provider:d}=await a.json();if(!b||!c)return v.NextResponse.json({error:"Missing required fields"},{status:400});if(!d||!["google","github"].includes(d))return v.NextResponse.json({error:"Invalid provider"},{status:400});let e=new w.v,f=await e.exchangeSocialCode(b,c),g=e.extractEmailFromJWT(f.accessToken),h=await (0,x.createProviderConnection)({provider:"kiro",authType:"oauth",accessToken:f.accessToken,refreshToken:f.refreshToken,expiresAt:new Date(Date.now()+1e3*f.expiresIn).toISOString(),email:g||null,providerSpecificData:{profileArn:f.profileArn,authMethod:d,provider:d.charAt(0).toUpperCase()+d.slice(1)},testStatus:"active"});return v.NextResponse.json({success:!0,connection:{id:h.id,provider:h.provider,email:h.email}})}catch(a){return console.log("Kiro social exchange error:",a),v.NextResponse.json({error:a.message},{status:500})}}let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/oauth/kiro/social-exchange/route",pathname:"/api/oauth/kiro/social-exchange",filename:"route",bundlePath:"app/api/oauth/kiro/social-exchange/route"},distDir:".next-cli-build",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/VansRouter/VansRouter/src/app/api/oauth/kiro/social-exchange/route.js",nextConfigOutput:"standalone",userland:d,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function D(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function E(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/oauth/kiro/social-exchange/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},87550:a=>{a.exports=require("better-sqlite3")},94164:(a,b,c)=>{c.d(b,{CG:()=>d.CG,Dj:()=>d.Dj,Fh:()=>d.Fh,Iq:()=>d.Iq,K1:()=>d.K1,KJ:()=>d.KJ,L:()=>d.L,L9:()=>d.L9,Lh:()=>d.Lh,Mc:()=>d.Mc,OM:()=>d.OM,PX:()=>d.PX,Pc:()=>d.Pc,Q_:()=>d.Q_,Qu:()=>d.Qu,S8:()=>d.S8,Uv:()=>d.Uv,VT:()=>d.VT,XW:()=>d.XW,Xx:()=>d.Xx,Yd:()=>d.Yd,ZO:()=>d.ZO,bI:()=>d.bI,c:()=>d.c,ek:()=>d.ek,fK:()=>d.fK,fv:()=>d.fv,getProviderConnections:()=>d.P,ho:()=>d.ho,hr:()=>d.hr,i0:()=>d.i0,iE:()=>d.iE,jd:()=>d.jd,mt:()=>d.mt,o5:()=>d.o5,oG:()=>d.oG,op:()=>d.op,r4:()=>d.r4,uL:()=>d.uL,ui:()=>d.ui,updateProviderConnection:()=>d.rj,uv:()=>d.uv,yF:()=>d.yF,yg:()=>d.yg,zP:()=>d.zP});var d=c(45479)},94735:a=>{a.exports=require("events")},98327:(a,b,c)=>{c.d(b,{v:()=>f});var d=c(59824);let e="https://prod.us-east-1.auth.desktop.kiro.dev";class f{async registerClient(a="us-east-1"){(0,d.S6)(a);let b=`https://oidc.${a}.amazonaws.com/client/register`,c=await fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientName:d.Tx.clientName,clientType:d.Tx.clientType,scopes:d.Tx.scopes,grantTypes:d.Tx.grantTypes,issuerUrl:d.Tx.issuerUrl})});if(!c.ok){let a=await c.text();throw Error(`Failed to register client: ${a}`)}let e=await c.json();return{clientId:e.clientId,clientSecret:e.clientSecret,clientSecretExpiresAt:e.clientSecretExpiresAt}}async startDeviceAuthorization(a,b,c,e="us-east-1"){(0,d.S6)(e);let f=`https://oidc.${e}.amazonaws.com/device_authorization`,g=await fetch(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:a,clientSecret:b,startUrl:c})});if(!g.ok){let a=await g.text();throw Error(`Failed to start device authorization: ${a}`)}let h=await g.json();return{deviceCode:h.deviceCode,userCode:h.userCode,verificationUri:h.verificationUri,verificationUriComplete:h.verificationUriComplete,expiresIn:h.expiresIn,interval:h.interval||5}}async pollDeviceToken(a,b,c,e="us-east-1"){(0,d.S6)(e);let f=`https://oidc.${e}.amazonaws.com/token`,g=await fetch(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:a,clientSecret:b,deviceCode:c,grantType:"urn:ietf:params:oauth:grant-type:device_code"})}),h=await g.json();return!g.ok||h.error?{success:!1,error:h.error,errorDescription:h.error_description,pending:"authorization_pending"===h.error||"slow_down"===h.error}:{success:!0,tokens:{accessToken:h.accessToken,refreshToken:h.refreshToken,expiresIn:h.expiresIn,tokenType:h.tokenType}}}buildSocialLoginUrl(a,b,c){return`${e}/login?idp=${"google"===a?"Google":"Github"}&redirect_uri=${encodeURIComponent("kiro://kiro.kiroAgent/authenticate-success")}&code_challenge=${b}&code_challenge_method=S256&state=${c}&prompt=select_account`}async exchangeSocialCode(a,b){let c=await fetch(`${e}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,code_verifier:b,redirect_uri:"kiro://kiro.kiroAgent/authenticate-success"})});if(!c.ok){let a=await c.text();throw Error(`Token exchange failed: ${a}`)}let d=await c.json();return{accessToken:d.accessToken,refreshToken:d.refreshToken,profileArn:d.profileArn,expiresIn:d.expiresIn||3600}}async refreshToken(a,b={}){let{authMethod:c,clientId:f,clientSecret:g,region:h}=b;if(f&&g){let b=h||"us-east-1";(0,d.S6)(b);let c=`https://oidc.${b}.amazonaws.com/token`,e=await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:f,clientSecret:g,refreshToken:a,grantType:"refresh_token"})});if(!e.ok){let a=await e.text();throw Error(`Token refresh failed: ${a}`)}let i=await e.json();return{accessToken:i.accessToken,refreshToken:i.refreshToken||a,profileArn:i.profileArn,expiresIn:i.expiresIn}}let i=await fetch(`${e}/refreshToken`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:a})});if(!i.ok){let a=await i.text();throw Error(`Token refresh failed: ${a}`)}let j=await i.json();return{accessToken:j.accessToken,refreshToken:j.refreshToken||a,profileArn:j.profileArn,expiresIn:j.expiresIn||3600}}async validateImportToken(a){if(!a.startsWith("aorAAAAAG"))throw Error("Invalid token format. Token should start with aorAAAAAG...");try{let b=await this.refreshToken(a);return{accessToken:b.accessToken,refreshToken:b.refreshToken||a,profileArn:b.profileArn,expiresIn:b.expiresIn,authMethod:"imported"}}catch(a){throw Error(`Token validation failed: ${a.message}`)}}async listAvailableProfiles(a,b="us-east-1"){(0,d.S6)(b);let c=`https://codewhisperer.${b}.amazonaws.com`,e=await fetch(c,{method:"POST",headers:{"Content-Type":"application/x-amz-json-1.0","x-amz-target":"AmazonCodeWhispererService.ListAvailableProfiles",Authorization:`Bearer ${a}`,Accept:"application/json"},body:JSON.stringify({maxResults:10})});if(!e.ok){let a=await e.text();throw Error(`Failed to list profiles: ${a}`)}let f=await e.json(),g=Array.isArray(f?.profiles)?f.profiles:[],h=a=>a?.arn||a?.profileArn||null,i=g.find(a=>h(a)?.split(":")[3]===b)||g[0];return h(i)}async validateApiKey(a,b="us-east-1"){if(!a||"string"!=typeof a||!a.trim())throw Error("API key is required");let c=a.trim(),d=null;try{d=await this.listAvailableProfiles(c,b)}catch(a){throw Error(`API key validation failed: ${a.message}`)}return{accessToken:c,refreshToken:null,profileArn:d,region:b,authMethod:"api_key"}}async listAvailableModels(a,b){let c=await fetch("https://codewhisperer.us-east-1.amazonaws.com",{method:"POST",headers:{"Content-Type":"application/x-amz-json-1.0","x-amz-target":"AmazonCodeWhispererService.ListAvailableModels",Authorization:`Bearer ${a}`,Accept:"application/json"},body:JSON.stringify({origin:"AI_EDITOR",profileArn:b})});if(!c.ok){let a=await c.text();throw Error(`Failed to list models: ${a}`)}return((await c.json()).models||[]).map(a=>({id:a.modelId,name:a.modelName||a.modelId,description:a.description,rateMultiplier:a.rateMultiplier,rateUnit:a.rateUnit,maxInputTokens:a.tokenLimits?.maxInputTokens||0}))}extractEmailFromJWT(a){try{let b=a.split(".");if(3!==b.length)return null;let c=b[1];for(;c.length%4;)c+="=";let d=JSON.parse(atob(c.replace(/-/g,"+").replace(/_/g,"/")));return d.email||d.preferred_username||d.sub}catch{return null}}}}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[1348,4777,9633,9765,8711],()=>b(b.s=74628));module.exports=c})();
1
+ "use strict";(()=>{var a={};a.id=1451,a.ids=[1451,6820],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},21820:a=>{a.exports=require("os")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},46293:a=>{a.exports=require("sql.js")},46820:(a,b,c)=>{c.d(b,{Fh:()=>d.Fh,L9:()=>d.L9,Mc:()=>d.Mc,OM:()=>d.OM,P:()=>d.getProviderConnections,Pc:()=>d.Pc,Q_:()=>d.Q_,Qu:()=>d.Qu,S8:()=>d.S8,Yd:()=>d.Yd,ZO:()=>d.ZO,c:()=>d.c,createProviderConnection:()=>d.iE,fK:()=>d.fK,fv:()=>d.fv,ho:()=>d.ho,hr:()=>d.hr,i0:()=>d.i0,o5:()=>d.o5,op:()=>d.op,rj:()=>d.updateProviderConnection,uL:()=>d.uL,ui:()=>d.ui,uv:()=>d.uv});var d=c(94164)},55511:a=>{a.exports=require("crypto")},59824:(a,b,c)=>{c.d(b,{DI:()=>i,Hp:()=>k,LT:()=>j,MZ:()=>v,Nl:()=>y,Nu:()=>p,OV:()=>h,Op:()=>z,S6:()=>s,Tx:()=>q,WN:()=>t,Ww:()=>A,YT:()=>n,ZL:()=>m,cD:()=>o,f7:()=>x,hF:()=>l,lB:()=>w,t:()=>u});var d=c(21820),e=c(24567),f=c(68711);function g(){let a=(0,d.platform)(),b=(0,d.arch)();return"darwin"===a?"arm64"===b?2:1:"linux"===a?"arm64"===b?4:3:5*("win32"===a)}let h={...f.sr.claude},i={...f.sr.codex},j={...e.w3,...f.sr["gemini-cli"]},k={...f.sr.qwen},l={...f.sr.qoder},m={...f.sr.iflow},n={...e.XP,...f.sr.antigravity,loadCodeAssistClientMetadata:JSON.stringify({ideType:9,platform:g(),pluginType:2})};function o(){return{ideType:9,platform:g(),pluginType:2}}({...f.sr.openai});let p={...f.sr.github},q={...f.sr.kiro},r=/^[a-z]{2}-[a-z]+-\d{1,2}$/;function s(a){if("string"!=typeof a||!r.test(a))throw Error("Invalid region");return a}let t={...f.sr.cursor,tokenStoragePaths:{linux:"~/.config/Cursor/User/globalStorage/state.vscdb",macos:"/Users/<user>/Library/Application Support/Cursor/User/globalStorage/state.vscdb",windows:"%APPDATA%\\Cursor\\User\\globalStorage\\state.vscdb"}},u={...f.sr["kimi-coding"],clientId:process.env.KIMI_CODING_OAUTH_CLIENT_ID||f.xq["kimi-coding"]?.clientId},v={...f.sr.kilocode},w={...f.sr.cline},x={...f.sr.gitlab},y={...f.sr["codebuddy-cn"]},z={...f.sr.zcode},A=3e5},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{a.exports=require("node:fs")},74628:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>E,patchFetch:()=>D,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var d={};c.r(d),c.d(d,{POST:()=>y});var e=c(12334),f=c(59399),g=c(8894),h=c(83760),i=c(34958),j=c(970),k=c(261),l=c(28112),m=c(52194),n=c(9410),o=c(68673),p=c(47471),q=c(13093),r=c(98563),s=c(7572),t=c(86439),u=c(33610),v=c(77231),w=c(98327),x=c(46820);async function y(a){try{let{code:b,codeVerifier:c,provider:d}=await a.json();if(!b||!c)return v.NextResponse.json({error:"Missing required fields"},{status:400});if(!d||!["google","github"].includes(d))return v.NextResponse.json({error:"Invalid provider"},{status:400});let e=new w.v,f=await e.exchangeSocialCode(b,c),g=e.extractEmailFromJWT(f.accessToken),h=await (0,x.createProviderConnection)({provider:"kiro",authType:"oauth",accessToken:f.accessToken,refreshToken:f.refreshToken,expiresAt:new Date(Date.now()+1e3*f.expiresIn).toISOString(),email:g||null,providerSpecificData:{profileArn:f.profileArn,authMethod:d,provider:d.charAt(0).toUpperCase()+d.slice(1)},testStatus:"active"});return v.NextResponse.json({success:!0,connection:{id:h.id,provider:h.provider,email:h.email}})}catch(a){return console.log("Kiro social exchange error:",a),v.NextResponse.json({error:a.message},{status:500})}}let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/oauth/kiro/social-exchange/route",pathname:"/api/oauth/kiro/social-exchange",filename:"route",bundlePath:"app/api/oauth/kiro/social-exchange/route"},distDir:".next-cli-build",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/VansRouter/VansRouter/src/app/api/oauth/kiro/social-exchange/route.js",nextConfigOutput:"standalone",userland:d,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function D(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function E(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/oauth/kiro/social-exchange/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},87550:a=>{a.exports=require("better-sqlite3")},94164:(a,b,c)=>{c.d(b,{CG:()=>d.CG,Dj:()=>d.Dj,Fh:()=>d.Fh,Iq:()=>d.Iq,K1:()=>d.K1,KJ:()=>d.KJ,L:()=>d.L,L9:()=>d.L9,Lh:()=>d.Lh,Mc:()=>d.Mc,OM:()=>d.OM,PX:()=>d.PX,Pc:()=>d.Pc,Q_:()=>d.Q_,Qu:()=>d.Qu,S8:()=>d.S8,Uv:()=>d.Uv,VT:()=>d.VT,XW:()=>d.XW,Xx:()=>d.Xx,Yd:()=>d.Yd,ZO:()=>d.ZO,bI:()=>d.bI,c:()=>d.c,ek:()=>d.ek,fK:()=>d.fK,fv:()=>d.fv,getProviderConnections:()=>d.P,ho:()=>d.ho,hr:()=>d.hr,i0:()=>d.i0,iE:()=>d.iE,jd:()=>d.jd,mt:()=>d.mt,o5:()=>d.o5,oG:()=>d.oG,op:()=>d.op,r4:()=>d.r4,uL:()=>d.uL,ui:()=>d.ui,updateProviderConnection:()=>d.rj,uv:()=>d.uv,yF:()=>d.yF,yg:()=>d.yg,zP:()=>d.zP});var d=c(45479)},94735:a=>{a.exports=require("events")},98327:(a,b,c)=>{c.d(b,{v:()=>f});var d=c(59824);let e="https://prod.us-east-1.auth.desktop.kiro.dev";class f{async registerClient(a="us-east-1"){(0,d.S6)(a);let b=`https://oidc.${a}.amazonaws.com/client/register`,c=await fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientName:d.Tx.clientName,clientType:d.Tx.clientType,scopes:d.Tx.scopes,grantTypes:d.Tx.grantTypes,issuerUrl:d.Tx.issuerUrl})});if(!c.ok){let a=await c.text();throw Error(`Failed to register client: ${a}`)}let e=await c.json();return{clientId:e.clientId,clientSecret:e.clientSecret,clientSecretExpiresAt:e.clientSecretExpiresAt}}async startDeviceAuthorization(a,b,c,e="us-east-1"){(0,d.S6)(e);let f=`https://oidc.${e}.amazonaws.com/device_authorization`,g=await fetch(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:a,clientSecret:b,startUrl:c})});if(!g.ok){let a=await g.text();throw Error(`Failed to start device authorization: ${a}`)}let h=await g.json();return{deviceCode:h.deviceCode,userCode:h.userCode,verificationUri:h.verificationUri,verificationUriComplete:h.verificationUriComplete,expiresIn:h.expiresIn,interval:h.interval||5}}async pollDeviceToken(a,b,c,e="us-east-1"){(0,d.S6)(e);let f=`https://oidc.${e}.amazonaws.com/token`,g=await fetch(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:a,clientSecret:b,deviceCode:c,grantType:"urn:ietf:params:oauth:grant-type:device_code"})}),h=await g.json();return!g.ok||h.error?{success:!1,error:h.error,errorDescription:h.error_description,pending:"authorization_pending"===h.error||"slow_down"===h.error}:{success:!0,tokens:{accessToken:h.accessToken,refreshToken:h.refreshToken,expiresIn:h.expiresIn,tokenType:h.tokenType}}}buildSocialLoginUrl(a,b,c){return`${e}/login?idp=${"google"===a?"Google":"Github"}&redirect_uri=${encodeURIComponent("kiro://kiro.kiroAgent/authenticate-success")}&code_challenge=${b}&code_challenge_method=S256&state=${c}&prompt=select_account`}async exchangeSocialCode(a,b){let c=await fetch(`${e}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,code_verifier:b,redirect_uri:"kiro://kiro.kiroAgent/authenticate-success"})});if(!c.ok){let a=await c.text();throw Error(`Token exchange failed: ${a}`)}let d=await c.json();return{accessToken:d.accessToken,refreshToken:d.refreshToken,profileArn:d.profileArn,expiresIn:d.expiresIn||3600}}async refreshToken(a,b={}){let{authMethod:c,clientId:f,clientSecret:g,region:h}=b;if(f&&g){let b=h||"us-east-1";(0,d.S6)(b);let c=`https://oidc.${b}.amazonaws.com/token`,e=await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:f,clientSecret:g,refreshToken:a,grantType:"refresh_token"})});if(!e.ok){let a=await e.text();throw Error(`Token refresh failed: ${a}`)}let i=await e.json();return{accessToken:i.accessToken,refreshToken:i.refreshToken||a,profileArn:i.profileArn,expiresIn:i.expiresIn}}let i=await fetch(`${e}/refreshToken`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:a})});if(!i.ok){let a=await i.text();throw Error(`Token refresh failed: ${a}`)}let j=await i.json();return{accessToken:j.accessToken,refreshToken:j.refreshToken||a,profileArn:j.profileArn,expiresIn:j.expiresIn||3600}}async validateImportToken(a){if(!a.startsWith("aorAAAAAG"))throw Error("Invalid token format. Token should start with aorAAAAAG...");try{let b=await this.refreshToken(a);return{accessToken:b.accessToken,refreshToken:b.refreshToken||a,profileArn:b.profileArn,expiresIn:b.expiresIn,authMethod:"imported"}}catch(a){throw Error(`Token validation failed: ${a.message}`)}}async listAvailableProfiles(a,b="us-east-1"){(0,d.S6)(b);let c=`https://codewhisperer.${b}.amazonaws.com`,e=await fetch(c,{method:"POST",headers:{"Content-Type":"application/x-amz-json-1.0","x-amz-target":"AmazonCodeWhispererService.ListAvailableProfiles",Authorization:`Bearer ${a}`,Accept:"application/json"},body:JSON.stringify({maxResults:10})});if(!e.ok){let a=await e.text();throw Error(`Failed to list profiles: ${a}`)}let f=await e.json(),g=Array.isArray(f?.profiles)?f.profiles:[],h=a=>a?.arn||a?.profileArn||null,i=g.find(a=>h(a)?.split(":")[3]===b)||g[0];return h(i)}async validateApiKey(a,b="us-east-1"){if(!a||"string"!=typeof a||!a.trim())throw Error("API key is required");let c=a.trim(),d=null;try{d=await this.listAvailableProfiles(c,b)}catch(a){throw Error(`API key validation failed: ${a.message}`)}return{accessToken:c,refreshToken:null,profileArn:d,region:b,authMethod:"api_key"}}async listAvailableModels(a,b){let c=await fetch("https://codewhisperer.us-east-1.amazonaws.com",{method:"POST",headers:{"Content-Type":"application/x-amz-json-1.0","x-amz-target":"AmazonCodeWhispererService.ListAvailableModels",Authorization:`Bearer ${a}`,Accept:"application/json"},body:JSON.stringify({origin:"AI_EDITOR",profileArn:b})});if(!c.ok){let a=await c.text();throw Error(`Failed to list models: ${a}`)}return((await c.json()).models||[]).map(a=>({id:a.modelId,name:a.modelName||a.modelId,description:a.description,rateMultiplier:a.rateMultiplier,rateUnit:a.rateUnit,maxInputTokens:a.tokenLimits?.maxInputTokens||0}))}extractEmailFromJWT(a){try{let b=a.split(".");if(3!==b.length)return null;let c=b[1];for(;c.length%4;)c+="=";let d=JSON.parse(atob(c.replace(/-/g,"+").replace(/_/g,"/")));return d.email||d.preferred_username||d.sub}catch{return null}}}}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[1348,4777,9633,9765,8711],()=>b(b.s=74628));module.exports=c})();
@@ -1 +1 @@
1
- "use strict";(()=>{var a={};a.id=5211,a.ids=[1253,5211,6820],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},643:a=>{a.exports=require("node:perf_hooks")},1708:a=>{a.exports=require("node:process")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4573:a=>{a.exports=require("node:buffer")},7066:a=>{a.exports=require("node:tty")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},14985:a=>{a.exports=require("dns")},16698:a=>{a.exports=require("node:async_hooks")},21820:a=>{a.exports=require("os")},26915:a=>{a.exports=import("playwright-core")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31421:a=>{a.exports=require("node:child_process")},32467:a=>{a.exports=require("node:http2")},33873:a=>{a.exports=require("path")},34589:a=>{a.exports=require("node:assert")},37067:a=>{a.exports=require("node:http")},37540:a=>{a.exports=require("node:console")},38522:a=>{a.exports=require("node:zlib")},40610:a=>{a.exports=require("node:dns")},41692:a=>{a.exports=require("node:tls")},41792:a=>{a.exports=require("node:querystring")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},46293:a=>{a.exports=require("sql.js")},46820:(a,b,c)=>{c.d(b,{Fh:()=>d.Fh,L9:()=>d.L9,Mc:()=>d.Mc,OM:()=>d.OM,P:()=>d.getProviderConnections,Pc:()=>d.Pc,Q_:()=>d.Q_,Qu:()=>d.Qu,S8:()=>d.S8,Yd:()=>d.Yd,ZO:()=>d.ZO,c:()=>d.c,createProviderConnection:()=>d.iE,fK:()=>d.fK,fv:()=>d.fv,ho:()=>d.ho,hr:()=>d.hr,i0:()=>d.i0,o5:()=>d.o5,op:()=>d.op,rj:()=>d.updateProviderConnection,uL:()=>d.uL,ui:()=>d.ui,uv:()=>d.uv});var d=c(94164)},48161:a=>{a.exports=require("node:os")},51455:a=>{a.exports=require("node:fs/promises")},53053:a=>{a.exports=require("node:diagnostics_channel")},55511:a=>{a.exports=require("crypto")},55591:a=>{a.exports=require("https")},57075:a=>{a.exports=require("node:stream")},57975:a=>{a.exports=require("node:util")},59824:(a,b,c)=>{c.d(b,{DI:()=>i,Hp:()=>k,LT:()=>j,MZ:()=>v,Nl:()=>z,Nu:()=>p,OV:()=>h,Op:()=>A,S6:()=>s,Tx:()=>q,WN:()=>t,Ww:()=>B,YT:()=>n,ZL:()=>m,cD:()=>o,f7:()=>y,hF:()=>l,lB:()=>w,t:()=>u,w1:()=>x});var d=c(21820),e=c(24567),f=c(68711);function g(){let a=(0,d.platform)(),b=(0,d.arch)();return"darwin"===a?"arm64"===b?2:1:"linux"===a?"arm64"===b?4:3:5*("win32"===a)}let h={...f.sr.claude},i={...f.sr.codex},j={...e.w3,...f.sr["gemini-cli"]},k={...f.sr.qwen},l={...f.sr.qoder},m={...f.sr.iflow},n={...e.XP,...f.sr.antigravity,loadCodeAssistClientMetadata:JSON.stringify({ideType:9,platform:g(),pluginType:2})};function o(){return{ideType:9,platform:g(),pluginType:2}}({...f.sr.openai});let p={...f.sr.github},q={...f.sr.kiro},r=/^[a-z]{2}-[a-z]+-\d{1,2}$/;function s(a){if("string"!=typeof a||!r.test(a))throw Error("Invalid region");return a}let t={...f.sr.cursor,tokenStoragePaths:{linux:"~/.config/Cursor/User/globalStorage/state.vscdb",macos:"/Users/<user>/Library/Application Support/Cursor/User/globalStorage/state.vscdb",windows:"%APPDATA%\\Cursor\\User\\globalStorage\\state.vscdb"}},u={...f.sr["kimi-coding"],clientId:process.env.KIMI_CODING_OAUTH_CLIENT_ID||f.xq["kimi-coding"]?.clientId},v={...f.sr.kilocode},w={...f.sr.cline},x={...f.sr.clinepass},y={...f.sr.gitlab},z={...f.sr["codebuddy-cn"]},A={...f.sr.zcode},B=3e5},62701:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>M,patchFetch:()=>L,routeModule:()=>H,serverHooks:()=>K,workAsyncStorage:()=>I,workUnitAsyncStorage:()=>J});var d={};c.r(d),c.d(d,{GET:()=>G});var e=c(12334),f=c(59399),g=c(8894),h=c(83760),i=c(34958),j=c(970),k=c(261),l=c(28112),m=c(52194),n=c(9410),o=c(68673),p=c(47471),q=c(13093),r=c(98563),s=c(7572),t=c(86439),u=c(33610),v=c(77231),w=c(46820),x=c(91253),y=c(59824),z=c(83950),A=c(13946),B=c(84397),C=c(26415);let D=a=>Array.isArray(a)?a:a?.data||a?.models||a?.results||[],E=a=>({url:a,method:"GET",headers:{"Content-Type":"application/json"},authHeader:"Authorization",authPrefix:"Bearer ",parseResponse:D}),F={claude:{url:"https://api.anthropic.com/v1/models",method:"GET",headers:{"Anthropic-Version":"2023-06-01","Content-Type":"application/json"},authHeader:"x-api-key",parseResponse:a=>a.data||[]},gemini:{url:"https://generativelanguage.googleapis.com/v1beta/models",method:"GET",headers:{"Content-Type":"application/json"},authQuery:"key",parseResponse:a=>a.models||[]},qwen:{url:"https://portal.qwen.ai/v1/models",method:"GET",headers:{"Content-Type":"application/json"},authHeader:"Authorization",authPrefix:"Bearer ",parseResponse:a=>a.data||[]},codex:{url:"https://chatgpt.com/backend-api/codex/models?client_version=1.0.0",method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},authHeader:"Authorization",authPrefix:"Bearer ",parseResponse:a=>D(a).flatMap(a=>{let b=a?.id||a?.slug||a?.model||a?.name;if(!b)return[];let c=a?.display_name||a?.displayName||a?.name||b,d={...a,id:b,name:c};return!("image"!==(a?.type||"llm")&&!b.toLowerCase().includes("embed"))||b.endsWith("-review")?[d]:[d,{...d,id:`${b}-review`,name:`${c} Review`,upstreamModelId:b,quotaFamily:"review"}]})},antigravity:{url:"https://daily-cloudcode-pa.sandbox.googleapis.com/v1internal:models",method:"POST",headers:{"Content-Type":"application/json"},authHeader:"Authorization",authPrefix:"Bearer ",body:{},parseResponse:a=>a.models||[]},github:{url:"https://api.githubcopilot.com/models",method:"GET",headers:{"Content-Type":"application/json","Copilot-Integration-Id":"vscode-chat","editor-version":"vscode/1.107.1","editor-plugin-version":"copilot-chat/0.26.7","user-agent":"GitHubCopilotChat/0.26.7"},authHeader:"Authorization",authPrefix:"Bearer ",parseResponse:a=>a?.data?a.data.reduce((a,b)=>(b.capabilities?.type==="chat"&&b.policy?.state!=="disabled"&&a.push({id:b.id,name:b.name||b.id,version:b.version,capabilities:b.capabilities,isDefault:!0===b.model_picker_enabled}),a),[]):[]},openai:E("https://api.openai.com/v1/models"),openrouter:E("https://openrouter.ai/api/v1/models"),anthropic:{url:"https://api.anthropic.com/v1/models",method:"GET",headers:{"Anthropic-Version":"2023-06-01","Content-Type":"application/json"},authHeader:"x-api-key",parseResponse:a=>a.data||[]},alicode:{url:"https://coding.dashscope.aliyuncs.com/v1/models",method:"GET",headers:{"Content-Type":"application/json"},authHeader:"Authorization",authPrefix:"Bearer ",parseResponse:a=>a.data||[]},"alicode-intl":{url:"https://coding-intl.dashscope.aliyuncs.com/v1/models",method:"GET",headers:{"Content-Type":"application/json"},authHeader:"Authorization",authPrefix:"Bearer ",parseResponse:a=>a.data||[]},"volcengine-ark":E("https://ark.cn-beijing.volces.com/api/coding/v3/models"),byteplus:E("https://ark.ap-southeast.bytepluses.com/api/coding/v3/models"),deepseek:E("https://api.deepseek.com/models"),groq:E("https://api.groq.com/openai/v1/models"),xai:E("https://api.x.ai/v1/models"),mistral:E("https://api.mistral.ai/v1/models"),perplexity:E("https://api.perplexity.ai/v1/models"),together:E("https://api.together.xyz/v1/models"),fireworks:E("https://api.fireworks.ai/inference/v1/models"),cerebras:E("https://api.cerebras.ai/v1/models"),cohere:E("https://api.cohere.ai/v1/models"),nebius:E("https://api.studio.nebius.ai/v1/models"),siliconflow:E("https://api.siliconflow.com/v1/models"),hyperbolic:E("https://api.hyperbolic.xyz/v1/models"),ollama:E("https://ollama.com/api/tags"),nanobanana:E("https://api.nanobananaapi.ai/v1/models"),chutes:E("https://llm.chutes.ai/v1/models"),nvidia:E("https://integrate.api.nvidia.com/v1/models"),assemblyai:E("https://api.assemblyai.com/v1/models"),"vercel-ai-gateway":E("https://ai-gateway.vercel.sh/v1/models"),kiro:{customResolver:async a=>{let b,c={accessToken:a.accessToken,refreshToken:a.refreshToken,providerSpecificData:a.providerSpecificData||{}};try{let d=await (0,B.c)(c,{log:console,onCredentialsRefreshed:async b=>{b?.accessToken&&(await (0,z.vN)(a.id,{accessToken:b.accessToken,refreshToken:b.refreshToken||a.refreshToken,expiresIn:b.expiresIn}),a.accessToken=b.accessToken,b.refreshToken&&(a.refreshToken=b.refreshToken))}});if(d?.models?.length)return{models:d.models.map(a=>({id:a.id,name:a.name,upstreamModelId:a.upstreamModelId,contextLength:a.contextLength,rateMultiplier:a.rateMultiplier,capabilities:a.capabilities,description:a.description}))};b="Kiro returned no models; falling back to static catalog."}catch(a){b=`Failed to fetch Kiro models: ${a.message}`,console.log("Failed to fetch Kiro models dynamically, falling back to static:",a.message)}return{models:[],warning:b}}},qoder:{customResolver:async a=>{let b,c={accessToken:a.accessToken,refreshToken:a.refreshToken,email:a.email,displayName:a.displayName,providerSpecificData:a.providerSpecificData||{}};try{let a=await (0,C.EV)(c,{forceRefresh:!0});if(a?.models?.length)return{models:a.models.map(a=>({id:`qoder/${a.id}`,name:a.name,contextLength:a.contextLength,isVL:a.isVL,isReasoning:a.isReasoning,maxOutputTokens:a.maxOutputTokens,description:a.description}))};b="Qoder returned no models; falling back to static catalog."}catch(a){b=`Failed to fetch Qoder models: ${a.message}`,console.log("Failed to fetch Qoder models dynamically, falling back to static:",a.message)}return{models:[],warning:b}}},"gemini-cli":{customResolver:(({refreshFn:a,fetchFn:b,parseFn:c,errorLabel:d})=>async e=>{let f,{accessToken:g,refreshToken:h}=e;if(!g)return{error:"No valid token found",status:401};try{let i=await b(g,e);if(!i.ok&&(401===i.status||403===i.status)&&h){let c=await a(e);c?.accessToken&&(await (0,z.vN)(e.id,{accessToken:c.accessToken,refreshToken:c.refreshToken||h,expiresIn:c.expiresIn}),e.accessToken=c.accessToken,c.refreshToken&&(e.refreshToken=c.refreshToken),i=await b(c.accessToken,e))}if(i.ok){let a=await i.json(),b=c(a);if(b.length>0)return{models:b}}else{let a=await i.text();f=`${d}: ${i.status} ${a}`,console.log(`${d} (falling back to static):`,a)}}catch(a){f=`${d}: ${a.message}`,console.log(`${d} (falling back to static):`,a.message)}return{models:[],warning:f}})({refreshFn:a=>(0,z.I9)(a.refreshToken,y.LT.clientId,y.LT.clientSecret),fetchFn:(a,b)=>{let c=b.projectId||b.providerSpecificData?.projectId;return fetch("https://cloudcode-pa.googleapis.com/v1internal:fetchAvailableModels",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`,"User-Agent":"google-api-nodejs-client/9.15.1","X-Goog-Api-Client":"google-cloud-sdk vscode_cloudshelleditor/0.1"},body:JSON.stringify(c?{project:c}:{})})},parseFn:a=>Array.isArray(a?.models)?a.models.flatMap(a=>{let b=a?.id||a?.model||a?.name;return b?[{id:b,name:a?.displayName||a?.name||b}]:[]}):a?.models&&"object"==typeof a.models?Object.entries(a.models).reduce((a,[b,c])=>(c?.isInternal||a.push({id:b,name:c?.displayName||c?.name||b}),a),[]):[],errorLabel:"Failed to fetch Gemini CLI models"})},"ollama-local":{customResolver:async a=>{let b=`${(0,A.Ak)(a)}/api/tags`,c=await fetch(b,{method:"GET",headers:{"Content-Type":"application/json"}});return c.ok?{models:D(await c.json())}:(console.log("Error fetching models from ollama-local:",await c.text()),{error:`Failed to fetch models: ${c.status}`,status:c.status})}}};async function G(a,{params:b}){try{let{id:a}=await b,c=await (0,w.Mc)(a);if(!c)return v.NextResponse.json({error:"Connection not found"},{status:404});if((0,x.mq)(c.provider)){let a=c.providerSpecificData?.baseUrl;if(!a)return v.NextResponse.json({error:"No base URL configured for OpenAI compatible provider"},{status:400});let b=`${a.replace(/\/$/,"")}/models`,d=await fetch(b,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${c.apiKey}`}});if(!d.ok){let a=await d.text();return console.log(`Error fetching models from ${c.provider}:`,a),v.NextResponse.json({error:`Failed to fetch models: ${d.status}`},{status:d.status})}let e=await d.json(),f=e.data||e.models||[];return v.NextResponse.json({provider:c.provider,connectionId:c.id,models:f})}if((0,x.gb)(c.provider)){let a=c.providerSpecificData?.baseUrl;if(!a)return v.NextResponse.json({error:"No base URL configured for Anthropic compatible provider"},{status:400});(a=a.replace(/\/$/,"")).endsWith("/messages")&&(a=a.slice(0,-9));let b=`${a}/models`,d=await fetch(b,{method:"GET",headers:{"Content-Type":"application/json","x-api-key":c.apiKey,"anthropic-version":"2023-06-01",Authorization:`Bearer ${c.apiKey}`}});if(!d.ok){let a=await d.text();return console.log(`Error fetching models from ${c.provider}:`,a),v.NextResponse.json({error:`Failed to fetch models: ${d.status}`},{status:d.status})}let e=await d.json(),f=e.data||e.models||[];return v.NextResponse.json({provider:c.provider,connectionId:c.id,models:f})}let d=F[c.provider];if(!d)return v.NextResponse.json({error:`Provider ${c.provider} does not support models listing`},{status:400});if("function"==typeof d.customResolver){let a=await d.customResolver(c);if(a.error)return v.NextResponse.json({error:a.error},{status:a.status||500});return v.NextResponse.json({provider:c.provider,connectionId:c.id,models:a.models,...a.warning?{warning:a.warning}:{}})}let e=c.providerSpecificData?.copilotToken||c.accessToken||c.apiKey;if(!e)return v.NextResponse.json({error:"No valid token found"},{status:401});let f=d.url;"qwen"===c.provider&&(f=(a=>{let b="https://portal.qwen.ai/v1/models",c=a?.providerSpecificData?.resourceUrl;if(!c||"string"!=typeof c)return b;let d=c.trim();return d?d.startsWith("http://")||d.startsWith("https://")?`${d.replace(/\/$/,"")}/models`:`https://${d.replace(/\/$/,"")}/v1/models`:b})(c)),d.authQuery&&(f+=`?${d.authQuery}=${e}`);let g={...d.headers};d.authHeader&&!d.authQuery&&(g[d.authHeader]=(d.authPrefix||"")+e);let h={method:d.method,headers:g};d.body&&"POST"===d.method&&(h.body=JSON.stringify(d.body));let i=await fetch(f,h);if(!i.ok){let a=await i.text();return console.log(`Error fetching models from ${c.provider}:`,a),v.NextResponse.json({error:`Failed to fetch models: ${i.status}`},{status:i.status})}let j=await i.json(),k=d.parseResponse(j);return v.NextResponse.json({provider:c.provider,connectionId:c.id,models:k})}catch(a){return console.log("Error fetching provider models:",a),v.NextResponse.json({error:"Failed to fetch models"},{status:500})}}let H=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/providers/[id]/models/route",pathname:"/api/providers/[id]/models",filename:"route",bundlePath:"app/api/providers/[id]/models/route"},distDir:".next-cli-build",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/VansRouter/VansRouter/src/app/api/providers/[id]/models/route.js",nextConfigOutput:"standalone",userland:d,...{}}),{workAsyncStorage:I,workUnitAsyncStorage:J,serverHooks:K}=H;function L(){return(0,g.patchFetch)({workAsyncStorage:I,workUnitAsyncStorage:J})}async function M(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),H.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/providers/[id]/models/route";"/index"===d&&(d="/");let e=await H.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:z,prerenderManifest:A,routerServerContext:B,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,resolvedPathname:E,clientReferenceManifest:F,serverActionsManifest:G}=e,I=(0,k.normalizeAppPath)(d),J=!!(A.dynamicRoutes[I]||A.routes[E]),K=async()=>((null==B?void 0:B.render404)?await B.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!z){let a=!!A.routes[E],b=A.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||H.isDev||z||(L="/index"===(L=E)?"/":L);let M=!0===H.isDev||!J,N=J&&!M;G&&F&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:F,serverActionsManifest:G});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==B?void 0:B.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await H.getIncrementalCache(a,x,A,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>H.onRequestError(a,b,d,e,B)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>H.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&C&&D&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await H.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:C})},!1,B),b}},k=await H.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",C?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),z&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await H.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:C})},!1,B),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},71553:a=>{a.exports=require("node:dns/promises")},73024:a=>{a.exports=require("node:fs")},73136:a=>{a.exports=require("node:url")},73429:a=>{a.exports=require("node:util/types")},73496:a=>{a.exports=require("http2")},74075:a=>{a.exports=require("zlib")},75919:a=>{a.exports=require("node:worker_threads")},76760:a=>{a.exports=require("node:path")},77030:a=>{a.exports=require("node:net")},77598:a=>{a.exports=require("node:crypto")},78474:a=>{a.exports=require("node:events")},79551:a=>{a.exports=require("url")},81630:a=>{a.exports=require("http")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},87550:a=>{a.exports=require("better-sqlite3")},87997:a=>{a.exports=require("node:timers")},90293:(a,b,c)=>{c.r(b),c.d(b,{debug:()=>h,error:()=>k,info:()=>i,maskKey:()=>o,request:()=>l,response:()=>m,stream:()=>n,warn:()=>j});let d={DEBUG:0,INFO:1,WARN:2,ERROR:3},e=d[process.env.LOG_LEVEL?.toUpperCase?.()]??d.INFO;function f(){return new Date().toLocaleTimeString("en-US",{hour12:!1})}function g(a){if(!a)return"";if("string"==typeof a)return a;try{return JSON.stringify(a)}catch{return String(a)}}function h(a,b,c){if(e<=d.DEBUG){let d=c?` ${g(c)}`:"";console.log(`[${f()}] 🔍 [${a}] ${b}${d}`)}}function i(a,b,c){if(e<=d.INFO){let d=c?` ${g(c)}`:"";console.log(`[${f()}] â„šī¸ [${a}] ${b}${d}`)}}function j(a,b,c){e<=d.WARN&&c&&g(c)}function k(a,b,c){if(e<=d.ERROR){let d=c?` ${g(c)}`:"";console.log(`[${f()}] ❌ [${a}] ${b}${d}`)}}function l(a,b,c){let d=c?` ${g(c)}`:"";console.log(`\x1b[36m[${f()}] đŸ“Ĩ ${a} ${b}${d}\x1b[0m`)}function m(a,b,c){let d=c?` ${g(c)}`:"";console.log(`[${f()}] ${a<400?"\uD83D\uDCE4":"\uD83D\uDCA5"} ${a} (${b}ms)${d}`)}function n(a,b){let c=b?` ${g(b)}`:"";console.log(`[${f()}] 🌊 [STREAM] ${a}${c}`)}function o(a){return!a||a.length<8?"***":`${a.slice(0,4)}...${a.slice(-4)}`}},91253:(a,b,c)=>{c.d(b,{AI_PROVIDERS:()=>s,js:()=>w,DI:()=>n,fg:()=>k,Pd:()=>o,IS:()=>h,nJ:()=>i,zN:()=>j,JH:()=>m,jO:()=>y,wb:()=>x,br:()=>l,wG:()=>v,zt:()=>t,gb:()=>q,gC:()=>r,mq:()=>p,rs:()=>u});var d=c(69765);let e="âš ī¸ Risk Notice: This provider uses a subscription/OAuth session not officially licensed for proxy/router use. Account may be restricted or banned. Use at your own risk.";Object.fromEntries(d.A.filter(a=>a.display).map(a=>{let b;return[a.id,"RISK_NOTICE"===(b=a.display).deprecationNotice?{...b,deprecationNotice:e}:b]}));let f=["serviceKinds","ttsConfig","sttConfig","embeddingConfig","imageConfig","imageToTextConfig","videoConfig","musicConfig","searchViaChat","searchConfig","fetchConfig","modelsFetcher","mediaPriority","hiddenKinds"],g=a=>Object.fromEntries(d.A.filter(b=>b.category===a).map(a=>[a.id,function(a){let b={};for(let c of(a.media&&Object.assign(b,a.media),f))void 0!==a[c]&&(b[c]=a[c]);let c={...a.display||{}};return"RISK_NOTICE"===c.deprecationNotice&&(c.deprecationNotice=e),{...c,id:a.id,alias:a.uiAlias||a.alias,...a.hidden?{hidden:!0}:{},...b,...void 0!==a.priority?{priority:a.priority}:{},...a.hasFree?{hasFree:!0}:{},...a.thinkingConfig?{thinkingConfig:a.thinkingConfig}:{},...a.regions?{regions:a.regions,defaultRegion:a.defaultRegion}:{},...a.hasProviderSpecificData?{hasProviderSpecificData:!0}:{},...a.noAuth?{noAuth:!0}:{},...a.passthroughModels?{passthroughModels:!0}:{},...a.hasOAuth?{hasOAuth:!0}:{},...a.authModes?{authModes:a.authModes}:{},...a.authType?{authType:a.authType}:{},...a.authHint?{authHint:a.authHint}:{}}}(a)])),h=g("free"),i=g("freeTier"),j=g("oauth"),k=g("apikey"),l=g("webCookie"),m="openai-compatible-",n="anthropic-compatible-",o="custom-embedding-";function p(a){return"string"==typeof a&&a.startsWith(m)}function q(a){return"string"==typeof a&&a.startsWith(n)}function r(a){return"string"==typeof a&&a.startsWith(o)}let s={...h,...i,...j,...k,...l};function t(a){for(let b of Object.values(s))if(b.alias===a||b.id===a)return b;return null}function u(a){let b=t(a);return b?.id||a}function v(a){let b=s[a];return b?.alias||a}let w=Object.values(s).reduce((a,b)=>(a[b.alias]=b.id,a),{});Object.values(s).reduce((a,b)=>(a[b.id]=b.alias,a),{});let x=d.A.filter(a=>a.features?.usage).map(a=>a.id),y=d.A.filter(a=>a.features?.usageApikey).map(a=>a.id)},91645:a=>{a.exports=require("net")},94735:a=>{a.exports=require("events")}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[1348,4777,9633,9765,8711,3424,3950,1827],()=>b(b.s=62701));module.exports=c})();
1
+ "use strict";(()=>{var a={};a.id=5211,a.ids=[1253,5211,6820],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},643:a=>{a.exports=require("node:perf_hooks")},1708:a=>{a.exports=require("node:process")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4573:a=>{a.exports=require("node:buffer")},7066:a=>{a.exports=require("node:tty")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},14985:a=>{a.exports=require("dns")},16698:a=>{a.exports=require("node:async_hooks")},21820:a=>{a.exports=require("os")},26915:a=>{a.exports=import("playwright-core")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31421:a=>{a.exports=require("node:child_process")},32467:a=>{a.exports=require("node:http2")},33873:a=>{a.exports=require("path")},34589:a=>{a.exports=require("node:assert")},37067:a=>{a.exports=require("node:http")},37540:a=>{a.exports=require("node:console")},38522:a=>{a.exports=require("node:zlib")},40610:a=>{a.exports=require("node:dns")},41692:a=>{a.exports=require("node:tls")},41792:a=>{a.exports=require("node:querystring")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},46293:a=>{a.exports=require("sql.js")},46820:(a,b,c)=>{c.d(b,{Fh:()=>d.Fh,L9:()=>d.L9,Mc:()=>d.Mc,OM:()=>d.OM,P:()=>d.getProviderConnections,Pc:()=>d.Pc,Q_:()=>d.Q_,Qu:()=>d.Qu,S8:()=>d.S8,Yd:()=>d.Yd,ZO:()=>d.ZO,c:()=>d.c,createProviderConnection:()=>d.iE,fK:()=>d.fK,fv:()=>d.fv,ho:()=>d.ho,hr:()=>d.hr,i0:()=>d.i0,o5:()=>d.o5,op:()=>d.op,rj:()=>d.updateProviderConnection,uL:()=>d.uL,ui:()=>d.ui,uv:()=>d.uv});var d=c(94164)},48161:a=>{a.exports=require("node:os")},51455:a=>{a.exports=require("node:fs/promises")},53053:a=>{a.exports=require("node:diagnostics_channel")},55511:a=>{a.exports=require("crypto")},55591:a=>{a.exports=require("https")},57075:a=>{a.exports=require("node:stream")},57975:a=>{a.exports=require("node:util")},59824:(a,b,c)=>{c.d(b,{DI:()=>i,Hp:()=>k,LT:()=>j,MZ:()=>v,Nl:()=>y,Nu:()=>p,OV:()=>h,Op:()=>z,S6:()=>s,Tx:()=>q,WN:()=>t,Ww:()=>A,YT:()=>n,ZL:()=>m,cD:()=>o,f7:()=>x,hF:()=>l,lB:()=>w,t:()=>u});var d=c(21820),e=c(24567),f=c(68711);function g(){let a=(0,d.platform)(),b=(0,d.arch)();return"darwin"===a?"arm64"===b?2:1:"linux"===a?"arm64"===b?4:3:5*("win32"===a)}let h={...f.sr.claude},i={...f.sr.codex},j={...e.w3,...f.sr["gemini-cli"]},k={...f.sr.qwen},l={...f.sr.qoder},m={...f.sr.iflow},n={...e.XP,...f.sr.antigravity,loadCodeAssistClientMetadata:JSON.stringify({ideType:9,platform:g(),pluginType:2})};function o(){return{ideType:9,platform:g(),pluginType:2}}({...f.sr.openai});let p={...f.sr.github},q={...f.sr.kiro},r=/^[a-z]{2}-[a-z]+-\d{1,2}$/;function s(a){if("string"!=typeof a||!r.test(a))throw Error("Invalid region");return a}let t={...f.sr.cursor,tokenStoragePaths:{linux:"~/.config/Cursor/User/globalStorage/state.vscdb",macos:"/Users/<user>/Library/Application Support/Cursor/User/globalStorage/state.vscdb",windows:"%APPDATA%\\Cursor\\User\\globalStorage\\state.vscdb"}},u={...f.sr["kimi-coding"],clientId:process.env.KIMI_CODING_OAUTH_CLIENT_ID||f.xq["kimi-coding"]?.clientId},v={...f.sr.kilocode},w={...f.sr.cline},x={...f.sr.gitlab},y={...f.sr["codebuddy-cn"]},z={...f.sr.zcode},A=3e5},62701:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>M,patchFetch:()=>L,routeModule:()=>H,serverHooks:()=>K,workAsyncStorage:()=>I,workUnitAsyncStorage:()=>J});var d={};c.r(d),c.d(d,{GET:()=>G});var e=c(12334),f=c(59399),g=c(8894),h=c(83760),i=c(34958),j=c(970),k=c(261),l=c(28112),m=c(52194),n=c(9410),o=c(68673),p=c(47471),q=c(13093),r=c(98563),s=c(7572),t=c(86439),u=c(33610),v=c(77231),w=c(46820),x=c(91253),y=c(59824),z=c(83950),A=c(13946),B=c(84397),C=c(26415);let D=a=>Array.isArray(a)?a:a?.data||a?.models||a?.results||[],E=a=>({url:a,method:"GET",headers:{"Content-Type":"application/json"},authHeader:"Authorization",authPrefix:"Bearer ",parseResponse:D}),F={claude:{url:"https://api.anthropic.com/v1/models",method:"GET",headers:{"Anthropic-Version":"2023-06-01","Content-Type":"application/json"},authHeader:"x-api-key",parseResponse:a=>a.data||[]},gemini:{url:"https://generativelanguage.googleapis.com/v1beta/models",method:"GET",headers:{"Content-Type":"application/json"},authQuery:"key",parseResponse:a=>a.models||[]},qwen:{url:"https://portal.qwen.ai/v1/models",method:"GET",headers:{"Content-Type":"application/json"},authHeader:"Authorization",authPrefix:"Bearer ",parseResponse:a=>a.data||[]},codex:{url:"https://chatgpt.com/backend-api/codex/models?client_version=1.0.0",method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},authHeader:"Authorization",authPrefix:"Bearer ",parseResponse:a=>D(a).flatMap(a=>{let b=a?.id||a?.slug||a?.model||a?.name;if(!b)return[];let c=a?.display_name||a?.displayName||a?.name||b,d={...a,id:b,name:c};return!("image"!==(a?.type||"llm")&&!b.toLowerCase().includes("embed"))||b.endsWith("-review")?[d]:[d,{...d,id:`${b}-review`,name:`${c} Review`,upstreamModelId:b,quotaFamily:"review"}]})},antigravity:{url:"https://daily-cloudcode-pa.sandbox.googleapis.com/v1internal:models",method:"POST",headers:{"Content-Type":"application/json"},authHeader:"Authorization",authPrefix:"Bearer ",body:{},parseResponse:a=>a.models||[]},github:{url:"https://api.githubcopilot.com/models",method:"GET",headers:{"Content-Type":"application/json","Copilot-Integration-Id":"vscode-chat","editor-version":"vscode/1.107.1","editor-plugin-version":"copilot-chat/0.26.7","user-agent":"GitHubCopilotChat/0.26.7"},authHeader:"Authorization",authPrefix:"Bearer ",parseResponse:a=>a?.data?a.data.reduce((a,b)=>(b.capabilities?.type==="chat"&&b.policy?.state!=="disabled"&&a.push({id:b.id,name:b.name||b.id,version:b.version,capabilities:b.capabilities,isDefault:!0===b.model_picker_enabled}),a),[]):[]},openai:E("https://api.openai.com/v1/models"),openrouter:E("https://openrouter.ai/api/v1/models"),anthropic:{url:"https://api.anthropic.com/v1/models",method:"GET",headers:{"Anthropic-Version":"2023-06-01","Content-Type":"application/json"},authHeader:"x-api-key",parseResponse:a=>a.data||[]},alicode:{url:"https://coding.dashscope.aliyuncs.com/v1/models",method:"GET",headers:{"Content-Type":"application/json"},authHeader:"Authorization",authPrefix:"Bearer ",parseResponse:a=>a.data||[]},"alicode-intl":{url:"https://coding-intl.dashscope.aliyuncs.com/v1/models",method:"GET",headers:{"Content-Type":"application/json"},authHeader:"Authorization",authPrefix:"Bearer ",parseResponse:a=>a.data||[]},"volcengine-ark":E("https://ark.cn-beijing.volces.com/api/coding/v3/models"),byteplus:E("https://ark.ap-southeast.bytepluses.com/api/coding/v3/models"),deepseek:E("https://api.deepseek.com/models"),groq:E("https://api.groq.com/openai/v1/models"),xai:E("https://api.x.ai/v1/models"),mistral:E("https://api.mistral.ai/v1/models"),perplexity:E("https://api.perplexity.ai/v1/models"),together:E("https://api.together.xyz/v1/models"),fireworks:E("https://api.fireworks.ai/inference/v1/models"),cerebras:E("https://api.cerebras.ai/v1/models"),cohere:E("https://api.cohere.ai/v1/models"),nebius:E("https://api.studio.nebius.ai/v1/models"),siliconflow:E("https://api.siliconflow.com/v1/models"),hyperbolic:E("https://api.hyperbolic.xyz/v1/models"),ollama:E("https://ollama.com/api/tags"),nanobanana:E("https://api.nanobananaapi.ai/v1/models"),chutes:E("https://llm.chutes.ai/v1/models"),nvidia:E("https://integrate.api.nvidia.com/v1/models"),assemblyai:E("https://api.assemblyai.com/v1/models"),"vercel-ai-gateway":E("https://ai-gateway.vercel.sh/v1/models"),kiro:{customResolver:async a=>{let b,c={accessToken:a.accessToken,refreshToken:a.refreshToken,providerSpecificData:a.providerSpecificData||{}};try{let d=await (0,B.c)(c,{log:console,onCredentialsRefreshed:async b=>{b?.accessToken&&(await (0,z.vN)(a.id,{accessToken:b.accessToken,refreshToken:b.refreshToken||a.refreshToken,expiresIn:b.expiresIn}),a.accessToken=b.accessToken,b.refreshToken&&(a.refreshToken=b.refreshToken))}});if(d?.models?.length)return{models:d.models.map(a=>({id:a.id,name:a.name,upstreamModelId:a.upstreamModelId,contextLength:a.contextLength,rateMultiplier:a.rateMultiplier,capabilities:a.capabilities,description:a.description}))};b="Kiro returned no models; falling back to static catalog."}catch(a){b=`Failed to fetch Kiro models: ${a.message}`,console.log("Failed to fetch Kiro models dynamically, falling back to static:",a.message)}return{models:[],warning:b}}},qoder:{customResolver:async a=>{let b,c={accessToken:a.accessToken,refreshToken:a.refreshToken,email:a.email,displayName:a.displayName,providerSpecificData:a.providerSpecificData||{}};try{let a=await (0,C.EV)(c,{forceRefresh:!0});if(a?.models?.length)return{models:a.models.map(a=>({id:`qoder/${a.id}`,name:a.name,contextLength:a.contextLength,isVL:a.isVL,isReasoning:a.isReasoning,maxOutputTokens:a.maxOutputTokens,description:a.description}))};b="Qoder returned no models; falling back to static catalog."}catch(a){b=`Failed to fetch Qoder models: ${a.message}`,console.log("Failed to fetch Qoder models dynamically, falling back to static:",a.message)}return{models:[],warning:b}}},"gemini-cli":{customResolver:(({refreshFn:a,fetchFn:b,parseFn:c,errorLabel:d})=>async e=>{let f,{accessToken:g,refreshToken:h}=e;if(!g)return{error:"No valid token found",status:401};try{let i=await b(g,e);if(!i.ok&&(401===i.status||403===i.status)&&h){let c=await a(e);c?.accessToken&&(await (0,z.vN)(e.id,{accessToken:c.accessToken,refreshToken:c.refreshToken||h,expiresIn:c.expiresIn}),e.accessToken=c.accessToken,c.refreshToken&&(e.refreshToken=c.refreshToken),i=await b(c.accessToken,e))}if(i.ok){let a=await i.json(),b=c(a);if(b.length>0)return{models:b}}else{let a=await i.text();f=`${d}: ${i.status} ${a}`,console.log(`${d} (falling back to static):`,a)}}catch(a){f=`${d}: ${a.message}`,console.log(`${d} (falling back to static):`,a.message)}return{models:[],warning:f}})({refreshFn:a=>(0,z.I9)(a.refreshToken,y.LT.clientId,y.LT.clientSecret),fetchFn:(a,b)=>{let c=b.projectId||b.providerSpecificData?.projectId;return fetch("https://cloudcode-pa.googleapis.com/v1internal:fetchAvailableModels",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`,"User-Agent":"google-api-nodejs-client/9.15.1","X-Goog-Api-Client":"google-cloud-sdk vscode_cloudshelleditor/0.1"},body:JSON.stringify(c?{project:c}:{})})},parseFn:a=>Array.isArray(a?.models)?a.models.flatMap(a=>{let b=a?.id||a?.model||a?.name;return b?[{id:b,name:a?.displayName||a?.name||b}]:[]}):a?.models&&"object"==typeof a.models?Object.entries(a.models).reduce((a,[b,c])=>(c?.isInternal||a.push({id:b,name:c?.displayName||c?.name||b}),a),[]):[],errorLabel:"Failed to fetch Gemini CLI models"})},"ollama-local":{customResolver:async a=>{let b=`${(0,A.Ak)(a)}/api/tags`,c=await fetch(b,{method:"GET",headers:{"Content-Type":"application/json"}});return c.ok?{models:D(await c.json())}:(console.log("Error fetching models from ollama-local:",await c.text()),{error:`Failed to fetch models: ${c.status}`,status:c.status})}}};async function G(a,{params:b}){try{let{id:a}=await b,c=await (0,w.Mc)(a);if(!c)return v.NextResponse.json({error:"Connection not found"},{status:404});if((0,x.mq)(c.provider)){let a=c.providerSpecificData?.baseUrl;if(!a)return v.NextResponse.json({error:"No base URL configured for OpenAI compatible provider"},{status:400});let b=`${a.replace(/\/$/,"")}/models`,d=await fetch(b,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${c.apiKey}`}});if(!d.ok){let a=await d.text();return console.log(`Error fetching models from ${c.provider}:`,a),v.NextResponse.json({error:`Failed to fetch models: ${d.status}`},{status:d.status})}let e=await d.json(),f=e.data||e.models||[];return v.NextResponse.json({provider:c.provider,connectionId:c.id,models:f})}if((0,x.gb)(c.provider)){let a=c.providerSpecificData?.baseUrl;if(!a)return v.NextResponse.json({error:"No base URL configured for Anthropic compatible provider"},{status:400});(a=a.replace(/\/$/,"")).endsWith("/messages")&&(a=a.slice(0,-9));let b=`${a}/models`,d=await fetch(b,{method:"GET",headers:{"Content-Type":"application/json","x-api-key":c.apiKey,"anthropic-version":"2023-06-01",Authorization:`Bearer ${c.apiKey}`}});if(!d.ok){let a=await d.text();return console.log(`Error fetching models from ${c.provider}:`,a),v.NextResponse.json({error:`Failed to fetch models: ${d.status}`},{status:d.status})}let e=await d.json(),f=e.data||e.models||[];return v.NextResponse.json({provider:c.provider,connectionId:c.id,models:f})}let d=F[c.provider];if(!d)return v.NextResponse.json({error:`Provider ${c.provider} does not support models listing`},{status:400});if("function"==typeof d.customResolver){let a=await d.customResolver(c);if(a.error)return v.NextResponse.json({error:a.error},{status:a.status||500});return v.NextResponse.json({provider:c.provider,connectionId:c.id,models:a.models,...a.warning?{warning:a.warning}:{}})}let e=c.providerSpecificData?.copilotToken||c.accessToken||c.apiKey;if(!e)return v.NextResponse.json({error:"No valid token found"},{status:401});let f=d.url;"qwen"===c.provider&&(f=(a=>{let b="https://portal.qwen.ai/v1/models",c=a?.providerSpecificData?.resourceUrl;if(!c||"string"!=typeof c)return b;let d=c.trim();return d?d.startsWith("http://")||d.startsWith("https://")?`${d.replace(/\/$/,"")}/models`:`https://${d.replace(/\/$/,"")}/v1/models`:b})(c)),d.authQuery&&(f+=`?${d.authQuery}=${e}`);let g={...d.headers};d.authHeader&&!d.authQuery&&(g[d.authHeader]=(d.authPrefix||"")+e);let h={method:d.method,headers:g};d.body&&"POST"===d.method&&(h.body=JSON.stringify(d.body));let i=await fetch(f,h);if(!i.ok){let a=await i.text();return console.log(`Error fetching models from ${c.provider}:`,a),v.NextResponse.json({error:`Failed to fetch models: ${i.status}`},{status:i.status})}let j=await i.json(),k=d.parseResponse(j);return v.NextResponse.json({provider:c.provider,connectionId:c.id,models:k})}catch(a){return console.log("Error fetching provider models:",a),v.NextResponse.json({error:"Failed to fetch models"},{status:500})}}let H=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/providers/[id]/models/route",pathname:"/api/providers/[id]/models",filename:"route",bundlePath:"app/api/providers/[id]/models/route"},distDir:".next-cli-build",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/VansRouter/VansRouter/src/app/api/providers/[id]/models/route.js",nextConfigOutput:"standalone",userland:d,...{}}),{workAsyncStorage:I,workUnitAsyncStorage:J,serverHooks:K}=H;function L(){return(0,g.patchFetch)({workAsyncStorage:I,workUnitAsyncStorage:J})}async function M(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),H.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/providers/[id]/models/route";"/index"===d&&(d="/");let e=await H.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:z,prerenderManifest:A,routerServerContext:B,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,resolvedPathname:E,clientReferenceManifest:F,serverActionsManifest:G}=e,I=(0,k.normalizeAppPath)(d),J=!!(A.dynamicRoutes[I]||A.routes[E]),K=async()=>((null==B?void 0:B.render404)?await B.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!z){let a=!!A.routes[E],b=A.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||H.isDev||z||(L="/index"===(L=E)?"/":L);let M=!0===H.isDev||!J,N=J&&!M;G&&F&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:F,serverActionsManifest:G});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==B?void 0:B.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await H.getIncrementalCache(a,x,A,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>H.onRequestError(a,b,d,e,B)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>H.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&C&&D&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await H.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:C})},!1,B),b}},k=await H.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",C?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),z&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await H.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:C})},!1,B),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},71553:a=>{a.exports=require("node:dns/promises")},73024:a=>{a.exports=require("node:fs")},73136:a=>{a.exports=require("node:url")},73429:a=>{a.exports=require("node:util/types")},73496:a=>{a.exports=require("http2")},74075:a=>{a.exports=require("zlib")},75919:a=>{a.exports=require("node:worker_threads")},76760:a=>{a.exports=require("node:path")},77030:a=>{a.exports=require("node:net")},77598:a=>{a.exports=require("node:crypto")},78474:a=>{a.exports=require("node:events")},79551:a=>{a.exports=require("url")},81630:a=>{a.exports=require("http")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},87550:a=>{a.exports=require("better-sqlite3")},87997:a=>{a.exports=require("node:timers")},90293:(a,b,c)=>{c.r(b),c.d(b,{debug:()=>h,error:()=>k,info:()=>i,maskKey:()=>o,request:()=>l,response:()=>m,stream:()=>n,warn:()=>j});let d={DEBUG:0,INFO:1,WARN:2,ERROR:3},e=d[process.env.LOG_LEVEL?.toUpperCase?.()]??d.INFO;function f(){return new Date().toLocaleTimeString("en-US",{hour12:!1})}function g(a){if(!a)return"";if("string"==typeof a)return a;try{return JSON.stringify(a)}catch{return String(a)}}function h(a,b,c){if(e<=d.DEBUG){let d=c?` ${g(c)}`:"";console.log(`[${f()}] 🔍 [${a}] ${b}${d}`)}}function i(a,b,c){if(e<=d.INFO){let d=c?` ${g(c)}`:"";console.log(`[${f()}] â„šī¸ [${a}] ${b}${d}`)}}function j(a,b,c){e<=d.WARN&&c&&g(c)}function k(a,b,c){if(e<=d.ERROR){let d=c?` ${g(c)}`:"";console.log(`[${f()}] ❌ [${a}] ${b}${d}`)}}function l(a,b,c){let d=c?` ${g(c)}`:"";console.log(`\x1b[36m[${f()}] đŸ“Ĩ ${a} ${b}${d}\x1b[0m`)}function m(a,b,c){let d=c?` ${g(c)}`:"";console.log(`[${f()}] ${a<400?"\uD83D\uDCE4":"\uD83D\uDCA5"} ${a} (${b}ms)${d}`)}function n(a,b){let c=b?` ${g(b)}`:"";console.log(`[${f()}] 🌊 [STREAM] ${a}${c}`)}function o(a){return!a||a.length<8?"***":`${a.slice(0,4)}...${a.slice(-4)}`}},91253:(a,b,c)=>{c.d(b,{AI_PROVIDERS:()=>s,js:()=>w,DI:()=>n,fg:()=>k,Pd:()=>o,IS:()=>h,nJ:()=>i,zN:()=>j,JH:()=>m,jO:()=>y,wb:()=>x,br:()=>l,wG:()=>v,zt:()=>t,gb:()=>q,gC:()=>r,mq:()=>p,rs:()=>u});var d=c(69765);let e="âš ī¸ Risk Notice: This provider uses a subscription/OAuth session not officially licensed for proxy/router use. Account may be restricted or banned. Use at your own risk.";Object.fromEntries(d.A.filter(a=>a.display).map(a=>{let b;return[a.id,"RISK_NOTICE"===(b=a.display).deprecationNotice?{...b,deprecationNotice:e}:b]}));let f=["serviceKinds","ttsConfig","sttConfig","embeddingConfig","imageConfig","imageToTextConfig","videoConfig","musicConfig","searchViaChat","searchConfig","fetchConfig","modelsFetcher","mediaPriority","hiddenKinds"],g=a=>Object.fromEntries(d.A.filter(b=>b.category===a).map(a=>[a.id,function(a){let b={};for(let c of(a.media&&Object.assign(b,a.media),f))void 0!==a[c]&&(b[c]=a[c]);let c={...a.display||{}};return"RISK_NOTICE"===c.deprecationNotice&&(c.deprecationNotice=e),{...c,id:a.id,alias:a.uiAlias||a.alias,...a.hidden?{hidden:!0}:{},...b,...void 0!==a.priority?{priority:a.priority}:{},...a.hasFree?{hasFree:!0}:{},...a.thinkingConfig?{thinkingConfig:a.thinkingConfig}:{},...a.regions?{regions:a.regions,defaultRegion:a.defaultRegion}:{},...a.hasProviderSpecificData?{hasProviderSpecificData:!0}:{},...a.noAuth?{noAuth:!0}:{},...a.passthroughModels?{passthroughModels:!0}:{},...a.hasOAuth?{hasOAuth:!0}:{},...a.authModes?{authModes:a.authModes}:{},...a.authType?{authType:a.authType}:{},...a.authHint?{authHint:a.authHint}:{}}}(a)])),h=g("free"),i=g("freeTier"),j=g("oauth"),k=g("apikey"),l=g("webCookie"),m="openai-compatible-",n="anthropic-compatible-",o="custom-embedding-";function p(a){return"string"==typeof a&&a.startsWith(m)}function q(a){return"string"==typeof a&&a.startsWith(n)}function r(a){return"string"==typeof a&&a.startsWith(o)}let s={...h,...i,...j,...k,...l};function t(a){for(let b of Object.values(s))if(b.alias===a||b.id===a)return b;return null}function u(a){let b=t(a);return b?.id||a}function v(a){let b=s[a];return b?.alias||a}let w=Object.values(s).reduce((a,b)=>(a[b.alias]=b.id,a),{});Object.values(s).reduce((a,b)=>(a[b.id]=b.alias,a),{});let x=d.A.filter(a=>a.features?.usage).map(a=>a.id),y=d.A.filter(a=>a.features?.usageApikey).map(a=>a.id)},91645:a=>{a.exports=require("net")},94735:a=>{a.exports=require("events")}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[1348,4777,9633,9765,8711,3424,3950,1827],()=>b(b.s=62701));module.exports=c})();
@@ -1 +1 @@
1
- "use strict";(()=>{var a={};a.id=4286,a.ids=[4286,6085],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},643:a=>{a.exports=require("node:perf_hooks")},893:(a,b,c)=>{c.d(b,{Ue:()=>k,oT:()=>l});var d=c(68711);let e=d.xq.xai?.clientId,f="https://auth.x.ai",g="/oauth2/authorize",h="/oauth2/token",i="/.well-known/openid-configuration",j="/callback",k=96,l={clientId:e,issuer:f,authEndpointPath:g,tokenEndpointPath:h,discoveryPath:i,authorizeUrl:`${f}${g}`,tokenUrl:`${f}${h}`,discoveryUrl:`${f}${i}`,scope:"openid profile email offline_access grok-cli:access api:access",apiBaseUrl:"https://api.x.ai/v1",redirectUri:`http://127.0.0.1:56121${j}`,loopbackPort:56121,callbackPath:j,pkceVerifierBytes:96,refreshLeadSeconds:300,userAgent:"grok-cli/vansrouter",codeChallengeMethod:"S256"}},1708:a=>{a.exports=require("node:process")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4573:a=>{a.exports=require("node:buffer")},7066:a=>{a.exports=require("node:tty")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},14518:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>m});var e=c(77231),f=c(94164),g=c(96975),h=c(91253),i=a([g]);g=(i.then?(await i)():i)[0];let n=["id","provider","authType","name","email","displayName","priority","globalPriority","isActive","defaultModel","testStatus","lastError","lastErrorAt","errorCode","expiresAt","lastUsedAt","consecutiveUseCount","createdAt","updatedAt"],o=["baseUrl","azureEndpoint","deployment","apiVersion","accountId","region","projectId","resourceUrl","proxyPoolId","connectionProxyEnabled","connectionProxyUrl","connectionNoProxy","githubLogin","githubName","githubEmail","githubUserId","username","firstName","lastName","authMethod","authKind","profileArn"];function j(a){var b;let c={};for(let b of n)void 0!==a[b]&&(c[b]=a[b]);if(c.name&&(b=c.name,c.name="string"!=typeof b||b.length<=16?b:/[a-zA-Z0-9_-]{32,}/.test(b)?`${b.slice(0,8)}***`:b),a.providerSpecificData){let b={};for(let c of o)void 0!==a.providerSpecificData[c]&&(b[c]=a.providerSpecificData[c]);c.providerSpecificData=b}return c}function k(a){return h.wb.includes(a.provider)&&("oauth"===a.authType||h.jO.includes(a.provider))}function l(a,b){let c=Number.parseInt(a,10);return Number.isFinite(c)&&c>0?c:b}async function m(a){try{var b;let c;await (0,g.PY)();let{searchParams:d}=new URL(a.url),i=d.get("provider")||"all",m=d.get("accountStatus")||"all",n=d.get("sort")||"priority",o=l(d.get("page"),1),p=Math.min(l(d.get("pageSize"),20),500),q=(await (0,f.getProviderConnections)()).filter(k),r=Array.from(new Set(q.map(a=>a.provider))).sort(),s=q.filter(a=>"all"===i||a.provider===i),t=(b=s.filter(a=>"active"===m?a.isActive??!0:"inactive"!==m||!(a.isActive??!0)),c=[...b],"provider"===n?c.sort((a,b)=>{let c=h.wb.indexOf(a.provider),d=h.wb.indexOf(b.provider);return c!==d?c-d:a.provider.localeCompare(b.provider)}):c.sort((a,b)=>{let c=a.priority??Number.MAX_SAFE_INTEGER,d=b.priority??Number.MAX_SAFE_INTEGER;return c!==d?c-d:(a.provider||"").localeCompare(b.provider||"")})),u=t.length,v=Math.max(1,Math.ceil(u/p)),w=Math.min(o,v),x=(w-1)*p,y=t.slice(x,x+p).map(j);return e.NextResponse.json({connections:y,providerOptions:r,pagination:{page:w,pageSize:p,total:u,totalPages:v},totals:{eligibleConnections:q.length,providerFilteredConnections:s.length}})}catch(a){return console.log("Error fetching providers for client:",a),e.NextResponse.json({error:"Failed to fetch providers"},{status:500})}}d()}catch(a){d(a)}})},14985:a=>{a.exports=require("dns")},16698:a=>{a.exports=require("node:async_hooks")},21820:a=>{a.exports=require("os")},24364:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{handler:()=>y,patchFetch:()=>x,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var e=c(12334),f=c(59399),g=c(8894),h=c(83760),i=c(34958),j=c(970),k=c(261),l=c(28112),m=c(52194),n=c(9410),o=c(68673),p=c(47471),q=c(13093),r=c(98563),s=c(7572),t=c(86439),u=c(33610),v=c(14518),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/providers/client/route",pathname:"/api/providers/client",filename:"route",bundlePath:"app/api/providers/client/route"},distDir:".next-cli-build",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/VansRouter/VansRouter/src/app/api/providers/client/route.js",nextConfigOutput:"standalone",userland:v,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function x(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function y(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/providers/client/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L=F,L="/index"===L?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}d()}catch(a){d(a)}})},26254:(a,b,c)=>{c.d(b,{$N:()=>f,OK:()=>g,Zl:()=>h,lz:()=>i});var d=c(55511),e=c.n(d);function f(a=32){return e().randomBytes(a).toString("base64url")}function g(a){return e().createHash("sha256").update(a).digest("base64url")}function h(){return e().randomBytes(32).toString("base64url")}function i(a=32){let b=f(a),c=g(b);return{codeVerifier:b,codeChallenge:c,state:h()}}},26915:a=>{a.exports=import("playwright-core")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31421:a=>{a.exports=require("node:child_process")},32467:a=>{a.exports=require("node:http2")},33873:a=>{a.exports=require("path")},34589:a=>{a.exports=require("node:assert")},37067:a=>{a.exports=require("node:http")},37540:a=>{a.exports=require("node:console")},38522:a=>{a.exports=require("node:zlib")},40610:a=>{a.exports=require("node:dns")},41692:a=>{a.exports=require("node:tls")},41792:a=>{a.exports=require("node:querystring")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},46293:a=>{a.exports=require("sql.js")},48161:a=>{a.exports=require("node:os")},51455:a=>{a.exports=require("node:fs/promises")},53053:a=>{a.exports=require("node:diagnostics_channel")},55511:a=>{a.exports=require("crypto")},55591:a=>{a.exports=require("https")},57075:a=>{a.exports=require("node:stream")},57975:a=>{a.exports=require("node:util")},59824:(a,b,c)=>{c.d(b,{DI:()=>i,Hp:()=>k,LT:()=>j,MZ:()=>v,Nl:()=>z,Nu:()=>p,OV:()=>h,Op:()=>A,S6:()=>s,Tx:()=>q,WN:()=>t,Ww:()=>B,YT:()=>n,ZL:()=>m,cD:()=>o,f7:()=>y,hF:()=>l,lB:()=>w,t:()=>u,w1:()=>x});var d=c(21820),e=c(24567),f=c(68711);function g(){let a=(0,d.platform)(),b=(0,d.arch)();return"darwin"===a?"arm64"===b?2:1:"linux"===a?"arm64"===b?4:3:5*("win32"===a)}let h={...f.sr.claude},i={...f.sr.codex},j={...e.w3,...f.sr["gemini-cli"]},k={...f.sr.qwen},l={...f.sr.qoder},m={...f.sr.iflow},n={...e.XP,...f.sr.antigravity,loadCodeAssistClientMetadata:JSON.stringify({ideType:9,platform:g(),pluginType:2})};function o(){return{ideType:9,platform:g(),pluginType:2}}({...f.sr.openai});let p={...f.sr.github},q={...f.sr.kiro},r=/^[a-z]{2}-[a-z]+-\d{1,2}$/;function s(a){if("string"!=typeof a||!r.test(a))throw Error("Invalid region");return a}let t={...f.sr.cursor,tokenStoragePaths:{linux:"~/.config/Cursor/User/globalStorage/state.vscdb",macos:"/Users/<user>/Library/Application Support/Cursor/User/globalStorage/state.vscdb",windows:"%APPDATA%\\Cursor\\User\\globalStorage\\state.vscdb"}},u={...f.sr["kimi-coding"],clientId:process.env.KIMI_CODING_OAUTH_CLIENT_ID||f.xq["kimi-coding"]?.clientId},v={...f.sr.kilocode},w={...f.sr.cline},x={...f.sr.clinepass},y={...f.sr.gitlab},z={...f.sr["codebuddy-cn"]},A={...f.sr.zcode},B=3e5},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},71553:a=>{a.exports=require("node:dns/promises")},73024:a=>{a.exports=require("node:fs")},73136:a=>{a.exports=require("node:url")},73429:a=>{a.exports=require("node:util/types")},73496:a=>{a.exports=require("http2")},74075:a=>{a.exports=require("zlib")},75919:a=>{a.exports=require("node:worker_threads")},76760:a=>{a.exports=require("node:path")},77030:a=>{a.exports=require("node:net")},77598:a=>{a.exports=require("node:crypto")},78474:a=>{a.exports=require("node:events")},79551:a=>{a.exports=require("url")},81630:a=>{a.exports=require("http")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},87550:a=>{a.exports=require("better-sqlite3")},87997:a=>{a.exports=require("node:timers")},91645:a=>{a.exports=require("net")},94735:a=>{a.exports=require("events")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[1348,4777,3398,9633,9765,8711,7010,7916,404,3424,4418,4574,2557,6975],()=>b(b.s=24364));module.exports=c})();
1
+ "use strict";(()=>{var a={};a.id=4286,a.ids=[4286,6085],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},643:a=>{a.exports=require("node:perf_hooks")},893:(a,b,c)=>{c.d(b,{Ue:()=>k,oT:()=>l});var d=c(68711);let e=d.xq.xai?.clientId,f="https://auth.x.ai",g="/oauth2/authorize",h="/oauth2/token",i="/.well-known/openid-configuration",j="/callback",k=96,l={clientId:e,issuer:f,authEndpointPath:g,tokenEndpointPath:h,discoveryPath:i,authorizeUrl:`${f}${g}`,tokenUrl:`${f}${h}`,discoveryUrl:`${f}${i}`,scope:"openid profile email offline_access grok-cli:access api:access",apiBaseUrl:"https://api.x.ai/v1",redirectUri:`http://127.0.0.1:56121${j}`,loopbackPort:56121,callbackPath:j,pkceVerifierBytes:96,refreshLeadSeconds:300,userAgent:"grok-cli/vansrouter",codeChallengeMethod:"S256"}},1708:a=>{a.exports=require("node:process")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4573:a=>{a.exports=require("node:buffer")},7066:a=>{a.exports=require("node:tty")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},14518:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>m});var e=c(77231),f=c(94164),g=c(96975),h=c(91253),i=a([g]);g=(i.then?(await i)():i)[0];let n=["id","provider","authType","name","email","displayName","priority","globalPriority","isActive","defaultModel","testStatus","lastError","lastErrorAt","errorCode","expiresAt","lastUsedAt","consecutiveUseCount","createdAt","updatedAt"],o=["baseUrl","azureEndpoint","deployment","apiVersion","accountId","region","projectId","resourceUrl","proxyPoolId","connectionProxyEnabled","connectionProxyUrl","connectionNoProxy","githubLogin","githubName","githubEmail","githubUserId","username","firstName","lastName","authMethod","authKind","profileArn"];function j(a){var b;let c={};for(let b of n)void 0!==a[b]&&(c[b]=a[b]);if(c.name&&(b=c.name,c.name="string"!=typeof b||b.length<=16?b:/[a-zA-Z0-9_-]{32,}/.test(b)?`${b.slice(0,8)}***`:b),a.providerSpecificData){let b={};for(let c of o)void 0!==a.providerSpecificData[c]&&(b[c]=a.providerSpecificData[c]);c.providerSpecificData=b}return c}function k(a){return h.wb.includes(a.provider)&&("oauth"===a.authType||h.jO.includes(a.provider))}function l(a,b){let c=Number.parseInt(a,10);return Number.isFinite(c)&&c>0?c:b}async function m(a){try{var b;let c;await (0,g.PY)();let{searchParams:d}=new URL(a.url),i=d.get("provider")||"all",m=d.get("accountStatus")||"all",n=d.get("sort")||"priority",o=l(d.get("page"),1),p=Math.min(l(d.get("pageSize"),20),500),q=(await (0,f.getProviderConnections)()).filter(k),r=Array.from(new Set(q.map(a=>a.provider))).sort(),s=q.filter(a=>"all"===i||a.provider===i),t=(b=s.filter(a=>"active"===m?a.isActive??!0:"inactive"!==m||!(a.isActive??!0)),c=[...b],"provider"===n?c.sort((a,b)=>{let c=h.wb.indexOf(a.provider),d=h.wb.indexOf(b.provider);return c!==d?c-d:a.provider.localeCompare(b.provider)}):c.sort((a,b)=>{let c=a.priority??Number.MAX_SAFE_INTEGER,d=b.priority??Number.MAX_SAFE_INTEGER;return c!==d?c-d:(a.provider||"").localeCompare(b.provider||"")})),u=t.length,v=Math.max(1,Math.ceil(u/p)),w=Math.min(o,v),x=(w-1)*p,y=t.slice(x,x+p).map(j);return e.NextResponse.json({connections:y,providerOptions:r,pagination:{page:w,pageSize:p,total:u,totalPages:v},totals:{eligibleConnections:q.length,providerFilteredConnections:s.length}})}catch(a){return console.log("Error fetching providers for client:",a),e.NextResponse.json({error:"Failed to fetch providers"},{status:500})}}d()}catch(a){d(a)}})},14985:a=>{a.exports=require("dns")},16698:a=>{a.exports=require("node:async_hooks")},21820:a=>{a.exports=require("os")},24364:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{handler:()=>y,patchFetch:()=>x,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var e=c(12334),f=c(59399),g=c(8894),h=c(83760),i=c(34958),j=c(970),k=c(261),l=c(28112),m=c(52194),n=c(9410),o=c(68673),p=c(47471),q=c(13093),r=c(98563),s=c(7572),t=c(86439),u=c(33610),v=c(14518),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/providers/client/route",pathname:"/api/providers/client",filename:"route",bundlePath:"app/api/providers/client/route"},distDir:".next-cli-build",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/VansRouter/VansRouter/src/app/api/providers/client/route.js",nextConfigOutput:"standalone",userland:v,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function x(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function y(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/providers/client/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L=F,L="/index"===L?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}d()}catch(a){d(a)}})},26254:(a,b,c)=>{c.d(b,{$N:()=>f,OK:()=>g,Zl:()=>h,lz:()=>i});var d=c(55511),e=c.n(d);function f(a=32){return e().randomBytes(a).toString("base64url")}function g(a){return e().createHash("sha256").update(a).digest("base64url")}function h(){return e().randomBytes(32).toString("base64url")}function i(a=32){let b=f(a),c=g(b);return{codeVerifier:b,codeChallenge:c,state:h()}}},26915:a=>{a.exports=import("playwright-core")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31421:a=>{a.exports=require("node:child_process")},32467:a=>{a.exports=require("node:http2")},33873:a=>{a.exports=require("path")},34589:a=>{a.exports=require("node:assert")},37067:a=>{a.exports=require("node:http")},37540:a=>{a.exports=require("node:console")},38522:a=>{a.exports=require("node:zlib")},40610:a=>{a.exports=require("node:dns")},41692:a=>{a.exports=require("node:tls")},41792:a=>{a.exports=require("node:querystring")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},46293:a=>{a.exports=require("sql.js")},48161:a=>{a.exports=require("node:os")},51455:a=>{a.exports=require("node:fs/promises")},53053:a=>{a.exports=require("node:diagnostics_channel")},55511:a=>{a.exports=require("crypto")},55591:a=>{a.exports=require("https")},57075:a=>{a.exports=require("node:stream")},57975:a=>{a.exports=require("node:util")},59824:(a,b,c)=>{c.d(b,{DI:()=>i,Hp:()=>k,LT:()=>j,MZ:()=>v,Nl:()=>y,Nu:()=>p,OV:()=>h,Op:()=>z,S6:()=>s,Tx:()=>q,WN:()=>t,Ww:()=>A,YT:()=>n,ZL:()=>m,cD:()=>o,f7:()=>x,hF:()=>l,lB:()=>w,t:()=>u});var d=c(21820),e=c(24567),f=c(68711);function g(){let a=(0,d.platform)(),b=(0,d.arch)();return"darwin"===a?"arm64"===b?2:1:"linux"===a?"arm64"===b?4:3:5*("win32"===a)}let h={...f.sr.claude},i={...f.sr.codex},j={...e.w3,...f.sr["gemini-cli"]},k={...f.sr.qwen},l={...f.sr.qoder},m={...f.sr.iflow},n={...e.XP,...f.sr.antigravity,loadCodeAssistClientMetadata:JSON.stringify({ideType:9,platform:g(),pluginType:2})};function o(){return{ideType:9,platform:g(),pluginType:2}}({...f.sr.openai});let p={...f.sr.github},q={...f.sr.kiro},r=/^[a-z]{2}-[a-z]+-\d{1,2}$/;function s(a){if("string"!=typeof a||!r.test(a))throw Error("Invalid region");return a}let t={...f.sr.cursor,tokenStoragePaths:{linux:"~/.config/Cursor/User/globalStorage/state.vscdb",macos:"/Users/<user>/Library/Application Support/Cursor/User/globalStorage/state.vscdb",windows:"%APPDATA%\\Cursor\\User\\globalStorage\\state.vscdb"}},u={...f.sr["kimi-coding"],clientId:process.env.KIMI_CODING_OAUTH_CLIENT_ID||f.xq["kimi-coding"]?.clientId},v={...f.sr.kilocode},w={...f.sr.cline},x={...f.sr.gitlab},y={...f.sr["codebuddy-cn"]},z={...f.sr.zcode},A=3e5},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},71553:a=>{a.exports=require("node:dns/promises")},73024:a=>{a.exports=require("node:fs")},73136:a=>{a.exports=require("node:url")},73429:a=>{a.exports=require("node:util/types")},73496:a=>{a.exports=require("http2")},74075:a=>{a.exports=require("zlib")},75919:a=>{a.exports=require("node:worker_threads")},76760:a=>{a.exports=require("node:path")},77030:a=>{a.exports=require("node:net")},77598:a=>{a.exports=require("node:crypto")},78474:a=>{a.exports=require("node:events")},79551:a=>{a.exports=require("url")},81630:a=>{a.exports=require("http")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},87550:a=>{a.exports=require("better-sqlite3")},87997:a=>{a.exports=require("node:timers")},91645:a=>{a.exports=require("net")},94735:a=>{a.exports=require("events")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[1348,4777,3398,9633,9765,8711,7010,7916,404,3424,4418,4574,2557,6975],()=>b(b.s=24364));module.exports=c})();