swayrouter 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dashboard/dist/assets/{CliTools-BA3qQ4Y-.js → CliTools-BIvAMkEP.js} +1 -1
  3. package/dashboard/dist/assets/{Combo-CoYmIAt0.js → Combo-DZ0yCwJq.js} +1 -1
  4. package/dashboard/dist/assets/{ConsoleLog-DEJBcRXY.js → ConsoleLog-DYc8yWoO.js} +1 -1
  5. package/dashboard/dist/assets/{Dashboard-0H0FmS_z.js → Dashboard-BGpeqNLd.js} +1 -1
  6. package/dashboard/dist/assets/{Header-DjeUJuR7.js → Header-bX_7xlVV.js} +1 -1
  7. package/dashboard/dist/assets/{Keys-D5i0CJPw.js → Keys-DUR_KMaU.js} +1 -1
  8. package/dashboard/dist/assets/{Login-Bmyb9mgb.js → Login-j-Fu6nmK.js} +1 -1
  9. package/dashboard/dist/assets/{ManageApiKey--COl62Nm.js → ManageApiKey-CChQc5sm.js} +1 -1
  10. package/dashboard/dist/assets/{OAuthCallback-DH2M63oY.js → OAuthCallback-CuMYq0kD.js} +1 -1
  11. package/dashboard/dist/assets/Provider-CKuPL89U.js +4 -0
  12. package/dashboard/dist/assets/{ProviderModelAccordion-Cuk2_DWf.js → ProviderModelAccordion-qY8m5iA3.js} +1 -1
  13. package/dashboard/dist/assets/{Proxy-C2UzXL2r.js → Proxy-DaEipiQW.js} +1 -1
  14. package/dashboard/dist/assets/{QuotaMonitor-gk5otjdB.js → QuotaMonitor-9oxr_V-M.js} +1 -1
  15. package/dashboard/dist/assets/{Settings-DlOhYL96.js → Settings-oBD2zi37.js} +1 -1
  16. package/dashboard/dist/assets/{Setup-3-yf1tvY.js → Setup-BfPMueRP.js} +1 -1
  17. package/dashboard/dist/assets/{StatusBadge-iBeqU7Qd.js → StatusBadge-DwoF6JKt.js} +1 -1
  18. package/dashboard/dist/assets/{SwayChat-BlbMT8HI.js → SwayChat-BN0OcHod.js} +1 -1
  19. package/dashboard/dist/assets/{Usage-C1uKYlTO.js → Usage-BZG-TSrV.js} +1 -1
  20. package/dashboard/dist/assets/{accordion-DovdZQJu.js → accordion-oO6QoOCj.js} +1 -1
  21. package/dashboard/dist/assets/{admin-extras-api-5xk7DmbO.js → admin-extras-api-LcymBrBl.js} +1 -1
  22. package/dashboard/dist/assets/{api-keys-api-DVdIV17Y.js → api-keys-api-DRZ4baCv.js} +1 -1
  23. package/dashboard/dist/assets/{card-DvGOwuMw.js → card-BtEmYJoF.js} +1 -1
  24. package/dashboard/dist/assets/{checkbox-ClXwjb6M.js → checkbox-Bp15fhqx.js} +1 -1
  25. package/dashboard/dist/assets/{connections-api-DlH7CVMr.js → connections-api-eXKpSjaP.js} +1 -1
  26. package/dashboard/dist/assets/{copy-button-CCsXIvkJ.js → copy-button-CmI5h4W6.js} +1 -1
  27. package/dashboard/dist/assets/{currency-api-CHfn9Y-I.js → currency-api-7hE88WWd.js} +1 -1
  28. package/dashboard/dist/assets/{flip-button-CDurxfqc.js → flip-button-D37ibV3U.js} +1 -1
  29. package/dashboard/dist/assets/{frame-CY26iHQE.js → frame-C_Vz9WkQ.js} +1 -1
  30. package/dashboard/dist/assets/{index-CkR38iPY.js → index-B7c_Oeni.js} +2 -2
  31. package/dashboard/dist/assets/{ripple-button-BrLlmKvT.js → ripple-button-Bi2qoFsd.js} +1 -1
  32. package/dashboard/dist/assets/{segmented-CxobJihW.js → segmented-JQkY0jOQ.js} +1 -1
  33. package/dashboard/dist/assets/{select-DfWoWPVg.js → select-i3aesCPb.js} +1 -1
  34. package/dashboard/dist/assets/{skeleton-81lPHspy.js → skeleton-CUHI70xv.js} +1 -1
  35. package/dashboard/dist/assets/{table-CEyzPvr7.js → table-BMmCRvDh.js} +1 -1
  36. package/dashboard/dist/assets/{tabs-DkTPKASE.js → tabs-CMGiJtvA.js} +1 -1
  37. package/dashboard/dist/assets/{tunnel-api-m02RsElG.js → tunnel-api-5eluT04C.js} +1 -1
  38. package/dashboard/dist/index.html +1 -1
  39. package/package.json +1 -1
  40. package/dashboard/dist/assets/Provider-DubAFZl3.js +0 -4
