omniroute 1.4.10 → 1.4.11

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 (216) hide show
  1. package/app/.next/BUILD_ID +1 -1
  2. package/app/.next/app-path-routes-manifest.json +34 -34
  3. package/app/.next/build-manifest.json +2 -2
  4. package/app/.next/prerender-manifest.json +3 -3
  5. package/app/.next/server/app/(dashboard)/dashboard/analytics/page.js +1 -1
  6. package/app/.next/server/app/(dashboard)/dashboard/analytics/page_client-reference-manifest.js +1 -1
  7. package/app/.next/server/app/(dashboard)/dashboard/api-manager/page_client-reference-manifest.js +1 -1
  8. package/app/.next/server/app/(dashboard)/dashboard/audit-log/page_client-reference-manifest.js +1 -1
  9. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  10. package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  11. package/app/.next/server/app/(dashboard)/dashboard/costs/page.js +1 -1
  12. package/app/.next/server/app/(dashboard)/dashboard/costs/page_client-reference-manifest.js +1 -1
  13. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  14. package/app/.next/server/app/(dashboard)/dashboard/health/page_client-reference-manifest.js +1 -1
  15. package/app/.next/server/app/(dashboard)/dashboard/limits/page.js +1 -1
  16. package/app/.next/server/app/(dashboard)/dashboard/limits/page_client-reference-manifest.js +1 -1
  17. package/app/.next/server/app/(dashboard)/dashboard/logs/page_client-reference-manifest.js +1 -1
  18. package/app/.next/server/app/(dashboard)/dashboard/onboarding/page_client-reference-manifest.js +1 -1
  19. package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  20. package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  21. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  22. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  23. package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  24. package/app/.next/server/app/(dashboard)/dashboard/settings/page_client-reference-manifest.js +1 -1
  25. package/app/.next/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  26. package/app/.next/server/app/(dashboard)/dashboard/translator/page.js +4 -4
  27. package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  28. package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  29. package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  30. package/app/.next/server/app/_global-error.html +2 -2
  31. package/app/.next/server/app/_global-error.rsc +1 -1
  32. package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  33. package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  34. package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  35. package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  36. package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  37. package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  38. package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  39. package/app/.next/server/app/api/auth/login/route.js +1 -1
  40. package/app/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  41. package/app/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  42. package/app/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
  43. package/app/.next/server/app/api/cache/route_client-reference-manifest.js +1 -1
  44. package/app/.next/server/app/api/cache/stats/route_client-reference-manifest.js +1 -1
  45. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  46. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route_client-reference-manifest.js +1 -1
  47. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js +2 -2
  48. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route_client-reference-manifest.js +1 -1
  49. package/app/.next/server/app/api/cli-tools/backups/route.js +1 -1
  50. package/app/.next/server/app/api/cli-tools/backups/route_client-reference-manifest.js +1 -1
  51. package/app/.next/server/app/api/cli-tools/claude-settings/route.js +2 -2
  52. package/app/.next/server/app/api/cli-tools/claude-settings/route_client-reference-manifest.js +1 -1
  53. package/app/.next/server/app/api/cli-tools/cline-settings/route.js +1 -1
  54. package/app/.next/server/app/api/cli-tools/cline-settings/route_client-reference-manifest.js +1 -1
  55. package/app/.next/server/app/api/cli-tools/codex-profiles/route.js +1 -1
  56. package/app/.next/server/app/api/cli-tools/codex-profiles/route_client-reference-manifest.js +1 -1
  57. package/app/.next/server/app/api/cli-tools/codex-settings/route.js +2 -2
  58. package/app/.next/server/app/api/cli-tools/codex-settings/route_client-reference-manifest.js +1 -1
  59. package/app/.next/server/app/api/cli-tools/droid-settings/route.js +1 -1
  60. package/app/.next/server/app/api/cli-tools/droid-settings/route_client-reference-manifest.js +1 -1
  61. package/app/.next/server/app/api/cli-tools/guide-settings/[toolId]/route_client-reference-manifest.js +1 -1
  62. package/app/.next/server/app/api/cli-tools/kilo-settings/route.js +1 -1
  63. package/app/.next/server/app/api/cli-tools/kilo-settings/route_client-reference-manifest.js +1 -1
  64. package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  65. package/app/.next/server/app/api/cli-tools/openclaw-settings/route_client-reference-manifest.js +1 -1
  66. package/app/.next/server/app/api/cli-tools/runtime/[toolId]/route.js +2 -2
  67. package/app/.next/server/app/api/cli-tools/runtime/[toolId]/route_client-reference-manifest.js +1 -1
  68. package/app/.next/server/app/api/cli-tools/status/route.js +2 -2
  69. package/app/.next/server/app/api/cli-tools/status/route_client-reference-manifest.js +1 -1
  70. package/app/.next/server/app/api/cloud/auth/route_client-reference-manifest.js +1 -1
  71. package/app/.next/server/app/api/cloud/credentials/update/route_client-reference-manifest.js +1 -1
  72. package/app/.next/server/app/api/cloud/model/resolve/route_client-reference-manifest.js +1 -1
  73. package/app/.next/server/app/api/cloud/models/alias/route_client-reference-manifest.js +1 -1
  74. package/app/.next/server/app/api/combos/[id]/route_client-reference-manifest.js +1 -1
  75. package/app/.next/server/app/api/combos/metrics/route_client-reference-manifest.js +1 -1
  76. package/app/.next/server/app/api/combos/route.js +1 -1
  77. package/app/.next/server/app/api/combos/route_client-reference-manifest.js +1 -1
  78. package/app/.next/server/app/api/combos/test/route_client-reference-manifest.js +1 -1
  79. package/app/.next/server/app/api/compliance/audit-log/route_client-reference-manifest.js +1 -1
  80. package/app/.next/server/app/api/db-backups/export/route_client-reference-manifest.js +1 -1
  81. package/app/.next/server/app/api/db-backups/exportAll/route_client-reference-manifest.js +1 -1
  82. package/app/.next/server/app/api/db-backups/import/route_client-reference-manifest.js +1 -1
  83. package/app/.next/server/app/api/db-backups/route_client-reference-manifest.js +1 -1
  84. package/app/.next/server/app/api/evals/[suiteId]/route_client-reference-manifest.js +1 -1
  85. package/app/.next/server/app/api/evals/route_client-reference-manifest.js +1 -1
  86. package/app/.next/server/app/api/fallback/chains/route_client-reference-manifest.js +1 -1
  87. package/app/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
  88. package/app/.next/server/app/api/keys/[id]/route_client-reference-manifest.js +1 -1
  89. package/app/.next/server/app/api/keys/route.js +1 -1
  90. package/app/.next/server/app/api/keys/route_client-reference-manifest.js +1 -1
  91. package/app/.next/server/app/api/logs/console/route_client-reference-manifest.js +1 -1
  92. package/app/.next/server/app/api/models/alias/route_client-reference-manifest.js +1 -1
  93. package/app/.next/server/app/api/models/availability/route_client-reference-manifest.js +1 -1
  94. package/app/.next/server/app/api/models/catalog/route_client-reference-manifest.js +1 -1
  95. package/app/.next/server/app/api/models/route.js +1 -1
  96. package/app/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
  97. package/app/.next/server/app/api/monitoring/health/route.js +1 -1
  98. package/app/.next/server/app/api/monitoring/health/route_client-reference-manifest.js +1 -1
  99. package/app/.next/server/app/api/oauth/[provider]/[action]/route_client-reference-manifest.js +1 -1
  100. package/app/.next/server/app/api/oauth/cursor/auto-import/route_client-reference-manifest.js +1 -1
  101. package/app/.next/server/app/api/oauth/cursor/import/route_client-reference-manifest.js +1 -1
  102. package/app/.next/server/app/api/oauth/kiro/auto-import/route_client-reference-manifest.js +1 -1
  103. package/app/.next/server/app/api/oauth/kiro/import/route_client-reference-manifest.js +1 -1
  104. package/app/.next/server/app/api/oauth/kiro/social-authorize/route_client-reference-manifest.js +1 -1
  105. package/app/.next/server/app/api/oauth/kiro/social-exchange/route_client-reference-manifest.js +1 -1
  106. package/app/.next/server/app/api/policies/route_client-reference-manifest.js +1 -1
  107. package/app/.next/server/app/api/pricing/defaults/route_client-reference-manifest.js +1 -1
  108. package/app/.next/server/app/api/pricing/models/route_client-reference-manifest.js +1 -1
  109. package/app/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
  110. package/app/.next/server/app/api/provider-metrics/route_client-reference-manifest.js +1 -1
  111. package/app/.next/server/app/api/provider-models/route_client-reference-manifest.js +1 -1
  112. package/app/.next/server/app/api/provider-nodes/[id]/route_client-reference-manifest.js +1 -1
  113. package/app/.next/server/app/api/provider-nodes/route_client-reference-manifest.js +1 -1
  114. package/app/.next/server/app/api/provider-nodes/validate/route_client-reference-manifest.js +1 -1
  115. package/app/.next/server/app/api/providers/[id]/models/route_client-reference-manifest.js +1 -1
  116. package/app/.next/server/app/api/providers/[id]/route_client-reference-manifest.js +1 -1
  117. package/app/.next/server/app/api/providers/[id]/test/route_client-reference-manifest.js +1 -1
  118. package/app/.next/server/app/api/providers/client/route_client-reference-manifest.js +1 -1
  119. package/app/.next/server/app/api/providers/route.js +1 -1
  120. package/app/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
  121. package/app/.next/server/app/api/providers/test-batch/route_client-reference-manifest.js +1 -1
  122. package/app/.next/server/app/api/providers/validate/route_client-reference-manifest.js +1 -1
  123. package/app/.next/server/app/api/rate-limit/route_client-reference-manifest.js +1 -1
  124. package/app/.next/server/app/api/rate-limits/route_client-reference-manifest.js +1 -1
  125. package/app/.next/server/app/api/resilience/reset/route_client-reference-manifest.js +1 -1
  126. package/app/.next/server/app/api/resilience/route_client-reference-manifest.js +1 -1
  127. package/app/.next/server/app/api/restart/route_client-reference-manifest.js +1 -1
  128. package/app/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
  129. package/app/.next/server/app/api/settings/combo-defaults/route_client-reference-manifest.js +1 -1
  130. package/app/.next/server/app/api/settings/ip-filter/route_client-reference-manifest.js +1 -1
  131. package/app/.next/server/app/api/settings/proxy/route_client-reference-manifest.js +1 -1
  132. package/app/.next/server/app/api/settings/proxy/test/route_client-reference-manifest.js +1 -1
  133. package/app/.next/server/app/api/settings/require-login/route_client-reference-manifest.js +1 -1
  134. package/app/.next/server/app/api/settings/route.js +1 -1
  135. package/app/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
  136. package/app/.next/server/app/api/settings/system-prompt/route_client-reference-manifest.js +1 -1
  137. package/app/.next/server/app/api/settings/thinking-budget/route_client-reference-manifest.js +1 -1
  138. package/app/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
  139. package/app/.next/server/app/api/storage/health/route_client-reference-manifest.js +1 -1
  140. package/app/.next/server/app/api/sync/cloud/route_client-reference-manifest.js +1 -1
  141. package/app/.next/server/app/api/sync/initialize/route_client-reference-manifest.js +1 -1
  142. package/app/.next/server/app/api/tags/route_client-reference-manifest.js +1 -1
  143. package/app/.next/server/app/api/telemetry/summary/route_client-reference-manifest.js +1 -1
  144. package/app/.next/server/app/api/token-health/route_client-reference-manifest.js +1 -1
  145. package/app/.next/server/app/api/translator/detect/route_client-reference-manifest.js +1 -1
  146. package/app/.next/server/app/api/translator/history/route_client-reference-manifest.js +1 -1
  147. package/app/.next/server/app/api/translator/load/route_client-reference-manifest.js +1 -1
  148. package/app/.next/server/app/api/translator/save/route_client-reference-manifest.js +1 -1
  149. package/app/.next/server/app/api/translator/send/route_client-reference-manifest.js +1 -1
  150. package/app/.next/server/app/api/translator/translate/route_client-reference-manifest.js +1 -1
  151. package/app/.next/server/app/api/usage/[connectionId]/route_client-reference-manifest.js +1 -1
  152. package/app/.next/server/app/api/usage/analytics/route_client-reference-manifest.js +1 -1
  153. package/app/.next/server/app/api/usage/budget/route_client-reference-manifest.js +1 -1
  154. package/app/.next/server/app/api/usage/call-logs/[id]/route_client-reference-manifest.js +1 -1
  155. package/app/.next/server/app/api/usage/call-logs/route_client-reference-manifest.js +1 -1
  156. package/app/.next/server/app/api/usage/history/route_client-reference-manifest.js +1 -1
  157. package/app/.next/server/app/api/usage/logs/route_client-reference-manifest.js +1 -1
  158. package/app/.next/server/app/api/usage/proxy-logs/route_client-reference-manifest.js +1 -1
  159. package/app/.next/server/app/api/usage/request-logs/route_client-reference-manifest.js +1 -1
  160. package/app/.next/server/app/api/v1/api/chat/route_client-reference-manifest.js +1 -1
  161. package/app/.next/server/app/api/v1/audio/speech/route_client-reference-manifest.js +1 -1
  162. package/app/.next/server/app/api/v1/audio/transcriptions/route_client-reference-manifest.js +1 -1
  163. package/app/.next/server/app/api/v1/chat/completions/route_client-reference-manifest.js +1 -1
  164. package/app/.next/server/app/api/v1/embeddings/route_client-reference-manifest.js +1 -1
  165. package/app/.next/server/app/api/v1/images/generations/route_client-reference-manifest.js +1 -1
  166. package/app/.next/server/app/api/v1/messages/count_tokens/route_client-reference-manifest.js +1 -1
  167. package/app/.next/server/app/api/v1/messages/route_client-reference-manifest.js +1 -1
  168. package/app/.next/server/app/api/v1/models/route_client-reference-manifest.js +1 -1
  169. package/app/.next/server/app/api/v1/moderations/route_client-reference-manifest.js +1 -1
  170. package/app/.next/server/app/api/v1/providers/[provider]/chat/completions/route_client-reference-manifest.js +1 -1
  171. package/app/.next/server/app/api/v1/providers/[provider]/embeddings/route_client-reference-manifest.js +1 -1
  172. package/app/.next/server/app/api/v1/providers/[provider]/images/generations/route_client-reference-manifest.js +1 -1
  173. package/app/.next/server/app/api/v1/rerank/route_client-reference-manifest.js +1 -1
  174. package/app/.next/server/app/api/v1/responses/route_client-reference-manifest.js +1 -1
  175. package/app/.next/server/app/api/v1/route_client-reference-manifest.js +1 -1
  176. package/app/.next/server/app/api/v1beta/models/[...path]/route_client-reference-manifest.js +1 -1
  177. package/app/.next/server/app/api/v1beta/models/route_client-reference-manifest.js +1 -1
  178. package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
  179. package/app/.next/server/app/docs/page.js +1 -1
  180. package/app/.next/server/app/docs/page_client-reference-manifest.js +1 -1
  181. package/app/.next/server/app/forbidden/page_client-reference-manifest.js +1 -1
  182. package/app/.next/server/app/forgot-password/page.js +1 -1
  183. package/app/.next/server/app/forgot-password/page_client-reference-manifest.js +1 -1
  184. package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
  185. package/app/.next/server/app/login/page.js +1 -1
  186. package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
  187. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  188. package/app/.next/server/app/privacy/page_client-reference-manifest.js +1 -1
  189. package/app/.next/server/app/terms/page_client-reference-manifest.js +1 -1
  190. package/app/.next/server/app-paths-manifest.json +34 -34
  191. package/app/.next/server/chunks/1259.js +1 -1
  192. package/app/.next/server/chunks/1960.js +1 -1
  193. package/app/.next/server/chunks/1990.js +1 -1
  194. package/app/.next/server/chunks/3498.js +5 -3
  195. package/app/.next/server/chunks/9824.js +2 -2
  196. package/app/.next/server/pages/500.html +2 -2
  197. package/app/.next/server/server-reference-manifest.js +1 -1
  198. package/app/.next/server/server-reference-manifest.json +1 -1
  199. package/app/.next/static/chunks/{5846-bac355f56b136439.js → 5846-19c878280decbd16.js} +1 -1
  200. package/app/.next/static/chunks/{993-961f6e199b93539a.js → 993-e3050ebfd4f5032f.js} +1 -1
  201. package/app/.next/static/chunks/app/(dashboard)/dashboard/analytics/page-a50474b6ebdf468a.js +1 -0
  202. package/app/.next/static/chunks/app/(dashboard)/dashboard/costs/page-08f3ed204d01b6a0.js +1 -0
  203. package/app/.next/static/chunks/app/(dashboard)/dashboard/limits/page-fbe1442b61df950a.js +1 -0
  204. package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/page-b351778975cb8622.js +4 -0
  205. package/app/.next/static/chunks/app/forgot-password/page-a440e0c1675842bf.js +1 -0
  206. package/app/.next/static/chunks/app/login/page-164f6b6b41167c5a.js +1 -0
  207. package/app/package.json +1 -1
  208. package/package.json +1 -1
  209. package/app/.next/static/chunks/app/(dashboard)/dashboard/analytics/page-3fcbbdb2221f0b0c.js +0 -1
  210. package/app/.next/static/chunks/app/(dashboard)/dashboard/costs/page-f256689b8410bd74.js +0 -1
  211. package/app/.next/static/chunks/app/(dashboard)/dashboard/limits/page-a5a48afa8c125ada.js +0 -1
  212. package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/page-75c8b38a55e13042.js +0 -4
  213. package/app/.next/static/chunks/app/forgot-password/page-057ea91c6f140e0b.js +0 -1
  214. package/app/.next/static/chunks/app/login/page-c1d7bfab91a7877c.js +0 -1
  215. /package/app/.next/static/{8UAle4UTGR7gIVofXmh_1 → g7Mie-iq39oZ7ts610YtL}/_buildManifest.js +0 -0
  216. /package/app/.next/static/{8UAle4UTGR7gIVofXmh_1 → g7Mie-iq39oZ7ts610YtL}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3700],{14031:(e,t,s)=>{Promise.resolve().then(s.bind(s,70595))},70595:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>h});var a=s(95155),l=s(12115),i=s(40993),r=s(50910),d=s(67671);function n({value:e,max:t,warningAt:s=.8}){let l=t>0?Math.min(e/t*100,100):0,i=t>0?e/t:0;return(0,a.jsxs)("div",{className:"w-full",children:[(0,a.jsxs)("div",{className:"flex justify-between text-xs mb-1",children:[(0,a.jsxs)("span",{className:"text-text-muted",children:["$",e.toFixed(2)]}),(0,a.jsxs)("span",{className:"text-text-muted",children:["$",t.toFixed(2)]})]}),(0,a.jsx)("div",{className:"w-full h-2 rounded-full bg-surface/50 overflow-hidden",children:(0,a.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${l}%`,backgroundColor:i>=1?"#ef4444":i>=s?"#f59e0b":"#22c55e"}})})]})}function o(){let e=(0,r.c)("usage"),[t,s]=(0,l.useState)([]),[o,c]=(0,l.useState)(null),[m,x]=(0,l.useState)(null),[u,p]=(0,l.useState)(!0),[h,g]=(0,l.useState)(!1),[b,f]=(0,l.useState)({dailyLimitUsd:"",monthlyLimitUsd:"",warningThreshold:"80"}),j=(0,d.i)();(0,l.useEffect)(()=>{fetch("/api/keys").then(e=>e.json()).then(e=>{let t=Array.isArray(e)?e:e.keys||[];s(t),t.length>0&&c(t[0].id),p(!1)}).catch(()=>p(!1))},[]);let y=(0,l.useCallback)(async()=>{if(o)try{let e=await fetch(`/api/usage/budget?apiKeyId=${o}`);if(e.ok){let t=await e.json();x(t),t.dailyLimitUsd&&f(e=>({...e,dailyLimitUsd:String(t.dailyLimitUsd)})),t.monthlyLimitUsd&&f(e=>({...e,monthlyLimitUsd:String(t.monthlyLimitUsd)})),t.warningThreshold&&f(e=>({...e,warningThreshold:String(t.warningThreshold)}))}}catch{}},[o]);(0,l.useEffect)(()=>{y()},[y]);let v=async()=>{g(!0);try{(await fetch("/api/usage/budget",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKeyId:o,dailyLimitUsd:b.dailyLimitUsd?parseFloat(b.dailyLimitUsd):null,monthlyLimitUsd:b.monthlyLimitUsd?parseFloat(b.monthlyLimitUsd):null,warningThreshold:parseInt(b.warningThreshold)||80})})).ok?(j.success("Budget limits saved"),await y()):j.error("Failed to save budget")}catch{j.error("Failed to save budget")}finally{g(!1)}};if(u)return(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted p-8 animate-pulse",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"account_balance_wallet"}),"Loading budget data..."]});if(0===t.length)return(0,a.jsx)(i.pp,{icon:"vpn_key",title:"No API Keys",description:"Add API keys first to set up budget limits."});let N=m?.dailyLimitUsd||parseFloat(b.dailyLimitUsd)||0,w=m?.monthlyLimitUsd||parseFloat(b.monthlyLimitUsd)||0,C=m?.totalCostToday||0,k=m?.totalCostMonth||0,S=(parseInt(b.warningThreshold)||80)/100;return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)(i.Zp,{className:"p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-emerald-500/10 text-emerald-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"account_balance_wallet"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:e("budgetManagement")})]}),(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("label",{className:"text-sm text-text-muted mb-1 block",children:e("apiKey")}),(0,a.jsx)("select",{value:o||"",onChange:e=>c(e.target.value),className:"w-full md:w-auto px-3 py-2 rounded-lg border border-border/50 bg-surface/30 text-text-main text-sm focus:outline-none focus:ring-1 focus:ring-primary",children:t.map(e=>(0,a.jsxs)("option",{value:e.id,children:[e.name||e.id," ",e.provider?`(${e.provider})`:""]},e.id))})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[(0,a.jsxs)("div",{className:"p-4 rounded-lg border border-border/30 bg-surface/20",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted mb-2",children:"Today's Spend"}),(0,a.jsxs)("p",{className:"text-2xl font-bold text-text-main",children:["$",C.toFixed(2)]}),N>0&&(0,a.jsx)(n,{value:C,max:N,warningAt:S})]}),(0,a.jsxs)("div",{className:"p-4 rounded-lg border border-border/30 bg-surface/20",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted mb-2",children:e("thisMonth")}),(0,a.jsxs)("p",{className:"text-2xl font-bold text-text-main",children:["$",k.toFixed(2)]}),w>0&&(0,a.jsx)(n,{value:k,max:w,warningAt:S})]})]}),(0,a.jsxs)("div",{className:"border-t border-border/30 pt-4",children:[(0,a.jsx)("p",{className:"text-sm font-medium mb-3",children:e("setLimits")}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-4",children:[(0,a.jsx)(i.pd,{label:"Daily Limit (USD)",type:"number",step:"0.01",min:"0",placeholder:"e.g. 5.00",value:b.dailyLimitUsd,onChange:e=>f({...b,dailyLimitUsd:e.target.value})}),(0,a.jsx)(i.pd,{label:"Monthly Limit (USD)",type:"number",step:"0.01",min:"0",placeholder:"e.g. 50.00",value:b.monthlyLimitUsd,onChange:e=>f({...b,monthlyLimitUsd:e.target.value})}),(0,a.jsx)(i.pd,{label:"Warning Threshold (%)",type:"number",min:"1",max:"100",placeholder:"80",value:b.warningThreshold,onChange:e=>f({...b,warningThreshold:e.target.value})})]}),(0,a.jsx)(i.$n,{variant:"primary",onClick:v,loading:h,children:"Save Limits"})]})]}),m?.budgetCheck&&(0,a.jsx)(i.Zp,{className:"p-4",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",style:{color:m.budgetCheck.allowed?"#22c55e":"#ef4444"},children:m.budgetCheck.allowed?"check_circle":"block"}),(0,a.jsx)("span",{className:"text-sm",children:m.budgetCheck.allowed?`Budget OK — $${(m.budgetCheck.remaining||0).toFixed(2)} remaining`:"Budget exceeded — requests may be blocked"})]})})]})}let c=["input","output","cached","reasoning","cache_creation"],m={input:"Input",output:"Output",cached:"Cached",reasoning:"Reasoning",cache_creation:"Cache Write"};function x(){let[e,t]=(0,l.useState)({}),[s,d]=(0,l.useState)({}),[n,o]=(0,l.useState)(!0),[c,m]=(0,l.useState)(!1),[x,p]=(0,l.useState)(""),[h,g]=(0,l.useState)(null),[b,f]=(0,l.useState)(new Set),[j,y]=(0,l.useState)(""),[v,N]=(0,l.useState)(new Set),w=(0,r.c)("settings");(0,l.useEffect)(()=>{C()},[]);let C=async()=>{o(!0);try{let[e,s]=await Promise.all([fetch("/api/pricing/models"),fetch("/api/pricing")]);e.ok&&t(await e.json()),s.ok&&d(await s.json())}catch(e){console.error("Failed to load pricing data:",e)}finally{o(!1)}},k=(0,l.useMemo)(()=>Object.entries(e).map(([e,t])=>({alias:e,...t,pricedModels:s[e]?Object.keys(s[e]).length:0})).sort((e,t)=>t.modelCount-e.modelCount),[e,s]),S=(0,l.useMemo)(()=>{if(!j.trim())return k;let e=j.toLowerCase();return k.filter(t=>t.alias.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||t.models.some(t=>t.id.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)))},[k,j]),L=(0,l.useMemo)(()=>{let e=k.reduce((e,t)=>e+t.modelCount,0),t=Object.values(s).reduce((e,t)=>e+Object.keys(t).length,0);return{providers:k.length,totalModels:e,pricedCount:t}},[k,s]),U=(0,l.useCallback)(e=>{f(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),T=(0,l.useCallback)((e,t,s,a)=>{let l=parseFloat(a);isNaN(l)||l<0||(d(a=>{let i={...a};return i[e]||(i[e]={}),i[e][t]||(i[e][t]={input:0,output:0,cached:0,reasoning:0,cache_creation:0}),i[e][t]={...i[e][t],[s]:l},i}),N(t=>new Set(t).add(e)))},[]),$=(0,l.useCallback)(async e=>{m(!0),p("");try{let t=s[e]||{},a=await fetch("/api/pricing",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[e]:t})});if(a.ok)p(`✅ ${e.toUpperCase()} saved`),N(t=>{let s=new Set(t);return s.delete(e),s}),setTimeout(()=>p(""),3e3);else{let e=await a.json();p(`❌ Error: ${e.error}`)}}catch(e){p(`❌ Save failed: ${e.message}`)}finally{m(!1)}},[s]),P=(0,l.useCallback)(async e=>{if(confirm(w("resetPricingConfirm",{provider:e.toUpperCase()})))try{let t=await fetch(`/api/pricing?provider=${e}`,{method:"DELETE"});if(t.ok){let s=await t.json();d(s),p(`🔄 ${e.toUpperCase()} reset to defaults`),N(t=>{let s=new Set(t);return s.delete(e),s}),setTimeout(()=>p(""),3e3)}}catch(e){p(`❌ Reset failed: ${e.message}`)}},[]),_=(0,l.useCallback)(e=>{g(t=>t===e?null:e)},[]),O=(0,l.useMemo)(()=>h?S.filter(e=>e.alias===h):S,[S,h]);return n?(0,a.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,a.jsx)("div",{className:"text-text-muted animate-pulse",children:w("loadingPricing")})}):(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between flex-wrap gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-xl font-bold",children:w("modelPricing")}),(0,a.jsx)("p",{className:"text-text-muted text-sm mt-1",children:w("modelPricingDesc")})]}),(0,a.jsxs)("div",{className:"flex gap-3 text-sm",children:[(0,a.jsxs)("div",{className:"bg-bg-subtle rounded-lg px-3 py-2 text-center",children:[(0,a.jsx)("div",{className:"text-text-muted text-xs font-semibold",children:w("providers")}),(0,a.jsx)("div",{className:"text-lg font-bold",children:L.providers})]}),(0,a.jsxs)("div",{className:"bg-bg-subtle rounded-lg px-3 py-2 text-center",children:[(0,a.jsx)("div",{className:"text-text-muted text-xs font-semibold",children:w("registry")}),(0,a.jsx)("div",{className:"text-lg font-bold",children:L.totalModels})]}),(0,a.jsxs)("div",{className:"bg-bg-subtle rounded-lg px-3 py-2 text-center",children:[(0,a.jsx)("div",{className:"text-text-muted text-xs font-semibold",children:w("priced")}),(0,a.jsx)("div",{className:"text-lg font-bold text-success",children:L.pricedCount})]})]})]}),x&&(0,a.jsx)("div",{className:"px-3 py-2 rounded-lg bg-bg-subtle border border-border text-sm",children:x}),(0,a.jsxs)("div",{className:"flex gap-3 items-center flex-wrap",children:[(0,a.jsxs)("div",{className:"relative flex-1 min-w-[200px]",children:[(0,a.jsx)("span",{className:"material-symbols-outlined absolute left-3 top-1/2 -translate-y-1/2 text-text-muted text-lg",children:"search"}),(0,a.jsx)("input",{type:"text",placeholder:w("searchProvidersModels"),value:j,onChange:e=>y(e.target.value),className:"w-full pl-10 pr-3 py-2 bg-bg-base border border-border rounded-lg focus:outline-none focus:border-primary text-sm"})]}),h&&(0,a.jsxs)("button",{onClick:()=>g(null),className:"px-3 py-2 text-xs bg-primary/10 text-primary border border-primary/20 rounded-lg hover:bg-primary/20 transition-colors flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"}),h.toUpperCase()," — ",w("showAll")]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:k.map(e=>(0,a.jsxs)("button",{onClick:()=>_(e.alias),className:`px-2.5 py-1 rounded-md text-xs font-medium transition-all ${h===e.alias?"bg-primary text-white shadow-sm":v.has(e.alias)?"bg-yellow-500/15 text-yellow-400 border border-yellow-500/30":"bg-bg-subtle text-text-muted hover:bg-bg-hover border border-transparent"}`,children:[e.alias.toUpperCase()," ",(0,a.jsxs)("span",{className:"opacity-60",children:["(",e.modelCount,")"]})]},e.alias))}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[O.map(e=>(0,a.jsx)(u,{provider:e,pricingData:s[e.alias]||{},isExpanded:b.has(e.alias),isEdited:v.has(e.alias),onToggle:()=>U(e.alias),onPricingChange:(t,s,a)=>T(e.alias,t,s,a),onSave:()=>$(e.alias),onReset:()=>P(e.alias),saving:c},e.alias)),0===O.length&&(0,a.jsx)("div",{className:"text-center py-12 text-text-muted",children:w("noProvidersMatch")})]}),(0,a.jsxs)(i.Zp,{className:"p-4 mt-2",children:[(0,a.jsxs)("h3",{className:"text-sm font-semibold mb-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm align-middle mr-1",children:"info"}),w("howPricingWorks")]}),(0,a.jsxs)("div",{className:"text-xs text-text-muted space-y-1",children:[(0,a.jsxs)("p",{children:[w("pricingDescInput")," • ",w("pricingDescOutput")," • ",w("pricingDescCached")," •"," ",w("pricingDescReasoning")," • ",w("pricingDescCacheWrite")]}),(0,a.jsx)("p",{children:w("pricingDescFormula")})]})]})]})}function u({provider:e,pricingData:t,isExpanded:s,isEdited:l,onToggle:i,onPricingChange:d,onSave:n,onReset:o,saving:x}){let u=(0,r.c)("settings"),h=Object.keys(t).length,g="oauth"===e.authType?"OAuth":"apikey"===e.authType?"API Key":e.authType;return(0,a.jsxs)("div",{className:`border rounded-lg overflow-hidden transition-colors ${l?"border-yellow-500/40 bg-yellow-500/5":"border-border"}`,children:[(0,a.jsxs)("button",{onClick:i,className:"w-full flex items-center justify-between px-4 py-3 hover:bg-bg-hover/50 transition-colors text-left",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-lg transition-transform ${s?"rotate-90":""}`,children:"chevron_right"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"font-semibold text-sm",children:e.id.charAt(0).toUpperCase()+e.id.slice(1)}),(0,a.jsxs)("span",{className:"text-text-muted text-xs ml-2",children:["(",e.alias.toUpperCase(),")"]})]}),(0,a.jsx)("span",{className:"px-1.5 py-0.5 bg-bg-subtle text-text-muted text-[10px] rounded uppercase font-semibold",children:g}),(0,a.jsx)("span",{className:"px-1.5 py-0.5 bg-bg-subtle text-text-muted text-[10px] rounded uppercase font-semibold",children:e.format})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[l&&(0,a.jsx)("span",{className:"text-yellow-500 text-xs font-medium",children:u("unsaved")}),(0,a.jsxs)("span",{className:"text-text-muted text-xs",children:[h,"/",e.modelCount," priced"]}),(0,a.jsx)("div",{className:"w-16 h-1.5 bg-bg-subtle rounded-full overflow-hidden",children:(0,a.jsx)("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${e.modelCount>0?Math.round(h/e.modelCount*100):0}%`}})})]})]}),s&&(0,a.jsxs)("div",{className:"border-t border-border",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 bg-bg-subtle/50",children:[(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:[e.modelCount," models • ",h," with pricing configured"]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{onClick:e=>{e.stopPropagation(),o()},className:"px-2.5 py-1 text-[11px] text-red-400 hover:bg-red-500/10 rounded border border-red-500/20 transition-colors",children:u("resetDefaults")}),(0,a.jsx)("button",{onClick:e=>{e.stopPropagation(),n()},disabled:x||!l,className:"px-2.5 py-1 text-[11px] bg-primary text-white rounded hover:bg-primary/90 transition-colors disabled:opacity-40",children:u(x?"saving":"saveProvider")})]})]}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{className:"text-[11px] text-text-muted uppercase bg-bg-subtle/30",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-4 py-2 text-left font-semibold",children:u("model")}),c.map(e=>(0,a.jsx)("th",{className:"px-2 py-2 text-right font-semibold w-24",children:m[e]},e))]})}),(0,a.jsx)("tbody",{className:"divide-y divide-border/50",children:e.models.map(e=>(0,a.jsx)(p,{model:e,pricing:t[e.id],onPricingChange:(t,s)=>d(e.id,t,s)},e.id))})]})})]})]})}function p({model:e,pricing:t,onPricingChange:s}){let l=t&&Object.values(t).some(e=>e>0);return(0,a.jsxs)("tr",{className:"hover:bg-bg-hover/30 group",children:[(0,a.jsx)("td",{className:"px-4 py-1.5",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${l?"bg-success":"bg-text-muted/30"}`}),(0,a.jsx)("span",{className:"font-medium text-xs",children:e.name}),e.custom&&(0,a.jsx)("span",{className:"px-1 py-0.5 text-[8px] font-bold bg-blue-500/15 text-blue-400 border border-blue-500/20 rounded uppercase",children:"custom"}),(0,a.jsx)("span",{className:"text-text-muted text-[10px] opacity-0 group-hover:opacity-100 transition-opacity",children:e.id})]})}),c.map(e=>(0,a.jsx)("td",{className:"px-2 py-1.5",children:(0,a.jsx)("input",{type:"number",step:"0.01",min:"0",value:t?.[e]||0,onChange:t=>s(e,t.target.value),className:"w-full px-2 py-1 text-right text-xs bg-transparent border border-transparent hover:border-border focus:border-primary focus:bg-bg-base rounded transition-colors outline-none tabular-nums"})},e))]})}function h(){let[e,t]=(0,l.useState)("budget"),s=(0,r.c)("costs"),d=(0,r.c)("settings");return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(i.Iz,{options:[{value:"budget",label:s("budget")},{value:"pricing",label:d("pricing")}],value:e,onChange:t}),"budget"===e&&(0,a.jsx)(o,{}),"pricing"===e&&(0,a.jsx)(x,{})]})}}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=14031)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1066],{39387:(e,t,s)=>{Promise.resolve().then(s.bind(s,73732))},73732:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>j});var a=s(95155),l=s(12115),r=s(40993),n=s(50910),i=s(5772),c=s(35144);function o(e){let t="string"==typeof e?e.trim():"";if(!t)return{key:"unknown",label:"Unknown",variant:"default",rank:0,raw:null};let s=t.toUpperCase();return s.includes("ENTERPRISE")||s.includes("CORP")||s.includes("ORG")?{key:"enterprise",label:"Enterprise",variant:"info",rank:7,raw:t}:s.includes("TEAM")||s.includes("CHATGPTTEAM")?{key:"team",label:"Team",variant:"info",rank:6,raw:t}:s.includes("BUSINESS")||s.includes("STANDARD")||s.includes("BIZ")?{key:"business",label:"Business",variant:"warning",rank:5,raw:t}:s.includes("ULTRA")?{key:"ultra",label:"Ultra",variant:"success",rank:4,raw:t}:s.includes("PRO")||s.includes("PREMIUM")?{key:"pro",label:"Pro",variant:"primary",rank:3,raw:t}:s.includes("PLUS")||s.includes("PAID")?{key:"plus",label:"Plus",variant:"secondary",rank:2,raw:t}:s.includes("FREE")||s.includes("INDIVIDUAL")||s.includes("BASIC")||s.includes("TRIAL")||s.includes("LEGACY")?{key:"free",label:"Free",variant:"default",rank:1,raw:t}:{key:"unknown",label:t.toLowerCase().split(/[\s_-]+/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")||"Unknown",variant:"default",rank:0,raw:t}}var d=s(81060),x=s(80927),u=s(92542),m=s(20909);let p={antigravity:{label:"Antigravity",color:"#F59E0B"},github:{label:"GitHub Copilot",color:"#333"},kiro:{label:"Kiro AI",color:"#FF6B35"},codex:{label:"OpenAI Codex",color:"#10A37F"},claude:{label:"Claude Code",color:"#D97757"}},h=[{key:"all",label:"All"},{key:"enterprise",label:"Enterprise"},{key:"team",label:"Team"},{key:"business",label:"Business"},{key:"ultra",label:"Ultra"},{key:"pro",label:"Pro"},{key:"plus",label:"Plus"},{key:"free",label:"Free"},{key:"unknown",label:"Unknown"}];function f(){let e=(0,n.c)("usage"),[t,s]=(0,l.useState)([]),[r,f]=(0,l.useState)({}),[b,g]=(0,l.useState)({}),[j,y]=(0,l.useState)({}),[v,N]=(0,l.useState)(!0),[k,w]=(0,l.useState)(null),[A,E]=(0,l.useState)(!1),[C,I]=(0,l.useState)(120),[S,q]=(0,l.useState)(!0),[M,P]=(0,l.useState)("all"),T=(0,l.useRef)(null),$=(0,l.useRef)(null),_=(0,l.useRef)({}),R=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/providers/client");if(!e.ok)throw Error("Failed");let t=(await e.json()).connections||[];return s(t),t}catch{return s([]),[]}},[]),L=(0,l.useCallback)(async(e,t)=>{let s=Date.now();if(!(s-(_.current[e]||0)<3e4)){_.current[e]=s,g(t=>({...t,[e]:!0})),y(t=>({...t,[e]:null}));try{let s=await fetch(`/api/usage/${e}`);if(!s.ok){let t=(await s.json().catch(()=>({}))).error||s.statusText;if(404===s.status)return;if(401===s.status)return void f(s=>({...s,[e]:{quotas:[],message:t}}));throw Error(`HTTP ${s.status}: ${t}`)}let a=await s.json(),l=function(e,t){if(!t||"object"!=typeof t)return[];let s=[];try{switch(e.toLowerCase()){case"github":default:t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"antigravity":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"codex":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"kiro":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"claude":t.message?s.push({name:"error",used:0,total:0,resetAt:null,message:t.message}):t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})})}}catch(t){return console.error(`Error parsing quota data for ${e}:`,t),[]}let a=(0,c.KC)(e);if(a.length>0){let e=new Map(a.map((e,t)=>[e.id,t]));s.sort((t,s)=>{let a=t.modelKey||t.name,l=s.modelKey||s.name;return(e.get(a)??999)-(e.get(l)??999)})}return s}(t,a);f(t=>({...t,[e]:{quotas:l,plan:a.plan||null,message:a.message||null,raw:a}}))}catch(t){y(s=>({...s,[e]:t.message||"Failed to fetch quota"}))}finally{g(t=>({...t,[e]:!1}))}}},[]),O=(0,l.useCallback)(async(e,t)=>{await L(e,t),w(new Date)},[L]),D=(0,l.useCallback)(async()=>{if(!A){E(!0),I(120);try{let e=(await R()).filter(e=>m.wb.includes(e.provider)&&"oauth"===e.authType);await Promise.all(e.map(e=>L(e.id,e.provider))),w(new Date)}catch(e){console.error("Error refreshing all:",e)}finally{E(!1)}}},[A,R,L]);(0,l.useEffect)(()=>{(async()=>{q(!0),await D(),q(!1)})()},[]),(0,l.useEffect)(()=>{if(!v){T.current&&clearInterval(T.current),$.current&&clearInterval($.current);return}return T.current=setInterval(D,12e4),$.current=setInterval(()=>{I(e=>e<=1?120:e-1)},1e3),()=>{T.current&&clearInterval(T.current),$.current&&clearInterval($.current)}},[v,D]),(0,l.useEffect)(()=>{let e=()=>{document.hidden?(T.current&&clearInterval(T.current),$.current&&clearInterval($.current)):v&&(T.current=setInterval(D,12e4),$.current=setInterval(()=>{I(e=>e<=1?120:e-1)},1e3))};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[v,D]);let U=(0,l.useMemo)(()=>t.filter(e=>m.wb.includes(e.provider)&&"oauth"===e.authType),[t]),F=(0,l.useMemo)(()=>{let e={antigravity:1,github:2,codex:3,claude:4,kiro:5};return[...U].sort((t,s)=>(e[t.provider]||9)-(e[s.provider]||9))},[U]),B=(0,l.useMemo)(()=>{let e={};for(let t of F)e[t.id]=o(r[t.id]?.plan);return e},[F,r]),G=(0,l.useMemo)(()=>{let e={all:F.length,enterprise:0,team:0,business:0,ultra:0,pro:0,free:0,unknown:0};for(let t of F){let s=B[t.id]?.key||"unknown";e[s]=(e[s]||0)+1}return e},[F,B]),K=(0,l.useMemo)(()=>"all"===M?F:F.filter(e=>(B[e.id]?.key||"unknown")===M),[F,B,M]);return S?(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(u.CardSkeleton,{}),(0,a.jsx)(u.CardSkeleton,{})]}):0===F.length?(0,a.jsx)(d.default,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[64px] opacity-15",children:"cloud_off"}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-main",children:e("noProviders")}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-[400px] mx-auto",children:"Connect to providers with OAuth to track your API quota limits and usage."})]})}):(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-text-main m-0",children:e("providerLimits")}),(0,a.jsxs)("span",{className:"text-[13px] text-text-muted",children:[K.length," account",1!==K.length?"s":"",K.length!==F.length?` (filtered from ${F.length})`:""]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("button",{onClick:()=>N(e=>!e),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-white/[0.08] bg-transparent cursor-pointer text-text-main text-[13px]",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",style:{color:v?"#22c55e":"var(--text-muted)"},children:v?"toggle_on":"toggle_off"}),"Auto-refresh",v&&(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["(",C,"s)"]})]}),(0,a.jsxs)("button",{onClick:D,disabled:A,className:"flex items-center gap-1.5 px-3.5 py-1.5 rounded-lg bg-white/[0.06] border border-white/10 text-text-main text-[13px] disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] ${A?"animate-spin":""}`,children:"refresh"}),"Refresh All"]})]})]}),(0,a.jsx)("div",{className:"flex items-center gap-2 flex-wrap",children:h.map(e=>{if("all"!==e.key&&!G[e.key])return null;let t=M===e.key;return(0,a.jsxs)("button",{onClick:()=>P(e.key),className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-semibold cursor-pointer",style:{border:t?"1px solid var(--primary, #E54D5E)":"1px solid rgba(255,255,255,0.12)",background:t?"rgba(249,120,21,0.14)":"transparent",color:t?"var(--primary, #E54D5E)":"var(--text-muted)"},children:[(0,a.jsx)("span",{children:e.label}),(0,a.jsx)("span",{className:"opacity-85",children:G[e.key]||0})]},e.key)})}),(0,a.jsxs)("div",{className:"rounded-xl border border-white/[0.06] overflow-hidden bg-black/15",children:[(0,a.jsxs)("div",{className:"items-center px-4 py-2.5 border-b border-white/[0.06] text-[11px] font-semibold uppercase tracking-wider text-text-muted",style:{display:"grid",gridTemplateColumns:"280px 1fr 100px 48px"},children:[(0,a.jsx)("div",{children:e("account")}),(0,a.jsx)("div",{children:e("modelQuotas")}),(0,a.jsx)("div",{className:"text-center",children:e("lastUsed")}),(0,a.jsx)("div",{className:"text-center",children:e("actions")})]}),K.map((t,s)=>{let l=r[t.id],n=b[t.id],c=j[t.id],d=p[t.provider]||{label:t.provider,color:"#666"},u=B[t.id]||o(null);return(0,a.jsxs)("div",{className:"items-center px-4 py-3.5 transition-[background] duration-150 hover:bg-white/[0.02]",style:{display:"grid",gridTemplateColumns:"280px 1fr 100px 48px",borderBottom:s<K.length-1?"1px solid rgba(255,255,255,0.04)":"none"},children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center overflow-hidden shrink-0",children:(0,a.jsx)(i.default,{src:`/providers/${t.provider}.png`,alt:t.provider,width:32,height:32,className:"object-contain",sizes:"32px"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("div",{className:"text-[13px] font-semibold text-text-main truncate",children:t.name||d.label}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mt-0.5",children:[(0,a.jsx)("span",{title:l?.plan?`Raw plan: ${l.plan}`:"No plan from provider",children:(0,a.jsx)(x.default,{variant:u.variant,size:"sm",dot:!0,children:u.label})}),(0,a.jsx)("span",{className:"text-[11px] text-text-muted",children:d.label})]})]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-x-3 gap-y-1.5 pr-3",children:n?(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-text-muted text-xs",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[14px]",children:"progress_activity"}),"Loading..."]}):c?(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-red-500",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,a.jsx)("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap max-w-[300px]",children:c})]}):l?.message&&(!l.quotas||0===l.quotas.length)?(0,a.jsx)("div",{className:"text-xs text-text-muted italic",children:l.message}):l?.quotas?.length>0?l.quotas.map((e,t)=>{var s,l,r;let n=void 0!==e.remainingPercentage?Math.round(e.remainingPercentage):(s=e.used,(l=e.total)&&0!==l?!s||s<0?100:s>=l?0:Math.round((l-s)/l*100):0),i=n>70?{bar:"#22c55e",text:"#22c55e",bg:"rgba(34,197,94,0.12)"}:n>=30?{bar:"#eab308",text:"#eab308",bg:"rgba(234,179,8,0.12)"}:{bar:"#ef4444",text:"#ef4444",bg:"rgba(239,68,68,0.12)"},c=function(e){if(!e)return null;try{let t=new Date(e)-new Date;if(t<=0)return null;let s=Math.floor(t/36e5),a=Math.floor(t%36e5/6e4);if(s>=24){let e=Math.floor(s/24);return`${e}d ${s%24}h`}return`${s}h ${a}m`}catch{return null}}(e.resetAt),o={"gemini-3-pro-high":"G3 Pro","gemini-3-pro-low":"G3 Pro Low","gemini-3-flash":"G3 Flash","gemini-2.5-flash":"G2.5 Flash","claude-opus-4-6-thinking":"Opus 4.6 Tk","claude-opus-4-5-thinking":"Opus 4.5 Tk","claude-opus-4-5":"Opus 4.5","claude-sonnet-4-5-thinking":"Sonnet 4.5 Tk","claude-sonnet-4-5":"Sonnet 4.5",chat:"Chat",completions:"Completions",premium_interactions:"Premium",session:"Session",weekly:"Weekly",agentic_request:"Agentic",agentic_request_freetrial:"Agentic (Trial)"}[r=e.name]||r;return(0,a.jsxs)("div",{className:"flex items-center gap-1.5 min-w-[200px] shrink-0",children:[(0,a.jsx)("span",{className:"text-[11px] font-semibold py-0.5 px-2 rounded whitespace-nowrap min-w-[60px] text-center",style:{background:i.bg,color:i.text},children:o}),c&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted whitespace-nowrap",children:["⏱ ",c]}),(0,a.jsx)("div",{className:"flex-1 h-1.5 rounded-sm bg-white/[0.06] min-w-[60px] overflow-hidden",children:(0,a.jsx)("div",{className:"h-full rounded-sm transition-[width] duration-300 ease-out",style:{width:`${Math.min(n,100)}%`,background:i.bar}})}),(0,a.jsxs)("span",{className:"text-[11px] font-semibold min-w-[32px] text-right",style:{color:i.text},children:[n,"%"]})]},t)}):(0,a.jsx)("div",{className:"text-xs text-text-muted italic",children:e("noQuotaData")})}),(0,a.jsx)("div",{className:"text-center text-[11px] text-text-muted",children:k?(0,a.jsx)("span",{children:k.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}):"-"}),(0,a.jsx)("div",{className:"flex justify-center gap-0.5",children:(0,a.jsx)("button",{onClick:()=>O(t.id,t.provider),disabled:n,title:"Refresh quota",className:"p-1 rounded-md border-none bg-transparent cursor-pointer disabled:cursor-not-allowed disabled:opacity-30 opacity-60 hover:opacity-100 flex items-center justify-center transition-opacity duration-150",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] text-text-muted ${n?"animate-spin":""}`,children:"refresh"})})})]},t.id)}),0===K.length&&(0,a.jsxs)("div",{className:"py-6 px-4 text-center text-text-muted text-[13px]",children:["No accounts found for tier filter"," ",(0,a.jsx)("strong",{children:h.find(e=>e.key===M)?.label||M}),"."]})]})]})}function b(){let e=(0,n.c)("usage"),[t,s]=(0,l.useState)({lockouts:[],cacheStats:null}),[i,c]=(0,l.useState)(!0),o=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/rate-limits");e.ok&&s(await e.json())}catch{}finally{c(!1)}},[]);return(0,l.useEffect)(()=>{o();let e=setInterval(o,1e4);return()=>clearInterval(e)},[o]),(0,a.jsx)("div",{className:"flex flex-col gap-4",children:(0,a.jsxs)(r.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-orange-500/10 text-orange-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"lock_clock"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Model Lockouts"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Per-model rate limit locks • Auto-refresh 10s"})]}),t.lockouts.length>0&&(0,a.jsxs)("span",{className:"px-2.5 py-1 rounded-full text-xs font-semibold bg-orange-500/10 text-orange-400 border border-orange-500/20",children:[t.lockouts.length," locked"]})]}),0===t.lockouts.length?(0,a.jsxs)("div",{className:"text-center py-6 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[32px] mb-2 block opacity-40",children:"lock_open"}),(0,a.jsx)("p",{className:"text-sm",children:e("noLockouts")})]}):(0,a.jsx)("div",{className:"flex flex-col gap-2",children:t.lockouts.map((e,t)=>{var s;return(0,a.jsxs)("div",{className:"flex items-center justify-between px-3 py-2.5 rounded-lg bg-orange-500/5 border border-orange-500/15",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-orange-400",children:"lock"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:e.model}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Account:"," ",(0,a.jsx)("span",{className:"font-mono",children:e.accountId?.slice(0,12)||"N/A"}),e.reason&&(0,a.jsxs)(a.Fragment,{children:[" — ",e.reason]})]})]})]}),(0,a.jsxs)("span",{className:"text-xs font-mono tabular-nums text-orange-400",children:[(s=e.remainingMs)<1e3?`${s}ms`:s<6e4?`${Math.ceil(s/1e3)}s`:`${Math.ceil(s/6e4)}m`," left"]})]},t)})})]})})}function g(){let e=(0,n.c)("usage"),[t,s]=(0,l.useState)({count:0,sessions:[]}),[i,c]=(0,l.useState)(!0),o=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/sessions");e.ok&&s(await e.json())}catch{}finally{c(!1)}},[]);return(0,l.useEffect)(()=>{o();let e=setInterval(o,5e3);return()=>clearInterval(e)},[o]),(0,a.jsxs)(r.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-cyan-500/10 text-cyan-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"fingerprint"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:e("activeSessions")}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Tracked via request fingerprinting • Auto-refresh 5s"})]}),(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsxs)("span",{className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-cyan-500/10 border border-cyan-500/20",children:[(0,a.jsx)("span",{className:"w-2 h-2 rounded-full bg-cyan-500 animate-pulse"}),(0,a.jsx)("span",{className:"text-sm font-semibold tabular-nums text-cyan-400",children:t.count})]})})]}),0===t.sessions.length?(0,a.jsxs)("div",{className:"text-center py-8 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[40px] mb-2 block opacity-40",children:"fingerprint"}),(0,a.jsx)("p",{className:"text-sm",children:e("noSessions")}),(0,a.jsx)("p",{className:"text-xs mt-1",children:e("sessionsHint")})]}):(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-border/30",children:[(0,a.jsx)("th",{className:"text-left py-2 px-3 text-xs font-semibold text-text-muted uppercase tracking-wider",children:e("session")}),(0,a.jsx)("th",{className:"text-left py-2 px-3 text-xs font-semibold text-text-muted uppercase tracking-wider",children:e("age")}),(0,a.jsx)("th",{className:"text-right py-2 px-3 text-xs font-semibold text-text-muted uppercase tracking-wider",children:e("requests")}),(0,a.jsx)("th",{className:"text-left py-2 px-3 text-xs font-semibold text-text-muted uppercase tracking-wider",children:e("connection")})]})}),(0,a.jsx)("tbody",{children:t.sessions.map(e=>{var t;return(0,a.jsxs)("tr",{className:"border-b border-border/10 hover:bg-surface/20 transition-colors",children:[(0,a.jsx)("td",{className:"py-2.5 px-3",children:(0,a.jsxs)("span",{className:"font-mono text-xs px-2 py-1 rounded bg-surface/40 text-text-muted",children:[e.sessionId.slice(0,12),"…"]})}),(0,a.jsx)("td",{className:"py-2.5 px-3 text-text-muted tabular-nums",children:(t=e.ageMs)<6e4?`${Math.floor(t/1e3)}s`:t<36e5?`${Math.floor(t/6e4)}m`:`${Math.floor(t/36e5)}h`}),(0,a.jsx)("td",{className:"py-2.5 px-3 text-right",children:(0,a.jsx)("span",{className:"font-semibold tabular-nums",children:e.requestCount})}),(0,a.jsx)("td",{className:"py-2.5 px-3",children:e.connectionId?(0,a.jsx)("span",{className:"text-xs font-mono text-cyan-400",children:e.connectionId.slice(0,10)}):(0,a.jsx)("span",{className:"text-text-muted/40",children:"—"})})]},e.sessionId)})})]})})]})}function j(){return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(r.Qv,{}),children:(0,a.jsx)(f,{})}),(0,a.jsx)(b,{}),(0,a.jsx)(g,{})]})}}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=39387)),_N_E=e.O()}]);
@@ -0,0 +1,4 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3528],{2824:(e,t,s)=>{"use strict";s.d(t,{default:()=>k});var a=s(95155),r=s(50910),n=s(12115),l=s(40993);let i=[{id:"simple-chat",name:"Simple Chat",icon:"chat",description:"Basic text message",formats:{openai:{model:"gpt-4o",messages:[{role:"system",content:"You are a helpful assistant."},{role:"user",content:"Hello! How are you today?"}],stream:!0},claude:{model:"claude-sonnet-4-20250514",system:"You are a helpful assistant.",max_tokens:1024,messages:[{role:"user",content:"Hello! How are you today?"}],stream:!0},gemini:{model:"gemini-2.5-flash",contents:[{role:"user",parts:[{text:"Hello! How are you today?"}]}],systemInstruction:{parts:[{text:"You are a helpful assistant."}]}},"openai-responses":{model:"gpt-4o",input:"Hello! How are you today?",instructions:"You are a helpful assistant."}}},{id:"tool-calling",name:"Tool Calling",icon:"build",description:"Function/tool invocation",formats:{openai:{model:"gpt-4o",messages:[{role:"user",content:"What's the weather in S\xe3o Paulo?"}],tools:[{type:"function",function:{name:"get_weather",description:"Get current weather for a location",parameters:{type:"object",properties:{location:{type:"string",description:"City name"},unit:{type:"string",enum:["celsius","fahrenheit"]}},required:["location"]}}}],stream:!0},claude:{model:"claude-sonnet-4-20250514",max_tokens:1024,messages:[{role:"user",content:"What's the weather in S\xe3o Paulo?"}],tools:[{name:"get_weather",description:"Get current weather for a location",input_schema:{type:"object",properties:{location:{type:"string",description:"City name"},unit:{type:"string",enum:["celsius","fahrenheit"]}},required:["location"]}}],stream:!0},gemini:{model:"gemini-2.5-flash",contents:[{role:"user",parts:[{text:"What's the weather in S\xe3o Paulo?"}]}],tools:[{functionDeclarations:[{name:"get_weather",description:"Get current weather for a location",parameters:{type:"object",properties:{location:{type:"string",description:"City name"},unit:{type:"string",enum:["celsius","fahrenheit"]}},required:["location"]}}]}]}}},{id:"multi-turn",name:"Multi-turn",icon:"forum",description:"Conversation with history",formats:{openai:{model:"gpt-4o",messages:[{role:"system",content:"You are a coding assistant."},{role:"user",content:"Write a function to sort an array in Python."},{role:"assistant",content:"Here's a simple sort function:\n\n```python\ndef sort_array(arr):\n return sorted(arr)\n```"},{role:"user",content:"Now make it sort in descending order."}],stream:!0},claude:{model:"claude-sonnet-4-20250514",system:"You are a coding assistant.",max_tokens:1024,messages:[{role:"user",content:"Write a function to sort an array in Python."},{role:"assistant",content:"Here's a simple sort function:\n\n```python\ndef sort_array(arr):\n return sorted(arr)\n```"},{role:"user",content:"Now make it sort in descending order."}],stream:!0},gemini:{model:"gemini-2.5-flash",contents:[{role:"user",parts:[{text:"Write a function to sort an array in Python."}]},{role:"model",parts:[{text:"Here's a simple sort function:\n\n```python\ndef sort_array(arr):\n return sorted(arr)\n```"}]},{role:"user",parts:[{text:"Now make it sort in descending order."}]}],systemInstruction:{parts:[{text:"You are a coding assistant."}]}}}},{id:"thinking",name:"Thinking",icon:"psychology",description:"Extended thinking / reasoning",formats:{openai:{model:"o3-mini",messages:[{role:"user",content:"What is the sum of the first 100 prime numbers?"}],stream:!0},claude:{model:"claude-sonnet-4-20250514",max_tokens:16e3,thinking:{type:"enabled",budget_tokens:1e4},messages:[{role:"user",content:"What is the sum of the first 100 prime numbers?"}],stream:!0},gemini:{model:"gemini-2.5-flash-thinking",contents:[{role:"user",parts:[{text:"What is the sum of the first 100 prime numbers?"}]}],generationConfig:{thinkingConfig:{thinkingBudget:1e4}}}}},{id:"system-prompt",name:"System Prompt",icon:"settings",description:"Complex system instructions",formats:{openai:{model:"gpt-4o",messages:[{role:"system",content:"You are a senior software engineer specializing in distributed systems. Answer questions concisely using industry best practices. Always provide code examples when relevant. Format your responses using markdown."},{role:"user",content:"How do I implement a circuit breaker pattern?"}],temperature:.7,stream:!0},claude:{model:"claude-sonnet-4-20250514",system:"You are a senior software engineer specializing in distributed systems. Answer questions concisely using industry best practices. Always provide code examples when relevant. Format your responses using markdown.",max_tokens:2048,messages:[{role:"user",content:"How do I implement a circuit breaker pattern?"}],temperature:.7,stream:!0},gemini:{model:"gemini-2.5-flash",contents:[{role:"user",parts:[{text:"How do I implement a circuit breaker pattern?"}]}],systemInstruction:{parts:[{text:"You are a senior software engineer specializing in distributed systems. Answer questions concisely using industry best practices. Always provide code examples when relevant. Format your responses using markdown."}]},generationConfig:{temperature:.7}}}},{id:"streaming",name:"Streaming",icon:"stream",description:"SSE streaming request",formats:{openai:{model:"gpt-4o",messages:[{role:"user",content:"Tell me a short story about a robot learning to paint."}],stream:!0,stream_options:{include_usage:!0}},claude:{model:"claude-sonnet-4-20250514",max_tokens:1024,messages:[{role:"user",content:"Tell me a short story about a robot learning to paint."}],stream:!0},gemini:{model:"gemini-2.5-flash",contents:[{role:"user",parts:[{text:"Tell me a short story about a robot learning to paint."}]}]}}}],o={openai:{label:"OpenAI",color:"emerald",icon:"smart_toy"},"openai-responses":{label:"OpenAI Responses",color:"amber",icon:"swap_horiz"},claude:{label:"Claude",color:"orange",icon:"psychology"},gemini:{label:"Gemini",color:"blue",icon:"auto_awesome"},antigravity:{label:"Antigravity",color:"purple",icon:"rocket_launch"},kiro:{label:"Kiro",color:"cyan",icon:"terminal"},cursor:{label:"Cursor",color:"pink",icon:"edit"},codex:{label:"Codex",color:"yellow",icon:"code"}},c=Object.entries(o).map(([e,t])=>({value:e,label:t.label}));var d=s(75707),m=s.n(d);let u=m()(()=>s.e(8202).then(s.bind(s,28202)),{loadableGenerated:{webpack:()=>[28202]},ssr:!1});function x(){let e=(0,r.c)("translator"),t=(0,r.c)("common"),[s,d]=(0,n.useState)("claude"),[m,x]=(0,n.useState)("openai"),[p,h]=(0,n.useState)(""),[g,f]=(0,n.useState)(""),[b,y]=(0,n.useState)(null),[j,v]=(0,n.useState)(!1),[N,w]=(0,n.useState)(!1),[k,S]=(0,n.useState)(null),_=(0,n.useCallback)(async e=>{if(!e||e.trim().length<5)return void y(null);try{let t=JSON.parse(e);w(!0);let s=await fetch("/api/translator/detect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:t})}),a=await s.json();a.success&&(y(a.format),d(a.format))}catch{}finally{w(!1)}},[]);(0,n.useEffect)(()=>{let e=setTimeout(()=>{_(p)},600);return()=>clearTimeout(e)},[p,_]);let C=async()=>{if(p.trim()){v(!0),f("");try{let e=JSON.parse(p),t=await fetch("/api/translator/translate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step:"direct",sourceFormat:s,targetFormat:m,body:e})}),a=await t.json();a.success?f(JSON.stringify(a.result,null,2)):f(JSON.stringify({error:a.error},null,2))}catch(e){f(JSON.stringify({error:e.message},null,2))}v(!1)}},O=async e=>{try{await navigator.clipboard.writeText(e)}catch{}},T=o[s]||o.openai,P=o[m]||o.openai;return(0,a.jsxs)("div",{className:"space-y-5",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 rounded-lg bg-primary/5 border border-primary/10 text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px] mt-0.5 shrink-0",children:"info"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-text-main mb-0.5",children:e("formatConverter")}),(0,a.jsx)("p",{children:e("formatConverterDescription")})]})]}),(0,a.jsx)(l.Zp,{children:(0,a.jsxs)("div",{className:"p-4 flex flex-col sm:flex-row items-center gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 w-full",children:[(0,a.jsx)("label",{className:"block text-xs font-medium text-text-muted mb-1.5 uppercase tracking-wider",children:e("source")}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[20px] text-${T.color}-500`,children:T.icon}),(0,a.jsx)(l.l6,{value:s,onChange:e=>{d(e.target.value),y(null)},options:c,className:"flex-1"}),b&&(0,a.jsx)(l.Ex,{variant:"primary",size:"sm",icon:"auto_awesome",children:e("auto")})]})]}),(0,a.jsx)("button",{onClick:()=>{d(m),x(s),h(g),f(""),y(null)},className:"p-2 rounded-full hover:bg-primary/10 text-text-muted hover:text-primary transition-all mt-4 sm:mt-5",title:e("swapFormats"),children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[24px]",children:"swap_horiz"})}),(0,a.jsxs)("div",{className:"flex-1 w-full",children:[(0,a.jsx)("label",{className:"block text-xs font-medium text-text-muted mb-1.5 uppercase tracking-wider",children:e("target")}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[20px] text-${P.color}-500`,children:P.icon}),(0,a.jsx)(l.l6,{value:m,onChange:e=>x(e.target.value),options:c,className:"flex-1"})]})]}),(0,a.jsx)("div",{className:"pt-0 sm:pt-5",children:(0,a.jsx)(l.$n,{icon:"arrow_forward",onClick:C,loading:j,disabled:!p.trim()||j,className:"whitespace-nowrap",children:e("translateAction")})})]})}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,a.jsx)(l.Zp,{children:(0,a.jsxs)("div",{className:"p-4 space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:"input"}),(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:e("input")}),b&&(0,a.jsx)(l.Ex,{variant:"info",size:"sm",dot:!0,children:o[b]?.label||b}),N&&(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted animate-spin",children:"progress_activity"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("button",{onClick:()=>O(p),className:"p-1.5 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-text-main transition-colors",title:t("copy"),children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"content_copy"})}),(0,a.jsx)("button",{onClick:()=>{h(""),f(""),y(null),S(null)},className:"p-1.5 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-text-main transition-colors",title:e("clear"),children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"delete"})})]})]}),(0,a.jsx)("div",{className:"border border-border rounded-lg overflow-hidden",children:(0,a.jsx)(u,{height:"400px",defaultLanguage:"json",value:p,onChange:e=>h(e||""),theme:"vs-dark",options:{minimap:{enabled:!1},fontSize:12,lineNumbers:"on",scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,formatOnPaste:!0,placeholder:e("inputPlaceholder")}})})]})}),(0,a.jsx)(l.Zp,{children:(0,a.jsxs)("div",{className:"p-4 space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:"output"}),(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:e("output")}),g&&(0,a.jsx)(l.Ex,{variant:"success",size:"sm",dot:!0,children:o[m]?.label||m})]}),(0,a.jsx)("div",{className:"flex items-center gap-1",children:(0,a.jsx)("button",{onClick:()=>O(g),className:"p-1.5 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-text-main transition-colors",title:t("copy"),children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"content_copy"})})})]}),(0,a.jsx)("div",{className:"border border-border rounded-lg overflow-hidden",children:(0,a.jsx)(u,{height:"400px",defaultLanguage:"json",value:g,theme:"vs-dark",options:{minimap:{enabled:!1},fontSize:12,lineNumbers:"on",scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,readOnly:!0}})})]})})]}),(0,a.jsx)(l.Zp,{children:(0,a.jsxs)("div",{className:"p-4 space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary",children:"library_books"}),(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:e("exampleTemplates")}),(0,a.jsx)("span",{className:"text-xs text-text-muted",children:e("exampleTemplatesHint")})]}),(0,a.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-6 gap-2",children:i.map(e=>(0,a.jsxs)("button",{onClick:()=>{h(JSON.stringify(e.formats[s]||e.formats.openai,null,2)),S(e.id),f("")},className:`
2
+ group flex flex-col items-center gap-1.5 p-3 rounded-lg border transition-all text-center
3
+ ${k===e.id?"border-primary bg-primary/5 text-primary":"border-border hover:border-primary/30 hover:bg-primary/5 text-text-muted hover:text-text-main"}
4
+ `,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[22px] ${k===e.id?"text-primary":"text-text-muted group-hover:text-primary"} transition-colors`,children:e.icon}),(0,a.jsx)("span",{className:"text-xs font-medium leading-tight",children:e.name})]},e.id))}),k&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"info"}),e("templateLoadHint",{format:o[s]?.label||s})]})]})})]})}var p=s(20909);function h(e="openai"){let[t,s]=(0,n.useState)(e),[a,r]=(0,n.useState)([]),[l,i]=(0,n.useState)(!0);return(0,n.useEffect)(()=>{(async()=>{try{let[e,t]=await Promise.all([fetch("/api/providers"),fetch("/api/provider-nodes")]),[a,n]=await Promise.all([e.json(),t.json()]),l=new Map((n.nodes||[]).map(e=>[e.id,e])),i=[...new Set((a.connections||[]).filter(e=>!1!==e.isActive).map(e=>e.provider))].map(e=>{let t=p.Q2[e],s=l.get(e),a=t?.name||s?.name||e;return!t&&e.startsWith(p.JH)&&(a=s?.name||"OpenAI Compatible"),!t&&e.startsWith(p.DI)&&(a=s?.name||"Anthropic Compatible"),{value:e,label:a}}).sort((e,t)=>e.label.localeCompare(t.label)),o=i.length>0?i:Object.entries(p.Q2).map(([e,t])=>({value:e,label:t.name}));r(o),o.length>0&&s(e=>o.some(t=>t.value===e)?e:o[0].value)}catch{let e=Object.entries(p.Q2).map(([e,t])=>({value:e,label:t.name}));r(e),e.length>0&&s(t=>e.some(e=>e.value===t)?t:e[0].value)}finally{i(!1)}})()},[]),{provider:t,setProvider:s,providerOptions:a,loading:l}}let g={openai:["gpt-","o1-","o3-","o4-"],"openai-responses":["gpt-","o1-","o3-","o4-"],claude:["claude-"],gemini:["gemini-"]};function f(){let[e,t]=(0,n.useState)(""),[s,a]=(0,n.useState)([]),[r,l]=(0,n.useState)(!0);(0,n.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/v1/models"),t=((await e.json()).data||[]).map(e=>e.id).sort((e,t)=>e.localeCompare(t));a(t)}catch{a([])}finally{l(!1)}})()},[]);let i=(0,n.useCallback)(e=>{if(0===s.length)return"";for(let t of g[e]||[]){let e=s.find(e=>e.startsWith(t));if(e)return e}return s[0]},[s]);return{model:e,setModel:t,availableModels:s,loading:r,pickModelForFormat:i}}let b=m()(()=>s.e(8202).then(s.bind(s,28202)),{loadableGenerated:{webpack:()=>[28202]},ssr:!1});function y(){let e=(0,r.c)("translator"),{provider:t,setProvider:s,providerOptions:i}=h("openai"),{model:d,setModel:m,availableModels:u,pickModelForFormat:x}=f(),[p,g]=(0,n.useState)("openai"),[y,j]=(0,n.useState)(""),[v,N]=(0,n.useState)(!1),[w,k]=(0,n.useState)([]),[S,_]=(0,n.useState)(null),[C,O]=(0,n.useState)(null),T=(0,n.useRef)(null);(0,n.useEffect)(()=>{let e=x(p);e&&m(e)},[p,x,m]);let P=()=>{T.current?.scrollIntoView({behavior:"smooth"})},D=async()=>{if(!y.trim()||v)return;let s=y.trim();j(""),N(!0),k(e=>[...e,{role:"user",content:s}]);let a=[];try{let r,n=[...w.map(e=>({role:e.role,content:e.content})),{role:"user",content:s}];r="claude"===p?{model:d,max_tokens:1024,messages:n,stream:!0}:"gemini"===p?{model:d,contents:n.map(e=>({role:"assistant"===e.role?"model":"user",parts:[{text:e.content}]}))}:"openai-responses"===p?{model:d,input:n.map(e=>({type:"message",role:e.role,content:[{type:"input_text",text:e.content}]})),stream:!0}:{model:d,messages:n,stream:!0},a.push({id:1,name:e("clientRequest"),description:e("clientRequestDescription"),format:p,content:JSON.stringify(r,null,2),status:"done"});let l=await fetch("/api/translator/detect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:r})}),i=(await l.json()).format||p;a.push({id:2,name:e("formatDetected"),description:e("formatDetectedDescription"),format:i,content:JSON.stringify({detectedFormat:i,clientFormat:p,match:i===p},null,2),status:"done"});let o=await fetch("/api/translator/translate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step:"direct",sourceFormat:i,targetFormat:"openai",body:r})}),c=await o.json();a.push({id:3,name:e("openaiIntermediate"),description:e("openaiIntermediateDescription"),format:"openai",content:JSON.stringify(c.result||c,null,2),status:c.success?"done":"error"});let m=await fetch("/api/translator/translate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step:"direct",sourceFormat:"openai",provider:t,body:c.result})}),u=await m.json(),x=u.targetFormat||"openai";a.push({id:4,name:e("providerFormat"),description:e("providerFormatDescription"),format:x,content:JSON.stringify(u.result||u,null,2),status:u.success?"done":"error"});let h=await fetch("/api/translator/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,body:u.result||c.result})});if(h.ok){let t=h.body.getReader(),s=new TextDecoder,r="";for(;;){let{done:e,value:a}=await t.read();if(e)break;r+=s.decode(a,{stream:!0})}a.push({id:5,name:e("providerResponse"),description:e("providerResponseSseDescription"),format:x,content:r.slice(0,5e3)+(r.length>5e3?"\n... (truncated)":""),status:"done"});let n=function(e){let t="";for(let s of e.split("\n")){if(!s.startsWith("data: "))continue;let e=s.slice(6).trim();if("[DONE]"===e)break;try{let s=JSON.parse(e),a=s.choices?.[0]?.delta;a?.content&&(t+=a.content),"content_block_delta"===s.type&&s.delta?.text&&(t+=s.delta.text)}catch{}}return t||e.slice(0,500)}(r);k(t=>[...t,{role:"assistant",content:n||e("noTextExtracted")}])}else{let t=await h.json().catch(()=>({error:e("requestFailed")}));a.push({id:5,name:e("providerResponse"),description:e("providerResponseRawDescription"),format:x,content:JSON.stringify(t,null,2),status:"error"}),k(s=>[...s,{role:"assistant",content:e("errorMessage",{message:t.error||e("requestFailed")})}])}}catch(t){a.push({id:a.length+1,name:e("error"),description:e("unexpectedError"),format:"error",content:JSON.stringify({error:t.message},null,2),status:"error"}),k(s=>[...s,{role:"assistant",content:e("errorMessage",{message:t.message})}])}_(a),O(a.length>0?a[a.length-1].id:null),N(!1),setTimeout(P,100)};return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 rounded-lg bg-primary/5 border border-primary/10 text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px] mt-0.5 shrink-0",children:"info"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-text-main mb-0.5",children:e("pipelineDebugger")}),(0,a.jsx)("p",{children:e("chatTesterDescription")}),(0,a.jsxs)("p",{children:[(0,a.jsx)("strong",{className:"text-text-main",children:e("chatTesterFlow")}),"."," ",e("clickStepToInspect")]})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(l.Zp,{children:(0,a.jsxs)("div",{className:"p-4 flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("label",{className:"block text-xs font-medium text-text-muted mb-1 uppercase tracking-wider",children:e("clientFormat")}),(0,a.jsx)(l.l6,{value:p,onChange:e=>g(e.target.value),options:c.filter(e=>["openai","claude","gemini","openai-responses"].includes(e.value))})]}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("label",{className:"block text-xs font-medium text-text-muted mb-1 uppercase tracking-wider",children:e("provider")}),(0,a.jsx)(l.l6,{value:t,onChange:e=>s(e.target.value),options:i})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs font-medium text-text-muted mb-1 uppercase tracking-wider",children:e("model")}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{type:"text",value:d,onChange:e=>m(e.target.value),list:"model-suggestions",placeholder:e("modelPlaceholder"),className:"w-full bg-bg-subtle border border-border rounded-lg px-3 py-2 text-sm text-text-main placeholder:text-text-muted focus:outline-none focus:border-primary transition-colors"}),(0,a.jsx)("datalist",{id:"model-suggestions",children:u.map(e=>(0,a.jsx)("option",{value:e},e))})]})]})]})}),(0,a.jsxs)(l.Zp,{className:"min-h-[400px] flex flex-col",children:[(0,a.jsxs)("div",{className:"p-4 flex-1 overflow-y-auto max-h-[500px] space-y-3",children:[0===w.length&&(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-full text-text-muted py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[48px] mb-3 opacity-30",children:"chat"}),(0,a.jsx)("p",{className:"text-sm font-medium mb-1",children:e("sendMessageToSeePipeline")}),(0,a.jsxs)("p",{className:"text-xs text-center max-w-xs",children:[e("chatMessageHintPrefix")," ",(0,a.jsx)("strong",{children:o[p]?.label})," ",e("chatMessageHintSuffix")]})]}),w.map((t,s)=>(0,a.jsx)("div",{className:`flex ${"user"===t.role?"justify-end":"justify-start"}`,children:(0,a.jsxs)("div",{className:`max-w-[85%] rounded-lg px-3 py-2 text-sm ${"user"===t.role?"bg-primary/10 text-text-main border border-primary/20":"bg-bg-subtle text-text-main border border-border"}`,children:[(0,a.jsx)("p",{className:"text-[10px] font-semibold text-text-muted mb-1 uppercase",children:"user"===t.role?e("youWithFormat",{format:o[p]?.label}):e("assistant")}),(0,a.jsx)("p",{className:"whitespace-pre-wrap",children:t.content})]})},s)),(0,a.jsx)("div",{ref:T})]}),(0,a.jsx)("div",{className:"p-3 border-t border-border",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:y,onChange:e=>j(e.target.value),onKeyDown:e=>"Enter"===e.key&&!e.shiftKey&&D(),placeholder:e("typeMessage"),className:"flex-1 bg-bg-subtle border border-border rounded-lg px-3 py-2 text-sm text-text-main placeholder:text-text-muted focus:outline-none focus:border-primary transition-colors",disabled:v}),(0,a.jsx)(l.$n,{icon:"send",onClick:D,loading:v,disabled:!y.trim()||v,children:e("send")})]})})]})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(l.Zp,{children:(0,a.jsxs)("div",{className:"p-4 space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary",children:"account_tree"}),(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:e("translationPipeline")})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:e("clickStepToInspect")})]})}),S?(0,a.jsx)("div",{className:"space-y-2",children:S.map((e,t)=>{let s=o[e.format]||{label:e.format,color:"gray",icon:"code"},r=C===e.id;return(0,a.jsxs)("div",{children:[t>0&&(0,a.jsx)("div",{className:"flex justify-center py-1",children:(0,a.jsx)("div",{className:"w-px h-4 bg-border"})}),(0,a.jsxs)(l.Zp,{className:"error"===e.status?"border-red-500/30":r?"border-primary/30":"",children:[(0,a.jsxs)("button",{onClick:()=>O(r?null:e.id),className:"w-full p-3 flex items-center gap-3 text-left",children:[(0,a.jsx)("div",{className:`flex items-center justify-center w-7 h-7 rounded-full text-xs font-bold ${"error"===e.status?"bg-red-500/10 text-red-500":"done"===e.status?`bg-${s.color}-500/10 text-${s.color}-500`:"bg-bg-subtle text-text-muted"}`,children:"error"===e.status?"!":e.id}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-text-main",children:e.name}),e.description&&(0,a.jsx)("p",{className:"text-[10px] text-text-muted truncate",children:e.description})]}),(0,a.jsx)(l.Ex,{variant:"error"===e.status?"error":"default",size:"sm",children:s.label}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:r?"expand_less":"expand_more"})]}),r&&(0,a.jsx)("div",{className:"px-3 pb-3",children:(0,a.jsx)("div",{className:"border border-border rounded-lg overflow-hidden",children:(0,a.jsx)(b,{height:"250px",defaultLanguage:"json",value:e.content,theme:"vs-dark",options:{minimap:{enabled:!1},fontSize:11,lineNumbers:"on",scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,readOnly:!0}})})})]})]},e.id)})}):(0,a.jsx)(l.Zp,{children:(0,a.jsxs)("div",{className:"p-8 flex flex-col items-center justify-center text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[48px] mb-3 opacity-30",children:"account_tree"}),(0,a.jsx)("p",{className:"text-sm font-medium mb-1",children:e("pipelineVisualization")}),(0,a.jsx)("p",{className:"text-xs text-center max-w-xs",children:e("pipelineVisualizationHint")})]})})]})]})]})}let j=[{id:"simple-chat",name:"Simple Chat",icon:"chat",templateId:"simple-chat"},{id:"tool-calling",name:"Tool Calling",icon:"build",templateId:"tool-calling"},{id:"multi-turn",name:"Multi-turn",icon:"forum",templateId:"multi-turn"},{id:"thinking",name:"Thinking",icon:"psychology",templateId:"thinking"},{id:"system-prompt",name:"System Prompt",icon:"settings",templateId:"system-prompt"},{id:"streaming",name:"Streaming",icon:"stream",templateId:"streaming"}];function v(){let e=(0,r.c)("translator"),[t,s]=(0,n.useState)("claude"),{provider:d,setProvider:m,providerOptions:u}=h("openai"),{model:x,setModel:p,availableModels:g,pickModelForFormat:b}=f(),[y,v]=(0,n.useState)({}),[N,w]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let e=b(t);e&&p(e)},[t,b,p]);let k=async e=>{v(t=>({...t,[e.id]:{status:"running"}}));let s=Date.now();try{let a=i.find(t=>t.id===e.templateId),r=a?.formats[t]||a?.formats.openai;if(!r)return void v(t=>({...t,[e.id]:{status:"error",error:"No template for this format",latency:0}}));let n={...r,model:x};r.contents&&(n.model=x);let l=await fetch("/api/translator/translate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step:"direct",sourceFormat:t,provider:d,body:n})}),o=await l.json();if(!o.success)return void v(t=>({...t,[e.id]:{status:"error",error:`Translation failed: ${o.error}`,latency:Date.now()-s}}));let c=await fetch("/api/translator/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:d,body:o.result})}),m=Date.now()-s;if(!c.ok){let t=await c.json().catch(()=>({}));v(s=>({...s,[e.id]:{status:"error",error:t.error||`HTTP ${c.status}`,latency:m,httpStatus:c.status}}));return}let u=c.body.getReader(),p=0;for(;;){let{done:e}=await u.read();if(e)break;p++}v(t=>({...t,[e.id]:{status:"pass",latency:Date.now()-s,chunks:p}}))}catch(t){v(a=>({...a,[e.id]:{status:"error",error:t.message,latency:Date.now()-s}}))}},S=async()=>{for(let e of(w(!0),v({}),j))await k(e);w(!1)},_=Object.values(y).filter(e=>"pass"===e.status).length,C=Object.values(y).filter(e=>"error"===e.status).length,O=_+C,T=O>0?Math.round(_/O*100):0,P=o[t]||o.openai;return(0,a.jsxs)("div",{className:"space-y-5",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 rounded-lg bg-primary/5 border border-primary/10 text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px] mt-0.5 shrink-0",children:"info"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-text-main mb-0.5",children:e("compatibilityTester")}),(0,a.jsx)("p",{children:"Run predefined scenarios (Simple Chat, Tool Calling, etc.) to verify translation and provider compatibility. Select a source format and target provider, then run all tests to see a compatibility percentage. Use this to find which features work across providers."})]})]}),(0,a.jsx)(l.Zp,{children:(0,a.jsxs)("div",{className:"p-4 flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row items-end gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 w-full",children:[(0,a.jsx)("label",{className:"block text-xs font-medium text-text-muted mb-1.5 uppercase tracking-wider",children:"Source Format"}),(0,a.jsx)(l.l6,{value:t,onChange:e=>{s(e.target.value),v({})},options:c.filter(e=>["openai","claude","gemini","openai-responses"].includes(e.value))})]}),(0,a.jsx)("div",{className:"flex items-center justify-center px-2",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[22px] text-text-muted",children:"arrow_forward"})}),(0,a.jsxs)("div",{className:"flex-1 w-full",children:[(0,a.jsx)("label",{className:"block text-xs font-medium text-text-muted mb-1.5 uppercase tracking-wider",children:"Target Provider"}),(0,a.jsx)(l.l6,{value:d,onChange:e=>{m(e.target.value),v({})},options:u})]}),(0,a.jsx)(l.$n,{icon:"play_arrow",onClick:S,loading:N,disabled:N,children:"Run All Tests"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs font-medium text-text-muted mb-1.5 uppercase tracking-wider",children:"Model"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{type:"text",value:x,onChange:e=>p(e.target.value),list:"testbench-model-suggestions",placeholder:"Select or type a model name...",className:"w-full bg-bg-subtle border border-border rounded-lg px-3 py-2 text-sm text-text-main placeholder:text-text-muted focus:outline-none focus:border-primary transition-colors"}),(0,a.jsx)("datalist",{id:"testbench-model-suggestions",children:g.map(e=>(0,a.jsx)("option",{value:e},e))})]})]})]})}),O>0&&(0,a.jsx)(l.Zp,{children:(0,a.jsxs)("div",{className:"p-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:e("compatibilityReport")}),(0,a.jsxs)(l.Ex,{variant:T>=80?"success":T>=50?"warning":"error",size:"lg",children:[T,"%"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 text-xs text-text-muted",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"size-2 rounded-full bg-green-500"})," ",_," passed"]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"size-2 rounded-full bg-red-500"})," ",C," failed"]})]})]}),(0,a.jsx)("div",{className:"w-full h-2 bg-bg-subtle rounded-full overflow-hidden",children:(0,a.jsx)("div",{className:"h-full bg-gradient-to-r from-green-500 to-emerald-400 rounded-full transition-all duration-500",style:{width:`${T}%`}})})]})}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:j.map(e=>{let t=y[e.id],s=t?.status==="running";return(0,a.jsx)(l.Zp,{className:`transition-all ${t?.status==="pass"?"border-green-500/30":t?.status==="error"?"border-red-500/30":""}`,children:(0,a.jsxs)("div",{className:"p-4 space-y-3",children:[(0,a.jsx)("div",{className:"flex items-center justify-between",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:`flex items-center justify-center w-9 h-9 rounded-lg ${t?.status==="pass"?"bg-green-500/10 text-green-500":t?.status==="error"?"bg-red-500/10 text-red-500":"bg-bg-subtle text-text-muted"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:s?"progress_activity":t?.status==="pass"?"check_circle":t?.status==="error"?"error":e.icon})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium text-text-main",children:e.name}),(0,a.jsxs)("p",{className:"text-[10px] text-text-muted uppercase",children:[P.label," →"," ",u.find(e=>e.value===d)?.label||d]})]})]})}),t&&"running"!==t.status&&(0,a.jsx)("div",{className:`rounded-lg p-2 text-xs ${"pass"===t.status?"bg-green-500/5 text-green-600 dark:text-green-400":"bg-red-500/5 text-red-600 dark:text-red-400"}`,children:"pass"===t.status?(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{children:"✅ Passed"}),(0,a.jsxs)("span",{className:"text-text-muted",children:[t.latency,"ms • ",t.chunks," chunks"]})]}):(0,a.jsxs)("div",{children:[(0,a.jsxs)("p",{children:["❌ ",t.error]}),(0,a.jsxs)("p",{className:"text-text-muted mt-0.5",children:[t.latency,"ms"]})]})}),(0,a.jsx)(l.$n,{size:"sm",variant:t?.status==="pass"?"ghost":"outline",icon:s?"progress_activity":"play_arrow",onClick:()=>k(e),disabled:s||N,className:"w-full",children:s?"Running...":t?"Re-run":"Run Test"})]})},e.id)})})]})}function N(){let e=(0,r.c)("translator"),t=(0,r.c)("common"),[s,i]=(0,n.useState)([]),[c,d]=(0,n.useState)(!0),[m,u]=(0,n.useState)(!0),x=(0,n.useRef)(null),p=async()=>{try{let e=await fetch("/api/translator/history?limit=50");if(e.ok){let t=await e.json();i(t.events||[])}}catch{}finally{d(!1)}};(0,n.useEffect)(()=>(p(),m&&(x.current=setInterval(p,3e3)),()=>{x.current&&clearInterval(x.current)}),[m]);let h=s.filter(e=>"success"===e.status).length,g=s.filter(e=>"error"===e.status).length,f=s.length>0?Math.round(s.reduce((e,t)=>e+(t.latency||0),0)/s.length):0;return(0,a.jsxs)("div",{className:"space-y-5",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 rounded-lg bg-primary/5 border border-primary/10 text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px] mt-0.5 shrink-0",children:"info"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-text-main mb-0.5",children:e("realtime")}),(0,a.jsxs)("p",{children:[e("liveMonitorDescriptionPrefix")," ",(0,a.jsx)("strong",{className:"text-text-main",children:e("chatTester")}),","," ",(0,a.jsx)("strong",{className:"text-text-main",children:e("testBench")}),e("liveMonitorDescriptionSuffix")]})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[(0,a.jsx)(w,{icon:"translate",label:e("totalTranslations"),value:s.length,color:"blue"}),(0,a.jsx)(w,{icon:"check_circle",label:e("successful"),value:h,color:"green"}),(0,a.jsx)(w,{icon:"error",label:e("errors"),value:g,color:"red"}),(0,a.jsx)(w,{icon:"speed",label:e("avgLatency"),value:`${f}ms`,color:"purple"})]}),(0,a.jsx)(l.Zp,{children:(0,a.jsxs)("div",{className:"p-3 flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] ${m?"text-green-500 animate-pulse":"text-text-muted"}`,children:m?"radio_button_checked":"radio_button_unchecked"}),(0,a.jsx)("button",{onClick:()=>u(!m),className:"text-sm text-text-main hover:text-primary transition-colors",children:m?e("liveAutoRefreshing"):e("paused")})]}),(0,a.jsxs)("button",{onClick:p,className:"flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"refresh"}),t("refresh")]})]})}),(0,a.jsx)(l.Zp,{children:(0,a.jsxs)("div",{className:"p-4",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:e("recentTranslations")}),c?(0,a.jsxs)("div",{className:"flex items-center justify-center py-12 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin mr-2",children:"progress_activity"}),t("loading")]}):0===s.length?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[48px] mb-3 opacity-30",children:"monitoring"}),(0,a.jsx)("p",{className:"text-sm font-medium mb-1",children:e("noTranslations")}),(0,a.jsx)("p",{className:"text-xs text-center max-w-sm",children:e("eventsAppearHint")}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 mt-3 text-xs",children:[(0,a.jsx)("span",{className:"px-2 py-1 rounded-md bg-bg-subtle border border-border",children:e("chatTesterTab")}),(0,a.jsx)("span",{className:"px-2 py-1 rounded-md bg-bg-subtle border border-border",children:e("testBenchTab")}),(0,a.jsx)("span",{className:"px-2 py-1 rounded-md bg-bg-subtle border border-border",children:e("externalApiCalls")}),(0,a.jsx)("span",{className:"px-2 py-1 rounded-md bg-bg-subtle border border-border",children:e("ideCliIntegrations")})]}),(0,a.jsx)("p",{className:"text-[10px] mt-3 text-text-muted/70",children:e("inMemoryNote")})]}):(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"text-left text-xs text-text-muted border-b border-border",children:[(0,a.jsx)("th",{className:"pb-2 pr-4",children:e("time")}),(0,a.jsx)("th",{className:"pb-2 pr-4",children:e("source")}),(0,a.jsx)("th",{className:"pb-2 pr-4"}),(0,a.jsx)("th",{className:"pb-2 pr-4",children:e("target")}),(0,a.jsx)("th",{className:"pb-2 pr-4",children:e("model")}),(0,a.jsx)("th",{className:"pb-2 pr-4",children:e("status")}),(0,a.jsx)("th",{className:"pb-2 text-right",children:e("latency")})]})}),(0,a.jsx)("tbody",{children:s.map((t,s)=>{let r=o[t.sourceFormat]||{label:t.sourceFormat||"?",color:"gray"},n=o[t.targetFormat]||{label:t.targetFormat||"?",color:"gray"};return(0,a.jsxs)("tr",{className:"border-b border-border/50 hover:bg-bg-subtle/50 transition-colors",children:[(0,a.jsx)("td",{className:"py-2 pr-4 text-xs text-text-muted whitespace-nowrap",children:t.timestamp?new Date(t.timestamp).toLocaleTimeString():"—"}),(0,a.jsx)("td",{className:"py-2 pr-4",children:(0,a.jsx)(l.Ex,{variant:"default",size:"sm",children:r.label})}),(0,a.jsx)("td",{className:"py-2 pr-4 text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"arrow_forward"})}),(0,a.jsx)("td",{className:"py-2 pr-4",children:(0,a.jsx)(l.Ex,{variant:"primary",size:"sm",children:n.label})}),(0,a.jsx)("td",{className:"py-2 pr-4 text-xs font-mono text-text-muted",children:t.model||"—"}),(0,a.jsx)("td",{className:"py-2 pr-4",children:"success"===t.status?(0,a.jsx)(l.Ex,{variant:"success",size:"sm",dot:!0,children:e("ok")}):(0,a.jsx)(l.Ex,{variant:"error",size:"sm",dot:!0,children:t.statusCode||e("errorShort")})}),(0,a.jsx)("td",{className:"py-2 text-right text-xs text-text-muted",children:t.latency?`${t.latency}ms`:"—"})]},t.id||s)})})]})})]})})]})}function w({icon:e,label:t,value:s,color:r}){return(0,a.jsx)(l.Zp,{children:(0,a.jsxs)("div",{className:"p-4 flex items-center gap-3",children:[(0,a.jsx)("div",{className:`flex items-center justify-center w-10 h-10 rounded-lg bg-${r}-500/10`,children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[22px] text-${r}-500`,children:e})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-lg font-bold text-text-main",children:s}),(0,a.jsx)("p",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:t})]})]})})}function k(){let e=(0,r.c)("translator"),[t,s]=(0,n.useState)("playground"),i=[{value:"playground",label:e("playground"),icon:"code"},{value:"chat-tester",label:e("chatTester"),icon:"chat"},{value:"test-bench",label:e("testBench"),icon:"science"},{value:"live-monitor",label:e("liveMonitor"),icon:"monitoring"}],o={playground:e("modeDescriptionPlayground"),"chat-tester":e("modeDescriptionChatTester"),"test-bench":e("modeDescriptionTestBench"),"live-monitor":e("modeDescriptionLiveMonitor")};return(0,a.jsxs)("div",{className:"p-8 space-y-6",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("h1",{className:"text-2xl font-bold text-text-main flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[28px]",children:"translate"}),e("playgroundTitle")]}),(0,a.jsx)("p",{className:"text-sm text-text-muted mt-1",children:o[t]||e("modeDescriptionFallback")})]}),(0,a.jsx)(l.Iz,{options:i,value:t,onChange:s,size:"md"})]}),"playground"===t&&(0,a.jsx)(x,{}),"chat-tester"===t&&(0,a.jsx)(y,{}),"test-bench"===t&&(0,a.jsx)(v,{}),"live-monitor"===t&&(0,a.jsx)(N,{})]})}},5214:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorage",{enumerable:!0,get:function(){return a.workAsyncStorageInstance}});let a=s(17828)},17828:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorageInstance",{enumerable:!0,get:function(){return a}});let a=(0,s(64054).createAsyncLocalStorage)()},21957:(e,t,s)=>{"use strict";function a({moduleIds:e}){return null}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadChunks",{enumerable:!0,get:function(){return a}}),s(95155),s(47650),s(5214),s(2451),s(53887)},41112:(e,t,s)=>{"use strict";function a({reason:e,children:t}){return t}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return a}}),s(1980)},64054:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s={bindSnapshot:function(){return o},createAsyncLocalStorage:function(){return i},createSnapshot:function(){return c}};for(var a in s)Object.defineProperty(t,a,{enumerable:!0,get:s[a]});let r=Object.defineProperty(Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0});class n{disable(){throw r}getStore(){}run(){throw r}exit(){throw r}enterWith(){throw r}static bind(e){return e}}let l="u">typeof globalThis&&globalThis.AsyncLocalStorage;function i(){return l?new l:new n}function o(e){return l?l.bind(e):n.bind(e)}function c(){return l?l.snapshot():function(e,...t){return e(...t)}}},65355:(e,t,s)=>{Promise.resolve().then(s.bind(s,2824))},68635:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return o}});let a=s(95155),r=s(12115),n=s(41112);function l(e){return{default:e&&"default"in e?e.default:e}}s(21957);let i={loader:()=>Promise.resolve(l(()=>null)),loading:null,ssr:!0},o=function(e){let t={...i,...e},s=(0,r.lazy)(()=>t.loader().then(l)),o=t.loading;function c(e){let l=o?(0,a.jsx)(o,{isLoading:!0,pastDelay:!0,error:null}):null,i=!t.ssr||!!t.loading,c=i?r.Suspense:r.Fragment,d=t.ssr?(0,a.jsxs)(a.Fragment,{children:[null,(0,a.jsx)(s,{...e})]}):(0,a.jsx)(n.BailoutToCSR,{reason:"next/dynamic",children:(0,a.jsx)(s,{...e})});return(0,a.jsx)(c,{...i?{fallback:l}:{},children:d})}return c.displayName="LoadableComponent",c}},75707:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return r}});let a=s(73623)._(s(68635));function r(e,t){let s={};"function"==typeof e&&(s.loader=e);let r={...s,...t};return(0,a.default)({...r,modules:r.loadableGenerated?.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=65355)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2162],{40182:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>d});var l=t(95155),a=t(50910),r=t(98500),i=t.n(r),n=t(40993);function d(){let e=(0,a.c)("auth");return(0,l.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-bg p-4",children:(0,l.jsxs)("div",{className:"w-full max-w-lg",children:[(0,l.jsxs)("div",{className:"text-center mb-8",children:[(0,l.jsx)("h1",{className:"text-3xl font-bold text-primary mb-2",children:e("resetPassword")}),(0,l.jsx)("p",{className:"text-text-muted",children:e("resetDescription")})]}),(0,l.jsx)(n.Zp,{className:"mb-4",children:(0,l.jsxs)("div",{className:"flex items-start gap-4 p-2",children:[(0,l.jsx)("div",{className:"flex items-center justify-center size-10 rounded-lg bg-primary/10 text-primary shrink-0 mt-0.5",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"terminal"})}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("h2",{className:"text-lg font-semibold mb-1",children:"Method 1: CLI Reset"}),(0,l.jsx)("p",{className:"text-sm text-text-muted mb-3",children:"Run the following command on the server where OmniRoute is running:"}),(0,l.jsx)("div",{className:"bg-black/30 rounded-lg p-3 mb-3 font-mono text-sm text-green-400 border border-white/5",children:(0,l.jsx)("code",{children:"npx omniroute reset-password"})}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"This will prompt you to set a new password. The server must be stopped first."})]})]})}),(0,l.jsx)(n.Zp,{className:"mb-6",children:(0,l.jsxs)("div",{className:"flex items-start gap-4 p-2",children:[(0,l.jsx)("div",{className:"flex items-center justify-center size-10 rounded-lg bg-amber-500/10 text-amber-500 shrink-0 mt-0.5",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"database"})}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("h2",{className:"text-lg font-semibold mb-1",children:"Method 2: Manual Reset"}),(0,l.jsx)("p",{className:"text-sm text-text-muted mb-3",children:"Delete the password from the database and set a new one on startup:"}),(0,l.jsxs)("ol",{className:"text-sm text-text-muted space-y-2 list-decimal list-inside mb-3",children:[(0,l.jsx)("li",{children:e("stopServer")}),(0,l.jsxs)("li",{children:["Set a new password in your"," ",(0,l.jsx)("code",{className:"bg-black/30 px-1 rounded text-text-main",children:".env"})," file:",(0,l.jsx)("div",{className:"bg-black/30 rounded-lg p-2 mt-1 font-mono text-xs text-green-400 border border-white/5",children:"INITIAL_PASSWORD=your_new_password"})]}),(0,l.jsxs)("li",{children:["Delete"," ",(0,l.jsx)("code",{className:"bg-black/30 px-1 rounded text-text-main",children:"data/settings.json"})," ","(or remove the"," ",(0,l.jsx)("code",{className:"bg-black/30 px-1 rounded text-text-main",children:"passwordHash"})," ","field)"]}),(0,l.jsx)("li",{children:"Restart the server — it will use the new password"})]})]})]})}),(0,l.jsx)("div",{className:"text-center",children:(0,l.jsxs)(i(),{href:"/login",className:"text-sm text-primary hover:underline inline-flex items-center gap-1",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"arrow_back"}),"Back to Login"]})})]})})}},50057:(e,s,t)=>{Promise.resolve().then(t.bind(t,40182))}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=50057)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4520],{13504:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>d});var a=s(95155),r=s(50910),i=s(12115),n=s(40993),l=s(73321);function d(){let e=(0,r.c)("auth"),[t,s]=(0,i.useState)(""),[d,c]=(0,i.useState)(""),[o,m]=(0,i.useState)(!1),[x,u]=(0,i.useState)(null),[h,p]=(0,i.useState)(null),[b,f]=(0,i.useState)(!1),y=(0,l.useRouter)();(0,i.useEffect)(()=>{f(!0),async function(){let e=new AbortController,t=setTimeout(()=>e.abort(),5e3),s=window.location.origin;try{let a=await fetch(`${s}/api/settings`,{signal:e.signal});if(clearTimeout(t),a.ok){let e=await a.json();if(!1===e.requireLogin){y.push("/dashboard"),y.refresh();return}u(!!e.hasPassword),p(!!e.setupComplete)}else u(!0),p(!0)}catch(e){clearTimeout(t),u(!0),p(!0)}}()},[y]);let j=async e=>{e.preventDefault(),m(!0),c("");try{let e=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:t})});if(e.ok)sessionStorage.setItem("omniroute_login_time",String(Date.now())),y.push("/dashboard"),y.refresh();else{let t=await e.json();c(t.error||"Invalid password")}}catch(e){c("An error occurred. Please try again.")}finally{m(!1)}};return null===x||null===h?(0,a.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-bg",children:(0,a.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("div",{className:"w-10 h-10 border-2 border-primary/20 rounded-full"}),(0,a.jsx)("div",{className:"absolute inset-0 w-10 h-10 border-2 border-primary border-t-transparent rounded-full animate-spin"})]}),(0,a.jsx)("span",{className:"text-sm text-text-muted",children:"Loading..."})]})}):x||h?!x&&h?(0,a.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-bg p-6",children:(0,a.jsxs)("div",{className:`w-full max-w-md transition-all duration-700 ease-out ${b?"opacity-100 translate-y-0":"opacity-0 translate-y-4"}`,children:[(0,a.jsxs)("div",{className:"text-center mb-10",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-20 h-20 rounded-3xl bg-gradient-to-br from-amber-500/10 to-amber-500/5 border border-amber-500/10 mb-6",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-amber-500 text-[40px]",children:"shield_person"})}),(0,a.jsx)("h1",{className:"text-3xl font-bold text-text-main tracking-tight",children:"Secure Your Instance"}),(0,a.jsx)("p",{className:"text-text-muted mt-2",children:e("passwordNotEnabled")})]}),(0,a.jsx)("div",{className:"bg-surface border border-border rounded-2xl p-8 shadow-soft",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("p",{className:"text-text-muted leading-relaxed mb-6",children:"Set a password to protect your dashboard and secure your API endpoints from unauthorized access."}),(0,a.jsx)(n.$n,{variant:"primary",className:"w-full h-11 text-sm font-medium",onClick:()=>y.push("/dashboard/settings?tab=security"),children:"Configure Password"})]})}),(0,a.jsx)("p",{className:"text-center text-xs text-text-muted/60 mt-8",children:"OmniRoute — Unified AI API Proxy"})]})}):(0,a.jsxs)("div",{className:"min-h-screen flex bg-bg",children:[(0,a.jsx)("div",{className:"flex-1 flex items-center justify-center p-6",children:(0,a.jsxs)("div",{className:`w-full max-w-sm transition-all duration-700 ease-out ${b?"opacity-100 translate-y-0":"opacity-0 translate-y-4"}`,children:[(0,a.jsxs)("div",{className:"mb-10",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-8",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-primary to-primary-hover flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-white text-[20px]",children:"hub"})}),(0,a.jsx)("span",{className:"text-xl font-semibold text-text-main tracking-tight",children:"OmniRoute"})]}),(0,a.jsx)("h1",{className:"text-2xl font-bold text-text-main tracking-tight",children:e("signIn")}),(0,a.jsx)("p",{className:"text-text-muted mt-1.5",children:e("enterPassword")})]}),(0,a.jsxs)("form",{onSubmit:j,className:"space-y-5",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{className:"text-sm font-medium text-text-main",children:e("password")}),(0,a.jsx)(n.pd,{type:"password",placeholder:"Enter your password",value:t,onChange:e=>s(e.target.value),required:!0,autoFocus:!0,className:"h-11"}),d&&(0,a.jsxs)("p",{className:"text-sm text-red-500 flex items-center gap-1.5 pt-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base",children:"error"}),d]})]}),(0,a.jsx)(n.$n,{type:"submit",variant:"primary",className:"w-full h-11 text-sm font-medium",loading:o,children:"Continue"})]}),(0,a.jsx)("div",{className:"mt-6 pt-6 border-t border-border",children:(0,a.jsx)("a",{href:"/forgot-password",className:"text-sm text-text-muted hover:text-primary transition-colors",children:"Forgot your password?"})})]})}),(0,a.jsx)("div",{className:"hidden lg:flex lg:w-1/2 bg-gradient-to-br from-primary/5 via-primary/3 to-transparent items-center justify-center p-12",children:(0,a.jsx)("div",{className:`max-w-md transition-all duration-700 delay-200 ease-out ${b?"opacity-100 translate-y-0":"opacity-0 translate-y-4"}`,children:(0,a.jsxs)("div",{className:"space-y-8",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-2xl font-bold text-text-main mb-3",children:"Unified AI API Proxy"}),(0,a.jsx)("p",{className:"text-text-muted leading-relaxed",children:"Route requests to multiple AI providers through a single endpoint. Load balancing, failover, and usage tracking built in."})]}),(0,a.jsx)("div",{className:"space-y-4",children:[{icon:"swap_horiz",title:"Multi-Provider",desc:"OpenAI, Anthropic, Google, and more"},{icon:"speed",title:"Load Balancing",desc:"Distribute requests intelligently"},{icon:"analytics",title:"Usage Tracking",desc:"Monitor costs and tokens"}].map(e=>(0,a.jsxs)("div",{className:"flex items-start gap-4 p-4 rounded-xl bg-surface/50 border border-border",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:e.icon})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"font-medium text-text-main",children:e.title}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:e.desc})]})]},e.icon))})]})})})]}):(0,a.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-bg p-6",children:(0,a.jsxs)("div",{className:`w-full max-w-md transition-all duration-700 ease-out ${b?"opacity-100 translate-y-0":"opacity-0 translate-y-4"}`,children:[(0,a.jsxs)("div",{className:"text-center mb-10",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-20 h-20 rounded-3xl bg-gradient-to-br from-primary/10 to-primary/5 border border-primary/10 mb-6",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[40px]",children:"rocket_launch"})}),(0,a.jsx)("h1",{className:"text-3xl font-bold text-text-main tracking-tight",children:e("welcome")}),(0,a.jsx)("p",{className:"text-text-muted mt-2",children:"Let's get your OmniRoute instance configured"})]}),(0,a.jsx)("div",{className:"bg-surface border border-border rounded-2xl p-8 shadow-soft",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("p",{className:"text-text-muted leading-relaxed mb-6",children:"Run the onboarding wizard to set up your password and connect your first AI provider."}),(0,a.jsx)(n.$n,{variant:"primary",className:"w-full h-11 text-sm font-medium",onClick:()=>y.push("/dashboard/onboarding"),children:"Start Onboarding"})]})}),(0,a.jsxs)("p",{className:"text-center text-xs text-text-muted/60 mt-8",children:["OmniRoute — ",e("unifiedProxy")]})]})})}},90723:(e,t,s)=>{Promise.resolve().then(s.bind(s,13504))}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=90723)),_N_E=e.O()}]);
package/app/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omniroute",
3
- "version": "1.4.10",
3
+ "version": "1.4.11",
4
4
  "description": "Smart AI Router with auto fallback — route to FREE & cheap models, zero downtime. Works with Cursor, Cline, Claude Desktop, Codex, and any OpenAI-compatible tool.",
5
5
  "type": "module",
6
6
  "bin": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omniroute",
3
- "version": "1.4.10",
3
+ "version": "1.4.11",
4
4
  "description": "Smart AI Router with auto fallback — route to FREE & cheap models, zero downtime. Works with Cursor, Cline, Claude Desktop, Codex, and any OpenAI-compatible tool.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8978],{53701:(e,s,a)=>{"use strict";a.r(s),a.d(s,{default:()=>o});var l=a(95155),n=a(12115),r=a(40993),i=a(50910),c=a(67671);let d=[{name:"contains",label:"Contains",icon:"search",color:"text-sky-400",bg:"bg-sky-500/10",description:"Checks if the response contains a specific text (case-insensitive)"},{name:"exact",label:"Exact Match",icon:"check_circle",color:"text-emerald-400",bg:"bg-emerald-500/10",description:"Response must be an exact character-for-character match"},{name:"regex",label:"Regex Pattern",icon:"code",color:"text-amber-400",bg:"bg-amber-500/10",description:"Matches response against a regular expression pattern"},{name:"custom",label:"Custom Function",icon:"tune",color:"text-violet-400",bg:"bg-violet-500/10",description:"Uses a custom function for advanced evaluation logic"}];function x(){let e=(0,i.c)("usage"),[s,a]=(0,n.useState)([]),[x,o]=(0,n.useState)(null),[p,u]=(0,n.useState)(!0),[h,g]=(0,n.useState)(null),[f,b]=(0,n.useState)({current:0,total:0}),[j,v]=(0,n.useState)({}),[N,y]=(0,n.useState)(""),[k,w]=(0,n.useState)(null),[C,S]=(0,n.useState)(!1),R=(0,c.i)(),$=(0,n.useCallback)(async()=>{try{let e=await fetch("/api/evals");if(e.ok){let s=await e.json();a(Array.isArray(s)?s:s.suites||[])}}catch{}finally{u(!1)}},[]),E=(0,n.useCallback)(async()=>{try{let e=await fetch("/api/keys");if(!e.ok)return;let s=await e.json(),a=s?.keys?.[0]?.key||null;o(a)}catch{}},[]);(0,n.useEffect)(()=>{$(),E()},[$,E]);let L=async e=>{try{let s={"Content-Type":"application/json"};x&&(s.Authorization=`Bearer ${x}`);let a=await fetch("/v1/chat/completions",{method:"POST",headers:s,body:JSON.stringify({model:e.model||"gpt-4o",messages:e.input?.messages||[],max_tokens:512,stream:!1})});if(!a.ok)return`[ERROR: HTTP ${a.status}]`;let l=await a.json();return l.choices?.[0]?.message?.content||"[No content returned]"}catch(e){return`[ERROR: ${e.message}]`}},M=async e=>{let s=e.cases||[];if(0===s.length)return void R.warning("No test cases defined for this suite");g(e.id),b({current:0,total:s.length});try{let a={};for(let e=0;e<s.length;e++){b({current:e+1,total:s.length});let l=await L(s[e]);a[s[e].id]=l}let l=await fetch("/api/evals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({suiteId:e.id,outputs:a})}),n=await l.json();if(v(s=>({...s,[e.id]:n})),n.summary){let{passed:s,failed:a,total:l}=n.summary;0===a?R.success(`All ${l} cases passed ✅`,`Eval: ${e.name}`):R.warning(`${s}/${l} passed, ${a} failed`,`Eval: ${e.name}`)}w(e.id)}catch{R.error("Eval run failed")}finally{g(null),b({current:0,total:0})}},T=s.filter(e=>!N||e.name?.toLowerCase().includes(N.toLowerCase())||e.id?.toLowerCase().includes(N.toLowerCase())),_=s.reduce((e,s)=>e+(s.cases?.length||s.caseCount||0),0),O=[...new Set(s.flatMap(e=>(e.cases||[]).map(e=>e.model)).filter(Boolean))];if(p)return(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted p-8 animate-pulse",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"science"}),"Loading eval suites..."]});if(0===s.length)return(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,l.jsx)(m,{}),(0,l.jsx)(r.pp,{icon:"science",title:"No Eval Suites Found",description:"Eval suites can be defined via the API or in code. They test model outputs against expected results using strategies like contains, regex, exact match, and custom functions."})]});let P=[{key:"caseName",label:"Case"},{key:"status",label:"Status"},{key:"durationMs",label:"Latency"},{key:"details",label:"Details"}];return(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,l.jsx)(m,{}),(0,l.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[(0,l.jsxs)(r.Zp,{className:"px-4 py-3 text-center",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted uppercase font-semibold tracking-wide",children:"Suites"}),(0,l.jsx)("div",{className:"text-2xl font-bold mt-1 text-violet-400",children:s.length})]}),(0,l.jsxs)(r.Zp,{className:"px-4 py-3 text-center",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted uppercase font-semibold tracking-wide",children:"Test Cases"}),(0,l.jsx)("div",{className:"text-2xl font-bold mt-1 text-sky-400",children:_})]}),(0,l.jsxs)(r.Zp,{className:"px-4 py-3 text-center",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted uppercase font-semibold tracking-wide",children:"Models"}),(0,l.jsx)("div",{className:"text-2xl font-bold mt-1 text-emerald-400",children:O.length})]}),(0,l.jsxs)(r.Zp,{className:"px-4 py-3 text-center",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted uppercase font-semibold tracking-wide",children:"Coverage"}),(0,l.jsxs)("div",{className:"text-2xl font-bold mt-1 text-amber-400",children:[d.length," strategies"]})]})]}),(0,l.jsxs)(r.Zp,{className:"p-0 overflow-hidden",children:[(0,l.jsxs)("button",{onClick:()=>S(!C),className:"w-full flex items-center justify-between px-6 py-4 hover:bg-surface/30 transition-colors text-left",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"help"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:"How It Works"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Learn how evaluations validate your LLM responses"})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted transition-transform duration-200 ${C?"rotate-180":""}`,children:"expand_more"})]}),C&&(0,l.jsxs)("div",{className:"px-6 pb-6 border-t border-border/10",children:[(0,l.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mt-4",children:[(0,l.jsxs)("div",{className:"flex flex-col items-center text-center p-4 rounded-lg bg-violet-500/5 border border-violet-500/10",children:[(0,l.jsx)("div",{className:"w-10 h-10 rounded-full bg-violet-500/20 flex items-center justify-center mb-3",children:(0,l.jsx)("span",{className:"text-lg font-bold text-violet-400",children:"1"})}),(0,l.jsx)("h4",{className:"text-sm font-semibold text-text-main mb-1",children:e(">define</")}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Create test cases with input prompts and expected output criteria using strategies like contains, regex, or exact match."})]}),(0,l.jsxs)("div",{className:"flex flex-col items-center text-center p-4 rounded-lg bg-sky-500/5 border border-sky-500/10",children:[(0,l.jsx)("div",{className:"w-10 h-10 rounded-full bg-sky-500/20 flex items-center justify-center mb-3",children:(0,l.jsx)("span",{className:"text-lg font-bold text-sky-400",children:"2"})}),(0,l.jsx)("h4",{className:"text-sm font-semibold text-text-main mb-1",children:e(">run</")}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Execute test cases against your LLM endpoints through OmniRoute. Each case is sent as a real API request."})]}),(0,l.jsxs)("div",{className:"flex flex-col items-center text-center p-4 rounded-lg bg-emerald-500/5 border border-emerald-500/10",children:[(0,l.jsx)("div",{className:"w-10 h-10 rounded-full bg-emerald-500/20 flex items-center justify-center mb-3",children:(0,l.jsx)("span",{className:"text-lg font-bold text-emerald-400",children:"3"})}),(0,l.jsx)("h4",{className:"text-sm font-semibold text-text-main mb-1",children:e(">evaluate</")}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Responses are compared against expected criteria. See pass/fail for each case with latency metrics and detailed feedback."})]})]}),(0,l.jsxs)("div",{className:"mt-6",children:[(0,l.jsx)("h4",{className:"text-xs font-semibold text-text-muted uppercase tracking-wide mb-3",children:"Evaluation Strategies"}),(0,l.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:d.map(e=>(0,l.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg ${e.bg} border border-transparent`,children:[(0,l.jsx)("span",{className:`material-symbols-outlined text-[18px] ${e.color}`,children:e.icon}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:`text-xs font-mono font-semibold ${e.color}`,children:e.name}),(0,l.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:e.description})]})]},e.name))})]}),O.length>0&&(0,l.jsxs)("div",{className:"mt-6",children:[(0,l.jsx)("h4",{className:"text-xs font-semibold text-text-muted uppercase tracking-wide mb-3",children:"Models Under Test"}),(0,l.jsx)("div",{className:"flex flex-wrap gap-2",children:O.map(e=>(0,l.jsx)("span",{className:"px-3 py-1.5 rounded-full text-xs font-mono font-medium bg-primary/10 text-primary border border-primary/20",children:e},e))})]})]})]}),(0,l.jsxs)(r.Zp,{className:"p-6",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,l.jsx)("div",{className:"p-2 rounded-lg bg-violet-500/10 text-violet-500",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"science"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("h3",{className:"text-lg font-semibold",children:e("evalSuites")}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Click a suite to view test cases, then run to evaluate your LLM endpoints"})]})]}),(0,l.jsx)(r.Qn,{searchValue:N,onSearchChange:y,placeholder:"Search suites...",filters:[],activeFilters:{},onFilterChange:()=>{},children:null}),(0,l.jsx)("div",{className:"flex flex-col gap-3 mt-4",children:T.map(e=>{let s=j[e.id],a=h===e.id,n=k===e.id,i=e.cases?.length||e.caseCount||0,c=[...new Set((e.cases||[]).map(e=>e.model).filter(Boolean))];return(0,l.jsxs)("div",{className:"border border-border/30 rounded-lg overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 cursor-pointer hover:bg-surface/30 transition-colors",onClick:()=>w(n?null:e.id),children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted",children:n?"expand_more":"chevron_right"}),(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("p",{className:"text-sm font-medium text-text-main",children:e.name||e.id}),s?.summary&&(0,l.jsxs)("span",{className:`px-2 py-0.5 rounded-full text-xs font-semibold ${100===s.summary.passRate?"bg-emerald-500/10 text-emerald-400":s.summary.passRate>=80?"bg-amber-500/10 text-amber-400":"bg-red-500/10 text-red-400"}`,children:[s.summary.passRate,"% pass"]})]}),(0,l.jsxs)("p",{className:"text-xs text-text-muted",children:[i," case",1!==i?"s":"",e.description&&(0,l.jsxs)("span",{className:"ml-1",children:["— ",e.description]})]}),c.length>0&&(0,l.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:c.map(e=>(0,l.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono text-text-muted bg-black/5 dark:bg-white/5",children:e},e))})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[a&&f.total>0&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-24 h-1.5 bg-black/10 dark:bg-white/10 rounded-full overflow-hidden",children:(0,l.jsx)("div",{className:"h-full bg-violet-500 rounded-full transition-all duration-300",style:{width:`${f.current/f.total*100}%`}})}),(0,l.jsxs)("span",{className:"text-xs text-text-muted font-mono tabular-nums",children:[f.current,"/",f.total]})]}),(0,l.jsx)(r.$n,{size:"sm",variant:"primary",onClick:s=>{s.stopPropagation(),M(e)},loading:a,disabled:a,children:a?`Running ${f.current}/${f.total}...`:"Run Eval"})]})]}),n&&(0,l.jsx)("div",{className:"border-t border-border/20 p-4",children:s?.results?(0,l.jsxs)(l.Fragment,{children:[s.summary&&(0,l.jsxs)("div",{className:"flex items-center gap-4 mb-4 p-3 rounded-lg bg-surface/30 border border-border/20",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)("span",{className:`text-lg font-bold ${100===s.summary.passRate?"text-emerald-400":s.summary.passRate>=80?"text-amber-400":"text-red-400"}`,children:[s.summary.passRate,"%"]}),(0,l.jsx)("span",{className:"text-xs text-text-muted",children:"pass rate"})]}),(0,l.jsxs)("div",{className:"text-xs text-text-muted",children:[s.summary.passed," passed \xb7 ",s.summary.failed," ","failed \xb7 ",s.summary.total," total"]}),(0,l.jsx)("div",{className:"flex-1 h-2 bg-black/10 dark:bg-white/10 rounded-full overflow-hidden",children:(0,l.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${s.summary.passRate}%`,background:100===s.summary.passRate?"linear-gradient(90deg, #22c55e, #16a34a)":s.summary.passRate>=80?"linear-gradient(90deg, #f59e0b, #d97706)":"linear-gradient(90deg, #ef4444, #dc2626)"}})})]}),(0,l.jsx)(r.bQ,{columns:P,data:s.results.map((e,s)=>({...e,id:e.caseId||s})),renderCell:(e,s)=>{if("status"===s.key)return e.passed?(0,l.jsx)("span",{className:"text-emerald-400",children:"✅ Passed"}):(0,l.jsx)("span",{className:"text-red-400",children:"❌ Failed"});if("durationMs"===s.key)return(0,l.jsx)("span",{className:"text-text-muted text-xs font-mono",children:null!=e.durationMs?`${e.durationMs}ms`:"—"});if("details"===s.key){let s=e.details||{};return(0,l.jsx)("span",{className:"text-text-muted text-xs truncate max-w-[300px] block",children:String(s.searchTerm?`Contains: "${s.searchTerm}"`:s.pattern?`Regex: ${s.pattern}`:s.expected?`Expected: "${String(s.expected).slice(0,50)}"`:e.error||"—")})}return(0,l.jsx)("span",{className:"text-sm text-text-main",children:e[s.key]||"—"})},maxHeight:"400px",emptyMessage:"No results yet"})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted",children:"checklist"}),(0,l.jsxs)("span",{className:"text-xs text-text-muted font-medium",children:["Test Cases (",(e.cases||[]).length,")"]})]}),(0,l.jsx)(r.bQ,{columns:[{key:"name",label:"Case"},{key:"model",label:"Model"},{key:"strategy",label:"Strategy"},{key:"expected",label:"Expected"}],data:(e.cases||[]).map((e,s)=>({id:e.id||s,name:e.name,model:e.model||"—",strategy:e.expected?.strategy||"—",expected:e.expected?.value?String(e.expected.value).slice(0,80):"—"})),renderCell:(e,s)=>{if("strategy"===s.key){let s=d.find(s=>s.name===e.strategy);return(0,l.jsx)("span",{className:`text-xs font-mono font-semibold ${s?.color||"text-text-muted"}`,children:e.strategy})}return"model"===s.key?(0,l.jsx)("span",{className:"text-xs font-mono text-primary/80",children:e.model}):"expected"===s.key?(0,l.jsx)("span",{className:"text-text-muted text-xs font-mono truncate max-w-[300px] block",children:e.expected}):(0,l.jsx)("span",{className:"text-sm text-text-main",children:e[s.key]||"—"})},maxHeight:"400px",emptyMessage:"No test cases defined"}),(0,l.jsxs)("p",{className:"text-xs text-text-muted mt-3 flex items-center gap-1.5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"info"}),'Click "Run Eval" to execute all cases against your LLM endpoint. Each test sends a real request through OmniRoute.']})]})})]},e.id)})})]})]})}function m(){return(0,l.jsx)(r.Zp,{className:"p-0 overflow-hidden",children:(0,l.jsx)("div",{className:"p-6",style:{background:"linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(59, 130, 246, 0.05) 50%, rgba(16, 185, 129, 0.05) 100%)"},children:(0,l.jsxs)("div",{className:"flex items-start gap-4",children:[(0,l.jsx)("div",{className:"p-3 rounded-xl bg-violet-500/10 text-violet-500",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[28px]",children:"science"})}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("h2",{className:"text-xl font-bold text-text-main mb-1",children:t("modelEvals")}),(0,l.jsx)("p",{className:"text-sm text-text-muted leading-relaxed max-w-2xl",children:"Test and validate your LLM endpoints by running predefined evaluation suites. Each suite contains test cases that send real prompts through OmniRoute and compare responses against expected criteria — helping you detect regressions, compare models, and ensure response quality across providers."}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-4 mt-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] text-emerald-400",children:"verified"}),"Quality Validation"]}),(0,l.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] text-sky-400",children:"compare"}),"Model Comparison"]}),(0,l.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] text-amber-400",children:"bug_report"}),"Regression Detection"]}),(0,l.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] text-violet-400",children:"speed"}),"Latency Benchmarks"]})]})]})]})})})}function o(){let[e,s]=(0,n.useState)("overview"),a=(0,i.c)("analytics"),c={overview:a("overviewDescription"),evals:a("evalsDescription")};return(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-primary text-[28px]",children:"analytics"}),a("title")]}),(0,l.jsx)("p",{className:"text-sm text-text-muted mt-1",children:c[e]})]}),(0,l.jsx)(r.Iz,{options:[{value:"overview",label:a("overview")},{value:"evals",label:a("evals")}],value:e,onChange:s}),"overview"===e&&(0,l.jsx)(n.Suspense,{fallback:(0,l.jsx)(r.Qv,{}),children:(0,l.jsx)(r.cn,{})}),"evals"===e&&(0,l.jsx)(x,{})]})}},69589:(e,s,a)=>{Promise.resolve().then(a.bind(a,53701))}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=69589)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3700],{14031:(e,t,s)=>{Promise.resolve().then(s.bind(s,70595))},70595:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>h});var a=s(95155),l=s(12115),i=s(40993),r=s(50910),d=s(67671);function n({value:e,max:t,warningAt:s=.8}){let l=t>0?Math.min(e/t*100,100):0,i=t>0?e/t:0;return(0,a.jsxs)("div",{className:"w-full",children:[(0,a.jsxs)("div",{className:"flex justify-between text-xs mb-1",children:[(0,a.jsxs)("span",{className:"text-text-muted",children:["$",e.toFixed(2)]}),(0,a.jsxs)("span",{className:"text-text-muted",children:["$",t.toFixed(2)]})]}),(0,a.jsx)("div",{className:"w-full h-2 rounded-full bg-surface/50 overflow-hidden",children:(0,a.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${l}%`,backgroundColor:i>=1?"#ef4444":i>=s?"#f59e0b":"#22c55e"}})})]})}function o(){let e=(0,r.c)("usage"),[t,s]=(0,l.useState)([]),[o,c]=(0,l.useState)(null),[m,x]=(0,l.useState)(null),[u,p]=(0,l.useState)(!0),[h,g]=(0,l.useState)(!1),[b,f]=(0,l.useState)({dailyLimitUsd:"",monthlyLimitUsd:"",warningThreshold:"80"}),j=(0,d.i)();(0,l.useEffect)(()=>{fetch("/api/keys").then(e=>e.json()).then(e=>{let t=Array.isArray(e)?e:e.keys||[];s(t),t.length>0&&c(t[0].id),p(!1)}).catch(()=>p(!1))},[]);let y=(0,l.useCallback)(async()=>{if(o)try{let e=await fetch(`/api/usage/budget?apiKeyId=${o}`);if(e.ok){let t=await e.json();x(t),t.dailyLimitUsd&&f(e=>({...e,dailyLimitUsd:String(t.dailyLimitUsd)})),t.monthlyLimitUsd&&f(e=>({...e,monthlyLimitUsd:String(t.monthlyLimitUsd)})),t.warningThreshold&&f(e=>({...e,warningThreshold:String(t.warningThreshold)}))}}catch{}},[o]);(0,l.useEffect)(()=>{y()},[y]);let v=async()=>{g(!0);try{(await fetch("/api/usage/budget",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKeyId:o,dailyLimitUsd:b.dailyLimitUsd?parseFloat(b.dailyLimitUsd):null,monthlyLimitUsd:b.monthlyLimitUsd?parseFloat(b.monthlyLimitUsd):null,warningThreshold:parseInt(b.warningThreshold)||80})})).ok?(j.success("Budget limits saved"),await y()):j.error("Failed to save budget")}catch{j.error("Failed to save budget")}finally{g(!1)}};if(u)return(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted p-8 animate-pulse",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"account_balance_wallet"}),"Loading budget data..."]});if(0===t.length)return(0,a.jsx)(i.pp,{icon:"vpn_key",title:"No API Keys",description:"Add API keys first to set up budget limits."});let N=m?.dailyLimitUsd||parseFloat(b.dailyLimitUsd)||0,w=m?.monthlyLimitUsd||parseFloat(b.monthlyLimitUsd)||0,C=m?.totalCostToday||0,k=m?.totalCostMonth||0,S=(parseInt(b.warningThreshold)||80)/100;return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)(i.Zp,{className:"p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-emerald-500/10 text-emerald-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"account_balance_wallet"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:e("budgetManagement")})]}),(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("label",{className:"text-sm text-text-muted mb-1 block",children:e(">apiKey</")}),(0,a.jsx)("select",{value:o||"",onChange:e=>c(e.target.value),className:"w-full md:w-auto px-3 py-2 rounded-lg border border-border/50 bg-surface/30 text-text-main text-sm focus:outline-none focus:ring-1 focus:ring-primary",children:t.map(e=>(0,a.jsxs)("option",{value:e.id,children:[e.name||e.id," ",e.provider?`(${e.provider})`:""]},e.id))})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[(0,a.jsxs)("div",{className:"p-4 rounded-lg border border-border/30 bg-surface/20",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted mb-2",children:"Today's Spend"}),(0,a.jsxs)("p",{className:"text-2xl font-bold text-text-main",children:["$",C.toFixed(2)]}),N>0&&(0,a.jsx)(n,{value:C,max:N,warningAt:S})]}),(0,a.jsxs)("div",{className:"p-4 rounded-lg border border-border/30 bg-surface/20",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted mb-2",children:e("thisMonth")}),(0,a.jsxs)("p",{className:"text-2xl font-bold text-text-main",children:["$",k.toFixed(2)]}),w>0&&(0,a.jsx)(n,{value:k,max:w,warningAt:S})]})]}),(0,a.jsxs)("div",{className:"border-t border-border/30 pt-4",children:[(0,a.jsx)("p",{className:"text-sm font-medium mb-3",children:e("setLimits")}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-4",children:[(0,a.jsx)(i.pd,{label:"Daily Limit (USD)",type:"number",step:"0.01",min:"0",placeholder:"e.g. 5.00",value:b.dailyLimitUsd,onChange:e=>f({...b,dailyLimitUsd:e.target.value})}),(0,a.jsx)(i.pd,{label:"Monthly Limit (USD)",type:"number",step:"0.01",min:"0",placeholder:"e.g. 50.00",value:b.monthlyLimitUsd,onChange:e=>f({...b,monthlyLimitUsd:e.target.value})}),(0,a.jsx)(i.pd,{label:"Warning Threshold (%)",type:"number",min:"1",max:"100",placeholder:"80",value:b.warningThreshold,onChange:e=>f({...b,warningThreshold:e.target.value})})]}),(0,a.jsx)(i.$n,{variant:"primary",onClick:v,loading:h,children:"Save Limits"})]})]}),m?.budgetCheck&&(0,a.jsx)(i.Zp,{className:"p-4",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",style:{color:m.budgetCheck.allowed?"#22c55e":"#ef4444"},children:m.budgetCheck.allowed?"check_circle":"block"}),(0,a.jsx)("span",{className:"text-sm",children:m.budgetCheck.allowed?`Budget OK — $${(m.budgetCheck.remaining||0).toFixed(2)} remaining`:"Budget exceeded — requests may be blocked"})]})})]})}let c=["input","output","cached","reasoning","cache_creation"],m={input:"Input",output:"Output",cached:"Cached",reasoning:"Reasoning",cache_creation:"Cache Write"};function x(){let[e,t]=(0,l.useState)({}),[s,d]=(0,l.useState)({}),[n,o]=(0,l.useState)(!0),[c,m]=(0,l.useState)(!1),[x,p]=(0,l.useState)(""),[h,g]=(0,l.useState)(null),[b,f]=(0,l.useState)(new Set),[j,y]=(0,l.useState)(""),[v,N]=(0,l.useState)(new Set),w=(0,r.c)("settings");(0,l.useEffect)(()=>{C()},[]);let C=async()=>{o(!0);try{let[e,s]=await Promise.all([fetch("/api/pricing/models"),fetch("/api/pricing")]);e.ok&&t(await e.json()),s.ok&&d(await s.json())}catch(e){console.error("Failed to load pricing data:",e)}finally{o(!1)}},k=(0,l.useMemo)(()=>Object.entries(e).map(([e,t])=>({alias:e,...t,pricedModels:s[e]?Object.keys(s[e]).length:0})).sort((e,t)=>t.modelCount-e.modelCount),[e,s]),S=(0,l.useMemo)(()=>{if(!j.trim())return k;let e=j.toLowerCase();return k.filter(t=>t.alias.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||t.models.some(t=>t.id.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)))},[k,j]),L=(0,l.useMemo)(()=>{let e=k.reduce((e,t)=>e+t.modelCount,0),t=Object.values(s).reduce((e,t)=>e+Object.keys(t).length,0);return{providers:k.length,totalModels:e,pricedCount:t}},[k,s]),U=(0,l.useCallback)(e=>{f(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),T=(0,l.useCallback)((e,t,s,a)=>{let l=parseFloat(a);isNaN(l)||l<0||(d(a=>{let i={...a};return i[e]||(i[e]={}),i[e][t]||(i[e][t]={input:0,output:0,cached:0,reasoning:0,cache_creation:0}),i[e][t]={...i[e][t],[s]:l},i}),N(t=>new Set(t).add(e)))},[]),$=(0,l.useCallback)(async e=>{m(!0),p("");try{let t=s[e]||{},a=await fetch("/api/pricing",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[e]:t})});if(a.ok)p(`✅ ${e.toUpperCase()} saved`),N(t=>{let s=new Set(t);return s.delete(e),s}),setTimeout(()=>p(""),3e3);else{let e=await a.json();p(`❌ Error: ${e.error}`)}}catch(e){p(`❌ Save failed: ${e.message}`)}finally{m(!1)}},[s]),P=(0,l.useCallback)(async e=>{if(confirm(w("resetPricingConfirm",{provider:e.toUpperCase()})))try{let t=await fetch(`/api/pricing?provider=${e}`,{method:"DELETE"});if(t.ok){let s=await t.json();d(s),p(`🔄 ${e.toUpperCase()} reset to defaults`),N(t=>{let s=new Set(t);return s.delete(e),s}),setTimeout(()=>p(""),3e3)}}catch(e){p(`❌ Reset failed: ${e.message}`)}},[]),_=(0,l.useCallback)(e=>{g(t=>t===e?null:e)},[]),O=(0,l.useMemo)(()=>h?S.filter(e=>e.alias===h):S,[S,h]);return n?(0,a.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,a.jsx)("div",{className:"text-text-muted animate-pulse",children:w("loadingPricing")})}):(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between flex-wrap gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-xl font-bold",children:w("modelPricing")}),(0,a.jsx)("p",{className:"text-text-muted text-sm mt-1",children:w("modelPricingDesc")})]}),(0,a.jsxs)("div",{className:"flex gap-3 text-sm",children:[(0,a.jsxs)("div",{className:"bg-bg-subtle rounded-lg px-3 py-2 text-center",children:[(0,a.jsx)("div",{className:"text-text-muted text-xs font-semibold",children:w("providers")}),(0,a.jsx)("div",{className:"text-lg font-bold",children:L.providers})]}),(0,a.jsxs)("div",{className:"bg-bg-subtle rounded-lg px-3 py-2 text-center",children:[(0,a.jsx)("div",{className:"text-text-muted text-xs font-semibold",children:w("registry")}),(0,a.jsx)("div",{className:"text-lg font-bold",children:L.totalModels})]}),(0,a.jsxs)("div",{className:"bg-bg-subtle rounded-lg px-3 py-2 text-center",children:[(0,a.jsx)("div",{className:"text-text-muted text-xs font-semibold",children:w("priced")}),(0,a.jsx)("div",{className:"text-lg font-bold text-success",children:L.pricedCount})]})]})]}),x&&(0,a.jsx)("div",{className:"px-3 py-2 rounded-lg bg-bg-subtle border border-border text-sm",children:x}),(0,a.jsxs)("div",{className:"flex gap-3 items-center flex-wrap",children:[(0,a.jsxs)("div",{className:"relative flex-1 min-w-[200px]",children:[(0,a.jsx)("span",{className:"material-symbols-outlined absolute left-3 top-1/2 -translate-y-1/2 text-text-muted text-lg",children:"search"}),(0,a.jsx)("input",{type:"text",placeholder:w("searchProvidersModels"),value:j,onChange:e=>y(e.target.value),className:"w-full pl-10 pr-3 py-2 bg-bg-base border border-border rounded-lg focus:outline-none focus:border-primary text-sm"})]}),h&&(0,a.jsxs)("button",{onClick:()=>g(null),className:"px-3 py-2 text-xs bg-primary/10 text-primary border border-primary/20 rounded-lg hover:bg-primary/20 transition-colors flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"}),h.toUpperCase()," — ",w("showAll")]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:k.map(e=>(0,a.jsxs)("button",{onClick:()=>_(e.alias),className:`px-2.5 py-1 rounded-md text-xs font-medium transition-all ${h===e.alias?"bg-primary text-white shadow-sm":v.has(e.alias)?"bg-yellow-500/15 text-yellow-400 border border-yellow-500/30":"bg-bg-subtle text-text-muted hover:bg-bg-hover border border-transparent"}`,children:[e.alias.toUpperCase()," ",(0,a.jsxs)("span",{className:"opacity-60",children:["(",e.modelCount,")"]})]},e.alias))}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[O.map(e=>(0,a.jsx)(u,{provider:e,pricingData:s[e.alias]||{},isExpanded:b.has(e.alias),isEdited:v.has(e.alias),onToggle:()=>U(e.alias),onPricingChange:(t,s,a)=>T(e.alias,t,s,a),onSave:()=>$(e.alias),onReset:()=>P(e.alias),saving:c},e.alias)),0===O.length&&(0,a.jsx)("div",{className:"text-center py-12 text-text-muted",children:w("noProvidersMatch")})]}),(0,a.jsxs)(i.Zp,{className:"p-4 mt-2",children:[(0,a.jsxs)("h3",{className:"text-sm font-semibold mb-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm align-middle mr-1",children:"info"}),w("howPricingWorks")]}),(0,a.jsxs)("div",{className:"text-xs text-text-muted space-y-1",children:[(0,a.jsxs)("p",{children:[w("pricingDescInput")," • ",w("pricingDescOutput")," • ",w("pricingDescCached")," •"," ",w("pricingDescReasoning")," • ",w("pricingDescCacheWrite")]}),(0,a.jsx)("p",{children:w("pricingDescFormula")})]})]})]})}function u({provider:e,pricingData:t,isExpanded:s,isEdited:l,onToggle:i,onPricingChange:d,onSave:n,onReset:o,saving:x}){let u=(0,r.c)("settings"),h=Object.keys(t).length,g="oauth"===e.authType?"OAuth":"apikey"===e.authType?"API Key":e.authType;return(0,a.jsxs)("div",{className:`border rounded-lg overflow-hidden transition-colors ${l?"border-yellow-500/40 bg-yellow-500/5":"border-border"}`,children:[(0,a.jsxs)("button",{onClick:i,className:"w-full flex items-center justify-between px-4 py-3 hover:bg-bg-hover/50 transition-colors text-left",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-lg transition-transform ${s?"rotate-90":""}`,children:"chevron_right"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"font-semibold text-sm",children:e.id.charAt(0).toUpperCase()+e.id.slice(1)}),(0,a.jsxs)("span",{className:"text-text-muted text-xs ml-2",children:["(",e.alias.toUpperCase(),")"]})]}),(0,a.jsx)("span",{className:"px-1.5 py-0.5 bg-bg-subtle text-text-muted text-[10px] rounded uppercase font-semibold",children:g}),(0,a.jsx)("span",{className:"px-1.5 py-0.5 bg-bg-subtle text-text-muted text-[10px] rounded uppercase font-semibold",children:e.format})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[l&&(0,a.jsx)("span",{className:"text-yellow-500 text-xs font-medium",children:u("unsaved")}),(0,a.jsxs)("span",{className:"text-text-muted text-xs",children:[h,"/",e.modelCount," priced"]}),(0,a.jsx)("div",{className:"w-16 h-1.5 bg-bg-subtle rounded-full overflow-hidden",children:(0,a.jsx)("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${e.modelCount>0?Math.round(h/e.modelCount*100):0}%`}})})]})]}),s&&(0,a.jsxs)("div",{className:"border-t border-border",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 bg-bg-subtle/50",children:[(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:[e.modelCount," models • ",h," with pricing configured"]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{onClick:e=>{e.stopPropagation(),o()},className:"px-2.5 py-1 text-[11px] text-red-400 hover:bg-red-500/10 rounded border border-red-500/20 transition-colors",children:u("resetDefaults")}),(0,a.jsx)("button",{onClick:e=>{e.stopPropagation(),n()},disabled:x||!l,className:"px-2.5 py-1 text-[11px] bg-primary text-white rounded hover:bg-primary/90 transition-colors disabled:opacity-40",children:u(x?"saving":"saveProvider")})]})]}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{className:"text-[11px] text-text-muted uppercase bg-bg-subtle/30",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-4 py-2 text-left font-semibold",children:u("model")}),c.map(e=>(0,a.jsx)("th",{className:"px-2 py-2 text-right font-semibold w-24",children:m[e]},e))]})}),(0,a.jsx)("tbody",{className:"divide-y divide-border/50",children:e.models.map(e=>(0,a.jsx)(p,{model:e,pricing:t[e.id],onPricingChange:(t,s)=>d(e.id,t,s)},e.id))})]})})]})]})}function p({model:e,pricing:t,onPricingChange:s}){let l=t&&Object.values(t).some(e=>e>0);return(0,a.jsxs)("tr",{className:"hover:bg-bg-hover/30 group",children:[(0,a.jsx)("td",{className:"px-4 py-1.5",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${l?"bg-success":"bg-text-muted/30"}`}),(0,a.jsx)("span",{className:"font-medium text-xs",children:e.name}),e.custom&&(0,a.jsx)("span",{className:"px-1 py-0.5 text-[8px] font-bold bg-blue-500/15 text-blue-400 border border-blue-500/20 rounded uppercase",children:"custom"}),(0,a.jsx)("span",{className:"text-text-muted text-[10px] opacity-0 group-hover:opacity-100 transition-opacity",children:e.id})]})}),c.map(e=>(0,a.jsx)("td",{className:"px-2 py-1.5",children:(0,a.jsx)("input",{type:"number",step:"0.01",min:"0",value:t?.[e]||0,onChange:t=>s(e,t.target.value),className:"w-full px-2 py-1 text-right text-xs bg-transparent border border-transparent hover:border-border focus:border-primary focus:bg-bg-base rounded transition-colors outline-none tabular-nums"})},e))]})}function h(){let[e,t]=(0,l.useState)("budget"),s=(0,r.c)("costs"),d=(0,r.c)("settings");return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(i.Iz,{options:[{value:"budget",label:s("budget")},{value:"pricing",label:d("pricing")}],value:e,onChange:t}),"budget"===e&&(0,a.jsx)(o,{}),"pricing"===e&&(0,a.jsx)(x,{})]})}}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=14031)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1066],{39387:(e,t,s)=>{Promise.resolve().then(s.bind(s,73732))},73732:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>j});var a=s(95155),l=s(12115),r=s(40993),n=s(50910),i=s(5772),c=s(35144);function o(e){let t="string"==typeof e?e.trim():"";if(!t)return{key:"unknown",label:"Unknown",variant:"default",rank:0,raw:null};let s=t.toUpperCase();return s.includes("ENTERPRISE")||s.includes("CORP")||s.includes("ORG")?{key:"enterprise",label:"Enterprise",variant:"info",rank:7,raw:t}:s.includes("TEAM")||s.includes("CHATGPTTEAM")?{key:"team",label:"Team",variant:"info",rank:6,raw:t}:s.includes("BUSINESS")||s.includes("STANDARD")||s.includes("BIZ")?{key:"business",label:"Business",variant:"warning",rank:5,raw:t}:s.includes("ULTRA")?{key:"ultra",label:"Ultra",variant:"success",rank:4,raw:t}:s.includes("PRO")||s.includes("PREMIUM")?{key:"pro",label:"Pro",variant:"primary",rank:3,raw:t}:s.includes("PLUS")||s.includes("PAID")?{key:"plus",label:"Plus",variant:"secondary",rank:2,raw:t}:s.includes("FREE")||s.includes("INDIVIDUAL")||s.includes("BASIC")||s.includes("TRIAL")||s.includes("LEGACY")?{key:"free",label:"Free",variant:"default",rank:1,raw:t}:{key:"unknown",label:t.toLowerCase().split(/[\s_-]+/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")||"Unknown",variant:"default",rank:0,raw:t}}var d=s(81060),x=s(80927),u=s(92542),m=s(20909);let p={antigravity:{label:"Antigravity",color:"#F59E0B"},github:{label:"GitHub Copilot",color:"#333"},kiro:{label:"Kiro AI",color:"#FF6B35"},codex:{label:"OpenAI Codex",color:"#10A37F"},claude:{label:"Claude Code",color:"#D97757"}},h=[{key:"all",label:"All"},{key:"enterprise",label:"Enterprise"},{key:"team",label:"Team"},{key:"business",label:"Business"},{key:"ultra",label:"Ultra"},{key:"pro",label:"Pro"},{key:"plus",label:"Plus"},{key:"free",label:"Free"},{key:"unknown",label:"Unknown"}];function f(){let e=(0,n.c)("usage"),[t,s]=(0,l.useState)([]),[r,f]=(0,l.useState)({}),[b,g]=(0,l.useState)({}),[j,y]=(0,l.useState)({}),[v,N]=(0,l.useState)(!0),[k,w]=(0,l.useState)(null),[A,E]=(0,l.useState)(!1),[C,I]=(0,l.useState)(120),[S,q]=(0,l.useState)(!0),[M,P]=(0,l.useState)("all"),T=(0,l.useRef)(null),$=(0,l.useRef)(null),_=(0,l.useRef)({}),R=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/providers/client");if(!e.ok)throw Error("Failed");let t=(await e.json()).connections||[];return s(t),t}catch{return s([]),[]}},[]),L=(0,l.useCallback)(async(e,t)=>{let s=Date.now();if(!(s-(_.current[e]||0)<3e4)){_.current[e]=s,g(t=>({...t,[e]:!0})),y(t=>({...t,[e]:null}));try{let s=await fetch(`/api/usage/${e}`);if(!s.ok){let t=(await s.json().catch(()=>({}))).error||s.statusText;if(404===s.status)return;if(401===s.status)return void f(s=>({...s,[e]:{quotas:[],message:t}}));throw Error(`HTTP ${s.status}: ${t}`)}let a=await s.json(),l=function(e,t){if(!t||"object"!=typeof t)return[];let s=[];try{switch(e.toLowerCase()){case"github":default:t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"antigravity":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"codex":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"kiro":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"claude":t.message?s.push({name:"error",used:0,total:0,resetAt:null,message:t.message}):t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})})}}catch(t){return console.error(`Error parsing quota data for ${e}:`,t),[]}let a=(0,c.KC)(e);if(a.length>0){let e=new Map(a.map((e,t)=>[e.id,t]));s.sort((t,s)=>{let a=t.modelKey||t.name,l=s.modelKey||s.name;return(e.get(a)??999)-(e.get(l)??999)})}return s}(t,a);f(t=>({...t,[e]:{quotas:l,plan:a.plan||null,message:a.message||null,raw:a}}))}catch(t){y(s=>({...s,[e]:t.message||"Failed to fetch quota"}))}finally{g(t=>({...t,[e]:!1}))}}},[]),O=(0,l.useCallback)(async(e,t)=>{await L(e,t),w(new Date)},[L]),D=(0,l.useCallback)(async()=>{if(!A){E(!0),I(120);try{let e=(await R()).filter(e=>m.wb.includes(e.provider)&&"oauth"===e.authType);await Promise.all(e.map(e=>L(e.id,e.provider))),w(new Date)}catch(e){console.error("Error refreshing all:",e)}finally{E(!1)}}},[A,R,L]);(0,l.useEffect)(()=>{(async()=>{q(!0),await D(),q(!1)})()},[]),(0,l.useEffect)(()=>{if(!v){T.current&&clearInterval(T.current),$.current&&clearInterval($.current);return}return T.current=setInterval(D,12e4),$.current=setInterval(()=>{I(e=>e<=1?120:e-1)},1e3),()=>{T.current&&clearInterval(T.current),$.current&&clearInterval($.current)}},[v,D]),(0,l.useEffect)(()=>{let e=()=>{document.hidden?(T.current&&clearInterval(T.current),$.current&&clearInterval($.current)):v&&(T.current=setInterval(D,12e4),$.current=setInterval(()=>{I(e=>e<=1?120:e-1)},1e3))};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[v,D]);let U=(0,l.useMemo)(()=>t.filter(e=>m.wb.includes(e.provider)&&"oauth"===e.authType),[t]),F=(0,l.useMemo)(()=>{let e={antigravity:1,github:2,codex:3,claude:4,kiro:5};return[...U].sort((t,s)=>(e[t.provider]||9)-(e[s.provider]||9))},[U]),B=(0,l.useMemo)(()=>{let e={};for(let t of F)e[t.id]=o(r[t.id]?.plan);return e},[F,r]),G=(0,l.useMemo)(()=>{let e={all:F.length,enterprise:0,team:0,business:0,ultra:0,pro:0,free:0,unknown:0};for(let t of F){let s=B[t.id]?.key||"unknown";e[s]=(e[s]||0)+1}return e},[F,B]),K=(0,l.useMemo)(()=>"all"===M?F:F.filter(e=>(B[e.id]?.key||"unknown")===M),[F,B,M]);return S?(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(u.CardSkeleton,{}),(0,a.jsx)(u.CardSkeleton,{})]}):0===F.length?(0,a.jsx)(d.default,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[64px] opacity-15",children:"cloud_off"}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-main",children:e("noProviders")}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-[400px] mx-auto",children:"Connect to providers with OAuth to track your API quota limits and usage."})]})}):(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-text-main m-0",children:e("providerLimits")}),(0,a.jsxs)("span",{className:"text-[13px] text-text-muted",children:[K.length," account",1!==K.length?"s":"",K.length!==F.length?` (filtered from ${F.length})`:""]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("button",{onClick:()=>N(e=>!e),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-white/[0.08] bg-transparent cursor-pointer text-text-main text-[13px]",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",style:{color:v?"#22c55e":"var(--text-muted)"},children:v?"toggle_on":"toggle_off"}),"Auto-refresh",v&&(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["(",C,"s)"]})]}),(0,a.jsxs)("button",{onClick:D,disabled:A,className:"flex items-center gap-1.5 px-3.5 py-1.5 rounded-lg bg-white/[0.06] border border-white/10 text-text-main text-[13px] disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] ${A?"animate-spin":""}`,children:"refresh"}),"Refresh All"]})]})]}),(0,a.jsx)("div",{className:"flex items-center gap-2 flex-wrap",children:h.map(e=>{if("all"!==e.key&&!G[e.key])return null;let t=M===e.key;return(0,a.jsxs)("button",{onClick:()=>P(e.key),className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-semibold cursor-pointer",style:{border:t?"1px solid var(--primary, #E54D5E)":"1px solid rgba(255,255,255,0.12)",background:t?"rgba(249,120,21,0.14)":"transparent",color:t?"var(--primary, #E54D5E)":"var(--text-muted)"},children:[(0,a.jsx)("span",{children:e.label}),(0,a.jsx)("span",{className:"opacity-85",children:G[e.key]||0})]},e.key)})}),(0,a.jsxs)("div",{className:"rounded-xl border border-white/[0.06] overflow-hidden bg-black/15",children:[(0,a.jsxs)("div",{className:"items-center px-4 py-2.5 border-b border-white/[0.06] text-[11px] font-semibold uppercase tracking-wider text-text-muted",style:{display:"grid",gridTemplateColumns:"280px 1fr 100px 48px"},children:[(0,a.jsx)("div",{children:e(">account</")}),(0,a.jsx)("div",{children:e("modelQuotas")}),(0,a.jsx)("div",{className:"text-center",children:e(">lastUsed</")}),(0,a.jsx)("div",{className:"text-center",children:e(">actions</")})]}),K.map((t,s)=>{let l=r[t.id],n=b[t.id],c=j[t.id],d=p[t.provider]||{label:t.provider,color:"#666"},u=B[t.id]||o(null);return(0,a.jsxs)("div",{className:"items-center px-4 py-3.5 transition-[background] duration-150 hover:bg-white/[0.02]",style:{display:"grid",gridTemplateColumns:"280px 1fr 100px 48px",borderBottom:s<K.length-1?"1px solid rgba(255,255,255,0.04)":"none"},children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center overflow-hidden shrink-0",children:(0,a.jsx)(i.default,{src:`/providers/${t.provider}.png`,alt:t.provider,width:32,height:32,className:"object-contain",sizes:"32px"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("div",{className:"text-[13px] font-semibold text-text-main truncate",children:t.name||d.label}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mt-0.5",children:[(0,a.jsx)("span",{title:l?.plan?`Raw plan: ${l.plan}`:"No plan from provider",children:(0,a.jsx)(x.default,{variant:u.variant,size:"sm",dot:!0,children:u.label})}),(0,a.jsx)("span",{className:"text-[11px] text-text-muted",children:d.label})]})]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-x-3 gap-y-1.5 pr-3",children:n?(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-text-muted text-xs",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[14px]",children:"progress_activity"}),"Loading..."]}):c?(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-red-500",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,a.jsx)("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap max-w-[300px]",children:c})]}):l?.message&&(!l.quotas||0===l.quotas.length)?(0,a.jsx)("div",{className:"text-xs text-text-muted italic",children:l.message}):l?.quotas?.length>0?l.quotas.map((e,t)=>{var s,l,r;let n=void 0!==e.remainingPercentage?Math.round(e.remainingPercentage):(s=e.used,(l=e.total)&&0!==l?!s||s<0?100:s>=l?0:Math.round((l-s)/l*100):0),i=n>70?{bar:"#22c55e",text:"#22c55e",bg:"rgba(34,197,94,0.12)"}:n>=30?{bar:"#eab308",text:"#eab308",bg:"rgba(234,179,8,0.12)"}:{bar:"#ef4444",text:"#ef4444",bg:"rgba(239,68,68,0.12)"},c=function(e){if(!e)return null;try{let t=new Date(e)-new Date;if(t<=0)return null;let s=Math.floor(t/36e5),a=Math.floor(t%36e5/6e4);if(s>=24){let e=Math.floor(s/24);return`${e}d ${s%24}h`}return`${s}h ${a}m`}catch{return null}}(e.resetAt),o={"gemini-3-pro-high":"G3 Pro","gemini-3-pro-low":"G3 Pro Low","gemini-3-flash":"G3 Flash","gemini-2.5-flash":"G2.5 Flash","claude-opus-4-6-thinking":"Opus 4.6 Tk","claude-opus-4-5-thinking":"Opus 4.5 Tk","claude-opus-4-5":"Opus 4.5","claude-sonnet-4-5-thinking":"Sonnet 4.5 Tk","claude-sonnet-4-5":"Sonnet 4.5",chat:"Chat",completions:"Completions",premium_interactions:"Premium",session:"Session",weekly:"Weekly",agentic_request:"Agentic",agentic_request_freetrial:"Agentic (Trial)"}[r=e.name]||r;return(0,a.jsxs)("div",{className:"flex items-center gap-1.5 min-w-[200px] shrink-0",children:[(0,a.jsx)("span",{className:"text-[11px] font-semibold py-0.5 px-2 rounded whitespace-nowrap min-w-[60px] text-center",style:{background:i.bg,color:i.text},children:o}),c&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted whitespace-nowrap",children:["⏱ ",c]}),(0,a.jsx)("div",{className:"flex-1 h-1.5 rounded-sm bg-white/[0.06] min-w-[60px] overflow-hidden",children:(0,a.jsx)("div",{className:"h-full rounded-sm transition-[width] duration-300 ease-out",style:{width:`${Math.min(n,100)}%`,background:i.bar}})}),(0,a.jsxs)("span",{className:"text-[11px] font-semibold min-w-[32px] text-right",style:{color:i.text},children:[n,"%"]})]},t)}):(0,a.jsx)("div",{className:"text-xs text-text-muted italic",children:e("noQuotaData")})}),(0,a.jsx)("div",{className:"text-center text-[11px] text-text-muted",children:k?(0,a.jsx)("span",{children:k.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}):"-"}),(0,a.jsx)("div",{className:"flex justify-center gap-0.5",children:(0,a.jsx)("button",{onClick:()=>O(t.id,t.provider),disabled:n,title:"Refresh quota",className:"p-1 rounded-md border-none bg-transparent cursor-pointer disabled:cursor-not-allowed disabled:opacity-30 opacity-60 hover:opacity-100 flex items-center justify-center transition-opacity duration-150",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] text-text-muted ${n?"animate-spin":""}`,children:"refresh"})})})]},t.id)}),0===K.length&&(0,a.jsxs)("div",{className:"py-6 px-4 text-center text-text-muted text-[13px]",children:["No accounts found for tier filter"," ",(0,a.jsx)("strong",{children:h.find(e=>e.key===M)?.label||M}),"."]})]})]})}function b(){let e=(0,n.c)("usage"),[t,s]=(0,l.useState)({lockouts:[],cacheStats:null}),[i,c]=(0,l.useState)(!0),o=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/rate-limits");e.ok&&s(await e.json())}catch{}finally{c(!1)}},[]);return(0,l.useEffect)(()=>{o();let e=setInterval(o,1e4);return()=>clearInterval(e)},[o]),(0,a.jsx)("div",{className:"flex flex-col gap-4",children:(0,a.jsxs)(r.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-orange-500/10 text-orange-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"lock_clock"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Model Lockouts"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Per-model rate limit locks • Auto-refresh 10s"})]}),t.lockouts.length>0&&(0,a.jsxs)("span",{className:"px-2.5 py-1 rounded-full text-xs font-semibold bg-orange-500/10 text-orange-400 border border-orange-500/20",children:[t.lockouts.length," locked"]})]}),0===t.lockouts.length?(0,a.jsxs)("div",{className:"text-center py-6 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[32px] mb-2 block opacity-40",children:"lock_open"}),(0,a.jsx)("p",{className:"text-sm",children:e("noLockouts")})]}):(0,a.jsx)("div",{className:"flex flex-col gap-2",children:t.lockouts.map((e,t)=>{var s;return(0,a.jsxs)("div",{className:"flex items-center justify-between px-3 py-2.5 rounded-lg bg-orange-500/5 border border-orange-500/15",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-orange-400",children:"lock"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:e.model}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Account:"," ",(0,a.jsx)("span",{className:"font-mono",children:e.accountId?.slice(0,12)||"N/A"}),e.reason&&(0,a.jsxs)(a.Fragment,{children:[" — ",e.reason]})]})]})]}),(0,a.jsxs)("span",{className:"text-xs font-mono tabular-nums text-orange-400",children:[(s=e.remainingMs)<1e3?`${s}ms`:s<6e4?`${Math.ceil(s/1e3)}s`:`${Math.ceil(s/6e4)}m`," left"]})]},t)})})]})})}function g(){let e=(0,n.c)("usage"),[t,s]=(0,l.useState)({count:0,sessions:[]}),[i,c]=(0,l.useState)(!0),o=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/sessions");e.ok&&s(await e.json())}catch{}finally{c(!1)}},[]);return(0,l.useEffect)(()=>{o();let e=setInterval(o,5e3);return()=>clearInterval(e)},[o]),(0,a.jsxs)(r.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-cyan-500/10 text-cyan-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"fingerprint"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:e("activeSessions")}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Tracked via request fingerprinting • Auto-refresh 5s"})]}),(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsxs)("span",{className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-cyan-500/10 border border-cyan-500/20",children:[(0,a.jsx)("span",{className:"w-2 h-2 rounded-full bg-cyan-500 animate-pulse"}),(0,a.jsx)("span",{className:"text-sm font-semibold tabular-nums text-cyan-400",children:t.count})]})})]}),0===t.sessions.length?(0,a.jsxs)("div",{className:"text-center py-8 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[40px] mb-2 block opacity-40",children:"fingerprint"}),(0,a.jsx)("p",{className:"text-sm",children:e("noSessions")}),(0,a.jsx)("p",{className:"text-xs mt-1",children:e("sessionsHint")})]}):(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-border/30",children:[(0,a.jsx)("th",{className:"text-left py-2 px-3 text-xs font-semibold text-text-muted uppercase tracking-wider",children:e(">session</")}),(0,a.jsx)("th",{className:"text-left py-2 px-3 text-xs font-semibold text-text-muted uppercase tracking-wider",children:e(">age</")}),(0,a.jsx)("th",{className:"text-right py-2 px-3 text-xs font-semibold text-text-muted uppercase tracking-wider",children:e(">requests</")}),(0,a.jsx)("th",{className:"text-left py-2 px-3 text-xs font-semibold text-text-muted uppercase tracking-wider",children:e(">connection</")})]})}),(0,a.jsx)("tbody",{children:t.sessions.map(e=>{var t;return(0,a.jsxs)("tr",{className:"border-b border-border/10 hover:bg-surface/20 transition-colors",children:[(0,a.jsx)("td",{className:"py-2.5 px-3",children:(0,a.jsxs)("span",{className:"font-mono text-xs px-2 py-1 rounded bg-surface/40 text-text-muted",children:[e.sessionId.slice(0,12),"…"]})}),(0,a.jsx)("td",{className:"py-2.5 px-3 text-text-muted tabular-nums",children:(t=e.ageMs)<6e4?`${Math.floor(t/1e3)}s`:t<36e5?`${Math.floor(t/6e4)}m`:`${Math.floor(t/36e5)}h`}),(0,a.jsx)("td",{className:"py-2.5 px-3 text-right",children:(0,a.jsx)("span",{className:"font-semibold tabular-nums",children:e.requestCount})}),(0,a.jsx)("td",{className:"py-2.5 px-3",children:e.connectionId?(0,a.jsx)("span",{className:"text-xs font-mono text-cyan-400",children:e.connectionId.slice(0,10)}):(0,a.jsx)("span",{className:"text-text-muted/40",children:"—"})})]},e.sessionId)})})]})})]})}function j(){return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(r.Qv,{}),children:(0,a.jsx)(f,{})}),(0,a.jsx)(b,{}),(0,a.jsx)(g,{})]})}}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=39387)),_N_E=e.O()}]);