@dudousxd/nestjs-agent-dashboard 0.5.0 → 0.7.0
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/dist/client/agent-client.d.ts +40 -0
- package/dist/client/agent-client.d.ts.map +1 -1
- package/dist/client/agent-client.js +23 -0
- package/dist/client/agent-client.js.map +1 -1
- package/dist/server/index.cjs +235 -63
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +105 -8
- package/dist/server/index.d.ts +105 -8
- package/dist/server/index.js +188 -19
- package/dist/server/index.js.map +1 -1
- package/dist/spa/assets/index-BjIcXlBO.js +1 -0
- package/dist/spa/assets/index-CES4RqI4.js +49 -0
- package/dist/spa/assets/index-CVcgbps5.css +1 -0
- package/dist/spa/assets/preview-A3jHlGra.js +1 -0
- package/dist/spa/index.html +3 -3
- package/dist/spa/preview.html +3 -3
- package/package.json +2 -2
- package/dist/spa/assets/index-BiQzj2IF.js +0 -49
- package/dist/spa/assets/index-C-8Bnj9D.css +0 -1
- package/dist/spa/assets/index-CHzfsa2R.js +0 -1
- package/dist/spa/assets/preview-Dh9sCp0L.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:JetBrains Mono,ui-monospace,SFMono-Regular,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.relative{position:relative}.z-10{z-index:10}.mx-auto{margin-left:auto;margin-right:auto}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-5{margin-bottom:1.25rem}.ml-auto{margin-left:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-4{height:1rem}.h-8{height:2rem}.max-h-\[520px\]{max-height:520px}.min-h-full{min-height:100%}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-24{width:6rem}.w-32{width:8rem}.w-4{width:1rem}.w-40{width:10rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-\[520px\]{min-width:520px}.min-w-\[560px\]{min-width:560px}.min-w-\[640px\]{min-width:640px}.max-w-\[1180px\]{max-width:1180px}.max-w-\[220px\]{max-width:220px}.max-w-\[240px\]{max-width:240px}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-2\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.625rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rounded{border-radius:.25rem}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-sm{border-radius:.125rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-dashed{border-style:dashed}.border-\[var\(--accent\)\]{border-color:var(--accent)}.border-\[var\(--line\)\]{border-color:var(--line)}.border-\[var\(--line-soft\)\]{border-color:var(--line-soft)}.border-transparent{border-color:transparent}.bg-\[var\(--panel\)\]{background-color:var(--panel)}.bg-transparent{background-color:transparent}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.pl-4{padding-left:1rem}.pr-4{padding-right:1rem}.text-left{text-align:left}.text-right{text-align:right}.text-2xl{font-size:1.5rem;line-height:2rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.leading-none{line-height:1}.tracking-\[0\.2em\]{letter-spacing:.2em}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.text-\[var\(--accent\)\]{color:var(--accent)}.text-\[var\(--bad\)\]{color:var(--bad)}.text-\[var\(--good\)\]{color:var(--good)}.text-\[var\(--muted\)\]{color:var(--muted)}.text-\[var\(--text\)\]{color:var(--text)}.text-\[var\(--warn\)\]{color:var(--warn)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}:root{--bg: #08080b;--panel: #0d0d12;--panel-2: #101017;--line: #1d1d26;--line-soft: #16161d;--text: #e8e8ee;--muted: #7c7c88;--accent: #a78bfa;--accent-2: #22d3ee;--good: #34d399;--warn: #fbbf24;--bad: #f87171}*{box-sizing:border-box}html,body,#root{height:100%}body{margin:0;background:var(--bg);color:var(--text);font-family:Space Grotesk,ui-sans-serif,system-ui,sans-serif;-webkit-font-smoothing:antialiased}.app-bg{position:fixed;top:0;right:0;bottom:0;left:0;z-index:0;pointer-events:none;background-image:radial-gradient(900px 420px at 82% -10%,rgba(167,139,250,.1),transparent 70%),radial-gradient(700px 360px at 8% -12%,rgba(34,211,238,.06),transparent 70%),linear-gradient(to right,var(--line-soft) 1px,transparent 1px),linear-gradient(to bottom,var(--line-soft) 1px,transparent 1px);background-size:100% 100%,100% 100%,46px 46px,46px 46px;-webkit-mask-image:linear-gradient(to bottom,black,black 62%,transparent);mask-image:linear-gradient(to bottom,black,black 62%,transparent);opacity:.55}.mono{font-family:JetBrains Mono,ui-monospace,monospace}.tnum{font-variant-numeric:tabular-nums}.panel{background:linear-gradient(180deg,var(--panel-2),var(--panel));border:1px solid var(--line);border-radius:12px}.s-ok,.s-completed,.s-success{color:var(--good)}.s-running,.s-pending{color:var(--accent-2)}.s-forbidden,.s-denied,.s-failed,.s-error{color:var(--bad)}.s-warn{color:var(--warn)}.dot{width:7px;height:7px;border-radius:999px;background:currentColor;box-shadow:0 0 0 3px color-mix(in srgb,currentColor 18%,transparent);display:inline-block}.pulse{animation:pulse 1.6s ease-in-out infinite}@keyframes pulse{0%,to{opacity:1}50%{opacity:.35}}@keyframes rise{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}.rise{animation:rise .32s cubic-bezier(.2,.7,.2,1) both}.bar-track{background:var(--line);border-radius:999px;overflow:hidden}.bar-fill{height:100%;border-radius:999px;background:linear-gradient(90deg,var(--accent),var(--accent-2))}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-thumb{background:#26262c;border:3px solid var(--bg);border-radius:999px}.hover\:bg-\[var\(--panel-2\)\]:hover{background-color:var(--panel-2)}.hover\:text-\[var\(--text\)\]:hover{color:var(--text)}.disabled\:opacity-50:disabled{opacity:.5}@media (min-width: 640px){.sm\:flex-row{flex-direction:row}}@media (min-width: 768px){.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width: 1024px){.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var be=e=>{throw TypeError(e)};var Vt=(e,t,s)=>t.has(e)||be("Cannot "+s);var i=(e,t,s)=>(Vt(e,t,"read from private field"),s?s.call(e):t.get(e)),f=(e,t,s)=>t.has(e)?be("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),u=(e,t,s,r)=>(Vt(e,t,"write to private field"),r?r.call(e,s):t.set(e,s),s),v=(e,t,s)=>(Vt(e,t,"access private method"),s);var Gt=(e,t,s,r)=>({set _(n){u(e,t,n,s)},get _(){return i(e,t,r)}});import{r as P,j as p,p as ts,L as es,D as ss,C as rs,U as is,W as ns,S as as,T as os,A as us,a as cs,P as hs,R as ls,b as ds,c as fs,M as ys,d as ps,e as ms}from"./index-BiQzj2IF.js";var Ut=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},bt=typeof window>"u"||"Deno"in globalThis;function K(){}function vs(e,t){return typeof e=="function"?e(t):e}function Xt(e){return typeof e=="number"&&e>=0&&e!==1/0}function Ne(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ct(e,t){return typeof e=="function"?e(t):e}function G(e,t){return typeof e=="function"?e(t):e}function ge(e,t){const{type:s="all",exact:r,fetchStatus:n,predicate:a,queryKey:o,stale:c}=e;if(o){if(r){if(t.queryHash!==fe(o,t.options))return!1}else if(!Lt(t.queryKey,o))return!1}if(s!=="all"){const l=t.isActive();if(s==="active"&&!l||s==="inactive"&&l)return!1}return!(typeof c=="boolean"&&t.isStale()!==c||n&&n!==t.state.fetchStatus||a&&!a(t))}function we(e,t){const{exact:s,status:r,predicate:n,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(s){if(gt(t.options.mutationKey)!==gt(a))return!1}else if(!Lt(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||n&&!n(t))}function fe(e,t){return((t==null?void 0:t.queryKeyHashFn)||gt)(e)}function gt(e){return JSON.stringify(e,(t,s)=>Zt(s)?Object.keys(s).sort().reduce((r,n)=>(r[n]=s[n],r),{}):s)}function Lt(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(s=>!Lt(e[s],t[s])):!1}function Ke(e,t){if(e===t)return e;const s=Se(e)&&Se(t);if(s||Zt(e)&&Zt(t)){const r=s?e:Object.keys(e),n=r.length,a=s?t:Object.keys(t),o=a.length,c=s?[]:{};let l=0;for(let b=0;b<o;b++){const y=s?b:a[b];(!s&&r.includes(y)||s)&&e[y]===void 0&&t[y]===void 0?(c[y]=void 0,l++):(c[y]=Ke(e[y],t[y]),c[y]===e[y]&&e[y]!==void 0&&l++)}return n===o&&l===n?e:c}return t}function zt(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(e[s]!==t[s])return!1;return!0}function Se(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Zt(e){if(!xe(e))return!1;const t=e.constructor;if(t===void 0)return!0;const s=t.prototype;return!(!xe(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function xe(e){return Object.prototype.toString.call(e)==="[object Object]"}function bs(e){return new Promise(t=>{setTimeout(t,e)})}function te(e,t,s){return typeof s.structuralSharing=="function"?s.structuralSharing(e,t):s.structuralSharing!==!1?Ke(e,t):t}function gs(e,t,s=0){const r=[...e,t];return s&&r.length>s?r.slice(1):r}function ws(e,t,s=0){const r=[t,...e];return s&&r.length>s?r.slice(0,-1):r}var ye=Symbol();function He(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===ye?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var lt,et,Pt,Me,Ss=(Me=class extends Ut{constructor(){super();f(this,lt);f(this,et);f(this,Pt);u(this,Pt,t=>{if(!bt&&window.addEventListener){const s=()=>t();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){i(this,et)||this.setEventListener(i(this,Pt))}onUnsubscribe(){var t;this.hasListeners()||((t=i(this,et))==null||t.call(this),u(this,et,void 0))}setEventListener(t){var s;u(this,Pt,t),(s=i(this,et))==null||s.call(this),u(this,et,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){i(this,lt)!==t&&(u(this,lt,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(s=>{s(t)})}isFocused(){var t;return typeof i(this,lt)=="boolean"?i(this,lt):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},lt=new WeakMap,et=new WeakMap,Pt=new WeakMap,Me),pe=new Ss,Rt,st,Ot,Te,xs=(Te=class extends Ut{constructor(){super();f(this,Rt,!0);f(this,st);f(this,Ot);u(this,Ot,t=>{if(!bt&&window.addEventListener){const s=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",s,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",r)}}})}onSubscribe(){i(this,st)||this.setEventListener(i(this,Ot))}onUnsubscribe(){var t;this.hasListeners()||((t=i(this,st))==null||t.call(this),u(this,st,void 0))}setEventListener(t){var s;u(this,Ot,t),(s=i(this,st))==null||s.call(this),u(this,st,t(this.setOnline.bind(this)))}setOnline(t){i(this,Rt)!==t&&(u(this,Rt,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return i(this,Rt)}},Rt=new WeakMap,st=new WeakMap,Ot=new WeakMap,Te),Wt=new xs;function ee(){let e,t;const s=new Promise((n,a)=>{e=n,t=a});s.status="pending",s.catch(()=>{});function r(n){Object.assign(s,n),delete s.resolve,delete s.reject}return s.resolve=n=>{r({status:"fulfilled",value:n}),e(n)},s.reject=n=>{r({status:"rejected",reason:n}),t(n)},s}function Cs(e){return Math.min(1e3*2**e,3e4)}function $e(e){return(e??"online")==="online"?Wt.isOnline():!0}var Ge=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Jt(e){return e instanceof Ge}function Be(e){let t=!1,s=0,r=!1,n;const a=ee(),o=d=>{var S;r||(m(new Ge(d)),(S=e.abort)==null||S.call(e))},c=()=>{t=!0},l=()=>{t=!1},b=()=>pe.isFocused()&&(e.networkMode==="always"||Wt.isOnline())&&e.canRun(),y=()=>$e(e.networkMode)&&e.canRun(),h=d=>{var S;r||(r=!0,(S=e.onSuccess)==null||S.call(e,d),n==null||n(),a.resolve(d))},m=d=>{var S;r||(r=!0,(S=e.onError)==null||S.call(e,d),n==null||n(),a.reject(d))},w=()=>new Promise(d=>{var S;n=j=>{(r||b())&&d(j)},(S=e.onPause)==null||S.call(e)}).then(()=>{var d;n=void 0,r||(d=e.onContinue)==null||d.call(e)}),C=()=>{if(r)return;let d;const S=s===0?e.initialPromise:void 0;try{d=S??e.fn()}catch(j){d=Promise.reject(j)}Promise.resolve(d).then(h).catch(j=>{var H;if(r)return;const A=e.retry??(bt?0:3),O=e.retryDelay??Cs,M=typeof O=="function"?O(s,j):O,L=A===!0||typeof A=="number"&&s<A||typeof A=="function"&&A(s,j);if(t||!L){m(j);return}s++,(H=e.onFail)==null||H.call(e,s,j),bs(M).then(()=>b()?void 0:w()).then(()=>{t?m(j):C()})})};return{promise:a,cancel:o,continue:()=>(n==null||n(),a),cancelRetry:c,continueRetry:l,canStart:y,start:()=>(y()?C():w().then(C),a)}}function Ps(){let e=[],t=0,s=c=>{c()},r=c=>{c()},n=c=>setTimeout(c,0);const a=c=>{t?e.push(c):n(()=>{s(c)})},o=()=>{const c=e;e=[],c.length&&n(()=>{r(()=>{c.forEach(l=>{s(l)})})})};return{batch:c=>{let l;t++;try{l=c()}finally{t--,t||o()}return l},batchCalls:c=>(...l)=>{a(()=>{c(...l)})},schedule:a,setNotifyFunction:c=>{s=c},setBatchNotifyFunction:c=>{r=c},setScheduler:c=>{n=c}}}var D=Ps(),dt,Ae,Ye=(Ae=class{constructor(){f(this,dt)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Xt(this.gcTime)&&u(this,dt,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(bt?1/0:5*60*1e3))}clearGcTimeout(){i(this,dt)&&(clearTimeout(i(this,dt)),u(this,dt,void 0))}},dt=new WeakMap,Ae),Et,Ft,N,T,_t,ft,$,V,Ie,Rs=(Ie=class extends Ye{constructor(t){super();f(this,$);f(this,Et);f(this,Ft);f(this,N);f(this,T);f(this,_t);f(this,ft);u(this,ft,!1),u(this,_t,t.defaultOptions),this.setOptions(t.options),this.observers=[],u(this,N,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,u(this,Et,Os(this.options)),this.state=t.state??i(this,Et),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=i(this,T))==null?void 0:t.promise}setOptions(t){this.options={...i(this,_t),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&i(this,N).remove(this)}setData(t,s){const r=te(this.state.data,t,this.options);return v(this,$,V).call(this,{data:r,type:"success",dataUpdatedAt:s==null?void 0:s.updatedAt,manual:s==null?void 0:s.manual}),r}setState(t,s){v(this,$,V).call(this,{type:"setState",state:t,setStateOptions:s})}cancel(t){var r,n;const s=(r=i(this,T))==null?void 0:r.promise;return(n=i(this,T))==null||n.cancel(t),s?s.then(K).catch(K):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(i(this,Et))}isActive(){return this.observers.some(t=>G(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ye||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!Ne(this.state.dataUpdatedAt,t)}onFocus(){var s;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(s=i(this,T))==null||s.continue()}onOnline(){var s;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(s=i(this,T))==null||s.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),i(this,N).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(s=>s!==t),this.observers.length||(i(this,T)&&(i(this,ft)?i(this,T).cancel({revert:!0}):i(this,T).cancelRetry()),this.scheduleGc()),i(this,N).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||v(this,$,V).call(this,{type:"invalidate"})}fetch(t,s){var l,b,y;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(i(this,T))return i(this,T).continueRetry(),i(this,T).promise}if(t&&this.setOptions(t),!this.options.queryFn){const h=this.observers.find(m=>m.options.queryFn);h&&this.setOptions(h.options)}const r=new AbortController,n=h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:()=>(u(this,ft,!0),r.signal)})},a=()=>{const h=He(this.options,s),m={queryKey:this.queryKey,meta:this.meta};return n(m),u(this,ft,!1),this.options.persister?this.options.persister(h,m,this):h(m)},o={fetchOptions:s,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:a};n(o),(l=this.options.behavior)==null||l.onFetch(o,this),u(this,Ft,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((b=o.fetchOptions)==null?void 0:b.meta))&&v(this,$,V).call(this,{type:"fetch",meta:(y=o.fetchOptions)==null?void 0:y.meta});const c=h=>{var m,w,C,d;Jt(h)&&h.silent||v(this,$,V).call(this,{type:"error",error:h}),Jt(h)||((w=(m=i(this,N).config).onError)==null||w.call(m,h,this),(d=(C=i(this,N).config).onSettled)==null||d.call(C,this.state.data,h,this)),this.scheduleGc()};return u(this,T,Be({initialPromise:s==null?void 0:s.initialPromise,fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:h=>{var m,w,C,d;if(h===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(h)}catch(S){c(S);return}(w=(m=i(this,N).config).onSuccess)==null||w.call(m,h,this),(d=(C=i(this,N).config).onSettled)==null||d.call(C,h,this.state.error,this),this.scheduleGc()},onError:c,onFail:(h,m)=>{v(this,$,V).call(this,{type:"failed",failureCount:h,error:m})},onPause:()=>{v(this,$,V).call(this,{type:"pause"})},onContinue:()=>{v(this,$,V).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),i(this,T).start()}},Et=new WeakMap,Ft=new WeakMap,N=new WeakMap,T=new WeakMap,_t=new WeakMap,ft=new WeakMap,$=new WeakSet,V=function(t){const s=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...ze(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const n=t.error;return Jt(n)&&n.revert&&i(this,Ft)?{...i(this,Ft),fetchStatus:"idle"}:{...r,error:n,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=s(this.state),D.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),i(this,N).notify({query:this,type:"updated",action:t})})},Ie);function ze(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:$e(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Os(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,s=t!==void 0,r=s?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var B,Qe,Es=(Qe=class extends Ut{constructor(t={}){super();f(this,B);this.config=t,u(this,B,new Map)}build(t,s,r){const n=s.queryKey,a=s.queryHash??fe(n,s);let o=this.get(a);return o||(o=new Rs({cache:this,queryKey:n,queryHash:a,options:t.defaultQueryOptions(s),state:r,defaultOptions:t.getQueryDefaults(n)}),this.add(o)),o}add(t){i(this,B).has(t.queryHash)||(i(this,B).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const s=i(this,B).get(t.queryHash);s&&(t.destroy(),s===t&&i(this,B).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){D.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return i(this,B).get(t)}getAll(){return[...i(this,B).values()]}find(t){const s={exact:!0,...t};return this.getAll().find(r=>ge(s,r))}findAll(t={}){const s=this.getAll();return Object.keys(t).length>0?s.filter(r=>ge(t,r)):s}notify(t){D.batch(()=>{this.listeners.forEach(s=>{s(t)})})}onFocus(){D.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){D.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},B=new WeakMap,Qe),Y,Q,yt,z,tt,qe,Fs=(qe=class extends Ye{constructor(t){super();f(this,z);f(this,Y);f(this,Q);f(this,yt);this.mutationId=t.mutationId,u(this,Q,t.mutationCache),u(this,Y,[]),this.state=t.state||We(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){i(this,Y).includes(t)||(i(this,Y).push(t),this.clearGcTimeout(),i(this,Q).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){u(this,Y,i(this,Y).filter(s=>s!==t)),this.scheduleGc(),i(this,Q).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){i(this,Y).length||(this.state.status==="pending"?this.scheduleGc():i(this,Q).remove(this))}continue(){var t;return((t=i(this,yt))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var n,a,o,c,l,b,y,h,m,w,C,d,S,j,A,O,M,L,H,I;u(this,yt,Be({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(F,R)=>{v(this,z,tt).call(this,{type:"failed",failureCount:F,error:R})},onPause:()=>{v(this,z,tt).call(this,{type:"pause"})},onContinue:()=>{v(this,z,tt).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>i(this,Q).canRun(this)}));const s=this.state.status==="pending",r=!i(this,yt).canStart();try{if(!s){v(this,z,tt).call(this,{type:"pending",variables:t,isPaused:r}),await((a=(n=i(this,Q).config).onMutate)==null?void 0:a.call(n,t,this));const R=await((c=(o=this.options).onMutate)==null?void 0:c.call(o,t));R!==this.state.context&&v(this,z,tt).call(this,{type:"pending",context:R,variables:t,isPaused:r})}const F=await i(this,yt).start();return await((b=(l=i(this,Q).config).onSuccess)==null?void 0:b.call(l,F,t,this.state.context,this)),await((h=(y=this.options).onSuccess)==null?void 0:h.call(y,F,t,this.state.context)),await((w=(m=i(this,Q).config).onSettled)==null?void 0:w.call(m,F,null,this.state.variables,this.state.context,this)),await((d=(C=this.options).onSettled)==null?void 0:d.call(C,F,null,t,this.state.context)),v(this,z,tt).call(this,{type:"success",data:F}),F}catch(F){try{throw await((j=(S=i(this,Q).config).onError)==null?void 0:j.call(S,F,t,this.state.context,this)),await((O=(A=this.options).onError)==null?void 0:O.call(A,F,t,this.state.context)),await((L=(M=i(this,Q).config).onSettled)==null?void 0:L.call(M,void 0,F,this.state.variables,this.state.context,this)),await((I=(H=this.options).onSettled)==null?void 0:I.call(H,void 0,F,t,this.state.context)),F}finally{v(this,z,tt).call(this,{type:"error",error:F})}}finally{i(this,Q).runNext(this)}}},Y=new WeakMap,Q=new WeakMap,yt=new WeakMap,z=new WeakSet,tt=function(t){const s=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=s(this.state),D.batch(()=>{i(this,Y).forEach(r=>{r.onMutationUpdate(t)}),i(this,Q).notify({mutation:this,type:"updated",action:t})})},qe);function We(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var _,Nt,Ue,Ds=(Ue=class extends Ut{constructor(t={}){super();f(this,_);f(this,Nt);this.config=t,u(this,_,new Map),u(this,Nt,Date.now())}build(t,s,r){const n=new Fs({mutationCache:this,mutationId:++Gt(this,Nt)._,options:t.defaultMutationOptions(s),state:r});return this.add(n),n}add(t){const s=Bt(t),r=i(this,_).get(s)??[];r.push(t),i(this,_).set(s,r),this.notify({type:"added",mutation:t})}remove(t){var r;const s=Bt(t);if(i(this,_).has(s)){const n=(r=i(this,_).get(s))==null?void 0:r.filter(a=>a!==t);n&&(n.length===0?i(this,_).delete(s):i(this,_).set(s,n))}this.notify({type:"removed",mutation:t})}canRun(t){var r;const s=(r=i(this,_).get(Bt(t)))==null?void 0:r.find(n=>n.state.status==="pending");return!s||s===t}runNext(t){var r;const s=(r=i(this,_).get(Bt(t)))==null?void 0:r.find(n=>n!==t&&n.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}clear(){D.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}getAll(){return[...i(this,_).values()].flat()}find(t){const s={exact:!0,...t};return this.getAll().find(r=>we(s,r))}findAll(t={}){return this.getAll().filter(s=>we(t,s))}notify(t){D.batch(()=>{this.listeners.forEach(s=>{s(t)})})}resumePausedMutations(){const t=this.getAll().filter(s=>s.state.isPaused);return D.batch(()=>Promise.all(t.map(s=>s.continue().catch(K))))}},_=new WeakMap,Nt=new WeakMap,Ue);function Bt(e){var t;return((t=e.options.scope)==null?void 0:t.id)??String(e.mutationId)}function Ce(e){return{onFetch:(t,s)=>{var y,h,m,w,C;const r=t.options,n=(m=(h=(y=t.fetchOptions)==null?void 0:y.meta)==null?void 0:h.fetchMore)==null?void 0:m.direction,a=((w=t.state.data)==null?void 0:w.pages)||[],o=((C=t.state.data)==null?void 0:C.pageParams)||[];let c={pages:[],pageParams:[]},l=0;const b=async()=>{let d=!1;const S=O=>{Object.defineProperty(O,"signal",{enumerable:!0,get:()=>(t.signal.aborted?d=!0:t.signal.addEventListener("abort",()=>{d=!0}),t.signal)})},j=He(t.options,t.fetchOptions),A=async(O,M,L)=>{if(d)return Promise.reject();if(M==null&&O.pages.length)return Promise.resolve(O);const H={queryKey:t.queryKey,pageParam:M,direction:L?"backward":"forward",meta:t.options.meta};S(H);const I=await j(H),{maxPages:F}=t.options,R=L?ws:gs;return{pages:R(O.pages,I,F),pageParams:R(O.pageParams,M,F)}};if(n&&a.length){const O=n==="backward",M=O?js:Pe,L={pages:a,pageParams:o},H=M(r,L);c=await A(L,H,O)}else{const O=e??a.length;do{const M=l===0?o[0]??r.initialPageParam:Pe(r,c);if(l>0&&M==null)break;c=await A(c,M),l++}while(l<O)}return c};t.options.persister?t.fetchFn=()=>{var d,S;return(S=(d=t.options).persister)==null?void 0:S.call(d,b,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},s)}:t.fetchFn=b}}}function Pe(e,{pages:t,pageParams:s}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,s[r],s):void 0}function js(e,{pages:t,pageParams:s}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,s[0],s):void 0}var E,rt,it,Dt,jt,nt,Mt,Tt,ke,Ms=(ke=class{constructor(e={}){f(this,E);f(this,rt);f(this,it);f(this,Dt);f(this,jt);f(this,nt);f(this,Mt);f(this,Tt);u(this,E,e.queryCache||new Es),u(this,rt,e.mutationCache||new Ds),u(this,it,e.defaultOptions||{}),u(this,Dt,new Map),u(this,jt,new Map),u(this,nt,0)}mount(){Gt(this,nt)._++,i(this,nt)===1&&(u(this,Mt,pe.subscribe(async e=>{e&&(await this.resumePausedMutations(),i(this,E).onFocus())})),u(this,Tt,Wt.subscribe(async e=>{e&&(await this.resumePausedMutations(),i(this,E).onOnline())})))}unmount(){var e,t;Gt(this,nt)._--,i(this,nt)===0&&((e=i(this,Mt))==null||e.call(this),u(this,Mt,void 0),(t=i(this,Tt))==null||t.call(this),u(this,Tt,void 0))}isFetching(e){return i(this,E).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return i(this,rt).findAll({...e,status:"pending"}).length}getQueryData(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=i(this,E).get(t.queryHash))==null?void 0:s.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),s=i(this,E).build(this,t),r=s.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime(Ct(t.staleTime,s))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return i(this,E).findAll(e).map(({queryKey:t,state:s})=>{const r=s.data;return[t,r]})}setQueryData(e,t,s){const r=this.defaultQueryOptions({queryKey:e}),n=i(this,E).get(r.queryHash),a=n==null?void 0:n.state.data,o=vs(t,a);if(o!==void 0)return i(this,E).build(this,r).setData(o,{...s,manual:!0})}setQueriesData(e,t,s){return D.batch(()=>i(this,E).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,s)]))}getQueryState(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=i(this,E).get(t.queryHash))==null?void 0:s.state}removeQueries(e){const t=i(this,E);D.batch(()=>{t.findAll(e).forEach(s=>{t.remove(s)})})}resetQueries(e,t){const s=i(this,E),r={type:"active",...e};return D.batch(()=>(s.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries(r,t)))}cancelQueries(e,t={}){const s={revert:!0,...t},r=D.batch(()=>i(this,E).findAll(e).map(n=>n.cancel(s)));return Promise.all(r).then(K).catch(K)}invalidateQueries(e,t={}){return D.batch(()=>{if(i(this,E).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none")return Promise.resolve();const s={...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"};return this.refetchQueries(s,t)})}refetchQueries(e,t={}){const s={...t,cancelRefetch:t.cancelRefetch??!0},r=D.batch(()=>i(this,E).findAll(e).filter(n=>!n.isDisabled()).map(n=>{let a=n.fetch(void 0,s);return s.throwOnError||(a=a.catch(K)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(K)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const s=i(this,E).build(this,t);return s.isStaleByTime(Ct(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(K).catch(K)}fetchInfiniteQuery(e){return e.behavior=Ce(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(K).catch(K)}ensureInfiniteQueryData(e){return e.behavior=Ce(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Wt.isOnline()?i(this,rt).resumePausedMutations():Promise.resolve()}getQueryCache(){return i(this,E)}getMutationCache(){return i(this,rt)}getDefaultOptions(){return i(this,it)}setDefaultOptions(e){u(this,it,e)}setQueryDefaults(e,t){i(this,Dt).set(gt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...i(this,Dt).values()],s={};return t.forEach(r=>{Lt(e,r.queryKey)&&Object.assign(s,r.defaultOptions)}),s}setMutationDefaults(e,t){i(this,jt).set(gt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...i(this,jt).values()];let s={};return t.forEach(r=>{Lt(e,r.mutationKey)&&(s={...s,...r.defaultOptions})}),s}defaultQueryOptions(e){if(e._defaulted)return e;const t={...i(this,it).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=fe(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===ye&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...i(this,it).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){i(this,E).clear(),i(this,rt).clear()}},E=new WeakMap,rt=new WeakMap,it=new WeakMap,Dt=new WeakMap,jt=new WeakMap,nt=new WeakMap,Mt=new WeakMap,Tt=new WeakMap,ke),U,g,Kt,q,pt,At,at,W,Ht,It,Qt,mt,vt,ot,qt,x,kt,se,re,ie,ne,ae,oe,ue,Ve,Le,Ts=(Le=class extends Ut{constructor(t,s){super();f(this,x);f(this,U);f(this,g);f(this,Kt);f(this,q);f(this,pt);f(this,At);f(this,at);f(this,W);f(this,Ht);f(this,It);f(this,Qt);f(this,mt);f(this,vt);f(this,ot);f(this,qt,new Set);this.options=s,u(this,U,t),u(this,W,null),u(this,at,ee()),this.options.experimental_prefetchInRender||i(this,at).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(i(this,g).addObserver(this),Re(i(this,g),this.options)?v(this,x,kt).call(this):this.updateResult(),v(this,x,ne).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ce(i(this,g),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ce(i(this,g),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,v(this,x,ae).call(this),v(this,x,oe).call(this),i(this,g).removeObserver(this)}setOptions(t,s){const r=this.options,n=i(this,g);if(this.options=i(this,U).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof G(this.options.enabled,i(this,g))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");v(this,x,ue).call(this),i(this,g).setOptions(this.options),r._defaulted&&!zt(this.options,r)&&i(this,U).getQueryCache().notify({type:"observerOptionsUpdated",query:i(this,g),observer:this});const a=this.hasListeners();a&&Oe(i(this,g),n,this.options,r)&&v(this,x,kt).call(this),this.updateResult(s),a&&(i(this,g)!==n||G(this.options.enabled,i(this,g))!==G(r.enabled,i(this,g))||Ct(this.options.staleTime,i(this,g))!==Ct(r.staleTime,i(this,g)))&&v(this,x,se).call(this);const o=v(this,x,re).call(this);a&&(i(this,g)!==n||G(this.options.enabled,i(this,g))!==G(r.enabled,i(this,g))||o!==i(this,ot))&&v(this,x,ie).call(this,o)}getOptimisticResult(t){const s=i(this,U).getQueryCache().build(i(this,U),t),r=this.createResult(s,t);return Is(this,r)&&(u(this,q,r),u(this,At,this.options),u(this,pt,i(this,g).state)),r}getCurrentResult(){return i(this,q)}trackResult(t,s){const r={};return Object.keys(t).forEach(n=>{Object.defineProperty(r,n,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(n),s==null||s(n),t[n])})}),r}trackProp(t){i(this,qt).add(t)}getCurrentQuery(){return i(this,g)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const s=i(this,U).defaultQueryOptions(t),r=i(this,U).getQueryCache().build(i(this,U),s);return r.fetch().then(()=>this.createResult(r,s))}fetch(t){return v(this,x,kt).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),i(this,q)))}createResult(t,s){var F;const r=i(this,g),n=this.options,a=i(this,q),o=i(this,pt),c=i(this,At),b=t!==r?t.state:i(this,Kt),{state:y}=t;let h={...y},m=!1,w;if(s._optimisticResults){const R=this.hasListeners(),St=!R&&Re(t,s),xt=R&&Oe(t,r,s,n);(St||xt)&&(h={...h,...ze(y.data,t.options)}),s._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:C,errorUpdatedAt:d,status:S}=h;if(s.select&&h.data!==void 0)if(a&&h.data===(o==null?void 0:o.data)&&s.select===i(this,Ht))w=i(this,It);else try{u(this,Ht,s.select),w=s.select(h.data),w=te(a==null?void 0:a.data,w,s),u(this,It,w),u(this,W,null)}catch(R){u(this,W,R)}else w=h.data;if(s.placeholderData!==void 0&&w===void 0&&S==="pending"){let R;if(a!=null&&a.isPlaceholderData&&s.placeholderData===(c==null?void 0:c.placeholderData))R=a.data;else if(R=typeof s.placeholderData=="function"?s.placeholderData((F=i(this,Qt))==null?void 0:F.state.data,i(this,Qt)):s.placeholderData,s.select&&R!==void 0)try{R=s.select(R),u(this,W,null)}catch(St){u(this,W,St)}R!==void 0&&(S="success",w=te(a==null?void 0:a.data,R,s),m=!0)}i(this,W)&&(C=i(this,W),w=i(this,It),d=Date.now(),S="error");const j=h.fetchStatus==="fetching",A=S==="pending",O=S==="error",M=A&&j,L=w!==void 0,I={status:S,fetchStatus:h.fetchStatus,isPending:A,isSuccess:S==="success",isError:O,isInitialLoading:M,isLoading:M,data:w,dataUpdatedAt:h.dataUpdatedAt,error:C,errorUpdatedAt:d,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>b.dataUpdateCount||h.errorUpdateCount>b.errorUpdateCount,isFetching:j,isRefetching:j&&!A,isLoadingError:O&&!L,isPaused:h.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:O&&L,isStale:me(t,s),refetch:this.refetch,promise:i(this,at)};if(this.options.experimental_prefetchInRender){const R=$t=>{I.status==="error"?$t.reject(I.error):I.data!==void 0&&$t.resolve(I.data)},St=()=>{const $t=u(this,at,I.promise=ee());R($t)},xt=i(this,at);switch(xt.status){case"pending":t.queryHash===r.queryHash&&R(xt);break;case"fulfilled":(I.status==="error"||I.data!==xt.value)&&St();break;case"rejected":(I.status!=="error"||I.error!==xt.reason)&&St();break}}return I}updateResult(t){const s=i(this,q),r=this.createResult(i(this,g),this.options);if(u(this,pt,i(this,g).state),u(this,At,this.options),i(this,pt).data!==void 0&&u(this,Qt,i(this,g)),zt(r,s))return;u(this,q,r);const n={},a=()=>{if(!s)return!0;const{notifyOnChangeProps:o}=this.options,c=typeof o=="function"?o():o;if(c==="all"||!c&&!i(this,qt).size)return!0;const l=new Set(c??i(this,qt));return this.options.throwOnError&&l.add("error"),Object.keys(i(this,q)).some(b=>{const y=b;return i(this,q)[y]!==s[y]&&l.has(y)})};(t==null?void 0:t.listeners)!==!1&&a()&&(n.listeners=!0),v(this,x,Ve).call(this,{...n,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&v(this,x,ne).call(this)}},U=new WeakMap,g=new WeakMap,Kt=new WeakMap,q=new WeakMap,pt=new WeakMap,At=new WeakMap,at=new WeakMap,W=new WeakMap,Ht=new WeakMap,It=new WeakMap,Qt=new WeakMap,mt=new WeakMap,vt=new WeakMap,ot=new WeakMap,qt=new WeakMap,x=new WeakSet,kt=function(t){v(this,x,ue).call(this);let s=i(this,g).fetch(this.options,t);return t!=null&&t.throwOnError||(s=s.catch(K)),s},se=function(){v(this,x,ae).call(this);const t=Ct(this.options.staleTime,i(this,g));if(bt||i(this,q).isStale||!Xt(t))return;const r=Ne(i(this,q).dataUpdatedAt,t)+1;u(this,mt,setTimeout(()=>{i(this,q).isStale||this.updateResult()},r))},re=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(i(this,g)):this.options.refetchInterval)??!1},ie=function(t){v(this,x,oe).call(this),u(this,ot,t),!(bt||G(this.options.enabled,i(this,g))===!1||!Xt(i(this,ot))||i(this,ot)===0)&&u(this,vt,setInterval(()=>{(this.options.refetchIntervalInBackground||pe.isFocused())&&v(this,x,kt).call(this)},i(this,ot)))},ne=function(){v(this,x,se).call(this),v(this,x,ie).call(this,v(this,x,re).call(this))},ae=function(){i(this,mt)&&(clearTimeout(i(this,mt)),u(this,mt,void 0))},oe=function(){i(this,vt)&&(clearInterval(i(this,vt)),u(this,vt,void 0))},ue=function(){const t=i(this,U).getQueryCache().build(i(this,U),this.options);if(t===i(this,g))return;const s=i(this,g);u(this,g,t),u(this,Kt,t.state),this.hasListeners()&&(s==null||s.removeObserver(this),t.addObserver(this))},Ve=function(t){D.batch(()=>{t.listeners&&this.listeners.forEach(s=>{s(i(this,q))}),i(this,U).getQueryCache().notify({query:i(this,g),type:"observerResultsUpdated"})})},Le);function As(e,t){return G(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Re(e,t){return As(e,t)||e.state.data!==void 0&&ce(e,t,t.refetchOnMount)}function ce(e,t,s){if(G(t.enabled,e)!==!1){const r=typeof s=="function"?s(e):s;return r==="always"||r!==!1&&me(e,t)}return!1}function Oe(e,t,s,r){return(e!==t||G(r.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&me(e,s)}function me(e,t){return G(t.enabled,e)!==!1&&e.isStaleByTime(Ct(t.staleTime,e))}function Is(e,t){return!zt(e.getCurrentResult(),t)}var ut,ct,k,J,X,Yt,he,_e,Qs=(_e=class extends Ut{constructor(t,s){super();f(this,X);f(this,ut);f(this,ct);f(this,k);f(this,J);u(this,ut,t),this.setOptions(s),this.bindMethods(),v(this,X,Yt).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var r;const s=this.options;this.options=i(this,ut).defaultMutationOptions(t),zt(this.options,s)||i(this,ut).getMutationCache().notify({type:"observerOptionsUpdated",mutation:i(this,k),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&>(s.mutationKey)!==gt(this.options.mutationKey)?this.reset():((r=i(this,k))==null?void 0:r.state.status)==="pending"&&i(this,k).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=i(this,k))==null||t.removeObserver(this)}onMutationUpdate(t){v(this,X,Yt).call(this),v(this,X,he).call(this,t)}getCurrentResult(){return i(this,ct)}reset(){var t;(t=i(this,k))==null||t.removeObserver(this),u(this,k,void 0),v(this,X,Yt).call(this),v(this,X,he).call(this)}mutate(t,s){var r;return u(this,J,s),(r=i(this,k))==null||r.removeObserver(this),u(this,k,i(this,ut).getMutationCache().build(i(this,ut),this.options)),i(this,k).addObserver(this),i(this,k).execute(t)}},ut=new WeakMap,ct=new WeakMap,k=new WeakMap,J=new WeakMap,X=new WeakSet,Yt=function(){var s;const t=((s=i(this,k))==null?void 0:s.state)??We();u(this,ct,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},he=function(t){D.batch(()=>{var s,r,n,a,o,c,l,b;if(i(this,J)&&this.hasListeners()){const y=i(this,ct).variables,h=i(this,ct).context;(t==null?void 0:t.type)==="success"?((r=(s=i(this,J)).onSuccess)==null||r.call(s,t.data,y,h),(a=(n=i(this,J)).onSettled)==null||a.call(n,t.data,null,y,h)):(t==null?void 0:t.type)==="error"&&((c=(o=i(this,J)).onError)==null||c.call(o,t.error,y,h),(b=(l=i(this,J)).onSettled)==null||b.call(l,void 0,t.error,y,h))}this.listeners.forEach(y=>{y(i(this,ct))})})},_e),Je=P.createContext(void 0),ve=e=>{const t=P.useContext(Je);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},qs=({client:e,children:t})=>(P.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),p.jsx(Je.Provider,{value:e,children:t})),Xe=P.createContext(!1),Us=()=>P.useContext(Xe);Xe.Provider;function ks(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ls=P.createContext(ks()),_s=()=>P.useContext(Ls);function Ze(e,t){return typeof e=="function"?e(...t):!!e}function le(){}var Ns=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Ks=e=>{P.useEffect(()=>{e.clearReset()},[e])},Hs=({result:e,errorResetBoundary:t,throwOnError:s,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&Ze(s,[e.error,r]),$s=e=>{e.suspense&&(e.staleTime===void 0&&(e.staleTime=1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},Gs=(e,t)=>e.isLoading&&e.isFetching&&!t,Bs=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ee=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function Ys(e,t,s){var y,h,m,w,C;const r=ve(),n=Us(),a=_s(),o=r.defaultQueryOptions(e);(h=(y=r.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||h.call(y,o),o._optimisticResults=n?"isRestoring":"optimistic",$s(o),Ns(o,a),Ks(a);const c=!r.getQueryCache().get(o.queryHash),[l]=P.useState(()=>new t(r,o)),b=l.getOptimisticResult(o);if(P.useSyncExternalStore(P.useCallback(d=>{const S=n?le:l.subscribe(D.batchCalls(d));return l.updateResult(),S},[l,n]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),P.useEffect(()=>{l.setOptions(o,{listeners:!1})},[o,l]),Bs(o,b))throw Ee(o,l,a);if(Hs({result:b,errorResetBoundary:a,throwOnError:o.throwOnError,query:r.getQueryCache().get(o.queryHash)}))throw b.error;if((w=(m=r.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||w.call(m,o,b),o.experimental_prefetchInRender&&!bt&&Gs(b,n)){const d=c?Ee(o,l,a):(C=r.getQueryCache().get(o.queryHash))==null?void 0:C.promise;d==null||d.catch(le).finally(()=>{l.updateResult()})}return o.notifyOnChangeProps?b:l.trackResult(b)}function wt(e,t){return Ys(e,Ts)}function zs(e,t){const s=ve(),[r]=P.useState(()=>new Qs(s,e));P.useEffect(()=>{r.setOptions(e)},[r,e]);const n=P.useSyncExternalStore(P.useCallback(o=>r.subscribe(D.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=P.useCallback((o,c)=>{r.mutate(o,c).catch(le)},[r]);if(n.error&&Ze(r.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:a,mutateAsync:n.mutate}}const Ws=864e5,Vs=/^\d{4}-\d{2}-\d{2}$/;function Fe(e,t=Date.now()){return new Date(t-e*Ws).toISOString().slice(0,10)}function Js(e=30,t=Date.now()){return{fromDay:Fe(e-1,t),toDay:Fe(0,t)}}function Xs(e){return Vs.test(e)}function de(){return typeof window<"u"&&window.__AGENT_API__?window.__AGENT_API__:`${typeof window<"u"&&window.__AGENT_BASE__||"/ai-gateway"}/api`}async function ht(e,t){const s=await fetch(de()+e,t);if(!s.ok)throw new Error(`${s.status} ${s.statusText}`);return await s.json()}const Z={spend(e){const t=new URLSearchParams({from:e.fromDay,to:e.toDay});return ht(`/spend?${t.toString()}`)},topThreads(e,t=10){const s=new URLSearchParams({from:e.fromDay,to:e.toDay,limit:`${t}`});return ht(`/top-threads?${s.toString()}`)},reliability(e){const t=new URLSearchParams({from:e.fromDay,to:e.toDay});return ht(`/reliability?${t.toString()}`)},runs(e=50){return ht(`/runs?limit=${e}`)},toolCalls(e=50){return ht(`/tool-calls?limit=${e}`)},threads(e=50){return ht(`/threads?limit=${e}`)},pricing(){return ht("/pricing")},async upsertPrice(e){const t=await fetch(`${de()}/pricing`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(`${t.status} ${t.statusText}`)},streamEvents(e){const t=new EventSource(`${de()}/stream`);return t.onmessage=s=>{try{e(JSON.parse(s.data))}catch{}},()=>t.close()}};function Zs(e){return wt({queryKey:["spend",e.fromDay,e.toDay],queryFn:()=>Z.spend(e)})}function tr(e,t=10){return wt({queryKey:["top-threads",e.fromDay,e.toDay,t],queryFn:()=>Z.topThreads(e,t)})}function er(e){return wt({queryKey:["reliability",e.fromDay,e.toDay],queryFn:()=>Z.reliability(e)})}function sr(e=50){return wt({queryKey:["runs",e],queryFn:()=>Z.runs(e)})}function rr(e=50){return wt({queryKey:["tool-calls",e],queryFn:()=>Z.toolCalls(e)})}function ir(e=50){return wt({queryKey:["threads",e],queryFn:()=>Z.threads(e)})}function nr(){return wt({queryKey:["pricing"],queryFn:()=>Z.pricing()})}function ar(){const e=ve();return zs({mutationFn:t=>Z.upsertPrice(t),onSuccess:()=>{e.invalidateQueries({queryKey:["pricing"]})}})}function or(e=200){const[t,s]=P.useState([]),[r,n]=P.useState(!1),a=P.useRef(0);return P.useEffect(()=>{n(!0);const o=Z.streamEvents(c=>{a.current+=1,s(l=>ts(l,c,a.current,e))});return()=>{n(!1),o()}},[e]),{events:t,connected:r}}const ur=[{key:"spend",label:"Spend & usage",icon:p.jsx(ss,{})},{key:"models",label:"Models",icon:p.jsx(rs,{})},{key:"actors",label:"Actors & budgets",icon:p.jsx(is,{})},{key:"runs",label:"Runs & tools",icon:p.jsx(ns,{})},{key:"reliability",label:"Reliability",icon:p.jsx(as,{})},{key:"pricing",label:"Pricing",icon:p.jsx(os,{})},{key:"live",label:"Live",icon:p.jsx(us,{})}],cr={byModel:[],byActor:[],trend:[]},hr=[],lr=[],dr=[],fr=[],yr={metrics:{runs:0,completed:0,failed:0,successRate:0,retries:0,durationP50Ms:null,durationP95Ms:null},byAgent:[],errors:[],trend:[]},pr=[],mr="501";function vr(){const[e,t]=P.useState(Js()),[s,r]=P.useState("spend"),n=Zs(e),a=tr(e),o=rr(),c=ir(),l=er(e),b=sr(),y=nr(),h=ar(),m=or(),w=n.data??cr,C=y.isError&&y.error instanceof Error?y.error.message.startsWith(mr):!1;return p.jsxs("div",{className:"relative min-h-full",children:[p.jsx("div",{className:"app-bg"}),p.jsxs("div",{className:"relative z-10 mx-auto max-w-[1180px] px-5 py-5",children:[p.jsx(gr,{range:e,onRange:t,connected:m.connected,liveCount:m.events.length}),p.jsx("nav",{className:"mb-5 flex flex-wrap gap-1",children:ur.map(d=>p.jsxs("button",{type:"button",onClick:()=>r(d.key),className:`flex items-center gap-2 rounded-lg border px-3 py-1.5 text-xs transition-colors ${s===d.key?"border-[var(--accent)]/50 bg-[var(--accent)]/10 text-[var(--text)]":"border-transparent text-[var(--muted)] hover:text-[var(--text)]"}`,children:[d.icon,d.label,d.key==="live"&&m.events.length>0&&p.jsx("span",{className:"mono tnum rounded bg-[var(--accent)]/20 px-1 text-[10px] text-[var(--accent)]",children:m.events.length})]},d.key))}),p.jsx(br,{section:s,overview:w,topThreads:a.data??dr,loadingSpend:n.isLoading,errorSpend:n.isError,toolCalls:o.data??hr,threads:c.data??lr,reliability:l.data??yr,runs:b.data??pr,liveEvents:m.events,connected:m.connected,prices:y.data??fr,loadingPrices:y.isLoading,pricingUnavailable:C,onUpsertPrice:d=>h.mutateAsync(d),savingPrice:h.isPending})]})]})}function br({section:e,overview:t,topThreads:s,loadingSpend:r,errorSpend:n,toolCalls:a,threads:o,reliability:c,runs:l,liveEvents:b,connected:y,prices:h,loadingPrices:m,pricingUnavailable:w,onUpsertPrice:C,savingPrice:d}){if(n&&(e==="spend"||e==="models"||e==="actors"))return p.jsx("div",{className:"panel p-6 text-sm text-[var(--bad)]",children:"Failed to load the read-model. Is the governance read-model bound and the API reachable?"});if(r&&(e==="spend"||e==="models"||e==="actors"))return p.jsx("div",{className:"panel animate-pulse p-6 text-sm text-[var(--muted)]",children:"Loading…"});switch(e){case"spend":return p.jsx(ps,{overview:t,topThreads:s});case"models":return p.jsx(ys,{rows:t.byModel});case"actors":return p.jsx(fs,{rows:t.byActor});case"runs":return p.jsx(ds,{toolCalls:a,threads:o});case"reliability":return p.jsx(ls,{overview:c,runs:l});case"pricing":return p.jsx(hs,{prices:h,loading:m,unavailable:w,onUpsert:C,saving:d});case"live":return p.jsx(cs,{events:b,connected:y});default:return null}}function gr({range:e,onRange:t,connected:s,liveCount:r}){return p.jsxs("header",{className:"mb-5 flex flex-wrap items-center gap-4",children:[p.jsxs("div",{className:"flex items-center gap-2.5",children:[p.jsx("div",{className:"grid h-8 w-8 place-items-center rounded-lg border border-[var(--accent)]/40 bg-[var(--accent)]/10",children:p.jsx(es,{className:"h-4 w-4 text-[var(--accent)]"})}),p.jsxs("div",{className:"leading-none",children:[p.jsx("div",{className:"text-sm font-semibold tracking-tight",children:"AI gateway"}),p.jsx("div",{className:"mono text-[10px] uppercase tracking-[0.2em] text-[var(--muted)]",children:"governance console"})]})]}),p.jsxs("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[p.jsx(De,{label:"From",value:e.fromDay,onChange:n=>t({...e,fromDay:n})}),p.jsx(De,{label:"To",value:e.toDay,onChange:n=>t({...e,toDay:n})}),p.jsxs("span",{className:"flex items-center gap-1.5 rounded-lg border border-[var(--line)] px-2.5 py-1.5 text-[11px] text-[var(--muted)]",children:[p.jsx("span",{className:`dot ${s?"s-ok pulse":"s-failed"}`,"aria-hidden":!0}),"live ",r>0?`· ${r}`:""]})]})]})}function De({label:e,value:t,onChange:s}){return p.jsxs("label",{className:"flex items-center gap-1.5 rounded-lg border border-[var(--line)] bg-[var(--panel)] px-2.5 py-1 text-[11px] text-[var(--muted)]",children:[p.jsx("span",{className:"uppercase tracking-wider",children:e}),p.jsx("input",{type:"date",value:t,onChange:r=>{const n=r.target.value;Xs(n)&&s(n)},className:"mono bg-transparent text-[var(--text)] outline-none"})]})}const wr=new Ms({defaultOptions:{queries:{refetchInterval:5e3,refetchOnWindowFocus:!1,retry:1}}}),je=document.getElementById("root");je&&ms.createRoot(je).render(p.jsx(P.StrictMode,{children:p.jsx(qs,{client:wr,children:p.jsx(vr,{})})}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{e as i,j as e,r as c,L as u,d as m,M as p,c as g,b as h,R as I,P as f,a as S}from"./index-BiQzj2IF.js";const w=[{modelId:"gpt-4o",requests:4200,inputTokens:84e5,outputTokens:21e5,costUsd:84.2},{modelId:"claude-3-5-sonnet",requests:2600,inputTokens:52e5,outputTokens:13e5,costUsd:41.6},{modelId:"gpt-4o-mini",requests:9800,inputTokens:12e6,outputTokens:3e6,costUsd:9.4},{modelId:"llama-3-70b",requests:1200,inputTokens:21e5,outputTokens:64e4,costUsd:0}],b=[{actorRef:"tenant:acme",requests:8200,totalTokens:184e5,costUsd:78.1,actorLabel:"Acme Corp"},{actorRef:"user:davi@goflip.ai",requests:3100,totalTokens:69e5,costUsd:34.2,actorLabel:"Davi de Carvalho"},{actorRef:"tenant:globex",requests:4400,totalTokens:92e5,costUsd:21.8,actorLabel:null},{actorRef:"user:ops-bot",requests:2100,totalTokens:394e4,costUsd:1.1,actorLabel:null}],v={"tenant:acme":2e7,"user:davi@goflip.ai":5e6,"tenant:globex":12e6};function D(){const a=[];for(let t=29;t>=0;t-=1){const s=new Date(Date.now()-t*864e5).toISOString().slice(0,10),r=Math.sin(t/3)*.5+1;a.push({day:s,totalTokens:Math.round(7e5*r+t*4e3),costUsd:Number((4.2*r+t*.05).toFixed(2))})}return a}function T(){const a=[];for(let t=29;t>=0;t-=1){const s=new Date(Date.now()-t*864e5).toISOString().slice(0,10),r=Math.sin(t/3)*.5+1,d=Math.round(18*r+t*.3);a.push({day:s,runs:d,failed:Math.max(0,Math.round(d*.06))})}return a}const n={byModel:w,byActor:b,trend:D()},x={metrics:{runs:482,completed:461,failed:21,successRate:461/482,retries:34,durationP50Ms:640,durationP95Ms:2400},byAgent:[{agentName:"analyst",runs:210,failed:8,retries:14},{agentName:"billing-agent",runs:150,failed:9,retries:12},{agentName:"(default)",runs:122,failed:4,retries:8}],errors:[{errorCode:"TIMEOUT",count:9},{errorCode:"TOOL_ERROR",count:6},{errorCode:"RATE_LIMIT",count:4},{errorCode:"UNKNOWN",count:2}],trend:T()},O=[{runId:"r-9f2a",threadId:"th1",actorRef:"tenant:acme",agentName:"analyst",status:"completed",durationMs:820,errorCode:null,errorMessage:null,retries:0,startedAt:new Date(Date.now()-4e4).toISOString()},{runId:"r-7c31",threadId:"th2",actorRef:"user:ops-bot",agentName:"billing-agent",status:"failed",durationMs:4200,errorCode:"TIMEOUT",errorMessage:"upstream model request timed out after 3 attempts",retries:2,startedAt:new Date(Date.now()-21e4).toISOString()},{runId:"r-a114",threadId:"th3",actorRef:"user:davi@goflip.ai",agentName:null,status:"completed",durationMs:1150,errorCode:null,errorMessage:null,retries:1,startedAt:new Date(Date.now()-54e4).toISOString()},{runId:"r-b902",threadId:"th1",actorRef:"tenant:acme",agentName:"analyst",status:"failed",durationMs:980,errorCode:"TOOL_ERROR",errorMessage:"search_records returned a 500",retries:0,startedAt:new Date(Date.now()-132e4).toISOString()},{runId:"r-c447",threadId:"th2",actorRef:"user:ops-bot",agentName:"billing-agent",status:"running",durationMs:null,errorCode:null,errorMessage:null,retries:0,startedAt:new Date(Date.now()-8e3).toISOString()}],R=v,C=[{toolCallId:"tc1",toolName:"search_records",toolType:"read",status:"ok",threadId:"th1",createdAt:new Date(Date.now()-12e3).toISOString()},{toolCallId:"tc2",toolName:"delete_asset",toolType:"action",status:"forbidden",threadId:"th2",createdAt:new Date(Date.now()-9e4).toISOString()},{toolCallId:"tc3",toolName:"fetch_pricing",toolType:"read",status:"ok",threadId:"th1",createdAt:new Date(Date.now()-24e4).toISOString()},{toolCallId:"tc4",toolName:"send_email",toolType:"action",status:"failed",threadId:"th3",createdAt:new Date(Date.now()-62e4).toISOString()},{toolCallId:"tc5",toolName:"summarize_thread",toolType:"read",status:"ok",threadId:"th2",createdAt:new Date(Date.now()-12e5).toISOString()}],M=[{threadId:"th1",title:"Q3 procurement review",actorRef:"tenant:acme",messageCount:24,totalTokens:184e3,lastActivityAt:new Date(Date.now()-3e4).toISOString(),actorLabel:"Acme Corp"},{threadId:"th2",title:"Incident triage",actorRef:"user:ops-bot",messageCount:11,totalTokens:62e3,lastActivityAt:new Date(Date.now()-4e5).toISOString(),actorLabel:null},{threadId:"th3",title:"Contract summary",actorRef:"user:davi@goflip.ai",messageCount:6,totalTokens:28400,lastActivityAt:new Date(Date.now()-18e5).toISOString(),actorLabel:"Davi de Carvalho"}],y=[{threadId:"th1",title:"Q3 procurement review",actorRef:"tenant:acme",requests:24,totalTokens:184e3,costUsd:18.4,actorLabel:"Acme Corp"},{threadId:"th2",title:"Incident triage",actorRef:"user:ops-bot",requests:11,totalTokens:62e3,costUsd:6.2,actorLabel:null},{threadId:"th3",title:"Contract summary",actorRef:"user:davi@goflip.ai",requests:6,totalTokens:28400,costUsd:2.8,actorLabel:"Davi de Carvalho"}],N=[{modelId:"gpt-4o",inputPricePer1m:2.5,outputPricePer1m:10,cacheReadPricePer1m:1.25,effectiveFrom:new Date(Date.now()-5*864e5).toISOString()},{modelId:"claude-3-5-sonnet",inputPricePer1m:3,outputPricePer1m:15,cacheWritePricePer1m:3.75,cacheReadPricePer1m:.3,effectiveFrom:new Date(Date.now()-12*864e5).toISOString()},{modelId:"gpt-4o-mini",inputPricePer1m:.15,outputPricePer1m:.6,effectiveFrom:new Date(Date.now()-2*864e5).toISOString()}],k=[{id:"e1",event:"run.started",ts:Date.now()-2e3,payload:{runId:"r-9f2",agentName:"analyst"}},{id:"e2",event:"tool-call",ts:Date.now()-5e3,payload:{toolName:"search_records",toolType:"read",status:"ok"}},{id:"e3",event:"quota.exceeded",ts:Date.now()-9e3,payload:{actorId:"tenant:globex",usedTokens:124e5,limitTokens:12e6}},{id:"e4",event:"tool-call",ts:Date.now()-14e3,payload:{toolName:"delete_asset",toolType:"action",status:"forbidden"}},{id:"e5",event:"delegated",ts:Date.now()-2e4,payload:{fromAgent:"router",toAgent:"billing-agent"}},{id:"e6",event:"run.finished",ts:Date.now()-26e3,payload:{runId:"r-8a1",steps:7,inputTokens:4200,outputTokens:1100}}];function A(){return e.jsxs("div",{className:"relative min-h-full",children:[e.jsx("div",{className:"app-bg"}),e.jsxs("div",{className:"relative z-10 mx-auto max-w-[1180px] space-y-6 px-5 py-6",children:[e.jsxs("header",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"grid h-8 w-8 place-items-center rounded-lg border border-[var(--accent)]/40 bg-[var(--accent)]/10",children:e.jsx(u,{className:"h-4 w-4 text-[var(--accent)]"})}),e.jsxs("div",{className:"leading-none",children:[e.jsx("div",{className:"text-sm font-semibold tracking-tight",children:"AI gateway — preview"}),e.jsx("div",{className:"mono text-[10px] uppercase tracking-[0.2em] text-[var(--muted)]",children:"mock data · no backend"})]})]}),e.jsx(o,{label:"Spend & usage",children:e.jsx(m,{overview:n,topThreads:y})}),e.jsx(o,{label:"Models",children:e.jsx(p,{rows:n.byModel})}),e.jsx(o,{label:"Actors & budgets",children:e.jsx(g,{rows:n.byActor,budgets:R})}),e.jsx(o,{label:"Runs & tools",children:e.jsx(h,{toolCalls:C,threads:M})}),e.jsx(o,{label:"Reliability",children:e.jsx(I,{overview:x,runs:O})}),e.jsx(o,{label:"Pricing",children:e.jsx(f,{prices:N,loading:!1,unavailable:!1,onUpsert:async()=>{},saving:!1})}),e.jsx(o,{label:"Live",children:e.jsx(S,{events:k,connected:!0})})]})]})}function o({label:a,children:t}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"mono text-[11px] uppercase tracking-[0.2em] text-[var(--muted)]",children:a}),t]})}const l=document.getElementById("root");l&&i.createRoot(l).render(e.jsx(c.StrictMode,{children:e.jsx(A,{})}));
|