9router 0.2.16 → 0.2.17
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.
- package/LICENSE +4 -0
- package/app/.next/BUILD_ID +1 -1
- package/app/.next/app-build-manifest.json +136 -136
- package/app/.next/app-path-routes-manifest.json +19 -19
- package/app/.next/build-manifest.json +5 -5
- package/app/.next/prerender-manifest.json +34 -34
- package/app/.next/react-loadable-manifest.json +13 -0
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js +5 -5
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_not-found/page.js +2 -2
- package/app/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_not-found.html +1 -1
- package/app/.next/server/app/_not-found.rsc +2 -2
- package/app/.next/server/app/api/cli-tools/claude-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/codex-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/auth/route.js +1 -1
- package/app/.next/server/app/api/cloud/auth/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/credentials/update/route.js +1 -1
- package/app/.next/server/app/api/cloud/credentials/update/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/model/resolve/route.js +1 -1
- package/app/.next/server/app/api/cloud/model/resolve/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/models/alias/route.js +1 -1
- package/app/.next/server/app/api/cloud/models/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/[id]/route.js +1 -1
- package/app/.next/server/app/api/combos/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/route.js +1 -1
- package/app/.next/server/app/api/combos/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/init/route.js +1 -1
- package/app/.next/server/app/api/init/route.js.nft.json +1 -1
- package/app/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/keys/[id]/route.js +1 -1
- package/app/.next/server/app/api/keys/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/keys/route.js +1 -1
- package/app/.next/server/app/api/keys/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/alias/route.js +1 -1
- package/app/.next/server/app/api/models/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/route.js +1 -1
- package/app/.next/server/app/api/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/[provider]/[action]/route.js +1 -1
- package/app/.next/server/app/api/oauth/[provider]/[action]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/models/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/test/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/test/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/client/route.js +1 -1
- package/app/.next/server/app/api/providers/client/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/route.js +1 -1
- package/app/.next/server/app/api/providers/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/validate/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/route.js +1 -1
- package/app/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/sync/cloud/route.js +1 -1
- package/app/.next/server/app/api/sync/cloud/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/sync/initialize/route.js +1 -1
- package/app/.next/server/app/api/sync/initialize/route.js.nft.json +1 -1
- package/app/.next/server/app/api/sync/initialize/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/tags/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/[connectionId]/route.js +1 -1
- package/app/.next/server/app/api/usage/[connectionId]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/api/chat/route.js +1 -1
- package/app/.next/server/app/api/v1/api/chat/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/api/chat/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/chat/completions/route.js +1 -1
- package/app/.next/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/chat/completions/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/messages/count_tokens/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/messages/route.js +1 -1
- package/app/.next/server/app/api/v1/messages/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/messages/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/responses/route.js +1 -1
- package/app/.next/server/app/api/v1/responses/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/responses/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1beta/models/[...path]/route.js +1 -1
- package/app/.next/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1beta/models/[...path]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1beta/models/route.js +1 -1
- package/app/.next/server/app/api/v1beta/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1beta/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback/page.js +1 -1
- package/app/.next/server/app/callback/page.js.nft.json +1 -1
- package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback.html +1 -1
- package/app/.next/server/app/callback.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next/server/app/dashboard/cli-tools.rsc +4 -4
- package/app/.next/server/app/dashboard/combos.html +1 -1
- package/app/.next/server/app/dashboard/combos.rsc +4 -4
- package/app/.next/server/app/dashboard/endpoint.html +1 -1
- package/app/.next/server/app/dashboard/endpoint.rsc +4 -4
- package/app/.next/server/app/dashboard/profile.html +1 -1
- package/app/.next/server/app/dashboard/profile.rsc +4 -4
- package/app/.next/server/app/dashboard/providers/new.html +1 -1
- package/app/.next/server/app/dashboard/providers/new.rsc +4 -4
- package/app/.next/server/app/dashboard/providers.html +1 -1
- package/app/.next/server/app/dashboard/providers.rsc +4 -4
- package/app/.next/server/app/dashboard.html +1 -1
- package/app/.next/server/app/dashboard.rsc +4 -4
- package/app/.next/server/app/index.html +1 -1
- package/app/.next/server/app/index.rsc +2 -2
- package/app/.next/server/app/landing/page.js +1 -1
- package/app/.next/server/app/landing/page.js.nft.json +1 -1
- package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/landing.html +1 -1
- package/app/.next/server/app/landing.rsc +2 -2
- package/app/.next/server/app/page.js +1 -1
- package/app/.next/server/app/page.js.nft.json +1 -1
- package/app/.next/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app-paths-manifest.json +19 -19
- package/app/.next/server/chunks/1354.js +3 -3
- package/app/.next/server/chunks/3103.js +1 -1
- package/app/.next/server/chunks/5170.js +1 -1
- package/app/.next/server/chunks/533.js +1 -0
- package/app/.next/server/chunks/{6689.js → 5451.js} +2 -2
- package/app/.next/server/chunks/5977.js +1 -1
- package/app/.next/server/chunks/9858.js +1 -0
- package/app/.next/server/middleware-build-manifest.js +1 -1
- package/app/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/app/.next/server/pages/404.html +1 -1
- package/app/.next/server/pages/500.html +1 -1
- package/app/.next/server/webpack-runtime.js +1 -1
- package/app/.next/static/chunks/1393-74e0710828062f40.js +1 -0
- package/app/.next/static/chunks/2819-00dd2839ed1323e4.js +1 -0
- package/app/.next/static/chunks/3431.b7e68d807c631773.js +1 -0
- package/app/.next/static/chunks/9220.745ac8c97d067b9a.js +1 -0
- package/app/.next/static/chunks/9955-cba200dfd971f126.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-1ef1ec29086061fd.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/page-f18c8b5778e91a72.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/endpoint/page-636932605724d0ce.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/page-81c3e3fb971037c1.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/profile/page-327e2f8b73368cc2.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-800270dff34413c0.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/new/page-9e075d79ef785c9b.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-eea1c0bf95c10035.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/{layout-239cdcb35472d644.js → layout-65f98ae0eccfc7b8.js} +1 -1
- package/app/.next/static/chunks/webpack-5865472aea7b6340.js +1 -0
- package/app/package.json +2 -0
- package/cli.js +11 -38
- package/package.json +1 -1
- package/app/.next/server/chunks/1582.js +0 -1
- package/app/.next/server/chunks/3576.js +0 -1
- package/app/.next/static/chunks/1393-c0bf788a0bc19102.js +0 -1
- package/app/.next/static/chunks/4244-0a98cf2e73799efe.js +0 -1
- package/app/.next/static/chunks/9955-a027f64b1a9bf4e5.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-9009a2a4fdcd878c.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/page-95da854765deba41.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/endpoint/page-98e477f1e2603f2b.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/page-1dce481cbcf036bc.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/profile/page-c3dd45dfdb0b9dec.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-60e73b7047f9e428.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/new/page-1f016f32f42ef1f9.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-407c2ce547816028.js +0 -1
- package/app/.next/static/chunks/webpack-e009a29a8139b7cb.js +0 -1
- /package/app/.next/static/{CjtizKLK3s08esa00wWI0 → jTOq4rGDmshmQFiyCGWaU}/_buildManifest.js +0 -0
- /package/app/.next/static/{CjtizKLK3s08esa00wWI0 → jTOq4rGDmshmQFiyCGWaU}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3649],{3170:(e,t,s)=>{"use strict";s.a(e,async(e,l)=>{try{s.r(t),s.d(t,{default:()=>r});var a=s(5155),o=s(2115),i=s(2819),n=s(2694),c=e([i]);i=(c.then?(await c)():c)[0];let x=/^[a-zA-Z0-9_-]+$/;function r(){let[e,t]=(0,o.useState)([]),[s,l]=(0,o.useState)(!0),[c,r]=(0,o.useState)(!1),[x,h]=(0,o.useState)(null),[u,p]=(0,o.useState)([]),{copied:b,copy:j}=(0,n.C)();(0,o.useEffect)(()=>{f()},[]);let f=async()=>{try{let[e,s]=await Promise.all([fetch("/api/combos"),fetch("/api/providers")]),l=await e.json(),a=await s.json();if(e.ok&&t(l.combos||[]),s.ok){let e=(a.connections||[]).filter(e=>"active"===e.testStatus||"success"===e.testStatus);p(e)}}catch(e){console.log("Error fetching data:",e)}finally{l(!1)}},v=async e=>{try{let t=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.ok)await f(),r(!1);else{let e=await t.json();alert(e.error||"Failed to create combo")}}catch(e){console.log("Error creating combo:",e)}},y=async(e,t)=>{try{let s=await fetch("/api/combos/".concat(e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(s.ok)await f(),h(null);else{let e=await s.json();alert(e.error||"Failed to update combo")}}catch(e){console.log("Error updating combo:",e)}},N=async s=>{if(confirm("Delete this combo?"))try{(await fetch("/api/combos/".concat(s),{method:"DELETE"})).ok&&t(e.filter(e=>e.id!==s))}catch(e){console.log("Error deleting combo:",e)}};return s?(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(i.Qv,{}),(0,a.jsx)(i.Qv,{})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-semibold",children:"Combos"}),(0,a.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Create model combos with fallback support"})]}),(0,a.jsx)(i.$n,{icon:"add",onClick:()=>r(!0),children:"Create Combo"})]}),0===e.length?(0,a.jsx)(i.Zp,{children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-5xl text-text-muted mb-3 block",children:"layers"}),(0,a.jsx)("p",{className:"text-text-muted mb-4",children:"No combos yet"}),(0,a.jsx)(i.$n,{icon:"add",onClick:()=>r(!0),children:"Create your first combo"})]})}):(0,a.jsx)("div",{className:"flex flex-col gap-4",children:e.map(e=>(0,a.jsx)(d,{combo:e,copied:b,onCopy:j,onEdit:()=>h(e),onDelete:()=>N(e.id)},e.id))}),(0,a.jsx)(m,{isOpen:c,onClose:()=>r(!1),onSave:v,activeProviders:u},"create"),(0,a.jsx)(m,{isOpen:!!x,combo:x,onClose:()=>h(null),onSave:e=>y(x.id,e),activeProviders:u},(null==x?void 0:x.id)||"new")]})}function d(e){let{combo:t,copied:s,onCopy:l,onEdit:o,onDelete:n}=e;return(0,a.jsx)(i.Zp,{children:(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary",children:"layers"}),(0,a.jsx)("code",{className:"text-lg font-semibold font-mono",children:t.name}),(0,a.jsx)("button",{onClick:()=>l(t.name,"combo-".concat(t.id)),className:"p-1 hover:bg-sidebar rounded text-text-muted hover:text-primary",title:"Copy combo name",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:s==="combo-".concat(t.id)?"check":"content_copy"})})]}),(0,a.jsx)("div",{className:"flex flex-col gap-1.5",children:0===t.models.length?(0,a.jsx)("p",{className:"text-sm text-text-muted italic",children:"No models added"}):t.models.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("span",{className:"text-xs text-text-muted w-5",children:[t+1,"."]}),(0,a.jsx)("code",{className:"text-sm font-mono bg-sidebar px-2 py-0.5 rounded",children:e}),0===t&&(0,a.jsx)("span",{className:"text-xs text-primary font-medium",children:"Primary"}),t>0&&(0,a.jsx)("span",{className:"text-xs text-text-muted",children:"Fallback"})]},t))})]}),(0,a.jsxs)("div",{className:"flex gap-1",children:[(0,a.jsx)("button",{onClick:o,className:"p-2 hover:bg-sidebar rounded text-text-muted hover:text-primary",title:"Edit",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"edit"})}),(0,a.jsx)("button",{onClick:n,className:"p-2 hover:bg-red-50 rounded text-red-500",title:"Delete",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"delete"})})]})]})})}function m(e){let{isOpen:t,combo:s,onClose:l,onSave:n,activeProviders:c}=e,[r,d]=(0,o.useState)((null==s?void 0:s.name)||""),[m,h]=(0,o.useState)((null==s?void 0:s.models)||[]),[u,p]=(0,o.useState)(!1),[b,j]=(0,o.useState)(!1),[f,v]=(0,o.useState)(""),[y,N]=(0,o.useState)({});(0,o.useEffect)(()=>{t&&(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&N(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}})()},[t]);let g=e=>e.trim()?x.test(e)?(v(""),!0):(v("Only letters, numbers, - and _ allowed"),!1):(v("Name is required"),!1),C=async()=>{g(r)&&(j(!0),await n({name:r.trim(),models:m}),j(!1))},k=!!s;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.aF,{isOpen:t,onClose:l,title:k?"Edit Combo":"Create Combo",size:"md",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(i.pd,{label:"Combo Name",value:r,onChange:e=>{let t=e.target.value;d(t),t?g(t):v("")},placeholder:"my-combo",error:f}),(0,a.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Only letters, numbers, - and _ allowed"})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("label",{className:"text-sm font-medium",children:"Models"}),(0,a.jsx)(i.$n,{size:"sm",variant:"secondary",icon:"add",onClick:()=>p(!0),children:"Add Model"})]}),0===m.length?(0,a.jsxs)("div",{className:"text-center py-6 border border-dashed border-border rounded-lg",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No models added"}),(0,a.jsx)("p",{className:"text-xs text-text-muted mt-1",children:'Click "Add Model" to add'})]}):(0,a.jsx)("div",{className:"flex flex-col gap-2 max-h-[240px] overflow-y-auto",children:m.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-0",children:[(0,a.jsx)("button",{onClick:()=>(e=>{if(0===e)return;let t=[...m];[t[e-1],t[e]]=[t[e],t[e-1]],h(t)})(t),disabled:0===t,className:"p-0.5 rounded ".concat(0===t?"text-text-muted/30":"hover:bg-surface text-text-muted hover:text-primary"),children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm leading-none",children:"keyboard_arrow_up"})}),(0,a.jsx)("button",{onClick:()=>(e=>{if(e===m.length-1)return;let t=[...m];[t[e],t[e+1]]=[t[e+1],t[e]],h(t)})(t),disabled:t===m.length-1,className:"p-0.5 rounded ".concat(t===m.length-1?"text-text-muted/30":"hover:bg-surface text-text-muted hover:text-primary"),children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm leading-none",children:"keyboard_arrow_down"})})]}),(0,a.jsx)(i.pd,{value:e,onChange:e=>((e,t)=>{let s=[...m];s[e]=t,h(s)})(t,e.target.value),placeholder:"model-name",className:"flex-1"}),(0,a.jsx)("button",{onClick:()=>{h(m.filter((e,s)=>s!==t))},className:"p-2 hover:bg-red-50 rounded text-red-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})})]},t))})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-2",children:[(0,a.jsx)(i.$n,{onClick:C,fullWidth:!0,disabled:!r.trim()||!!f||b,children:b?"Saving...":"Apply"}),(0,a.jsx)(i.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}),(0,a.jsx)(i.rq,{isOpen:u,onClose:()=>p(!1),onSelect:e=>{m.includes(e.value)||h([...m,e.value])},activeProviders:c,modelAliases:y,title:"Add Model to Combo"})]})}l()}catch(e){l(e)}})},3822:(e,t,s)=>{Promise.resolve().then(s.bind(s,3170))}},e=>{e.O(0,[1760,9955,2819,8441,1255,7358],()=>e(e.s=3822)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6099],{},_=>{_.O(0,[1760,9955,2819,1393,8441,1255,7358],()=>_(_.s=1393)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6337],{},_=>{_.O(0,[1760,9955,2819,1393,8441,1255,7358],()=>_(_.s=1393)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3471],{4074:(e,s,t)=>{"use strict";t.a(e,async(e,l)=>{try{t.r(s),t.d(s,{default:()=>n});var a=t(5155),r=t(2819),d=t(5157),c=t(4156),i=e([r,d,c]);function n(){let{theme:e,setTheme:s,isDark:t}=(0,d.D)();return(0,a.jsx)("div",{className:"max-w-2xl mx-auto",children:(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)(r.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-4 mb-4",children:[(0,a.jsx)("div",{className:"size-12 rounded-lg bg-green-500/10 text-green-500 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-2xl",children:"computer"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-xl font-semibold",children:"Local Mode"}),(0,a.jsx)("p",{className:"text-text-muted",children:"Running on your machine"})]})]}),(0,a.jsx)("div",{className:"pt-4 border-t border-border",children:(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["All data is stored locally in the ",(0,a.jsx)("code",{className:"bg-sidebar px-1 rounded",children:"data/db.json"})," file."]})})]}),(0,a.jsxs)(r.Zp,{children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-4",children:"Appearance"}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Dark Mode"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Switch between light and dark themes"})]}),(0,a.jsx)(r.lM,{checked:t,onChange:()=>s(t?"light":"dark")})]}),(0,a.jsx)("div",{className:"flex gap-3 pt-4 border-t border-border",children:["light","dark","system"].map(t=>(0,a.jsxs)("button",{onClick:()=>s(t),className:"flex-1 flex flex-col items-center gap-2 p-4 rounded-lg border transition-all ".concat(e===t?"border-primary bg-primary/5":"border-border hover:border-primary/50"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-2xl",children:"light"===t?"light_mode":"dark"===t?"dark_mode":"contrast"}),(0,a.jsx)("span",{className:"text-sm font-medium capitalize",children:t})]},t))})]})]}),(0,a.jsxs)(r.Zp,{children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-4",children:"Data"}),(0,a.jsx)("div",{className:"flex flex-col gap-3",children:(0,a.jsx)("div",{className:"flex items-center justify-between p-4 rounded-lg bg-bg border border-border",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Database Location"}),(0,a.jsx)("p",{className:"text-sm text-text-muted font-mono",children:"~/9router/data/db.json"})]})})})]}),(0,a.jsxs)("div",{className:"text-center text-sm text-text-muted py-4",children:[(0,a.jsxs)("p",{children:[c.vQ.name," v",c.vQ.version]}),(0,a.jsx)("p",{className:"mt-1",children:"Local Mode - All data stored on your machine"})]})]})})}[r,d,c]=i.then?(await i)():i,l()}catch(e){l(e)}})},6086:(e,s,t)=>{Promise.resolve().then(t.bind(t,4074))}},e=>{e.O(0,[1760,9955,2819,8441,1255,7358],()=>e(e.s=6086)),_N_E=e.O()}]);
|
package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-800270dff34413c0.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{2397:(e,t,s)=>{Promise.resolve().then(s.bind(s,5259))},5259:(e,t,s)=>{"use strict";s.a(e,async(e,a)=>{try{s.r(t),s.d(t,{default:()=>h});var l=s(5155),r=s(2115),i=s(63),n=s(2619),o=s.n(n);s(5239);var c=s(2819),d=s(9608),m=s(9576),x=s(4156),p=s(2694),u=e([c,m,x]);function h(){let e=(0,i.useParams)().id,[t,s]=(0,r.useState)([]),[a,n]=(0,r.useState)(!0),[x,u]=(0,r.useState)(!1),[h,v]=(0,r.useState)(!1),[j,w]=(0,r.useState)(!1),[C,k]=(0,r.useState)(null),[S,E]=(0,r.useState)({}),{copied:A,copy:O}=(0,p.C)(),P=d.zN[e]||d.fg[e],T=!!d.zN[e],D=(0,m.KC)(e),I=(0,d.wG)(e);(0,r.useEffect)(()=>{U(),K()},[e]);let K=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&E(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},_=async(e,t)=>{let s="".concat(I,"/").concat(e);try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:s,alias:t})});if(e.ok)await K();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},M=async e=>{try{(await fetch("/api/models/alias?alias=".concat(encodeURIComponent(e)),{method:"DELETE"})).ok&&await K()}catch(e){console.log("Error deleting alias:",e)}},U=async()=>{try{let t=await fetch("/api/providers"),a=await t.json();if(t.ok){let t=(a.connections||[]).filter(t=>t.provider===e);s(t)}}catch(e){console.log("Error fetching connections:",e)}finally{n(!1)}},L=async e=>{if(confirm("Delete this connection?"))try{(await fetch("/api/providers/".concat(e),{method:"DELETE"})).ok&&s(t.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}},$=async t=>{try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,...t})})).ok&&(await U(),v(!1))}catch(e){console.log("Error saving connection:",e)}},z=async e=>{try{(await fetch("/api/providers/".concat(C.id),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await U(),w(!1))}catch(e){console.log("Error updating connection:",e)}},F=async(e,t)=>{if(e&&t)try{await Promise.all([fetch("/api/providers/".concat(e.id),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t.priority})}),fetch("/api/providers/".concat(t.id),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e.priority})})]),await U()}catch(e){console.log("Error swapping priority:",e)}};return P?a?(0,l.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,l.jsx)(c.Qv,{}),(0,l.jsx)(c.Qv,{})]}):(0,l.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)(o(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,l.jsxs)("div",{className:"flex items-center gap-4",children:[(0,l.jsx)("div",{className:"rounded-lg flex items-center justify-center",style:{backgroundColor:"".concat(P.color,"15")},children:(0,l.jsx)("img",{src:"/providers/".concat(P.id,".png"),alt:P.name,className:"size-12 object-contain rounded-lg",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:P.name}),(0,l.jsxs)("p",{className:"text-text-muted",children:[t.length," connection",1!==t.length?"s":""]})]})]})]}),(0,l.jsxs)(c.Zp,{children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,l.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,l.jsx)(c.$n,{size:"sm",icon:"add",onClick:()=>T?u(!0):v(!0),children:"Add"})]}),0===t.length?(0,l.jsxs)("div",{className:"text-center py-8",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-4xl text-text-muted mb-2",children:T?"lock":"key"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"})]}):(0,l.jsx)("div",{className:"flex flex-col gap-2",children:t.sort((e,t)=>(e.priority||0)-(t.priority||0)).map((e,s)=>(0,l.jsx)(b,{connection:e,isOAuth:T,isFirst:0===s,isLast:s===t.length-1,onMoveUp:()=>F(e,t[s-1]),onMoveDown:()=>F(e,t[s+1]),onEdit:()=>{k(e),w(!0)},onDelete:()=>L(e.id)},e.id))})]}),(0,l.jsxs)(c.Zp,{children:[(0,l.jsx)("h2",{className:"text-lg font-semibold mb-4",children:P.passthroughModels?"Model Aliases":"Available Models"}),P.passthroughModels?(0,l.jsx)(f,{providerAlias:I,modelAliases:S,copied:A,onCopy:O,onSetAlias:_,onDeleteAlias:M}):0===D.length?(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"No models configured"}):(0,l.jsx)("div",{className:"flex flex-wrap gap-3",children:D.map(t=>{var s;let a="".concat(I,"/").concat(t.id),r="".concat(e,"/").concat(t.id),i=null==(s=Object.entries(S).find(e=>{let[,t]=e;return t===a||t===r}))?void 0:s[0];return(0,l.jsx)(y,{model:t,fullModel:a,alias:i,copied:A,onCopy:O,onSetAlias:e=>_(t.id,e),onDeleteAlias:()=>M(i)},t.id)})})]}),(0,l.jsx)(c.LF,{isOpen:x,provider:e,providerInfo:P,onSuccess:()=>{U(),u(!1)},onClose:()=>u(!1)}),(0,l.jsx)(g,{isOpen:h,provider:e,onSave:$,onClose:()=>v(!1)}),(0,l.jsx)(N,{isOpen:j,connection:C,onSave:z,onClose:()=>w(!1)})]}):(0,l.jsxs)("div",{className:"text-center py-20",children:[(0,l.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,l.jsx)(o(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}function y(e){let{model:t,fullModel:s,alias:a,copied:r,onCopy:i}=e;return(0,l.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-border hover:bg-sidebar/50",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:"smart_toy"}),(0,l.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:s}),(0,l.jsx)("button",{onClick:()=>i(s,"model-".concat(t.id)),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",title:"Copy model",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-sm",children:r==="model-".concat(t.id)?"check":"content_copy"})})]})}function f(e){let{providerAlias:t,modelAliases:s,copied:a,onCopy:i,onSetAlias:n,onDeleteAlias:o}=e,[d,m]=(0,r.useState)(""),[x,p]=(0,r.useState)(!1),u=Object.entries(s).filter(e=>{let[,s]=e;return s.startsWith("".concat(t,"/"))}).map(e=>{let[s,a]=e;return{modelId:a.replace("".concat(t,"/"),""),fullModel:a,alias:s}}),h=async()=>{if(!d.trim()||x)return;let e=d.trim(),t=(e=>{let t=e.split("/");return t[t.length-1]})(e);if(s[t])return void alert('Alias "'.concat(t,'" already exists. Please use a different model or edit existing alias.'));p(!0);try{await n(e,t),m("")}catch(e){console.log("Error adding model:",e)}finally{p(!1)}};return(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"OpenRouter supports any model. Add models and create aliases for quick access."}),(0,l.jsxs)("div",{className:"flex items-end gap-2",children:[(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Model ID (from OpenRouter)"}),(0,l.jsx)("input",{type:"text",value:d,onChange:e=>m(e.target.value),onKeyDown:e=>"Enter"===e.key&&h(),placeholder:"anthropic/claude-3-opus",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,l.jsx)(c.$n,{size:"sm",icon:"add",onClick:h,disabled:!d.trim()||x,children:x?"Adding...":"Add"})]}),u.length>0&&(0,l.jsx)("div",{className:"flex flex-col gap-3",children:u.map(e=>{let{modelId:t,fullModel:s,alias:r}=e;return(0,l.jsx)(v,{modelId:t,fullModel:s,copied:a,onCopy:i,onDeleteAlias:()=>o(r)},s)})})]})}function v(e){let{modelId:t,fullModel:s,copied:a,onCopy:r,onDeleteAlias:i}=e;return(0,l.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-lg border border-border hover:bg-sidebar/50",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:"smart_toy"}),(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsx)("p",{className:"text-sm font-medium truncate",children:t}),(0,l.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,l.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:s}),(0,l.jsx)("button",{onClick:()=>r(s,"model-".concat(t)),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",title:"Copy model",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-sm",children:a==="model-".concat(t)?"check":"content_copy"})})]})]}),(0,l.jsx)("button",{onClick:i,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function j(e){let{until:t}=e,[s,a]=(0,r.useState)("");return((0,r.useEffect)(()=>{let e=()=>{let e=new Date(t).getTime()-Date.now();if(e<=0)return void a("");let s=Math.floor(e/1e3);if(s<60)a("".concat(s,"s"));else if(s<3600)a("".concat(Math.floor(s/60),"m ").concat(s%60,"s"));else{let e=Math.floor(s/3600),t=Math.floor(s%3600/60);a("".concat(e,"h ").concat(t,"m"))}};e();let s=setInterval(e,1e3);return()=>clearInterval(s)},[t]),s)?(0,l.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",s]}):null}function b(e){let{connection:t,isOAuth:s,isFirst:a,isLast:i,onMoveUp:n,onMoveDown:o,onEdit:d,onDelete:m}=e,x=s?t.name||t.email||t.displayName||"OAuth Account":t.name,[p,u]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e=()=>{let e=t.rateLimitedUntil&&new Date(t.rateLimitedUntil).getTime()>Date.now();u(e)};e();let s=t.rateLimitedUntil?setInterval(e,1e3):null;return()=>{s&&clearInterval(s)}},[t.rateLimitedUntil]);let h="unavailable"!==t.testStatus||p?t.testStatus:"active";return(0,l.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg border border-border hover:bg-sidebar/50 hover:cursor-pointer",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,l.jsxs)("div",{className:"flex flex-col",children:[(0,l.jsx)("button",{onClick:n,disabled:a,className:"p-0.5 rounded ".concat(a?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"),children:(0,l.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,l.jsx)("button",{onClick:o,disabled:i,className:"p-0.5 rounded ".concat(i?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"),children:(0,l.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,l.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:s?"lock":"key"}),(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsx)("p",{className:"text-sm font-medium truncate",children:x}),(0,l.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,l.jsx)(c.Ex,{variant:"active"===h||"success"===h?"success":"error"===h||"expired"===h||"unavailable"===h?"error":"default",size:"sm",dot:!0,children:h||"Unknown"}),p&&(0,l.jsx)(j,{until:t.rateLimitedUntil}),t.lastError&&(0,l.jsx)("span",{className:"text-xs text-red-500 truncate max-w-[300px]",title:t.lastError,children:t.lastError}),(0,l.jsxs)("span",{className:"text-xs text-text-muted",children:["#",t.priority]}),t.globalPriority&&(0,l.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",t.globalPriority]})]})]})]}),(0,l.jsxs)("div",{className:"flex gap-1",children:[(0,l.jsx)("button",{onClick:d,className:"p-2 hover:bg-sidebar rounded",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-base",children:"edit"})}),(0,l.jsx)("button",{onClick:m,className:"p-2 hover:bg-red-50 rounded text-red-500",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-base",children:"delete"})})]})]})}function g(e){let{isOpen:t,provider:s,onSave:a,onClose:i}=e,[n,o]=(0,r.useState)({name:"",apiKey:"",priority:1}),[d,m]=(0,r.useState)(!1),[x,p]=(0,r.useState)(null),u=async()=>{m(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:s,apiKey:n.apiKey})}),t=await e.json();p(t.valid?"success":"failed")}catch(e){p("failed")}finally{m(!1)}};return s?(0,l.jsx)(c.aF,{isOpen:t,title:"Add ".concat(s," API Key"),onClose:i,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsx)(c.pd,{label:"Name",value:n.name,onChange:e=>o({...n,name:e.target.value}),placeholder:"Production Key"}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(c.pd,{label:"API Key",type:"password",value:n.apiKey,onChange:e=>o({...n,apiKey:e.target.value}),className:"flex-1"}),(0,l.jsx)("div",{className:"pt-6",children:(0,l.jsx)(c.$n,{onClick:u,disabled:!n.apiKey||d,variant:"secondary",children:d?"Checking...":"Check"})})]}),x&&(0,l.jsx)(c.Ex,{variant:"success"===x?"success":"error",children:"success"===x?"Valid":"Invalid"}),(0,l.jsx)(c.pd,{label:"Priority",type:"number",value:n.priority,onChange:e=>o({...n,priority:parseInt(e.target.value)||1})}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(c.$n,{onClick:()=>{a({name:n.name,apiKey:n.apiKey,priority:n.priority,testStatus:"success"===x?"active":"unknown"})},fullWidth:!0,disabled:!n.name||!n.apiKey,children:"Save"}),(0,l.jsx)(c.$n,{onClick:i,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function N(e){let{isOpen:t,connection:s,onSave:a,onClose:i}=e,[n,o]=(0,r.useState)({name:"",priority:1}),[d,m]=(0,r.useState)(!1),[x,p]=(0,r.useState)(null);(0,r.useEffect)(()=>{s&&(o({name:s.name||"",priority:s.priority||1}),p(null))},[s]);let u=async()=>{if(null==s?void 0:s.provider){m(!0),p(null);try{let e=await fetch("/api/providers/".concat(s.id,"/test"),{method:"POST"}),t=await e.json();p(t.valid?"success":"failed"),t.valid?a({testStatus:"active",lastError:null,lastErrorAt:null}):a({testStatus:"error",lastError:t.error,lastErrorAt:new Date().toISOString()})}catch(e){p("failed")}finally{m(!1)}}};if(!s)return null;let h="oauth"===s.authType;return(0,l.jsx)(c.aF,{isOpen:t,title:"Edit Connection",onClose:i,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsx)(c.pd,{label:"Name",value:n.name,onChange:e=>o({...n,name:e.target.value}),placeholder:h?"Account name":"Production Key"}),h&&s.email&&(0,l.jsxs)("div",{className:"bg-sidebar/50 p-3 rounded-lg",children:[(0,l.jsx)("p",{className:"text-sm text-text-muted mb-1",children:"Email"}),(0,l.jsx)("p",{className:"font-medium",children:s.email})]}),(0,l.jsx)(c.pd,{label:"Priority",type:"number",value:n.priority,onChange:e=>o({...n,priority:parseInt(e.target.value)||1})}),(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)(c.$n,{onClick:u,variant:"secondary",disabled:d,children:d?"Testing...":"Test Connection"}),x&&(0,l.jsx)(c.Ex,{variant:"success"===x?"success":"error",children:"success"===x?"Valid":"Failed"})]}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(c.$n,{onClick:()=>{let e={name:n.name,priority:n.priority};a(e)},fullWidth:!0,children:"Save"}),(0,l.jsx)(c.$n,{onClick:i,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}[c,m,x]=u.then?(await u)():u,a()}catch(e){a(e)}})}},e=>{e.O(0,[1760,5239,9955,2819,8441,1255,7358],()=>e(e.s=2397)),_N_E=e.O()}]);
|
package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/new/page-9e075d79ef785c9b.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9089],{60:(e,r,t)=>{"use strict";t.a(e,async(e,a)=>{try{t.r(r),t.d(r,{default:()=>u});var s=t(5155),i=t(2115),l=t(63),d=t(2619),n=t.n(d),o=t(2819),c=t(4156),p=e([o,c]);[o,c]=p.then?(await p)():p;let h=Object.values(c.Q2).map(e=>({value:e.id,label:e.name})),m=Object.values(c.MA).map(e=>({value:e.id,label:e.name}));function u(){let e=(0,l.useRouter)(),[r,t]=(0,i.useState)(!1),[a,d]=(0,i.useState)({provider:"",authMethod:"api_key",apiKey:"",displayName:"",isActive:!0}),[p,u]=(0,i.useState)({}),x=(e,r)=>{d(t=>({...t,[e]:r})),p[e]&&u(r=>({...r,[e]:null}))},b=async r=>{if(r.preventDefault(),(()=>{let e={};return a.provider||(e.provider="Please select a provider"),"api_key"!==a.authMethod||a.apiKey||(e.apiKey="API Key is required"),u(e),0===Object.keys(e).length})()){t(!0);try{let r=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(r.ok)e.push("/dashboard/providers");else{let e=await r.json();u({submit:e.error||"Failed to create provider"})}}catch(e){u({submit:"An error occurred. Please try again."})}finally{t(!1)}}},v=c.Q2[a.provider];return(0,s.jsxs)("div",{className:"max-w-2xl mx-auto",children:[(0,s.jsxs)("div",{className:"mb-8",children:[(0,s.jsxs)(n(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,s.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:"Add New Provider"}),(0,s.jsx)("p",{className:"text-text-muted mt-2",children:"Configure a new AI provider to use with your applications."})]}),(0,s.jsx)(o.Zp,{children:(0,s.jsxs)("form",{onSubmit:b,className:"flex flex-col gap-6",children:[(0,s.jsx)(o.l6,{label:"Provider",options:h,value:a.provider,onChange:e=>x("provider",e.target.value),placeholder:"Select a provider",error:p.provider,required:!0}),v&&(0,s.jsxs)(o.Zp.Section,{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"size-10 rounded-lg flex items-center justify-center bg-bg border border-border",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:v.color},children:v.icon})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-medium",children:v.name}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Selected provider"})]})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,s.jsxs)("label",{className:"text-sm font-medium",children:["Authentication Method ",(0,s.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,s.jsx)("div",{className:"flex gap-3",children:m.map(e=>(0,s.jsxs)("button",{type:"button",onClick:()=>x("authMethod",e.value),className:"flex-1 flex items-center justify-center gap-2 p-4 rounded-lg border transition-all ".concat(a.authMethod===e.value?"border-primary bg-primary/5 text-primary":"border-border hover:border-primary/50"),children:[(0,s.jsx)("span",{className:"material-symbols-outlined",children:"api_key"===e.value?"key":"lock"}),(0,s.jsx)("span",{className:"font-medium",children:e.label})]},e.value))})]}),"api_key"===a.authMethod&&(0,s.jsx)(o.pd,{label:"API Key",type:"password",placeholder:"Enter your API key",value:a.apiKey,onChange:e=>x("apiKey",e.target.value),error:p.apiKey,hint:"Your API key will be encrypted and stored securely.",required:!0}),"oauth2"===a.authMethod&&(0,s.jsxs)(o.Zp.Section,{children:[(0,s.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Connect your account using OAuth2 authentication."}),(0,s.jsx)(o.$n,{type:"button",variant:"secondary",icon:"link",children:"Connect with OAuth2"})]}),(0,s.jsx)(o.pd,{label:"Display Name",placeholder:"e.g., Production API, Dev Environment",value:a.displayName,onChange:e=>x("displayName",e.target.value),hint:"Optional. A friendly name to identify this configuration."}),(0,s.jsx)(o.lM,{checked:a.isActive,onChange:e=>x("isActive",e),label:"Active",description:"Enable this provider for use in your applications"}),p.submit&&(0,s.jsx)("div",{className:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-600 dark:text-red-400 text-sm",children:p.submit}),(0,s.jsxs)("div",{className:"flex gap-3 pt-4 border-t border-border",children:[(0,s.jsx)(n(),{href:"/dashboard/providers",className:"flex-1",children:(0,s.jsx)(o.$n,{type:"button",variant:"ghost",fullWidth:!0,children:"Cancel"})}),(0,s.jsx)(o.$n,{type:"submit",loading:r,fullWidth:!0,className:"flex-1",children:"Create Provider"})]})]})})]})}a()}catch(e){a(e)}})},5390:(e,r,t)=>{Promise.resolve().then(t.bind(t,60))}},e=>{e.O(0,[1760,9955,2819,8441,1255,7358],()=>e(e.s=5390)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8460],{2336:(e,t,s)=>{"use strict";s.a(e,async(e,r)=>{try{s.r(t),s.d(t,{default:()=>h});var l=s(5155),n=s(2115),a=s(2819),c=s(4156);s(5239);var i=s(2619),o=s.n(i),d=s(9939),x=e([a,c]);function h(){let[e,t]=(0,n.useState)([]),[s,r]=(0,n.useState)(!0);(0,n.useEffect)(()=>{i()},[]);let i=async()=>{try{let e=await fetch("/api/providers"),s=await e.json();e.ok&&t(s.connections||[])}catch(e){console.log("Error fetching data:",e)}finally{r(!1)}},o=(t,s)=>{let r=e.filter(e=>e.provider===t&&e.authType===s),l=e=>{let t=e.rateLimitedUntil&&new Date(e.rateLimitedUntil).getTime()>Date.now();return"unavailable"!==e.testStatus||t?e.testStatus:"active"},n=r.filter(e=>{let t=l(e);return"active"===t||"success"===t}).length,a=r.filter(e=>{let t=l(e);return"error"===t||"expired"===t||"unavailable"===t}),c=a.length,i=r.length,o=a.sort((e,t)=>new Date(t.lastErrorAt||0)-new Date(e.lastErrorAt||0))[0],x=o?(0,d.E2)(o.lastError):null,h=(null==o?void 0:o.lastErrorAt)?(0,d.gs)(o.lastErrorAt):null;return{connected:n,error:c,total:i,errorCode:x,errorTime:h}};return s?(0,l.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,l.jsx)(a.Qv,{}),(0,l.jsx)(a.Qv,{})]}):(0,l.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsx)("h2",{className:"text-xl font-semibold",children:"OAuth Providers"}),(0,l.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:Object.entries(c.zN).map(e=>{let[t,s]=e;return(0,l.jsx)(m,{providerId:t,provider:s,stats:o(t,"oauth")},t)})})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsx)("h2",{className:"text-xl font-semibold",children:"API Key Providers"}),(0,l.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:Object.entries(c.fg).map(e=>{let[t,s]=e;return(0,l.jsx)(u,{providerId:t,provider:s,stats:o(t,"apikey")},t)})})]})]})}function m(e){let{providerId:t,provider:s,stats:r}=e,{connected:c,error:i,errorCode:d,errorTime:x}=r,[h,m]=(0,n.useState)(!1);return(0,l.jsx)(o(),{href:"/dashboard/providers/".concat(t),children:(0,l.jsx)(a.Zp,{className:"h-full hover:border-primary/50 transition-colors cursor-pointer",children:(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-10 rounded-lg flex items-center justify-center",style:{backgroundColor:"".concat(s.color,"15")},children:h?(0,l.jsx)("span",{className:"text-sm font-bold",style:{color:s.color},children:s.textIcon||s.id.slice(0,2).toUpperCase()}):(0,l.jsx)("img",{src:"/providers/".concat(s.id,".png"),alt:s.name,className:"size-10 object-contain rounded-lg",onError:()=>m(!0)})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("h3",{className:"font-semibold",children:s.name}),(0,l.jsxs)("div",{className:"flex items-center gap-2 text-xs flex-wrap",children:[(()=>{let e=[];if(c>0&&e.push((0,l.jsxs)(a.Ex,{variant:"success",size:"sm",dot:!0,children:[c," Connected"]},"connected")),i>0){let t=d?"".concat(i," Error (").concat(d,")"):"".concat(i," Error");e.push((0,l.jsx)(a.Ex,{variant:"error",size:"sm",dot:!0,children:t},"error"))}return 0===e.length?(0,l.jsx)("span",{className:"text-text-muted",children:"No connections"}):e})(),x&&(0,l.jsxs)("span",{className:"text-text-muted",children:["• ",x]})]})]})]}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted",children:"chevron_right"})]})})})}function u(e){let{providerId:t,provider:s,stats:r}=e,{connected:n,error:c,errorCode:i,errorTime:d}=r;return(0,l.jsx)(o(),{href:"/dashboard/providers/".concat(t),children:(0,l.jsx)(a.Zp,{className:"h-full hover:border-primary/50 transition-colors cursor-pointer",children:(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-10 rounded-lg flex items-center justify-center",style:{backgroundColor:"".concat(s.color,"15")},children:(0,l.jsx)("span",{className:"text-sm font-bold",style:{color:s.color},children:s.textIcon||s.id.slice(0,2).toUpperCase()})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("h3",{className:"font-semibold",children:s.name}),(0,l.jsxs)("div",{className:"flex items-center gap-2 text-xs flex-wrap",children:[(()=>{let e=[];if(n>0&&e.push((0,l.jsxs)(a.Ex,{variant:"success",size:"sm",dot:!0,children:[n," Connected"]},"connected")),c>0){let t=i?"".concat(c," Error (").concat(i,")"):"".concat(c," Error");e.push((0,l.jsx)(a.Ex,{variant:"error",size:"sm",dot:!0,children:t},"error"))}return 0===e.length?(0,l.jsx)("span",{className:"text-text-muted",children:"No connections"}):e})(),d&&(0,l.jsxs)("span",{className:"text-text-muted",children:["• ",d]})]})]})]}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted",children:"chevron_right"})]})})})}[a,c]=x.then?(await x)():x,r()}catch(e){r(e)}})},3117:(e,t,s)=>{Promise.resolve().then(s.bind(s,2336))},9939:(e,t,s)=>{"use strict";s.d(t,{E2:()=>r,gs:()=>l});function r(e){if(!e)return null;let t=e.match(/\b([45]\d{2})\b/);return t?t[1]:"ERR"}function l(e){if(!e)return"";let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return"".concat(t,"m ago");let s=Math.floor(t/60);if(s<24)return"".concat(s,"h ago");let r=Math.floor(s/24);return"".concat(r,"d ago")}}},e=>{e.O(0,[1760,5239,9955,2819,8441,1255,7358],()=>e(e.s=3117)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9305],{8383:(e,s,n)=>{Promise.resolve().then(n.bind(n,1980)),Promise.resolve().then(n.bind(n,3876)),Promise.resolve().then(n.bind(n,2513)),Promise.resolve().then(n.bind(n,1255)),Promise.resolve().then(n.bind(n,4486)),Promise.resolve().then(n.bind(n,1620)),Promise.resolve().then(n.bind(n,2411)),Promise.resolve().then(n.bind(n,3461)),Promise.resolve().then(n.bind(n,709)),Promise.resolve().then(n.bind(n,3367)),Promise.resolve().then(n.bind(n,4202)),Promise.resolve().then(n.bind(n,2923)),Promise.resolve().then(n.bind(n,1553)),Promise.resolve().then(n.bind(n,7897)),Promise.resolve().then(n.bind(n,3439)),Promise.resolve().then(n.bind(n,9955)),Promise.resolve().then(n.bind(n,3222)),Promise.resolve().then(n.bind(n,9957))}},e=>{e.O(0,[1760,9955,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9305],{8383:(e,s,n)=>{Promise.resolve().then(n.bind(n,1980)),Promise.resolve().then(n.bind(n,3876)),Promise.resolve().then(n.bind(n,2513)),Promise.resolve().then(n.bind(n,1255)),Promise.resolve().then(n.bind(n,4486)),Promise.resolve().then(n.bind(n,1620)),Promise.resolve().then(n.bind(n,2411)),Promise.resolve().then(n.bind(n,3461)),Promise.resolve().then(n.bind(n,709)),Promise.resolve().then(n.bind(n,3367)),Promise.resolve().then(n.bind(n,4202)),Promise.resolve().then(n.bind(n,2923)),Promise.resolve().then(n.bind(n,1553)),Promise.resolve().then(n.bind(n,7897)),Promise.resolve().then(n.bind(n,3439)),Promise.resolve().then(n.bind(n,9955)),Promise.resolve().then(n.bind(n,3222)),Promise.resolve().then(n.bind(n,9957))}},e=>{e.O(0,[1760,9955,2819,8441,1255,7358],()=>e(e.s=8383)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";var e={},r={};function t(o){var a=r[o];if(void 0!==a)return a.exports;var n=r[o]={exports:{}},c=!0;try{e[o](n,n.exports,t),c=!1}finally{c&&delete r[o]}return n.exports}t.m=e,(()=>{var e="function"==typeof Symbol?Symbol("webpack queues"):"__webpack_queues__",r="function"==typeof Symbol?Symbol("webpack exports"):"__webpack_exports__",o="function"==typeof Symbol?Symbol("webpack error"):"__webpack_error__",a=e=>{e&&e.d<1&&(e.d=1,e.forEach(e=>e.r--),e.forEach(e=>e.r--?e.r++:e()))};t.a=(t,n,c)=>{c&&((i=[]).d=-1);var i,u,f,d,l=new Set,s=t.exports,p=new Promise((e,r)=>{d=r,f=e});p[r]=s,p[e]=e=>(i&&e(i),l.forEach(e),p.catch(e=>{})),t.exports=p,n(t=>{u=t.map(t=>{if(null!==t&&"object"==typeof t){if(t[e])return t;if(t.then){var n=[];n.d=0,t.then(e=>{c[r]=e,a(n)},e=>{c[o]=e,a(n)});var c={};return c[e]=e=>e(n),c}}var i={};return i[e]=e=>{},i[r]=t,i});var n,c=()=>u.map(e=>{if(e[o])throw e[o];return e[r]}),f=new Promise(r=>{(n=()=>r(c)).r=0;var t=e=>e!==i&&!l.has(e)&&(l.add(e),e&&!e.d&&(n.r++,e.push(n)));u.map(r=>r[e](t))});return n.r?f:c()},e=>(e?d(p[o]=e):f(s),a(i))),i&&i.d<0&&(i.d=0)}})(),(()=>{var e=[];t.O=(r,o,a,n)=>{if(o){n=n||0;for(var c=e.length;c>0&&e[c-1][2]>n;c--)e[c]=e[c-1];e[c]=[o,a,n];return}for(var i=1/0,c=0;c<e.length;c++){for(var[o,a,n]=e[c],u=!0,f=0;f<o.length;f++)(!1&n||i>=n)&&Object.keys(t.O).every(e=>t.O[e](o[f]))?o.splice(f--,1):(u=!1,n<i&&(i=n));if(u){e.splice(c--,1);var d=a();void 0!==d&&(r=d)}}return r}})(),t.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},(()=>{var e,r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;t.t=function(o,a){if(1&a&&(o=this(o)),8&a||"object"==typeof o&&o&&(4&a&&o.__esModule||16&a&&"function"==typeof o.then))return o;var n=Object.create(null);t.r(n);var c={};e=e||[null,r({}),r([]),r(r)];for(var i=2&a&&o;"object"==typeof i&&!~e.indexOf(i);i=r(i))Object.getOwnPropertyNames(i).forEach(e=>c[e]=()=>o[e]);return c.default=()=>o,t.d(n,c),n}})(),t.d=(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},t.f={},t.e=e=>Promise.all(Object.keys(t.f).reduce((r,o)=>(t.f[o](e,r),r),[])),t.u=e=>"static/chunks/"+e+"."+({197:"83743acbae435446",1055:"0f91ab6513ec317b",1441:"7b9fc2e539f71e56",3431:"b7e68d807c631773",3433:"dfc71de88505c41d",3592:"2bc2e6e506f250e3",5812:"5dc8861d62b394fe",6899:"44ddb324d06f2b00",7712:"6576b07aa7d6f955",8456:"50ee5fc36ad7054f",9220:"745ac8c97d067b9a"})[e]+".js",t.miniCssF=e=>{},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e={},r="_N_E:";t.l=(o,a,n,c)=>{if(e[o])return void e[o].push(a);if(void 0!==n)for(var i,u,f=document.getElementsByTagName("script"),d=0;d<f.length;d++){var l=f[d];if(l.getAttribute("src")==o||l.getAttribute("data-webpack")==r+n){i=l;break}}i||(u=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,t.nc&&i.setAttribute("nonce",t.nc),i.setAttribute("data-webpack",r+n),i.src=t.tu(o)),e[o]=[a];var s=(r,t)=>{i.onerror=i.onload=null,clearTimeout(p);var a=e[o];if(delete e[o],i.parentNode&&i.parentNode.removeChild(i),a&&a.forEach(e=>e(t)),r)return r(t)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=s.bind(null,i.onerror),i.onload=s.bind(null,i.onload),u&&document.head.appendChild(i)}})(),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;t.tt=()=>(void 0===e&&(e={createScriptURL:e=>e},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("nextjs#bundler",e))),e)})(),t.tu=e=>t.tt().createScriptURL(e),t.p="/_next/",(()=>{var e={8068:0,2328:0};t.f.j=(r,o)=>{var a=t.o(e,r)?e[r]:void 0;if(0!==a)if(a)o.push(a[2]);else if(/^(232|806)8$/.test(r))e[r]=0;else{var n=new Promise((t,o)=>a=e[r]=[t,o]);o.push(a[2]=n);var c=t.p+t.u(r),i=Error();t.l(c,o=>{if(t.o(e,r)&&(0!==(a=e[r])&&(e[r]=void 0),a)){var n=o&&("load"===o.type?"missing":o.type),c=o&&o.target&&o.target.src;i.message="Loading chunk "+r+" failed.\n("+n+": "+c+")",i.name="ChunkLoadError",i.type=n,i.request=c,a[1](i)}},"chunk-"+r,r)}},t.O.j=r=>0===e[r];var r=(r,o)=>{var a,n,[c,i,u]=o,f=0;if(c.some(r=>0!==e[r])){for(a in i)t.o(i,a)&&(t.m[a]=i[a]);if(u)var d=u(t)}for(r&&r(o);f<c.length;f++)n=c[f],t.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return t.O(d)},o=self.webpackChunk_N_E=self.webpackChunk_N_E||[];o.forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o))})()})();
|
package/app/package.json
CHANGED
package/cli.js
CHANGED
|
@@ -22,7 +22,7 @@ let port = DEFAULT_PORT;
|
|
|
22
22
|
let host = DEFAULT_HOST;
|
|
23
23
|
let noBrowser = false;
|
|
24
24
|
let skipUpdate = false;
|
|
25
|
-
let
|
|
25
|
+
let showLog = false;
|
|
26
26
|
|
|
27
27
|
for (let i = 0; i < args.length; i++) {
|
|
28
28
|
if (args[i] === "--port" || args[i] === "-p") {
|
|
@@ -33,10 +33,10 @@ for (let i = 0; i < args.length; i++) {
|
|
|
33
33
|
i++;
|
|
34
34
|
} else if (args[i] === "--no-browser" || args[i] === "-n") {
|
|
35
35
|
noBrowser = true;
|
|
36
|
+
} else if (args[i] === "--log" || args[i] === "-l") {
|
|
37
|
+
showLog = true;
|
|
36
38
|
} else if (args[i] === "--skip-update") {
|
|
37
39
|
skipUpdate = true;
|
|
38
|
-
} else if (args[i] === "--node") {
|
|
39
|
-
forceNode = true;
|
|
40
40
|
} else if (args[i] === "--help" || args[i] === "-h") {
|
|
41
41
|
console.log(`
|
|
42
42
|
Usage: ${APP_NAME} [options]
|
|
@@ -45,8 +45,8 @@ Options:
|
|
|
45
45
|
-p, --port <port> Port to run the server (default: ${DEFAULT_PORT})
|
|
46
46
|
-H, --host <host> Host to bind (default: ${DEFAULT_HOST})
|
|
47
47
|
-n, --no-browser Don't open browser automatically
|
|
48
|
+
-l, --log Show server logs (default: hidden)
|
|
48
49
|
--skip-update Skip auto-update check
|
|
49
|
-
--node Force use Node.js instead of Bun
|
|
50
50
|
-h, --help Show this help message
|
|
51
51
|
-v, --version Show version
|
|
52
52
|
`);
|
|
@@ -57,16 +57,8 @@ Options:
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
//
|
|
61
|
-
|
|
62
|
-
if (forceNode) return "node";
|
|
63
|
-
try {
|
|
64
|
-
execSync("bun --version", { stdio: "ignore" });
|
|
65
|
-
return "bun";
|
|
66
|
-
} catch {
|
|
67
|
-
return "node";
|
|
68
|
-
}
|
|
69
|
-
}
|
|
60
|
+
// Always use Node.js runtime
|
|
61
|
+
const RUNTIME = "node";
|
|
70
62
|
|
|
71
63
|
// Compare semver versions: returns 1 if a > b, -1 if a < b, 0 if equal
|
|
72
64
|
function compareVersions(a, b) {
|
|
@@ -296,20 +288,19 @@ checkAndUpdate().then((hasUpdate) => {
|
|
|
296
288
|
function startServer() {
|
|
297
289
|
const displayHost = host === DEFAULT_HOST ? "localhost" : host;
|
|
298
290
|
const url = `http://${displayHost}:${port}/dashboard`;
|
|
299
|
-
const runtime = detectRuntime();
|
|
300
291
|
|
|
301
292
|
console.log(`\n┌───────────────────────────────────────────────────────┐`);
|
|
302
293
|
console.log(`│ 🚀 ${pkg.name} v${pkg.version}`.padEnd(56) + `│`);
|
|
303
294
|
console.log(`├───────────────────────────────────────────────────────┤`);
|
|
304
|
-
console.log(`│ Runtime: ${
|
|
295
|
+
console.log(`│ Runtime: ${RUNTIME}`.padEnd(56) + `│`);
|
|
305
296
|
console.log(`│ Host: ${displayHost}`.padEnd(56) + `│`);
|
|
306
297
|
console.log(`│ Port: ${port}`.padEnd(56) + `│`);
|
|
307
298
|
console.log(`│ Dashboard: ${url}`.padEnd(56) + `│`);
|
|
308
299
|
console.log(`└───────────────────────────────────────────────────────┘\n`);
|
|
309
300
|
|
|
310
|
-
const server = spawn(
|
|
301
|
+
const server = spawn(RUNTIME, [serverPath], {
|
|
311
302
|
cwd: standaloneDir,
|
|
312
|
-
stdio:
|
|
303
|
+
stdio: showLog ? "inherit" : "ignore", // Show logs only when --log flag is present
|
|
313
304
|
detached: true,
|
|
314
305
|
env: {
|
|
315
306
|
...process.env,
|
|
@@ -318,27 +309,9 @@ function startServer() {
|
|
|
318
309
|
}
|
|
319
310
|
});
|
|
320
311
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
// Listen for server ready signal from stdout
|
|
324
|
-
server.stdout.on("data", (data) => {
|
|
325
|
-
const output = data.toString();
|
|
326
|
-
if (!serverReady && (output.includes("Ready") || output.includes("started"))) {
|
|
327
|
-
serverReady = true;
|
|
328
|
-
if (!noBrowser) {
|
|
329
|
-
openBrowser(url);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
});
|
|
333
|
-
|
|
334
|
-
// Show stderr for debugging
|
|
335
|
-
server.stderr.on("data", (data) => {
|
|
336
|
-
console.error(data.toString());
|
|
337
|
-
});
|
|
338
|
-
|
|
339
|
-
// Fallback: open browser after timeout if server didn't signal ready
|
|
312
|
+
// Open browser after timeout
|
|
340
313
|
setTimeout(() => {
|
|
341
|
-
if (!
|
|
314
|
+
if (!noBrowser) {
|
|
342
315
|
openBrowser(url);
|
|
343
316
|
}
|
|
344
317
|
}, 3000);
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";exports.id=1582,exports.ids=[1582],exports.modules={31852:(a,b,c)=>{c.d(b,{Xj:()=>e});var d=c(1124);async function e(a=null){let b=a||process.env.MACHINE_ID_SALT||"endpoint-proxy-salt";try{let a=(0,d.machineIdSync)();return(await Promise.resolve().then(c.t.bind(c,55511,23))).createHash("sha256").update(a+b).digest("hex").substring(0,16)}catch(a){return console.log("Error getting machine ID:",a),crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){let b=16*Math.random()|0;return("x"==a?b:3&b|8).toString(16)})}}},34443:(a,b,c)=>{c.d(b,{CG:()=>F,Dj:()=>C,Iq:()=>H,L:()=>B,Lh:()=>I,Mc:()=>t,Nx:()=>N,OM:()=>x,P:()=>s,PX:()=>G,Uv:()=>A,Xx:()=>M,bI:()=>K,ek:()=>J,fK:()=>w,fv:()=>z,iE:()=>u,jd:()=>D,mt:()=>L,o5:()=>y,oG:()=>E,rj:()=>v});var d=c(16373),e=c(56963),f=c(14701),g=c(33873),h=c.n(g),i=c(21820),j=c.n(i),k=c(29021),l=c.n(k),m=c(79551);let n=function(){let a=process.platform,b=j().homedir(),c=function(){let a=h().dirname((0,m.fileURLToPath)("file:///Users/Working/router4/app/src/lib/localDb.js")),b=h().resolve(a,"../../../package.json");try{let a=JSON.parse(l().readFileSync(b,"utf-8"));return a.config?.appName||"9router"}catch{return"9router"}}();return"win32"===a?h().join(process.env.APPDATA||h().join(b,"AppData","Roaming"),c):h().join(b,`.${c}`)}(),o=h().join(n,"db.json");l().existsSync(n)||l().mkdirSync(n,{recursive:!0});let p={providerConnections:[],modelAliases:{},combos:[],apiKeys:[],settings:{cloudEnabled:!1}},q=null;async function r(){if(!q){let a=new e.Pv(o);q=new d.t(a,p);try{await q.read()}catch(a){if(a instanceof SyntaxError)console.warn("[DB] Corrupt JSON detected, resetting to defaults..."),q.data=p,await q.write();else throw a}q.data||(q.data=p,await q.write())}return q}async function s(a={}){let b=(await r()).data.providerConnections||[];return a.provider&&(b=b.filter(b=>b.provider===a.provider)),void 0!==a.isActive&&(b=b.filter(b=>b.isActive===a.isActive)),b.sort((a,b)=>(a.priority||999)-(b.priority||999)),b}async function t(a){return(await r()).data.providerConnections.find(b=>b.id===a)||null}async function u(a){let b=await r(),c=new Date().toISOString(),d=-1;if("oauth"===a.authType&&a.email?d=b.data.providerConnections.findIndex(b=>b.provider===a.provider&&"oauth"===b.authType&&b.email===a.email):"apikey"===a.authType&&a.name&&(d=b.data.providerConnections.findIndex(b=>b.provider===a.provider&&"apikey"===b.authType&&b.name===a.name)),-1!==d)return b.data.providerConnections[d]={...b.data.providerConnections[d],...a,updatedAt:c},await b.write(),b.data.providerConnections[d];let e=a.name||null;if(!e&&"oauth"===a.authType)if(a.email)e=a.email;else{let c=b.data.providerConnections.filter(b=>b.provider===a.provider).length;e=`Account ${c+1}`}let g=a.priority;g||(g=b.data.providerConnections.filter(b=>b.provider===a.provider).reduce((a,b)=>Math.max(a,b.priority||0),0)+1);let h={id:(0,f.A)(),provider:a.provider,authType:a.authType||"oauth",name:e,priority:g,isActive:void 0===a.isActive||a.isActive,createdAt:c,updatedAt:c};for(let b of["displayName","email","globalPriority","defaultModel","accessToken","refreshToken","expiresAt","tokenType","scope","idToken","projectId","apiKey","testStatus","lastTested","lastError","lastErrorAt","rateLimitedUntil","expiresIn","errorCode"])void 0!==a[b]&&null!==a[b]&&(h[b]=a[b]);return a.providerSpecificData&&Object.keys(a.providerSpecificData).length>0&&(h.providerSpecificData=a.providerSpecificData),b.data.providerConnections.push(h),await b.write(),h}async function v(a,b){let c=await r(),d=c.data.providerConnections.findIndex(b=>b.id===a);return -1===d?null:(c.data.providerConnections[d]={...c.data.providerConnections[d],...b,updatedAt:new Date().toISOString()},await c.write(),c.data.providerConnections[d])}async function w(a){let b=await r(),c=b.data.providerConnections.findIndex(b=>b.id===a);return -1!==c&&(b.data.providerConnections.splice(c,1),await b.write(),!0)}async function x(){return(await r()).data.modelAliases||{}}async function y(a,b){let c=await r();c.data.modelAliases[a]=b,await c.write()}async function z(a){let b=await r();delete b.data.modelAliases[a],await b.write()}async function A(){return(await r()).data.combos||[]}async function B(a){return((await r()).data.combos||[]).find(b=>b.id===a)||null}async function C(a){return((await r()).data.combos||[]).find(b=>b.name===a)||null}async function D(a){let b=await r();b.data.combos||(b.data.combos=[]);let c=new Date().toISOString(),d={id:(0,f.A)(),name:a.name,models:a.models||[],createdAt:c,updatedAt:c};return b.data.combos.push(d),await b.write(),d}async function E(a,b){let c=await r();c.data.combos||(c.data.combos=[]);let d=c.data.combos.findIndex(b=>b.id===a);return -1===d?null:(c.data.combos[d]={...c.data.combos[d],...b,updatedAt:new Date().toISOString()},await c.write(),c.data.combos[d])}async function F(a){let b=await r();if(!b.data.combos)return!1;let c=b.data.combos.findIndex(b=>b.id===a);return -1!==c&&(b.data.combos.splice(c,1),await b.write(),!0)}async function G(){return(await r()).data.apiKeys||[]}async function H(a,b){if(!b)throw Error("machineId is required");let d=await r(),e=new Date().toISOString(),{generateApiKeyWithMachine:g}=await c.e(9285).then(c.bind(c,39285)),h=g(b),i={id:(0,f.A)(),name:a,key:h.key,machineId:b,createdAt:e};return d.data.apiKeys.push(i),await d.write(),i}async function I(a){let b=await r(),c=b.data.apiKeys.findIndex(b=>b.id===a);return -1!==c&&(b.data.apiKeys.splice(c,1),await b.write(),!0)}async function J(a){return(await r()).data.apiKeys.some(b=>b.key===a)}async function K(){let a=await r(),b=["displayName","email","globalPriority","defaultModel","accessToken","refreshToken","expiresAt","tokenType","scope","idToken","projectId","apiKey","testStatus","lastTested","lastError","lastErrorAt","rateLimitedUntil","expiresIn"],c=0;for(let d of a.data.providerConnections){for(let a of b)(null===d[a]||void 0===d[a])&&(delete d[a],c++);d.providerSpecificData&&0===Object.keys(d.providerSpecificData).length&&(delete d.providerSpecificData,c++)}return c>0&&await a.write(),c}async function L(){return(await r()).data.settings||{cloudEnabled:!1}}async function M(a){let b=await r();return b.data.settings={...b.data.settings,...a},await b.write(),b.data.settings}async function N(){return!0===(await L()).cloudEnabled}},81582:(a,b,c)=>{c.d(b,{A:()=>j});var d=c(31852),e=c(34443);class f{constructor(a=null,b=15){this.machineId=a,this.intervalMinutes=b,this.intervalId=null}async initializeMachineId(){this.machineId||(this.machineId=await (0,d.Xj)())}async start(){this.intervalId||(await this.initializeMachineId(),setTimeout(()=>{this.syncWithRetry().catch(()=>{})},3e4),this.intervalId=setInterval(()=>{this.syncWithRetry().catch(()=>{})},60*this.intervalMinutes*1e3))}stop(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null)}async syncWithRetry(a=1){for(let b=1;b<=a;b++)try{return await this.sync()}catch(d){if(b===a)return null;let c=Math.min(1e3*Math.pow(2,b),1e4);await new Promise(a=>setTimeout(a,c))}}async sync(){if(!await (0,e.Nx)())return null;await this.initializeMachineId();let a=await fetch(`${process.env.NEXT_PUBLIC_BASE_URL||"http://localhost:3000"}/api/sync/cloud`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({machineId:this.machineId,action:"sync"})});if(!a.ok)throw Error((await a.json().catch(()=>({}))).error||"Sync failed");return await a.json()}isRunning(){return null!==this.intervalId}}let g=null;async function h(a=null,b=15){return g||(g=new f(a,b)),g}async function i(){try{await (0,e.bI)();let a=await h(null,15);return await a.start(),a}catch(a){throw console.error("[CloudSync] Error initializing scheduler:",a),a}}a=c.hmd(a),c.c[c.s]===a&&i().catch(console.log);let j=i}};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
exports.id=3576,exports.ids=[3576],exports.modules={3421:(a,b,c)=>{"use strict";Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(71237),e=c(55088),f=c(17679);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},34443:(a,b,c)=>{"use strict";c.d(b,{CG:()=>F,Dj:()=>C,Iq:()=>H,L:()=>B,Lh:()=>I,Mc:()=>t,Nx:()=>N,OM:()=>x,P:()=>s,PX:()=>G,Uv:()=>A,Xx:()=>M,bI:()=>K,ek:()=>J,fK:()=>w,fv:()=>z,iE:()=>u,jd:()=>D,mt:()=>L,o5:()=>y,oG:()=>E,rj:()=>v});var d=c(16373),e=c(56963),f=c(14701),g=c(33873),h=c.n(g),i=c(21820),j=c.n(i),k=c(29021),l=c.n(k),m=c(79551);let n=function(){let a=process.platform,b=j().homedir(),c=function(){let a=h().dirname((0,m.fileURLToPath)("file:///Users/Working/router4/app/src/lib/localDb.js")),b=h().resolve(a,"../../../package.json");try{let a=JSON.parse(l().readFileSync(b,"utf-8"));return a.config?.appName||"9router"}catch{return"9router"}}();return"win32"===a?h().join(process.env.APPDATA||h().join(b,"AppData","Roaming"),c):h().join(b,`.${c}`)}(),o=h().join(n,"db.json");l().existsSync(n)||l().mkdirSync(n,{recursive:!0});let p={providerConnections:[],modelAliases:{},combos:[],apiKeys:[],settings:{cloudEnabled:!1}},q=null;async function r(){if(!q){let a=new e.Pv(o);q=new d.t(a,p);try{await q.read()}catch(a){if(a instanceof SyntaxError)console.warn("[DB] Corrupt JSON detected, resetting to defaults..."),q.data=p,await q.write();else throw a}q.data||(q.data=p,await q.write())}return q}async function s(a={}){let b=(await r()).data.providerConnections||[];return a.provider&&(b=b.filter(b=>b.provider===a.provider)),void 0!==a.isActive&&(b=b.filter(b=>b.isActive===a.isActive)),b.sort((a,b)=>(a.priority||999)-(b.priority||999)),b}async function t(a){return(await r()).data.providerConnections.find(b=>b.id===a)||null}async function u(a){let b=await r(),c=new Date().toISOString(),d=-1;if("oauth"===a.authType&&a.email?d=b.data.providerConnections.findIndex(b=>b.provider===a.provider&&"oauth"===b.authType&&b.email===a.email):"apikey"===a.authType&&a.name&&(d=b.data.providerConnections.findIndex(b=>b.provider===a.provider&&"apikey"===b.authType&&b.name===a.name)),-1!==d)return b.data.providerConnections[d]={...b.data.providerConnections[d],...a,updatedAt:c},await b.write(),b.data.providerConnections[d];let e=a.name||null;if(!e&&"oauth"===a.authType)if(a.email)e=a.email;else{let c=b.data.providerConnections.filter(b=>b.provider===a.provider).length;e=`Account ${c+1}`}let g=a.priority;g||(g=b.data.providerConnections.filter(b=>b.provider===a.provider).reduce((a,b)=>Math.max(a,b.priority||0),0)+1);let h={id:(0,f.A)(),provider:a.provider,authType:a.authType||"oauth",name:e,priority:g,isActive:void 0===a.isActive||a.isActive,createdAt:c,updatedAt:c};for(let b of["displayName","email","globalPriority","defaultModel","accessToken","refreshToken","expiresAt","tokenType","scope","idToken","projectId","apiKey","testStatus","lastTested","lastError","lastErrorAt","rateLimitedUntil","expiresIn","errorCode"])void 0!==a[b]&&null!==a[b]&&(h[b]=a[b]);return a.providerSpecificData&&Object.keys(a.providerSpecificData).length>0&&(h.providerSpecificData=a.providerSpecificData),b.data.providerConnections.push(h),await b.write(),h}async function v(a,b){let c=await r(),d=c.data.providerConnections.findIndex(b=>b.id===a);return -1===d?null:(c.data.providerConnections[d]={...c.data.providerConnections[d],...b,updatedAt:new Date().toISOString()},await c.write(),c.data.providerConnections[d])}async function w(a){let b=await r(),c=b.data.providerConnections.findIndex(b=>b.id===a);return -1!==c&&(b.data.providerConnections.splice(c,1),await b.write(),!0)}async function x(){return(await r()).data.modelAliases||{}}async function y(a,b){let c=await r();c.data.modelAliases[a]=b,await c.write()}async function z(a){let b=await r();delete b.data.modelAliases[a],await b.write()}async function A(){return(await r()).data.combos||[]}async function B(a){return((await r()).data.combos||[]).find(b=>b.id===a)||null}async function C(a){return((await r()).data.combos||[]).find(b=>b.name===a)||null}async function D(a){let b=await r();b.data.combos||(b.data.combos=[]);let c=new Date().toISOString(),d={id:(0,f.A)(),name:a.name,models:a.models||[],createdAt:c,updatedAt:c};return b.data.combos.push(d),await b.write(),d}async function E(a,b){let c=await r();c.data.combos||(c.data.combos=[]);let d=c.data.combos.findIndex(b=>b.id===a);return -1===d?null:(c.data.combos[d]={...c.data.combos[d],...b,updatedAt:new Date().toISOString()},await c.write(),c.data.combos[d])}async function F(a){let b=await r();if(!b.data.combos)return!1;let c=b.data.combos.findIndex(b=>b.id===a);return -1!==c&&(b.data.combos.splice(c,1),await b.write(),!0)}async function G(){return(await r()).data.apiKeys||[]}async function H(a,b){if(!b)throw Error("machineId is required");let d=await r(),e=new Date().toISOString(),{generateApiKeyWithMachine:g}=await c.e(9285).then(c.bind(c,39285)),h=g(b),i={id:(0,f.A)(),name:a,key:h.key,machineId:b,createdAt:e};return d.data.apiKeys.push(i),await d.write(),i}async function I(a){let b=await r(),c=b.data.apiKeys.findIndex(b=>b.id===a);return -1!==c&&(b.data.apiKeys.splice(c,1),await b.write(),!0)}async function J(a){return(await r()).data.apiKeys.some(b=>b.key===a)}async function K(){let a=await r(),b=["displayName","email","globalPriority","defaultModel","accessToken","refreshToken","expiresAt","tokenType","scope","idToken","projectId","apiKey","testStatus","lastTested","lastError","lastErrorAt","rateLimitedUntil","expiresIn"],c=0;for(let d of a.data.providerConnections){for(let a of b)(null===d[a]||void 0===d[a])&&(delete d[a],c++);d.providerSpecificData&&0===Object.keys(d.providerSpecificData).length&&(delete d.providerSpecificData,c++)}return c>0&&await a.write(),c}async function L(){return(await r()).data.settings||{cloudEnabled:!1}}async function M(a){let b=await r();return b.data.settings={...b.data.settings,...a},await b.write(),b.data.settings}async function N(){return!0===(await L()).cloudEnabled}},48947:(a,b,c)=>{"use strict";c.d(b,{P:()=>F});var d={};c.r(d),c.d(d,{debug:()=>k,error:()=>n,info:()=>l,maskKey:()=>r,request:()=>o,response:()=>p,stream:()=>q,warn:()=>m});var e=c(34443),f=c(71544);let g={DEBUG:0,INFO:1,WARN:2,ERROR:3},h=g.DEBUG;function i(){return new Date().toLocaleTimeString("en-US",{hour12:!1})}function j(a){if(!a)return"";if("string"==typeof a)return a;try{return JSON.stringify(a)}catch{return String(a)}}function k(a,b,c){if(h<=g.DEBUG){let d=c?` ${j(c)}`:"";console.log(`[${i()}] 🔍 [${a}] ${b}${d}`)}}function l(a,b,c){if(h<=g.INFO){let d=c?` ${j(c)}`:"";console.log(`[${i()}] ℹ️ [${a}] ${b}${d}`)}}function m(a,b,c){h<=g.WARN&&c&&j(c)}function n(a,b,c){if(h<=g.ERROR){let d=c?` ${j(c)}`:"";console.log(`[${i()}] ❌ [${a}] ${b}${d}`)}}function o(a,b,c){let d=c?` ${j(c)}`:"";console.log(`\x1b[36m[${i()}] 📥 ${a} ${b}${d}\x1b[0m`)}function p(a,b,c){let d=c?` ${j(c)}`:"";console.log(`[${i()}] ${a<400?"\uD83D\uDCE4":"\uD83D\uDCA5"} ${a} (${b}ms)${d}`)}function q(a,b){let c=b?` ${j(b)}`:"";console.log(`[${i()}] 🌊 [STREAM] ${a}${c}`)}function r(a){return!a||a.length<8?"***":`${a.slice(0,4)}...${a.slice(-4)}`}async function s(a,b=null){let c=await (0,e.P)({provider:a,isActive:!0});if(0===c.length)return m("AUTH",`No credentials for ${a}`),null;let d=c.filter(a=>!(b&&a.id===b||(0,f.AO)(a.rateLimitedUntil)));if(0===d.length)return m("AUTH",`All ${c.length} accounts for ${a} unavailable`),null;let g=d[0];return{apiKey:g.apiKey,accessToken:g.accessToken,refreshToken:g.refreshToken,projectId:g.projectId,copilotToken:g.providerSpecificData?.copilotToken,providerSpecificData:g.providerSpecificData,connectionId:g.id,testStatus:g.testStatus,lastError:g.lastError,rateLimitedUntil:g.rateLimitedUntil}}async function t(a,b,c="Provider error",d=null,g=null){let h=(0,f.vp)(b);await (0,e.rj)(a,{rateLimitedUntil:h,testStatus:"unavailable",lastError:c,errorCode:d,lastErrorAt:new Date().toISOString()}),g&&d&&c&&console.error(`❌ ${g} [${d}]: ${c}`)}async function u(a,b){("unavailable"===b.testStatus||b.lastError||b.rateLimitedUntil)&&(await (0,e.rj)(a,{testStatus:"active",lastError:null,lastErrorAt:null,rateLimitedUntil:null}),l("AUTH",`Account ${a.slice(0,8)} error cleared`))}var v=c(44836);async function w(a){return(0,v.js)(a,e.OM)}async function x(a){if(a.includes("/"))return null;let b=await (0,e.Dj)(a);return b&&b.models&&b.models.length>0?b.models:null}var y=c(85809),z=c(33508);async function A({body:a,models:b,handleSingleModel:c,log:d}){let e=null;for(let f=0;f<b.length;f++){let g=b[f];d.info("COMBO",`Trying model ${f+1}/${b.length}: ${g}`);let h=await c(a,g);if(h.ok||401===h.status)return h;e=`${g}: ${h.statusText||h.status}`,d.warn("COMBO","Model failed, trying next",{model:g,status:h.status})}return d.warn("COMBO","All models failed"),new Response(JSON.stringify({error:e||"All combo models unavailable"}),{status:503,headers:{"Content-Type":"application/json"}})}var B=c(71125);let C=B.oD;async function D(a,b){try{let c={};b.accessToken&&(c.accessToken=b.accessToken),b.refreshToken&&(c.refreshToken=b.refreshToken),b.expiresIn&&(c.expiresAt=new Date(Date.now()+1e3*b.expiresIn).toISOString(),c.expiresIn=b.expiresIn),b.providerSpecificData&&(c.providerSpecificData=b.providerSpecificData);let d=await (0,e.rj)(a,c);return l("TOKEN_REFRESH","Credentials updated in localDb",{connectionId:a,success:!!d}),!!d}catch(b){return n("TOKEN_REFRESH","Error updating credentials in localDb",{connectionId:a,error:b.message}),!1}}async function E(a,b){let c={...b};if(c.expiresAt){let b=new Date(c.expiresAt).getTime(),e=Date.now();if(b-e<C){let f;l("TOKEN_REFRESH","Token expiring soon, refreshing proactively",{provider:a,expiresIn:Math.round((b-e)/1e3)});let g=await (f=c,(0,B.iD)(a,f,d));g&&g.accessToken&&(await D(c.connectionId,g),c={...c,accessToken:g.accessToken,refreshToken:g.refreshToken||c.refreshToken,expiresAt:g.expiresIn?new Date(Date.now()+1e3*g.expiresIn).toISOString():c.expiresAt})}}if("github"===a&&c.providerSpecificData?.copilotTokenExpiresAt){let b=1e3*c.providerSpecificData.copilotTokenExpiresAt,e=Date.now();if(b-e<C){let f;l("TOKEN_REFRESH","Copilot token expiring soon, refreshing proactively",{provider:a,expiresIn:Math.round((b-e)/1e3)});let g=await (f=c.accessToken,(0,B.refreshCopilotToken)(f,d));g&&(await D(c.connectionId,{providerSpecificData:{...c.providerSpecificData,copilotToken:g.token,copilotTokenExpiresAt:g.expiresAt}}),c.providerSpecificData={...c.providerSpecificData,copilotToken:g.token,copilotTokenExpiresAt:g.expiresAt})}}return c}async function F(a,b=null){let c;try{c=await a.json()}catch{return m("CHAT","Invalid JSON body"),(0,z.yj)(400,"Invalid JSON body")}b||(b={endpoint:new URL(a.url).pathname,body:c,headers:Object.fromEntries(a.headers.entries())});let e=c.messages?.length||c.input?.length||0,f=c.tools?.length||0;o("POST",`${c.model} | ${e} msgs${f?` | ${f} tools`:""}`);let g=c.model;if(!g)return m("CHAT","Missing model"),(0,z.yj)(400,"Missing model");let h=await x(g);return h?(l("CHAT",`Combo "${g}" with ${h.length} models`),A({body:c,models:h,handleSingleModel:(a,c)=>G(a,c,b),log:d})):G(c,g,b)}async function G(a,b,c=null){let e=await w(b);if(!e.provider)return m("CHAT","Invalid model format",{model:b}),(0,z.yj)(400,"Invalid model format");let{provider:g,model:h}=e,i=null,j=null;for(;;){let b=await s(g,i);if(!b){if(!i)return(0,z.yj)(400,`No credentials for provider: ${g}`);return m("CHAT","No more accounts available",{provider:g}),new Response(JSON.stringify({error:j||"All accounts unavailable"}),{status:503,headers:{"Content-Type":"application/json"}})}k("CHAT",`Using account ${b.connectionId} for ${g}`);let e=await E(g,b),l=await (0,y.w)({body:{...a,model:`${g}/${h}`},modelInfo:{provider:g,model:h},credentials:e,log:d,clientRawRequest:c,onCredentialsRefreshed:async a=>{await D(b.connectionId,{accessToken:a.accessToken,refreshToken:a.refreshToken,providerSpecificData:a.providerSpecificData,testStatus:"active"})},onRequestSuccess:async()=>{await u(b.connectionId,b)}});if(l.success)return l.response;let{shouldFallback:n,cooldownMs:o}=(0,f.hk)(l.status,l.error);if(n){m("CHAT","Account unavailable, trying next",{provider:g,connectionId:b.connectionId,status:l.status}),await t(b.connectionId,o,l.error?.slice(0,100),l.status,g),i=b.connectionId,j=l.error;continue}return l.response}}},78335:()=>{},95736:(a,b,c)=>{"use strict";a.exports=c(44870)},96487:()=>{}};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1393],{1393:(e,s,l)=>{Promise.resolve().then(l.bind(l,1902))},1902:(e,s,l)=>{"use strict";l.d(s,{default:()=>d});var t=l(5155),a=l(2115),i=l(4244),r=l(2694);let n="https://9router.com";function d(e){let{machineId:s}=e,[l,d]=(0,a.useState)([]),[c,o]=(0,a.useState)(!0),[x,m]=(0,a.useState)(!1),[h,y]=(0,a.useState)(""),[p,u]=(0,a.useState)(null),[b,g]=(0,a.useState)(!1),[f,j]=(0,a.useState)(!1),[N,v]=(0,a.useState)(!1),[k,w]=(0,a.useState)(!1),[C,S]=(0,a.useState)(null),[_,E]=(0,a.useState)(""),{copied:P,copy:O}=(0,r.C)();(0,a.useEffect)(()=>{A(),$()},[]);let $=async()=>{try{let e=await fetch("/api/settings");if(e.ok){let s=await e.json();g(s.cloudEnabled||!1)}}catch(e){console.log("Error loading cloud settings:",e)}},A=async()=>{try{let e=await fetch("/api/keys"),s=await e.json();e.ok&&d(s.keys||[])}catch(e){console.log("Error fetching data:",e)}finally{o(!1)}},D=e=>{e?j(!0):v(!0)},T=async()=>{w(!0),E("syncing");try{let e=await fetch("/api/sync/cloud",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"enable"})}),s=await e.json();e.ok?(E("verifying"),s.verified?(g(!0),S({type:"success",message:"Cloud Proxy connected and verified!"})):(g(!0),S({type:"warning",message:s.verifyError||"Connected but verification failed"})),j(!1),s.createdKey&&await A()):S({type:"error",message:s.error||"Failed to enable cloud"})}catch(e){S({type:"error",message:e.message})}finally{w(!1),E("")}},W=async()=>{w(!0),E("syncing");try{await fetch("/api/sync/cloud",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"sync"})}),E("disabling"),(await fetch("/api/sync/cloud",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"disable"})})).ok&&(g(!1),S({type:"success",message:"Cloud disabled"}),v(!1))}catch(e){console.log("Error disabling cloud:",e),S({type:"error",message:"Failed to disable cloud"})}finally{w(!1),E("")}},I=async()=>{if(h.trim())try{let e=await fetch("/api/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:h})}),s=await e.json();e.ok&&(u(s.key),await A(),y(""),m(!1))}catch(e){console.log("Error creating key:",e)}},K=async e=>{if(confirm("Delete this API key?"))try{(await fetch("/api/keys/".concat(e),{method:"DELETE"})).ok&&d(l.filter(s=>s.id!==e))}catch(e){console.log("Error deleting key:",e)}};"localhost"===window.location.hostname||window.location.hostname;let F="".concat(window.location.origin,"/v1");if("".concat(n,"/").concat(s,"/v1"),c)return(0,t.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,t.jsx)(i.Qv,{}),(0,t.jsx)(i.Qv,{})]});let J=b?"".concat(n,"/v1"):F;return(0,t.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,t.jsxs)(i.Zp,{className:"",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-lg font-semibold",children:"API Endpoint"}),(0,t.jsx)("p",{className:"text-sm text-text-muted",children:b?"Using Cloud Proxy":"Using Local Server"})]}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:b?(0,t.jsx)(i.$n,{size:"sm",variant:"secondary",icon:"cloud_off",onClick:()=>D(!1),disabled:k,className:"!bg-red-500/10 !text-red-500 hover:!bg-red-500/20 !border-red-500/30",children:"Disable Cloud"}):(0,t.jsx)(i.$n,{variant:"primary",icon:"cloud_upload",onClick:()=>D(!0),disabled:k,className:"bg-gradient-to-r from-primary to-blue-500 hover:from-primary-hover hover:to-blue-600",children:"Enable Cloud"})})]}),(0,t.jsxs)("div",{className:"flex gap-2 mb-3",children:[(0,t.jsx)(i.pd,{value:J,readOnly:!0,className:"flex-1 font-mono text-sm ".concat(b?"animate-border-glow":"")}),(0,t.jsx)(i.$n,{variant:"secondary",icon:"endpoint_url"===P?"check":"content_copy",onClick:()=>O(J,"endpoint_url"),children:"endpoint_url"===P?"Copied!":"Copy"})]})]}),(0,t.jsxs)(i.Zp,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold",children:"API Keys"}),(0,t.jsx)(i.$n,{icon:"add",onClick:()=>m(!0),children:"Create Key"})]}),0===l.length?(0,t.jsxs)("div",{className:"text-center py-8",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-4xl text-text-muted mb-2",children:"vpn_key"}),(0,t.jsx)("p",{className:"text-sm text-text-muted",children:"No API keys yet"})]}):(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"border-b border-border",children:[(0,t.jsx)("th",{className:"text-left p-3 font-medium",children:"Name"}),(0,t.jsx)("th",{className:"text-left p-3 font-medium",children:"Key"}),(0,t.jsx)("th",{className:"text-left p-3 font-medium",children:"Created"}),(0,t.jsx)("th",{className:"text-left p-3 font-medium",children:"Actions"})]})}),(0,t.jsx)("tbody",{children:l.map(e=>(0,t.jsxs)("tr",{className:"border-b border-border hover:bg-sidebar/30",children:[(0,t.jsx)("td",{className:"p-3 text-sm",children:e.name}),(0,t.jsx)("td",{className:"p-3",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"font-mono text-xs text-text-muted",children:e.key}),(0,t.jsx)(i.$n,{size:"sm",variant:"ghost",icon:P===e.id?"check":"content_copy",onClick:()=>O(e.key,e.id)})]})}),(0,t.jsx)("td",{className:"p-3 text-sm text-text-muted",children:new Date(e.createdAt).toLocaleDateString()}),(0,t.jsx)("td",{className:"p-3",children:(0,t.jsx)(i.$n,{size:"sm",variant:"ghost",icon:"delete",className:"text-red-500",onClick:()=>K(e.id),children:"Delete"})})]},e.id))})]})})]}),!1,(0,t.jsx)(i.aF,{isOpen:f,title:"Enable Cloud Proxy",onClose:()=>j(!1),children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[(0,t.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200 font-medium mb-2",children:"What you will get"}),(0,t.jsxs)("ul",{className:"text-sm text-blue-700 dark:text-blue-300 space-y-1",children:[(0,t.jsx)("li",{children:"• Access your API from anywhere in the world"}),(0,t.jsx)("li",{children:"• Share endpoint with your team easily"}),(0,t.jsx)("li",{children:"• No need to open ports or configure firewall"}),(0,t.jsx)("li",{children:"• Fast global edge network"})]})]}),(0,t.jsxs)("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:[(0,t.jsx)("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 font-medium mb-1",children:"Note"}),(0,t.jsxs)("ul",{className:"text-sm text-yellow-700 dark:text-yellow-300 space-y-1",children:[(0,t.jsx)("li",{children:"• Cloud will keep your auth session for 1 day. If not used, it will be automatically deleted."}),(0,t.jsx)("li",{children:"• Cloud is currently unstable with Claude Code OAuth in some cases."})]})]}),k&&(0,t.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-primary/10 border border-primary/30 rounded-lg",children:[(0,t.jsx)("span",{className:"material-symbols-outlined animate-spin text-primary",children:"progress_activity"}),(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsxs)("p",{className:"text-sm font-medium text-primary",children:["syncing"===_&&"Syncing data to cloud...","verifying"===_&&"Verifying connection..."]})})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(i.$n,{onClick:T,fullWidth:!0,disabled:k,children:k?(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),"syncing"===_?"Syncing...":"Verifying..."]}):"Enable Cloud"}),(0,t.jsx)(i.$n,{onClick:()=>j(!1),variant:"ghost",fullWidth:!0,disabled:k,children:"Cancel"})]})]})}),(0,t.jsx)(i.aF,{isOpen:x,title:"Create API Key",onClose:()=>{m(!1),y("")},children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsx)(i.pd,{label:"Key Name",value:h,onChange:e=>y(e.target.value),placeholder:"Production Key"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(i.$n,{onClick:I,fullWidth:!0,disabled:!h.trim(),children:"Create"}),(0,t.jsx)(i.$n,{onClick:()=>{m(!1),y("")},variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}),(0,t.jsx)(i.aF,{isOpen:!!p,title:"API Key Created",onClose:()=>u(null),children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:[(0,t.jsx)("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 mb-2 font-medium",children:"Save this key now!"}),(0,t.jsx)("p",{className:"text-sm text-yellow-700 dark:text-yellow-300",children:"This is the only time you will see this key. Store it securely."})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(i.pd,{value:p||"",readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,t.jsx)(i.$n,{variant:"secondary",icon:"created_key"===P?"check":"content_copy",onClick:()=>O(p,"created_key"),children:"created_key"===P?"Copied!":"Copy"})]}),(0,t.jsx)(i.$n,{onClick:()=>u(null),fullWidth:!0,children:"Done"})]})}),(0,t.jsx)(i.aF,{isOpen:N,title:"Disable Cloud Proxy",onClose:()=>!k&&v(!1),children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-red-600 dark:text-red-400",children:"warning"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium mb-1",children:"Warning"}),(0,t.jsx)("p",{className:"text-sm text-red-700 dark:text-red-300",children:"All auth sessions will be deleted from cloud."})]})]})}),k&&(0,t.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-primary/10 border border-primary/30 rounded-lg",children:[(0,t.jsx)("span",{className:"material-symbols-outlined animate-spin text-primary",children:"progress_activity"}),(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsxs)("p",{className:"text-sm font-medium text-primary",children:["syncing"===_&&"Syncing latest data...","disabling"===_&&"Disabling cloud..."]})})]}),(0,t.jsx)("p",{className:"text-sm text-text-muted",children:"Are you sure you want to disable cloud proxy?"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(i.$n,{onClick:W,fullWidth:!0,disabled:k,className:"!bg-red-500 hover:!bg-red-600 !text-white",children:k?(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),"syncing"===_?"Syncing...":"Disabling..."]}):"Disable Cloud"}),(0,t.jsx)(i.$n,{onClick:()=>v(!1),variant:"ghost",fullWidth:!0,disabled:k,children:"Cancel"})]})]})})]})}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4244],{709:(e,t,r)=>{r.d(t,{default:()=>i});var s=r(5155),a=r(2115),l=r(3439),n=r(1620);function i(e){let{children:t}=e,[r,i]=(0,a.useState)(!1);return(0,s.jsxs)("div",{className:"flex h-screen w-full overflow-hidden bg-bg",children:[r&&(0,s.jsx)("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>i(!1)}),(0,s.jsx)("div",{className:"hidden lg:flex",children:(0,s.jsx)(l.default,{})}),(0,s.jsx)("div",{className:"fixed inset-y-0 left-0 z-50 transform lg:hidden transition-transform duration-300 ease-in-out ".concat(r?"translate-x-0":"-translate-x-full"),children:(0,s.jsx)(l.default,{onClose:()=>i(!1)})}),(0,s.jsxs)("main",{className:"flex flex-col flex-1 h-full min-w-0 relative transition-colors duration-300",children:[(0,s.jsx)(n.default,{onMenuClick:()=>i(!0)}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto custom-scrollbar p-6 lg:p-10",children:(0,s.jsx)("div",{className:"max-w-7xl mx-auto",children:t})})]})]})}},1255:(e,t,r)=>{r.d(t,{default:()=>l});var s=r(5155),a=r(6319);function l(e){let{children:t,title:r,subtitle:l,icon:n,action:i,padding:o="md",hover:c=!1,className:d,...m}=e;return(0,s.jsxs)("div",{className:(0,a.cn)("bg-surface","border border-border","rounded-xl shadow-soft",c&&"hover:shadow-warm hover:border-primary/30 transition-all cursor-pointer",{none:"",sm:"p-4",md:"p-6",lg:"p-8"}[o],d),...m,children:[(r||i)&&(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[n&&(0,s.jsx)("div",{className:"p-2 rounded-lg bg-bg text-text-muted",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:n})}),(0,s.jsxs)("div",{children:[r&&(0,s.jsx)("h3",{className:"text-text-main font-semibold",children:r}),l&&(0,s.jsx)("p",{className:"text-sm text-text-muted",children:l})]})]}),i]}),t]})}l.Section=function(e){let{children:t,className:r,...l}=e;return(0,s.jsx)("div",{className:(0,a.cn)("p-4 rounded-lg","bg-surface","border border-border",r),...l,children:t})},l.Row=function(e){let{children:t,className:r,...l}=e;return(0,s.jsx)("div",{className:(0,a.cn)("p-3 -mx-3 px-3 border-b border-border last:border-b-0 transition-colors","hover:bg-sidebar",r),...l,children:t})}},1553:(e,t,r)=>{r.d(t,{default:()=>i});var s=r(5155),a=r(2115),l=r(4244),n=r(2694);function i(e){let{isOpen:t,provider:r,providerInfo:i,onSuccess:o,onClose:c}=e,[d,m]=(0,a.useState)("waiting"),[x,u]=(0,a.useState)(null),[h,b]=(0,a.useState)(""),[f,p]=(0,a.useState)(null),[g,j]=(0,a.useState)(!1),[v,y]=(0,a.useState)(null),[N,w]=(0,a.useState)(!1),k=(0,a.useRef)(null),{copied:C,copy:z}=(0,n.C)(),_="localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname;(0,a.useEffect)(()=>{t&&r&&(u(null),b(""),p(null),j(!1),y(null),w(!1),E())},[t,r]);let S=(0,a.useRef)(!1);(0,a.useEffect)(()=>{let e;if(!x)return;S.current=!1;let t=async e=>{if(S.current)return;let{code:t,state:r,error:s,errorDescription:a}=e;if(s){S.current=!0,p(a||s),m("error");return}t&&(S.current=!0,await L(t,r))},r=e=>{var r;e.origin===window.location.origin&&(null==(r=e.data)?void 0:r.type)==="oauth_callback"&&t(e.data.data)};window.addEventListener("message",r);try{(e=new BroadcastChannel("oauth_callback")).onmessage=e=>t(e.data)}catch(e){console.log("BroadcastChannel not supported")}let s=e=>{if("oauth_callback"===e.key&&e.newValue)try{let r=JSON.parse(e.newValue);t(r),localStorage.removeItem("oauth_callback")}catch(e){console.log("Failed to parse localStorage data")}};window.addEventListener("storage",s);try{let e=localStorage.getItem("oauth_callback");if(e){let r=JSON.parse(e);r.timestamp&&Date.now()-r.timestamp<3e4&&(t(r),localStorage.removeItem("oauth_callback"))}}catch(e){}return()=>{window.removeEventListener("message",r),window.removeEventListener("storage",s),e&&e.close()}},[x]);let L=async(e,t)=>{try{let s=await fetch("/api/oauth/".concat(r,"/exchange"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,redirectUri:x.redirectUri,codeVerifier:x.codeVerifier,state:t})}),a=await s.json();if(!s.ok)throw Error(a.error);m("success"),null==o||o()}catch(e){p(e.message),m("error")}},E=async()=>{if(r)try{let e;if(p(null),"github"===r||"qwen"===r){j(!0),m("waiting");let e=await fetch("/api/oauth/".concat(r,"/device-code")),t=await e.json();if(!e.ok)throw Error(t.error);y(t);let s=t.verification_uri_complete||t.verification_uri;s&&window.open(s,"_blank"),P(t.device_code,t.codeVerifier,t.interval||5);return}if("codex"===r)e="http://localhost:1455/auth/callback";else{let t=window.location.port||("https:"===window.location.protocol?"443":"80");e="http://localhost:".concat(t,"/callback")}let t=await fetch("/api/oauth/".concat(r,"/authorize?redirect_uri=").concat(encodeURIComponent(e))),s=await t.json();if(!t.ok)throw Error(s.error);u({...s,redirectUri:e}),"codex"===r?(m("input"),window.open(s.authUrl,"_blank")):_?(m("waiting"),k.current=window.open(s.authUrl,"oauth_popup","width=600,height=700"),k.current||m("input")):(m("input"),window.open(s.authUrl,"_blank"))}catch(e){p(e.message),m("error")}},P=async(e,t,s)=>{w(!0);for(let a=0;a<60;a++){await new Promise(e=>setTimeout(e,1e3*s));try{let a=await fetch("/api/oauth/".concat(r,"/poll"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:e,codeVerifier:t})}),l=await a.json();if(l.success){m("success"),w(!1),null==o||o();return}if("expired_token"===l.error||"access_denied"===l.error)throw Error(l.errorDescription||l.error);"slow_down"===l.error&&(s=Math.min(s+5,30))}catch(e){p(e.message),m("error"),w(!1);return}}p("Authorization timeout"),m("error"),w(!1)},U=async()=>{try{p(null);let e=new URL(h),t=e.searchParams.get("code"),r=e.searchParams.get("state"),s=e.searchParams.get("error");if(s)throw Error(e.searchParams.get("error_description")||s);if(!t)throw Error("No authorization code found in URL");await L(t,r)}catch(e){p(e.message),m("error")}};return r&&i?(0,s.jsx)(l.aF,{isOpen:t,title:"Connect ".concat(i.name),onClose:c,size:"lg",children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:["waiting"===d&&!g&&(0,s.jsxs)("div",{className:"text-center py-6",children:[(0,s.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,s.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Waiting for Authorization"}),(0,s.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Complete the authorization in the popup window."}),(0,s.jsx)(l.$n,{variant:"ghost",onClick:()=>m("input"),children:"Popup blocked? Enter URL manually"})]}),"waiting"===d&&g&&v&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"text-center py-4",children:[(0,s.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Visit the URL below and enter the code:"}),(0,s.jsxs)("div",{className:"bg-sidebar p-4 rounded-lg mb-4",children:[(0,s.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Verification URL"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("code",{className:"flex-1 text-sm break-all",children:v.verification_uri}),(0,s.jsx)(l.$n,{size:"sm",variant:"ghost",icon:"verify_url"===C?"check":"content_copy",onClick:()=>z(v.verification_uri,"verify_url")})]})]}),(0,s.jsxs)("div",{className:"bg-primary/10 p-4 rounded-lg",children:[(0,s.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Your Code"}),(0,s.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,s.jsx)("p",{className:"text-2xl font-mono font-bold text-primary",children:v.user_code}),(0,s.jsx)(l.$n,{size:"sm",variant:"ghost",icon:"user_code"===C?"check":"content_copy",onClick:()=>z(v.user_code,"user_code")})]})]})]}),N&&(0,s.jsxs)("div",{className:"flex items-center justify-center gap-2 text-sm text-text-muted",children:[(0,s.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),"Waiting for authorization..."]})]}),"input"===d&&!g&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(l.pd,{value:(null==x?void 0:x.authUrl)||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,s.jsx)(l.$n,{variant:"secondary",icon:"auth_url"===C?"check":"content_copy",onClick:()=>z(null==x?void 0:x.authUrl,"auth_url"),children:"Copy"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,s.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser."}),(0,s.jsx)(l.pd,{value:h,onChange:e=>b(e.target.value),placeholder:"".concat(window.location.origin,"/callback?code=..."),className:"font-mono text-xs"})]})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(l.$n,{onClick:U,fullWidth:!0,disabled:!h,children:"Connect"}),(0,s.jsx)(l.$n,{onClick:c,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"success"===d&&(0,s.jsxs)("div",{className:"text-center py-6",children:[(0,s.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,s.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,s.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your ",i.name," account has been connected."]}),(0,s.jsx)(l.$n,{onClick:c,fullWidth:!0,children:"Done"})]}),"error"===d&&(0,s.jsxs)("div",{className:"text-center py-6",children:[(0,s.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,s.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,s.jsx)("p",{className:"text-sm text-red-600 mb-4",children:f}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(l.$n,{onClick:E,variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,s.jsx)(l.$n,{onClick:c,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}},1620:(e,t,r)=>{r.d(t,{default:()=>c});var s=r(5155),a=r(63),l=r(2619),n=r.n(l),i=r(4244),o=r(4156);function c(e){let{onMenuClick:t,showMenuButton:r=!0}=e,{title:l,description:c,breadcrumbs:d}=(e=>{if(!e)return{title:"",description:"",breadcrumbs:[]};let t=e.match(/\/providers\/([^/]+)$/);if(t){let e=t[1],r=o.zN[e]||o.fg[e];if(r)return{title:r.name,description:"",breadcrumbs:[{label:"Providers",href:"/dashboard/providers"},{label:r.name,image:"/providers/".concat(r.id,".png")}]}}return e.includes("/providers")?{title:"Providers",description:"Manage your AI provider connections",breadcrumbs:[]}:e.includes("/combos")?{title:"Combos",description:"Model combos with fallback",breadcrumbs:[]}:e.includes("/cli-tools")?{title:"CLI Tools",description:"Configure CLI tools",breadcrumbs:[]}:e.includes("/endpoint")?{title:"Endpoint",description:"API endpoint configuration",breadcrumbs:[]}:e.includes("/profile")?{title:"Settings",description:"Manage your preferences",breadcrumbs:[]}:"/dashboard"===e?{title:"Endpoint",description:"API endpoint configuration",breadcrumbs:[]}:{title:"",description:"",breadcrumbs:[]}})((0,a.usePathname)());return(0,s.jsxs)("header",{className:"flex items-center justify-between px-8 py-5 border-b border-border bg-bg/80 backdrop-blur-md z-10 sticky top-0",children:[(0,s.jsx)("div",{className:"flex items-center gap-3 lg:hidden",children:r&&(0,s.jsx)("button",{onClick:t,className:"text-text-main hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined",children:"menu"})})}),(0,s.jsx)("div",{className:"hidden lg:flex flex-col",children:d.length>0?(0,s.jsx)("div",{className:"flex items-center gap-2",children:d.map((e,t)=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[t>0&&(0,s.jsx)("span",{className:"material-symbols-outlined text-text-muted text-base",children:"chevron_right"}),e.href?(0,s.jsx)(n(),{href:e.href,className:"text-text-muted hover:text-primary transition-colors",children:e.label}):(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[e.image&&(0,s.jsx)("img",{src:e.image,alt:e.label,className:"size-7 object-contain rounded",onError:e=>{e.target.style.display="none"}}),(0,s.jsx)("h1",{className:"text-2xl font-semibold text-text-main tracking-tight",children:e.label})]})]},t))}):l?(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-2xl font-semibold text-text-main tracking-tight",children:l}),c&&(0,s.jsx)("p",{className:"text-sm text-text-muted",children:c})]}):null}),(0,s.jsx)("div",{className:"flex items-center gap-3 ml-auto",children:(0,s.jsx)(i.UW,{})})]})}},1980:(e,t,r)=>{r.d(t,{default:()=>l});var s=r(5155),a=r(6319);function l(e){let{src:t,alt:r="Avatar",name:l,size:n="md",className:i}=e,o={xs:"size-6 text-xs",sm:"size-8 text-sm",md:"size-10 text-base",lg:"size-12 text-lg",xl:"size-16 text-xl"};return t?(0,s.jsx)("div",{className:(0,a.cn)("rounded-full bg-cover bg-center bg-no-repeat","ring-2 ring-white dark:ring-surface-dark shadow-sm",o[n],i),style:{backgroundImage:"url(".concat(t,")")},role:"img","aria-label":r}):(0,s.jsx)("div",{className:(0,a.cn)("rounded-full flex items-center justify-center font-semibold text-white","ring-2 ring-white dark:ring-surface-dark shadow-sm",o[n],(e=>{if(!e)return"bg-primary";let t=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],r=e.charCodeAt(0)%t.length;return t[r]})(l),i),role:"img","aria-label":r,children:(e=>{if(!e)return"?";let t=e.split(" ");return t.length>=2?"".concat(t[0][0]).concat(t[1][0]).toUpperCase():e.substring(0,2).toUpperCase()})(l)})}},2411:(e,t,r)=>{r.d(t,{default:()=>l});var s=r(5155),a=r(6319);function l(e){let{label:t,type:r="text",placeholder:l,value:n,onChange:i,error:o,hint:c,icon:d,disabled:m=!1,required:x=!1,className:u,inputClassName:h,...b}=e;return(0,s.jsxs)("div",{className:(0,a.cn)("flex flex-col gap-1.5",u),children:[t&&(0,s.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[t,x&&(0,s.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,s.jsxs)("div",{className:"relative",children:[d&&(0,s.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-text-muted",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:d})}),(0,s.jsx)("input",{type:r,placeholder:l,value:n,onChange:i,disabled:m,className:(0,a.cn)("w-full py-2.5 px-4 text-sm text-text-main","bg-surface border rounded-lg","placeholder-text-muted/60","focus:ring-2 focus:ring-primary/20 focus:border-primary focus:outline-none","transition-all shadow-sm disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",d&&"pl-10",o?"border-red-500 focus:border-red-500 focus:ring-red-500/20":"border-border",h),...b})]}),o&&(0,s.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),c&&!o&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:c})]})}},2513:(e,t,r)=>{r.d(t,{default:()=>i});var s=r(5155),a=r(6319);let l={primary:"bg-primary text-white hover:bg-primary-hover shadow-warm",secondary:"bg-surface border border-border text-text-main hover:bg-black/5 shadow-sm",outline:"border border-border text-text-main hover:bg-black/5",ghost:"text-text-muted hover:bg-black/5 hover:text-text-main",danger:"bg-red-500 text-white hover:bg-red-600 shadow-sm"},n={sm:"h-8 px-3 text-xs rounded-md",md:"h-10 px-5 text-sm rounded-lg",lg:"h-12 px-8 text-base rounded-xl"};function i(e){let{children:t,variant:r="primary",size:i="md",icon:o,iconRight:c,disabled:d=!1,loading:m=!1,fullWidth:x=!1,className:u,...h}=e;return(0,s.jsxs)("button",{className:(0,a.cn)("inline-flex items-center justify-center gap-2 font-medium transition-all duration-200 cursor-pointer","active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed disabled:active:scale-100",l[r],n[i],x&&"w-full",u),disabled:d||m,...h,children:[m?(0,s.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}):o?(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:o}):null,t,c&&!m&&(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:c})]})}},2694:(e,t,r)=>{r.d(t,{C:()=>a});var s=r(2115);function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2e3,[t,r]=(0,s.useState)(null),a=(0,s.useRef)(null);return{copied:t,copy:(0,s.useCallback)(function(t){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";navigator.clipboard.writeText(t),r(s),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{r(null)},e)},[e])}}},2923:(e,t,r)=>{r.d(t,{default:()=>o});var s=r(5155),a=r(2115),l=r(4202),n=r(505),i=r(9608);function o(e){let{isOpen:t,onClose:r,onSelect:o,selectedModel:c,activeProviders:d=[],title:m="Select Model",modelAliases:x={}}=e,[u,h]=(0,a.useState)(""),b=(0,a.useMemo)(()=>{let e={};return(d.length>0?d.map(e=>e.provider):Object.keys(i.Q2)).forEach(t=>{let r=n.Xg[t]||t,s=i.Q2[t]||{name:t,color:"#666"};if(s.passthroughModels){let a=Object.entries(x).filter(e=>{let[,t]=e;return t.startsWith("".concat(r,"/"))}).map(e=>{let[t,s]=e;return{id:s.replace("".concat(r,"/"),""),name:t,value:s}});a.length>0&&(e[t]={name:s.name,alias:r,color:s.color,models:a})}else{let a=(0,n.KC)(t);a.length>0&&(e[t]={name:s.name,alias:r,color:s.color,models:a.map(e=>({id:e.id,name:e.name,value:"".concat(r,"/").concat(e.id)}))})}}),e},[d,x]),f=(0,a.useMemo)(()=>{if(!u.trim())return b;let e=u.toLowerCase(),t={};return Object.entries(b).forEach(r=>{let[s,a]=r,l=a.models.filter(t=>t.name.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||a.name.toLowerCase().includes(e));l.length>0&&(t[s]={...a,models:l})}),t},[b,u]);return(0,s.jsxs)(l.default,{isOpen:t,onClose:()=>{r(),h("")},title:m,size:"md",className:"!p-4",children:[(0,s.jsx)("div",{className:"mb-3",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("span",{className:"material-symbols-outlined absolute left-2.5 top-1/2 -translate-y-1/2 text-text-muted text-[16px]",children:"search"}),(0,s.jsx)("input",{type:"text",placeholder:"Search...",value:u,onChange:e=>h(e.target.value),className:"w-full pl-8 pr-3 py-1.5 bg-surface border border-border rounded text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"})]})}),(0,s.jsxs)("div",{className:"max-h-[300px] overflow-y-auto space-y-3",children:[Object.entries(f).map(e=>{let[t,a]=e;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,s.jsx)("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:a.color}}),(0,s.jsx)("span",{className:"text-xs font-medium text-primary",children:a.name}),(0,s.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",a.models.length,")"]})]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.models.map(e=>{let t=c===e.value;return(0,s.jsx)("button",{onClick:()=>{o(e),r(),h("")},className:"\n px-2 py-1 rounded-xl text-xs font-medium transition-all border hover:cursor-pointer\n ".concat(t?"bg-primary text-white border-primary":"bg-surface border-border text-text-main hover:border-primary/50 hover:bg-primary/5","\n "),children:e.name},e.id)})})]},t)}),0===Object.keys(f).length&&(0,s.jsxs)("div",{className:"text-center py-4 text-text-muted",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-2xl mb-1 block",children:"search_off"}),(0,s.jsx)("p",{className:"text-xs",children:"No models found"})]})]})]})}},3222:(e,t,r)=>{r.d(t,{default:()=>n});var s=r(5155),a=r(5157),l=r(6319);function n(e){let{className:t,variant:r="default"}=e,{theme:n,toggleTheme:i,isDark:o}=(0,a.D)(),c={default:(0,l.cn)("flex items-center justify-center size-10 rounded-full","text-text-muted","hover:bg-black/5","hover:text-text-main","transition-colors"),card:(0,l.cn)("flex items-center justify-center size-11 rounded-full","bg-surface/60","hover:bg-surface","border border-border","backdrop-blur-md shadow-sm hover:shadow-md","text-text-muted-light hover:text-primary","hover:text-primary","transition-all group")};return(0,s.jsx)("button",{onClick:i,className:(0,l.cn)(c[r],t),"aria-label":"Switch to ".concat(o?"light":"dark"," mode"),title:"Switch to ".concat(o?"light":"dark"," mode"),children:(0,s.jsx)("span",{className:(0,l.cn)("material-symbols-outlined text-[22px]","card"===r&&"transition-transform duration-300 group-hover:rotate-12"),children:o?"light_mode":"dark_mode"})})}},3367:(e,t,r)=>{r.d(t,{CardSkeleton:()=>o,PageLoading:()=>n,Skeleton:()=>i,Spinner:()=>l,default:()=>c});var s=r(5155),a=r(6319);function l(e){let{size:t="md",className:r}=e;return(0,s.jsx)("span",{className:(0,a.cn)("material-symbols-outlined animate-spin text-primary",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[t],r),children:"progress_activity"})}function n(e){let{message:t="Loading..."}=e;return(0,s.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,s.jsx)(l,{size:"xl"}),(0,s.jsx)("p",{className:"mt-4 text-text-muted",children:t})]})}function i(e){let{className:t,...r}=e;return(0,s.jsx)("div",{className:(0,a.cn)("animate-pulse rounded-lg bg-border",t),...r})}function o(){return(0,s.jsxs)("div",{className:"p-6 rounded-xl border border-border bg-surface",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsx)(i,{className:"h-4 w-24"}),(0,s.jsx)(i,{className:"size-10 rounded-lg"})]}),(0,s.jsx)(i,{className:"h-8 w-16 mb-2"}),(0,s.jsx)(i,{className:"h-3 w-20"})]})}function c(e){let{type:t="spinner",...r}=e;switch(t){case"page":return(0,s.jsx)(n,{...r});case"skeleton":return(0,s.jsx)(i,{...r});case"card":return(0,s.jsx)(o,{...r});default:return(0,s.jsx)(l,{...r})}}},3439:(e,t,r)=>{r.d(t,{default:()=>h});var s=r(5155),a=r(2115),l=r(2619),n=r.n(l),i=r(63),o=r(6319),c=r(4156),d=r(2513),m=r(4202);let x=[{href:"/dashboard/endpoint",label:"Endpoint",icon:"api"},{href:"/dashboard/providers",label:"Providers",icon:"dns"},{href:"/dashboard/combos",label:"Combos",icon:"layers"},{href:"/dashboard/cli-tools",label:"CLI Tools",icon:"terminal"}],u=[{href:"/dashboard/profile",label:"Settings",icon:"settings"}];function h(e){let{onClose:t}=e,r=(0,i.usePathname)(),[l,h]=(0,a.useState)(!1),[b,f]=(0,a.useState)(!1),[p,g]=(0,a.useState)(!1),j=e=>"/dashboard/endpoint"===e?"/dashboard"===r||r.startsWith("/dashboard/endpoint"):r.startsWith(e),v=async()=>{f(!0);try{await fetch("/api/shutdown",{method:"POST"})}catch(e){}f(!1),h(!1),g(!0)};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("aside",{className:"flex w-72 flex-col border-r border-border bg-sidebar transition-colors duration-300",children:[(0,s.jsx)("div",{className:"p-8",children:(0,s.jsxs)(n(),{href:"/dashboard",className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"flex items-center justify-center size-9 rounded bg-gradient-to-br from-[#f97815] to-[#c2590a]",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-white text-[20px]",children:"hub"})}),(0,s.jsx)("h1",{className:"text-lg font-semibold tracking-tight text-text-main",children:c.vQ.name})]})}),(0,s.jsxs)("nav",{className:"flex-1 px-4 py-2 space-y-1 overflow-y-auto custom-scrollbar",children:[x.map(e=>(0,s.jsxs)(n(),{href:e.href,onClick:t,className:(0,o.cn)("flex items-center gap-3 px-4 py-3 rounded-lg transition-all group",j(e.href)?"bg-surface text-primary shadow-sm border border-border":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,s.jsx)("span",{className:(0,o.cn)("material-symbols-outlined text-[20px]",j(e.href)?"fill-1":"group-hover:text-primary transition-colors"),children:e.icon}),(0,s.jsx)("span",{className:"text-sm font-medium",children:e.label})]},e.href)),(0,s.jsxs)("div",{className:"pt-6 mt-2",children:[(0,s.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-3",children:"System"}),u.map(e=>(0,s.jsxs)(n(),{href:e.href,onClick:t,className:(0,o.cn)("flex items-center gap-3 px-4 py-3 rounded-lg transition-all group",j(e.href)?"bg-surface text-primary shadow-sm border border-border":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px] group-hover:text-primary transition-colors",children:e.icon}),(0,s.jsx)("span",{className:"text-sm font-medium",children:e.label})]},e.href))]})]}),(0,s.jsxs)("div",{className:"p-4 border-t border-border",children:[(0,s.jsxs)("div",{className:"flex items-start gap-3 p-3 rounded-xl bg-surface border border-border mb-3",children:[(0,s.jsx)("div",{className:"flex items-center justify-center size-8 rounded-lg bg-blue-500/10 text-blue-500 shrink-0 mt-0.5",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"info"})}),(0,s.jsx)("div",{className:"flex flex-col",children:(0,s.jsx)("span",{className:"text-xs font-medium text-text-main leading-relaxed",children:"Service is running in terminal. You can close this web page. Shutdown will stop the service."})})]}),(0,s.jsx)(d.default,{variant:"outline",fullWidth:!0,icon:"power_settings_new",onClick:()=>h(!0),className:"text-red-500 border-red-200 hover:bg-red-50 hover:border-red-300",children:"Shutdown"})]})]}),(0,s.jsx)(m.ConfirmModal,{isOpen:l,onClose:()=>h(!1),onConfirm:v,title:"Close Proxy",message:"Are you sure you want to close the proxy server?",confirmText:"Close",cancelText:"Cancel",variant:"danger",loading:b}),p&&(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",children:(0,s.jsxs)("div",{className:"text-center p-8",children:[(0,s.jsx)("div",{className:"flex items-center justify-center size-16 rounded-full bg-red-500/20 text-red-500 mx-auto mb-4",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"power_off"})}),(0,s.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:"Server Disconnected"}),(0,s.jsx)("p",{className:"text-text-muted mb-6",children:"The proxy server has been stopped."}),(0,s.jsx)(d.default,{variant:"secondary",onClick:()=>window.location.reload(),children:"Reload Page"})]})})]})}},3461:(e,t,r)=>{r.d(t,{default:()=>l});var s=r(5155),a=r(4244);function l(e){let{children:t}=e;return(0,s.jsxs)("div",{className:"min-h-screen flex flex-col relative bg-bg transition-colors duration-500 overflow-x-hidden selection:bg-primary/20 selection:text-primary",children:[(0,s.jsx)("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[800px] h-[800px] bg-primary/5 dark:bg-primary/5 rounded-full blur-[100px] pointer-events-none z-0"}),(0,s.jsx)("div",{className:"fixed bottom-0 right-0 w-[600px] h-[600px] bg-orange-200/20 dark:bg-orange-900/10 rounded-full blur-[120px] pointer-events-none z-0 translate-y-1/3 translate-x-1/3"}),(0,s.jsx)("div",{className:"absolute top-6 right-6 z-20",children:(0,s.jsx)(a.UW,{variant:"card"})}),(0,s.jsx)("main",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-6 z-10 w-full h-full",children:t})]})}},3876:(e,t,r)=>{r.d(t,{default:()=>i});var s=r(5155),a=r(6319);let l={default:"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300",primary:"bg-primary/10 text-primary",success:"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400 border border-green-100 dark:border-green-800/30",warning:"bg-yellow-50 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-500 border border-yellow-100 dark:border-yellow-800/30",error:"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400 border border-red-100 dark:border-red-800/30",info:"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 border border-blue-100 dark:border-blue-800/30"},n={sm:"px-2 py-0.5 text-[10px]",md:"px-2.5 py-1 text-xs",lg:"px-3 py-1.5 text-sm"};function i(e){let{children:t,variant:r="default",size:i="md",dot:o=!1,icon:c,className:d}=e;return(0,s.jsxs)("span",{className:(0,a.cn)("inline-flex items-center gap-1.5 rounded-full font-semibold",l[r],n[i],d),children:[o&&(0,s.jsx)("span",{className:(0,a.cn)("size-1.5 rounded-full","success"===r&&"bg-green-500","warning"===r&&"bg-yellow-500","error"===r&&"bg-red-500","info"===r&&"bg-blue-500","primary"===r&&"bg-primary","default"===r&&"bg-gray-500")}),c&&(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:c}),t]})}},4202:(e,t,r)=>{r.d(t,{ConfirmModal:()=>o,default:()=>i});var s=r(5155),a=r(2115),l=r(6319),n=r(2513);function i(e){let{isOpen:t,onClose:r,title:n,children:i,footer:o,size:c="md",closeOnOverlay:d=!0,showCloseButton:m=!0,className:x}=e;return((0,a.useEffect)(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[t]),(0,a.useEffect)(()=>{let e=e=>{"Escape"===e.key&&t&&r()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t,r]),t)?(0,s.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:d?r:void 0}),(0,s.jsxs)("div",{className:(0,l.cn)("relative w-full bg-surface","border border-border","rounded-2xl shadow-elevated","animate-in fade-in zoom-in-95 duration-200",{sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-4xl"}[c],x),children:[(n||m)&&(0,s.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-border",children:[n&&(0,s.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:n}),m&&(0,s.jsx)("button",{onClick:r,className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,s.jsx)("div",{className:"p-6 max-h-[calc(80vh-140px)] overflow-y-auto",children:i}),o&&(0,s.jsx)("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-border",children:o})]})]}):null}function o(e){let{isOpen:t,onClose:r,onConfirm:a,title:l="Confirm",message:o,confirmText:c="Confirm",cancelText:d="Cancel",variant:m="danger",loading:x=!1}=e;return(0,s.jsx)(i,{isOpen:t,onClose:r,title:l,size:"sm",footer:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.default,{variant:"ghost",onClick:r,disabled:x,children:d}),(0,s.jsx)(n.default,{variant:m,onClick:a,loading:x,children:c})]}),children:(0,s.jsx)("p",{className:"text-text-muted",children:o})})}},4244:(e,t,r)=>{r.d(t,{Ex:()=>c.default,$n:()=>s.default,Zp:()=>n.default,Qv:()=>o.CardSkeleton,pd:()=>a.default,aF:()=>i.default,rq:()=>u.default,LF:()=>x.default,l6:()=>l.default,UW:()=>m.default,lM:()=>d.default});var s=r(2513),a=r(2411),l=r(7897),n=r(1255),i=r(4202),o=r(3367);r(1980);var c=r(3876),d=r(9957),m=r(3222);r(9955),r(3439),r(1620),r(4486);var x=r(1553),u=r(2923);r(709),r(3461)},4486:(e,t,r)=>{r.d(t,{default:()=>o});var s=r(5155),a=r(2619),l=r.n(a),n=r(4156);let i={product:[{label:"Features",href:"#features"},{label:"Pricing",href:"#pricing"},{label:"Changelog",href:"#"}],resources:[{label:"Documentation",href:"#"},{label:"API Reference",href:"#"},{label:"Help Center",href:"#"}],company:[{label:"About",href:"#"},{label:"Blog",href:"#"},{label:"Contact",href:"#"}]};function o(){return(0,s.jsx)("footer",{className:"bg-bg border-t border-border pt-16 pb-12",children:(0,s.jsxs)("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8",children:[(0,s.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-10 mb-12",children:[(0,s.jsxs)("div",{className:"col-span-2 lg:col-span-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,s.jsx)("div",{className:"size-6 text-primary",children:(0,s.jsx)("svg",{className:"w-full h-full",fill:"currentColor",viewBox:"0 0 48 48",children:(0,s.jsx)("path",{clipRule:"evenodd",d:"M12.0799 24L4 19.2479L9.95537 8.75216L18.04 13.4961L18.0446 4H29.9554L29.96 13.4961L38.0446 8.75216L44 19.2479L35.92 24L44 28.7521L38.0446 39.2479L29.96 34.5039L29.9554 44H18.0446L18.04 34.5039L9.95537 39.2479L4 28.7521L12.0799 24Z",fillRule:"evenodd"})})}),(0,s.jsx)("span",{className:"text-xl font-bold text-text-main",children:n.vQ.name})]}),(0,s.jsx)("p",{className:"text-text-muted mb-6 max-w-sm font-light",children:"The unified interface for modern AI infrastructure. Secure, observable, and scalable."}),(0,s.jsxs)("div",{className:"flex gap-4",children:[(0,s.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"Twitter",children:(0,s.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"M22.46 6c-.77.35-1.6.58-2.46.69.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21 16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56.84-.6 1.56-1.36 2.14-2.23z"})})}),(0,s.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"GitHub",children:(0,s.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})})})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Product"}),(0,s.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:i.product.map(e=>(0,s.jsx)("li",{children:(0,s.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Resources"}),(0,s.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:i.resources.map(e=>(0,s.jsx)("li",{children:(0,s.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Company"}),(0,s.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:i.company.map(e=>(0,s.jsx)("li",{children:(0,s.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]})]}),(0,s.jsxs)("div",{className:"border-t border-border pt-8 flex flex-col md:flex-row justify-between items-center gap-4",children:[(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:["\xa9 ",new Date().getFullYear()," ",n.vQ.name," Inc. All rights reserved."]}),(0,s.jsxs)("div",{className:"flex gap-6 text-sm text-text-muted",children:[(0,s.jsx)(l(),{href:"#",className:"hover:text-primary transition-colors",children:"Privacy Policy"}),(0,s.jsx)(l(),{href:"#",className:"hover:text-primary transition-colors",children:"Terms of Service"})]})]})]})})}},5157:(e,t,r)=>{r.d(t,{D:()=>l});var s=r(2115),a=r(1070);function l(){let{theme:e,setTheme:t,toggleTheme:r,initTheme:l}=(0,a.A)();return(0,s.useEffect)(()=>{l();let t=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>{"system"===e&&l()};return t.addEventListener("change",r),()=>t.removeEventListener("change",r)},[e,l]),{theme:e,setTheme:t,toggleTheme:r,isDark:"dark"===e||"system"===e&&window.matchMedia("(prefers-color-scheme: dark)").matches}}},6319:(e,t,r)=>{r.d(t,{cn:()=>s});function s(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter(Boolean).join(" ").replace(/\s+/g," ").trim()}},7897:(e,t,r)=>{r.d(t,{default:()=>l});var s=r(5155),a=r(6319);function l(e){let{label:t,options:r=[],value:l,onChange:n,placeholder:i="Select an option",error:o,hint:c,disabled:d=!1,required:m=!1,className:x,selectClassName:u,...h}=e;return(0,s.jsxs)("div",{className:(0,a.cn)("flex flex-col gap-1.5",x),children:[t&&(0,s.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[t,m&&(0,s.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsxs)("select",{value:l,onChange:n,disabled:d,className:(0,a.cn)("w-full py-2.5 px-4 pr-10 text-sm text-text-main","bg-surface border rounded-lg appearance-none","focus:ring-2 focus:ring-primary/20 focus:border-primary focus:outline-none","transition-all shadow-sm disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",o?"border-red-500 focus:border-red-500 focus:ring-red-500/20":"border-border",u),...h,children:[(0,s.jsx)("option",{value:"",disabled:!0,children:i}),r.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))]}),(0,s.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-text-muted",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"expand_more"})})]}),o&&(0,s.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),c&&!o&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:c})]})}},9957:(e,t,r)=>{r.d(t,{default:()=>l});var s=r(5155),a=r(6319);function l(e){let{checked:t=!1,onChange:r,label:l,description:n,disabled:i=!1,size:o="md",className:c}=e,d={sm:{track:"w-8 h-4",thumb:"size-3",translate:"translate-x-4"},md:{track:"w-11 h-6",thumb:"size-5",translate:"translate-x-5"},lg:{track:"w-14 h-7",thumb:"size-6",translate:"translate-x-7"}};return(0,s.jsxs)("div",{className:(0,a.cn)("flex items-center gap-3",i&&"opacity-50 cursor-not-allowed",c),children:[(0,s.jsx)("button",{type:"button",role:"switch","aria-checked":t,disabled:i,onClick:()=>{!i&&r&&r(!t)},className:(0,a.cn)("relative inline-flex shrink-0 cursor-pointer rounded-full","transition-colors duration-200 ease-in-out","focus:outline-none focus:ring-2 focus:ring-primary/20 focus:ring-offset-2","dark:focus:ring-offset-surface-dark",t?"bg-primary":"bg-border",d[o].track,i&&"cursor-not-allowed"),children:(0,s.jsx)("span",{className:(0,a.cn)("pointer-events-none inline-block rounded-full bg-white shadow-sm","transform transition duration-200 ease-in-out",t?d[o].translate:"translate-x-0.5",d[o].thumb,"mt-0.5")})}),(l||n)&&(0,s.jsxs)("div",{className:"flex flex-col",children:[l&&(0,s.jsx)("span",{className:"text-sm font-medium text-text-main",children:l}),n&&(0,s.jsx)("span",{className:"text-xs text-text-muted",children:n})]})]})}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9955],{505:(e,i,n)=>{n.d(i,{Xg:()=>t,vq:()=>a,KC:()=>o}),n(9562);let a={cc:[{id:"claude-opus-4-5-20251101",name:"Claude 4.5 Opus"},{id:"claude-sonnet-4-5-20250929",name:"Claude 4.5 Sonnet"},{id:"claude-haiku-4-5-20251001",name:"Claude 4.5 Haiku"}],cx:[{id:"gpt-5.2-codex",name:"GPT 5.2 Codex"},{id:"gpt-5.2",name:"GPT 5.2"},{id:"gpt-5.1-codex-max",name:"GPT 5.1 Codex Max"},{id:"gpt-5.1-codex",name:"GPT 5.1 Codex"},{id:"gpt-5.1-codex-mini",name:"GPT 5.1 Codex Mini"},{id:"gpt-5.1",name:"GPT 5.1"},{id:"gpt-5-codex",name:"GPT 5 Codex"},{id:"gpt-5-codex-mini",name:"GPT 5 Codex Mini"}],gc:[{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview"},{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash"},{id:"gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite"}],qw:[{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus"},{id:"qwen3-coder-flash",name:"Qwen3 Coder Flash"},{id:"vision-model",name:"Qwen3 Vision Model"}],if:[{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus"},{id:"kimi-k2",name:"Kimi K2"},{id:"kimi-k2-thinking",name:"Kimi K2 Thinking"},{id:"deepseek-r1",name:"DeepSeek R1"},{id:"deepseek-v3.2-chat",name:"DeepSeek V3.2 Chat"},{id:"deepseek-v3.2-reasoner",name:"DeepSeek V3.2 Reasoner"},{id:"minimax-m2",name:"MiniMax M2"},{id:"glm-4.6",name:"GLM 4.6"},{id:"glm-4.7",name:"GLM 4.7"}],ag:[{id:"gemini-3-pro-low",name:"Gemini 3 Pro Low"},{id:"gemini-3-pro-high",name:"Gemini 3 Pro High"},{id:"gemini-3-flash",name:"Gemini 3 Flash"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash"},{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5 "},{id:"claude-sonnet-4-5-thinking",name:"Claude Sonnet 4.5 Thinking"},{id:"claude-opus-4-5-thinking",name:"Claude Opus 4.5"}],gh:[{id:"gpt-5",name:"GPT-5"},{id:"gpt-5-mini",name:"GPT-5 Mini"},{id:"gpt-5.1-codex",name:"GPT-5.1 Codex"},{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max"},{id:"gpt-4.1",name:"GPT-4.1"},{id:"claude-4.5-sonnet",name:"Claude 4.5 Sonnet"},{id:"claude-4.5-opus",name:"Claude 4.5 Opus"},{id:"claude-4.5-haiku",name:"Claude 4.5 Haiku"},{id:"gemini-3-pro",name:"Gemini 3 Pro"},{id:"gemini-3-flash",name:"Gemini 3 Flash"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro"},{id:"grok-code-fast-1",name:"Grok Code Fast 1"}],openai:[{id:"gpt-4o",name:"GPT-4o"},{id:"gpt-4o-mini",name:"GPT-4o Mini"},{id:"gpt-4-turbo",name:"GPT-4 Turbo"},{id:"o1",name:"O1"},{id:"o1-mini",name:"O1 Mini"}],anthropic:[{id:"claude-sonnet-4-20250514",name:"Claude Sonnet 4"},{id:"claude-opus-4-20250514",name:"Claude Opus 4"},{id:"claude-3-5-sonnet-20241022",name:"Claude 3.5 Sonnet"}],gemini:[{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash"},{id:"gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite"}],openrouter:[{id:"auto",name:"Auto (Best Available)"}],glm:[{id:"glm-4.7",name:"GLM 4.7"},{id:"glm-4.6",name:"GLM 4.6"},{id:"glm-4.6v",name:"GLM 4.6V (Vision)"}],kimi:[{id:"kimi-latest",name:"Kimi Latest"}],minimax:[{id:"MiniMax-M2.1",name:"MiniMax M2.1"}]},t={claude:"cc",codex:"cx","gemini-cli":"gc",qwen:"qw",iflow:"if",antigravity:"ag",github:"gh",openai:"openai",anthropic:"anthropic",gemini:"gemini",openrouter:"openrouter",glm:"glm",kimi:"kimi",minimax:"minimax"};function o(e){return a[t[e]||e]||[]}n(6775),n(4427),n(6562),n(3971);var r,l,s=n(5704);void 0!==s&&(null==(r=s.versions)||r.node),void 0!==s&&(null==(l=s.env)||l.ENABLE_REQUEST_LOGS),Object.entries(n(9608).Q2).filter(e=>{let[,i]=e;return i.passthroughModels}).map(e=>{let[i]=e;return i}),Object.entries(a).flatMap(e=>{let[i,n]=e;return n.map(e=>({provider:i,model:e.id,name:e.name}))})},1070:(e,i,n)=>{n.d(i,{A:()=>l});var a=n(5959),t=n(9863),o=n(4156);function r(e){let i=document.documentElement,n=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";"dark"===("system"===e?n:e)?i.classList.add("dark"):i.classList.remove("dark")}let l=(0,a.v)((0,t.Zr)((e,i)=>({theme:o.B2.defaultTheme,setTheme:i=>{e({theme:i}),r(i)},toggleTheme:()=>{let n="dark"===i().theme?"light":"dark";e({theme:n}),r(n)},initTheme:()=>{r(i().theme)}}),{name:o.B2.storageKey}))},3971:(e,i,n)=>{n.d(i,{refreshCopilotToken:()=>o,refreshGitHubToken:()=>t});var a=n(9562);async function t(e,i){var n,t;let o=await fetch(a.NA.github.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:e,client_id:a.xq.github.clientId,client_secret:a.xq.github.clientSecret})});if(!o.ok){let e=await o.text();return null==i||null==(t=i.error)||t.call(i,"TOKEN_REFRESH","Failed to refresh GitHub token",{status:o.status,error:e}),null}let r=await o.json();return null==i||null==(n=i.info)||n.call(i,"TOKEN_REFRESH","Successfully refreshed GitHub token",{hasNewAccessToken:!!r.access_token,hasNewRefreshToken:!!r.refresh_token,expiresIn:r.expires_in}),{accessToken:r.access_token,refreshToken:r.refresh_token||e,expiresIn:r.expires_in}}async function o(e,i){var n,a,t;try{let t=await fetch("https://api.github.com/copilot_internal/v2/token",{headers:{Authorization:"Bearer ".concat(e),"User-Agent":"GitHub-Copilot/1.0",Accept:"*/*"}});if(!t.ok){let e=await t.text();return null==i||null==(a=i.error)||a.call(i,"TOKEN_REFRESH","Failed to refresh Copilot token",{status:t.status,error:e}),null}let o=await t.json();return null==i||null==(n=i.info)||n.call(i,"TOKEN_REFRESH","Successfully refreshed Copilot token",{hasToken:!!o.token,expiresAt:o.expires_at}),{token:o.token,expiresAt:o.expires_at}}catch(e){return null==i||null==(t=i.error)||t.call(i,"TOKEN_REFRESH","Error refreshing Copilot token",{error:e.message}),null}}},4156:(e,i,n)=>{n.d(i,{B2:()=>o,MA:()=>a.MA,Q2:()=>a.Q2,fg:()=>a.fg,vQ:()=>t,zN:()=>a.zN});var a=n(9608);n(505);let t={name:"Endpoint Proxy",description:"AI Infrastructure Management",version:"1.0.0"},o={storageKey:"theme",defaultTheme:"system"}},4427:(e,i,n)=>{n.d(i,{kz:()=>o}),n(6775),n(6562);let a=new Map,t=new Map;function o(e,i,n,o){let r="".concat(e,":").concat(i);n&&a.set(r,n),o&&t.set(r,o)}},6562:(e,i,n)=>{n(9562)},6775:(e,i,n)=>{n.d(i,{h:()=>a});let a={OPENAI:"openai",OPENAI_RESPONSES:"openai-responses",OPENAI_RESPONSE:"openai-response",CLAUDE:"claude",GEMINI:"gemini",GEMINI_CLI:"gemini-cli",CODEX:"codex",ANTIGRAVITY:"antigravity"}},9562:(e,i,n)=>{n.d(i,{Co:()=>t,NA:()=>o,Uc:()=>r,eo:()=>l,xq:()=>a});let a={claude:{baseUrl:"https://api.anthropic.com/v1/messages",format:"claude",headers:{"Anthropic-Version":"2023-06-01","Anthropic-Beta":"claude-code-20250219,oauth-2025-04-20,interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14,context-management-2025-06-27","Anthropic-Dangerous-Direct-Browser-Access":"true","User-Agent":"claude-cli/1.0.83 (external, cli)","X-App":"cli","X-Stainless-Helper-Method":"stream","X-Stainless-Retry-Count":"0","X-Stainless-Runtime-Version":"v24.3.0","X-Stainless-Package-Version":"0.55.1","X-Stainless-Runtime":"node","X-Stainless-Lang":"js","X-Stainless-Arch":"arm64","X-Stainless-Os":"MacOS","X-Stainless-Timeout":"60"},clientId:"9d1c250a-e61b-44d9-88ed-5944d1962f5e",tokenUrl:"https://console.anthropic.com/v1/oauth/token"},gemini:{baseUrl:"https://generativelanguage.googleapis.com/v1beta/models",format:"gemini",clientId:"681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com",clientSecret:"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"},"gemini-cli":{baseUrl:"https://cloudcode-pa.googleapis.com/v1internal",format:"gemini-cli",clientId:"681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com",clientSecret:"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"},codex:{baseUrl:"https://chatgpt.com/backend-api/codex/responses",format:"codex",headers:{Version:"0.21.0","Openai-Beta":"responses=experimental","User-Agent":"codex_cli_rs/0.50.0 (Mac OS 26.0.1; arm64)"},clientId:"app_EMoamEEZ73f0CkXaXp7hrann",clientSecret:"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",tokenUrl:"https://auth.openai.com/oauth/token"},qwen:{baseUrl:"https://portal.qwen.ai/v1/chat/completions",format:"openai",headers:{"User-Agent":"google-api-nodejs-client/9.15.1","X-Goog-Api-Client":"gl-node/22.17.0"},clientId:"f0304373b74a44d2b584a3fb70ca9e56",tokenUrl:"https://chat.qwen.ai/api/v1/oauth2/token",authUrl:"https://chat.qwen.ai/api/v1/oauth2/device/code"},iflow:{baseUrl:"https://apis.iflow.cn/v1/chat/completions",format:"openai",headers:{"User-Agent":"iFlow-Cli"},clientId:"10009311001",clientSecret:"4Z3YjXycVsQvyGF1etiNlIBB4RsqSDtW",tokenUrl:"https://iflow.cn/oauth/token",authUrl:"https://iflow.cn/oauth"},antigravity:{baseUrls:["https://daily-cloudcode-pa.sandbox.googleapis.com","https://cloudcode-pa.googleapis.com"],format:"antigravity",headers:{"User-Agent":"antigravity/1.11.5 windows/amd64"},clientId:"1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com",clientSecret:"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"},openrouter:{baseUrl:"https://openrouter.ai/api/v1/chat/completions",format:"openai",headers:{"HTTP-Referer":"https://endpoint-proxy.local","X-Title":"Endpoint Proxy"}},openai:{baseUrl:"https://api.openai.com/v1/chat/completions",format:"openai"},glm:{baseUrl:"https://api.z.ai/api/anthropic/v1/messages",format:"claude",headers:{"Anthropic-Version":"2023-06-01","Anthropic-Beta":"claude-code-20250219,interleaved-thinking-2025-05-14"}},kimi:{baseUrl:"https://api.kimi.com/coding/v1/messages",format:"claude",headers:{"Anthropic-Version":"2023-06-01","Anthropic-Beta":"claude-code-20250219,interleaved-thinking-2025-05-14"}},minimax:{baseUrl:"https://api.minimax.io/anthropic/v1/messages",format:"claude",headers:{"Anthropic-Version":"2023-06-01","Anthropic-Beta":"claude-code-20250219,interleaved-thinking-2025-05-14"}},github:{baseUrl:"https://api.githubcopilot.com/chat/completions",format:"openai",headers:{"copilot-integration-id":"vscode-chat","editor-version":"vscode/1.107.1","editor-plugin-version":"copilot-chat/0.26.7","user-agent":"GitHubCopilotChat/0.26.7","openai-intent":"conversation-panel","x-github-api-version":"2025-04-01","x-vscode-user-agent-library-version":"electron-fetch","X-Initiator":"user",Accept:"application/json","Content-Type":"application/json"}}},t="You are Claude Code, Anthropic's official CLI for Claude.",o={google:{token:"https://oauth2.googleapis.com/token",auth:"https://accounts.google.com/o/oauth2/auth"},openai:{token:"https://auth.openai.com/oauth/token",auth:"https://auth.openai.com/oauth/authorize"},anthropic:{token:"https://console.anthropic.com/v1/oauth/token",auth:"https://console.anthropic.com/v1/oauth/authorize"},qwen:{token:"https://chat.qwen.ai/api/v1/oauth2/token",auth:"https://chat.qwen.ai/api/v1/oauth2/device/code"},iflow:{token:"https://iflow.cn/oauth/token",auth:"https://iflow.cn/oauth"},github:{token:"https://github.com/login/oauth/access_token",auth:"https://github.com/login/oauth/authorize",deviceCode:"https://github.com/login/device/code"}},r=64e3,l=32e3},9608:(e,i,n)=>{n.d(i,{MA:()=>r,Q2:()=>o,fg:()=>t,wG:()=>l,zN:()=>a});let a={claude:{id:"claude",alias:"cc",name:"Claude Code",icon:"smart_toy",color:"#D97757"},antigravity:{id:"antigravity",alias:"ag",name:"Antigravity",icon:"rocket_launch",color:"#F59E0B"},codex:{id:"codex",alias:"cx",name:"OpenAI Codex",icon:"code",color:"#3B82F6"},iflow:{id:"iflow",alias:"if",name:"iFlow AI",icon:"water_drop",color:"#6366F1"},qwen:{id:"qwen",alias:"qw",name:"Qwen Code",icon:"psychology",color:"#10B981"},"gemini-cli":{id:"gemini-cli",alias:"gc",name:"Gemini CLI",icon:"terminal",color:"#4285F4"},github:{id:"github",alias:"gh",name:"GitHub Copilot",icon:"code",color:"#333333"}},t={openrouter:{id:"openrouter",alias:"openrouter",name:"OpenRouter",icon:"router",color:"#6366F1",textIcon:"OR",passthroughModels:!0},glm:{id:"glm",alias:"glm",name:"GLM Coding",icon:"code",color:"#2563EB",textIcon:"GL"},kimi:{id:"kimi",alias:"kimi",name:"Kimi Coding",icon:"psychology",color:"#1E3A8A",textIcon:"KM"},minimax:{id:"minimax",alias:"minimax",name:"Minimax Coding",icon:"memory",color:"#7C3AED",textIcon:"MM"},openai:{id:"openai",alias:"openai",name:"OpenAI",icon:"auto_awesome",color:"#10A37F",textIcon:"OA"},anthropic:{id:"anthropic",alias:"anthropic",name:"Anthropic",icon:"smart_toy",color:"#D97757",textIcon:"AN"},gemini:{id:"gemini",alias:"gemini",name:"Gemini",icon:"diamond",color:"#4285F4",textIcon:"GE"}},o={...a,...t},r={oauth:{id:"oauth",name:"OAuth",icon:"lock"},apikey:{id:"apikey",name:"API Key",icon:"key"}};function l(e){let i=o[e];return(null==i?void 0:i.alias)||e}Object.values(o).reduce((e,i)=>(e[i.alias]=i.id,e),{}),Object.values(o).reduce((e,i)=>(e[i.id]=i.alias,e),{})},9955:(e,i,n)=>{n.d(i,{ThemeProvider:()=>r});var a=n(5155),t=n(2115),o=n(1070);function r(e){let{children:i}=e,{initTheme:n}=(0,o.A)();return(0,t.useEffect)(()=>{n()},[n]),(0,a.jsx)(a.Fragment,{children:i})}}}]);
|