omnigateway 0.4.7 → 0.4.8

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 (46) hide show
  1. package/README.md +53 -15
  2. package/bin/omni.js +11 -11
  3. package/gateway.js +10 -15
  4. package/package.json +1 -1
  5. package/public/assets/{CopyValue-BiiqC_Z2.js → CopyValue-CHZz2PLE.js} +1 -1
  6. package/public/assets/{Field-b0ohzqzR.js → Field-B79Yxdit.js} +1 -1
  7. package/public/assets/{Match-B2ZxNor3.js → Match-BWa6L0L1.js} +1 -1
  8. package/public/assets/Panel-CoulMx6R.js +25 -0
  9. package/public/assets/Rack-ziQuyb2l.js +314 -0
  10. package/public/assets/{Readout-VYnpaTMg.js → Readout-D1XEfywe.js} +1 -1
  11. package/public/assets/States-Shs8nZi1.js +54 -0
  12. package/public/assets/{Toggle-DMk46RX2.js → Toggle-CNnMgEU1.js} +1 -1
  13. package/public/assets/{TokenBreakdown-B9RanXin.js → TokenBreakdown-hkwYCWT3.js} +1 -1
  14. package/public/assets/_app-BD1K3SGD.js +1 -0
  15. package/public/assets/_app.accounts-BDBEn5vF.js +64 -0
  16. package/public/assets/{_app.console-eFiUh-OA.js → _app.console-BtLYkvSQ.js} +4 -4
  17. package/public/assets/_app.database-ByLAAKXX.js +24 -0
  18. package/public/assets/_app.index-3mAmJsCn.js +62 -0
  19. package/public/assets/_app.keys-Ce6Xd1RK.js +76 -0
  20. package/public/assets/{_app.logs-DV7O6ZUp.js → _app.logs-CmDNhsU4.js} +7 -7
  21. package/public/assets/_app.models-mqdU56d8.js +148 -0
  22. package/public/assets/_app.plugins._pluginId-C0VWWCD2.js +20 -0
  23. package/public/assets/{_app.settings-B8zjCira.js → _app.settings-BLJ-25xq.js} +3 -3
  24. package/public/assets/{_app.usage-C4GR06sI.js → _app.usage-BaB40kku.js} +4 -4
  25. package/public/assets/{index-B2twwe7y.js → index-C3Fp8XmZ.js} +3 -3
  26. package/public/assets/{login-CJz2YA-O.js → login-Bn1s6JI_.js} +2 -2
  27. package/public/assets/plus-Cdyfj4uP.js +1 -0
  28. package/public/assets/{queries-BOAAI06M.js → queries-CX9mStps.js} +5 -2
  29. package/public/assets/{shared-Rzhx6i7s.js → shared-DtfLcn24.js} +2 -2
  30. package/public/assets/{trash-2-C7-QrCg5.js → trash-2-B5fBDSkh.js} +1 -1
  31. package/public/index.html +4 -4
  32. package/public/shared/dashboard-sdk.js +1 -0
  33. package/public/assets/Confirm-BO1xS6uH.js +0 -4
  34. package/public/assets/Lamp-BDf7-dMa.js +0 -25
  35. package/public/assets/Modal-OALemCh6.js +0 -82
  36. package/public/assets/Rack-DhVnjAjC.js +0 -180
  37. package/public/assets/States-6G9NsYha.js +0 -54
  38. package/public/assets/_app-ChlUa_Ov.js +0 -1
  39. package/public/assets/_app.accounts-CJ6lFXIx.js +0 -64
  40. package/public/assets/_app.database-BHaMpXld.js +0 -39
  41. package/public/assets/_app.index-C1vtrxnM.js +0 -62
  42. package/public/assets/_app.keys-Bz6-VVJi.js +0 -76
  43. package/public/assets/_app.models-KIctkivt.js +0 -148
  44. package/public/assets/_app.plugins._pluginId-BbqXEJUB.js +0 -20
  45. package/public/assets/dist-9ps0Qd15.js +0 -1
  46. package/public/assets/plus-C7a0RuII.js +0 -1
