omnigateway 0.12.12 → 0.12.13

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 (56) hide show
  1. package/README.md +1 -0
  2. package/bin/omni.js +378 -21
  3. package/gateway.js +346 -13
  4. package/package.json +1 -1
  5. package/public/assets/{Chip-D4qvhu1D.js → Chip-D0XSbQUr.js} +1 -1
  6. package/public/assets/{CopyValue-SnsT2LML.js → CopyValue-DAlmkISB.js} +3 -3
  7. package/public/assets/{Field-BYBri2NV.js → Field-DG1317zr.js} +1 -1
  8. package/public/assets/Lamp-Dk9XrTCg.js +26 -0
  9. package/public/assets/{Panel-CWmOTDAP.js → Panel-CsovmtxF.js} +23 -4
  10. package/public/assets/Rack-CDUOJkS2.js +483 -0
  11. package/public/assets/{Readout-BTh732hP.js → Readout-DlT5oxGO.js} +1 -1
  12. package/public/assets/RequestTable-i3TtCB9m.js +93 -0
  13. package/public/assets/{SummaryDeck-7ivuca39.js → SummaryDeck-DrzTQQo5.js} +2 -2
  14. package/public/assets/{Toggle-t82IhqEt.js → Toggle-CdMD58sy.js} +1 -1
  15. package/public/assets/{TokenBreakdown-D1Wtza1y.js → TokenBreakdown-BC6nqo1v.js} +1 -1
  16. package/public/assets/{WindowChart-BeGPsccS.js → WindowChart-Bqbl-KFO.js} +2 -2
  17. package/public/assets/_app-CSru2YTE.js +1 -0
  18. package/public/assets/_app.accounts-B2lQkMb0.js +70 -0
  19. package/public/assets/_app.console-a2TJDoBC.js +24 -0
  20. package/public/assets/_app.database-CqSoTi2l.js +24 -0
  21. package/public/assets/_app.index-BV1kJJjA.js +67 -0
  22. package/public/assets/_app.keys-Dq5O0AG9.js +92 -0
  23. package/public/assets/_app.logs-PjRK5wqy.js +46 -0
  24. package/public/assets/_app.models-BfmeeB5e.js +148 -0
  25. package/public/assets/_app.plugins._pluginId-Owb05aFv.js +20 -0
  26. package/public/assets/{_app.settings-C3GzeJ4q.js → _app.settings-5i-vvT-H.js} +7 -7
  27. package/public/assets/_app.usage--5qFtU1W.js +76 -0
  28. package/public/assets/chevron-down-Bb5ZGvwk.js +1 -0
  29. package/public/assets/chevron-right-hwF5mD6-.js +1 -0
  30. package/public/assets/{client-k1tkFSNH.js → client-BcXc3lek.js} +4 -4
  31. package/public/assets/{dist-D03q-60i.js → dist-BBGxva0Y.js} +1 -1
  32. package/public/assets/index-D1RDaq3l.js +14 -0
  33. package/public/assets/{login-DW2Ipp21.js → login-GB0ZGUvA.js} +4 -4
  34. package/public/assets/plus-BgcHxxIr.js +1 -0
  35. package/public/assets/{preload-helper-BPaHpbO_.js → preload-helper-B7KDmXJ9.js} +1 -1
  36. package/public/assets/rotate-ccw-Do43Argv.js +1 -0
  37. package/public/assets/{shared-Dtkw6SE0.js → shared-DDpLUhCp.js} +2 -2
  38. package/public/assets/{trash-D4QWzEK_.js → trash-00950_yY.js} +1 -1
  39. package/public/index.html +5 -5
  40. package/public/assets/Lamp-DkvXKB-B.js +0 -26
  41. package/public/assets/Rack-CEuCdVXc.js +0 -483
  42. package/public/assets/RequestTable-D8L6iVJV.js +0 -93
  43. package/public/assets/_app-Drf03PWk.js +0 -1
  44. package/public/assets/_app.accounts-W1USUo2Q.js +0 -70
  45. package/public/assets/_app.console-Co9d2ZiD.js +0 -44
  46. package/public/assets/_app.database-CtFJLcfE.js +0 -24
  47. package/public/assets/_app.index-DigYfob3.js +0 -67
  48. package/public/assets/_app.keys-B1fRMyU-.js +0 -92
  49. package/public/assets/_app.logs-CFixPsUw.js +0 -60
  50. package/public/assets/_app.models-Dpl1O2RE.js +0 -148
  51. package/public/assets/_app.plugins._pluginId-BK0ADugW.js +0 -20
  52. package/public/assets/_app.usage-D2qlcEp4.js +0 -76
  53. package/public/assets/chevron-down-Bs0tSOyA.js +0 -1
  54. package/public/assets/chevron-right-DSaI1kFo.js +0 -1
  55. package/public/assets/index-Bk9sabex.js +0 -14
  56. package/public/assets/plus-BCfjC6nk.js +0 -1
