@oas-tools/oas-telemetry 0.7.0-alpha.4 → 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/.env.example +6 -2
- package/README.md +35 -17
- package/dist/cjs/config/bootConfig.cjs +3 -1
- package/dist/cjs/config/config.cjs +7 -5
- package/dist/cjs/docs/openapi.yaml +1399 -0
- package/dist/cjs/routesManager.cjs +36 -48
- package/dist/cjs/telemetry/custom-implementations/exporters/InMemoryDbLogExporter.cjs +43 -13
- package/dist/cjs/telemetry/custom-implementations/exporters/InMemoryDbMetricExporter.cjs +10 -2
- package/dist/cjs/telemetry/custom-implementations/exporters/InMemoryDbSpanExporter.cjs +21 -16
- package/dist/cjs/telemetry/initializeTelemetry.cjs +39 -15
- package/dist/cjs/telemetry/telemetryConfigurator.cjs +6 -9
- package/dist/cjs/telemetry/telemetryRegistry.cjs +11 -8
- package/dist/cjs/tlm-ai/agent.cjs +54 -84
- package/dist/cjs/tlm-ai/aiController.cjs +69 -47
- package/dist/cjs/tlm-ai/aiRoutes.cjs +10 -3
- package/dist/cjs/tlm-ai/aiService.cjs +109 -0
- package/dist/cjs/tlm-ai/tools.cjs +30 -268
- package/dist/cjs/tlm-auth/authController.cjs +91 -26
- package/dist/cjs/tlm-auth/authMiddleware.cjs +20 -7
- package/dist/cjs/tlm-auth/authRoutes.cjs +3 -2
- package/dist/cjs/tlm-log/logController.cjs +30 -36
- package/dist/cjs/tlm-log/logRoutes.cjs +3 -2
- package/dist/cjs/tlm-metric/metricsController.cjs +15 -8
- package/dist/cjs/tlm-metric/metricsRoutes.cjs +2 -1
- package/dist/cjs/tlm-plugin/pluginController.cjs +11 -1
- package/dist/cjs/tlm-plugin/pluginProcess.cjs +4 -2
- package/dist/cjs/tlm-plugin/pluginService.cjs +3 -0
- package/dist/cjs/tlm-trace/traceController.cjs +16 -9
- package/dist/cjs/tlm-trace/traceRoutes.cjs +2 -1
- package/dist/cjs/tlm-util/utilController.cjs +23 -2
- package/dist/cjs/tlm-util/utilRoutes.cjs +44 -5
- package/dist/cjs/utils/logger.cjs +35 -13
- package/dist/esm/config/bootConfig.js +2 -0
- package/dist/esm/config/config.js +4 -2
- package/dist/esm/docs/openapi.yaml +1399 -0
- package/dist/esm/routesManager.js +37 -49
- package/dist/esm/telemetry/custom-implementations/exporters/InMemoryDbLogExporter.js +32 -11
- package/dist/esm/telemetry/custom-implementations/exporters/InMemoryDbMetricExporter.js +10 -2
- package/dist/esm/telemetry/custom-implementations/exporters/InMemoryDbSpanExporter.js +20 -13
- package/dist/esm/telemetry/initializeTelemetry.js +22 -14
- package/dist/esm/telemetry/telemetryConfigurator.js +7 -10
- package/dist/esm/telemetry/telemetryRegistry.js +10 -7
- package/dist/esm/tlm-ai/agent.js +37 -78
- package/dist/esm/tlm-ai/aiController.js +56 -39
- package/dist/esm/tlm-ai/aiRoutes.js +11 -4
- package/dist/esm/tlm-ai/aiService.js +94 -0
- package/dist/esm/tlm-ai/tools.js +29 -255
- package/dist/esm/tlm-auth/authController.js +62 -20
- package/dist/esm/tlm-auth/authMiddleware.js +18 -9
- package/dist/esm/tlm-auth/authRoutes.js +4 -3
- package/dist/esm/tlm-log/logController.js +26 -28
- package/dist/esm/tlm-log/logRoutes.js +4 -3
- package/dist/esm/tlm-metric/metricsController.js +10 -6
- package/dist/esm/tlm-metric/metricsRoutes.js +3 -2
- package/dist/esm/tlm-plugin/pluginController.js +2 -1
- package/dist/esm/tlm-plugin/pluginProcess.js +4 -2
- package/dist/esm/tlm-plugin/pluginService.js +4 -0
- package/dist/esm/tlm-trace/traceController.js +11 -7
- package/dist/esm/tlm-trace/traceRoutes.js +3 -2
- package/dist/esm/tlm-util/utilController.js +22 -0
- package/dist/esm/tlm-util/utilRoutes.js +40 -5
- package/dist/esm/utils/logger.js +35 -12
- package/dist/types/config/bootConfig.d.ts +1 -0
- package/dist/types/config/config.d.ts +6 -3
- package/dist/types/telemetry/custom-implementations/exporters/InMemoryDbLogExporter.d.ts +7 -1
- package/dist/types/telemetry/custom-implementations/exporters/InMemoryDbMetricExporter.d.ts +1 -0
- package/dist/types/telemetry/custom-implementations/exporters/InMemoryDbSpanExporter.d.ts +1 -0
- package/dist/types/telemetry/telemetryRegistry.d.ts +22 -6
- package/dist/types/tlm-ai/agent.d.ts +2 -2
- package/dist/types/tlm-ai/aiController.d.ts +5 -4
- package/dist/types/tlm-ai/aiRoutes.d.ts +1 -1
- package/dist/types/tlm-ai/aiService.d.ts +38 -0
- package/dist/types/tlm-ai/tools.d.ts +5 -14
- package/dist/types/tlm-auth/authController.d.ts +2 -1
- package/dist/types/tlm-log/logController.d.ts +2 -2
- package/dist/types/tlm-metric/metricsController.d.ts +2 -1
- package/dist/types/tlm-plugin/pluginService.d.ts +2 -0
- package/dist/types/tlm-trace/traceController.d.ts +2 -1
- package/dist/types/tlm-util/utilController.d.ts +1 -0
- package/dist/types/utils/logger.d.ts +5 -5
- package/dist/ui/assets/ApiDocsPage-C_VVPPHa.js +16 -0
- package/dist/ui/assets/CollapsibleCard-B3KR_8mL.js +1 -0
- package/dist/ui/assets/DevToolsPage-OyZcDcmw.js +1 -0
- package/dist/ui/assets/LandingPage-CppFBA6K.js +6 -0
- package/dist/ui/assets/LogsPage-9Fq8GArS.js +26 -0
- package/dist/ui/assets/NotFoundPage-B3quk3P1.js +1 -0
- package/dist/ui/assets/PluginCreatePage-X_aCH4t4.js +50 -0
- package/dist/ui/assets/PluginPage-DMDSihrZ.js +27 -0
- package/dist/ui/assets/alert-jQ9HCPIf.js +1133 -0
- package/dist/ui/assets/badge-CNq0-mH5.js +1 -0
- package/dist/ui/assets/card-DFAwwhN3.js +1 -0
- package/dist/ui/assets/chevron-down-CPsvsmqj.js +6 -0
- package/dist/ui/assets/chevron-up-Df9jMo1X.js +6 -0
- package/dist/ui/assets/circle-alert-DOPQPvU8.js +6 -0
- package/dist/ui/assets/index-BkD6DijD.js +15 -0
- package/dist/ui/assets/index-CERGVYZK.js +292 -0
- package/dist/ui/assets/index-CSIPf9qw.css +1 -0
- package/dist/ui/assets/input-Dzvg_ZEZ.js +1 -0
- package/dist/ui/assets/label-DuVnkZ4q.js +1 -0
- package/dist/ui/assets/loader-circle-CrvlRy5o.js +6 -0
- package/dist/ui/assets/loginPage-qa4V-B70.js +6 -0
- package/dist/ui/assets/select-DhS8YUtJ.js +1 -0
- package/dist/ui/assets/separator-isK4chBP.js +6 -0
- package/dist/ui/assets/severityOptions-O38dSOfk.js +11 -0
- package/dist/ui/assets/switch-Z3mImG9n.js +1 -0
- package/dist/ui/assets/tabs-_77MUUQe.js +16 -0
- package/dist/ui/assets/upload-C1LT4Gkb.js +16 -0
- package/dist/ui/assets/utilService-DNyqzwj0.js +1 -0
- package/dist/ui/index.html +2 -2
- package/package.json +18 -7
- package/dist/ui/assets/index-BzIdRox6.js +0 -1733
- package/dist/ui/assets/index-CkoHzrrt.css +0 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import{c as At,r as h,u as zt,a as Dr,j as c,P as Be,b as Po,d as $r,e as Zn,g as Oo,i as Fr,R as Wr,f as _r,h as it,A as Lo,k as Vr,J as Ur,K as Gr,L as qr,N as Kr,O as Xr,C as Jr,l as Yr,o as fe,Q as jt,B as Je,G as Zr,X as Qr,I as es,V as Ao,t as Se,Y as D,Z as ts}from"./index-CERGVYZK.js";import{s as bn,l as qe}from"./severityOptions-O38dSOfk.js";import{C as Ln,a as An}from"./card-DFAwwhN3.js";import{I as yn}from"./input-Dzvg_ZEZ.js";import{L as pt}from"./label-DuVnkZ4q.js";import{S as In,T as ns}from"./separator-isK4chBP.js";import{B as Jt}from"./badge-CNq0-mH5.js";import{R as os,d as rs,O as ss,C as ls,P as Qn,a as is}from"./index-BkD6DijD.js";import{C as eo}from"./chevron-down-CPsvsmqj.js";import{C as un,W as zo,T as as,a as cs,b as to,c as no}from"./tabs-_77MUUQe.js";import{C as zn}from"./CollapsibleCard-B3KR_8mL.js";import"./circle-alert-DOPQPvU8.js";import"./chevron-up-Df9jMo1X.js";/**
|
|
2
|
+
* @license lucide-react v0.515.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const us=[["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"}]],oo=At("activity",us);/**
|
|
7
|
+
* @license lucide-react v0.515.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const ds=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],ro=At("circle-x",ds);/**
|
|
12
|
+
* @license lucide-react v0.515.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const fs=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],ms=At("clock",fs);/**
|
|
17
|
+
* @license lucide-react v0.515.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const hs=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],ps=At("code-xml",hs);/**
|
|
22
|
+
* @license lucide-react v0.515.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const gs=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ho=At("search",gs);function Ye(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}var vs="DismissableLayer",Cn="dismissableLayer.update",xs="dismissableLayer.pointerDownOutside",ws="dismissableLayer.focusOutside",so,Mo=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Bo=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:l,onDismiss:i,...u}=e,a=h.useContext(Mo),[f,x]=h.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,m]=h.useState({}),S=zt(t,y=>x(y)),j=Array.from(a.layers),[b]=[...a.layersWithOutsidePointerEventsDisabled].slice(-1),w=j.indexOf(b),v=f?j.indexOf(f):-1,I=a.layersWithOutsidePointerEventsDisabled.size>0,P=v>=w,p=Is(y=>{const O=y.target,k=[...a.branches].some(L=>L.contains(O));!P||k||(r==null||r(y),l==null||l(y),y.defaultPrevented||i==null||i())},g),d=Cs(y=>{const O=y.target;[...a.branches].some(L=>L.contains(O))||(s==null||s(y),l==null||l(y),y.defaultPrevented||i==null||i())},g);return Dr(y=>{v===a.layers.size-1&&(o==null||o(y),!y.defaultPrevented&&i&&(y.preventDefault(),i()))},g),h.useEffect(()=>{if(f)return n&&(a.layersWithOutsidePointerEventsDisabled.size===0&&(so=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),a.layersWithOutsidePointerEventsDisabled.add(f)),a.layers.add(f),lo(),()=>{n&&a.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=so)}},[f,g,n,a]),h.useEffect(()=>()=>{f&&(a.layers.delete(f),a.layersWithOutsidePointerEventsDisabled.delete(f),lo())},[f,a]),h.useEffect(()=>{const y=()=>m({});return document.addEventListener(Cn,y),()=>document.removeEventListener(Cn,y)},[]),c.jsx(Be.div,{...u,ref:S,style:{pointerEvents:I?P?"auto":"none":void 0,...e.style},onFocusCapture:Ye(e.onFocusCapture,d.onFocusCapture),onBlurCapture:Ye(e.onBlurCapture,d.onBlurCapture),onPointerDownCapture:Ye(e.onPointerDownCapture,p.onPointerDownCapture)})});Bo.displayName=vs;var bs="DismissableLayerBranch",ys=h.forwardRef((e,t)=>{const n=h.useContext(Mo),o=h.useRef(null),r=zt(t,o);return h.useEffect(()=>{const s=o.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),c.jsx(Be.div,{...e,ref:r})});ys.displayName=bs;function Is(e,t=globalThis==null?void 0:globalThis.document){const n=Po(e),o=h.useRef(!1),r=h.useRef(()=>{});return h.useEffect(()=>{const s=i=>{if(i.target&&!o.current){let u=function(){Do(xs,n,a,{discrete:!0})};const a={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=u,t.addEventListener("click",r.current,{once:!0})):u()}else t.removeEventListener("click",r.current);o.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",s),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function Cs(e,t=globalThis==null?void 0:globalThis.document){const n=Po(e),o=h.useRef(!1);return h.useEffect(()=>{const r=s=>{s.target&&!o.current&&Do(ws,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function lo(){const e=new CustomEvent(Cn);document.dispatchEvent(e)}function Do(e,t,n,{discrete:o}){const r=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?$r(r,s):r.dispatchEvent(s)}function Ss(e,t){return h.useReducer((n,o)=>t[n][o]??n,e)}var Hn=e=>{const{present:t,children:n}=e,o=Ts(t),r=typeof n=="function"?n({present:o.isPresent}):h.Children.only(n),s=zt(o.ref,Es(r));return typeof n=="function"||o.isPresent?h.cloneElement(r,{ref:s}):null};Hn.displayName="Presence";function Ts(e){const[t,n]=h.useState(),o=h.useRef(null),r=h.useRef(e),s=h.useRef("none"),l=e?"mounted":"unmounted",[i,u]=Ss(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const a=Vt(o.current);s.current=i==="mounted"?a:"none"},[i]),Zn(()=>{const a=o.current,f=r.current;if(f!==e){const g=s.current,m=Vt(a);e?u("MOUNT"):m==="none"||(a==null?void 0:a.display)==="none"?u("UNMOUNT"):u(f&&g!==m?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,u]),Zn(()=>{if(t){let a;const f=t.ownerDocument.defaultView??window,x=m=>{const j=Vt(o.current).includes(CSS.escape(m.animationName));if(m.target===t&&j&&(u("ANIMATION_END"),!r.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",a=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},g=m=>{m.target===t&&(s.current=Vt(o.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",x),t.addEventListener("animationend",x),()=>{f.clearTimeout(a),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",x),t.removeEventListener("animationend",x)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:h.useCallback(a=>{o.current=a?getComputedStyle(a):null,n(a)},[])}}function Vt(e){return(e==null?void 0:e.animationName)||"none"}function Es(e){var o,r;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var tn="Popover",[$o,ma]=_r(tn,[Oo]),Ht=Oo(),[Rs,et]=$o(tn),Fo=e=>{const{__scopePopover:t,children:n,open:o,defaultOpen:r,onOpenChange:s,modal:l=!1}=e,i=Ht(t),u=h.useRef(null),[a,f]=h.useState(!1),[x,g]=Fr({prop:o,defaultProp:r??!1,onChange:s,caller:tn});return c.jsx(Wr,{...i,children:c.jsx(Rs,{scope:t,contentId:it(),triggerRef:u,open:x,onOpenChange:g,onOpenToggle:h.useCallback(()=>g(m=>!m),[g]),hasCustomAnchor:a,onCustomAnchorAdd:h.useCallback(()=>f(!0),[]),onCustomAnchorRemove:h.useCallback(()=>f(!1),[]),modal:l,children:n})})};Fo.displayName=tn;var Wo="PopoverAnchor",js=h.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=et(Wo,n),s=Ht(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:i}=r;return h.useEffect(()=>(l(),()=>i()),[l,i]),c.jsx(Lo,{...s,...o,ref:t})});js.displayName=Wo;var _o="PopoverTrigger",Vo=h.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=et(_o,n),s=Ht(n),l=zt(t,r.triggerRef),i=c.jsx(Be.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Xo(r.open),...o,ref:l,onClick:Ye(e.onClick,r.onOpenToggle)});return r.hasCustomAnchor?i:c.jsx(Lo,{asChild:!0,...s,children:i})});Vo.displayName=_o;var Mn="PopoverPortal",[ks,Ns]=$o(Mn,{forceMount:void 0}),Uo=e=>{const{__scopePopover:t,forceMount:n,children:o,container:r}=e,s=et(Mn,t);return c.jsx(ks,{scope:t,forceMount:n,children:c.jsx(Hn,{present:n||s.open,children:c.jsx(Vr,{asChild:!0,container:r,children:o})})})};Uo.displayName=Mn;var wt="PopoverContent",Go=h.forwardRef((e,t)=>{const n=Ns(wt,e.__scopePopover),{forceMount:o=n.forceMount,...r}=e,s=et(wt,e.__scopePopover);return c.jsx(Hn,{present:o||s.open,children:s.modal?c.jsx(Os,{...r,ref:t}):c.jsx(Ls,{...r,ref:t})})});Go.displayName=wt;var Ps=qr("PopoverContent.RemoveScroll"),Os=h.forwardRef((e,t)=>{const n=et(wt,e.__scopePopover),o=h.useRef(null),r=zt(t,o),s=h.useRef(!1);return h.useEffect(()=>{const l=o.current;if(l)return Ur(l)},[]),c.jsx(Gr,{as:Ps,allowPinchZoom:!0,children:c.jsx(qo,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ye(e.onCloseAutoFocus,l=>{var i;l.preventDefault(),s.current||(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:Ye(e.onPointerDownOutside,l=>{const i=l.detail.originalEvent,u=i.button===0&&i.ctrlKey===!0,a=i.button===2||u;s.current=a},{checkForDefaultPrevented:!1}),onFocusOutside:Ye(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),Ls=h.forwardRef((e,t)=>{const n=et(wt,e.__scopePopover),o=h.useRef(!1),r=h.useRef(!1);return c.jsx(qo,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var l,i;(l=e.onCloseAutoFocus)==null||l.call(e,s),s.defaultPrevented||(o.current||(i=n.triggerRef.current)==null||i.focus(),s.preventDefault()),o.current=!1,r.current=!1},onInteractOutside:s=>{var u,a;(u=e.onInteractOutside)==null||u.call(e,s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const l=s.target;((a=n.triggerRef.current)==null?void 0:a.contains(l))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&r.current&&s.preventDefault()}})}),qo=h.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEscapeKeyDown:i,onPointerDownOutside:u,onFocusOutside:a,onInteractOutside:f,...x}=e,g=et(wt,n),m=Ht(n);return Kr(),c.jsx(Xr,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:s,children:c.jsx(Bo,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:f,onEscapeKeyDown:i,onPointerDownOutside:u,onFocusOutside:a,onDismiss:()=>g.onOpenChange(!1),children:c.jsx(Jr,{"data-state":Xo(g.open),role:"dialog",id:g.contentId,...m,...x,ref:t,style:{...x.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Ko="PopoverClose",As=h.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=et(Ko,n);return c.jsx(Be.button,{type:"button",...o,ref:t,onClick:Ye(e.onClick,()=>r.onOpenChange(!1))})});As.displayName=Ko;var zs="PopoverArrow",Hs=h.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=Ht(n);return c.jsx(Yr,{...r,...o,ref:t})});Hs.displayName=zs;function Xo(e){return e?"open":"closed"}var Ms=Fo,Bs=Vo,Ds=Uo,$s=Go;function Fs({...e}){return c.jsx(Ms,{"data-slot":"popover",...e})}function Ws({...e}){return c.jsx(Bs,{"data-slot":"popover-trigger",...e})}function _s({className:e,align:t="center",sideOffset:n=4,...o}){return c.jsx(Ds,{children:c.jsx($s,{"data-slot":"popover-content",align:t,sideOffset:n,className:fe("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...o})})}var io=1,Vs=.9,Us=.8,Gs=.17,dn=.1,fn=.999,qs=.9999,Ks=.99,Xs=/[\\\/_+.#"@\[\(\{&]/,Js=/[\\\/_+.#"@\[\(\{&]/g,Ys=/[\s-]/,Jo=/[\s-]/g;function Sn(e,t,n,o,r,s,l){if(s===t.length)return r===e.length?io:Ks;var i=`${r},${s}`;if(l[i]!==void 0)return l[i];for(var u=o.charAt(s),a=n.indexOf(u,r),f=0,x,g,m,S;a>=0;)x=Sn(e,t,n,o,a+1,s+1,l),x>f&&(a===r?x*=io:Xs.test(e.charAt(a-1))?(x*=Us,m=e.slice(r,a-1).match(Js),m&&r>0&&(x*=Math.pow(fn,m.length))):Ys.test(e.charAt(a-1))?(x*=Vs,S=e.slice(r,a-1).match(Jo),S&&r>0&&(x*=Math.pow(fn,S.length))):(x*=Gs,r>0&&(x*=Math.pow(fn,a-r))),e.charAt(a)!==t.charAt(s)&&(x*=qs)),(x<dn&&n.charAt(a-1)===o.charAt(s+1)||o.charAt(s+1)===o.charAt(s)&&n.charAt(a-1)!==o.charAt(s))&&(g=Sn(e,t,n,o,a+1,s+2,l),g*dn>x&&(x=g*dn)),x>f&&(f=x),a=n.indexOf(u,a+1);return l[i]=f,f}function ao(e){return e.toLowerCase().replace(Jo," ")}function Zs(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Sn(e,t,ao(e),ao(t),0,0,{})}var St='[cmdk-group=""]',mn='[cmdk-group-items=""]',Qs='[cmdk-group-heading=""]',Yo='[cmdk-item=""]',co=`${Yo}:not([aria-disabled="true"])`,Tn="cmdk-item-select",gt="data-value",el=(e,t,n)=>Zs(e,t,n),Zo=h.createContext(void 0),Mt=()=>h.useContext(Zo),Qo=h.createContext(void 0),Bn=()=>h.useContext(Qo),er=h.createContext(void 0),tr=h.forwardRef((e,t)=>{let n=vt(()=>{var T,F;return{search:"",value:(F=(T=e.value)!=null?T:e.defaultValue)!=null?F:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),o=vt(()=>new Set),r=vt(()=>new Map),s=vt(()=>new Map),l=vt(()=>new Set),i=nr(e),{label:u,children:a,value:f,onValueChange:x,filter:g,shouldFilter:m,loop:S,disablePointerSelection:j=!1,vimBindings:b=!0,...w}=e,v=it(),I=it(),P=it(),p=h.useRef(null),d=dl();at(()=>{if(f!==void 0){let T=f.trim();n.current.value=T,y.emit()}},[f]),at(()=>{d(6,ne)},[]);let y=h.useMemo(()=>({subscribe:T=>(l.current.add(T),()=>l.current.delete(T)),snapshot:()=>n.current,setState:(T,F,q)=>{var M,X,Z,R;if(!Object.is(n.current[T],F)){if(n.current[T]=F,T==="search")U(),L(),d(1,B);else if(T==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let W=document.getElementById(P);W?W.focus():(M=document.getElementById(v))==null||M.focus()}if(d(7,()=>{var W;n.current.selectedItemId=(W=A())==null?void 0:W.id,y.emit()}),q||d(5,ne),((X=i.current)==null?void 0:X.value)!==void 0){let W=F??"";(R=(Z=i.current).onValueChange)==null||R.call(Z,W);return}}y.emit()}},emit:()=>{l.current.forEach(T=>T())}}),[]),O=h.useMemo(()=>({value:(T,F,q)=>{var M;F!==((M=s.current.get(T))==null?void 0:M.value)&&(s.current.set(T,{value:F,keywords:q}),n.current.filtered.items.set(T,k(F,q)),d(2,()=>{L(),y.emit()}))},item:(T,F)=>(o.current.add(T),F&&(r.current.has(F)?r.current.get(F).add(T):r.current.set(F,new Set([T]))),d(3,()=>{U(),L(),n.current.value||B(),y.emit()}),()=>{s.current.delete(T),o.current.delete(T),n.current.filtered.items.delete(T);let q=A();d(4,()=>{U(),(q==null?void 0:q.getAttribute("id"))===T&&B(),y.emit()})}),group:T=>(r.current.has(T)||r.current.set(T,new Set),()=>{s.current.delete(T),r.current.delete(T)}),filter:()=>i.current.shouldFilter,label:u||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:v,inputId:P,labelId:I,listInnerRef:p}),[]);function k(T,F){var q,M;let X=(M=(q=i.current)==null?void 0:q.filter)!=null?M:el;return T?X(T,n.current.search,F):0}function L(){if(!n.current.search||i.current.shouldFilter===!1)return;let T=n.current.filtered.items,F=[];n.current.filtered.groups.forEach(M=>{let X=r.current.get(M),Z=0;X.forEach(R=>{let W=T.get(R);Z=Math.max(W,Z)}),F.push([M,Z])});let q=p.current;_().sort((M,X)=>{var Z,R;let W=M.getAttribute("id"),Q=X.getAttribute("id");return((Z=T.get(Q))!=null?Z:0)-((R=T.get(W))!=null?R:0)}).forEach(M=>{let X=M.closest(mn);X?X.appendChild(M.parentElement===X?M:M.closest(`${mn} > *`)):q.appendChild(M.parentElement===q?M:M.closest(`${mn} > *`))}),F.sort((M,X)=>X[1]-M[1]).forEach(M=>{var X;let Z=(X=p.current)==null?void 0:X.querySelector(`${St}[${gt}="${encodeURIComponent(M[0])}"]`);Z==null||Z.parentElement.appendChild(Z)})}function B(){let T=_().find(q=>q.getAttribute("aria-disabled")!=="true"),F=T==null?void 0:T.getAttribute(gt);y.setState("value",F||void 0)}function U(){var T,F,q,M;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=o.current.size;return}n.current.filtered.groups=new Set;let X=0;for(let Z of o.current){let R=(F=(T=s.current.get(Z))==null?void 0:T.value)!=null?F:"",W=(M=(q=s.current.get(Z))==null?void 0:q.keywords)!=null?M:[],Q=k(R,W);n.current.filtered.items.set(Z,Q),Q>0&&X++}for(let[Z,R]of r.current)for(let W of R)if(n.current.filtered.items.get(W)>0){n.current.filtered.groups.add(Z);break}n.current.filtered.count=X}function ne(){var T,F,q;let M=A();M&&(((T=M.parentElement)==null?void 0:T.firstChild)===M&&((q=(F=M.closest(St))==null?void 0:F.querySelector(Qs))==null||q.scrollIntoView({block:"nearest"})),M.scrollIntoView({block:"nearest"}))}function A(){var T;return(T=p.current)==null?void 0:T.querySelector(`${Yo}[aria-selected="true"]`)}function _(){var T;return Array.from(((T=p.current)==null?void 0:T.querySelectorAll(co))||[])}function ie(T){let F=_()[T];F&&y.setState("value",F.getAttribute(gt))}function be(T){var F;let q=A(),M=_(),X=M.findIndex(R=>R===q),Z=M[X+T];(F=i.current)!=null&&F.loop&&(Z=X+T<0?M[M.length-1]:X+T===M.length?M[0]:M[X+T]),Z&&y.setState("value",Z.getAttribute(gt))}function Ie(T){let F=A(),q=F==null?void 0:F.closest(St),M;for(;q&&!M;)q=T>0?cl(q,St):ul(q,St),M=q==null?void 0:q.querySelector(co);M?y.setState("value",M.getAttribute(gt)):be(T)}let Te=()=>ie(_().length-1),ve=T=>{T.preventDefault(),T.metaKey?Te():T.altKey?Ie(1):be(1)},me=T=>{T.preventDefault(),T.metaKey?ie(0):T.altKey?Ie(-1):be(-1)};return h.createElement(Be.div,{ref:t,tabIndex:-1,...w,"cmdk-root":"",onKeyDown:T=>{var F;(F=w.onKeyDown)==null||F.call(w,T);let q=T.nativeEvent.isComposing||T.keyCode===229;if(!(T.defaultPrevented||q))switch(T.key){case"n":case"j":{b&&T.ctrlKey&&ve(T);break}case"ArrowDown":{ve(T);break}case"p":case"k":{b&&T.ctrlKey&&me(T);break}case"ArrowUp":{me(T);break}case"Home":{T.preventDefault(),ie(0);break}case"End":{T.preventDefault(),Te();break}case"Enter":{T.preventDefault();let M=A();if(M){let X=new Event(Tn);M.dispatchEvent(X)}}}}},h.createElement("label",{"cmdk-label":"",htmlFor:O.inputId,id:O.labelId,style:ml},u),nn(e,T=>h.createElement(Qo.Provider,{value:y},h.createElement(Zo.Provider,{value:O},T))))}),tl=h.forwardRef((e,t)=>{var n,o;let r=it(),s=h.useRef(null),l=h.useContext(er),i=Mt(),u=nr(e),a=(o=(n=u.current)==null?void 0:n.forceMount)!=null?o:l==null?void 0:l.forceMount;at(()=>{if(!a)return i.item(r,l==null?void 0:l.id)},[a]);let f=or(r,s,[e.value,e.children,s],e.keywords),x=Bn(),g=Ze(d=>d.value&&d.value===f.current),m=Ze(d=>a||i.filter()===!1?!0:d.search?d.filtered.items.get(r)>0:!0);h.useEffect(()=>{let d=s.current;if(!(!d||e.disabled))return d.addEventListener(Tn,S),()=>d.removeEventListener(Tn,S)},[m,e.onSelect,e.disabled]);function S(){var d,y;j(),(y=(d=u.current).onSelect)==null||y.call(d,f.current)}function j(){x.setState("value",f.current,!0)}if(!m)return null;let{disabled:b,value:w,onSelect:v,forceMount:I,keywords:P,...p}=e;return h.createElement(Be.div,{ref:jt(s,t),...p,id:r,"cmdk-item":"",role:"option","aria-disabled":!!b,"aria-selected":!!g,"data-disabled":!!b,"data-selected":!!g,onPointerMove:b||i.getDisablePointerSelection()?void 0:j,onClick:b?void 0:S},e.children)}),nl=h.forwardRef((e,t)=>{let{heading:n,children:o,forceMount:r,...s}=e,l=it(),i=h.useRef(null),u=h.useRef(null),a=it(),f=Mt(),x=Ze(m=>r||f.filter()===!1?!0:m.search?m.filtered.groups.has(l):!0);at(()=>f.group(l),[]),or(l,i,[e.value,e.heading,u]);let g=h.useMemo(()=>({id:l,forceMount:r}),[r]);return h.createElement(Be.div,{ref:jt(i,t),...s,"cmdk-group":"",role:"presentation",hidden:x?void 0:!0},n&&h.createElement("div",{ref:u,"cmdk-group-heading":"","aria-hidden":!0,id:a},n),nn(e,m=>h.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?a:void 0},h.createElement(er.Provider,{value:g},m))))}),ol=h.forwardRef((e,t)=>{let{alwaysRender:n,...o}=e,r=h.useRef(null),s=Ze(l=>!l.search);return!n&&!s?null:h.createElement(Be.div,{ref:jt(r,t),...o,"cmdk-separator":"",role:"separator"})}),rl=h.forwardRef((e,t)=>{let{onValueChange:n,...o}=e,r=e.value!=null,s=Bn(),l=Ze(a=>a.search),i=Ze(a=>a.selectedItemId),u=Mt();return h.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),h.createElement(Be.input,{ref:t,...o,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":u.listId,"aria-labelledby":u.labelId,"aria-activedescendant":i,id:u.inputId,type:"text",value:r?e.value:l,onChange:a=>{r||s.setState("search",a.target.value),n==null||n(a.target.value)}})}),sl=h.forwardRef((e,t)=>{let{children:n,label:o="Suggestions",...r}=e,s=h.useRef(null),l=h.useRef(null),i=Ze(a=>a.selectedItemId),u=Mt();return h.useEffect(()=>{if(l.current&&s.current){let a=l.current,f=s.current,x,g=new ResizeObserver(()=>{x=requestAnimationFrame(()=>{let m=a.offsetHeight;f.style.setProperty("--cmdk-list-height",m.toFixed(1)+"px")})});return g.observe(a),()=>{cancelAnimationFrame(x),g.unobserve(a)}}},[]),h.createElement(Be.div,{ref:jt(s,t),...r,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":o,id:u.listId},nn(e,a=>h.createElement("div",{ref:jt(l,u.listInnerRef),"cmdk-list-sizer":""},a)))}),ll=h.forwardRef((e,t)=>{let{open:n,onOpenChange:o,overlayClassName:r,contentClassName:s,container:l,...i}=e;return h.createElement(os,{open:n,onOpenChange:o},h.createElement(rs,{container:l},h.createElement(ss,{"cmdk-overlay":"",className:r}),h.createElement(ls,{"aria-label":e.label,"cmdk-dialog":"",className:s},h.createElement(tr,{ref:t,...i}))))}),il=h.forwardRef((e,t)=>Ze(n=>n.filtered.count===0)?h.createElement(Be.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),al=h.forwardRef((e,t)=>{let{progress:n,children:o,label:r="Loading...",...s}=e;return h.createElement(Be.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":r},nn(e,l=>h.createElement("div",{"aria-hidden":!0},l)))}),ut=Object.assign(tr,{List:sl,Item:tl,Input:rl,Group:nl,Separator:ol,Dialog:ll,Empty:il,Loading:al});function cl(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function ul(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function nr(e){let t=h.useRef(e);return at(()=>{t.current=e}),t}var at=typeof window>"u"?h.useEffect:h.useLayoutEffect;function vt(e){let t=h.useRef();return t.current===void 0&&(t.current=e()),t}function Ze(e){let t=Bn(),n=()=>e(t.snapshot());return h.useSyncExternalStore(t.subscribe,n,n)}function or(e,t,n,o=[]){let r=h.useRef(),s=Mt();return at(()=>{var l;let i=(()=>{var a;for(let f of n){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(a=f.current.textContent)==null?void 0:a.trim():r.current}})(),u=o.map(a=>a.trim());s.value(e,i,u),(l=t.current)==null||l.setAttribute(gt,i),r.current=i}),r}var dl=()=>{let[e,t]=h.useState(),n=vt(()=>new Map);return at(()=>{n.current.forEach(o=>o()),n.current=new Map},[e]),(o,r)=>{n.current.set(o,r),t({})}};function fl(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function nn({asChild:e,children:t},n){return e&&h.isValidElement(t)?h.cloneElement(fl(t),{ref:t.ref},n(t.props.children)):n(t)}var ml={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function hl({className:e,...t}){return c.jsx(ut,{"data-slot":"command",className:fe("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function pl({className:e,...t}){return c.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[c.jsx(Ho,{className:"size-4 shrink-0 opacity-50"}),c.jsx(ut.Input,{"data-slot":"command-input",className:fe("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function gl({className:e,...t}){return c.jsx(ut.List,{"data-slot":"command-list",className:fe("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function vl({...e}){return c.jsx(ut.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function Ut({className:e,...t}){return c.jsx(ut.Group,{"data-slot":"command-group",className:fe("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function xl({className:e,...t}){return c.jsx(ut.Separator,{"data-slot":"command-separator",className:fe("bg-border -mx-1 h-px",e),...t})}function Tt({className:e,...t}){return c.jsx(ut.Item,{"data-slot":"command-item",className:fe("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}const uo=Zr("m-1 transition-all duration-300 ease-in-out",{variants:{variant:{default:"border-foreground/10 text-foreground bg-card hover:bg-card/80",secondary:"border-foreground/10 bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",inverted:"inverted"},badgeAnimation:{bounce:"hover:-translate-y-1 hover:scale-110",pulse:"hover:animate-pulse",wiggle:"hover:animate-wiggle",fade:"hover:opacity-80",slide:"hover:translate-x-1",none:""}},defaultVariants:{variant:"default",badgeAnimation:"bounce"}}),En=h.forwardRef(({options:e,onValueChange:t,variant:n,defaultValue:o=[],placeholder:r="Select options",animation:s=0,animationConfig:l,maxCount:i=3,modalPopover:u=!1,className:a,hideSelectAll:f=!1,searchable:x=!0,emptyIndicator:g,autoSize:m=!1,singleLine:S=!1,popoverClassName:j,disabled:b=!1,responsive:w,minWidth:v,maxWidth:I,deduplicateOptions:P=!1,resetOnDefaultValueChange:p=!0,closeOnSelect:d=!1,...y},O)=>{const[k,L]=h.useState(o),[B,U]=h.useState(!1),[ne,A]=h.useState(!1),[_,ie]=h.useState(""),[be,Ie]=h.useState(""),[Te,ve]=h.useState(""),me=h.useRef(k.length),T=h.useRef(B),F=h.useRef(_),q=h.useCallback((C,H="polite")=>{H==="assertive"?(ve(C),setTimeout(()=>ve(""),100)):(Ie(C),setTimeout(()=>Ie(""),100))},[]),M=h.useId(),X=`${M}-listbox`,Z=`${M}-description`,R=`${M}-count`,W=h.useRef(o),Q=h.useCallback(C=>C.length>0&&"heading"in C[0],[]),he=h.useCallback((C,H)=>{if(C.length!==H.length)return!1;const oe=[...C].sort(),ee=[...H].sort();return oe.every((ke,ze)=>ke===ee[ze])},[]),ue=h.useCallback(()=>{L(o),U(!1),ie(""),t(o)},[o,t]),ye=h.useRef(null);h.useImperativeHandle(O,()=>({reset:ue,getSelectedValues:()=>k,setSelectedValues:C=>{L(C),t(C)},clear:()=>{L([]),t([])},focus:()=>{if(ye.current){ye.current.focus();const C=ye.current.style.outline,H=ye.current.style.outlineOffset;ye.current.style.outline="2px solid hsl(var(--ring))",ye.current.style.outlineOffset="2px",setTimeout(()=>{ye.current&&(ye.current.style.outline=C,ye.current.style.outlineOffset=H)},1e3)}}}),[ue,k,t]);const[Ce,_e]=h.useState("desktop");h.useEffect(()=>{if(typeof window>"u")return;const C=()=>{const H=window.innerWidth;H<640?_e("mobile"):H<1024?_e("tablet"):_e("desktop")};return C(),window.addEventListener("resize",C),()=>{typeof window<"u"&&window.removeEventListener("resize",C)}},[]);const pe=(()=>{if(!w)return{maxCount:i,hideIcons:!1,compactMode:!1};if(w===!0){const oe={mobile:{maxCount:2,hideIcons:!1,compactMode:!0},tablet:{maxCount:4,hideIcons:!1,compactMode:!1},desktop:{maxCount:6,hideIcons:!1,compactMode:!1}}[Ce];return{maxCount:(oe==null?void 0:oe.maxCount)??i,hideIcons:(oe==null?void 0:oe.hideIcons)??!1,compactMode:(oe==null?void 0:oe.compactMode)??!1}}const C=w[Ce];return{maxCount:(C==null?void 0:C.maxCount)??i,hideIcons:(C==null?void 0:C.hideIcons)??!1,compactMode:(C==null?void 0:C.compactMode)??!1}})(),De=()=>{if(l!=null&&l.badgeAnimation)switch(l.badgeAnimation){case"bounce":return ne?"animate-bounce":"hover:-translate-y-1 hover:scale-110";case"pulse":return"hover:animate-pulse";case"wiggle":return"hover:animate-wiggle";case"fade":return"hover:opacity-80";case"slide":return"hover:translate-x-1";case"none":return"";default:return""}return ne?"animate-bounce":""},rt=()=>{if(l!=null&&l.popoverAnimation)switch(l.popoverAnimation){case"scale":return"animate-scaleIn";case"slide":return"animate-slideInDown";case"fade":return"animate-fadeIn";case"flip":return"animate-flipIn";case"none":return"";default:return""}return""},Ee=h.useCallback(()=>{if(e.length===0)return[];let C;Q(e)?C=e.flatMap(ke=>ke.options):C=e;const H=new Set,oe=[],ee=[];return C.forEach(ke=>{H.has(ke.value)?(oe.push(ke.value),P||ee.push(ke)):(H.add(ke.value),ee.push(ke))}),P?ee:C},[e,P,Q]),st=h.useCallback(C=>Ee().find(oe=>oe.value===C),[Ee]),mt=h.useMemo(()=>!x||!_?e:e.length===0?[]:Q(e)?e.map(C=>({...C,options:C.options.filter(H=>H.label.toLowerCase().includes(_.toLowerCase())||H.value.toLowerCase().includes(_.toLowerCase()))})).filter(C=>C.options.length>0):e.filter(C=>C.label.toLowerCase().includes(_.toLowerCase())||C.value.toLowerCase().includes(_.toLowerCase())),[e,_,x,Q]),ht=C=>{if(C.key==="Enter")U(!0);else if(C.key==="Backspace"&&!C.currentTarget.value){const H=[...k];H.pop(),L(H),t(H)}},$e=C=>{if(b)return;const H=st(C);if(H!=null&&H.disabled)return;const oe=k.includes(C)?k.filter(ee=>ee!==C):[...k,C];L(oe),t(oe),d&&U(!1)},Ae=()=>{b||(L([]),t([]))},Ft=()=>{b||U(C=>!C)},Wt=()=>{if(b)return;const C=k.slice(0,pe.maxCount);L(C),t(C)},_t=()=>{if(b)return;const C=Ee().filter(H=>!H.disabled);if(k.length===C.length)Ae();else{const H=C.map(oe=>oe.value);L(H),t(H)}d&&U(!1)};h.useEffect(()=>{if(!p)return;const C=W.current;he(C,o)||(he(k,o)||L(o),W.current=[...o])},[o,k,he,p]);const Ct={minWidth:v||(Ce==="mobile"?"0px":"200px"),maxWidth:I||"100%",width:m?"auto":"100%"};return h.useEffect(()=>{B||ie("")},[B]),h.useEffect(()=>{const C=k.length,H=Ee(),oe=H.filter(ee=>!ee.disabled).length;if(C!==me.current){const ee=C-me.current;if(ee>0){const ze=k.slice(-ee).map(Mr=>{var Yn;return(Yn=H.find(Br=>Br.value===Mr))==null?void 0:Yn.label}).filter(Boolean);ze.length===1?q(`${ze[0]} selected. ${C} of ${oe} options selected.`):q(`${ze.length} options selected. ${C} of ${oe} total selected.`)}else ee<0&&q(`Option removed. ${C} of ${oe} options selected.`);me.current=C}if(B!==T.current&&(q(B?`Dropdown opened. ${oe} options available. Use arrow keys to navigate.`:"Dropdown closed."),T.current=B),_!==F.current&&_!==void 0){if(_&&B){const ee=H.filter(ke=>ke.label.toLowerCase().includes(_.toLowerCase())||ke.value.toLowerCase().includes(_.toLowerCase())).length;q(`${ee} option${ee===1?"":"s"} found for "${_}"`)}F.current=_}},[k,B,_,q,Ee]),c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"sr-only",children:[c.jsx("div",{"aria-live":"polite","aria-atomic":"true",role:"status",children:be}),c.jsx("div",{"aria-live":"assertive","aria-atomic":"true",role:"alert",children:Te})]}),c.jsxs(Fs,{open:B,onOpenChange:U,modal:u,children:[c.jsx("div",{id:Z,className:"sr-only",children:"Multi-select dropdown. Use arrow keys to navigate, Enter to select, and Escape to close."}),c.jsx("div",{id:R,className:"sr-only","aria-live":"polite",children:k.length===0?"No options selected":`${k.length} option${k.length===1?"":"s"} selected: ${k.map(C=>{var H;return(H=st(C))==null?void 0:H.label}).filter(Boolean).join(", ")}`}),c.jsx(Ws,{asChild:!0,children:c.jsx(Je,{ref:ye,...y,onClick:Ft,disabled:b,role:"combobox","aria-expanded":B,"aria-haspopup":"listbox","aria-controls":B?X:void 0,"aria-describedby":`${Z} ${R}`,"aria-label":`Multi-select: ${k.length} of ${Ee().length} options selected. ${r}`,className:fe("flex p-1 rounded-md border min-h-10 h-auto items-center justify-between bg-inherit hover:bg-inherit [&_svg]:pointer-events-auto",m?"w-auto":"w-full",pe.compactMode&&"min-h-8 text-sm",Ce==="mobile"&&"min-h-12 text-base",b&&"opacity-50 cursor-not-allowed",a),style:{...Ct,maxWidth:`min(${Ct.maxWidth}, 100%)`},children:k.length>0?c.jsxs("div",{className:"flex justify-between items-center w-full",children:[c.jsxs("div",{className:fe("flex items-center gap-1",S?"overflow-x-auto multiselect-singleline-scroll":"flex-wrap",pe.compactMode&&"gap-0.5"),style:S?{paddingBottom:"4px"}:{},children:[k.slice(0,pe.maxCount).map(C=>{const H=st(C),oe=H==null?void 0:H.icon,ee=H==null?void 0:H.style;if(!H)return null;const ke={animationDuration:`${s}s`,...(ee==null?void 0:ee.badgeColor)&&{backgroundColor:ee.badgeColor},...(ee==null?void 0:ee.gradient)&&{background:ee.gradient,color:"white"}};return c.jsxs(Jt,{className:fe(De(),uo({variant:n}),(ee==null?void 0:ee.gradient)&&"text-white border-transparent",pe.compactMode&&"text-xs px-1.5 py-0.5",Ce==="mobile"&&"max-w-[120px] truncate",S&&"flex-shrink-0 whitespace-nowrap","[&>svg]:pointer-events-auto"),style:{...ke,animationDuration:`${(l==null?void 0:l.duration)||s}s`,animationDelay:`${(l==null?void 0:l.delay)||0}s`},children:[oe&&!pe.hideIcons&&c.jsx(oe,{className:fe("h-4 w-4 mr-2",pe.compactMode&&"h-3 w-3 mr-1",(ee==null?void 0:ee.iconColor)&&"text-current"),...(ee==null?void 0:ee.iconColor)&&{style:{color:ee.iconColor}}}),c.jsx("span",{className:fe(Ce==="mobile"&&"truncate"),children:H.label}),c.jsx("div",{role:"button",tabIndex:0,onClick:ze=>{ze.stopPropagation(),$e(C)},onKeyDown:ze=>{(ze.key==="Enter"||ze.key===" ")&&(ze.preventDefault(),ze.stopPropagation(),$e(C))},"aria-label":`Remove ${H.label} from selection`,className:"ml-2 h-4 w-4 cursor-pointer hover:bg-white/20 rounded-sm p-0.5 -m-0.5 focus:outline-none focus:ring-1 focus:ring-white/50",children:c.jsx(ro,{className:fe("h-3 w-3",pe.compactMode&&"h-2.5 w-2.5")})})]},C)}).filter(Boolean),k.length>pe.maxCount&&c.jsxs(Jt,{className:fe("bg-transparent text-foreground border-foreground/1 hover:bg-transparent",De(),uo({variant:n}),pe.compactMode&&"text-xs px-1.5 py-0.5",S&&"flex-shrink-0 whitespace-nowrap","[&>svg]:pointer-events-auto"),style:{animationDuration:`${(l==null?void 0:l.duration)||s}s`,animationDelay:`${(l==null?void 0:l.delay)||0}s`},children:[`+ ${k.length-pe.maxCount} more`,c.jsx(ro,{className:fe("ml-2 h-4 w-4 cursor-pointer",pe.compactMode&&"ml-1 h-3 w-3"),onClick:C=>{C.stopPropagation(),Wt()}})]})]}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("div",{role:"button",tabIndex:0,onClick:C=>{C.stopPropagation(),Ae()},onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),C.stopPropagation(),Ae())},"aria-label":`Clear all ${k.length} selected options`,className:"flex items-center justify-center h-4 w-4 mx-2 cursor-pointer text-muted-foreground hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 rounded-sm",children:c.jsx(Qr,{className:"h-4 w-4"})}),c.jsx(In,{orientation:"vertical",className:"flex min-h-6 h-full"}),c.jsx(eo,{className:"h-4 mx-2 cursor-pointer text-muted-foreground","aria-hidden":"true"})]})]}):c.jsxs("div",{className:"flex items-center justify-between w-full mx-auto",children:[c.jsx("span",{className:"text-sm text-muted-foreground mx-3",children:r}),c.jsx(eo,{className:"h-4 cursor-pointer text-muted-foreground mx-2"})]})})}),c.jsx(_s,{id:X,role:"listbox","aria-multiselectable":"true","aria-label":"Available options",className:fe("w-auto p-0",rt(),Ce==="mobile"&&"w-[85vw] max-w-[280px]",Ce==="tablet"&&"w-[70vw] max-w-md",Ce==="desktop"&&"min-w-[300px]",j),style:{animationDuration:`${(l==null?void 0:l.duration)||s}s`,animationDelay:`${(l==null?void 0:l.delay)||0}s`,maxWidth:`min(${Ct.maxWidth}, 85vw)`,maxHeight:Ce==="mobile"?"70vh":"60vh",touchAction:"manipulation"},align:"start",onEscapeKeyDown:()=>U(!1),children:c.jsxs(hl,{children:[x&&c.jsx(pl,{placeholder:"Search options...",onKeyDown:ht,value:_,onValueChange:ie,"aria-label":"Search through available options","aria-describedby":`${M}-search-help`}),x&&c.jsx("div",{id:`${M}-search-help`,className:"sr-only",children:"Type to filter options. Use arrow keys to navigate results."}),c.jsxs(gl,{className:fe("max-h-[40vh] overflow-y-auto multiselect-scrollbar",Ce==="mobile"&&"max-h-[50vh]","overscroll-behavior-y-contain"),children:[c.jsx(vl,{children:g||"No results found."})," ",!f&&!_&&c.jsx(Ut,{children:c.jsxs(Tt,{onSelect:_t,role:"option","aria-selected":k.length===Ee().filter(C=>!C.disabled).length,"aria-label":`Select all ${Ee().length} options`,className:"cursor-pointer",children:[c.jsx("div",{className:fe("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",k.length===Ee().filter(C=>!C.disabled).length?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),"aria-hidden":"true",children:c.jsx(un,{className:"h-4 w-4"})}),c.jsxs("span",{children:["(Select All",Ee().length>20?` - ${Ee().length} options`:"",")"]})]},"all")}),Q(mt)?mt.map(C=>c.jsx(Ut,{heading:C.heading,children:C.options.map(H=>{const oe=k.includes(H.value);return c.jsxs(Tt,{onSelect:()=>$e(H.value),role:"option","aria-selected":oe,"aria-disabled":H.disabled,"aria-label":`${H.label}${oe?", selected":", not selected"}${H.disabled?", disabled":""}`,className:fe("cursor-pointer",H.disabled&&"opacity-50 cursor-not-allowed"),disabled:H.disabled,children:[c.jsx("div",{className:fe("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",oe?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),"aria-hidden":"true",children:c.jsx(un,{className:"h-4 w-4"})}),H.icon&&c.jsx(H.icon,{className:"mr-2 h-4 w-4 text-muted-foreground","aria-hidden":"true"}),c.jsx("span",{children:H.label})]},H.value)})},C.heading)):c.jsx(Ut,{children:mt.map(C=>{const H=k.includes(C.value);return c.jsxs(Tt,{onSelect:()=>$e(C.value),role:"option","aria-selected":H,"aria-disabled":C.disabled,"aria-label":`${C.label}${H?", selected":", not selected"}${C.disabled?", disabled":""}`,className:fe("cursor-pointer",C.disabled&&"opacity-50 cursor-not-allowed"),disabled:C.disabled,children:[c.jsx("div",{className:fe("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",H?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),"aria-hidden":"true",children:c.jsx(un,{className:"h-4 w-4"})}),C.icon&&c.jsx(C.icon,{className:"mr-2 h-4 w-4 text-muted-foreground","aria-hidden":"true"}),c.jsx("span",{children:C.label})]},C.value)})}),c.jsx(xl,{}),c.jsx(Ut,{children:c.jsxs("div",{className:"flex items-center justify-between",children:[k.length>0&&c.jsxs(c.Fragment,{children:[c.jsx(Tt,{onSelect:Ae,className:"flex-1 justify-center cursor-pointer",children:"Clear"}),c.jsx(In,{orientation:"vertical",className:"flex min-h-6 h-full"})]}),c.jsx(Tt,{onSelect:()=>U(!1),className:"flex-1 justify-center cursor-pointer max-w-full",children:"Close"})]})})]})]})}),s>0&&k.length>0&&c.jsx(zo,{className:fe("cursor-pointer my-2 text-foreground bg-background w-3 h-3",ne?"":"text-muted-foreground"),onClick:()=>A(!ne)})]})]})});En.displayName="MultiSelect";const wl="normal",bl="advanced",yl=({uniqueServices:e,loading:t,onFiltersChange:n})=>{const[o,r]=h.useState("normal"),[s,l]=h.useState(""),[i,u]=h.useState([]),[a,f]=h.useState([]),[x,g]=h.useState(""),[m,S]=h.useState(""),[j,b]=h.useState(!1),w=()=>{let I={},P="";if(o===bl)try{I=x?JSON.parse(x):{},P=s}catch{Se.error("Invalid JSON in advanced query");return}else i.length>0&&(I={...I,severityText:{$in:i}}),a.length>0&&(I={...I,"resource.attributes.service.name":{$in:a}}),m.trim().length>0&&(I={...I,traceId:m.trim()}),P=s;n(I,P)},v=()=>{l(""),u([]),f([]),g(""),S(""),r(wl),n({},"")};return c.jsx(zn,{isOpen:j,onToggle:()=>b(I=>!I),header:c.jsxs(c.Fragment,{children:[c.jsxs(Ln,{className:"flex items-center gap-2",children:[c.jsx(Ho,{className:"h-5 w-5"}),"Search & Filters"]}),c.jsx(An,{children:"Filter logs by text, severity, service, or advanced query."})]}),children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx(pt,{htmlFor:"search",className:"text-sm",children:"Text Search"}),c.jsx(yn,{id:"search",placeholder:"Search logs...",value:s,onChange:I=>l(I.target.value),className:"mt-1",disabled:t})]}),c.jsxs(as,{value:o,onValueChange:I=>r(I),children:[c.jsxs(cs,{className:"grid w-full grid-cols-2",children:[c.jsx(to,{value:"normal",children:"Normal Filters"}),c.jsx(to,{value:"advanced",children:"Advanced Query"})]}),c.jsx(no,{value:"normal",className:"space-y-4",children:c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsxs("div",{className:"flex-1 min-w-[160px]",children:[c.jsx(pt,{htmlFor:"service",className:"text-sm",children:"Service"}),c.jsx(En,{id:"service",options:e.map(I=>({label:I,value:I})),value:a,onValueChange:f,disabled:t})]}),c.jsxs("div",{className:"flex-1 min-w-[160px] flex gap-4 flex-col sm:flex-row",children:[c.jsxs("div",{className:"flex-1",children:[c.jsx(pt,{htmlFor:"severity",className:"text-sm",children:"Severity Levels"}),c.jsx(En,{id:"severity",options:bn,value:i,onValueChange:u,disabled:t})]}),c.jsxs("div",{className:"flex-1",children:[c.jsx(pt,{htmlFor:"trace-id",className:"text-sm",children:"Trace ID"}),c.jsx(yn,{id:"trace-id",placeholder:"Enter trace id...",value:m,onChange:I=>S(I.target.value),className:"min-h-[40px]",disabled:t})]})]})]})}),c.jsx(no,{value:"advanced",className:"space-y-4",children:c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-2",children:[c.jsx(pt,{htmlFor:"mongo-query",className:"text-sm",children:"Advanced Query (JSON)"}),c.jsxs(Je,{type:"button",variant:"outline",onClick:()=>g(JSON.stringify({severityText:"INFO","resource.attributes.service.name":"PET-SERVICE"},null,2)),disabled:t,children:[c.jsx(zo,{className:"h-4 w-4"}),"Load Example"]})]}),c.jsx(es,{id:"mongo-query",placeholder:'{"severityText": "ERROR"}',value:x,onChange:I=>g(I.target.value),className:"min-h-[120px] font-mono text-sm",disabled:t})]})})]}),c.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[c.jsxs(Je,{onClick:w,disabled:t,className:"w-full sm:w-auto",children:[c.jsx(Ao,{className:`h-4 w-4 mr-2 ${t?"animate-spin":""}`}),"Apply and Update"]}),c.jsx(Je,{variant:"outline",onClick:v,className:"w-full sm:w-auto bg-transparent",disabled:t,children:"Clear"})]})]})})},on=0,tt=1,bt=2,rr=4;function fo(e){return()=>e}function Il(e){e()}function sr(e,t){return n=>e(t(n))}function mo(e,t){return()=>e(t)}function Cl(e,t){return n=>e(t,n)}function Dn(e){return e!==void 0}function Sl(...e){return()=>{e.map(Il)}}function yt(){}function rn(e,t){return t(e),e}function Tl(e,t){return t(e)}function ce(...e){return e}function se(e,t){return e(tt,t)}function J(e,t){e(on,t)}function $n(e){e(bt)}function ge(e){return e(rr)}function $(e,t){return se(e,Cl(t,on))}function Fe(e,t){const n=e(tt,o=>{n(),t(o)});return n}function ho(e){let t,n;return o=>r=>{t=r,n&&clearTimeout(n),n=setTimeout(()=>{o(t)},e)}}function lr(e,t){return e===t}function ae(e=lr){let t;return n=>o=>{e(t,o)||(t=o,n(o))}}function G(e){return t=>n=>{e(n)&&t(n)}}function z(e){return t=>sr(t,e)}function Ve(e){return t=>()=>{t(e)}}function E(e,...t){const n=El(...t);return(o,r)=>{switch(o){case bt:$n(e);return;case tt:return se(e,n(r))}}}function Ue(e,t){return n=>o=>{n(t=e(t,o))}}function ct(e){return t=>n=>{e>0?e--:t(n)}}function Ke(e){let t=null,n;return o=>r=>{t=r,!n&&(n=setTimeout(()=>{n=void 0,o(t)},e))}}function Y(...e){const t=new Array(e.length);let n=0,o=null;const r=Math.pow(2,e.length)-1;return e.forEach((s,l)=>{const i=Math.pow(2,l);se(s,u=>{const a=n;n=n|i,t[l]=u,a!==r&&n===r&&o&&(o(),o=null)})}),s=>l=>{const i=()=>{s([l].concat(t))};n===r?i():o=i}}function El(...e){return t=>e.reduceRight(Tl,t)}function Rl(e){let t,n;const o=()=>t==null?void 0:t();return function(r,s){switch(r){case tt:return s?n===s?void 0:(o(),n=s,t=se(e,s),t):(o(),yt);case bt:o(),n=null;return}}}function N(e){let t=e;const n=te();return(o,r)=>{switch(o){case on:t=r;break;case tt:{r(t);break}case rr:return t}return n(o,r)}}function je(e,t){return rn(N(t),n=>$(e,n))}function te(){const e=[];return(t,n)=>{switch(t){case on:e.slice().forEach(o=>{o(n)});return;case bt:e.splice(0,e.length);return;case tt:return e.push(n),()=>{const o=e.indexOf(n);o>-1&&e.splice(o,1)}}}}function Le(e){return rn(te(),t=>$(e,t))}function re(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:jl(),singleton:n}}const jl=()=>Symbol();function kl(e){const t=new Map,n=({constructor:o,dependencies:r,id:s,singleton:l})=>{if(l&&t.has(s))return t.get(s);const i=o(r.map(u=>n(u)));return l&&t.set(s,i),i};return n(e)}function xe(...e){const t=te(),n=new Array(e.length);let o=0;const r=Math.pow(2,e.length)-1;return e.forEach((s,l)=>{const i=Math.pow(2,l);se(s,u=>{n[l]=u,o=o|i,o===r&&J(t,n)})}),function(s,l){switch(s){case bt:{$n(t);return}case tt:return o===r&&l(n),se(t,l)}}}function V(e,t=lr){return E(e,ae(t))}function Rn(...e){return function(t,n){switch(t){case bt:return;case tt:return Sl(...e.map(o=>se(o,n)))}}}var Pe=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(Pe||{});const Nl={0:"debug",3:"error",1:"log",2:"warn"},Pl=()=>typeof globalThis>"u"?window:globalThis,nt=re(()=>{const e=N(3);return{log:N((t,n,o=1)=>{var r;const s=(r=Pl().VIRTUOSO_LOG_LEVEL)!=null?r:ge(e);o>=s&&console[Nl[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function dt(e,t,n){return Fn(e,t,n).callbackRef}function Fn(e,t,n){const o=D.useRef(null);let r=l=>{};const s=D.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(l=>{const i=()=>{const u=l[0].target;u.offsetParent!==null&&e(u)};n?i():requestAnimationFrame(i)}):null,[e,n]);return r=l=>{l&&t?(s==null||s.observe(l),o.current=l):(o.current&&(s==null||s.unobserve(o.current)),o.current=null)},{callbackRef:r,ref:o}}function Ol(e,t,n,o,r,s,l,i,u){const a=D.useCallback(f=>{const x=Ll(f.children,t,i?"offsetWidth":"offsetHeight",r);let g=f.parentElement;for(;!g.dataset.virtuosoScroller;)g=g.parentElement;const m=g.lastElementChild.dataset.viewportType==="window";let S;m&&(S=g.ownerDocument.defaultView);const j=l?i?l.scrollLeft:l.scrollTop:m?i?S.scrollX||S.document.documentElement.scrollLeft:S.scrollY||S.document.documentElement.scrollTop:i?g.scrollLeft:g.scrollTop,b=l?i?l.scrollWidth:l.scrollHeight:m?i?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight:i?g.scrollWidth:g.scrollHeight,w=l?i?l.offsetWidth:l.offsetHeight:m?i?S.innerWidth:S.innerHeight:i?g.offsetWidth:g.offsetHeight;o({scrollHeight:b,scrollTop:Math.max(j,0),viewportHeight:w}),s==null||s(i?po("column-gap",getComputedStyle(f).columnGap,r):po("row-gap",getComputedStyle(f).rowGap,r)),x!==null&&e(x)},[e,t,r,s,l,o,i]);return Fn(a,n,u)}function Ll(e,t,n,o){const r=e.length;if(r===0)return null;const s=[];for(let l=0;l<r;l++){const i=e.item(l);if(i.dataset.index===void 0)continue;const u=parseInt(i.dataset.index),a=parseFloat(i.dataset.knownSize),f=t(i,n);if(f===0&&o("Zero-sized element, this should not happen",{child:i},Pe.ERROR),f===a)continue;const x=s[s.length-1];s.length===0||x.size!==f||x.endIndex!==u-1?s.push({endIndex:u,size:f,startIndex:u}):s[s.length-1].endIndex++}return s}function po(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Pe.WARN),t==="normal"?0:parseInt(t??"0",10)}function ir(e,t,n){const o=D.useRef(null),r=D.useCallback(u=>{if(!(u!=null&&u.offsetParent))return;const a=u.getBoundingClientRect(),f=a.width;let x,g;if(t){const m=t.getBoundingClientRect(),S=a.top-m.top;g=m.height-Math.max(0,S),x=S+t.scrollTop}else{const m=l.current.ownerDocument.defaultView;g=m.innerHeight-Math.max(0,a.top),x=a.top+m.scrollY}o.current={offsetTop:x,visibleHeight:g,visibleWidth:f},e(o.current)},[e,t]),{callbackRef:s,ref:l}=Fn(r,!0,n),i=D.useCallback(()=>{r(l.current)},[r,l]);return D.useEffect(()=>{var u;if(t){t.addEventListener("scroll",i);const a=new ResizeObserver(()=>{requestAnimationFrame(i)});return a.observe(t),()=>{t.removeEventListener("scroll",i),a.unobserve(t)}}else{const a=(u=l.current)==null?void 0:u.ownerDocument.defaultView;return a==null||a.addEventListener("scroll",i),a==null||a.addEventListener("resize",i),()=>{a==null||a.removeEventListener("scroll",i),a==null||a.removeEventListener("resize",i)}}},[i,t,l]),s}const Ne=re(()=>{const e=te(),t=te(),n=N(0),o=te(),r=N(0),s=te(),l=te(),i=N(0),u=N(0),a=N(0),f=N(0),x=te(),g=te(),m=N(!1),S=N(!1),j=N(!1);return $(E(e,z(({scrollTop:b})=>b)),t),$(E(e,z(({scrollHeight:b})=>b)),l),$(t,r),{deviation:n,fixedFooterHeight:a,fixedHeaderHeight:u,footerHeight:f,headerHeight:i,horizontalDirection:S,scrollBy:g,scrollContainerState:e,scrollHeight:l,scrollingInProgress:m,scrollTo:x,scrollTop:t,skipAnimationFrameInResizeObserver:j,smoothScrollTargetReached:o,statefulScrollTop:r,viewportHeight:s}},[],{singleton:!0}),kt={lvl:0};function ar(e,t){const n=e.length;if(n===0)return[];let{index:o,value:r}=t(e[0]);const s=[];for(let l=1;l<n;l++){const{index:i,value:u}=t(e[l]);s.push({end:i-1,start:o,value:r}),o=i,r=u}return s.push({end:1/0,start:o,value:r}),s}function le(e){return e===kt}function Nt(e,t){if(!le(e))return t===e.k?e.v:t<e.k?Nt(e.l,t):Nt(e.r,t)}function We(e,t,n="k"){if(le(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const o=We(e.r,t,n);return o[0]===-1/0?[e.k,e.v]:o}return We(e.l,t,n)}function Oe(e,t,n){return le(e)?dr(t,n,1):t===e.k?we(e,{k:t,v:n}):t<e.k?go(we(e,{l:Oe(e.l,t,n)})):go(we(e,{r:Oe(e.r,t,n)}))}function xt(){return kt}function sn(e,t,n){if(le(e))return[];const o=We(e,t)[0];return Al(kn(e,o,n))}function jn(e,t){if(le(e))return kt;const{k:n,l:o,r}=e;if(t===n){if(le(o))return r;if(le(r))return o;{const[s,l]=ur(o);return Kt(we(e,{k:s,l:cr(o),v:l}))}}else return t<n?Kt(we(e,{l:jn(o,t)})):Kt(we(e,{r:jn(r,t)}))}function lt(e){return le(e)?[]:[...lt(e.l),{k:e.k,v:e.v},...lt(e.r)]}function kn(e,t,n){if(le(e))return[];const{k:o,l:r,r:s,v:l}=e;let i=[];return o>t&&(i=i.concat(kn(r,t,n))),o>=t&&o<=n&&i.push({k:o,v:l}),o<=n&&(i=i.concat(kn(s,t,n))),i}function Kt(e){const{l:t,lvl:n,r:o}=e;if(o.lvl>=n-1&&t.lvl>=n-1)return e;if(n>o.lvl+1){if(hn(t))return fr(we(e,{lvl:n-1}));if(!le(t)&&!le(t.r))return we(t.r,{l:we(t,{r:t.r.l}),lvl:n,r:we(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}else{if(hn(e))return Nn(we(e,{lvl:n-1}));if(!le(o)&&!le(o.l)){const r=o.l,s=hn(r)?o.lvl-1:o.lvl;return we(r,{l:we(e,{lvl:n-1,r:r.l}),lvl:r.lvl+1,r:Nn(we(o,{l:r.r,lvl:s}))})}else throw new Error("Unexpected empty nodes")}}function we(e,t){return dr(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function cr(e){return le(e.r)?e.l:Kt(we(e,{r:cr(e.r)}))}function hn(e){return le(e)||e.lvl>e.r.lvl}function ur(e){return le(e.r)?[e.k,e.v]:ur(e.r)}function dr(e,t,n,o=kt,r=kt){return{k:e,l:o,lvl:n,r,v:t}}function go(e){return Nn(fr(e))}function fr(e){const{l:t}=e;return!le(t)&&t.lvl===e.lvl?we(t,{r:we(e,{l:t.r})}):e}function Nn(e){const{lvl:t,r:n}=e;return!le(n)&&!le(n.r)&&n.lvl===t&&n.r.lvl===t?we(n,{l:we(e,{r:n.l}),lvl:t+1}):e}function Al(e){return ar(e,({k:t,v:n})=>({index:t,value:n}))}function mr(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function Pt(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const Wn=re(()=>({recalcInProgress:N(!1)}),[],{singleton:!0});function hr(e,t,n){return e[Yt(e,t,n)]}function Yt(e,t,n,o=0){let r=e.length-1;for(;o<=r;){const s=Math.floor((o+r)/2),l=e[s],i=n(l,t);if(i===0)return s;if(i===-1){if(r-o<2)return s-1;r=s-1}else{if(r===o)return s;o=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function zl(e,t,n,o){const r=Yt(e,t,o),s=Yt(e,n,o,r);return e.slice(r,s+1)}function Qe(e,t){return Math.round(e.getBoundingClientRect()[t])}function ln(e){return!le(e.groupOffsetTree)}function _n({index:e},t){return t===e?0:t<e?-1:1}function Hl(){return{groupIndices:[],groupOffsetTree:xt(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:xt()}}function Ml(e,t){let n=le(e)?0:1/0;for(const o of t){const{endIndex:r,size:s,startIndex:l}=o;if(n=Math.min(n,l),le(e)){e=Oe(e,0,s);continue}const i=sn(e,l-1,r+1);if(i.some(Vl(o)))continue;let u=!1,a=!1;for(const{end:f,start:x,value:g}of i)u?(r>=x||s===g)&&(e=jn(e,x)):(a=g!==s,u=!0),f>r&&r>=x&&g!==s&&(e=Oe(e,r+1,g));a&&(e=Oe(e,l,s))}return[e,n]}function Bl(e){return typeof e.groupIndex<"u"}function Dl({offset:e},t){return t===e?0:t<e?-1:1}function Ot(e,t,n){if(t.length===0)return 0;const{index:o,offset:r,size:s}=hr(t,e,_n),l=e-o,i=s*l+(l-1)*n+r;return i>0?i+n:i}function pr(e,t){if(!ln(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function gr(e,t,n){if(Bl(e))return t.groupIndices[e.groupIndex]+1;{const o=e.index==="LAST"?n:e.index;let r=pr(o,t);return r=Math.max(0,r,Math.min(n,r)),r}}function $l(e,t,n,o=0){return o>0&&(t=Math.max(t,hr(e,o,_n).offset)),ar(zl(e,t,n,Dl),_l)}function Fl(e,[t,n,o,r]){t.length>0&&o("received item sizes",t,Pe.DEBUG);const s=e.sizeTree;let l=s,i=0;if(n.length>0&&le(s)&&t.length===2){const g=t[0].size,m=t[1].size;l=n.reduce((S,j)=>Oe(Oe(S,j,g),j+1,m),l)}else[l,i]=Ml(l,t);if(l===s)return e;const{lastIndex:u,lastOffset:a,lastSize:f,offsetTree:x}=Pn(e.offsetTree,i,l,r);return{groupIndices:n,groupOffsetTree:n.reduce((g,m)=>Oe(g,m,Ot(m,x,r)),xt()),lastIndex:u,lastOffset:a,lastSize:f,offsetTree:x,sizeTree:l}}function Wl(e){return lt(e).map(({k:t,v:n},o,r)=>{const s=r[o+1];return{endIndex:s?s.k-1:1/0,size:n,startIndex:t}})}function vo(e,t){let n=0,o=0;for(;n<e;)n+=t[o+1]-t[o]-1,o++;return o-(n===e?0:1)}function Pn(e,t,n,o){let r=e,s=0,l=0,i=0,u=0;if(t!==0){u=Yt(r,t-1,_n),i=r[u].offset;const a=We(n,t-1);s=a[0],l=a[1],r.length&&r[u].size===We(n,t)[1]&&(u-=1),r=r.slice(0,u+1)}else r=[];for(const{start:a,value:f}of sn(n,t,1/0)){const x=a-s,g=x*l+i+x*o;r.push({index:a,offset:g,size:f}),s=a,i=g,l=f}return{lastIndex:s,lastOffset:i,lastSize:l,offsetTree:r}}function _l(e){return{index:e.index,value:e}}function Vl(e){const{endIndex:t,size:n,startIndex:o}=e;return r=>r.start===o&&(r.end===t||r.end===1/0)&&r.value===n}const Ul={offsetHeight:"height",offsetWidth:"width"},Ge=re(([{log:e},{recalcInProgress:t}])=>{const n=te(),o=te(),r=je(o,0),s=te(),l=te(),i=N(0),u=N([]),a=N(void 0),f=N(void 0),x=N((p,d)=>Qe(p,Ul[d])),g=N(void 0),m=N(0),S=Hl(),j=je(E(n,Y(u,e,m),Ue(Fl,S),ae()),S),b=je(E(u,ae(),Ue((p,d)=>({current:d,prev:p.current}),{current:[],prev:[]}),z(({prev:p})=>p)),[]);$(E(u,G(p=>p.length>0),Y(j,m),z(([p,d,y])=>{const O=p.reduce((k,L,B)=>Oe(k,L,Ot(L,d.offsetTree,y)||B),xt());return{...d,groupIndices:p,groupOffsetTree:O}})),j),$(E(o,Y(j),G(([p,{lastIndex:d}])=>p<d),z(([p,{lastIndex:d,lastSize:y}])=>[{endIndex:d,size:y,startIndex:p}])),n),$(a,f);const w=je(E(a,z(p=>p===void 0)),!0);$(E(f,G(p=>p!==void 0&&le(ge(j).sizeTree)),z(p=>[{endIndex:0,size:p,startIndex:0}])),n);const v=Le(E(n,Y(j),Ue(({sizes:p},[d,y])=>({changed:y!==p,sizes:y}),{changed:!1,sizes:S}),z(p=>p.changed)));se(E(i,Ue((p,d)=>({diff:p.prev-d,prev:d}),{diff:0,prev:0}),z(p=>p.diff)),p=>{const{groupIndices:d}=ge(j);if(p>0)J(t,!0),J(s,p+vo(p,d));else if(p<0){const y=ge(b);y.length>0&&(p-=vo(-p,y)),J(l,p)}}),se(E(i,Y(e)),([p,d])=>{p<0&&d("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:i},Pe.ERROR)});const I=Le(s);$(E(s,Y(j),z(([p,d])=>{const y=d.groupIndices.length>0,O=[],k=d.lastSize;if(y){const L=Nt(d.sizeTree,0);let B=0,U=0;for(;B<p;){const A=d.groupIndices[U],_=d.groupIndices.length===U+1?1/0:d.groupIndices[U+1]-A-1;O.push({endIndex:A,size:L,startIndex:A}),O.push({endIndex:A+1+_-1,size:k,startIndex:A+1}),U++,B+=_+1}const ne=lt(d.sizeTree);return B!==p&&ne.shift(),ne.reduce((A,{k:_,v:ie})=>{let be=A.ranges;return A.prevSize!==0&&(be=[...A.ranges,{endIndex:_+p-1,size:A.prevSize,startIndex:A.prevIndex}]),{prevIndex:_+p,prevSize:ie,ranges:be}},{prevIndex:p,prevSize:0,ranges:O}).ranges}return lt(d.sizeTree).reduce((L,{k:B,v:U})=>({prevIndex:B+p,prevSize:U,ranges:[...L.ranges,{endIndex:B+p-1,size:L.prevSize,startIndex:L.prevIndex}]}),{prevIndex:0,prevSize:k,ranges:[]}).ranges})),n);const P=Le(E(l,Y(j,m),z(([p,{offsetTree:d},y])=>{const O=-p;return Ot(O,d,y)})));return $(E(l,Y(j,m),z(([p,d,y])=>{if(d.groupIndices.length>0){if(le(d.sizeTree))return d;let O=xt();const k=ge(b);let L=0,B=0,U=0;for(;L<-p;){U=k[B];const ne=k[B+1]-U-1;B++,L+=ne+1}if(O=lt(d.sizeTree).reduce((ne,{k:A,v:_})=>Oe(ne,Math.max(0,A+p),_),O),L!==-p){const ne=Nt(d.sizeTree,U);O=Oe(O,0,ne);const A=We(d.sizeTree,-p+1)[1];O=Oe(O,1,A)}return{...d,sizeTree:O,...Pn(d.offsetTree,0,O,y)}}else{const O=lt(d.sizeTree).reduce((k,{k:L,v:B})=>Oe(k,Math.max(0,L+p),B),xt());return{...d,sizeTree:O,...Pn(d.offsetTree,0,O,y)}}})),j),{beforeUnshiftWith:I,data:g,defaultItemSize:f,firstItemIndex:i,fixedItemSize:a,gap:m,groupIndices:u,itemSize:x,listRefresh:v,shiftWith:l,shiftWithOffset:P,sizeRanges:n,sizes:j,statefulTotalCount:r,totalCount:o,trackItemSizes:w,unshiftWith:s}},ce(nt,Wn),{singleton:!0});function Gl(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const vr=re(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:o,scrollTop:r}])=>{const s=te(),l=te(),i=Le(E(s,z(Gl)));return $(E(i,z(u=>u.totalCount)),n),$(E(i,z(u=>u.groupIndices)),e),$(E(xe(r,t,o),G(([u,a])=>ln(a)),z(([u,a,f])=>We(a.groupOffsetTree,Math.max(u-f,0),"v")[0]),ae(),z(u=>[u])),l),{groupCounts:s,topItemsIndexes:l}},ce(Ge,Ne)),ot=re(([{log:e}])=>{const t=N(!1),n=Le(E(t,G(o=>o),ae()));return se(t,o=>{o&&ge(e)("props updated",{},Pe.DEBUG)}),{didMount:n,propsReady:t}},ce(nt),{singleton:!0}),ql=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function xr(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!ql)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Bt=re(([{gap:e,listRefresh:t,sizes:n,totalCount:o},{fixedFooterHeight:r,fixedHeaderHeight:s,footerHeight:l,headerHeight:i,scrollingInProgress:u,scrollTo:a,smoothScrollTargetReached:f,viewportHeight:x},{log:g}])=>{const m=te(),S=te(),j=N(0);let b=null,w=null,v=null;function I(){b&&(b(),b=null),v&&(v(),v=null),w&&(clearTimeout(w),w=null),J(u,!1)}return $(E(m,Y(n,x,o,j,i,l,g),Y(e,s,r),z(([[P,p,d,y,O,k,L,B],U,ne,A])=>{const _=xr(P),{align:ie,behavior:be,offset:Ie}=_,Te=y-1,ve=gr(_,p,Te);let me=Ot(ve,p.offsetTree,U)+k;ie==="end"?(me+=ne+We(p.sizeTree,ve)[1]-d+A,ve===Te&&(me+=L)):ie==="center"?me+=(ne+We(p.sizeTree,ve)[1]-d+A)/2:me-=O,Ie&&(me+=Ie);const T=F=>{I(),F?(B("retrying to scroll to",{location:P},Pe.DEBUG),J(m,P)):(J(S,!0),B("list did not change, scroll successful",{},Pe.DEBUG))};if(I(),be==="smooth"){let F=!1;v=se(t,q=>{F=F||q}),b=Fe(f,()=>{T(F)})}else b=Fe(E(t,Kl(150)),T);return w=setTimeout(()=>{I()},1200),J(u,!0),B("scrolling from index to",{behavior:be,index:ve,top:me},Pe.DEBUG),{behavior:be,top:me}})),a),{scrollTargetReached:S,scrollToIndex:m,topListHeight:j}},ce(Ge,Ne,nt),{singleton:!0});function Kl(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return o=>{o&&(t(!0),clearTimeout(n))}}}function Vn(e,t){e==0?t():requestAnimationFrame(()=>{Vn(e-1,t)})}function Un(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Dt=re(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:o},{scrollTargetReached:r,scrollToIndex:s},{didMount:l}])=>{const i=N(!0),u=N(0),a=N(!0);return $(E(l,Y(u),G(([f,x])=>!!x),Ve(!1)),i),$(E(l,Y(u),G(([f,x])=>!!x),Ve(!1)),a),se(E(xe(t,l),Y(i,n,e,a),G(([[,f],x,{sizeTree:g},m,S])=>f&&(!le(g)||Dn(m))&&!x&&!S),Y(u)),([,f])=>{Fe(r,()=>{J(a,!0)}),Vn(4,()=>{Fe(o,()=>{J(i,!0)}),J(s,f)})}),{initialItemFinalLocationReached:a,initialTopMostItemIndex:u,scrolledToInitialItem:i}},ce(Ge,Ne,Bt,ot),{singleton:!0});function wr(e,t){return Math.abs(e-t)<1.01}const Lt="up",Et="down",Xl="none",Jl={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Yl=0,$t=re(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:o,scrollTop:r,viewportHeight:s}])=>{const l=N(!1),i=N(!0),u=te(),a=te(),f=N(4),x=N(Yl),g=je(E(Rn(E(V(r),ct(1),Ve(!0)),E(V(r),ct(1),Ve(!1),ho(100))),ae()),!1),m=je(E(Rn(E(n,Ve(!0)),E(n,Ve(!1),ho(200))),ae()),!1);$(E(xe(V(r),V(x)),z(([v,I])=>v<=I),ae()),i),$(E(i,Ke(50)),a);const S=Le(E(xe(o,V(s),V(t),V(e),V(f)),Ue((v,[{scrollHeight:I,scrollTop:P},p,d,y,O])=>{const k=P+p-I>-O,L={scrollHeight:I,scrollTop:P,viewportHeight:p};if(k){let U,ne;return P>v.state.scrollTop?(U="SCROLLED_DOWN",ne=v.state.scrollTop-P):(U="SIZE_DECREASED",ne=v.state.scrollTop-P||v.scrollTopDelta),{atBottom:!0,atBottomBecause:U,scrollTopDelta:ne,state:L}}let B;return L.scrollHeight>v.state.scrollHeight?B="SIZE_INCREASED":p<v.state.viewportHeight?B="VIEWPORT_HEIGHT_DECREASING":P<v.state.scrollTop?B="SCROLLING_UPWARDS":B="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:B,state:L}},Jl),ae((v,I)=>v&&v.atBottom===I.atBottom))),j=je(E(o,Ue((v,{scrollHeight:I,scrollTop:P,viewportHeight:p})=>{if(wr(v.scrollHeight,I))return{changed:!1,jump:0,scrollHeight:I,scrollTop:P};{const d=I-(P+p)<1;return v.scrollTop!==P&&d?{changed:!0,jump:v.scrollTop-P,scrollHeight:I,scrollTop:P}:{changed:!0,jump:0,scrollHeight:I,scrollTop:P}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),G(v=>v.changed),z(v=>v.jump)),0);$(E(S,z(v=>v.atBottom)),l),$(E(l,Ke(50)),u);const b=N(Et);$(E(o,z(({scrollTop:v})=>v),ae(),Ue((v,I)=>ge(m)?{direction:v.direction,prevScrollTop:I}:{direction:I<v.prevScrollTop?Lt:Et,prevScrollTop:I},{direction:Et,prevScrollTop:0}),z(v=>v.direction)),b),$(E(o,Ke(50),Ve(Xl)),b);const w=N(0);return $(E(g,G(v=>!v),Ve(0)),w),$(E(r,Ke(100),Y(g),G(([v,I])=>!!I),Ue(([v,I],[P])=>[I,P],[0,0]),z(([v,I])=>I-v)),w),{atBottomState:S,atBottomStateChange:u,atBottomThreshold:f,atTopStateChange:a,atTopThreshold:x,isAtBottom:l,isAtTop:i,isScrolling:g,lastJumpDueToItemResize:j,scrollDirection:b,scrollVelocity:w}},ce(Ne)),Zt="top",Qt="bottom",xo="none";function wo(e,t,n){return typeof e=="number"?n===Lt&&t===Zt||n===Et&&t===Qt?e:0:n===Lt?t===Zt?e.main:e.reverse:t===Qt?e.main:e.reverse}function bo(e,t){var n;return typeof e=="number"?e:(n=e[t])!=null?n:0}const Gn=re(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:o,viewportHeight:r}])=>{const s=te(),l=N(0),i=N(0),u=N(0),a=je(E(xe(V(o),V(r),V(n),V(s,Pt),V(u),V(l),V(t),V(e),V(i)),z(([f,x,g,[m,S],j,b,w,v,I])=>{const P=f-v,p=b+w,d=Math.max(g-P,0);let y=xo;const O=bo(I,Zt),k=bo(I,Qt);return m-=v,m+=g+w,S+=g+w,S-=v,m>f+p-O&&(y=Lt),S<f-d+x+k&&(y=Et),y!==xo?[Math.max(P-g-wo(j,Zt,y)-O,0),P-d-w+x+wo(j,Qt,y)+k]:null}),G(f=>f!=null),ae(Pt)),[0,0]);return{increaseViewportBy:i,listBoundary:s,overscan:u,topListHeight:l,visibleRange:a}},ce(Ne),{singleton:!0});function Zl(e,t,n){if(ln(t)){const o=pr(e,t);return[{index:We(t.groupOffsetTree,o)[0],offset:0,size:0},{data:n==null?void 0:n[0],index:o,offset:0,size:0}]}return[{data:n==null?void 0:n[0],index:e,offset:0,size:0}]}const pn={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Xt(e,t,n,o,r,s){const{lastIndex:l,lastOffset:i,lastSize:u}=r;let a=0,f=0;if(e.length>0){a=e[0].offset;const j=e[e.length-1];f=j.offset+j.size}const x=n-l,g=i+x*u+(x-1)*o,m=a,S=g-f;return{bottom:f,firstItemIndex:s,items:yo(e,r,s),offsetBottom:S,offsetTop:a,top:m,topItems:yo(t,r,s),topListHeight:t.reduce((j,b)=>b.size+j,0),totalCount:n}}function br(e,t,n,o,r,s){let l=0;if(n.groupIndices.length>0)for(const f of n.groupIndices){if(f-l>=e)break;l++}const i=e+l,u=Un(t,i),a=Array.from({length:i}).map((f,x)=>({data:s[x+u],index:x+u,offset:0,size:0}));return Xt(a,[],i,r,n,o)}function yo(e,t,n){if(e.length===0)return[];if(!ln(t))return e.map(a=>({...a,index:a.index+n,originalIndex:a.index}));const o=e[0].index,r=e[e.length-1].index,s=[],l=sn(t.groupOffsetTree,o,r);let i,u=0;for(const a of e){(!i||i.end<a.index)&&(i=l.shift(),u=t.groupIndices.indexOf(i.start));let f;a.index===i.start?f={index:u,type:"group"}:f={groupIndex:u,index:a.index-(u+1)+n},s.push({...f,data:a.data,offset:a.offset,originalIndex:a.index,size:a.size})}return s}const ft=re(([{data:e,firstItemIndex:t,gap:n,sizes:o,totalCount:r},s,{listBoundary:l,topListHeight:i,visibleRange:u},{initialTopMostItemIndex:a,scrolledToInitialItem:f},{topListHeight:x},g,{didMount:m},{recalcInProgress:S}])=>{const j=N([]),b=N(0),w=te();$(s.topItemsIndexes,j);const v=je(E(xe(m,S,V(u,Pt),V(r),V(o),V(a),f,V(j),V(t),V(n),e),G(([d,y,,O,,,,,,,k])=>{const L=k&&k.length!==O;return d&&!y&&!L}),z(([,,[d,y],O,k,L,B,U,ne,A,_])=>{const ie=k,{offsetTree:be,sizeTree:Ie}=ie,Te=ge(b);if(O===0)return{...pn,totalCount:O};if(d===0&&y===0)return Te===0?{...pn,totalCount:O}:br(Te,L,k,ne,A,_||[]);if(le(Ie))return Te>0?null:Xt(Zl(Un(L,O),ie,_),[],O,A,ie,ne);const ve=[];if(U.length>0){const M=U[0],X=U[U.length-1];let Z=0;for(const R of sn(Ie,M,X)){const W=R.value,Q=Math.max(R.start,M),he=Math.min(R.end,X);for(let ue=Q;ue<=he;ue++)ve.push({data:_==null?void 0:_[ue],index:ue,offset:Z,size:W}),Z+=W}}if(!B)return Xt([],ve,O,A,ie,ne);const me=U.length>0?U[U.length-1]+1:0,T=$l(be,d,y,me);if(T.length===0)return null;const F=O-1,q=rn([],M=>{for(const X of T){const Z=X.value;let R=Z.offset,W=X.start;const Q=Z.size;if(Z.offset<d){W+=Math.floor((d-Z.offset+A)/(Q+A));const ue=W-X.start;R+=ue*Q+ue*A}W<me&&(R+=(me-W)*Q,W=me);const he=Math.min(X.end,F);for(let ue=W;ue<=he&&!(R>=y);ue++)M.push({data:_==null?void 0:_[ue],index:ue,offset:R,size:Q}),R+=Q+A}});return Xt(q,ve,O,A,ie,ne)}),G(d=>d!==null),ae()),pn);$(E(e,G(Dn),z(d=>d==null?void 0:d.length)),r),$(E(v,z(d=>d.topListHeight)),x),$(x,i),$(E(v,z(d=>[d.top,d.bottom])),l),$(E(v,z(d=>d.items)),w);const I=Le(E(v,G(({items:d})=>d.length>0),Y(r,e),G(([{items:d},y])=>d[d.length-1].originalIndex===y-1),z(([,d,y])=>[d-1,y]),ae(Pt),z(([d])=>d))),P=Le(E(v,Ke(200),G(({items:d,topItems:y})=>d.length>0&&d[0].originalIndex===y.length),z(({items:d})=>d[0].index),ae())),p=Le(E(v,G(({items:d})=>d.length>0),z(({items:d})=>{let y=0,O=d.length-1;for(;d[y].type==="group"&&y<O;)y++;for(;d[O].type==="group"&&O>y;)O--;return{endIndex:d[O].index,startIndex:d[y].index}}),ae(mr)));return{endReached:I,initialItemCount:b,itemsRendered:w,listState:v,rangeChanged:p,startReached:P,topItemsIndexes:j,...g}},ce(Ge,vr,Gn,Dt,Bt,$t,ot,Wn),{singleton:!0}),yr=re(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:o},{listState:r}])=>{const s=te(),l=je(E(xe(n,e,o,t,r),z(([i,u,a,f,x])=>i+u+a+f+x.offsetBottom+x.bottom)),0);return $(V(l),s),{totalListHeight:l,totalListHeightChanged:s}},ce(Ne,ft),{singleton:!0}),Ql=re(([{viewportHeight:e},{totalListHeight:t}])=>{const n=N(!1),o=je(E(xe(n,e,t),G(([r])=>r),z(([,r,s])=>Math.max(0,r-s)),Ke(0),ae()),0);return{alignToBottom:n,paddingTopAddition:o}},ce(Ne,yr),{singleton:!0}),Ir=re(()=>({context:N(null)})),ei=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:o,...r},viewportBottom:s,viewportTop:l})=>t<l?{...r,align:n??"start",behavior:o}:e>s?{...r,align:n??"end",behavior:o}:null,Cr=re(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:o,fixedHeaderHeight:r,headerHeight:s,scrollingInProgress:l,scrollTop:i,viewportHeight:u},{scrollToIndex:a}])=>{const f=te();return $(E(f,Y(t,u,n,s,r,o,i),Y(e),z(([[x,g,m,S,j,b,w,v],I])=>{const{align:P,behavior:p,calculateViewLocation:d=ei,done:y,...O}=x,k=gr(x,g,S-1),L=Ot(k,g.offsetTree,I)+j+b,B=L+We(g.sizeTree,k)[1],U=v+b,ne=v+m-w,A=d({itemBottom:B,itemTop:L,locationParams:{align:P,behavior:p,...O},viewportBottom:ne,viewportTop:U});return A?y&&Fe(E(l,G(_=>!_),ct(ge(l)?1:2)),y):y&&y(),A}),G(x=>x!==null)),a),{scrollIntoView:f}},ce(Ge,Ne,Bt,ft,nt),{singleton:!0});function Io(e){return e?e==="smooth"?"smooth":"auto":!1}const ti=(e,t)=>typeof e=="function"?Io(e(t)):t&&Io(e),ni=re(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:o},{atBottomState:r,isAtBottom:s},{scrollToIndex:l},{scrolledToInitialItem:i},{didMount:u,propsReady:a},{log:f},{scrollingInProgress:x},{context:g},{scrollIntoView:m}])=>{const S=N(!1),j=te();let b=null;function w(p){J(l,{align:"end",behavior:p,index:"LAST"})}se(E(xe(E(V(t),ct(1)),u),Y(V(S),s,i,x),z(([[p,d],y,O,k,L])=>{let B=d&&k,U="auto";return B&&(U=ti(y,O||L),B=B&&!!U),{followOutputBehavior:U,shouldFollow:B,totalCount:p}}),G(({shouldFollow:p})=>p)),({followOutputBehavior:p,totalCount:d})=>{b&&(b(),b=null),ge(n)?requestAnimationFrame(()=>{ge(f)("following output to ",{totalCount:d},Pe.DEBUG),w(p)}):b=Fe(e,()=>{ge(f)("following output to ",{totalCount:d},Pe.DEBUG),w(p),b=null})});function v(p){const d=Fe(r,y=>{p&&!y.atBottom&&y.notAtBottomBecause==="SIZE_INCREASED"&&!b&&(ge(f)("scrolling to bottom due to increased size",{},Pe.DEBUG),w("auto"))});setTimeout(d,100)}se(E(xe(V(S),t,a),G(([p,,d])=>p&&d),Ue(({value:p},[,d])=>({refreshed:p===d,value:d}),{refreshed:!1,value:0}),G(({refreshed:p})=>p),Y(S,t)),([,p])=>{ge(i)&&v(p!==!1)}),se(j,()=>{v(ge(S)!==!1)}),se(xe(V(S),r),([p,d])=>{p&&!d.atBottom&&d.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&w("auto")});const I=N(null),P=te();return $(Rn(E(V(o),z(p=>{var d;return(d=p==null?void 0:p.length)!=null?d:0})),E(V(t))),P),se(E(xe(E(P,ct(1)),u),Y(V(I),i,x,g),z(([[p,d],y,O,k,L])=>d&&O&&(y==null?void 0:y({context:L,totalCount:p,scrollingInProgress:k}))),G(p=>!!p),Ke(0)),p=>{b&&(b(),b=null),ge(n)?requestAnimationFrame(()=>{ge(f)("scrolling into view",{}),J(m,p)}):b=Fe(e,()=>{ge(f)("scrolling into view",{}),J(m,p),b=null})}),{autoscrollToBottom:j,followOutput:S,scrollIntoViewOnChange:I}},ce(Ge,$t,Bt,Dt,ot,nt,Ne,Ir,Cr)),oi=re(([{data:e,firstItemIndex:t,gap:n,sizes:o},{initialTopMostItemIndex:r},{initialItemCount:s,listState:l},{didMount:i}])=>($(E(i,Y(s),G(([,u])=>u!==0),Y(r,o,t,n,e),z(([[,u],a,f,x,g,m=[]])=>br(u,a,f,x,g,m))),l),{}),ce(Ge,Dt,ft,ot),{singleton:!0}),ri=re(([{didMount:e},{scrollTo:t},{listState:n}])=>{const o=N(0);return se(E(e,Y(o),G(([,r])=>r!==0),z(([,r])=>({top:r}))),r=>{Fe(E(n,ct(1),G(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{J(t,r)})})}),{initialScrollTop:o}},ce(ot,Ne,ft),{singleton:!0}),Sr=re(([{scrollVelocity:e}])=>{const t=N(!1),n=te(),o=N(!1);return $(E(e,Y(o,t,n),G(([r,s])=>!!s),z(([r,s,l,i])=>{const{enter:u,exit:a}=s;if(l){if(a(r,i))return!1}else if(u(r,i))return!0;return l}),ae()),t),se(E(xe(t,e,n),Y(o)),([[r,s,l],i])=>{r&&i&&i.change&&i.change(s,l)}),{isSeeking:t,scrollSeekConfiguration:o,scrollSeekRangeChanged:n,scrollVelocity:e}},ce($t),{singleton:!0}),qn=re(([{scrollContainerState:e,scrollTo:t}])=>{const n=te(),o=te(),r=te(),s=N(!1),l=N(void 0);return $(E(xe(n,o),z(([{scrollHeight:i,scrollTop:u,viewportHeight:a},{offsetTop:f}])=>({scrollHeight:i,scrollTop:Math.max(0,u-f),viewportHeight:a}))),e),$(E(t,Y(o),z(([i,{offsetTop:u}])=>({...i,top:i.top+u}))),r),{customScrollParent:l,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:r,windowViewportRect:o}},ce(Ne)),si=re(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:o},{initialTopMostItemIndex:r},{didMount:s},{useWindowScroll:l,windowScrollContainerState:i,windowViewportRect:u}])=>{const a=te(),f=N(void 0),x=N(null),g=N(null);return $(i,x),$(u,g),se(E(a,Y(t,o,l,x,g,n)),([m,S,j,b,w,v,I])=>{const P=Wl(S.sizeTree);b&&w!==null&&v!==null&&(j=w.scrollTop-v.offsetTop),j-=I,m({ranges:P,scrollTop:j})}),$(E(f,G(Dn),z(li)),r),$(E(s,Y(f),G(([,m])=>m!==void 0),ae(),z(([,m])=>m.ranges)),e),{getState:a,restoreStateFrom:f}},ce(Ge,Ne,Dt,ot,qn));function li(e){return{align:"start",index:0,offset:e.scrollTop}}const ii=re(([{topItemsIndexes:e}])=>{const t=N(0);return $(E(t,G(n=>n>=0),z(n=>Array.from({length:n}).map((o,r)=>r))),e),{topItemCount:t}},ce(ft));function Tr(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const ai=Tr(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),ci=re(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:o},{isAtBottom:r,isScrolling:s,lastJumpDueToItemResize:l,scrollDirection:i},{listState:u},{beforeUnshiftWith:a,gap:f,shiftWithOffset:x,sizes:g},{log:m},{recalcInProgress:S}])=>{const j=Le(E(u,Y(l),Ue(([,w,v,I],[{bottom:P,items:p,offsetBottom:d,totalCount:y},O])=>{const k=P+d;let L=0;return v===y&&w.length>0&&p.length>0&&(p[0].originalIndex===0&&w[0].originalIndex===0||(L=k-I,L!==0&&(L+=O))),[L,p,y,k]},[0,[],0,0]),G(([w])=>w!==0),Y(o,i,n,r,m,S),G(([,w,v,I,,,P])=>!P&&!I&&w!==0&&v===Lt),z(([[w],,,,,v])=>(v("Upward scrolling compensation",{amount:w},Pe.DEBUG),w))));function b(w){w>0?(J(t,{behavior:"auto",top:-w}),J(e,0)):(J(e,0),J(t,{behavior:"auto",top:-w}))}return se(E(j,Y(e,s)),([w,v,I])=>{I&&ai()?J(e,v-w):b(-w)}),se(E(xe(je(s,!1),e,S),G(([w,v,I])=>!w&&!I&&v!==0),z(([w,v])=>v),Ke(1)),b),$(E(x,z(w=>({top:-w}))),t),se(E(a,Y(g,f),z(([w,{groupIndices:v,lastSize:I,sizeTree:P},p])=>{function d(y){return y*(I+p)}if(v.length===0)return d(w);{let y=0;const O=Nt(P,0);let k=0,L=0;for(;k<w;){k++,y+=O;let B=v.length===L+1?1/0:v[L+1]-v[L]-1;k+B>w&&(y-=O,B=w-k+1),k+=B,y+=d(B),L++}return y}})),w=>{J(e,w),requestAnimationFrame(()=>{J(t,{top:w}),requestAnimationFrame(()=>{J(e,0),J(S,!1)})})}),{deviation:e}},ce(Ne,$t,ft,Ge,nt,Wn)),ui=re(([e,t,n,o,r,s,l,i,u,a,f])=>({...e,...t,...n,...o,...r,...s,...l,...i,...u,...a,...f}),ce(Gn,oi,ot,Sr,yr,ri,Ql,qn,Cr,nt,Ir)),Er=re(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:o,gap:r,groupIndices:s,itemSize:l,sizeRanges:i,sizes:u,statefulTotalCount:a,totalCount:f,trackItemSizes:x},{initialItemFinalLocationReached:g,initialTopMostItemIndex:m,scrolledToInitialItem:S},j,b,w,{listState:v,topItemsIndexes:I,...P},{scrollToIndex:p},d,{topItemCount:y},{groupCounts:O},k])=>($(P.rangeChanged,k.scrollSeekRangeChanged),$(E(k.windowViewportRect,z(L=>L.visibleHeight)),j.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:o,gap:r,groupCounts:O,initialItemFinalLocationReached:g,initialTopMostItemIndex:m,scrolledToInitialItem:S,sizeRanges:i,topItemCount:y,topItemsIndexes:I,totalCount:f,...w,groupIndices:s,itemSize:l,listState:v,scrollToIndex:p,statefulTotalCount:a,trackItemSizes:x,...P,...k,...j,sizes:u,...b}),ce(Ge,Dt,Ne,si,ni,ft,Bt,ci,ii,vr,ui));function di(e,t){const n={},o={};let r=0;const s=e.length;for(;r<s;)o[e[r]]=1,r+=1;for(const l in t)Object.hasOwn(o,l)||(n[l]=t[l]);return n}const Gt=typeof document<"u"?D.useLayoutEffect:D.useEffect;function Rr(e,t,n){const o=Object.keys(t.required||{}),r=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),l=Object.keys(t.events||{}),i=D.createContext({});function u(b,w){b.propsReady&&J(b.propsReady,!1);for(const v of o){const I=b[t.required[v]];J(I,w[v])}for(const v of r)if(v in w){const I=b[t.optional[v]];J(I,w[v])}b.propsReady&&J(b.propsReady,!0)}function a(b){return s.reduce((w,v)=>(w[v]=I=>{const P=b[t.methods[v]];J(P,I)},w),{})}function f(b){return l.reduce((w,v)=>(w[v]=Rl(b[t.events[v]]),w),{})}const x=D.forwardRef((b,w)=>{const{children:v,...I}=b,[P]=D.useState(()=>rn(kl(e),y=>{u(y,I)})),[p]=D.useState(mo(f,P));Gt(()=>{for(const y of l)y in I&&se(p[y],I[y]);return()=>{Object.values(p).map($n)}},[I,p,P]),Gt(()=>{u(P,I)}),D.useImperativeHandle(w,fo(a(P)));const d=n;return c.jsx(i.Provider,{value:P,children:n?c.jsx(d,{...di([...o,...r,...l],I),children:v}):v})}),g=b=>{const w=D.useContext(i);return D.useCallback(v=>{J(w[b],v)},[w,b])},m=b=>{const w=D.useContext(i)[b],v=D.useCallback(I=>se(w,I),[w]);return D.useSyncExternalStore(v,()=>ge(w),()=>ge(w))},S=b=>{const w=D.useContext(i)[b],[v,I]=D.useState(mo(ge,w));return Gt(()=>se(w,P=>{P!==v&&I(fo(P))}),[w,v]),v},j=D.version.startsWith("18")?m:S;return{Component:x,useEmitter:(b,w)=>{const v=D.useContext(i)[b];Gt(()=>se(v,w),[w,v])},useEmitterValue:j,usePublisher:g}}const jr=D.createContext(void 0),kr=D.createContext(void 0),Nr=typeof document<"u"?D.useLayoutEffect:D.useEffect;function gn(e){return"self"in e}function fi(e){return"body"in e}function Pr(e,t,n,o=yt,r,s){const l=D.useRef(null),i=D.useRef(null),u=D.useRef(null),a=D.useCallback(g=>{let m,S,j;const b=g.target;if(fi(b)||gn(b)){const v=gn(b)?b:b.defaultView;j=s?v.scrollX:v.scrollY,m=s?v.document.documentElement.scrollWidth:v.document.documentElement.scrollHeight,S=s?v.innerWidth:v.innerHeight}else j=s?b.scrollLeft:b.scrollTop,m=s?b.scrollWidth:b.scrollHeight,S=s?b.offsetWidth:b.offsetHeight;const w=()=>{e({scrollHeight:m,scrollTop:Math.max(j,0),viewportHeight:S})};g.suppressFlushSync?w():ts.flushSync(w),i.current!==null&&(j===i.current||j<=0||j===m-S)&&(i.current=null,t(!0),u.current&&(clearTimeout(u.current),u.current=null))},[e,t,s]);D.useEffect(()=>{const g=r||l.current;return o(r||l.current),a({suppressFlushSync:!0,target:g}),g.addEventListener("scroll",a,{passive:!0}),()=>{o(null),g.removeEventListener("scroll",a)}},[l,a,n,o,r]);function f(g){const m=l.current;if(!m||(s?"offsetWidth"in m&&m.offsetWidth===0:"offsetHeight"in m&&m.offsetHeight===0))return;const S=g.behavior==="smooth";let j,b,w;gn(m)?(b=Math.max(Qe(m.document.documentElement,s?"width":"height"),s?m.document.documentElement.scrollWidth:m.document.documentElement.scrollHeight),j=s?m.innerWidth:m.innerHeight,w=s?window.scrollX:window.scrollY):(b=m[s?"scrollWidth":"scrollHeight"],j=Qe(m,s?"width":"height"),w=m[s?"scrollLeft":"scrollTop"]);const v=b-j;if(g.top=Math.ceil(Math.max(Math.min(v,g.top),0)),wr(j,b)||g.top===w){e({scrollHeight:b,scrollTop:w,viewportHeight:j}),S&&t(!0);return}S?(i.current=g.top,u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{u.current=null,i.current=null,t(!0)},1e3)):i.current=null,s&&(g={behavior:g.behavior,left:g.top}),m.scrollTo(g)}function x(g){s&&(g={behavior:g.behavior,left:g.top}),l.current.scrollBy(g)}return{scrollByCallback:x,scrollerRef:l,scrollToCallback:f}}const vn="-webkit-sticky",Co="sticky",Kn=Tr(()=>{if(typeof document>"u")return Co;const e=document.createElement("div");return e.style.position=vn,e.style.position===vn?vn:Co});function Xn(e){return e}const mi=re(()=>{const e=N(i=>`Item ${i}`),t=N(i=>`Group ${i}`),n=N({}),o=N(Xn),r=N("div"),s=N(yt),l=(i,u=null)=>je(E(n,z(a=>a[i]),ae()),u);return{components:n,computeItemKey:o,EmptyPlaceholder:l("EmptyPlaceholder"),FooterComponent:l("Footer"),GroupComponent:l("Group","div"),groupContent:t,HeaderComponent:l("Header"),HeaderFooterTag:r,ItemComponent:l("Item","div"),itemContent:e,ListComponent:l("List","div"),ScrollerComponent:l("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TopItemListComponent:l("TopItemList")}}),hi=re(([e,t])=>({...e,...t}),ce(Er,mi)),pi=({height:e})=>c.jsx("div",{style:{height:e}}),gi={overflowAnchor:"none",position:Kn(),zIndex:1},Or={overflowAnchor:"none"},vi={...Or,display:"inline-block",height:"100%"},So=D.memo(function({showTopList:e=!1}){const t=K("listState"),n=He("sizeRanges"),o=K("useWindowScroll"),r=K("customScrollParent"),s=He("windowScrollContainerState"),l=He("scrollContainerState"),i=r||o?s:l,u=K("itemContent"),a=K("context"),f=K("groupContent"),x=K("trackItemSizes"),g=K("itemSize"),m=K("log"),S=He("gap"),j=K("horizontalDirection"),{callbackRef:b}=Ol(n,g,x,e?yt:i,m,S,r,j,K("skipAnimationFrameInResizeObserver")),[w,v]=D.useState(0);Jn("deviation",A=>{w!==A&&v(A)});const I=K("EmptyPlaceholder"),P=K("ScrollSeekPlaceholder")||pi,p=K("ListComponent"),d=K("ItemComponent"),y=K("GroupComponent"),O=K("computeItemKey"),k=K("isSeeking"),L=K("groupIndices").length>0,B=K("alignToBottom"),U=K("initialItemFinalLocationReached"),ne=e?{}:{boxSizing:"border-box",...j?{display:"inline-block",height:"100%",marginLeft:w!==0?w:B?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:w!==0?w:B?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...U?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&I?c.jsx(I,{...Re(I,a)}):c.jsx(p,{...Re(p,a),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:b,style:ne,children:(e?t.topItems:t.items).map(A=>{const _=A.originalIndex,ie=O(_+t.firstItemIndex,A.data,a);return k?h.createElement(P,{...Re(P,a),height:A.size,index:A.index,key:ie,type:A.type||"item",...A.type==="group"?{}:{groupIndex:A.groupIndex}}):A.type==="group"?h.createElement(y,{...Re(y,a),"data-index":_,"data-item-index":A.index,"data-known-size":A.size,key:ie,style:gi},f(A.index,a)):h.createElement(d,{...Re(d,a),...yi(d,A.data),"data-index":_,"data-item-group-index":A.groupIndex,"data-item-index":A.index,"data-known-size":A.size,key:ie,style:j?vi:Or},L?u(A.index,A.groupIndex,A.data,a):u(A.index,A.data,a))})})}),xi={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},wi={outline:"none",overflowX:"auto",position:"relative"},an=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),bi={position:Kn(),top:0,width:"100%",zIndex:1};function Re(e,t){if(typeof e!="string")return{context:t}}function yi(e,t){return{item:typeof e=="string"?void 0:t}}const Ii=D.memo(function(){const e=K("HeaderComponent"),t=He("headerHeight"),n=K("HeaderFooterTag"),o=dt(D.useMemo(()=>s=>{t(Qe(s,"height"))},[t]),!0,K("skipAnimationFrameInResizeObserver")),r=K("context");return e?c.jsx(n,{ref:o,children:c.jsx(e,{...Re(e,r)})}):null}),Ci=D.memo(function(){const e=K("FooterComponent"),t=He("footerHeight"),n=K("HeaderFooterTag"),o=dt(D.useMemo(()=>s=>{t(Qe(s,"height"))},[t]),!0,K("skipAnimationFrameInResizeObserver")),r=K("context");return e?c.jsx(n,{ref:o,children:c.jsx(e,{...Re(e,r)})}):null});function Lr({useEmitter:e,useEmitterValue:t,usePublisher:n}){return D.memo(function({children:o,style:r,context:s,...l}){const i=n("scrollContainerState"),u=t("ScrollerComponent"),a=n("smoothScrollTargetReached"),f=t("scrollerRef"),x=t("horizontalDirection")||!1,{scrollByCallback:g,scrollerRef:m,scrollToCallback:S}=Pr(i,a,u,f,void 0,x);return e("scrollTo",S),e("scrollBy",g),c.jsx(u,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:m,style:{...x?wi:xi,...r},tabIndex:0,...l,...Re(u,s),children:o})})}function Ar({useEmitter:e,useEmitterValue:t,usePublisher:n}){return D.memo(function({children:o,style:r,context:s,...l}){const i=n("windowScrollContainerState"),u=t("ScrollerComponent"),a=n("smoothScrollTargetReached"),f=t("totalListHeight"),x=t("deviation"),g=t("customScrollParent"),m=D.useRef(null),S=t("scrollerRef"),{scrollByCallback:j,scrollerRef:b,scrollToCallback:w}=Pr(i,a,u,S,g);return Nr(()=>{var v;return b.current=g||((v=m.current)==null?void 0:v.ownerDocument.defaultView),()=>{b.current=null}},[b,g]),e("windowScrollTo",w),e("scrollBy",j),c.jsx(u,{ref:m,"data-virtuoso-scroller":!0,style:{position:"relative",...r,...f!==0?{height:f+x}:{}},...l,...Re(u,s),children:o})})}const Si=({children:e})=>{const t=D.useContext(jr),n=He("viewportHeight"),o=He("fixedItemHeight"),r=K("alignToBottom"),s=K("horizontalDirection"),l=D.useMemo(()=>sr(n,u=>Qe(u,s?"width":"height")),[n,s]),i=dt(l,!0,K("skipAnimationFrameInResizeObserver"));return D.useEffect(()=>{t&&(n(t.viewportHeight),o(t.itemHeight))},[t,n,o]),c.jsx("div",{"data-viewport-type":"element",ref:i,style:an(r),children:e})},Ti=({children:e})=>{const t=D.useContext(jr),n=He("windowViewportRect"),o=He("fixedItemHeight"),r=K("customScrollParent"),s=ir(n,r,K("skipAnimationFrameInResizeObserver")),l=K("alignToBottom");return D.useEffect(()=>{t&&(o(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,o]),c.jsx("div",{"data-viewport-type":"window",ref:s,style:an(l),children:e})},Ei=({children:e})=>{const t=K("TopItemListComponent")||"div",n=K("headerHeight"),o={...bi,marginTop:`${n}px`},r=K("context");return c.jsx(t,{style:o,...Re(t,r),children:e})},Ri=D.memo(function(e){const t=K("useWindowScroll"),n=K("topItemsIndexes").length>0,o=K("customScrollParent"),r=K("context");return c.jsxs(o||t?Ni:ki,{...e,context:r,children:[n&&c.jsx(Ei,{children:c.jsx(So,{showTopList:!0})}),c.jsxs(o||t?Ti:Si,{children:[c.jsx(Ii,{}),c.jsx(So,{}),c.jsx(Ci,{})]})]})}),{Component:ji,useEmitter:Jn,useEmitterValue:K,usePublisher:He}=Rr(hi,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Ri),ki=Lr({useEmitter:Jn,useEmitterValue:K,usePublisher:He}),Ni=Ar({useEmitter:Jn,useEmitterValue:K,usePublisher:He}),Pi=ji,Oi=re(()=>{const e=N(a=>c.jsxs("td",{children:["Item $",a]})),t=N(null),n=N(a=>c.jsxs("td",{colSpan:1e3,children:["Group ",a]})),o=N(null),r=N(null),s=N({}),l=N(Xn),i=N(yt),u=(a,f=null)=>je(E(s,z(x=>x[a]),ae()),f);return{components:s,computeItemKey:l,context:t,EmptyPlaceholder:u("EmptyPlaceholder"),FillerRow:u("FillerRow"),fixedFooterContent:r,fixedHeaderContent:o,itemContent:e,groupContent:n,ScrollerComponent:u("Scroller","div"),scrollerRef:i,ScrollSeekPlaceholder:u("ScrollSeekPlaceholder"),TableBodyComponent:u("TableBody","tbody"),TableComponent:u("Table","table"),TableFooterComponent:u("TableFoot","tfoot"),TableHeadComponent:u("TableHead","thead"),TableRowComponent:u("TableRow","tr"),GroupComponent:u("Group","tr")}});ce(Er,Oi);Kn();const To={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},Li={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Eo,floor:en,max:Rt,min:xn,round:Ro}=Math;function jo(e,t,n){return Array.from({length:t-e+1}).map((o,r)=>({data:n===null?null:n[r+e],index:r+e}))}function Ai(e){return{...Li,items:e}}function qt(e,t){return e&&e.width===t.width&&e.height===t.height}function zi(e,t){return e&&e.column===t.column&&e.row===t.row}const Hi=re(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:o},{footerHeight:r,headerHeight:s,scrollBy:l,scrollContainerState:i,scrollTo:u,scrollTop:a,smoothScrollTargetReached:f,viewportHeight:x},g,m,{didMount:S,propsReady:j},{customScrollParent:b,useWindowScroll:w,windowScrollContainerState:v,windowScrollTo:I,windowViewportRect:P},p])=>{const d=N(0),y=N(0),O=N(To),k=N({height:0,width:0}),L=N({height:0,width:0}),B=te(),U=te(),ne=N(0),A=N(null),_=N({column:0,row:0}),ie=te(),be=te(),Ie=N(!1),Te=N(0),ve=N(!0),me=N(!1),T=N(!1);se(E(S,Y(Te),G(([R,W])=>!!W)),()=>{J(ve,!1)}),se(E(xe(S,ve,L,k,Te,me),G(([R,W,Q,he,,ue])=>R&&!W&&Q.height!==0&&he.height!==0&&!ue)),([,,,,R])=>{J(me,!0),Vn(1,()=>{J(B,R)}),Fe(E(a),()=>{J(t,[0,0]),J(ve,!0)})}),$(E(be,G(R=>R!=null&&R.scrollTop>0),Ve(0)),y),se(E(S,Y(be),G(([,R])=>R!=null)),([,R])=>{R&&(J(k,R.viewport),J(L,R.item),J(_,R.gap),R.scrollTop>0&&(J(Ie,!0),Fe(E(a,ct(1)),W=>{J(Ie,!1)}),J(u,{top:R.scrollTop})))}),$(E(k,z(({height:R})=>R)),x),$(E(xe(V(k,qt),V(L,qt),V(_,(R,W)=>R&&R.column===W.column&&R.row===W.row),V(a)),z(([R,W,Q,he])=>({gap:Q,item:W,scrollTop:he,viewport:R}))),ie),$(E(xe(V(d),o,V(_,zi),V(L,qt),V(k,qt),V(A),V(y),V(Ie),V(ve),V(Te)),G(([,,,,,,,R])=>!R),z(([R,[W,Q],he,ue,ye,Ce,_e,,It,pe])=>{const{column:De,row:rt}=he,{height:Ee,width:st}=ue,{width:mt}=ye;if(_e===0&&(R===0||mt===0))return To;if(st===0){const C=Un(pe,R),H=C+Math.max(_e-1,0);return Ai(jo(C,H,Ce))}const ht=zr(mt,st,De);let $e,Ae;It?W===0&&Q===0&&_e>0?($e=0,Ae=_e-1):($e=ht*en((W+rt)/(Ee+rt)),Ae=ht*Eo((Q+rt)/(Ee+rt))-1,Ae=xn(R-1,Rt(Ae,ht-1)),$e=xn(Ae,Rt(0,$e))):($e=0,Ae=-1);const Ft=jo($e,Ae,Ce),{bottom:Wt,top:_t}=ko(ye,he,ue,Ft),cn=Eo(R/ht),Ct=cn*Ee+(cn-1)*rt-Wt;return{bottom:Wt,itemHeight:Ee,items:Ft,itemWidth:st,offsetBottom:Ct,offsetTop:_t,top:_t}})),O),$(E(A,G(R=>R!==null),z(R=>R.length)),d),$(E(xe(k,L,O,_),G(([R,W,{items:Q}])=>Q.length>0&&W.height!==0&&R.height!==0),z(([R,W,{items:Q},he])=>{const{bottom:ue,top:ye}=ko(R,he,W,Q);return[ye,ue]}),ae(Pt)),t);const F=N(!1);$(E(a,Y(F),z(([R,W])=>W||R!==0)),F);const q=Le(E(xe(O,d),G(([{items:R}])=>R.length>0),Y(F),G(([[R,W],Q])=>{const he=R.items[R.items.length-1].index===W-1;return(Q||R.bottom>0&&R.itemHeight>0&&R.offsetBottom===0&&R.items.length===W)&&he}),z(([[,R]])=>R-1),ae())),M=Le(E(V(O),G(({items:R})=>R.length>0&&R[0].index===0),Ve(0),ae())),X=Le(E(V(O),Y(Ie),G(([{items:R},W])=>R.length>0&&!W),z(([{items:R}])=>({endIndex:R[R.length-1].index,startIndex:R[0].index})),ae(mr),Ke(0)));$(X,m.scrollSeekRangeChanged),$(E(B,Y(k,L,d,_),z(([R,W,Q,he,ue])=>{const ye=xr(R),{align:Ce,behavior:_e,offset:It}=ye;let pe=ye.index;pe==="LAST"&&(pe=he-1),pe=Rt(0,pe,xn(he-1,pe));let De=On(W,ue,Q,pe);return Ce==="end"?De=Ro(De-W.height+Q.height):Ce==="center"&&(De=Ro(De-W.height/2+Q.height/2)),It&&(De+=It),{behavior:_e,top:De}})),u);const Z=je(E(O,z(R=>R.offsetBottom+R.bottom)),0);return $(E(P,z(R=>({height:R.visibleHeight,width:R.visibleWidth}))),k),{customScrollParent:b,data:A,deviation:ne,footerHeight:r,gap:_,headerHeight:s,increaseViewportBy:e,initialItemCount:y,itemDimensions:L,overscan:n,restoreStateFrom:be,scrollBy:l,scrollContainerState:i,scrollHeight:U,scrollTo:u,scrollToIndex:B,scrollTop:a,smoothScrollTargetReached:f,totalCount:d,useWindowScroll:w,viewportDimensions:k,windowScrollContainerState:v,windowScrollTo:I,windowViewportRect:P,...m,gridState:O,horizontalDirection:T,initialTopMostItemIndex:Te,totalListHeight:Z,...g,endReached:q,propsReady:j,rangeChanged:X,startReached:M,stateChanged:ie,stateRestoreInProgress:Ie,...p}},ce(Gn,Ne,$t,Sr,ot,qn,nt));function zr(e,t,n){return Rt(1,en((e+n)/(en(t)+n)))}function ko(e,t,n,o){const{height:r}=n;if(r===void 0||o.length===0)return{bottom:0,top:0};const s=On(e,t,n,o[0].index);return{bottom:On(e,t,n,o[o.length-1].index)+r,top:s}}function On(e,t,n,o){const r=zr(e.width,n.width,t.column),s=en(o/r),l=s*n.height+Rt(0,s-1)*t.row;return l>0?l+t.row:l}const Mi=re(()=>{const e=N(x=>`Item ${x}`),t=N({}),n=N(null),o=N("virtuoso-grid-item"),r=N("virtuoso-grid-list"),s=N(Xn),l=N("div"),i=N(yt),u=(x,g=null)=>je(E(t,z(m=>m[x]),ae()),g),a=N(!1),f=N(!1);return $(V(f),a),{components:t,computeItemKey:s,context:n,FooterComponent:u("Footer"),HeaderComponent:u("Header"),headerFooterTag:l,itemClassName:o,ItemComponent:u("Item","div"),itemContent:e,listClassName:r,ListComponent:u("List","div"),readyStateChanged:a,reportReadyState:f,ScrollerComponent:u("Scroller","div"),scrollerRef:i,ScrollSeekPlaceholder:u("ScrollSeekPlaceholder","div")}}),Bi=re(([e,t])=>({...e,...t}),ce(Hi,Mi)),Di=D.memo(function(){const e=de("gridState"),t=de("listClassName"),n=de("itemClassName"),o=de("itemContent"),r=de("computeItemKey"),s=de("isSeeking"),l=Me("scrollHeight"),i=de("ItemComponent"),u=de("ListComponent"),a=de("ScrollSeekPlaceholder"),f=de("context"),x=Me("itemDimensions"),g=Me("gap"),m=de("log"),S=de("stateRestoreInProgress"),j=Me("reportReadyState"),b=dt(D.useMemo(()=>w=>{const v=w.parentElement.parentElement.scrollHeight;l(v);const I=w.firstChild;if(I){const{height:P,width:p}=I.getBoundingClientRect();x({height:P,width:p})}g({column:No("column-gap",getComputedStyle(w).columnGap,m),row:No("row-gap",getComputedStyle(w).rowGap,m)})},[l,x,g,m]),!0,!1);return Nr(()=>{e.itemHeight>0&&e.itemWidth>0&&j(!0)},[e]),S?null:c.jsx(u,{className:t,ref:b,...Re(u,f),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(w=>{const v=r(w.index,w.data,f);return s?c.jsx(a,{...Re(a,f),height:e.itemHeight,index:w.index,width:e.itemWidth},v):h.createElement(i,{...Re(i,f),className:n,"data-index":w.index,key:v},o(w.index,w.data,f))})})}),$i=D.memo(function(){const e=de("HeaderComponent"),t=Me("headerHeight"),n=de("headerFooterTag"),o=dt(D.useMemo(()=>s=>{t(Qe(s,"height"))},[t]),!0,!1),r=de("context");return e?c.jsx(n,{ref:o,children:c.jsx(e,{...Re(e,r)})}):null}),Fi=D.memo(function(){const e=de("FooterComponent"),t=Me("footerHeight"),n=de("headerFooterTag"),o=dt(D.useMemo(()=>s=>{t(Qe(s,"height"))},[t]),!0,!1),r=de("context");return e?c.jsx(n,{ref:o,children:c.jsx(e,{...Re(e,r)})}):null}),Wi=({children:e})=>{const t=D.useContext(kr),n=Me("itemDimensions"),o=Me("viewportDimensions"),r=dt(D.useMemo(()=>s=>{o(s.getBoundingClientRect())},[o]),!0,!1);return D.useEffect(()=>{t&&(o({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,o,n]),c.jsx("div",{ref:r,style:an(!1),children:e})},_i=({children:e})=>{const t=D.useContext(kr),n=Me("windowViewportRect"),o=Me("itemDimensions"),r=de("customScrollParent"),s=ir(n,r,!1);return D.useEffect(()=>{t&&(o({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,o]),c.jsx("div",{ref:s,style:an(!1),children:e})},Vi=D.memo(function({...e}){const t=de("useWindowScroll"),n=de("customScrollParent"),o=n||t?Gi:Ui,r=n||t?_i:Wi,s=de("context");return c.jsx(o,{...e,...Re(o,s),children:c.jsxs(r,{children:[c.jsx($i,{}),c.jsx(Di,{}),c.jsx(Fi,{})]})})}),{useEmitter:Hr,useEmitterValue:de,usePublisher:Me}=Rr(Bi,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},Vi),Ui=Lr({useEmitter:Hr,useEmitterValue:de,usePublisher:Me}),Gi=Ar({useEmitter:Hr,useEmitterValue:de,usePublisher:Me});function No(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Pe.WARN),t==="normal"?0:parseInt(t??"0",10)}function qi(e){return bn.find(t=>t.value===e)||bn[0]}function Ki(e){const t=Math.floor(typeof e=="number"?e/1e3:Number(e)/1e3);return new Date(t).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function Xi(e){navigator.clipboard.writeText(e).then(()=>Se.success("Copied to clipboard")).catch(()=>Se.error("Failed to copy"))}const Ji=({log:e})=>{var l,i,u;const[t,n]=h.useState(!1),o=qi(e.severityText||e.severity),r=o.icon,s=((u=(i=(l=e.resource)==null?void 0:l.attributes)==null?void 0:i.service)==null?void 0:u.name)||"unknown-service";return c.jsxs("div",{className:"group hover:bg-muted/50 rounded-lg px-2 py-2 transition-colors border-b border-muted font-mono text-[13px]",children:[c.jsxs("div",{className:"flex items-center gap-3 flex-wrap text-xs text-muted-foreground font-mono",children:[c.jsx("span",{children:Ki(e.timestamp)}),c.jsx("span",{className:"text-blue-700 dark:text-blue-400",children:s}),c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(r,{className:o.color+" h-4 w-4"}),e.severityText||e.severity]}),c.jsxs("span",{className:"flex items-center gap-2 ml-auto",children:[e.traceId&&c.jsx(Jt,{variant:"outline",className:"px-2 py-0.5 text-[10px] cursor-pointer font-mono",onClick:()=>Xi(e.traceId||""),title:"Copy Trace ID",children:e.traceId.slice(0,8)}),c.jsx(Je,{variant:"ghost",size:"sm",className:"flex-shrink-0 h-7 w-7 p-0","aria-label":"Show more Context",onClick:()=>n(a=>!a),children:c.jsx(ps,{className:"h-4 w-4"})})]})]}),t&&c.jsx("div",{className:"mt-2 mb-2 bg-muted/30 rounded p-2 font-mono text-xs overflow-x-auto border",children:c.jsx("pre",{className:"whitespace-pre-wrap break-words",children:JSON.stringify(e,null,2)})}),c.jsx("div",{className:"text-sm text-foreground break-words font-mono mt-1",children:e.body})]})},Yi=15;function Zi({logs:e,loadOlderLogs:t,loadNewerLogs:n}){const o=h.useRef(null),r=h.useRef(!0),[s,l]=h.useState(1e8),i=h.useRef(0),u=h.useRef([]),[a,f]=h.useState(!0);h.useEffect(()=>{var j,b;r.current=e.length<=Yi;const m=u.current;let S=0;e.length>m.length&&m.length>0&&((j=e[0])==null?void 0:j._id)!==((b=m[0])==null?void 0:b._id)&&(S=e.length-m.length,l(w=>w-S),console.log(`[LogsListPanel] ADDED AT TOP: prevLogs.length=${m.length} + addedAtTop=${S} = logs.length=${e.length}`)),u.current=e,i.current=e.length},[e]);const x=async()=>{console.log("Top reached triggered"),r.current&&await new Promise(m=>setTimeout(m,2e3)),await t()},g=async()=>{console.log("Bottom reached triggered"),r.current&&await new Promise(m=>setTimeout(m,3e3)),await n()};return c.jsx(zn,{isOpen:a,onToggle:()=>f(m=>!m),header:c.jsxs(c.Fragment,{children:[c.jsx(Ln,{children:"Logs History"}),c.jsx(An,{children:"View and scroll through log entries"})]}),children:e.length===0?c.jsx("div",{className:"py-10 text-center text-sm text-muted-foreground",children:"No logs to display. Please update your filter or try again later."}):c.jsx(Pi,{ref:o,firstItemIndex:s,style:{height:"70vh"},data:e,initialTopMostItemIndex:e.length-1,itemContent:(m,S)=>c.jsx(Ji,{log:S}),startReached:x,endReached:g})})}const Qi=({onLogsReset:e})=>{const[t,n]=h.useState(!0),[o,r]=h.useState({active:!1}),[s,l]=h.useState("3600"),[i,u]=h.useState(!0),a=async m=>{n(!0);const S=Date.now();await m;const j=Date.now()-S;j<400&&await new Promise(b=>setTimeout(b,400-j)),n(!1)};h.useEffect(()=>{a(Promise.all([(async()=>{try{const m=await qe.getRetentionTime();l(m.toString())}catch{Se.error("Failed to fetch retention time")}})(),(async()=>{try{const m=await qe.getStatus();r(m)}catch{r({active:!0}),Se("Could not connect to telemetry service")}})()]))},[]);const f=async m=>{await a((async()=>{try{m?(await qe.startCollection(),Se.success("Logs collection started")):(await qe.stopCollection(),Se.warning("Logs collection stopped")),r({active:m})}catch{Se.error(`Failed to ${m?"start":"stop"} log collection`)}})())},x=async()=>{await a((async()=>{try{await qe.resetLogs(),Se.success("All logs cleared"),e==null||e()}catch{Se.error("Failed to reset logs")}})())},g=async()=>{await a((async()=>{try{const m=Number.parseInt(s);if(isNaN(m)||m<=0){Se.error("Retention time must be a positive number");return}await qe.setRetentionTime(m),Se.success(`Logs will be retained for ${m} seconds`)}catch{Se.error("Failed to set retention time")}})())};return c.jsx(zn,{isOpen:i,onToggle:()=>u(m=>!m),header:c.jsxs(c.Fragment,{children:[c.jsxs(Ln,{className:"flex items-center gap-2",children:[c.jsx(oo,{className:"h-5 w-5"}),"Logs Collection",t&&c.jsx(Ao,{className:"animate-spin h-4 w-4 text-muted-foreground ml-2"})]}),c.jsx(An,{children:"Control logs collection and retention settings"})]}),children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 mb-2",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-muted-foreground font-medium",children:"Current Status:"}),c.jsx(Jt,{variant:o.active?"default":"secondary",children:o.active?c.jsxs(c.Fragment,{children:[c.jsx(oo,{className:"h-4 w-4 mr-1 inline"}),"Collecting"]}):c.jsxs(c.Fragment,{children:[c.jsx(Qn,{className:"h-4 w-4 mr-1 inline"}),"Paused"]})})]}),c.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full sm:w-auto",children:[c.jsxs(Je,{variant:o.active?"outline":"default",onClick:()=>f(!o.active),disabled:t,className:"w-full sm:w-auto",children:[o.active?c.jsx(Qn,{className:"h-4 w-4 mr-2"}):c.jsx(is,{className:"h-4 w-4 mr-2"}),o.active?"Pause Collection":"Start Collection"]}),c.jsxs(Je,{variant:"destructive",onClick:x,disabled:t,className:"w-full sm:w-auto",children:[c.jsx(ns,{className:"h-4 w-4 mr-2"}),"Reset Logs"]})]})]}),c.jsx(In,{}),c.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-end gap-2",children:[c.jsxs("div",{className:"flex-1 w-full",children:[c.jsx(pt,{htmlFor:"retention-time",className:"text-sm",children:"Retention Time (seconds)"}),c.jsx(yn,{id:"retention-time",type:"number",value:s,onChange:m=>l(m.target.value),placeholder:"3600",className:"mt-1",disabled:t})]}),c.jsxs(Je,{onClick:g,className:"w-full sm:w-auto",disabled:t,children:[c.jsx(ms,{className:"h-4 w-4 mr-2"}),"Set Retention"]})]})]})})},wn=30,Xe=e=>typeof e.timestamp=="number"?e.timestamp:Number(e.timestamp);function ha(){const[e,t]=h.useState(!0),[n,o]=h.useState([]),[r,s]=h.useState(null),[l,i]=h.useState(null),[u,a]=h.useState({}),[f,x]=h.useState(""),g=h.useCallback(async(v={},I="")=>{t(!0),a(v),x(I);try{const p=(await qe.findLogs({query:v,textSearch:I,limit:wn})).logs;o(p),p.length>0?(s(Xe(p[0])),i(Xe(p[p.length-1]))):Se.info("No logs found")}catch{Se.error("Failed to load logs")}finally{t(!1)}},[]),m=h.useCallback(async()=>{if(!(!r||n.length===0)){console.log("Enough logs, loading older logs");try{const I=(await qe.findOlderLogs({query:u,textSearch:f,limit:wn},r)).logs.sort((d,y)=>Xe(d)-Xe(y)),P=new Set(n.map(d=>d._id)),p=I.filter(d=>!P.has(d._id));console.log("Fetched older logs: ",p.length),o(d=>[...p,...d]),s(p.length>0?Xe(p[0]):r)}catch{Se.error("Failed to load older logs")}}},[r,n,u,f]),S=h.useCallback(async()=>{if(l)try{const I=(await qe.findNewerLogs({query:u,textSearch:f,limit:wn},l)).logs.sort((d,y)=>Xe(d)-Xe(y)),P=new Set(n.map(d=>d._id)),p=I.filter(d=>!P.has(d._id));o(d=>[...d,...p]),p.length>0&&i(Xe(p[p.length-1]))}catch{Se.error("Failed to load newer logs")}},[l,n,u,f]);h.useEffect(()=>{g()},[g]);const j=Array.from(new Set(n.map(v=>{var I,P,p;return(p=(P=(I=v.resource)==null?void 0:I.attributes)==null?void 0:P.service)==null?void 0:p.name}))).filter(Boolean),b=()=>{o([]),s(null),i(null),g({},"")},w=(v,I)=>{o([]),s(null),i(null),a(v),x(I),g(v,I)};return c.jsx("div",{className:"min-h-screen bg-background",children:c.jsxs("main",{className:"container mx-auto px-4 py-4 md:py-8 space-y-4 md:space-y-6",children:[c.jsx(Qi,{onLogsReset:b}),c.jsx(yl,{uniqueServices:j,loading:e,onFiltersChange:w}),c.jsx(Zi,{logs:n,loadOlderLogs:m,loadNewerLogs:S})]})})}export{ha as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as a,j as e,B as s}from"./index-CERGVYZK.js";function n(){const t=a();return e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx("section",{className:"bg-gradient-to-r from-blue-600 to-purple-700 text-white py-20",children:e.jsxs("div",{className:"container mx-auto px-6 text-center",children:[e.jsx("h1",{className:"text-5xl font-bold mb-6",children:"Page Not Found"}),e.jsx("p",{className:"text-xl mb-8 max-w-3xl mx-auto",children:"The page you are looking for does not exist. You can return to the home page using the button below."}),e.jsx(s,{variant:"default",size:"lg",onClick:()=>t("/"),className:"bg-white text-blue-600 hover:bg-gray-200",children:"Go to Home"})]})}),e.jsx("div",{className:"my-56"})]})}export{n as default};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import{c as _,p as q,v as z,r,j as e,B as d,t as j}from"./index-CERGVYZK.js";import{a as M,b as A,C as G,G as W,A as v,g as R}from"./alert-jQ9HCPIf.js";import{I as b}from"./input-Dzvg_ZEZ.js";import{L as l}from"./label-DuVnkZ4q.js";import{S as U,a as H,b as V,c as B,d as S}from"./select-DhS8YUtJ.js";import{W as Q,T as Y,a as K,b as E,c as k,I as X}from"./tabs-_77MUUQe.js";import{b as Z,c as $,C as ee,a as se,d as ne}from"./card-DFAwwhN3.js";import{S as L}from"./switch-Z3mImG9n.js";import{C as ie}from"./circle-alert-DOPQPvU8.js";import{L as ae}from"./loader-circle-CrvlRy5o.js";import"./chevron-down-CPsvsmqj.js";import"./chevron-up-Df9jMo1X.js";/**
|
|
2
|
+
* @license lucide-react v0.515.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const le=[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]],re=_("eraser",le),te={globalOptions:["--no-save"],verbose:!1,ignoreErrors:!1,dependencies:[{name:"lodash@latest"}]},oe=`
|
|
7
|
+
import _ from "lodash";
|
|
8
|
+
|
|
9
|
+
let text = "hello world";
|
|
10
|
+
let capital = _.capitalize(text);
|
|
11
|
+
console.log(capital);
|
|
12
|
+
let loaded = false;
|
|
13
|
+
|
|
14
|
+
const plugin = {
|
|
15
|
+
async load(config) {
|
|
16
|
+
console.log("Plugin loaded with config:", config);
|
|
17
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
18
|
+
loaded = true;
|
|
19
|
+
console.log("Plugin is now loaded");
|
|
20
|
+
},
|
|
21
|
+
unload() {
|
|
22
|
+
console.log("Plugin unloaded");
|
|
23
|
+
},
|
|
24
|
+
isConfigured() {
|
|
25
|
+
return loaded;
|
|
26
|
+
},
|
|
27
|
+
newLog(log) {
|
|
28
|
+
// Do not worry this logs will not be captured by the telemetry system
|
|
29
|
+
console.log("New log received:", log);
|
|
30
|
+
},
|
|
31
|
+
newTrace(trace) {
|
|
32
|
+
console.log("New trace received");
|
|
33
|
+
},
|
|
34
|
+
newMetric(metric) {
|
|
35
|
+
console.log("New metric received");
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default {plugin};
|
|
40
|
+
`.trim(),ce={setting1:"value1",setting2:"value2",setting3:"value3"},de="Sample Plugin",me="This plugin demonstrates all available features: it reads configuration, imports a dependency (lodash) to capitalize the first letter of a message, and logs when it receives traces, metrics, or logs. You can extend it to perform any custom logic, such as sending a message to Slack or Telegram when a log matches a specific regex.";function Se(){const y=q(),w=z(),[h,N]=r.useState(!1),[C,x]=r.useState(null),[o,P]=r.useState("code"),[m,u]=r.useState(!1),[p,g]=r.useState(!1),[F,O]=r.useState(!1),[n,i]=r.useState({id:"",name:"",description:"",moduleFormat:"esm",url:"",code:"",dependencies:"",config:""});r.useEffect(()=>{var c;const s=(c=w.state)==null?void 0:c.plugin;s&&(i({id:s.id||"",name:s.name||"",description:s.description||"",moduleFormat:s.moduleFormat||"esm",url:s.url||"",code:s.sourceCode||s.code||"",dependencies:s.install?JSON.stringify(s.install,null,2):"",config:s.config?JSON.stringify(s.config,null,2):""}),u(!!s.install),g(!!s.config))},[w.state]);const D=()=>{i({id:"sample-plugin",name:de,description:me,moduleFormat:"esm",url:"",code:oe,dependencies:JSON.stringify(te,null,2),config:JSON.stringify(ce,null,2)}),u(!0),g(!0)},T=()=>{i({id:"",name:"",description:"",moduleFormat:"esm",url:"",code:"",dependencies:"",config:""}),u(!1),g(!1)},I=async s=>{var c;s.preventDefault(),N(!0),x(null);try{if(!n.id.trim())throw new Error("Plugin ID is required");if(!n.name.trim())throw new Error("Plugin name is required");if(o==="url"&&!n.url.trim())throw new Error("URL is required");if(o==="code"&&!n.code.trim())throw new Error("Code is required");let a;if(p)if(n.config.trim())try{a=JSON.parse(n.config)}catch{throw new Error("Invalid JSON in config field")}else a={};else a={};let t={};if(m)if(n.dependencies.trim())try{t=JSON.parse(n.dependencies)}catch{throw new Error("Invalid JSON in dependencies field")}else t={};else t={};const J={id:n.id.trim(),name:n.name.trim(),...((c=n.description)==null?void 0:c.trim())&&{description:n.description.trim()},moduleFormat:n.moduleFormat,...o==="url"?{url:n.url.trim()}:{code:n.code.trim()},install:t,...a&&{config:a}},f=await R().createPlugin(J);if(f.status!=="success"){x(f.message),j.error(e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:"Error creating plugin"}),e.jsx("div",{className:"text-xs whitespace-pre-line mt-1",children:f.message})]}),{duration:1e4});return}j.success("Plugin created successfully!"),y("/plugins")}catch(a){const t=a instanceof Error?a.message:"Failed to create plugin";x(t),console.error("Plugin creation error:",a),j.error(e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:"Error creating plugin"}),e.jsx("div",{className:"text-xs whitespace-pre-line mt-1",children:t})]}),{duration:1e4})}finally{N(!1)}};return e.jsx("div",{className:"min-h-screen bg-gray-50",children:e.jsx("main",{className:"container mx-auto px-6 py-8 space-y-6",children:e.jsxs(Z,{children:[e.jsx($,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(ee,{className:"flex items-center gap-2",children:"Create New Plugin"}),e.jsx(se,{children:"Add a new plugin to your telemetry system."})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(d,{type:"button",variant:"outline",onClick:D,className:"gap-2",title:"Load Example",children:[e.jsx(Q,{className:"h-4 w-4"}),"Load Example"]}),e.jsxs(d,{type:"button",variant:"outline",onClick:T,className:"gap-2",title:"Clear",children:[e.jsx(re,{className:"h-4 w-4"}),"Clear"]})]})]})}),e.jsx(ne,{children:e.jsxs("form",{onSubmit:I,className:"space-y-6",children:[C&&e.jsxs(M,{variant:"destructive",children:[e.jsx(ie,{className:"h-4 w-4"}),e.jsx(A,{children:C})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"plugin-id",children:"Plugin ID *"}),e.jsx(b,{id:"plugin-id",placeholder:"my-plugin-unique-id",value:n.id,onChange:s=>i({...n,id:s.target.value}),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"plugin-name",children:"Name *"}),e.jsx(b,{id:"plugin-name",placeholder:"My Plugin",value:n.name,onChange:s=>i({...n,name:s.target.value}),required:!0})]}),e.jsxs("div",{className:"col-span-2 space-y-2",children:[e.jsx(l,{htmlFor:"plugin-description",children:"Description"}),e.jsx("textarea",{id:"plugin-description",placeholder:"Describe what this plugin does (optional)",value:n.description,onChange:s=>i({...n,description:s.target.value}),className:"w-full min-h-20 border rounded px-3 py-2 text-sm font-mono resize-y"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"module-format",children:"Module Format *"}),e.jsxs(U,{value:n.moduleFormat,onValueChange:s=>i({...n,moduleFormat:s}),children:[e.jsx(H,{children:e.jsx(V,{})}),e.jsxs(B,{children:[e.jsx(S,{value:"esm",children:"ESM (ES Modules)"}),e.jsx(S,{value:"cjs",children:"CJS (CommonJS)"})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(l,{children:"Plugin Source *"}),e.jsxs(Y,{value:o,onValueChange:s=>P(s),children:[e.jsxs(K,{className:"grid w-full grid-cols-2",children:[e.jsxs(E,{value:"code",className:"gap-2",children:[e.jsx(G,{className:"h-4 w-4"}),"Code"]}),e.jsxs(E,{value:"url",className:"gap-2",children:[e.jsx(W,{className:"h-4 w-4"}),"URL"]})]}),e.jsxs(k,{value:"code",className:"space-y-4",children:[e.jsx(l,{htmlFor:"plugin-code",children:"Source Code"}),e.jsx(v,{mode:"javascript",theme:"monokai",value:n.code,name:"plugin_code_editor",width:"100%",fontSize:14,showPrintMargin:!1,showGutter:!0,setOptions:{useWorker:!1},minLines:8,maxLines:24,onChange:s=>i({...n,code:s}),className:"font-mono text-sm resize-y border rounded-lg"})]}),e.jsxs(k,{value:"url",className:"space-y-2",children:[e.jsx(l,{htmlFor:"plugin-url",children:"Source URL"}),e.jsx(b,{id:"plugin-url",type:"url",placeholder:"https://example.com/my-plugin.js",value:n.url,onChange:s=>i({...n,url:s.target.value}),required:o==="url"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l,{htmlFor:"dependencies",children:"Dependencies"}),e.jsx(L,{id:"dependencies-switch",checked:m,onCheckedChange:u}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Enable"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Optional dependencies to install (dynamic installer syntax)",e.jsx(d,{type:"button",size:"sm",variant:"ghost",onClick:()=>O(s=>!s),title:"Dynamic installer syntax info",children:e.jsx(X,{className:"h-2 w-2"})})]}),F&&e.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded p-3 text-xs text-blue-900 mb-2",children:[e.jsx("div",{className:"font-semibold mb-1",children:"Dynamic Installer: quick guide"}),e.jsxs("div",{className:"mb-2",children:["This syntax configures programmatic npm installs. Use ",e.jsx("b",{children:"globalOptions"})," to pass flags applied to every install (for example ",e.jsx("code",{children:"--no-save"}),"). Each dependency can include its own ",e.jsx("b",{children:"options"}),", and set ",e.jsx("b",{children:"override"})," to true to ignore globalOptions for that dependency. Enable ",e.jsx("b",{children:"verbose"})," to get detailed logs and set ",e.jsx("b",{children:"ignoreErrors"})," to true to continue installing even if one package fails."]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium mb-1",children:"Detailed example"}),e.jsx("pre",{className:"bg-blue-100 border rounded p-2 overflow-x-auto text-xs",children:`{
|
|
41
|
+
"globalOptions": ["--no-save"],
|
|
42
|
+
"verbose": true,
|
|
43
|
+
"ignoreErrors": false,
|
|
44
|
+
"dependencies": [
|
|
45
|
+
{ "name": "eslint@8.0.0", "options": ["--save-dev"] },
|
|
46
|
+
{ "name": "lodash@latest", "options": ["-E"] },
|
|
47
|
+
{ "name": "axios@latest", "options": ["--save-exact"], "override": true },
|
|
48
|
+
{ "name": "typescript", "options": ["--save-optional"] }
|
|
49
|
+
]
|
|
50
|
+
}`}),e.jsxs("div",{className:"mt-2",children:["Quick notes:",e.jsxs("ul",{className:"list-disc ml-5",children:[e.jsxs("li",{children:[e.jsx("b",{children:"globalOptions"})," (here ",e.jsx("code",{children:"--no-save"}),") are applied to all installs unless a dependency sets ",e.jsx("b",{children:"override"}),"."]}),e.jsxs("li",{children:["In the example, ",e.jsx("code",{children:"axios"})," sets ",e.jsx("b",{children:"override"})," true → it will install only with its own options."]}),e.jsxs("li",{children:[e.jsx("b",{children:"verbose"})," produces console logs for each command; ",e.jsx("b",{children:"ignoreErrors"})," controls whether the installer stops on first failure."]})]})]}),e.jsx("a",{href:"https://github.com/motero2k/dynamic-installer",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 underline ml-2",children:"GitHub: dynamic-installer"})]})]}),m&&e.jsx(v,{mode:"json",theme:"monokai",value:n.dependencies,name:"plugin_dependencies_editor",width:"100%",fontSize:14,wrapEnabled:!0,showPrintMargin:!1,showGutter:!0,setOptions:{useWorker:!1},minLines:8,maxLines:16,onChange:s=>i({...n,dependencies:s}),className:"font-mono text-sm resize-y border rounded-lg",readOnly:!m})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l,{htmlFor:"plugin-config",children:"Plugin Configuration"}),e.jsx(L,{id:"config-switch",checked:p,onCheckedChange:g}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Enable"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"JSON configuration object"}),p&&e.jsx(v,{mode:"json",theme:"monokai",value:n.config,name:"plugin_config_editor",width:"100%",fontSize:14,wrapEnabled:!0,showPrintMargin:!1,showGutter:!0,setOptions:{useWorker:!1},minLines:8,maxLines:16,onChange:s=>i({...n,config:s}),className:"font-mono text-sm resize-y border rounded-lg",readOnly:!p})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(d,{type:"button",variant:"outline",onClick:()=>y("/plugins"),disabled:h,children:"Cancel"}),e.jsxs(d,{type:"submit",disabled:h,children:[h&&e.jsx(ae,{className:"h-4 w-4 mr-2 animate-spin"}),"Create Plugin"]})]})]})})]})})})}export{Se as default};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import{c as G,r as l,u as q,e as U,i as ee,j as e,f as se,h as te,P as F,p as K,B as b,T as ne,o as A,X as ae,F as re,S as ie,t as S,q as oe}from"./index-CERGVYZK.js";import{b as C,d as P,c as E,C as L,a as _}from"./card-DFAwwhN3.js";import{B as R}from"./badge-CNq0-mH5.js";import{G as le,C as ce,g as k,A as M,a as B,b as J}from"./alert-jQ9HCPIf.js";import{L as T}from"./loader-circle-CrvlRy5o.js";import{C as de}from"./chevron-down-CPsvsmqj.js";import{P as ue,a as me,R as fe,T as xe,C as he,b as pe,c as ge,D as je,d as Ne,O as ve}from"./index-BkD6DijD.js";import{D as V,S as we,U as ye}from"./upload-C1LT4Gkb.js";import{I as be}from"./input-Dzvg_ZEZ.js";import{L as Ce}from"./label-DuVnkZ4q.js";import{C as Se}from"./circle-alert-DOPQPvU8.js";/**
|
|
2
|
+
* @license lucide-react v0.515.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const Pe=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Oe=G("chevron-right",Pe);/**
|
|
7
|
+
* @license lucide-react v0.515.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const Ee=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],ke=G("circle-check-big",Ee);function Ae(s,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(s==null||s(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function De(s,t){return l.useReducer((n,i)=>t[n][i]??n,s)}var X=s=>{const{present:t,children:n}=s,i=Le(t),r=typeof n=="function"?n({present:i.isPresent}):l.Children.only(n),m=q(i.ref,Re(r));return typeof n=="function"||i.isPresent?l.cloneElement(r,{ref:m}):null};X.displayName="Presence";function Le(s){const[t,n]=l.useState(),i=l.useRef(null),r=l.useRef(s),m=l.useRef("none"),d=s?"mounted":"unmounted",[g,x]=De(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return l.useEffect(()=>{const c=D(i.current);m.current=g==="mounted"?c:"none"},[g]),U(()=>{const c=i.current,N=r.current;if(N!==s){const a=m.current,u=D(c);s?x("MOUNT"):u==="none"||(c==null?void 0:c.display)==="none"?x("UNMOUNT"):x(N&&a!==u?"ANIMATION_OUT":"UNMOUNT"),r.current=s}},[s,x]),U(()=>{if(t){let c;const N=t.ownerDocument.defaultView??window,v=u=>{const j=D(i.current).includes(CSS.escape(u.animationName));if(u.target===t&&j&&(x("ANIMATION_END"),!r.current)){const o=t.style.animationFillMode;t.style.animationFillMode="forwards",c=N.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=o)})}},a=u=>{u.target===t&&(m.current=D(i.current))};return t.addEventListener("animationstart",a),t.addEventListener("animationcancel",v),t.addEventListener("animationend",v),()=>{N.clearTimeout(c),t.removeEventListener("animationstart",a),t.removeEventListener("animationcancel",v),t.removeEventListener("animationend",v)}}else x("ANIMATION_END")},[t,x]),{isPresent:["mounted","unmountSuspended"].includes(g),ref:l.useCallback(c=>{i.current=c?getComputedStyle(c):null,n(c)},[])}}function D(s){return(s==null?void 0:s.animationName)||"none"}function Re(s){var i,r;let t=(i=Object.getOwnPropertyDescriptor(s.props,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?s.ref:(t=(r=Object.getOwnPropertyDescriptor(s,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?s.props.ref:s.props.ref||s.ref)}var I="Collapsible",[Te,fs]=se(I),[Ie,$]=Te(I),Q=l.forwardRef((s,t)=>{const{__scopeCollapsible:n,open:i,defaultOpen:r,disabled:m,onOpenChange:d,...g}=s,[x,c]=ee({prop:i,defaultProp:r??!1,onChange:d,caller:I});return e.jsx(Ie,{scope:n,disabled:m,contentId:te(),open:x,onOpenToggle:l.useCallback(()=>c(N=>!N),[c]),children:e.jsx(F.div,{"data-state":W(x),"data-disabled":m?"":void 0,...g,ref:t})})});Q.displayName=I;var Y="CollapsibleTrigger",Z=l.forwardRef((s,t)=>{const{__scopeCollapsible:n,...i}=s,r=$(Y,n);return e.jsx(F.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":W(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...i,ref:t,onClick:Ae(s.onClick,r.onOpenToggle)})});Z.displayName=Y;var z="CollapsibleContent",H=l.forwardRef((s,t)=>{const{forceMount:n,...i}=s,r=$(z,s.__scopeCollapsible);return e.jsx(X,{present:n||r.open,children:({present:m})=>e.jsx(Me,{...i,ref:t,present:m})})});H.displayName=z;var Me=l.forwardRef((s,t)=>{const{__scopeCollapsible:n,present:i,children:r,...m}=s,d=$(z,n),[g,x]=l.useState(i),c=l.useRef(null),N=q(t,c),v=l.useRef(0),a=v.current,u=l.useRef(0),h=u.current,j=d.open||g,o=l.useRef(j),p=l.useRef(void 0);return l.useEffect(()=>{const f=requestAnimationFrame(()=>o.current=!1);return()=>cancelAnimationFrame(f)},[]),U(()=>{const f=c.current;if(f){p.current=p.current||{transitionDuration:f.style.transitionDuration,animationName:f.style.animationName},f.style.transitionDuration="0s",f.style.animationName="none";const y=f.getBoundingClientRect();v.current=y.height,u.current=y.width,o.current||(f.style.transitionDuration=p.current.transitionDuration,f.style.animationName=p.current.animationName),x(i)}},[d.open,i]),e.jsx(F.div,{"data-state":W(d.open),"data-disabled":d.disabled?"":void 0,id:d.contentId,hidden:!j,...m,ref:N,style:{"--radix-collapsible-content-height":a?`${a}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...s.style},children:j&&r})});function W(s){return s?"open":"closed"}var Ue=Q;function _e({...s}){return e.jsx(Ue,{"data-slot":"collapsible",...s})}function Fe({...s}){return e.jsx(Z,{"data-slot":"collapsible-trigger",...s})}function $e({...s}){return e.jsx(H,{"data-slot":"collapsible-content",...s})}function ze(s){return s.code?"code":"url"}function We(s){const t=s.map(n=>({id:n.id,name:n.name,...n.url&&{url:n.url},...n.code&&{code:n.code},moduleFormat:n.moduleFormat,active:n.active,...n.install&&{install:n.install},...n.config&&{config:n.config}}));return JSON.stringify(t,null,2)}function Be(s){return Array.isArray(s)?s.every(t=>typeof t.id=="string"&&typeof t.moduleFormat=="string"&&["cjs","esm"].includes(t.moduleFormat)&&(t.url||t.code)):!1}function Je({plugin:s}){const[t,n]=l.useState(s.sourceCode),[i,r]=l.useState(s.install?JSON.stringify(s.install,null,2):""),[m,d]=l.useState(s.config?JSON.stringify(s.config,null,2):"");return l.useEffect(()=>{n(s.sourceCode),r(s.install?JSON.stringify(s.install,null,2):""),d(s.config?JSON.stringify(s.config,null,2):"")},[s]),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h5",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Source Code"}),e.jsx(M,{mode:"javascript",theme:"monokai",value:t,name:`source_${s.id}`,readOnly:!0,width:"100%",fontSize:14,wrapEnabled:!0,showPrintMargin:!1,showGutter:!0,setOptions:{useWorker:!1},minLines:5,maxLines:20,onChange:n})]}),s.install&&e.jsxs("div",{children:[e.jsx("h5",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Dependencies"}),e.jsx(M,{mode:"json",theme:"monokai",value:i,name:`install_${s.id}`,readOnly:!0,width:"100%",fontSize:14,wrapEnabled:!0,showPrintMargin:!1,showGutter:!0,setOptions:{useWorker:!1},minLines:5,maxLines:20,onChange:r})]}),s.config&&Object.keys(s.config).length>0&&e.jsxs("div",{children:[e.jsx("h5",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Plugin Configuration"}),e.jsx(M,{mode:"json",theme:"monokai",value:m,name:`config_${s.id}`,readOnly:!0,width:"100%",fontSize:14,wrapEnabled:!0,showPrintMargin:!1,showGutter:!0,setOptions:{useWorker:!1},minLines:5,maxLines:20,onChange:d})]})]})}function Ge({plugins:s,onRefresh:t,loading:n=!1}){const[i,r]=l.useState(new Set),[m,d]=l.useState(new Set),g=K(),x=async a=>{const u=a.id;d(o=>new Set(o).add(u));const h=k();let j;a.active?j=await h.deactivatePlugin(u):j=await h.activatePlugin(u),j.status,t==null||t(),d(o=>{const p=new Set(o);return p.delete(u),p})},c=async a=>{if(!confirm("Are you sure you want to delete this plugin?"))return;d(j=>new Set(j).add(a)),(await k().deletePlugin(a)).status,t==null||t(),d(j=>{const o=new Set(j);return o.delete(a),o})},N=a=>{const u={...a,exportedAt:new Date().toISOString()};delete u.process;const h=new Blob([JSON.stringify([u],null,2)],{type:"application/json"}),j=URL.createObjectURL(h),o=document.createElement("a"),p=new Date().toISOString().split("T")[0];o.href=j,o.download=`plugin-${a.id}-${p}.json`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(j)},v=a=>{r(u=>{const h=new Set(u);return h.has(a)?h.delete(a):h.add(a),h})};return n?e.jsx(C,{children:e.jsx(P,{className:"flex items-center justify-center py-12",children:e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(T,{className:"h-4 w-4 animate-spin"}),"Loading plugins..."]})})}):s.length===0?e.jsx(C,{children:e.jsxs(E,{children:[e.jsx(L,{children:"No Plugins Found"}),e.jsx(_,{children:"Get started by creating your first plugin."})]})}):e.jsxs(C,{className:"rounded-lg",children:[e.jsxs(E,{children:[e.jsxs(L,{children:["Plugins (",s.length,")"]}),e.jsx(_,{children:"Manage your telemetry plugins."})]}),e.jsx(P,{className:"space-y-4",children:s.map(a=>{const u=i.has(a.id),h=m.has(a.id),j=ze(a);return e.jsx(_e,{open:u,onOpenChange:()=>v(a.id),children:e.jsxs(C,{className:"rounded-lg border-l-4 border-l-transparent data-[state=open]:border-l-primary transition-all",children:[e.jsx(E,{className:"pb-3",children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[e.jsx(Fe,{asChild:!0,children:e.jsx(b,{variant:"ghost",size:"sm",className:"rounded-md h-9 w-9 p-0 flex-shrink-0 mt-0.5",children:u?e.jsx(de,{className:"h-4 w-4"}):e.jsx(Oe,{className:"h-4 w-4"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:[e.jsx("h3",{className:"font-semibold text-base",children:a.name||a.id}),e.jsx(R,{variant:a.active?"default":"secondary",children:a.active?"Active":"Inactive"}),e.jsx(R,{variant:"outline",className:"font-mono text-xs",children:a.moduleFormat.toUpperCase()})]}),e.jsx("p",{className:"text-sm text-muted-foreground font-mono mb-2",children:a.id}),a.description&&e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:a.description}),e.jsx("div",{className:"flex items-center gap-2",children:j==="url"?e.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[e.jsx(le,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),a.url&&e.jsx("a",{href:a.url,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:underline truncate",children:a.url})]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ce,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Inline Code"})]})})]})]}),e.jsx("div",{className:"flex items-center gap-3 sm:ml-4 self-start w-full sm:w-auto",children:e.jsxs("div",{className:"flex flex-wrap sm:flex-row gap-2 w-auto",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{variant:a.active?"secondary":"default",size:"sm",onClick:()=>x(a),disabled:h,className:"rounded-md h-9 sm:w-9 p-0",title:a.active?"Pause Plugin":"Run Plugin",children:a.active?e.jsx(ue,{className:"h-4 w-4"}):e.jsx(me,{className:"h-4 w-4"})}),h&&e.jsx(T,{className:"h-4 w-4 animate-spin"})]}),e.jsx(b,{variant:"secondary",size:"sm",onClick:()=>N(a),className:"rounded-md h-9 sm:w-9 p-0",title:"Export Plugin",children:e.jsx(V,{className:"h-4 w-4"})}),e.jsx(b,{variant:"secondary",size:"sm",onClick:()=>c(a.id),title:"Delete Plugin",disabled:h,className:"text-destructive hover:text-destructive rounded-md h-9 sm:w-9 p-0",children:e.jsx(ne,{className:"h-4 w-4"})}),e.jsx(b,{variant:"secondary",size:"sm",className:"rounded-md h-9 sm:w-9 p-0",title:"Edit Plugin",onClick:()=>{if(window.confirm("Warning: Editing a plugin will delete and re-register it to properly kill the process. Do you agree?"))try{k().deletePlugin(a.id),g("/plugins/create",{state:{plugin:a}})}catch(o){console.error("Error deleting plugin:",o)}},children:e.jsx(we,{className:"h-4 w-4"})})]})})]})}),e.jsx($e,{children:e.jsx(P,{className:"pt-0 rounded-b-lg",children:e.jsx(Je,{plugin:a})})})]})},a.id)})})]})}function qe({...s}){return e.jsx(fe,{"data-slot":"dialog",...s})}function Ke({...s}){return e.jsx(xe,{"data-slot":"dialog-trigger",...s})}function Ve({...s}){return e.jsx(Ne,{"data-slot":"dialog-portal",...s})}function Xe({className:s,...t}){return e.jsx(ve,{"data-slot":"dialog-overlay",className:A("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",s),...t})}function Qe({className:s,children:t,showCloseButton:n=!0,...i}){return e.jsxs(Ve,{"data-slot":"dialog-portal",children:[e.jsx(Xe,{}),e.jsxs(he,{"data-slot":"dialog-content",className:A("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",s),...i,children:[t,n&&e.jsxs(pe,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[e.jsx(ae,{}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Ye({className:s,...t}){return e.jsx("div",{"data-slot":"dialog-header",className:A("flex flex-col gap-2 text-center sm:text-left",s),...t})}function Ze({className:s,...t}){return e.jsx(ge,{"data-slot":"dialog-title",className:A("text-lg leading-none font-semibold",s),...t})}function He({className:s,...t}){return e.jsx(je,{"data-slot":"dialog-description",className:A("text-muted-foreground text-sm",s),...t})}function es({plugins:s}){const[t,n]=l.useState(!1),i=async()=>{n(!0);try{const r=We(s),m=new Blob([r],{type:"application/json"}),d=URL.createObjectURL(m),g=document.createElement("a");g.href=d,g.download=`plugins-export-${new Date().toISOString().split("T")[0]}.json`,document.body.appendChild(g),g.click(),document.body.removeChild(g),URL.revokeObjectURL(d),S.success(e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:"Plugins exported"}),e.jsxs("div",{className:"text-xs whitespace-pre-line mt-1",children:["Exported ",s.length," plugin",s.length===1?"":"s"," successfully."]})]}))}catch(r){S.error(e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:"Error exporting plugins"}),e.jsx("div",{className:"text-xs whitespace-pre-line mt-1",children:r instanceof Error?r.message:"Export failed"})]}),{duration:1e4}),console.error("Export failed:",r)}finally{n(!1)}};return e.jsxs(b,{variant:"outline",className:"gap-2 bg-transparent",onClick:i,disabled:t||s.length===0,children:[t?e.jsx(T,{className:"h-4 w-4 animate-spin"}):e.jsx(V,{className:"h-4 w-4"}),"Export (",s.length,")"]})}function ss({onPluginsImported:s}){const[t,n]=l.useState(!1),[i,r]=l.useState(!1),[m,d]=l.useState(null),[g,x]=l.useState(null),[c,N]=l.useState(null),v=l.useRef(null),a=()=>{d(null),x(null),N(null),v.current&&(v.current.value="")},u=async o=>{var f;const p=(f=o.target.files)==null?void 0:f[0];if(p){a();try{const y=await p.text(),w=JSON.parse(y);if(!Be(w))throw new Error("Invalid plugin data format");N(w)}catch(y){d(y instanceof Error?y.message:"Failed to parse file")}}},h=async()=>{if(c){r(!0),d(null);try{const o=k(),p=[];for(const w of c)try{const O=await o.createPlugin(w);O.status==="success"?p.push({id:w.id,success:!0}):p.push({id:w.id,success:!1,error:O.message||"Unknown error"})}catch(O){p.push({id:w.id,success:!1,error:O instanceof Error?O.message:"Unknown error"})}const f=p.filter(w=>w.success).length,y=p.length-f;y===0?(x(`Successfully imported ${f} plugins`),S.success(e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:"Plugins imported"}),e.jsxs("div",{className:"text-xs whitespace-pre-line mt-1",children:["Imported ",f," plugin",f===1?"":"s"," successfully."]})]}))):(x(`Imported ${f} plugins (${y} failed)`),S.error(e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:"Some plugins failed to import"}),e.jsxs("div",{className:"text-xs whitespace-pre-line mt-1",children:["Imported ",f," plugin",f===1?"":"s",", ",y," failed.",p.filter(w=>!w.success).map(w=>`
|
|
12
|
+
${w.id}: ${w.error}`).join("")]})]}),{duration:1e4})),s==null||s(),setTimeout(()=>{n(!1)},2e3)}catch(o){d(o instanceof Error?o.message:"Import failed"),S.error(e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:"Error importing plugins"}),e.jsx("div",{className:"text-xs whitespace-pre-line mt-1",children:o instanceof Error?o.message:"Import failed"})]}),{duration:1e4})}finally{r(!1)}}},j=o=>{n(o),o||a()};return e.jsxs(qe,{open:t,onOpenChange:j,children:[e.jsx(Ke,{asChild:!0,children:e.jsxs(b,{variant:"outline",className:"gap-2 bg-transparent",children:[e.jsx(ye,{className:"h-4 w-4"}),"Import"]})}),e.jsxs(Qe,{className:"max-w-2xl max-h-[90vh]",children:[e.jsxs(Ye,{children:[e.jsx(Ze,{children:"Import Plugins"}),e.jsx(He,{children:"Upload a JSON file to import plugins in bulk."})]}),e.jsxs("div",{className:"space-y-6",children:[m&&e.jsxs(B,{variant:"destructive",children:[e.jsx(Se,{className:"h-4 w-4"}),e.jsx(J,{children:m})]}),g&&e.jsxs(B,{children:[e.jsx(ke,{className:"h-4 w-4"}),e.jsx(J,{children:g})]}),!c&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ce,{htmlFor:"plugin-file",children:"Select Plugin File"}),e.jsx(be,{id:"plugin-file",type:"file",accept:".json",onChange:u,ref:v})]}),e.jsxs(C,{children:[e.jsx(E,{children:e.jsxs(L,{className:"text-base flex items-center gap-2",children:[e.jsx(re,{className:"h-4 w-4"}),"Expected Format"]})}),e.jsx(P,{children:e.jsx("pre",{className:"text-xs bg-muted rounded p-3 overflow-x-auto",children:e.jsx("code",{children:`[
|
|
13
|
+
{
|
|
14
|
+
"id": "my-plugin",
|
|
15
|
+
"name": "My Plugin",
|
|
16
|
+
"moduleFormat": "esm",
|
|
17
|
+
"code": "export default function...",
|
|
18
|
+
"active": true,
|
|
19
|
+
"install": {
|
|
20
|
+
"dependencies": ["lodash"],
|
|
21
|
+
"ignoreErrors": false
|
|
22
|
+
},
|
|
23
|
+
"config": {
|
|
24
|
+
"option": true
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
]`})})})]})]}),c&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h3",{className:"font-medium",children:["Preview (",c.length," plugins)"]}),e.jsx(b,{variant:"outline",size:"sm",onClick:a,children:"Choose Different File"})]}),e.jsx(ie,{className:"h-64 border rounded-lg",children:e.jsx("div",{className:"p-4 space-y-3",children:c.map((o,p)=>{var f;return e.jsx(C,{children:e.jsx(P,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:o.id}),e.jsx("div",{className:"text-sm text-muted-foreground",children:o.url?`URL: ${o.url}`:"Code provided"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(R,{variant:"outline",className:"font-mono text-xs",children:o.moduleFormat.toUpperCase()}),((f=o.install)==null?void 0:f.dependencies)&&e.jsxs(R,{variant:"secondary",className:"text-xs",children:[o.install.dependencies.length," deps"]})]})]})})},p)})})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(b,{variant:"outline",onClick:()=>n(!1),disabled:i,children:"Cancel"}),e.jsxs(b,{onClick:h,disabled:i,children:[i&&e.jsx(T,{className:"h-4 w-4 mr-2 animate-spin"}),"Import ",c.length," Plugins"]})]})]})]})]})]})}function xs(){const[s,t]=l.useState(0),[n,i]=l.useState([]),[r,m]=l.useState(!0),d=K();l.useEffect(()=>{g()},[s]);const g=async()=>{m(!0);try{const N=await k().listPlugins();N.status==="success"?i(N.data):(i([]),S.error(e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Error loading Plugins:"})," ",N.message||"Unknown error"]})))}catch{i([]),S.error(e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Error loading Plugins:"}),' "Unknown error"']}))}m(!1)},x=()=>{t(c=>c+1)};return e.jsx("div",{className:" bg-gray-50",children:e.jsxs("main",{className:"container mx-auto px-6 py-8 space-y-6",children:[e.jsxs(C,{children:[e.jsx(E,{children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsxs(L,{className:"flex items-center gap-2",children:[e.jsx(oe,{className:"h-5 w-5"}),"Plugin Management"]}),e.jsx(_,{children:"Control and manage telemetry system plugins"})]})})}),e.jsx(P,{children:e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:e.jsx(b,{className:"gap-2 w-full sm:w-auto",onClick:()=>d("/plugins/create"),children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add Plugin"]})})}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[e.jsx(ss,{onPluginsImported:x}),e.jsx(es,{plugins:n})]})]})})]}),e.jsx(Ge,{plugins:n,loading:r,onRefresh:x})]})})}export{xs as default};
|