omnigateway 0.4.13 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -1
- package/bin/omni.js +6970 -6733
- package/gateway.js +9440 -8038
- package/package.json +1 -1
- package/public/assets/{CopyValue-C2DkO9Yz.js → CopyValue-DNNJGDI5.js} +5 -5
- package/public/assets/{Field-B79Yxdit.js → Field-B2rnk3JM.js} +1 -1
- package/public/assets/{Match-BWa6L0L1.js → Match-CvkEmOIG.js} +1 -1
- package/public/assets/{Panel-CoulMx6R.js → Panel-BeQOQoap.js} +2 -2
- package/public/assets/Rack-DdhpgQWD.js +316 -0
- package/public/assets/{Readout-D1XEfywe.js → Readout-CZfn5JDy.js} +1 -1
- package/public/assets/RequestTable-I1TrD689.js +11 -0
- package/public/assets/States-2kaQxx-s.js +54 -0
- package/public/assets/SummaryDeck-BisdRswW.js +15 -0
- package/public/assets/{Toggle-CRrH9nDt.js → Toggle-BvOELhpy.js} +1 -1
- package/public/assets/{TokenBreakdown-C2NsJnqO.js → TokenBreakdown-En1JT4tT.js} +1 -1
- package/public/assets/WindowChart-Bvbkz9rt.js +11 -0
- package/public/assets/_app-a3VUev6k.js +1 -0
- package/public/assets/_app.accounts-CYPB-7Xt.js +59 -0
- package/public/assets/_app.console-C4x5F3d0.js +44 -0
- package/public/assets/_app.database-B-9oB52r.js +24 -0
- package/public/assets/_app.index-NBeanmyf.js +62 -0
- package/public/assets/_app.keys-DK9jdOqT.js +82 -0
- package/public/assets/_app.logs-Dr6fApsE.js +58 -0
- package/public/assets/_app.models-CGBQ2QaS.js +148 -0
- package/public/assets/_app.plugins._pluginId-DXzhupNH.js +20 -0
- package/public/assets/_app.settings-zTFRyxhZ.js +58 -0
- package/public/assets/_app.usage-BCCimHY0.js +76 -0
- package/public/assets/chevron-right-mGs1is3r.js +1 -0
- package/public/assets/client-CQGHWD56.js +39 -0
- package/public/assets/index-C3LoGDKu.js +178 -0
- package/public/assets/login-bJoYdBqx.js +45 -0
- package/public/assets/plus-Bqi8Y2Xd.js +1 -0
- package/public/assets/queries-GAue98pY.js +145 -0
- package/public/assets/reasons-Du1OBWAM.js +1 -0
- package/public/assets/shared-DQOWYTp3.js +77 -0
- package/public/assets/stream-Bu-m1Z1Y.js +1 -0
- package/public/assets/{trash-2-DwMK-JrZ.js → trash-2-BDA1rQVQ.js} +1 -1
- package/public/index.html +3 -3
- package/public/shared/dashboard-sdk.js +1 -1
- package/public/assets/Rack-HM36SprU.js +0 -314
- package/public/assets/States-DtkkMzEu.js +0 -54
- package/public/assets/_app-DVpIsUid.js +0 -1
- package/public/assets/_app.accounts-64d_cxir.js +0 -64
- package/public/assets/_app.console-BBuBmLRI.js +0 -44
- package/public/assets/_app.database-J9Ujio8l.js +0 -24
- package/public/assets/_app.index-BX4yKEXO.js +0 -62
- package/public/assets/_app.keys-2sKwhZJc.js +0 -76
- package/public/assets/_app.logs-DuHXYrZU.js +0 -68
- package/public/assets/_app.models-B0kTfPtn.js +0 -148
- package/public/assets/_app.plugins._pluginId-BOXRBToU.js +0 -20
- package/public/assets/_app.settings-DoaOUmc1.js +0 -46
- package/public/assets/_app.usage-B5sxB40E.js +0 -83
- package/public/assets/index-iCfSaRSG.js +0 -178
- package/public/assets/login-B9CJqU--.js +0 -36
- package/public/assets/plus-DKapAGoR.js +0 -1
- package/public/assets/queries-CX9mStps.js +0 -145
- package/public/assets/reasons-Cb8yF4Oy.js +0 -1
- package/public/assets/shared-Cct_4xwp.js +0 -84
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./queries-GAue98pY.js";import{a as t}from"./Rack-DdhpgQWD.js";import{useQueryClient as n}from"@tanstack/react-query";import{createContext as r,use as i,useEffect as a,useRef as o,useState as s,useSyncExternalStore as c}from"react";import{jsx as l}from"react/jsx-runtime";var u=`stream:console`,d={"res:usage":{predicate:e=>e.queryKey[0]===`usage`||e.queryKey[0]===`client`&&(e.queryKey[1]===`usage`||e.queryKey[1]===`summary`)},"res:logs":{predicate:e=>e.queryKey[0]===`logs`&&e.queryKey[1]!==`body`||e.queryKey[0]===`client`&&e.queryKey[1]===`logs`},"res:credentials":{queryKey:e.credentials},"res:keys":{queryKey:e.keys},"res:settings":{queryKey:e.settings},"res:models":{queryKey:e.models},"res:quota":{queryKey:[`quota-history`]},[u]:{queryKey:[`console`]}},f=Object.keys(d),p=f.filter(e=>e.startsWith(`res:`)),m=f.filter(e=>e.startsWith(`stream:`));function h(e,t){if(t===`res:*`){_(e);return}let n=d[t];n!==void 0&&e.invalidateQueries(n)}function g(e){for(let t of f)h(e,t)}function _(e){e.invalidateQueries()}var v=4401,y=500,b=3e4,x=3,S=6e4,C=(e,t)=>{let n=setTimeout(e,t);return()=>clearTimeout(n)};function w(){let{protocol:e,host:t}=window.location;return`${e===`https:`?`wss:`:`ws:`}//${t}/api/stream`}function T(e){if(typeof e!=`string`)return null;let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t||Array.isArray(t))return null;let n=t,{type:r,topic:i,seq:a}=n;return typeof r!=`string`||i!==void 0&&typeof i!=`string`||a!==void 0&&typeof a!=`number`?null:{type:r,...typeof i==`string`?{topic:i}:{},...typeof a==`number`?{seq:a}:{},...`payload`in n?{payload:n.payload}:{}}}function E(e){let t=new Set,n=new Set,r=new Map,i=new Map,a=[],o=null,s=!1,c=!1,l=!1,u=!1,d=!1,f=0,C=null,w={status:`poll`,pushed:()=>!1};function E(){let e=d?`offline`:c&&!u?`push`:`poll`,r=e===`push`;w={status:e,pushed:e=>r&&n.has(e)};for(let e of t)e()}function D(e){o?.send(JSON.stringify(e))}function O(e,t){let n=i.get(e);if(n===void 0||n.size===0)return!1;for(let e of[...n])e(t);return!0}function k(){for(let e of p)D({type:`subscribe`,topic:e});for(let e of m){let t=r.get(e);D(t===void 0?{type:`subscribe`,topic:e}:{type:`subscribe`,topic:e,sinceSeq:t})}}function A(){c=!0,f=0,n.clear(),l&&g(e.client),l=!0,k(),E()}function j(t){let i=T(t.data);if(i===null)return;let{topic:a}=i;if(i.type===`ack`){a!==void 0&&(n.add(a),E());return}if(i.type===`error`){a!==void 0&&n.delete(a)&&E();return}if(a!==void 0){if(i.type===`gap`){i.seq!==void 0&&r.set(a,i.seq),O(a,{kind:`gap`}),h(e.client,a);return}if(i.type===`event`){if(a===`res:*`){_(e.client);return}if(i.seq!==void 0){let t=r.get(a);if(r.set(a,i.seq),t!==void 0&&i.seq>t+1){O(a,{kind:`gap`}),h(e.client,a);return}}i.payload!==void 0&&O(a,{kind:`frame`,payload:i.payload})||h(e.client,a)}}}function M(t){let r=c;if(c=!1,o=null,n.clear(),s){if(t.code===v){d=!0,s=!1,E(),_(e.client);return}if(!r)u=!0;else{let t=e.now();a=[...a.filter(e=>e>t-S),t],a.length>=x&&(u=!0)}E(),N()}}function N(){let t=Math.min(b,y*2**f);f+=1,C=e.timer(()=>{C=null,s&&P()},t)}function P(){let t=new WebSocket(e.url());o=t,t.addEventListener(`open`,A),t.addEventListener(`message`,j),t.addEventListener(`close`,M)}return{subscribe(e){return t.add(e),()=>{t.delete(e)}},snapshot:()=>w,onStream(e,t){let n=i.get(e)??new Set;return i.set(e,n),n.add(t),()=>{n.delete(t),n.size===0&&i.delete(e)}},start(){return s=!0,P(),()=>{s=!1,C?.(),C=null;let e=o;o=null,c=!1,e?.close()}}}}var D=r(null),O=r(null),k={status:`poll`,pushed:()=>!1};function A({children:e,enabled:t=!0,timer:r=C,now:i=Date.now,url:o=w}){let u=n(),[d]=s(()=>E({client:u,timer:r,now:i,url:o}));a(()=>{if(t)return d.start()},[d,t]);let f=c(d.subscribe,d.snapshot,d.snapshot);return l(D,{value:f,children:l(O,{value:d.onStream,children:e})})}function j(){return i(D)??k}function M(e,t){let n=i(O),r=o(t);a(()=>{r.current=t}),a(()=>{if(n!==null)return n(e,e=>r.current(e))},[n,e])}function N({children:e}){let n=j();return l(t,{connection:n,children:e})}export{h as a,u as i,N as n,M as r,A as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{_ as e}from"./Rack-DdhpgQWD.js";var t=e(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]);export{t};
|
package/public/index.html
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
|
|
10
10
|
<title>OmniGateway — One endpoint in front of the AI accounts you already pay for.</title>
|
|
11
11
|
<script type="importmap">{"imports":{"react":"/shared/react.js","react/jsx-runtime":"/shared/jsx-runtime.js","react-dom":"/shared/react-dom.js","react-dom/client":"/shared/react-dom-client.js","styled-components":"/shared/styled-components.js","@tanstack/react-query":"/shared/react-query.js","@omnigateway/dashboard-sdk":"/shared/dashboard-sdk.js"}}</script>
|
|
12
|
-
<script type="module" crossorigin src="/assets/index-
|
|
13
|
-
<link rel="modulepreload" crossorigin href="/assets/queries-
|
|
12
|
+
<script type="module" crossorigin src="/assets/index-C3LoGDKu.js"></script>
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/queries-GAue98pY.js">
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/assets/matchContext-BOenO3J2.js">
|
|
15
|
-
<link rel="modulepreload" crossorigin href="/assets/Match-
|
|
15
|
+
<link rel="modulepreload" crossorigin href="/assets/Match-CvkEmOIG.js">
|
|
16
16
|
<link rel="stylesheet" crossorigin href="/assets/index-Co2s5xMk.css">
|
|
17
17
|
</head>
|
|
18
18
|
<body>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunks/rolldown-runtime-CbXtAM7H.js";import{t}from"./chunks/react-GitiQ0dt.js";var n=`0.1.
|
|
1
|
+
import{n as e}from"./chunks/rolldown-runtime-CbXtAM7H.js";import{t}from"./chunks/react-GitiQ0dt.js";var n=`0.1.2`,r=class extends Error{status;code;constructor(e,t,n){super(n),this.name=`PluginApiError`,this.status=e,this.code=t}get isUnauthenticated(){return this.status===401||this.code===`AUTH`}},i=/%2e/i;function a(e,t){if(t.length===0)throw TypeError(`plugin api ${e} must not be empty`);if(t.startsWith(`/`))throw TypeError(`plugin api ${e} must be relative to the plugin's own prefix, got ${JSON.stringify(t)}`);if(t.includes(`..`)||i.test(t))throw TypeError(`plugin api ${e} must not escape the plugin's own prefix, got ${JSON.stringify(t)}`)}function o(e,t){if(a(`plugin id`,e),e.includes(`/`))throw TypeError(`plugin api plugin id must be a single path segment, got ${e}`);return a(`path`,t),`/api/plugins/${e}/${t}`}function s(e){if(typeof e!=`object`||!e)return!1;let t=e.error;return typeof t!=`object`||!t?!1:typeof t.message==`string`}async function c(e,t,n,i,a){let c=o(e,n),l={method:t,credentials:`same-origin`,headers:i===void 0?{}:{"content-type":`application/json`},...i===void 0?{}:{body:JSON.stringify(i)},...a===void 0?{}:{signal:a}},u=await fetch(c,l),d=null;if(u.status!==204){let e=await u.text();if(e.length>0)try{d=JSON.parse(e)}catch{d=null}}if(!u.ok){let e=s(d)?d.error.code??`INTERNAL`:`INTERNAL`,t=s(d)?d.error.message:`request failed with status ${u.status}`;throw new r(u.status,String(e),t)}return d}function l(e){return a(`plugin id`,e),{get:(t,n)=>c(e,`GET`,t,void 0,n),post:(t,n)=>c(e,`POST`,t,n,void 0),put:(t,n)=>c(e,`PUT`,t,n,void 0),del:t=>c(e,`DELETE`,t,void 0,void 0)}}var u=new Map;function d(e){let t=u.get(e);if(t!==void 0)return t;let n=l(e);return u.set(e,n),n}var f=e(t(),1),p={status:`poll`,pushed:()=>!1},m=(0,f.createContext)(null);function h({children:e,connection:t=p}){let[n,r]=(0,f.useState)(!0),i=(0,f.useCallback)(()=>r(e=>!e),[]),a=(0,f.useMemo)(()=>({live:n,toggle:i,connection:t,cadence:(e,r)=>n?(r===void 0||!t.pushed(r))&&e:!1}),[n,i,t]);return(0,f.createElement)(m,{value:a},e)}function g(){return(0,f.use)(m)??{live:!1,toggle:()=>{},cadence:()=>!1,connection:{status:`offline`,pushed:()=>!1}}}var _=`--rack.--panel.--panel-sunk.--panel-raised.--rule.--rule-strong.--ink.--ink-dim.--ink-faint.--accent.--accent-ink.--accent-wash.--ok.--warn.--down.--ok-wash.--warn-wash.--down-wash.--p-anthropic.--p-openai.--p-kimi.--p-kilo.--p-grok.--p-custom.--grid-line.--shadow`.split(`.`);function v(e){return e}export{_ as CSS_VARIABLES,h as LiveProvider,r as PluginApiError,n as SDK_VERSION,l as createPluginApi,v as definePluginUI,o as pluginApiPath,g as useLive,d as usePluginApi};
|
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
import{$ as e,D as t,E as n,M as r,V as i,at as a,ct as o,dt as s,et as c,ft as l,it as u,k as d,lt as f,nt as p,st as m,ut as h,w as g}from"./queries-CX9mStps.js";import{t as _}from"./index-iCfSaRSG.js";import{A as v,N as y,a as ee,i as b,j as x,s as te,x as ne}from"./States-DtkkMzEu.js";import*as S from"react";import{createContext as C,createElement as w,forwardRef as re,useContext as ie,useEffect as ae,useId as oe,useMemo as se,useState as T}from"react";import{Fragment as ce,jsx as E,jsxs as D}from"react/jsx-runtime";import*as le from"react-dom";import O,{css as ue}from"styled-components";import{LiveProvider as de,useLive as fe}from"@omnigateway/dashboard-sdk";var pe=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),me=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),he=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),ge=e=>{let t=he(e);return t.charAt(0).toUpperCase()+t.slice(1)},_e={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`},ve=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ye=C({}),be=()=>ie(ye),xe=re(({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=``}=be()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return w(`svg`,{ref:c,..._e,width:t??l??_e.width,height:t??l??_e.height,stroke:e??f,strokeWidth:m,className:pe(`lucide`,p,i),...!a&&!ve(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>w(e,t)),...Array.isArray(a)?a:[a]])}),k=(e,t)=>{let n=re(({className:n,...r},i)=>w(xe,{ref:i,iconNode:t,className:pe(`lucide-${me(ge(e))}`,`lucide-${e}`,n),...r}));return n.displayName=ge(e),n},Se=k(`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`}]]),Ce=k(`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`}]]),we=k(`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`}]]),Te=k(`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`}]]),Ee=k(`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=k(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),Oe=k(`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`}]]),ke=k(`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`}]]),Ae=k(`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`}]]),je=k(`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`}]]),Me=k(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Ne=k(`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`}]]),Pe=k(`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`}]]),Fe=k(`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`}]]),Ie=k(`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`}]]),Le=k(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Re=k(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),ze=Object.defineProperty,Be=(e,t)=>ze(e,`name`,{value:t,configurable:!0});function Ve(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}Be(Ve,`setRef`);function He(...e){return t=>{let n=!1,r=e.map(e=>{let r=Ve(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Ve(e[t],null)}}}}Be(He,`composeRefs`);function A(...e){return S.useCallback(He(...e),e)}Be(A,`useComposedRefs`);var Ue=Object.defineProperty,j=(e,t)=>Ue(e,`name`,{value:t,configurable:!0});function We(e){let t=S.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];Qe(r)&&typeof nt==`function`&&(r=nt(r._payload)),S.Children.forEach(r,e=>{if(Xe(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;Qe(n)&&typeof nt==`function`&&(n=nt(n._payload)),a=qe(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=S.cloneElement(a,void 0,s):!o&&S.Children.count(r)===1&&S.isValidElement(r)&&(a=r);let c=a?Ye(a):void 0,l=A(n,c);if(!a){if(r||r===0)throw Error(o?tt(e):et(e));return r}let u=Je(i,a.props??{});return a.type!==S.Fragment&&(u.ref=n?l:c),S.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}j(We,`createSlot`);var Ge=Symbol.for(`radix.slottable`);function Ke(e){let t=j(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=Ge,t}j(Ke,`createSlottable`);var qe=j((e,t)=>{if(`child`in e.props){let t=e.props.child;return S.isValidElement(t)?S.cloneElement(t,void 0,e.props.children(t.props.children)):null}return S.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function Je(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}j(Je,`mergeProps`);function Ye(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)}j(Ye,`getElementRef`);function Xe(e){return S.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Ge}j(Xe,`isSlottable`);var Ze=Symbol.for(`react.lazy`);function Qe(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Ze&&`_payload`in e&&$e(e._payload)}j(Qe,`isLazyComponent`);function $e(e){return typeof e==`object`&&!!e&&`then`in e}j($e,`isPromiseLike`);var et=j(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),tt=j(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),nt=S.use,rt=Object.defineProperty,it=(e,t)=>rt(e,`name`,{value:t,configurable:!0}),M=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=We(`Primitive.${t}`),r=S.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),E(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function at(e,t){e&&le.flushSync(()=>e.dispatchEvent(t))}it(at,`dispatchDiscreteCustomEvent`);var ot=Object.defineProperty,N=(e,t)=>ot(e,`name`,{value:t,configurable:!0});function st(e,t){let n=S.createContext(t);n.displayName=e+`Context`;let r=N(e=>{let{children:t,...r}=e,i=S.useMemo(()=>r,Object.values(r));return E(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=S.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return N(i,`useContext`),[r,i]}N(st,`createContext`);function ct(e,t=[]){let n=[];function r(t,r){let i=S.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=N(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=S.useMemo(()=>o,Object.values(o));return E(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=S.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return N(s,`useContext`),[o,s]}N(r,`createContext`);let i=N(()=>{let t=n.map(e=>S.createContext(e));return N(function(n){let r=n?.[e]||t;return S.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,lt(i,...t)]}N(ct,`createContextScope`);function lt(...e){let t=e[0];if(e.length===1)return t;let n=N(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return N(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return S.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}N(lt,`composeContextScopes`);var ut=Object.defineProperty,P=(e,t)=>ut(e,`name`,{value:t,configurable:!0}),dt=!!(typeof window<`u`&&window.document&&window.document.createElement);function F(e,t,{checkForDefaultPrevented:n=!0}={}){return P(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}P(F,`composeEventHandlers`);function ft(e){if(!dt)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}P(ft,`getOwnerWindow`);function pt(e){if(!dt)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}P(pt,`getOwnerDocument`);function mt(e,t=!1){let{activeElement:n}=pt(e);if(!n?.nodeName)return null;if(ht(n)&&n.contentDocument)return mt(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=pt(n).getElementById(e);if(t)return t}}return n}P(mt,`getActiveElement`);function ht(e){return e.tagName===`IFRAME`}P(ht,`isFrame`);var I=globalThis?.document?S.useLayoutEffect:()=>{},gt=Object.defineProperty,_t=(e,t)=>gt(e,`name`,{value:t,configurable:!0}),vt=S.useEffectEvent,yt=S.useInsertionEffect;function bt(e){if(typeof vt==`function`)return vt(e);let t=S.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof yt==`function`?yt(()=>{t.current=e}):I(()=>{t.current=e}),S.useMemo(()=>((...e)=>t.current?.(...e)),[])}_t(bt,`useEffectEvent`);var xt=Object.defineProperty,L=(e,t)=>xt(e,`name`,{value:t,configurable:!0}),St=S.useInsertionEffect||I;function Ct({prop:e,defaultProp:t,onChange:n=L(()=>{},`onChange`),caller:r}){let[i,a,o]=wt({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,S.useCallback(t=>{if(s){let n=Tt(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}L(Ct,`useControllableState`);function wt({defaultProp:e,onChange:t}){let[n,r]=S.useState(e),i=S.useRef(n),a=S.useRef(t);return St(()=>{a.current=t},[t]),S.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}L(wt,`useUncontrolledState`);function Tt(e){return typeof e==`function`}L(Tt,`isFunction`);var Et=Symbol(`RADIX:SYNC_STATE`);function Dt(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=bt(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=S.useReducer((t,n)=>{if(n.type===Et)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=S.useRef(p);S.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=S.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return S.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:Et,state:i})},[i,d.state,c]),[h,f]}L(Dt,`useControllableStateReducer`);var Ot=Object.defineProperty,R=(e,t)=>Ot(e,`name`,{value:t,configurable:!0});function kt(e,t){return S.useReducer((e,n)=>t[e][n]??e,e)}R(kt,`useStateMachine`);var At=R(e=>{let{present:t,children:n}=e,r=jt(t),i=typeof n==`function`?n({present:r.isPresent}):S.Children.only(n),a=Nt(r.ref,Pt(i));return typeof n==`function`||r.isPresent?S.cloneElement(i,{ref:a}):null},`Presence`);function jt(e){let[t,n]=S.useState(),r=S.useRef(null),i=S.useRef(e),a=S.useRef(`none`),o=S.useRef(void 0),[s,c]=kt(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return S.useEffect(()=>{s===`mounted`?(a.current=o.current??z(r.current),o.current=void 0):a.current=`none`},[s]),I(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=z(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),I(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=R(a=>{let o=z(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`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=R(e=>{e.target===t&&(a.current=z(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)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:S.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=z(t)}else r.current=null;n(e)},[])}}R(jt,`usePresence`);function Mt(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}R(Mt,`setRef`);function Nt(...e){let t=S.useRef(e);return t.current=e,S.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=Mt(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():Mt(n[e],null)}}},[])}R(Nt,`useStableComposedRefs`);function z(e){return e?.animationName||`none`}R(z,`getAnimationName`);function Pt(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)}R(Pt,`getElementRef`);var Ft=Object.defineProperty,It=(e,t)=>Ft(e,`name`,{value:t,configurable:!0}),Lt=S.useId||(()=>void 0),Rt=0;function zt(e){let[t,n]=S.useState(Lt());return I(()=>{e||n(e=>e??String(Rt++))},[e]),e||(t?`radix-${t}`:``)}It(zt,`useId`);var Bt=Object.defineProperty,Vt=(e,t)=>Bt(e,`name`,{value:t,configurable:!0});function B(e){let t=S.useRef(e);return S.useEffect(()=>{t.current=e}),S.useMemo(()=>((...e)=>t.current?.(...e)),[])}Vt(B,`useCallbackRef`);var Ht=Object.defineProperty,V=(e,t)=>Ht(e,`name`,{value:t,configurable:!0}),Ut=`dismissableLayer.update`,Wt=`dismissableLayer.pointerDownOutside`,Gt=`dismissableLayer.focusOutside`,Kt,qt=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Jt=S.forwardRef(V(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=S.useContext(qt),[d,f]=S.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=S.useState({}),h=A(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,ee=u.layersWithOutsidePointerEventsDisabled.size>0,b=y>=v,x=S.useRef(!1),te=Zt(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:x,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:S.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return b&&!t},[u.branches,b])}),ne=Qt(e=>{if(r&&x.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),C=d?y===g.length-1:!1,w=B(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return S.useEffect(()=>{if(C)return p.addEventListener(`keydown`,w,{capture:!0}),()=>p.removeEventListener(`keydown`,w,{capture:!0})},[p,C,w]),S.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Kt=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),$t(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Kt))}},[d,p,n,u]),S.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),$t())},[d,u]),S.useEffect(()=>{let e=V(()=>m({}),`handleUpdate`);return document.addEventListener(Ut,e),()=>document.removeEventListener(Ut,e)},[]),E(M.div,{...l,ref:h,style:{pointerEvents:ee?b?`auto`:`none`:void 0,...e.style},onFocusCapture:F(e.onFocusCapture,ne.onFocusCapture),onBlurCapture:F(e.onBlurCapture,ne.onBlurCapture),onPointerDownCapture:F(e.onPointerDownCapture,te.onPointerDownCapture)})},`DismissableLayer`));function Yt(){let e=S.useContext(qt),[t,n]=S.useState(null);return S.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}V(Yt,`useDismissableLayerSurface`);var Xt=V(()=>!0,`IS_TRUE`);function Zt(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Xt}=t,s=B(e),c=S.useRef(!1),l=S.useRef(!1),u=S.useRef(new Map),d=S.useRef(()=>{});return S.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}V(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}V(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)}V(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}V(p,`handleInteractionBubble`);let m=V(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||en(Wt,s,p,{discrete:!0})};if(V(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:V(()=>c.current=!0,`onPointerDownCapture`)}}V(Zt,`usePointerDownOutside`);function Qt(e,t=globalThis?.document){let n=B(e),r=S.useRef(!1);return S.useEffect(()=>{let e=V(e=>{e.target&&!r.current&&en(Gt,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:V(()=>r.current=!0,`onFocusCapture`),onBlurCapture:V(()=>r.current=!1,`onBlurCapture`)}}V(Qt,`useFocusOutside`);function $t(){let e=new CustomEvent(Ut);document.dispatchEvent(e)}V($t,`dispatchUpdate`);function en(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?at(i,a):i.dispatchEvent(a)}V(en,`handleAndDispatchCustomEvent`);var tn=Object.defineProperty,H=(e,t)=>tn(e,`name`,{value:t,configurable:!0}),nn=`focusScope.autoFocusOnMount`,rn=`focusScope.autoFocusOnUnmount`,an={bubbles:!1,cancelable:!0},on=S.forwardRef(H(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=S.useState(null),l=B(i),u=B(a),d=S.useRef(null),f=A(t,c),p=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:U(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||U(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&U(s)};H(e,`handleFocusIn`),H(t,`handleFocusOut`),H(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),S.useEffect(()=>{if(s){pn.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(nn,an);s.addEventListener(nn,l),s.dispatchEvent(t),t.defaultPrevented||(sn(gn(ln(s)),{select:!0}),document.activeElement===e&&U(s))}return()=>{s.removeEventListener(nn,l),setTimeout(()=>{let t=new CustomEvent(rn,an);s.addEventListener(rn,u),s.dispatchEvent(t),t.defaultPrevented||U(e??document.body,{select:!0}),s.removeEventListener(rn,u),pn.remove(p)},0)}}},[s,l,u,p]);let m=S.useCallback(e=>{if(!n&&!r||p.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]=cn(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&U(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&U(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return E(M.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})},`FocusScope`));function sn(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(U(r,{select:t}),document.activeElement!==n)return}H(sn,`focusFirst`);function cn(e){let t=ln(e);return[un(t,e),un(t.reverse(),e)]}H(cn,`getTabbableEdges`);function ln(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:H(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}H(ln,`getTabbableCandidates`);function un(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):dn(r,{upTo:t})))return r}H(un,`findVisible`);function dn(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}H(dn,`isHidden`);function fn(e){return e instanceof HTMLInputElement&&`select`in e}H(fn,`isSelectableInput`);function U(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&fn(e)&&t&&e.select()}}H(U,`focus`);var pn=mn();function mn(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=hn(e,t),e.unshift(t)},remove(t){e=hn(e,t),e[0]?.resume()}}}H(mn,`createFocusScopesStack`);function hn(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}H(hn,`arrayRemove`);function gn(e){return e.filter(e=>e.tagName!==`A`)}H(gn,`removeLinks`);var _n=Object.defineProperty,vn=S.forwardRef(((e,t)=>_n(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=S.useState(!1);I(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?le.createPortal(E(M.div,{...r,ref:t}),o):null},`Portal`)),yn=Object.defineProperty,bn=(e,t)=>yn(e,`name`,{value:t,configurable:!0}),xn=0,W=null;function Sn(e){return Cn(),e.children}bn(Sn,`FocusGuards`);function Cn(){S.useEffect(()=>{W||={start:wn(),end:wn()};let{start:e,end:t}=W;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),xn++,()=>{xn===1&&(W?.start.remove(),W?.end.remove(),W=null),xn=Math.max(0,xn-1)}},[])}bn(Cn,`useFocusGuards`);function wn(){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}bn(wn,`createFocusGuard`);var G=function(){return G=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},G.apply(this,arguments)};function Tn(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 En(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 Dn=`right-scroll-bar-position`,On=`width-before-scroll-bar`,kn=`with-scroll-bars-hidden`,An=`--removed-body-scroll-bar-size`;function jn(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Mn(e,t){var n=T(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 Nn=typeof window<`u`?S.useLayoutEffect:S.useEffect,Pn=new WeakMap;function Fn(e,t){var n=Mn(t||null,function(t){return e.forEach(function(e){return jn(e,t)})});return Nn(function(){var t=Pn.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||jn(e,null)}),i.forEach(function(e){r.has(e)||jn(e,a)})}Pn.set(n,e)},[e]),n}function In(e){return e}function Ln(e,t){t===void 0&&(t=In);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 Rn(e){e===void 0&&(e={});var t=Ln(null);return t.options=G({async:!0,ssr:!1},e),t}var zn=function(e){var t=e.sideCar,n=Tn(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 S.createElement(r,G({},n))};zn.isSideCarExport=!0;function Bn(e,t){return e.useMedium(t),zn}var Vn=Rn(),Hn=function(){},Un=S.forwardRef(function(e,t){var n=S.useRef(null),r=S.useState({onScrollCapture:Hn,onWheelCapture:Hn,onTouchMoveCapture:Hn}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,ee=Tn(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),b=f,x=Fn([n,t]),te=G(G({},ee),i);return S.createElement(S.Fragment,null,u&&S.createElement(b,{sideCar:Vn,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?S.cloneElement(S.Children.only(s),G(G({},te),{ref:x})):S.createElement(v,G({},te,{className:c,ref:x}),s))});Un.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Un.classNames={fullWidth:On,zeroRight:Dn};var Wn,Gn=function(){if(Wn)return Wn;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Kn(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Gn();return t&&e.setAttribute(`nonce`,t),e}function qn(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Jn(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Yn=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Kn())&&(qn(t,n),Jn(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Xn=function(){var e=Yn();return function(t,n){S.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Zn=function(){var e=Xn();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Qn={left:0,top:0,right:0,gap:0},$n=function(e){return parseInt(e||``,10)||0},er=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[$n(n),$n(r),$n(i)]},tr=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Qn;var t=er(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])}},nr=Zn(),K=`data-scroll-locked`,rr=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
|
-
.${kn} {
|
|
3
|
-
overflow: hidden ${r};
|
|
4
|
-
padding-right: ${s}px ${r};
|
|
5
|
-
}
|
|
6
|
-
body[${K}] {
|
|
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
|
-
.${Dn} {
|
|
20
|
-
right: ${s}px ${r};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.${On} {
|
|
24
|
-
margin-right: ${s}px ${r};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.${Dn} .${Dn} {
|
|
28
|
-
right: 0 ${r};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.${On} .${On} {
|
|
32
|
-
margin-right: 0 ${r};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
body[${K}] {
|
|
36
|
-
${An}: ${s}px;
|
|
37
|
-
}
|
|
38
|
-
`},ir=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},ar=function(){S.useEffect(function(){return document.body.setAttribute(K,(ir()+1).toString()),function(){var e=ir()-1;e<=0?document.body.removeAttribute(K):document.body.setAttribute(K,e.toString())}},[])},or=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;ar();var a=S.useMemo(function(){return tr(i)},[i]);return S.createElement(nr,{styles:rr(a,!t,i,n?``:`!important`)})},sr=!1;if(typeof window<`u`)try{var cr=Object.defineProperty({},"passive",{get:function(){return sr=!0,!0}});window.addEventListener(`test`,cr,cr),window.removeEventListener(`test`,cr,cr)}catch{sr=!1}var q=sr?{passive:!1}:!1,lr=function(e){return e.tagName===`TEXTAREA`},ur=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!lr(e)&&n[t]===`visible`)},dr=function(e){return ur(e,`overflowY`)},fr=function(e){return ur(e,`overflowX`)},pr=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),gr(e,r)){var i=_r(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},mr=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},hr=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},gr=function(e,t){return e===`v`?dr(t):fr(t)},_r=function(e,t){return e===`v`?mr(t):hr(t)},vr=function(e,t){return e===`h`&&t===`rtl`?-1:1},yr=function(e,t,n,r,i){var a=vr(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=_r(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&gr(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},br=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},xr=function(e){return[e.deltaX,e.deltaY]},Sr=function(e){return e&&`current`in e?e.current:e},Cr=function(e,t){return e[0]===t[0]&&e[1]===t[1]},wr=function(e){return`
|
|
39
|
-
.block-interactivity-${e} {pointer-events: none;}
|
|
40
|
-
.allow-interactivity-${e} {pointer-events: all;}
|
|
41
|
-
`},Tr=0,J=[];function Er(e){var t=S.useRef([]),n=S.useRef([0,0]),r=S.useRef(),i=S.useState(Tr++)[0],a=S.useState(Zn)[0],o=S.useRef(e);S.useEffect(function(){o.current=e},[e]),S.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=En([e.lockRef.current],(e.shards||[]).map(Sr),!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=S.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=br(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=pr(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=pr(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 yr(h,t,e,h===`h`?s:c,!0)},[]),c=S.useCallback(function(e){var n=e;if(!(!J.length||J[J.length-1]!==a)){var r=`deltaY`in n?xr(n):br(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Cr(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Sr).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=S.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Dr(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=S.useCallback(function(e){n.current=br(e),r.current=void 0},[]),d=S.useCallback(function(t){l(t.type,xr(t),t.target,s(t,e.lockRef.current))},[]),f=S.useCallback(function(t){l(t.type,br(t),t.target,s(t,e.lockRef.current))},[]);S.useEffect(function(){return J.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,q),document.addEventListener(`touchmove`,c,q),document.addEventListener(`touchstart`,u,q),function(){J=J.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,q),document.removeEventListener(`touchmove`,c,q),document.removeEventListener(`touchstart`,u,q)}},[]);var p=e.removeScrollBar,m=e.inert;return S.createElement(S.Fragment,null,m?S.createElement(a,{styles:wr(i)}):null,p?S.createElement(or,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Dr(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Or=Bn(Vn,Er),kr=S.forwardRef(function(e,t){return S.createElement(Un,G({},e,{ref:t,sideCar:Or}))});kr.classNames=Un.classNames;var Ar=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Y=new WeakMap,jr=new WeakMap,Mr={},Nr=0,Pr=function(e){return e&&(e.host||Pr(e.parentNode))},Fr=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Pr(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})},Ir=function(e,t,n,r){var i=Fr(t,Array.isArray(e)?e:[e]);Mr[n]||(Mr[n]=new WeakMap);var a=Mr[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=(Y.get(e)||0)+1,l=(a.get(e)||0)+1;Y.set(e,c),a.set(e,l),o.push(e),c===1&&i&&jr.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(),Nr++,function(){o.forEach(function(e){var t=Y.get(e)-1,i=a.get(e)-1;Y.set(e,t),a.set(e,i),t||(jr.has(e)||e.removeAttribute(r),jr.delete(e)),i||e.removeAttribute(n)}),Nr--,Nr||(Y=new WeakMap,Y=new WeakMap,jr=new WeakMap,Mr={})}},Lr=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Ar(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Ir(r,i,n,`aria-hidden`)):function(){return null}},Rr=Object.defineProperty,X=(e,t)=>Rr(e,`name`,{value:t,configurable:!0}),zr=`Dialog`,[Br,Vr]=ct(zr),[Hr,Z]=Br(zr),Ur=X(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=S.useRef(null),c=S.useRef(null),[l,u]=Ct({prop:r,defaultProp:i??!1,onChange:a,caller:zr}),[d,f]=S.useState(0),[p,m]=S.useState(0);return E(Hr,{scope:t,triggerRef:s,contentRef:c,contentId:zt(),titleId:zt(),descriptionId:zt(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:S.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),Wr=`DialogPortal`,[Gr,Kr]=Br(Wr,{forceMount:void 0}),qr=X(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Z(Wr,t);return E(Gr,{scope:t,forceMount:n,children:S.Children.map(r,e=>E(At,{present:n||a.open,children:E(vn,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Jr=`DialogOverlay`,Yr=S.forwardRef(X(function(e,t){let n=Kr(Jr,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Z(Jr,e.__scopeDialog);return a.modal?E(At,{present:r||a.open,children:E(Zr,{...i,ref:t})}):null},`DialogOverlay`)),Xr=We(`DialogOverlay.RemoveScroll`),Zr=S.forwardRef(X(function(e,t){let{__scopeDialog:n,...r}=e,i=Z(Jr,n),a=A(t,Yt());return E(kr,{as:Xr,allowPinchZoom:!0,shards:[i.contentRef],children:E(M.div,{"data-state":ci(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Q=`DialogContent`,Qr=S.forwardRef(X(function(e,t){let n=Kr(Q,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Z(Q,e.__scopeDialog);return E(At,{present:r||a.open,children:a.modal?E($r,{...i,ref:t}):E(ei,{...i,ref:t})})},`DialogContent`)),$r=S.forwardRef(X(function(e,t){let n=Z(Q,e.__scopeDialog),r=S.useRef(null),i=A(t,n.contentRef,r);return S.useEffect(()=>{let e=r.current;if(e)return Lr(e)},[]),E(ti,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:F(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:F(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:F(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),ei=S.forwardRef(X(function(e,t){let n=Z(Q,e.__scopeDialog),r=S.useRef(!1),i=S.useRef(!1);return E(ti,{...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`)),ti=S.forwardRef(X(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Z(Q,n);return Cn(),E(ce,{children:E(on,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:E(Jt,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":ci(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),ni=`DialogTitle`,ri=S.forwardRef(X(function(e,t){let{__scopeDialog:n,...r}=e,i=Z(ni,n),{setTitleCount:a}=i;return I(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),E(M.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),ii=`DialogDescription`,ai=S.forwardRef(X(function(e,t){let{__scopeDialog:n,...r}=e,i=Z(ii,n),{setDescriptionCount:a}=i;return I(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),E(M.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),oi=`DialogClose`,si=S.forwardRef(X(function(e,t){let{__scopeDialog:n,...r}=e,i=Z(oi,n);return E(M.button,{type:`button`,...r,ref:t,onClick:F(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function ci(e){return e?`open`:`closed`}X(ci,`getState`);var li=O(Yr)`
|
|
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
|
-
`,ui=O(Qr)`
|
|
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
|
-
`,di=O.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
|
-
`,fi=O.div`
|
|
69
|
-
padding: ${({theme:e})=>e.space(3)};
|
|
70
|
-
overflow-y: auto;
|
|
71
|
-
`,pi=O.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
|
-
`,mi=O(ai)`
|
|
79
|
-
margin: 0 0 ${({theme:e})=>e.space(3)};
|
|
80
|
-
font-size: 12px;
|
|
81
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
82
|
-
`;function hi({open:t,onOpenChange:n,title:r,description:i,footer:a,width:o=`560px`,children:s}){return E(Ur,{open:t,onOpenChange:n,children:D(qr,{children:[E(li,{}),D(ui,{$width:o,children:[D(di,{children:[E(ri,{asChild:!0,children:E(e,{as:`h2`,children:r})}),E(u,{}),E(si,{asChild:!0,children:E(h,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Close`,children:E(Re,{})})})]}),D(fi,{children:[i===void 0?null:E(mi,{children:i}),s]}),a===void 0?null:E(pi,{children:a})]})]})})}var gi=O.p`
|
|
83
|
-
font-size: 13px;
|
|
84
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
85
|
-
`;function _i({open:e,onOpenChange:t,title:n,body:r,confirmLabel:i,busy:a,onConfirm:o}){return E(hi,{open:e,onOpenChange:t,title:n,width:`420px`,footer:D(ce,{children:[E(f,{type:`button`,onClick:()=>t(!1),children:`Cancel`}),E(f,{type:`button`,$variant:`danger`,disabled:a===!0,onClick:o,children:i})]}),children:E(gi,{children:r})})}var vi=O.svg`
|
|
86
|
-
display: block;
|
|
87
|
-
width: 100%;
|
|
88
|
-
height: 100%;
|
|
89
|
-
overflow: visible;
|
|
90
|
-
`;function yi(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 bi({values:e,overlay:t,height:n=28,color:r,overlayColor:i,scaleTo:a,label:o,className:s}){let c=oe(),l=a===void 0?Math.max(1,...e,...t??[]):Math.max(1,a),u=yi(e,100,n,l),d=u.length===0?``:`${u} L100,${n} L0,${n} Z`;return D(vi,{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:yi(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 xi=O.header`
|
|
91
|
-
grid-area: chassis;
|
|
92
|
-
display: flex;
|
|
93
|
-
align-items: center;
|
|
94
|
-
gap: ${({theme:e})=>e.space(3)};
|
|
95
|
-
height: 48px;
|
|
96
|
-
padding: 0 ${({theme:e})=>e.space(3)};
|
|
97
|
-
border-bottom: 1px solid ${({theme:e})=>e.color.rule};
|
|
98
|
-
background: ${({theme:e})=>e.color.panel};
|
|
99
|
-
${o}
|
|
100
|
-
position: sticky;
|
|
101
|
-
top: 0;
|
|
102
|
-
z-index: ${({theme:e})=>e.z.chassis};
|
|
103
|
-
`,Si=O.div`
|
|
104
|
-
display: flex;
|
|
105
|
-
align-items: baseline;
|
|
106
|
-
gap: 7px;
|
|
107
|
-
font-stretch: 74%;
|
|
108
|
-
font-weight: 700;
|
|
109
|
-
letter-spacing: 0.2em;
|
|
110
|
-
font-size: 12px;
|
|
111
|
-
text-transform: uppercase;
|
|
112
|
-
flex: none;
|
|
113
|
-
`,Ci=O(p)`
|
|
114
|
-
gap: ${({theme:e})=>e.space(3)};
|
|
115
|
-
overflow: hidden;
|
|
116
|
-
|
|
117
|
-
@media (max-width: 860px) {
|
|
118
|
-
display: none;
|
|
119
|
-
}
|
|
120
|
-
`,$=O.div`
|
|
121
|
-
display: flex;
|
|
122
|
-
align-items: baseline;
|
|
123
|
-
gap: 6px;
|
|
124
|
-
padding-left: ${({theme:e})=>e.space(3)};
|
|
125
|
-
border-left: 1px solid ${({theme:e})=>e.color.rule};
|
|
126
|
-
white-space: nowrap;
|
|
127
|
-
`,wi=O($)`
|
|
128
|
-
width: 96px;
|
|
129
|
-
align-items: center;
|
|
130
|
-
`,Ti=O.div`
|
|
131
|
-
flex: 1;
|
|
132
|
-
min-width: 0;
|
|
133
|
-
`,Ei=O(f)`
|
|
134
|
-
gap: 6px;
|
|
135
|
-
font-family: ${({theme:e})=>e.font.mono};
|
|
136
|
-
letter-spacing: 0.08em;
|
|
137
|
-
`,Di=[`system`,`light`,`dark`],Oi={system:`Match system theme`,light:`Light theme`,dark:`Dark theme`},ki=6e5;function Ai(){let r=l(),{live:i,toggle:a,cadence:o}=fe(),{mode:s,setMode:d}=_(),f=n(),p=t(200,o(1e4)),m=Date.now(),g=se(()=>(p.data??[]).filter(e=>m-e.at<=ki),[p.data,m]),b=ne(g,ki),S=te(g,{now:m,spanMs:ki,count:24}),C=Di[(Di.indexOf(s)+1)%Di.length]??`system`,w=s===`light`?Ie:s===`dark`?je:Ae,re=p.isError||b.errorRate>=.25?`down`:b.errorRate>=.05?`warn`:g.length===0?`idle`:`ok`;return D(xi,{children:[D(Si,{children:[E(ee,{state:re,label:p.isError?`gateway unreachable`:`error rate ${x(b.errorRate)}`}),`Omnigateway`]}),D(Ci,{children:[D(wi,{children:[E(e,{children:`req`}),E(Ti,{children:E(bi,{values:S.map(e=>e.total),overlay:S.map(e=>e.errors),height:22,label:`${b.requests} requests in the last 10 minutes`})})]}),D($,{children:[E(e,{children:`rate`}),E(c,{children:b.ratePerMin.toFixed(1)}),E(e,{children:`/min`})]}),D($,{children:[E(e,{children:`err`}),E(c,{style:{color:b.errorRate>=.05?`var(--down)`:void 0},children:x(b.errorRate)})]}),D($,{children:[E(e,{children:`ttft p50`}),E(c,{children:v(b.ttftP50)})]}),D($,{children:[E(e,{children:`spend`}),E(c,{children:y(b.costUsd)})]})]}),E(u,{}),D(Ei,{type:`button`,$size:`sm`,onClick:a,"aria-pressed":i,title:i?`Pause polling`:`Resume polling`,children:[E(ee,{state:i?`ok`:`idle`,label:i?`polling`:`paused`}),i?`LIVE`:`PAUSED`]}),E(h,{type:`button`,$variant:`ghost`,$size:`sm`,onClick:()=>d(C),"aria-label":Oi[s],title:`${Oi[s]} — switch to ${Oi[C].toLowerCase()}`,children:E(w,{})}),E(h,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Sign out`,title:`Sign out`,disabled:f.isPending,onClick:()=>{f.mutate(void 0,{onSuccess:()=>void r({to:`/login`})})},children:E(ke,{})})]})}function ji(e){return`/plugins/${e}`}function Mi(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:Ni(e)}))}function Ni(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 Pi={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.`},Fi=O.hr`
|
|
138
|
-
flex: none;
|
|
139
|
-
border: 0;
|
|
140
|
-
margin: 0;
|
|
141
|
-
height: 1px;
|
|
142
|
-
align-self: stretch;
|
|
143
|
-
background: ${({theme:e})=>e.color.rule};
|
|
144
|
-
|
|
145
|
-
/* The rail turns on its side below 720px, and so does the rule that closes it. */
|
|
146
|
-
@media (max-width: 720px) {
|
|
147
|
-
height: auto;
|
|
148
|
-
width: 1px;
|
|
149
|
-
margin-left: ${({theme:e})=>e.space(2)};
|
|
150
|
-
}
|
|
151
|
-
`,Ii=O.div`
|
|
152
|
-
display: flex;
|
|
153
|
-
flex-direction: column;
|
|
154
|
-
gap: 6px;
|
|
155
|
-
padding-top: ${({theme:e})=>e.space(2)};
|
|
156
|
-
|
|
157
|
-
@media (max-width: 720px) {
|
|
158
|
-
padding-top: 0;
|
|
159
|
-
padding-left: ${({theme:e})=>e.space(2)};
|
|
160
|
-
flex-direction: row;
|
|
161
|
-
align-items: center;
|
|
162
|
-
}
|
|
163
|
-
`,Li=O(f)`
|
|
164
|
-
justify-content: flex-start;
|
|
165
|
-
width: 100%;
|
|
166
|
-
|
|
167
|
-
@media (max-width: 720px) {
|
|
168
|
-
width: auto;
|
|
169
|
-
}
|
|
170
|
-
`,Ri=O.p`
|
|
171
|
-
font-size: 10.5px;
|
|
172
|
-
line-height: 1.3;
|
|
173
|
-
color: ${({theme:e})=>e.color.warn};
|
|
174
|
-
`,zi=O.p`
|
|
175
|
-
font-size: 10.5px;
|
|
176
|
-
line-height: 1.3;
|
|
177
|
-
color: ${({theme:e})=>e.color.down};
|
|
178
|
-
`,Bi=O.p`
|
|
179
|
-
font-size: 10.5px;
|
|
180
|
-
line-height: 1.3;
|
|
181
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
182
|
-
${m}
|
|
183
|
-
`,Vi=O.p`
|
|
184
|
-
font-size: 10.5px;
|
|
185
|
-
line-height: 1.3;
|
|
186
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
187
|
-
`,Hi=9e4;async function Ui(){try{return(await fetch(`/health`,{cache:`no-store`})).ok}catch{return!1}}function Wi({pollMs:t=750}){let n=g(),o=r(),s=i(),[c,l]=T(null),[d,f]=T(!1),[p,m]=T(!1),[h,_]=T(`idle`),v=n.data;ae(()=>{if(!d)return;let e=!1,n,r=!1,i=0,a=Math.max(1,Math.ceil(Hi/t)),o=async()=>{let s=await Ui();if(!e){if(!r&&!s)r=!0,_(`returning`);else if(r&&s){window.location.reload();return}if(i+=1,i>=a){_(`lost`),f(!1);return}n=setTimeout(()=>void o(),t)}};return n=setTimeout(()=>void o(),t),()=>{e=!0,n!==void 0&&clearTimeout(n)}},[d,t]);let y=()=>{_(`leaving`),o.mutate(void 0,{onSuccess:()=>f(!0),onError:()=>_(`idle`)})};return p?D(ce,{children:[E(u,{}),E(Fi,{}),E(Ii,{children:D(a,{$gap:1,children:[E(e,{children:`Gateway stopped`}),D(Vi,{children:[`Nothing on this screen 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`,`.`]})]})})]}):D(ce,{children:[E(u,{}),E(Fi,{}),D(Ii,{title:v===void 0?void 0:Pi[v.supervisor],children:[D(Li,{type:`button`,$size:`sm`,"aria-label":`Restart gateway`,disabled:v===void 0||!v.canRestart||o.isPending||d,onClick:()=>l(`restart`),children:[E(Ne,{}),`Restart`]}),D(Li,{type:`button`,$size:`sm`,$variant:`danger`,"aria-label":`Shut down gateway`,disabled:v===void 0||!v.canShutdown||s.isPending||d,onClick:()=>l(`shutdown`),children:[E(Me,{}),`Shut down`]}),v?.note===void 0?null:E(Ri,{children:v.note}),h===`leaving`?E(Bi,{role:`status`,children:`Restarting. Waiting for the gateway to stop answering.`}):h===`returning`?E(Bi,{role:`status`,children:`The gateway has stopped answering. Waiting for it to come back, then this page reloads.`}):h===`lost`?E(zi,{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,o.isError?E(zi,{role:`alert`,children:b(o.error)}):null,s.isError?E(zi,{role:`alert`,children:b(s.error)}):null]}),E(_i,{open:c===`restart`,onOpenChange:e=>{e||l(null)},title:`Restart gateway`,body:`${v===void 0?``:`${Pi[v.supervisor]} `}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:o.isPending,onConfirm:()=>{l(null),y()}}),E(_i,{open:c===`shutdown`,onOpenChange:e=>{e||l(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:s.isPending,onConfirm:()=>{l(null),s.mutate(void 0,{onSuccess:()=>m(!0)})}})]})}var Gi=[{to:`/`,label:`Rack`,blurb:`Live state of every account and model`,Icon:Se},{to:`/accounts`,label:`Accounts`,blurb:`Provider credentials and their health`,Icon:Te},{to:`/models`,label:`Models`,blurb:`Virtual models, targets, and routing`,Icon:we},{to:`/keys`,label:`Keys`,blurb:`Gateway API keys and their limits`,Icon:Oe},{to:`/usage`,label:`Usage`,blurb:`Requests, tokens, and spend over time`,Icon:De},{to:`/logs`,label:`Logs`,blurb:`Recent requests, one row each`,Icon:Pe},{to:`/console`,label:`Console`,blurb:`The gateway's own output, as it was printed`,Icon:Le},{to:`/settings`,label:`Settings`,blurb:`Routing weights, retries, retention`,Icon:Fe},{to:`/database`,label:`Database`,blurb:`Size, snapshots, and retention`,Icon:Ee}],Ki=O.nav`
|
|
188
|
-
grid-area: rail;
|
|
189
|
-
display: flex;
|
|
190
|
-
flex-direction: column;
|
|
191
|
-
gap: 2px;
|
|
192
|
-
padding: ${({theme:e})=>e.space(2)};
|
|
193
|
-
border-right: 1px solid ${({theme:e})=>e.color.rule};
|
|
194
|
-
background: ${({theme:e})=>e.color.panel};
|
|
195
|
-
overflow-y: auto;
|
|
196
|
-
|
|
197
|
-
@media (max-width: 720px) {
|
|
198
|
-
flex-direction: row;
|
|
199
|
-
overflow-x: auto;
|
|
200
|
-
border-right: 0;
|
|
201
|
-
border-bottom: 1px solid ${({theme:e})=>e.color.rule};
|
|
202
|
-
}
|
|
203
|
-
`,qi=ue`
|
|
204
|
-
display: flex;
|
|
205
|
-
align-items: center;
|
|
206
|
-
gap: ${({theme:e})=>e.space(2)};
|
|
207
|
-
padding: 7px ${({theme:e})=>e.space(2)};
|
|
208
|
-
border-radius: ${({theme:e})=>e.radius.control};
|
|
209
|
-
border-left: 2px solid transparent;
|
|
210
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
211
|
-
font-size: 12.5px;
|
|
212
|
-
font-weight: 500;
|
|
213
|
-
white-space: nowrap;
|
|
214
|
-
transition:
|
|
215
|
-
background 120ms ease,
|
|
216
|
-
color 120ms ease;
|
|
217
|
-
|
|
218
|
-
svg {
|
|
219
|
-
width: 15px;
|
|
220
|
-
height: 15px;
|
|
221
|
-
flex: none;
|
|
222
|
-
}
|
|
223
|
-
`,Ji=O(s)`
|
|
224
|
-
${qi}
|
|
225
|
-
|
|
226
|
-
&:hover {
|
|
227
|
-
background: ${({theme:e})=>e.color.panelSunk};
|
|
228
|
-
color: ${({theme:e})=>e.color.ink};
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
&[data-status="active"] {
|
|
232
|
-
background: ${({theme:e})=>e.color.accentWash};
|
|
233
|
-
border-left-color: ${({theme:e})=>e.color.accent};
|
|
234
|
-
color: ${({theme:e})=>e.color.accent};
|
|
235
|
-
}
|
|
236
|
-
`,Yi=O.button`
|
|
237
|
-
${qi}
|
|
238
|
-
align-items: flex-start;
|
|
239
|
-
width: 100%;
|
|
240
|
-
text-align: left;
|
|
241
|
-
white-space: normal;
|
|
242
|
-
background: none;
|
|
243
|
-
border-top: 0;
|
|
244
|
-
border-right: 0;
|
|
245
|
-
border-bottom: 0;
|
|
246
|
-
color: ${({theme:e})=>e.color.inkFaint};
|
|
247
|
-
cursor: not-allowed;
|
|
248
|
-
font-family: inherit;
|
|
249
|
-
|
|
250
|
-
svg {
|
|
251
|
-
margin-top: 2px;
|
|
252
|
-
}
|
|
253
|
-
`,Xi=O.span`
|
|
254
|
-
display: flex;
|
|
255
|
-
flex-direction: column;
|
|
256
|
-
gap: 2px;
|
|
257
|
-
min-width: 0;
|
|
258
|
-
`,Zi=O.span`
|
|
259
|
-
font-size: 10.5px;
|
|
260
|
-
font-weight: 400;
|
|
261
|
-
line-height: 1.3;
|
|
262
|
-
color: ${({theme:e})=>e.color.warn};
|
|
263
|
-
`;function Qi(){let e=d();return D(Ki,{"aria-label":`Console sections`,children:[Gi.map(({to:e,label:t,blurb:n,Icon:r})=>D(Ji,{to:e,title:n,activeOptions:{exact:e===`/`},children:[E(r,{}),t]},e)),Mi(e.data??[]).map(({id:e,label:t,disabledReason:n})=>n===null?D(Ji,{to:ji(e),title:`Provided by the ${e} plugin`,children:[E(Ce,{}),t]},e):D(Yi,{type:`button`,disabled:!0,children:[E(Ce,{}),D(Xi,{children:[t,E(Zi,{children:n})]})]},e)),E(Wi,{})]})}var $i=O.div`
|
|
264
|
-
display: grid;
|
|
265
|
-
grid-template-areas:
|
|
266
|
-
"chassis chassis"
|
|
267
|
-
"rail main";
|
|
268
|
-
grid-template-columns: 168px minmax(0, 1fr);
|
|
269
|
-
grid-template-rows: auto minmax(0, 1fr);
|
|
270
|
-
height: 100vh;
|
|
271
|
-
min-height: 0;
|
|
272
|
-
overflow: hidden;
|
|
273
|
-
|
|
274
|
-
@media (max-width: 720px) {
|
|
275
|
-
grid-template-areas:
|
|
276
|
-
"chassis"
|
|
277
|
-
"rail"
|
|
278
|
-
"main";
|
|
279
|
-
grid-template-columns: minmax(0, 1fr);
|
|
280
|
-
grid-template-rows: auto auto minmax(0, 1fr);
|
|
281
|
-
}
|
|
282
|
-
`,ea=O.main`
|
|
283
|
-
grid-area: main;
|
|
284
|
-
padding: ${({theme:e})=>e.space(4)};
|
|
285
|
-
display: flex;
|
|
286
|
-
flex-direction: column;
|
|
287
|
-
gap: ${({theme:e})=>e.space(4)};
|
|
288
|
-
min-width: 0;
|
|
289
|
-
min-height: 0;
|
|
290
|
-
overflow-y: auto;
|
|
291
|
-
|
|
292
|
-
@media (max-width: 720px) {
|
|
293
|
-
padding: ${({theme:e})=>e.space(3)};
|
|
294
|
-
}
|
|
295
|
-
`;function ta({children:e}){return D($i,{"data-testid":`rack-shell`,children:[E(Ai,{}),E(Qi,{}),E(ea,{children:e})]})}var na=O.div`
|
|
296
|
-
display: flex;
|
|
297
|
-
align-items: flex-end;
|
|
298
|
-
gap: ${({theme:e})=>e.space(3)};
|
|
299
|
-
flex-wrap: wrap;
|
|
300
|
-
`,ra=O.h1`
|
|
301
|
-
font-size: 20px;
|
|
302
|
-
font-weight: 600;
|
|
303
|
-
font-stretch: 88%;
|
|
304
|
-
letter-spacing: -0.01em;
|
|
305
|
-
`,ia=O.p`
|
|
306
|
-
font-size: 13px;
|
|
307
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
308
|
-
max-width: 68ch;
|
|
309
|
-
`,aa=O.div`
|
|
310
|
-
display: flex;
|
|
311
|
-
flex-direction: column;
|
|
312
|
-
gap: 6px;
|
|
313
|
-
min-width: 0;
|
|
314
|
-
`;function oa({legend:t,title:n,summary:r,actions:i}){return D(na,{children:[D(aa,{children:[E(e,{children:t}),E(ra,{children:n}),E(ia,{children:r})]}),E(u,{}),i]})}export{fe as a,Ct as c,ct as d,M as f,k as g,Ee as h,de as i,I as l,Fe as m,ta as n,_i as o,A as p,bi as r,hi as s,oa as t,F as u};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import{$ as e,lt as t,q as n}from"./queries-CX9mStps.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";import a,{css as o,keyframes as s}from"styled-components";var c=new Intl.NumberFormat(`en-US`,{notation:`compact`,maximumFractionDigits:1}),l=new Intl.NumberFormat(`en-US`);function u(e){return Number.isFinite(e)?e<1e4?l.format(Math.round(e)):c.format(e).toLowerCase():`—`}function ee(e){return Number.isFinite(e)?e===0?`$0`:e<.01?`$${e.toFixed(4)}`:e<100?`$${e.toFixed(2)}`:`$${c.format(e).toLowerCase()}`:`—`}function d(e){return e==null||!Number.isFinite(e)?`—`:e<1e3?`${Math.round(e)}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.round(e/6e4)}m`}function f(e,t=1){return Number.isFinite(e)?`${(e*100).toFixed(t)}%`:`—`}var p=[[6e4,1e3,`s`],[36e5,6e4,`m`],[864e5,36e5,`h`],[1/0,864e5,`d`]];function m(e){let t=Math.abs(e);if(t<1e3)return`0s`;let n=p.find(([e])=>t<e);return n===void 0?`—`:`${Math.floor(t/n[1])}${n[2]}`}function h(e,t=Date.now()){if(e==null||!Number.isFinite(e))return`—`;let n=e-t;return Math.abs(n)<5e3?`just now`:n<0?`${m(n)} ago`:`in ${m(n)}`}function g(e){return new Date(e).toLocaleTimeString(`en-GB`,{hour12:!1})}var _=864e5;function v(e,t){let n=new Date(e),r=n.toLocaleTimeString(`en-GB`,{hour:`2-digit`,minute:`2-digit`,hour12:!1});return y(t)?`${n.toLocaleDateString(`en-GB`,{day:`2-digit`,month:`short`})} ${r}`:r}function y(e){return e>=_}function b(e){return e==null||!Number.isFinite(e)?`—`:new Date(e).toLocaleString(`en-GB`,{year:`numeric`,month:`short`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1})}var x=[`B`,`KiB`,`MiB`,`GiB`,`TiB`];function S(e){if(e==null||!Number.isFinite(e))return`—`;if(Math.abs(e)<1024)return`${Math.round(e)} B`;let t=e,n=0;for(;Math.abs(t)>=1024&&n<x.length-1;)t/=1024,n+=1;return`${t.toFixed(1)} ${x[n]}`}function C(e,t=8){return e.length<=t?e:`${e.slice(0,t)}…`}var te={fiveHour:18e6,daily:864e5,weekly:6048e5};function ne(e,t){return t!==null&&t>0?t:te[e]}var w=6e4;function T(e,t){return e===null||t===null?e===t:Math.abs(e-t)<=w}function E(e,t){return t===void 0?`unknown`:e.observedAt>0&&t.stale?`stale`:t.ratePerHour===null||e.limit===null?`unknown`:t.survives===!1&&t.exhaustsAt!==null?`empty`:t.survives===!0?`ok`:`unknown`}function D(e,t){if(e.length===0)return null;let n=[...e].sort((e,t)=>e-t);return n[Math.min(n.length-1,Math.max(0,Math.ceil(t*n.length)-1))]??null}function O(e){return e.state===`pending`}function k(e){return e.filter(e=>!O(e))}function A(e){return O(e)?!1:e.status>=400||e.errorCode!==null}var j={ok:`●`,warn:`◐`,down:`○`,idle:`·`,live:`●`};function M(e){return O(e)?`live`:A(e)?`down`:`ok`}function N(e){return O(e)?`in flight`:A(e)?`failed with ${e.status}`:`succeeded`}function P(e,t){let n=k(e),r=[],i=0,a=0,o=0,s=0,c=0,l=0;for(let e of n)A(e)&&(i+=1),e.ttftMs!==null&&Number.isFinite(e.ttftMs)&&r.push(e.ttftMs),a+=e.costUsd,o+=e.inputTokens,s+=e.outputTokens,c+=e.cacheReadTokens,l+=e.cacheWriteTokens;let u=t/6e4;return{requests:n.length,errors:i,errorRate:n.length===0?0:i/n.length,ratePerMin:u<=0?0:n.length/u,ttftP50:D(r,.5),ttftP95:D(r,.95),costUsd:a,inputTokens:o,outputTokens:s,cacheReadTokens:c,cacheWriteTokens:l}}function F(e,t){let n=k(e),{now:r,spanMs:i,count:a}=t,o=i/a,s=r-i,c=Array.from({length:a},(e,t)=>({at:s+t*o,total:0,errors:0,costUsd:0,tokens:0,ttftMs:null})),l=Array.from({length:a},()=>[]);for(let e of n){if(e.at<s||e.at>r)continue;let t=Math.min(a-1,Math.floor((e.at-s)/o)),n=c[t];n!==void 0&&(n.total+=1,n.costUsd+=e.costUsd,n.tokens+=e.inputTokens+e.outputTokens+e.cacheReadTokens+e.cacheWriteTokens,A(e)&&(n.errors+=1),e.ttftMs!==null&&Number.isFinite(e.ttftMs)&&l[t]?.push(e.ttftMs))}for(let[e,t]of c.entries())t.ttftMs=D(l[e]??[],.5);return c}var I={tokenRejected:`reconnect needed — provider rejected the refresh token`,expiredNoRefresh:`reconnect needed — token expired with nothing to refresh from`};function L(e,t,n,r=null){if(!n){let e=r===`tokenRejected`||r===`expiredNoRefresh`;return{state:e?`down`:`idle`,note:e?I[r]:`disabled`,ttftMs:null,lastUsedAt:null,consecutiveFailures:0}}if(e.length===0)return{state:`idle`,note:`unused`,ttftMs:null,lastUsedAt:null,consecutiveFailures:0};let i=`ok`,a=``,o=null,s=null,c=0;for(let n of e){if(n.ewmaTtftMs!==null&&(o=o===null?n.ewmaTtftMs:Math.max(o,n.ewmaTtftMs)),n.lastUsedAt!==null&&(s=s===null?n.lastUsedAt:Math.max(s,n.lastUsedAt)),c=Math.max(c,n.consecutiveFailures),n.breakerState===`open`){i=`down`,a=`breaker open`;continue}if(n.rateLimitedUntil!==null&&n.rateLimitedUntil>t&&i!==`down`){i=`warn`,a=`rate limited`;continue}n.breakerState===`halfOpen`&&i===`ok`&&(i=`warn`,a=`probing`)}return{state:i,note:a,ttftMs:o,lastUsedAt:s,consecutiveFailures:c}}var R={fiveHour:`5h`,daily:`24h`,weekly:`7d`};function z(e){return Math.max(e,6e4)*3}function B(e,t,n){return e.observedAt<=0||t-e.observedAt>z(n)}function V(e,t){return e.find(e=>e.windowType===t)}function H(e,t,n,r,i){let a=R[e.windowType];if(e.observedAt<=0)return`${a} · never observed`;if(B(e,t,n))return`${a} · stale, read ${r(e.observedAt,t)}`;if(e.resetsAt===null)return a;let o=`resets ${r(e.resetsAt,t)}`;return i===void 0||i.stale||i.survives!==!1||i.exhaustsAt===null?`${a} · ${o}`:`${a} · ${i.exhaustsAt<=t?`empty now`:`empty ~${m(i.exhaustsAt-t)}`} · ${o}`}function re(e){let t=e.filter(e=>e.limit!==null&&e.limit>0).sort((e,t)=>e.observedAt-t.observedAt),n=[],r;for(let e of t){let t={at:e.observedAt,percent:Math.min(100,e.used/e.limit*100)},i={resetsAt:e.resetsAt,startsAt:e.resetsAt===null?null:e.resetsAt-ne(e.windowType,e.windowMs)},a=n[n.length-1];a===void 0||r===void 0||!T(e.resetsAt,r.resetsAt)?n.push({key:`window-${n.length}`,points:[t],...i}):(a.points.push(t),a.resetsAt=i.resetsAt,a.startsAt=i.startsAt),r=e}return n}function U(e,t){let{limit:n,used:r,observedAt:i}=t;if(n===null||n<=0)return[...e];let a=e.findLastIndex(e=>T(e.resetsAt,t.resetsAt)),o=e[a];if(o===void 0)return[...e];let s=o.points[o.points.length-1];if(s===void 0||s.at>=i)return[...e];let c={at:i,percent:Math.min(100,r/n*100)};return e.map((e,t)=>t===a?{...e,points:[...e.points,c]}:e)}function W(e){return e.startsAt===null||e.resetsAt===null?null:{from:{at:e.startsAt,percent:0},to:{at:e.resetsAt,percent:100}}}var G=36e5;function K(e,t){let{limit:n,resetsAt:r,observedAt:i,used:a}=e,o=t.ratePerHour;if(n===null||n<=0||r===null||o===null||o<=0)return null;let s=a/n*100,c=o/n*100;return{from:{at:i,percent:s},to:{at:r,percent:s+c*((r-i)/G)}}}var q={fiveHour:0,daily:1,weekly:2};function J(e){return e.filter(e=>e.limit!==null&&e.limit>0).map(e=>({window:e,fraction:Math.min(1,e.used/e.limit)})).sort((e,t)=>q[e.window.windowType]-q[t.window.windowType])}function Y(e,t){let n=new Map;for(let r of e){let e=t(r),i=n.get(e);i===void 0?n.set(e,[r]):i.push(r)}return n}var X=s`
|
|
2
|
-
0%, 100% { opacity: 1; }
|
|
3
|
-
50% { opacity: 0.28; }
|
|
4
|
-
`,ie=o`
|
|
5
|
-
color: ${({theme:e})=>e.color.ok};
|
|
6
|
-
animation: ${X} 1.2s ease-in-out infinite;
|
|
7
|
-
|
|
8
|
-
@media (prefers-reduced-motion: reduce) {
|
|
9
|
-
animation: none;
|
|
10
|
-
}
|
|
11
|
-
`,ae={ok:o`
|
|
12
|
-
color: ${({theme:e})=>e.color.ok};
|
|
13
|
-
`,warn:o`
|
|
14
|
-
color: ${({theme:e})=>e.color.warn};
|
|
15
|
-
`,down:o`
|
|
16
|
-
color: ${({theme:e})=>e.color.down};
|
|
17
|
-
`,idle:o`
|
|
18
|
-
color: ${({theme:e})=>e.color.inkFaint};
|
|
19
|
-
`,live:ie},oe=a.span`
|
|
20
|
-
font-family: ${({theme:e})=>e.font.mono};
|
|
21
|
-
font-size: 12px;
|
|
22
|
-
line-height: 1;
|
|
23
|
-
flex: none;
|
|
24
|
-
${({$state:e})=>ae[e]}
|
|
25
|
-
`;function se({state:e,label:t,className:n}){return r(oe,{$state:e,className:n,role:`img`,"aria-label":t,title:t,children:j[e]})}var Z=a.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
|
-
`,Q=a.p`
|
|
34
|
-
max-width: 44ch;
|
|
35
|
-
font-size: 13px;
|
|
36
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
37
|
-
`;function ce({legend:t,message:n,action:a}){return i(Z,{children:[r(e,{children:t}),r(Q,{children:n}),a]})}var le=a(Q)`
|
|
38
|
-
color: ${({theme:e})=>e.color.down};
|
|
39
|
-
`;function $(e){return e instanceof n||e instanceof Error?e.message:`The gateway did not answer.`}function ue({legend:n=`Request failed`,error:a,onRetry:o}){return i(Z,{children:[r(e,{children:n}),r(le,{children:$(a)}),o===void 0?null:r(t,{type:`button`,$size:`sm`,onClick:o,children:`Try again`})]})}var de=s`
|
|
40
|
-
0% { opacity: 0.35; }
|
|
41
|
-
50% { opacity: 0.7; }
|
|
42
|
-
100% { opacity: 0.35; }
|
|
43
|
-
`,fe=a.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: ${de} 1.4s ease-in-out infinite;
|
|
49
|
-
`,pe=a.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 me({rows:e=4}){let t=Array.from({length:e},(e,t)=>`row-${t}:${t%3==0?`72%`:`100%`}`);return r(pe,{"aria-hidden":`true`,children:t.map(e=>r(fe,{$width:e.split(`:`)[1]??`100%`},e))})}export{d as A,E as C,u as D,g as E,C as F,h as M,ee as N,b as O,y as P,U as S,v as T,K as _,se as a,J as b,W as c,Y as d,A as f,M as g,N as h,$ as i,f as j,m as k,V as l,B as m,ue as n,R as o,O as p,me as r,F as s,ce as t,L as u,H as v,S as w,P as x,re as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./Match-BWa6L0L1.js";import{i as t,n}from"./Rack-HM36SprU.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-Cct_4xwp.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-CX9mStps.js";import{a as D,g as O,o as k,s as ee,t as A}from"./Rack-HM36SprU.js";import{n as te,r as ne,t as re}from"./CopyValue-C2DkO9Yz.js";import{t as j}from"./plus-DKapAGoR.js";import{t as M}from"./trash-2-DwMK-JrZ.js";import{t as N}from"./Toggle-CRrH9nDt.js";import{A as P,C as F,D as I,M as L,O as ie,P as ae,S as oe,T as se,_ as ce,a as le,b as ue,c as de,d as R,i as z,k as fe,l as pe,m as me,n as he,o as ge,r as _e,t as ve,u as ye,v as be,y as xe}from"./States-DtkkMzEu.js";import{t as Se}from"./Chip-BltJSw8A.js";import{i as B,n as V,r as Ce,t as H}from"./Field-B79Yxdit.js";import{t as we}from"./Meter-stpt3vQu.js";import{t as U}from"./Panel-CoulMx6R.js";import{i as Te,n as W,r as G,t as Ee}from"./Table-CVDZ69Zx.js";import{t as De}from"./catalog-BBKm8Ih8.js";import*as Oe from"react";import{Fragment as ke,forwardRef as Ae,useCallback as je,useEffect as Me,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 Ne=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`}]]),Pe=Object.keys(De);function Fe(e){return De[e].authTypes}function Ie(e){return Fe(e).includes(`oauth`)?`oauth`:`apiKey`}var Le={oauth:`Authorize in the browser`,apiKey:`Paste an API key`},Z={anthropic:`Anthropic`,openai:`OpenAI`,kimi:`Kimi`,kilo:`Kilo`,grok:`Grok`,custom:`OpenAI Compatible`},Re={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.`},ze={openai:`http://localhost:1455/auth/callback?code=…`,grok:`http://127.0.0.1:56121/callback?code=…`},Be=X.ol`
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
gap: ${({theme:e})=>e.space(3)};
|
|
5
|
-
`,Ve=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
|
-
`,He=X.p`
|
|
15
|
-
font-size: 12px;
|
|
16
|
-
color: ${({theme:e})=>e.color.down};
|
|
17
|
-
`,Ue=X.p`
|
|
18
|
-
font-size: 12px;
|
|
19
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
20
|
-
`;function We({open:e,credentials:t,onOpenChange:n,onConnected:r}){let[i,a]=K(`anthropic`),[o,s]=K(Ie(`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`),[te,ne]=K(``),[j,M]=K(null),N=C(),P=v(),F=h(),I=je(()=>{f(null),g(``),S(``),E(``),O(``),A(`chat_completions`),ne(``),M(null),l(``),N.reset(),P.reset(),F.reset()},[N,P,F]),L=je(e=>{e||I(),n(e)},[n,I]);return Me(()=>{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(z(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(ee,{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:te,label:c.trim()||void 0,...i===`custom`?{endpointId:_,endpointLabel:T,origin:D,protocol:k}:{}},{onSuccess:()=>{I(),n(!1),r()},onError:e=>M(z(e))});return}N.mutate({provider:i,label:c.trim().length===0?Z[i]:c.trim()},{onSuccess:e=>f(e),onError:e=>M(z(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(z(e))}))},children:P.isPending?`Finishing…`:`Finish connecting`})]}),children:Y(Be,{children:[d===null?Y(p,{$gap:3,children:[J(H,{label:`Provider`,children:e=>J(B,{...e,value:i,onChange:e=>{let t=e.target.value;a(t),s(Ie(t))},children:Pe.map(e=>J(`option`,{value:e,children:Z[e]},e))})}),Fe(i).length>1?J(H,{label:`How to connect`,children:e=>J(B,{...e,value:o,onChange:e=>s(e.target.value),children:Fe(i).map(e=>J(`option`,{value:e,children:Le[e]},e))})}):null,i===`custom`?Y(q,{children:[w.length===0?null:J(H,{label:`Existing endpoint`,children:e=>Y(B,{...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)+String(t.providerData.basePath??``)),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(H,{label:`Endpoint ID`,children:e=>J(V,{...e,value:_,onChange:e=>S(e.target.value)})}),J(H,{label:`Endpoint label`,children:e=>J(V,{...e,value:T,onChange:e=>E(e.target.value)})}),J(H,{label:`Server URL`,children:e=>J(V,{...e,value:D,placeholder:`https://server.example/api`,onChange:e=>O(e.target.value)})}),D.trim().toLowerCase().startsWith(`http://`)?J(He,{children:`Plaintext transport sends prompts and API keys without TLS.`}):null,J(H,{label:`Protocol`,children:e=>Y(B,{...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(H,{label:`API key`,children:e=>J(V,{...e,type:`password`,value:te,autoComplete:`off`,onChange:e=>ne(e.target.value)})}):null,J(H,{label:`Label`,hint:`How this account is named in the rack. Defaults to the provider.`,children:e=>J(V,{...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(Ne,{}),`Open `,Z[i]]})}),J(re,{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(Ve,{children:d.userCode})]}),d.kind===`device`?Y(Ue,{children:[Re[i],` Waiting for authorization…`]}):J(H,{label:`Authorization code`,hint:Re[i],...j===null?{}:{problem:j},children:e=>J(V,{...e,value:m,autoFocus:!0,placeholder:ze[i]??`code#state`,onChange:e=>g(e.target.value)})})]}),j===null||d?.kind===`pkce`?null:J(He,{children:j})]})})}var Ge=[`axis`],Ke=Ae((e,n)=>Oe.createElement(t,{chartName:`LineChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:Ge,tooltipPayloadSearcher:a,categoricalChartProps:e,ref:n})),qe=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
|
-
`,Je={budget:`1 4`,projection:`6 4`},Ye=`projected`;function Xe(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 Ze(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 Qe(e,t){let n=t?.windowStartsAt??null;return n===null||e.resetsAt===null?null:n-(e.resetsAt-n)}function $e({credentialId:e,windows:t,burn:n,pollIntervalMs:r,now:i}){let a=t.map(e=>{let t=pe(n,e.windowType);return{window:e,estimate:t,since:Qe(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(tt,{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 et(e,t,n){let r=F(e,t);return r===`ok`?`lasts the window`:r!==`empty`||t.exhaustsAt===null?`unknown`:t.exhaustsAt<=n?`empty now`:`empty ~${fe(t.exhaustsAt-n)} before it resets`}function tt({window:t,estimate:a,since:d,samples:f,gatewayRate:h,pollIntervalMs:g,now:_}){let v=ge[t.windowType],y=t.limit===null?`${I(t.used)} used`:`${I(t.used)} of ${I(t.limit)} used`;if(a===void 0||a.stale||me(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=oe(xe(f),t),S=x.flatMap(e=>{let t=de(e);return t===null?[]:[{key:`${e.key}-budget`,pace:t}]}),C=ce(t,a),w=Xe([...x,...S.map(e=>({key:e.key,points:[e.pace.from,e.pace.to]})),...C===null?[]:[{key:Ye,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))),D=d===null||t.resetsAt===null?null:Ze(d,t.resetsAt,S);return Y(p,{$gap:2,children:[Y(b,{$gap:2,$wrap:!0,children:[Y(u,{children:[v,` window`]}),J($,{children:y})]}),Y(qe,{children:[Y(Q,{children:[J(u,{children:`Window average`}),J(m,{children:a.ratePerHour===null?`unknown`:`${I(a.ratePerHour)}/h`})]}),Y(Q,{children:[J(u,{children:`Estimate`}),J(m,{children:et(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`:`${I(h.gatewayRatePerHour)} tokens/h`})]})]}),t.limit===null?J($,{children:`no ceiling reported`}):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(Ke,{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:D,tickFormatter:e=>se(e,D[1]-D[0]),tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,minTickGap:ae(D[1]-D[0])?80: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:ie(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:Je.budget,dot:!1,connectNulls:!0,isAnimationActive:!1},e.key)),C===null?null:J(n,{type:`linear`,dataKey:Ye,stroke:`var(--ink-dim)`,strokeWidth:1.5,strokeDasharray:Je.projection,dot:!1,connectNulls:!0,isAnimationActive:!1})]})})})]})]})}var nt=[`anthropic`,`openai`,`kimi`,`kilo`,`grok`,`custom`],rt={anthropic:`Anthropic`,openai:`OpenAI`,kimi:`Kimi`,kilo:`Kilo`,grok:`Grok`,custom:`OpenAI Compatible`},it=X(U)`
|
|
31
|
-
border-left: 3px solid ${({theme:e,$provider:t})=>e.provider[t]};
|
|
32
|
-
`,at=X(V)`
|
|
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
|
-
`,ot=X(Ce)`
|
|
47
|
-
width: 62px;
|
|
48
|
-
height: 26px;
|
|
49
|
-
`,st=X.span`
|
|
50
|
-
display: block;
|
|
51
|
-
padding-left: 9px;
|
|
52
|
-
font-size: 11px;
|
|
53
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
54
|
-
`,ct=X.div`
|
|
55
|
-
display: grid;
|
|
56
|
-
grid-template-columns: 96px 1fr;
|
|
57
|
-
align-items: center;
|
|
58
|
-
min-width: 208px;
|
|
59
|
-
gap: 6px;
|
|
60
|
-
`,lt=X.div`
|
|
61
|
-
display: flex;
|
|
62
|
-
flex-direction: column;
|
|
63
|
-
gap: 4px;
|
|
64
|
-
`;function ut(){let e=f();return{pending:e.isPending,commit:(t,n)=>{e.mutate({id:t,patch:n})}}}function dt(){let{cadence:e}=D(),t=g(),n=_(e(1e4)),r=E(),i=T(),{commit:a}=ut(),[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),ee=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(A,{legend:`Accounts`,title:`Provider accounts`,summary:F,actions:Y(y,{type:`button`,$variant:`primary`,onClick:()=>s(!0),children:[J(j,{}),`Connect an account`]})}),t.isError?J(U,{legend:`Accounts`,children:J(he,{error:t.error,onRetry:()=>void t.refetch()})}):t.isLoading?J(U,{legend:`Accounts`,children:J(_e,{rows:5})}):v.length===0?J(U,{legend:`Accounts`,children:J(ve,{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:nt.filter(e=>v.some(t=>t.provider===e)).map(e=>{let t=v.filter(t=>t.provider===e);return J(it,{$provider:e,legend:rt[e],meta:`${t.length} account${t.length===1?``:`s`}`,flush:!0,children:J(S,{children:Y(Ee,{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=ye(x.get(e.id)??[],h,e.enabled,e.disabledReason),n=C.get(e.id)??[],r=O.get(e.id)??[],i=ue(n),o=d.has(e.id);return Y(ke,{children:[Y(Te,{children:[Y(W,{children:[Y(b,{$gap:2,children:[J(le,{state:t.state,label:t.note===``?`healthy`:t.note}),J(at,{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(st,{children:t.note})]}),J(W,{children:Y(b,{$gap:1,children:[J(Se,{children:e.authType===`oauth`?`oauth`:`api key`}),e.accountEmail===null?null:J(u,{children:e.accountEmail})]})}),J(W,{$align:`right`,children:J(ot,{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(ot,{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(N,{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(lt,{children:i.map(({window:e,fraction:t})=>Y(ct,{children:[J(we,{fraction:t,label:`${ge[e.windowType]} window, ${Math.round(t*100)}% used`}),J(u,{children:be(e,h,ee,L,pe(r,e.windowType))})]},e.windowType))})}),J(W,{$align:`right`,$mono:!0,children:P(t.ttftMs)}),J(W,{$align:`right`,$mono:!0,children:e.expiresAt===null?`never`:L(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?ne:te,{})}),J(w,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Remove ${e.label}`,title:`Remove ${e.label}`,onClick:()=>l(e),children:J(M,{})})]})})]}),o?J(Te,{children:J(W,{colSpan:9,children:J($e,{credentialId:e.id,windows:n,burn:r,pollIntervalMs:ee,now:h})})}):null]},e.id)})})]})})},e)})}),J(We,{open:o,credentials:t.data??[],onOpenChange:s,onConnected:()=>void t.refetch()}),J(k,{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 ${rt[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 ft=dt;export{ft as component};
|