@@ -1,82 +0,0 @@
1
- import{$ as e,it as t,ut as n}from"./queries-BOAAI06M.js";import{c as r}from"./Rack-DhVnjAjC.js";import{a as i,c as a,i as o,n as s,o as c,r as l,s as u,t as d}from"./dist-9ps0Qd15.js";import*as f from"react";import{useState as p}from"react";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";import*as _ from"react-dom";import v from"styled-components";var ee=r(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),te=Object.defineProperty,y=(e,t)=>te(e,`name`,{value:t,configurable:!0});function b(e,t){return f.useReducer((e,n)=>t[e][n]??e,e)}y(b,`useStateMachine`);var x=y(e=>{let{present:t,children:n}=e,r=S(t),i=typeof n==`function`?n({present:r.isPresent}):f.Children.only(n),a=w(r.ref,ne(i));return typeof n==`function`||r.isPresent?f.cloneElement(i,{ref:a}):null},`Presence`);function S(e){let[t,n]=f.useState(),r=f.useRef(null),i=f.useRef(e),a=f.useRef(`none`),o=f.useRef(void 0),[c,l]=b(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return f.useEffect(()=>{c===`mounted`?(a.current=o.current??T(r.current),o.current=void 0):a.current=`none`},[c]),s(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=T(t);e?(o.current=s,l(`MOUNT`)):s===`none`||t?.display===`none`?l(`UNMOUNT`):l(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,l]),s(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=y(a=>{let o=T(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(l(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=y(e=>{e.target===t&&(a.current=T(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}l(`ANIMATION_END`)},[t,l]),{isPresent:[`mounted`,`unmountSuspended`].includes(c),ref:f.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=T(t)}else r.current=null;n(e)},[])}}y(S,`usePresence`);function C(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}y(C,`setRef`);function w(...e){let t=f.useRef(e);return t.current=e,f.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=C(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():C(n[e],null)}}},[])}y(w,`useStableComposedRefs`);function T(e){return e?.animationName||`none`}y(T,`getAnimationName`);function ne(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}y(ne,`getElementRef`);var re=Object.defineProperty,ie=(e,t)=>re(e,`name`,{value:t,configurable:!0}),E=f.useId||(()=>void 0),ae=0;function D(e){let[t,n]=f.useState(E());return s(()=>{e||n(e=>e??String(ae++))},[e]),e||(t?`radix-${t}`:``)}ie(D,`useId`);var oe=Object.defineProperty,se=(e,t)=>oe(e,`name`,{value:t,configurable:!0});function O(e){let t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>((...e)=>t.current?.(...e)),[])}se(O,`useCallbackRef`);var ce=Object.defineProperty,k=(e,t)=>ce(e,`name`,{value:t,configurable:!0}),le=`dismissableLayer.update`,ue=`dismissableLayer.pointerDownOutside`,de=`dismissableLayer.focusOutside`,fe,pe=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),me=f.forwardRef(k(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:c,onInteractOutside:u,onDismiss:d,...p}=e,m=f.useContext(pe),[g,_]=f.useState(null),v=g?.ownerDocument??globalThis?.document,[,ee]=f.useState({}),te=a(t,_),y=Array.from(m.layers),[b]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),x=b?y.indexOf(b):-1,S=g?y.indexOf(g):-1,C=m.layersWithOutsidePointerEventsDisabled.size>0,w=S>=x,T=f.useRef(!1),ne=_e(e=>{s?.(e),u?.(e),e.defaultPrevented||d?.()},{ownerDocument:v,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:T,dismissableSurfaces:m.dismissableSurfaces,shouldHandlePointerDownOutside:f.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...m.branches].some(t=>t.contains(e));return w&&!t},[m.branches,w])}),re=ve(e=>{if(r&&T.current)return;let t=e.target;[...m.branches].some(e=>e.contains(t))||(c?.(e),u?.(e),e.defaultPrevented||d?.())},v),ie=g?S===y.length-1:!1,E=O(e=>{e.key===`Escape`&&(o?.(e),!e.defaultPrevented&&d&&(e.preventDefault(),d()))});return f.useEffect(()=>{if(ie)return v.addEventListener(`keydown`,E,{capture:!0}),()=>v.removeEventListener(`keydown`,E,{capture:!0})},[v,ie,E]),f.useEffect(()=>{if(g)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(fe=v.body.style.pointerEvents,v.body.style.pointerEvents=`none`),m.layersWithOutsidePointerEventsDisabled.add(g)),m.layers.add(g),ye(),()=>{n&&(m.layersWithOutsidePointerEventsDisabled.delete(g),m.layersWithOutsidePointerEventsDisabled.size===0&&(v.body.style.pointerEvents=fe))}},[g,v,n,m]),f.useEffect(()=>()=>{g&&(m.layers.delete(g),m.layersWithOutsidePointerEventsDisabled.delete(g),ye())},[g,m]),f.useEffect(()=>{let e=k(()=>ee({}),`handleUpdate`);return document.addEventListener(le,e),()=>document.removeEventListener(le,e)},[]),h(i.div,{...p,ref:te,style:{pointerEvents:C?w?`auto`:`none`:void 0,...e.style},onFocusCapture:l(e.onFocusCapture,re.onFocusCapture),onBlurCapture:l(e.onBlurCapture,re.onBlurCapture),onPointerDownCapture:l(e.onPointerDownCapture,ne.onPointerDownCapture)})},`DismissableLayer`));function he(){let e=f.useContext(pe),[t,n]=f.useState(null);return f.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}k(he,`useDismissableLayerSurface`);var ge=k(()=>!0,`IS_TRUE`);function _e(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=ge}=t,s=O(e),c=f.useRef(!1),l=f.useRef(!1),u=f.useRef(new Map),d=f.useRef(()=>{});return f.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}k(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}k(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}k(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}k(p,`handleInteractionBubble`);let m=k(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||be(ue,s,p,{discrete:!0})};if(k(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:k(()=>c.current=!0,`onPointerDownCapture`)}}k(_e,`usePointerDownOutside`);function ve(e,t=globalThis?.document){let n=O(e),r=f.useRef(!1);return f.useEffect(()=>{let e=k(e=>{e.target&&!r.current&&be(de,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:k(()=>r.current=!0,`onFocusCapture`),onBlurCapture:k(()=>r.current=!1,`onBlurCapture`)}}k(ve,`useFocusOutside`);function ye(){let e=new CustomEvent(le);document.dispatchEvent(e)}k(ye,`dispatchUpdate`);function be(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?c(i,a):i.dispatchEvent(a)}k(be,`handleAndDispatchCustomEvent`);var xe=Object.defineProperty,A=(e,t)=>xe(e,`name`,{value:t,configurable:!0}),Se=`focusScope.autoFocusOnMount`,Ce=`focusScope.autoFocusOnUnmount`,we={bubbles:!1,cancelable:!0},Te=f.forwardRef(A(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...c}=e,[l,u]=f.useState(null),d=O(o),p=O(s),m=f.useRef(null),g=a(t,u),_=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(r){let e=function(e){if(_.paused||!l)return;let t=e.target;l.contains(t)?m.current=t:M(m.current,{select:!0})},t=function(e){if(_.paused||!l)return;let t=e.relatedTarget;t!==null&&(l.contains(t)||M(m.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&M(l)};A(e,`handleFocusIn`),A(t,`handleFocusOut`),A(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return l&&r.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,l,_.paused]),f.useEffect(()=>{if(l){je.add(_);let e=document.activeElement;if(!l.contains(e)){let t=new CustomEvent(Se,we);l.addEventListener(Se,d),l.dispatchEvent(t),t.defaultPrevented||(Ee(Ne(j(l)),{select:!0}),document.activeElement===e&&M(l))}return()=>{l.removeEventListener(Se,d),setTimeout(()=>{let t=new CustomEvent(Ce,we);l.addEventListener(Ce,p),l.dispatchEvent(t),t.defaultPrevented||M(e??document.body,{select:!0}),l.removeEventListener(Ce,p),je.remove(_)},0)}}},[l,d,p,_]);let v=f.useCallback(e=>{if(!n&&!r||_.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=De(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&M(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&M(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,_.paused]);return h(i.div,{tabIndex:-1,...c,ref:g,onKeyDown:v})},`FocusScope`));function Ee(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(M(r,{select:t}),document.activeElement!==n)return}A(Ee,`focusFirst`);function De(e){let t=j(e);return[Oe(t,e),Oe(t.reverse(),e)]}A(De,`getTabbableEdges`);function j(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:A(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}A(j,`getTabbableCandidates`);function Oe(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):ke(r,{upTo:t})))return r}A(Oe,`findVisible`);function ke(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}A(ke,`isHidden`);function Ae(e){return e instanceof HTMLInputElement&&`select`in e}A(Ae,`isSelectableInput`);function M(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ae(e)&&t&&e.select()}}A(M,`focus`);var je=Me();function Me(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=N(e,t),e.unshift(t)},remove(t){e=N(e,t),e[0]?.resume()}}}A(Me,`createFocusScopesStack`);function N(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}A(N,`arrayRemove`);function Ne(e){return e.filter(e=>e.tagName!==`A`)}A(Ne,`removeLinks`);var Pe=Object.defineProperty,Fe=f.forwardRef(((e,t)=>Pe(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[a,o]=f.useState(!1);s(()=>o(!0),[]);let c=n||a&&globalThis?.document?.body;return c?_.createPortal(h(i.div,{...r,ref:t}),c):null},`Portal`)),Ie=Object.defineProperty,Le=(e,t)=>Ie(e,`name`,{value:t,configurable:!0}),P=0,F=null;function Re(e){return ze(),e.children}Le(Re,`FocusGuards`);function ze(){f.useEffect(()=>{F||={start:Be(),end:Be()};let{start:e,end:t}=F;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),P++,()=>{P===1&&(F?.start.remove(),F?.end.remove(),F=null),P=Math.max(0,P-1)}},[])}Le(ze,`useFocusGuards`);function Be(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}Le(Be,`createFocusGuard`);var I=function(){return I=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},I.apply(this,arguments)};function Ve(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function He(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var L=`right-scroll-bar-position`,R=`width-before-scroll-bar`,Ue=`with-scroll-bars-hidden`,We=`--removed-body-scroll-bar-size`;function z(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Ge(e,t){var n=p(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Ke=typeof window<`u`?f.useLayoutEffect:f.useEffect,qe=new WeakMap;function Je(e,t){var n=Ge(t||null,function(t){return e.forEach(function(e){return z(e,t)})});return Ke(function(){var t=qe.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||z(e,null)}),i.forEach(function(e){r.has(e)||z(e,a)})}qe.set(n,e)},[e]),n}function Ye(e){return e}function Xe(e,t){t===void 0&&(t=Ye);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Ze(e){e===void 0&&(e={});var t=Xe(null);return t.options=I({async:!0,ssr:!1},e),t}var Qe=function(e){var t=e.sideCar,n=Ve(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return f.createElement(r,I({},n))};Qe.isSideCarExport=!0;function $e(e,t){return e.useMedium(t),Qe}var et=Ze(),B=function(){},V=f.forwardRef(function(e,t){var n=f.useRef(null),r=f.useState({onScrollCapture:B,onWheelCapture:B,onTouchMoveCapture:B}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,ee=v===void 0?`div`:v,te=e.gapMode,y=Ve(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),b=p,x=Je([n,t]),S=I(I({},y),i);return f.createElement(f.Fragment,null,u&&f.createElement(b,{sideCar:et,removeScrollBar:l,shards:d,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:te}),o?f.cloneElement(f.Children.only(s),I(I({},S),{ref:x})):f.createElement(ee,I({},S,{className:c,ref:x}),s))});V.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},V.classNames={fullWidth:R,zeroRight:L};var tt,nt=function(){if(tt)return tt;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function rt(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=nt();return t&&e.setAttribute(`nonce`,t),e}function it(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function at(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var ot=function(){var e=0,t=null;return{add:function(n){e==0&&(t=rt())&&(it(t,n),at(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},st=function(){var e=ot();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},ct=function(){var e=st();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},lt={left:0,top:0,right:0,gap:0},H=function(e){return parseInt(e||``,10)||0},ut=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[H(n),H(r),H(i)]},dt=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return lt;var t=ut(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},ft=ct(),U=`data-scroll-locked`,pt=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
2
- .${Ue} {
3
- overflow: hidden ${r};
4
- padding-right: ${s}px ${r};
5
- }
6
- body[${U}] {
7
- overflow: hidden ${r};
8
- overscroll-behavior: contain;
9
- ${[t&&`position: relative ${r};`,n===`margin`&&`
10
- padding-left: ${i}px;
11
- padding-top: ${a}px;
12
- padding-right: ${o}px;
13
- margin-left:0;
14
- margin-top:0;
15
- margin-right: ${s}px ${r};
16
- `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
17
- }
18
-
19
- .${L} {
20
- right: ${s}px ${r};
21
- }
22
-
23
- .${R} {
24
- margin-right: ${s}px ${r};
25
- }
26
-
27
- .${L} .${L} {
28
- right: 0 ${r};
29
- }
30
-
31
- .${R} .${R} {
32
- margin-right: 0 ${r};
33
- }
34
-
35
- body[${U}] {
36
- ${We}: ${s}px;
37
- }
38
- `},mt=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},ht=function(){f.useEffect(function(){return document.body.setAttribute(U,(mt()+1).toString()),function(){var e=mt()-1;e<=0?document.body.removeAttribute(U):document.body.setAttribute(U,e.toString())}},[])},gt=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;ht();var a=f.useMemo(function(){return dt(i)},[i]);return f.createElement(ft,{styles:pt(a,!t,i,n?``:`!important`)})},_t=!1;if(typeof window<`u`)try{var W=Object.defineProperty({},"passive",{get:function(){return _t=!0,!0}});window.addEventListener(`test`,W,W),window.removeEventListener(`test`,W,W)}catch{_t=!1}var G=_t?{passive:!1}:!1,vt=function(e){return e.tagName===`TEXTAREA`},yt=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!vt(e)&&n[t]===`visible`)},bt=function(e){return yt(e,`overflowY`)},xt=function(e){return yt(e,`overflowX`)},St=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Tt(e,r)){var i=Et(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ct=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},wt=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Tt=function(e,t){return e===`v`?bt(t):xt(t)},Et=function(e,t){return e===`v`?Ct(t):wt(t)},Dt=function(e,t){return e===`h`&&t===`rtl`?-1:1},Ot=function(e,t,n,r,i){var a=Dt(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Et(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Tt(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},K=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},kt=function(e){return[e.deltaX,e.deltaY]},At=function(e){return e&&`current`in e?e.current:e},jt=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Mt=function(e){return`
39
- .block-interactivity-${e} {pointer-events: none;}
40
- .allow-interactivity-${e} {pointer-events: all;}
41
- `},Nt=0,q=[];function Pt(e){var t=f.useRef([]),n=f.useRef([0,0]),r=f.useRef(),i=f.useState(Nt++)[0],a=f.useState(ct)[0],o=f.useRef(e);f.useEffect(function(){o.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=He([e.lockRef.current],(e.shards||[]).map(At),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=f.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=K(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=St(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=St(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Ot(h,t,e,h===`h`?s:c,!0)},[]),c=f.useCallback(function(e){var n=e;if(!(!q.length||q[q.length-1]!==a)){var r=`deltaY`in n?kt(n):K(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&jt(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(At).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=f.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Ft(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=f.useCallback(function(e){n.current=K(e),r.current=void 0},[]),d=f.useCallback(function(t){l(t.type,kt(t),t.target,s(t,e.lockRef.current))},[]),p=f.useCallback(function(t){l(t.type,K(t),t.target,s(t,e.lockRef.current))},[]);f.useEffect(function(){return q.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener(`wheel`,c,G),document.addEventListener(`touchmove`,c,G),document.addEventListener(`touchstart`,u,G),function(){q=q.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,G),document.removeEventListener(`touchmove`,c,G),document.removeEventListener(`touchstart`,u,G)}},[]);var m=e.removeScrollBar,h=e.inert;return f.createElement(f.Fragment,null,h?f.createElement(a,{styles:Mt(i)}):null,m?f.createElement(gt,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ft(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var It=$e(et,Pt),Lt=f.forwardRef(function(e,t){return f.createElement(V,I({},e,{ref:t,sideCar:It}))});Lt.classNames=V.classNames;var Rt=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},J=new WeakMap,Y=new WeakMap,X={},zt=0,Bt=function(e){return e&&(e.host||Bt(e.parentNode))},Vt=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Bt(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Ht=function(e,t,n,r){var i=Vt(t,Array.isArray(e)?e:[e]);X[n]||(X[n]=new WeakMap);var a=X[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(J.get(e)||0)+1,l=(a.get(e)||0)+1;J.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Y.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),zt++,function(){o.forEach(function(e){var t=J.get(e)-1,i=a.get(e)-1;J.set(e,t),a.set(e,i),t||(Y.has(e)||e.removeAttribute(r),Y.delete(e)),i||e.removeAttribute(n)}),zt--,zt||(J=new WeakMap,J=new WeakMap,Y=new WeakMap,X={})}},Ut=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Rt(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Ht(r,i,n,`aria-hidden`)):function(){return null}},Wt=Object.defineProperty,Z=(e,t)=>Wt(e,`name`,{value:t,configurable:!0}),Gt=`Dialog`,[Kt,qt]=o(Gt),[Jt,Q]=Kt(Gt),Yt=Z(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=f.useRef(null),c=f.useRef(null),[l,u]=d({prop:r,defaultProp:i??!1,onChange:a,caller:Gt}),[p,m]=f.useState(0),[g,_]=f.useState(0);return h(Jt,{scope:t,triggerRef:s,contentRef:c,contentId:D(),titleId:D(),descriptionId:D(),titlePresent:p>0,descriptionPresent:g>0,setTitleCount:m,setDescriptionCount:_,open:l,onOpenChange:u,onOpenToggle:f.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),Xt=`DialogPortal`,[Zt,Qt]=Kt(Xt,{forceMount:void 0}),$t=Z(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Q(Xt,t);return h(Zt,{scope:t,forceMount:n,children:f.Children.map(r,e=>h(x,{present:n||a.open,children:h(Fe,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),en=`DialogOverlay`,tn=f.forwardRef(Z(function(e,t){let n=Qt(en,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Q(en,e.__scopeDialog);return a.modal?h(x,{present:r||a.open,children:h(rn,{...i,ref:t})}):null},`DialogOverlay`)),nn=u(`DialogOverlay.RemoveScroll`),rn=f.forwardRef(Z(function(e,t){let{__scopeDialog:n,...r}=e,o=Q(en,n),s=he(),c=a(t,s);return h(Lt,{as:nn,allowPinchZoom:!0,shards:[o.contentRef],children:h(i.div,{"data-state":hn(o.open),...r,ref:c,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),$=`DialogContent`,an=f.forwardRef(Z(function(e,t){let n=Qt($,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Q($,e.__scopeDialog);return h(x,{present:r||a.open,children:a.modal?h(on,{...i,ref:t}):h(sn,{...i,ref:t})})},`DialogContent`)),on=f.forwardRef(Z(function(e,t){let n=Q($,e.__scopeDialog),r=f.useRef(null),i=a(t,n.contentRef,r);return f.useEffect(()=>{let e=r.current;if(e)return Ut(e)},[]),h(cn,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:l(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:l(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:l(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),sn=f.forwardRef(Z(function(e,t){let n=Q($,e.__scopeDialog),r=f.useRef(!1),i=f.useRef(!1);return h(cn,{...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()}})},`DialogContentNonModal`)),cn=f.forwardRef(Z(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Q($,n);return ze(),h(m,{children:h(Te,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:h(me,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":hn(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),ln=`DialogTitle`,un=f.forwardRef(Z(function(e,t){let{__scopeDialog:n,...r}=e,a=Q(ln,n),{setTitleCount:o}=a;return s(()=>(o(e=>e+1),()=>o(e=>e-1)),[o]),h(i.h2,{id:a.titleId,...r,ref:t})},`DialogTitle`)),dn=`DialogDescription`,fn=f.forwardRef(Z(function(e,t){let{__scopeDialog:n,...r}=e,a=Q(dn,n),{setDescriptionCount:o}=a;return s(()=>(o(e=>e+1),()=>o(e=>e-1)),[o]),h(i.p,{id:a.descriptionId,...r,ref:t})},`DialogDescription`)),pn=`DialogClose`,mn=f.forwardRef(Z(function(e,t){let{__scopeDialog:n,...r}=e,a=Q(pn,n);return h(i.button,{type:`button`,...r,ref:t,onClick:l(e.onClick,()=>a.onOpenChange(!1))})},`DialogClose`));function hn(e){return e?`open`:`closed`}Z(hn,`getState`);var gn=v(tn)`
42
- position: fixed;
43
- inset: 0;
44
- z-index: ${({theme:e})=>e.z.overlay};
45
- background: oklch(0 0 0 / 0.5);
46
- backdrop-filter: blur(2px);
47
- `,_n=v(an)`
48
- position: fixed;
49
- z-index: ${({theme:e})=>e.z.dialog};
50
- top: 50%;
51
- left: 50%;
52
- transform: translate(-50%, -50%);
53
- width: min(${({$width:e})=>e}, calc(100vw - 32px));
54
- max-height: calc(100vh - 64px);
55
- display: flex;
56
- flex-direction: column;
57
- background: ${({theme:e})=>e.color.panel};
58
- border: 1px solid ${({theme:e})=>e.color.ruleStrong};
59
- border-radius: ${({theme:e})=>e.radius.panel};
60
- box-shadow: 0 12px 40px oklch(0 0 0 / 0.35);
61
- `,vn=v.div`
62
- display: flex;
63
- align-items: center;
64
- gap: ${({theme:e})=>e.space(2)};
65
- padding: ${({theme:e})=>`${e.space(2)} ${e.space(2)} ${e.space(2)} ${e.space(3)}`};
66
- border-bottom: 1px solid ${({theme:e})=>e.color.rule};
67
- background: ${({theme:e})=>e.color.panelSunk};
68
- `,yn=v.div`
69
- padding: ${({theme:e})=>e.space(3)};
70
- overflow-y: auto;
71
- `,bn=v.div`
72
- display: flex;
73
- justify-content: flex-end;
74
- gap: ${({theme:e})=>e.space(2)};
75
- padding: ${({theme:e})=>`${e.space(2)} ${e.space(3)}`};
76
- border-top: 1px solid ${({theme:e})=>e.color.rule};
77
- background: ${({theme:e})=>e.color.panelSunk};
78
- `,xn=v(fn)`
79
- margin: 0 0 ${({theme:e})=>e.space(3)};
80
- font-size: 12px;
81
- color: ${({theme:e})=>e.color.inkDim};
82
- `;function Sn({open:r,onOpenChange:i,title:a,description:o,footer:s,width:c=`560px`,children:l}){return h(Yt,{open:r,onOpenChange:i,children:g($t,{children:[h(gn,{}),g(_n,{$width:c,children:[g(vn,{children:[h(un,{asChild:!0,children:h(e,{as:`h2`,children:a})}),h(t,{}),h(mn,{asChild:!0,children:h(n,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Close`,children:h(ee,{})})})]}),g(yn,{children:[o===void 0?null:h(xn,{children:o}),l]}),s===void 0?null:h(bn,{children:s})]})]})})}export{Sn as t};
@@ -1,180 +0,0 @@
1
- import{$ as e,D as t,E as n,ct as r,dt as i,et as a,ft as o,it as s,k as c,lt as l,nt as u,ut as d}from"./queries-BOAAI06M.js";import{t as f}from"./index-B2twwe7y.js";import{E as p,O as m,T as h,_ as ee,r as te,t as g}from"./Lamp-BDf7-dMa.js";import{createContext as _,createElement as v,forwardRef as y,use as b,useCallback as x,useContext as S,useId as C,useMemo as w,useState as T}from"react";import{jsx as E,jsxs as D}from"react/jsx-runtime";import O,{css as k}from"styled-components";var A=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),ne=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),re=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),j=e=>{let t=re(e);return t.charAt(0).toUpperCase()+t.slice(1)},M={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ie=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ae=_({}),oe=()=>S(ae),se=y(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=oe()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return v(`svg`,{ref:c,...M,width:t??l??M.width,height:t??l??M.height,stroke:e??f,strokeWidth:m,className:A(`lucide`,p,i),...!a&&!ie(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>v(e,t)),...Array.isArray(a)?a:[a]])}),N=(e,t)=>{let n=y(({className:n,...r},i)=>v(se,{ref:i,iconNode:t,className:A(`lucide-${ne(j(e))}`,`lucide-${e}`,n),...r}));return n.displayName=j(e),n},ce=N(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),P=N(`blocks`,[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]),le=N(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),ue=N(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),F=N(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),de=N(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),I=N(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),L=N(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),R=N(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),z=N(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),B=N(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),V=N(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),H=N(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),fe=N(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),U=_(null);function pe({children:e}){let[t,n]=T(!0),r=x(()=>n(e=>!e),[]),i=w(()=>({live:t,toggle:r,cadence:e=>t?e:!1}),[t,r]);return E(U,{value:i,children:e})}function W(){return b(U)??{live:!1,toggle:()=>{},cadence:()=>!1}}var me=O.svg`
2
- display: block;
3
- width: 100%;
4
- height: 100%;
5
- overflow: visible;
6
- `;function G(e,t,n,r){if(e.length===0)return``;let i=e.length===1?0:t/(e.length-1);return e.map((e,t)=>{let a=t*i,o=n-(r===0?0:e/r*n);return`${t===0?`M`:`L`}${a.toFixed(2)},${o.toFixed(2)}`}).join(` `)}function K({values:e,overlay:t,height:n=28,color:r,overlayColor:i,scaleTo:a,label:o,className:s}){let c=C(),l=a===void 0?Math.max(1,...e,...t??[]):Math.max(1,a),u=G(e,100,n,l),d=u.length===0?``:`${u} L100,${n} L0,${n} Z`;return D(me,{className:s,viewBox:`0 0 100 ${n}`,preserveAspectRatio:`none`,role:`img`,"aria-label":o,style:{height:n},children:[E(`defs`,{children:D(`linearGradient`,{id:c,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[E(`stop`,{offset:`0%`,stopColor:r??`var(--accent)`,stopOpacity:`0.28`}),E(`stop`,{offset:`100%`,stopColor:r??`var(--accent)`,stopOpacity:`0`})]})}),d.length===0?null:E(`path`,{d,fill:`url(#${c})`}),t===void 0?null:E(`path`,{d:G(t,100,n,l),fill:`none`,stroke:i??`var(--down)`,strokeWidth:`1.25`,vectorEffect:`non-scaling-stroke`}),E(`path`,{d:u,fill:`none`,stroke:r??`var(--accent)`,strokeWidth:`1.5`,strokeLinejoin:`round`,vectorEffect:`non-scaling-stroke`})]})}var he=O.header`
7
- grid-area: chassis;
8
- display: flex;
9
- align-items: center;
10
- gap: ${({theme:e})=>e.space(3)};
11
- height: 48px;
12
- padding: 0 ${({theme:e})=>e.space(3)};
13
- border-bottom: 1px solid ${({theme:e})=>e.color.rule};
14
- background: ${({theme:e})=>e.color.panel};
15
- ${r}
16
- position: sticky;
17
- top: 0;
18
- z-index: ${({theme:e})=>e.z.chassis};
19
- `,ge=O.div`
20
- display: flex;
21
- align-items: baseline;
22
- gap: 7px;
23
- font-stretch: 74%;
24
- font-weight: 700;
25
- letter-spacing: 0.2em;
26
- font-size: 12px;
27
- text-transform: uppercase;
28
- flex: none;
29
- `,_e=O(u)`
30
- gap: ${({theme:e})=>e.space(3)};
31
- overflow: hidden;
32
-
33
- @media (max-width: 860px) {
34
- display: none;
35
- }
36
- `,q=O.div`
37
- display: flex;
38
- align-items: baseline;
39
- gap: 6px;
40
- padding-left: ${({theme:e})=>e.space(3)};
41
- border-left: 1px solid ${({theme:e})=>e.color.rule};
42
- white-space: nowrap;
43
- `,ve=O(q)`
44
- width: 96px;
45
- align-items: center;
46
- `,ye=O.div`
47
- flex: 1;
48
- min-width: 0;
49
- `,be=O(l)`
50
- gap: 6px;
51
- font-family: ${({theme:e})=>e.font.mono};
52
- letter-spacing: 0.08em;
53
- `,J=[`system`,`light`,`dark`],Y={system:`Match system theme`,light:`Light theme`,dark:`Dark theme`},X=6e5;function xe(){let r=o(),{live:i,toggle:c,cadence:l}=W(),{mode:u,setMode:_}=f(),v=n(),y=t(200,l(1e4)),b=Date.now(),x=w(()=>(y.data??[]).filter(e=>b-e.at<=X),[y.data,b]),S=ee(x,X),C=te(x,{now:b,spanMs:X,count:24}),T=J[(J.indexOf(u)+1)%J.length]??`system`,O=u===`light`?H:u===`dark`?z:R,k=y.isError||S.errorRate>=.25?`down`:S.errorRate>=.05?`warn`:x.length===0?`idle`:`ok`;return D(he,{children:[D(ge,{children:[E(g,{state:k,label:y.isError?`gateway unreachable`:`error rate ${p(S.errorRate)}`}),`Omnigateway`]}),D(_e,{children:[D(ve,{children:[E(e,{children:`req`}),E(ye,{children:E(K,{values:C.map(e=>e.total),overlay:C.map(e=>e.errors),height:22,label:`${S.requests} requests in the last 10 minutes`})})]}),D(q,{children:[E(e,{children:`rate`}),E(a,{children:S.ratePerMin.toFixed(1)}),E(e,{children:`/min`})]}),D(q,{children:[E(e,{children:`err`}),E(a,{style:{color:S.errorRate>=.05?`var(--down)`:void 0},children:p(S.errorRate)})]}),D(q,{children:[E(e,{children:`ttft p50`}),E(a,{children:h(S.ttftP50)})]}),D(q,{children:[E(e,{children:`spend`}),E(a,{children:m(S.costUsd)})]})]}),E(s,{}),D(be,{type:`button`,$size:`sm`,onClick:c,"aria-pressed":i,title:i?`Pause polling`:`Resume polling`,children:[E(g,{state:i?`ok`:`idle`,label:i?`polling`:`paused`}),i?`LIVE`:`PAUSED`]}),E(d,{type:`button`,$variant:`ghost`,$size:`sm`,onClick:()=>_(T),"aria-label":Y[u],title:`${Y[u]} — switch to ${Y[T].toLowerCase()}`,children:E(O,{})}),E(d,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Sign out`,title:`Sign out`,disabled:v.isPending,onClick:()=>{v.mutate(void 0,{onSuccess:()=>void r({to:`/login`})})},children:E(L,{})})]})}function Se(e){return`/plugins/${e}`}function Ce(e){return e.filter(e=>e.nav!==null&&e.ui!==null).sort((e,t)=>e.id.localeCompare(t.id)).map(e=>({id:e.id,label:e.nav?.label??e.name,disabledReason:we(e)}))}function we(e){let t=e.ui;return t===null||t.compatible&&t.entry!==null?null:t.reason??`This plugin's interface does not match this gateway.`}var Te=[{to:`/`,label:`Rack`,blurb:`Live state of every account and model`,Icon:ce},{to:`/accounts`,label:`Accounts`,blurb:`Provider credentials and their health`,Icon:ue},{to:`/models`,label:`Models`,blurb:`Virtual models, targets, and routing`,Icon:le},{to:`/keys`,label:`Keys`,blurb:`Gateway API keys and their limits`,Icon:I},{to:`/usage`,label:`Usage`,blurb:`Requests, tokens, and spend over time`,Icon:de},{to:`/logs`,label:`Logs`,blurb:`Recent requests, one row each`,Icon:B},{to:`/console`,label:`Console`,blurb:`The gateway's own output, as it was printed`,Icon:fe},{to:`/settings`,label:`Settings`,blurb:`Routing weights, retries, retention`,Icon:V},{to:`/database`,label:`Database`,blurb:`Size, snapshots, restart and shutdown`,Icon:F}],Ee=O.nav`
54
- grid-area: rail;
55
- display: flex;
56
- flex-direction: column;
57
- gap: 2px;
58
- padding: ${({theme:e})=>e.space(2)};
59
- border-right: 1px solid ${({theme:e})=>e.color.rule};
60
- background: ${({theme:e})=>e.color.panel};
61
- overflow-y: auto;
62
-
63
- @media (max-width: 720px) {
64
- flex-direction: row;
65
- overflow-x: auto;
66
- border-right: 0;
67
- border-bottom: 1px solid ${({theme:e})=>e.color.rule};
68
- }
69
- `,Z=k`
70
- display: flex;
71
- align-items: center;
72
- gap: ${({theme:e})=>e.space(2)};
73
- padding: 7px ${({theme:e})=>e.space(2)};
74
- border-radius: ${({theme:e})=>e.radius.control};
75
- border-left: 2px solid transparent;
76
- color: ${({theme:e})=>e.color.inkDim};
77
- font-size: 12.5px;
78
- font-weight: 500;
79
- white-space: nowrap;
80
- transition:
81
- background 120ms ease,
82
- color 120ms ease;
83
-
84
- svg {
85
- width: 15px;
86
- height: 15px;
87
- flex: none;
88
- }
89
- `,Q=O(i)`
90
- ${Z}
91
-
92
- &:hover {
93
- background: ${({theme:e})=>e.color.panelSunk};
94
- color: ${({theme:e})=>e.color.ink};
95
- }
96
-
97
- &[data-status="active"] {
98
- background: ${({theme:e})=>e.color.accentWash};
99
- border-left-color: ${({theme:e})=>e.color.accent};
100
- color: ${({theme:e})=>e.color.accent};
101
- }
102
- `,De=O.button`
103
- ${Z}
104
- align-items: flex-start;
105
- width: 100%;
106
- text-align: left;
107
- white-space: normal;
108
- background: none;
109
- border-top: 0;
110
- border-right: 0;
111
- border-bottom: 0;
112
- color: ${({theme:e})=>e.color.inkFaint};
113
- cursor: not-allowed;
114
- font-family: inherit;
115
-
116
- svg {
117
- margin-top: 2px;
118
- }
119
- `,$=O.span`
120
- display: flex;
121
- flex-direction: column;
122
- gap: 2px;
123
- min-width: 0;
124
- `,Oe=O.span`
125
- font-size: 10.5px;
126
- font-weight: 400;
127
- line-height: 1.3;
128
- color: ${({theme:e})=>e.color.warn};
129
- `;function ke(){let e=c();return D(Ee,{"aria-label":`Console sections`,children:[Te.map(({to:e,label:t,blurb:n,Icon:r})=>D(Q,{to:e,title:n,activeOptions:{exact:e===`/`},children:[E(r,{}),t]},e)),Ce(e.data??[]).map(({id:e,label:t,disabledReason:n})=>n===null?D(Q,{to:Se(e),title:`Provided by the ${e} plugin`,children:[E(P,{}),t]},e):D(De,{type:`button`,disabled:!0,children:[E(P,{}),D($,{children:[t,E(Oe,{children:n})]})]},e))]})}var Ae=O.div`
130
- display: grid;
131
- grid-template-areas:
132
- "chassis chassis"
133
- "rail main";
134
- grid-template-columns: 168px minmax(0, 1fr);
135
- grid-template-rows: auto minmax(0, 1fr);
136
- height: 100vh;
137
- min-height: 0;
138
- overflow: hidden;
139
-
140
- @media (max-width: 720px) {
141
- grid-template-areas:
142
- "chassis"
143
- "rail"
144
- "main";
145
- grid-template-columns: minmax(0, 1fr);
146
- grid-template-rows: auto auto minmax(0, 1fr);
147
- }
148
- `,je=O.main`
149
- grid-area: main;
150
- padding: ${({theme:e})=>e.space(4)};
151
- display: flex;
152
- flex-direction: column;
153
- gap: ${({theme:e})=>e.space(4)};
154
- min-width: 0;
155
- min-height: 0;
156
- overflow-y: auto;
157
-
158
- @media (max-width: 720px) {
159
- padding: ${({theme:e})=>e.space(3)};
160
- }
161
- `;function Me({children:e}){return D(Ae,{"data-testid":`rack-shell`,children:[E(xe,{}),E(ke,{}),E(je,{children:e})]})}var Ne=O.div`
162
- display: flex;
163
- align-items: flex-end;
164
- gap: ${({theme:e})=>e.space(3)};
165
- flex-wrap: wrap;
166
- `,Pe=O.h1`
167
- font-size: 20px;
168
- font-weight: 600;
169
- font-stretch: 88%;
170
- letter-spacing: -0.01em;
171
- `,Fe=O.p`
172
- font-size: 13px;
173
- color: ${({theme:e})=>e.color.inkDim};
174
- max-width: 68ch;
175
- `,Ie=O.div`
176
- display: flex;
177
- flex-direction: column;
178
- gap: 6px;
179
- min-width: 0;
180
- `;function Le({legend:t,title:n,summary:r,actions:i}){return D(Ne,{children:[D(Ie,{children:[E(e,{children:t}),E(Pe,{children:n}),E(Fe,{children:r})]}),E(s,{}),i]})}export{W as a,N as c,pe as i,Me as n,V as o,K as r,F as s,Le as t};
@@ -1,54 +0,0 @@
1
- import{$ as e,it as t,lt as n,nt as r,q as i}from"./queries-BOAAI06M.js";import{jsx as a,jsxs as o}from"react/jsx-runtime";import s,{keyframes as c}from"styled-components";var l=s.section`
2
- background: ${({theme:e})=>e.color.panel};
3
- border: 1px solid ${({theme:e})=>e.color.rule};
4
- border-radius: ${({theme:e})=>e.radius.panel};
5
- box-shadow: ${({theme:e})=>e.color.shadow};
6
- overflow: hidden;
7
- display: flex;
8
- flex-direction: column;
9
- min-width: 0;
10
- `,u=s.header`
11
- display: flex;
12
- align-items: center;
13
- gap: ${({theme:e})=>e.space(2)};
14
- padding: ${({theme:e})=>`${e.space(2)} ${e.space(3)}`};
15
- border-bottom: 1px solid ${({theme:e})=>e.color.rule};
16
- background: ${({theme:e})=>e.color.panelSunk};
17
- min-height: 34px;
18
- `,d=s.div`
19
- padding: ${({theme:e,$flush:t})=>t===!0?`0`:e.space(3)};
20
- min-width: 0;
21
- `,f=s.footer`
22
- padding: ${({theme:e})=>`${e.space(2)} ${e.space(3)}`};
23
- border-top: 1px solid ${({theme:e})=>e.color.rule};
24
- background: ${({theme:e})=>e.color.panelSunk};
25
- `;function p({legend:n,meta:i,actions:s,footer:c,flush:p,className:m,children:h}){return o(l,{className:m,children:[o(u,{children:[a(e,{children:n}),i===void 0?null:a(e,{as:`span`,children:i}),a(t,{}),s===void 0?null:a(r,{$gap:1,children:s})]}),a(d,{...p===!0?{$flush:!0}:{},children:h}),c===void 0?null:a(f,{children:c})]})}var m=s.div`
26
- display: flex;
27
- flex-direction: column;
28
- align-items: center;
29
- justify-content: center;
30
- gap: ${({theme:e})=>e.space(2)};
31
- padding: ${({theme:e})=>e.space(8)} ${({theme:e})=>e.space(4)};
32
- text-align: center;
33
- `,h=s.p`
34
- max-width: 44ch;
35
- font-size: 13px;
36
- color: ${({theme:e})=>e.color.inkDim};
37
- `;function g({legend:t,message:n,action:r}){return o(m,{children:[a(e,{children:t}),a(h,{children:n}),r]})}var _=s(h)`
38
- color: ${({theme:e})=>e.color.down};
39
- `;function v(e){return e instanceof i||e instanceof Error?e.message:`The gateway did not answer.`}function y({legend:t=`Request failed`,error:r,onRetry:i}){return o(m,{children:[a(e,{children:t}),a(_,{children:v(r)}),i===void 0?null:a(n,{type:`button`,$size:`sm`,onClick:i,children:`Try again`})]})}var b=c`
40
- 0% { opacity: 0.35; }
41
- 50% { opacity: 0.7; }
42
- 100% { opacity: 0.35; }
43
- `,x=s.div`
44
- height: ${({$height:e})=>e??12}px;
45
- width: ${({$width:e})=>e??`100%`};
46
- border-radius: 2px;
47
- background: ${({theme:e})=>e.color.ruleStrong};
48
- animation: ${b} 1.4s ease-in-out infinite;
49
- `,S=s.div`
50
- display: flex;
51
- flex-direction: column;
52
- gap: ${({theme:e})=>e.space(2)};
53
- padding: ${({theme:e})=>e.space(1)} 0;
54
- `;function C({rows:e=4}){let t=Array.from({length:e},(e,t)=>`row-${t}:${t%3==0?`72%`:`100%`}`);return a(S,{"aria-hidden":`true`,children:t.map(e=>a(x,{$width:e.split(`:`)[1]??`100%`},e))})}export{p as a,v as i,y as n,l as o,C as r,g as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./Match-B2ZxNor3.js";import{i as t,n}from"./Rack-DhVnjAjC.js";import{jsx as r}from"react/jsx-runtime";var i=()=>r(t,{children:r(n,{children:r(e,{})})});export{i as component};
@@ -1,64 +0,0 @@
1
- import{A as e,C as t,E as n,J as r,T as i,Y as a,c as o,dt as s,t as c,w as l}from"./shared-Rzhx6i7s.js";import{$ as u,A as d,W as f,at as p,et as m,f as h,g,h as _,l as v,lt as y,nt as b,r as x,rt as S,u as C,ut as w,v as T,z as E}from"./queries-BOAAI06M.js";import{a as D,c as O,t as k}from"./Rack-DhVnjAjC.js";import{n as A,r as ee,t as te}from"./CopyValue-BiiqC_Z2.js";import{t as ne}from"./plus-C7a0RuII.js";import{t as j}from"./trash-2-C7-QrCg5.js";import{t as re}from"./Modal-OALemCh6.js";import{t as M}from"./Toggle-DMk46RX2.js";import{t as N}from"./Confirm-BO1xS6uH.js";import{D as P,S as F,T as I,a as L,g as ie,h as ae,i as oe,m as se,n as ce,o as le,p as ue,s as R,t as de,u as fe,v as pe,w as me,x as he,y as ge}from"./Lamp-BDf7-dMa.js";import{t as _e}from"./Chip-BltJSw8A.js";import{i as z,n as B,r as ve,t as V}from"./Field-b0ohzqzR.js";import{t as ye}from"./Meter-stpt3vQu.js";import{a as H,i as U,n as be,r as xe,t as Se}from"./States-6G9NsYha.js";import{i as Ce,n as W,r as G,t as we}from"./Table-CVDZ69Zx.js";import{t as Te}from"./catalog-BBKm8Ih8.js";import*as Ee from"react";import{Fragment as De,forwardRef as Oe,useCallback as ke,useEffect as Ae,useState as K}from"react";import{Fragment as q,jsx as J,jsxs as Y}from"react/jsx-runtime";import X from"styled-components";var je=O(`external-link`,[[`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`}]]),Me=Object.keys(Te);function Ne(e){return Te[e].authTypes}function Pe(e){return Ne(e).includes(`oauth`)?`oauth`:`apiKey`}var Fe={oauth:`Authorize in the browser`,apiKey:`Paste an API key`},Z={anthropic:`Anthropic`,openai:`OpenAI`,kimi:`Kimi`,kilo:`Kilo`,grok:`Grok`,custom:`OpenAI Compatible`},Ie={anthropic:`Authorize in the browser, then paste the code Anthropic shows you.`,openai:`Authorize in the browser. When it redirects to localhost, paste the whole URL.`,kimi:`Enter the code on Kimi's device page. This dialog finishes on its own.`,kilo:`Approve the code on Kilo's device page. This dialog finishes on its own.`,grok:`Authorize in the browser. When it redirects to 127.0.0.1, paste the whole URL.`,custom:`Enter endpoint metadata and API key.`},Le={openai:`http://localhost:1455/auth/callback?code=…`,grok:`http://127.0.0.1:56121/callback?code=…`},Re=X.ol`
2
- display: flex;
3
- flex-direction: column;
4
- gap: ${({theme:e})=>e.space(3)};
5
- `,ze=X.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
- `,Be=X.p`
15
- font-size: 12px;
16
- color: ${({theme:e})=>e.color.down};
17
- `,Ve=X.p`
18
- font-size: 12px;
19
- color: ${({theme:e})=>e.color.inkDim};
20
- `;function He({open:e,credentials:t,onOpenChange:n,onConnected:r}){let[i,a]=K(`anthropic`),[o,s]=K(Pe(`anthropic`)),[c,l]=K(``),[d,f]=K(null),[m,g]=K(``),[_,S]=K(``),w=(t??[]).filter((e,t,n)=>e.provider===`custom`&&n.findIndex(t=>t.provider===`custom`&&t.providerData.endpointId===e.providerData.endpointId)===t),[T,E]=K(``),[D,O]=K(``),[k,A]=K(`chat_completions`),[ee,ne]=K(``),[j,M]=K(null),N=C(),P=v(),F=h(),I=ke(()=>{f(null),g(``),S(``),E(``),O(``),A(`chat_completions`),ne(``),M(null),l(``),N.reset(),P.reset(),F.reset()},[N,P,F]),L=ke(e=>{e||I(),n(e)},[n,I]);return Ae(()=>{if(d===null||d.kind!==`device`)return;let e=!1,t=async()=>{try{let t=await x(d.flowId);if(e)return;if(t.status===`complete`){I(),n(!1),r();return}}catch(t){if(e)return;M(U(t)),f(null);return}e||(i=setTimeout(()=>void t(),d.pollIntervalMs))},i=setTimeout(()=>void t(),d.pollIntervalMs);return()=>{e=!0,clearTimeout(i)}},[d,r,n,I]),J(re,{open:e,onOpenChange:L,title:`Connect an account`,description:`The gateway stores the resulting token encrypted. It is never shown again after this dialog.`,footer:d===null?Y(q,{children:[J(y,{type:`button`,onClick:()=>L(!1),children:`Cancel`}),J(y,{type:`button`,$variant:`primary`,disabled:N.isPending||F.isPending,onClick:()=>{if(M(null),o===`apiKey`){F.mutate({provider:i,apiKey:ee,label:c.trim()||void 0,...i===`custom`?{endpointId:_,endpointLabel:T,origin:D,protocol:k}:{}},{onSuccess:()=>{I(),n(!1),r()},onError:e=>M(U(e))});return}N.mutate({provider:i,label:c.trim().length===0?Z[i]:c.trim()},{onSuccess:e=>f(e),onError:e=>M(U(e))})},children:o===`apiKey`?F.isPending?`Adding…`:`Add API key`:N.isPending?`Starting…`:`Start authorization`})]}):d.kind===`device`?J(y,{type:`button`,onClick:()=>L(!1),children:`Cancel`}):Y(q,{children:[J(y,{type:`button`,onClick:()=>L(!1),children:`Cancel`}),J(y,{type:`button`,$variant:`primary`,disabled:P.isPending||m.trim().length===0,onClick:()=>{d!==null&&(M(null),P.mutate({flowId:d.flowId,code:m.trim()},{onSuccess:()=>{I(),n(!1),r()},onError:e=>M(U(e))}))},children:P.isPending?`Finishing…`:`Finish connecting`})]}),children:Y(Re,{children:[d===null?Y(p,{$gap:3,children:[J(V,{label:`Provider`,children:e=>J(z,{...e,value:i,onChange:e=>{let t=e.target.value;a(t),s(Pe(t))},children:Me.map(e=>J(`option`,{value:e,children:Z[e]},e))})}),Ne(i).length>1?J(V,{label:`How to connect`,children:e=>J(z,{...e,value:o,onChange:e=>s(e.target.value),children:Ne(i).map(e=>J(`option`,{value:e,children:Fe[e]},e))})}):null,i===`custom`?Y(q,{children:[w.length===0?null:J(V,{label:`Existing endpoint`,children:e=>Y(z,{...e,value:_,onChange:e=>{let t=w.find(t=>t.providerData.endpointId===e.target.value);if(t===void 0){S(``),E(``),O(``),A(`chat_completions`);return}S(String(t.providerData.endpointId)),E(String(t.providerData.endpointLabel)),O(String(t.providerData.origin)),A(t.providerData.protocol===`responses`?`responses`:`chat_completions`)},children:[J(`option`,{value:``,children:`Create new endpoint`}),w.map(e=>J(`option`,{value:String(e.providerData.endpointId),children:String(e.providerData.endpointLabel)},String(e.providerData.endpointId)))]})}),J(V,{label:`Endpoint ID`,children:e=>J(B,{...e,value:_,onChange:e=>S(e.target.value)})}),J(V,{label:`Endpoint label`,children:e=>J(B,{...e,value:T,onChange:e=>E(e.target.value)})}),J(V,{label:`Server origin`,children:e=>J(B,{...e,value:D,placeholder:`https://server.example`,onChange:e=>O(e.target.value)})}),D.trim().toLowerCase().startsWith(`http://`)?J(Be,{children:`Plaintext transport sends prompts and API keys without TLS.`}):null,J(V,{label:`Protocol`,children:e=>Y(z,{...e,value:k,onChange:e=>A(e.target.value),children:[J(`option`,{value:`chat_completions`,children:`Chat Completions (/v1/chat/completions)`}),J(`option`,{value:`responses`,children:`Responses (/v1/responses)`})]})})]}):null,o===`apiKey`?J(V,{label:`API key`,children:e=>J(B,{...e,type:`password`,value:ee,autoComplete:`off`,onChange:e=>ne(e.target.value)})}):null,J(V,{label:`Label`,hint:`How this account is named in the rack. Defaults to the provider.`,children:e=>J(B,{...e,value:c,placeholder:Z[i],onChange:e=>l(e.target.value)})})]}):Y(p,{$gap:3,children:[Y(p,{$gap:1,children:[J(u,{children:`Step 1 — authorize`}),J(b,{$gap:2,children:Y(y,{as:`a`,href:d.authorizeUrl,target:`_blank`,rel:`noreferrer noopener`,$variant:`primary`,$size:`sm`,children:[J(je,{}),`Open `,Z[i]]})}),J(te,{value:d.authorizeUrl,label:`Copy authorization link`})]}),d.userCode===null?null:Y(p,{$gap:1,children:[J(u,{children:`Step 2 — enter this code`}),J(ze,{children:d.userCode})]}),d.kind===`device`?Y(Ve,{children:[Ie[i],` Waiting for authorization…`]}):J(V,{label:`Authorization code`,hint:Ie[i],...j===null?{}:{problem:j},children:e=>J(B,{...e,value:m,autoFocus:!0,placeholder:Le[i]??`code#state`,onChange:e=>g(e.target.value)})})]}),j===null||d?.kind===`pkce`?null:J(Be,{children:j})]})})}var Ue=[`axis`],We=Oe((e,n)=>Ee.createElement(t,{chartName:`LineChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:Ue,tooltipPayloadSearcher:a,categoricalChartProps:e,ref:n})),Ge=X(b)`
21
- gap: ${({theme:e})=>e.space(5)};
22
- flex-wrap: wrap;
23
- `,Q=X.div`
24
- display: flex;
25
- flex-direction: column;
26
- gap: 2px;
27
- `,$=X.span`
28
- font-size: 11.5px;
29
- color: ${({theme:e})=>e.color.inkDim};
30
- `,Ke={budget:`1 4`,projection:`6 4`},qe=`projected`;function Je(e){let t=new Map;for(let{key:n,points:r}of e)for(let e of r){let r=t.get(e.at)??{at:e.at};r[n]=e.percent,t.set(e.at,r)}return[...t.values()].sort((e,t)=>e.at-t.at)}function Ye(e,t,n){return[Math.min(e,...n.map(e=>e.pace.from.at)),Math.max(t,...n.map(e=>e.pace.to.at))]}function Xe(e,t){let n=t?.windowStartsAt??null;return n===null||e.resetsAt===null?null:n-(e.resetsAt-n)}function Ze({credentialId:e,windows:t,burn:n,pollIntervalMs:r,now:i}){let a=t.map(e=>{let t=L(n,e.windowType);return{window:e,estimate:t,since:Xe(e,t)}}),o=a.map(e=>e.since).filter(e=>e!==null),s=o.length===0?0:Math.min(...o),c=d({credentialId:e,since:s},o.length>0),l=c.data?.samples??[],u=c.data?.gatewayRates??[];return J(p,{$gap:4,children:a.map(e=>J($e,{window:e.window,estimate:e.estimate,since:e.since,samples:l.filter(t=>t.windowType===e.window.windowType&&t.observedAt>=(e.since??0)),gatewayRate:u.find(t=>t.windowType===e.window.windowType),pollIntervalMs:r,now:i},e.window.windowType))})}function Qe(e,t,n){let r=ge(e,t);return r===`ok`?`lasts the window`:r!==`empty`||t.exhaustsAt===null?`unknown`:t.exhaustsAt<=n?`empty now`:`empty ~${me(t.exhaustsAt-n)} before it resets`}function $e({window:t,estimate:a,since:d,samples:f,gatewayRate:h,pollIntervalMs:g,now:_}){let v=ce[t.windowType],y=t.limit===null?`${F(t.used)} used`:`${F(t.used)} of ${F(t.limit)} used`;if(a===void 0||a.stale||fe(t,_,g))return Y(p,{$gap:2,children:[Y(b,{$gap:2,$wrap:!0,children:[Y(u,{children:[v,` window`]}),J($,{children:y})]}),J($,{children:`reading is stale`})]});let x=pe(ae(f),t),S=x.flatMap(e=>{let t=oe(e);return t===null?[]:[{key:`${e.key}-budget`,pace:t}]}),C=ue(t,a),w=Je([...x,...S.map(e=>({key:e.key,points:[e.pace.from,e.pace.to]})),...C===null?[]:[{key:qe,points:[C.from,C.to]}]]),T=new Set(x.map(e=>e.key)),E=Math.max(100,...C===null?[]:[C.from.percent,C.to.percent].map(e=>Math.ceil(e)));return Y(p,{$gap:2,children:[Y(b,{$gap:2,$wrap:!0,children:[Y(u,{children:[v,` window`]}),J($,{children:y})]}),Y(Ge,{children:[Y(Q,{children:[J(u,{children:`Window average`}),J(m,{children:a.ratePerHour===null?`unknown`:`${F(a.ratePerHour)}/h`})]}),Y(Q,{children:[J(u,{children:`Estimate`}),J(m,{children:Qe(t,a,_)})]}),Y(Q,{children:[J(u,{children:`Projected`}),J(m,{children:C===null?`unknown`:`${Math.round(C.to.percent)}% of limit by reset`})]}),Y(Q,{children:[J(u,{children:`This gateway accounts for`}),J(m,{children:h?.gatewayRatePerHour===void 0||h.gatewayRatePerHour===null?`unknown`:`${F(h.gatewayRatePerHour)} tokens/h`})]})]}),t.limit===null?J($,{children:`no ceiling reported`}):t.resetsAt===null||d===null?J($,{children:`no reset reported`}):x.length===0?J($,{children:`not yet observed`}):Y(q,{children:[J(u,{children:[`Used, this window and the one before`,...S.length===0?[]:[`budget dotted`],...C===null?[]:[`projection dashed`]].join(` · `)}),J(c,{$height:160,children:J(s,{width:`100%`,height:`100%`,children:Y(We,{data:w,margin:{top:4,right:8,bottom:4,left:4},children:[J(e,{stroke:`var(--rule)`,vertical:!1}),J(i,{dataKey:`at`,type:`number`,scale:`time`,domain:Ye(d,t.resetsAt,S),tickFormatter:e=>he(e),tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,minTickGap:40}),J(l,{domain:[0,E],allowDataOverflow:!0,tickFormatter:e=>`${Math.round(e)}%`,tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,width:40}),J(r,{cursor:{stroke:`var(--rule-strong)`},content:({active:e,payload:t})=>{if(e!==!0||t===void 0||t.length===0)return null;let n=t.find(e=>T.has(String(e.dataKey)));if(n===void 0||typeof n.value!=`number`)return null;let r=n.payload.at;return Y(o,{children:[J(`div`,{children:he(r)}),Y(`div`,{children:[n.value.toFixed(1),`% used`]})]})}}),x.map(e=>J(n,{type:`monotone`,dataKey:e.key,stroke:`var(--accent)`,strokeWidth:2,dot:e.points.length===1&&{r:2.5,fill:`var(--accent)`,stroke:`var(--accent)`},connectNulls:!0,isAnimationActive:!1},e.key)),S.map(e=>J(n,{type:`linear`,dataKey:e.key,stroke:`var(--ink-faint)`,strokeWidth:1.5,strokeDasharray:Ke.budget,dot:!1,connectNulls:!0,isAnimationActive:!1},e.key)),C===null?null:J(n,{type:`linear`,dataKey:qe,stroke:`var(--ink-dim)`,strokeWidth:1.5,strokeDasharray:Ke.projection,dot:!1,connectNulls:!0,isAnimationActive:!1})]})})})]})]})}var et=[`anthropic`,`openai`,`kimi`,`kilo`,`grok`,`custom`],tt={anthropic:`Anthropic`,openai:`OpenAI`,kimi:`Kimi`,kilo:`Kilo`,grok:`Grok`,custom:`OpenAI Compatible`},nt=X(H)`
31
- border-left: 3px solid ${({theme:e,$provider:t})=>e.provider[t]};
32
- `,rt=X(B)`
33
- width: 100%;
34
- min-width: 140px;
35
- height: 26px;
36
- font-family: ${({theme:e})=>e.font.sans};
37
- font-size: 12.5px;
38
- background: transparent;
39
- border-color: transparent;
40
-
41
- &:hover:not(:disabled),
42
- &:focus {
43
- background: ${({theme:e})=>e.color.panelSunk};
44
- border-color: ${({theme:e})=>e.color.ruleStrong};
45
- }
46
- `,it=X(ve)`
47
- width: 62px;
48
- height: 26px;
49
- `,at=X.span`
50
- display: block;
51
- padding-left: 9px;
52
- font-size: 11px;
53
- color: ${({theme:e})=>e.color.inkDim};
54
- `,ot=X.div`
55
- display: grid;
56
- grid-template-columns: 96px 1fr;
57
- align-items: center;
58
- min-width: 208px;
59
- gap: 6px;
60
- `,st=X.div`
61
- display: flex;
62
- flex-direction: column;
63
- gap: 4px;
64
- `;function ct(){let e=f();return{pending:e.isPending,commit:(t,n)=>{e.mutate({id:t,patch:n})}}}function lt(){let{cadence:e}=D(),t=g(),n=_(e(1e4)),r=E(),i=T(),{commit:a}=ct(),[o,s]=K(!1),[c,l]=K(null),[d,f]=K(new Set),m=e=>f(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),h=Date.now(),v=t.data??[],x=R(n.data?.health??[],e=>e.credentialId),C=R(n.data?.quota??[],e=>e.credentialId),O=R(n.data?.burn??[],e=>e.credentialId),te=r.data?.quotaPollIntervalMs??3e5,re=v.filter(e=>e.enabled).length,F=t.isLoading?`Reading connected accounts…`:v.length===0?`No provider credentials are connected, so every request fails at the router.`:`${re} of ${v.length} accounts are enabled and eligible for routing.`;return Y(q,{children:[J(k,{legend:`Accounts`,title:`Provider accounts`,summary:F,actions:Y(y,{type:`button`,$variant:`primary`,onClick:()=>s(!0),children:[J(ne,{}),`Connect an account`]})}),t.isError?J(H,{legend:`Accounts`,children:J(be,{error:t.error,onRetry:()=>void t.refetch()})}):t.isLoading?J(H,{legend:`Accounts`,children:J(xe,{rows:5})}):v.length===0?J(H,{legend:`Accounts`,children:J(Se,{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:J(y,{type:`button`,$variant:`primary`,$size:`sm`,onClick:()=>s(!0),children:`Connect an account`})})}):J(p,{$gap:4,children:et.filter(e=>v.some(t=>t.provider===e)).map(e=>{let t=v.filter(t=>t.provider===e);return J(nt,{$provider:e,legend:tt[e],meta:`${t.length} account${t.length===1?``:`s`}`,flush:!0,children:J(S,{children:Y(we,{children:[J(`thead`,{children:Y(`tr`,{children:[J(G,{$width:`24%`,children:`Account`}),J(G,{$width:`20%`,children:`Sign-in`}),J(G,{$align:`right`,$width:`86px`,children:`Tier`}),J(G,{$align:`right`,$width:`94px`,children:`Weight`}),J(G,{$align:`center`,$width:`86px`,children:`Enabled`}),J(G,{$width:`240px`,children:`Quota`}),J(G,{$align:`right`,$width:`88px`,children:`TTFT`}),J(G,{$align:`right`,$width:`130px`,children:`Token expires`}),J(G,{$width:`76px`})]})}),J(`tbody`,{children:t.map(e=>{let t=le(x.get(e.id)??[],h,e.enabled,e.disabledReason),n=C.get(e.id)??[],r=O.get(e.id)??[],i=ie(n),o=d.has(e.id);return Y(De,{children:[Y(Ce,{children:[Y(W,{children:[Y(b,{$gap:2,children:[J(de,{state:t.state,label:t.note===``?`healthy`:t.note}),J(rt,{defaultValue:e.label,"aria-label":`Label for ${e.label}`,onBlur:t=>{let n=t.target.value.trim();if(n.length===0||n===e.label){t.target.value=e.label;return}a(e.id,{label:n})}})]}),t.note===``?null:J(at,{children:t.note})]}),J(W,{children:Y(b,{$gap:1,children:[J(_e,{children:e.authType===`oauth`?`oauth`:`api key`}),e.accountEmail===null?null:J(u,{children:e.accountEmail})]})}),J(W,{$align:`right`,children:J(it,{min:1,step:1,defaultValue:e.tier,"aria-label":`Tier for ${e.label}`,onBlur:t=>{let n=Number(t.target.value);if(!Number.isInteger(n)||n<1||n===e.tier){t.target.value=String(e.tier);return}a(e.id,{tier:n})}})}),J(W,{$align:`right`,children:J(it,{min:.1,step:.1,defaultValue:e.weight,"aria-label":`Weight for ${e.label}`,onBlur:t=>{let n=Number(t.target.value);if(!Number.isFinite(n)||n<=0||n===e.weight){t.target.value=String(e.weight);return}a(e.id,{weight:n})}})}),J(W,{$align:`center`,children:J(M,{checked:e.enabled,label:`Route to ${e.label}`,onCheckedChange:t=>a(e.id,{enabled:t})})}),J(W,{children:i.length===0?J(u,{children:`unknown`}):J(st,{children:i.map(({window:e,fraction:t})=>Y(ot,{children:[J(ye,{fraction:t,label:`${ce[e.windowType]} window, ${Math.round(t*100)}% used`}),J(u,{children:se(e,h,te,P,L(r,e.windowType))})]},e.windowType))})}),J(W,{$align:`right`,$mono:!0,children:I(t.ttftMs)}),J(W,{$align:`right`,$mono:!0,children:e.expiresAt===null?`never`:P(e.expiresAt,h)}),J(W,{$align:`right`,children:Y(b,{$gap:1,$justify:`flex-end`,children:[n.length===0?null:J(w,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-expanded":o,"aria-label":`${o?`Hide`:`Show`} quota history for ${e.label}`,title:`${o?`Hide`:`Show`} quota history for ${e.label}`,onClick:()=>m(e.id),children:J(o?ee:A,{})}),J(w,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Remove ${e.label}`,title:`Remove ${e.label}`,onClick:()=>l(e),children:J(j,{})})]})})]}),o?J(Ce,{children:J(W,{colSpan:9,children:J(Ze,{credentialId:e.id,windows:n,burn:r,pollIntervalMs:te,now:h})})}):null]},e.id)})})]})})},e)})}),J(He,{open:o,credentials:t.data??[],onOpenChange:s,onConnected:()=>void t.refetch()}),J(N,{open:c!==null,onOpenChange:e=>{e||l(null)},title:`Remove account`,body:c===null?``:`Removing "${c.label}" deletes its stored token. Any model target pointing at ${tt[c.provider]} loses this account, and reconnecting means authorizing again.`,confirmLabel:`Remove account`,busy:i.isPending,onConfirm:()=>{c!==null&&i.mutate(c.id,{onSettled:()=>l(null)})}})]})}var ut=lt;export{ut as component};
@@ -1,39 +0,0 @@
1
- import{$ as e,H as t,I as n,K as r,M as i,N as a,Q as o,S as s,V as c,_ as l,a as u,at as d,b as f,lt as p,m,nt as h,ot as g,rt as _,st as v,w as y}from"./queries-BOAAI06M.js";import{c as b,t as x}from"./Rack-DhVnjAjC.js";import{t as S}from"./Confirm-BO1xS6uH.js";import{C as ee,E as C,T as w,b as T}from"./Lamp-BDf7-dMa.js";import{r as E,t as D}from"./Field-b0ohzqzR.js";import{t as O}from"./Meter-stpt3vQu.js";import{a as k,i as A,n as j,r as M,t as N}from"./States-6G9NsYha.js";import{i as P,n as F,r as I,t as te}from"./Table-CVDZ69Zx.js";import{t as L}from"./Readout-VYnpaTMg.js";import{n as R}from"./reasons-Cb8yF4Oy.js";import{useQueryClient as ne}from"@tanstack/react-query";import{useCallback as re,useEffect as ie,useState as z}from"react";import{Fragment as ae,jsx as B,jsxs as V}from"react/jsx-runtime";import H from"styled-components";var U=b(`camera`,[[`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`}]]),W=b(`minimize-2`,[[`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`}]]),G=b(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),K=b(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),q={systemd:`systemd is capturing this process, so a restart asks the manager to bring the unit back rather than signalling the gateway itself.`,container:`This gateway is running in a container, so a restart is an exit and the container's restart policy decides what happens next.`,none:`Nothing is supervising this process. It was started directly, and whatever stops it leaves it stopped.`},J=H.p`
2
- font-size: 12px;
3
- color: ${({theme:e})=>e.color.inkDim};
4
- max-width: 72ch;
5
- `,oe=H.p`
6
- font-size: 12px;
7
- color: ${({theme:e})=>e.color.warn};
8
- max-width: 72ch;
9
- `,Y=H.p`
10
- font-size: 12px;
11
- color: ${({theme:e})=>e.color.down};
12
- `,X=H.p`
13
- font-size: 12px;
14
- color: ${({theme:e})=>e.color.inkDim};
15
- ${v}
16
- `,se=9e4;async function ce(){try{return(await fetch(`/health`,{cache:`no-store`})).ok}catch{return!1}}function le({pollMs:t=750}){let n=y(),r=i(),a=c(),[o,s]=z(null),[l,u]=z(!1),[f,m]=z(!1),[g,_]=z(`idle`),v=n.data;ie(()=>{if(!l)return;let e=!1,n,r=!1,i=0,a=Math.max(1,Math.ceil(se/t)),o=async()=>{let s=await ce();if(!e){if(!r&&!s)r=!0,_(`returning`);else if(r&&s){window.location.reload();return}if(i+=1,i>=a){_(`lost`),u(!1);return}n=setTimeout(()=>void o(),t)}};return n=setTimeout(()=>void o(),t),()=>{e=!0,n!==void 0&&clearTimeout(n)}},[l,t]);let b=()=>{_(`leaving`),r.mutate(void 0,{onSuccess:()=>u(!0),onError:()=>_(`idle`)})};return f?B(k,{legend:`Lifecycle`,meta:`stopped`,children:V(d,{$gap:2,children:[B(e,{children:`Gateway stopped`}),V(J,{children:[`The gateway accepted the shutdown and is no longer serving. Nothing on this page will update again, and nothing here can start it: that needs`,` `,v?.supervisor===`container`?`the host that runs this container`:`a shell on the machine it runs on`,`.`]})]})}):V(k,{legend:`Lifecycle`,meta:v?.supervisor,children:[n.isError?B(j,{error:n.error,onRetry:()=>void n.refetch()}):v===void 0?B(M,{rows:2}):V(d,{$gap:3,children:[B(J,{children:q[v.supervisor]}),v.note===void 0?null:B(oe,{children:v.note}),V(h,{$gap:2,children:[V(p,{type:`button`,disabled:!v.canRestart||r.isPending||l,onClick:()=>s(`restart`),children:[B(K,{}),`Restart gateway`]}),V(p,{type:`button`,$variant:`danger`,disabled:!v.canShutdown||a.isPending||l,onClick:()=>s(`shutdown`),children:[B(G,{}),`Shut down gateway`]})]}),g===`leaving`?B(X,{role:`status`,children:`Asked the gateway to restart. Waiting for it to stop answering.`}):g===`returning`?B(X,{role:`status`,children:`The gateway has stopped answering. Waiting for it to come back, then this page reloads.`}):g===`lost`?B(Y,{role:`alert`,children:`The gateway has not come back. Reload this page once it is running again, or check the machine it runs on.`}):null,r.isError?B(Y,{role:`alert`,children:A(r.error)}):null,a.isError?B(Y,{role:`alert`,children:A(a.error)}):null]}),B(S,{open:o===`restart`,onOpenChange:e=>{e||s(null)},title:`Restart gateway`,body:`Requests in flight are dropped when the process goes. This console waits for the gateway to stop answering and to answer again, then reloads itself.`,confirmLabel:`Restart now`,busy:r.isPending,onConfirm:()=>{s(null),b()}}),B(S,{open:o===`shutdown`,onOpenChange:e=>{e||s(null)},title:`Shut down gateway`,body:v?.supervisor===`container`?`Stopping the only process in this container takes this dashboard with it, and the dashboard is what would have restarted the gateway. Unless the container's restart policy brings it back, getting it running again needs access to the host.`:`The gateway stops serving and stays stopped. This console goes with it, so starting the gateway again needs a shell on the machine it runs on.`,confirmLabel:`Shut down now`,busy:a.isPending,onConfirm:()=>{s(null),a.mutate(void 0,{onSuccess:()=>m(!0)})}})]})}var Z=[{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}],ue=H.p`
17
- font-size: 12px;
18
- color: ${({theme:e})=>e.color.down};
19
- `,de=H.p`
20
- font-size: 12px;
21
- color: ${({theme:e})=>e.color.ok};
22
- `,fe=H.div`
23
- display: grid;
24
- grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
25
- gap: ${({theme:e})=>e.space(3)};
26
- `;function pe(e){let t={};for(let n of Z){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 Q({retention:t}){let r=n(),[i,a]=z({}),[o,s]=z(null),[c,l]=z(!1),u={keepLatest:i.keepLatest??(t===void 0?``:String(t.keepLatest)),maxAgeDays:i.maxAgeDays??(t===void 0?``:String(t.maxAgeDays))};return B(k,{legend:`Retention`,actions:B(p,{type:`button`,$size:`sm`,disabled:r.isPending||t===void 0,onClick:()=>{l(!1);let e=pe(u);if(!e.ok){s(e.problem);return}s(null),r.mutate(e.policy,{onSuccess:()=>{l(!0),a({})},onError:e=>s(A(e))})},children:r.isPending?`Saving…`:`Save retention`}),children:V(d,{$gap:3,children:[B(fe,{children:Z.map(t=>B(D,{label:t.label,hint:t.hint,children:n=>V(h,{$gap:2,children:[B(E,{...n,min:1,max:t.max,step:1,value:u[t.id],onChange:e=>a({...i,[t.id]:e.target.value})}),B(e,{children:t.unit})]})},t.id))}),o===null?null:B(ue,{role:`alert`,children:o}),c&&o===null?B(de,{role:`status`,children:`Retention saved.`}):null]})})}function me(){let e=ne();return re(t=>{if(t.adminPasswordChanged){R(`admin-password-changed`);return}e.invalidateQueries()},[e])}var $=H.p`
27
- font-size: 12px;
28
- color: ${({theme:e})=>e.color.down};
29
- `,he=H.input`
30
- font-size: 12px;
31
- color: ${({theme:e})=>e.color.inkDim};
32
- max-width: 40ch;
33
- `;function ge(){let e=t(),n=m(),r=a(),i=me(),o=f(),c=s(),[l,v]=z(null),[y,b]=z(null),[x,C]=z(null),[w,E]=z(!1),O=e.data??[],L=V(p,{type:`button`,$variant:`primary`,$size:`sm`,disabled:n.isPending,onClick:()=>n.mutate(),children:[B(U,{}),n.isPending?`Copying…`:`Take a snapshot`]}),R=V(d,{$gap:2,children:[V(h,{$gap:2,$wrap:!0,children:[B(D,{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=>B(he,{...e,type:`file`,accept:`.sqlite,.db,application/octet-stream`,onChange:e=>C(e.target.files?.[0]??null)})}),B(p,{type:`button`,$variant:`danger`,$size:`sm`,disabled:x===null||c.isPending,onClick:()=>E(!0),children:c.isPending?`Replacing…`:`Import`})]}),c.isError?B($,{role:`alert`,children:A(c.error)}):null,r.isError?B($,{role:`alert`,children:A(r.error)}):null,n.isError?B($,{role:`alert`,children:A(n.error)}):null]});return V(k,{legend:`Snapshots`,meta:`${O.length}`,actions:L,footer:R,flush:!0,children:[e.isError?B(j,{error:e.error,onRetry:()=>void e.refetch()}):e.isLoading?B(`div`,{style:{padding:12},children:B(M,{rows:3})}):O.length===0?B(N,{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:B(p,{type:`button`,$variant:`primary`,$size:`sm`,disabled:n.isPending,onClick:()=>n.mutate(),children:`Take the first snapshot`})}):B(_,{children:V(te,{children:[B(`thead`,{children:V(`tr`,{children:[B(I,{children:`File`}),B(I,{children:`Reason`}),B(I,{$align:`right`,children:`Size`}),B(I,{$align:`right`,children:`Taken`}),B(I,{})]})}),B(`tbody`,{children:O.map(e=>V(P,{children:[B(F,{$mono:!0,children:B(g,{style:{maxWidth:`38ch`,display:`block`},children:e.filename})}),B(F,{children:e.reason}),B(F,{$align:`right`,$mono:!0,children:T(e.sizeBytes)}),B(F,{$align:`right`,$mono:!0,children:ee(e.createdAt)}),B(F,{$align:`right`,children:V(h,{$gap:1,$justify:`flex-end`,children:[B(p,{as:`a`,$size:`sm`,href:u(e.id),download:e.filename,children:`Download`}),B(p,{type:`button`,$variant:`danger`,$size:`sm`,onClick:()=>v(e),children:`Restore`}),B(p,{type:`button`,$variant:`danger`,$size:`sm`,onClick:()=>b(e),children:`Delete`})]})})]},e.id))})]})}),B(S,{open:l!==null,onOpenChange:e=>{e||v(null)},title:`Restore database`,body:l===null?``:`Replacing the live database with ${l.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:r.isPending,onConfirm:()=>{l!==null&&r.mutate(l.id,{onSuccess:i,onSettled:()=>v(null)})}}),B(S,{open:y!==null,onOpenChange:e=>{e||b(null)},title:`Delete snapshot`,body:y===null?``:`Deleting ${y.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:o.isPending,onConfirm:()=>{y!==null&&o.mutate(y.id,{onSettled:()=>b(null)})}}),B(S,{open:w,onOpenChange:E,title:`Import database`,body:x===null?``:`Replacing the live database with ${x.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:c.isPending,onConfirm:()=>{x!==null&&c.mutate(x,{onSuccess:i,onSettled:()=>E(!1)})}})]})}var _e=H.p`
34
- font-size: 12px;
35
- color: ${({theme:e})=>e.color.ok};
36
- `,ve=H.p`
37
- font-size: 12px;
38
- color: ${({theme:e})=>e.color.down};
39
- `;function ye(){let e=l(),t=r(),[n,i]=z(!1),a=e.data,s=a===void 0||a.logicalBytes===0?0:a.freePageBytes/a.logicalBytes;return V(ae,{children:[B(x,{legend:`Database`,title:`Storage, snapshots, and lifecycle`,summary:e.isLoading?`Measuring the database…`:`The one SQLite file this gateway runs from, the copies taken of it, and the controls that stop and start the process.`}),B(k,{legend:`Size`,meta:a===void 0?void 0:`schema v${a.stats.schemaVersion}`,actions:V(p,{type:`button`,$size:`sm`,disabled:t.isPending||a===void 0,onClick:()=>i(!0),children:[B(W,{}),t.isPending?`Compacting…`:`Compact`]}),footer:t.isError?B(ve,{role:`alert`,children:A(t.error)}):t.data===void 0?void 0:B(_e,{role:`status`,children:`Compacted, reclaiming ${T(t.data.reclaimedBytes)} in ${w(t.data.durationMs)}.`}),children:e.isError?B(j,{error:e.error,onRetry:()=>void e.refetch()}):a===void 0?B(M,{rows:3}):V(o,{$min:`180px`,children:[B(L,{legend:`Database file`,value:T(a.fileBytes),unit:`${a.stats.pageCount} pages of ${T(a.stats.pageSize)}`,trace:B(O,{fraction:s,label:`${C(s,0)} of the file is reclaimable`})}),B(L,{legend:`Reclaimable`,value:T(a.freePageBytes),unit:`${a.stats.freelistCount} free pages`}),B(L,{legend:`Write-ahead log`,value:T(a.walBytes),unit:`folded into every snapshot`}),B(L,{legend:`Captured bodies`,value:T(a.bodiesBytes),unit:`never in a snapshot`}),B(L,{legend:`Snapshots`,value:T(a.snapshots.totalBytes),unit:`${a.snapshots.count} kept`}),B(L,{legend:`Free disk`,value:T(a.freeDiskBytes),unit:a.freeDiskBytes===null?`not readable here`:`on this filesystem`})]})}),B(ge,{}),B(Q,{retention:a?.retention}),B(le,{}),B(S,{open:n,onOpenChange:i,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:t.isPending,onConfirm:()=>t.mutate(void 0,{onSettled:()=>i(!1)})})]})}var be=ye;export{be as component};
@@ -1,62 +0,0 @@
1
- import{$ as e,D as t,G as n,O as r,Q as i,at as a,dt as o,et as s,g as c,h as l,it as u,lt as d,nt as f,ot as p,rt as m,z as h}from"./queries-BOAAI06M.js";import{a as g,r as _,t as v}from"./Rack-DhVnjAjC.js";import{n as y,t as b}from"./TokenBreakdown-B9RanXin.js";import{D as x,E as S,O as C,S as w,T,_ as E,a as D,d as O,f as k,g as ee,l as te,m as A,n as j,o as M,r as ne,s as N,t as P,x as F}from"./Lamp-BDf7-dMa.js";import{n as I,t as L}from"./Chip-BltJSw8A.js";import{t as re}from"./Meter-stpt3vQu.js";import{a as R,n as z,t as B}from"./States-6G9NsYha.js";import{i as V,n as H,r as U,t as W}from"./Table-CVDZ69Zx.js";import{t as G}from"./Readout-VYnpaTMg.js";import{Fragment as K,jsx as q,jsxs as J}from"react/jsx-runtime";import Y from"styled-components";var X=Y(p)`
2
- font-weight: 500;
3
- display: block;
4
- max-width: 24ch;
5
- `,Z=Y.span`
6
- font-size: 11px;
7
- color: ${({theme:e})=>e.color.inkDim};
8
- `,ie=Y.div`
9
- display: grid;
10
- grid-template-columns: 72px 1fr;
11
- align-items: center;
12
- gap: 6px;
13
- min-width: 172px;
14
- `,ae=Y.div`
15
- display: flex;
16
- flex-direction: column;
17
- gap: 4px;
18
- `;function oe(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 se(e,t){return e===null?t===null?0:1:t===null?-1:e-t}function ce({credentials:t,health:n,quota:r,burn:i,usage:a,quotaPollIntervalMs:s,now:c}){let l=N(n,e=>e.credentialId),u=N(r,e=>e.credentialId),p=N(i,e=>e.credentialId),h=new Map(a.map(e=>[e.key,e])),g={down:0,warn:1,ok:2,idle:3,live:3},_=t.map(e=>{let t=p.get(e.id)??[];return{credential:e,status:M(l.get(e.id)??[],c,e.enabled,e.disabledReason),quota:ee(u.get(e.id)??[]),burn:t,exhaustsAt:oe(t),usage:h.get(e.id)}}).sort((e,t)=>g[e.status.state]-g[t.status.state]||se(e.exhaustsAt,t.exhaustsAt)||e.credential.tier-t.credential.tier);return q(R,{legend:`Accounts`,meta:`${t.length} connected`,flush:!0,actions:q(d,{as:o,to:`/accounts`,$size:`sm`,children:`Manage accounts`}),children:t.length===0?q(B,{legend:`No accounts`,message:`The gateway has no provider credentials, so every request will fail. Connect one to start routing.`,action:q(d,{as:o,to:`/accounts`,$variant:`primary`,$size:`sm`,children:`Connect an account`})}):q(m,{children:J(W,{children:[q(`thead`,{children:J(`tr`,{children:[q(U,{children:`Account`}),q(U,{children:`Provider`}),q(U,{$align:`right`,children:`Tier`}),q(U,{children:`Quota`}),q(U,{$align:`right`,children:`TTFT`}),q(U,{$align:`right`,children:`Requests`}),q(U,{$align:`right`,children:`Last used`})]})}),q(`tbody`,{children:_.map(({credential:t,status:n,quota:r,burn:i,usage:a})=>J(V,{children:[q(H,{children:J(f,{$gap:2,children:[q(P,{state:n.state,label:n.note===``?`healthy`:n.note}),J(`div`,{children:[q(X,{children:t.label}),n.note===``?null:q(Z,{children:n.note})]})]})}),q(H,{children:q(I,{provider:t.provider})}),q(H,{$align:`right`,$mono:!0,children:t.tier}),q(H,{children:r.length===0?q(Z,{children:`unknown`}):q(ae,{children:r.map(({window:t,fraction:n})=>J(ie,{children:[q(re,{fraction:n,label:`${j[t.windowType]} window, ${Math.round(n*100)}% used`}),q(e,{children:A(t,c,s,x,D(i,t.windowType))})]},t.windowType))})}),q(H,{$align:`right`,$mono:!0,children:T(n.ttftMs)}),q(H,{$align:`right`,$mono:!0,children:a===void 0?`—`:w(a.requests)}),q(H,{$align:`right`,$mono:!0,children:x(n.lastUsedAt,c)})]},t.id))})]})})})}var le=Y.ul`
19
- display: flex;
20
- flex-direction: column;
21
- `,ue=Y.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
- `,de=Y(p)`
32
- font-family: ${({theme:e})=>e.font.mono};
33
- font-size: 12px;
34
- max-width: 30ch;
35
- `,fe=Y(s)`
36
- color: ${({theme:e})=>e.color.down};
37
- font-size: 11px;
38
- `;function Q({logs:e}){let t=e.slice(0,12);return q(R,{legend:`Activity`,meta:`most recent first`,flush:!0,actions:q(d,{as:o,to:`/logs`,$size:`sm`,children:`Open logs`}),children:t.length===0?q(B,{legend:`No traffic yet`,message:`Point a client at this gateway with an API key and the requests will appear here.`}):q(le,{children:t.map(e=>J(ue,{children:[q(P,{state:k(e),label:O(e)}),q(s,{$dim:!0,children:F(e.at)}),q(de,{title:e.requestedModel,children:e.requestedModel||`—`}),e.resolvedProvider===null?null:q(s,{$dim:!0,style:{color:`var(--p-${e.resolvedProvider})`},children:e.resolvedProvider}),q(u,{}),te(e)?q(s,{$dim:!0,"aria-label":`processing`,children:q(b,{})}):J(K,{children:[e.errorCode===null?null:q(fe,{children:e.errorCode}),e.attempts>1?J(s,{$dim:!0,children:[e.attempts,`×`]}):null,q(s,{$dim:!0,children:q(y,{tokens:e})}),q(s,{$dim:!0,children:T(e.durationMs)}),q(s,{$dim:!0,children:C(e.costUsd)})]})]},e.id))})})}var pe=Y.ul`
39
- display: flex;
40
- flex-direction: column;
41
- gap: ${({theme:e})=>e.space(3)};
42
- `,me=Y(p)`
43
- font-family: ${({theme:e})=>e.font.mono};
44
- font-size: 12.5px;
45
- `,he=Y.div`
46
- display: flex;
47
- height: 5px;
48
- border-radius: 2px;
49
- overflow: hidden;
50
- background: ${({theme:e})=>e.color.panelSunk};
51
- border: 1px solid ${({theme:e})=>e.color.rule};
52
- `,ge=Y.div`
53
- flex: ${({$grow:e})=>e} 0 0;
54
- background: ${({$color:e})=>e};
55
- opacity: 0.8;
56
- `,_e=Y.div`
57
- flex: ${({$grow:e})=>e} 0 0;
58
- `;function ve({models:t,logs:n}){let r=new Map;for(let e of n){let t=r.get(e.requestedModel)??{requests:0,costUsd:0};t.requests+=1,t.costUsd+=e.costUsd,r.set(e.requestedModel,t)}let i=Math.max(1,...[...r.values()].map(e=>e.requests)),a=[...t].map(e=>({model:e,used:r.get(e.id)})).sort((e,t)=>(t.used?.requests??0)-(e.used?.requests??0)).slice(0,8);return q(R,{legend:`Models`,meta:`${t.length} configured`,actions:q(d,{as:o,to:`/models`,$size:`sm`,children:`Edit routing`}),children:t.length===0?q(B,{legend:`No models`,message:`Nothing is routable yet. Create a virtual model and point it at one or more provider targets.`,action:q(d,{as:o,to:`/models`,$variant:`primary`,$size:`sm`,children:`Create a model`})}):q(pe,{children:a.map(({model:t,used:n})=>{let r=(n?.requests??0)/i,a=[...new Set(t.targets.map(e=>e.provider))];return J(`li`,{children:[J(f,{$gap:2,children:[q(me,{title:t.id,children:t.id}),t.isAlias?q(L,{children:`alias`}):null,q(L,{$tone:`accent`,children:t.strategy}),q(u,{}),q(s,{$dim:!0,children:w(n?.requests??0)}),q(e,{children:`req`}),q(s,{$dim:!0,children:C(n?.costUsd??0)})]}),J(he,{style:{marginTop:6},title:`${Math.round(r*100)}% of the busiest model`,children:[a.map(e=>q(ge,{$color:`var(--p-${e})`,$grow:r/a.length},e)),q(_e,{$grow:Math.max(0,1-r)})]})]},t.id)})})})}var ye=Y.div`
59
- display: grid;
60
- grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
61
- gap: ${({theme:e})=>e.space(3)};
62
- `;function be({logs:e,windowMs:t,now:n}){let r=e.filter(e=>n-e.at<=t),i=E(r,t),a=ne(r,{now:n,spanMs:t,count:32}),o=i.errorRate>=.25?`down`:i.errorRate>=.05?`warn`:`ok`,s=i.inputTokens+i.outputTokens+i.cacheReadTokens+i.cacheWriteTokens;return J(ye,{children:[q(G,{legend:`Requests`,value:w(i.requests),unit:`${i.ratePerMin.toFixed(1)}/min`,trace:q(_,{values:a.map(e=>e.total),overlay:a.map(e=>e.errors),label:`${i.requests} requests, ${i.errors} of them failed`})}),q(G,{legend:`Error rate`,value:S(i.errorRate),unit:`${w(i.errors)} failed`,tone:i.requests===0?`ink`:o,trace:q(_,{values:a.map(e=>e.errors),scaleTo:Math.max(...a.map(e=>e.total)),color:`var(--down)`,label:`${i.errors} failed requests against ${i.requests} total`})}),q(G,{legend:`Total tokens`,value:w(s),unit:q(y,{tokens:i}),trace:q(_,{values:a.map(e=>e.tokens),label:`token volume over the window, ${s.toLocaleString(`en-US`)} total`})}),q(G,{legend:`Time to first token`,value:T(i.ttftP50),unit:`p95 ${T(i.ttftP95)}`,trace:q(_,{values:a.map(e=>e.ttftMs??0),color:`var(--ok)`,label:`median first-token latency, currently ${T(i.ttftP50)}`})}),q(G,{legend:`Spend`,value:C(i.costUsd),unit:`${w(i.inputTokens+i.outputTokens)} tokens`,trace:q(_,{values:a.map(e=>e.costUsd),color:`var(--warn)`,label:`spend over the window, ${C(i.costUsd)} total`})})]})}var $=36e5;function xe(){let{cadence:e}=g(),o=c(),s=l(e(1e4)),u=r(),d=t(500,e(1e4)),f=h(),p=Date.now(),m=Math.floor((p-$)/6e4)*6e4,_=n({groupBy:`credential`,since:m},e(6e4)),y=o.data??[],b=N(s.data?.health??[],e=>e.credentialId),x=y.filter(e=>M(b.get(e.id)??[],p,e.enabled,e.disabledReason).state===`down`),S=o.isLoading||d.isLoading?`Reading the gateway…`:y.length===0?`No accounts are connected, so every request fails at the router.`:x.length>0?`${x.length} account${x.length===1?` is`:`s are`} out of rotation.`:`All ${y.length} accounts are answering. Nothing needs attention.`;return J(K,{children:[q(v,{legend:`Rack`,title:`Gateway`,summary:S}),d.isError?q(R,{legend:`Traffic`,children:q(z,{legend:`The gateway did not answer`,error:d.error,onRetry:()=>void d.refetch()})}):J(a,{$gap:4,children:[q(be,{logs:d.data??[],windowMs:$,now:p}),q(ce,{credentials:y,health:s.data?.health??[],quota:s.data?.quota??[],burn:s.data?.burn??[],usage:_.data??[],quotaPollIntervalMs:f.data?.quotaPollIntervalMs??3e5,now:p}),J(i,{$min:`340px`,$gap:4,children:[q(ve,{models:u.data??[],logs:d.data??[]}),q(Q,{logs:d.data??[]})]})]})]})}var Se=xe;export{Se as component};