react-window 2.3.3 → 2.3.4

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.
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import { jsx as oe } from "react/jsx-runtime";
3
- import { useState as V, useLayoutEffect as ce, useEffect as te, useMemo as H, useRef as q, useCallback as $, memo as fe, useImperativeHandle as de, createElement as C } from "react";
4
- function be(e) {
2
+ import { jsx as re } from "react/jsx-runtime";
3
+ import { useState as H, useLayoutEffect as oe, useEffect as ee, useMemo as W, useRef as G, useCallback as $, memo as ue, useImperativeHandle as he, createElement as K } from "react";
4
+ function Oe(e) {
5
5
  let t = e;
6
6
  for (; t; ) {
7
7
  if (t.dir)
@@ -11,13 +11,19 @@ function be(e) {
11
11
  return !1;
12
12
  }
13
13
  function me(e, t) {
14
- const [s, r] = V(t === "rtl");
15
- return ce(() => {
16
- t ? r(t === "rtl") : e && r(be(e));
14
+ const [s, r] = H(t === "rtl");
15
+ return oe(() => {
16
+ t ? r(t === "rtl") : e && r(Oe(e));
17
17
  }, [t, e]), s;
18
18
  }
19
- const Y = typeof window < "u" ? ce : te;
20
- function ae(e) {
19
+ const Y = typeof window < "u" ? oe : ee;
20
+ function ie(e) {
21
+ return e?.ownerDocument.defaultView ?? window;
22
+ }
23
+ function ve(e) {
24
+ return ie(e).ResizeObserver ?? (typeof ResizeObserver < "u" ? ResizeObserver : void 0);
25
+ }
26
+ function le(e) {
21
27
  if (e !== void 0)
22
28
  switch (typeof e) {
23
29
  case "number":
@@ -29,80 +35,84 @@ function ae(e) {
29
35
  }
30
36
  }
31
37
  }
32
- function we({
38
+ function ze({
33
39
  box: e,
34
40
  defaultHeight: t,
35
41
  defaultWidth: s,
36
42
  disabled: r,
37
43
  element: n,
38
- mode: o,
39
- style: d
44
+ mode: i,
45
+ style: l
40
46
  }) {
41
- const { styleHeight: l, styleWidth: c } = H(
47
+ const { styleHeight: a, styleWidth: c } = W(
42
48
  () => ({
43
- styleHeight: ae(d?.height),
44
- styleWidth: ae(d?.width)
49
+ styleHeight: le(l?.height),
50
+ styleWidth: le(l?.width)
45
51
  }),
46
- [d?.height, d?.width]
47
- ), [f, a] = V({
52
+ [l?.height, l?.width]
53
+ ), [f, h] = H({
48
54
  height: t,
49
55
  width: s
50
- }), i = r || o === "only-height" && l !== void 0 || o === "only-width" && c !== void 0 || l !== void 0 && c !== void 0;
56
+ }), o = r || i === "only-height" && a !== void 0 || i === "only-width" && c !== void 0 || a !== void 0 && c !== void 0;
51
57
  return Y(() => {
52
- if (n === null || i)
58
+ if (n === null || o)
53
59
  return;
54
- const u = new ResizeObserver((h) => {
55
- for (const x of h) {
56
- const { contentRect: p, target: w } = x;
57
- n === w && a((g) => g.height === p.height && g.width === p.width ? g : {
58
- height: p.height,
59
- width: p.width
60
+ const u = ve(n);
61
+ if (!u)
62
+ return;
63
+ const d = new u((p) => {
64
+ for (const v of p) {
65
+ const { contentRect: x, target: g } = v;
66
+ n === g && h((z) => z.height === x.height && z.width === x.width ? z : {
67
+ height: x.height,
68
+ width: x.width
60
69
  });
61
70
  }
62
71
  });
63
- return u.observe(n, { box: e }), () => {
64
- u?.unobserve(n);
72
+ return d.observe(n, { box: e }), () => {
73
+ d?.unobserve(n);
65
74
  };
66
- }, [e, i, n, l, c]), H(
75
+ }, [e, o, n, a, c]), W(
67
76
  () => ({
68
- height: l ?? f.height,
77
+ height: a ?? f.height,
69
78
  width: c ?? f.width
70
79
  }),
71
- [f, l, c]
80
+ [f, a, c]
72
81
  );
73
82
  }
74
- function ee(e) {
75
- const t = q(() => {
83
+ function J(e) {
84
+ const t = G(() => {
76
85
  throw new Error("Cannot call an event handler while rendering.");
77
86
  });
78
87
  return Y(() => {
79
88
  t.current = e;
80
89
  }, [e]), $((...s) => t.current?.(...s), [t]);
81
90
  }
82
- let N = null;
83
- function Ie(e = !1) {
84
- if (N === null || e) {
85
- const t = document.createElement("div"), s = t.style;
86
- s.width = "50px", s.height = "50px", s.overflow = "scroll", s.direction = "rtl";
87
- const r = document.createElement("div"), n = r.style;
88
- return n.width = "100px", n.height = "100px", t.appendChild(r), document.body.appendChild(t), t.scrollLeft > 0 ? N = "positive-descending" : (t.scrollLeft = 1, t.scrollLeft === 0 ? N = "negative" : N = "positive-ascending"), document.body.removeChild(t), N;
91
+ const ae = /* @__PURE__ */ new WeakMap();
92
+ function ye(e = !1, t = document) {
93
+ let s = ae.get(t);
94
+ if (s === void 0 || e) {
95
+ const r = t.createElement("div"), n = r.style;
96
+ n.width = "50px", n.height = "50px", n.overflow = "scroll", n.direction = "rtl";
97
+ const i = t.createElement("div"), l = i.style;
98
+ l.width = "100px", l.height = "100px", r.appendChild(i), t.body.appendChild(r), r.scrollLeft > 0 ? s = "positive-descending" : (r.scrollLeft = 1, r.scrollLeft === 0 ? s = "negative" : s = "positive-ascending"), t.body.removeChild(r), ae.set(t, s);
89
99
  }
90
- return N;
100
+ return s;
91
101
  }
92
- function K({
102
+ function P({
93
103
  containerElement: e,
94
104
  direction: t,
95
105
  isRtl: s,
96
106
  scrollOffset: r
97
107
  }) {
98
108
  if (t === "horizontal" && s)
99
- switch (Ie()) {
109
+ switch (ye(!1, e?.ownerDocument ?? document)) {
100
110
  case "negative":
101
111
  return -r;
102
112
  case "positive-descending": {
103
113
  if (e) {
104
- const { clientWidth: n, scrollWidth: o } = e;
105
- return o - n - r;
114
+ const { clientWidth: n, scrollWidth: i } = e;
115
+ return i - n - r;
106
116
  }
107
117
  break;
108
118
  }
@@ -113,7 +123,7 @@ function L(e, t = "Assertion error") {
113
123
  if (!e)
114
124
  throw console.error(t), Error(t);
115
125
  }
116
- function _(e, t) {
126
+ function N(e, t) {
117
127
  if (e === t)
118
128
  return !0;
119
129
  if (!!e != !!t || (L(e !== void 0), L(t !== void 0), Object.keys(e).length !== Object.keys(t).length))
@@ -123,7 +133,7 @@ function _(e, t) {
123
133
  return !1;
124
134
  return !0;
125
135
  }
126
- function ue({
136
+ function pe({
127
137
  cachedBounds: e,
128
138
  itemCount: t,
129
139
  itemSize: s
@@ -141,56 +151,56 @@ function ue({
141
151
  return t * n;
142
152
  }
143
153
  }
144
- function Oe({
154
+ function Se({
145
155
  align: e,
146
156
  cachedBounds: t,
147
157
  index: s,
148
158
  itemCount: r,
149
159
  itemSize: n,
150
- containerScrollOffset: o,
151
- containerSize: d
160
+ containerScrollOffset: i,
161
+ containerSize: l
152
162
  }) {
153
163
  if (s < 0 || s >= r)
154
164
  throw RangeError(`Invalid index specified: ${s}`, {
155
165
  cause: `Index ${s} is not within the range of 0 - ${r - 1}`
156
166
  });
157
- const l = t.get(s), c = ue({
167
+ const a = t.get(s), c = pe({
158
168
  cachedBounds: t,
159
169
  itemCount: r,
160
170
  itemSize: n
161
171
  }), f = Math.max(
162
172
  0,
163
- Math.min(c - d, l.scrollOffset)
164
- ), a = Math.max(
173
+ Math.min(c - l, a.scrollOffset)
174
+ ), h = Math.max(
165
175
  0,
166
- l.scrollOffset - d + l.size
167
- ), i = l.size > d ? o >= l.scrollOffset && o <= a : o >= a && o <= l.scrollOffset;
168
- switch (e === "smart" && (e = i ? "auto" : "center"), e) {
176
+ a.scrollOffset - l + a.size
177
+ ), o = a.size > l ? i >= a.scrollOffset && i <= h : i >= h && i <= a.scrollOffset;
178
+ switch (e === "smart" && (e = o ? "auto" : "center"), e) {
169
179
  case "start":
170
180
  return f;
171
181
  case "end":
172
- return a;
182
+ return h;
173
183
  case "center":
174
184
  return Math.max(
175
185
  0,
176
186
  Math.min(
177
- c - d,
178
- l.scrollOffset + l.size / 2 - d / 2
187
+ c - l,
188
+ a.scrollOffset + a.size / 2 - l / 2
179
189
  )
180
190
  );
181
191
  case "auto":
182
192
  default:
183
- return i ? o : o < a ? a : f;
193
+ return o ? i : i < h ? h : f;
184
194
  }
185
195
  }
186
- function re({
196
+ function se({
187
197
  cachedBounds: e,
188
198
  containerScrollOffset: t,
189
199
  containerSize: s,
190
200
  itemCount: r,
191
201
  overscanCount: n
192
202
  }) {
193
- const o = r - 1;
203
+ const i = r - 1;
194
204
  if (r === 0)
195
205
  return {
196
206
  startIndexVisible: 0,
@@ -198,45 +208,45 @@ function re({
198
208
  startIndexOverscan: 0,
199
209
  stopIndexOverscan: -1
200
210
  };
201
- let d, l;
211
+ let l, a;
202
212
  const { itemSize: c } = e;
203
213
  if (c !== void 0 && c > 0)
204
- d = Math.max(
214
+ l = Math.max(
205
215
  0,
206
- Math.min(o, Math.floor(t / c))
207
- ), l = Math.max(
208
- d,
216
+ Math.min(i, Math.floor(t / c))
217
+ ), a = Math.max(
218
+ l,
209
219
  Math.min(
210
- o,
220
+ i,
211
221
  Math.ceil((t + s) / c) - 1
212
222
  )
213
223
  );
214
224
  else {
215
- let f = 0, a = Math.min(o, Math.max(0, e.size - 1));
216
- for (; f < a; ) {
217
- const i = Math.floor((f + a) / 2), u = e.get(i);
218
- u.scrollOffset + u.size > t ? a = i : f = i + 1;
225
+ let f = 0, h = Math.min(i, Math.max(0, e.size - 1));
226
+ for (; f < h; ) {
227
+ const o = Math.floor((f + h) / 2), u = e.get(o);
228
+ u.scrollOffset + u.size > t ? h = o : f = o + 1;
219
229
  }
220
- for (; f < o; ) {
221
- const i = e.get(f);
222
- if (i.scrollOffset + i.size > t) break;
230
+ for (; f < i; ) {
231
+ const o = e.get(f);
232
+ if (o.scrollOffset + o.size > t) break;
223
233
  f++;
224
234
  }
225
- for (d = f, l = f; l < o; ) {
226
- const i = e.get(l);
227
- if (i.scrollOffset + i.size >= t + s)
235
+ for (l = f, a = f; a < i; ) {
236
+ const o = e.get(a);
237
+ if (o.scrollOffset + o.size >= t + s)
228
238
  break;
229
- l++;
239
+ a++;
230
240
  }
231
241
  }
232
242
  return {
233
- startIndexVisible: d,
234
- stopIndexVisible: l,
235
- startIndexOverscan: Math.max(0, d - n),
236
- stopIndexOverscan: Math.min(o, l + n)
243
+ startIndexVisible: l,
244
+ stopIndexVisible: a,
245
+ startIndexOverscan: Math.max(0, l - n),
246
+ stopIndexOverscan: Math.min(i, a + n)
237
247
  };
238
248
  }
239
- function ze({
249
+ function Te({
240
250
  itemCount: e,
241
251
  itemProps: t,
242
252
  itemSize: s
@@ -247,48 +257,48 @@ function ze({
247
257
  get(n) {
248
258
  if (L(n < e, `Invalid index ${n}`), typeof s == "number") {
249
259
  L(n >= 0, `Invalid index ${n}`);
250
- let d = r.get(n);
251
- return d === void 0 && (d = { size: s, scrollOffset: n * s }, r.set(n, d)), d;
260
+ let l = r.get(n);
261
+ return l === void 0 && (l = { size: s, scrollOffset: n * s }, r.set(n, l)), l;
252
262
  }
253
263
  for (; r.size - 1 < n; ) {
254
- const d = r.size, l = s(d, t);
255
- if (d === 0)
256
- r.set(d, {
257
- size: l,
264
+ const l = r.size, a = s(l, t);
265
+ if (l === 0)
266
+ r.set(l, {
267
+ size: a,
258
268
  scrollOffset: 0
259
269
  });
260
270
  else {
261
- const c = r.get(d - 1);
271
+ const c = r.get(l - 1);
262
272
  L(
263
273
  c !== void 0,
264
274
  `Unexpected bounds cache miss for index ${n}`
265
- ), r.set(d, {
275
+ ), r.set(l, {
266
276
  scrollOffset: c.scrollOffset + c.size,
267
- size: l
277
+ size: a
268
278
  });
269
279
  }
270
280
  }
271
- const o = r.get(n);
281
+ const i = r.get(n);
272
282
  return L(
273
- o !== void 0,
283
+ i !== void 0,
274
284
  `Unexpected bounds cache miss for index ${n}`
275
- ), o;
285
+ ), i;
276
286
  },
277
- set(n, o) {
278
- r.set(n, o);
287
+ set(n, i) {
288
+ r.set(n, i);
279
289
  },
280
290
  get size() {
281
291
  return r.size;
282
292
  }
283
293
  };
284
294
  }
285
- function ye({
295
+ function Me({
286
296
  itemCount: e,
287
297
  itemProps: t,
288
298
  itemSize: s
289
299
  }) {
290
- return H(
291
- () => ze({
300
+ return W(
301
+ () => Te({
292
302
  itemCount: e,
293
303
  itemProps: t,
294
304
  itemSize: s
@@ -296,7 +306,7 @@ function ye({
296
306
  [e, t, s]
297
307
  );
298
308
  }
299
- function Se({
309
+ function Ee({
300
310
  containerSize: e,
301
311
  itemSize: t
302
312
  }) {
@@ -319,346 +329,346 @@ function Se({
319
329
  }
320
330
  return s;
321
331
  }
322
- function ie({
332
+ function ne({
323
333
  containerElement: e,
324
334
  containerStyle: t,
325
335
  defaultContainerSize: s = 0,
326
336
  direction: r,
327
337
  isRtl: n = !1,
328
- itemCount: o,
329
- itemProps: d,
330
- itemSize: l,
338
+ itemCount: i,
339
+ itemProps: l,
340
+ itemSize: a,
331
341
  onResize: c,
332
342
  overscanCount: f
333
343
  }) {
334
- const { height: a = s, width: i = s } = we({
344
+ const { height: h = s, width: o = s } = ze({
335
345
  defaultHeight: r === "vertical" ? s : void 0,
336
346
  defaultWidth: r === "horizontal" ? s : void 0,
337
347
  element: e,
338
348
  mode: r === "vertical" ? "only-height" : "only-width",
339
349
  style: t
340
- }), u = q({
350
+ }), u = G({
341
351
  height: 0,
342
352
  width: 0
343
- }), h = r === "vertical" ? a : i, x = Se({ containerSize: h, itemSize: l });
344
- ce(() => {
353
+ }), d = r === "vertical" ? h : o, p = Ee({ containerSize: d, itemSize: a });
354
+ oe(() => {
345
355
  if (typeof c == "function") {
346
- const v = u.current;
347
- (v.height !== a || v.width !== i) && (c({ height: a, width: i }, { ...v }), v.height = a, v.width = i);
356
+ const b = u.current;
357
+ (b.height !== h || b.width !== o) && (c({ height: h, width: o }, { ...b }), b.height = h, b.width = o);
348
358
  }
349
- }, [a, c, i]);
350
- const p = ye({
351
- itemCount: o,
352
- itemProps: d,
353
- itemSize: x
354
- }), w = $(
355
- (v) => p.get(v),
356
- [p]
357
- ), [g, B] = V(
358
- () => re({
359
- cachedBounds: p,
359
+ }, [h, c, o]);
360
+ const v = Me({
361
+ itemCount: i,
362
+ itemProps: l,
363
+ itemSize: p
364
+ }), x = $(
365
+ (b) => v.get(b),
366
+ [v]
367
+ ), [g, z] = H(
368
+ () => se({
369
+ cachedBounds: v,
360
370
  // TODO Potentially support a defaultScrollOffset prop?
361
371
  containerScrollOffset: 0,
362
- containerSize: h,
363
- itemCount: o,
372
+ containerSize: d,
373
+ itemCount: i,
364
374
  overscanCount: f
365
375
  })
366
376
  ), {
367
- startIndexVisible: T,
377
+ startIndexVisible: M,
368
378
  startIndexOverscan: E,
369
379
  stopIndexVisible: F,
370
- stopIndexOverscan: b
380
+ stopIndexOverscan: w
371
381
  } = {
372
- startIndexVisible: Math.min(o - 1, g.startIndexVisible),
373
- startIndexOverscan: Math.min(o - 1, g.startIndexOverscan),
374
- stopIndexVisible: Math.min(o - 1, g.stopIndexVisible),
375
- stopIndexOverscan: Math.min(o - 1, g.stopIndexOverscan)
376
- }, X = $(
377
- () => ue({
378
- cachedBounds: p,
379
- itemCount: o,
380
- itemSize: x
382
+ startIndexVisible: Math.min(i - 1, g.startIndexVisible),
383
+ startIndexOverscan: Math.min(i - 1, g.startIndexOverscan),
384
+ stopIndexVisible: Math.min(i - 1, g.stopIndexVisible),
385
+ stopIndexOverscan: Math.min(i - 1, g.stopIndexOverscan)
386
+ }, D = $(
387
+ () => pe({
388
+ cachedBounds: v,
389
+ itemCount: i,
390
+ itemSize: p
381
391
  }),
382
- [p, o, x]
383
- ), m = $(
384
- (v) => {
385
- const I = K({
392
+ [v, i, p]
393
+ ), I = $(
394
+ (b) => {
395
+ const O = P({
386
396
  containerElement: e,
387
397
  direction: r,
388
398
  isRtl: n,
389
- scrollOffset: v
399
+ scrollOffset: b
390
400
  });
391
- return re({
392
- cachedBounds: p,
393
- containerScrollOffset: I,
394
- containerSize: h,
395
- itemCount: o,
401
+ return se({
402
+ cachedBounds: v,
403
+ containerScrollOffset: O,
404
+ containerSize: d,
405
+ itemCount: i,
396
406
  overscanCount: f
397
407
  });
398
408
  },
399
409
  [
400
- p,
410
+ v,
401
411
  e,
402
- h,
412
+ d,
403
413
  r,
404
414
  n,
405
- o,
415
+ i,
406
416
  f
407
417
  ]
408
418
  );
409
419
  Y(() => {
410
- const v = (r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0;
411
- B(m(v));
412
- }, [e, r, m]), Y(() => {
420
+ const b = (r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0;
421
+ z(I(b));
422
+ }, [e, r, I]), Y(() => {
413
423
  if (!e)
414
424
  return;
415
- const v = () => {
416
- B((I) => {
417
- const { scrollLeft: R, scrollTop: z } = e, y = K({
425
+ const b = () => {
426
+ z((O) => {
427
+ const { scrollLeft: V, scrollTop: y } = e, S = P({
418
428
  containerElement: e,
419
429
  direction: r,
420
430
  isRtl: n,
421
- scrollOffset: r === "vertical" ? z : R
422
- }), G = re({
423
- cachedBounds: p,
424
- containerScrollOffset: y,
425
- containerSize: h,
426
- itemCount: o,
431
+ scrollOffset: r === "vertical" ? y : V
432
+ }), q = se({
433
+ cachedBounds: v,
434
+ containerScrollOffset: S,
435
+ containerSize: d,
436
+ itemCount: i,
427
437
  overscanCount: f
428
438
  });
429
- return _(G, I) ? I : G;
439
+ return N(q, O) ? O : q;
430
440
  });
431
441
  };
432
- return e.addEventListener("scroll", v), () => {
433
- e.removeEventListener("scroll", v);
442
+ return e.addEventListener("scroll", b), () => {
443
+ e.removeEventListener("scroll", b);
434
444
  };
435
445
  }, [
436
- p,
446
+ v,
437
447
  e,
438
- h,
448
+ d,
439
449
  r,
440
450
  n,
441
- o,
451
+ i,
442
452
  f
443
453
  ]);
444
- const U = ee(
454
+ const _ = J(
445
455
  ({
446
- align: v = "auto",
447
- containerScrollOffset: I,
448
- index: R
456
+ align: b = "auto",
457
+ containerScrollOffset: O,
458
+ index: V
449
459
  }) => {
450
- let z = Oe({
451
- align: v,
452
- cachedBounds: p,
453
- containerScrollOffset: K({
460
+ let y = Se({
461
+ align: b,
462
+ cachedBounds: v,
463
+ containerScrollOffset: P({
454
464
  containerElement: e,
455
465
  direction: r,
456
466
  isRtl: n,
457
- scrollOffset: I
467
+ scrollOffset: O
458
468
  }),
459
- containerSize: h,
460
- index: R,
461
- itemCount: o,
462
- itemSize: x
469
+ containerSize: d,
470
+ index: V,
471
+ itemCount: i,
472
+ itemSize: p
463
473
  });
464
474
  if (e) {
465
- if (z = K({
475
+ if (y = P({
466
476
  containerElement: e,
467
477
  direction: r,
468
478
  isRtl: n,
469
- scrollOffset: z
479
+ scrollOffset: y
470
480
  }), typeof e.scrollTo != "function") {
471
- const y = m(z);
472
- _(g, y) || B(y);
481
+ const S = I(y);
482
+ N(g, S) || z(S);
473
483
  }
474
- return z;
484
+ return y;
475
485
  }
476
486
  }
477
487
  );
478
488
  return {
479
- getCellBounds: w,
480
- getEstimatedSize: X,
481
- scrollToIndex: U,
489
+ getCellBounds: x,
490
+ getEstimatedSize: D,
491
+ scrollToIndex: _,
482
492
  startIndexOverscan: E,
483
- startIndexVisible: T,
484
- stopIndexOverscan: b,
493
+ startIndexVisible: M,
494
+ stopIndexOverscan: w,
485
495
  stopIndexVisible: F
486
496
  };
487
497
  }
488
- function he(e) {
489
- const [t, s] = V(e);
490
- return _(t, e) ? t : (s(e), e);
498
+ function ge(e) {
499
+ const [t, s] = H(e);
500
+ return N(t, e) ? t : (s(e), e);
491
501
  }
492
- function pe(e, t) {
502
+ function be(e, t) {
493
503
  const {
494
504
  ariaAttributes: s,
495
505
  style: r,
496
506
  ...n
497
507
  } = e, {
498
- ariaAttributes: o,
499
- style: d,
500
- ...l
508
+ ariaAttributes: i,
509
+ style: l,
510
+ ...a
501
511
  } = t;
502
- return _(s, o) && _(r, d) && _(n, l);
512
+ return N(s, i) && N(r, l) && N(n, a);
503
513
  }
504
- function Le({
514
+ function ke({
505
515
  cellComponent: e,
506
516
  cellProps: t,
507
517
  children: s,
508
518
  className: r,
509
519
  columnCount: n,
510
- columnKey: o,
511
- columnWidth: d,
512
- defaultHeight: l = 0,
520
+ columnKey: i,
521
+ columnWidth: l,
522
+ defaultHeight: a = 0,
513
523
  defaultWidth: c = 0,
514
524
  dir: f,
515
- gridRef: a,
516
- onCellsRendered: i,
525
+ gridRef: h,
526
+ onCellsRendered: o,
517
527
  onResize: u,
518
- overscanCount: h = 3,
519
- rowCount: x,
520
- rowHeight: p,
521
- rowKey: w,
528
+ overscanCount: d = 3,
529
+ rowCount: p,
530
+ rowHeight: v,
531
+ rowKey: x,
522
532
  style: g,
523
- tagName: B = "div",
524
- ...T
533
+ tagName: z = "div",
534
+ ...M
525
535
  }) {
526
- const E = he(t), F = H(
527
- () => fe(e, pe),
536
+ const E = ge(t), F = W(
537
+ () => ue(e, be),
528
538
  [e]
529
- ), [b, X] = V(null), m = me(b, f), {
530
- getCellBounds: U,
531
- getEstimatedSize: v,
532
- startIndexOverscan: I,
533
- startIndexVisible: R,
534
- scrollToIndex: z,
535
- stopIndexOverscan: y,
536
- stopIndexVisible: G
537
- } = ie({
538
- containerElement: b,
539
+ ), [w, D] = H(null), I = me(w, f), {
540
+ getCellBounds: _,
541
+ getEstimatedSize: b,
542
+ startIndexOverscan: O,
543
+ startIndexVisible: V,
544
+ scrollToIndex: y,
545
+ stopIndexOverscan: S,
546
+ stopIndexVisible: q
547
+ } = ne({
548
+ containerElement: w,
539
549
  containerStyle: g,
540
550
  defaultContainerSize: c,
541
551
  direction: "horizontal",
542
- isRtl: m,
552
+ isRtl: I,
543
553
  itemCount: n,
544
554
  itemProps: E,
545
- itemSize: d,
555
+ itemSize: l,
546
556
  onResize: u,
547
- overscanCount: h
557
+ overscanCount: d
548
558
  }), {
549
- getCellBounds: M,
550
- getEstimatedSize: S,
551
- startIndexOverscan: A,
552
- startIndexVisible: P,
553
- scrollToIndex: se,
554
- stopIndexOverscan: J,
555
- stopIndexVisible: le
556
- } = ie({
557
- containerElement: b,
559
+ getCellBounds: A,
560
+ getEstimatedSize: T,
561
+ startIndexOverscan: R,
562
+ startIndexVisible: C,
563
+ scrollToIndex: te,
564
+ stopIndexOverscan: X,
565
+ stopIndexVisible: ce
566
+ } = ne({
567
+ containerElement: w,
558
568
  containerStyle: g,
559
- defaultContainerSize: l,
569
+ defaultContainerSize: a,
560
570
  direction: "vertical",
561
- itemCount: x,
571
+ itemCount: p,
562
572
  itemProps: E,
563
- itemSize: p,
573
+ itemSize: v,
564
574
  onResize: u,
565
- overscanCount: h
575
+ overscanCount: d
566
576
  });
567
- de(
568
- a,
577
+ he(
578
+ h,
569
579
  () => ({
570
580
  get element() {
571
- return b;
581
+ return w;
572
582
  },
573
583
  scrollToCell({
574
- behavior: W = "auto",
575
- columnAlign: O = "auto",
576
- columnIndex: j,
577
- rowAlign: D = "auto",
584
+ behavior: j = "auto",
585
+ columnAlign: m = "auto",
586
+ columnIndex: B,
587
+ rowAlign: U = "auto",
578
588
  rowIndex: k
579
589
  }) {
580
- const Q = z({
581
- align: O,
582
- containerScrollOffset: b?.scrollLeft ?? 0,
583
- index: j
584
- }), xe = se({
585
- align: D,
586
- containerScrollOffset: b?.scrollTop ?? 0,
590
+ const Z = y({
591
+ align: m,
592
+ containerScrollOffset: w?.scrollLeft ?? 0,
593
+ index: B
594
+ }), Ie = te({
595
+ align: U,
596
+ containerScrollOffset: w?.scrollTop ?? 0,
587
597
  index: k
588
598
  });
589
- typeof b?.scrollTo == "function" && b.scrollTo({
590
- behavior: W,
591
- left: Q,
592
- top: xe
599
+ typeof w?.scrollTo == "function" && w.scrollTo({
600
+ behavior: j,
601
+ left: Z,
602
+ top: Ie
593
603
  });
594
604
  },
595
605
  scrollToColumn({
596
- align: W = "auto",
597
- behavior: O = "auto",
598
- index: j
606
+ align: j = "auto",
607
+ behavior: m = "auto",
608
+ index: B
599
609
  }) {
600
- const D = z({
601
- align: W,
602
- containerScrollOffset: b?.scrollLeft ?? 0,
603
- index: j
610
+ const U = y({
611
+ align: j,
612
+ containerScrollOffset: w?.scrollLeft ?? 0,
613
+ index: B
604
614
  });
605
- typeof b?.scrollTo == "function" && b.scrollTo({
606
- behavior: O,
607
- left: D
615
+ typeof w?.scrollTo == "function" && w.scrollTo({
616
+ behavior: m,
617
+ left: U
608
618
  });
609
619
  },
610
620
  scrollToRow({
611
- align: W = "auto",
612
- behavior: O = "auto",
613
- index: j
621
+ align: j = "auto",
622
+ behavior: m = "auto",
623
+ index: B
614
624
  }) {
615
- const D = se({
616
- align: W,
617
- containerScrollOffset: b?.scrollTop ?? 0,
618
- index: j
625
+ const U = te({
626
+ align: j,
627
+ containerScrollOffset: w?.scrollTop ?? 0,
628
+ index: B
619
629
  });
620
- typeof b?.scrollTo == "function" && b.scrollTo({
621
- behavior: O,
622
- top: D
630
+ typeof w?.scrollTo == "function" && w.scrollTo({
631
+ behavior: m,
632
+ top: U
623
633
  });
624
634
  }
625
635
  }),
626
- [b, z, se]
627
- ), te(() => {
628
- I >= 0 && y >= 0 && A >= 0 && J >= 0 && i && i(
636
+ [w, y, te]
637
+ ), ee(() => {
638
+ O >= 0 && S >= 0 && R >= 0 && X >= 0 && o && o(
629
639
  {
630
- columnStartIndex: R,
631
- columnStopIndex: G,
632
- rowStartIndex: P,
633
- rowStopIndex: le
640
+ columnStartIndex: V,
641
+ columnStopIndex: q,
642
+ rowStartIndex: C,
643
+ rowStopIndex: ce
634
644
  },
635
645
  {
636
- columnStartIndex: I,
637
- columnStopIndex: y,
638
- rowStartIndex: A,
639
- rowStopIndex: J
646
+ columnStartIndex: O,
647
+ columnStopIndex: S,
648
+ rowStartIndex: R,
649
+ rowStopIndex: X
640
650
  }
641
651
  );
642
652
  }, [
643
- i,
644
- I,
653
+ o,
654
+ O,
655
+ V,
656
+ S,
657
+ q,
645
658
  R,
646
- y,
647
- G,
648
- A,
649
- P,
650
- J,
651
- le
659
+ C,
660
+ X,
661
+ ce
652
662
  ]);
653
- const ge = H(() => {
654
- const W = [];
655
- if (n > 0 && x > 0)
656
- for (let O = A; O <= J; O++) {
657
- const j = M(O), D = [];
658
- for (let k = I; k <= y; k++) {
659
- const Q = U(k);
660
- D.push(
661
- /* @__PURE__ */ C(
663
+ const xe = W(() => {
664
+ const j = [];
665
+ if (n > 0 && p > 0)
666
+ for (let m = R; m <= X; m++) {
667
+ const B = A(m), U = [];
668
+ for (let k = O; k <= S; k++) {
669
+ const Z = _(k);
670
+ U.push(
671
+ /* @__PURE__ */ K(
662
672
  F,
663
673
  {
664
674
  ...E,
@@ -667,75 +677,75 @@ function Le({
667
677
  role: "gridcell"
668
678
  },
669
679
  columnIndex: k,
670
- key: o ? o({
680
+ key: i ? i({
671
681
  columnIndex: k,
672
682
  data: E,
673
- rowIndex: O
683
+ rowIndex: m
674
684
  }) : k,
675
- rowIndex: O,
685
+ rowIndex: m,
676
686
  style: {
677
687
  position: "absolute",
678
- left: m ? void 0 : 0,
679
- right: m ? 0 : void 0,
680
- transform: `translate(${m ? -Q.scrollOffset : Q.scrollOffset}px, ${j.scrollOffset}px)`,
681
- height: j.size,
682
- width: Q.size
688
+ left: I ? void 0 : 0,
689
+ right: I ? 0 : void 0,
690
+ transform: `translate(${I ? -Z.scrollOffset : Z.scrollOffset}px, ${B.scrollOffset}px)`,
691
+ height: B.size,
692
+ width: Z.size
683
693
  }
684
694
  }
685
695
  )
686
696
  );
687
697
  }
688
- W.push(
689
- /* @__PURE__ */ oe(
698
+ j.push(
699
+ /* @__PURE__ */ re(
690
700
  "div",
691
701
  {
692
702
  role: "row",
693
- "aria-rowindex": O + 1,
694
- children: D
703
+ "aria-rowindex": m + 1,
704
+ children: U
695
705
  },
696
- w ? w({
706
+ x ? x({
697
707
  data: E,
698
- rowIndex: O
699
- }) : O
708
+ rowIndex: m
709
+ }) : m
700
710
  )
701
711
  );
702
712
  }
703
- return W;
713
+ return j;
704
714
  }, [
705
715
  F,
706
716
  E,
707
717
  n,
708
- o,
718
+ i,
719
+ O,
720
+ S,
721
+ _,
722
+ A,
709
723
  I,
710
- y,
711
- U,
712
- M,
713
- m,
724
+ p,
714
725
  x,
715
- w,
716
- A,
717
- J
718
- ]), ve = /* @__PURE__ */ oe(
726
+ R,
727
+ X
728
+ ]), we = /* @__PURE__ */ re(
719
729
  "div",
720
730
  {
721
731
  "aria-hidden": !0,
722
732
  style: {
723
- height: S(),
724
- width: v(),
733
+ height: T(),
734
+ width: b(),
725
735
  zIndex: -1
726
736
  }
727
737
  }
728
738
  );
729
- return C(
730
- B,
739
+ return K(
740
+ z,
731
741
  {
732
742
  "aria-colcount": n,
733
- "aria-rowcount": x,
743
+ "aria-rowcount": p,
734
744
  role: "grid",
735
- ...T,
745
+ ...M,
736
746
  className: r,
737
747
  dir: f,
738
- ref: X,
748
+ ref: D,
739
749
  style: {
740
750
  position: "relative",
741
751
  maxHeight: "100%",
@@ -745,68 +755,76 @@ function Le({
745
755
  ...g
746
756
  }
747
757
  },
748
- ge,
758
+ xe,
749
759
  s,
750
- ve
760
+ we
751
761
  );
752
762
  }
753
- const Ve = V, Re = q;
754
- function Te(e) {
763
+ const $e = H, We = G;
764
+ function Ae(e) {
755
765
  return e != null && typeof e == "object" && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
756
766
  }
757
- function Ee({
767
+ function Re({
758
768
  element: e,
759
769
  getCellBounds: t,
760
770
  isDynamicRowHeight: s,
761
771
  rowCount: r,
762
772
  rowElements: n,
763
- scrollToIndex: o
773
+ scrollToIndex: i
764
774
  }) {
765
- const d = q(null), l = q(void 0), c = ee(() => {
766
- d.current = null, l.current !== void 0 && (cancelAnimationFrame(l.current), l.current = void 0);
767
- }), f = ee(() => {
768
- l.current = void 0;
769
- const a = d.current;
770
- if (!a) return;
771
- if (!e || !s || a.index >= r || performance.now() >= a.deadline) {
775
+ const l = G(null), a = G(
776
+ void 0
777
+ ), c = J(() => {
778
+ l.current = null, a.current !== void 0 && (a.current.view.cancelAnimationFrame(a.current.id), a.current = void 0);
779
+ }), f = J(() => {
780
+ const o = ie(e);
781
+ a.current = {
782
+ id: o.requestAnimationFrame(h),
783
+ view: o
784
+ };
785
+ }), h = J(() => {
786
+ a.current = void 0;
787
+ const o = l.current;
788
+ if (!o) return;
789
+ if (!e || !s || o.index >= r || performance.now() >= o.deadline) {
772
790
  c();
773
791
  return;
774
792
  }
775
- const i = o({
776
- align: a.align,
793
+ const u = i({
794
+ align: o.align,
777
795
  containerScrollOffset: e.scrollTop,
778
- index: a.index
796
+ index: o.index
779
797
  });
780
- if (i !== void 0) {
781
- const u = Math.max(
798
+ if (u !== void 0) {
799
+ const d = Math.max(
782
800
  0,
783
- Math.min(i, e.scrollHeight - e.clientHeight)
801
+ Math.min(u, e.scrollHeight - e.clientHeight)
784
802
  );
785
- if (Math.abs(u - e.scrollTop) > 1)
786
- a.stableFrames = 0, e.scrollTo({ behavior: "instant", top: u });
803
+ if (Math.abs(d - e.scrollTop) > 1)
804
+ o.stableFrames = 0, e.scrollTo({ behavior: "instant", top: d });
787
805
  else {
788
- const h = n.current;
789
- if (!(h.some(
790
- (w) => w.getAttribute(Z) === `${a.index}`
791
- ) && h.every((w) => {
792
- const g = Number(w.getAttribute(Z));
806
+ const p = n.current;
807
+ if (!(p.some(
808
+ (g) => g.getAttribute(Q) === `${o.index}`
809
+ ) && p.every((g) => {
810
+ const z = Number(g.getAttribute(Q));
793
811
  return Math.abs(
794
- t(g).size - w.offsetHeight
812
+ t(z).size - g.offsetHeight
795
813
  ) <= 1;
796
814
  })))
797
- a.stableFrames = 0;
798
- else if (++a.stableFrames >= 2) {
815
+ o.stableFrames = 0;
816
+ else if (++o.stableFrames >= 2) {
799
817
  c();
800
818
  return;
801
819
  }
802
820
  }
803
821
  }
804
- l.current = requestAnimationFrame(f);
822
+ f();
805
823
  });
806
824
  return Y(() => {
807
825
  if (!e) return;
808
- const a = (i) => {
809
- switch (i.key) {
826
+ const o = (u) => {
827
+ switch (u.key) {
810
828
  case "ArrowUp":
811
829
  case "ArrowDown":
812
830
  case "PageUp":
@@ -817,212 +835,219 @@ function Ee({
817
835
  c();
818
836
  }
819
837
  };
820
- return e.addEventListener("wheel", c, { passive: !0 }), e.addEventListener("touchstart", c, { passive: !0 }), e.addEventListener("pointerdown", c), e.addEventListener("keydown", a), () => {
821
- c(), e.removeEventListener("wheel", c), e.removeEventListener("touchstart", c), e.removeEventListener("pointerdown", c), e.removeEventListener("keydown", a);
838
+ return e.addEventListener("wheel", c, { passive: !0 }), e.addEventListener("touchstart", c, { passive: !0 }), e.addEventListener("pointerdown", c), e.addEventListener("keydown", o), () => {
839
+ c(), e.removeEventListener("wheel", c), e.removeEventListener("touchstart", c), e.removeEventListener("pointerdown", c), e.removeEventListener("keydown", o);
822
840
  };
823
841
  }, [c, e]), $(
824
842
  ({
825
- align: a = "auto",
826
- behavior: i = "auto",
827
- index: u
843
+ align: o = "auto",
844
+ behavior: u = "auto",
845
+ index: d
828
846
  }) => {
829
- s && a === "smart" && (a = o({
847
+ s && o === "smart" && (o = i({
830
848
  align: "auto",
831
849
  containerScrollOffset: e?.scrollTop ?? 0,
832
- index: u
850
+ index: d
833
851
  }) === (e?.scrollTop ?? 0) ? "auto" : "center");
834
- const h = o({
835
- align: a,
852
+ const p = i({
853
+ align: o,
836
854
  containerScrollOffset: e?.scrollTop ?? 0,
837
- index: u
855
+ index: d
838
856
  });
839
- c(), typeof e?.scrollTo == "function" && (s && (d.current = {
840
- align: a,
841
- index: u,
857
+ c(), typeof e?.scrollTo == "function" && (s && (l.current = {
858
+ align: o,
859
+ index: d,
842
860
  deadline: performance.now() + 1e3,
843
861
  stableFrames: 0
844
- }, l.current = requestAnimationFrame(f)), e.scrollTo({
845
- behavior: s ? "instant" : i,
846
- top: h
862
+ }, f()), e.scrollTo({
863
+ behavior: s ? "instant" : u,
864
+ top: p
847
865
  }));
848
866
  },
849
- [c, f, e, s, o]
867
+ [
868
+ c,
869
+ e,
870
+ s,
871
+ f,
872
+ i
873
+ ]
850
874
  );
851
875
  }
852
- const Z = "data-react-window-index";
853
- function ke({
876
+ const Q = "data-react-window-index", fe = "data-react-window-sizer";
877
+ function He({
854
878
  children: e,
855
879
  className: t,
856
880
  defaultHeight: s = 0,
857
881
  listRef: r,
858
882
  onResize: n,
859
- onRowsRendered: o,
860
- overscanCount: d = 3,
861
- rowComponent: l,
883
+ onRowsRendered: i,
884
+ overscanCount: l = 3,
885
+ rowComponent: a,
862
886
  rowCount: c,
863
887
  rowHeight: f,
864
- rowKey: a,
865
- rowProps: i,
888
+ rowKey: h,
889
+ rowProps: o,
866
890
  tagName: u = "div",
867
- style: h,
868
- ...x
891
+ style: d,
892
+ ...p
869
893
  }) {
870
- const p = he(i), w = H(
871
- () => fe(l, pe),
872
- [l]
873
- ), [g, B] = V(null), T = Te(f), E = H(() => T ? (M) => f.getRowHeight(M) ?? f.getAverageRowHeight() : f, [T, f]), {
894
+ const v = ge(o), x = W(
895
+ () => ue(a, be),
896
+ [a]
897
+ ), [g, z] = H(null), M = Ae(f), E = W(() => M ? (A) => f.getRowHeight(A) ?? f.getAverageRowHeight() : f, [M, f]), {
874
898
  getCellBounds: F,
875
- getEstimatedSize: b,
876
- scrollToIndex: X,
877
- startIndexOverscan: m,
878
- startIndexVisible: U,
879
- stopIndexOverscan: v,
880
- stopIndexVisible: I
881
- } = ie({
899
+ getEstimatedSize: w,
900
+ scrollToIndex: D,
901
+ startIndexOverscan: I,
902
+ startIndexVisible: _,
903
+ stopIndexOverscan: b,
904
+ stopIndexVisible: O
905
+ } = ne({
882
906
  containerElement: g,
883
- containerStyle: h,
907
+ containerStyle: d,
884
908
  defaultContainerSize: s,
885
909
  direction: "vertical",
886
910
  itemCount: c,
887
- itemProps: p,
911
+ itemProps: v,
888
912
  itemSize: E,
889
913
  onResize: n,
890
- overscanCount: d
891
- }), R = q([]), z = Ee({
914
+ overscanCount: l
915
+ }), V = G([]), y = Re({
892
916
  element: g,
893
917
  getCellBounds: F,
894
- isDynamicRowHeight: T,
918
+ isDynamicRowHeight: M,
895
919
  rowCount: c,
896
- rowElements: R,
897
- scrollToIndex: X
920
+ rowElements: V,
921
+ scrollToIndex: D
898
922
  });
899
- de(
923
+ he(
900
924
  r,
901
925
  () => ({
902
926
  get element() {
903
927
  return g;
904
928
  },
905
- scrollToRow: z
929
+ scrollToRow: y
906
930
  }),
907
- [g, z]
931
+ [g, y]
908
932
  ), Y(() => {
909
933
  if (!g)
910
934
  return;
911
- const M = Array.from(g.children).slice(
935
+ const A = Array.from(g.children).slice(
912
936
  0,
913
- m < 0 ? 0 : v - m + 1
914
- ).filter((S, A) => {
915
- if (S.hasAttribute("aria-hidden"))
937
+ I < 0 ? 0 : b - I + 1
938
+ ).filter((T, R) => {
939
+ if (T.hasAttribute(fe))
916
940
  return !1;
917
- const P = `${m + A}`;
918
- return S.setAttribute(Z, P), !0;
941
+ const C = `${I + R}`;
942
+ return T.setAttribute(Q, C), !0;
919
943
  });
920
- if (R.current = M, T)
921
- return f.observeRowElements(M);
944
+ if (V.current = A, M)
945
+ return f.observeRowElements(A);
922
946
  }, [
923
- w,
947
+ x,
924
948
  g,
925
- T,
949
+ M,
926
950
  c,
927
951
  f,
928
- a,
929
- p,
930
- m,
931
- v
932
- ]), te(() => {
933
- m >= 0 && v >= 0 && o && o(
952
+ h,
953
+ v,
954
+ I,
955
+ b
956
+ ]), ee(() => {
957
+ I >= 0 && b >= 0 && i && i(
934
958
  {
935
- startIndex: U,
936
- stopIndex: I
959
+ startIndex: _,
960
+ stopIndex: O
937
961
  },
938
962
  {
939
- startIndex: m,
940
- stopIndex: v
963
+ startIndex: I,
964
+ stopIndex: b
941
965
  }
942
966
  );
943
967
  }, [
944
- o,
945
- m,
946
- U,
947
- v,
948
- I
968
+ i,
969
+ I,
970
+ _,
971
+ b,
972
+ O
949
973
  ]);
950
- const y = H(() => {
951
- const M = [];
974
+ const S = W(() => {
975
+ const A = [];
952
976
  if (c > 0)
953
- for (let S = m; S <= v; S++) {
954
- const A = F(S);
955
- M.push(
956
- /* @__PURE__ */ C(
957
- w,
977
+ for (let T = I; T <= b; T++) {
978
+ const R = F(T);
979
+ A.push(
980
+ /* @__PURE__ */ K(
981
+ x,
958
982
  {
959
- ...p,
983
+ ...v,
960
984
  ariaAttributes: {
961
- "aria-posinset": S + 1,
985
+ "aria-posinset": T + 1,
962
986
  "aria-setsize": c,
963
987
  role: "listitem"
964
988
  },
965
- key: a ? a(S, p) : S,
966
- index: S,
989
+ key: h ? h(T, v) : T,
990
+ index: T,
967
991
  style: {
968
992
  position: "absolute",
969
993
  left: 0,
970
- transform: `translateY(${A.scrollOffset}px)`,
994
+ transform: `translateY(${R.scrollOffset}px)`,
971
995
  // In case of dynamic row heights, don't specify a height style
972
996
  // otherwise a default/estimated height would mask the actual height
973
- height: T ? void 0 : A.size,
997
+ height: M ? void 0 : R.size,
974
998
  width: "100%"
975
999
  }
976
1000
  }
977
1001
  )
978
1002
  );
979
1003
  }
980
- return M;
1004
+ return A;
981
1005
  }, [
982
- w,
1006
+ x,
983
1007
  F,
984
- T,
1008
+ M,
985
1009
  c,
986
- a,
987
- p,
988
- m,
989
- v
990
- ]), G = /* @__PURE__ */ oe(
1010
+ h,
1011
+ v,
1012
+ I,
1013
+ b
1014
+ ]), q = /* @__PURE__ */ re(
991
1015
  "div",
992
1016
  {
993
1017
  "aria-hidden": !0,
1018
+ [fe]: "",
994
1019
  style: {
995
- height: b(),
1020
+ height: w(),
996
1021
  width: "100%",
997
1022
  zIndex: -1
998
1023
  }
999
1024
  }
1000
1025
  );
1001
- return C(
1026
+ return K(
1002
1027
  u,
1003
1028
  {
1004
1029
  role: "list",
1005
- ...x,
1030
+ ...p,
1006
1031
  className: t,
1007
- ref: B,
1032
+ ref: z,
1008
1033
  style: {
1009
1034
  position: "relative",
1010
1035
  maxHeight: "100%",
1011
1036
  flexGrow: 1,
1012
1037
  overflowY: "auto",
1013
- ...h
1038
+ ...d
1014
1039
  }
1015
1040
  },
1016
- y,
1041
+ S,
1017
1042
  e,
1018
- G
1043
+ q
1019
1044
  );
1020
1045
  }
1021
- function $e({
1046
+ function Fe({
1022
1047
  defaultRowHeight: e,
1023
1048
  key: t
1024
1049
  }) {
1025
- const [s, r] = V({
1050
+ const [s, r] = H({
1026
1051
  key: t,
1027
1052
  map: /* @__PURE__ */ new Map()
1028
1053
  });
@@ -1030,83 +1055,96 @@ function $e({
1030
1055
  key: t,
1031
1056
  map: /* @__PURE__ */ new Map()
1032
1057
  });
1033
- const { map: n } = s, o = $(() => {
1034
- let i = 0;
1058
+ const { map: n } = s, i = $(() => {
1059
+ let o = 0;
1035
1060
  return n.forEach((u) => {
1036
- i += u;
1037
- }), i === 0 ? e : i / n.size;
1038
- }, [e, n]), d = $(
1039
- (i) => {
1040
- const u = n.get(i);
1061
+ o += u;
1062
+ }), o === 0 ? e : o / n.size;
1063
+ }, [e, n]), l = $(
1064
+ (o) => {
1065
+ const u = n.get(o);
1041
1066
  return u !== void 0 ? u : e;
1042
1067
  },
1043
1068
  [e, n]
1044
- ), l = $((i, u) => {
1045
- r((h) => {
1046
- if (h.map.get(i) === u)
1047
- return h;
1048
- const x = new Map(h.map);
1049
- return x.set(i, u), {
1050
- ...h,
1051
- map: x
1069
+ ), a = $((o, u) => {
1070
+ r((d) => {
1071
+ if (d.map.get(o) === u)
1072
+ return d;
1073
+ const p = new Map(d.map);
1074
+ return p.set(o, u), {
1075
+ ...d,
1076
+ map: p
1052
1077
  };
1053
1078
  });
1054
- }, []), c = ee(
1055
- (i) => {
1056
- i.length !== 0 && i.forEach((u) => {
1057
- const { borderBoxSize: h, target: x } = u, p = x.getAttribute(Z);
1079
+ }, []), c = J(
1080
+ (o) => {
1081
+ o.length !== 0 && o.forEach((u) => {
1082
+ const { borderBoxSize: d, target: p } = u, v = p.getAttribute(Q);
1058
1083
  L(
1059
- p !== null,
1060
- `Invalid ${Z} attribute value`
1084
+ v !== null,
1085
+ `Invalid ${Q} attribute value`
1061
1086
  );
1062
- const w = parseInt(p), { blockSize: g } = h[0];
1063
- g && l(w, g);
1087
+ const x = parseInt(v), { blockSize: g } = d[0];
1088
+ g && a(x, g);
1064
1089
  });
1065
1090
  }
1066
- ), [f] = V(() => {
1067
- if (typeof ResizeObserver < "u")
1068
- return new ResizeObserver(c);
1069
- });
1070
- te(() => {
1071
- if (f)
1072
- return () => {
1073
- f.disconnect();
1091
+ ), f = G(null);
1092
+ ee(
1093
+ () => () => {
1094
+ f.current?.resizeObserver.disconnect(), f.current = null;
1095
+ },
1096
+ []
1097
+ );
1098
+ const h = $(
1099
+ (o) => {
1100
+ const u = [];
1101
+ return o.forEach((d) => {
1102
+ const p = ie(d);
1103
+ if (f.current?.view !== p) {
1104
+ f.current?.resizeObserver.disconnect();
1105
+ const x = ve(d);
1106
+ f.current = x ? {
1107
+ resizeObserver: new x(c),
1108
+ view: p
1109
+ } : null;
1110
+ }
1111
+ const v = f.current?.resizeObserver;
1112
+ v && (v.observe(d), u.push([d, v]));
1113
+ }), () => {
1114
+ u.forEach(
1115
+ ([d, p]) => p.unobserve(d)
1116
+ );
1074
1117
  };
1075
- }, [f]);
1076
- const a = $(
1077
- (i) => f ? (i.forEach((u) => f.observe(u)), () => {
1078
- i.forEach((u) => f.unobserve(u));
1079
- }) : () => {
1080
1118
  },
1081
- [f]
1119
+ [c]
1082
1120
  );
1083
- return H(
1121
+ return W(
1084
1122
  () => ({
1085
- getAverageRowHeight: o,
1086
- getRowHeight: d,
1087
- setRowHeight: l,
1088
- observeRowElements: a
1123
+ getAverageRowHeight: i,
1124
+ getRowHeight: l,
1125
+ setRowHeight: a,
1126
+ observeRowElements: h
1089
1127
  }),
1090
- [o, d, l, a]
1128
+ [i, l, a, h]
1091
1129
  );
1092
1130
  }
1093
- const He = V, Fe = q;
1094
- let ne = -1;
1095
- function We(e = !1) {
1096
- if (ne === -1 || e) {
1097
- const t = document.createElement("div"), s = t.style;
1098
- s.width = "50px", s.height = "50px", s.overflow = "scroll", document.body.appendChild(t), ne = t.offsetWidth - t.clientWidth, document.body.removeChild(t);
1131
+ const je = H, Be = G, de = /* @__PURE__ */ new WeakMap();
1132
+ function Ue(e = !1, t = document) {
1133
+ let s = de.get(t);
1134
+ if (s === void 0 || e) {
1135
+ const r = t.createElement("div"), n = r.style;
1136
+ n.width = "50px", n.height = "50px", n.overflow = "scroll", t.body.appendChild(r), s = r.offsetWidth - r.clientWidth, t.body.removeChild(r), de.set(t, s);
1099
1137
  }
1100
- return ne;
1138
+ return s;
1101
1139
  }
1102
1140
  export {
1103
- Le as Grid,
1104
- ke as List,
1105
- We as getScrollbarSize,
1106
- $e as useDynamicRowHeight,
1107
- Ve as useGridCallbackRef,
1108
- Re as useGridRef,
1109
- He as useListCallbackRef,
1110
- Fe as useListRef
1141
+ ke as Grid,
1142
+ He as List,
1143
+ Ue as getScrollbarSize,
1144
+ Fe as useDynamicRowHeight,
1145
+ $e as useGridCallbackRef,
1146
+ We as useGridRef,
1147
+ je as useListCallbackRef,
1148
+ Be as useListRef
1111
1149
  };
1112
1150
  //# sourceMappingURL=react-window.js.map