@@ -1,93 +0,0 @@
1
- import{A as e,Ct as t,L as n,M as r,Mt as i,N as a,P as o,f as s,j as c,mt as l,p as u,t as d,u as f,z as p}from"./Lamp-DkvXKB-B.js";import{C as m,D as h,O as g,_,b as v,v as y,w as b}from"./Panel-CWmOTDAP.js";import{A as x,_ as S,a as C,b as w,c as T,d as E,f as ee,g as D,h as O,l as k,m as A,o as j,p as te,s as ne,u as re,v as ie,y as ae}from"./Rack-CEuCdVXc.js";import{n as oe,r as se,t as ce}from"./TokenBreakdown-D1Wtza1y.js";import{t as le}from"./chevron-right-DSaI1kFo.js";import{t as ue}from"./dist-D03q-60i.js";import{n as de,t as fe}from"./Chip-D4qvhu1D.js";import{i as pe,n as me}from"./Field-BYBri2NV.js";import{i as he,n as M,r as N,t as ge}from"./Table-CVDZ69Zx.js";import*as P from"react";import{useEffect as _e,useLayoutEffect as ve,useRef as ye,useState as be}from"react";import{Fragment as xe,jsx as F,jsxs as I}from"react/jsx-runtime";import L from"styled-components";import*as Se from"react-dom";var Ce={name:`calendar-days`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M8 13h.01`,key:`1sbv64`}],[`path`,{d:`M12 13h.01`,key:`y0uutt`}],[`path`,{d:`M16 13h.01`,key:`wip0gl`}],[`path`,{d:`M8 17h.01`,key:`p3bg7i`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M16 17h.01`,key:`ql8jdd`}]]};Ce.node;var we=x(Ce),Te={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};Te.node;var Ee=x(Te),De=[`top`,`right`,`bottom`,`left`],R=Math.min,z=Math.max,Oe=Math.round,ke=Math.floor,B=e=>({x:e,y:e}),Ae={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function je(e,t,n){return z(e,R(t,n))}function V(e,t){return typeof e==`function`?e(t):e}function H(e){return e.split(`-`)[0]}function Me(e){return e.split(`-`)[1]}function Ne(e){return e===`x`?`y`:`x`}function Pe(e){return e===`y`?`height`:`width`}function U(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Fe(e){return Ne(U(e))}function Ie(e,t,n){n===void 0&&(n=!1);let r=Me(e),i=Fe(e),a=Pe(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Ge(o)),[o,Ge(o)]}function Le(e){let t=Ge(e);return[Re(e),t,Re(t)]}function Re(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var ze=[`left`,`right`],Be=[`right`,`left`],Ve=[`top`,`bottom`],He=[`bottom`,`top`];function Ue(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Be:ze:t?ze:Be;case`left`:case`right`:return t?Ve:He;default:return[]}}function We(e,t,n,r){let i=Me(e),a=Ue(H(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Re)))),a}function Ge(e){let t=H(e);return Ae[t]+e.slice(t.length)}function Ke(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function qe(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ke(e)}function Je(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Ye(e,t,n){let{reference:r,floating:i}=e,a=U(t),o=Fe(t),s=Pe(o),c=H(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Me(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Xe(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=V(t,e),p=qe(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Je(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Je(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Ze=50,Qe=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Xe},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Ye(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Ze&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Ye(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},$e=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=V(e,t)||{};if(l==null)return{};let d=qe(u),f={x:n,y:r},p=Fe(i),m=Pe(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=R(d[_],T),ee=R(d[v],T),D=C-h[m]-ee,O=C/2-h[m]/2+w,k=je(E,O,D),A=!c.arrow&&Me(i)!=null&&O!==k&&a.reference[m]/2-(O<E?E:ee)-h[m]/2<0,j=A?O<E?O-E:O-D:0;return{[p]:f[p]+j,data:{[p]:k,centerOffset:O-k-j,...A&&{alignmentOffset:j}},reset:A}}}),et=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=V(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=H(r),_=U(o),v=H(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ge(o)]:Le(o)),x=p!==`none`;!d&&x&&b.push(...We(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Ie(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===U(t)||T.every(e=>U(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=U(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function tt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function nt(e){return De.some(t=>e[t]>=0)}var rt=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=V(e,t);switch(i){case`referenceHidden`:{let e=tt(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:nt(e)}}}case`escaped`:{let e=tt(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:nt(e)}}}default:return{}}}}},it=new Set([`left`,`top`]);async function at(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=H(n),s=Me(n),c=U(n)===`y`,l=it.has(o)?-1:1,u=a&&c?-1:1,d=V(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var ot=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await at(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},st=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=V(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=U(i),p=Ne(f),m=u[p],h=u[f],g=(e,t)=>je(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},ct=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=V(e,t),u={x:n,y:r},d=U(i),f=Ne(d),p=u[f],m=u[d],h=V(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=it.has(H(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},lt=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=V(e,t),c=await i.detectOverflow(t,s),l=H(n),u=Me(n),d=U(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=R(p-c[m],g),y=R(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*z(c.left,c.right):S=p-2*z(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function ut(){return typeof window<`u`}function dt(e){return ft(e)?(e.nodeName||``).toLowerCase():`#document`}function W(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function G(e){return((ft(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ft(e){return ut()?e instanceof Node||e instanceof W(e).Node:!1}function K(e){return ut()?e instanceof Element||e instanceof W(e).Element:!1}function q(e){return ut()?e instanceof HTMLElement||e instanceof W(e).HTMLElement:!1}function pt(e){return!ut()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof W(e).ShadowRoot}function mt(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Y(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ht(e){return/^(table|td|th)$/.test(dt(e))}function gt(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var _t=/transform|translate|scale|rotate|perspective|filter/,vt=/paint|layout|strict|content/,J=e=>!!e&&e!==`none`,yt;function bt(e){let t=K(e)?Y(e):e;return J(t.transform)||J(t.translate)||J(t.scale)||J(t.rotate)||J(t.perspective)||!St()&&(J(t.backdropFilter)||J(t.filter))||_t.test(t.willChange||``)||vt.test(t.contain||``)}function xt(e){let t=Tt(e);for(;q(t)&&!Ct(t);){if(bt(t))return t;if(gt(t))return null;t=Tt(t)}return null}function St(){return yt??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),yt}function Ct(e){return/^(html|body|#document)$/.test(dt(e))}function Y(e){return W(e).getComputedStyle(e)}function wt(e){return K(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Tt(e){if(dt(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||pt(e)&&e.host||G(e);return pt(t)?t.host:t}function Et(e){let t=Tt(e);return Ct(t)?(e.ownerDocument||e).body:q(t)&&mt(t)?t:Et(t)}function Dt(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Et(e),i=r===e.ownerDocument?.body,a=W(r);if(i){let e=Ot(a);return t.concat(a,a.visualViewport||[],mt(r)?r:[],e&&n?Dt(e):[])}return t.concat(r,Dt(r,[],n))}function Ot(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function kt(e){let t=Y(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=q(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Oe(n)!==a||Oe(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function At(e){return K(e)?e:e.contextElement}function jt(e){let t=At(e);if(!q(t))return B(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=kt(t),o=(a?Oe(n.width):n.width)/r,s=(a?Oe(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Mt=B(0);function Nt(e){let t=W(e);return!St()||!t.visualViewport?Mt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Pt(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===W(e)}function Ft(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=At(e),o=B(1);t&&(r?K(r)&&(o=jt(r)):o=jt(e));let s=Pt(a,n,r)?Nt(a):B(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=W(a),t=K(r)?W(r):r,n=e,i=Ot(n);for(;i&&t!==n;){let e=jt(i),t=i.getBoundingClientRect(),r=Y(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=W(i),i=Ot(n)}}return Je({width:u,height:d,x:c,y:l})}function It(e,t){let n=wt(e).scrollLeft;return t?t.left+n:Ft(G(e)).left+n}function Lt(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-It(e,n),y:n.top+t.scrollTop}}function Rt(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=G(r),s=t?gt(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=B(1),u=B(0),d=q(r);if((d||!a)&&((dt(r)!==`body`||mt(o))&&(c=wt(r)),d)){let e=Ft(r);l=jt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Lt(o,c):B(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function zt(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Bt(e){let t=wt(e),n=e.ownerDocument.body,r=z(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=z(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+It(e),o=-t.scrollTop;return Y(n).direction===`rtl`&&(a+=z(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Vt=25;function Ht(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=W(e),a=G(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!St()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(It(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Vt&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ut(e,t){let n=Ft(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=jt(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Wt(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Ht(e,n,t);else if(t===`document`)r=Bt(G(e));else if(K(t))r=Ut(t,n);else{let n=Nt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Je(r)}function Gt(e,t){let n=t.get(e);if(n)return n;let r=Dt(e,[],!1).filter(e=>K(e)&&dt(e)!==`body`),i=null,a=Y(e).position===`fixed`,o=a?Tt(e):e;for(;K(o)&&!Ct(o);){let e=Y(o),t=bt(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Tt(o)}return t.set(e,r),r}function Kt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?gt(t)?[]:Gt(t,this._c):[].concat(n),r],o=Wt(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Wt(t,a[e],i);s=z(n.top,s),c=R(n.right,c),l=R(n.bottom,l),u=z(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function qt(e){let{width:t,height:n}=kt(e);return{width:t,height:n}}function Jt(e,t,n){let r=q(t),i=G(t),a=n===`fixed`,o=Ft(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=B(0);if((r||!a)&&((dt(t)!==`body`||mt(i))&&(s=wt(t)),r)){let e=Ft(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=It(i));let l=i&&!r&&!a?Lt(i,s):B(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function Yt(e){return Y(e).position===`static`}function Xt(e,t){if(!q(e)||Y(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return G(e)===n&&(n=n.ownerDocument.body),n}function Zt(e,t){let n=W(e);if(gt(e))return n;if(!q(e)){let t=Tt(e);for(;t&&!Ct(t);){if(K(t)&&!Yt(t))return t;t=Tt(t)}return n}let r=Xt(e,t);for(;r&&ht(r)&&Yt(r);)r=Xt(r,t);return r&&Ct(r)&&Yt(r)&&!bt(r)?n:r||xt(e)||n}var Qt=async function(e){let t=this.getOffsetParent||Zt,n=this.getDimensions,r=await n(e.floating);return{reference:Jt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $t(e){return Y(e).direction===`rtl`}var en={convertOffsetParentRelativeRectToViewportRelativeRect:Rt,getDocumentElement:G,getClippingRect:Kt,getOffsetParent:Zt,getElementRects:Qt,getClientRects:zt,getDimensions:qt,getScale:jt,isElement:K,isRTL:$t};function tn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function nn(e,t,n){let r=null,i,a=G(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=ke(d),h=ke(a.clientWidth-(u+f)),g=ke(a.clientHeight-(d+p)),_=ke(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:z(0,R(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!tn(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=W(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function rn(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=At(e),u=i||a?[...l?Dt(l):[],...t?Dt(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?nn(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Ft(e):null;c&&g();function g(){let t=Ft(e);h&&!tn(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var an=ot,on=st,sn=et,cn=lt,ln=rt,un=$e,dn=ct,fn=(e,t,n)=>{let r=new Map,i=n??{},a={...en,...i.platform,_c:r};return Qe(e,t,{...i,platform:a})},pn=typeof document<`u`?ve:function(){};function mn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!mn(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!mn(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function hn(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function gn(e,t){let n=hn(e);return Math.round(t*n)/n}function _n(e){let t=P.useRef(e);return pn(()=>{t.current=e}),t}function vn(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=P.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=P.useState(r);mn(f,r)||p(r);let[m,h]=P.useState(null),[g,_]=P.useState(null),v=P.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=P.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=P.useRef(null),C=P.useRef(null),w=P.useRef(u),T=c!=null,E=_n(c),ee=_n(i),D=_n(l),O=P.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};ee.current&&(e.platform=ee.current),fn(S.current,C.current,e).then(e=>{let t={...e,isPositioned:D.current!==!1};k.current&&!mn(w.current,t)&&(w.current=t,Se.flushSync(()=>{d(t)}))})},[f,t,n,ee,D]);pn(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let k=P.useRef(!1);pn(()=>(k.current=!0,()=>{k.current=!1}),[]),pn(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,O);O()}},[b,x,O,E,T]);let A=P.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),j=P.useMemo(()=>({reference:b,floating:x}),[b,x]),te=P.useMemo(()=>{let e={position:n,left:0,top:0};if(!j.floating)return e;let t=gn(j.floating,u.x),r=gn(j.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...hn(j.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,j.floating,u.x,u.y]);return P.useMemo(()=>({...u,update:O,refs:A,elements:j,floatingStyles:te}),[u,O,A,j,te])}var yn=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:un({element:r.current,padding:i}).fn(n):r?un({element:r,padding:i}).fn(n):{}}}},bn=(e,t)=>{let n=an(e);return{name:n.name,fn:n.fn,options:[e,t]}},xn=(e,t)=>{let n=on(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sn=(e,t)=>({fn:dn(e).fn,options:[e,t]}),Cn=(e,t)=>{let n=sn(e);return{name:n.name,fn:n.fn,options:[e,t]}},wn=(e,t)=>{let n=cn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tn=(e,t)=>{let n=ln(e);return{name:n.name,fn:n.fn,options:[e,t]}},En=(e,t)=>{let n=yn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dn=Object.defineProperty,X=(e,t)=>Dn(e,`name`,{value:t,configurable:!0}),On=`Popper`,[kn,An]=S(On),[jn,Mn]=kn(On),Nn=X(e=>{let{__scopePopper:t,children:n}=e,[r,i]=P.useState(null),[a,o]=P.useState(void 0);return F(jn,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),Pn=`PopperAnchor`,Fn=P.forwardRef(X(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=Mn(Pn,n),o=P.useRef(null),s=a.onAnchorChange,c=P.useCallback(e=>{o.current=e,e&&s(e)},[s]),l=w(t,c),u=P.useRef(null);P.useEffect(()=>{if(!r)return;let e=u.current;u.current=r.current,e!==u.current&&s(u.current)});let d=a.placementState&&Hn(a.placementState),f=d?.[0],p=d?.[1];return r?null:F(ie.div,{"data-radix-popper-side":f,"data-radix-popper-align":p,...i,ref:l})},`PopperAnchor`)),In=`PopperContent`,[Ln,Rn]=kn(In),zn=P.forwardRef(X(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=Mn(In,n),[_,v]=P.useState(null),y=w(t,v),[b,x]=P.useState(null),S=ue(b),C=S?.width??0,T=S?.height??0,ee=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},k=Array.isArray(l)?l:[l],A=k.length>0,j={padding:D,boundary:k.filter(Bn),altBoundary:A},{refs:te,floatingStyles:ne,placement:re,isPositioned:ae,middlewareData:oe}=vn({strategy:`fixed`,placement:ee,whileElementsMounted:X((...e)=>rn(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[bn({mainAxis:i+T,alignmentAxis:o}),c&&xn({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Sn():void 0,...j}),c&&Cn({...j}),wn({...j,apply:X(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),b&&En({element:b,padding:s}),Vn({arrowWidth:C,arrowHeight:T}),f&&Tn({strategy:`referenceHidden`,...j,boundary:A?j.boundary:void 0})]}),se=g.setPlacementState;O(()=>(se(re),()=>{se(void 0)}),[re,se]);let[ce,le]=Hn(re),de=E(m);O(()=>{ae&&de?.()},[ae,de]);let fe=oe.arrow?.x,pe=oe.arrow?.y,me=oe.arrow?.centerOffset!==0,[he,M]=P.useState();return O(()=>{_&&M(window.getComputedStyle(_).zIndex)},[_]),F(`div`,{ref:te.setFloating,"data-radix-popper-content-wrapper":``,style:{...ne,transform:ae?ne.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:he,"--radix-popper-transform-origin":[oe.transformOrigin?.x,oe.transformOrigin?.y].join(` `),...oe.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:F(Ln,{scope:n,placedSide:ce,placedAlign:le,onArrowChange:x,arrowX:fe,arrowY:pe,shouldHideArrow:me,children:F(ie.div,{"data-side":ce,"data-align":le,...h,ref:y,style:{...h.style,animation:ae?h.style?.animation:`none`}})})})},`PopperContent`));function Bn(e){return e!==null}X(Bn,`isNotNull`);var Vn=X(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Hn(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function Hn(e){let[t,n=`center`]=e.split(`-`);return[t,n]}X(Hn,`getSideAndAlignFromPlacement`);var Un=Nn,Wn=Fn,Gn=zn,Kn=Object.defineProperty,Z=(e,t)=>Kn(e,`name`,{value:t,configurable:!0}),qn=`Popover`,[Jn,Yn]=S(qn,[An]),Xn=An(),[Zn,Qn]=Jn(qn),$n=Z(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Xn(t),c=P.useRef(null),[l,u]=P.useState(!1),[d,f]=A({prop:r,defaultProp:i??!1,onChange:a,caller:qn});return F(Un,{...s,children:F(Zn,{scope:t,contentId:ee(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:P.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:P.useCallback(()=>u(!0),[]),onCustomAnchorRemove:P.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),er=`PopoverTrigger`,tr=P.forwardRef(Z(function(e,t){let{__scopePopover:n,...r}=e,i=Qn(er,n),a=Xn(n),o=w(t,i.triggerRef),s=F(ie.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":fr(i.open),...r,ref:o,onClick:D(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:F(Wn,{asChild:!0,...a,children:s})},`PopoverTrigger`)),nr=`PopoverPortal`,[rr,ir]=Jn(nr,{forceMount:void 0}),ar=Z(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Qn(nr,t);return F(rr,{scope:t,forceMount:n,children:F(te,{present:n||a.open,children:F(T,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),or=`PopoverContent`,sr=P.forwardRef(Z(function(e,t){let n=ir(or,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Qn(or,e.__scopePopover);return F(te,{present:r||a.open,children:a.modal?F(lr,{...i,ref:t}):F(ur,{...i,ref:t})})},`PopoverContent`)),cr=ae(`PopoverContent.RemoveScroll`),lr=P.forwardRef(Z(function(e,t){let n=Qn(or,e.__scopePopover),r=P.useRef(null),i=w(t,r),a=P.useRef(!1);return P.useEffect(()=>{let e=r.current;if(e)return C(e)},[]),F(j,{as:cr,allowPinchZoom:!0,children:F(dr,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:D(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:D(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:D(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),ur=P.forwardRef(Z(function(e,t){let n=Qn(or,e.__scopePopover),r=P.useRef(!1),i=P.useRef(!1);return F(dr,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),dr=P.forwardRef(Z(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Qn(or,n),p=Xn(n);return ne(),F(k,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:F(re,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:F(Gn,{"data-state":fr(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})},`PopoverContentImpl`));function fr(e){return e?`open`:`closed`}Z(fr,`getState`);var pr=$n,mr=tr,hr=ar,gr=sr,_r={},Q=e=>String(e).padStart(2,`0`),vr=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],yr=e=>{let t=new Date(e);return`${t.getFullYear()}-${Q(t.getMonth()+1)}-${Q(t.getDate())}`},br=(e,t,n)=>`${e}-${Q(t+1)}-${Q(n)}`,xr=e=>{let t=new Date(e);return`${Q(t.getHours())}:${Q(t.getMinutes())}`};function Sr(e,t,n){let r=Date.parse(`${e}T${t}`);if(!Number.isNaN(r))return n===`end`?r+59999:r}function Cr(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t+1,0).getDate();return{lead:n,days:Array.from({length:r},(e,t)=>t+1)}}function wr(e,t){return t<e?{from:t,to:e}:{from:e,to:t}}var Tr=(e,t,n)=>t!==void 0&&n!==void 0&&e>=t&&e<=n;function Er(e,t){let n=new Date(t);n.setDate(n.getDate()-(e-1)),n.setHours(0,0,0,0);let r=new Date(t);return r.setHours(23,59,59,999),{since:n.getTime(),until:r.getTime()}}var Dr=e=>{let t=new Date(e);return`${vr[t.getMonth()]??``} ${t.getDate()} ${Q(t.getHours())}:${Q(t.getMinutes())}`};function Or(e,t){return e!==void 0&&t!==void 0?`${Dr(e)} - ${Dr(t)}`:e===void 0?t===void 0?`Any time`:`Until ${Dr(t)}`:`From ${Dr(e)}`}var kr=L(mr)`
2
- display: flex;
3
- align-items: center;
4
- gap: ${({theme:e})=>e.space(2)};
5
- height: 30px;
6
- min-width: 230px;
7
- padding: 0 8px;
8
- border-radius: ${({theme:e})=>e.radius.control};
9
- background: ${({theme:e})=>e.color.panelSunk};
10
- border: 1px solid ${({theme:e})=>e.color.ruleStrong};
11
- color: ${({theme:e})=>e.color.ink};
12
- font-family: ${({theme:e})=>e.font.mono};
13
- font-size: 12px;
14
- cursor: pointer;
15
- transition: border-color 120ms ease;
16
-
17
- &:hover,
18
- &[data-state="open"] {
19
- border-color: ${({theme:e})=>e.color.accent};
20
- }
21
-
22
- svg {
23
- width: 13px;
24
- height: 13px;
25
- flex: none;
26
- color: ${({theme:e})=>e.color.inkFaint};
27
- }
28
- `,Ar=L(gr)`
29
- z-index: ${({theme:e})=>e.z.dialog};
30
- width: 252px;
31
- padding: ${({theme:e})=>e.space(2)};
32
- background: ${({theme:e})=>e.color.panel};
33
- border: 1px solid ${({theme:e})=>e.color.ruleStrong};
34
- border-radius: ${({theme:e})=>e.radius.panel};
35
- box-shadow: 0 12px 40px oklch(0 0 0 / 0.35);
36
- `,jr=L(v)`
37
- justify-content: space-between;
38
- margin-bottom: ${({theme:e})=>e.space(2)};
39
- `,Mr=L.div`
40
- display: grid;
41
- grid-template-columns: repeat(7, 1fr);
42
- gap: 1px;
43
- `,Nr=L.span`
44
- height: 20px;
45
- display: grid;
46
- place-items: center;
47
- font-size: 10px;
48
- color: ${({theme:e})=>e.color.inkFaint};
49
- font-family: ${({theme:e})=>e.font.sans};
50
- `,Pr=L.button`
51
- height: 26px;
52
- ${({$start:e})=>e===void 0?``:`grid-column-start: ${e};`}
53
- border: 0;
54
- border-radius: ${({theme:e})=>e.radius.chip};
55
- font-family: ${({theme:e})=>e.font.mono};
56
- font-size: 11px;
57
- cursor: pointer;
58
- background: ${({theme:e,$in:t,$edge:n})=>n?e.color.accent:t?e.color.accentWash:`transparent`};
59
- color: ${({theme:e,$edge:t})=>t?e.color.accentInk:e.color.ink};
60
-
61
- &:hover {
62
- background: ${({theme:e,$edge:t})=>t?e.color.accent:e.color.panelRaised};
63
- }
64
- `,Fr=L(v)`
65
- gap: ${({theme:e})=>e.space(1)};
66
- margin-top: ${({theme:e})=>e.space(2)};
67
- padding-top: ${({theme:e})=>e.space(2)};
68
- border-top: 1px solid ${({theme:e})=>e.color.rule};
69
- `,Ir=L(me).attrs({type:`time`})`
70
- width: auto;
71
- flex: 1;
72
- `,Lr=L(v)`
73
- gap: ${({theme:e})=>e.space(1)};
74
- margin-top: ${({theme:e})=>e.space(2)};
75
- `,Rr=[`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`,`Su`],zr=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Br=[{label:`Today`,days:1},{label:`7d`,days:7},{label:`30d`,days:30}];function Vr({since:e,until:t,onChange:n}){let[r,i]=be(!1),[a,o]=be(()=>new Date(e??Date.now())),[s,c]=be(null),l=e===void 0?void 0:yr(e),u=t===void 0?void 0:yr(t),d=e===void 0?`00:00`:xr(e),f=t===void 0?`23:59`:xr(t),p=(e,t)=>n({since:Sr(e,d,`start`),until:Sr(t,f,`end`)}),m=e=>{if(s===null){c(e),p(e,e);return}let{from:t,to:n}=wr(s,e);c(null),p(t,n)},v=e=>o(t=>new Date(t.getFullYear(),t.getMonth()+e,1)),y=a.getFullYear(),b=a.getMonth(),{lead:x,days:S}=Cr(y,b);return I(pr,{open:r,onOpenChange:t=>{i(t),t&&(o(new Date(e??Date.now())),c(null))},children:[I(kr,{"aria-label":`Time range`,children:[F(we,{}),Or(e,t)]}),F(hr,{children:I(Ar,{align:`start`,sideOffset:4,children:[I(jr,{children:[F(g,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Previous month`,onClick:()=>v(-1),children:F(Ee,{})}),F(_,{children:`${zr[b]??``} ${y}`}),F(g,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Next month`,onClick:()=>v(1),children:F(le,{})})]}),I(Mr,{children:[Rr.map(e=>F(Nr,{children:e},e)),S.map((e,t)=>{let n=br(y,b,e);return F(Pr,{type:`button`,...t===0?{$start:x+1}:{},$in:Tr(n,l,u),$edge:n===l||n===u,onClick:()=>m(n),children:e},n)})]}),I(Fr,{children:[F(Ir,{"aria-label":`From time`,value:d,onChange:e=>n({since:Sr(l??yr(Date.now()),e.target.value,`start`),until:t})}),F(Ir,{"aria-label":`To time`,value:f,onChange:t=>n({since:e,until:Sr(u??yr(Date.now()),t.target.value,`end`)})})]}),F(Lr,{children:Br.map(e=>F(h,{type:`button`,$size:`sm`,onClick:()=>{c(null),n(Er(e.days,Date.now())),i(!1)},children:e.label},e.label))})]})})]})}var Hr=L(v)`
76
- gap: ${({theme:e})=>e.space(2)};
77
- flex-wrap: wrap;
78
- `,Ur=L(pe)`
79
- width: auto;
80
- `,Wr=L(me)`
81
- flex: 1;
82
- min-width: 260px;
83
- `,Gr=[{id:`all`,label:`All requests`,filters:{}},{id:`failed`,label:`Failed only`,filters:{failed:`true`}},{id:`pending`,label:`Still running`,filters:{state:`pending`}},{id:`done`,label:`Completed`,filters:{state:`done`}}],Kr=e=>e.failed===`true`?`failed`:e.state??`all`,qr=[{prefix:`model`,field:`model`},{prefix:`resolved`,field:`resolvedModel`},{prefix:`requested`,field:`requestedModel`},{prefix:`error`,field:`errorCode`}],Jr=[`model`,`resolvedModel`,`requestedModel`,`errorCode`];function Yr(e){let t={};for(let n of e.trim().split(/\s+/)){if(n===``)continue;let e=n.indexOf(`:`),r=e===-1?void 0:qr.find(t=>t.prefix===n.slice(0,e).toLowerCase());if(r===void 0){t.model=n;continue}let i=n.slice(e+1);i!==``&&(t[r.field]=i)}return t}function Xr(e){let t=[];return e.model!==void 0&&t.push(e.model),e.resolvedModel!==void 0&&t.push(`resolved:${e.resolvedModel}`),e.requestedModel!==void 0&&t.push(`requested:${e.requestedModel}`),e.errorCode!==void 0&&t.push(`error:${e.errorCode}`),t.join(` `)}var Zr=(e,t)=>Jr.every(n=>e[n]===t[n]),Qr=Object.fromEntries(Jr.map(e=>[e,void 0]));function $r({filters:e,patch:n}){let r=l(),a=t(),o=i();return I(xe,{children:[I(Ur,{"aria-label":`Provider`,value:e.provider??``,onChange:e=>n({provider:e.target.value||void 0}),children:[F(`option`,{value:``,children:`Any provider`}),(o.data??[]).map(e=>F(`option`,{value:e.id,children:e.label},e.id))]}),I(Ur,{"aria-label":`Account`,value:e.credentialId??``,onChange:e=>n({credentialId:e.target.value||void 0}),children:[F(`option`,{value:``,children:`Any account`}),(r.data??[]).map(e=>F(`option`,{value:e.id,children:e.label},e.id))]}),I(Ur,{"aria-label":`Gateway key`,value:e.apiKeyId??``,onChange:e=>n({apiKeyId:e.target.value||void 0}),children:[F(`option`,{value:``,children:`Any key`}),(a.data??[]).map(e=>F(`option`,{value:e.id,children:e.label},e.id))]})]})}function ei(e,t){let n={...e,...t};for(let e of Object.keys(n))n[e]===void 0&&delete n[e];return n}function ti({filters:e,onChange:t,operator:n=!1}){let r=n=>t(ei(e,n)),[i,a]=be(()=>Xr(e)),o=ye(null),s=ye(r);s.current=r;let c=()=>{o.current!==null&&clearTimeout(o.current),o.current=null};_e(()=>()=>clearTimeout(o.current??void 0),[]);let l=Xr(e);return o.current===null&&!Zr(Yr(i),e)&&i!==l&&a(l),I(Hr,{children:[F(Wr,{"aria-label":`Models and error codes`,placeholder:`Search anything`,value:i,onChange:e=>{let t=e.target.value;a(t),c(),o.current=setTimeout(()=>{o.current=null,s.current({...Qr,...Yr(t)})},500)}}),F(Vr,{since:e.since,until:e.until,onChange:e=>r(e)}),F(Ur,{"aria-label":`Show which requests`,value:Kr(e),onChange:e=>{let t=Gr.find(t=>t.id===e.target.value)??Gr[0];r({state:void 0,failed:void 0,...t.filters})},children:Gr.map(e=>F(`option`,{value:e.id,children:e.label},e.id))}),n?F($r,{filters:e,patch:r}):null,F(h,{type:`button`,onClick:()=>{c(),a(``),t({})},children:`Clear filters`})]})}function ni(e){let[t,n]=be(Date.now);return _e(()=>{if(!e)return;n(Date.now());let t=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(t)},[e]),t}function ri({log:e}){return F(M,{$align:`right`,$mono:!0,...f(e)?{"aria-label":`processing`}:{title:se(e)},children:f(e)?F(ce,{}):F(oe,{tokens:e})})}function ii({rows:t,now:i,names:c,onOpen:l}){return I(ge,{children:[F(`thead`,{children:I(`tr`,{children:[F(N,{}),F(N,{$align:`right`,children:`Time`}),F(N,{children:`Requested`}),F(N,{children:`Routed to`}),c===void 0?null:I(xe,{children:[F(N,{children:`Account`}),F(N,{children:`Key`})]}),F(N,{$align:`right`,children:`Try`}),F(N,{$align:`right`,children:`TTFT`}),F(N,{$align:`right`,children:`Total`}),F(N,{$align:`right`,children:`Tokens`}),F(N,{$align:`right`,children:`Cost`}),F(N,{children:`Outcome`})]})}),F(`tbody`,{children:t.map(t=>I(he,{$selectable:!0,onClick:()=>l(t),children:[F(M,{children:F(d,{state:u(t),label:s(t)})}),F(M,{$align:`right`,$mono:!0,title:r(t.at),children:e(t.at)}),F(M,{$mono:!0,children:F(b,{style:{display:`block`,maxWidth:`20ch`},children:t.requestedModel||`—`})}),F(M,{children:t.resolvedProvider===null?F(_,{children:f(t)?`routing…`:`not routed`}):I(v,{$gap:1,children:[F(de,{provider:t.resolvedProvider}),F(y,{$dim:!0,children:t.resolvedModel??`—`})]})}),c===void 0?null:I(xe,{children:[F(M,{children:F(b,{style:{display:`block`,maxWidth:`18ch`},children:t.credentialId==null?`—`:c.accounts.get(t.credentialId)??p(t.credentialId)})}),F(M,{children:F(b,{style:{display:`block`,maxWidth:`16ch`},title:t.apiKeyId??void 0,children:t.apiKeyId==null?`—`:c.keys.get(t.apiKeyId)??p(t.apiKeyId)})})]}),F(M,{$align:`right`,$mono:!0,children:f(t)?`—`:t.attempts}),F(M,{$align:`right`,$mono:!0,children:f(t)?`—`:o(t.ttftMs)}),F(M,{$align:`right`,$mono:!0,children:f(t)?a(Math.max(0,i-t.at)):o(t.durationMs)}),F(ri,{log:t}),F(M,{$align:`right`,$mono:!0,children:f(t)?`—`:n(t.costUsd)}),F(M,{children:f(t)?F(fe,{$tone:`accent`,children:`live`}):t.errorCode===null?F(fe,{$tone:`ok`,children:t.status}):F(fe,{$tone:`down`,children:t.errorCode})})]},t.id))})]})}var ai=L.dl`
84
- display: grid;
85
- grid-template-columns: minmax(120px, auto) minmax(0, 1fr);
86
- gap: 6px ${({theme:e})=>e.space(3)};
87
- margin: 0;
88
- font-size: 12.5px;
89
- `,$=L.dd`
90
- margin: 0;
91
- font-family: ${({theme:e})=>e.font.mono};
92
- word-break: break-all;
93
- `;function oi({log:e,names:t,children:i}){return I(m,{$gap:3,children:[I(ai,{children:[F(_,{as:`dt`,children:`Request id`}),F($,{children:e.id}),F(_,{as:`dt`,children:`At`}),F($,{children:r(e.at)}),F(_,{as:`dt`,children:`Requested model`}),F($,{children:e.requestedModel||`—`}),F(_,{as:`dt`,children:`Routed to`}),F($,{children:f(e)?`—`:e.resolvedProvider===null?`not routed`:`${e.resolvedProvider} · ${e.resolvedModel??`—`}`}),t===void 0?null:I(xe,{children:[F(_,{as:`dt`,children:`Account`}),F($,{children:e.credentialId==null?`—`:t.accounts.get(e.credentialId)??e.credentialId}),F(_,{as:`dt`,children:`Key`}),F($,{children:e.apiKeyId==null?`—`:t.keys.get(e.apiKeyId)??e.apiKeyId})]}),F(_,{as:`dt`,children:`Attempts`}),F($,{children:f(e)?`—`:e.attempts}),F(_,{as:`dt`,children:`Status`}),F($,{children:f(e)?`in flight`:e.errorCode===null?e.status:`${e.status} ${e.errorCode}`}),F(_,{as:`dt`,children:`Timing`}),F($,{children:f(e)?`—`:`first token ${o(e.ttftMs)} · total ${o(e.durationMs)}`}),F(_,{as:`dt`,children:`Tokens`}),F($,{children:f(e)?`—`:I(xe,{children:[c(e.inputTokens),` in · `,c(e.outputTokens),` out ·`,` `,c(e.cacheReadTokens),` cache read · `,c(e.cacheWriteTokens),` `,`cache write`]})}),F(_,{as:`dt`,children:`Cost`}),F($,{children:f(e)?`—`:n(e.costUsd)}),F(_,{as:`dt`,children:`RTK compression`}),F($,{children:f(e)?`—`:e.rtkApplied?e.rtkFilterHits===void 0?`~${c(e.rtkEstimatedTokensSaved)} tokens saved`:`${c(e.rtkFilterHits)} hits · ${c(e.rtkOriginalCodeUnits??0)} → ${c(e.rtkCompressedCodeUnits??0)} code units · ~${c(e.rtkEstimatedTokensSaved)} tokens saved`:`not applied`}),e.rtkFilters===void 0?null:I(xe,{children:[F(_,{as:`dt`,children:`RTK filters`}),F($,{children:e.rtkFilters.length===0?`—`:e.rtkFilters.join(`, `)})]})]}),e.degradations.length===0?null:I(m,{$gap:1,children:[F(_,{children:`Capabilities dropped to fit the target`}),F(v,{$gap:1,$wrap:!0,children:e.degradations.map(e=>F(fe,{$tone:`warn`,children:e},e))})]}),i]})}export{_r as a,ti as i,ii as n,ni as r,oi as t};
@@ -1 +0,0 @@
1
- import{i as e,k as t,t as n}from"./Panel-CWmOTDAP.js";import{jsx as r}from"react/jsx-runtime";function i({error:i}){let a=t();return r(n,{legend:`Console unavailable`,children:r(e,{legend:`The gateway did not answer`,error:i,onRetry:()=>void a.invalidate()})})}export{i as errorComponent};
@@ -1,70 +0,0 @@
1
- import{F as e,G as t,I as n,Kt as r,Mt as i,Nt as a,Pt as o,Qt as s,St as c,T as l,U as u,_t as d,b as f,c as p,ct as ee,d as m,h,j as g,kt as _,mt as v,n as te,o as y,pt as b,s as x,st as ne,t as re,ut as S,v as C,y as w}from"./Lamp-DkvXKB-B.js";import{C as T,D as E,O as D,_ as O,a as ie,b as k,i as A,o as j,r as ae,t as M,v as N,x as P}from"./Panel-CWmOTDAP.js";import{A as F,D as I,i as oe,r as L,t as R,w as z}from"./Rack-CEuCdVXc.js";import{t as B}from"./CopyValue-SnsT2LML.js";import{t as se}from"./chevron-down-Bs0tSOyA.js";import{t as ce}from"./chevron-right-DSaI1kFo.js";import{t as le}from"./plus-BCfjC6nk.js";import{t as ue}from"./trash-D4QWzEK_.js";import{t as de}from"./Toggle-t82IhqEt.js";import{t as fe}from"./Chip-D4qvhu1D.js";import{i as V,n as H,r as pe,t as U}from"./Field-BYBri2NV.js";import{t as me}from"./Meter-stpt3vQu.js";import{i as he,n as W,r as G,t as ge}from"./Table-CVDZ69Zx.js";import{n as K,r as _e,t as ve}from"./WindowChart-BeGPsccS.js";import{Fragment as ye,useCallback as be,useEffect as q,useState as J}from"react";import{Fragment as Y,jsx as X,jsxs as Z}from"react/jsx-runtime";import Q from"styled-components";var xe={name:`external-link`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]};xe.node;var Se=F(xe),Ce={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};Ce.node;var we=F(Ce);function $(e){return e?.authTypes??[]}function Te(e){return $(e).includes(`oauth`)?`oauth`:`apiKey`}function Ee(e){return e[0]?.id??`anthropic`}var De={oauth:`Authorize in the browser`,apiKey:`Paste an API key`};function Oe(e){let t=e?.callback;return t===void 0?`code#state`:`${t.uri}?code=…`}var ke=Q.ol`
2
- display: flex;
3
- flex-direction: column;
4
- gap: ${({theme:e})=>e.space(3)};
5
- `,Ae=Q.div`
6
- font-family: ${({theme:e})=>e.font.mono};
7
- font-size: 26px;
8
- letter-spacing: 0.22em;
9
- text-align: center;
10
- padding: ${({theme:e})=>e.space(3)};
11
- background: ${({theme:e})=>e.color.panelSunk};
12
- border: 1px solid ${({theme:e})=>e.color.ruleStrong};
13
- border-radius: ${({theme:e})=>e.radius.control};
14
- `,je=Q.p`
15
- font-size: 12px;
16
- color: ${({theme:e})=>e.color.down};
17
- `,Me=Q.p`
18
- font-size: 12px;
19
- color: ${({theme:e})=>e.color.inkDim};
20
- `;function Ne({open:e,credentials:n,onOpenChange:r,onConnected:a}){let o=i().data??[],[s,c]=J(()=>Ee(o)),l=u(o,s),[d,f]=J(()=>Te(u(o,Ee(o)))),[p,m]=J(``),h=l?.label??s,[g,_]=J(null),[v,te]=J(``),[y,b]=J(``),x=(n??[]).filter((e,t,n)=>e.provider===`custom`&&n.findIndex(t=>t.provider===`custom`&&t.providerData.endpointId===e.providerData.endpointId)===t),[re,C]=J(``),[w,D]=J(``),[ie,A]=J(`chat_completions`),[ae,M]=J(``),[N,P]=J(null),F=ee(),I=ne(),L=S(),R=be(()=>{_(null),te(``),b(``),C(``),D(``),A(`chat_completions`),M(``),P(null),m(``),F.reset(),I.reset(),L.reset()},[F,I,L]),z=be(e=>{e||R(),r(e)},[r,R]);return q(()=>{if(g===null||g.kind!==`device`)return;let e=!1,n=async()=>{try{let n=await t(g.flowId);if(e)return;if(n.status===`complete`){R(),r(!1),a();return}}catch(t){if(e)return;P(j(t)),_(null);return}e||(i=setTimeout(()=>void n(),g.pollIntervalMs))},i=setTimeout(()=>void n(),g.pollIntervalMs);return()=>{e=!0,clearTimeout(i)}},[g,a,r,R]),X(oe,{open:e,onOpenChange:z,title:`Connect an account`,description:`The gateway stores the resulting token encrypted. It is never shown again after this dialog.`,footer:g===null?Z(Y,{children:[X(E,{type:`button`,onClick:()=>z(!1),children:`Cancel`}),X(E,{type:`button`,$variant:`primary`,disabled:F.isPending||L.isPending,onClick:()=>{if(P(null),d===`apiKey`){L.mutate({provider:s,apiKey:ae,label:p.trim()||void 0,...s===`custom`?{endpointId:y,endpointLabel:re,origin:w,protocol:ie}:{}},{onSuccess:()=>{R(),r(!1),a()},onError:e=>P(j(e))});return}F.mutate({provider:s,label:p.trim().length===0?h:p.trim()},{onSuccess:e=>_(e),onError:e=>P(j(e))})},children:d===`apiKey`?L.isPending?`Adding…`:`Add API key`:F.isPending?`Starting…`:`Start authorization`})]}):g.kind===`device`?X(E,{type:`button`,onClick:()=>z(!1),children:`Cancel`}):Z(Y,{children:[X(E,{type:`button`,onClick:()=>z(!1),children:`Cancel`}),X(E,{type:`button`,$variant:`primary`,disabled:I.isPending||v.trim().length===0,onClick:()=>{g!==null&&(P(null),I.mutate({flowId:g.flowId,code:v.trim()},{onSuccess:()=>{R(),r(!1),a()},onError:e=>P(j(e))}))},children:I.isPending?`Finishing…`:`Finish connecting`})]}),children:Z(ke,{children:[g===null?Z(T,{$gap:3,children:[X(U,{label:`Provider`,children:e=>X(V,{...e,value:s,onChange:e=>{let t=e.target.value;c(t),f(Te(u(o,t)))},children:o.map(e=>X(`option`,{value:e.id,children:e.label},e.id))})}),$(l).length>1?X(U,{label:`How to connect`,children:e=>X(V,{...e,value:d,onChange:e=>f(e.target.value),children:$(l).map(e=>X(`option`,{value:e,children:De[e]},e))})}):null,s===`custom`?Z(Y,{children:[x.length===0?null:X(U,{label:`Existing endpoint`,children:e=>Z(V,{...e,value:y,onChange:e=>{let t=x.find(t=>t.providerData.endpointId===e.target.value);if(t===void 0){b(``),C(``),D(``),A(`chat_completions`);return}b(String(t.providerData.endpointId)),C(String(t.providerData.endpointLabel)),D(String(t.providerData.origin)+String(t.providerData.basePath??``)),A(t.providerData.protocol===`responses`?`responses`:`chat_completions`)},children:[X(`option`,{value:``,children:`Create new endpoint`}),x.map(e=>X(`option`,{value:String(e.providerData.endpointId),children:String(e.providerData.endpointLabel)},String(e.providerData.endpointId)))]})}),X(U,{label:`Endpoint ID`,children:e=>X(H,{...e,value:y,onChange:e=>b(e.target.value)})}),X(U,{label:`Endpoint label`,children:e=>X(H,{...e,value:re,onChange:e=>C(e.target.value)})}),X(U,{label:`Server URL`,children:e=>X(H,{...e,value:w,placeholder:`https://server.example/api`,onChange:e=>D(e.target.value)})}),w.trim().toLowerCase().startsWith(`http://`)?X(je,{children:`Plaintext transport sends prompts and API keys without TLS.`}):null,X(U,{label:`Protocol`,children:e=>Z(V,{...e,value:ie,onChange:e=>A(e.target.value),children:[X(`option`,{value:`chat_completions`,children:`Chat Completions (/v1/chat/completions)`}),X(`option`,{value:`responses`,children:`Responses (/v1/responses)`})]})})]}):null,d===`apiKey`?X(U,{label:`API key`,children:e=>X(H,{...e,type:`password`,value:ae,autoComplete:`off`,onChange:e=>M(e.target.value)})}):null,X(U,{label:`Label`,hint:`How this account is named in the rack. Defaults to the provider.`,children:e=>X(H,{...e,value:p,placeholder:h,onChange:e=>m(e.target.value)})})]}):Z(T,{$gap:3,children:[Z(T,{$gap:1,children:[X(O,{children:`Step 1 — authorize`}),X(k,{$gap:2,children:Z(E,{as:`a`,href:g.authorizeUrl,target:`_blank`,rel:`noreferrer noopener`,$variant:`primary`,$size:`sm`,children:[X(Se,{}),`Open `,h]})}),X(B,{value:g.authorizeUrl,label:`Copy authorization link`})]}),g.userCode===null?null:Z(T,{$gap:1,children:[X(O,{children:`Step 2 — enter this code`}),X(Ae,{children:g.userCode})]}),g.kind===`device`?Z(Me,{children:[l?.pasteHint??``,` Waiting for authorization…`]}):X(U,{label:`Authorization code`,hint:l?.pasteHint??``,...N===null?{}:{problem:N},children:e=>X(H,{...e,value:v,autoFocus:!0,placeholder:Oe(l),onChange:e=>te(e.target.value)})})]}),N===null||g?.kind===`pkce`?null:X(je,{children:N})]})})}function Pe({credentialId:e,windows:t,burn:n,pollIntervalMs:r,now:i}){let o=t.map(e=>({window:e,estimate:y(n,e.windowType),since:_e(f(e))})),s=o.map(e=>e.since).filter(e=>e!==null),c=s.length===0?0:Math.min(...s),l=a({credentialId:e,since:c},s.length>0),u=l.data?.samples??[],d=l.data?.gatewayRates??[],p=l.data?.truncated===!0;return X(T,{$gap:4,children:o.map(e=>X(Fe,{window:e.window,estimate:e.estimate,since:e.since,samples:u.filter(t=>t.windowType===e.window.windowType&&t.observedAt>=(e.since??0)),gatewayRate:d.find(t=>t.windowType===e.window.windowType),truncated:p,pollIntervalMs:r,now:i},e.window.windowType))})}function Fe({window:e,estimate:t,since:n,samples:r,gatewayRate:i,truncated:a,pollIntervalMs:o,now:s}){let c=e.limit===null?`${g(e.used)} used`:`${g(e.used)} of ${g(e.limit)} used`,u=l(e,s),d=t===void 0||m(e,s,o)||t.stale&&!u;return X(K,{live:f(e),samples:r.map(f),since:n,now:s,truncated:a&&n!==null&&r.length>0&&(r[0]?.observedAt??0)>n,ratePerHourRatio:w(e,t),exhaustsAt:t?.exhaustsAt??null,survives:t?.survives??null,stale:d,rolledOver:u,spent:c,rateText:t?.ratePerHour===void 0||t.ratePerHour===null?`unknown`:`${g(t.ratePerHour)}/h`,extraFact:X(ve,{legend:`This gateway accounts for`,value:i?.gatewayRatePerHour===void 0||i.gatewayRatePerHour===null?`unknown`:`${g(i.gatewayRatePerHour)} tokens/h`})})}var Ie=Q(M)`
21
- border-left: 3px solid ${({$provider:e})=>z(e)};
22
- `,Le=Q(H)`
23
- width: 100%;
24
- min-width: 140px;
25
- height: 26px;
26
- font-family: ${({theme:e})=>e.font.sans};
27
- font-size: 12.5px;
28
- background: transparent;
29
- border-color: transparent;
30
-
31
- &:hover:not(:disabled),
32
- &:focus {
33
- background: ${({theme:e})=>e.color.panelSunk};
34
- border-color: ${({theme:e})=>e.color.ruleStrong};
35
- }
36
- `,Re=Q(pe)`
37
- width: 62px;
38
- height: 26px;
39
- `,ze=Q.span`
40
- display: block;
41
- padding-left: 9px;
42
- font-size: 11px;
43
- color: ${({theme:e})=>e.color.inkDim};
44
- `,Be=Q.div`
45
- margin: 0 0 10px;
46
- min-height: 16px;
47
- font-size: 12px;
48
- color: ${({theme:e})=>e.color.inkDim};
49
- `,Ve=Q.p`
50
- margin: 0;
51
- `,He=Q.ul`
52
- margin: 4px 0 0;
53
- padding-left: 16px;
54
- list-style: disc;
55
- `,Ue=Q.div`
56
- display: grid;
57
- /* Bar, figure, legend. The figure has a column of its own so the legends stay
58
- aligned down the stack whether a window reads 4% or 100%. */
59
- grid-template-columns: 96px 34px 1fr;
60
- align-items: center;
61
- min-width: 208px;
62
- gap: 6px;
63
- `,We=Q(N)`
64
- font-size: 11px;
65
- text-align: right;
66
- `,Ge=Q.div`
67
- display: flex;
68
- flex-direction: column;
69
- gap: 4px;
70
- `;function Ke(){let e=s();return{pending:e.isPending,commit:(t,n)=>{e.mutate({id:t,patch:n})}}}function qe(e,t){if(t===void 0)return` The list of models could not be read, so whether any target is pinned to this account is unknown.`;let n=t.filter(t=>t.targets.some(t=>t.credentialId===e.id)).map(e=>e.id);return n.length===0?``:` ${n.length===1?`The model`:`The models`} ${n.join(`, `)} ${n.length===1?`pins a target`:`pin targets`} to this account. Those targets will fail rather than fall back to another account.`}function Je(){let{cadence:t}=I(),a=v(),s=b(t(1e4,`res:credentials`)),l=r(),f=_(),ee=i(),m=d(),g=o(),ne=c(),{commit:S}=Ke(),[w,j]=J(!1),[N,F]=J(null),[oe,z]=J([]),[B,V]=J(new Set),[H,pe]=J(!1),[U,K]=J(null),[_e,ve]=J(new Set),be=e=>ve(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),q=a.data??[],Q=e=>q.find(t=>t.id===e)?.label??e,xe=e=>{let t=e[0];if(e.length===1&&t!==void 0){let e=Q(t.credentialId);return t.kind===`refreshed`||t.kind===`coalesced`?`Quota refreshed for ${e}.`:t.kind===`noData`?`No quota data reported for ${e}.`:t.kind===`cooldown`?`Quota refresh is cooling down for ${e}.`:t.kind===`unsupported`?`${e} does not report quota.`:t.kind===`disabled`?`${e} is disabled, so it was not probed.`:`Quota refresh failed for ${e}.`}let n=e.filter(e=>e.kind===`refreshed`||e.kind===`coalesced`).length,r=e.filter(e=>e.kind===`failed`).length,i=e.filter(e=>e.kind===`cooldown`).length,a=e.length-n-r-i;return[`Refreshed ${n} ${n===1?`account`:`accounts`}`,r===0?null:`${r} failed`,i===0?null:`${i} cooling down`,a===0?null:`${a} skipped`].filter(e=>e!==null).join(`; `).concat(`.`)},Se=e=>e.filter(e=>e.kind===`failed`||e.kind===`cooldown`||e.kind===`noData`).map(e=>`${Q(e.credentialId)}: ${e.kind===`failed`?`failed`:e.kind===`cooldown`?`cooling down`:`no data reported`}`),Ce=async e=>{F(null),z([]),e.kind===`all`?pe(!0):V(t=>{let n=new Set(t);return n.add(e.credentialId),n});try{let t=await g.mutateAsync(e);F(xe(t.outcomes)),z(t.outcomes.length>1?Se(t.outcomes):[])}catch{F(e.kind===`all`?`Quota refresh could not be started.`:`Quota refresh could not be started for ${Q(e.credentialId)}.`)}finally{pe(!1),e.kind===`one`&&V(t=>{let n=new Set(t);return n.delete(e.credentialId),n})}},$=Date.now(),Te=ee.data??[],Ee=e=>u(Te,e)?.order??1/0,De=[...new Set(q.map(e=>e.provider))].sort((e,t)=>Ee(e)-Ee(t)),Oe=e=>u(Te,e)?.label??e,ke=p(s.data?.health??[],e=>e.credentialId),Ae=p(s.data?.quota??[],e=>e.credentialId),je=p(s.data?.burn??[],e=>e.credentialId),Me=l.data?.quotaPollIntervalMs??3e5,Fe=q.filter(e=>e.enabled).length,Je=a.isLoading?`Reading connected accounts…`:q.length===0?`No provider credentials are connected, so every request fails at the router.`:`${Fe} of ${q.length} accounts are enabled and eligible for routing.`;return Z(Y,{children:[X(R,{legend:`Accounts`,title:`Provider accounts`,summary:Je,actions:Z(k,{$gap:1,children:[ne?Z(E,{type:`button`,$variant:`ghost`,disabled:H||B.size>0,onClick:()=>void Ce({kind:`all`}),children:[X(we,{}),H?`Refreshing quota…`:`Refresh all quota`]}):null,Z(E,{type:`button`,$variant:`primary`,onClick:()=>j(!0),children:[X(le,{}),`Connect an account`]})]})}),Z(Be,{children:[X(Ve,{role:`status`,"aria-live":`polite`,children:N??``}),oe.length===0?null:X(He,{children:oe.map(e=>X(`li`,{children:e},e))})]}),a.isError?X(M,{legend:`Accounts`,children:X(A,{error:a.error,onRetry:()=>void a.refetch()})}):a.isLoading?X(M,{legend:`Accounts`,children:X(ie,{rows:5})}):q.length===0?X(M,{legend:`Accounts`,children:X(ae,{legend:`Nothing connected`,message:`Connect a provider account to give the router something to dispatch to. Tokens are encrypted at rest and never shown again.`,action:X(E,{type:`button`,$variant:`primary`,$size:`sm`,onClick:()=>j(!0),children:`Connect an account`})})}):X(T,{$gap:4,children:De.map(t=>{let r=q.filter(e=>e.provider===t);return X(Ie,{$provider:t,legend:Oe(t),meta:`${r.length} account${r.length===1?``:`s`}`,flush:!0,children:X(P,{children:Z(ge,{children:[X(`thead`,{children:Z(`tr`,{children:[X(G,{$width:`24%`,children:`Account`}),X(G,{$width:`20%`,children:`Sign-in`}),X(G,{$align:`right`,$width:`86px`,children:`Tier`}),X(G,{$align:`right`,$width:`94px`,children:`Weight`}),X(G,{$align:`center`,$width:`86px`,children:`Enabled`}),X(G,{$width:`240px`,children:`Quota`}),X(G,{$align:`right`,$width:`130px`,children:`Token expires`}),X(G,{$width:`112px`})]})}),X(`tbody`,{children:r.map(t=>{let r=x(ke.get(t.id)??[],$,t.enabled,t.disabledReason),i=Ae.get(t.id)??[],a=je.get(t.id)??[],o=C(i),s=_e.has(t.id);return Z(ye,{children:[Z(he,{children:[Z(W,{children:[Z(k,{$gap:2,children:[X(re,{state:r.state,label:r.note===``?`healthy`:r.note}),X(Le,{defaultValue:t.label,"aria-label":`Label for ${t.label}`,onBlur:e=>{let n=e.target.value.trim();if(n.length===0||n===t.label){e.target.value=t.label;return}S(t.id,{label:n})}})]}),r.note===``?null:X(ze,{children:r.note})]}),X(W,{children:Z(k,{$gap:1,children:[X(fe,{children:t.authType===`oauth`?`oauth`:`api key`}),t.accountEmail===null?null:X(O,{children:t.accountEmail})]})}),X(W,{$align:`right`,children:X(Re,{min:1,step:1,defaultValue:t.tier,"aria-label":`Tier for ${t.label}`,onBlur:e=>{let n=Number(e.target.value);if(!Number.isInteger(n)||n<1||n===t.tier){e.target.value=String(t.tier);return}S(t.id,{tier:n})}})}),X(W,{$align:`right`,children:X(Re,{min:.1,step:.1,defaultValue:t.weight,"aria-label":`Weight for ${t.label}`,onBlur:e=>{let n=Number(e.target.value);if(!Number.isFinite(n)||n<=0||n===t.weight){e.target.value=String(t.weight);return}S(t.id,{weight:n})}})}),X(W,{$align:`center`,children:X(de,{checked:t.enabled,label:`Route to ${t.label}`,onCheckedChange:e=>S(t.id,{enabled:e})})}),X(W,{children:o.length===0?X(O,{children:`unknown`}):X(Ge,{children:o.map(({window:t,fraction:r})=>Z(Ue,{children:[X(me,{fraction:r,label:`${te[t.windowType]} window, ${Math.round(r*100)}% used`}),X(We,{children:e(r,0)}),X(O,{children:h(t,$,Me,n,y(a,t.windowType))})]},t.windowType))})}),X(W,{$align:`right`,$mono:!0,children:t.expiresAt===null?`never`:n(t.expiresAt,$)}),X(W,{$align:`right`,children:Z(k,{$gap:1,$justify:`flex-end`,children:[i.length===0?null:X(D,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-expanded":s,"aria-label":`${s?`Hide`:`Show`} quota history for ${t.label}`,title:`${s?`Hide`:`Show`} quota history for ${t.label}`,onClick:()=>be(t.id),children:X(s?se:ce,{})}),ne?X(D,{type:`button`,$variant:`ghost`,$size:`sm`,disabled:H||B.has(t.id),"aria-label":B.has(t.id)?`Refreshing quota for ${t.label}`:`Refresh quota for ${t.label}`,title:`Refresh quota for ${t.label}`,onClick:()=>void Ce({kind:`one`,credentialId:t.id}),children:X(we,{})}):null,X(D,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Remove ${t.label}`,title:`Remove ${t.label}`,onClick:()=>K(t),children:X(ue,{})})]})})]}),s?X(he,{children:X(W,{colSpan:9,children:X(Pe,{credentialId:t.id,windows:i,burn:a,pollIntervalMs:Me,now:$})})}):null]},t.id)})})]})})},t)})}),X(Ne,{open:w,credentials:a.data??[],onOpenChange:j,onConnected:()=>void a.refetch()}),X(L,{open:U!==null,onOpenChange:e=>{e||K(null)},title:`Remove account`,body:U===null?``:`Removing "${U.label}" deletes its stored token. Any model target pointing at ${Oe(U.provider)} loses this account, and reconnecting means authorizing again.`+qe(U,f.data),confirmLabel:`Remove account`,busy:m.isPending,onConfirm:()=>{U!==null&&m.mutate(U.id,{onSettled:()=>K(null)})}})]})}var Ye=Je;export{Ye as component};
@@ -1,44 +0,0 @@
1
- import{At as e,B as t,j as n,lt as r}from"./Lamp-DkvXKB-B.js";import{a as i,b as a,i as o,r as s,t as c,y as ee}from"./Panel-CWmOTDAP.js";import{D as l,t as u}from"./Rack-CEuCdVXc.js";import{a as d,c as f,o as p,s as m}from"./index-Bk9sabex.js";import{i as h}from"./Field-BYBri2NV.js";import{useQueryClient as g}from"@tanstack/react-query";import{useLayoutEffect as te,useMemo as _,useRef as v,useState as y}from"react";import{jsx as b,jsxs as x}from"react/jsx-runtime";import S from"styled-components";var C={debug:10,info:20,warn:30,error:40};function w(e){return typeof e==`string`&&e in C}function T(e,t){return!w(t)||e.level===null||C[e.level]>=C[t]}function E(e){if(typeof e!=`object`||!e)return null;let{raw:t,at:n,level:r,msg:i}=e;return typeof t!=`string`||n!==null&&typeof n!=`number`||r!==null&&!w(r)||i!==null&&typeof i!=`string`?null:{raw:t,at:n,level:r,msg:i}}function D(e){if(typeof e!=`object`||!e)return null;let{lines:t}=e;if(!Array.isArray(t))return null;let n=[];for(let e of t){let t=E(e);if(t===null)return null;n.push(t)}return n}var O=[100,200,500],ne=[{value:``,label:`All levels`},{value:`debug`,label:`Debug and above`},{value:`info`,label:`Info and above`},{value:`warn`,label:`Warnings and errors`},{value:`error`,label:`Errors only`}],re=S(a)`
2
- gap: ${({theme:e})=>e.space(2)};
3
- flex-wrap: wrap;
4
- `,k=S(h)`
5
- width: auto;
6
- `,ie=S.div`
7
- display: grid;
8
- grid-template-rows: auto minmax(0, 1fr);
9
- gap: ${({theme:e})=>e.space(4)};
10
- min-height: 0;
11
- flex: 1;
12
- `,ae=S(c)`
13
- min-height: 0;
14
-
15
- > div {
16
- display: flex;
17
- flex: 1;
18
- flex-direction: column;
19
- min-height: 0;
20
- }
21
- `,A=S.div`
22
- flex: 1;
23
- min-height: 0;
24
- overflow-x: auto;
25
- overflow-y: auto;
26
- `,j=S.pre`
27
- margin: 0;
28
- padding: ${({theme:e})=>e.space(3)};
29
- font-family: ${({theme:e})=>e.font.mono};
30
- font-size: 12px;
31
- line-height: 1.65;
32
- white-space: pre;
33
- `,M=S.div`
34
- color: ${({theme:e,$level:t})=>t===`error`?e.color.down:t===`warn`?e.color.warn:t===`debug`?e.color.inkFaint:e.color.ink};
35
- `,N=S.p`
36
- margin: 0;
37
- padding: ${({theme:e})=>`${e.space(2)} ${e.space(3)}`};
38
- border-top: 1px solid ${({theme:e})=>e.color.rule};
39
- color: ${({theme:e})=>e.color.inkDim};
40
- font-size: 12px;
41
- `,P=S.code`
42
- font-family: ${({theme:e})=>e.font.mono};
43
- word-break: break-all;
44
- `;function F({read:e}){return e.source===`file`?x(N,{children:[`Reading `,b(P,{children:e.path}),`, named by `,b(P,{children:`OMNI_LOG_FILE`}),`. That variable says where the gateway's output is being captured; it does not redirect it.`]}):e.source===`journal`?x(N,{children:[`Reading the systemd journal for `,b(P,{children:`omnigateway.service`}),`. To read a file instead, redirect the gateway's output to one and point `,b(P,{children:`OMNI_LOG_FILE`}),` at the same path.`]}):e.unreachable!==void 0&&e.unreachable.length>0?x(N,{children:[e.unreachable.length===1?`One process`:`${e.unreachable.length} processes`,` did not answer in time and `,e.unreachable.length===1?`is`:`are`,` not shown:`,` `,e.unreachable.map(e=>e.slice(0,8)).join(`, `),`.`]}):null}var I={single:"Its output is going to a terminal, so there is nothing to read back. To capture it, run the gateway under systemd with `omni service install`, or start it with `omni start`, which redirects output to a file and points OMNI_LOG_FILE at it.",fleet:`No process in this fleet is capturing its own output, so there is nothing to read back. Each one can capture its own — tee its stdout to a file and point OMNI_LOG_FILE at the same path — and this screen will then merge them. For a fleet, ship stdout to a collector instead: Elasticsearch and Kibana, Loki and Grafana, or whatever already reads your containers. This screen shows one process's tail at a time, and a process that is gone takes its log with it.`,process:`This process is not capturing its own output, so there is nothing to read back from it. Tee its stdout to a file and point OMNI_LOG_FILE at the same path, or pick another process.`},L=[],R={read:void 0,lines:L};function z(){let{cadence:a}=l(),c=g(),[h,S]=y(200),[C,w]=y(``),[E,N]=y(``),P=e(),z=P.data?.nodes??[],V=z.length>1,H=E===``&&V?`all`:E,U=H===`all`?`fleet`:V?`process`:`single`,W=H===``||H===`all`?null:`${m}:${H}`,G=r(h,C,a(t,W??`stream:console`),H),K=G.data,[q,J]=y(R),Y=q.read===K?q.lines:L,X=_(()=>[...K?.lines??[],...Y].slice(-h),[K,Y,h]),Z=v(null),Q=v(!0),$=e=>{if(e.kind!==`frame`&&e.kind!==`gap`&&e.kind!==`closed`)return;let t=e.kind===`frame`?D(e.payload):null;if(t===null){J({read:K,lines:L}),e.kind===`frame`&&f(c,m);return}let n=t.filter(e=>T(e,C));n.length!==0&&J(e=>({read:K,lines:[...e.read===K?e.lines:[],...n].slice(-h)}))};return p(m,e=>{W===null&&$(e)}),d(W,$),te(()=>{let e=Z.current;e!==null&&Q.current&&X.length>0&&(e.scrollTop=e.scrollHeight)},[X]),x(ie,{children:[b(u,{legend:`Console`,title:`Gateway output`,summary:G.isLoading?`Reading the gateway's own output…`:`${n(X.length)} lines of what this process is doing. Requests are in Logs; prompt bodies, tokens and keys are never written here.`,actions:x(re,{children:[V?x(k,{value:H,"aria-label":`Which process to show`,onChange:e=>N(e.target.value),children:[b(`option`,{value:`all`,children:`every process`}),z.map(e=>b(`option`,{value:e.id,children:e.self?`${e.id.slice(0,8)} (this one)`:e.id.slice(0,8)},e.id))]}):null,b(k,{value:C,"aria-label":`Which levels to show`,onChange:e=>w(e.target.value),children:ne.map(e=>b(`option`,{value:e.value,children:e.label},e.value))}),b(k,{value:h,"aria-label":`How many lines to fetch`,onChange:e=>S(Number(e.target.value)),children:O.map(e=>x(`option`,{value:e,children:[`last `,e]},e))})]})}),x(ae,{legend:`Process output`,meta:K===void 0?void 0:b(ee,{children:B(K)}),flush:!0,children:[K===void 0?null:b(F,{read:K}),b(A,{ref:Z,"data-testid":`console-terminal`,onScroll:e=>{let t=e.currentTarget;Q.current=t.scrollHeight-t.scrollTop-t.clientHeight<=8},children:G.isError?b(o,{error:G.error,onRetry:()=>void G.refetch()}):G.isLoading||P.isLoading?b(`div`,{style:{padding:12},children:b(i,{rows:10})}):K!==void 0&&K.source===`none`?b(s,{legend:`Nothing is capturing this gateway`,message:I[U]}):X.length===0?b(s,{legend:`Nothing to show`,message:C===``?`This log is empty. The gateway writes here when it boots, refreshes a token, or polls a quota.`:`No line in this window is at that level. Widen the filter to see everything.`}):b(j,{children:X.map((e,t)=>b(M,{$level:e.level,children:e.nodeId===void 0?e.raw:`[${e.nodeId.slice(0,8)}] ${e.raw}`},`${e.at??0}-${t}`))})})]})]})}function B(e){return e.source===`file`?`log file`:e.source===`journal`?`systemd journal`:e.source===`fleet`?`every process, merged`:`not captured`}var V=z;export{V as component};
@@ -1,24 +0,0 @@
1
- import{Bt as e,F as t,Lt as n,M as r,O as i,P as a,Q as o,Yt as s,en as c,ft as l,ht as u,j as d,q as f,xt as p,yt as m}from"./Lamp-DkvXKB-B.js";import{C as h,D as g,_,a as v,b as y,g as b,i as x,o as S,r as ee,t as C,w,x as T}from"./Panel-CWmOTDAP.js";import{A as E,r as D,t as O}from"./Rack-CEuCdVXc.js";import{t as k}from"./trash-D4QWzEK_.js";import{r as A,t as j}from"./Field-BYBri2NV.js";import{t as M}from"./Meter-stpt3vQu.js";import{i as N,n as P,r as F,t as I}from"./Table-CVDZ69Zx.js";import{t as L}from"./Readout-BTh732hP.js";import{n as R}from"./reasons-Du1OBWAM.js";import{useQueryClient as z}from"@tanstack/react-query";import{useCallback as B,useState as V}from"react";import{Fragment as H,jsx as U,jsxs as W}from"react/jsx-runtime";import G from"styled-components";var K={name:`camera`,size:24,node:[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]};K.node;var q=E(K),J={name:`minimize-2`,size:24,node:[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]};J.node;var Y=E(J),X=[{id:`keepLatest`,label:`Snapshots kept`,hint:`How many survive regardless of age. The newest is always kept, whatever both numbers say.`,unit:`files`,max:100},{id:`maxAgeDays`,label:`Maximum age`,hint:`Older snapshots are pruned after every new one and on the hourly maintenance sweep.`,unit:`days`,max:3650}],te=G.p`
2
- font-size: 12px;
3
- color: ${({theme:e})=>e.color.down};
4
- `,ne=G.p`
5
- font-size: 12px;
6
- color: ${({theme:e})=>e.color.ok};
7
- `,re=G.div`
8
- display: grid;
9
- grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
10
- gap: ${({theme:e})=>e.space(3)};
11
- `;function ie(e){let t={};for(let n of X){let r=e[n.id].trim(),i=Number(r);if(r.length===0||!Number.isInteger(i)||i<1)return{ok:!1,problem:`${n.label} must be a whole number of 1 or more.`};if(i>n.max)return{ok:!1,problem:`${n.label} cannot exceed ${n.max}.`};t[n.id]=i}return{ok:!0,policy:t}}function ae({retention:t}){let n=e(),[r,i]=V({}),[a,o]=V(null),[s,c]=V(!1),l={keepLatest:r.keepLatest??(t===void 0?``:String(t.keepLatest)),maxAgeDays:r.maxAgeDays??(t===void 0?``:String(t.maxAgeDays))};return U(C,{legend:`Retention`,actions:U(g,{type:`button`,$size:`sm`,disabled:n.isPending||t===void 0,onClick:()=>{c(!1);let e=ie(l);if(!e.ok){o(e.problem);return}o(null),n.mutate(e.policy,{onSuccess:()=>{c(!0),i({})},onError:e=>o(S(e))})},children:n.isPending?`Saving…`:`Save retention`}),children:W(h,{$gap:3,children:[U(re,{children:X.map(e=>U(j,{label:e.label,hint:e.hint,children:t=>W(y,{$gap:2,children:[U(A,{...t,min:1,max:e.max,step:1,value:l[e.id],onChange:t=>i({...r,[e.id]:t.target.value})}),U(_,{children:e.unit})]})},e.id))}),a===null?null:U(te,{role:`alert`,children:a}),s&&a===null?U(ne,{role:`status`,children:`Retention saved.`}):null]})})}function oe(){let e=z();return B(t=>{if(t.adminPasswordChanged){R(`admin-password-changed`);return}e.invalidateQueries()},[e])}var Z=G.p`
12
- font-size: 12px;
13
- color: ${({theme:e})=>e.color.down};
14
- `,se=G.input`
15
- font-size: 12px;
16
- color: ${({theme:e})=>e.color.inkDim};
17
- max-width: 40ch;
18
- `;function ce(){let e=s(),t=l(),a=n(),o=oe(),c=m(),u=p(),[d,_]=V(null),[b,E]=V(null),[O,k]=V(null),[A,M]=V(!1),L=e.data??[],R=W(g,{type:`button`,$variant:`primary`,$size:`sm`,disabled:t.isPending,onClick:()=>t.mutate(),children:[U(q,{}),t.isPending?`Copying…`:`Take a snapshot`]}),z=W(h,{$gap:2,children:[W(y,{$gap:2,$wrap:!0,children:[U(j,{label:`Database file to import`,hint:`A snapshot taken from this or another OmniGateway. It is checked for integrity and rejected if it is not one of ours.`,children:e=>U(se,{...e,type:`file`,accept:`.sqlite,.db,application/octet-stream`,onChange:e=>k(e.target.files?.[0]??null)})}),U(g,{type:`button`,$variant:`danger`,$size:`sm`,disabled:O===null||u.isPending,onClick:()=>M(!0),children:u.isPending?`Replacing…`:`Import`})]}),u.isError?U(Z,{role:`alert`,children:S(u.error)}):null,a.isError?U(Z,{role:`alert`,children:S(a.error)}):null,t.isError?U(Z,{role:`alert`,children:S(t.error)}):null]});return W(C,{legend:`Snapshots`,meta:`${L.length}`,actions:R,footer:z,flush:!0,children:[e.isError?U(x,{error:e.error,onRetry:()=>void e.refetch()}):e.isLoading?U(`div`,{style:{padding:12},children:U(v,{rows:3})}):L.length===0?U(ee,{legend:`No snapshots`,message:`Nothing has been copied yet, so there is nothing to go back to. Take one before a migration or a settings change you are unsure of.`,action:U(g,{type:`button`,$variant:`primary`,$size:`sm`,disabled:t.isPending,onClick:()=>t.mutate(),children:`Take the first snapshot`})}):U(T,{children:W(I,{children:[U(`thead`,{children:W(`tr`,{children:[U(F,{children:`File`}),U(F,{children:`Reason`}),U(F,{$align:`right`,children:`Size`}),U(F,{$align:`right`,children:`Taken`}),U(F,{})]})}),U(`tbody`,{children:L.map(e=>W(N,{children:[U(P,{$mono:!0,children:U(w,{style:{maxWidth:`38ch`,display:`block`},children:e.filename})}),U(P,{children:e.reason}),U(P,{$align:`right`,$mono:!0,children:i(e.sizeBytes)}),U(P,{$align:`right`,$mono:!0,children:r(e.createdAt)}),U(P,{$align:`right`,children:W(y,{$gap:1,$justify:`flex-end`,children:[U(g,{as:`a`,$size:`sm`,href:f(e.id),download:e.filename,children:`Download`}),U(g,{type:`button`,$variant:`danger`,$size:`sm`,onClick:()=>_(e),children:`Restore`}),U(g,{type:`button`,$variant:`danger`,$size:`sm`,onClick:()=>E(e),children:`Delete`})]})})]},e.id))})]})}),U(D,{open:d!==null,onOpenChange:e=>{e||_(null)},title:`Restore database`,body:d===null?``:`Replacing the live database with ${d.filename}. Client requests are refused while the file is swapped, and a copy of the current database is taken first so this can be undone. Captured request bodies are not part of a snapshot and are left where they are.`,confirmLabel:`Restore database`,busy:a.isPending,onConfirm:()=>{d!==null&&a.mutate(d.id,{onSuccess:o,onSettled:()=>_(null)})}}),U(D,{open:b!==null,onOpenChange:e=>{e||E(null)},title:`Delete snapshot`,body:b===null?``:`Deleting ${b.filename} from disk. Download it first if it is the copy you would go back to; there is no other one of it.`,confirmLabel:`Delete snapshot`,busy:c.isPending,onConfirm:()=>{b!==null&&c.mutate(b.id,{onSettled:()=>E(null)})}}),U(D,{open:A,onOpenChange:M,title:`Import database`,body:O===null?``:`Replacing the live database with ${O.name}. It is validated before anything is touched, and a copy of the current database is taken first. If the file carries a different admin password, every session ends and you will be asked to sign in again.`,confirmLabel:`Replace database`,busy:u.isPending,onConfirm:()=>{O!==null&&u.mutate(O,{onSuccess:o,onSettled:()=>M(!1)})}})]})}var Q=G.p`
19
- font-size: 12px;
20
- color: ${({theme:e})=>e.color.ok};
21
- `,$=G.p`
22
- font-size: 12px;
23
- color: ${({theme:e})=>e.color.down};
24
- `;function le(e){try{let{hostname:t,port:n}=new URL(e);return n===``?t:`${t}:${n}`}catch{return e}}function ue(e){try{return new URL(e).pathname.replace(/^\//,``)||`—`}catch{return`—`}}function de(){let e=u(),n=c(),[r,s]=V(!1),l=o(),[f,p]=V(!1),m=e.data,h=m?.engine===`postgres`,_=m===void 0||m.logicalBytes===0?0:m.freePageBytes/m.logicalBytes;return W(H,{children:[U(O,{legend:`Database`,title:`Storage, snapshots, and retention`,summary:e.isLoading?`Measuring the database…`:h?`The Postgres database every replica of this cluster runs from. Back it up with pg_dump; nothing here copies or replaces it.`:`The one SQLite file this gateway runs from, the copies taken of it, and how long they are kept.`}),U(C,{legend:`Size`,meta:m===void 0?void 0:`schema v${m.stats.schemaVersion}`,actions:W(H,{children:[W(g,{type:`button`,$size:`sm`,disabled:l.isPending||m===void 0||m.bodiesBytes===0,onClick:()=>p(!0),children:[U(k,{}),l.isPending?`Clearing…`:`Clear bodies`]}),h?null:W(g,{type:`button`,$size:`sm`,disabled:n.isPending||m===void 0,onClick:()=>s(!0),children:[U(Y,{}),n.isPending?`Compacting…`:`Compact`]})]}),footer:n.isError?U($,{role:`alert`,children:S(n.error)}):l.isError?U($,{role:`alert`,children:S(l.error)}):n.data===void 0?l.data===void 0?void 0:U(Q,{role:`status`,children:`Cleared ${d(l.data.removed)} captured bodies.`}):U(Q,{role:`status`,children:`Compacted, reclaiming ${i(n.data.reclaimedBytes)} in ${a(n.data.durationMs)}.`}),children:e.isError?U(x,{error:e.error,onRetry:()=>void e.refetch()}):m===void 0?U(v,{rows:3}):h?W(b,{$min:`180px`,$stretch:!0,children:[U(L,{legend:`Database`,value:i(m.logicalBytes),unit:`${m.stats.pageCount} blocks of ${i(m.stats.pageSize)}`}),U(L,{legend:`Server`,value:le(m.location),unit:`database ${ue(m.location)}`}),U(L,{legend:`Captured bodies`,value:i(m.bodiesBytes),unit:`the request_bodies table`})]}):W(b,{$min:`180px`,$stretch:!0,children:[U(L,{legend:`Database file`,value:i(m.fileBytes),unit:`${m.stats.pageCount} pages of ${i(m.stats.pageSize)}`,trace:U(M,{fraction:_,label:`${t(_,0)} of the file is reclaimable`})}),U(L,{legend:`Reclaimable`,value:i(m.freePageBytes),unit:`${m.stats.freelistCount} free pages`}),U(L,{legend:`Write-ahead log`,value:i(m.walBytes),unit:`folded into every snapshot`}),U(L,{legend:`Captured bodies`,value:i(m.bodiesBytes),unit:`never in a snapshot`}),U(L,{legend:`Snapshots`,value:i(m.snapshots.totalBytes),unit:`${m.snapshots.count} kept`}),U(L,{legend:`Free disk`,value:i(m.freeDiskBytes),unit:m.freeDiskBytes===null?`not readable here`:`on this filesystem`})]})}),U(C,{legend:`Tables`,meta:h?`row counts are the planner's estimates; dead rows await autovacuum`:`size includes each table's indexes`,children:m===void 0?U(v,{rows:4}):W(I,{children:[U(`thead`,{children:W(N,{children:[U(F,{children:`Table`}),U(F,{$align:`right`,children:`Size`}),U(F,{$align:`right`,children:`Rows`}),h?U(F,{$align:`right`,children:`Dead rows`}):null]})}),U(`tbody`,{children:m.tables.map(e=>W(N,{children:[U(P,{children:e.name}),U(P,{$align:`right`,children:i(e.bytes)}),U(P,{$align:`right`,children:d(e.rows)}),h?U(P,{$align:`right`,children:d(e.deadRows??0)}):null]},e.name))})]})}),h?null:W(H,{children:[U(ce,{}),U(ae,{retention:m?.retention})]}),U(D,{open:f,onOpenChange:p,title:`Clear every captured body?`,body:`Every stored prompt and completion is deleted. The requests themselves stay in the log, with their bodies marked pruned. There is no undo: bodies are never in a snapshot.`,confirmLabel:`Clear captured bodies`,busy:l.isPending,onConfirm:()=>l.mutate(void 0,{onSettled:()=>p(!1)})}),U(D,{open:r,onOpenChange:s,title:`Compact database`,body:`Running VACUUM rewrites the database to give back its free pages. It holds the write lock for as long as it takes, so requests in flight will wait, and it needs room on disk for a second copy while it runs.`,confirmLabel:`Compact database`,busy:n.isPending,onConfirm:()=>n.mutate(void 0,{onSettled:()=>s(!1)})})]})}var fe=de;export{fe as component};
@@ -1,67 +0,0 @@
1
- import{$t as e,A as t,Ct as n,F as r,I as i,Kt as a,L as o,Ot as s,P as c,c as l,f as u,h as d,i as f,j as p,kt as m,mt as h,n as g,o as _,p as v,pt as y,s as b,t as x,tn as S,u as C,v as ee,x as te,z as w}from"./Lamp-DkvXKB-B.js";import{C as T,D as E,S as D,_ as O,b as k,g as ne,i as re,r as A,t as j,v as M,w as N,x as P}from"./Panel-CWmOTDAP.js";import{D as F,S as I,t as ie,w as L}from"./Rack-CEuCdVXc.js";import{n as R,t as ae}from"./TokenBreakdown-D1Wtza1y.js";import{n as oe,t as z}from"./Chip-D4qvhu1D.js";import{t as B}from"./Meter-stpt3vQu.js";import{i as V,n as H,r as U,t as W}from"./Table-CVDZ69Zx.js";import{t as G}from"./Readout-BTh732hP.js";import{useMemo as K}from"react";import{Fragment as q,jsx as J,jsxs as Y}from"react/jsx-runtime";import X from"styled-components";var se=X(N)`
2
- font-weight: 500;
3
- display: block;
4
- max-width: 24ch;
5
- `,Z=X.span`
6
- font-size: 11px;
7
- color: ${({theme:e})=>e.color.inkDim};
8
- `,ce=X.div`
9
- display: grid;
10
- grid-template-columns: 72px 1fr;
11
- align-items: center;
12
- gap: 6px;
13
- min-width: 172px;
14
- `,le=X.div`
15
- display: flex;
16
- flex-direction: column;
17
- gap: 4px;
18
- `;function ue(e){let t=null;for(let n of e)n.stale||n.survives!==!1||n.exhaustsAt===null||(t===null||n.exhaustsAt<t)&&(t=n.exhaustsAt);return t}function de(e,t){return e===null?t===null?0:1:t===null?-1:e-t}function fe({credentials:e,health:t,quota:n,burn:r,usage:a,lastUsed:o,quotaPollIntervalMs:s,now:c}){let u=l(t,e=>e.credentialId),f=l(n,e=>e.credentialId),m=l(r,e=>e.credentialId),h=new Map(a.map(e=>[e.key,e])),v={down:0,warn:1,ok:2,idle:3,live:3},y=e.map(e=>{let t=m.get(e.id)??[];return{credential:e,status:b(u.get(e.id)??[],c,e.enabled,e.disabledReason),quota:ee(f.get(e.id)??[]),burn:t,exhaustsAt:ue(t),usage:h.get(e.id)}}).sort((e,t)=>v[e.status.state]-v[t.status.state]||de(e.exhaustsAt,t.exhaustsAt)||e.credential.tier-t.credential.tier);return J(j,{legend:`Accounts`,meta:`${e.length} connected`,flush:!0,actions:J(E,{as:S,to:`/accounts`,$size:`sm`,children:`Manage accounts`}),children:e.length===0?J(A,{legend:`No accounts`,message:`The gateway has no provider credentials, so every request will fail. Connect one to start routing.`,action:J(E,{as:S,to:`/accounts`,$variant:`primary`,$size:`sm`,children:`Connect an account`})}):J(P,{children:Y(W,{children:[J(`thead`,{children:Y(`tr`,{children:[J(U,{children:`Account`}),J(U,{children:`Provider`}),J(U,{$align:`right`,children:`Tier`}),J(U,{children:`Quota`}),J(U,{$align:`right`,children:`Requests`}),J(U,{$align:`right`,children:`Last used`})]})}),J(`tbody`,{children:y.map(({credential:e,status:t,quota:n,burn:r,usage:a})=>Y(V,{children:[J(H,{children:Y(k,{$gap:2,children:[J(x,{state:t.state,label:t.note===``?`healthy`:t.note}),Y(`div`,{children:[J(se,{children:e.label}),t.note===``?null:J(Z,{children:t.note})]})]})}),J(H,{children:J(oe,{provider:e.provider})}),J(H,{$align:`right`,$mono:!0,children:e.tier}),J(H,{children:n.length===0?J(Z,{children:`unknown`}):J(le,{children:n.map(({window:e,fraction:t})=>Y(ce,{children:[J(B,{fraction:t,label:`${g[e.windowType]} window, ${Math.round(t*100)}% used`}),J(O,{children:d(e,c,s,i,_(r,e.windowType))})]},e.windowType))})}),J(H,{$align:`right`,$mono:!0,children:a===void 0?`—`:p(a.requests)}),J(H,{$align:`right`,$mono:!0,children:i(o[e.id]??null,c)})]},e.id))})]})})})}var pe=X.ul`
19
- display: flex;
20
- flex-direction: column;
21
- `,me=X.li`
22
- display: flex;
23
- align-items: center;
24
- gap: ${({theme:e})=>e.space(2)};
25
- padding: 6px ${({theme:e})=>e.space(3)};
26
- border-bottom: 1px solid ${({theme:e})=>e.color.rule};
27
-
28
- &:last-child {
29
- border-bottom: 0;
30
- }
31
- `,he=X(N)`
32
- font-family: ${({theme:e})=>e.font.mono};
33
- font-size: 12px;
34
- max-width: 30ch;
35
- `,ge=X(N)`
36
- font-family: ${({theme:e})=>e.font.mono};
37
- font-size: 11px;
38
- color: ${({theme:e})=>e.color.inkFaint};
39
- max-width: 16ch;
40
- `,_e=X(M)`
41
- color: ${({theme:e})=>e.color.down};
42
- font-size: 11px;
43
- `;function ve({logs:e,keyNames:n}){let r=e.slice(0,12);return J(j,{legend:`Activity`,meta:`most recent first`,flush:!0,actions:J(E,{as:S,to:`/logs`,$size:`sm`,children:`Open logs`}),children:r.length===0?J(A,{legend:`No traffic yet`,message:`Point a client at this gateway with an API key and the requests will appear here.`}):J(pe,{children:r.map(e=>Y(me,{children:[J(x,{state:v(e),label:u(e)}),J(M,{$dim:!0,children:t(e.at)}),J(he,{title:e.requestedModel,children:e.requestedModel||`—`}),e.resolvedProvider===null?null:J(M,{$dim:!0,style:{color:L(e.resolvedProvider)},children:e.resolvedProvider}),e.apiKeyId===null?null:J(ge,{title:e.apiKeyId,children:n.get(e.apiKeyId)??w(e.apiKeyId)}),J(D,{}),C(e)?J(M,{$dim:!0,"aria-label":`processing`,children:J(ae,{})}):Y(q,{children:[e.errorCode===null?null:J(_e,{children:e.errorCode}),e.attempts>1?Y(M,{$dim:!0,children:[e.attempts,`×`]}):null,J(M,{$dim:!0,children:J(R,{tokens:e})}),J(M,{$dim:!0,children:c(e.durationMs)}),J(M,{$dim:!0,children:o(e.costUsd)})]})]},e.id))})})}var ye=X.ul`
44
- display: flex;
45
- flex-direction: column;
46
- gap: ${({theme:e})=>e.space(3)};
47
- `,be=X(N)`
48
- font-family: ${({theme:e})=>e.font.mono};
49
- font-size: 12.5px;
50
- `,xe=X.div`
51
- display: flex;
52
- height: 5px;
53
- border-radius: 2px;
54
- overflow: hidden;
55
- background: ${({theme:e})=>e.color.panelSunk};
56
- border: 1px solid ${({theme:e})=>e.color.rule};
57
- `,Q=X.div`
58
- flex: ${({$grow:e})=>e} 0 0;
59
- background: ${({$color:e})=>e};
60
- opacity: 0.8;
61
- `,Se=X.div`
62
- flex: ${({$grow:e})=>e} 0 0;
63
- `;function Ce({models:e,logs:t}){let n=new Map;for(let e of t){let t=n.get(e.requestedModel)??{requests:0,costUsd:0};t.requests+=1,t.costUsd+=e.costUsd,n.set(e.requestedModel,t)}let r=Math.max(1,...[...n.values()].map(e=>e.requests)),i=[...e].map(e=>({model:e,used:n.get(e.id)})).sort((e,t)=>(t.used?.requests??0)-(e.used?.requests??0)).slice(0,8);return J(j,{legend:`Models`,meta:`${e.length} configured`,actions:J(E,{as:S,to:`/models`,$size:`sm`,children:`Edit routing`}),children:e.length===0?J(A,{legend:`No models`,message:`Nothing is routable yet. Create a virtual model and point it at one or more provider targets.`,action:J(E,{as:S,to:`/models`,$variant:`primary`,$size:`sm`,children:`Create a model`})}):J(ye,{children:i.map(({model:e,used:t})=>{let n=(t?.requests??0)/r,i=[...new Set(e.targets.map(e=>e.provider))];return Y(`li`,{children:[Y(k,{$gap:2,children:[J(be,{title:e.id,children:e.id}),e.isAlias?J(z,{children:`alias`}):null,J(z,{$tone:`accent`,children:e.strategy}),J(D,{}),J(M,{$dim:!0,children:p(t?.requests??0)}),J(O,{children:`req`}),J(M,{$dim:!0,children:o(t?.costUsd??0)})]}),Y(xe,{style:{marginTop:6},title:`${Math.round(n*100)}% of the busiest model`,children:[i.map(e=>J(Q,{$color:L(e),$grow:n/i.length},e)),J(Se,{$grow:Math.max(0,1-n)})]})]},e.id)})})})}var we=X.div`
64
- display: grid;
65
- grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
66
- gap: ${({theme:e})=>e.space(3)};
67
- `;function Te({logs:e,windowMs:t,now:n}){let i=e.filter(e=>n-e.at<=t),a=te(i,t),s=f(i,{now:n,spanMs:t,count:32}),l=a.errorRate>=.25?`down`:a.errorRate>=.05?`warn`:`ok`,u=a.inputTokens+a.outputTokens+a.cacheReadTokens+a.cacheWriteTokens;return Y(we,{children:[J(G,{legend:`Requests`,value:p(a.requests),unit:`${a.ratePerMin.toFixed(1)}/min`,trace:J(I,{values:s.map(e=>e.total),overlay:s.map(e=>e.errors),label:`${a.requests} requests, ${a.errors} of them failed`})}),J(G,{legend:`Error rate`,value:r(a.errorRate),unit:`${p(a.errors)} failed`,tone:a.requests===0?`ink`:l,trace:J(I,{values:s.map(e=>e.errors),scaleTo:Math.max(...s.map(e=>e.total)),color:`var(--down)`,label:`${a.errors} failed requests against ${a.requests} total`})}),J(G,{legend:`Total tokens`,value:p(u),unit:J(R,{tokens:a}),trace:J(I,{values:s.map(e=>e.tokens),label:`token volume over the window, ${u.toLocaleString(`en-US`)} total`})}),J(G,{legend:`Time to first token`,value:c(a.ttftP50),unit:`p95 ${c(a.ttftP95)}`,trace:J(I,{values:s.map(e=>e.ttftMs??0),color:`var(--ok)`,label:`median first-token latency, currently ${c(a.ttftP50)}`})}),J(G,{legend:`Spend`,value:o(a.costUsd),unit:`${p(a.inputTokens+a.outputTokens)} tokens`,trace:J(I,{values:s.map(e=>e.costUsd),color:`var(--warn)`,label:`spend over the window, ${o(a.costUsd)} total`})})]})}var $=36e5;function Ee(){let{cadence:t}=F(),r=h(),i=y(t(1e4,`res:credentials`)),o=m(),c=s(500,t(1e4,`res:logs`)),u=n(),d=a(),f=K(()=>{let e=new Map;for(let t of u.data??[])e.set(t.id,t.label);return e},[u.data]),p=Date.now(),g=Math.floor((p-$)/6e4)*6e4,_=e({groupBy:`credential`,since:g},t(6e4,`res:usage`)),v=r.data??[],x=l(i.data?.health??[],e=>e.credentialId),S=v.filter(e=>b(x.get(e.id)??[],p,e.enabled,e.disabledReason).state===`down`),C=r.isLoading||c.isLoading?`Reading the gateway…`:v.length===0?`No accounts are connected, so every request fails at the router.`:S.length>0?`${S.length} account${S.length===1?` is`:`s are`} out of rotation.`:`All ${v.length} accounts are answering. Nothing needs attention.`;return Y(q,{children:[J(ie,{legend:`Rack`,title:`Gateway`,summary:C}),c.isError?J(j,{legend:`Traffic`,children:J(re,{legend:`The gateway did not answer`,error:c.error,onRetry:()=>void c.refetch()})}):Y(T,{$gap:4,children:[J(Te,{logs:c.data??[],windowMs:$,now:p}),J(fe,{credentials:v,health:i.data?.health??[],quota:i.data?.quota??[],burn:i.data?.burn??[],usage:_.data??[],lastUsed:i.data?.lastUsed??{},quotaPollIntervalMs:d.data?.quotaPollIntervalMs??3e5,now:p}),Y(ne,{$min:`340px`,$gap:4,children:[J(Ce,{models:o.data??[],logs:c.data??[]}),J(ve,{logs:c.data??[],keyNames:f})]})]})]})}var De=Ee;export{De as component};
@@ -1,92 +0,0 @@
1
- import{Ct as e,Ht as t,M as n,Rt as r,Ut as i,Wt as a,dt as o,kt as s,w as c}from"./Lamp-DkvXKB-B.js";import{C as l,D as u,O as d,_ as f,a as p,b as m,i as h,o as g,r as _,t as v,v as y,w as b,x}from"./Panel-CWmOTDAP.js";import{A as S,O as C,i as w,r as T,t as E}from"./Rack-CEuCdVXc.js";import{t as ee}from"./CopyValue-SnsT2LML.js";import{t as D}from"./chevron-down-Bs0tSOyA.js";import{t as O}from"./chevron-right-DSaI1kFo.js";import{t as k}from"./plus-BCfjC6nk.js";import{t as A}from"./Toggle-t82IhqEt.js";import{t as j}from"./Chip-D4qvhu1D.js";import{n as M,r as N,t as P}from"./Field-BYBri2NV.js";import{t as F}from"./Meter-stpt3vQu.js";import{i as I,n as L,r as R,t as te}from"./Table-CVDZ69Zx.js";import{Fragment as z,useState as B}from"react";import{Fragment as V,jsx as H,jsxs as U}from"react/jsx-runtime";import W from"styled-components";var G={name:`calendar-clock`,size:24,node:[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`path`,{d:`M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338`,key:`7hb8p4`}],[`path`,{d:`M3 9h5.859`,key:`numkqi`}],[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]};G.node;var ne=S(G),K={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};K.node;var re=S(K);function q(e,t){return e.revokedAt===null?c(e,t)?`active`:`expired`:`revoked`}function ie(e){if(e===null)return``;let t=new Date(e-new Date(e).getTimezoneOffset()*6e4);return Number.isNaN(t.getTime())?``:t.toISOString().slice(0,16)}function ae(e){let t=e.trim();if(t.length===0)return{at:null};let n=new Date(t).getTime();return Number.isFinite(n)?{at:n}:{problem:`"${e}" is not a date`}}var oe=W.p`
2
- font-size: 12px;
3
- color: ${({theme:e})=>e.color.down};
4
- `,se=W.p`
5
- font-size: 12px;
6
- color: ${({theme:e})=>e.color.warn};
7
- `;function ce({apiKey:e,onOpenChange:n}){let r=t(),[i,a]=B(()=>ie(e?.expiresAt??null)),[o,s]=B(null),c=()=>{if(e===null)return;let t=ae(i);if(`problem`in t){s(t.problem);return}s(null),r.mutate({id:e.id,expiresAt:t.at},{onSuccess:()=>n(!1),onError:e=>s(g(e))})},d=e!==null&&q(e,Date.now())===`expired`;return H(w,{open:e!==null,onOpenChange:n,title:`Edit expiry`,description:e===null?void 0:`When "${e.label}" stops being accepted. Leave it blank for never.`,width:`480px`,footer:U(V,{children:[H(u,{type:`button`,onClick:()=>n(!1),children:`Cancel`}),H(u,{type:`button`,$variant:`primary`,disabled:r.isPending,onClick:c,children:r.isPending?`Saving…`:`Save expiry`})]}),children:U(l,{$gap:3,children:[d?H(se,{role:`status`,children:`This key has expired and the gateway is refusing it. Moving the date forward, or clearing it, brings it back.`}):null,H(P,{label:`Expires`,hint:`Your local time. Blank means the key never expires; a date already past expires it now.`,children:e=>H(M,{...e,type:`datetime-local`,value:i,disabled:r.isPending,onChange:e=>a(e.target.value)})}),o===null?null:H(oe,{role:`alert`,children:o})]})})}var J=[{dimension:`requests`,window:`1m`},{dimension:`requests`,window:`5h`},{dimension:`requests`,window:`1w`},{dimension:`tokens`,window:`1m`},{dimension:`tokens`,window:`5h`},{dimension:`tokens`,window:`1w`},{dimension:`spend`,window:`5h`},{dimension:`spend`,window:`1w`},{dimension:`concurrency`,window:null}];function Y(e){return e.window===null?e.dimension:`${e.dimension}:${e.window}`}var le={requests:`Requests`,tokens:`Tokens`,spend:`Spend`,concurrency:`Concurrent`},ue={"1m":`per minute`,"5h":`per 5 hours`,"1w":`per week`};function X(e){let t=le[e.dimension];return e.window===null?t:`${t} ${ue[e.window]}`}function Z(e,t){return e===`spend`?`$${t<1?t.toFixed(4):t.toFixed(2)}`:t.toLocaleString(`en-US`)}function Q(e){return e.used===null||e.limit<=0?null:Math.max(0,e.used/e.limit)}function de(e){let t=null,n=-1;for(let r of e){let e=Q(r);e!==null&&e>n&&(t=r,n=e)}return t}function $(e){let t={};for(let e of J)t[Y(e)]=``;if(e===null)return t;for(let n of J){let r=n.window===null?e.concurrency:n.dimension===`requests`?e.requests?.[n.window]:n.dimension===`tokens`?e.tokens?.[n.window]:n.window===`1m`?void 0:e.spend?.[n.window];r!=null&&(t[Y(n)]=String(r))}return t}function fe(e){let t={},n={},r={},i;for(let a of J){let o=(e[Y(a)]??``).trim();if(o.length===0)continue;let s=Number(o),c=a.dimension===`spend`;if(!Number.isFinite(s)||s<=0||!c&&!Number.isInteger(s))return{problem:c?`${X(a)} must be an amount above zero, or blank for no limit.`:`${X(a)} must be a whole number above zero, or blank for no limit.`};a.window===null?i=s:a.dimension===`requests`?t[a.window]=s:a.dimension===`tokens`?n[a.window]=s:a.window!==`1m`&&(r[a.window]=s)}return{limits:{...Object.keys(t).length>0?{requests:t}:{},...Object.keys(n).length>0?{tokens:n}:{},...Object.keys(r).length>0?{spend:r}:{},...i===void 0?{}:{concurrency:i}}}}var pe=W.div`
8
- display: grid;
9
- grid-template-columns: repeat(3, minmax(0, 1fr));
10
- gap: ${({theme:e})=>e.space(2)};
11
- `,me=W.p`
12
- font-size: 11px;
13
- color: ${({theme:e})=>e.color.inkDim};
14
- `;function he({draft:e,onChange:t,disabled:n=!1}){return U(l,{$gap:2,children:[H(pe,{children:J.map(r=>{let i=Y(r);return H(P,{label:X(r),children:a=>H(N,{...a,min:r.dimension===`spend`?void 0:1,step:r.dimension===`spend`?`any`:1,disabled:n,value:e[i]??``,placeholder:`none`,onChange:n=>t({...e,[i]:n.target.value})})},i)})}),H(me,{children:`Blank means no limit. Token and spend ceilings are debited after a response completes, so a key at its ceiling is refused on its next request rather than its current one. Concurrency counts requests in flight right now and resets when the gateway restarts.`})]})}var ge=W.p`
15
- font-size: 12px;
16
- color: ${({theme:e})=>e.color.down};
17
- `,_e=W.p`
18
- font-size: 12px;
19
- color: ${({theme:e})=>e.color.warn};
20
- `;function ve({apiKey:e,onOpenChange:t}){let n=i(),[r,a]=B(()=>$(e?.limits??{})),[o,s]=B(null);return H(w,{open:e!==null,onOpenChange:t,title:`Edit limits`,description:e===null?void 0:`What "${e.label}" may do per minute, per five hours, and per week. Every field is a ceiling; blank is no limit.`,width:`640px`,footer:U(V,{children:[H(u,{type:`button`,onClick:()=>t(!1),children:`Cancel`}),H(u,{type:`button`,$variant:`primary`,disabled:n.isPending,onClick:()=>{if(e===null)return;let i=fe(r);if(`problem`in i){s(i.problem);return}s(null),n.mutate({id:e.id,limits:i.limits},{onSuccess:()=>t(!1),onError:e=>s(g(e))})},children:n.isPending?`Saving…`:`Save limits`})]}),children:U(l,{$gap:3,children:[e?.limits===null?H(_e,{role:`status`,children:`The stored limits for this key cannot be read, so the gateway refuses it. Saving here replaces them.`}):null,H(he,{draft:r,onChange:a,disabled:n.isPending}),o===null?null:H(ge,{role:`alert`,children:o})]})})}var ye=W.div`
21
- display: flex;
22
- flex-direction: column;
23
- gap: 2px;
24
- max-height: 190px;
25
- overflow-y: auto;
26
- padding: ${({theme:e})=>e.space(1)};
27
- border: 1px solid ${({theme:e})=>e.color.ruleStrong};
28
- border-radius: ${({theme:e})=>e.radius.control};
29
- background: ${({theme:e})=>e.color.panelSunk};
30
- `,be=W.label`
31
- display: flex;
32
- align-items: center;
33
- gap: ${({theme:e})=>e.space(2)};
34
- padding: 4px 6px;
35
- border-radius: 2px;
36
- cursor: pointer;
37
- font-family: ${({theme:e})=>e.font.mono};
38
- font-size: 12px;
39
-
40
- &:hover {
41
- background: ${({theme:e})=>e.color.panelRaised};
42
- }
43
- `,xe=W.p`
44
- font-size: 11px;
45
- color: ${({theme:e})=>e.color.inkDim};
46
- `;function Se({configured:e,checked:t,onChange:n,disabled:r}){let i=[...new Set([...e,...t])].sort(),a=(e,r)=>{n(r?[...t,e]:t.filter(t=>t!==e))},o=t.filter(t=>!e.includes(t));return U(`div`,{children:[H(ye,{children:i.map(e=>U(be,{children:[H(`input`,{type:`checkbox`,disabled:r,"aria-label":e,checked:t.includes(e),onChange:t=>a(e,t.target.checked)}),e]},e))}),o.length>0?H(xe,{children:`Some listed models are no longer configured. They stay until you clear them.`}):null,t.length===0?H(f,{children:`With nothing selected this key is allowed no model.`}):null]})}var Ce=W.p`
47
- font-size: 12px;
48
- color: ${({theme:e})=>e.color.down};
49
- `;function we({apiKey:e,onOpenChange:t}){let n=a(),r=s(),[i,o]=B(e?.modelAllowlist===null),[c,d]=B(()=>e?.modelAllowlist===null?[]:e?.modelAllowlist??[]),[p,h]=B(null),_=(r.data??[]).map(e=>e.id);return H(w,{open:e!==null,onOpenChange:t,title:`Edit models`,description:e===null?void 0:`Which models "${e.label}" may ask the gateway for. Sent whole on save.`,width:`640px`,footer:U(V,{children:[H(u,{type:`button`,onClick:()=>t(!1),children:`Cancel`}),H(u,{type:`button`,$variant:`primary`,disabled:n.isPending,onClick:()=>{e!==null&&(h(null),n.mutate({id:e.id,modelAllowlist:i?null:c},{onSuccess:()=>t(!1),onError:e=>h(g(e))}))},children:n.isPending?`Saving…`:`Save models`})]}),children:U(l,{$gap:3,children:[U(l,{$gap:2,children:[U(m,{$gap:2,children:[H(A,{checked:i,label:`Allow every model`,onCheckedChange:e=>{o(e),e&&d([])}}),H(f,{as:`span`,children:`Allow every model`})]}),i?null:H(Se,{configured:_,checked:c,onChange:d,disabled:n.isPending})]}),p===null?null:H(Ce,{role:`alert`,children:p})]})})}var Te=W.div`
50
- display: grid;
51
- grid-template-columns: minmax(0, 11rem) minmax(0, 12rem) minmax(0, 1fr) minmax(0, 3.5rem);
52
- align-items: center;
53
- gap: ${({theme:e})=>e.space(2)} ${({theme:e})=>e.space(4)};
54
- `,Ee=W.span`
55
- font-size: 11.5px;
56
- color: ${({theme:e})=>e.color.inkDim};
57
- `,De=W.p`
58
- font-size: 11px;
59
- color: ${({theme:e})=>e.color.inkDim};
60
- `;function Oe({label:e,readings:t}){return U(l,{$gap:3,children:[H(Te,{children:t.map(t=>{let n=X({dimension:t.dimension,window:t.window}),r=Q(t),i=Z(t.dimension,t.limit);return U(z,{children:[H(f,{as:`span`,children:n}),H(y,{children:t.used===null?i:`${Z(t.dimension,t.used)} of ${i}`}),r===null?H(Ee,{children:`in flight now, counted in the gateway process`}):H(F,{fraction:Math.min(1,r),label:`${e}, ${n}, ${Math.round(r*100)}% used`}),H(y,{children:r===null?`—`:`${Math.round(r*100)}%`})]},n)})}),H(De,{children:`Usage counts completed requests still inside each window. Requests in flight are added by the gateway itself and are not shown here.`})]})}var ke=W.p`
61
- font-size: 12px;
62
- color: ${({theme:e})=>e.color.warn};
63
- `,Ae=W.p`
64
- font-size: 11px;
65
- color: ${({theme:e})=>e.color.inkDim};
66
- `,je=W.p`
67
- font-size: 12px;
68
- color: ${({theme:e})=>e.color.down};
69
- `,Me=W.p`
70
- font-size: 12px;
71
- color: ${({theme:e})=>e.color.inkDim};
72
- `,Ne=W(u)`
73
- gap: 4px;
74
- `;function Pe({open:e,onOpenChange:t}){let n=s(),r=o(),[i,a]=B(``),[c,d]=B(!0),[p,h]=B([]),[_,v]=B(()=>$({})),[b,x]=B(!1),[S,C]=B(``),[T,E]=B(!1),[k,j]=B(null),[N,F]=B(null),I=()=>{a(``),d(!0),h([]),v($({})),x(!1),C(``),E(!1),j(null),F(null),r.reset()},L=e=>{e||I(),t(e)},R=Object.values(_).filter(e=>e.trim().length>0).length;return H(w,{open:e,onOpenChange:L,title:k===null?`Create an API key`:`Key created`,description:k===null?`Clients send this key as a bearer token or as x-api-key on every /v1 request.`:void 0,footer:k===null?U(V,{children:[H(u,{type:`button`,onClick:()=>L(!1),children:`Cancel`}),H(u,{type:`button`,$variant:`primary`,disabled:r.isPending,onClick:()=>{let e=fe(_);if(`problem`in e){x(!0),F(e.problem);return}let t=ae(S);if(`problem`in t){F(t.problem);return}F(null),r.mutate({label:i.trim().length===0?`api key`:i.trim(),modelAllowlist:c?null:p,limits:e.limits,bodyLoggingOptOut:T,expiresAt:t.at},{onSuccess:e=>j(e),onError:e=>F(g(e))})},children:r.isPending?`Creating…`:`Create key`})]}):H(u,{type:`button`,$variant:`primary`,onClick:()=>L(!1),children:`I have copied the key`}),children:k===null?U(l,{$gap:3,children:[H(P,{label:`Label`,hint:`Names the client this key belongs to, e.g. laptop or CI.`,children:e=>H(M,{...e,value:i,placeholder:`api key`,onChange:e=>a(e.target.value)})}),U(l,{$gap:2,children:[U(m,{$gap:2,children:[H(A,{checked:c,label:`Allow every model`,onCheckedChange:d}),H(f,{as:`span`,children:`Allow every model`})]}),c?null:U(V,{children:[H(Se,{configured:(n.data??[]).map(e=>e.id),checked:p,onChange:h}),p.length===0?H(ke,{children:`With no model selected this key is allowed nothing and every request it makes will be refused.`}):null]})]}),U(l,{$gap:2,children:[U(m,{$gap:2,children:[U(Ne,{type:`button`,$size:`sm`,"aria-expanded":b,onClick:()=>x(e=>!e),children:[H(b?D:O,{}),`Limits`]}),H(f,{as:`span`,children:R===0?`no limits; this key is unbounded`:`${R} limit${R===1?``:`s`} set`})]}),b?H(he,{draft:_,onChange:v}):null]}),H(P,{label:`Expires`,hint:`Optional. Your local time; blank means the key never expires.`,children:e=>H(M,{...e,type:`datetime-local`,value:S,onChange:e=>C(e.target.value)})}),U(l,{$gap:2,children:[U(m,{$gap:2,children:[H(A,{checked:T,label:`Never record this key's bodies`,onCheckedChange:E}),H(f,{as:`span`,children:`Never record this key's bodies`})]}),H(Ae,{children:`Suppresses body capture for this key whatever the gateway setting says. Choose it for a client whose payloads must not be retained. It cannot be changed after the key is created — issue a new key instead.`})]}),N===null?null:H(je,{role:`alert`,children:N})]}):U(l,{$gap:3,children:[H(Me,{children:`This is the only time the key is shown. The gateway keeps a hash, so a lost key has to be replaced rather than recovered.`}),H(ee,{value:k.key,label:`Copy API key`}),U(m,{$gap:2,children:[H(f,{children:`Label`}),H(y,{children:k.label}),H(f,{children:`Prefix`}),H(y,{children:k.prefix})]})]})})}var Fe=W(m)`
75
- gap: 4px;
76
- flex-wrap: wrap;
77
- max-width: 34ch;
78
- `,Ie=W.span`
79
- color: ${({theme:e})=>e.color.inkFaint};
80
- `,Le=W.span`
81
- display: block;
82
- font-size: 11px;
83
- color: ${({theme:e})=>e.color.inkDim};
84
- `,Re=W.span`
85
- font-size: 11px;
86
- color: ${({theme:e})=>e.color.inkDim};
87
- `,ze=W.div`
88
- display: flex;
89
- flex-direction: column;
90
- align-items: flex-end;
91
- gap: 2px;
92
- `;function Be(e){if(e===null)return`usage not counted here`;let t=Q(e);return`${X({dimension:e.dimension,window:e.window})} ${Z(e.dimension,e.limit)}, ${t===null?`—`:Math.round(t*100)}% used`}function Ve(){let t=e(),i=r(),[a,o]=B(!1),[s,c]=B(null),[l,g]=B(null),[y,S]=B(null),[w,ee]=B(null),[A,M]=B(null),N=Date.now(),P=t.data??[],F=P.filter(e=>q(e,N)===`active`),W=t.isLoading?`Reading issued keys…`:P.length===0?`No keys exist, so nothing can call this gateway yet.`:`${F.length} active key${F.length===1?``:`s`} of ${P.length} ever issued.`;return U(V,{children:[H(E,{legend:`Keys`,title:`Gateway API keys`,summary:W,actions:U(u,{type:`button`,$variant:`primary`,onClick:()=>o(!0),children:[H(k,{}),`Create a key`]})}),H(v,{legend:`Issued keys`,meta:`${P.length}`,flush:!0,children:t.isError?H(h,{error:t.error,onRetry:()=>void t.refetch()}):t.isLoading?H(`div`,{style:{padding:12},children:H(p,{rows:4})}):P.length===0?H(_,{legend:`No keys`,message:`Create a key and give it to a client. The key is shown once, at creation.`,action:H(u,{type:`button`,$variant:`primary`,$size:`sm`,onClick:()=>o(!0),children:`Create a key`})}):H(x,{children:U(te,{children:[H(`thead`,{children:U(`tr`,{children:[H(R,{children:`Label`}),H(R,{children:`Prefix`}),H(R,{children:`Allowed models`}),H(R,{$align:`right`,children:`Limits`}),H(R,{$align:`right`,children:`Created`}),H(R,{children:`Body capture`}),H(R,{children:`Status`}),H(R,{})]})}),H(`tbody`,{children:P.map(e=>{let t=w===e.id,r=de(e.limitUsage),i=q(e,N);return U(z,{children:[U(I,{children:[H(L,{children:H(b,{style:{maxWidth:`24ch`,display:`block`},children:e.label})}),U(L,{$mono:!0,children:[e.prefix,`…`]}),H(L,{children:e.modelAllowlist===null?H(f,{children:`every model`}):e.modelAllowlist.length===0?H(j,{$tone:`down`,children:`no models`}):H(Fe,{children:e.modelAllowlist.map(e=>H(j,{children:e},e))})}),H(L,{$align:`right`,children:e.limits===null?H(j,{$tone:`down`,children:`unreadable`}):e.limitUsage.length===0?H(f,{children:`no limits`}):U(ze,{children:[U(`span`,{children:[e.limitUsage.length,` limit`,e.limitUsage.length===1?``:`s`]}),H(Re,{children:Be(r)})]})}),H(L,{$align:`right`,$mono:!0,children:n(e.createdAt)}),H(L,{children:e.bodyLoggingOptOut?H(j,{children:`no bodies`}):H(f,{children:`—`})}),U(L,{children:[i===`revoked`?H(Ie,{title:n(e.revokedAt??0),children:H(j,{children:`revoked`})}):i===`expired`?H(j,{$tone:`down`,children:`expired`}):H(j,{$tone:`ok`,children:`active`}),e.expiresAt===null?null:U(Le,{children:[i===`expired`?`expired`:`expires`,` `,n(e.expiresAt)]})]}),H(L,{$align:`right`,children:U(m,{$gap:1,$justify:`flex-end`,children:[e.limitUsage.length===0?null:H(d,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-expanded":t,"aria-label":`${t?`Hide`:`Show`} limits for ${e.label}`,title:`${t?`Hide`:`Show`} limits for ${e.label}`,onClick:()=>ee(t?null:e.id),children:H(t?D:O,{})}),e.revokedAt===null?U(V,{children:[H(d,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Edit models for ${e.label}`,title:`Edit models for ${e.label}`,onClick:()=>g(e),children:H(re,{})}),H(d,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Edit limits for ${e.label}`,title:`Edit limits for ${e.label}`,onClick:()=>c(e),children:H(C,{})}),H(d,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Edit expiry for ${e.label}`,title:`Edit expiry for ${e.label}`,onClick:()=>S(e),children:H(ne,{})}),H(u,{type:`button`,$variant:`danger`,$size:`sm`,onClick:()=>M(e),children:`Revoke`})]}):null]})})]}),t?H(I,{children:H(L,{colSpan:8,children:H(Oe,{label:e.label,readings:e.limitUsage})})}):null]},e.id)})})]})})}),H(Pe,{open:a,onOpenChange:o}),H(ve,{apiKey:s,onOpenChange:e=>{e||c(null)}},s?.id??`none`),H(we,{apiKey:l,onOpenChange:e=>{e||g(null)}},l?.id??`none`),H(ce,{apiKey:y,onOpenChange:e=>{e||S(null)}},y?.id??`none`),H(T,{open:A!==null,onOpenChange:e=>{e||M(null)},title:`Revoke key`,body:A===null?``:`Revoking "${A.label}" refuses its next request. The key stays listed so past usage keeps its attribution, and it cannot be un-revoked.`,confirmLabel:`Revoke key`,busy:i.isPending,onConfirm:()=>{A!==null&&i.mutate(A.id,{onSettled:()=>M(null)})}})]})}var He=Ve;export{He as component};