@oas-tools/oas-telemetry 0.7.1 → 0.8.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/.env.example +17 -3
  2. package/README.md +1 -2
  3. package/dist/cjs/config/bootConfig.cjs +16 -14
  4. package/dist/cjs/config/config.cjs +120 -125
  5. package/dist/cjs/config/config.types.cjs +1 -4
  6. package/dist/cjs/docs/openapi.yaml +158 -4
  7. package/dist/cjs/index.cjs +27 -30
  8. package/dist/cjs/routesManager.cjs +62 -70
  9. package/dist/cjs/telemetry/custom-implementations/exporters/DiskLogExporter.cjs +121 -0
  10. package/dist/cjs/telemetry/custom-implementations/exporters/DiskMetricExporter.cjs +101 -0
  11. package/dist/cjs/telemetry/custom-implementations/exporters/DiskTraceExporter.cjs +103 -0
  12. package/dist/cjs/telemetry/custom-implementations/exporters/InMemoryDbLogExporter.cjs +194 -190
  13. package/dist/cjs/telemetry/custom-implementations/exporters/InMemoryDbMetricExporter.cjs +147 -99
  14. package/dist/cjs/telemetry/custom-implementations/exporters/InMemoryDbSpanExporter.cjs +143 -116
  15. package/dist/cjs/telemetry/custom-implementations/exporters/MultiMetricExporter.cjs +57 -0
  16. package/dist/cjs/telemetry/custom-implementations/instrumentations/logsInstrumentation.cjs +92 -0
  17. package/dist/cjs/telemetry/custom-implementations/metrics/tsdb/Chunk.cjs +159 -0
  18. package/dist/cjs/telemetry/custom-implementations/metrics/tsdb/Series.cjs +168 -0
  19. package/dist/cjs/telemetry/custom-implementations/metrics/tsdb/SeriesRegistry.cjs +392 -0
  20. package/dist/cjs/telemetry/custom-implementations/metrics/tsdb/types.cjs +2 -0
  21. package/dist/cjs/telemetry/custom-implementations/metrics/tsdb/utils.cjs +77 -0
  22. package/dist/cjs/telemetry/custom-implementations/processors/dynamicMultiLogProcessor.cjs +65 -63
  23. package/dist/cjs/telemetry/custom-implementations/processors/dynamicMultiSpanProcessor.cjs +63 -62
  24. package/dist/cjs/telemetry/custom-implementations/utils/circular.cjs +47 -47
  25. package/dist/cjs/telemetry/custom-implementations/wrappers.cjs +209 -138
  26. package/dist/cjs/telemetry/initializeTelemetry.cjs +35 -91
  27. package/dist/cjs/telemetry/persistence/DiskImporter.cjs +85 -0
  28. package/dist/cjs/telemetry/persistence/DiskUtils.cjs +61 -0
  29. package/dist/cjs/telemetry/persistence/DiskWriter.cjs +66 -0
  30. package/dist/cjs/telemetry/telemetryConfigurator.cjs +139 -72
  31. package/dist/cjs/telemetry/telemetryRegistry.cjs +45 -31
  32. package/dist/cjs/tlm-ai/agent.cjs +49 -64
  33. package/dist/cjs/tlm-ai/aiController.cjs +54 -76
  34. package/dist/cjs/tlm-ai/aiRoutes.cjs +17 -20
  35. package/dist/cjs/tlm-ai/aiService.cjs +91 -95
  36. package/dist/cjs/tlm-ai/tools.cjs +177 -174
  37. package/dist/cjs/tlm-auth/authController.cjs +80 -123
  38. package/dist/cjs/tlm-auth/authMiddleware.cjs +25 -30
  39. package/dist/cjs/tlm-auth/authRoutes.cjs +11 -14
  40. package/dist/cjs/tlm-log/logController.cjs +135 -116
  41. package/dist/cjs/tlm-log/logRoutes.cjs +19 -20
  42. package/dist/cjs/tlm-log/logService.cjs +29 -0
  43. package/dist/cjs/tlm-metric/metricsController.cjs +154 -122
  44. package/dist/cjs/tlm-metric/metricsRoutes.cjs +22 -20
  45. package/dist/cjs/tlm-metric/metricsService.cjs +26 -0
  46. package/dist/cjs/tlm-plugin/pluginController.cjs +128 -140
  47. package/dist/cjs/tlm-plugin/pluginProcess.cjs +89 -94
  48. package/dist/cjs/tlm-plugin/pluginRoutes.cjs +11 -14
  49. package/dist/cjs/tlm-plugin/pluginService.cjs +73 -74
  50. package/dist/cjs/tlm-trace/traceController.cjs +140 -123
  51. package/dist/cjs/tlm-trace/traceRoutes.cjs +19 -20
  52. package/dist/cjs/tlm-trace/traceService.cjs +29 -0
  53. package/dist/cjs/tlm-ui/uiRoutes.cjs +63 -32
  54. package/dist/cjs/tlm-util/utilController.cjs +68 -70
  55. package/dist/cjs/tlm-util/utilRoutes.cjs +51 -63
  56. package/dist/cjs/types/index.cjs +2 -5
  57. package/dist/cjs/utils/logger.cjs +38 -43
  58. package/dist/cjs/utils/regexUtils.cjs +22 -22
  59. package/dist/esm/config/bootConfig.js +5 -2
  60. package/dist/esm/config/config.js +9 -2
  61. package/dist/esm/docs/openapi.yaml +158 -4
  62. package/dist/esm/index.js +9 -8
  63. package/dist/esm/routesManager.js +6 -10
  64. package/dist/esm/telemetry/custom-implementations/exporters/DiskLogExporter.js +114 -0
  65. package/dist/esm/telemetry/custom-implementations/exporters/DiskMetricExporter.js +94 -0
  66. package/dist/esm/telemetry/custom-implementations/exporters/DiskTraceExporter.js +96 -0
  67. package/dist/esm/telemetry/custom-implementations/exporters/InMemoryDbLogExporter.js +38 -7
  68. package/dist/esm/telemetry/custom-implementations/exporters/InMemoryDbMetricExporter.js +107 -48
  69. package/dist/esm/telemetry/custom-implementations/exporters/InMemoryDbSpanExporter.js +60 -29
  70. package/dist/esm/telemetry/custom-implementations/exporters/MultiMetricExporter.js +53 -0
  71. package/dist/esm/telemetry/custom-implementations/instrumentations/logsInstrumentation.js +85 -0
  72. package/dist/esm/telemetry/custom-implementations/metrics/tsdb/Chunk.js +155 -0
  73. package/dist/esm/telemetry/custom-implementations/metrics/tsdb/Series.js +164 -0
  74. package/dist/esm/telemetry/custom-implementations/metrics/tsdb/SeriesRegistry.js +385 -0
  75. package/dist/esm/telemetry/custom-implementations/metrics/tsdb/types.js +1 -0
  76. package/dist/esm/telemetry/custom-implementations/metrics/tsdb/utils.js +74 -0
  77. package/dist/esm/telemetry/custom-implementations/processors/dynamicMultiLogProcessor.js +2 -1
  78. package/dist/esm/telemetry/custom-implementations/processors/dynamicMultiSpanProcessor.js +1 -1
  79. package/dist/esm/telemetry/custom-implementations/wrappers.js +77 -6
  80. package/dist/esm/telemetry/initializeTelemetry.js +27 -69
  81. package/dist/esm/telemetry/persistence/DiskImporter.js +78 -0
  82. package/dist/esm/telemetry/persistence/DiskUtils.js +51 -0
  83. package/dist/esm/telemetry/persistence/DiskWriter.js +59 -0
  84. package/dist/esm/telemetry/telemetryConfigurator.js +110 -39
  85. package/dist/esm/telemetry/telemetryRegistry.js +12 -1
  86. package/dist/esm/tlm-ai/agent.js +5 -3
  87. package/dist/esm/tlm-ai/aiController.js +3 -3
  88. package/dist/esm/tlm-ai/aiService.js +6 -2
  89. package/dist/esm/tlm-ai/tools.js +5 -9
  90. package/dist/esm/tlm-auth/authController.js +3 -2
  91. package/dist/esm/tlm-log/logController.js +62 -18
  92. package/dist/esm/tlm-log/logRoutes.js +3 -1
  93. package/dist/esm/tlm-log/logService.js +25 -0
  94. package/dist/esm/tlm-metric/metricsController.js +116 -50
  95. package/dist/esm/tlm-metric/metricsRoutes.js +8 -3
  96. package/dist/esm/tlm-metric/metricsService.js +22 -0
  97. package/dist/esm/tlm-plugin/pluginController.js +6 -11
  98. package/dist/esm/tlm-plugin/pluginService.js +2 -4
  99. package/dist/esm/tlm-trace/traceController.js +87 -36
  100. package/dist/esm/tlm-trace/traceRoutes.js +3 -1
  101. package/dist/esm/tlm-trace/traceService.js +25 -0
  102. package/dist/esm/tlm-ui/uiRoutes.js +5 -5
  103. package/dist/esm/tlm-util/utilController.js +3 -9
  104. package/dist/esm/tlm-util/utilRoutes.js +2 -2
  105. package/dist/types/config/bootConfig.d.ts +3 -0
  106. package/dist/types/config/config.d.ts +48 -7
  107. package/dist/types/config/config.types.d.ts +7 -0
  108. package/dist/types/index.d.ts +2 -3
  109. package/dist/types/telemetry/custom-implementations/exporters/DiskLogExporter.d.ts +24 -0
  110. package/dist/types/telemetry/custom-implementations/exporters/DiskMetricExporter.d.ts +23 -0
  111. package/dist/types/telemetry/custom-implementations/exporters/DiskTraceExporter.d.ts +23 -0
  112. package/dist/types/telemetry/custom-implementations/exporters/InMemoryDbLogExporter.d.ts +3 -1
  113. package/dist/types/telemetry/custom-implementations/exporters/InMemoryDbMetricExporter.d.ts +56 -15
  114. package/dist/types/telemetry/custom-implementations/exporters/InMemoryDbSpanExporter.d.ts +8 -4
  115. package/dist/types/telemetry/custom-implementations/exporters/MultiMetricExporter.d.ts +9 -0
  116. package/dist/types/telemetry/custom-implementations/instrumentations/logsInstrumentation.d.ts +23 -0
  117. package/dist/types/telemetry/custom-implementations/metrics/tsdb/Chunk.d.ts +49 -0
  118. package/dist/types/telemetry/custom-implementations/metrics/tsdb/Series.d.ts +67 -0
  119. package/dist/types/telemetry/custom-implementations/metrics/tsdb/SeriesRegistry.d.ts +69 -0
  120. package/dist/types/telemetry/custom-implementations/metrics/tsdb/types.d.ts +68 -0
  121. package/dist/types/telemetry/custom-implementations/metrics/tsdb/utils.d.ts +21 -0
  122. package/dist/types/telemetry/custom-implementations/processors/dynamicMultiLogProcessor.d.ts +2 -2
  123. package/dist/types/telemetry/custom-implementations/wrappers.d.ts +2 -1
  124. package/dist/types/telemetry/persistence/DiskImporter.d.ts +17 -0
  125. package/dist/types/telemetry/persistence/DiskUtils.d.ts +11 -0
  126. package/dist/types/telemetry/persistence/DiskWriter.d.ts +21 -0
  127. package/dist/types/telemetry/telemetryConfigurator.d.ts +1 -1
  128. package/dist/types/telemetry/telemetryRegistry.d.ts +8 -0
  129. package/dist/types/tlm-ai/agent.d.ts +1 -1
  130. package/dist/types/tlm-ai/aiService.d.ts +1 -1
  131. package/dist/types/tlm-log/logController.d.ts +2 -0
  132. package/dist/types/tlm-log/logService.d.ts +4 -0
  133. package/dist/types/tlm-metric/metricsController.d.ts +11 -2
  134. package/dist/types/tlm-metric/metricsService.d.ts +6 -0
  135. package/dist/types/tlm-trace/traceController.d.ts +9 -7
  136. package/dist/types/tlm-trace/traceService.d.ts +4 -0
  137. package/dist/types/types/index.d.ts +2 -2
  138. package/dist/ui/assets/{ApiDocsPage-C_VVPPHa.js → ApiDocsPage-DTCgVbW2.js} +2 -2
  139. package/dist/ui/assets/CollapsibleCard-lWgfsaAn.js +1 -0
  140. package/dist/ui/assets/DevToolsPage-DEhf8CBy.js +1 -0
  141. package/dist/ui/assets/LandingPage-CfEHCDxY.js +6 -0
  142. package/dist/ui/assets/LogsPage-DFDKRuGH.js +1 -0
  143. package/dist/ui/assets/{NotFoundPage-B3quk3P1.js → NotFoundPage-DCy0DcV7.js} +1 -1
  144. package/dist/ui/assets/PluginCreatePage-BawZ5_-h.js +50 -0
  145. package/dist/ui/assets/PluginPage-D3FmgU7d.js +27 -0
  146. package/dist/ui/assets/TraceSpansPage-D0_L45Rb.js +6 -0
  147. package/dist/ui/assets/VirtualizedListPanel-q605n9He.js +16 -0
  148. package/dist/ui/assets/alert-DBAFshSi.js +1133 -0
  149. package/dist/ui/assets/badge-DGNBtnxU.js +1 -0
  150. package/dist/ui/assets/{chevron-down-CPsvsmqj.js → chevron-down-CFEqYzGC.js} +1 -1
  151. package/dist/ui/assets/{chevron-up-Df9jMo1X.js → chevron-up-lDnFwAJq.js} +1 -1
  152. package/dist/ui/assets/{circle-alert-DOPQPvU8.js → circle-alert-BpYUuRs7.js} +1 -1
  153. package/dist/ui/assets/dialog-1dRyI6SC.js +15 -0
  154. package/dist/ui/assets/index-C7RfU6hR.js +1 -0
  155. package/dist/ui/assets/index-C9dDYIpd.js +305 -0
  156. package/dist/ui/assets/index-D6f1KjWV.css +1 -0
  157. package/dist/ui/assets/info-CuJQWoBU.js +6 -0
  158. package/dist/ui/assets/{input-Dzvg_ZEZ.js → input-BLXaar0X.js} +1 -1
  159. package/dist/ui/assets/label-DfAcltsl.js +1 -0
  160. package/dist/ui/assets/{loader-circle-CrvlRy5o.js → loader-circle-B7oLyPsi.js} +1 -1
  161. package/dist/ui/assets/{loginPage-qa4V-B70.js → loginPage-DswZvOJ-.js} +1 -1
  162. package/dist/ui/assets/metrics-page-BhtXrfUW.js +31 -0
  163. package/dist/ui/assets/metrics-page-D1GxaB_c.css +1 -0
  164. package/dist/ui/assets/popover-IDker85U.js +11 -0
  165. package/dist/ui/assets/select-B8y5IidE.js +6 -0
  166. package/dist/ui/assets/separator-B6EzrxYY.js +6 -0
  167. package/dist/ui/assets/severityOptions-DtCsaAZK.js +11 -0
  168. package/dist/ui/assets/square-pen-D_oecB1x.js +6 -0
  169. package/dist/ui/assets/switch-Dqo0XkRD.js +1 -0
  170. package/dist/ui/assets/trace-DJq1miYa.js +1 -0
  171. package/dist/ui/assets/upload-prIohEdY.js +11 -0
  172. package/dist/ui/assets/{utilService-DNyqzwj0.js → utilService-C8TJKLqs.js} +1 -1
  173. package/dist/ui/assets/wand-sparkles-OgXuzsSx.js +6 -0
  174. package/dist/ui/index.html +2 -2
  175. package/package.json +44 -49
  176. package/dist/ui/assets/CollapsibleCard-B3KR_8mL.js +0 -1
  177. package/dist/ui/assets/DevToolsPage-OyZcDcmw.js +0 -1
  178. package/dist/ui/assets/LandingPage-CppFBA6K.js +0 -6
  179. package/dist/ui/assets/LogsPage-9Fq8GArS.js +0 -26
  180. package/dist/ui/assets/PluginCreatePage-X_aCH4t4.js +0 -50
  181. package/dist/ui/assets/PluginPage-DMDSihrZ.js +0 -27
  182. package/dist/ui/assets/alert-jQ9HCPIf.js +0 -1133
  183. package/dist/ui/assets/badge-CNq0-mH5.js +0 -1
  184. package/dist/ui/assets/card-DFAwwhN3.js +0 -1
  185. package/dist/ui/assets/index-BkD6DijD.js +0 -15
  186. package/dist/ui/assets/index-CERGVYZK.js +0 -292
  187. package/dist/ui/assets/index-CSIPf9qw.css +0 -1
  188. package/dist/ui/assets/label-DuVnkZ4q.js +0 -1
  189. package/dist/ui/assets/select-DhS8YUtJ.js +0 -1
  190. package/dist/ui/assets/separator-isK4chBP.js +0 -6
  191. package/dist/ui/assets/severityOptions-O38dSOfk.js +0 -11
  192. package/dist/ui/assets/switch-Z3mImG9n.js +0 -1
  193. package/dist/ui/assets/tabs-_77MUUQe.js +0 -16
  194. package/dist/ui/assets/upload-C1LT4Gkb.js +0 -16