@@ -1,4 +1,4 @@
1
- import{r as o,j as e,d as rs}from"./react-vendor-xnYrwzsL.js";import{u as as,b as ns,a as W}from"./query-vendor-DVevaSVS.js";import{H as ls}from"./Header-DjeUJuR7.js";import{S as is}from"./StatusBadge-iBeqU7Qd.js";import{C as os}from"./copy-button-CCsXIvkJ.js";import{u as ds,n as cs,F as ms,f as We,S as Z,a as us,g as He,b as xs}from"./currency-api-CHfn9Y-I.js";import{c as f,p as ps,e as v,B as P,I as hs,S as fs,h as xe,D as gs,m as bs,n as js,o as vs,s as ys,G as Ns,i as ws,H as $e}from"./index-CkR38iPY.js";import{ag as ks,ad as Ss,a8 as le,a9 as $,af as Cs,as as Ds,at as zs,q as Ps,X as qs,ab as As,A as _s,au as Ue,av as Ls,T as Rs,aw as Es}from"./icons-vendor-CUx7SB5V.js";import{D as Is,q as Ms,w as Os,x as Fs,r as Hs,t as $s,v as Us}from"./ui-vendor-BuM9f2NY.js";import{F as U,c as X,b as T,a as Ts,d as Bs}from"./frame-CY26iHQE.js";import{S as Qs}from"./segmented-CxobJihW.js";import{A as Ks,a as Vs,b as Gs,c as Js}from"./accordion-DovdZQJu.js";import{S as pe,a as he,d as fe,b as ge,c as Y}from"./select-DfWoWPVg.js";import{S as B}from"./skeleton-81lPHspy.js";import{T as Ws,a as Zs,b as ie,c as q,d as Xs,e as w}from"./table-CEyzPvr7.js";import{l as Ys}from"./admin-extras-api-5xk7DmbO.js";import{p as oe}from"./live-mode-CHShLY4E.js";import"./ripple-button-BrLlmKvT.js";import"./motion-vendor-g5fpGzmJ.js";const Te={python:"Python",typescript:"TypeScript",javascript:"JavaScript",go:"Go",curl:"cURL",bash:"Shell",php:"PHP",ruby:"Ruby",json:"JSON",text:"Plain text"},et={python:"example.py",typescript:"example.ts",javascript:"example.js",go:"main.go",curl:"request.sh",bash:"script.sh",php:"example.php",ruby:"example.rb",json:"payload.json"};function st(t,n){if(n==="text")return[t];const i=[];n==="python"?i.push({re:/(#.*)$/g,cls:"text-zinc-500"},{re:/("""[\s\S]*?"""|'''[\s\S]*?'''|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/g,cls:"text-emerald-400"},{re:/\b(from|import|as|def|class|return|if|elif|else|for|while|with|try|except|raise|True|False|None|print|await|async|yield|lambda|pass|in|not|and|or)\b/g,cls:"text-violet-400"},{re:/\b(self|cls)\b/g,cls:"text-sky-400"},{re:/\b(\d+\.?\d*)\b/g,cls:"text-amber-400"}):n==="typescript"||n==="javascript"?i.push({re:/(\/\/.*)$/g,cls:"text-zinc-500"},{re:/(`(?:\\.|[^`\\])*`|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/g,cls:"text-emerald-400"},{re:/\b(import|from|export|const|let|var|function|async|await|return|if|else|for|while|class|new|typeof|interface|type|extends|implements|true|false|null|undefined|of|in)\b/g,cls:"text-violet-400"},{re:/\b(console|OpenAI|Anthropic)\b/g,cls:"text-sky-400"},{re:/\b(\d+\.?\d*)\b/g,cls:"text-amber-400"}):n==="go"?i.push({re:/(\/\/.*)$/g,cls:"text-zinc-500"},{re:/(`(?:\\.|[^`\\])*`|"(?:\\.|[^"\\])*")/g,cls:"text-emerald-400"},{re:/\b(package|import|func|return|if|else|for|range|var|const|type|struct|map|defer|go|chan|select|case|default|true|false|nil|err|error|string|int|int64|any)\b/g,cls:"text-violet-400"},{re:/\b(fmt|http|json|io|bytes)\b/g,cls:"text-sky-400"},{re:/\b(\d+\.?\d*)\b/g,cls:"text-amber-400"}):n==="curl"||n==="bash"?i.push({re:/(#.*)$/g,cls:"text-zinc-500"},{re:/("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/g,cls:"text-emerald-400"},{re:/\b(curl|echo|export|cd|npm|pip|go|php|ruby)\b/g,cls:"text-violet-400"},{re:/(^|\s)(-[A-Za-z][A-Za-z0-9-]*)\b/g,cls:"text-sky-400"}):n==="php"?i.push({re:/(\/\/.*|#.*)$/g,cls:"text-zinc-500"},{re:/("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/g,cls:"text-emerald-400"},{re:/\b(function|return|echo|true|false|null|array|new|class|public|private|protected|use|namespace|if|else|foreach|as)\b/g,cls:"text-violet-400"},{re:/(\$[\w]+)/g,cls:"text-sky-400"},{re:/\b(\d+\.?\d*)\b/g,cls:"text-amber-400"}):n==="ruby"?i.push({re:/(#.*)$/g,cls:"text-zinc-500"},{re:/("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/g,cls:"text-emerald-400"},{re:/\b(require|def|end|do|if|else|elsif|unless|class|module|return|true|false|nil|puts|print|new|each)\b/g,cls:"text-violet-400"},{re:/(:[\w]+)/g,cls:"text-amber-400"},{re:/\b(\d+\.?\d*)\b/g,cls:"text-amber-400"}):n==="json"&&i.push({re:/("(?:\\.|[^"\\])*")(\s*:)/g,cls:"text-sky-400"},{re:/("(?:\\.|[^"\\])*")/g,cls:"text-emerald-400"},{re:/\b(true|false|null)\b/g,cls:"text-violet-400"},{re:/\b(-?\d+\.?\d*)\b/g,cls:"text-amber-400"});const u=[];for(const{re:d,cls:h}of i){d.lastIndex=0;let y;const D=new RegExp(d.source,d.flags.includes("g")?d.flags:d.flags+"g");for(;(y=D.exec(t))!==null;){const _=y[0];let b=y.index,j=_;if(n==="curl"||n==="bash"){const k=y[2]??y[1];k&&_.indexOf(k)>=0&&/^-\w/.test(k)&&(b=y.index+_.lastIndexOf(k),j=k)}const r=b+j.length;!u.some(k=>!(r<=k.start||b>=k.end))&&j.length&&u.push({start:b,end:r,cls:h,text:j})}}u.sort((d,h)=>d.start-h.start);const C=[];let g=0;return u.forEach((d,h)=>{d.start>g&&C.push(t.slice(g,d.start)),C.push(e.jsx("span",{className:d.cls,children:d.text},`${h}-${d.start}`)),g=d.end}),g<t.length&&C.push(t.slice(g)),C.length?C:[t]}function tt({code:t,language:n="text",filename:i,className:u,showLineNumbers:C=!0}){const[g,d]=o.useState(!1),h=o.useMemo(()=>t.replace(/\n$/,"").split(`
1
+ import{r as o,j as e,d as rs}from"./react-vendor-xnYrwzsL.js";import{u as as,b as ns,a as W}from"./query-vendor-DVevaSVS.js";import{H as ls}from"./Header-bX_7xlVV.js";import{S as is}from"./StatusBadge-DwoF6JKt.js";import{C as os}from"./copy-button-CmI5h4W6.js";import{u as ds,n as cs,F as ms,f as We,S as Z,a as us,g as He,b as xs}from"./currency-api-7hE88WWd.js";import{c as f,p as ps,e as v,B as P,I as hs,S as fs,h as xe,D as gs,m as bs,n as js,o as vs,s as ys,G as Ns,i as ws,H as $e}from"./index-B7c_Oeni.js";import{ag as ks,ad as Ss,a8 as le,a9 as $,af as Cs,as as Ds,at as zs,q as Ps,X as qs,ab as As,A as _s,au as Ue,av as Ls,T as Rs,aw as Es}from"./icons-vendor-CUx7SB5V.js";import{D as Is,q as Ms,w as Os,x as Fs,r as Hs,t as $s,v as Us}from"./ui-vendor-BuM9f2NY.js";import{F as U,c as X,b as T,a as Ts,d as Bs}from"./frame-C_Vz9WkQ.js";import{S as Qs}from"./segmented-JQkY0jOQ.js";import{A as Ks,a as Vs,b as Gs,c as Js}from"./accordion-oO6QoOCj.js";import{S as pe,a as he,d as fe,b as ge,c as Y}from"./select-i3aesCPb.js";import{S as B}from"./skeleton-CUHI70xv.js";import{T as Ws,a as Zs,b as ie,c as q,d as Xs,e as w}from"./table-BMmCRvDh.js";import{l as Ys}from"./admin-extras-api-LcymBrBl.js";import{p as oe}from"./live-mode-CHShLY4E.js";import"./ripple-button-Bi2qoFsd.js";import"./motion-vendor-g5fpGzmJ.js";const Te={python:"Python",typescript:"TypeScript",javascript:"JavaScript",go:"Go",curl:"cURL",bash:"Shell",php:"PHP",ruby:"Ruby",json:"JSON",text:"Plain text"},et={python:"example.py",typescript:"example.ts",javascript:"example.js",go:"main.go",curl:"request.sh",bash:"script.sh",php:"example.php",ruby:"example.rb",json:"payload.json"};function st(t,n){if(n==="text")return[t];const i=[];n==="python"?i.push({re:/(#.*)$/g,cls:"text-zinc-500"},{re:/("""[\s\S]*?"""|'''[\s\S]*?'''|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/g,cls:"text-emerald-400"},{re:/\b(from|import|as|def|class|return|if|elif|else|for|while|with|try|except|raise|True|False|None|print|await|async|yield|lambda|pass|in|not|and|or)\b/g,cls:"text-violet-400"},{re:/\b(self|cls)\b/g,cls:"text-sky-400"},{re:/\b(\d+\.?\d*)\b/g,cls:"text-amber-400"}):n==="typescript"||n==="javascript"?i.push({re:/(\/\/.*)$/g,cls:"text-zinc-500"},{re:/(`(?:\\.|[^`\\])*`|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/g,cls:"text-emerald-400"},{re:/\b(import|from|export|const|let|var|function|async|await|return|if|else|for|while|class|new|typeof|interface|type|extends|implements|true|false|null|undefined|of|in)\b/g,cls:"text-violet-400"},{re:/\b(console|OpenAI|Anthropic)\b/g,cls:"text-sky-400"},{re:/\b(\d+\.?\d*)\b/g,cls:"text-amber-400"}):n==="go"?i.push({re:/(\/\/.*)$/g,cls:"text-zinc-500"},{re:/(`(?:\\.|[^`\\])*`|"(?:\\.|[^"\\])*")/g,cls:"text-emerald-400"},{re:/\b(package|import|func|return|if|else|for|range|var|const|type|struct|map|defer|go|chan|select|case|default|true|false|nil|err|error|string|int|int64|any)\b/g,cls:"text-violet-400"},{re:/\b(fmt|http|json|io|bytes)\b/g,cls:"text-sky-400"},{re:/\b(\d+\.?\d*)\b/g,cls:"text-amber-400"}):n==="curl"||n==="bash"?i.push({re:/(#.*)$/g,cls:"text-zinc-500"},{re:/("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/g,cls:"text-emerald-400"},{re:/\b(curl|echo|export|cd|npm|pip|go|php|ruby)\b/g,cls:"text-violet-400"},{re:/(^|\s)(-[A-Za-z][A-Za-z0-9-]*)\b/g,cls:"text-sky-400"}):n==="php"?i.push({re:/(\/\/.*|#.*)$/g,cls:"text-zinc-500"},{re:/("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/g,cls:"text-emerald-400"},{re:/\b(function|return|echo|true|false|null|array|new|class|public|private|protected|use|namespace|if|else|foreach|as)\b/g,cls:"text-violet-400"},{re:/(\$[\w]+)/g,cls:"text-sky-400"},{re:/\b(\d+\.?\d*)\b/g,cls:"text-amber-400"}):n==="ruby"?i.push({re:/(#.*)$/g,cls:"text-zinc-500"},{re:/("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/g,cls:"text-emerald-400"},{re:/\b(require|def|end|do|if|else|elsif|unless|class|module|return|true|false|nil|puts|print|new|each)\b/g,cls:"text-violet-400"},{re:/(:[\w]+)/g,cls:"text-amber-400"},{re:/\b(\d+\.?\d*)\b/g,cls:"text-amber-400"}):n==="json"&&i.push({re:/("(?:\\.|[^"\\])*")(\s*:)/g,cls:"text-sky-400"},{re:/("(?:\\.|[^"\\])*")/g,cls:"text-emerald-400"},{re:/\b(true|false|null)\b/g,cls:"text-violet-400"},{re:/\b(-?\d+\.?\d*)\b/g,cls:"text-amber-400"});const u=[];for(const{re:d,cls:h}of i){d.lastIndex=0;let y;const D=new RegExp(d.source,d.flags.includes("g")?d.flags:d.flags+"g");for(;(y=D.exec(t))!==null;){const _=y[0];let b=y.index,j=_;if(n==="curl"||n==="bash"){const k=y[2]??y[1];k&&_.indexOf(k)>=0&&/^-\w/.test(k)&&(b=y.index+_.lastIndexOf(k),j=k)}const r=b+j.length;!u.some(k=>!(r<=k.start||b>=k.end))&&j.length&&u.push({start:b,end:r,cls:h,text:j})}}u.sort((d,h)=>d.start-h.start);const C=[];let g=0;return u.forEach((d,h)=>{d.start>g&&C.push(t.slice(g,d.start)),C.push(e.jsx("span",{className:d.cls,children:d.text},`${h}-${d.start}`)),g=d.end}),g<t.length&&C.push(t.slice(g)),C.length?C:[t]}function tt({code:t,language:n="text",filename:i,className:u,showLineNumbers:C=!0}){const[g,d]=o.useState(!1),h=o.useMemo(()=>t.replace(/\n$/,"").split(`
2
2
  `),[t]),y=i??et[n]??Te[n],D=String(h.length).length;async function _(){try{await navigator.clipboard.writeText(t),d(!0),window.setTimeout(()=>d(!1),1500)}catch{}}return e.jsxs("div",{className:f("group relative flex h-[min(20rem,45vh)] w-full min-w-0 max-w-full flex-col overflow-hidden rounded-xl border border-white/10","bg-[#0b0d12]",u),children:[e.jsxs("div",{className:"relative z-10 flex items-center gap-3 border-b border-white/10 bg-white/[0.03] px-3 py-2 sm:px-3.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":!0,children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-border"}),e.jsx("span",{className:"h-2 w-2 rounded-full bg-muted-foreground/50"}),e.jsx("span",{className:"h-2 w-2 rounded-full bg-primary/70"})]}),e.jsx("div",{className:"min-w-0 flex-1 truncate text-center font-mono text-[11px] text-zinc-400 sm:text-xs",children:y}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"hidden rounded-md border border-white/10 bg-white/[0.04] px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wide text-zinc-500 sm:inline",children:Te[n]}),e.jsxs("button",{type:"button",onClick:_,className:f("inline-flex h-7 items-center gap-1.5 rounded-md border border-white/10 bg-white/[0.04] px-2","font-mono text-[11px] text-zinc-300 transition-colors","hover:bg-white/[0.08] hover:text-white","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-white/20"),"aria-label":"Copy code",children:[g?e.jsx(ks,{className:"h-3 w-3 text-emerald-400"}):e.jsx(Ss,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden sm:inline",children:g?"Copied":"Copy"})]})]})]}),e.jsx("div",{className:"relative z-10 min-h-0 flex-1 overflow-auto",children:e.jsx("pre",{className:"m-0 p-0 font-mono text-[12px] leading-[1.65] text-zinc-200 sm:text-[12.5px]",children:e.jsx("code",{className:"block min-w-full py-3",children:h.map((b,j)=>e.jsxs("div",{className:"flex px-0 hover:bg-white/[0.03]",children:[C?e.jsx("span",{className:"sticky left-0 select-none bg-[#0b0d12]/80 pl-3 pr-3 text-right text-zinc-600 backdrop-blur-[2px] sm:pl-4",style:{minWidth:`${D+2.5}ch`},"aria-hidden":!0,children:j+1}):e.jsx("span",{className:"w-3 shrink-0 sm:w-4","aria-hidden":!0}),e.jsx("span",{className:"flex-1 whitespace-pre pr-4 text-zinc-200",children:b.length?st(b,n):`
3
3
  `})]},j))})})})]})}const rt=Is;function at({className:t,children:n,variant:i="inset",...u}){return e.jsxs(Ms,{children:[e.jsx(Os,{className:"fixed inset-0 z-50 bg-black/32 backdrop-blur-sm transition-opacity data-ending-style:opacity-0 data-starting-style:opacity-0"}),e.jsx(Fs,{className:"fixed inset-0 z-50 flex justify-end p-0 sm:p-3",children:e.jsx(Hs,{className:f("relative flex h-full min-h-0 w-full min-w-0 max-w-2xl flex-col overflow-hidden border bg-popover text-popover-foreground outline-none transition-[translate,opacity] duration-200 ease-out data-ending-style:translate-x-full data-ending-style:opacity-0 data-starting-style:translate-x-full data-starting-style:opacity-0 sm:rounded-2xl sm:border",i==="inset"&&"sm:h-[calc(100vh-1.5rem)] sm:max-h-[calc(100vh-1.5rem)]",t),...u,children:n})})]})}function nt({className:t,...n}){return e.jsx("div",{className:f("shrink-0 border-b border-border/70 px-6 py-5",t),...n})}function lt({className:t,...n}){return e.jsx($s,{className:f("font-heading text-xl font-semibold leading-none",t),...n})}function it({className:t,...n}){return e.jsx(Us,{className:f("mt-2 text-sm text-muted-foreground",t),...n})}function ot({className:t,...n}){return e.jsx("div",{className:f("min-h-0 flex-1 overflow-y-auto overflow-x-hidden px-6 py-5",t),...n})}function dt(t,n){const i=Number.isFinite(t)?Math.max(1,Math.floor(t)):1,u=Math.max(1,Math.floor((n==null?void 0:n.totalPages)??1));return{safePage:n?Math.min(i,u):i,totalPages:u}}function ct(t,n,i){return!n||i?!1:t>Math.max(1,Math.floor(n.totalPages))}const Q="all",mt=[{value:"today",label:"Today"},{value:"24h",label:"24h"},{value:"7d",label:"7d"},{value:"30d",label:"30d"},{value:"90d",label:"90d"},{value:"1y",label:"1y"}],Be={today:"Today","24h":"Last 24 hours","7d":"Last 7 days","30d":"Last 30 days","90d":"Last 90 days","1y":"Last 1 year"},ve=[{value:"today",label:"Today"},{value:"24h",label:"Last 24 hours"},{value:"7d",label:"Last 7 days"},{value:"30d",label:"Last 30 days"},{value:"90d",label:"Last 90 days"},{value:"1y",label:"Last 1 year"},{value:"all",label:"All time"}],Qe=Object.fromEntries(ve.map(t=>[t.value,t.label])),ut=12;function xt(t){switch(t){case"today":{const n=new Date;return n.setHours(0,0,0,0),n.getTime()}case"24h":return Date.now()-1440*60*1e3;case"7d":return Date.now()-7*864e5;case"30d":return Date.now()-30*864e5;case"90d":return Date.now()-90*864e5;case"1y":{const n=new Date;return n.setHours(0,0,0,0),n.setDate(n.getDate()-364),n.getTime()}default:return null}}function E(t){return Number.isFinite(t)?Math.round(t).toLocaleString("id-ID"):"0"}function be(t,n,i){return We(t,n,i)}function Ke(t){const n=t==null?void 0:t.trim();if(!n)return"—";const i=n.lastIndexOf("/");return i>=0?n.slice(i+1):n}function je(t){if(!t)return"—";try{return new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return t}}function Ze(t){if(t==null)return"{}";if(typeof t=="string")return t;try{return JSON.stringify(t,null,2)}catch{return String(t)}}function pt(t){if(t==null)return"Not captured";if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const i=t;if(typeof i._redacted=="string")return"Capture unavailable";if(Object.keys(i).length===0)return"Empty payload"}const n=Ze(t);return`${n.split(`
4
4
  `).length} lines · ${n.length.toLocaleString()} chars`}function Ve(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&typeof t._redacted=="string"}function Ge(t){return t.status==="ok"||t.status==="success"?"bg-emerald-500":t.status==="error"||t.error?"bg-red-500":t.status==="pending"||t.status==="processing"?"bg-amber-500":"bg-muted-foreground/64"}function Je(t){if(t.status){const n=t.status.toUpperCase();return n==="SUCCESS"?"OK":n}return t.error?"ERROR":"—"}function Rt(){var De,ze,Pe,qe;const t=rs(),[n,i]=o.useState("today"),[u,C]=o.useState(Q),[g,d]=o.useState(""),[h,y]=o.useState(""),[D,_]=o.useState("desc"),[b,j]=o.useState(1),[r,I]=o.useState(null),[k,ee]=o.useState(!1),[K,ye]=o.useState("today"),[S,Ne]=o.useState(!1),[N,we]=o.useState(!1),se=as();ds();const M=ns({mutationFn:Ns,onSuccess:async()=>{ee(!1),I(null),j(1),await se.invalidateQueries({queryKey:["usage-stats"]}),await se.invalidateQueries({queryKey:["usage-history"]}),await se.invalidateQueries({queryKey:["usage-request-details"]}),await se.invalidateQueries({queryKey:["request-detail"]})}}),de=W({queryKey:["usage-stats",n],queryFn:()=>ws({range:n}),enabled:oe(),retry:!1}),ke=W({queryKey:["currency-settings"],queryFn:xs,enabled:oe(),staleTime:720*60*1e3,retry:!1}),A=W({queryKey:["usage-history",b,u===Q?void 0:u,g.trim()||void 0,h||void 0,n,D],queryFn:()=>{const s=xt(n);return $e({page:b,pageSize:ut,provider:u===Q?void 0:u,query:g.trim()||void 0,status:h||void 0,sortDir:D,startDate:s?new Date(s).toISOString():void 0,source:"usage"})},enabled:oe(),retry:!1,placeholderData:s=>s}),Se=W({queryKey:["nodes"],queryFn:Ys,enabled:oe(),retry:!1}),te=W({queryKey:["request-detail",r==null?void 0:r.provider,r==null?void 0:r.model,r==null?void 0:r.timestamp],queryFn:()=>{const s=r!=null&&r.timestamp?new Date(r.timestamp).getTime():Date.now();return $e({provider:r==null?void 0:r.provider,model:r==null?void 0:r.model,startDate:new Date(s-5e3).toISOString(),endDate:new Date(s+5e3).toISOString(),pageSize:5,includePayloads:!0})},enabled:!!r,retry:!1}),l=o.useMemo(()=>{var s,a,c,p;return((a=(s=te.data)==null?void 0:s.details)==null?void 0:a.find(H=>H.provider===(r==null?void 0:r.provider)||!(r!=null&&r.provider)))??((p=(c=te.data)==null?void 0:c.details)==null?void 0:p[0])??null},[te.data,r]),m=de.data,z=cs((De=ke.data)==null?void 0:De.currency),V=((ze=ke.data)==null?void 0:ze.usdToIdr)??ms,ce=(m==null?void 0:m.totalCost)??0,Ce=We(ce,z,V),G=o.useMemo(()=>{var s;return(((s=A.data)==null?void 0:s.details)??[]).map(a=>{var c,p,H,Ae,_e,Le,Re,Ee,Ie,Me,Oe,Fe;return{id:a.id&&Number(a.id)||void 0,timestamp:a.timestamp,provider:a.provider,model:a.model,connectionId:a.connectionId,endpoint:a.endpoint,cost:a.cost,promptTokens:((c=a.tokens)==null?void 0:c.prompt_tokens)??((p=a.tokens)==null?void 0:p.input_tokens),completionTokens:((H=a.tokens)==null?void 0:H.completion_tokens)??((Ae=a.tokens)==null?void 0:Ae.output_tokens),cachedTokens:((_e=a.tokens)==null?void 0:_e.cached_tokens)??((Le=a.tokens)==null?void 0:Le.cache_read_input_tokens)??((Ee=(Re=a.tokens)==null?void 0:Re.prompt_tokens_details)==null?void 0:Ee.cached_tokens),cacheCreationTokens:((Ie=a.tokens)==null?void 0:Ie.cache_creation_input_tokens)??((Oe=(Me=a.tokens)==null?void 0:Me.prompt_tokens_details)==null?void 0:Oe.cache_creation_tokens),status:a.status,latencyMs:typeof((Fe=a.latency)==null?void 0:Fe.total)=="number"?a.latency.total:void 0,error:typeof a.error=="string"?a.error:null}})},[A.data]),L=de.isLoading||A.isLoading,R=o.useMemo(()=>{const s=new Map;for(const a of Se.data??[])s.set(a.id,a.name||a.id),a.prefix&&s.set(a.prefix,a.name||a.prefix);return a=>a?s.has(a)?s.get(a):ps(a)||a:"—"},[Se.data]),me=o.useMemo(()=>{const s=new Set;return Object.keys((m==null?void 0:m.byProvider)??{}).forEach(a=>s.add(a)),G.forEach(a=>a.provider&&s.add(a.provider)),Array.from(s).sort()},[m,G]),Xe=o.useMemo(()=>{const s={[Q]:"All providers"};for(const a of me)s[a]=R(a);return s},[R,me]),re=G,O=(Pe=A.data)==null?void 0:Pe.pagination,Ye=(O==null?void 0:O.totalItems)??0,{safePage:ue,totalPages:J}=dt(b,O),F=A.isFetching;o.useEffect(()=>{j(1)},[n,u,g,h,D]),o.useEffect(()=>{ct(b,O,A.isFetching)&&j(J)},[A.isFetching,b,O,J]);const ae=o.useMemo(()=>Array.from(new Set(G.map(s=>s.status).filter(Boolean))).sort(),[G]);o.useEffect(()=>{h&&!ae.includes(h)&&y("")},[h,ae]);const x=l==null?void 0:l.tokens,es=(x==null?void 0:x.prompt_tokens)??(x==null?void 0:x.input_tokens)??void 0,ss=(x==null?void 0:x.completion_tokens)??(x==null?void 0:x.output_tokens)??void 0,ts=(x==null?void 0:x.cached_tokens)??(x==null?void 0:x.cache_read_input_tokens)??void 0,ne=[l==null?void 0:l.request,l==null?void 0:l.providerRequest,l==null?void 0:l.providerResponse,l==null?void 0:l.response].some(s=>s!=null&&!Ve(s));return e.jsxs("div",{className:"flex min-h-full h-auto w-full min-w-0 flex-col gap-2.5 overflow-x-hidden lg:h-full",children:[e.jsx(ls,{className:"mb-0 shrink-0 sm:mb-0",title:"Usage & Cost",actions:e.jsx("div",{className:"w-full max-w-full sm:min-w-[26rem] sm:w-auto",children:e.jsx(Qs,{size:"sm",value:n,onChange:i,options:mt,className:"w-full"})})}),de.isError||A.isError?e.jsx("div",{className:"shrink-0 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:"Unable to load live usage data. Check your session and backend connection."}):null,e.jsxs("div",{className:"grid shrink-0 grid-cols-2 gap-2 sm:grid-cols-3 sm:gap-3 lg:grid-cols-5",children:[e.jsx(U,{className:"w-full rounded-xl p-0.5 sm:rounded-2xl sm:p-1",children:e.jsxs(X,{className:"rounded-lg p-2.5 sm:rounded-xl sm:p-4",children:[e.jsx(T,{className:"min-h-5 text-[10px] font-medium leading-tight text-muted-foreground sm:min-h-0 sm:text-[12px]",children:"Total requests"}),e.jsx("p",{className:"mt-1 text-lg font-semibold leading-none tabular-nums sm:text-2xl",children:L?"—":e.jsx(Z,{value:(m==null?void 0:m.total)??0})})]})}),e.jsx(U,{className:"w-full rounded-xl p-0.5 sm:rounded-2xl sm:p-1",children:e.jsxs(X,{className:"rounded-lg p-2.5 sm:rounded-xl sm:p-4",children:[e.jsx(T,{className:"min-h-5 text-[10px] font-medium leading-tight text-muted-foreground sm:min-h-0 sm:text-[12px]",children:"Total input tokens"}),e.jsx("p",{className:"mt-1 text-lg font-semibold leading-none tabular-nums text-success sm:text-2xl",children:L?"—":e.jsx(Z,{value:(m==null?void 0:m.totalPromptTokens)??0,className:"text-success"})})]})}),e.jsx(U,{className:"w-full rounded-xl p-0.5 sm:rounded-2xl sm:p-1",children:e.jsxs(X,{className:"rounded-lg p-2.5 sm:rounded-xl sm:p-4",children:[e.jsx(T,{className:"min-h-5 text-[10px] font-medium leading-tight text-muted-foreground sm:min-h-0 sm:text-[12px]",children:"Output tokens"}),e.jsx("p",{className:"mt-1 text-lg font-semibold leading-none tabular-nums text-destructive sm:text-2xl",children:L?"—":e.jsx(Z,{value:(m==null?void 0:m.totalCompletionTokens)??0,className:"text-destructive"})})]})}),e.jsx(U,{className:"w-full rounded-xl p-0.5 sm:rounded-2xl sm:p-1",children:e.jsxs(X,{className:"rounded-lg p-2.5 sm:rounded-xl sm:p-4",children:[e.jsx(T,{className:"min-h-5 text-[10px] font-medium leading-tight text-muted-foreground sm:min-h-0 sm:text-[12px]",children:"Cached tokens"}),e.jsx("p",{className:"mt-1 text-lg font-semibold leading-none tabular-nums text-warning sm:text-2xl",children:L?"—":e.jsx(Z,{value:(m==null?void 0:m.totalCachedTokens)??0,className:"text-warning"})})]})}),e.jsx(U,{className:"w-full rounded-xl p-0.5 sm:rounded-2xl sm:p-1",children:e.jsxs(X,{className:"rounded-lg p-2.5 sm:rounded-xl sm:p-4",children:[e.jsx(T,{className:"min-h-5 text-[10px] font-medium leading-tight text-muted-foreground sm:min-h-0 sm:text-[12px]",children:`Est. cost (${z})`}),e.jsx("p",{className:"mt-1 min-w-0 max-w-full truncate text-lg font-semibold leading-none tabular-nums sm:text-2xl",children:L?"—":e.jsx(v,{label:Ce,children:e.jsx("span",{className:"inline-block max-w-full truncate align-bottom",title:Ce,children:e.jsx(Z,{value:us(ce,z,V),prefix:z==="IDR"?"Rp":"$",locale:z==="IDR"?"id-ID":"en-US",decimals:z==="IDR"?0:ce<.01?4:2,className:"text-[clamp(1rem,4vw,1.5rem)]"})})})})]})})]}),e.jsxs(U,{className:"flex min-h-[24rem] flex-none flex-col rounded-xl bg-transparent p-0 sm:rounded-2xl sm:bg-muted/72 sm:p-1 lg:min-h-0 lg:flex-1",children:[e.jsx(Ts,{className:"border-b border-border/70 px-3 py-3 sm:border-0 sm:px-5 sm:py-4",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-2",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Request history"}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:"To view payload details, enable “Capture full request payloads” in Settings."})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("div",{className:"flex items-center gap-0.5 sm:hidden",children:[e.jsx(v,{label:S?"Show provider names":"Hide provider names",children:e.jsxs("button",{type:"button","aria-label":S?"Show provider names":"Hide provider names","aria-pressed":S,onClick:()=>Ne(s=>!s),className:"inline-flex h-8 items-center gap-1.5 rounded-md px-2 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[S?e.jsx(le,{className:"size-3.5","aria-hidden":"true"}):e.jsx($,{className:"size-3.5","aria-hidden":"true"}),e.jsx("span",{children:"Provider"})]})}),e.jsx(v,{label:N?"Show full model names":"Hide provider prefixes from models",children:e.jsxs("button",{type:"button","aria-label":N?"Show full model names":"Hide provider prefixes from models","aria-pressed":N,onClick:()=>we(s=>!s),className:"inline-flex h-8 items-center gap-1.5 rounded-md px-2 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[N?e.jsx(le,{className:"size-3.5","aria-hidden":"true"}):e.jsx($,{className:"size-3.5","aria-hidden":"true"}),e.jsx("span",{children:"Model"})]})})]}),e.jsx(v,{label:"Clear history",children:e.jsxs(P,{type:"button",variant:"ghost",size:"sm",className:"size-8 px-0 text-destructive hover:bg-destructive/10 hover:text-destructive sm:h-7 sm:w-auto sm:px-2 sm:text-[11px]",onClick:()=>{ye(n),ee(!0)},disabled:M.isPending,"aria-label":"Clear history",children:[e.jsx(Cs,{className:"h-3.5 w-3.5 sm:hidden"}),e.jsx("span",{className:"hidden sm:inline",children:"Clear history"})]})}),e.jsx(v,{label:"Sort by date",children:e.jsxs("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-md px-0 py-1 text-[11px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground sm:h-7 sm:w-auto sm:gap-1.5 sm:px-2",onClick:()=>_(s=>s==="desc"?"asc":"desc"),"aria-label":D==="desc"?"Sort oldest first":"Sort newest first",children:[D==="desc"?e.jsx(Ds,{className:"h-3.5 w-3.5","aria-hidden":!0}):e.jsx(zs,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{className:"hidden sm:inline",children:"Sort by date"})]})})]})]})}),M.isError?e.jsx("div",{className:"mx-5 mb-3 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:"Failed to clear Usage history. Try again."}):null,e.jsxs("div",{className:"flex shrink-0 flex-col gap-2 border-b border-border/70 px-3 pb-3 sm:flex-row sm:items-center sm:border-0 sm:px-5",children:[e.jsxs("div",{className:"relative min-w-0 flex-1",children:[e.jsx(Ps,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(hs,{value:g,onChange:s=>d(s.target.value),placeholder:"Search model, provider, status, connection…",autoComplete:"off",autoCorrect:"off",autoCapitalize:"none",spellCheck:!1,className:"h-9 pl-9 pr-8 leading-none"}),g?e.jsx("button",{type:"button","aria-label":"Clear search",className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>d(""),children:e.jsx(qs,{className:"h-4 w-4"})}):null]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:contents",children:[e.jsxs(pe,{items:Xe,value:u,onValueChange:s=>C(s??Q),children:[e.jsx(he,{className:"h-9 w-full sm:w-48",children:e.jsx(fe,{placeholder:"All providers"})}),e.jsxs(ge,{children:[e.jsx(Y,{value:Q,children:"All providers"}),me.map(s=>e.jsx(Y,{value:s,children:R(s)},s))]})]}),e.jsxs(pe,{items:{all:"All statuses",...Object.fromEntries(ae.map(s=>[s,s.toUpperCase()]))},value:h||"all",onValueChange:s=>y(s==="all"?"":s??""),children:[e.jsx(he,{className:"h-9 w-full sm:w-40",children:e.jsx(fe,{placeholder:"All statuses"})}),e.jsxs(ge,{children:[e.jsx(Y,{value:"all",children:"All statuses"}),ae.map(s=>e.jsx(Y,{value:s,children:s.toUpperCase()},s))]})]})]})]}),e.jsx("div",{className:"min-h-0 flex-1 px-3 pb-1 sm:px-1",children:e.jsxs(fs,{overscrollContain:!0,className:"h-full",children:[e.jsx("div",{className:"w-full min-w-0 rounded-xl border border-border/70 bg-card sm:hidden",children:L?e.jsx("div",{className:"divide-y divide-border/70",children:Array.from({length:6}).map((s,a)=>e.jsxs("div",{className:"px-2.5 py-2.5",children:[e.jsx(B,{className:"h-3.5 w-2/3"}),e.jsx(B,{className:"mt-2 h-3 w-full"})]},a))}):re.length===0?e.jsxs("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:["No usage rows for ",Be[n].toLowerCase()]}):e.jsx("div",{className:"divide-y divide-border/70",children:re.map((s,a)=>{const c=He(s);return e.jsx("article",{className:"min-w-0 px-2.5 py-2.5",children:e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("p",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:S?"Hidden":R(s.provider)}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[e.jsxs(xe,{variant:"outline",className:"text-[10px] font-normal",children:[e.jsx("span",{"aria-hidden":"true",className:f("size-1.5 rounded-full",Ge(s))}),Je(s)]}),e.jsx(v,{label:"View details",children:e.jsx(P,{variant:"outline",size:"icon-xs",className:"size-6 shrink-0 p-0 [&_svg]:size-3",onClick:()=>I(s),"aria-label":"View request details",children:e.jsx($,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]})]}),e.jsx(v,{label:N?"Showing model slug only":s.model||"—",children:e.jsx("p",{className:"mt-0.5 max-w-full truncate whitespace-nowrap font-mono text-[10px] text-muted-foreground",children:N?Ke(s.model):s.model||"—"})}),e.jsxs("div",{className:"mt-1 flex min-w-0 items-center gap-1.5 truncate text-[10px] tabular-nums text-muted-foreground",children:[e.jsx("span",{className:"shrink-0",children:je(s.timestamp)}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsxs("span",{className:"shrink-0 text-success",children:["In ",E(s.promptTokens||0)]}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsxs("span",{className:"shrink-0 text-destructive",children:["Out ",E(s.completionTokens||0)]}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx("span",{className:"shrink-0 text-foreground",children:be(s.cost??0,z,V)}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx(v,{label:c.title,children:e.jsx("span",{className:f("shrink-0",c.hit?"text-warning":"text-muted-foreground"),children:c.label})})]})]})},s.id??`${s.timestamp}-${a}`)})})}),e.jsx("div",{className:"hidden sm:block",children:e.jsxs(Ws,{variant:"card",className:"min-w-[900px] text-[13px]",children:[e.jsx(Zs,{children:e.jsxs(ie,{children:[e.jsx(q,{className:"px-4 py-2",children:"Time"}),e.jsx(q,{className:"px-3 py-2",children:e.jsxs("div",{className:"group/column flex items-center gap-1.5",children:[e.jsx("span",{children:"Provider"}),e.jsx(v,{label:S?"Show provider names":"Hide provider names",children:e.jsx("button",{type:"button","aria-label":S?"Show provider names":"Hide provider names",onClick:()=>Ne(s=>!s),className:"inline-flex size-5 items-center justify-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-surface-hover hover:text-primary focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/column:opacity-100",children:S?e.jsx(le,{className:"size-3.5","aria-hidden":"true"}):e.jsx($,{className:"size-3.5","aria-hidden":"true"})})})]})}),e.jsx(q,{className:"px-3 py-2",children:e.jsxs("div",{className:"group/column flex items-center gap-1.5",children:[e.jsx("span",{children:"Model"}),e.jsx(v,{label:N?"Show full model names":"Hide provider prefixes from models",children:e.jsx("button",{type:"button","aria-label":N?"Show full model names":"Hide provider prefixes from models",onClick:()=>we(s=>!s),className:"inline-flex size-5 items-center justify-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-surface-hover hover:text-primary focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/column:opacity-100",children:N?e.jsx(le,{className:"size-3.5","aria-hidden":"true"}):e.jsx($,{className:"size-3.5","aria-hidden":"true"})})})]})}),e.jsx(q,{className:"px-3 py-2 text-success",children:"In"}),e.jsx(q,{className:"px-3 py-2 text-destructive",children:"Out"}),e.jsx(q,{className:"px-3 py-2",children:"Cache"}),e.jsx(q,{className:"px-3 py-2",children:"Cost"}),e.jsx(q,{className:"px-3 py-2",children:"Status"}),e.jsx(q,{className:"px-3 py-2 text-right",children:"Detail"})]})}),e.jsx(Xs,{children:L?Array.from({length:6}).map((s,a)=>e.jsx(ie,{children:e.jsx(w,{colSpan:9,className:"px-4 py-2",children:e.jsx(B,{className:"h-4 w-full"})})},a)):re.length===0?e.jsx(ie,{children:e.jsxs(w,{colSpan:9,className:"px-4 py-10 text-center text-muted-foreground",children:["No usage rows for ",Be[n].toLowerCase()]})}):re.map((s,a)=>e.jsxs(ie,{children:[e.jsx(w,{className:"whitespace-nowrap px-4 py-2 text-muted-foreground",children:je(s.timestamp)}),e.jsx(w,{className:"px-3 py-2 font-medium",children:e.jsx("span",{className:f(S&&"font-normal italic text-muted-foreground"),children:S?"Hidden":R(s.provider)})}),e.jsx(w,{className:"whitespace-nowrap px-3 py-2",children:e.jsx(v,{label:N?"Showing model slug only":s.model||"—",children:e.jsx("span",{className:"block min-w-max whitespace-nowrap font-mono text-[11px] text-muted-foreground",children:N?Ke(s.model):s.model||"—"})})}),e.jsx(w,{className:"px-3 py-2",children:e.jsxs("span",{className:"inline-flex items-center gap-1 tabular-nums text-success",children:[e.jsx(As,{className:"h-3 w-3"}),E(s.promptTokens||0)]})}),e.jsx(w,{className:"px-3 py-2",children:e.jsxs("span",{className:"inline-flex items-center gap-1 tabular-nums text-destructive",children:[e.jsx(_s,{className:"h-3 w-3"}),E(s.completionTokens||0)]})}),e.jsx(w,{className:"px-3 py-2",children:(()=>{const c=He(s);return e.jsx(v,{label:c.title,children:e.jsx("span",{className:f("whitespace-nowrap text-[11px] font-medium tabular-nums",c.hit?"text-warning":"text-muted-foreground"),children:c.label})})})()}),e.jsx(w,{className:"px-3 py-2 text-muted-foreground tabular-nums",children:be(s.cost??0,z,V)}),e.jsx(w,{className:"px-3 py-2",children:e.jsxs(xe,{variant:"outline",className:"font-normal",children:[e.jsx("span",{"aria-hidden":"true",className:f("size-1.5 rounded-full",Ge(s))}),Je(s)]})}),e.jsx(w,{className:"px-3 py-2 text-right",children:e.jsxs(P,{variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground",onClick:()=>I(s),children:[e.jsx($,{className:"h-3.5 w-3.5","aria-hidden":!0}),"View"]})})]},s.id??`${s.timestamp}-${a}`))})]})})]})}),Ye>0?e.jsx(Bs,{className:"px-3 py-3 sm:px-5 sm:py-4",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsxs("p",{className:"text-[10px] tabular-nums text-muted-foreground sm:text-[11px]",children:[ue,"/",J]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs(P,{variant:"outline",size:"sm",className:"size-8 px-0 sm:h-7 sm:w-auto sm:px-2.5",loading:F,disabled:F||ue<=1,onClick:()=>j(s=>Math.max(1,s-1)),"aria-label":F?"Loading page":"Previous page",children:[e.jsx(Ue,{className:"h-4 w-4","aria-hidden":!0}),e.jsx("span",{className:"hidden sm:inline",children:"Prev"})]}),e.jsxs(P,{variant:"outline",size:"sm",className:"size-8 px-0 sm:h-7 sm:w-auto sm:px-2.5",loading:F,disabled:F||ue>=J,onClick:()=>j(s=>Math.min(J,s+1)),"aria-label":F?"Loading page":"Next page",children:[e.jsx("span",{className:"hidden sm:inline",children:"Next"}),e.jsx(Ls,{className:"h-4 w-4","aria-hidden":!0})]})]})]})}):null]}),e.jsx(gs,{open:k,onOpenChange:ee,children:e.jsxs(bs,{className:"max-w-[25rem] overflow-hidden p-0",children:[e.jsx("div",{className:"border-b border-border/70 bg-destructive/[0.06] px-5 py-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-destructive/10 text-destructive",children:e.jsx(Rs,{className:"h-4 w-4","aria-hidden":!0})}),e.jsxs(js,{className:"gap-1 text-left",children:[e.jsx(vs,{className:"text-sm font-semibold",children:"Clear Usage history?"}),e.jsx(ys,{className:"text-xs leading-5",children:"Remove request history, daily totals, and captured details for the selected time range."})]})]})}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"clear-history-range",className:"text-xs font-medium text-foreground",children:"Time range"}),e.jsxs(pe,{items:Object.fromEntries(ve.map(s=>[s.value,s.label])),value:K,onValueChange:s=>ye(s||"today"),children:[e.jsx(he,{id:"clear-history-range",className:"h-9 w-full text-xs",children:e.jsx(fe,{})}),e.jsx(ge,{className:"max-h-52 overscroll-contain",children:ve.map(s=>e.jsx(Y,{value:s.value,className:"min-h-8 py-1.5",children:s.label},s.value))})]})]}),e.jsxs("div",{className:"rounded-lg border border-border/70 bg-muted/30 px-3 py-2.5 text-xs leading-5 text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-foreground",children:Qe[K]})," will be removed. Providers, API keys, and settings will not be affected."]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(P,{variant:"outline",size:"sm",onClick:()=>ee(!1),disabled:M.isPending,children:"Cancel"}),e.jsx(P,{variant:"destructive",size:"sm",onClick:()=>M.mutate(K),disabled:M.isPending,children:M.isPending?"Clearing…":K==="all"?"Clear all history":`Clear ${Qe[K].toLowerCase()}`})]})]})]})}),e.jsx(rt,{open:!!r,onOpenChange:s=>{s||I(null)},children:e.jsxs(at,{variant:"inset",children:[e.jsxs(nt,{className:"px-4 py-3 sm:px-5 sm:py-4",children:[e.jsxs(P,{type:"button",variant:"ghost",size:"sm",className:"-ml-2 h-8 w-fit gap-1 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>I(null),"aria-label":"Back to usage history",children:[e.jsx(Ue,{className:"h-4 w-4","aria-hidden":!0}),"Back"]}),e.jsxs("div",{className:"mt-2 flex min-w-0 items-start justify-between gap-3 pr-8",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(lt,{className:"text-lg sm:text-xl",children:"Request detail"}),e.jsxs(it,{className:"break-words font-mono text-[11px] leading-4 sm:text-xs",children:[(r==null?void 0:r.model)||"Unknown model"," ·"," ",r?R(r.provider):""]})]}),r?e.jsx(is,{tone:r.status==="ok"||r.status==="success"?"ok":r.status==="error"?"err":"muted",className:"shrink-0 text-[10px]",children:(r.status||"—").toUpperCase()}):null]})]}),e.jsxs(ot,{className:"space-y-3 px-4 py-3 sm:space-y-4 sm:px-5 sm:py-4",children:[e.jsxs("section",{className:"rounded-xl border border-border/70 bg-surface/35 p-3 sm:p-3.5",children:[e.jsx("p",{className:"mb-3 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Request summary"}),e.jsx("dl",{className:"grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-3",children:[["Time",je(r==null?void 0:r.timestamp),!1],["Provider",r?R(r.provider):"—",!1],["Latency",((qe=l==null?void 0:l.latency)==null?void 0:qe.total)!=null?`${Math.round(l.latency.total)} ms`:(r==null?void 0:r.latencyMs)!=null?`${r.latencyMs} ms`:"—",!1],["Cost",be((r==null?void 0:r.cost)??(l==null?void 0:l.cost)??0,z,V),!1],["Connection ID",(l==null?void 0:l.connectionId)||(r==null?void 0:r.connectionId)||"—",!0],["Endpoint",(r==null?void 0:r.endpoint)||"—",!0]].map(([s,a,c])=>e.jsxs("div",{className:f("min-w-0",s==="Connection ID"&&"col-span-2 sm:col-span-2"),children:[e.jsx("dt",{className:"text-[9px] uppercase tracking-wide text-muted-foreground sm:text-[10px]",children:String(s)}),e.jsxs("dd",{className:"mt-0.5 flex min-w-0 items-center gap-2",children:[e.jsx(v,{label:String(a),children:e.jsx("span",{className:f("min-w-0 flex-1 text-[11px] text-foreground sm:text-xs",!!c&&"font-mono text-[10px] sm:text-[11px]",s==="Connection ID"?"break-all":"truncate"),children:String(a)})}),s==="Connection ID"&&a!=="—"?e.jsx(os,{value:String(a),label:"Copy",iconOnly:!0,className:"size-6 shrink-0 p-0 [&_svg]:mx-0 [&_svg]:size-3"}):null]})]},String(s)))})]}),r!=null&&r.error?e.jsx("p",{className:"rounded-lg border border-destructive/30 bg-destructive/8 px-3 py-2.5 text-xs text-destructive-foreground",children:r.error}):null,e.jsxs("section",{className:"rounded-xl border border-border/70 bg-surface/35 p-3 sm:p-3.5",children:[e.jsx("p",{className:"mb-3 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Token usage"}),e.jsx("div",{className:"grid grid-cols-3 divide-x divide-border/70",children:[["Prompt",E(es??(r==null?void 0:r.promptTokens)??0),"text-success"],["Cached",E(ts??0),"text-foreground"],["Completion",E(ss??(r==null?void 0:r.completionTokens)??0),"text-destructive"]].map(([s,a,c],p)=>e.jsxs("div",{className:f("min-w-0 px-3 first:pl-0 last:pr-0",p===0&&"pl-0"),children:[e.jsx("p",{className:"text-[9px] uppercase tracking-wide text-muted-foreground sm:text-[10px]",children:String(s)}),e.jsx("p",{className:f("mt-0.5 text-sm font-semibold tabular-nums sm:text-base",String(c)),children:String(a)})]},String(s)))})]}),e.jsxs("section",{children:[e.jsxs("div",{className:"mb-2 flex flex-wrap items-start justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground sm:text-[11px]",children:"Payload"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:ne?"Select a captured payload to inspect and copy its JSON.":"Full payload was not captured. Metadata remains available above."})]}),e.jsx(xe,{variant:ne?"success":"outline",className:"text-[10px] font-normal",children:ne?"Payload captured":"Metadata only"}),ne?null:e.jsxs(P,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-[11px]",onClick:()=>t("/dashboard/settings?tab=security"),children:[e.jsx(Es,{className:"size-3.5","aria-hidden":"true"}),"Enable in Settings"]})]}),te.isLoading?e.jsxs("div",{className:"space-y-2 rounded-xl border border-border/70 p-3",children:[e.jsx(B,{className:"h-9 w-full"}),e.jsx(B,{className:"h-9 w-full"}),e.jsx(B,{className:"h-9 w-full"})]}):l?(()=>{var c;const a=[{key:"request",label:"Request",filename:`${((c=l.request)==null?void 0:c.method)??"REQUEST"}.json`,value:l.request},{key:"providerRequest",label:"Provider request",filename:"provider-request.json",value:l.providerRequest},{key:"providerResponse",label:"Provider response",filename:"provider-response.json",value:l.providerResponse},{key:"response",label:"Response",filename:"response.json",value:l.response}].filter(p=>p.value!==void 0&&p.value!==null);return a.length?e.jsx(Ks,{multiple:!0,defaultValue:a[0]?[a[0].key]:[],className:"w-full min-w-0 overflow-hidden rounded-xl border border-border/70 bg-surface/30",children:a.map(p=>{const H=Ve(p.value);return e.jsxs(Vs,{value:p.key,className:"border-border/70 px-3 last:border-b-0",children:[e.jsx(Gs,{className:"gap-2 py-2 sm:py-2.5",children:e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-xs sm:text-sm",children:p.label}),e.jsx("span",{className:"truncate text-[9px] font-normal text-muted-foreground sm:text-[10px]",children:pt(p.value)})]})}),e.jsx(Js,{className:"min-w-0 overflow-hidden pb-3",children:H?e.jsx("div",{className:"rounded-lg border border-border/70 bg-muted/30 px-3 py-2.5 text-xs text-muted-foreground",children:"Payload capture was unavailable for this field. Metadata is still available above."}):e.jsx(tt,{code:Ze(p.value),language:"json",filename:p.filename,className:"max-h-80 max-w-full min-w-0 overflow-auto"})})]},p.key)})}):e.jsx("p",{className:"rounded-xl border border-border/70 bg-surface/30 px-3 py-3 text-xs text-muted-foreground",children:"Full request and response payloads were not captured for this request."})})():e.jsx("p",{className:"rounded-xl border border-border/70 bg-surface/30 px-3 py-3 text-xs text-muted-foreground",children:"Full request and response payloads were not captured for this request."})]})]})]})})]})}export{Rt as default};
@@ -1 +1 @@
1
- import{j as a}from"./react-vendor-xnYrwzsL.js";import{c as e}from"./index-CkR38iPY.js";import{i as r}from"./icons-vendor-CUx7SB5V.js";import{a6 as i,a7 as s,a8 as c,a9 as d,aa as l}from"./ui-vendor-BuM9f2NY.js";function x(o){return a.jsx(i,{"data-slot":"accordion",...o})}function g({className:o,...t}){return a.jsx(s,{className:e("min-w-0 border-b last:border-b-0",o),"data-slot":"accordion-item",...t})}function h({className:o,children:t,...n}){return a.jsx(c,{className:"flex",children:a.jsxs(d,{className:e("flex flex-1 cursor-pointer items-start justify-between gap-4 rounded-md py-4 text-left font-medium text-sm outline-none transition-all focus-visible:ring-[3px] focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-64 data-panel-open:*:data-[slot=accordion-indicator]:rotate-180",o),"data-slot":"accordion-trigger",...n,children:[t,a.jsx(r,{className:"pointer-events-none size-4 shrink-0 translate-y-0.5 opacity-80 transition-transform duration-200 ease-in-out","data-slot":"accordion-indicator"})]})})}function b({className:o,children:t,...n}){return a.jsx(l,{className:"h-(--accordion-panel-height) overflow-hidden text-muted-foreground text-sm transition-[height] duration-200 ease-in-out data-ending-style:h-0 data-starting-style:h-0","data-slot":"accordion-panel",...n,children:a.jsx("div",{className:e("pt-0 pb-4",o),children:t})})}export{x as A,g as a,h as b,b as c};
1
+ import{j as a}from"./react-vendor-xnYrwzsL.js";import{c as e}from"./index-B7c_Oeni.js";import{i as r}from"./icons-vendor-CUx7SB5V.js";import{a6 as i,a7 as s,a8 as c,a9 as d,aa as l}from"./ui-vendor-BuM9f2NY.js";function x(o){return a.jsx(i,{"data-slot":"accordion",...o})}function g({className:o,...t}){return a.jsx(s,{className:e("min-w-0 border-b last:border-b-0",o),"data-slot":"accordion-item",...t})}function h({className:o,children:t,...n}){return a.jsx(c,{className:"flex",children:a.jsxs(d,{className:e("flex flex-1 cursor-pointer items-start justify-between gap-4 rounded-md py-4 text-left font-medium text-sm outline-none transition-all focus-visible:ring-[3px] focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-64 data-panel-open:*:data-[slot=accordion-indicator]:rotate-180",o),"data-slot":"accordion-trigger",...n,children:[t,a.jsx(r,{className:"pointer-events-none size-4 shrink-0 translate-y-0.5 opacity-80 transition-transform duration-200 ease-in-out","data-slot":"accordion-indicator"})]})})}function b({className:o,children:t,...n}){return a.jsx(l,{className:"h-(--accordion-panel-height) overflow-hidden text-muted-foreground text-sm transition-[height] duration-200 ease-in-out data-ending-style:h-0 data-starting-style:h-0","data-slot":"accordion-panel",...n,children:a.jsx("div",{className:e("pt-0 pb-4",o),children:t})})}export{x as A,g as a,h as b,b as c};
@@ -1 +1 @@
1
- import{y as o}from"./index-CkR38iPY.js";async function r(){const{data:a}=await o.get("/provider-nodes");return a.nodes??[]}async function l(a){const{data:e}=await o.post("/provider-nodes",a);return e.node}async function i(a,e){const{data:t}=await o.put(`/provider-nodes/${a}`,e);return t.node}async function s(a){await o.delete(`/provider-nodes/${a}`)}async function c(){const{data:a}=await o.get("/proxy-pools",{params:{includeUsage:"true"}});return a.proxyPools??[]}async function p(a){const{data:e}=await o.post("/proxy-pools",a);return e.proxyPool??e.pool}async function d(a,e){const{data:t}=await o.put(`/proxy-pools/${a}`,e);return t.proxyPool??t.pool}async function u(a){const e=`/proxy-pools/${a.type}-deploy`,{data:t}=await o.post(e,a);return t}async function y(a){await o.delete(`/proxy-pools/${a}`)}async function m(a){const{data:e}=await o.post(`/proxy-pools/${a}/test`);return e}function b(a){var e;return{profileName:((e=a.profileName)==null?void 0:e.trim())||"Sway Router",profileAvatar:a.profileAvatar||"",currency:a.currency==="IDR"?"IDR":"USD",requireApiKey:!!a.requireApiKey,requireLogin:!!a.requireLogin,payloadCaptureEnabled:a.payloadCaptureEnabled!==!1,rtkEnabled:a.rtkEnabled!==!1,cavemanEnabled:!!a.cavemanEnabled,cavemanLevel:String(a.cavemanLevel||"full"),ponytailEnabled:!!a.ponytailEnabled,ponytailLevel:String(a.ponytailLevel||"full")}}function v(a){return{requireApiKey:a.requireApiKey,requireLogin:a.requireLogin,payloadCaptureEnabled:a.payloadCaptureEnabled,rtkEnabled:a.rtkEnabled,cavemanEnabled:a.cavemanEnabled,cavemanLevel:a.cavemanLevel,ponytailEnabled:a.ponytailEnabled,ponytailLevel:a.ponytailLevel}}async function f(){const{data:a}=await o.get("/combos");return a.combos??[]}async function x(a){const{data:e}=await o.post("/combos",a);return e}async function E(a,e){const{data:t}=await o.put(`/combos/${encodeURIComponent(a)}`,e);return t}async function w(a){await o.delete(`/combos/${encodeURIComponent(a)}`)}export{c as a,E as b,l as c,s as d,x as e,w as f,f as g,u as h,p as i,d as j,y as k,r as l,v as m,b as s,m as t,i as u};
1
+ import{y as o}from"./index-B7c_Oeni.js";async function r(){const{data:a}=await o.get("/provider-nodes");return a.nodes??[]}async function l(a){const{data:e}=await o.post("/provider-nodes",a);return e.node}async function i(a,e){const{data:t}=await o.put(`/provider-nodes/${a}`,e);return t.node}async function s(a){await o.delete(`/provider-nodes/${a}`)}async function c(){const{data:a}=await o.get("/proxy-pools",{params:{includeUsage:"true"}});return a.proxyPools??[]}async function p(a){const{data:e}=await o.post("/proxy-pools",a);return e.proxyPool??e.pool}async function d(a,e){const{data:t}=await o.put(`/proxy-pools/${a}`,e);return t.proxyPool??t.pool}async function u(a){const e=`/proxy-pools/${a.type}-deploy`,{data:t}=await o.post(e,a);return t}async function y(a){await o.delete(`/proxy-pools/${a}`)}async function m(a){const{data:e}=await o.post(`/proxy-pools/${a}/test`);return e}function b(a){var e;return{profileName:((e=a.profileName)==null?void 0:e.trim())||"Sway Router",profileAvatar:a.profileAvatar||"",currency:a.currency==="IDR"?"IDR":"USD",requireApiKey:!!a.requireApiKey,requireLogin:!!a.requireLogin,payloadCaptureEnabled:a.payloadCaptureEnabled!==!1,rtkEnabled:a.rtkEnabled!==!1,cavemanEnabled:!!a.cavemanEnabled,cavemanLevel:String(a.cavemanLevel||"full"),ponytailEnabled:!!a.ponytailEnabled,ponytailLevel:String(a.ponytailLevel||"full")}}function v(a){return{requireApiKey:a.requireApiKey,requireLogin:a.requireLogin,payloadCaptureEnabled:a.payloadCaptureEnabled,rtkEnabled:a.rtkEnabled,cavemanEnabled:a.cavemanEnabled,cavemanLevel:a.cavemanLevel,ponytailEnabled:a.ponytailEnabled,ponytailLevel:a.ponytailLevel}}async function f(){const{data:a}=await o.get("/combos");return a.combos??[]}async function x(a){const{data:e}=await o.post("/combos",a);return e}async function E(a,e){const{data:t}=await o.put(`/combos/${encodeURIComponent(a)}`,e);return t}async function w(a){await o.delete(`/combos/${encodeURIComponent(a)}`)}export{c as a,E as b,l as c,s as d,x as e,w as f,f as g,u as h,p as i,d as j,y as k,r as l,v as m,b as s,m as t,i as u};
@@ -1 +1 @@
1
- import{y as i}from"./index-CkR38iPY.js";async function c(e){const{data:t}=await i.get("/keys",{params:e!=null&&e.includeRevoked?{includeRevoked:1}:void 0});return(t.keys??[]).map(a)}async function d(e){var r;const t=((r=e.name)==null?void 0:r.trim())||"default",{data:n}=await i.post("/keys",{name:t});return{key:{id:n.id??`key_${Math.random().toString(36).slice(2,10)}`,name:n.name??t,prefix:n.key?n.key.slice(0,10):void 0,key:n.key,isActive:!0,isDefault:n.isDefault===!0,createdAt:new Date().toISOString()},message:"Save this key now — it will not be shown again."}}async function f(e,t){const{data:n}=await i.put(`/keys/${encodeURIComponent(e)}`,{isActive:t.isActive});return a(n.key)}async function k(e){await i.delete(`/keys/${encodeURIComponent(e)}`)}async function p(e){const{data:t}=await i.put(`/keys/${encodeURIComponent(e)}`,{rotate:!0});return a(t.key)}async function y(e){var n;const{data:t}=await i.get(`/keys/${encodeURIComponent(e)}`);return((n=t.key)==null?void 0:n.key)||""}async function l(){const t=(await c({includeRevoked:!1})).find(n=>n.isActive!==!1);return t?t.key?t.key:t.id?y(t.id):"":""}function a(e){const t=e.key?s(e.key):void 0;return{...e,prefix:e.prefix||e.keyPrefix||t,keyPrefix:e.keyPrefix||e.prefix||t}}function m(e){return e.prefix||e.keyPrefix?e.prefix||e.keyPrefix||"":e.key?s(e.key):"swy-••••"}function s(e){const t=e.trim();if(t.length<=11)return t;const n=t.startsWith("sk-")?"sk-":t.slice(0,3);return t.length>14?`${n}${t.slice(3,11)}…`:t}export{k as a,l as b,d as c,m as d,y as g,c as l,p as r,f as u};
1
+ import{y as i}from"./index-B7c_Oeni.js";async function c(e){const{data:t}=await i.get("/keys",{params:e!=null&&e.includeRevoked?{includeRevoked:1}:void 0});return(t.keys??[]).map(a)}async function d(e){var r;const t=((r=e.name)==null?void 0:r.trim())||"default",{data:n}=await i.post("/keys",{name:t});return{key:{id:n.id??`key_${Math.random().toString(36).slice(2,10)}`,name:n.name??t,prefix:n.key?n.key.slice(0,10):void 0,key:n.key,isActive:!0,isDefault:n.isDefault===!0,createdAt:new Date().toISOString()},message:"Save this key now — it will not be shown again."}}async function f(e,t){const{data:n}=await i.put(`/keys/${encodeURIComponent(e)}`,{isActive:t.isActive});return a(n.key)}async function k(e){await i.delete(`/keys/${encodeURIComponent(e)}`)}async function p(e){const{data:t}=await i.put(`/keys/${encodeURIComponent(e)}`,{rotate:!0});return a(t.key)}async function y(e){var n;const{data:t}=await i.get(`/keys/${encodeURIComponent(e)}`);return((n=t.key)==null?void 0:n.key)||""}async function l(){const t=(await c({includeRevoked:!1})).find(n=>n.isActive!==!1);return t?t.key?t.key:t.id?y(t.id):"":""}function a(e){const t=e.key?s(e.key):void 0;return{...e,prefix:e.prefix||e.keyPrefix||t,keyPrefix:e.keyPrefix||e.prefix||t}}function m(e){return e.prefix||e.keyPrefix?e.prefix||e.keyPrefix||"":e.key?s(e.key):"swy-••••"}function s(e){const t=e.trim();if(t.length<=11)return t;const n=t.startsWith("sk-")?"sk-":t.slice(0,3);return t.length>14?`${n}${t.slice(3,11)}…`:t}export{k as a,l as b,d as c,m as d,y as g,c as l,p as r,f as u};
@@ -1 +1 @@
1
- import{c as o}from"./index-CkR38iPY.js";import{u as e,m as s}from"./ui-vendor-BuM9f2NY.js";function c({className:a,render:t,...r}){const d={className:o("relative flex flex-col rounded-2xl border bg-card not-dark:bg-clip-padding text-card-foreground",a),"data-slot":"card"};return e({defaultTagName:"div",props:s(d,r),render:t})}function i({className:a,render:t,...r}){const d={className:o("grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 p-6 in-[[data-slot=card]:has(>[data-slot=card-panel])]:pb-4 has-data-[slot=card-action]:grid-cols-[1fr_auto]",a),"data-slot":"card-header"};return e({defaultTagName:"div",props:s(d,r),render:t})}function p({className:a,render:t,...r}){const d={className:o("font-heading font-semibold text-lg leading-none",a),"data-slot":"card-title"};return e({defaultTagName:"div",props:s(d,r),render:t})}function u({className:a,render:t,...r}){const d={className:o("flex-1 p-6 in-[[data-slot=card]:has(>[data-slot=card-header]:not(.border-b))]:pt-0 in-[[data-slot=card]:has(>[data-slot=card-footer]:not(.border-t))]:pb-0",a),"data-slot":"card-panel"};return e({defaultTagName:"div",props:s(d,r),render:t})}export{c as C,i as a,p as b,u as c};
1
+ import{c as o}from"./index-B7c_Oeni.js";import{u as e,m as s}from"./ui-vendor-BuM9f2NY.js";function c({className:a,render:t,...r}){const d={className:o("relative flex flex-col rounded-2xl border bg-card not-dark:bg-clip-padding text-card-foreground",a),"data-slot":"card"};return e({defaultTagName:"div",props:s(d,r),render:t})}function i({className:a,render:t,...r}){const d={className:o("grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 p-6 in-[[data-slot=card]:has(>[data-slot=card-panel])]:pb-4 has-data-[slot=card-action]:grid-cols-[1fr_auto]",a),"data-slot":"card-header"};return e({defaultTagName:"div",props:s(d,r),render:t})}function p({className:a,render:t,...r}){const d={className:o("font-heading font-semibold text-lg leading-none",a),"data-slot":"card-title"};return e({defaultTagName:"div",props:s(d,r),render:t})}function u({className:a,render:t,...r}){const d={className:o("flex-1 p-6 in-[[data-slot=card]:has(>[data-slot=card-header]:not(.border-b))]:pt-0 in-[[data-slot=card]:has(>[data-slot=card-footer]:not(.border-t))]:pb-0",a),"data-slot":"card-panel"};return e({defaultTagName:"div",props:s(d,r),render:t})}export{c as C,i as a,p as b,u as c};
@@ -1 +1 @@
1
- import{j as e}from"./react-vendor-xnYrwzsL.js";import{c as n}from"./index-CkR38iPY.js";import{R as o,U as a}from"./ui-vendor-BuM9f2NY.js";function u({className:i,...r}){return e.jsx(o,{className:n("relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-[.25rem] border border-input bg-background not-dark:bg-clip-padding outline-none ring-ring focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-background aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/48 data-disabled:cursor-not-allowed data-disabled:opacity-64 sm:size-4 dark:not-data-checked:bg-input/32 dark:aria-invalid:ring-destructive/24",i),"data-slot":"checkbox",...r,children:e.jsx(a,{className:"absolute -inset-px flex items-center justify-center rounded-[.25rem] text-primary-foreground data-unchecked:hidden data-checked:bg-primary data-indeterminate:text-foreground","data-slot":"checkbox-indicator",render:(t,s)=>e.jsx("span",{...t,children:s.indeterminate?e.jsx("svg",{"aria-hidden":"true",className:"size-3.5 sm:size-3",fill:"none",height:"24",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",viewBox:"0 0 24 24",width:"24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M5.252 12h13.496"})}):e.jsx("svg",{"aria-hidden":"true",className:"size-3.5 sm:size-3",fill:"none",height:"24",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",viewBox:"0 0 24 24",width:"24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M5.252 12.7 10.2 18.63 18.748 5.37"})})})})})}export{u as C};
1
+ import{j as e}from"./react-vendor-xnYrwzsL.js";import{c as n}from"./index-B7c_Oeni.js";import{R as o,U as a}from"./ui-vendor-BuM9f2NY.js";function u({className:i,...r}){return e.jsx(o,{className:n("relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-[.25rem] border border-input bg-background not-dark:bg-clip-padding outline-none ring-ring focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-background aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/48 data-disabled:cursor-not-allowed data-disabled:opacity-64 sm:size-4 dark:not-data-checked:bg-input/32 dark:aria-invalid:ring-destructive/24",i),"data-slot":"checkbox",...r,children:e.jsx(a,{className:"absolute -inset-px flex items-center justify-center rounded-[.25rem] text-primary-foreground data-unchecked:hidden data-checked:bg-primary data-indeterminate:text-foreground","data-slot":"checkbox-indicator",render:(t,s)=>e.jsx("span",{...t,children:s.indeterminate?e.jsx("svg",{"aria-hidden":"true",className:"size-3.5 sm:size-3",fill:"none",height:"24",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",viewBox:"0 0 24 24",width:"24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M5.252 12h13.496"})}):e.jsx("svg",{"aria-hidden":"true",className:"size-3.5 sm:size-3",fill:"none",height:"24",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",viewBox:"0 0 24 24",width:"24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M5.252 12.7 10.2 18.63 18.748 5.37"})})})})})}export{u as C};
@@ -1 +1 @@
1
- import{y as s,U as L,V as M}from"./index-CkR38iPY.js";function I(t){return!!(t!=null&&t.isCustom||t!=null&&t.nodeType||t!=null&&t.passthroughModels)}async function P(t,e=!1){const{data:a}=await s.get(`/providers/${encodeURIComponent(t)}/models`,e?{params:{refresh:"1"}}:void 0);return a}async function z(t){const{data:e}=await s.get("/providers",{params:t});return{connections:e.connections??[],pagination:e.pagination??{page:t.page??1,pageSize:t.pageSize??50,totalItems:0,totalPages:0,hasNext:!1,hasPrev:!1}}}async function $(){const{data:t}=await s.get("/providers/counts");return t.counts??[]}async function T(){try{const{data:t}=await s.get("/providers/catalog"),e=t.providers??[];if(e.length)return e}catch{}return[]}async function B(){const[t,e,a]=await Promise.all([T(),$(),s.get("/provider-nodes")]),f=t.length?t:L(),m=a.data.nodes??[],l=o=>String(o||"").trim().toLowerCase().replace(/[^a-z0-9]/g,""),c=new Map;for(const o of e){const i=String(o.provider).trim().toLowerCase();c.set(i,o),c.set(l(i),o)}for(const o of f){const i=[o.id,o.alias].filter(Boolean).flatMap(u=>{const n=String(u).trim().toLowerCase();return[n,l(n)]}),r=i.map(u=>c.get(u)).find(Boolean);if(r)for(const u of i)c.set(u,r)}for(const o of m){const i=[o.id,o.prefix].filter(Boolean).flatMap(u=>{const n=String(u).trim().toLowerCase();return[n,l(n)]}),r=i.map(u=>c.get(u)).find(Boolean);if(r)for(const u of i)c.set(u,r)}const w=Array.from(new Set(e.map(o=>String(o.provider).trim()))),g=new Set,h=w.filter(o=>{const i=l(o);return g.has(i)?!1:(g.add(i),!0)});w.splice(0,w.length,...h);const p=new Set,y=[],k=new Map(m.map(o=>[o.id,o])),v=o=>{const i=o.trim().toLowerCase(),r=l(i);return f.find(u=>[u.id,u.alias].some(n=>{const d=String(n||"").trim().toLowerCase();return d===i||l(d)===r}))},x=o=>{const i=o.trim().toLowerCase();return c.get(i)||c.get(l(i))||(()=>{const r=v(o);if(r)return c.get(String(r.id).trim().toLowerCase())||c.get(l(r.id))||(r.alias?c.get(String(r.alias).trim().toLowerCase())||c.get(l(r.alias)):void 0)})()};for(const o of f){const i=x(o.id)||(o.alias?x(o.alias):void 0);if(!i)continue;const r=o.id.trim().toLowerCase();c.set(r,i),c.set(l(r),i),o.alias&&(c.set(o.alias.trim().toLowerCase(),i),c.set(l(o.alias),i))}for(const o of w){const i=o.trim().toLowerCase(),r=v(o),u=(r==null?void 0:r.id)||o,n=M(u)||r,d=k.get(u)||k.get(o),C=c.get(i)||c.get(l(i))||c.get(u.toLowerCase())||c.get(l(u));y.push({id:u,alias:(d==null?void 0:d.prefix)||(n==null?void 0:n.alias),name:(d==null?void 0:d.name)||(n==null?void 0:n.name)||u,color:n==null?void 0:n.color,icon:d?"sway-custom":n==null?void 0:n.icon,textIcon:n==null?void 0:n.textIcon,category:n==null?void 0:n.category,authType:(n==null?void 0:n.authType)||"apikey",noAuth:n==null?void 0:n.noAuth,authModes:n==null?void 0:n.authModes,thinkingConfig:r==null?void 0:r.thinkingConfig,passthroughModels:(r==null?void 0:r.passthroughModels)===!0,isCustom:!!d,baseUrl:d==null?void 0:d.baseUrl,nodeType:d==null?void 0:d.type,apiType:d==null?void 0:d.apiType,connected:(C==null?void 0:C.total)??0}),p.add(u)}for(const o of m)p.has(o.id)||(y.push({id:o.id,alias:o.prefix||o.id,name:o.name||o.prefix||o.id,authType:"apikey",isCustom:!0,baseUrl:o.baseUrl,nodeType:o.type,apiType:o.apiType,icon:"sway",connected:0}),p.add(o.id));for(const o of f)p.has(o.id)||y.push({...o,connected:0});return y}async function U(t){const{data:e}=await s.post("/providers",t);return e.connection}async function O(t,e){const{data:a}=await s.put(`/providers/${t}`,e);return a.connection}async function b(t){const{data:e}=await s.delete(`/providers/${t}`);return e}async function K(t,e){const{data:a}=await s.put(`/providers/${t}`,{isActive:!e});return a.connection}async function D(t,e,a){const{data:f}=await s.post(`/providers/${t}/test`,{},{signal:a==null?void 0:a.signal});return f}async function N(t,e){const{data:a}=await s.post(`/providers/${t}/test-models`,e!=null&&e.model?{model:e.model}:{},{signal:e==null?void 0:e.signal});return a}async function R(t,e){const{data:a}=await s.post("/models/test",{model:t,kind:"llm"},{signal:e==null?void 0:e.signal});return a}async function _(t){const{data:e}=await s.post("/providers/validate",t);return e}async function j(t){const{data:e}=await s.post("/providers/validate",t);return e}function S(t,e){if(t==="codex")return"http://localhost:1455/auth/callback";if(t==="xai")return"http://127.0.0.1:56121/callback";const a=typeof window<"u"?window.location.protocol:"http:",f=(typeof window<"u"?window.location.port:"14045")||(a==="https:"?"443":"80"),m=typeof window<"u"?window.location.hostname:"localhost";return`http://${m==="127.0.0.1"||m==="localhost"?m:"localhost"}:${f}/callback`}async function q(t,e=S(t),a){const f={redirect_uri:e};for(const[l,c]of Object.entries({}))c!==void 0&&(f[l]=c);const{data:m}=await s.get(`/oauth/${t}/authorize`,{params:f});return m}async function H(t,e){const{data:a}=await s.get(`/oauth/${t}/start-proxy`,{params:{app_port:String(e.appPort)}});return a}async function E(t,e){const{data:a}=await s.post(`/oauth/${t}/register-session`,e);return a}async function F(t,e){const{data:a}=await s.get(`/oauth/${t}/poll-status`,{params:{state:e}});return a}async function V(t){const{data:e}=await s.get(`/oauth/${t}/stop-proxy`);return e}async function G(t,e){const a={};e!=null&&e.authMethod&&(a.auth_method=e.authMethod),e!=null&&e.region&&(a.region=e.region),e!=null&&e.startUrl&&(a.start_url=e.startUrl);const{data:f}=await s.get(`/oauth/${t}/device-code`,Object.keys(a).length?{params:a}:void 0);return f}async function J(t,e){const{data:a}=await s.post(`/oauth/${t}/poll`,e);return a}async function Q(t,e){const{data:a}=await s.post(`/oauth/${t}/exchange`,e);return a}async function W(t,e){if(t==="codex"){const{data:a}=await s.post("/oauth/codex/import-token",{accessToken:e.accessToken,name:e.displayName});return a}if(t==="cursor"){if(!e.machineId)throw new Error("Cursor import requires a Machine ID");const{data:a}=await s.post("/oauth/cursor/import",{accessToken:e.accessToken,machineId:e.machineId});return a}return{success:!1,error:`Import token is not supported for "${t}" — use OAuth or device flow`}}async function X(){const{data:t}=await s.get("/oauth/cursor/auto-import");return t}async function Y(t){const{data:e}=await s.post("/oauth/kiro/api-key",t);return e}async function Z(t){const{data:e}=await s.post("/oauth/kiro/import",t);return e}async function tt(t){const{data:e}=await s.post("/oauth/kiro/import-cli-proxy",t);return e}async function et(t){var f,m,l,c,w;const e=(f=t.baseUrl)==null?void 0:f.trim();if(!e)return{ok:!1,success:!1,message:"No upstream base URL to import models from",models:[]};const a=(m=t.provider)!=null&&m.toLowerCase().includes("openrouter")?"openrouter-free":((l=t.provider)==null?void 0:l.toLowerCase())==="opencode-zen"?"opencode-all":(c=t.provider)!=null&&c.toLowerCase().includes("opencode")?"opencode-free":(w=t.provider)!=null&&w.toLowerCase().includes("mimo")?"mimo-free":"openrouter-free";try{const{data:g}=await s.get("/providers/suggested-models",{params:{url:e,type:a}}),h=(g.data??[]).map(p=>p.id).filter(p=>!!p);return{ok:h.length>0,success:h.length>0,message:h.length?`Found ${h.length} models`:"No models matched the catalog filter",models:h,count:h.length}}catch(g){return{ok:!1,success:!1,message:(g==null?void 0:g.message)||"Import failed",error:(g==null?void 0:g.message)||"Import failed",models:[]}}}export{z as A,B,$ as C,H as a,G as b,V as c,J as d,j as e,X as f,S as g,D as h,O as i,R as j,N as k,P as l,et as m,K as n,b as o,F as p,U as q,E as r,q as s,_ as t,I as u,Y as v,Z as w,tt as x,W as y,Q as z};
1
+ import{y as s,U as L,V as M}from"./index-B7c_Oeni.js";function I(t){return!!(t!=null&&t.isCustom||t!=null&&t.nodeType||t!=null&&t.passthroughModels)}async function P(t,e=!1){const{data:a}=await s.get(`/providers/${encodeURIComponent(t)}/models`,e?{params:{refresh:"1"}}:void 0);return a}async function z(t){const{data:e}=await s.get("/providers",{params:t});return{connections:e.connections??[],pagination:e.pagination??{page:t.page??1,pageSize:t.pageSize??50,totalItems:0,totalPages:0,hasNext:!1,hasPrev:!1}}}async function $(){const{data:t}=await s.get("/providers/counts");return t.counts??[]}async function T(){try{const{data:t}=await s.get("/providers/catalog"),e=t.providers??[];if(e.length)return e}catch{}return[]}async function B(){const[t,e,a]=await Promise.all([T(),$(),s.get("/provider-nodes")]),f=t.length?t:L(),m=a.data.nodes??[],l=o=>String(o||"").trim().toLowerCase().replace(/[^a-z0-9]/g,""),c=new Map;for(const o of e){const i=String(o.provider).trim().toLowerCase();c.set(i,o),c.set(l(i),o)}for(const o of f){const i=[o.id,o.alias].filter(Boolean).flatMap(u=>{const n=String(u).trim().toLowerCase();return[n,l(n)]}),r=i.map(u=>c.get(u)).find(Boolean);if(r)for(const u of i)c.set(u,r)}for(const o of m){const i=[o.id,o.prefix].filter(Boolean).flatMap(u=>{const n=String(u).trim().toLowerCase();return[n,l(n)]}),r=i.map(u=>c.get(u)).find(Boolean);if(r)for(const u of i)c.set(u,r)}const w=Array.from(new Set(e.map(o=>String(o.provider).trim()))),g=new Set,h=w.filter(o=>{const i=l(o);return g.has(i)?!1:(g.add(i),!0)});w.splice(0,w.length,...h);const p=new Set,y=[],k=new Map(m.map(o=>[o.id,o])),v=o=>{const i=o.trim().toLowerCase(),r=l(i);return f.find(u=>[u.id,u.alias].some(n=>{const d=String(n||"").trim().toLowerCase();return d===i||l(d)===r}))},x=o=>{const i=o.trim().toLowerCase();return c.get(i)||c.get(l(i))||(()=>{const r=v(o);if(r)return c.get(String(r.id).trim().toLowerCase())||c.get(l(r.id))||(r.alias?c.get(String(r.alias).trim().toLowerCase())||c.get(l(r.alias)):void 0)})()};for(const o of f){const i=x(o.id)||(o.alias?x(o.alias):void 0);if(!i)continue;const r=o.id.trim().toLowerCase();c.set(r,i),c.set(l(r),i),o.alias&&(c.set(o.alias.trim().toLowerCase(),i),c.set(l(o.alias),i))}for(const o of w){const i=o.trim().toLowerCase(),r=v(o),u=(r==null?void 0:r.id)||o,n=M(u)||r,d=k.get(u)||k.get(o),C=c.get(i)||c.get(l(i))||c.get(u.toLowerCase())||c.get(l(u));y.push({id:u,alias:(d==null?void 0:d.prefix)||(n==null?void 0:n.alias),name:(d==null?void 0:d.name)||(n==null?void 0:n.name)||u,color:n==null?void 0:n.color,icon:d?"sway-custom":n==null?void 0:n.icon,textIcon:n==null?void 0:n.textIcon,category:n==null?void 0:n.category,authType:(n==null?void 0:n.authType)||"apikey",noAuth:n==null?void 0:n.noAuth,authModes:n==null?void 0:n.authModes,thinkingConfig:r==null?void 0:r.thinkingConfig,passthroughModels:(r==null?void 0:r.passthroughModels)===!0,isCustom:!!d,baseUrl:d==null?void 0:d.baseUrl,nodeType:d==null?void 0:d.type,apiType:d==null?void 0:d.apiType,connected:(C==null?void 0:C.total)??0}),p.add(u)}for(const o of m)p.has(o.id)||(y.push({id:o.id,alias:o.prefix||o.id,name:o.name||o.prefix||o.id,authType:"apikey",isCustom:!0,baseUrl:o.baseUrl,nodeType:o.type,apiType:o.apiType,icon:"sway",connected:0}),p.add(o.id));for(const o of f)p.has(o.id)||y.push({...o,connected:0});return y}async function U(t){const{data:e}=await s.post("/providers",t);return e.connection}async function O(t,e){const{data:a}=await s.put(`/providers/${t}`,e);return a.connection}async function b(t){const{data:e}=await s.delete(`/providers/${t}`);return e}async function K(t,e){const{data:a}=await s.put(`/providers/${t}`,{isActive:!e});return a.connection}async function D(t,e,a){const{data:f}=await s.post(`/providers/${t}/test`,{},{signal:a==null?void 0:a.signal});return f}async function N(t,e){const{data:a}=await s.post(`/providers/${t}/test-models`,e!=null&&e.model?{model:e.model}:{},{signal:e==null?void 0:e.signal});return a}async function R(t,e){const{data:a}=await s.post("/models/test",{model:t,kind:"llm"},{signal:e==null?void 0:e.signal});return a}async function _(t){const{data:e}=await s.post("/providers/validate",t);return e}async function j(t){const{data:e}=await s.post("/providers/validate",t);return e}function S(t,e){if(t==="codex")return"http://localhost:1455/auth/callback";if(t==="xai")return"http://127.0.0.1:56121/callback";const a=typeof window<"u"?window.location.protocol:"http:",f=(typeof window<"u"?window.location.port:"14045")||(a==="https:"?"443":"80"),m=typeof window<"u"?window.location.hostname:"localhost";return`http://${m==="127.0.0.1"||m==="localhost"?m:"localhost"}:${f}/callback`}async function q(t,e=S(t),a){const f={redirect_uri:e};for(const[l,c]of Object.entries({}))c!==void 0&&(f[l]=c);const{data:m}=await s.get(`/oauth/${t}/authorize`,{params:f});return m}async function H(t,e){const{data:a}=await s.get(`/oauth/${t}/start-proxy`,{params:{app_port:String(e.appPort)}});return a}async function E(t,e){const{data:a}=await s.post(`/oauth/${t}/register-session`,e);return a}async function F(t,e){const{data:a}=await s.get(`/oauth/${t}/poll-status`,{params:{state:e}});return a}async function V(t){const{data:e}=await s.get(`/oauth/${t}/stop-proxy`);return e}async function G(t,e){const a={};e!=null&&e.authMethod&&(a.auth_method=e.authMethod),e!=null&&e.region&&(a.region=e.region),e!=null&&e.startUrl&&(a.start_url=e.startUrl);const{data:f}=await s.get(`/oauth/${t}/device-code`,Object.keys(a).length?{params:a}:void 0);return f}async function J(t,e){const{data:a}=await s.post(`/oauth/${t}/poll`,e);return a}async function Q(t,e){const{data:a}=await s.post(`/oauth/${t}/exchange`,e);return a}async function W(t,e){if(t==="codex"){const{data:a}=await s.post("/oauth/codex/import-token",{accessToken:e.accessToken,name:e.displayName});return a}if(t==="cursor"){if(!e.machineId)throw new Error("Cursor import requires a Machine ID");const{data:a}=await s.post("/oauth/cursor/import",{accessToken:e.accessToken,machineId:e.machineId});return a}return{success:!1,error:`Import token is not supported for "${t}" — use OAuth or device flow`}}async function X(){const{data:t}=await s.get("/oauth/cursor/auto-import");return t}async function Y(t){const{data:e}=await s.post("/oauth/kiro/api-key",t);return e}async function Z(t){const{data:e}=await s.post("/oauth/kiro/import",t);return e}async function tt(t){const{data:e}=await s.post("/oauth/kiro/import-cli-proxy",t);return e}async function et(t){var f,m,l,c,w;const e=(f=t.baseUrl)==null?void 0:f.trim();if(!e)return{ok:!1,success:!1,message:"No upstream base URL to import models from",models:[]};const a=(m=t.provider)!=null&&m.toLowerCase().includes("openrouter")?"openrouter-free":((l=t.provider)==null?void 0:l.toLowerCase())==="opencode-zen"?"opencode-all":(c=t.provider)!=null&&c.toLowerCase().includes("opencode")?"opencode-free":(w=t.provider)!=null&&w.toLowerCase().includes("mimo")?"mimo-free":"openrouter-free";try{const{data:g}=await s.get("/providers/suggested-models",{params:{url:e,type:a}}),h=(g.data??[]).map(p=>p.id).filter(p=>!!p);return{ok:h.length>0,success:h.length>0,message:h.length?`Found ${h.length} models`:"No models matched the catalog filter",models:h,count:h.length}}catch(g){return{ok:!1,success:!1,message:(g==null?void 0:g.message)||"Import failed",error:(g==null?void 0:g.message)||"Import failed",models:[]}}}export{z as A,B,$ as C,H as a,G as b,V as c,J as d,j as e,X as f,S as g,D as h,O as i,R as j,N as k,P as l,et as m,K as n,b as o,F as p,U as q,E as r,q as s,_ as t,I as u,Y as v,Z as w,tt as x,W as y,Q as z};
@@ -1 +1 @@
1
- import{r as n,j as t}from"./react-vendor-xnYrwzsL.js";import{R as l}from"./ripple-button-BrLlmKvT.js";import{e as m,c as u}from"./index-CkR38iPY.js";import{ag as d,ad as f}from"./icons-vendor-CUx7SB5V.js";function w({value:i,className:r,label:a="Copy",onCopy:s,iconOnly:c=!1}){const[e,o]=n.useState(!1);async function p(){try{await navigator.clipboard.writeText(i),o(!0),window.setTimeout(()=>o(!1),1500),s==null||s()}catch{}}return t.jsx(m,{label:e?"Copied":a||"Copy",children:t.jsxs(l,{type:"button",variant:"outline",size:"sm",onClick:p,className:u(r),"aria-label":a||"Copy",children:[e?t.jsx(d,{className:"h-3.5 w-3.5"}):t.jsx(f,{className:"h-3.5 w-3.5"}),c?null:e?"Copied":a]})})}export{w as C};
1
+ import{r as n,j as t}from"./react-vendor-xnYrwzsL.js";import{R as l}from"./ripple-button-Bi2qoFsd.js";import{e as m,c as u}from"./index-B7c_Oeni.js";import{ag as d,ad as f}from"./icons-vendor-CUx7SB5V.js";function w({value:i,className:r,label:a="Copy",onCopy:s,iconOnly:c=!1}){const[e,o]=n.useState(!1);async function p(){try{await navigator.clipboard.writeText(i),o(!0),window.setTimeout(()=>o(!1),1500),s==null||s()}catch{}}return t.jsx(m,{label:e?"Copied":a||"Copy",children:t.jsxs(l,{type:"button",variant:"outline",size:"sm",onClick:p,className:u(r),"aria-label":a||"Copy",children:[e?t.jsx(d,{className:"h-3.5 w-3.5"}):t.jsx(f,{className:"h-3.5 w-3.5"}),c?null:e?"Copied":a]})})}export{w as C};
@@ -1 +1 @@
1
- import{r as u,j as b}from"./react-vendor-xnYrwzsL.js";import{a as S,u as I,b as F,m as R}from"./motion-vendor-g5fpGzmJ.js";import{c as N,y as x}from"./index-CkR38iPY.js";import{u as U}from"./query-vendor-DVevaSVS.js";const $={type:"spring",stiffness:300,damping:25};function j({value:e,prefix:n="",suffix:t="",decimals:r=0,locale:s="id-ID",className:a}){const c=S(e,$),d=I(),m=u.useRef(e),o=u.useRef(null),i=u.useRef(new Intl.NumberFormat(s,{minimumFractionDigits:r,maximumFractionDigits:r})),[f,g]=u.useState(!1);u.useEffect(()=>{i.current=new Intl.NumberFormat(s,{minimumFractionDigits:r,maximumFractionDigits:r})},[r,s]);const y=F(c,p=>`${n}${i.current.format(Number.isFinite(p)?p:0)}${t}`),[T,h]=u.useState(`${n}${i.current.format(Number.isFinite(e)?e:0)}${t}`);return u.useEffect(()=>{if(c.set(e),m.current!==e)return m.current=e,g(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>g(!1),220),()=>{o.current&&clearTimeout(o.current)}},[c,e]),u.useEffect(()=>y.on("change",h),[y]),b.jsx(R.span,{className:N("tabular-nums text-foreground",a),animate:{transform:f&&!d?"translateY(-1px) scale(1.015)":"translateY(0) scale(1)"},transition:{duration:.18,ease:[.23,1,.32,1]},children:T})}function D(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.round(e):0}function q(e){const n=D(e.cachedTokens),t=D(e.cacheCreationTokens),r=n>0,s=[r?`HIT · ${n.toLocaleString("id-ID")}`:"MISS"];return t>0&&s.push(`+${t.toLocaleString("id-ID")}`),{hit:r,readTokens:n,creationTokens:t,label:s.join(" "),title:r?`Cache hit: ${n.toLocaleString("id-ID")} tokens read${t>0?`; ${t.toLocaleString("id-ID")} tokens created`:""}`:t>0?`Cache miss: ${t.toLocaleString("id-ID")} tokens created`:"Cache miss: no cached tokens read"}}const C=new Set(["usage-stats","usage-history","usage-chart","usage-heatmap","usage-request-details","request-detail"]);function Q(){const e=U();u.useEffect(()=>{let n=!1,t=null,r=null,s=null,a=1e3;const c=()=>{s=null,!n&&e.invalidateQueries({predicate:i=>{const f=i.queryKey[0];return typeof f=="string"&&C.has(f)}})},d=()=>{s||(s=setTimeout(c,0))},m=()=>{n||r||(r=setTimeout(()=>{r=null,o()},a),a=Math.min(a*2,1e4))},o=()=>{if(n||t)return;const i=new EventSource("/api/usage/stream");t=i,i.onopen=()=>{n||t!==i||(a=1e3)},i.onmessage=()=>{n||t!==i||d()},i.onerror=()=>{t===i&&(i.close(),t=null,m())}};return o(),()=>{n=!0,r&&clearTimeout(r),s&&clearTimeout(s),r=null,s=null,t==null||t.close(),t=null}},[e])}const l=16500,E="USD",k=new Intl.NumberFormat("id-ID",{style:"currency",currency:"IDR",currencyDisplay:"symbol",minimumFractionDigits:0,maximumFractionDigits:0});function A(e){return e==="IDR"?"IDR":E}function L(e,n,t=l){const r=Number(e);if(!Number.isFinite(r))return 0;if(n==="USD")return Math.max(0,r);const s=Number(t);return Math.max(0,r)*(Number.isFinite(s)&&s>0?s:l)}function K(e,n,t=l){const r=L(e,n,t);return n==="USD"?`$${r>=1?r.toFixed(2):r.toFixed(4)}`:k.format(r)}async function G(){const{data:e}=await x.get("/settings/currency");return{currency:A(e.currency),usdToIdr:Number.isFinite(Number(e.usdToIdr))&&Number(e.usdToIdr)>0?Number(e.usdToIdr):l,rateUpdatedAt:typeof e.rateUpdatedAt=="string"?e.rateUpdatedAt:null,rateSource:e.rateSource||"fallback"}}export{l as F,j as S,L as a,G as b,K as f,q as g,A as n,Q as u};
1
+ import{r as u,j as b}from"./react-vendor-xnYrwzsL.js";import{a as S,u as I,b as F,m as R}from"./motion-vendor-g5fpGzmJ.js";import{c as N,y as x}from"./index-B7c_Oeni.js";import{u as U}from"./query-vendor-DVevaSVS.js";const $={type:"spring",stiffness:300,damping:25};function j({value:e,prefix:n="",suffix:t="",decimals:r=0,locale:s="id-ID",className:a}){const c=S(e,$),d=I(),m=u.useRef(e),o=u.useRef(null),i=u.useRef(new Intl.NumberFormat(s,{minimumFractionDigits:r,maximumFractionDigits:r})),[f,g]=u.useState(!1);u.useEffect(()=>{i.current=new Intl.NumberFormat(s,{minimumFractionDigits:r,maximumFractionDigits:r})},[r,s]);const y=F(c,p=>`${n}${i.current.format(Number.isFinite(p)?p:0)}${t}`),[T,h]=u.useState(`${n}${i.current.format(Number.isFinite(e)?e:0)}${t}`);return u.useEffect(()=>{if(c.set(e),m.current!==e)return m.current=e,g(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>g(!1),220),()=>{o.current&&clearTimeout(o.current)}},[c,e]),u.useEffect(()=>y.on("change",h),[y]),b.jsx(R.span,{className:N("tabular-nums text-foreground",a),animate:{transform:f&&!d?"translateY(-1px) scale(1.015)":"translateY(0) scale(1)"},transition:{duration:.18,ease:[.23,1,.32,1]},children:T})}function D(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.round(e):0}function q(e){const n=D(e.cachedTokens),t=D(e.cacheCreationTokens),r=n>0,s=[r?`HIT · ${n.toLocaleString("id-ID")}`:"MISS"];return t>0&&s.push(`+${t.toLocaleString("id-ID")}`),{hit:r,readTokens:n,creationTokens:t,label:s.join(" "),title:r?`Cache hit: ${n.toLocaleString("id-ID")} tokens read${t>0?`; ${t.toLocaleString("id-ID")} tokens created`:""}`:t>0?`Cache miss: ${t.toLocaleString("id-ID")} tokens created`:"Cache miss: no cached tokens read"}}const C=new Set(["usage-stats","usage-history","usage-chart","usage-heatmap","usage-request-details","request-detail"]);function Q(){const e=U();u.useEffect(()=>{let n=!1,t=null,r=null,s=null,a=1e3;const c=()=>{s=null,!n&&e.invalidateQueries({predicate:i=>{const f=i.queryKey[0];return typeof f=="string"&&C.has(f)}})},d=()=>{s||(s=setTimeout(c,0))},m=()=>{n||r||(r=setTimeout(()=>{r=null,o()},a),a=Math.min(a*2,1e4))},o=()=>{if(n||t)return;const i=new EventSource("/api/usage/stream");t=i,i.onopen=()=>{n||t!==i||(a=1e3)},i.onmessage=()=>{n||t!==i||d()},i.onerror=()=>{t===i&&(i.close(),t=null,m())}};return o(),()=>{n=!0,r&&clearTimeout(r),s&&clearTimeout(s),r=null,s=null,t==null||t.close(),t=null}},[e])}const l=16500,E="USD",k=new Intl.NumberFormat("id-ID",{style:"currency",currency:"IDR",currencyDisplay:"symbol",minimumFractionDigits:0,maximumFractionDigits:0});function A(e){return e==="IDR"?"IDR":E}function L(e,n,t=l){const r=Number(e);if(!Number.isFinite(r))return 0;if(n==="USD")return Math.max(0,r);const s=Number(t);return Math.max(0,r)*(Number.isFinite(s)&&s>0?s:l)}function K(e,n,t=l){const r=L(e,n,t);return n==="USD"?`$${r>=1?r.toFixed(2):r.toFixed(4)}`:k.format(r)}async function G(){const{data:e}=await x.get("/settings/currency");return{currency:A(e.currency),usdToIdr:Number.isFinite(Number(e.usdToIdr))&&Number(e.usdToIdr)>0?Number(e.usdToIdr):l,rateUpdatedAt:typeof e.rateUpdatedAt=="string"?e.rateUpdatedAt:null,rateSource:e.rateSource||"fallback"}}export{l as F,j as S,L as a,G as b,K as f,q as g,A as n,Q as u};
@@ -1 +1 @@
1
- import{j as o}from"./react-vendor-xnYrwzsL.js";import{e as a,c as r}from"./index-CkR38iPY.js";function f({active:e,onToggle:t,disabled:n,className:i,activeLabel:s="Active",inactiveLabel:l="Inactive"}){return o.jsx(a,{label:e?"On":"Off",children:o.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":e?"On":"Off",disabled:n,onClick:t,className:r("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full p-0.5 touch-manipulation","transition-colors duration-150 ease-out outline-none","pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-6 pointer-coarse:after:min-w-6","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",e?"bg-primary":"bg-muted-foreground/30",n&&"cursor-not-allowed opacity-50",!n&&"cursor-pointer",i),children:o.jsx("span",{className:r("pointer-events-none block h-4 w-4 rounded-full bg-white","transition-transform duration-150 ease-out",e?"translate-x-4":"translate-x-0")})})})}export{f as F};
1
+ import{j as o}from"./react-vendor-xnYrwzsL.js";import{e as a,c as r}from"./index-B7c_Oeni.js";function f({active:e,onToggle:t,disabled:n,className:i,activeLabel:s="Active",inactiveLabel:l="Inactive"}){return o.jsx(a,{label:e?"On":"Off",children:o.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":e?"On":"Off",disabled:n,onClick:t,className:r("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full p-0.5 touch-manipulation","transition-colors duration-150 ease-out outline-none","pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-6 pointer-coarse:after:min-w-6","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",e?"bg-primary":"bg-muted-foreground/30",n&&"cursor-not-allowed opacity-50",!n&&"cursor-pointer",i),children:o.jsx("span",{className:r("pointer-events-none block h-4 w-4 rounded-full bg-white","transition-transform duration-150 ease-out",e?"translate-x-4":"translate-x-0")})})})}export{f as F};
@@ -1 +1 @@
1
- import{j as r}from"./react-vendor-xnYrwzsL.js";import{c as t}from"./index-CkR38iPY.js";function l({className:e,...a}){return r.jsx("div",{className:t("relative flex flex-col rounded-2xl bg-muted/72 p-1","*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-1",e),"data-slot":"frame",...a})}function m({className:e,...a}){return r.jsx("div",{className:t("relative rounded-xl border-x border-b border-border border-t-0 bg-background bg-clip-padding p-5",e),"data-slot":"frame-panel",...a})}function n({className:e,...a}){return r.jsx("header",{className:t("flex flex-col px-4 py-3 sm:px-5 sm:py-4",e),"data-slot":"frame-panel-header",...a})}function d({className:e,...a}){return r.jsx("div",{className:t("font-semibold text-sm",e),"data-slot":"frame-panel-title",...a})}function p({className:e,...a}){return r.jsx("footer",{className:t("px-4 py-3 sm:px-5 sm:py-4",e),"data-slot":"frame-panel-footer",...a})}export{l as F,n as a,d as b,m as c,p as d};
1
+ import{j as r}from"./react-vendor-xnYrwzsL.js";import{c as t}from"./index-B7c_Oeni.js";function l({className:e,...a}){return r.jsx("div",{className:t("relative flex flex-col rounded-2xl bg-muted/72 p-1","*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-1",e),"data-slot":"frame",...a})}function m({className:e,...a}){return r.jsx("div",{className:t("relative rounded-xl border-x border-b border-border border-t-0 bg-background bg-clip-padding p-5",e),"data-slot":"frame-panel",...a})}function n({className:e,...a}){return r.jsx("header",{className:t("flex flex-col px-4 py-3 sm:px-5 sm:py-4",e),"data-slot":"frame-panel-header",...a})}function d({className:e,...a}){return r.jsx("div",{className:t("font-semibold text-sm",e),"data-slot":"frame-panel-title",...a})}function p({className:e,...a}){return r.jsx("footer",{className:t("px-4 py-3 sm:px-5 sm:py-4",e),"data-slot":"frame-panel-footer",...a})}export{l as F,n as a,d as b,m as c,p as d};