virtua 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ![npm](https://img.shields.io/npm/v/virtua) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/virtua) ![npm](https://img.shields.io/npm/dw/virtua) [![check](https://github.com/inokawa/virtua/actions/workflows/check.yml/badge.svg)](https://github.com/inokawa/virtua/actions/workflows/check.yml) [![demo](https://github.com/inokawa/virtua/actions/workflows/demo.yml/badge.svg)](https://github.com/inokawa/virtua/actions/workflows/demo.yml)
4
4
 
5
- > A zero-config, fast and small (~3kB) virtual list and grid component for [React](https://github.com/facebook/react).
5
+ > A zero-config, fast and small (~3kB) virtual list (and grid) component for [React](https://github.com/facebook/react).
6
6
 
7
7
  ![example](./example.gif)
8
8
 
@@ -15,7 +15,7 @@ This project is a challenge to rethink virtualization. The goals are...
15
15
  - **Zero-config virtualization:** This library is designed to give the best performance without configuration. It also handles common hard things in the real world (dynamic size measurement, scroll position adjustment while reverse scrolling and imperative scrolling, etc).
16
16
  - **Fast:** Scrolling without frame drop needs optimization in many aspects (reduce CPU usage, reduce GC, [reduce layout recalculation](https://gist.github.com/paulirish/5d52fb081b3570c81e3a), optimize with CSS, optimize for frameworks, etc). We are trying to combine the best of them.
17
17
  - **Small:** Its bundle size should be small as much as possible to be friendly with modern web development. Currently each components are ~3kB gzipped and the total is [~5kB gzipped](https://bundlephobia.com/package/virtua).
18
- - **Flexible:** Aiming to support many usecases - fixed size, dynamic size, horizontal scrolling, reverse scrolling, rtl direction, sticky, infinite scrolling, placeholder, scrollTo, scroll restoration, dnd, table, and more. See [live demo](#demo).
18
+ - **Flexible:** Aiming to support many usecases - fixed size, dynamic size, horizontal scrolling, reverse scrolling, RTL, mobile, sticky, infinite scrolling, placeholder, scrollTo, scroll restoration, DnD, table, and more. See [live demo](#demo).
19
19
  - **Framework agnostic (WIP):** Currently only for [React](https://react.dev/) but we could support [Vue](https://vuejs.org/), [Svelte](https://svelte.dev/), [Solid](https://www.solidjs.com/), [Angular](https://angular.io/), [Web Components](https://developer.mozilla.org/en-US/docs/Web/API/Web_components) and more in the future.
20
20
 
21
21
  ## Demo
@@ -198,26 +198,26 @@ It may be dispatched by ResizeObserver in this lib [as described in spec](https:
198
198
 
199
199
  ### Features
200
200
 
201
- | | [virtua](https://github.com/inokawa/virtua) | [react-virtuoso](https://github.com/petyosi/react-virtuoso) | [react-window](https://github.com/bvaughn/react-window) | [react-virtualized](https://github.com/bvaughn/react-virtualized) | [@tanstack/react-virtual](https://github.com/TanStack/virtual) | [react-cool-virtual](https://github.com/wellyshen/react-cool-virtual) |
202
- | :------------------------------------------------- | :------------------------------------------------------- | :---------------------------------------------------------------- | :------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------ | :-------------------------------------------------------------------- |
203
- | Bundle size | [5.0kB gzipped](https://bundlephobia.com/package/virtua) | [16.9kB gzipped](https://bundlephobia.com/package/react-virtuoso) | [6.4kB gzipped](https://bundlephobia.com/package/react-window) | [27.3kB gzipped](https://bundlephobia.com/package/react-virtualized) | [2.3kB gzipped](https://bundlephobia.com/package/@tanstack/react-virtual) | [3.1kB gzipped](https://bundlephobia.com/package/react-cool-virtual) |
204
- | Vertical scroll | ✅ | ✅ | ✅ | ✅ | 🟠 (needs customization) | 🟠 (needs customization) |
205
- | Horizontal scroll | ✅ | ❌ | ✅ | ✅ | 🟠 (needs customization) | 🟠 (needs customization) |
206
- | Grid (Virtualization for two dimension) | ✅ (VGrid) | ❌ | ✅ (FixedSizeGrid / VariableSizeGrid) | ✅ ([Grid](https://github.com/bvaughn/react-virtualized/blob/master/docs/Grid.md)) | 🟠 (needs customization) | 🟠 (needs customization) |
207
- | Table | 🟠 (needs customization) | ✅ (TableVirtuoso) | 🟠 (needs customization) | ✅ ([Table](https://github.com/bvaughn/react-virtualized/blob/master/docs/Table.md)) | 🟠 (needs customization) | 🟠 (needs customization) |
208
- | Window scroller | ✅ (WVList) | ✅ | ❌ | ✅ ([WindowScroller](https://github.com/bvaughn/react-virtualized/blob/master/docs/WindowScroller.md)) | ✅ | ❌ |
209
- | Dynamic list size | ✅ | ✅ | 🟠 (needs [AutoSizer](https://github.com/bvaughn/react-virtualized/blob/master/docs/AutoSizer.md)) | 🟠 (needs [AutoSizer](https://github.com/bvaughn/react-virtualized/blob/master/docs/AutoSizer.md)) | ✅ | ✅ |
210
- | Dynamic item size | ✅ | ✅ | 🟠 (needs additional codes and has wrong destination when scrolling to item imperatively) | 🟠 (needs [CellMeasurer](https://github.com/bvaughn/react-virtualized/blob/master/docs/CellMeasurer.md) and has wrong destination when scrolling to item imperatively) | 🟠 (has wrong destination when scrolling to item imperatively) | 🟠 (has wrong destination when scrolling to item imperatively) |
211
- | Reverse scroll | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
212
- | Reverse scroll in iOS Safari | | | ❌ | ❌ | ❌ | ❌ |
213
- | Infinite scroll | ✅ | ✅ | 🟠 (needs [react-window-infinite-loader](https://github.com/bvaughn/react-window-infinite-loader)) | 🟠 (needs [InfiniteLoader](https://github.com/bvaughn/react-virtualized/blob/master/docs/InfiniteLoader.md)) | ✅ | ✅ |
214
- | Reverse (bi-directional) infinite scroll | ✅ | ✅ | ❌ | ❌ | ❌ | 🟠 (has startItem method but its scroll position can be inaccurate) |
215
- | Scroll restoration | ✅ | ✅ (getState) | ❌ | ❌ | ❌ | ❌ |
216
- | Smooth scroll | ❌ | ✅ | ❌ | ❌ | ✅ | ✅ |
217
- | RTL support | ✅ | ❌ | ✅ | ❌ | ❌ | ❌ |
218
- | SSR support | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
219
- | Render React Server Components (RSC) as children | ✅ | ❌ | ❌ | ❌ | 🟠(needs customization) | 🟠 (needs customization) |
220
- | Display exceeding browser's max element size limit | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ |
201
+ | | [virtua](https://github.com/inokawa/virtua) | [react-virtuoso](https://github.com/petyosi/react-virtuoso) | [react-window](https://github.com/bvaughn/react-window) | [react-virtualized](https://github.com/bvaughn/react-virtualized) | [@tanstack/react-virtual](https://github.com/TanStack/virtual) | [react-cool-virtual](https://github.com/wellyshen/react-cool-virtual) |
202
+ | :------------------------------------------------- | :------------------------------------------------------- | :----------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------ | :-------------------------------------------------------------------- |
203
+ | Bundle size | [5.0kB gzipped](https://bundlephobia.com/package/virtua) | [16.9kB gzipped](https://bundlephobia.com/package/react-virtuoso) | [6.4kB gzipped](https://bundlephobia.com/package/react-window) | [27.3kB gzipped](https://bundlephobia.com/package/react-virtualized) | [2.3kB gzipped](https://bundlephobia.com/package/@tanstack/react-virtual) | [3.1kB gzipped](https://bundlephobia.com/package/react-cool-virtual) |
204
+ | Vertical scroll | ✅ | ✅ | ✅ | ✅ | 🟠 (needs customization) | 🟠 (needs customization) |
205
+ | Horizontal scroll | ✅ | ❌ | ✅ ([may be dropped in v2](https://github.com/bvaughn/react-window/issues/302)) | ✅ | 🟠 (needs customization) | 🟠 (needs customization) |
206
+ | Grid (Virtualization for two dimension) | ✅ (VGrid) | ❌ | ✅ (FixedSizeGrid / VariableSizeGrid) | ✅ ([Grid](https://github.com/bvaughn/react-virtualized/blob/master/docs/Grid.md)) | 🟠 (needs customization) | 🟠 (needs customization) |
207
+ | Table | 🟠 (needs customization) | ✅ (TableVirtuoso) | 🟠 (needs customization) | ✅ ([Table](https://github.com/bvaughn/react-virtualized/blob/master/docs/Table.md)) | 🟠 (needs customization) | 🟠 (needs customization) |
208
+ | Window scroller | ✅ (WVList) | ✅ | ❌ | ✅ ([WindowScroller](https://github.com/bvaughn/react-virtualized/blob/master/docs/WindowScroller.md)) | ✅ | ❌ |
209
+ | Dynamic list size | ✅ | ✅ | 🟠 (needs [AutoSizer](https://github.com/bvaughn/react-virtualized/blob/master/docs/AutoSizer.md)) | 🟠 (needs [AutoSizer](https://github.com/bvaughn/react-virtualized/blob/master/docs/AutoSizer.md)) | ✅ | ✅ |
210
+ | Dynamic item size | ✅ | ✅ | 🟠 (needs additional codes and has wrong destination when scrolling to item imperatively) | 🟠 (needs [CellMeasurer](https://github.com/bvaughn/react-virtualized/blob/master/docs/CellMeasurer.md) and has wrong destination when scrolling to item imperatively) | 🟠 (has wrong destination when scrolling to item imperatively) | 🟠 (has wrong destination when scrolling to item imperatively) |
211
+ | Reverse scroll | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
212
+ | Reverse scroll in iOS Safari | | 🟠 ([has glitch with unknown sized items](https://github.com/petyosi/react-virtuoso/issues/945)) | ❌ | ❌ | ❌ | ❌ |
213
+ | Infinite scroll | ✅ | ✅ | 🟠 (needs [react-window-infinite-loader](https://github.com/bvaughn/react-window-infinite-loader)) | 🟠 (needs [InfiniteLoader](https://github.com/bvaughn/react-virtualized/blob/master/docs/InfiniteLoader.md)) | ✅ | ✅ |
214
+ | Reverse (bi-directional) infinite scroll | ✅ | ✅ | ❌ | ❌ | ❌ | 🟠 (has startItem method but its scroll position can be inaccurate) |
215
+ | Scroll restoration | ✅ | ✅ (getState) | ❌ | ❌ | ❌ | ❌ |
216
+ | Smooth scroll | ❌ | ✅ | ❌ | ❌ | ✅ | ✅ |
217
+ | RTL support | ✅ | ❌ | ✅ ([may be dropped in v2](https://github.com/bvaughn/react-window/issues/302)) | ❌ | ❌ | ❌ |
218
+ | SSR support | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
219
+ | Render React Server Components (RSC) as children | ✅ | ❌ | ❌ | ❌ | 🟠(needs customization) | 🟠 (needs customization) |
220
+ | Display exceeding browser's max element size limit | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ |
221
221
 
222
222
  - ✅ - Built-in supported
223
223
  - 🟠 - Supported but partial, limited or requires some user custom code
@@ -1,3 +1,4 @@
1
1
  export declare const isBrowser: boolean;
2
2
  export declare const hasNegativeOffsetInRTL: (scrollable: HTMLElement) => boolean;
3
3
  export declare const isRTLDocument: () => boolean;
4
+ export declare const isIOSWebKit: () => boolean;
@@ -1,6 +1,6 @@
1
1
  import { Cache } from "./cache";
2
2
  import type { CacheSnapshot } from "./types";
3
- export type ScrollJump = Readonly<number>;
3
+ export type ScrollJump = number;
4
4
  export type ItemResize = Readonly<[index: number, size: number]>;
5
5
  type ItemsRange = Readonly<[startIndex: number, endIndex: number]>;
6
6
  export declare const SCROLL_IDLE = 0;
@@ -18,12 +18,10 @@ type Actions = [type: typeof ACTION_ITEM_RESIZE, entries: ItemResize[]] | [type:
18
18
  type: typeof ACTION_ITEMS_LENGTH_CHANGE,
19
19
  arg: [length: number, isShift?: boolean | undefined]
20
20
  ] | [type: typeof ACTION_SCROLL, offset: number] | [type: typeof ACTION_BEFORE_MANUAL_SCROLL, offset: number] | [type: typeof ACTION_SCROLL_END, dummy?: void] | [type: typeof ACTION_MANUAL_SCROLL, dummy?: void];
21
- type Subscriber = () => void;
22
- export declare const UPDATE_SCROLL = 1;
23
- export declare const UPDATE_SIZE = 2;
24
- export declare const UPDATE_JUMP = 4;
25
- export declare const UPDATE_SCROLL_DIRECTION = 8;
26
- export declare const UPDATE_SCROLL_WITH_EVENT = 16;
21
+ type Subscriber = (sync?: boolean) => void;
22
+ export declare const UPDATE_SCROLL_STATE = 1;
23
+ export declare const UPDATE_SIZE_STATE = 2;
24
+ export declare const UPDATE_SCROLL_WITH_EVENT = 4;
27
25
  export type VirtualStore = {
28
26
  _getCache(): CacheSnapshot;
29
27
  _getRange(): ItemsRange;
@@ -42,5 +40,5 @@ export type VirtualStore = {
42
40
  _subscribe(target: number, cb: Subscriber): () => void;
43
41
  _update(...action: Actions): void;
44
42
  };
45
- export declare const createVirtualStore: (flushSync: (cb: () => void) => void, elementsCount: number, itemSize?: number, initialItemCount?: number, cache?: Cache, isReverse?: boolean, shouldAutoEstimateItemSize?: boolean) => VirtualStore;
43
+ export declare const createVirtualStore: (elementsCount: number, itemSize?: number, initialItemCount?: number, cache?: Cache, isReverse?: boolean, shouldAutoEstimateItemSize?: boolean) => VirtualStore;
46
44
  export {};
package/lib/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- var e=require("react/jsx-runtime"),t=require("react"),n=require("react-dom");const r=Math.min,o=Math.max,s=Math.abs,i=Date.now,c=Object.values,l=Array.isArray,u=setTimeout,a=(e,t,n)=>r(n,o(t,e)),d=e=>null!=e,h=(e,t)=>{let n;const r=()=>{d(n)&&clearTimeout(n)},o=()=>{r(),n=u((()=>{n=null,e()}),t)};return o.t=r,o},f=e=>{let t,n;return(...r)=>(t||(t=!0,n=e(...r)),n)},_=e=>getComputedStyle(e),w=e=>e?parseFloat(e):0,g=-1,p=(e,t)=>{const n=e.o[t];return n===g?e.i:n},m=(e,t)=>{if(!e.l)return 0;if(e.u>=t)return e.h[t];let n=e.u,r=e.h[n];for(;n<t;)r+=p(e,n),e.h[++n]=r;return e.u=t,r},v=(e,t,n)=>{let r=m(e,n);for(;n>=0&&n<e.l;)if(r<=t){const o=p(e,n);if(r+o>t)break;r+=o,n++}else r-=p(e,--n);return a(n,0,e.l-1)},b=(e,t,n,o)=>{const s=v(e,t,r(n,e.l-1));return[s,v(e,t+o,s)]},S=(e,t,n)=>{const r=n?"unshift":"push";for(let n=e.l;n<t;n++)e.o[r](g),e.h.push(0===n?0:g);e.l=t},I=(e,t,n)=>{const r=t-e.l,o=r<0;let s;return o?(s=(n?e.o.splice(0,-r):e.o.splice(r)).reduce(((t,n)=>t+(n===g?e.i:n)),0),e.h.splice(r)):(s=e.i*r,S(e,e.l+r,n)),e.u=n?0:a(t-1,0,e.u),e.l=t,[s,o]},z=(e,t,n)=>t.reduce(((t,[r,o])=>{const s=o-p(e,r);return(!n||s>0)&&(t+=s),t}),0),x=(e,t,n=40,i=0,c=((e,t)=>{const n={i:t,l:0,u:0,o:[],h:[]};return S(n,e),n})(t,n),l,u)=>{let d=n*o(i-1,0),h=0,f=0,_=0,w=0,v=!1,x=!1,y=!1,R=[0,i];const k=new Set,O=()=>(e=>e.l?m(e,e.l-1)+p(e,e.l-1):0)(c),C=()=>O()-d,T=e=>a(e,0,C()),M=e=>{const t=w;return w=e,w!==t};return{_:()=>JSON.parse(JSON.stringify(c)),g(){const[e,t]=R,[n,r]=b(c,h,e,d);return e===n&&t===r?R:R=[n,r]},p:e=>c.o[e]===g,m(e){const[t,n]=b(c,e,R[0],d);return((e,t,n)=>e.o.slice(o(0,t-1),r(e.l-1,n+1)+1).includes(g))(c,t,n)},v(e){const t=m(c,e);return l?t+o(0,d-O()):t},S:e=>p(c,e),I:()=>c.l,R:()=>h,k:C,O:()=>w,C:()=>d,T:()=>o(O(),d),M:()=>f,H(){const e=_;return _=0,e},J(e,t){const n=[e,t];return k.add(n),()=>{k.delete(n)}},W(t,n){let o,i=0;switch(t){case 1:{const e=n.filter((([e,t])=>c.o[e]!==t));if(!e.length)break;let t=0;if(!v){const[n]=R;0===h||(t=h>C()-1.5?z(c,e,!0):z(c,e.filter((([e])=>e<n))))}t&&(_=t,f++,i+=4);let s=!1;e.forEach((([e,t])=>{((e,t,n)=>{const o=e.o[t]===g;return e.o[t]=n,e.u=r(t,e.u),o})(c,e,t)&&(s=!0)})),u&&s&&!h&&(e=>{const t=e.o.filter((e=>e!==g)),n=t[0];e.i=t.every((e=>e===n))?n:(e=>{const t=[...e].sort(((e,t)=>e-t)),n=e.length/2|0;return t.length%2==0?(t[n-1]+t[n])/2:t[n]})(t)})(c),i+=2,y=o=!0;break}case 2:d!==n&&(d=n,i=2);break;case 3:if(n[1]){const e=C()-h,[t,o]=I(c,n[0],!0),s=o?-r(t,e):t;_+=s,h=T(h+s),f++,i=5}else I(c,n[0]);break;case 4:case 5:if(h===n)break;if(4===t){const e=n-h,t=y;y=!1,0!==w&&t||x||M(e<0?2:1)&&(i+=8),o=s(e)>d,i+=16}else v=!0;h=T(n),i+=1;break;case 6:M(0)&&(i=8),x=v=!1;break;case 7:v=!1,x=!0}if(i){const t=()=>{k.forEach((([e,t])=>{i&e&&t()}))};o?e(t):t()}}}},y="undefined"!=typeof window,R=/*#__PURE__*/f((e=>{const t="scrollLeft",n=e[t];e[t]=1;const r=e[t]<1;return e[t]=n,r})),k=/*#__PURE__*/f((()=>!!y&&"rtl"===_(document.body).direction)),O=y?t.useLayoutEffect:t.useEffect,C="current",T={},M=(e,t)=>{if(l(e))for(const n of e)M(n,t);else d(e)&&"boolean"!=typeof e&&t.push(e)},H=e=>{const t=[];return M(e,t),t},J=(e,t,n)=>o(e-(1===n?1:o(1,t)),0),W=(e,t,n,s)=>r(e+(2===n?1:o(1,t)),s-1),L=e=>{const n=t.useRef(e);return O((()=>{n[C]=e}),[e]),n},$=(e,n,r,o)=>{const[s,i]=t.useState(n),c=L(n);if(O((()=>e.J(r,(()=>{i((()=>c[C]()))}))),[]),o){const e=n();s!==e&&i(e)}return s},q=(e,t,n)=>(()=>{let r=i()-50;return(...o)=>{const s=i();r+50<s&&(r=s,(r=>{if(0!==e.O()&&!r.ctrlKey&&(t?r.deltaX:r.deltaY)){const t=e.R();t>0&&t<e.k()&&n()}})(...o))}})(),B=(e,t,n,r)=>R(e)||r?-n:t.k()-n,j=(e,t)=>{let n,r;const o=t?"scrollLeft":"scrollTop",s=(r,o)=>t&&k()?B(n,e,r,o):r,i=async t=>{if(!n)return;const i=()=>a(t(),0,e.k());for(;;){const t=i();if(e.W(5,t),!e.m(t))break;r&&r[1]();const n=e.J(2,(()=>{r&&r[0]()}));try{await new Promise(((e,t)=>{let n=!1;const o=()=>{n||(n=!0,e(),r=void 0)};r=[o,t],u(o,250)}))}catch(e){return}finally{n()}}n[o]=s(i()),e.W(7)};return{L(r){n=r;const i=()=>{e.W(4,s(r[o]))},c=h((()=>{i(),e.W(6)}),150),l=()=>{i(),c()},u=q(e,t,c);return r.addEventListener("scroll",l),r.addEventListener("wheel",u,{passive:!0}),()=>{r.removeEventListener("scroll",l),r.removeEventListener("wheel",u),c.t()}},$(e){i((()=>e))},q(t){t+=e.R(),i((()=>t))},B(t,n){t=a(t,0,e.I()-1),i("end"===n?()=>e.v(t)+e.S(t)-e.C():()=>e.v(t))},j:e=>{n&&(n[o]+=s(e,!0))}}},D=(e,t)=>{let n;const r=t?"scrollX":"scrollY",o=t?"offsetLeft":"offsetTop",s=(r,o)=>t&&k()?B(n,e,r,o):r;return{L(i){n=i;let c=!1;const l=(e,n)=>{const r=n+(t&&k()?window.innerWidth-e[o]-e.offsetWidth:e[o]),s=e.offsetParent;return e!==document.body&&s?l(s,r):r},u=()=>{c&&e.W(4,s(window[r])-l(i,0))},a=h((()=>{u(),e.W(6)}),150),d=()=>{u(),a()},f=q(e,t,a),_=new IntersectionObserver((([e])=>{c=e.isIntersecting}));return _.observe(i),window.addEventListener("scroll",d),window.addEventListener("wheel",f,{passive:!0}),()=>{_.disconnect(),window.removeEventListener("scroll",d),window.removeEventListener("wheel",f),a.t()}},j:e=>{window.scrollBy(t?s(e,!0):0,t?0:e)}}},N=e=>{const n=t.useRef();return n[C]||(n[C]=e())},U={box:"border-box"},V=(e,t)=>{let n;const r=t?"width":"height",o=new WeakMap,s=f((()=>new ResizeObserver((s=>{const i=[];for(const{target:c,contentRect:l}of s)if(c.offsetParent)if(c===n)e.W(2,l[r]+l[t?"left":"top"]+w(_(n)[t?"paddingRight":"paddingBottom"]));else{const e=o.get(c);d(e)&&i.push([e,l[r]])}i.length&&e.W(1,i)}))));return{D(e){n=e;const t=s();return t.observe(e,U),()=>{t.disconnect()}},N(e,t){const n=s();return o.set(e,t),n.observe(e),()=>{o.delete(e),n.unobserve(e)}}}},A=(e,t)=>{const n=t?"width":"height",r=t?"innerWidth":"innerHeight",o=new WeakMap,s=f((()=>new ResizeObserver((t=>{const r=[];for(const{target:e,contentRect:s}of t){if(!e.offsetParent)continue;const t=o.get(e);d(t)&&r.push([t,s[n]])}r.length&&e.W(1,r)}))));return{D(){const t=()=>{e.W(2,window[r])};return window.addEventListener("resize",t),t(),()=>{window.removeEventListener("resize",t),s().disconnect()}},N(e,t){const n=s();return o.set(e,t),n.observe(e),()=>{o.delete(e),n.unobserve(e)}}}},E=(e,t)=>{let n;const r="height",s="width",i=new WeakMap,c=new Set,l=new Set,u=new Map,a=(e,t)=>`${e}-${t}`,d=f((()=>new ResizeObserver((d=>{const h=new Set,f=new Set;for(const{target:o,contentRect:c}of d)if(o.offsetParent)if(o===n){const o=_(n);e.W(2,c[r]+c.top+w(o.paddingBottom)),t.W(2,c[s]+c.left+w(o.paddingRight))}else{const e=i.get(o);if(e){const[t,n]=e,o=a(t,n),i=u.get(o),l=[c[r],c[s]];let d,_;i?(i[0]!==l[0]&&(d=!0),i[1]!==l[1]&&(_=!0)):d=_=!0,d&&h.add(t),_&&f.add(n),(d||_)&&u.set(o,l)}}if(h.size){const t=[];h.forEach((e=>{let n=0;l.forEach((t=>{const r=u.get(a(e,t));r&&(n=o(n,r[0]))})),n&&t.push([e,n])})),e.W(1,t)}if(f.size){const e=[];f.forEach((t=>{let n=0;c.forEach((e=>{const r=u.get(a(e,t));r&&(n=o(n,r[1]))})),n&&e.push([t,n])})),t.W(1,e)}}))));return{D(e){n=e;const t=d();return t.observe(e,U),()=>{t.disconnect()}},N(e,t,n){const r=d();return i.set(e,[t,n]),c.add(t),l.add(n),r.observe(e),()=>{i.delete(e),r.unobserve(e)}}}},F=t.forwardRef((({children:n,attrs:r,width:o,height:s,scrolling:i},c)=>e.jsx("div",{ref:c,...r,children:e.jsx("div",{style:t.useMemo((()=>({position:"relative",visibility:"hidden",width:null!=o?o:"100%",height:null!=s?s:"100%",pointerEvents:i?"none":"auto"})),[o,s,i]),children:n})}))),P=t.memo((({U:n,V:r,A:o,F:s,P:i,X:c})=>{const l=t.useRef(null),u=$(o,(()=>o.v(s)),2,!0),a=$(o,(()=>o.p(s)),2,!0);return O((()=>r.N(l[C],s)),[s]),e.jsx(i,{ref:l,style:t.useMemo((()=>{const e=k()?"right":"left",t={margin:0,padding:0,position:"absolute",[c?"height":"width"]:"100%",[c?"top":e]:0,[c?e:"top"]:u,visibility:a?"hidden":"visible"};return c&&(t.display="flex"),t}),[u,a]),children:n})})),X=t.forwardRef((({children:r,overscan:o=4,initialItemSize:s,initialItemCount:i,shift:l,horizontal:u,reverse:a,cache:h,components:{Root:f=F,Item:_="div"}=T,onScroll:w,onScrollStop:g,onRangeChange:p,...m},v)=>{const b=t.useMemo((()=>H(r)),[r]),S=b.length,I=L(w),z=L(g),[y,R,k,M]=N((()=>{const e=!!u,t=x(n.flushSync,S,s,i,h,!!a,!s);return[t,V(t,e),j(t,e),e]}));S!==y.I()&&y.W(3,[S,l]);const[q,B]=$(y,y.g,3),D=$(y,y.O,8),U=$(y,y.M,4),A=$(y,y.T,2,!0),E=t.useRef(null),X=0!==D;O((()=>{const e=E[C],t=R.D(e),n=k.L(e),r=y.J(16,(()=>{I[C]&&I[C](y.R())}));return()=>{t(),n(),r()}}),[]),O((()=>{const e=y.H();e&&k.j(e)}),[U]),t.useEffect((()=>{X||z[C]&&z[C]()}),[X]),t.useEffect((()=>{p&&p(q,B)}),[q,B]),t.useImperativeHandle(v,(()=>({get cache(){return y._()},get scrollOffset(){return y.R()},get scrollSize(){return y.T()},get viewportSize(){return y.C()},scrollToIndex:k.B,scrollTo:k.$,scrollBy:k.q})),[]);const Y=J(q,o,D),G=W(B,o,D,S),K=t.useMemo((()=>{const t=[];for(let n=Y;n<=G;n++){const r=b[n],o=r.key;t.push(e.jsx(P,{V:R,A:y,F:n,P:_,U:r,X:M},d(o)?o:"_"+n))}return t}),[b,Y,G]);return e.jsx(f,{ref:E,width:M?A:void 0,height:M?void 0:A,scrolling:X,attrs:t.useMemo((()=>({...m,style:{overflow:"auto",display:M?"inline-block":"block",contain:"strict",width:"100%",height:"100%",...m.style}})),c(m)),children:K})})),Y=(e,t)=>`${e}-${t}`,G=t.memo((({U:n,V:r,Y:o,G:s,K:i,Z:c,P:l})=>{const u=t.useRef(null),a=$(o,(()=>o.v(i)),2,!0),d=$(s,(()=>s.v(c)),2,!0),h=$(o,(()=>o.p(i)),2,!0),f=$(s,(()=>s.p(c)),2,!0),_=$(o,(()=>o.S(i)),2,!0),w=$(s,(()=>s.S(c)),2,!0);return O((()=>r.N(u[C],i,c)),[c,i]),e.jsx(l,{ref:u,style:t.useMemo((()=>({display:"grid",margin:0,padding:0,position:"absolute",top:a,[k()?"right":"left"]:d,visibility:h||f?"hidden":"visible",minHeight:_,minWidth:w})),[a,d,w,_,h,f]),children:n})})),K=t.forwardRef((({children:r,row:o,col:s,cellHeight:i=40,cellWidth:l=100,overscan:u=2,initialRowCount:a,initialColCount:d,components:{Root:h=F,Cell:f="div"}=T,..._},w)=>{const[g,p,m,v,b]=N((()=>{const e=x(n.flushSync,o,i,a),t=x(n.flushSync,s,l,d);return[e,t,E(e,t),j(e,!1),j(t,!0)]}));o!==g.I()&&g.W(3,[o]),s!==p.I()&&p.W(3,[s]);const[S,I]=$(g,g.g,3),[z,y]=$(p,p.g,3),R=$(g,g.O,8),k=$(p,p.O,8),M=$(g,g.M,4),H=$(p,p.M,4),L=$(g,g.T,2,!0),q=$(p,p.T,2,!0),B=t.useRef(null),D=0!==R,U=0!==k;O((()=>{const e=B[C],t=m.D(e),n=v.L(e),r=b.L(e);return()=>{t(),n(),r()}}),[]),O((()=>{const e=g.H();e&&v.j(e)}),[M]),O((()=>{const e=p.H();e&&b.j(e)}),[H]),t.useImperativeHandle(w,(()=>({get scrollOffset(){return[p.R(),g.R()]},get scrollSize(){return[p.T(),g.T()]},get viewportSize(){return[p.C(),g.C()]},scrollToIndex(e,t){b.B(e),v.B(t)},scrollTo(e,t){b.$(e),v.$(t)},scrollBy(e,t){b.q(e),v.q(t)}})),[]);const V=t.useMemo((()=>{const e=new Map;return(t,n)=>{let o=e.get(Y(t,n));return o||e.set(Y(t,n),o=r({rowIndex:t,colIndex:n})),o}}),[r]),A=J(S,u,R),P=W(I,u,R,o),X=J(z,u,k),K=W(y,u,k,s),Q=t.useMemo((()=>{const t=[];for(let n=A;n<=P;n++)for(let r=X;r<=K;r++)t.push(e.jsx(G,{V:m,Y:g,G:p,K:n,Z:r,P:f,U:V(n,r)},Y(n,r)));return t}),[V,A,P,X,K]);return e.jsx(h,{ref:B,width:q,height:L,scrolling:D||U,attrs:t.useMemo((()=>({..._,style:{overflow:"auto",contain:"strict",width:"100%",height:"100%",..._.style}})),c(_)),children:Q})})),Q=t.forwardRef((({children:r,overscan:o=4,initialItemSize:s,initialItemCount:i,horizontal:l,cache:u,components:{Root:a=F,Item:h="div"}=T,onScrollStop:f,onRangeChange:_,...w},g)=>{const p=t.useMemo((()=>H(r)),[r]),m=p.length,v=L(f),[b,S,I,z]=N((()=>{const e=!!l,t=x(n.flushSync,m,s,i,u,!1,!s);return[t,A(t,e),D(t,e),e]}));m!==b.I()&&b.W(3,[m]);const[y,R]=$(b,b.g,3),k=$(b,b.O,8),M=$(b,b.M,4),q=$(b,b.T,2,!0),B=t.useRef(null),j=0!==k;O((()=>{const e=B[C],t=S.D(e),n=I.L(e);return()=>{t(),n()}}),[]),O((()=>{const e=b.H();e&&I.j(e)}),[M]),t.useEffect((()=>{j||v[C]&&v[C]()}),[j]),t.useEffect((()=>{_&&_(y,R)}),[y,R]),t.useImperativeHandle(g,(()=>({get cache(){return b._()}})),[]);const U=J(y,o,k),V=W(R,o,k,m),E=t.useMemo((()=>{const t=[];for(let n=U;n<=V;n++){const r=p[n],o=r.key;t.push(e.jsx(P,{V:S,A:b,F:n,P:h,U:r,X:z},d(o)?o:"_"+n))}return t}),[p,U,V]);return e.jsx(a,{ref:B,width:z?q:void 0,height:z?void 0:q,scrolling:j,attrs:t.useMemo((()=>({...w,style:{display:z?"inline-block":"block",width:z?"auto":"100%",height:z?"100%":"auto",...w.style}})),c(w)),children:E})}));exports.VGrid=K,exports.VList=X,exports.WVList=Q;
2
+ var e=require("react/jsx-runtime"),t=require("react"),n=require("react-dom");const r=Math.min,o=Math.max,i=Math.abs,s=Date.now,l=Object.values,c=Array.isArray,u=setTimeout,d=(e,t,n)=>r(n,o(t,e)),a=e=>null!=e,h=(e,t)=>{let n;const r=()=>{a(n)&&clearTimeout(n)},o=()=>{r(),n=u((()=>{n=null,e()}),t)};return o.t=r,o},f=e=>{let t,n;return(...r)=>(t||(t=!0,n=e(...r)),n)},_=e=>getComputedStyle(e),w=e=>e?parseFloat(e):0,g=-1,p=(e,t)=>{const n=e.o[t];return n===g?e.i:n},m=(e,t)=>{if(!e.l)return 0;if(e.u>=t)return e.h[t];let n=e.u,r=e.h[n];for(;n<t;)r+=p(e,n),e.h[++n]=r;return e.u=t,r},v=(e,t,n)=>{let r=m(e,n);for(;n>=0&&n<e.l;)if(r<=t){const o=p(e,n);if(r+o>t)break;r+=o,n++}else r-=p(e,--n);return d(n,0,e.l-1)},b=(e,t,n,o)=>{const i=v(e,t,r(n,e.l-1));return[i,v(e,t+o,i)]},S=(e,t,n)=>{const r=n?"unshift":"push";for(let n=e.l;n<t;n++)e.o[r](g),e.h.push(0===n?0:g);e.l=t},I=(e,t,n)=>{const r=t-e.l,o=r<0;let i;return o?(i=(n?e.o.splice(0,-r):e.o.splice(r)).reduce(((t,n)=>t+(n===g?e.i:n)),0),e.h.splice(r)):(i=e.i*r,S(e,e.l+r,n)),e.u=n?0:d(t-1,0,e.u),e.l=t,[i,o]},z="undefined"!=typeof window,x=/*#__PURE__*/f((e=>{const t="scrollLeft",n=e[t];e[t]=1;const r=e[t]<1;return e[t]=n,r})),y=/*#__PURE__*/f((()=>!!z&&"rtl"===_(document.body).direction)),R=/*#__PURE__*/f((()=>!!z&&/iP(hone|od|ad)/.test(navigator.userAgent))),k=(e,t,n)=>t.reduce(((t,[r,o])=>{const i=o-p(e,r);return(!n||i>0)&&(t+=i),t}),0),O=(e,t=40,n=0,s=((e,t)=>{const n={i:t,l:0,u:0,o:[],h:[]};return S(n,e),n})(e,t),l,c)=>{let u=t*o(n-1,0),a=0,h=0,f=0,_=0,w=0,v=!1,z=!1,x=!1,y=[0,n];const O=R(),C=new Set,T=()=>(e=>e.l?m(e,e.l-1)+p(e,e.l-1):0)(s),M=()=>T()-u,H=e=>d(e,0,M()),J=e=>{O&&0!==w?_+=e:(f+=e,h++)},W=e=>{const t=w;return w=e,w!==t};return{_:()=>JSON.parse(JSON.stringify(s)),g:()=>y=b(s,a+_,y[0],u),p:e=>s.o[e]===g,m(e){const[t,n]=b(s,e,y[0],u);return((e,t,n)=>e.o.slice(o(0,t-1),r(e.l-1,n+1)+1).includes(g))(s,t,n)},v(e){const t=m(s,e)-_;return l?t+o(0,u-T()):t},S:e=>p(s,e),I:()=>s.l,R:()=>a,k:M,O:()=>w,C:()=>u,T:()=>o(T(),u),M:()=>h,H(){const e=f;return f=0,e},J(e,t){const n=[e,t];return C.add(n),()=>{C.delete(n)}},W(e,t){let n,o,l=0;switch(e){case 1:{const e=t.filter((([e,t])=>s.o[e]!==t));if(!e.length)break;if(!v){let t=0;if(0===a);else if(a>M()-1.5)t=k(s,e,!0);else{const[n]=y;t=k(s,e.filter((([e])=>e<n)))}t&&J(t)}let n=!1;e.forEach((([e,t])=>{((e,t,n)=>{const o=e.o[t]===g;return e.o[t]=n,e.u=r(t,e.u),o})(s,e,t)&&(n=!0)})),c&&n&&!a&&(e=>{const t=e.o.filter((e=>e!==g)),n=t[0];e.i=t.every((e=>e===n))?n:(e=>{const t=[...e].sort(((e,t)=>e-t)),n=e.length/2|0;return t.length%2==0?(t[n-1]+t[n])/2:t[n]})(t)})(s),l+=2,x=o=!0;break}case 2:u!==t&&(u=t,l=2);break;case 3:if(t[1]){const e=M()-a,[n,o]=I(s,t[0],!0),i=o?-r(n,e):n;J(i),O||(a=H(a+i)),l=1}else I(s,t[0]);break;case 4:case 5:if(a===t)break;if(4===e){const e=t-a,n=x;x=!1,0!==w&&n||z||W(e<0?2:1),o=i(e)>u,l+=4}else v=!0;a=H(t),l+=1;break;case 6:W(0)&&(n=!0,l=1),z=v=!1;break;case 7:v=!1,z=!0}l&&(n&&_&&(x=!0,f+=_,_=0,h++),C.forEach((([e,t])=>{l&e&&t(o)})))}}},C=z?t.useLayoutEffect:t.useEffect,T=(e,t,n)=>(()=>{let r=s()-50;return(...o)=>{const i=s();r+50<i&&(r=i,(r=>{if(0!==e.O()&&!r.ctrlKey&&(t?r.deltaX:r.deltaY)){const t=e.R();t>0&&t<e.k()&&n()}})(...o))}})(),M=(e,t,n,r)=>x(e)||r?-n:t.k()-n,H=(e,t)=>{let n,r,o=!1;const i=t?"scrollLeft":"scrollTop",s=(r,o)=>t&&y()?M(n,e,r,o):r,l=async t=>{if(!n)return;const o=()=>d(t(),0,e.k());for(;;){const t=o();if(e.W(5,t),!e.m(t))break;r&&r[1]();const n=e.J(2,(()=>{r&&r[0]()}));try{await new Promise(((e,t)=>{let n=!1;const o=()=>{n||(n=!0,e(),r=void 0)};r=[o,t],u(o,250)}))}catch(e){return}finally{n()}}n[i]=s(o()),e.W(7)};return{L(r){n=r;let l=!1,c=!1;const u=()=>{e.W(4,s(r[i]))},d=h((()=>{l?d():(c=!1,u(),e.W(6))}),150),a=()=>{c&&(o=!0),u(),d()},f=T(e,t,d),_=()=>{l=!0,c=o=!1},w=()=>{l=!1,R()&&(c=!0)};return r.addEventListener("scroll",a),r.addEventListener("wheel",f,{passive:!0}),r.addEventListener("touchstart",_,{passive:!0}),r.addEventListener("touchend",w,{passive:!0}),()=>{r.removeEventListener("scroll",a),r.removeEventListener("wheel",f),r.removeEventListener("touchstart",_),r.removeEventListener("touchend",w),d.t()}},$(e){l((()=>e))},q(t){t+=e.R(),l((()=>t))},B(t,n){t=d(t,0,e.I()-1),l("end"===n?()=>e.v(t)+e.S(t)-e.C():()=>e.v(t))},j:e=>{if(n){if(o){const e=n.style.overflow;n.style.overflow="hidden",o=!1,u((()=>{n.style.overflow=e}))}n[i]+=s(e,!0)}}}},J=(e,t)=>{let n;const r=t?"scrollX":"scrollY",o=t?"offsetLeft":"offsetTop",i=(r,o)=>t&&y()?M(n,e,r,o):r;return{L(s){n=s;let l=!1;const c=(e,n)=>{const r=n+(t&&y()?window.innerWidth-e[o]-e.offsetWidth:e[o]),i=e.offsetParent;return e!==document.body&&i?c(i,r):r},u=()=>{l&&e.W(4,i(window[r])-c(s,0))},d=h((()=>{u(),e.W(6)}),150),a=()=>{u(),d()},f=T(e,t,d),_=new IntersectionObserver((([e])=>{l=e.isIntersecting}));return _.observe(s),window.addEventListener("scroll",a),window.addEventListener("wheel",f,{passive:!0}),()=>{_.disconnect(),window.removeEventListener("scroll",a),window.removeEventListener("wheel",f),d.t()}},j:e=>{window.scrollBy(t?i(e,!0):0,t?0:e)}}},W="current",L={},$=(e,t)=>{if(c(e))for(const n of e)$(n,t);else a(e)&&"boolean"!=typeof e&&t.push(e)},q=e=>{const t=[];return $(e,t),t},B=(e,t,n)=>o(e-(1===n?1:o(1,t)),0),j=(e,t,n,i)=>r(e+(2===n?1:o(1,t)),i-1),D=e=>{const n=t.useRef();return n[W]||(n[W]=e())},N=e=>{const n=t.useRef(e);return C((()=>{n[W]=e}),[e]),n},P={box:"border-box"},U=(e,t)=>{let n;const r=t?"width":"height",o=new WeakMap,i=f((()=>new ResizeObserver((i=>{const s=[];for(const{target:l,contentRect:c}of i)if(l.offsetParent)if(l===n)e.W(2,c[r]+c[t?"left":"top"]+w(_(n)[t?"paddingRight":"paddingBottom"]));else{const e=o.get(l);a(e)&&s.push([e,c[r]])}s.length&&e.W(1,s)}))));return{D(e){n=e;const t=i();return t.observe(e,P),()=>{t.disconnect()}},N(e,t){const n=i();return o.set(e,t),n.observe(e),()=>{o.delete(e),n.unobserve(e)}}}},V=(e,t)=>{const n=t?"width":"height",r=t?"innerWidth":"innerHeight",o=new WeakMap,i=f((()=>new ResizeObserver((t=>{const r=[];for(const{target:e,contentRect:i}of t){if(!e.offsetParent)continue;const t=o.get(e);a(t)&&r.push([t,i[n]])}r.length&&e.W(1,r)}))));return{D(){const t=()=>{e.W(2,window[r])};return window.addEventListener("resize",t),t(),()=>{window.removeEventListener("resize",t),i().disconnect()}},N(e,t){const n=i();return o.set(e,t),n.observe(e),()=>{o.delete(e),n.unobserve(e)}}}},A=(e,t)=>{let n;const r="height",i="width",s=new WeakMap,l=new Set,c=new Set,u=new Map,d=(e,t)=>`${e}-${t}`,a=f((()=>new ResizeObserver((a=>{const h=new Set,f=new Set;for(const{target:o,contentRect:l}of a)if(o.offsetParent)if(o===n){const o=_(n);e.W(2,l[r]+l.top+w(o.paddingBottom)),t.W(2,l[i]+l.left+w(o.paddingRight))}else{const e=s.get(o);if(e){const[t,n]=e,o=d(t,n),s=u.get(o),c=[l[r],l[i]];let a,_;s?(s[0]!==c[0]&&(a=!0),s[1]!==c[1]&&(_=!0)):a=_=!0,a&&h.add(t),_&&f.add(n),(a||_)&&u.set(o,c)}}if(h.size){const t=[];h.forEach((e=>{let n=0;c.forEach((t=>{const r=u.get(d(e,t));r&&(n=o(n,r[0]))})),n&&t.push([e,n])})),e.W(1,t)}if(f.size){const e=[];f.forEach((t=>{let n=0;l.forEach((e=>{const r=u.get(d(e,t));r&&(n=o(n,r[1]))})),n&&e.push([t,n])})),t.W(1,e)}}))));return{D(e){n=e;const t=a();return t.observe(e,P),()=>{t.disconnect()}},N(e,t,n){const r=a();return s.set(e,[t,n]),l.add(t),c.add(n),r.observe(e),()=>{s.delete(e),r.unobserve(e)}}}},E=t.forwardRef((({children:n,attrs:r,width:o,height:i,scrolling:s},l)=>e.jsx("div",{ref:l,...r,children:e.jsx("div",{style:t.useMemo((()=>({position:"relative",visibility:"hidden",width:null!=o?o:"100%",height:null!=i?i:"100%",pointerEvents:s?"none":"auto"})),[o,i,s]),children:n})}))),F=t.memo((({P:n,U:r,V:o,A:i,F:s,X:l,Y:c})=>{const u=t.useRef(null);return C((()=>r.N(u[W],o)),[o]),e.jsx(l,{ref:u,style:t.useMemo((()=>{const e={margin:0,padding:0,position:"absolute",[c?"height":"width"]:"100%",[c?"top":"left"]:0,[c?y()?"right":"left":"top"]:i,visibility:s?"hidden":"visible"};return c&&(e.display="flex"),e}),[i,s]),children:n})})),X=()=>[],Y=()=>t.useReducer(X,void 0,X)[1],G=t.forwardRef((({children:r,overscan:o=4,initialItemSize:i,initialItemCount:s,shift:c,horizontal:u,reverse:d,cache:h,components:{Root:f=E,Item:_="div"}=L,onScroll:w,onScrollStop:g,onRangeChange:p,...m},v)=>{const b=t.useMemo((()=>q(r)),[r]),S=b.length,I=N(w),z=N(g),[x,y,R,k]=D((()=>{const e=!!u,t=O(S,i,s,h,!!d,!i);return[t,U(t,e),H(t,e),e]}));S!==x.I()&&x.W(3,[S,c]);const T=Y(),[M,J]=x.g(),$=x.O(),P=x.M(),V=x.T(),A=t.useRef(null),X=0!==$;C((()=>{const e=A[W],t=y.D(e),r=R.L(e),o=x.J(3,(e=>{e?n.flushSync(T):T()})),i=x.J(4,(()=>{I[W]&&I[W](x.R())}));return()=>{t(),r(),o(),i()}}),[]),C((()=>{const e=x.H();e&&R.j(e)}),[P]),t.useEffect((()=>{X||z[W]&&z[W]()}),[X]),t.useEffect((()=>{p&&p(M,J)}),[M,J]),t.useImperativeHandle(v,(()=>({get cache(){return x._()},get scrollOffset(){return x.R()},get scrollSize(){return x.T()},get viewportSize(){return x.C()},scrollToIndex:R.B,scrollTo:R.$,scrollBy:R.q})),[]);const G=B(M,o,$),K=j(J,o,$,S),Q=[];for(let t=G;t<=K;t++){const n=b[t],r=n.key;Q.push(e.jsx(F,{U:y,V:t,A:x.v(t),F:x.p(t),X:_,P:n,Y:k},a(r)?r:"_"+t))}return e.jsx(f,{ref:A,width:k?V:void 0,height:k?void 0:V,scrolling:X,attrs:t.useMemo((()=>({...m,style:{overflow:"auto",display:k?"inline-block":"block",contain:"strict",width:"100%",height:"100%",...m.style}})),l(m)),children:Q})})),K=(e,t)=>`${e}-${t}`,Q=t.memo((({P:n,U:r,G:o,K:i,Z:s,ee:l,te:c,ne:u,F:d,X:a})=>{const h=t.useRef(null);return C((()=>r.N(h[W],o,i)),[i,o]),e.jsx(a,{ref:h,style:t.useMemo((()=>({display:"grid",margin:0,padding:0,position:"absolute",top:s,[y()?"right":"left"]:l,visibility:d?"hidden":"visible",minHeight:c,minWidth:u})),[s,l,u,c,d]),children:n})})),Z=t.forwardRef((({children:r,row:o,col:i,cellHeight:s=40,cellWidth:c=100,overscan:u=2,initialRowCount:d,initialColCount:a,components:{Root:h=E,Cell:f="div"}=L,..._},w)=>{const[g,p,m,v,b]=D((()=>{const e=O(o,s,d),t=O(i,c,a);return[e,t,A(e,t),H(e,!1),H(t,!0)]}));o!==g.I()&&g.W(3,[o]),i!==p.I()&&p.W(3,[i]);const S=Y(),[I,z]=g.g(),[x,y]=p.g(),R=g.O(),k=p.O(),T=g.M(),M=p.M(),J=g.T(),$=p.T(),q=t.useRef(null),N=0!==R,P=0!==k;C((()=>{const e=q[W],t=m.D(e),r=v.L(e),o=b.L(e),i=e=>{e?n.flushSync(S):S()},s=g.J(3,i),l=p.J(3,i);return()=>{t(),r(),o(),s(),l()}}),[]),C((()=>{const e=g.H();e&&v.j(e)}),[T]),C((()=>{const e=p.H();e&&b.j(e)}),[M]),t.useImperativeHandle(w,(()=>({get scrollOffset(){return[p.R(),g.R()]},get scrollSize(){return[p.T(),g.T()]},get viewportSize(){return[p.C(),g.C()]},scrollToIndex(e,t){b.B(e),v.B(t)},scrollTo(e,t){b.$(e),v.$(t)},scrollBy(e,t){b.q(e),v.q(t)}})),[]);const U=t.useMemo((()=>{const e=new Map;return(t,n)=>{let o=e.get(K(t,n));return o||e.set(K(t,n),o=r({rowIndex:t,colIndex:n})),o}}),[r]),V=B(I,u,R),F=j(z,u,R,o),X=B(x,u,k),G=j(y,u,k,i),Z=[];for(let t=V;t<=F;t++)for(let n=X;n<=G;n++)Z.push(e.jsx(Q,{U:m,G:t,K:n,Z:g.v(t),ee:p.v(n),te:g.S(t),ne:p.S(n),F:g.p(t)||p.p(n),X:f,P:U(t,n)},K(t,n)));return e.jsx(h,{ref:q,width:$,height:J,scrolling:N||P,attrs:t.useMemo((()=>({..._,style:{overflow:"auto",contain:"strict",width:"100%",height:"100%",..._.style}})),l(_)),children:Z})})),ee=t.forwardRef((({children:r,overscan:o=4,initialItemSize:i,initialItemCount:s,horizontal:c,cache:u,components:{Root:d=E,Item:h="div"}=L,onScrollStop:f,onRangeChange:_,...w},g)=>{const p=t.useMemo((()=>q(r)),[r]),m=p.length,v=N(f),[b,S,I,z]=D((()=>{const e=!!c,t=O(m,i,s,u,!1,!i);return[t,V(t,e),J(t,e),e]}));m!==b.I()&&b.W(3,[m]);const x=Y(),[y,R]=b.g(),k=b.O(),T=b.M(),M=b.T(),H=t.useRef(null),$=0!==k;C((()=>{const e=H[W],t=S.D(e),r=I.L(e);return b.J(3,(e=>{e?n.flushSync(x):x()})),()=>{t(),r()}}),[]),C((()=>{const e=b.H();e&&I.j(e)}),[T]),t.useEffect((()=>{$||v[W]&&v[W]()}),[$]),t.useEffect((()=>{_&&_(y,R)}),[y,R]),t.useImperativeHandle(g,(()=>({get cache(){return b._()}})),[]);const P=B(y,o,k),U=j(R,o,k,m),A=[];for(let t=P;t<=U;t++){const n=p[t],r=n.key;A.push(e.jsx(F,{U:S,V:t,A:b.v(t),F:b.p(t),X:h,P:n,Y:z},a(r)?r:"_"+t))}return e.jsx(d,{ref:H,width:z?M:void 0,height:z?void 0:M,scrolling:$,attrs:t.useMemo((()=>({...w,style:{display:z?"inline-block":"block",width:z?"auto":"100%",height:z?"100%":"auto",...w.style}})),l(w)),children:A})}));exports.VGrid=Z,exports.VList=G,exports.WVList=ee;
3
3
  //# sourceMappingURL=index.js.map