@@ -0,0 +1,27 @@
1
+ import{c as z,r as i,j as e,a as K,b as Z,u as Q,e as X,P as Y,d as ee,v as se,l as W,B as b,w as te,F as ne,S as re,t as S,m as ae}from"./index-C9dDYIpd.js";import{b as C,d as P,c as k,C as L,a as A}from"./index-C7RfU6hR.js";import{B as D}from"./badge-DGNBtnxU.js";import{G as ie,C as le,g as O,A as I,a as M,b as B}from"./alert-DBAFshSi.js";import{L as R}from"./loader-circle-B7oLyPsi.js";import{C as oe}from"./chevron-down-CFEqYzGC.js";import{P as ce,a as de,D as ue,b as me,c as xe,d as fe,e as he,f as pe}from"./dialog-1dRyI6SC.js";import{D as J,U as je}from"./upload-prIohEdY.js";import{S as ge}from"./square-pen-D_oecB1x.js";import{I as ve}from"./input-BLXaar0X.js";import{L as we}from"./label-DfAcltsl.js";import{C as Ne}from"./circle-alert-BpYUuRs7.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 ye=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],be=z("chevron-right",ye);/**
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 Ce=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Se=z("circle-check-big",Ce);function Pe(s){return s.code?"code":"url"}function Ee(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 ke(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 Oe(s,t=[]){let n=[];function l(d,o){const c=i.createContext(o),m=n.length;n=[...n,o];const x=w=>{var h;const{scope:a,children:g,...f}=w,j=((h=a==null?void 0:a[s])==null?void 0:h[m])||c,u=i.useMemo(()=>f,Object.values(f));return e.jsx(j.Provider,{value:u,children:g})};x.displayName=d+"Provider";function v(w,a){var j;const g=((j=a==null?void 0:a[s])==null?void 0:j[m])||c,f=i.useContext(g);if(f)return f;if(o!==void 0)return o;throw new Error(`\`${w}\` must be used within \`${d}\``)}return[x,v]}const r=()=>{const d=n.map(o=>i.createContext(o));return function(c){const m=(c==null?void 0:c[s])||d;return i.useMemo(()=>({[`__scope${s}`]:{...c,[s]:m}}),[c,m])}};return r.scopeName=s,[l,Le(r,...t)]}function Le(...s){const t=s[0];if(s.length===1)return t;const n=()=>{const l=s.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(d){const o=l.reduce((c,{useScope:m,scopeName:x})=>{const w=m(d)[`__scope${x}`];return{...c,...w}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function De(s){const t=Re(s),n=i.forwardRef((l,r)=>{const{children:d,...o}=l,c=i.Children.toArray(d),m=c.find(Ie);if(m){const x=m.props.children,v=c.map(w=>w===m?i.Children.count(x)>1?i.Children.only(null):i.isValidElement(x)?x.props.children:null:w);return e.jsx(t,{...o,ref:r,children:i.isValidElement(x)?i.cloneElement(x,void 0,v):null})}return e.jsx(t,{...o,ref:r,children:d})});return n.displayName=`${s}.Slot`,n}function Re(s){const t=i.forwardRef((n,l)=>{const{children:r,...d}=n;if(i.isValidElement(r)){const o=$e(r),c=Ae(d,r.props);return r.type!==i.Fragment&&(c.ref=l?K(l,o):o),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${s}.SlotClone`,t}var _e=Symbol("radix.slottable");function Ie(s){return i.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===_e}function Ae(s,t){const n={...t};for(const l in t){const r=s[l],d=t[l];/^on[A-Z]/.test(l)?r&&d?n[l]=(...c)=>{const m=d(...c);return r(...c),m}:r&&(n[l]=r):l==="style"?n[l]={...r,...d}:l==="className"&&(n[l]=[r,d].filter(Boolean).join(" "))}return{...s,...n}}function $e(s){var l,r;let t=(l=Object.getOwnPropertyDescriptor(s.props,"ref"))==null?void 0:l.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 Fe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$=Fe.reduce((s,t)=>{const n=De(`Primitive.${t}`),l=i.forwardRef((r,d)=>{const{asChild:o,...c}=r,m=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(m,{...c,ref:d})});return l.displayName=`Primitive.${t}`,{...s,[t]:l}},{}),_="Collapsible",[Te]=Oe(_),[Ue,F]=Te(_),G=i.forwardRef((s,t)=>{const{__scopeCollapsible:n,open:l,defaultOpen:r,disabled:d,onOpenChange:o,...c}=s,[m,x]=Z({prop:l,defaultProp:r??!1,onChange:o,caller:_});return e.jsx(Ue,{scope:n,disabled:d,contentId:Q(),open:m,onOpenToggle:i.useCallback(()=>x(v=>!v),[x]),children:e.jsx($.div,{"data-state":U(m),"data-disabled":d?"":void 0,...c,ref:t})})});G.displayName=_;var H="CollapsibleTrigger",V=i.forwardRef((s,t)=>{const{__scopeCollapsible:n,...l}=s,r=F(H,n);return e.jsx($.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":U(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...l,ref:t,onClick:X(s.onClick,r.onOpenToggle)})});V.displayName=H;var T="CollapsibleContent",q=i.forwardRef((s,t)=>{const{forceMount:n,...l}=s,r=F(T,s.__scopeCollapsible);return e.jsx(Y,{present:n||r.open,children:({present:d})=>e.jsx(Me,{...l,ref:t,present:d})})});q.displayName=T;var Me=i.forwardRef((s,t)=>{const{__scopeCollapsible:n,present:l,children:r,...d}=s,o=F(T,n),[c,m]=i.useState(l),x=i.useRef(null),v=ee(t,x),w=i.useRef(0),a=w.current,g=i.useRef(0),f=g.current,j=o.open||c,u=i.useRef(j),h=i.useRef(void 0);return i.useEffect(()=>{const p=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(p)},[]),se(()=>{const p=x.current;if(p){h.current=h.current||{transitionDuration:p.style.transitionDuration,animationName:p.style.animationName},p.style.transitionDuration="0s",p.style.animationName="none";const y=p.getBoundingClientRect();w.current=y.height,g.current=y.width,u.current||(p.style.transitionDuration=h.current.transitionDuration,p.style.animationName=h.current.animationName),m(l)}},[o.open,l]),e.jsx($.div,{"data-state":U(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!j,...d,ref:v,style:{"--radix-collapsible-content-height":a?`${a}px`:void 0,"--radix-collapsible-content-width":f?`${f}px`:void 0,...s.style},children:j&&r})});function U(s){return s?"open":"closed"}var Be=G;function ze({...s}){return e.jsx(Be,{"data-slot":"collapsible",...s})}function We({...s}){return e.jsx(V,{"data-slot":"collapsible-trigger",...s})}function Je({...s}){return e.jsx(q,{"data-slot":"collapsible-content",...s})}function Ge({plugin:s}){const[t,n]=i.useState(s.sourceCode),[l,r]=i.useState(s.install?JSON.stringify(s.install,null,2):""),[d,o]=i.useState(s.config?JSON.stringify(s.config,null,2):"");return i.useEffect(()=>{n(s.sourceCode),r(s.install?JSON.stringify(s.install,null,2):""),o(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(I,{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(I,{mode:"json",theme:"monokai",value:l,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(I,{mode:"json",theme:"monokai",value:d,name:`config_${s.id}`,readOnly:!0,width:"100%",fontSize:14,wrapEnabled:!0,showPrintMargin:!1,showGutter:!0,setOptions:{useWorker:!1},minLines:5,maxLines:20,onChange:o})]})]})}function He({plugins:s,onRefresh:t,loading:n=!1}){const[l,r]=i.useState(new Set),[d,o]=i.useState(new Set),c=W(),m=async a=>{const g=a.id;o(u=>new Set(u).add(g));const f=O();let j;a.active?j=await f.deactivatePlugin(g):j=await f.activatePlugin(g),j.status,t==null||t(),o(u=>{const h=new Set(u);return h.delete(g),h})},x=async a=>{if(!confirm("Are you sure you want to delete this plugin?"))return;o(j=>new Set(j).add(a)),(await O().deletePlugin(a)).status,t==null||t(),o(j=>{const u=new Set(j);return u.delete(a),u})},v=a=>{const g={...a,exportedAt:new Date().toISOString()};delete g.process;const f=new Blob([JSON.stringify([g],null,2)],{type:"application/json"}),j=URL.createObjectURL(f),u=document.createElement("a"),h=new Date().toISOString().split("T")[0];u.href=j,u.download=`plugin-${a.id}-${h}.json`,document.body.appendChild(u),u.click(),document.body.removeChild(u),URL.revokeObjectURL(j)},w=a=>{r(g=>{const f=new Set(g);return f.has(a)?f.delete(a):f.add(a),f})};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(R,{className:"h-4 w-4 animate-spin"}),"Loading plugins..."]})})}):s.length===0?e.jsx(C,{children:e.jsxs(k,{children:[e.jsx(L,{children:"No Plugins Found"}),e.jsx(A,{children:"Get started by creating your first plugin."})]})}):e.jsxs(C,{className:"rounded-lg",children:[e.jsxs(k,{children:[e.jsxs(L,{children:["Plugins (",s.length,")"]}),e.jsx(A,{children:"Manage your telemetry plugins."})]}),e.jsx(P,{className:"space-y-4",children:s.map(a=>{const g=l.has(a.id),f=d.has(a.id),j=Pe(a);return e.jsx(ze,{open:g,onOpenChange:()=>w(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(k,{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(We,{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:g?e.jsx(oe,{className:"h-4 w-4"}):e.jsx(be,{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(D,{variant:a.active?"default":"secondary",children:a.active?"Active":"Inactive"}),e.jsx(D,{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(ie,{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(le,{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:()=>m(a),disabled:f,className:"rounded-md h-9 sm:w-9 p-0",title:a.active?"Pause Plugin":"Run Plugin",children:a.active?e.jsx(ce,{className:"h-4 w-4"}):e.jsx(de,{className:"h-4 w-4"})}),f&&e.jsx(R,{className:"h-4 w-4 animate-spin"})]}),e.jsx(b,{variant:"secondary",size:"sm",onClick:()=>v(a),className:"rounded-md h-9 sm:w-9 p-0",title:"Export Plugin",children:e.jsx(J,{className:"h-4 w-4"})}),e.jsx(b,{variant:"secondary",size:"sm",onClick:()=>x(a.id),title:"Delete Plugin",disabled:f,className:"text-destructive hover:text-destructive rounded-md h-9 sm:w-9 p-0",children:e.jsx(te,{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{O().deletePlugin(a.id),c("/plugins/create",{state:{plugin:a}})}catch{}},children:e.jsx(ge,{className:"h-4 w-4"})})]})})]})}),e.jsx(Je,{children:e.jsx(P,{className:"pt-0 rounded-b-lg",children:e.jsx(Ge,{plugin:a})})})]})},a.id)})})]})}function Ve({plugins:s}){const[t,n]=i.useState(!1),l=async()=>{n(!0);try{const r=Ee(s),d=new Blob([r],{type:"application/json"}),o=URL.createObjectURL(d),c=document.createElement("a");c.href=o,c.download=`plugins-export-${new Date().toISOString().split("T")[0]}.json`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(o),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})}finally{n(!1)}};return e.jsxs(b,{variant:"outline",className:"gap-2 bg-transparent",onClick:l,disabled:t||s.length===0,children:[t?e.jsx(R,{className:"h-4 w-4 animate-spin"}):e.jsx(J,{className:"h-4 w-4"}),"Export (",s.length,")"]})}function qe({onPluginsImported:s}){const[t,n]=i.useState(!1),[l,r]=i.useState(!1),[d,o]=i.useState(null),[c,m]=i.useState(null),[x,v]=i.useState(null),w=i.useRef(null),a=()=>{o(null),m(null),v(null),w.current&&(w.current.value="")},g=async u=>{var p;const h=(p=u.target.files)==null?void 0:p[0];if(h){a();try{const y=await h.text(),N=JSON.parse(y);if(!ke(N))throw new Error("Invalid plugin data format");v(N)}catch(y){o(y instanceof Error?y.message:"Failed to parse file")}}},f=async()=>{if(x){r(!0),o(null);try{const u=O(),h=[];for(const N of x)try{const E=await u.createPlugin(N);E.status==="success"?h.push({id:N.id,success:!0}):h.push({id:N.id,success:!1,error:E.message||"Unknown error"})}catch(E){h.push({id:N.id,success:!1,error:E instanceof Error?E.message:"Unknown error"})}const p=h.filter(N=>N.success).length,y=h.length-p;y===0?(m(`Successfully imported ${p} 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 ",p," plugin",p===1?"":"s"," successfully."]})]}))):(m(`Imported ${p} 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 ",p," plugin",p===1?"":"s",", ",y," failed.",h.filter(N=>!N.success).map(N=>`
12
+ ${N.id}: ${N.error}`).join("")]})]}),{duration:1e4})),s==null||s(),setTimeout(()=>{n(!1)},2e3)}catch(u){o(u instanceof Error?u.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:u instanceof Error?u.message:"Import failed"})]}),{duration:1e4})}finally{r(!1)}}},j=u=>{n(u),u||a()};return e.jsxs(ue,{open:t,onOpenChange:j,children:[e.jsx(me,{asChild:!0,children:e.jsxs(b,{variant:"outline",className:"gap-2 bg-transparent",children:[e.jsx(je,{className:"h-4 w-4"}),"Import"]})}),e.jsxs(xe,{className:"max-w-2xl max-h-[90vh]",children:[e.jsxs(fe,{children:[e.jsx(he,{children:"Import Plugins"}),e.jsx(pe,{children:"Upload a JSON file to import plugins in bulk."})]}),e.jsxs("div",{className:"space-y-6",children:[d&&e.jsxs(M,{variant:"destructive",children:[e.jsx(Ne,{className:"h-4 w-4"}),e.jsx(B,{children:d})]}),c&&e.jsxs(M,{children:[e.jsx(Se,{className:"h-4 w-4"}),e.jsx(B,{children:c})]}),!x&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(we,{htmlFor:"plugin-file",children:"Select Plugin File"}),e.jsx(ve,{id:"plugin-file",type:"file",accept:".json",onChange:g,ref:w})]}),e.jsxs(C,{children:[e.jsx(k,{children:e.jsxs(L,{className:"text-base flex items-center gap-2",children:[e.jsx(ne,{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
+ ]`})})})]})]}),x&&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 (",x.length," plugins)"]}),e.jsx(b,{variant:"outline",size:"sm",onClick:a,children:"Choose Different File"})]}),e.jsx(re,{className:"h-64 border rounded-lg",children:e.jsx("div",{className:"p-4 space-y-3",children:x.map((u,h)=>{var p;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:u.id}),e.jsx("div",{className:"text-sm text-muted-foreground",children:u.url?`URL: ${u.url}`:"Code provided"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(D,{variant:"outline",className:"font-mono text-xs",children:u.moduleFormat.toUpperCase()}),((p=u.install)==null?void 0:p.dependencies)&&e.jsxs(D,{variant:"secondary",className:"text-xs",children:[u.install.dependencies.length," deps"]})]})]})})},h)})})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(b,{variant:"outline",onClick:()=>n(!1),disabled:l,children:"Cancel"}),e.jsxs(b,{onClick:f,disabled:l,children:[l&&e.jsx(R,{className:"h-4 w-4 mr-2 animate-spin"}),"Import ",x.length," Plugins"]})]})]})]})]})]})}function ls(){const[s,t]=i.useState(0),[n,l]=i.useState([]),[r,d]=i.useState(!0),o=W();i.useEffect(()=>{c()},[s]);const c=async()=>{d(!0);try{const v=await O().listPlugins();v.status==="success"?l(v.data):(l([]),S.error(e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Error loading Plugins:"})," ",v.message||"Unknown error"]})))}catch{l([]),S.error(e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Error loading Plugins:"}),' "Unknown error"']}))}d(!1)},m=()=>{t(x=>x+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(k,{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(ae,{className:"h-5 w-5"}),"Plugin Management"]}),e.jsx(A,{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:()=>o("/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(qe,{onPluginsImported:m}),e.jsx(Ve,{plugins:n})]})]})})]}),e.jsx(He,{plugins:n,loading:r,onRefresh:m})]})})}export{ls as default};
@@ -0,0 +1,6 @@
1
+ import{c as J,o as b,r as o,j as e,B as E,T as Q,p as V,t as v,q as z,s as W}from"./index-C9dDYIpd.js";import{C as G,a as K}from"./index-C7RfU6hR.js";import{L as F}from"./label-DfAcltsl.js";import{M as R,S as X,C as Y,V as Z}from"./VirtualizedListPanel-q605n9He.js";import{I as U}from"./input-BLXaar0X.js";import{T as ee,a as te,b as q,c as H}from"./select-B8y5IidE.js";import{C as se}from"./CollapsibleCard-lWgfsaAn.js";import{H as ae,p as B,a as ne,b as re}from"./trace-DJq1miYa.js";import{u as oe}from"./utilService-C8TJKLqs.js";import{W as ie}from"./wand-sparkles-OgXuzsSx.js";import{B as O}from"./badge-DGNBtnxU.js";import{C as le}from"./popover-IDker85U.js";import"./separator-B6EzrxYY.js";import"./dialog-1dRyI6SC.js";import"./chevron-down-CFEqYzGC.js";import"./chevron-up-lDnFwAJq.js";import"./upload-prIohEdY.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 ce=[["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M3 12h1",key:"lp3yf2"}],["path",{d:"M3 18h1",key:"1eiwyy"}],["path",{d:"M3 6h1",key:"rgxa97"}],["path",{d:"M8 12h1",key:"1con00"}],["path",{d:"M8 18h1",key:"13wk12"}],["path",{d:"M8 6h1",key:"tn6mkg"}]],de=J("logs",ce);class me{async fetchTraces(){try{return(await b.get("/traces")).data}catch{return null}}async findSpans(t){const{limit:r=50,query:n={}}=t,l={timestamp:-1},d={...n};return Object.prototype.hasOwnProperty.call(d,"attributes.http.method")||(d["attributes.http.method"]={$exists:!0}),{spans:((await b.post("/traces/find",{query:d,limit:r,sort:l})).data.spans||[]).reverse()}}async getStatus(){return{active:!!(await b.get("/traces/status")).data.active}}async startCollection(){await b.post("/traces/start")}async stopCollection(){await b.post("/traces/stop")}async resetTraces(){await b.post("/traces/reset")}async setRetentionTime(t){return{message:(await b.post("/traces/retention-time",{retentionTimeInSeconds:t})).data.message}}async getRetentionTime(){return(await b.get("/traces/retention-time")).data.retentionTimeInSeconds||0}download(){const r=`${b.defaults.baseURL}/traces/export`;window.open(r,"_blank")}async import(t,r){const n=JSON.parse(await t.text()),l=Array.isArray(n)?n:n==null?void 0:n.spans;if(!Array.isArray(l))throw new Error("Invalid JSON format. Expected an array or an object with a spans array.");await b.post(`/traces/import?reset=${r.reset}`,{spans:l})}}const S=new me,pe="normal",ue="advanced",he=({uniqueEndpoints:a,loading:t,onFiltersChange:r,initialTraceId:n=""})=>{const[l,d]=o.useState(n),[p,u]=o.useState("normal"),[w,T]=o.useState([]),[f,g]=o.useState([]),[N,k]=o.useState(""),[I,y]=o.useState(""),[M,_]=o.useState(!1),[L,P]=o.useState([]),[A,m]=o.useState(!1),c=o.useCallback(async()=>{m(!0);try{const s=new Set(a.filter(Boolean));try{const x=await oe.getOpenApiSpec();x!=null&&x.paths&&Object.keys(x.paths).forEach(D=>s.add(D))}catch{}const j=Array.from(s).sort();P(j)}finally{m(!1)}},[a]);o.useEffect(()=>{c()},[c]);const h=()=>{let s={};if(p===ue)try{s=I?JSON.parse(I):{}}catch{v.error("Invalid JSON in advanced query");return}else{if(w.length>0&&(s={...s,"attributes.http.target":{$in:w}}),f.length>0&&(s={...s,"attributes.http.method":{$in:f}}),N.trim().length>0){const j=B(N);if(j.length>0)s={...s,"attributes.http.status_code":{$in:j}};else{v.error("No valid status codes found. Use format: 200, 301, 404");return}}l.trim().length>0&&(s={...s,traceId:l.trim()})}r(s)},i=()=>{T([]),g([]),k(""),y(""),d(""),u(pe),r({})};return o.useEffect(()=>{n&&(d(n),h())},[n]),e.jsx(se,{isOpen:M,onToggle:()=>_(s=>!s),header:e.jsxs(e.Fragment,{children:[e.jsxs(G,{className:"flex items-center gap-2",children:[e.jsx(X,{className:"h-5 w-5"}),"Span Filters"]}),e.jsx(K,{children:"Filter spans by endpoint, HTTP method, or status code."})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ee,{value:p,onValueChange:s=>u(s),children:[e.jsxs(te,{className:"grid w-full grid-cols-2",children:[e.jsx(q,{value:"normal",children:"Normal Filters"}),e.jsx(q,{value:"advanced",children:"Advanced Query"})]}),e.jsx(H,{value:"normal",className:"space-y-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-[160px]",children:[e.jsxs(F,{htmlFor:"endpoint",className:"text-sm",children:["Endpoint / Target",A&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(loading...)"})]}),e.jsx(R,{id:"endpoint",options:L.map(s=>({label:s||"(no target)",value:s})),value:w,onValueChange:T,disabled:t||A})]}),e.jsxs("div",{className:"flex-1 min-w-[160px] flex gap-4 flex-col sm:flex-row",children:[e.jsxs("div",{className:"flex-1 min-w-[160px]",children:[e.jsx(F,{htmlFor:"traceId",className:"text-sm",children:"Trace ID"}),e.jsx(U,{id:"traceId",placeholder:"Filter by Trace ID...",value:l,onChange:s=>d(s.target.value),className:"mt-1",disabled:t})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx(F,{htmlFor:"method",className:"text-sm",children:"HTTP Method"}),e.jsx(R,{id:"method",options:ae.map(s=>({label:s,value:s})),value:f,onValueChange:g,disabled:t})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx(F,{htmlFor:"status",className:"text-sm",children:"Status Codes"}),e.jsx(U,{id:"status",placeholder:"200, 301, 404",value:N,onChange:s=>k(s.target.value),className:"font-mono text-sm",disabled:t,title:"Enter HTTP status codes separated by commas or spaces"}),N&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Will query: ",B(N).join(", ")||"none"]})]})]})]})}),e.jsx(H,{value:"advanced",className:"space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx(F,{htmlFor:"mongo-query",className:"text-sm",children:"Advanced Query (JSON)"}),e.jsxs(E,{type:"button",variant:"outline",onClick:()=>y(JSON.stringify({"attributes.http.method":"GET","attributes.http.status_code":{$gte:400}},null,2)),disabled:t,children:[e.jsx(ie,{className:"h-4 w-4"}),"Load Example"]})]}),e.jsx(Q,{id:"mongo-query",placeholder:'{"attributes.http.method": "GET"}',value:I,onChange:s=>y(s.target.value),className:"min-h-[120px] font-mono text-sm",disabled:t})]})})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs(E,{onClick:h,disabled:t,className:"w-full sm:w-auto",children:[e.jsx(V,{className:`h-4 w-4 mr-2 ${t?"animate-spin":""}`}),"Apply and Update"]}),e.jsx(E,{variant:"outline",onClick:i,className:"w-full sm:w-auto bg-transparent",disabled:t,children:"Clear"})]})]})})},xe=({traceId:a})=>{if(!a)return null;const r=`${z()}/logs?traceId=${encodeURIComponent(a)}`;return e.jsx(E,{variant:"ghost",size:"sm",className:"flex-shrink-0 h-7 w-7 p-0","aria-label":"Show logs for this trace",title:"Show logs for this trace in a new tab",onClick:n=>{n.stopPropagation(),window.open(r,"_blank")},children:e.jsx(de,{className:"h-4 w-4"})})};function fe(a){let t;if(Array.isArray(a)){const[n,l]=a;t=n*1e3+l/1e6}else typeof a=="string"?t=Number(a):t=a;t>1e15&&(t=Math.floor(t/1e6));const r=new Date(t);return isNaN(r.getTime())?"Invalid timestamp":r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function ge(a){let t;if(Array.isArray(a)){const[r,n]=a;t=r*1e3+n/1e6}else t=a;return t<1?`${(t*1e3).toFixed(1)}µs`:t<1e3?`${t.toFixed(2)}ms`:`${(t/1e3).toFixed(2)}s`}function ye(a){navigator.clipboard.writeText(a).then(()=>v.success("Copied to clipboard")).catch(()=>v.error("Failed to copy"))}const Se=({span:a})=>{var f,g;const[t,r]=o.useState(!1),n=(f=a.attributes)==null?void 0:f.http,l=(n==null?void 0:n.method)||"UNKNOWN",d=(n==null?void 0:n.target)||"/",p=(n==null?void 0:n.status_code)||0,u=a.traceId||((g=a._spanContext)==null?void 0:g.traceId)||"",w=a.startTime||a.timestamp||0,T=a._duration||a.duration||0;return e.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:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap text-xs text-muted-foreground font-mono",children:[e.jsx("span",{children:fe(w)}),e.jsx(O,{className:`${ne(l)} border rounded-sm text-[10px]`,children:l.toUpperCase()}),e.jsx(O,{className:`${re(p)} border rounded-sm text-[10px]`,children:p}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:ge(T)}),e.jsxs("span",{className:"flex items-center gap-2 ml-auto",children:[u&&e.jsxs(e.Fragment,{children:[e.jsx(O,{variant:"outline",className:"px-2 py-0.5 text-[10px] cursor-pointer font-mono",onClick:()=>ye(u),title:"Copy Trace ID",children:u.slice(0,8)}),e.jsx(xe,{traceId:u})]}),e.jsx(E,{variant:"ghost",size:"sm",className:"flex-shrink-0 h-7 w-7 p-0","aria-label":"Show raw span data",onClick:()=>r(N=>!N),children:e.jsx(Y,{className:"h-4 w-4"})})]})]}),t&&e.jsx("div",{className:"mt-2 mb-2 bg-muted/30 rounded p-2 font-mono text-xs overflow-x-auto border",children:e.jsx("pre",{className:"whitespace-pre-wrap break-words",children:JSON.stringify(a,null,2)})}),e.jsx("div",{className:"text-sm text-foreground break-words font-mono mt-1",children:d})]})};function we({spans:a,loadOlderSpans:t,loadNewerSpans:r}){return e.jsx(Z,{items:a,itemContent:(n,l)=>e.jsx(Se,{span:l}),title:"Spans History",description:"View and scroll through HTTP spans",emptyMessage:"No spans to display. Please update your filter or try again later.",loadOlderItems:t,loadNewerItems:r,panelName:"SpansListPanel"})}const be=({onTracesReset:a})=>{const t=o.useMemo(()=>({getStatus:()=>S.getStatus(),startCollection:()=>S.startCollection(),stopCollection:()=>S.stopCollection(),resetCollection:()=>S.resetTraces(),setRetentionTime:r=>S.setRetentionTime(r),getRetentionTime:()=>S.getRetentionTime()}),[]);return e.jsx(le,{service:t,resourceType:"traces",onDownload:()=>(S.download(),Promise.resolve()),onImport:(r,n)=>S.import(r,n),onReset:a})},$=30,C=a=>typeof a.timestamp=="number"?a.timestamp:Number(a.timestamp);function qe(){const a=W(),r=new URLSearchParams(a.search).get("traceId")||"",[n,l]=o.useState(!0),[d,p]=o.useState([]),[u,w]=o.useState(null),[T,f]=o.useState(null),[g,N]=o.useState({}),[k,I]=o.useState(!1),y=o.useCallback(async(m={},c=!1)=>{l(!0),N(m),I(c);try{const i=(await S.findSpans({query:m,limit:$})).spans;p(i),i.length>0?(w(C(i[0])),f(C(i[i.length-1]))):c&&i.length===0&&v.info("No spans found")}catch{v.error("Failed to load spans")}finally{l(!1)}},[]),M=o.useCallback(async()=>{if(u)try{const m={...g,timestamp:{$lt:u}},h=(await S.findSpans({query:m,limit:$})).spans.sort((i,s)=>C(i)-C(s));p(i=>{if(i.length===0)return i;const s=new Set(i.map(x=>x._id));return[...h.filter(x=>!s.has(x._id)),...i]}),w(i=>h.length>0?C(h[0]):i)}catch{v.error("Failed to load older spans")}},[u,g,k]),_=o.useCallback(async()=>{if(!T)return y(g,!1);try{const m={...g,timestamp:{$gt:T}},h=(await S.findSpans({query:m,limit:$})).spans.sort((s,j)=>C(s)-C(j));let i=[];p(s=>{const j=new Set(s.map(x=>x._id));return i=h.filter(x=>!j.has(x._id)),[...s,...i]}),i.length>0&&f(C(i[i.length-1]))}catch{v.error("Failed to load newer spans")}},[T,g,y,k]);o.useEffect(()=>{y(r?{"_spanContext.traceId":r}:{},!1)},[y,r]);const L=o.useMemo(()=>Array.from(new Set(d.map(m=>{var c,h;return(h=(c=m.attributes)==null?void 0:c.http)==null?void 0:h.target}))).filter(Boolean),[d]),P=()=>{p([]),w(null),f(null),I(!1),y({},!1)},A=m=>{const c={...m};c.traceId&&(c["_spanContext.traceId"]=c.traceId,delete c.traceId),p([]),w(null),f(null),y(c,!0)};return e.jsx("div",{className:"min-h-screen bg-background",children:e.jsxs("main",{className:"container mx-auto px-4 py-4 md:py-8 space-y-4 md:space-y-6",children:[e.jsx(be,{onTracesReset:P}),e.jsx(he,{uniqueEndpoints:L,loading:n,onFiltersChange:A,initialTraceId:r}),e.jsx(we,{spans:d,loadOlderSpans:M,loadNewerSpans:_})]})})}export{qe as default};
@@ -0,0 +1,16 @@
1
+ import{c as hn,r as S,u as dt,a as bt,j as w,k as Te,B as Ko,X as Xo,H as Yo,J as N,L as Qo}from"./index-C9dDYIpd.js";import{S as En}from"./separator-B6EzrxYY.js";import{B as zn}from"./badge-DGNBtnxU.js";import{P as Jo,a as Zo,b as qo}from"./popover-IDker85U.js";import{R as er,g as tr,O as nr,C as or}from"./dialog-1dRyI6SC.js";import{P as Ye,C as rr,a as lr}from"./index-C7RfU6hR.js";import{C as Hn}from"./chevron-down-CFEqYzGC.js";import{C as Yt}from"./select-B8y5IidE.js";import{W as sr}from"./wand-sparkles-OgXuzsSx.js";import{C as ir}from"./CollapsibleCard-lWgfsaAn.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 ar=[["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"}]],jn=hn("circle-x",ar);/**
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 cr=[["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"}]],Ss=hn("code-xml",cr);/**
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 ur=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],dr=hn("search",ur);var Bn=1,fr=.9,hr=.8,mr=.17,Qt=.1,Jt=.999,pr=.9999,gr=.99,vr=/[\\\/_+.#"@\[\(\{&]/,xr=/[\\\/_+.#"@\[\(\{&]/g,wr=/[\s-]/,oo=/[\s-]/g;function rn(e,t,n,o,r,l,s){if(l===t.length)return r===e.length?Bn:gr;var i=`${r},${l}`;if(s[i]!==void 0)return s[i];for(var a=o.charAt(l),c=n.indexOf(a,r),f=0,p,m,x,R;c>=0;)p=rn(e,t,n,o,c+1,l+1,s),p>f&&(c===r?p*=Bn:vr.test(e.charAt(c-1))?(p*=hr,x=e.slice(r,c-1).match(xr),x&&r>0&&(p*=Math.pow(Jt,x.length))):wr.test(e.charAt(c-1))?(p*=fr,R=e.slice(r,c-1).match(oo),R&&r>0&&(p*=Math.pow(Jt,R.length))):(p*=mr,r>0&&(p*=Math.pow(Jt,c-r))),e.charAt(c)!==t.charAt(l)&&(p*=pr)),(p<Qt&&n.charAt(c-1)===o.charAt(l+1)||o.charAt(l+1)===o.charAt(l)&&n.charAt(c-1)!==o.charAt(l))&&(m=rn(e,t,n,o,c+1,l+2,s),m*Qt>p&&(p=m*Qt)),p>f&&(f=p),c=n.indexOf(a,c+1);return s[i]=f,f}function Mn(e){return e.toLowerCase().replace(oo," ")}function Ir(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,rn(e,t,Mn(e),Mn(t),0,0,{})}var vt='[cmdk-group=""]',Zt='[cmdk-group-items=""]',br='[cmdk-group-heading=""]',ro='[cmdk-item=""]',On=`${ro}:not([aria-disabled="true"])`,ln="cmdk-item-select",ct="data-value",Tr=(e,t,n)=>Ir(e,t,n),lo=S.createContext(void 0),zt=()=>S.useContext(lo),so=S.createContext(void 0),mn=()=>S.useContext(so),io=S.createContext(void 0),ao=S.forwardRef((e,t)=>{let n=ut(()=>{var y,P;return{search:"",value:(P=(y=e.value)!=null?y:e.defaultValue)!=null?P:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),o=ut(()=>new Set),r=ut(()=>new Map),l=ut(()=>new Map),s=ut(()=>new Set),i=co(e),{label:a,children:c,value:f,onValueChange:p,filter:m,shouldFilter:x,loop:R,disablePointerSelection:M=!1,vimBindings:g=!0,...d}=e,h=dt(),C=dt(),j=dt(),k=S.useRef(null),B=Mr();nt(()=>{if(f!==void 0){let y=f.trim();n.current.value=y,u.emit()}},[f]),nt(()=>{B(6,G)},[]);let u=S.useMemo(()=>({subscribe:y=>(s.current.add(y),()=>s.current.delete(y)),snapshot:()=>n.current,setState:(y,P,X)=>{var A,Q,le,E;if(!Object.is(n.current[y],P)){if(n.current[y]=P,y==="search")F(),O(),B(1,H);else if(y==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let _=document.getElementById(j);_?_.focus():(A=document.getElementById(h))==null||A.focus()}if(B(7,()=>{var _;n.current.selectedItemId=(_=V())==null?void 0:_.id,u.emit()}),X||B(5,G),((Q=i.current)==null?void 0:Q.value)!==void 0){let _=P??"";(E=(le=i.current).onValueChange)==null||E.call(le,_);return}}u.emit()}},emit:()=>{s.current.forEach(y=>y())}}),[]),I=S.useMemo(()=>({value:(y,P,X)=>{var A;P!==((A=l.current.get(y))==null?void 0:A.value)&&(l.current.set(y,{value:P,keywords:X}),n.current.filtered.items.set(y,v(P,X)),B(2,()=>{O(),u.emit()}))},item:(y,P)=>(o.current.add(y),P&&(r.current.has(P)?r.current.get(P).add(y):r.current.set(P,new Set([y]))),B(3,()=>{F(),O(),n.current.value||H(),u.emit()}),()=>{l.current.delete(y),o.current.delete(y),n.current.filtered.items.delete(y);let X=V();B(4,()=>{F(),(X==null?void 0:X.getAttribute("id"))===y&&H(),u.emit()})}),group:y=>(r.current.has(y)||r.current.set(y,new Set),()=>{l.current.delete(y),r.current.delete(y)}),filter:()=>i.current.shouldFilter,label:a||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:h,inputId:j,labelId:C,listInnerRef:k}),[]);function v(y,P){var X,A;let Q=(A=(X=i.current)==null?void 0:X.filter)!=null?A:Tr;return y?Q(y,n.current.search,P):0}function O(){if(!n.current.search||i.current.shouldFilter===!1)return;let y=n.current.filtered.items,P=[];n.current.filtered.groups.forEach(A=>{let Q=r.current.get(A),le=0;Q.forEach(E=>{let _=y.get(E);le=Math.max(_,le)}),P.push([A,le])});let X=k.current;D().sort((A,Q)=>{var le,E;let _=A.getAttribute("id"),ie=Q.getAttribute("id");return((le=y.get(ie))!=null?le:0)-((E=y.get(_))!=null?E:0)}).forEach(A=>{let Q=A.closest(Zt);Q?Q.appendChild(A.parentElement===Q?A:A.closest(`${Zt} > *`)):X.appendChild(A.parentElement===X?A:A.closest(`${Zt} > *`))}),P.sort((A,Q)=>Q[1]-A[1]).forEach(A=>{var Q;let le=(Q=k.current)==null?void 0:Q.querySelector(`${vt}[${ct}="${encodeURIComponent(A[0])}"]`);le==null||le.parentElement.appendChild(le)})}function H(){let y=D().find(X=>X.getAttribute("aria-disabled")!=="true"),P=y==null?void 0:y.getAttribute(ct);u.setState("value",P||void 0)}function F(){var y,P,X,A;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=o.current.size;return}n.current.filtered.groups=new Set;let Q=0;for(let le of o.current){let E=(P=(y=l.current.get(le))==null?void 0:y.value)!=null?P:"",_=(A=(X=l.current.get(le))==null?void 0:X.keywords)!=null?A:[],ie=v(E,_);n.current.filtered.items.set(le,ie),ie>0&&Q++}for(let[le,E]of r.current)for(let _ of E)if(n.current.filtered.items.get(_)>0){n.current.filtered.groups.add(le);break}n.current.filtered.count=Q}function G(){var y,P,X;let A=V();A&&(((y=A.parentElement)==null?void 0:y.firstChild)===A&&((X=(P=A.closest(vt))==null?void 0:P.querySelector(br))==null||X.scrollIntoView({block:"nearest"})),A.scrollIntoView({block:"nearest"}))}function V(){var y;return(y=k.current)==null?void 0:y.querySelector(`${ro}[aria-selected="true"]`)}function D(){var y;return Array.from(((y=k.current)==null?void 0:y.querySelectorAll(On))||[])}function q(y){let P=D()[y];P&&u.setState("value",P.getAttribute(ct))}function ee(y){var P;let X=V(),A=D(),Q=A.findIndex(E=>E===X),le=A[Q+y];(P=i.current)!=null&&P.loop&&(le=Q+y<0?A[A.length-1]:Q+y===A.length?A[0]:A[Q+y]),le&&u.setState("value",le.getAttribute(ct))}function pe(y){let P=V(),X=P==null?void 0:P.closest(vt),A;for(;X&&!A;)X=y>0?jr(X,vt):Br(X,vt),A=X==null?void 0:X.querySelector(On);A?u.setState("value",A.getAttribute(ct)):ee(y)}let Ee=()=>q(D().length-1),ye=y=>{y.preventDefault(),y.metaKey?Ee():y.altKey?pe(1):ee(1)},Se=y=>{y.preventDefault(),y.metaKey?q(0):y.altKey?pe(-1):ee(-1)};return S.createElement(Ye.div,{ref:t,tabIndex:-1,...d,"cmdk-root":"",onKeyDown:y=>{var P;(P=d.onKeyDown)==null||P.call(d,y);let X=y.nativeEvent.isComposing||y.keyCode===229;if(!(y.defaultPrevented||X))switch(y.key){case"n":case"j":{g&&y.ctrlKey&&ye(y);break}case"ArrowDown":{ye(y);break}case"p":case"k":{g&&y.ctrlKey&&Se(y);break}case"ArrowUp":{Se(y);break}case"Home":{y.preventDefault(),q(0);break}case"End":{y.preventDefault(),Ee();break}case"Enter":{y.preventDefault();let A=V();if(A){let Q=new Event(ln);A.dispatchEvent(Q)}}}}},S.createElement("label",{"cmdk-label":"",htmlFor:I.inputId,id:I.labelId,style:$r},a),Ft(e,y=>S.createElement(so.Provider,{value:u},S.createElement(lo.Provider,{value:I},y))))}),yr=S.forwardRef((e,t)=>{var n,o;let r=dt(),l=S.useRef(null),s=S.useContext(io),i=zt(),a=co(e),c=(o=(n=a.current)==null?void 0:n.forceMount)!=null?o:s==null?void 0:s.forceMount;nt(()=>{if(!c)return i.item(r,s==null?void 0:s.id)},[c]);let f=uo(r,l,[e.value,e.children,l],e.keywords),p=mn(),m=Ke(B=>B.value&&B.value===f.current),x=Ke(B=>c||i.filter()===!1?!0:B.search?B.filtered.items.get(r)>0:!0);S.useEffect(()=>{let B=l.current;if(!(!B||e.disabled))return B.addEventListener(ln,R),()=>B.removeEventListener(ln,R)},[x,e.onSelect,e.disabled]);function R(){var B,u;M(),(u=(B=a.current).onSelect)==null||u.call(B,f.current)}function M(){p.setState("value",f.current,!0)}if(!x)return null;let{disabled:g,value:d,onSelect:h,forceMount:C,keywords:j,...k}=e;return S.createElement(Ye.div,{ref:bt(l,t),...k,id:r,"cmdk-item":"",role:"option","aria-disabled":!!g,"aria-selected":!!m,"data-disabled":!!g,"data-selected":!!m,onPointerMove:g||i.getDisablePointerSelection()?void 0:M,onClick:g?void 0:R},e.children)}),Sr=S.forwardRef((e,t)=>{let{heading:n,children:o,forceMount:r,...l}=e,s=dt(),i=S.useRef(null),a=S.useRef(null),c=dt(),f=zt(),p=Ke(x=>r||f.filter()===!1?!0:x.search?x.filtered.groups.has(s):!0);nt(()=>f.group(s),[]),uo(s,i,[e.value,e.heading,a]);let m=S.useMemo(()=>({id:s,forceMount:r}),[r]);return S.createElement(Ye.div,{ref:bt(i,t),...l,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},n&&S.createElement("div",{ref:a,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),Ft(e,x=>S.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},S.createElement(io.Provider,{value:m},x))))}),Cr=S.forwardRef((e,t)=>{let{alwaysRender:n,...o}=e,r=S.useRef(null),l=Ke(s=>!s.search);return!n&&!l?null:S.createElement(Ye.div,{ref:bt(r,t),...o,"cmdk-separator":"",role:"separator"})}),Rr=S.forwardRef((e,t)=>{let{onValueChange:n,...o}=e,r=e.value!=null,l=mn(),s=Ke(c=>c.search),i=Ke(c=>c.selectedItemId),a=zt();return S.useEffect(()=>{e.value!=null&&l.setState("search",e.value)},[e.value]),S.createElement(Ye.input,{ref:t,...o,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":a.listId,"aria-labelledby":a.labelId,"aria-activedescendant":i,id:a.inputId,type:"text",value:r?e.value:s,onChange:c=>{r||l.setState("search",c.target.value),n==null||n(c.target.value)}})}),kr=S.forwardRef((e,t)=>{let{children:n,label:o="Suggestions",...r}=e,l=S.useRef(null),s=S.useRef(null),i=Ke(c=>c.selectedItemId),a=zt();return S.useEffect(()=>{if(s.current&&l.current){let c=s.current,f=l.current,p,m=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let x=c.offsetHeight;f.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return m.observe(c),()=>{cancelAnimationFrame(p),m.unobserve(c)}}},[]),S.createElement(Ye.div,{ref:bt(l,t),...r,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":o,id:a.listId},Ft(e,c=>S.createElement("div",{ref:bt(s,a.listInnerRef),"cmdk-list-sizer":""},c)))}),Er=S.forwardRef((e,t)=>{let{open:n,onOpenChange:o,overlayClassName:r,contentClassName:l,container:s,...i}=e;return S.createElement(er,{open:n,onOpenChange:o},S.createElement(tr,{container:s},S.createElement(nr,{"cmdk-overlay":"",className:r}),S.createElement(or,{"aria-label":e.label,"cmdk-dialog":"",className:l},S.createElement(ao,{ref:t,...i}))))}),zr=S.forwardRef((e,t)=>Ke(n=>n.filtered.count===0)?S.createElement(Ye.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Hr=S.forwardRef((e,t)=>{let{progress:n,children:o,label:r="Loading...",...l}=e;return S.createElement(Ye.div,{ref:t,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":r},Ft(e,s=>S.createElement("div",{"aria-hidden":!0},s)))}),rt=Object.assign(ao,{List:kr,Item:yr,Input:Rr,Group:Sr,Separator:Cr,Dialog:Er,Empty:zr,Loading:Hr});function jr(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Br(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function co(e){let t=S.useRef(e);return nt(()=>{t.current=e}),t}var nt=typeof window>"u"?S.useEffect:S.useLayoutEffect;function ut(e){let t=S.useRef();return t.current===void 0&&(t.current=e()),t}function Ke(e){let t=mn(),n=()=>e(t.snapshot());return S.useSyncExternalStore(t.subscribe,n,n)}function uo(e,t,n,o=[]){let r=S.useRef(),l=zt();return nt(()=>{var s;let i=(()=>{var c;for(let f of n){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(c=f.current.textContent)==null?void 0:c.trim():r.current}})(),a=o.map(c=>c.trim());l.value(e,i,a),(s=t.current)==null||s.setAttribute(ct,i),r.current=i}),r}var Mr=()=>{let[e,t]=S.useState(),n=ut(()=>new Map);return nt(()=>{n.current.forEach(o=>o()),n.current=new Map},[e]),(o,r)=>{n.current.set(o,r),t({})}};function Or(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Ft({asChild:e,children:t},n){return e&&S.isValidElement(t)?S.cloneElement(Or(t),{ref:t.ref},n(t.props.children)):n(t)}var $r={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Lr({className:e,...t}){return w.jsx(rt,{"data-slot":"command",className:Te("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function Ar({className:e,...t}){return w.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[w.jsx(dr,{className:"size-4 shrink-0 opacity-50"}),w.jsx(rt.Input,{"data-slot":"command-input",className:Te("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 Pr({className:e,...t}){return w.jsx(rt.List,{"data-slot":"command-list",className:Te("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function Nr({...e}){return w.jsx(rt.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function Lt({className:e,...t}){return w.jsx(rt.Group,{"data-slot":"command-group",className:Te("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 Wr({className:e,...t}){return w.jsx(rt.Separator,{"data-slot":"command-separator",className:Te("bg-border -mx-1 h-px",e),...t})}function xt({className:e,...t}){return w.jsx(rt.Item,{"data-slot":"command-item",className:Te("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 $n=Yo("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"}}),Dr=S.forwardRef(({options:e,onValueChange:t,variant:n,defaultValue:o=[],placeholder:r="Select options",animation:l=0,animationConfig:s,maxCount:i=3,modalPopover:a=!1,className:c,hideSelectAll:f=!1,searchable:p=!0,emptyIndicator:m,autoSize:x=!1,singleLine:R=!1,popoverClassName:M,disabled:g=!1,responsive:d,minWidth:h,maxWidth:C,deduplicateOptions:j=!1,resetOnDefaultValueChange:k=!0,closeOnSelect:B=!1,...u},I)=>{const[v,O]=S.useState(o),[H,F]=S.useState(!1),[G,V]=S.useState(!1),[D,q]=S.useState(""),[ee,pe]=S.useState(""),[Ee,ye]=S.useState(""),Se=S.useRef(v.length),y=S.useRef(H),P=S.useRef(D),X=S.useCallback((b,L="polite")=>{L==="assertive"?(ye(b),setTimeout(()=>ye(""),100)):(pe(b),setTimeout(()=>pe(""),100))},[]),A=S.useId(),Q=`${A}-listbox`,le=`${A}-description`,E=`${A}-count`,_=S.useRef(o),ie=S.useCallback(b=>b.length>0&&"heading"in b[0],[]),de=S.useCallback((b,L)=>{if(b.length!==L.length)return!1;const re=[...b].sort(),te=[...L].sort();return re.every((Be,Ae)=>Be===te[Ae])},[]),me=S.useCallback(()=>{O(o),F(!1),q(""),t(o)},[o,t]),ae=S.useRef(null);S.useImperativeHandle(I,()=>({reset:me,getSelectedValues:()=>v,setSelectedValues:b=>{O(b),t(b)},clear:()=>{O([]),t([])},focus:()=>{if(ae.current){ae.current.focus();const b=ae.current.style.outline,L=ae.current.style.outlineOffset;ae.current.style.outline="2px solid hsl(var(--ring))",ae.current.style.outlineOffset="2px",setTimeout(()=>{ae.current&&(ae.current.style.outline=b,ae.current.style.outlineOffset=L)},1e3)}}}),[me,v,t]);const[oe,ce]=S.useState("desktop");S.useEffect(()=>{if(typeof window>"u")return;const b=()=>{const L=window.innerWidth;L<640?ce("mobile"):L<1024?ce("tablet"):ce("desktop")};return b(),window.addEventListener("resize",b),()=>{typeof window<"u"&&window.removeEventListener("resize",b)}},[]);const fe=(()=>{if(!d)return{maxCount:i,hideIcons:!1,compactMode:!1};if(d===!0){const re={mobile:{maxCount:2,hideIcons:!1,compactMode:!0},tablet:{maxCount:4,hideIcons:!1,compactMode:!1},desktop:{maxCount:6,hideIcons:!1,compactMode:!1}}[oe];return{maxCount:(re==null?void 0:re.maxCount)??i,hideIcons:(re==null?void 0:re.hideIcons)??!1,compactMode:(re==null?void 0:re.compactMode)??!1}}const b=d[oe];return{maxCount:(b==null?void 0:b.maxCount)??i,hideIcons:(b==null?void 0:b.hideIcons)??!1,compactMode:(b==null?void 0:b.compactMode)??!1}})(),we=()=>{if(s!=null&&s.badgeAnimation)switch(s.badgeAnimation){case"bounce":return G?"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 G?"animate-bounce":""},qe=()=>{if(s!=null&&s.popoverAnimation)switch(s.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""},ze=S.useCallback(()=>{if(e.length===0)return[];let b;ie(e)?b=e.flatMap(Be=>Be.options):b=e;const L=new Set,re=[],te=[];return b.forEach(Be=>{L.has(Be.value)?(re.push(Be.value),j||te.push(Be)):(L.add(Be.value),te.push(Be))}),j?te:b},[e,j,ie]),et=S.useCallback(b=>ze().find(re=>re.value===b),[ze]),it=S.useMemo(()=>!p||!D?e:e.length===0?[]:ie(e)?e.map(b=>({...b,options:b.options.filter(L=>L.label.toLowerCase().includes(D.toLowerCase())||L.value.toLowerCase().includes(D.toLowerCase()))})).filter(b=>b.options.length>0):e.filter(b=>b.label.toLowerCase().includes(D.toLowerCase())||b.value.toLowerCase().includes(D.toLowerCase())),[e,D,p,ie]),at=b=>{if(b.key==="Enter")F(!0);else if(b.key==="Backspace"&&!b.currentTarget.value){const L=[...v];L.pop(),O(L),t(L)}},We=b=>{if(g)return;const L=et(b);if(L!=null&&L.disabled)return;const re=v.includes(b)?v.filter(te=>te!==b):[...v,b];O(re),t(re),B&&F(!1)},Le=()=>{g||(O([]),t([]))},Mt=()=>{g||F(b=>!b)},Ot=()=>{if(g)return;const b=v.slice(0,fe.maxCount);O(b),t(b)},$t=()=>{if(g)return;const b=ze().filter(L=>!L.disabled);if(v.length===b.length)Le();else{const L=b.map(re=>re.value);O(L),t(L)}B&&F(!1)};S.useEffect(()=>{if(!k)return;const b=_.current;de(b,o)||(de(v,o)||O(o),_.current=[...o])},[o,v,de,k]);const gt={minWidth:h||(oe==="mobile"?"0px":"200px"),maxWidth:C||"100%",width:x?"auto":"100%"};return S.useEffect(()=>{H||q("")},[H]),S.useEffect(()=>{const b=v.length,L=ze(),re=L.filter(te=>!te.disabled).length;if(b!==Se.current){const te=b-Se.current;if(te>0){const Ae=v.slice(-te).map(_o=>{var kn;return(kn=L.find(Uo=>Uo.value===_o))==null?void 0:kn.label}).filter(Boolean);Ae.length===1?X(`${Ae[0]} selected. ${b} of ${re} options selected.`):X(`${Ae.length} options selected. ${b} of ${re} total selected.`)}else te<0&&X(`Option removed. ${b} of ${re} options selected.`);Se.current=b}if(H!==y.current&&(X(H?`Dropdown opened. ${re} options available. Use arrow keys to navigate.`:"Dropdown closed."),y.current=H),D!==P.current&&D!==void 0){if(D&&H){const te=L.filter(Be=>Be.label.toLowerCase().includes(D.toLowerCase())||Be.value.toLowerCase().includes(D.toLowerCase())).length;X(`${te} option${te===1?"":"s"} found for "${D}"`)}P.current=D}},[v,H,D,X,ze]),w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"sr-only",children:[w.jsx("div",{"aria-live":"polite","aria-atomic":"true",role:"status",children:ee}),w.jsx("div",{"aria-live":"assertive","aria-atomic":"true",role:"alert",children:Ee})]}),w.jsxs(Jo,{open:H,onOpenChange:F,modal:a,children:[w.jsx("div",{id:le,className:"sr-only",children:"Multi-select dropdown. Use arrow keys to navigate, Enter to select, and Escape to close."}),w.jsx("div",{id:E,className:"sr-only","aria-live":"polite",children:v.length===0?"No options selected":`${v.length} option${v.length===1?"":"s"} selected: ${v.map(b=>{var L;return(L=et(b))==null?void 0:L.label}).filter(Boolean).join(", ")}`}),w.jsx(Zo,{asChild:!0,children:w.jsx(Ko,{ref:ae,...u,onClick:Mt,disabled:g,role:"combobox","aria-expanded":H,"aria-haspopup":"listbox","aria-controls":H?Q:void 0,"aria-describedby":`${le} ${E}`,"aria-label":`Multi-select: ${v.length} of ${ze().length} options selected. ${r}`,className:Te("flex p-1 rounded-md border min-h-10 h-auto items-center justify-between bg-inherit hover:bg-inherit [&_svg]:pointer-events-auto",x?"w-auto":"w-full",fe.compactMode&&"min-h-8 text-sm",oe==="mobile"&&"min-h-12 text-base",g&&"opacity-50 cursor-not-allowed",c),style:{...gt,maxWidth:`min(${gt.maxWidth}, 100%)`},children:v.length>0?w.jsxs("div",{className:"flex justify-between items-center w-full",children:[w.jsxs("div",{className:Te("flex items-center gap-1",R?"overflow-x-auto multiselect-singleline-scroll":"flex-wrap",fe.compactMode&&"gap-0.5"),style:R?{paddingBottom:"4px"}:{},children:[v.slice(0,fe.maxCount).map(b=>{const L=et(b),re=L==null?void 0:L.icon,te=L==null?void 0:L.style;if(!L)return null;const Be={animationDuration:`${l}s`,...(te==null?void 0:te.badgeColor)&&{backgroundColor:te.badgeColor},...(te==null?void 0:te.gradient)&&{background:te.gradient,color:"white"}};return w.jsxs(zn,{className:Te(we(),$n({variant:n}),(te==null?void 0:te.gradient)&&"text-white border-transparent",fe.compactMode&&"text-xs px-1.5 py-0.5",oe==="mobile"&&"max-w-[120px] truncate",R&&"flex-shrink-0 whitespace-nowrap","[&>svg]:pointer-events-auto"),style:{...Be,animationDuration:`${(s==null?void 0:s.duration)||l}s`,animationDelay:`${(s==null?void 0:s.delay)||0}s`},children:[re&&!fe.hideIcons&&w.jsx(re,{className:Te("h-4 w-4 mr-2",fe.compactMode&&"h-3 w-3 mr-1",(te==null?void 0:te.iconColor)&&"text-current"),...(te==null?void 0:te.iconColor)&&{style:{color:te.iconColor}}}),w.jsx("span",{className:Te(oe==="mobile"&&"truncate"),children:L.label}),w.jsx("div",{role:"button",tabIndex:0,onClick:Ae=>{Ae.stopPropagation(),We(b)},onKeyDown:Ae=>{(Ae.key==="Enter"||Ae.key===" ")&&(Ae.preventDefault(),Ae.stopPropagation(),We(b))},"aria-label":`Remove ${L.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:w.jsx(jn,{className:Te("h-3 w-3",fe.compactMode&&"h-2.5 w-2.5")})})]},b)}).filter(Boolean),v.length>fe.maxCount&&w.jsxs(zn,{className:Te("bg-transparent text-foreground border-foreground/1 hover:bg-transparent",we(),$n({variant:n}),fe.compactMode&&"text-xs px-1.5 py-0.5",R&&"flex-shrink-0 whitespace-nowrap","[&>svg]:pointer-events-auto"),style:{animationDuration:`${(s==null?void 0:s.duration)||l}s`,animationDelay:`${(s==null?void 0:s.delay)||0}s`},children:[`+ ${v.length-fe.maxCount} more`,w.jsx(jn,{className:Te("ml-2 h-4 w-4 cursor-pointer",fe.compactMode&&"ml-1 h-3 w-3"),onClick:b=>{b.stopPropagation(),Ot()}})]})]}),w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsx("div",{role:"button",tabIndex:0,onClick:b=>{b.stopPropagation(),Le()},onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),b.stopPropagation(),Le())},"aria-label":`Clear all ${v.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:w.jsx(Xo,{className:"h-4 w-4"})}),w.jsx(En,{orientation:"vertical",className:"flex min-h-6 h-full"}),w.jsx(Hn,{className:"h-4 mx-2 cursor-pointer text-muted-foreground","aria-hidden":"true"})]})]}):w.jsxs("div",{className:"flex items-center justify-between w-full mx-auto",children:[w.jsx("span",{className:"text-sm text-muted-foreground mx-3",children:r}),w.jsx(Hn,{className:"h-4 cursor-pointer text-muted-foreground mx-2"})]})})}),w.jsx(qo,{id:Q,role:"listbox","aria-multiselectable":"true","aria-label":"Available options",className:Te("w-auto p-0",qe(),oe==="mobile"&&"w-[85vw] max-w-[280px]",oe==="tablet"&&"w-[70vw] max-w-md",oe==="desktop"&&"min-w-[300px]",M),style:{animationDuration:`${(s==null?void 0:s.duration)||l}s`,animationDelay:`${(s==null?void 0:s.delay)||0}s`,maxWidth:`min(${gt.maxWidth}, 85vw)`,maxHeight:oe==="mobile"?"70vh":"60vh",touchAction:"manipulation"},align:"start",onEscapeKeyDown:()=>F(!1),children:w.jsxs(Lr,{children:[p&&w.jsx(Ar,{placeholder:"Search options...",onKeyDown:at,value:D,onValueChange:q,"aria-label":"Search through available options","aria-describedby":`${A}-search-help`}),p&&w.jsx("div",{id:`${A}-search-help`,className:"sr-only",children:"Type to filter options. Use arrow keys to navigate results."}),w.jsxs(Pr,{className:Te("max-h-[40vh] overflow-y-auto multiselect-scrollbar",oe==="mobile"&&"max-h-[50vh]","overscroll-behavior-y-contain"),children:[w.jsx(Nr,{children:m||"No results found."})," ",!f&&!D&&w.jsx(Lt,{children:w.jsxs(xt,{onSelect:$t,role:"option","aria-selected":v.length===ze().filter(b=>!b.disabled).length,"aria-label":`Select all ${ze().length} options`,className:"cursor-pointer",children:[w.jsx("div",{className:Te("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",v.length===ze().filter(b=>!b.disabled).length?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),"aria-hidden":"true",children:w.jsx(Yt,{className:"h-4 w-4"})}),w.jsxs("span",{children:["(Select All",ze().length>20?` - ${ze().length} options`:"",")"]})]},"all")}),ie(it)?it.map(b=>w.jsx(Lt,{heading:b.heading,children:b.options.map(L=>{const re=v.includes(L.value);return w.jsxs(xt,{onSelect:()=>We(L.value),role:"option","aria-selected":re,"aria-disabled":L.disabled,"aria-label":`${L.label}${re?", selected":", not selected"}${L.disabled?", disabled":""}`,className:Te("cursor-pointer",L.disabled&&"opacity-50 cursor-not-allowed"),disabled:L.disabled,children:[w.jsx("div",{className:Te("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",re?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),"aria-hidden":"true",children:w.jsx(Yt,{className:"h-4 w-4"})}),L.icon&&w.jsx(L.icon,{className:"mr-2 h-4 w-4 text-muted-foreground","aria-hidden":"true"}),w.jsx("span",{children:L.label})]},L.value)})},b.heading)):w.jsx(Lt,{children:it.map(b=>{const L=v.includes(b.value);return w.jsxs(xt,{onSelect:()=>We(b.value),role:"option","aria-selected":L,"aria-disabled":b.disabled,"aria-label":`${b.label}${L?", selected":", not selected"}${b.disabled?", disabled":""}`,className:Te("cursor-pointer",b.disabled&&"opacity-50 cursor-not-allowed"),disabled:b.disabled,children:[w.jsx("div",{className:Te("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",L?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),"aria-hidden":"true",children:w.jsx(Yt,{className:"h-4 w-4"})}),b.icon&&w.jsx(b.icon,{className:"mr-2 h-4 w-4 text-muted-foreground","aria-hidden":"true"}),w.jsx("span",{children:b.label})]},b.value)})}),w.jsx(Wr,{}),w.jsx(Lt,{children:w.jsxs("div",{className:"flex items-center justify-between",children:[v.length>0&&w.jsxs(w.Fragment,{children:[w.jsx(xt,{onSelect:Le,className:"flex-1 justify-center cursor-pointer",children:"Clear"}),w.jsx(En,{orientation:"vertical",className:"flex min-h-6 h-full"})]}),w.jsx(xt,{onSelect:()=>F(!1),className:"flex-1 justify-center cursor-pointer max-w-full",children:"Close"})]})})]})]})}),l>0&&v.length>0&&w.jsx(sr,{className:Te("cursor-pointer my-2 text-foreground bg-background w-3 h-3",G?"":"text-muted-foreground"),onClick:()=>V(!G)})]})]})});Dr.displayName="MultiSelect";const Gt=0,Qe=1,mt=2,fo=4;function Ln(e){return()=>e}function Vr(e){e()}function ho(e,t){return n=>e(t(n))}function An(e,t){return()=>e(t)}function Fr(e,t){return n=>e(t,n)}function pn(e){return e!==void 0}function Gr(...e){return()=>{e.map(Vr)}}function pt(){}function _t(e,t){return t(e),e}function _r(e,t){return t(e)}function ve(...e){return e}function ue(e,t){return e(Qe,t)}function J(e,t){e(Gt,t)}function gn(e){e(mt)}function be(e){return e(fo)}function W(e,t){return ue(e,Fr(t,Gt))}function De(e,t){const n=e(Qe,o=>{n(),t(o)});return n}function Pn(e){let t,n;return o=>r=>{t=r,n&&clearTimeout(n),n=setTimeout(()=>{o(t)},e)}}function mo(e,t){return e===t}function ge(e=mo){let t;return n=>o=>{e(t,o)||(t=o,n(o))}}function K(e){return t=>n=>{e(n)&&t(n)}}function $(e){return t=>ho(t,e)}function Fe(e){return t=>()=>{t(e)}}function T(e,...t){const n=Ur(...t);return((o,r)=>{switch(o){case mt:gn(e);return;case Qe:return ue(e,n(r))}})}function Ge(e,t){return n=>o=>{n(t=e(t,o))}}function ot(e){return t=>n=>{e>0?e--:t(n)}}function Ue(e){let t=null,n;return o=>r=>{t=r,!n&&(n=setTimeout(()=>{n=void 0,o(t)},e))}}function Z(...e){const t=new Array(e.length);let n=0,o=null;const r=2**e.length-1;return e.forEach((l,s)=>{const i=2**s;ue(l,a=>{const c=n;n|=i,t[s]=a,c!==r&&n===r&&o&&(o(),o=null)})}),l=>s=>{const i=()=>{l([s].concat(t))};n===r?i():o=i}}function Ur(...e){return t=>e.reduceRight(_r,t)}function Kr(e){let t,n;const o=()=>t==null?void 0:t();return function(r,l){switch(r){case Qe:return l?n===l?void 0:(o(),n=l,t=ue(e,l),t):(o(),pt);case mt:o(),n=null;return}}}function z(e){let t=e;const n=ne();return((o,r)=>{switch(o){case Gt:t=r;break;case Qe:{r(t);break}case fo:return t}return n(o,r)})}function je(e,t){return _t(z(t),n=>W(e,n))}function ne(){const e=[];return((t,n)=>{switch(t){case Gt:e.slice().forEach(o=>{o(n)});return;case mt:e.splice(0,e.length);return;case Qe:return e.push(n),()=>{const o=e.indexOf(n);o>-1&&e.splice(o,1)}}})}function $e(e){return _t(ne(),t=>W(e,t))}function se(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:Xr(),singleton:n}}const Xr=()=>Symbol();function Yr(e){const t=new Map,n=({constructor:o,dependencies:r,id:l,singleton:s})=>{if(s&&t.has(l))return t.get(l);const i=o(r.map(a=>n(a)));return s&&t.set(l,i),i};return n(e)}function Ce(...e){const t=ne(),n=new Array(e.length);let o=0;const r=2**e.length-1;return e.forEach((l,s)=>{const i=2**s;ue(l,a=>{n[s]=a,o|=i,o===r&&J(t,n)})}),function(l,s){switch(l){case mt:{gn(t);return}case Qe:return o===r&&s(n),ue(t,s)}}}function U(e,t=mo){return T(e,ge(t))}function sn(...e){return function(t,n){switch(t){case mt:return;case Qe:return Gr(...e.map(o=>ue(o,n)))}}}const ke={DEBUG:0,INFO:1,WARN:2,ERROR:3},Qr={[ke.DEBUG]:"debug",[ke.ERROR]:"error",[ke.INFO]:"log",[ke.WARN]:"warn"},Jr=()=>typeof globalThis>"u"?window:globalThis,Je=se(()=>{const e=z(ke.ERROR);return{log:z((t,n,o=ke.INFO)=>{const r=Jr().VIRTUOSO_LOG_LEVEL??be(e);o>=r&&console[Qr[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function lt(e,t,n){return vn(e,t,n).callbackRef}function vn(e,t,n){const o=N.useRef(null);let r=s=>{};const l=N.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(s=>{const i=()=>{const a=s[0].target;a.offsetParent!==null&&e(a)};n?i():requestAnimationFrame(i)}):null,[e,n]);return r=s=>{s&&t?(l==null||l.observe(s),o.current=s):(o.current&&(l==null||l.unobserve(o.current)),o.current=null)},{callbackRef:r,ref:o}}function Zr(e,t,n,o,r,l,s,i,a){const c=N.useCallback(f=>{const p=qr(f.children,t,i?"offsetWidth":"offsetHeight",r);let m=f.parentElement;for(;m.dataset.virtuosoScroller===void 0;)m=m.parentElement;const x=m.lastElementChild.dataset.viewportType==="window";let R;x&&(R=m.ownerDocument.defaultView);const M=s?i?s.scrollLeft:s.scrollTop:x?i?R.scrollX||R.document.documentElement.scrollLeft:R.scrollY||R.document.documentElement.scrollTop:i?m.scrollLeft:m.scrollTop,g=s?i?s.scrollWidth:s.scrollHeight:x?i?R.document.documentElement.scrollWidth:R.document.documentElement.scrollHeight:i?m.scrollWidth:m.scrollHeight,d=s?i?s.offsetWidth:s.offsetHeight:x?i?R.innerWidth:R.innerHeight:i?m.offsetWidth:m.offsetHeight;o({scrollHeight:g,scrollTop:Math.max(M,0),viewportHeight:d}),l==null||l(i?Nn("column-gap",getComputedStyle(f).columnGap,r):Nn("row-gap",getComputedStyle(f).rowGap,r)),p!==null&&e(p)},[e,t,r,l,s,o,i]);return vn(c,n,a)}function qr(e,t,n,o){const r=e.length;if(r===0)return null;const l=[];for(let s=0;s<r;s++){const i=e.item(s);if(i.dataset.index===void 0)continue;const a=parseInt(i.dataset.index),c=parseFloat(i.dataset.knownSize),f=t(i,n);if(f===0&&o("Zero-sized element, this should not happen",{child:i},ke.ERROR),f===c)continue;const p=l[l.length-1];l.length===0||p.size!==f||p.endIndex!==a-1?l.push({endIndex:a,size:f,startIndex:a}):l[l.length-1].endIndex++}return l}function Nn(e,t,n){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&n(`${e} was not resolved to pixel value correctly`,t,ke.WARN),t==="normal"?0:parseInt(t??"0",10)}function po(e,t,n){const o=N.useRef(null),r=N.useCallback(a=>{if(!(a!=null&&a.offsetParent))return;const c=a.getBoundingClientRect(),f=c.width;let p,m;if(t){const x=t.getBoundingClientRect(),R=c.top-x.top;m=x.height-Math.max(0,R),p=R+t.scrollTop}else{const x=s.current.ownerDocument.defaultView;m=x.innerHeight-Math.max(0,c.top),p=c.top+x.scrollY}o.current={listHeight:c.height,offsetTop:p,visibleHeight:m,visibleWidth:f},e(o.current)},[e,t]),{callbackRef:l,ref:s}=vn(r,!0,n),i=N.useCallback(()=>{r(s.current)},[r,s]);return N.useEffect(()=>{var c;if(t){t.addEventListener("scroll",i);const f=new ResizeObserver(()=>{requestAnimationFrame(i)});return f.observe(t),()=>{t.removeEventListener("scroll",i),f.unobserve(t)}}const a=(c=s.current)==null?void 0:c.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,s]),l}const Me=se(()=>{const e=ne(),t=ne(),n=z(0),o=ne(),r=z(0),l=ne(),s=ne(),i=z(0),a=z(0),c=z(0),f=z(0),p=ne(),m=ne(),x=z(!1),R=z(!1),M=z(!1);return W(T(e,$(({scrollTop:g})=>g)),t),W(T(e,$(({scrollHeight:g})=>g)),s),W(t,r),{deviation:n,fixedFooterHeight:c,fixedHeaderHeight:a,footerHeight:f,headerHeight:i,horizontalDirection:R,scrollBy:m,scrollContainerState:e,scrollHeight:s,scrollingInProgress:x,scrollTo:p,scrollTop:t,skipAnimationFrameInResizeObserver:M,smoothScrollTargetReached:o,statefulScrollTop:r,viewportHeight:l}},[],{singleton:!0}),Tt={lvl:0};function go(e,t){const n=e.length;if(n===0)return[];let{index:o,value:r}=t(e[0]);const l=[];for(let s=1;s<n;s++){const{index:i,value:a}=t(e[s]);l.push({end:i-1,start:o,value:r}),o=i,r=a}return l.push({end:1/0,start:o,value:r}),l}function he(e){return e===Tt}function yt(e,t){if(!he(e))return t===e.k?e.v:t<e.k?yt(e.l,t):yt(e.r,t)}function Ve(e,t,n="k"){if(he(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const o=Ve(e.r,t,n);return o[0]===-1/0?[e.k,e.v]:o}return Ve(e.l,t,n)}function Oe(e,t,n){return he(e)?wo(t,n,1):t===e.k?Re(e,{k:t,v:n}):t<e.k?Wn(Re(e,{l:Oe(e.l,t,n)})):Wn(Re(e,{r:Oe(e.r,t,n)}))}function ft(){return Tt}function ht(e,t,n){if(he(e))return[];const o=Ve(e,t)[0];return el(cn(e,o,n))}function an(e,t){if(he(e))return Tt;const{k:n,l:o,r}=e;if(t===n){if(he(o))return r;if(he(r))return o;const[l,s]=xo(o);return Nt(Re(e,{k:l,l:vo(o),v:s}))}return t<n?Nt(Re(e,{l:an(o,t)})):Nt(Re(e,{r:an(r,t)}))}function tt(e){return he(e)?[]:[...tt(e.l),{k:e.k,v:e.v},...tt(e.r)]}function cn(e,t,n){if(he(e))return[];const{k:o,l:r,r:l,v:s}=e;let i=[];return o>t&&(i=i.concat(cn(r,t,n))),o>=t&&o<=n&&i.push({k:o,v:s}),o<=n&&(i=i.concat(cn(l,t,n))),i}function Nt(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(qt(t))return Io(Re(e,{lvl:n-1}));if(!he(t)&&!he(t.r))return Re(t.r,{l:Re(t,{r:t.r.l}),lvl:n,r:Re(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(qt(e))return un(Re(e,{lvl:n-1}));if(!he(o)&&!he(o.l)){const r=o.l,l=qt(r)?o.lvl-1:o.lvl;return Re(r,{l:Re(e,{lvl:n-1,r:r.l}),lvl:r.lvl+1,r:un(Re(o,{l:r.r,lvl:l}))})}throw new Error("Unexpected empty nodes")}function Re(e,t){return wo(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 vo(e){return he(e.r)?e.l:Nt(Re(e,{r:vo(e.r)}))}function qt(e){return he(e)||e.lvl>e.r.lvl}function xo(e){return he(e.r)?[e.k,e.v]:xo(e.r)}function wo(e,t,n,o=Tt,r=Tt){return{k:e,l:o,lvl:n,r,v:t}}function Wn(e){return un(Io(e))}function Io(e){const{l:t}=e;return!he(t)&&t.lvl===e.lvl?Re(t,{r:Re(e,{l:t.r})}):e}function un(e){const{lvl:t,r:n}=e;return!he(n)&&!he(n.r)&&n.lvl===t&&n.r.lvl===t?Re(n,{l:Re(e,{r:n.l}),lvl:t+1}):e}function el(e){return go(e,({k:t,v:n})=>({index:t,value:n}))}function bo(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function St(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const xn=se(()=>({recalcInProgress:z(!1)}),[],{singleton:!0});function To(e,t,n){return e[Dt(e,t,n)]}function Dt(e,t,n,o=0){let r=e.length-1;for(;o<=r;){const l=Math.floor((o+r)/2),s=e[l],i=n(s,t);if(i===0)return l;if(i===-1){if(r-o<2)return l-1;r=l-1}else{if(r===o)return l;o=l+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function tl(e,t,n,o){const r=Dt(e,t,o),l=Dt(e,n,o,r);return e.slice(r,l+1)}function Xe(e,t){return Math.round(e.getBoundingClientRect()[t])}function Ut(e){return!he(e.groupOffsetTree)}function wn({index:e},t){return t===e?0:t<e?-1:1}function nl(){return{groupIndices:[],groupOffsetTree:ft(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:ft()}}function ol(e,t){let n=he(e)?0:1/0;for(const o of t){const{endIndex:r,size:l,startIndex:s}=o;if(n=Math.min(n,s),he(e)){e=Oe(e,0,l);continue}const i=ht(e,s-1,r+1);if(i.some(ul(o)))continue;let a=!1,c=!1;for(const{end:f,start:p,value:m}of i)a?(r>=p||l===m)&&(e=an(e,p)):(c=m!==l,a=!0),f>r&&r>=p&&m!==l&&(e=Oe(e,r+1,m));c&&(e=Oe(e,s,l))}return[e,n]}function rl(e){return typeof e.groupIndex<"u"}function ll({offset:e},t){return t===e?0:t<e?-1:1}function Ct(e,t,n){if(t.length===0)return 0;const{index:o,offset:r,size:l}=To(t,e,wn),s=e-o,i=l*s+(s-1)*n+r;return i>0?i+n:i}function yo(e,t){if(!Ut(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function So(e,t,n){if(rl(e))return t.groupIndices[e.groupIndex]+1;const o=e.index==="LAST"?n:e.index;let r=yo(o,t);return r=Math.max(0,r,Math.min(n,r)),r}function sl(e,t,n,o=0){return o>0&&(t=Math.max(t,To(e,o,wn).offset)),go(tl(e,t,n,ll),cl)}function il(e,[t,n,o,r]){t.length>0&&o("received item sizes",t,ke.DEBUG);const l=e.sizeTree;let s=l,i=0;if(n.length>0&&he(l)&&t.length===2){const m=t[0].size,x=t[1].size;s=n.reduce((R,M)=>Oe(Oe(R,M,m),M+1,x),s)}else[s,i]=ol(s,t);if(s===l)return e;const{lastIndex:a,lastOffset:c,lastSize:f,offsetTree:p}=dn(e.offsetTree,i,s,r);return{groupIndices:n,groupOffsetTree:n.reduce((m,x)=>Oe(m,x,Ct(x,p,r)),ft()),lastIndex:a,lastOffset:c,lastSize:f,offsetTree:p,sizeTree:s}}function al(e){return tt(e).map(({k:t,v:n},o,r)=>{const l=r[o+1];return{endIndex:l!==void 0?l.k-1:1/0,size:n,startIndex:t}})}function Dn(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 dn(e,t,n,o){let r=e,l=0,s=0,i=0,a=0;if(t!==0){a=Dt(r,t-1,wn),i=r[a].offset;const c=Ve(n,t-1);l=c[0],s=c[1],r.length&&r[a].size===Ve(n,t)[1]&&(a-=1),r=r.slice(0,a+1)}else r=[];for(const{start:c,value:f}of ht(n,t,1/0)){const p=c-l,m=p*s+i+p*o;r.push({index:c,offset:m,size:f}),l=c,i=m,s=f}return{lastIndex:l,lastOffset:i,lastSize:s,offsetTree:r}}function cl(e){return{index:e.index,value:e}}function ul(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 dl={offsetHeight:"height",offsetWidth:"width"},_e=se(([{log:e},{recalcInProgress:t}])=>{const n=ne(),o=ne(),r=je(o,0),l=ne(),s=ne(),i=z(0),a=z([]),c=z(void 0),f=z(void 0),p=z(void 0),m=z(void 0),x=z((u,I)=>Xe(u,dl[I])),R=z(void 0),M=z(0),g=nl(),d=je(T(n,Z(a,e,M),Ge(il,g),ge()),g),h=je(T(a,ge(),Ge((u,I)=>({current:I,prev:u.current}),{current:[],prev:[]}),$(({prev:u})=>u)),[]);W(T(a,K(u=>u.length>0),Z(d,M),$(([u,I,v])=>{const O=u.reduce((H,F,G)=>Oe(H,F,Ct(F,I.offsetTree,v)||G),ft());return{...I,groupIndices:u,groupOffsetTree:O}})),d),W(T(o,Z(d),K(([u,{lastIndex:I}])=>u<I),$(([u,{lastIndex:I,lastSize:v}])=>[{endIndex:I,size:v,startIndex:u}])),n),W(c,f);const C=je(T(c,$(u=>u===void 0)),!0);W(T(f,K(u=>u!==void 0&&he(be(d).sizeTree)),$(u=>{const I=be(p),v=be(a).length>0;return I!==void 0&&I!==0?v?[{endIndex:0,size:I,startIndex:0},{endIndex:1,size:u,startIndex:1}]:[]:[{endIndex:0,size:u,startIndex:0}]})),n),W(T(m,K(u=>u!==void 0&&u.length>0&&he(be(d).sizeTree)),$(u=>{const I=[];let v=u[0],O=0;for(let H=1;H<u.length;H++){const F=u[H];F!==v&&(I.push({endIndex:H-1,size:v,startIndex:O}),v=F,O=H)}return I.push({endIndex:u.length-1,size:v,startIndex:O}),I})),n),W(T(a,Z(p,f),K(([,u,I])=>u!==void 0&&I!==void 0),$(([u,I,v])=>{const O=[];for(let H=0;H<u.length;H++){const F=u[H],G=u[H+1];O.push({startIndex:F,endIndex:F,size:I}),G!==void 0&&O.push({startIndex:F+1,endIndex:G-1,size:v})}return O})),n);const j=$e(T(n,Z(d),Ge(({sizes:u},[I,v])=>({changed:v!==u,sizes:v}),{changed:!1,sizes:g}),$(u=>u.changed)));ue(T(i,Ge((u,I)=>({diff:u.prev-I,prev:I}),{diff:0,prev:0}),$(u=>u.diff)),u=>{const{groupIndices:I}=be(d);if(u>0)J(t,!0),J(l,u+Dn(u,I));else if(u<0){const v=be(h);v.length>0&&(u-=Dn(-u,v)),J(s,u)}}),ue(T(i,Z(e)),([u,I])=>{u<0&&I("`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},ke.ERROR)});const k=$e(l);W(T(l,Z(d),$(([u,I])=>{const v=I.groupIndices.length>0,O=[],H=I.lastSize;if(v){const F=yt(I.sizeTree,0);let G=0,V=0;for(;G<u;){const q=I.groupIndices[V],ee=I.groupIndices.length===V+1?1/0:I.groupIndices[V+1]-q-1;O.push({endIndex:q,size:F,startIndex:q}),O.push({endIndex:q+1+ee-1,size:H,startIndex:q+1}),V++,G+=ee+1}const D=tt(I.sizeTree);return G!==u&&D.shift(),D.reduce((q,{k:ee,v:pe})=>{let Ee=q.ranges;return q.prevSize!==0&&(Ee=[...q.ranges,{endIndex:ee+u-1,size:q.prevSize,startIndex:q.prevIndex}]),{prevIndex:ee+u,prevSize:pe,ranges:Ee}},{prevIndex:u,prevSize:0,ranges:O}).ranges}return tt(I.sizeTree).reduce((F,{k:G,v:V})=>({prevIndex:G+u,prevSize:V,ranges:[...F.ranges,{endIndex:G+u-1,size:F.prevSize,startIndex:F.prevIndex}]}),{prevIndex:0,prevSize:H,ranges:[]}).ranges})),n);const B=$e(T(s,Z(d,M),$(([u,{offsetTree:I},v])=>{const O=-u;return Ct(O,I,v)})));return W(T(s,Z(d,M),$(([u,I,v])=>{if(I.groupIndices.length>0){if(he(I.sizeTree))return I;let H=ft();const F=be(h);let G=0,V=0,D=0;for(;G<-u;){D=F[V];const q=F[V+1]-D-1;V++,G+=q+1}if(H=tt(I.sizeTree).reduce((q,{k:ee,v:pe})=>Oe(q,Math.max(0,ee+u),pe),H),G!==-u){const q=yt(I.sizeTree,D);H=Oe(H,0,q);const ee=Ve(I.sizeTree,-u+1)[1];H=Oe(H,1,ee)}return{...I,sizeTree:H,...dn(I.offsetTree,0,H,v)}}const O=tt(I.sizeTree).reduce((H,{k:F,v:G})=>Oe(H,Math.max(0,F+u),G),ft());return{...I,sizeTree:O,...dn(I.offsetTree,0,O,v)}})),d),{beforeUnshiftWith:k,data:R,defaultItemSize:f,firstItemIndex:i,fixedItemSize:c,fixedGroupSize:p,gap:M,groupIndices:a,heightEstimates:m,itemSize:x,listRefresh:j,shiftWith:s,shiftWithOffset:B,sizeRanges:n,sizes:d,statefulTotalCount:r,totalCount:o,trackItemSizes:C,unshiftWith:l}},ve(Je,xn),{singleton:!0});function fl(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const Co=se(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:o,scrollTop:r}])=>{const l=ne(),s=ne(),i=$e(T(l,$(fl)));return W(T(i,$(a=>a.totalCount)),n),W(T(i,$(a=>a.groupIndices)),e),W(T(Ce(r,t,o),K(([a,c])=>Ut(c)),$(([a,c,f])=>Ve(c.groupOffsetTree,Math.max(a-f,0),"v")[0]),ge(),$(a=>[a])),s),{groupCounts:l,topItemsIndexes:s}},ve(_e,Me)),Ze=se(([{log:e}])=>{const t=z(!1),n=$e(T(t,K(o=>o),ge()));return ue(t,o=>{o&&be(e)("props updated",{},ke.DEBUG)}),{didMount:n,propsReady:t}},ve(Je),{singleton:!0}),hl=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Ro(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!hl)&&(t.behavior="auto"),t.offset===void 0&&(t.offset=0),t}const Ht=se(([{gap:e,listRefresh:t,sizes:n,totalCount:o},{fixedFooterHeight:r,fixedHeaderHeight:l,footerHeight:s,headerHeight:i,scrollingInProgress:a,scrollTo:c,smoothScrollTargetReached:f,viewportHeight:p},{log:m}])=>{const x=ne(),R=ne(),M=z(0);let g=null,d=null,h=null;function C(){g!==null&&(g(),g=null),h!==null&&(h(),h=null),d&&(clearTimeout(d),d=null),J(a,!1)}return W(T(x,Z(n,p,o,M,i,s,m),Z(e,l,r),$(([[j,k,B,u,I,v,O,H],F,G,V])=>{const D=Ro(j),{align:q,behavior:ee,offset:pe}=D,Ee=u-1,ye=So(D,k,Ee);let Se=Ct(ye,k.offsetTree,F)+v;q==="end"?(Se+=G+Ve(k.sizeTree,ye)[1]-B+V,ye===Ee&&(Se+=O)):q==="center"?Se+=(G+Ve(k.sizeTree,ye)[1]-B+V)/2:Se-=I,pe!==void 0&&pe!==0&&(Se+=pe);const y=P=>{C(),P?(H("retrying to scroll to",{location:j},ke.DEBUG),J(x,j)):(J(R,!0),H("list did not change, scroll successful",{},ke.DEBUG))};if(C(),ee==="smooth"){let P=!1;h=ue(t,X=>{P=P||X}),g=De(f,()=>{y(P)})}else g=De(T(t,ml(150)),y);return d=setTimeout(()=>{C()},1200),J(a,!0),H("scrolling from index to",{behavior:ee,index:ye,top:Se},ke.DEBUG),{behavior:ee,top:Se}})),c),{scrollTargetReached:R,scrollToIndex:x,topListHeight:M}},ve(_e,Me,Je),{singleton:!0});function ml(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return o=>{o&&(t(!0),clearTimeout(n))}}}function In(e,t){e===0?t():requestAnimationFrame(()=>{In(e-1,t)})}function bn(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const jt=se(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:o},{scrollTargetReached:r,scrollToIndex:l},{didMount:s}])=>{const i=z(!0),a=z(0),c=z(!0);return W(T(s,Z(a),K(([f,p])=>p!==0),Fe(!1)),i),W(T(s,Z(a),K(([f,p])=>p!==0),Fe(!1)),c),ue(T(Ce(t,s),Z(i,n,e,c),K(([[,f],p,{sizeTree:m},x,R])=>f&&(!he(m)||pn(x))&&!p&&!R),Z(a)),([,f])=>{De(r,()=>{J(c,!0)}),In(4,()=>{De(o,()=>{J(i,!0)}),J(l,f)})}),{initialItemFinalLocationReached:c,initialTopMostItemIndex:a,scrolledToInitialItem:i}},ve(_e,Me,Ht,Ze),{singleton:!0});function ko(e,t){return Math.abs(e-t)<1.01}const Rt="up",wt="down",pl="none",gl={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},vl=0,Bt=se(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:o,scrollTop:r,viewportHeight:l}])=>{const s=z(!1),i=z(!0),a=ne(),c=ne(),f=z(4),p=z(vl),m=je(T(sn(T(U(r),ot(1),Fe(!0)),T(U(r),ot(1),Fe(!1),Pn(100))),ge()),!1),x=je(T(sn(T(n,Fe(!0)),T(n,Fe(!1),Pn(200))),ge()),!1);W(T(Ce(U(r),U(p)),$(([h,C])=>h<=C),ge()),i),W(T(i,Ue(50)),c);const R=$e(T(Ce(o,U(l),U(t),U(e),U(f)),Ge((h,[{scrollHeight:C,scrollTop:j},k,B,u,I])=>{const v=j+k-C>-I,O={scrollHeight:C,scrollTop:j,viewportHeight:k};if(v){let F,G;return j>h.state.scrollTop?(F="SCROLLED_DOWN",G=h.state.scrollTop-j):(F="SIZE_DECREASED",G=h.state.scrollTop-j||h.scrollTopDelta),{atBottom:!0,atBottomBecause:F,scrollTopDelta:G,state:O}}let H;return O.scrollHeight>h.state.scrollHeight?H="SIZE_INCREASED":k<h.state.viewportHeight?H="VIEWPORT_HEIGHT_DECREASING":j<h.state.scrollTop?H="SCROLLING_UPWARDS":H="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:H,state:O}},gl),ge((h,C)=>h!==void 0&&h.atBottom===C.atBottom))),M=je(T(o,Ge((h,{scrollHeight:C,scrollTop:j,viewportHeight:k})=>{if(!ko(h.scrollHeight,C)){const B=C-(j+k)<1;return h.scrollTop!==j&&B?{changed:!0,jump:h.scrollTop-j,scrollHeight:C,scrollTop:j}:{changed:!0,jump:0,scrollHeight:C,scrollTop:j}}return{changed:!1,jump:0,scrollHeight:C,scrollTop:j}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),K(h=>h.changed),$(h=>h.jump)),0);W(T(R,$(h=>h.atBottom)),s),W(T(s,Ue(50)),a);const g=z(wt);W(T(o,$(({scrollTop:h})=>h),ge(),Ge((h,C)=>be(x)?{direction:h.direction,prevScrollTop:C}:{direction:C<h.prevScrollTop?Rt:wt,prevScrollTop:C},{direction:wt,prevScrollTop:0}),$(h=>h.direction)),g),W(T(o,Ue(50),Fe(pl)),g);const d=z(0);return W(T(m,K(h=>!h),Fe(0)),d),W(T(r,Ue(100),Z(m),K(([h,C])=>C),Ge(([h,C],[j])=>[C,j],[0,0]),$(([h,C])=>C-h)),d),{atBottomState:R,atBottomStateChange:a,atBottomThreshold:f,atTopStateChange:c,atTopThreshold:p,isAtBottom:s,isAtTop:i,isScrolling:m,lastJumpDueToItemResize:M,scrollDirection:g,scrollVelocity:d}},ve(Me)),kt="top",Et="bottom",Vn="none";function Fn(e,t,n){return typeof e=="number"?n===Rt&&t===kt||n===wt&&t===Et?e:0:n===Rt?t===kt?e.main:e.reverse:t===Et?e.main:e.reverse}function Gn(e,t){return typeof e=="number"?e:e[t]??0}const Tn=se(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:o,viewportHeight:r}])=>{const l=ne(),s=z(0),i=z(0),a=z(0),c=je(T(Ce(U(o),U(r),U(n),U(l,St),U(a),U(s),U(t),U(e),U(i)),$(([f,p,m,[x,R],M,g,d,h,C])=>{const j=f-h,k=g+d,B=Math.max(m-j,0);let u=Vn;const I=Gn(C,kt),v=Gn(C,Et);return x-=h,x+=m+d,R+=m+d,R-=h,x>f+k-I&&(u=Rt),R<f-B+p+v&&(u=wt),u!==Vn?[Math.max(j-m-Fn(M,kt,u)-I,0),j-B-d+p+Fn(M,Et,u)+v]:null}),K(f=>f!==null),ge(St)),[0,0]);return{increaseViewportBy:i,listBoundary:l,overscan:a,topListHeight:s,visibleRange:c}},ve(Me),{singleton:!0});function xl(e,t,n){if(Ut(t)){const o=yo(e,t);return[{index:Ve(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 en={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Wt(e,t,n,o,r,l){const{lastIndex:s,lastOffset:i,lastSize:a}=r;let c=0,f=0;if(e.length>0){c=e[0].offset;const M=e[e.length-1];f=M.offset+M.size}const p=n-s,m=i+p*a+(p-1)*o,x=c,R=m-f;return{bottom:f,firstItemIndex:l,items:_n(e,r,l),offsetBottom:R,offsetTop:c,top:x,topItems:_n(t,r,l),topListHeight:t.reduce((M,g)=>g.size+M,0),totalCount:n}}function Eo(e,t,n,o,r,l){let s=0;if(n.groupIndices.length>0)for(const f of n.groupIndices){if(f-s>=e)break;s++}const i=e+s,a=bn(t,i),c=Array.from({length:i}).map((f,p)=>({data:l[p+a],index:p+a,offset:0,size:0}));return Wt(c,[],i,r,n,o)}function _n(e,t,n){if(e.length===0)return[];if(!Ut(t))return e.map(c=>({...c,index:c.index+n,originalIndex:c.index}));const o=e[0].index,r=e[e.length-1].index,l=[],s=ht(t.groupOffsetTree,o,r);let i,a=0;for(const c of e){(!i||i.end<c.index)&&(i=s.shift(),a=t.groupIndices.indexOf(i.start));let f;c.index===i.start?f={index:a,type:"group"}:f={groupIndex:a,index:c.index-(a+1)+n},l.push({...f,data:c.data,offset:c.offset,originalIndex:c.index,size:c.size})}return l}function Un(e,t){return e===void 0?0:typeof e=="number"?e:e[t]??0}const st=se(([{data:e,firstItemIndex:t,gap:n,sizes:o,totalCount:r},l,{listBoundary:s,topListHeight:i,visibleRange:a},{initialTopMostItemIndex:c,scrolledToInitialItem:f},{topListHeight:p},m,{didMount:x},{recalcInProgress:R}])=>{const M=z([]),g=z(0),d=ne(),h=z(0);W(l.topItemsIndexes,M);const C=je(T(Ce(x,R,U(a,St),U(r),U(o),U(c),f,U(M),U(t),U(n),U(h),e),K(([u,I,,v,,,,,,,,O])=>{const H=O!==void 0&&O.length!==v;return u&&!I&&!H}),$(([,,[u,I],v,O,H,F,G,V,D,q,ee])=>{var _,ie;const pe=O,{offsetTree:Ee,sizeTree:ye}=pe,Se=be(g);if(v===0)return{...en,totalCount:v};if(u===0&&I===0)return Se===0?{...en,totalCount:v}:Eo(Se,H,O,V,D,ee||[]);if(he(ye))return Se>0?null:Wt(xl(bn(H,v),pe,ee),[],v,D,pe,V);const y=[];if(G.length>0){const de=G[0],me=G[G.length-1];let ae=0;for(const oe of ht(ye,de,me)){const ce=oe.value,xe=Math.max(oe.start,de),fe=Math.min(oe.end,me);for(let we=xe;we<=fe;we++)y.push({data:ee==null?void 0:ee[we],index:we,offset:ae,size:ce}),ae+=ce}}if(!F)return Wt([],y,v,D,pe,V);const P=G.length>0?G[G.length-1]+1:0,X=sl(Ee,u,I,P);if(X.length===0)return null;const A=v-1,Q=_t([],de=>{for(const me of X){const ae=me.value;let oe=ae.offset,ce=me.start;const xe=ae.size;if(ae.offset<u){ce+=Math.floor((u-ae.offset+D)/(xe+D));const we=ce-me.start;oe+=we*xe+we*D}ce<P&&(oe+=(P-ce)*xe,ce=P);const fe=Math.min(me.end,A);for(let we=ce;we<=fe&&!(oe>=I);we++)de.push({data:ee==null?void 0:ee[we],index:we,offset:oe,size:xe}),oe+=xe+D}}),le=Un(q,kt),E=Un(q,Et);if(Q.length>0&&(le>0||E>0)){const de=Q[0],me=Q[Q.length-1];if(le>0&&de.index>P){const ae=Math.min(le,de.index-P),oe=[];let ce=de.offset;for(let xe=de.index-1;xe>=de.index-ae;xe--){const fe=((_=ht(ye,xe,xe)[0])==null?void 0:_.value)??de.size;ce-=fe+D,oe.unshift({data:ee==null?void 0:ee[xe],index:xe,offset:ce,size:fe})}Q.unshift(...oe)}if(E>0&&me.index<A){const ae=Math.min(E,A-me.index);let oe=me.offset+me.size+D;for(let ce=me.index+1;ce<=me.index+ae;ce++){const xe=((ie=ht(ye,ce,ce)[0])==null?void 0:ie.value)??me.size;Q.push({data:ee==null?void 0:ee[ce],index:ce,offset:oe,size:xe}),oe+=xe+D}}}return Wt(Q,y,v,D,pe,V)}),K(u=>u!==null),ge()),en);W(T(e,K(pn),$(u=>u==null?void 0:u.length)),r),W(T(C,$(u=>u.topListHeight)),p),W(p,i),W(T(C,$(u=>[u.top,u.bottom])),s),W(T(C,$(u=>u.items)),d);const j=$e(T(C,K(({items:u})=>u.length>0),Z(r,e),K(([{items:u},I])=>u[u.length-1].originalIndex===I-1),$(([,u,I])=>[u-1,I]),ge(St),$(([u])=>u))),k=$e(T(C,Ue(200),K(({items:u,topItems:I})=>u.length>0&&u[0].originalIndex===I.length),$(({items:u})=>u[0].index),ge())),B=$e(T(C,K(({items:u})=>u.length>0),$(({items:u})=>{let I=0,v=u.length-1;for(;u[I].type==="group"&&I<v;)I++;for(;u[v].type==="group"&&v>I;)v--;return{endIndex:u[v].index,startIndex:u[I].index}}),ge(bo)));return{endReached:j,initialItemCount:g,itemsRendered:d,listState:C,minOverscanItemCount:h,rangeChanged:B,startReached:k,topItemsIndexes:M,...m}},ve(_e,Co,Tn,jt,Ht,Bt,Ze,xn),{singleton:!0}),zo=se(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:o},{listState:r}])=>{const l=ne(),s=je(T(Ce(n,e,o,t,r),$(([i,a,c,f,p])=>i+a+c+f+p.offsetBottom+p.bottom)),0);return W(U(s),l),{totalListHeight:s,totalListHeightChanged:l}},ve(Me,st),{singleton:!0}),wl=se(([{viewportHeight:e},{totalListHeight:t}])=>{const n=z(!1),o=je(T(Ce(n,e,t),K(([r])=>r),$(([,r,l])=>Math.max(0,r-l)),Ue(0),ge()),0);return{alignToBottom:n,paddingTopAddition:o}},ve(Me,zo),{singleton:!0}),Ho=se(()=>({context:z(null)})),Il=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:o,...r},viewportBottom:l,viewportTop:s})=>t<s?{...r,align:n??"start",...o!==void 0?{behavior:o}:{}}:e>l?{...r,align:n??"end",...o!==void 0?{behavior:o}:{}}:null,jo=se(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:o,fixedHeaderHeight:r,headerHeight:l,scrollingInProgress:s,scrollTop:i,viewportHeight:a},{scrollToIndex:c}])=>{const f=ne();return W(T(f,Z(t,a,n,l,r,o,i),Z(e),$(([[p,m,x,R,M,g,d,h],C])=>{const{calculateViewLocation:j=Il,done:k,...B}=p,u=So(p,m,R-1),I=Ct(u,m.offsetTree,C)+M+g,v=I+Ve(m.sizeTree,u)[1],O=h+g,H=h+x-d,F=j({itemBottom:v,itemTop:I,locationParams:B,viewportBottom:H,viewportTop:O});return F!==null?k&&De(T(s,K(G=>!G),ot(be(s)?1:2)),k):k==null||k(),F}),K(p=>p!==null)),c),{scrollIntoView:f}},ve(_e,Me,Ht,st,Je),{singleton:!0});function Kn(e){return e===!1?!1:e==="smooth"?"smooth":"auto"}const bl=(e,t)=>typeof e=="function"?Kn(e(t)):t&&Kn(e),Tl=se(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:o},{atBottomState:r,isAtBottom:l},{scrollToIndex:s},{scrolledToInitialItem:i},{didMount:a,propsReady:c},{log:f},{scrollingInProgress:p},{context:m},{scrollIntoView:x}])=>{const R=z(!1),M=ne();let g=null;function d(k){J(s,{align:"end",behavior:k,index:"LAST"})}ue(T(Ce(T(U(t),ot(1)),a),Z(U(R),l,i,p),$(([[k,B],u,I,v,O])=>{let H=B&&v,F="auto";return H&&(F=bl(u,I||O),H=H&&F!==!1),{followOutputBehavior:F,shouldFollow:H,totalCount:k}}),K(({shouldFollow:k})=>k)),({followOutputBehavior:k,totalCount:B})=>{g!==null&&(g(),g=null),be(n)!==void 0?requestAnimationFrame(()=>{be(f)("following output to ",{totalCount:B},ke.DEBUG),d(k)}):g=De(e,()=>{be(f)("following output to ",{totalCount:B},ke.DEBUG),d(k),g=null})});function h(k){const B=De(r,u=>{k&&!u.atBottom&&u.notAtBottomBecause==="SIZE_INCREASED"&&g===null&&(be(f)("scrolling to bottom due to increased size",{},ke.DEBUG),d("auto"))});setTimeout(B,100)}ue(T(Ce(U(R),t,c),K(([k,,B])=>k!==!1&&B),Ge(({value:k},[,B])=>({refreshed:k===B,value:B}),{refreshed:!1,value:0}),K(({refreshed:k})=>k),Z(R,t)),([,k])=>{be(i)&&h(k!==!1)}),ue(M,()=>{h(be(R)!==!1)}),ue(Ce(U(R),r),([k,B])=>{k!==!1&&!B.atBottom&&B.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&d("auto")});const C=z(null),j=ne();return W(sn(T(U(o),$(k=>(k==null?void 0:k.length)??0)),T(U(t))),j),ue(T(Ce(T(j,ot(1)),a),Z(U(C),i,p,m),$(([[k,B],u,I,v,O])=>B&&I&&(u==null?void 0:u({context:O,totalCount:k,scrollingInProgress:v}))),K(k=>!!k),Ue(0)),k=>{g!==null&&(g(),g=null),be(n)!==void 0?requestAnimationFrame(()=>{be(f)("scrolling into view",{}),J(x,k)}):g=De(e,()=>{be(f)("scrolling into view",{}),J(x,k),g=null})}),{autoscrollToBottom:M,followOutput:R,scrollIntoViewOnChange:C}},ve(_e,Bt,Ht,jt,Ze,Je,Me,Ho,jo)),yl=se(([{data:e,firstItemIndex:t,gap:n,sizes:o},{initialTopMostItemIndex:r},{initialItemCount:l,listState:s},{didMount:i}])=>(W(T(i,Z(l),K(([,a])=>a!==0),Z(r,o,t,n,e),$(([[,a],c,f,p,m,x=[]])=>Eo(a,c,f,p,m,x))),s),{}),ve(_e,jt,st,Ze),{singleton:!0}),Sl=se(([{didMount:e},{scrollTo:t},{listState:n}])=>{const o=z(0);return ue(T(e,Z(o),K(([,r])=>r!==0),$(([,r])=>({top:r}))),r=>{De(T(n,ot(1),K(l=>l.items.length>1)),()=>{requestAnimationFrame(()=>{J(t,r)})})}),{initialScrollTop:o}},ve(Ze,Me,st),{singleton:!0}),Bo=se(([{scrollVelocity:e}])=>{const t=z(!1),n=ne(),o=z(!1);return W(T(e,Z(o,t,n),K(([r,l])=>l!==!1&&l!==void 0),$(([r,l,s,i])=>{const{enter:a,exit:c}=l;if(s){if(c(r,i))return!1}else if(a(r,i))return!0;return s}),ge()),t),ue(T(Ce(t,e,n),Z(o)),([[r,l,s],i])=>{r&&i!==!1&&i!==void 0&&i.change&&i.change(l,s)}),{isSeeking:t,scrollSeekConfiguration:o,scrollSeekRangeChanged:n,scrollVelocity:e}},ve(Bt),{singleton:!0}),yn=se(([{scrollContainerState:e,scrollTo:t}])=>{const n=ne(),o=ne(),r=ne(),l=z(!1),s=z(void 0);return W(T(Ce(n,o),$(([{scrollTop:i,viewportHeight:a},{offsetTop:c,listHeight:f}])=>({scrollHeight:f,scrollTop:Math.max(0,i-c),viewportHeight:a}))),e),W(T(t,Z(o),$(([i,{offsetTop:a}])=>({...i,top:i.top+a}))),r),{customScrollParent:s,useWindowScroll:l,windowScrollContainerState:n,windowScrollTo:r,windowViewportRect:o}},ve(Me)),Cl=se(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:o},{initialTopMostItemIndex:r},{didMount:l},{useWindowScroll:s,windowScrollContainerState:i,windowViewportRect:a}])=>{const c=ne(),f=z(void 0),p=z(null),m=z(null);return W(i,p),W(a,m),ue(T(c,Z(t,o,s,p,m,n)),([x,R,M,g,d,h,C])=>{const j=al(R.sizeTree);g&&d!==null&&h!==null&&(M=d.scrollTop-h.offsetTop),M-=C,x({ranges:j,scrollTop:M})}),W(T(f,K(pn),$(Rl)),r),W(T(l,Z(f),K(([,x])=>x!==void 0),ge(),$(([,x])=>x.ranges)),e),{getState:c,restoreStateFrom:f}},ve(_e,Me,jt,Ze,yn));function Rl(e){return{align:"start",index:0,offset:e.scrollTop}}const kl=se(([{topItemsIndexes:e}])=>{const t=z(0);return W(T(t,K(n=>n>=0),$(n=>Array.from({length:n}).map((o,r)=>r))),e),{topItemCount:t}},ve(st));function Mo(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}const El=Mo(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),zl=se(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:o},{isAtBottom:r,isScrolling:l,lastJumpDueToItemResize:s,scrollDirection:i},{listState:a},{beforeUnshiftWith:c,gap:f,shiftWithOffset:p,sizes:m},{log:x},{recalcInProgress:R}])=>{const M=$e(T(a,Z(s),Ge(([,d,h,C],[{bottom:j,items:k,offsetBottom:B,totalCount:u},I])=>{const v=j+B;let O=0;return h===u&&d.length>0&&k.length>0&&(k[0].originalIndex===0&&d[0].originalIndex===0||(O=v-C,O!==0&&(O+=I))),[O,k,u,v]},[0,[],0,0]),K(([d])=>d!==0),Z(o,i,n,r,x,R),K(([,d,h,C,,,j])=>!j&&!C&&d!==0&&h===Rt),$(([[d],,,,,h])=>(h("Upward scrolling compensation",{amount:d},ke.DEBUG),d))));function g(d){d>0?(J(t,{behavior:"auto",top:-d}),J(e,0)):(J(e,0),J(t,{behavior:"auto",top:-d}))}return ue(T(M,Z(e,l)),([d,h,C])=>{C&&El()?J(e,h-d):g(-d)}),ue(T(Ce(je(l,!1),e,R),K(([d,h,C])=>!d&&!C&&h!==0),$(([d,h])=>h),Ue(1)),g),W(T(p,$(d=>({top:-d}))),t),ue(T(c,Z(m,f),$(([d,{groupIndices:h,lastSize:C,sizeTree:j},k])=>{function B(H){return H*(C+k)}if(h.length===0)return B(d);let u=0;const I=yt(j,0);let v=0,O=0;for(;v<d;){v++,u+=I;let H=h.length===O+1?1/0:h[O+1]-h[O]-1;v+H>d&&(u-=I,H=d-v+1),v+=H,u+=B(H),O++}return u})),d=>{J(e,d),requestAnimationFrame(()=>{J(t,{top:d}),requestAnimationFrame(()=>{J(e,0),J(R,!1)})})}),{deviation:e}},ve(Me,Bt,st,_e,Je,xn)),Hl=se(([e,t,n,o,r,l,s,i,a,c,f])=>({...e,...t,...n,...o,...r,...l,...s,...i,...a,...c,...f}),ve(Tn,yl,Ze,Bo,zo,Sl,wl,yn,jo,Je,Ho)),Oo=se(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:o,fixedGroupSize:r,gap:l,groupIndices:s,heightEstimates:i,itemSize:a,sizeRanges:c,sizes:f,statefulTotalCount:p,totalCount:m,trackItemSizes:x},{initialItemFinalLocationReached:R,initialTopMostItemIndex:M,scrolledToInitialItem:g},d,h,C,j,{scrollToIndex:k},B,{topItemCount:u},{groupCounts:I},v])=>{const{listState:O,minOverscanItemCount:H,topItemsIndexes:F,rangeChanged:G,...V}=j;return W(G,v.scrollSeekRangeChanged),W(T(v.windowViewportRect,$(D=>D.visibleHeight)),d.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:o,fixedGroupHeight:r,gap:l,groupCounts:I,heightEstimates:i,initialItemFinalLocationReached:R,initialTopMostItemIndex:M,scrolledToInitialItem:g,sizeRanges:c,topItemCount:u,topItemsIndexes:F,totalCount:m,...C,groupIndices:s,itemSize:a,listState:O,minOverscanItemCount:H,scrollToIndex:k,statefulTotalCount:p,trackItemSizes:x,rangeChanged:G,...V,...v,...d,sizes:f,...h}},ve(_e,jt,Me,Cl,Tl,st,Ht,zl,kl,Co,Hl));function jl(e,t){const n={},o={};let r=0;const l=e.length;for(;r<l;)o[e[r]]=1,r+=1;for(const s in t)Object.hasOwn(o,s)||(n[s]=t[s]);return n}const At=typeof document<"u"?N.useLayoutEffect:N.useEffect;function $o(e,t,n){const o=Object.keys(t.required||{}),r=Object.keys(t.optional||{}),l=Object.keys(t.methods||{}),s=Object.keys(t.events||{}),i=N.createContext({});function a(g,d){g.propsReady!==void 0&&J(g.propsReady,!1);for(const h of o){const C=g[t.required[h]];J(C,d[h])}for(const h of r)if(h in d){const C=g[t.optional[h]];J(C,d[h])}g.propsReady!==void 0&&J(g.propsReady,!0)}function c(g){return l.reduce((d,h)=>(d[h]=C=>{const j=g[t.methods[h]];J(j,C)},d),{})}function f(g){return s.reduce((d,h)=>(d[h]=Kr(g[t.events[h]]),d),{})}const p=N.forwardRef(function(g,d){const{children:h,...C}=g,[j]=N.useState(()=>_t(Yr(e),u=>{a(u,C)})),[k]=N.useState(An(f,j));At(()=>{for(const u of s)u in C&&ue(k[u],C[u]);return()=>{Object.values(k).map(gn)}},[C,k,j]),At(()=>{a(j,C)}),N.useImperativeHandle(d,Ln(c(j)));const B=n;return w.jsx(i.Provider,{value:j,children:n!==void 0?w.jsx(B,{...jl([...o,...r,...s],C),children:h}):h})}),m=g=>{const d=N.useContext(i);return N.useCallback(h=>{J(d[g],h)},[d,g])},x=g=>{const d=N.useContext(i)[g],h=N.useCallback(C=>ue(d,C),[d]);return N.useSyncExternalStore(h,()=>be(d),()=>be(d))},R=g=>{const d=N.useContext(i)[g],[h,C]=N.useState(An(be,d));return At(()=>ue(d,j=>{j!==h&&C(Ln(j))}),[d,h]),h},M=N.version.startsWith("18")?x:R;return{Component:p,useEmitter:(g,d)=>{const h=N.useContext(i)[g];At(()=>ue(h,d),[d,h])},useEmitterValue:M,usePublisher:m}}const Lo=N.createContext(void 0),Ao=N.createContext(void 0),tn="-webkit-sticky",Xn="sticky",Sn=Mo(()=>{if(typeof document>"u")return Xn;const e=document.createElement("div");return e.style.position=tn,e.style.position===tn?tn:Xn}),Po=typeof document<"u"?N.useLayoutEffect:N.useEffect;function nn(e){return"self"in e}function Bl(e){return"body"in e}function No(e,t,n,o=pt,r,l){const s=N.useRef(null),i=N.useRef(null),a=N.useRef(null),c=N.useCallback(m=>{let x,R,M;const g=m.target;if(Bl(g)||nn(g)){const h=nn(g)?g:g.defaultView;M=l===!0?h.scrollX:h.scrollY,x=l===!0?h.document.documentElement.scrollWidth:h.document.documentElement.scrollHeight,R=l===!0?h.innerWidth:h.innerHeight}else M=l===!0?g.scrollLeft:g.scrollTop,x=l===!0?g.scrollWidth:g.scrollHeight,R=l===!0?g.offsetWidth:g.offsetHeight;const d=()=>{e({scrollHeight:x,scrollTop:Math.max(M,0),viewportHeight:R})};m.suppressFlushSync===!0?d():Qo.flushSync(d),i.current!==null&&(M===i.current||M<=0||M===x-R)&&(i.current=null,t(!0),a.current&&(clearTimeout(a.current),a.current=null))},[e,t,l]);N.useEffect(()=>{const m=r||s.current;return o(r||s.current),c({suppressFlushSync:!0,target:m}),m.addEventListener("scroll",c,{passive:!0}),()=>{o(null),m.removeEventListener("scroll",c)}},[s,c,n,o,r]);function f(m){const x=s.current;if(!x||(l===!0?"offsetWidth"in x&&x.offsetWidth===0:"offsetHeight"in x&&x.offsetHeight===0))return;const R=m.behavior==="smooth";let M,g,d;nn(x)?(g=Math.max(Xe(x.document.documentElement,l===!0?"width":"height"),l===!0?x.document.documentElement.scrollWidth:x.document.documentElement.scrollHeight),M=l===!0?x.innerWidth:x.innerHeight,d=l===!0?window.scrollX:window.scrollY):(g=x[l===!0?"scrollWidth":"scrollHeight"],M=Xe(x,l===!0?"width":"height"),d=x[l===!0?"scrollLeft":"scrollTop"]);const h=g-M;if(m.top=Math.ceil(Math.max(Math.min(h,m.top),0)),ko(M,g)||m.top===d){e({scrollHeight:g,scrollTop:d,viewportHeight:M}),R&&t(!0);return}R?(i.current=m.top,a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,i.current=null,t(!0)},1e3)):i.current=null,l===!0&&(m={...m.behavior!==void 0?{behavior:m.behavior}:{},left:m.top}),x.scrollTo(m)}function p(m){l===!0&&(m={...m.behavior!==void 0?{behavior:m.behavior}:{},...m.top!==void 0?{left:m.top}:{}}),s.current.scrollBy(m)}return{scrollByCallback:p,scrollerRef:s,scrollToCallback:f}}function Cn(e){return e}const Ml=se(()=>{const e=z(i=>`Item ${i}`),t=z(i=>`Group ${i}`),n=z({}),o=z(Cn),r=z("div"),l=z(pt),s=(i,a=null)=>je(T(n,$(c=>c[i]),ge()),a);return{components:n,computeItemKey:o,EmptyPlaceholder:s("EmptyPlaceholder"),FooterComponent:s("Footer"),GroupComponent:s("Group","div"),groupContent:t,HeaderComponent:s("Header"),HeaderFooterTag:r,ItemComponent:s("Item","div"),itemContent:e,ListComponent:s("List","div"),ScrollerComponent:s("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:s("ScrollSeekPlaceholder"),TopItemListComponent:s("TopItemList")}}),Ol=se(([e,t])=>({...e,...t}),ve(Oo,Ml)),$l=({height:e})=>w.jsx("div",{style:{height:e}}),Ll={overflowAnchor:"none",position:Sn(),zIndex:1},Wo={overflowAnchor:"none"},Al={...Wo,display:"inline-block",height:"100%"},Yn=N.memo(function({showTopList:e=!1}){const t=Y("listState"),n=Pe("sizeRanges"),o=Y("useWindowScroll"),r=Y("customScrollParent"),l=Pe("windowScrollContainerState"),s=Pe("scrollContainerState"),i=r||o?l:s,a=Y("itemContent"),c=Y("context"),f=Y("groupContent"),p=Y("trackItemSizes"),m=Y("itemSize"),x=Y("log"),R=Pe("gap"),M=Y("horizontalDirection"),{callbackRef:g}=Zr(n,m,p,e?pt:i,x,R,r,M,Y("skipAnimationFrameInResizeObserver")),[d,h]=N.useState(0);Rn("deviation",V=>{d!==V&&h(V)});const C=Y("EmptyPlaceholder"),j=Y("ScrollSeekPlaceholder")??$l,k=Y("ListComponent"),B=Y("ItemComponent"),u=Y("GroupComponent"),I=Y("computeItemKey"),v=Y("isSeeking"),O=Y("groupIndices").length>0,H=Y("alignToBottom"),F=Y("initialItemFinalLocationReached"),G=e?{}:{boxSizing:"border-box",...M?{display:"inline-block",height:"100%",marginLeft:d!==0?d:H?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:d!==0?d:H?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...F?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&C!==null&&C!==void 0?w.jsx(C,{...He(C,c)}):w.jsx(k,{...He(k,c),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:g,style:G,children:(e?t.topItems:t.items).map(V=>{const D=V.originalIndex,q=I(D+t.firstItemIndex,V.data,c);return v?S.createElement(j,{...He(j,c),height:V.size,index:V.index,key:q,type:V.type||"item",...V.type==="group"?{}:{groupIndex:V.groupIndex}}):V.type==="group"?S.createElement(u,{...He(u,c),"data-index":D,"data-item-index":V.index,"data-known-size":V.size,key:q,style:Ll},f(V.index,c)):S.createElement(B,{...He(B,c),...Dl(B,V.data),"data-index":D,"data-item-group-index":V.groupIndex,"data-item-index":V.index,"data-known-size":V.size,key:q,style:M?Al:Wo},O?a(V.index,V.groupIndex,V.data,c):a(V.index,V.data,c))})})}),Pl={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Nl={outline:"none",overflowX:"auto",position:"relative"},Kt=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:void 0}),Wl={position:Sn(),top:0,width:"100%",zIndex:1};function He(e,t){if(typeof e!="string")return{context:t}}function Dl(e,t){return{item:typeof e=="string"?void 0:t}}const Vl=N.memo(function(){const e=Y("HeaderComponent"),t=Pe("headerHeight"),n=Y("HeaderFooterTag"),o=lt(N.useMemo(()=>l=>{t(Xe(l,"height"))},[t]),!0,Y("skipAnimationFrameInResizeObserver")),r=Y("context");return e!=null?w.jsx(n,{ref:o,children:w.jsx(e,{...He(e,r)})}):null}),Fl=N.memo(function(){const e=Y("FooterComponent"),t=Pe("footerHeight"),n=Y("HeaderFooterTag"),o=lt(N.useMemo(()=>l=>{t(Xe(l,"height"))},[t]),!0,Y("skipAnimationFrameInResizeObserver")),r=Y("context");return e!=null?w.jsx(n,{ref:o,children:w.jsx(e,{...He(e,r)})}):null});function Do({useEmitter:e,useEmitterValue:t,usePublisher:n}){return N.memo(function({children:o,style:r,context:l,...s}){const i=n("scrollContainerState"),a=t("ScrollerComponent"),c=n("smoothScrollTargetReached"),f=t("scrollerRef"),p=t("horizontalDirection")||!1,{scrollByCallback:m,scrollerRef:x,scrollToCallback:R}=No(i,c,a,f,void 0,p);return e("scrollTo",R),e("scrollBy",m),w.jsx(a,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:x,style:{...p?Nl:Pl,...r},tabIndex:0,...s,...He(a,l),children:o})})}function Vo({useEmitter:e,useEmitterValue:t,usePublisher:n}){return N.memo(function({children:o,style:r,context:l,...s}){const i=n("windowScrollContainerState"),a=t("ScrollerComponent"),c=n("smoothScrollTargetReached"),f=t("totalListHeight"),p=t("deviation"),m=t("customScrollParent"),x=N.useRef(null),R=t("scrollerRef"),{scrollByCallback:M,scrollerRef:g,scrollToCallback:d}=No(i,c,a,R,m);return Po(()=>{var h;return g.current=m||((h=x.current)==null?void 0:h.ownerDocument.defaultView),()=>{g.current=null}},[g,m]),e("windowScrollTo",d),e("scrollBy",M),w.jsx(a,{ref:x,"data-virtuoso-scroller":!0,style:{position:"relative",...r,...f!==0?{height:f+p}:void 0},...s,...He(a,l),children:o})})}const Gl=({children:e})=>{const t=N.useContext(Lo),n=Pe("viewportHeight"),o=Pe("fixedItemHeight"),r=Y("alignToBottom"),l=Y("horizontalDirection"),s=N.useMemo(()=>ho(n,a=>Xe(a,l?"width":"height")),[n,l]),i=lt(s,!0,Y("skipAnimationFrameInResizeObserver"));return N.useEffect(()=>{t&&(n(t.viewportHeight),o(t.itemHeight))},[t,n,o]),w.jsx("div",{"data-viewport-type":"element",ref:i,style:Kt(r),children:e})},_l=({children:e})=>{const t=N.useContext(Lo),n=Pe("windowViewportRect"),o=Pe("fixedItemHeight"),r=Y("customScrollParent"),l=po(n,r,Y("skipAnimationFrameInResizeObserver")),s=Y("alignToBottom");return N.useEffect(()=>{t&&(o(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,o]),w.jsx("div",{"data-viewport-type":"window",ref:l,style:Kt(s),children:e})},Ul=({children:e})=>{const t=Y("TopItemListComponent")??"div",n=Y("headerHeight"),o={...Wl,marginTop:`${n}px`},r=Y("context");return w.jsx(t,{style:o,...He(t,r),children:e})},Kl=N.memo(function(e){const t=Y("useWindowScroll"),n=Y("topItemsIndexes").length>0,o=Y("customScrollParent"),r=Y("context");return w.jsxs(o||t?Ql:Yl,{...e,context:r,children:[n&&w.jsx(Ul,{children:w.jsx(Yn,{showTopList:!0})}),w.jsxs(o||t?_l:Gl,{children:[w.jsx(Vl,{}),w.jsx(Yn,{}),w.jsx(Fl,{})]})]})}),{Component:Xl,useEmitter:Rn,useEmitterValue:Y,usePublisher:Pe}=$o(Ol,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",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"}},Kl),Yl=Do({useEmitter:Rn,useEmitterValue:Y,usePublisher:Pe}),Ql=Vo({useEmitter:Rn,useEmitterValue:Y,usePublisher:Pe}),Jl=Xl,Zl=se(()=>{const e=z(c=>w.jsxs("td",{children:["Item $",c]})),t=z(null),n=z(c=>w.jsxs("td",{colSpan:1e3,children:["Group ",c]})),o=z(null),r=z(null),l=z({}),s=z(Cn),i=z(pt),a=(c,f=null)=>je(T(l,$(p=>p[c]),ge()),f);return{components:l,computeItemKey:s,context:t,EmptyPlaceholder:a("EmptyPlaceholder"),FillerRow:a("FillerRow"),fixedFooterContent:r,fixedHeaderContent:o,itemContent:e,groupContent:n,ScrollerComponent:a("Scroller","div"),scrollerRef:i,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder"),TableBodyComponent:a("TableBody","tbody"),TableComponent:a("Table","table"),TableFooterComponent:a("TableFoot","tfoot"),TableHeadComponent:a("TableHead","thead"),TableRowComponent:a("TableRow","tr"),GroupComponent:a("Group","tr")}});ve(Oo,Zl);Sn();const Qn={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},ql={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Jn,floor:Vt,max:It,min:on,round:Zn}=Math;function qn(e,t,n){return Array.from({length:t-e+1}).map((o,r)=>({data:n===null?null:n[r+e],index:r+e}))}function es(e){return{...ql,items:e}}function Pt(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function ts(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}const ns=se(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:o},{footerHeight:r,headerHeight:l,scrollBy:s,scrollContainerState:i,scrollTo:a,scrollTop:c,smoothScrollTargetReached:f,viewportHeight:p},m,x,{didMount:R,propsReady:M},{customScrollParent:g,useWindowScroll:d,windowScrollContainerState:h,windowScrollTo:C,windowViewportRect:j},k])=>{const B=z(0),u=z(0),I=z(Qn),v=z({height:0,width:0}),O=z({height:0,width:0}),H=ne(),F=ne(),G=z(0),V=z(null),D=z({column:0,row:0}),q=ne(),ee=ne(),pe=z(!1),Ee=z(0),ye=z(!0),Se=z(!1),y=z(!1);ue(T(R,Z(Ee),K(([E,_])=>_!==0)),()=>{J(ye,!1)}),ue(T(Ce(R,ye,O,v,Ee,Se),K(([E,_,ie,de,,me])=>E&&!_&&ie.height!==0&&de.height!==0&&!me)),([,,,,E])=>{J(Se,!0),In(1,()=>{J(H,E)}),De(T(c),()=>{J(t,[0,0]),J(ye,!0)})}),W(T(ee,K(E=>E!=null&&E.scrollTop>0),Fe(0)),u),ue(T(R,Z(ee),K(([,E])=>E!=null)),([,E])=>{E&&(J(v,E.viewport),J(O,E.item),J(D,E.gap),E.scrollTop>0&&(J(pe,!0),De(T(c,ot(1)),_=>{J(pe,!1)}),J(a,{top:E.scrollTop})))}),W(T(v,$(({height:E})=>E)),p),W(T(Ce(U(v,Pt),U(O,Pt),U(D,(E,_)=>E!==void 0&&E.column===_.column&&E.row===_.row),U(c)),$(([E,_,ie,de])=>({gap:ie,item:_,scrollTop:de,viewport:E}))),q),W(T(Ce(U(B),o,U(D,ts),U(O,Pt),U(v,Pt),U(V),U(u),U(pe),U(ye),U(Ee)),K(([,,,,,,,E])=>!E),$(([E,[_,ie],de,me,ae,oe,ce,,xe,fe])=>{const{column:we,row:qe}=de,{height:ze,width:et}=me,{width:it}=ae;if(ce===0&&(E===0||it===0))return Qn;if(et===0){const b=bn(fe,E),L=b+Math.max(ce-1,0);return es(qn(b,L,oe))}const at=Fo(it,et,we);let We,Le;xe?_===0&&ie===0&&ce>0?(We=0,Le=ce-1):(We=at*Vt((_+qe)/(ze+qe)),Le=at*Jn((ie+qe)/(ze+qe))-1,Le=on(E-1,It(Le,at-1)),We=on(Le,It(0,We))):(We=0,Le=-1);const Mt=qn(We,Le,oe),{bottom:Ot,top:$t}=eo(ae,de,me,Mt),Xt=Jn(E/at),gt=Xt*ze+(Xt-1)*qe-Ot;return{bottom:Ot,itemHeight:ze,items:Mt,itemWidth:et,offsetBottom:gt,offsetTop:$t,top:$t}})),I),W(T(V,K(E=>E!==null),$(E=>E.length)),B),W(T(Ce(v,O,I,D),K(([E,_,{items:ie}])=>ie.length>0&&_.height!==0&&E.height!==0),$(([E,_,{items:ie},de])=>{const{bottom:me,top:ae}=eo(E,de,_,ie);return[ae,me]}),ge(St)),t);const P=z(!1);W(T(c,Z(P),$(([E,_])=>_||E!==0)),P);const X=$e(T(Ce(I,B),K(([{items:E}])=>E.length>0),Z(P),K(([[E,_],ie])=>{const de=E.items[E.items.length-1].index===_-1;return(ie||E.bottom>0&&E.itemHeight>0&&E.offsetBottom===0&&E.items.length===_)&&de}),$(([[,E]])=>E-1),ge())),A=$e(T(U(I),K(({items:E})=>E.length>0&&E[0].index===0),Fe(0),ge())),Q=$e(T(U(I),Z(pe),K(([{items:E},_])=>E.length>0&&!_),$(([{items:E}])=>({endIndex:E[E.length-1].index,startIndex:E[0].index})),ge(bo),Ue(0)));W(Q,x.scrollSeekRangeChanged),W(T(H,Z(v,O,B,D),$(([E,_,ie,de,me])=>{const ae=Ro(E),{align:oe,behavior:ce,offset:xe}=ae;let fe=ae.index;fe==="LAST"&&(fe=de-1),fe=It(0,fe,on(de-1,fe));let we=fn(_,me,ie,fe);return oe==="end"?we=Zn(we-_.height+ie.height):oe==="center"&&(we=Zn(we-_.height/2+ie.height/2)),xe!==void 0&&xe!==0&&(we+=xe),{behavior:ce,top:we}})),a);const le=je(T(I,$(E=>E.offsetBottom+E.bottom)),0);return W(T(j,$(E=>({height:E.visibleHeight,width:E.visibleWidth}))),v),{customScrollParent:g,data:V,deviation:G,footerHeight:r,gap:D,headerHeight:l,increaseViewportBy:e,initialItemCount:u,itemDimensions:O,overscan:n,restoreStateFrom:ee,scrollBy:s,scrollContainerState:i,scrollHeight:F,scrollTo:a,scrollToIndex:H,scrollTop:c,smoothScrollTargetReached:f,totalCount:B,useWindowScroll:d,viewportDimensions:v,windowScrollContainerState:h,windowScrollTo:C,windowViewportRect:j,...x,gridState:I,horizontalDirection:y,initialTopMostItemIndex:Ee,totalListHeight:le,...m,endReached:X,propsReady:M,rangeChanged:Q,startReached:A,stateChanged:q,stateRestoreInProgress:pe,...k}},ve(Tn,Me,Bt,Bo,Ze,yn,Je));function Fo(e,t,n){return It(1,Vt((e+n)/(Vt(t)+n)))}function eo(e,t,n,o){const{height:r}=n;if(r===void 0||o.length===0)return{bottom:0,top:0};const l=fn(e,t,n,o[0].index);return{bottom:fn(e,t,n,o[o.length-1].index)+r,top:l}}function fn(e,t,n,o){const r=Fo(e.width,n.width,t.column),l=Vt(o/r),s=l*n.height+It(0,l-1)*t.row;return s>0?s+t.row:s}const os=se(()=>{const e=z(p=>`Item ${p}`),t=z({}),n=z(null),o=z("virtuoso-grid-item"),r=z("virtuoso-grid-list"),l=z(Cn),s=z("div"),i=z(pt),a=(p,m=null)=>je(T(t,$(x=>x[p]),ge()),m),c=z(!1),f=z(!1);return W(U(f),c),{components:t,computeItemKey:l,context:n,FooterComponent:a("Footer"),HeaderComponent:a("Header"),headerFooterTag:s,itemClassName:o,ItemComponent:a("Item","div"),itemContent:e,listClassName:r,ListComponent:a("List","div"),readyStateChanged:c,reportReadyState:f,ScrollerComponent:a("Scroller","div"),scrollerRef:i,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder","div")}}),rs=se(([e,t])=>({...e,...t}),ve(ns,os)),ls=N.memo(function(){const e=Ie("gridState"),t=Ie("listClassName"),n=Ie("itemClassName"),o=Ie("itemContent"),r=Ie("computeItemKey"),l=Ie("isSeeking"),s=Ne("scrollHeight"),i=Ie("ItemComponent"),a=Ie("ListComponent"),c=Ie("ScrollSeekPlaceholder"),f=Ie("context"),p=Ne("itemDimensions"),m=Ne("gap"),x=Ie("log"),R=Ie("stateRestoreInProgress"),M=Ne("reportReadyState"),g=lt(N.useMemo(()=>d=>{const h=d.parentElement.parentElement.scrollHeight;s(h);const C=d.firstChild;if(C!==null){const{height:j,width:k}=C.getBoundingClientRect();p({height:j,width:k})}m({column:to("column-gap",getComputedStyle(d).columnGap,x),row:to("row-gap",getComputedStyle(d).rowGap,x)})},[s,p,m,x]),!0,!1);return Po(()=>{e.itemHeight>0&&e.itemWidth>0&&M(!0)},[e]),R?null:w.jsx(a,{className:t,ref:g,...He(a,f),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(d=>{const h=r(d.index,d.data,f);return l?w.jsx(c,{...He(c,f),height:e.itemHeight,index:d.index,width:e.itemWidth},h):S.createElement(i,{...He(i,f),className:n,"data-index":d.index,key:h},o(d.index,d.data,f))})})}),ss=N.memo(function(){const e=Ie("HeaderComponent"),t=Ne("headerHeight"),n=Ie("headerFooterTag"),o=lt(N.useMemo(()=>l=>{t(Xe(l,"height"))},[t]),!0,!1),r=Ie("context");return e!=null?w.jsx(n,{ref:o,children:w.jsx(e,{...He(e,r)})}):null}),is=N.memo(function(){const e=Ie("FooterComponent"),t=Ne("footerHeight"),n=Ie("headerFooterTag"),o=lt(N.useMemo(()=>l=>{t(Xe(l,"height"))},[t]),!0,!1),r=Ie("context");return e!=null?w.jsx(n,{ref:o,children:w.jsx(e,{...He(e,r)})}):null}),as=({children:e})=>{const t=N.useContext(Ao),n=Ne("itemDimensions"),o=Ne("viewportDimensions"),r=lt(N.useMemo(()=>l=>{o(l.getBoundingClientRect())},[o]),!0,!1);return N.useEffect(()=>{t&&(o({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,o,n]),w.jsx("div",{ref:r,style:Kt(!1),children:e})},cs=({children:e})=>{const t=N.useContext(Ao),n=Ne("windowViewportRect"),o=Ne("itemDimensions"),r=Ie("customScrollParent"),l=po(n,r,!1);return N.useEffect(()=>{t&&(o({height:t.itemHeight,width:t.itemWidth}),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,o]),w.jsx("div",{ref:l,style:Kt(!1),children:e})},us=N.memo(function({...e}){const t=Ie("useWindowScroll"),n=Ie("customScrollParent"),o=n||t?fs:ds,r=n||t?cs:as,l=Ie("context");return w.jsx(o,{...e,...He(o,l),children:w.jsxs(r,{children:[w.jsx(ss,{}),w.jsx(ls,{}),w.jsx(is,{})]})})}),{useEmitter:Go,useEmitterValue:Ie,usePublisher:Ne}=$o(rs,{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"}},us),ds=Do({useEmitter:Go,useEmitterValue:Ie,usePublisher:Ne}),fs=Vo({useEmitter:Go,useEmitterValue:Ie,usePublisher:Ne});function to(e,t,n){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&n(`${e} was not resolved to pixel value correctly`,t,ke.WARN),t==="normal"?0:parseInt(t??"0",10)}const no=15,hs=3e3;function Cs({items:e,itemContent:t,title:n,description:o,emptyMessage:r,loadOlderItems:l,loadNewerItems:s,panelName:i}){const a=S.useRef(null),[c,f]=S.useState(1e8),p=S.useRef([]),[m,x]=S.useState(!0),[R,M]=S.useState(!0),g=S.useRef(s),d=S.useRef(!1);S.useEffect(()=>{g.current=s},[s]),S.useEffect(()=>{var B,u;const j=p.current;let k=0;e.length>j.length&&j.length>0&&((B=e[0])==null?void 0:B._id)!==((u=j[0])==null?void 0:u._id)&&(k=e.length-j.length,f(I=>I-k)),p.current=e},[e,i]),S.useEffect(()=>{if(e.length<=no||R){const k=setInterval(()=>{d.current||(d.current=!0,g.current().finally(()=>{d.current=!1}))},hs);return()=>clearInterval(k)}},[e.length,R,i]);const h=async()=>{await l()},C=async()=>{e.length<=no||R||await s()};return w.jsx(ir,{isOpen:m,onToggle:()=>x(j=>!j),header:w.jsxs(w.Fragment,{children:[w.jsx(rr,{children:n}),w.jsx(lr,{children:o})]}),children:e.length===0?w.jsx("div",{className:"py-10 text-center text-sm text-muted-foreground",children:r}):w.jsx(Jl,{ref:a,firstItemIndex:c,style:{height:"70vh"},data:e,initialTopMostItemIndex:e.length-1,itemContent:(j,k)=>t(j,k),startReached:h,endReached:C,atBottomStateChange:M})})}export{Ss as C,Dr as M,dr as S,Cs as V};