@aiquants/virtualscroll 2.1.0 → 2.2.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/CHANGELOG.md CHANGED
@@ -2,6 +2,77 @@
2
2
 
3
3
  All notable changes to `@aiquants/virtualscroll` are documented here.
4
4
 
5
+ ## 2.2.0 (2026-08-15)
6
+
7
+ **リセット非依存 (preflight independence)。** 2.1.0 の Top/Bottom ボタン修正と同じ根本原因 —
8
+ どちらの CSS アーティファクトもリセット (preflight) を含まないのに、`.aqvs-*` がホストのリセットを
9
+ 当てにしていた — をパッケージ全体で解消します。UA 既定の打ち消しは、それを必要とするルール自身が
10
+ 宣言します。実測はすべて chromium 148 / firefox 150 (webkit は本環境で起動不可のため未検証)。
11
+
12
+ ### Fixed
13
+
14
+ - **スクロール不能なリストでスクロールバーが消えなかった問題 (Tailwind ホストで発生)** —
15
+ 非表示状態を Tailwind ユーティリティ (`opacity-0` / `pointer-events-none`) で表現していましたが、
16
+ components-only アーティファクト (Artifact A) はユーティリティを同梱しません。ホスト側のビルドが
17
+ たまたま同名クラスを生成していない限り、**バーは不透明のまま残ります**。両ユーティリティとも生成
18
+ していないホストでは、さらに中央のクリックまで奪われます (本パッケージのデモは自前のソースから
19
+ `.pointer-events-none` だけを生成していたため、「バーが常時可視のまま」という形で現れていました)。
20
+ ルートとサムラッパーへ `data-visible` を出力し、パッケージ CSS の `[data-visible="false"]` で
21
+ `opacity: 0; pointer-events: none` を与えるよう移管しました。実測: `opacity 1 → 0`、
22
+ `pointer-events auto → none`、バー中央のヒットテストがサムからペインへ。
23
+ - **フェードアウトした Top/Bottom ピルが行のクリックを奪っていた問題 (全ホスト)** —
24
+ `.aqvs-scroll-to-edge-overlay[data-visible="false"]` は `opacity: 0` だけで、内側の
25
+ `.aqvs-scroll-to-edge-button` が `pointer-events: auto` を持つためヒットテストに残っていました
26
+ (初回描画時から不可視のピルが存在)。実測: ピル中央のクリックが行へ届かず `scrollToIndex()` が発火し、
27
+ リストが末尾へ飛ぶ。非表示状態のピルへ `pointer-events: none` を追加。
28
+ - **矢印ボタンが `scrollBarWidth` からはみ出していた問題 (リセット非適用ホスト)** —
29
+ UA の `padding` (chromium `1px 6px` / firefox `1px 4px`) と `border: 2px outset` が効き、ブラウザは
30
+ `<button>` を border-box として扱うため、それらがボーダーボックスの下限になってインライン指定の
31
+ `scrollBarWidth` が無視されていました。`border: 0 solid` / `padding: 0` を追加 (`none` ではなく
32
+ `0 solid` にしてあるのは、消費側が `border-width` だけを上書きしたときに描画されるようにするため)。
33
+ 実測 (chromium): 16x12 → 12x12、`scrollBarWidth: 8` では 16x8 → 8x8、バーの `scrollWidth` 16 → 12。
34
+ 水平バーではトラック長が `viewportSize - 2 * scrollBarWidth` へ戻り、JS 側の計算とのズレ (最大
35
+ スクロール時にサムが端の矢印へ乗る、トラッククリック位置がずれる) も解消します。
36
+ - **`contentInsets` 指定時にビューポートがインセット分だけ伸びていた問題 (リセット非適用ホスト)** —
37
+ `.aqvs-scroll-pane-content` は同一要素に `height` と `padding` を受けるため `box-sizing: border-box`
38
+ が必須でした。実測: `viewportSize: 300` / インセット 8+8 で 316px → 300px。
39
+ - **タップサークルの 1px リングが描画されない問題 (リセット非適用ホスト / `tapScrollCircleSampleVisual` 使用時)** —
40
+ `.aqvs-tap-scroll-circle-gradient` と `.aqvs-sample-visual-pupil` が `border-width` + `border-color`
41
+ だけを宣言しており、`border-style` の初期値 `none` により使用値が `0px` になっていました。
42
+ `border: 1px solid ...` へ変更し、瞳には `box-sizing: border-box` を併せて追加 (インライン
43
+ `width` / `height` は外径のため、border 分だけ太らないようにする)。どちらのクラスも
44
+ `tapScrollCircleOptions.renderVisual` に `tapScrollCircleSampleVisual` を渡した場合にのみ描画されます
45
+ (既定ビジュアルはリングを `box-shadow` で描くため影響を受けません)。
46
+ - **タッチ操作時にスクロールバー配下へタップハイライトが出る問題 (リセット非適用ホスト)** —
47
+ `.aqvs-scrollbar` に `-webkit-tap-highlight-color: transparent` を追加 (継承でバー・トラック・サム・
48
+ 矢印・タップサークルまで一括)。実測 `rgba(0,0,0,0.18) → rgba(0,0,0,0)`。**ペイン配下には付けません**
49
+ (利用側の行コンテンツからも UA のタップハイライトを奪ってしまうため)。
50
+ - **ボタンのラベル / グリフが UA のボタンフォントになる問題 (リセット非適用ホスト)** —
51
+ Top/Bottom ピルへ `font-family: inherit` (preflight の `button { font: inherit }` 相当)、矢印ボタンへ
52
+ `font-family: system-ui, sans-serif` / `font-weight: 400` / `letter-spacing: normal` を追加。矢印
53
+ (`▲▼◀▶`) はパッケージ所有のアイコンなので、ホストの散文用タイポグラフィを継承しません (実測:
54
+ `letter-spacing: 2px` のホストで 12px のボタン内のグリフが 1px ずれていた)。
55
+
56
+ ### Changed
57
+
58
+ - **スクロールバーの DOM 契約**: ルート (`role="scrollbar"`) とサムラッパー (`role="slider"`) は
59
+ `pointer-events-none opacity-0` を**付けなくなり**、代わりに `data-visible="true" | "false"` を
60
+ 常時出力します。これらのユーティリティクラスを目印にしていた利用側の CSS / テストロケータ /
61
+ スナップショットは `[data-visible]` へ移行してください。
62
+ - **Tailwind ホストでも、バー非表示状態 (スクロール不能なリスト) の描画は変わります。** ホストのビルドが
63
+ `opacity-0` を生成していない場合、2.1.0 までバーは不透明のまま描画されており、2.2.0 で
64
+ `opacity: 1 → 0` / `pointer-events: auto → none` になります (`opacity-0` を生成しているホストでは
65
+ 変化しません)。スクロール可能な状態では幾何・色ともに差分はありません。
66
+ - **非 Tailwind ホスト (standalone アーティファクト) の箱モデルが Tailwind ホストと一致します。**
67
+ 上記のとおり矢印ボタンが縮み、タップサークルのリングが描画され、インセット時のビューポート高さが
68
+ 正しくなります (タイポグラフィはホストの継承のままです)。ピクセル基準のスナップショットを持つ場合は
69
+ 更新が必要です。
70
+ - **standalone アーティファクトがユーティリティクラスを同梱しなくなりました** (9,023 → 5,505 バイト)。
71
+ `@source` 走査は spec ファイルの識別子や docstring の英単語を誤検出して `.hidden` / `.container` /
72
+ `.truncate` などを利用側の名前空間へ注入していました。`.aqvs-*` ルールはバイト単位で不変です
73
+ (両アーティファクトの `@layer components` ブロックは 5,264 バイトで完全一致)。レイヤー順序の宣言は
74
+ 残るため、利用側 `utilities` レイヤーからの上書きは従来どおり可能です。
75
+
5
76
  ## 2.1.0 (2026-08-14)
6
77
 
7
78
  ### Fixed
package/README.md CHANGED
@@ -35,8 +35,14 @@ pnpm add @aiquants/virtualscroll
35
35
  > `@aiquants/directory-tree`, `@aiquants/select-box`, and `@aiquants/daily-report`; when you also
36
36
  > use those packages, import virtualscroll's CSS just once and they all share it.
37
37
  >
38
- > The package ships **two CSS artifacts**. virtualscroll has no JSX utility classes, so the two are
39
- > nearly identical, but both are published for naming consistency across `@aiquants/*`:
38
+ > The package ships **two CSS artifacts**. Neither bundles a CSS reset the standalone build declares
39
+ > `@layer base` but leaves it empty so every `.aqvs-*` rule cancels the UA defaults **its own box model**
40
+ > depends on: `box-sizing`, `border-style`, the UA button bevel and padding, and the tap highlight (2.2.0).
41
+ > The components' box model is therefore identical with and without Tailwind preflight; text that inherits
42
+ > host typography (the "No items" label, the Top/Bottom pill label, your own row content) still follows the
43
+ > host's font and default line-height **by design**. The package's JSX writes `.aqvs-*` class names only,
44
+ > never a Tailwind utility, and the standalone build ships no utilities either — the `.aqvs-*` rules are
45
+ > byte-identical in both artifacts, so import exactly one:
40
46
  >
41
47
  > ```css
42
48
  > /* Tailwind v4 host — components-only build (Artifact A) in the components layer */
@@ -71,14 +77,13 @@ function App() {
71
77
  const getItemHeight = useCallback((index: number) => items[index].height, [])
72
78
 
73
79
  return (
74
- <div style={{ height: '400px', width: '100%' }}>
80
+ <div style={{ height: '400px', width: '100%', border: '1px solid #d1d5db' }}>
75
81
  <VirtualScroll
76
82
  itemCount={items.length}
77
83
  getItem={getItem}
78
84
  getItemHeight={getItemHeight}
79
85
  viewportSize={400}
80
86
  overscanCount={5}
81
- className="border border-gray-300"
82
87
  >
83
88
  {(item, index) => (
84
89
  <div
@@ -201,7 +206,9 @@ exists in the DOM.
201
206
  | `getItemHeight` | `(index: number) => number` | ✅ | Function to get item height |
202
207
  | `viewportSize` | `number` | ✅ | Height of the visible area |
203
208
  | `overscanCount` | `number` | ❌ | Number of items to render outside viewport (default: 15) |
204
- | `className` | `string` | ❌ | CSS class name |
209
+ | `className` | `string` | ❌ | CSS class name. Lands on the scroll root (`.aqvs-scroll-pane`) — see [Custom Scrollbar Styling](#custom-scrollbar-styling) |
210
+ | `getItemKey` | `(index: number) => React.Key` | ❌ | Stable React key per index (defaults to the index) |
211
+ | `testId` | `string` | ❌ | Emitted as `data-testid` on the scroll root. DOM hooks should use `data-*`, never class selectors |
205
212
  | `onScroll` | `(position: number, totalHeight: number) => void` | ❌ | Scroll event handler |
206
213
  | `onRangeChange` | `(range: VirtualScrollRange) => void` | ❌ | Range change handler |
207
214
  | `onWheelHorizontal` | `(deltaX: number) => void` | ❌ | Opt-in horizontal wheel delegation. When set, horizontal-dominant wheel / trackpad gestures (and shift+wheel) are delegated to this handler so the parent can implement horizontal scrolling. When omitted, horizontal gestures and shift+wheel bypass vertical scrolling so parent native scrolling works. See [Horizontal Scrolling](#horizontal-scrolling). |
@@ -220,11 +227,11 @@ exists in the DOM.
220
227
 
221
228
  | Property | Type | Description |
222
229
  | --- | --- | --- |
223
- | `width` | `number` | Width of the scrollbar |
224
- | `enableThumbDrag` | `boolean` | Enable dragging the scrollbar thumb |
225
- | `enableTrackClick` | `boolean` | Enable clicking the scrollbar track |
226
- | `enableArrowButtons` | `boolean` | Enable arrow buttons on the scrollbar |
227
- | `enableScrollToTopBottomButtons` | `boolean` | Enable "Scroll to Top" and "Scroll to Bottom" buttons |
230
+ | `width` | `number` | Width of the scrollbar (default: 12) |
231
+ | `enableThumbDrag` | `boolean` | Enable dragging the scrollbar thumb (default: true) |
232
+ | `enableTrackClick` | `boolean` | Enable clicking the scrollbar track (default: true) |
233
+ | `enableArrowButtons` | `boolean` | Enable arrow buttons on the scrollbar (default: true) |
234
+ | `enableScrollToTopBottomButtons` | `boolean` | Enable "Scroll to Top" and "Scroll to Bottom" buttons (default: false) |
228
235
  | `renderThumbOverlay` | `(props: ScrollBarThumbOverlayRenderProps) => ReactNode` | Render prop to anchor custom UI near the scrollbar thumb |
229
236
  | `tapScrollCircleOptions` | `ScrollBarTapCircleOptions` | Customization for the auxiliary tap scroll circle |
230
237
 
@@ -235,7 +242,7 @@ exists in the DOM.
235
242
  | `enablePointerDrag` | `boolean` | Enable dragging the content area to scroll (default: true). ⚠️ Setting this to `false` removes the only way to scroll on touch devices — the pane is transform-based and has no native scroller. Use `pointerDragInputs` to exclude a single pointer type instead. |
236
243
  | `pointerDragInputs` | `readonly ("mouse" \| "pen" \| "touch")[]` | Pointer types allowed to drag-scroll the content area (default: all three). `touch-action: none` is applied only when `"touch"` or `"pen"` is included. |
237
244
  | `enableKeyboardNavigation` | `boolean` | Enable keyboard navigation (default: true) |
238
- | `wheelSpeedMultiplier` | `number` | Multiplier for mouse wheel scrolling speed |
245
+ | `wheelSpeedMultiplier` | `number` | Multiplier for mouse wheel scrolling speed (default: 1) |
239
246
  | `inertiaOptions` | `ScrollPaneInertiaOptions` | Physics tuning for drag inertia |
240
247
  | `clipItemHeight` | `boolean` | Whether to clip item height (default: false) |
241
248
  | `resetOnGetItemHeightChange` | `boolean` | Whether to reset internal height cache when `getItemHeight` changes (default: false) |
@@ -319,14 +326,29 @@ function AdvancedExample() {
319
326
 
320
327
  return (
321
328
  <div
322
- className="pointer-events-none absolute flex items-center"
323
- style={
324
- props.orientation === 'vertical'
329
+ style={{
330
+ pointerEvents: 'none',
331
+ position: 'absolute',
332
+ display: 'flex',
333
+ alignItems: 'center',
334
+ ...(props.orientation === 'vertical'
325
335
  ? { top: props.thumbCenter, left: -14, transform: 'translate(-100%, -50%)' }
326
- : { left: props.thumbCenter, top: -14, transform: 'translate(-50%, -100%)' }
327
- }
336
+ : { left: props.thumbCenter, top: -14, transform: 'translate(-50%, -100%)' }),
337
+ }}
328
338
  >
329
- <div className="rounded-full border border-slate-200 bg-white px-2 py-1 text-xs font-medium text-slate-700 shadow-md">
339
+ <div
340
+ style={{
341
+ borderRadius: 9999,
342
+ border: '1px solid #e2e8f0',
343
+ background: '#fff',
344
+ padding: '4px 8px',
345
+ fontSize: 12,
346
+ fontWeight: 500,
347
+ color: '#334155',
348
+ whiteSpace: 'nowrap',
349
+ boxShadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1)',
350
+ }}
351
+ >
330
352
  {label}
331
353
  </div>
332
354
  </div>
@@ -359,6 +381,9 @@ function AdvancedExample() {
359
381
 
360
382
  ### Custom Scrollbar Styling
361
383
 
384
+ `className` lands on the **scroll root** (`.aqvs-scroll-pane`). The bar, its track, thumb, arrow buttons
385
+ and the Top/Bottom pills are all descendants of that element, so one wrapper class reaches every part:
386
+
362
387
  ```tsx
363
388
  <VirtualScroll
364
389
  itemCount={items.length}
@@ -369,19 +394,57 @@ function AdvancedExample() {
369
394
  >
370
395
  {(item, index) => <ItemComponent item={item} index={index} />}
371
396
  </VirtualScroll>
397
+ ```
372
398
 
373
- <style>
374
- .custom-virtual-scroll .scrollbar {
375
- background-color: #f0f0f0;
376
- }
377
-
378
- .custom-virtual-scroll .scrollbar-thumb {
379
- background-color: #007acc;
380
- border-radius: 4px;
381
- }
382
- </style>
399
+ ```css
400
+ /* The bar and its track. The stripe you see behind the thumb is the track. */
401
+ .custom-virtual-scroll .aqvs-scrollbar { background-color: #f0f0f0; }
402
+ .custom-virtual-scroll .aqvs-scrollbar-track { background-color: #e8e8e8; }
403
+
404
+ /* The thumb. Restate the states you want to keep — see "State rules are replaced" below. */
405
+ .custom-virtual-scroll .aqvs-scrollbar-thumb { background-color: #007acc; }
406
+ .custom-virtual-scroll .aqvs-scrollbar-thumb[data-thumb-state="hover"] { background-color: #3399dd; }
407
+ .custom-virtual-scroll .aqvs-scrollbar-thumb[data-thumb-state="dragging"] { background-color: #005c99; }
408
+ .custom-virtual-scroll .aqvs-scrollbar-thumb[data-thumb-state="disabled"] { background-color: #b0c4d4; }
409
+
410
+ /* Arrow buttons and the Top/Bottom pills. */
411
+ .custom-virtual-scroll .aqvs-scrollbar-arrow-button { background-color: #e8e8e8; color: #007acc; }
412
+ .custom-virtual-scroll .aqvs-scrollbar-arrow-button:enabled:hover { background-color: #cfe8f7; }
413
+ .custom-virtual-scroll .aqvs-scroll-to-edge-button { background-color: rgba(0, 122, 204, 0.85); }
414
+ .custom-virtual-scroll .aqvs-scroll-to-edge-button:hover { background-color: rgba(0, 92, 153, 0.9); }
383
415
  ```
384
416
 
417
+ The packaged rules live in `@layer components` in **both** artifacts, so an ordinary (unlayered) rule in
418
+ your app wins regardless of specificity and regardless of import order — no `!important`, no deeper
419
+ selector. Keep your rules unlayered: written inside a `@layer components { … }` block of your own you
420
+ re-enter the package's layer, and ordinary specificity — then source order — decides again. The example
421
+ above still wins there (every selector is prefixed with your wrapper class), but an unprefixed
422
+ `.aqvs-scrollbar-thumb { … }` in that layer loses on hover and while dragging, and an equally specific
423
+ rule loses outright if your stylesheet is ordered before the package's.
424
+
425
+ Three consequences are worth knowing:
426
+
427
+ - **State rules are replaced, not merged.** The thumb publishes `data-thumb-state` (`idle` / `hover` /
428
+ `dragging` / `disabled`; `disabled` whenever `scrollBarOptions.enableThumbDrag` is `false`). A single
429
+ flat `.aqvs-scrollbar-thumb { background-color: … }` freezes the thumb at that one colour, and the same
430
+ applies to `.aqvs-scrollbar-arrow-button:enabled:hover` and `.aqvs-scroll-to-edge-button:hover`. The
431
+ shape feedback survives untouched: `scaleX(1.06)` / `scaleX(1.12)` on a vertical bar, `scaleY(…)` on a
432
+ horizontal one — and the same state rules pull the cross-axis edges from `1.5px` to `-0.5px`, which is
433
+ most of the growth at the default `width: 12`.
434
+ - **Inline styles still outrank your rule.** Every size and position — the bar's width, the arrow buttons,
435
+ the thumb geometry — plus the thumb's `border-radius` / `cursor` and the track's `border-radius` are
436
+ written inline from `scrollBarOptions.width`, `viewportSize` and the scroll position. Change sizing
437
+ through the props; to re-round the corners use `!important`.
438
+ - **Do not hand-roll the hidden state.** When the content fits the viewport, the bar and the thumb wrapper
439
+ carry `data-visible="false"` and the packaged rule hides them (`opacity: 0; pointer-events: none`). If
440
+ you override `opacity` on `.aqvs-scrollbar`, scope it to `[data-visible="true"]`.
441
+
442
+ The parts you are most likely to target: `.aqvs-scroll-pane` (root), `.aqvs-scroll-pane-content` (row
443
+ viewport), `.aqvs-scrollbar` (+ `-vertical` / `-horizontal`), `.aqvs-scrollbar-track`,
444
+ `.aqvs-scrollbar-thumb-wrapper`, `.aqvs-scrollbar-thumb` (+ `-vertical` / `-horizontal`),
445
+ `.aqvs-scrollbar-arrow-button`, `.aqvs-scroll-to-edge-overlay` / `-button`, `.aqvs-tap-scroll-circle`,
446
+ `.aqvs-item-container`.
447
+
385
448
  ### Tap Scroll Circle Configuration
386
449
 
387
450
  The auxiliary tap scroll circle can replace the native scrollbar for large datasets while remaining easy to control:
@@ -1 +1 @@
1
- {"version":3,"file":"ScrollBar.d.ts","sourceRoot":"","sources":["../src/ScrollBar.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAIrD,OAAO,EAA8E,KAAK,0BAA0B,EAAE,MAAM,uBAAuB,CAAA;AAiEnJ;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACpC,oEAAoE;IACpE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,mFAAmF;IACnF,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,iFAAiF;IACjF,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,iFAAiF;IACjF,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,0BAA0B,KAAK,SAAS,CAAA;IAC/D,4FAA4F;IAC5F,aAAa,CAAC,EAAE;QACZ,qEAAqE;QACrE,oBAAoB,EAAE,MAAM,CAAA;QAC5B,gEAAgE;QAChE,gBAAgB,CAAC,EAAE,MAAM,CAAA;QACzB,4EAA4E;QAC5E,WAAW,CAAC,EAAE,MAAM,CAAA;KACvB,CAAA;CACJ,CAAA;AAaD,qIAAqI;AACrI,eAAO,MAAM,uBAAuB,oCAAoC,CAAA;AAExE;;;;GAIG;AACH,MAAM,MAAM,gCAAgC,GAAG;IAC3C,WAAW,EAAE,UAAU,GAAG,YAAY,CAAA;IACtC,cAAc,EAAE,MAAM,CAAA;IACtB,iBAAiB,EAAE,MAAM,CAAA;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;IACnB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IACzB,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAA;IACnB,gDAAgD;IAChD,YAAY,EAAE,MAAM,CAAA;IACpB,iDAAiD;IACjD,cAAc,EAAE,MAAM,CAAA;IACtB,wIAAwI;IACxI,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,GAAG,CAAC,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAA;IACrH,iFAAiF;IACjF,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,wFAAwF;IACxF,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,qFAAqF;IACrF,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,6DAA6D;IAC7D,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,+CAA+C;IAC/C,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,6DAA6D;IAC7D,sBAAsB,CAAC,EAAE,yBAAyB,CAAA;IAClD,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6EAA6E;IAC7E,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,gCAAgC,KAAK,SAAS,CAAA;IAC3E,+DAA+D;IAC/D,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,8DAA8D;IAC9D,eAAe,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAQD;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB;IAClC,mDAAmD;;IAEnD,wBAAwB;;CAElB,CAAA;AAsNV;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAA;IAChB,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAA;IACnB,8BAA8B;IAC9B,YAAY,EAAE,MAAM,CAAA;IACpB,wBAAwB;IACxB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,wBAAwB;IACxB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,yDAAyD;IACzD,2BAA2B,EAAE,OAAO,CAAA;IACpC,kDAAkD;IAClD,KAAK,CAAC,EAAE;QAAE,oBAAoB,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAC5F,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EG;AACH,eAAO,MAAM,qBAAqB,GAAI,qHAAqH,mBAAmB,KAAG,MAuChL,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,sCAAsC,GAAI,YAAY,MAAM,WASxE,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,iQAiBvB,cAAc,gCA69BhB,CAAA"}
1
+ {"version":3,"file":"ScrollBar.d.ts","sourceRoot":"","sources":["../src/ScrollBar.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAIrD,OAAO,EAA8E,KAAK,0BAA0B,EAAE,MAAM,uBAAuB,CAAA;AAiEnJ;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACpC,oEAAoE;IACpE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,mFAAmF;IACnF,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,iFAAiF;IACjF,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,iFAAiF;IACjF,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,0BAA0B,KAAK,SAAS,CAAA;IAC/D,4FAA4F;IAC5F,aAAa,CAAC,EAAE;QACZ,qEAAqE;QACrE,oBAAoB,EAAE,MAAM,CAAA;QAC5B,gEAAgE;QAChE,gBAAgB,CAAC,EAAE,MAAM,CAAA;QACzB,4EAA4E;QAC5E,WAAW,CAAC,EAAE,MAAM,CAAA;KACvB,CAAA;CACJ,CAAA;AAaD,qIAAqI;AACrI,eAAO,MAAM,uBAAuB,oCAAoC,CAAA;AAExE;;;;GAIG;AACH,MAAM,MAAM,gCAAgC,GAAG;IAC3C,WAAW,EAAE,UAAU,GAAG,YAAY,CAAA;IACtC,cAAc,EAAE,MAAM,CAAA;IACtB,iBAAiB,EAAE,MAAM,CAAA;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;IACnB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IACzB,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAA;IACnB,gDAAgD;IAChD,YAAY,EAAE,MAAM,CAAA;IACpB,iDAAiD;IACjD,cAAc,EAAE,MAAM,CAAA;IACtB,wIAAwI;IACxI,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,GAAG,CAAC,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAA;IACrH,iFAAiF;IACjF,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,wFAAwF;IACxF,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,qFAAqF;IACrF,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,6DAA6D;IAC7D,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,+CAA+C;IAC/C,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,6DAA6D;IAC7D,sBAAsB,CAAC,EAAE,yBAAyB,CAAA;IAClD,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6EAA6E;IAC7E,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,gCAAgC,KAAK,SAAS,CAAA;IAC3E,+DAA+D;IAC/D,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,8DAA8D;IAC9D,eAAe,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAQD;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB;IAClC,mDAAmD;;IAEnD,wBAAwB;;CAElB,CAAA;AAsNV;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAA;IAChB,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAA;IACnB,8BAA8B;IAC9B,YAAY,EAAE,MAAM,CAAA;IACpB,wBAAwB;IACxB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,wBAAwB;IACxB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,yDAAyD;IACzD,2BAA2B,EAAE,OAAO,CAAA;IACpC,kDAAkD;IAClD,KAAK,CAAC,EAAE;QAAE,oBAAoB,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAC5F,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EG;AACH,eAAO,MAAM,qBAAqB,GAAI,qHAAqH,mBAAmB,KAAG,MAuChL,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,sCAAsC,GAAI,YAAY,MAAM,WASxE,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,iQAiBvB,cAAc,gCAk+BhB,CAAA"}
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("react/jsx-runtime"),r=require("react"),gt=require("tailwind-merge");class w{level;prefix;impl;constructor(e=2,t="[virtualscroll]",s=console){this.level=e,this.prefix=t,this.impl=s}static instance=new w(2,"[virtualscroll]");static setLevel(e){w.instance.setLevel(e)}setLevel(e){this.level=e}static setImplementation(e){w.instance.setImplementation(e)}setImplementation(e){this.impl=e}static setPrefix(e){w.instance.setPrefix(e)}setPrefix(e){this.prefix=e}static isEnabled(e){return w.instance.isEnabled(e)}isEnabled(e){return this.level<=e}static resolveLazy(e){if(typeof e!="function")return e;try{return e()}catch{return e}}formatMessage(e){return typeof e=="string"?[`${this.prefix} ${e}`]:[this.prefix,e]}static debug(e,...t){w.instance.debug(e,...t)}debug(e,...t){this.level<=0&&this.impl.debug(...this.formatMessage(w.resolveLazy(e)),...t.map(w.resolveLazy))}static info(e,...t){w.instance.info(e,...t)}info(e,...t){this.level<=1&&this.impl.info(...this.formatMessage(w.resolveLazy(e)),...t.map(w.resolveLazy))}static warn(e,...t){w.instance.warn(e,...t)}warn(e,...t){this.level<=2&&this.impl.warn(...this.formatMessage(w.resolveLazy(e)),...t.map(w.resolveLazy))}static error(e,...t){w.instance.error(e,...t)}error(e,...t){this.level<=3&&this.impl.error(...this.formatMessage(w.resolveLazy(e)),...t.map(w.resolveLazy))}}const Yt={active:!1,offsetX:0,offsetY:0,distance:0,direction:0,pointerId:null},Dt=6,er=8,tr=({dragState:n,normalizedDistance:e})=>{const t=1+e*.18,s=.16+e*.24,i=.38+e*.28,a=n.active?"80ms ease-out":"220ms ease";return Y.jsxs(Y.Fragment,{children:[Y.jsx("div",{className:"aqvs-tap-scroll-circle-visual-outer",style:{background:"linear-gradient(140deg, rgba(255,255,255,0.62), rgba(72,72,72,0.48))",boxShadow:`0 0 0 1px rgba(255,255,255,0.28), 0 10px 22px rgba(0,0,0,${s})`,transform:`scale(${t})`,transition:`${a}, ${n.active?"80ms":"260ms"} box-shadow ease`}}),Y.jsx("div",{className:"aqvs-tap-scroll-circle-inner",style:{background:"linear-gradient(140deg, rgba(255,255,255,0.72), rgba(28,28,28,0.58))",boxShadow:"inset 0 4px 10px rgba(0,0,0,0.24), inset 0 0 2px rgba(255,255,255,0.55)",opacity:i,transition:n.active?"120ms opacity ease-out":"220ms opacity ease"}})]})},Ut=r.memo(r.forwardRef(({onDragChange:n,className:e,maxVisualDistance:t=160,size:s=40,style:i,opacity:a=1,renderVisual:c},u)=>{const[d,x]=r.useState(Yt),I=r.useRef(null),M=r.useRef(null),E=r.useRef({x:0,y:0}),h=r.useRef(null),N=r.useRef(0),F=r.useCallback(T=>{x(T),n(T)},[n]),U=r.useCallback((T,B,q=!1)=>{const{x:Ye,y:Ne}=E.current,te=T-Ye,re=B-Ne,W=Math.abs(re),Z=W<Dt?0:re<0?-1:1,Te=N.current;let Ve=Z;const $e=Dt+er;Z===0?Te!==0&&W<$e?Ve=Te:(Ve=0,q||(N.current=0)):Z!==Te&&Te!==0&&W<$e?Ve=Te:N.current=Z,F({active:q||W>=Dt,offsetX:te,offsetY:re,distance:W,direction:Ve,pointerId:I.current})},[F]),ie=r.useCallback(T=>{if(T===null)return;const B=h.current;B?.hasPointerCapture(T)&&B.releasePointerCapture(T)},[]),Q=r.useCallback((T=!1)=>{T&&ie(I.current),I.current=null,M.current=null,N.current=0,F(Yt)},[F,ie]),ee=r.useCallback(T=>{if(I.current!==null&&I.current!==T.pointerId){M.current={pointerId:T.pointerId,clientX:T.clientX,clientY:T.clientY},T.preventDefault(),T.stopPropagation();return}T.preventDefault(),T.stopPropagation();const B=h.current??T.currentTarget,{left:q,top:Ye,width:Ne,height:te}=B.getBoundingClientRect();E.current={x:q+Ne/2,y:Ye+te/2},I.current=T.pointerId;try{B.setPointerCapture(T.pointerId)}catch{}U(T.clientX,T.clientY,!0)},[U]),ge=r.useCallback(T=>{if(I.current!==T.pointerId){M.current!==null&&M.current.pointerId===T.pointerId&&(M.current={pointerId:T.pointerId,clientX:T.clientX,clientY:T.clientY});return}T.preventDefault(),U(T.clientX,T.clientY)},[U]),ye=r.useCallback(T=>{if(I.current!==T.pointerId){M.current!==null&&M.current.pointerId===T.pointerId&&(M.current=null);return}T.preventDefault(),T.stopPropagation();const B=M.current;if(M.current=null,B!==null){ie(T.pointerId);const q=h.current;let Ye=!0;if(q!==null&&typeof q.setPointerCapture=="function")try{q.setPointerCapture(B.pointerId)}catch(Ne){(typeof Ne=="object"&&Ne!==null&&"name"in Ne?Ne.name:void 0)==="NotFoundError"&&(Ye=!1)}if(Ye){I.current=B.pointerId,U(B.clientX,B.clientY,!0);return}}Q(!0)},[Q,ie,U]),V=r.useCallback(T=>{T.target===T.currentTarget&&I.current===T.pointerId&&Q(!1)},[Q]);r.useImperativeHandle(u,()=>({reset:()=>{Q(!0)},getElement:()=>h.current}),[Q]);const L=Math.min(Math.max(a,0),1),S=s/64,j=Math.min(d.distance,t)/t,G=d.direction*j*10*S,P=c??tr,ae={dragState:d,normalizedDistance:j,sizeScale:S,size:s,opacity:L},K={...i,width:s,height:s,transform:`translateY(${G}px)`};return K.opacity=L,Y.jsx("div",{ref:h,"data-testid":"virtual-scroll-tap-circle",className:gt.twMerge("aqvs-tap-scroll-circle",e),style:K,tabIndex:-1,onPointerDown:ee,onPointerMove:ge,onPointerUp:ye,onPointerCancel:ye,onLostPointerCapture:V,role:"presentation",children:P(ae)})}));Ut.displayName="TapScrollCircle";const J=(n,e,t)=>Math.max(e,Math.min(t,n)),Ft="virtualscroll:tap-scroll-cancel",Bt=20,rr=250,nr=60,sr=20,ir=20,zt={maxDistance:240,minSpeedMultiplier:.2},ar=zt.maxDistance,qt={active:!1,offsetX:0,offsetY:0,distance:0,direction:0,pointerId:null},At=2.2,or=8,lr=120,cr=1/10,Je={enabled:!0,size:40,offsetX:-80,offsetY:0,className:void 0,maxVisualDistance:ar,minSpeedMultiplier:zt.minSpeedMultiplier,opacity:.9,renderVisual:void 0,maxSpeedCurve:void 0},ur=n=>n?{mainSizeKey:"width",crossSizeKey:"height",positionKey:"left",selectDelta:(e,t)=>e,getPointerCoordinate:({clientX:e})=>e,arrowLabels:["Scroll left","Scroll right"],arrowIcons:["◀","▶"],directionClass:"aqvs-scrollbar-horizontal",orientation:"horizontal"}:{mainSizeKey:"height",crossSizeKey:"width",positionKey:"top",selectDelta:(e,t)=>t,getPointerCoordinate:({clientY:e})=>e,arrowLabels:["Scroll up","Scroll down"],arrowIcons:["▲","▼"],directionClass:"aqvs-scrollbar-vertical",orientation:"vertical"},fr=(n,e)=>{const t=n?.maxSpeedMultiplier,s=typeof t=="number"?t:Wt(e);return{enabled:n?.enabled??Je.enabled,size:n?.size??Je.size,offsetX:n?.offsetX??Je.offsetX,offsetY:n?.offsetY??Je.offsetY,className:n?.className??Je.className,maxVisualDistance:n?.maxVisualDistance??Je.maxVisualDistance,maxSpeedMultiplier:s,minSpeedMultiplier:Math.max(n?.minSpeedMultiplier??Je.minSpeedMultiplier,0),opacity:J(n?.opacity??Je.opacity,0,1),renderVisual:n?.renderVisual??Je.renderVisual,maxSpeedCurve:n?.maxSpeedCurve??Je.maxSpeedCurve}},dr=({isDragging:n,isThumbHovered:e,enableThumbDrag:t})=>r.useMemo(()=>t?n?"dragging":e?"hover":"idle":"disabled",[t,n,e]),mr=({canUseArrowButtons:n,enableArrowButtons:e,resetTapScroll:t,scrollByStep:s})=>{const i=r.useRef(null),a=r.useRef(null),c=r.useRef(null),u=r.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null),a.current!==null&&(window.clearTimeout(a.current),a.current=null),c.current!==null&&(window.removeEventListener("pointerup",c.current),window.removeEventListener("pointercancel",c.current),window.removeEventListener("blur",c.current),c.current=null)},[]),d=r.useCallback(()=>{u()},[u]),x=r.useCallback(M=>E=>{if(!n)return;E.cancelable&&E.preventDefault(),E.stopPropagation(),t(),u(),s(M),a.current=window.setTimeout(()=>{i.current=window.setInterval(()=>{s(M)},nr)},rr);const h=()=>u();c.current=h,window.addEventListener("pointerup",h),window.addEventListener("pointercancel",h),window.addEventListener("blur",h)},[n,u,t,s]),I=r.useCallback(M=>E=>{e&&(E.key==="Enter"||E.key===" "||E.key==="Spacebar")&&(E.preventDefault(),s(M))},[e,s]);return r.useEffect(()=>{n||u()},[n,u]),r.useEffect(()=>()=>{u()},[u]),{handleArrowPointerDown:x,handleArrowPointerUp:d,handleArrowKeyDown:I}},pr=700,dt=(n,e)=>typeof n=="number"&&Number.isFinite(n)?n:e,Kt=({distance:n,maxDistance:e,viewportSize:t,minSpeedMultiplier:s,maxSpeedMultiplier:i,hasCustomMaxSpeedMultiplier:a,curve:c})=>{const u=Math.max(dt(n,0),0),d=dt(e,0),x=d>0?Math.min(u,d)/d:1,I=Math.max(dt(t,0),0),M=Math.max(dt(s,0),0),E=Math.max(dt(i,0),0),h=Math.max(I*M,40),N=a?h:1200,F=Math.max(I*E,N),U=c?Math.max(dt(c.exponentialScale,E),0):0,ie=c?Math.min(F,Math.max(I*U,h)):F,Q=Math.max(ie,h);let ee=x**1.1;if(c){const ye=Math.min(Math.max(dt(c.exponentialSteepness,0),0),pr);if(ye===0)ee=x;else{const V=Math.expm1(ye)||1;ee=Math.min(Math.max(Math.expm1(ye*x)/V,0),1)}}const ge=Math.min(Math.max(dt(c?.easedOffset,0),0),1);return h+(Q-h)*(ge+(1-ge)*ee)},Wt=n=>{if(!n||n<=0)return At;const e=Math.max(1,n),t=Math.log10(e),s=At+t*or;return J(s,At,lr)},Gt=({contentSize:n,viewportSize:e,scrollPosition:t,onScroll:s,enableThumbDrag:i=!0,enableTrackClick:a=!0,enableArrowButtons:c=!0,horizontal:u=!1,scrollBarWidth:d=12,className:x,ariaControls:I,tapScrollCircleOptions:M,itemCount:E,renderThumbOverlay:h,visibleStartIndex:N,visibleEndIndex:F})=>{const[U,ie]=r.useState(!1),[Q,ee]=r.useState(!1),[ge,ye]=r.useState(!1),V=r.useRef(null),L=r.useRef({pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0,scale:1,captureTarget:null}),S=r.useRef({pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0,scale:1}),j=r.useRef(t),G=r.useRef(s),P=r.useRef(qt),ae=r.useRef(null),K=r.useRef(null),T=r.useRef(null),B=r.useRef(0),q=r.useRef(0),Ye=r.useMemo(()=>fr(M,E),[E,M]),Ne=r.useMemo(()=>ur(u),[u]),{enabled:te,size:re,offsetX:W,offsetY:Z,className:Te,maxVisualDistance:Ve,maxSpeedMultiplier:$e,minSpeedMultiplier:y,opacity:lt,renderVisual:ne,maxSpeedCurve:C}=Ye,Ee=r.useRef({viewportSize:e,maxScrollPosition:Math.max(n-e,0),scrollBarVisible:n>e,effectiveTapMaxDistance:Math.max(Ve,1),tapCircleMaxSpeedMultiplier:$e,tapCircleMinSpeedMultiplier:y,tapCircleMaxSpeedCurve:C,tapScrollCircleOptions:M,effectiveTrackLength:0,onScroll:s,scrollPosition:t}),{mainSizeKey:_e,crossSizeKey:We,positionKey:qe,selectDelta:g,getPointerCoordinate:_,arrowLabels:pe,arrowIcons:H,directionClass:Me,orientation:oe}=Ne,be=Math.max(Ve,1),Se=e/n,Re=Math.max(e-d*2,0),le=Se*Re,ke=Math.min(Math.max(Bt,le||0),Re||Bt),ce=n-e,se=Math.max(Re-ke,0),De=ce<=0||se<=0?0:J(t/ce*se,0,se),Be=De+ke/2,Ce=n>e||U,Qe=Ce&&c;r.useLayoutEffect(()=>{Ee.current={viewportSize:e,maxScrollPosition:ce,scrollBarVisible:Ce,effectiveTapMaxDistance:be,tapCircleMaxSpeedMultiplier:$e,tapCircleMinSpeedMultiplier:y,tapCircleMaxSpeedCurve:C,tapScrollCircleOptions:M,effectiveTrackLength:se,onScroll:s,scrollPosition:t}}),r.useLayoutEffect(()=>{j.current=t},[t]),r.useLayoutEffect(()=>{G.current=s},[s]),r.useEffect(()=>{i||ee(!1)},[i]);const Ue=dr({isDragging:U,isThumbHovered:Q,enableThumbDrag:i}),we=r.useCallback((o,b)=>{const v=Ee.current,D=b??j.current;if(G.current){const Oe=G.current(o,D);if(typeof Oe=="number"&&Number.isFinite(Oe))return j.current=Oe,Oe}const z=typeof o=="function"?o(D):o,he=Math.max(v.maxScrollPosition,0),Ae=v.scrollBarVisible?J(z,0,he):0;return j.current=Ae,Ae},[]),m=r.useCallback(o=>{const b=Ee.current,v=j.current;if(!b.scrollBarVisible||b.maxScrollPosition<=0){const at=we(0,v),l=at-v;return{nextPosition:at,actualDelta:l,reachedBoundary:!0}}if(o===0)return{nextPosition:v,actualDelta:0,reachedBoundary:!1};const z=we(at=>J(at+o,0,b.maxScrollPosition),v),he=z-v,Ae=o<0&&v+o<=0,Oe=o>0&&v+o>=b.maxScrollPosition,xt=o<0&&(z<=0||Ae&&he===0)||o>0&&(z>=b.maxScrollPosition||Oe&&he===0);return{nextPosition:z,actualDelta:he,reachedBoundary:xt}},[we]),R=r.useCallback((o,b)=>{o.current+=b;const v=Math.max(Ee.current.maxScrollPosition,0);v>0&&(o.current=J(o.current,-v,v));const D=m(o.current);return o.current-=D.actualDelta,D.reachedBoundary&&(o.current=0),D},[m]),ue=r.useCallback(()=>{K.current!==null&&(window.cancelAnimationFrame(K.current),K.current=null),T.current=null,B.current=0,q.current=0},[]),xe=r.useCallback(()=>{P.current={...qt},ye(!1),ae.current?.reset(),ue()},[ue]),ve=r.useCallback(o=>{const b=P.current,v=Ee.current;if(!b.active||b.direction===0){ue();return}if(!v.scrollBarVisible||v.maxScrollPosition<=0){ue();return}const D=T.current??o,z=Math.max((o-D)/1e3,0),he=Math.min(z,cr);if(T.current=o,he<=0){K.current=window.requestAnimationFrame(ve);return}const Ae=Kt({distance:b.distance,maxDistance:v.effectiveTapMaxDistance,viewportSize:v.viewportSize,minSpeedMultiplier:v.tapCircleMinSpeedMultiplier,maxSpeedMultiplier:v.tapCircleMaxSpeedMultiplier,hasCustomMaxSpeedMultiplier:typeof v.tapScrollCircleOptions?.maxSpeedMultiplier=="number",curve:v.tapCircleMaxSpeedCurve});q.current!==b.direction&&(q.current=b.direction,B.current=0);const{reachedBoundary:Oe}=R(B,b.direction*Ae*he);if(Oe){ue();return}K.current=window.requestAnimationFrame(ve)},[R,ue]),et=r.useCallback(()=>{K.current===null&&(T.current=null,B.current=0,K.current=window.requestAnimationFrame(ve))},[ve]);r.useEffect(()=>{const o=P.current;!o.active||o.direction===0||et()},[n,e,et]),r.useEffect(()=>()=>{ue()},[ue]);const Ge=r.useCallback(o=>{P.current=o,ye(o.active),o.active&&o.direction!==0?et():ue()},[et,ue]);r.useEffect(()=>{te||xe()},[xe,te]),r.useEffect(()=>{const o=b=>{const D=b.detail?.paneId;D&&I&&D!==I||xe()};return window.addEventListener(Ft,o),()=>{window.removeEventListener(Ft,o)}},[I,xe]),r.useEffect(()=>{if(!te)return;const o=b=>{if(!P.current.active||P.current.pointerId===b.pointerId)return;const v=b.target;if(!(v instanceof Node)){xe();return}ae.current?.getElement()?.contains(v)||xe()};return document.addEventListener("pointerdown",o,!0),()=>{document.removeEventListener("pointerdown",o,!0)}},[xe,te]);const Ze=o=>{if(!Ce||se<=0||ce<=0)return 0;const b=J(o,0,se);return J(b/se*ce,0,ce)},Xe=r.useCallback(o=>{const{scrollBarVisible:b,effectiveTrackLength:v,maxScrollPosition:D}=Ee.current;if(w.debug("[ScrollBar] calculateScrollPositionFromThumb",()=>({thumbPos:o,trackLen:v,maxScroll:D})),v<=0||D<=0)return null;const z=J(o,0,v);return J(z/v*D,0,D)},[]),tt=r.useCallback(o=>{const b=o.getBoundingClientRect(),v=u?b.width:b.height,D=xt=>{const at=Number.parseFloat(xt);return Number.isFinite(at)?at:0},z=window.getComputedStyle(o),he=D(u?z.width:z.height),Ae=he>0?he+D(u?z.paddingLeft:z.paddingTop)+D(u?z.paddingRight:z.paddingBottom)+D(u?z.borderLeftWidth:z.borderTopWidth)+D(u?z.borderRightWidth:z.borderBottomWidth):0,Oe=Ae>0?Ae:u?o.offsetWidth:o.offsetHeight;return Oe<=0||v<=0?1:v/Oe},[u]),ct=r.useCallback(o=>{const b=L.current;if(b.pointerId!==o.pointerId)return;const v=o.clientX-b.startClientX,D=o.clientY-b.startClientY,z=g(v,D)/(b.scale||1);w.debug("[ScrollBar] handleThumbPointerMove",()=>({delta:z,startThumbPosition:b.startThumbPosition,clientY:o.clientY,startClientY:b.startClientY,metrics:Ee.current}));const he=Xe(b.startThumbPosition+z);he!==null&&we(he),o.cancelable&&o.preventDefault()},[g,Xe,we]),Ke=r.useCallback(o=>{const b=L.current;if(b.pointerId!==o.pointerId)return;document.removeEventListener("pointermove",ct),document.removeEventListener("pointerup",Ke),document.removeEventListener("pointercancel",Ke);const v=b.captureTarget;if(v?.hasPointerCapture?.(o.pointerId)&&v.releasePointerCapture(o.pointerId),L.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0,scale:1,captureTarget:null},ie(!1),V.current){const D=V.current.getBoundingClientRect();o.clientX>=D.left&&o.clientX<=D.right&&o.clientY>=D.top&&o.clientY<=D.bottom||ee(!1)}else ee(!1)},[ct]);r.useEffect(()=>()=>{document.removeEventListener("pointermove",ct),document.removeEventListener("pointerup",Ke),document.removeEventListener("pointercancel",Ke)},[ct,Ke]);const Tt=r.useRef(0),fe=r.useRef(0),ut=r.useCallback(o=>{const b=Math.max(Math.round(Ee.current.viewportSize/ir),sr);fe.current!==o&&(fe.current=o,Tt.current=0),R(Tt,o*b)},[R]),{handleArrowPointerDown:vt,handleArrowPointerUp:bt,handleArrowKeyDown:He}=mr({canUseArrowButtons:Qe,enableArrowButtons:c,resetTapScroll:xe,scrollByStep:ut}),Pt=o=>{if(!Ce)return;if(!i){o.preventDefault(),o.stopPropagation();return}if(o.pointerType==="mouse"&&o.button!==0||o.ctrlKey)return;xe();const b=o.currentTarget,v=tt(b);let D=null;if(b.setPointerCapture)try{b.setPointerCapture(o.pointerId),D=b}catch{D=null}L.current={pointerId:o.pointerId,startThumbPosition:De,startClientX:o.clientX,startClientY:o.clientY,scale:v,captureTarget:D},document.addEventListener("pointermove",ct),document.addEventListener("pointerup",Ke),document.addEventListener("pointercancel",Ke),ie(!0),ee(!0),o.preventDefault(),o.stopPropagation()},yt=o=>{if(!Ce)return;if(!a){o.preventDefault(),o.stopPropagation();return}if(o.pointerType==="mouse"&&o.button!==0||o.ctrlKey)return;const b=o.currentTarget,v=b.getBoundingClientRect(),D=_(o),z=tt(b),he=(D-(u?v.left:v.top))/z;xe();const Ae=he-ke/2,Oe=Ze(Ae);if(we(Oe),b.setPointerCapture)try{b.setPointerCapture(o.pointerId)}catch{}S.current={pointerId:o.pointerId,startThumbPosition:Ae,startClientX:o.clientX,startClientY:o.clientY,scale:z},o.preventDefault(),o.stopPropagation()},mt=()=>{S.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0,scale:1}},Ct=o=>{const b=S.current;if(b.pointerId!==o.pointerId)return;if(o.pointerType==="mouse"&&o.buttons===0){mt();return}const v=o.clientX-b.startClientX,D=o.clientY-b.startClientY,z=g(v,D)/(b.scale||1),he=Ze(b.startThumbPosition+z);we(he),o.cancelable&&o.preventDefault()},kt=o=>{if(S.current.pointerId!==o.pointerId)return;const b=o.currentTarget;b.hasPointerCapture?.(o.pointerId)&&b.releasePointerCapture(o.pointerId),mt(),o.preventDefault(),o.stopPropagation()},rt=o=>{if(S.current.pointerId!==o.pointerId)return;const b=o.currentTarget;b.hasPointerCapture?.(o.pointerId)&&b.releasePointerCapture(o.pointerId),mt()},ft=o=>{o.target===o.currentTarget&&S.current.pointerId===o.pointerId&&mt()},nt=r.useMemo(()=>J((ge?1:.8)*lt,0,1),[ge,lt]),st=r.useMemo(()=>{const b=`calc(50% - ${re/2}px + ${Z}px)`;return{left:W,top:b}},[W,Z,re]),it=(o,b,v,D)=>Y.jsx("button",{type:"button",tabIndex:0,className:"aqvs-scrollbar-arrow-button",style:{[_e]:d,[We]:d},"aria-label":b,onPointerDown:vt(o),onPointerUp:bt,onPointerLeave:bt,onPointerCancel:bt,onKeyDown:He(o),"aria-disabled":!c,disabled:!Qe,children:Y.jsx("span",{"aria-hidden":"true",children:v})},D),pt=h&&Ce?{orientation:oe,scrollPosition:t,maxScrollPosition:ce,contentSize:n,viewportSize:e,thumbSize:ke,thumbPosition:De,thumbCenter:Be,trackSize:Re,isDragging:U,isTapScrollActive:ge,visibleStartIndex:N,visibleEndIndex:F}:null;return Y.jsxs("div",{className:gt.twMerge("aqvs-scrollbar",Me,!Ce&&"pointer-events-none opacity-0",x),style:{[_e]:e,[We]:d},role:"scrollbar",tabIndex:-1,"aria-controls":I,"aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":ce,"aria-orientation":u?"horizontal":"vertical",children:[!u&&Ce&&te&&Y.jsx(Ut,{ref:ae,className:gt.twMerge("aqvs-scrollbar-tap-circle-wrapper",Te),size:re,maxVisualDistance:be,style:st,opacity:nt,renderVisual:ne,onDragChange:Ge},"tap-circle"),it(-1,pe[0],H[0],"arrow-start"),Y.jsxs("div",{className:"aqvs-scrollbar-track",style:{borderRadius:d/2},onPointerDown:yt,onPointerMove:Ct,onPointerUp:kt,onPointerCancel:rt,onLostPointerCapture:ft,"aria-disabled":!a,children:[pt&&Y.jsx("div",{className:"aqvs-scrollbar-overlay","aria-hidden":!0,children:h?.(pt)},"overlay"),Y.jsx("div",{className:gt.twMerge("aqvs-scrollbar-thumb-wrapper",!(Ce||U)&&"pointer-events-none opacity-0"),style:{[_e]:ke,[qe]:De,...u?{top:0,bottom:0}:{left:0,right:0}},onPointerDown:Pt,role:"slider","aria-orientation":u?"horizontal":"vertical","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":ce,"aria-disabled":!i,tabIndex:-1,children:Y.jsx("div",{ref:V,className:gt.twMerge("aqvs-scrollbar-thumb",u?"aqvs-scrollbar-thumb-horizontal":"aqvs-scrollbar-thumb-vertical"),"data-testid":"aqvs-scrollbar-thumb","data-thumb-state":Ue,style:{borderRadius:d-1,cursor:i?"pointer":"default"},onMouseEnter:()=>{i&&ee(!0)},onMouseLeave:()=>{i&&ee(!1)}},"thumb")},"thumb-wrapper")]},"track"),it(1,pe[1],H[1],"arrow-end")]})},hr=["mouse","pen","touch"],Lt=(n,e)=>!(n==="mouse"||n==="pen"||n==="touch")||e.includes(n),gr=n=>n==="mouse"||n==="pen",St={maxVelocity:6,minVelocity:.02,deceleration:.0025,velocitySampleWindow:90,startVelocityThreshold:.04},wt=(n,e,t)=>{for(const[s,i,a]of e)t==="add"?n.addEventListener(s,i,a):n.removeEventListener(s,i,a)},Zt=r.forwardRef(({children:n,contentSize:e,viewportSize:t,scrollBarWidth:s=12,enableThumbDrag:i=!0,enableTrackClick:a=!0,enableArrowButtons:c=!0,enablePointerDrag:u=!0,pointerDragInputs:d=hr,onScroll:x,className:I,testId:M,style:E,background:h,tapScrollCircleOptions:N,inertiaOptions:F,itemCount:U,renderThumbOverlay:ie,wheelSpeedMultiplier:Q=1,onWheelHorizontal:ee,contentInsets:ge,visibleStartIndex:ye,visibleEndIndex:V,renderOverlay:L,initialScrollPosition:S=0,contentProps:j},G)=>{const P=r.useRef(Number.isFinite(S)?Math.max(0,S):0),ae=r.useRef(null),K=r.useRef(null),T=r.useRef(ee);r.useEffect(()=>{T.current=ee},[ee]);const B=r.useRef({frame:null,velocity:0,lastTimestamp:null,generation:0}),q=r.useMemo(()=>({maxVelocity:F?.maxVelocity??St.maxVelocity,minVelocity:F?.minVelocity??St.minVelocity,deceleration:F?.deceleration??St.deceleration,velocitySampleWindow:F?.velocitySampleWindow??St.velocitySampleWindow,startVelocityThreshold:F?.startVelocityThreshold??St.startVelocityThreshold}),[F]),Ye=r.useMemo(()=>({top:Math.max(0,ge?.top??0),bottom:Math.max(0,ge?.bottom??0)}),[ge]);w.debug("[ScrollPane] ScrollPane rendered",()=>({contentSize:e,viewportSize:t,scrollBarWidth:s,className:I,style:E,tapScrollCircleOptions:N,inertiaOptions:F,enablePointerDrag:u,contentInsets:Ye}));const Ne=r.useRef({contentSize:e,viewportSize:t});Ne.current={contentSize:e,viewportSize:t};const te=r.useMemo(()=>e>t,[e,t]),re=r.useCallback(g=>{const{contentSize:_,viewportSize:pe}=Ne.current,H=_>pe,Me=P.current;if(w.debug("[ScrollPane] scrollTo called",()=>({newPosition:g,contentSize:_,viewportSize:pe,currentIsScrollable:H,prevPosition:Me})),!H)return P.current!==0&&(P.current=0,x?.(0,Me)),P.current;const oe=typeof g=="function"?g(P.current):g;if(!Number.isFinite(oe))return w.warn("[ScrollPane] scrollTo received a non-finite position; keeping the current position",{nextPosition:oe}),P.current;const be=Math.max(_-pe,0),Se=J(oe,0,be);return P.current!==Se&&(P.current=Se,x?.(Se,Me)),P.current},[x]),W=r.useRef(re);r.useEffect(()=>{W.current=re},[re]);const Z=r.useCallback(()=>{const g=B.current;g.generation+=1,g.frame!==null&&cancelAnimationFrame(g.frame),g.frame=null,g.velocity=0,g.lastTimestamp=null},[]),Te=r.useRef(Z);r.useEffect(()=>{Te.current=Z},[Z]),r.useEffect(()=>()=>{Te.current()},[]);const Ve=r.useCallback(g=>{if(!te)return;const{maxVelocity:_,minVelocity:pe,deceleration:H,startVelocityThreshold:Me}=q,oe=J(g,-_,_);if(Math.abs(oe)<Me)return;Z(),B.current.velocity=oe,B.current.lastTimestamp=null;const be=B.current.generation,Se=Re=>{const le=B.current;if(le.generation!==be)return;if(le.lastTimestamp===null){le.lastTimestamp=Re,le.frame=requestAnimationFrame(Se);return}const ke=Re-le.lastTimestamp;if(le.lastTimestamp=Re,ke<=0){le.frame=requestAnimationFrame(Se);return}const ce=le.velocity;let se=ce;const De=H*ke;ce>0?se=Math.max(0,ce-De):ce<0&&(se=Math.min(0,ce+De));const Ce=(ce+se)/2*ke,Qe=P.current;if(Ce!==0&&W.current(xe=>xe+Ce),B.current.generation!==be)return;const Ue=P.current,{contentSize:we,viewportSize:m}=Ne.current,R=Math.max(we-m,0);le.velocity=se;const ue=Ue===Qe||Ue<=0&&se<=0||Ue>=R&&se>=0;if(Math.abs(se)<pe||ue){Z();return}le.frame=requestAnimationFrame(Se)};B.current.frame=requestAnimationFrame(Se)},[te,q,Z]),$e=r.useRef(Ve);r.useEffect(()=>{$e.current=Ve},[Ve]),r.useLayoutEffect(()=>{Ne.current={contentSize:e,viewportSize:t}},[e,t]),r.useLayoutEffect(()=>{const g=K.current;if(!g)return;const _=()=>{g.scrollTop!==0&&(w.debug("[ScrollPane] Native scroll detected, resetting to 0",()=>({scrollTop:g.scrollTop})),g.scrollTop=0),g.scrollLeft!==0&&(g.scrollLeft=0)};return g.addEventListener("scroll",_),()=>g.removeEventListener("scroll",_)},[]),r.useLayoutEffect(()=>{if(te){w.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change",()=>({contentSize:e,viewportSize:t,scrollPosition:P.current}));const g=J(e-t,0,e);P.current>g&&re(g)}else re(0)},[te,re,e,t]),r.useEffect(()=>{const g=H=>{if(H.ctrlKey)return;const Me=H.shiftKey&&H.deltaX===0,oe=Me?H.deltaY:H.deltaX,be=Me?0:H.deltaY;if(oe!==0&&Math.abs(oe)>=Math.abs(be)){if(T.current){H.preventDefault(),Z();let le=oe;H.deltaMode===1?le*=16:H.deltaMode===2&&(le*=t),T.current(le)}return}if(!te||H.deltaY===0)return;H.preventDefault(),Z();let Re=H.deltaY;H.deltaMode===1?Re*=16:H.deltaMode===2&&(Re*=t),Q!==1&&(Re*=Q),w.debug("[ScrollPane] wheel event",()=>({deltaY:Re,scrollPosition:P.current,wheelSpeedMultiplier:Q,deltaMode:H.deltaMode,scrollTop:K.current?.scrollTop})),re(le=>le+Re)},_=()=>{Z()},pe=ae.current;return pe&&(pe.addEventListener("wheel",g,{passive:!1}),pe.addEventListener("pointerdown",_,{capture:!0,passive:!0})),()=>{pe&&(pe.removeEventListener("wheel",g),pe.removeEventListener("pointerdown",_,{capture:!0}))}},[te,re,Z,t,Q]),r.useImperativeHandle(G,()=>({scrollTo:g=>(Z(),re(g)),getScrollPosition:()=>P.current,getContentSize:()=>e,getViewportSize:()=>t}),[re,e,t,Z]);const y=r.useId(),lt=j?.id??y,ne=r.useRef({pointerType:"",pointerId:null,startClientY:0,startScroll:0,isDragging:!1,shouldCancelNextClick:!1,clickResetTimer:null,velocitySamples:[]}),C=r.useRef(u),Ee=r.useRef(d);r.useEffect(()=>{C.current=u},[u]),r.useEffect(()=>{Ee.current=d},[d]);const _e=r.useRef(te);r.useEffect(()=>{_e.current=te},[te]);const We=r.useRef(q);r.useEffect(()=>{We.current=q},[q]),r.useEffect(()=>{const g=ne.current;if(u&&te&&(g.pointerId===null||Lt(g.pointerType,d))||g.pointerId===null)return;const _=K.current;g.clickResetTimer!==null&&(window.clearTimeout(g.clickResetTimer),g.clickResetTimer=null);const pe=g.isDragging&&g.shouldCancelNextClick,H=g.pointerId;g.pointerId=null,g.pointerType="",g.startClientY=0,g.startScroll=0,g.isDragging=!1,g.shouldCancelNextClick=pe,g.velocitySamples=[],_?.hasPointerCapture(H)&&_.releasePointerCapture(H)},[u,d,te]),r.useEffect(()=>{const g=K.current;if(!g)return;const _=6,pe=()=>typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),H=()=>{const m=ne.current;m.pointerId=null,m.pointerType="",m.startClientY=0,m.startScroll=0,m.isDragging=!1,m.velocitySamples=[]},Me=()=>{const m=ne.current;m.clickResetTimer!==null&&(window.clearTimeout(m.clickResetTimer),m.clickResetTimer=null)},oe=m=>{const R=ne.current,ue=pe();R.velocitySamples.push({clientY:m,time:ue});const xe=We.current.velocitySampleWindow;R.velocitySamples=R.velocitySamples.filter(ve=>ue-ve.time<=xe)},be=m=>m instanceof HTMLElement&&m.closest("[data-scrollpane-ignore-drag='true']")!==null,Se=m=>{const R=ne.current;R.shouldCancelNextClick&&(m.preventDefault(),m.stopPropagation(),R.shouldCancelNextClick=!1)},Re=m=>{const R=ne.current;if(!R.isDragging){if(R.isDragging=!0,R.shouldCancelNextClick=!0,!g.hasPointerCapture(m.pointerId))try{g.setPointerCapture(m.pointerId)}catch{}oe(m.clientY)}},le=m=>m.isTrusted||m.target===g,ke=m=>{const R=ne.current;g.hasPointerCapture(m)&&g.releasePointerCapture(m),R.shouldCancelNextClick=!1,Me(),H()},ce=m=>{const R=ne.current;if(R.pointerId!==m.pointerId)return;if(m.buttons===0&&gr(m.pointerType)){ke(m.pointerId);return}if(!(C.current&&_e.current)||!Lt(m.pointerType,Ee.current)||!R.isDragging&&(Math.abs(m.clientY-R.startClientY)<_||(Re(m),!R.isDragging)))return;oe(m.clientY);const ue=m.clientY-R.startClientY,xe=R.startScroll-ue;W.current(xe),m.cancelable&&m.preventDefault()},se=()=>{const m=ne.current;return m.pointerId!==null||!m.shouldCancelNextClick?!1:(Me(),m.clickResetTimer=window.setTimeout(()=>{const R=ne.current;R.shouldCancelNextClick=!1,R.clickResetTimer=null},0),!0)},De=m=>{const R=ne.current;if(R.pointerId!==m.pointerId){se();return}R.isDragging&&R.shouldCancelNextClick&&m.cancelable&&(m.preventDefault(),m.stopPropagation()),R.isDragging&&oe(m.clientY);let ue=0;if(R.isDragging&&R.velocitySamples.length>=2){const ve=R.velocitySamples,et=We.current.velocitySampleWindow,Ge=ve[ve.length-1],Ze=ve.find(Xe=>Ge.time-Xe.time<=et)??ve[0];if(Ge&&Ze&&Ge.time!==Ze.time){const Xe=Ge.clientY-Ze.clientY,tt=Ge.time-Ze.time;ue=-(Xe/tt)}}Me(),R.shouldCancelNextClick&&(R.clickResetTimer=window.setTimeout(()=>{const ve=ne.current;ve.shouldCancelNextClick=!1,ve.clickResetTimer=null},0));const xe=We.current.startVelocityThreshold;H(),g.hasPointerCapture(m.pointerId)&&g.releasePointerCapture(m.pointerId),Math.abs(ue)>=xe&&$e.current?.(ue)},Be=m=>{if(ne.current.pointerId!==null){if(!m.isPrimary||m.pointerType!==ne.current.pointerType)return;ke(ne.current.pointerId)}if(ne.current.shouldCancelNextClick&&(Me(),ne.current.shouldCancelNextClick=!1),!(C.current&&_e.current)||!Lt(m.pointerType,Ee.current)||m.button!==0&&m.pointerType==="mouse"||m.ctrlKey||m.metaKey||m.altKey||be(m.target))return;window.dispatchEvent(new CustomEvent(Ft,{detail:{paneId:y}})),Te.current?.();const R=ne.current;Me(),R.pointerId=m.pointerId,R.pointerType=m.pointerType,R.startClientY=m.clientY,R.startScroll=P.current,R.isDragging=!1,R.shouldCancelNextClick=!1,R.velocitySamples=[]},Ce=m=>{if(ne.current.pointerId!==m.pointerId){se();return}le(m)&&ke(m.pointerId)},Ue=[["click",Se,!0],["pointerdown",Be,{passive:!1}],["lostpointercapture",m=>{m.target!==g||ne.current.pointerId!==m.pointerId||ke(m.pointerId)},void 0]],we=[["pointermove",ce,{passive:!1}],["pointerup",De,void 0],["pointercancel",Ce,void 0]];return wt(g,Ue,"add"),wt(window,we,"add"),()=>{wt(g,Ue,"remove"),wt(window,we,"remove");const m=ne.current;m.pointerId!==null&&g.hasPointerCapture(m.pointerId)&&g.releasePointerCapture(m.pointerId),Me(),H()}},[y]);const qe=r.useCallback(g=>(Z(),re(g)),[re,Z]);return Y.jsxs("div",{ref:ae,"data-testid":M,className:gt.twMerge("aqvs-scroll-pane",I),style:E,children:[Y.jsxs("div",{ref:K,className:gt.twMerge("aqvs-scroll-pane-content"),"data-testid":"aqvs-scroll-pane-content",style:{height:t,paddingTop:Ye.top,paddingBottom:Ye.bottom,...u&&te&&d.some(g=>g==="touch"||g==="pen")?{touchAction:"none"}:{}},...j,id:lt,children:[h,n(P.current)]}),Y.jsx(Gt,{contentSize:e,viewportSize:t,scrollPosition:P.current,onScroll:qe,enableThumbDrag:i,enableTrackClick:a,enableArrowButtons:c,scrollBarWidth:s,ariaControls:lt,tapScrollCircleOptions:N,itemCount:U,renderThumbOverlay:ie,visibleStartIndex:ye,visibleEndIndex:V},"scrollbar"),L?.()]})}),Ht=(n,e,t)=>Math.min(Math.max(n,e),t),br=({dragState:n,normalizedDistance:e,sizeScale:t,size:s})=>{const i=Math.max(s/2,1),a=1+e*.65,c=Math.max(.65,1-e*.25),u=n.direction*e*26*t,d=.8+e*.18,x=3*t,I=6*t,M=22*t,E=Math.abs(u)+I,h=u>0?x:-Math.abs(u)-x,N=Math.max(2.5,3*t),F=Ht(n.offsetX,-i,i),U=Ht(n.offsetY,-i,i),ie=i*.35,Q=F/i*ie,ee=U/i*ie,ge=Q*.45,ye=ee*.45,V=Math.max(M*.38,6),L=.65+e*.2,S=n.active;return Y.jsxs(Y.Fragment,{children:[Y.jsx("div",{className:"aqvs-tap-scroll-circle-gradient",style:{transform:`scale(${c}, ${a})`,transition:S?"40ms transform ease-out":"200ms ease transform"}}),Y.jsx("div",{className:"aqvs-sample-visual-pupil",style:{width:M,height:M,transform:`translate(calc(-50% + ${Q}px), calc(-50% + ${ee}px)) scale(${c}, ${d*a})`,transition:S?"70ms transform ease-out":"200ms ease transform"}}),Y.jsx("div",{className:"aqvs-sample-visual-highlight",style:{width:V,height:V,transform:`translate(calc(-50% + ${ge}px), calc(-50% + ${ye}px)) scale(${c}, ${a})`,opacity:L,boxShadow:"0 0 8px rgba(255,255,255,0.45)",transition:S?"120ms opacity 150ms, 120ms transform ease-out ease-out":"220ms ease transform, 240ms opacity ease"}}),Y.jsx("div",{className:"aqvs-sample-visual-rod",style:{width:N,height:E,transform:`translate(-50%, ${h}px)`,opacity:e,transition:S?"40ms height, 60ms opacity ease-out ease-out":"200ms ease height, 120ms ease opacity"}})]})},Et=100,xr=n=>{if(!Number.isFinite(n))return 0n;const e=Math.trunc(n);return e<=0?0n:BigInt(e)},_t=(n,e)=>{if(!Number.isFinite(n))throw new Error(`valueFn returned a non-finite value at index ${e}: ${n}`);return n},It=n=>{if(n<=0||!Number.isFinite(n))return 0;const e=Math.trunc(n);if(e<=2147483647)return e&-e;const t=BigInt(e)&-BigInt(e);return Number(t)};class ot{tree;deltas;size;baseValue;valueFn;total;constructor(e,t,s){this.reset(e,t,s)}reset(e,t,s){const i=Number.isFinite(e)&&e>0?Math.trunc(e):0;if(typeof t!="function"){this.size=i,this.tree=new Map,this.deltas=new Map,this.valueFn=void 0,this.baseValue=t,this.total=this.baseValue*this.size;return}let a=0,c;if(i>0){const u=s?.sampleRange??{from:0,to:Math.min(Et-1,i-1)};let d=Math.max(0,Math.trunc(u.from)),x=Math.min(Math.trunc(u.to),i-1);if(d>x&&(d=0,x=Math.min(Et-1,i-1)),i>Et)a=ot._sampleBaseValueStrided(t,i,Et),s?.materialize&&(c={from:d,values:ot._collectValidatedValues(t,d,x)});else{const I=ot._collectValidatedValues(t,d,x);a=ot._modeOrMedian([...I]),s?.materialize&&(c={from:d,values:I})}}if(this.size=i,this.tree=new Map,this.deltas=new Map,this.total=void 0,this.valueFn=t,this.baseValue=a,c)for(let u=0;u<c.values.length;u++){const d=c.from+u;if(d>=this.size)break;const x=c.values[u]-this.baseValue;x!==0&&(this.deltas.set(d,x),this._updateTree(d,x))}this.total=this.getTotal()}setValueFn(e,t){if(t?.reset){this.reset(this.size,e);return}typeof e=="function"?this.valueFn=e:(this.valueFn=void 0,this.baseValue=e,this.total=this._computeTreeTotal())}static _collectValidatedValues(e,t,s){const i=[];for(let a=t;a<=s;a++)i.push(_t(e(a),a));return i}static _modeOrMedian(e){if(e.length===0)return 0;e.sort((c,u)=>c-u);const t=Math.floor(e.length/2);let s;e.length%2===0?s=Math.floor((e[t-1]+e[t])/2):s=e[t];const i=new Map;let a=0;for(const c of e){const u=(i.get(c)??0)+1;i.set(c,u),u>a&&(a=u)}if(a>e.length*.2){const c=[];for(const[d,x]of i.entries())x===a&&c.push(d);const u=c.reduce((d,x)=>d+x,0);s=Math.floor(u/c.length)}return s}static _sampleBaseValueStrided(e,t,s){if(t<=0)return 0;let i=Math.max(1,Math.ceil(t/s));i%2===0&&(i+=1);const a=[];for(let c=0;c<t&&a.length<s;c+=i)a.push(_t(e(c),c));return ot._modeOrMedian(a)}update(e,t){return this.updates([{index:e,value:t}])}updates(e){const t=this._buildDeltaUpdates(e);return t.length>0?this.updateDeltas(t):this.total}updateDelta(e,t){return this.updateDeltas([{index:e,change:t}])}updateDeltas(e){const t=new Map;for(const{index:s,change:i}of e){if(s<0||s>=this.size)throw new Error(`Index ${s} out of bounds`);if(!Number.isInteger(s))throw new Error(`Index must be an integer: ${s}`);if(!Number.isFinite(i))throw new Error(`Change must be a finite number: ${i}`);const c=(t.get(s)??this.deltas.get(s)??0)+i;if(c+this.baseValue<-1e-9)throw new Error(`Change would make the value at index ${s} negative: ${c+this.baseValue}`);t.set(s,c)}for(const{index:s,change:i}of e){const c=(this.deltas.get(s)??0)+i;c===0?this.deltas.delete(s):this.deltas.set(s,c),this._updateTree(s,i)}return this.total}_updateTree(e,t){if(t===0)return;let s=e+1;for(;s<=this.size;){this.tree.set(s,(this.tree.get(s)??0)+t);const i=It(s);if(i===0)break;s+=i}this.total!==void 0&&(this.total+=t)}_buildDeltaUpdates(e){const t=[],s=new Map;for(const{index:i,value:a}of e){if(i<0||i>=this.size)throw new Error(`Index ${i} out of bounds`);if(!Number.isInteger(i))throw new Error(`Index must be an integer: ${i}`);if(!Number.isFinite(a))throw new Error(`Value must be a finite number: ${a}`);if(a<0)throw new Error("Value cannot be negative.");const c=s.has(i)?s.get(i)??0:this.deltas.get(i)??0,u=c+this.baseValue,d=a-u;d!==0&&t.push({index:i,change:d}),s.set(i,c+d)}return t}_computeTreeTotal(){if(this.size<=0)return 0;let e=0,t=this.size;for(;t>0;){e+=this.tree.get(t)??0;const s=It(t);if(s===0)break;t-=s}return e+this.baseValue*this.size}_materialize(e,t=!0){if(this.valueFn){const s=this.deltas.get(e)??0,a=_t(this.valueFn(e),e)-this.baseValue;if(a!==s&&(a===0?this.deltas.delete(e):this.deltas.set(e,a),t)){const c=a-s;this._updateTree(e,c)}}}_materializeRanges(e,t,s=!1){if(!(e?.materialize&&this.valueFn))return;const i=e.ranges;if(i&&i.length>0){for(const u of i){const d=Math.max(0,Math.trunc(u.from)),x=Math.min(Math.trunc(u.to),this.size-1);for(let I=d;I<=x;I++)this._materialize(I)}if(t===void 0)return;if(s){this._materialize(t);return}const a=i[0].from,c=i[i.length-1].to;t>=a&&t<=c&&this._materialize(t);return}t!==void 0&&this._materialize(t)}_findIndex(e,t={},s){if(this.size>=1073741824)return this._findIndexLarge(e,t,s);if(this.size===0)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};this._materializeRanges(t.materializeOption);const i=t.materializeOption?.materialize===!0;let a;for(;;){if(a=this._descend(e,s),a<0||a>=this.size)return{index:-1,total:this.total??this.getTotal(),cumulative:void 0,currentValue:void 0,safeIndex:void 0};if(!i)break;const u=this.deltas.get(a)??0;if(this._materialize(a),(this.deltas.get(a)??0)===u)break}const c=this.prefixSum(a);return{index:a,total:this.total??c.total,cumulative:c.cumulative,currentValue:c.currentValue,safeIndex:c.safeIndex}}_descend(e,t){let s=0,i=0,a=1;for(;a<<1<=this.size;)a<<=1;for(;a>0;a>>=1){const c=s+a;if(c<=this.size){const d=(this.tree.get(c)??0)+this.baseValue*a;(t?i+d<e:i+d<=e)&&(s=c,i+=d)}}return t?s:s-1}_findIndexLarge(e,t,s){if(this.size===0)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};const i=xr(this.size);if(i===0n)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};this._materializeRanges(t.materializeOption);const a=t.materializeOption?.materialize===!0;for(;;){let c=0n,u=i-1n,d,x,I=this.total;for(;c<=u;){const h=c+u>>1n,N=Number(h),F=this.prefixSum(N);if(I=F.total,s?F.cumulative>=e:F.cumulative<=e)if(d=h,x=F,s){if(h===0n)break;u=h-1n}else c=h+1n;else if(s)c=h+1n;else{if(h===0n)break;u=h-1n}}const M=x,E=d!==void 0?Number(d):-1;if(a&&E>=0){const h=this.deltas.get(E)??0;if(this._materialize(E),(this.deltas.get(E)??0)!==h)continue}return{index:E,total:I,cumulative:M?.cumulative,currentValue:M?.currentValue,safeIndex:M?.safeIndex}}}prefixSum(e,t){if(e<0||Number.isNaN(e))return{cumulative:0,total:this.total,currentValue:0,safeIndex:0};if(this.size===0)return{cumulative:0,total:this.total??0,currentValue:0,safeIndex:0};const s=J(Math.trunc(e),0,this.size-1),i=t?.materializeOption;this._materializeRanges(i,s,!0);let a=0,c=s+1;for(;c>0;){const d=this.tree.get(c)??0;a+=d;const x=It(c);if(x===0)break;c-=x}const u=i?.materialize?this.get(s):(this.deltas.get(s)||0)+this.baseValue;return{cumulative:a+this.baseValue*(s+1),total:this.total,currentValue:u,safeIndex:s}}get(e,t){if(this.size===0)return 0;if(!Number.isInteger(e)||e<0||e>=this.size)throw new Error("Index out of bounds");const s=t?.materializeOption;return this._materializeRanges(s,e),(this.deltas.get(e)??0)+this.baseValue}getTotal(e){const t=e?.materializeOption;if(this._materializeRanges(t),this.total===void 0)if(this.size===0)this.total=0;else{this.total=this._computeTreeTotal();const s=this.prefixSum(this.getSize()-1);s.cumulative!==s.total&&w.error("Inconsistent Fenwick Tree state")}return this.total}rebuildTree(e){if(e?.materialize&&this.valueFn){const s=this.valueFn;this.reset(this.size,i=>s(i),{materialize:!0});return}const t=new Map;for(const[s,i]of this.deltas.entries()){if(i===0)continue;let a=s+1;for(;a<=this.size;){t.set(a,(t.get(a)??0)+i);const c=It(a);if(c===0)break;a+=c}}this.tree=t,this.total=this._computeTreeTotal()}calculateAccumulatedError(){if(this.total===void 0)return 0;let e=this.baseValue*this.size;for(const[t,s]of this.deltas)t<this.size&&(e+=s);return this.total-e}changeSize(e){if(!Number.isFinite(e))throw new Error(`Size must be a finite number: ${e}`);const t=Math.max(0,Math.trunc(e)),s=this.size;if(t===s)return;if(t>s)if(s===0&&this.deltas.size>0){for(const a of this.deltas.keys())a>=t&&this.deltas.delete(a);this.size=t,this.rebuildTree()}else this._growSize(s,t);else{if(t>0)for(const a of this.deltas.keys())a>=t&&this.deltas.delete(a);this.size=t,this.rebuildTree()}const i=this.prefixSum(this.getSize()-1);i.cumulative!==i.total&&w.error("Inconsistent Fenwick Tree state")}static _minCoveredLowBound(e,t){let s=1;for(;;){const i=s*2;if(Math.floor(t/i)*i<=e)break;s=i}return s*Math.floor(e/s)}_propagateDeltaToGrownNodes(e,t,s,i){let a=e+1;for(;a<=s;){const c=It(a);if(c===0)break;a+=c}for(;a<=i;){this.tree.set(a,(this.tree.get(a)??0)+t);const c=It(a);if(c===0)break;a+=c}}_growSize(e,t){if(this.size=t,this.deltas.size>0){const s=ot._minCoveredLowBound(e,t);if(e-s<this.deltas.size)for(let a=s;a<e;a++){const c=this.deltas.get(a);c===void 0||c===0||this._propagateDeltaToGrownNodes(a,c,e,t)}else for(const[a,c]of this.deltas.entries())c===0||a<s||this._propagateDeltaToGrownNodes(a,c,e,t)}this.total=this._computeTreeTotal()}getSize(){return this.size}get base(){return this.baseValue}findIndexAtOrAfter(e,t){return this._findIndex(e,t??{},!0)}findIndexAtOrBefore(e,t){return this._findIndex(e,t??{},!1)}}const Ir=(n,e)=>{const t=n?.sampleRange,s=e?.sampleRange;return t===s?!1:t&&s?t.from!==s.from||t.to!==s.to:!0},Jt=(n,e,t)=>{const s=Number.isFinite(n)&&n>0?Math.trunc(n):0,i=r.useRef(null),a=r.useRef({size:s,valueOrFn:e,options:t});i.current===null&&(i.current=new ot(s,e,t));const c=i.current,u=a.current,d=u.size!==s,x=u.valueOrFn!==e,I=Ir(u.options,t),M=u.size===0&&s>0&&(!i.current||i.current.base===0);if(x||I){const E=t?.resetOnValueFnChange??!0;I||x&&E||M?(t?.debug&&w.debug("[useFenwickMapTree] reset",{valueOrFnChanged:x,optionsChanged:I}),c.reset(s,e,t)):(d&&(t?.debug&&w.debug("[useFenwickMapTree] resize (with valueFn change)",{from:u.size,to:s}),c.changeSize(s)),t?.debug&&w.debug("[useFenwickMapTree] setValueFn (no reset)",{valueOrFnChanged:x}),c.setValueFn(e,{reset:!1})),a.current={size:s,valueOrFn:e,options:t}}else d&&(t?.debug&&w.debug("[useFenwickMapTree] resize",{from:u.size,to:s}),M?c.reset(s,e,t):c.changeSize(s),a.current={size:s,valueOrFn:e,options:t});return c};class Tr{key;value;prev=null;next=null;constructor(e,t){this.key=e,this.value=t}}class Ot{head=null;tail=null;addToTail(e){this.tail?(this.tail.next=e,e.prev=this.tail,this.tail=e):this.head=this.tail=e}remove(e){e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=null,e.next=null}removeHead(){const e=this.head;return e&&this.remove(e),e}moveToTail(e){this.remove(e),this.addToTail(e)}}function Qt(n){const e=r.useRef(new Map),t=r.useRef(new Ot),s=Math.floor(n),i=r.useRef(s);r.useEffect(()=>{if(i.current=s,Number.isNaN(s)||s<0){w.warn(`useLruCache: invalid capacity ${n}; the cache will not store any entries.`),e.current.clear(),t.current=new Ot;return}if(Number.isFinite(s))for(;e.current.size>s;){const I=t.current.removeHead();if(I)e.current.delete(I.key);else break}},[n,s]);const a=r.useCallback(I=>{const M=e.current.get(I);if(M)return t.current.moveToTail(M),M.value},[]),c=r.useCallback((I,M)=>{const E=i.current;if(Number.isNaN(E)||E<=0)return;let h=e.current.get(I);if(h)h.value=M,t.current.moveToTail(h);else{if(e.current.size>=E){const N=t.current.removeHead();N&&e.current.delete(N.key)}h=new Tr(I,M),e.current.set(I,h),t.current.addToTail(h)}},[]),u=r.useCallback(I=>e.current.has(I),[]),d=r.useCallback(I=>{const M=e.current.get(I);M&&(t.current.remove(M),e.current.delete(I))},[]),x=r.useCallback(()=>{e.current.clear(),t.current=new Ot},[]);return r.useMemo(()=>({get:a,set:c,has:u,remove:d,clear:x}),[a,c,u,d,x])}const Mr=1e4,Sr=()=>{const{get:n,set:e,has:t,clear:s}=Qt(Mr);return r.useMemo(()=>({get:n,set:e,has:t,clear:s}),[n,e,t,s])},Ie=(n,e)=>e<=0?0:J(n,0,e-1),Xt=n=>({top:Math.max(0,n?.top??0),bottom:Math.max(0,n?.bottom??0)}),je=(n,e)=>n<=e?0:n-e,ht=(n,e)=>n<=0?0:n+e,Nt=1e3,jt=2e3,Rr=1048576,Rt=n=>{if(!Number.isFinite(n))return 0n;const e=Math.trunc(n);return e<=0?0n:BigInt(e)},vr=(n,e,t,s,i,a,c,u)=>{const d=Rt(s);if(d===0n)return{renderingStartIndex:0,renderingEndIndex:0,visibleStartIndex:0,visibleEndIndex:0};const x=V=>V<0n?0n:V>=d?d-1n:V,I={materializeOption:{materialize:!1}},{index:M,cumulative:E}=a.findIndexAtOrAfter(n,I);let h;M===-1?h=d-1n:(E===n?h=Rt(M+1):h=Rt(M),h>=d&&(h=d-1n)),n<=0&&(h=0n),u&&n>=c&&(h=d-1n);const N=V=>{const L=Number(V);if(!Number.isSafeInteger(L))return null;const{cumulative:S}=a.prefixSum(L,{materializeOption:{materialize:!1}});if(!Number.isFinite(S))return null;const{index:j}=a.findIndexAtOrAfter(S+.5,{materializeOption:{materialize:!1}});if(j===-1)return null;const G=Rt(j);return G>V?G:null},F=V=>{let L=0,S=V,j=V,G=0n,P=0;for(;S<d&&L<e;){const ae=Number(S),K=i(ae);if(L+=K,j=S,S+=1n,G+=1n,!Number.isFinite(K)||K<0)break;if(K===0){if(P+=1,P>Nt){const T=N(j);if(T!==null&&T>S)S=T,P=0;else if(T!==null&&T===S&&i(Number(S))>0)P=0;else break}}else P=0}return G===0n&&(j=V),{height:L,end:j}};let{height:U,end:ie}=F(h);if(U<e&&h>0n){let V=h,L=U,S=0;for(;V>0n&&L<e;){V-=1n;const G=Number(V),P=i(G);if(L+=P,!Number.isFinite(P)||P<0)break;if(P===0){if(S+=1,S>Nt){const ae=Number(V);if(!Number.isSafeInteger(ae))break;const{cumulative:K}=a.prefixSum(ae,{materializeOption:{materialize:!1}});if(!Number.isFinite(K))break;const{index:T}=a.findIndexAtOrAfter(K-.5,{materializeOption:{materialize:!1}}),B=T===-1?-1n:Rt(T);if(B>=0n&&B<V)V=B+1n,S=0;else if(B===V&&V>=1n&&i(Number(V-1n))>0)S=0;else break}}else S=0}h=x(V);const j=F(h);U=j.height,ie=j.end}const Q=x(h),ee=x(ie),ge=x(Q-BigInt(Math.max(0,t))),ye=x(ee+BigInt(Math.max(0,t)));return{renderingStartIndex:Ie(Number(ge),s),renderingEndIndex:Ie(Number(ye),s),visibleStartIndex:Ie(Number(Q),s),visibleEndIndex:Ie(Number(ee),s)}},Pr=(n,e,t,s,i,a,c)=>{if(s===0)return{renderingStartIndex:0,renderingEndIndex:0,visibleStartIndex:0,visibleEndIndex:0};const u=Number.isFinite(c),d=u?Math.min(Math.max(0,n),c):Math.max(0,n);if(s>=Number.MAX_SAFE_INTEGER)return vr(d,e,t,s,i,a,c,u);const{index:x,cumulative:I,currentValue:M}=a.findIndexAtOrAfter(d,{materializeOption:{materialize:!1}}),E=x===-1?e<=0||(I??0)<d+(M??0)?s-1:0:x;let h=Ie(E,s),N=0;if(x!==-1&&I===d)h=Ie(x+1,s),N=0;else if(h===x&&I!==void 0&&M!==void 0)N=I-M-d;else{const{cumulative:V,currentValue:L}=a.prefixSum(h,{materializeOption:{materialize:!1}});N=(V??0)-(L??0)-d}const F=N,U=(V,L)=>{let S=V,j=L,G=0;for(;S<s&&j<e;){const P=i(S);if(j+=P,S++,!Number.isFinite(P)||P<0)break;if(P===0){if(G++,G>Nt){const{cumulative:ae}=a.prefixSum(S-1,{materializeOption:{materialize:!1}}),{index:K}=Number.isFinite(ae)?a.findIndexAtOrAfter(ae+.5,{materializeOption:{materialize:!1}}):{index:-1};if(K>S)S=K,G=0;else if(K===S&&i(S)>0)G=0;else break}}else G=0}return{cursor:S,height:j}},ie=U(h,N);let Q=ie.cursor;if(N=ie.height,N<e&&h>0){let V=N+Math.abs(Math.min(0,F)),L=h-1,S=0;for(;L>=0&&V<e;){const G=i(L);if(V+=G,!Number.isFinite(G)||G<0){L--;break}if(G===0){if(S++,S>Nt){const{cumulative:P}=a.prefixSum(L,{materializeOption:{materialize:!1}}),{index:ae}=Number.isFinite(P)?a.findIndexAtOrAfter(P-.5,{materializeOption:{materialize:!1}}):{index:-1};if(ae!==-1&&ae<L){L=ae,S=0;continue}if(ae===L&&L>=1&&i(L-1)>0)S=0;else{L--;break}}}else S=0;L--}h=Ie(L+1,s);const j=U(h,0);Q=j.cursor,N=j.height}const ee=Ie(h-t,s),ge=Ie(Math.max(Q-1,h),s),ye=Ie(ge+t,s);return{renderingStartIndex:ee,renderingEndIndex:ye,visibleStartIndex:h,visibleEndIndex:ge}},$t=(n,e,t)=>{const s=Math.max(0,e??0),i=r.useRef({last:0,id:null,arg:null}).current;return r.useEffect(()=>()=>{if(i.id!==null&&(cancelAnimationFrame(i.id),i.id=null),i.arg!==null&&n.current){try{t(n.current,i.arg)}catch(a){console.error("[useThrottledInvoker] Error flushing pending callback on unmount",a)}i.arg=null}},[i,n,t]),r.useCallback(a=>{if(i.arg=a,i.id!==null)return;const c=u=>{if(i.id=null,i.arg===null)return;const d=u-i.last;if(s===0||i.last===0||d>=s){if(n.current)try{t(n.current,i.arg)}catch(x){console.error("[useThrottledInvoker] Error invoking callback",x)}i.arg=null,i.last=u}i.arg!==null&&(i.id=requestAnimationFrame(c))};i.id=requestAnimationFrame(c)},[s,t,n,i])},yr=r.memo(({index:n,top:e,height:t,item:s,children:i,clipItemHeight:a,enableKeyboardNavigation:c,onKeyDown:u,onFocus:d,registerItemRef:x})=>{const I=r.useCallback(N=>x(n,N),[n,x]),M=r.useCallback(N=>u(N,n),[n,u]),E=r.useCallback(()=>d(n),[n,d]),h=r.useCallback(N=>{N.currentTarget.focus({preventScroll:!0})},[]);return Y.jsx("div",{ref:I,"data-index":n,"data-virtualscroll-item":"true",className:"aqvs-item-container",style:{top:e,height:t,overflow:a?"hidden":void 0},tabIndex:c?-1:void 0,onPointerDown:c?h:void 0,onKeyDownCapture:c?M:void 0,onFocusCapture:c?E:void 0,children:i(s,n)})}),Cr=({itemCount:n,getItem:e,getItemKey:t,getItemHeight:s,viewportSize:i,overscanCount:a=15,className:c,testId:u,onScroll:d,onRangeChange:x,children:I,background:M,initialScrollIndex:E,initialScrollOffset:h,initialScrollAnchor:N,callbackThrottleMs:F=5,contentInsets:U,onItemFocus:ie,scrollBarOptions:Q,behaviorOptions:ee,onWheelHorizontal:ge,contentProps:ye},V)=>{const{width:L,enableThumbDrag:S,enableTrackClick:j,enableArrowButtons:G,enableScrollToTopBottomButtons:P,renderThumbOverlay:ae,tapScrollCircleOptions:K}=Q??{},{enablePointerDrag:T,pointerDragInputs:B,enableKeyboardNavigation:q=!0,wheelSpeedMultiplier:Ye,inertiaOptions:Ne,clipItemHeight:te=!1,resetOnGetItemHeightChange:re=!1}=ee??{},W=r.useRef(null),Z=r.useRef({renderingStartIndex:0,renderingEndIndex:0,visibleStartIndex:0,visibleEndIndex:0,scrollPosition:0,totalHeight:0}),Te=r.useRef(N&&n>0?{index:J(Math.trunc(N.index),0,n-1),align:"top",offset:-Math.max(0,N.offsetPx??0)}:null),Ve=r.useRef(!1),$e=r.useRef(!0);r.useEffect(()=>{if($e.current){$e.current=!1;return}re&&(Te.current=null)},[re,s]);const y=r.useMemo(()=>Xt(U),[U]),[lt]=r.useState(()=>{const f=N?.index??E,p=typeof f=="number"&&Number.isFinite(f)?Math.max(0,Math.trunc(f)):0;return{from:Math.max(0,p-50),to:p+50}}),ne=r.useMemo(()=>({sampleRange:lt,resetOnValueFnChange:re,materialize:!0}),[re,lt]),C=Jt(n,s,ne),[Ee]=r.useState(()=>{let l=0,f=0;if(N&&n>0){const p=J(Math.trunc(N.index),0,n-1),k=Math.max(0,N.offsetPx??0),A=J(p-a*2,0,n-1),O=J(p+a*2,0,n-1),X=p>0||k>0?{materializeOption:{materialize:!0,ranges:[{from:A,to:O}]}}:void 0,{cumulative:$,total:Pe,currentValue:de}=C.prefixSum(p,X),me=Math.max($-de+k,0);l=ht(me,y.top),f=Pe??C.getTotal()}else if(typeof E=="number"){const p=J(E,0,n-1),k=J(p-a*2,0,n-1),A=J(p+a*2,0,n-1),O=E>0?{materializeOption:{materialize:!0,ranges:[{from:k,to:A}]}}:void 0,{cumulative:X,total:$,currentValue:Pe}=C.prefixSum(E,O),de=Math.max(X-Pe,0);l=ht(de,y.top),f=$??C.getTotal()}else typeof h=="number"&&(l=ht(Math.max(h,0),y.top)),f=C.getTotal();return{position:l,total:f}}),[_e,We]=r.useState(Ee.position),[qe,g]=r.useState(Ee.total),_=r.useRef(Ee.position),pe=r.useRef(y.top),H=r.useRef(d??void 0),Me=r.useRef(x??void 0),oe=r.useRef(new Map),be=r.useRef(null),Se=r.useRef(null),[Re,le]=r.useState(null),[ke,ce]=r.useState(!1),se=r.useRef(null),De=r.useRef(!1),Be=r.useRef(0),Ce=r.useRef(!1),Qe=r.useRef(!1),Ue=r.useRef(n);Ue.current!==n&&(Ue.current=n,Qe.current=!0),r.useEffect(()=>{H.current=d??void 0,Me.current=x??void 0},[x,d]);const we=r.useCallback(l=>{if(q&&l&&typeof l.focus=="function")try{l.focus({preventScroll:!0})}catch{l.focus()}},[q]),m=r.useCallback((l,{position:f,totalHeight:p})=>{l(f,p)},[]),R=$t(H,F,m),ue=r.useCallback((l,f)=>{l(f)},[]),xe=$t(Me,F,ue),ve=r.useRef(y.top);ve.current=y.top;const et=r.useRef(R);et.current=R,r.useEffect(()=>(Ve.current=!1,()=>{Ve.current=!0,se.current&&(clearTimeout(se.current),se.current=null)}),[]),r.useEffect(()=>{q||(oe.current.clear(),be.current=null,Se.current=null)},[q]);const Ge=r.useCallback((l,f)=>{if(!f){oe.current.delete(l);return}q&&(oe.current.set(l,f),be.current===l&&(be.current=null,Se.current=l,we(f)))},[q,we]),Ze=.01,Xe=r.useRef({rafId:null,loopActive:!1,idleFrames:0,lastRenderedPosition:Ee.position}),tt=r.useCallback(()=>{const l=Xe.current;l.rafId!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(l.rafId),l.rafId=null,l.loopActive=!1,l.idleFrames=0},[]);r.useEffect(()=>()=>{tt()},[tt]);const ct=r.useRef(()=>{}),Ke=r.useCallback(()=>{const l=Xe.current;l.rafId=null;const f=_.current,p=je(f,ve.current),k=C.getTotal();if(We(O=>Math.abs(O-f)<Ze?O:f),Math.abs(l.lastRenderedPosition-f)>=Ze?(et.current({position:p,totalHeight:k}),l.lastRenderedPosition=f,l.idleFrames=0):l.idleFrames+=1,l.idleFrames>=2){tt();return}if(typeof requestAnimationFrame=="function"){l.rafId=requestAnimationFrame(O=>ct.current(O));return}l.loopActive=!1},[C,tt]);ct.current=Ke;const Tt=r.useCallback(()=>{const l=Xe.current;if(l.idleFrames=0,!l.loopActive){if(l.loopActive=!0,typeof requestAnimationFrame=="function"){l.rafId=requestAnimationFrame(Ke);return}l.loopActive=!1}},[Ke]),fe=r.useCallback((l,f)=>{const p=f?.immediate??!1,k=je(l,y.top);if(_.current=l,p){Xe.current.lastRenderedPosition=l,Xe.current.idleFrames=0,We(l),R({position:k,totalHeight:C.getTotal()});return}Tt()},[Tt,C,y.top,R]),ut=r.useCallback(l=>{const f=W.current;if(!f)return l;const p=f.getScrollPosition();Be.current+=1;const k=f.scrollTo(l);return k===p&&(Be.current=Math.max(0,Be.current-1)),Math.abs(k-l)>.5&&(Ce.current=!0),k},[]),vt=r.useRef(!1);r.useEffect(()=>{if(!vt.current)if(vt.current=!0,N==null&&typeof E!="number"&&typeof h=="number"){const l=ht(Math.max(h,0),y.top),f=Math.abs(l-_.current)>.5;fe(l,{immediate:!0}),f&&W.current?.scrollTo(l)}else fe(_.current,{immediate:!0})},[N,E,h,y.top,fe]),r.useEffect(()=>{const l=C.getTotal();if(qe!==l){g(l);return}if(Ce.current){Ce.current=!1;const f=W.current;if(f&&Math.abs(f.getScrollPosition()-_.current)>.5){const p=ut(_.current);Ce.current=!1,fe(p,{immediate:!0})}}},[C,qe,n,ut,fe]),r.useEffect(()=>{if(Te.current!==null){const{index:l,align:f,offset:p}=Te.current,k=Ie(l,n),{cumulative:A,currentValue:O}=C.prefixSum(k,{materializeOption:{materialize:!1}});if(A!==void 0&&O!==void 0){const X=Math.max(A-O,0);let $=X;f==="bottom"?$=A-i:f==="center"&&($=X+O/2-i/2),p&&($-=p),$=Math.max(0,$);const Pe=Math.max(0,qe+y.top+y.bottom-i),de=Math.min(ht($,y.top),Pe);Math.abs(de-_.current)>1&&(w.debug("[VirtualScroll] Drift correction",{from:_.current,to:de,targetIndex:k}),Be.current===0&&(Be.current+=1),W.current?.scrollTo(de),fe(de,{immediate:!0}))}}Qe.current=!1},[qe,C,n,y.top,fe,i,y.bottom]),r.useEffect(()=>{const l=pe.current;if(l===y.top||(pe.current=y.top,Te.current))return;const f=je(_.current,l),p=ht(f,y.top);_.current=p,W.current?.scrollTo(p),fe(p,{immediate:!0})},[y.top,fe]);const bt=r.useCallback((l,f)=>{if(n===0)return;const p=Ie(l,n),k=C.get(p),A=f-k,O=C.update(p,f);O!==void 0&&g(O),w.debug("[VirtualScroll] Updated item size manually",{index:p,size:f,total:O});let X=Te.current?Te.current.index:null;if(X===null){const $=_.current,Pe=Xt(U).top,de=je($,Pe),{index:me,cumulative:Fe}=C.findIndexAtOrAfter(de,{materializeOption:{materialize:!1}});X=Fe!==void 0&&Fe===de?me+1:me}if(X!==-1&&p<X&&A!==0){const $=_.current,Pe=$+A;ut(Pe),fe(Pe,{immediate:!0}),w.debug("[VirtualScroll] Adjusted scroll for layout shift (manual update)",{from:$,to:Pe,causedByIndex:p,delta:A,activeVisibleStartIndex:X})}},[C,n,ut,fe,U]),He=r.useCallback((l,f)=>{if(!W.current||n===0)return;const p=Ie(l,n),k=Ie(p-a*2,n),A=Ie(p+a*2,n),{cumulative:O,total:X,currentValue:$}=C.prefixSum(p,{materializeOption:{materialize:!0,ranges:[{from:k,to:A}]}});if(w.debug("[VirtualScroll] Scrolling to index:",p,"ItemBottom:",O,"Total height:",X,"ItemHeight:",$,"safeIndexFrom:",k,"safeIndexTo:",A),!X)return;const Pe=Math.max(O-$,0);let de=Pe;f?.align==="bottom"?de=O-i:f?.align==="center"&&(de=Pe+$/2-i/2),f?.offset&&(de-=f.offset),de=Math.max(0,de);const me=ht(de,y.top),Fe=W.current?.getContentSize()??X+y.top+y.bottom,Le=Math.max(0,Fe-i),ze=Math.min(me,Le);Te.current={index:p,align:f?.align,offset:f?.offset};const Mt=W.current?.getScrollPosition()??-1,Vt=Math.abs(Mt-ze)>.5;De.current=!1,Be.current=0,Vt&&(De.current=!0,Be.current+=1,W.current?.scrollTo(ze)),g(X),fe(ze,{immediate:!0}),w.debug("[VirtualScroll] Setting scroll position to:",ze,{original:me,max:Le})},[C,a,n,y.top,y.bottom,i,fe]),Pt=r.useRef(N&&n===0?N:null);r.useEffect(()=>{const l=Pt.current;!l||n===0||(Pt.current=null,He(J(Math.trunc(l.index),0,n-1),{align:"top",offset:-Math.max(0,l.offsetPx??0)}))},[n,He]);const yt=r.useCallback(l=>{if(!W.current||n===0)return;const f=C.getTotal(),p=J(Math.floor(l),0,f),{index:k,cumulative:A,currentValue:O}=C.findIndexAtOrAfter(p,{materializeOption:{materialize:!1}}),$=(A??0)-(O??0)-p;He(k,{offset:$})},[C,n,He]),mt=r.useCallback(()=>{if(n===0)return null;const l=je(_.current,y.top),{index:f,cumulative:p,currentValue:k}=C.findIndexAtOrAfter(l,{materializeOption:{materialize:!1}});if(f===-1)return{index:n-1,offsetPx:0};if(p===l)return{index:J(f+1,0,n-1),offsetPx:0};const A=(p??0)-(k??0);return{index:f,offsetPx:Math.max(0,l-A)}},[C,n,y.top]),Ct=r.useCallback(l=>{const f=je(_.current,y.top),p=typeof l=="function"?l(f):l;yt(p);const k=W.current?.getScrollPosition(),A=typeof k=="number"?k:_.current;return fe(A),je(A,ve.current)},[y.top,yt,fe]),kt=r.useCallback((l,f)=>{w.debug("[VirtualScroll] Scroll position changed:",l);const p=De.current;p&&(De.current=!1);const k=Be.current>0;if(k&&(Be.current=0),p||k||Qe.current||(Te.current=null),fe(l),P){if(p||k)return;const A=l-f;if(w.debug("[VirtualScroll] Scroll diff:",A,"New:",l,"Prev:",f),Math.abs(A)>1){const O=A>0?"down":"up";le(O),ce(!0),w.debug("[VirtualScroll] Showing scroll buttons. Direction:",O),se.current&&clearTimeout(se.current),se.current=setTimeout(()=>{ce(!1),w.debug("[VirtualScroll] Hiding scroll buttons")},2e3)}}},[fe,P]),rt=r.useMemo(()=>je(_e,y.top),[y.top,_e]),ft=r.useMemo(()=>{const l=C.getTotal(),f=Pr(rt,i,a,n,s,C,l);return w.debug("[VirtualScroll] Calculated rendering range:",()=>({...f,scrollPosition:rt,renderingContentSize:l,overscanCount:a,viewportSize:i})),f},[rt,i,a,n,s,C]),{renderingStartIndex:nt,renderingEndIndex:st,visibleStartIndex:it,visibleEndIndex:pt}=ft,o=r.useCallback((l,f)=>{if(!q||n===0)return;const p=Ie(l,n);if(!(f?.ensureVisible??!0)){const Le=oe.current.get(p);Le&&(be.current=null,Se.current=p,we(Le));return}const A=C.prefixSum(p,{materializeOption:{materialize:!1}}),O=A.currentValue,X=Math.max(A.cumulative-O,0),$=X+O,Pe=je(_.current,y.top),de=Pe+i;if(X<Pe||$>de){He(p);const Le=oe.current.get(p);Le?(be.current=null,Se.current=p,we(Le)):be.current=p;return}const Fe=oe.current.get(p);if(Fe){be.current=null,Se.current=p,we(Fe);return}be.current=p},[q,n,C,y.top,He,we,i]),b=r.useCallback((l,f)=>{if(!q||l.defaultPrevented||l.altKey||l.metaKey||l.ctrlKey)return;const p=l.target;if(p){const k=p.tagName;if(k==="INPUT"||k==="TEXTAREA"||k==="SELECT"||p.isContentEditable)return}if(l.key==="ArrowDown"){f<n-1&&(l.preventDefault(),o(f+1));return}if(l.key==="ArrowUp"){f>0&&(l.preventDefault(),o(f-1));return}if(l.key==="PageDown"){if(f<n-1){l.preventDefault();const{visibleStartIndex:k,visibleEndIndex:A}=Z.current,O=Math.max(A-k+1,1),X=Math.max(O,1),$=Ie(Math.min(f+X,n-1),n);o($)}return}if(l.key==="PageUp"&&f>0){l.preventDefault();const{visibleStartIndex:k,visibleEndIndex:A}=Z.current,O=Math.max(A-k+1,1),X=Math.max(O,1),$=Ie(f-X,n);o($)}},[q,n,o]),v=r.useCallback(l=>{if(!q)return;const f=Ie(l,n);be.current=null,Se.current=f,ie?.(f)},[q,n,ie]);r.useEffect(()=>{const l=W.current?.getScrollPosition()??0,f=_.current,p=je(f,y.top);w.debug("[VirtualScroll] Range change effect triggered",()=>({renderingStartIndex:nt,renderingEndIndex:st,visibleStartIndex:it,visibleEndIndex:pt,scrollPositionState:_e,paneScrollPosition:f,logicalScrollPosition:p,contentSize:qe,scrollPaneScrollPosition:l})),xe({renderingStartIndex:nt,renderingEndIndex:st,visibleStartIndex:it,visibleEndIndex:pt,scrollPosition:p,totalHeight:qe})},[qe,st,nt,y.top,xe,_e,pt,it]);const D=r.useCallback(()=>{if(!P)return null;const l=ke&&Re!==null,f=Re==="up";return Y.jsx("div",{className:"aqvs-scroll-to-edge-overlay","data-visible":l,children:f?Y.jsx("div",{className:"aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top",children:Y.jsx("button",{type:"button",className:"aqvs-scroll-to-edge-button",onClick:p=>{p.stopPropagation(),De.current=!0,He(0),ce(!1)},children:"Top"})}):Y.jsx("div",{className:"aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-bottom",children:Y.jsx("button",{type:"button",className:"aqvs-scroll-to-edge-button",onClick:p=>{p.stopPropagation(),De.current=!0,He(n-1),ce(!1)},children:"Bottom"})})})},[P,ke,Re,He,n]),z=r.useRef(0),{visibleItems:he,renderAnchor:Ae}=r.useMemo(()=>{if(n===0)return{visibleItems:Y.jsx("div",{className:"aqvs-no-items-container",children:Y.jsx("div",{className:"aqvs-no-items-text",children:"No items"})}),renderAnchor:0};const l=Ie(nt,n),f=Ie(st,n),{cumulative:p,currentValue:k}=C.prefixSum(l,{materializeOption:{materialize:!1}}),A=p-k;Number.isFinite(A)&&Math.abs(A-z.current)>Rr&&(z.current=A);const O=z.current,X=[],$=[];let Pe=0,de=A;for(let me=l;me<=f;me++){if($.length>=jt){w.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.",{cap:jt,safeRenderingStartIndex:l,safeRenderingEndIndex:f});break}const Fe=s(me),Le=C.get(me),ze=Fe-Le;ze!==0&&X.push({index:me,value:Fe});const Mt=de+Pe,Vt=t?t(me):me;$.push(Y.jsx(yr,{index:me,top:Mt-O,height:Fe,item:e(me),clipItemHeight:te,enableKeyboardNavigation:q,onKeyDown:b,onFocus:v,registerItemRef:Ge,children:I},Vt)),Pe+=ze,de+=Le}return X.length>0&&Promise.resolve().then(()=>{if(Ve.current)return;let me=0;for(const ze of X)if(ze.index<it){const Mt=C.get(ze.index);me+=ze.value-Mt}const Fe=C.updates(X);if(Ve.current||typeof Fe!="number")return;g(Fe),w.debug("[VirtualScroll] Updated heights for items",X,"New total height:",Fe);const Le=W.current?.getScrollPosition()??_.current;if(me!==0){const ze=Le+me;ut(ze),fe(ze,{immediate:!0}),w.debug("[VirtualScroll] Adjusted scroll for layout shift (auto update)",{from:Le,to:ze,shiftAmount:me})}else Le!==_.current&&fe(Le)}),{visibleItems:$,renderAnchor:O}},[I,te,qe,q,n,C,e,t,s,v,b,ut,Ge,st,nt,fe,it]),Oe=r.useCallback(l=>{const f=(F??0)>0,p=Math.abs(l-_e),k=f&&p>.5?_e:l,A=je(k,y.top);if(w.debug("[VirtualScroll] Rendering visible items",()=>({currentScrollPosition:l,effectiveScrollPosition:A,renderingStartIndex:nt,renderingEndIndex:st,itemCount:n,viewportSize:i,callbackThrottleMs:F,diff:p,rawEffectiveScrollPosition:k})),n===0)return he;const O=y.top+Ae-k,X=y.bottom>0?Y.jsx("div",{className:"aqvs-bottom-inset",style:{top:C.getTotal()-Ae,height:y.bottom}},"virtualscroll-bottom-inset"):null;return w.debug("[VirtualScroll] Rendering items",()=>({containerTop:O,logicalScrollPosition:rt,resolvedInsets:y,effectiveScrollPosition:A})),Y.jsxs("div",{className:"aqvs-items-wrapper",style:{top:0,transform:`translateY(${O}px)`,willChange:"transform"},children:[he,X]})},[F,n,C,rt,Ae,st,nt,y,_e,i,he]),xt=r.useMemo(()=>({renderingStartIndex:ft.renderingStartIndex,renderingEndIndex:ft.renderingEndIndex,visibleStartIndex:ft.visibleStartIndex,visibleEndIndex:ft.visibleEndIndex,scrollPosition:rt,totalHeight:C.getTotal()}),[ft,rt,C,qe]);r.useEffect(()=>{Z.current=xt},[xt]),r.useImperativeHandle(V,()=>({getScrollPosition:()=>{const l=W.current?.getScrollPosition();return typeof l=="number"?je(l,ve.current):-1},getContentSize:()=>W.current?.getContentSize()??-1,getViewportSize:()=>W.current?.getViewportSize()??-1,scrollTo:Ct,scrollToIndex:He,getFenwickTreeTotalHeight:()=>C.getTotal(),getFenwickSize:()=>C.getSize(),focusItemAtIndex:o,getRange:()=>Z.current,getScrollAnchor:mt,updateItemSize:bt}),[Ct,He,C,o,mt,bt]);const at=C.getTotal()+y.top+y.bottom;return Y.jsx(Zt,{ref:W,contentSize:at,viewportSize:i,className:c,testId:u,onScroll:kt,background:M,tapScrollCircleOptions:K,inertiaOptions:Ne,itemCount:n,scrollBarWidth:L,enableThumbDrag:S,enableTrackClick:j,enableArrowButtons:G,enablePointerDrag:T,pointerDragInputs:B,renderThumbOverlay:ae,wheelSpeedMultiplier:Ye,onWheelHorizontal:ge,contentInsets:y,contentProps:ye,visibleStartIndex:it,visibleEndIndex:pt,renderOverlay:D,initialScrollPosition:Ee.position,children:Oe})},wr=r.forwardRef(Cr);exports.FenwickMapTree=ot;exports.ScrollBar=Gt;exports.ScrollPane=Zt;exports.TAP_SCROLL_SPEED_DEFAULTS=zt;exports.VirtualScroll=wr;exports.computeAutoTapScrollMaxSpeedMultiplier=Wt;exports.computeTapScrollSpeed=Kt;exports.minmax=J;exports.tapScrollCircleSampleVisual=br;exports.useFenwickMapTree=Jt;exports.useHeightCache=Sr;exports.useLruCache=Qt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("react/jsx-runtime"),r=require("react"),It=require("tailwind-merge");class w{level;prefix;impl;constructor(e=2,t="[virtualscroll]",s=console){this.level=e,this.prefix=t,this.impl=s}static instance=new w(2,"[virtualscroll]");static setLevel(e){w.instance.setLevel(e)}setLevel(e){this.level=e}static setImplementation(e){w.instance.setImplementation(e)}setImplementation(e){this.impl=e}static setPrefix(e){w.instance.setPrefix(e)}setPrefix(e){this.prefix=e}static isEnabled(e){return w.instance.isEnabled(e)}isEnabled(e){return this.level<=e}static resolveLazy(e){if(typeof e!="function")return e;try{return e()}catch{return e}}formatMessage(e){return typeof e=="string"?[`${this.prefix} ${e}`]:[this.prefix,e]}static debug(e,...t){w.instance.debug(e,...t)}debug(e,...t){this.level<=0&&this.impl.debug(...this.formatMessage(w.resolveLazy(e)),...t.map(w.resolveLazy))}static info(e,...t){w.instance.info(e,...t)}info(e,...t){this.level<=1&&this.impl.info(...this.formatMessage(w.resolveLazy(e)),...t.map(w.resolveLazy))}static warn(e,...t){w.instance.warn(e,...t)}warn(e,...t){this.level<=2&&this.impl.warn(...this.formatMessage(w.resolveLazy(e)),...t.map(w.resolveLazy))}static error(e,...t){w.instance.error(e,...t)}error(e,...t){this.level<=3&&this.impl.error(...this.formatMessage(w.resolveLazy(e)),...t.map(w.resolveLazy))}}const Yt={active:!1,offsetX:0,offsetY:0,distance:0,direction:0,pointerId:null},Dt=6,er=8,tr=({dragState:n,normalizedDistance:e})=>{const t=1+e*.18,s=.16+e*.24,i=.38+e*.28,a=n.active?"80ms ease-out":"220ms ease";return Y.jsxs(Y.Fragment,{children:[Y.jsx("div",{className:"aqvs-tap-scroll-circle-visual-outer",style:{background:"linear-gradient(140deg, rgba(255,255,255,0.62), rgba(72,72,72,0.48))",boxShadow:`0 0 0 1px rgba(255,255,255,0.28), 0 10px 22px rgba(0,0,0,${s})`,transform:`scale(${t})`,transition:`${a}, ${n.active?"80ms":"260ms"} box-shadow ease`}}),Y.jsx("div",{className:"aqvs-tap-scroll-circle-inner",style:{background:"linear-gradient(140deg, rgba(255,255,255,0.72), rgba(28,28,28,0.58))",boxShadow:"inset 0 4px 10px rgba(0,0,0,0.24), inset 0 0 2px rgba(255,255,255,0.55)",opacity:i,transition:n.active?"120ms opacity ease-out":"220ms opacity ease"}})]})},Ut=r.memo(r.forwardRef(({onDragChange:n,className:e,maxVisualDistance:t=160,size:s=40,style:i,opacity:a=1,renderVisual:c},u)=>{const[d,x]=r.useState(Yt),I=r.useRef(null),S=r.useRef(null),E=r.useRef({x:0,y:0}),h=r.useRef(null),N=r.useRef(0),F=r.useCallback(T=>{x(T),n(T)},[n]),U=r.useCallback((T,B,q=!1)=>{const{x:Ye,y:Ne}=E.current,te=T-Ye,re=B-Ne,W=Math.abs(re),Z=W<Dt?0:re<0?-1:1,Te=N.current;let Ve=Z;const $e=Dt+er;Z===0?Te!==0&&W<$e?Ve=Te:(Ve=0,q||(N.current=0)):Z!==Te&&Te!==0&&W<$e?Ve=Te:N.current=Z,F({active:q||W>=Dt,offsetX:te,offsetY:re,distance:W,direction:Ve,pointerId:I.current})},[F]),ie=r.useCallback(T=>{if(T===null)return;const B=h.current;B?.hasPointerCapture(T)&&B.releasePointerCapture(T)},[]),Q=r.useCallback((T=!1)=>{T&&ie(I.current),I.current=null,S.current=null,N.current=0,F(Yt)},[F,ie]),ee=r.useCallback(T=>{if(I.current!==null&&I.current!==T.pointerId){S.current={pointerId:T.pointerId,clientX:T.clientX,clientY:T.clientY},T.preventDefault(),T.stopPropagation();return}T.preventDefault(),T.stopPropagation();const B=h.current??T.currentTarget,{left:q,top:Ye,width:Ne,height:te}=B.getBoundingClientRect();E.current={x:q+Ne/2,y:Ye+te/2},I.current=T.pointerId;try{B.setPointerCapture(T.pointerId)}catch{}U(T.clientX,T.clientY,!0)},[U]),ge=r.useCallback(T=>{if(I.current!==T.pointerId){S.current!==null&&S.current.pointerId===T.pointerId&&(S.current={pointerId:T.pointerId,clientX:T.clientX,clientY:T.clientY});return}T.preventDefault(),U(T.clientX,T.clientY)},[U]),ye=r.useCallback(T=>{if(I.current!==T.pointerId){S.current!==null&&S.current.pointerId===T.pointerId&&(S.current=null);return}T.preventDefault(),T.stopPropagation();const B=S.current;if(S.current=null,B!==null){ie(T.pointerId);const q=h.current;let Ye=!0;if(q!==null&&typeof q.setPointerCapture=="function")try{q.setPointerCapture(B.pointerId)}catch(Ne){(typeof Ne=="object"&&Ne!==null&&"name"in Ne?Ne.name:void 0)==="NotFoundError"&&(Ye=!1)}if(Ye){I.current=B.pointerId,U(B.clientX,B.clientY,!0);return}}Q(!0)},[Q,ie,U]),V=r.useCallback(T=>{T.target===T.currentTarget&&I.current===T.pointerId&&Q(!1)},[Q]);r.useImperativeHandle(u,()=>({reset:()=>{Q(!0)},getElement:()=>h.current}),[Q]);const L=Math.min(Math.max(a,0),1),M=s/64,j=Math.min(d.distance,t)/t,G=d.direction*j*10*M,P=c??tr,ae={dragState:d,normalizedDistance:j,sizeScale:M,size:s,opacity:L},K={...i,width:s,height:s,transform:`translateY(${G}px)`};return K.opacity=L,Y.jsx("div",{ref:h,"data-testid":"virtual-scroll-tap-circle",className:It.twMerge("aqvs-tap-scroll-circle",e),style:K,tabIndex:-1,onPointerDown:ee,onPointerMove:ge,onPointerUp:ye,onPointerCancel:ye,onLostPointerCapture:V,role:"presentation",children:P(ae)})}));Ut.displayName="TapScrollCircle";const J=(n,e,t)=>Math.max(e,Math.min(t,n)),Ft="virtualscroll:tap-scroll-cancel",Bt=20,rr=250,nr=60,sr=20,ir=20,zt={maxDistance:240,minSpeedMultiplier:.2},ar=zt.maxDistance,qt={active:!1,offsetX:0,offsetY:0,distance:0,direction:0,pointerId:null},At=2.2,or=8,lr=120,cr=1/10,Je={enabled:!0,size:40,offsetX:-80,offsetY:0,className:void 0,maxVisualDistance:ar,minSpeedMultiplier:zt.minSpeedMultiplier,opacity:.9,renderVisual:void 0,maxSpeedCurve:void 0},ur=n=>n?{mainSizeKey:"width",crossSizeKey:"height",positionKey:"left",selectDelta:(e,t)=>e,getPointerCoordinate:({clientX:e})=>e,arrowLabels:["Scroll left","Scroll right"],arrowIcons:["◀","▶"],directionClass:"aqvs-scrollbar-horizontal",orientation:"horizontal"}:{mainSizeKey:"height",crossSizeKey:"width",positionKey:"top",selectDelta:(e,t)=>t,getPointerCoordinate:({clientY:e})=>e,arrowLabels:["Scroll up","Scroll down"],arrowIcons:["▲","▼"],directionClass:"aqvs-scrollbar-vertical",orientation:"vertical"},fr=(n,e)=>{const t=n?.maxSpeedMultiplier,s=typeof t=="number"?t:Wt(e);return{enabled:n?.enabled??Je.enabled,size:n?.size??Je.size,offsetX:n?.offsetX??Je.offsetX,offsetY:n?.offsetY??Je.offsetY,className:n?.className??Je.className,maxVisualDistance:n?.maxVisualDistance??Je.maxVisualDistance,maxSpeedMultiplier:s,minSpeedMultiplier:Math.max(n?.minSpeedMultiplier??Je.minSpeedMultiplier,0),opacity:J(n?.opacity??Je.opacity,0,1),renderVisual:n?.renderVisual??Je.renderVisual,maxSpeedCurve:n?.maxSpeedCurve??Je.maxSpeedCurve}},dr=({isDragging:n,isThumbHovered:e,enableThumbDrag:t})=>r.useMemo(()=>t?n?"dragging":e?"hover":"idle":"disabled",[t,n,e]),mr=({canUseArrowButtons:n,enableArrowButtons:e,resetTapScroll:t,scrollByStep:s})=>{const i=r.useRef(null),a=r.useRef(null),c=r.useRef(null),u=r.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null),a.current!==null&&(window.clearTimeout(a.current),a.current=null),c.current!==null&&(window.removeEventListener("pointerup",c.current),window.removeEventListener("pointercancel",c.current),window.removeEventListener("blur",c.current),c.current=null)},[]),d=r.useCallback(()=>{u()},[u]),x=r.useCallback(S=>E=>{if(!n)return;E.cancelable&&E.preventDefault(),E.stopPropagation(),t(),u(),s(S),a.current=window.setTimeout(()=>{i.current=window.setInterval(()=>{s(S)},nr)},rr);const h=()=>u();c.current=h,window.addEventListener("pointerup",h),window.addEventListener("pointercancel",h),window.addEventListener("blur",h)},[n,u,t,s]),I=r.useCallback(S=>E=>{e&&(E.key==="Enter"||E.key===" "||E.key==="Spacebar")&&(E.preventDefault(),s(S))},[e,s]);return r.useEffect(()=>{n||u()},[n,u]),r.useEffect(()=>()=>{u()},[u]),{handleArrowPointerDown:x,handleArrowPointerUp:d,handleArrowKeyDown:I}},pr=700,dt=(n,e)=>typeof n=="number"&&Number.isFinite(n)?n:e,Kt=({distance:n,maxDistance:e,viewportSize:t,minSpeedMultiplier:s,maxSpeedMultiplier:i,hasCustomMaxSpeedMultiplier:a,curve:c})=>{const u=Math.max(dt(n,0),0),d=dt(e,0),x=d>0?Math.min(u,d)/d:1,I=Math.max(dt(t,0),0),S=Math.max(dt(s,0),0),E=Math.max(dt(i,0),0),h=Math.max(I*S,40),N=a?h:1200,F=Math.max(I*E,N),U=c?Math.max(dt(c.exponentialScale,E),0):0,ie=c?Math.min(F,Math.max(I*U,h)):F,Q=Math.max(ie,h);let ee=x**1.1;if(c){const ye=Math.min(Math.max(dt(c.exponentialSteepness,0),0),pr);if(ye===0)ee=x;else{const V=Math.expm1(ye)||1;ee=Math.min(Math.max(Math.expm1(ye*x)/V,0),1)}}const ge=Math.min(Math.max(dt(c?.easedOffset,0),0),1);return h+(Q-h)*(ge+(1-ge)*ee)},Wt=n=>{if(!n||n<=0)return At;const e=Math.max(1,n),t=Math.log10(e),s=At+t*or;return J(s,At,lr)},Gt=({contentSize:n,viewportSize:e,scrollPosition:t,onScroll:s,enableThumbDrag:i=!0,enableTrackClick:a=!0,enableArrowButtons:c=!0,horizontal:u=!1,scrollBarWidth:d=12,className:x,ariaControls:I,tapScrollCircleOptions:S,itemCount:E,renderThumbOverlay:h,visibleStartIndex:N,visibleEndIndex:F})=>{const[U,ie]=r.useState(!1),[Q,ee]=r.useState(!1),[ge,ye]=r.useState(!1),V=r.useRef(null),L=r.useRef({pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0,scale:1,captureTarget:null}),M=r.useRef({pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0,scale:1}),j=r.useRef(t),G=r.useRef(s),P=r.useRef(qt),ae=r.useRef(null),K=r.useRef(null),T=r.useRef(null),B=r.useRef(0),q=r.useRef(0),Ye=r.useMemo(()=>fr(S,E),[E,S]),Ne=r.useMemo(()=>ur(u),[u]),{enabled:te,size:re,offsetX:W,offsetY:Z,className:Te,maxVisualDistance:Ve,maxSpeedMultiplier:$e,minSpeedMultiplier:y,opacity:lt,renderVisual:ne,maxSpeedCurve:C}=Ye,Ee=r.useRef({viewportSize:e,maxScrollPosition:Math.max(n-e,0),scrollBarVisible:n>e,effectiveTapMaxDistance:Math.max(Ve,1),tapCircleMaxSpeedMultiplier:$e,tapCircleMinSpeedMultiplier:y,tapCircleMaxSpeedCurve:C,tapScrollCircleOptions:S,effectiveTrackLength:0,onScroll:s,scrollPosition:t}),{mainSizeKey:_e,crossSizeKey:We,positionKey:qe,selectDelta:g,getPointerCoordinate:_,arrowLabels:pe,arrowIcons:H,directionClass:Se,orientation:oe}=Ne,be=Math.max(Ve,1),Me=e/n,Re=Math.max(e-d*2,0),le=Me*Re,ke=Math.min(Math.max(Bt,le||0),Re||Bt),ce=n-e,se=Math.max(Re-ke,0),De=ce<=0||se<=0?0:J(t/ce*se,0,se),Be=De+ke/2,Ce=n>e||U,Qe=Ce&&c;r.useLayoutEffect(()=>{Ee.current={viewportSize:e,maxScrollPosition:ce,scrollBarVisible:Ce,effectiveTapMaxDistance:be,tapCircleMaxSpeedMultiplier:$e,tapCircleMinSpeedMultiplier:y,tapCircleMaxSpeedCurve:C,tapScrollCircleOptions:S,effectiveTrackLength:se,onScroll:s,scrollPosition:t}}),r.useLayoutEffect(()=>{j.current=t},[t]),r.useLayoutEffect(()=>{G.current=s},[s]),r.useEffect(()=>{i||ee(!1)},[i]);const Ue=dr({isDragging:U,isThumbHovered:Q,enableThumbDrag:i}),we=r.useCallback((o,b)=>{const v=Ee.current,D=b??j.current;if(G.current){const Oe=G.current(o,D);if(typeof Oe=="number"&&Number.isFinite(Oe))return j.current=Oe,Oe}const z=typeof o=="function"?o(D):o,he=Math.max(v.maxScrollPosition,0),Ae=v.scrollBarVisible?J(z,0,he):0;return j.current=Ae,Ae},[]),m=r.useCallback(o=>{const b=Ee.current,v=j.current;if(!b.scrollBarVisible||b.maxScrollPosition<=0){const at=we(0,v),l=at-v;return{nextPosition:at,actualDelta:l,reachedBoundary:!0}}if(o===0)return{nextPosition:v,actualDelta:0,reachedBoundary:!1};const z=we(at=>J(at+o,0,b.maxScrollPosition),v),he=z-v,Ae=o<0&&v+o<=0,Oe=o>0&&v+o>=b.maxScrollPosition,bt=o<0&&(z<=0||Ae&&he===0)||o>0&&(z>=b.maxScrollPosition||Oe&&he===0);return{nextPosition:z,actualDelta:he,reachedBoundary:bt}},[we]),R=r.useCallback((o,b)=>{o.current+=b;const v=Math.max(Ee.current.maxScrollPosition,0);v>0&&(o.current=J(o.current,-v,v));const D=m(o.current);return o.current-=D.actualDelta,D.reachedBoundary&&(o.current=0),D},[m]),ue=r.useCallback(()=>{K.current!==null&&(window.cancelAnimationFrame(K.current),K.current=null),T.current=null,B.current=0,q.current=0},[]),xe=r.useCallback(()=>{P.current={...qt},ye(!1),ae.current?.reset(),ue()},[ue]),ve=r.useCallback(o=>{const b=P.current,v=Ee.current;if(!b.active||b.direction===0){ue();return}if(!v.scrollBarVisible||v.maxScrollPosition<=0){ue();return}const D=T.current??o,z=Math.max((o-D)/1e3,0),he=Math.min(z,cr);if(T.current=o,he<=0){K.current=window.requestAnimationFrame(ve);return}const Ae=Kt({distance:b.distance,maxDistance:v.effectiveTapMaxDistance,viewportSize:v.viewportSize,minSpeedMultiplier:v.tapCircleMinSpeedMultiplier,maxSpeedMultiplier:v.tapCircleMaxSpeedMultiplier,hasCustomMaxSpeedMultiplier:typeof v.tapScrollCircleOptions?.maxSpeedMultiplier=="number",curve:v.tapCircleMaxSpeedCurve});q.current!==b.direction&&(q.current=b.direction,B.current=0);const{reachedBoundary:Oe}=R(B,b.direction*Ae*he);if(Oe){ue();return}K.current=window.requestAnimationFrame(ve)},[R,ue]),et=r.useCallback(()=>{K.current===null&&(T.current=null,B.current=0,K.current=window.requestAnimationFrame(ve))},[ve]);r.useEffect(()=>{const o=P.current;!o.active||o.direction===0||et()},[n,e,et]),r.useEffect(()=>()=>{ue()},[ue]);const Ge=r.useCallback(o=>{P.current=o,ye(o.active),o.active&&o.direction!==0?et():ue()},[et,ue]);r.useEffect(()=>{te||xe()},[xe,te]),r.useEffect(()=>{const o=b=>{const D=b.detail?.paneId;D&&I&&D!==I||xe()};return window.addEventListener(Ft,o),()=>{window.removeEventListener(Ft,o)}},[I,xe]),r.useEffect(()=>{if(!te)return;const o=b=>{if(!P.current.active||P.current.pointerId===b.pointerId)return;const v=b.target;if(!(v instanceof Node)){xe();return}ae.current?.getElement()?.contains(v)||xe()};return document.addEventListener("pointerdown",o,!0),()=>{document.removeEventListener("pointerdown",o,!0)}},[xe,te]);const Ze=o=>{if(!Ce||se<=0||ce<=0)return 0;const b=J(o,0,se);return J(b/se*ce,0,ce)},Xe=r.useCallback(o=>{const{scrollBarVisible:b,effectiveTrackLength:v,maxScrollPosition:D}=Ee.current;if(w.debug("[ScrollBar] calculateScrollPositionFromThumb",()=>({thumbPos:o,trackLen:v,maxScroll:D})),v<=0||D<=0)return null;const z=J(o,0,v);return J(z/v*D,0,D)},[]),tt=r.useCallback(o=>{const b=o.getBoundingClientRect(),v=u?b.width:b.height,D=bt=>{const at=Number.parseFloat(bt);return Number.isFinite(at)?at:0},z=window.getComputedStyle(o),he=D(u?z.width:z.height),Ae=he>0?he+D(u?z.paddingLeft:z.paddingTop)+D(u?z.paddingRight:z.paddingBottom)+D(u?z.borderLeftWidth:z.borderTopWidth)+D(u?z.borderRightWidth:z.borderBottomWidth):0,Oe=Ae>0?Ae:u?o.offsetWidth:o.offsetHeight;return Oe<=0||v<=0?1:v/Oe},[u]),ct=r.useCallback(o=>{const b=L.current;if(b.pointerId!==o.pointerId)return;const v=o.clientX-b.startClientX,D=o.clientY-b.startClientY,z=g(v,D)/(b.scale||1);w.debug("[ScrollBar] handleThumbPointerMove",()=>({delta:z,startThumbPosition:b.startThumbPosition,clientY:o.clientY,startClientY:b.startClientY,metrics:Ee.current}));const he=Xe(b.startThumbPosition+z);he!==null&&we(he),o.cancelable&&o.preventDefault()},[g,Xe,we]),Ke=r.useCallback(o=>{const b=L.current;if(b.pointerId!==o.pointerId)return;document.removeEventListener("pointermove",ct),document.removeEventListener("pointerup",Ke),document.removeEventListener("pointercancel",Ke);const v=b.captureTarget;if(v?.hasPointerCapture?.(o.pointerId)&&v.releasePointerCapture(o.pointerId),L.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0,scale:1,captureTarget:null},ie(!1),V.current){const D=V.current.getBoundingClientRect();o.clientX>=D.left&&o.clientX<=D.right&&o.clientY>=D.top&&o.clientY<=D.bottom||ee(!1)}else ee(!1)},[ct]);r.useEffect(()=>()=>{document.removeEventListener("pointermove",ct),document.removeEventListener("pointerup",Ke),document.removeEventListener("pointercancel",Ke)},[ct,Ke]);const Tt=r.useRef(0),fe=r.useRef(0),ut=r.useCallback(o=>{const b=Math.max(Math.round(Ee.current.viewportSize/ir),sr);fe.current!==o&&(fe.current=o,Tt.current=0),R(Tt,o*b)},[R]),{handleArrowPointerDown:vt,handleArrowPointerUp:gt,handleArrowKeyDown:He}=mr({canUseArrowButtons:Qe,enableArrowButtons:c,resetTapScroll:xe,scrollByStep:ut}),Pt=o=>{if(!Ce)return;if(!i){o.preventDefault(),o.stopPropagation();return}if(o.pointerType==="mouse"&&o.button!==0||o.ctrlKey)return;xe();const b=o.currentTarget,v=tt(b);let D=null;if(b.setPointerCapture)try{b.setPointerCapture(o.pointerId),D=b}catch{D=null}L.current={pointerId:o.pointerId,startThumbPosition:De,startClientX:o.clientX,startClientY:o.clientY,scale:v,captureTarget:D},document.addEventListener("pointermove",ct),document.addEventListener("pointerup",Ke),document.addEventListener("pointercancel",Ke),ie(!0),ee(!0),o.preventDefault(),o.stopPropagation()},yt=o=>{if(!Ce)return;if(!a){o.preventDefault(),o.stopPropagation();return}if(o.pointerType==="mouse"&&o.button!==0||o.ctrlKey)return;const b=o.currentTarget,v=b.getBoundingClientRect(),D=_(o),z=tt(b),he=(D-(u?v.left:v.top))/z;xe();const Ae=he-ke/2,Oe=Ze(Ae);if(we(Oe),b.setPointerCapture)try{b.setPointerCapture(o.pointerId)}catch{}M.current={pointerId:o.pointerId,startThumbPosition:Ae,startClientX:o.clientX,startClientY:o.clientY,scale:z},o.preventDefault(),o.stopPropagation()},mt=()=>{M.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0,scale:1}},Ct=o=>{const b=M.current;if(b.pointerId!==o.pointerId)return;if(o.pointerType==="mouse"&&o.buttons===0){mt();return}const v=o.clientX-b.startClientX,D=o.clientY-b.startClientY,z=g(v,D)/(b.scale||1),he=Ze(b.startThumbPosition+z);we(he),o.cancelable&&o.preventDefault()},kt=o=>{if(M.current.pointerId!==o.pointerId)return;const b=o.currentTarget;b.hasPointerCapture?.(o.pointerId)&&b.releasePointerCapture(o.pointerId),mt(),o.preventDefault(),o.stopPropagation()},rt=o=>{if(M.current.pointerId!==o.pointerId)return;const b=o.currentTarget;b.hasPointerCapture?.(o.pointerId)&&b.releasePointerCapture(o.pointerId),mt()},ft=o=>{o.target===o.currentTarget&&M.current.pointerId===o.pointerId&&mt()},nt=r.useMemo(()=>J((ge?1:.8)*lt,0,1),[ge,lt]),st=r.useMemo(()=>{const b=`calc(50% - ${re/2}px + ${Z}px)`;return{left:W,top:b}},[W,Z,re]),it=(o,b,v,D)=>Y.jsx("button",{type:"button",tabIndex:0,className:"aqvs-scrollbar-arrow-button",style:{[_e]:d,[We]:d},"aria-label":b,onPointerDown:vt(o),onPointerUp:gt,onPointerLeave:gt,onPointerCancel:gt,onKeyDown:He(o),"aria-disabled":!c,disabled:!Qe,children:Y.jsx("span",{"aria-hidden":"true",children:v})},D),pt=h&&Ce?{orientation:oe,scrollPosition:t,maxScrollPosition:ce,contentSize:n,viewportSize:e,thumbSize:ke,thumbPosition:De,thumbCenter:Be,trackSize:Re,isDragging:U,isTapScrollActive:ge,visibleStartIndex:N,visibleEndIndex:F}:null;return Y.jsxs("div",{className:It.twMerge("aqvs-scrollbar",Se,x),style:{[_e]:e,[We]:d},"data-visible":Ce?"true":"false",role:"scrollbar",tabIndex:-1,"aria-controls":I,"aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":ce,"aria-orientation":u?"horizontal":"vertical",children:[!u&&Ce&&te&&Y.jsx(Ut,{ref:ae,className:It.twMerge("aqvs-scrollbar-tap-circle-wrapper",Te),size:re,maxVisualDistance:be,style:st,opacity:nt,renderVisual:ne,onDragChange:Ge},"tap-circle"),it(-1,pe[0],H[0],"arrow-start"),Y.jsxs("div",{className:"aqvs-scrollbar-track",style:{borderRadius:d/2},onPointerDown:yt,onPointerMove:Ct,onPointerUp:kt,onPointerCancel:rt,onLostPointerCapture:ft,"aria-disabled":!a,children:[pt&&Y.jsx("div",{className:"aqvs-scrollbar-overlay","aria-hidden":!0,children:h?.(pt)},"overlay"),Y.jsx("div",{className:"aqvs-scrollbar-thumb-wrapper",style:{[_e]:ke,[qe]:De,...u?{top:0,bottom:0}:{left:0,right:0}},"data-visible":Ce||U?"true":"false",onPointerDown:Pt,role:"slider","aria-orientation":u?"horizontal":"vertical","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":ce,"aria-disabled":!i,tabIndex:-1,children:Y.jsx("div",{ref:V,className:It.twMerge("aqvs-scrollbar-thumb",u?"aqvs-scrollbar-thumb-horizontal":"aqvs-scrollbar-thumb-vertical"),"data-testid":"aqvs-scrollbar-thumb","data-thumb-state":Ue,style:{borderRadius:d-1,cursor:i?"pointer":"default"},onMouseEnter:()=>{i&&ee(!0)},onMouseLeave:()=>{i&&ee(!1)}},"thumb")},"thumb-wrapper")]},"track"),it(1,pe[1],H[1],"arrow-end")]})},hr=["mouse","pen","touch"],Lt=(n,e)=>!(n==="mouse"||n==="pen"||n==="touch")||e.includes(n),gr=n=>n==="mouse"||n==="pen",Mt={maxVelocity:6,minVelocity:.02,deceleration:.0025,velocitySampleWindow:90,startVelocityThreshold:.04},wt=(n,e,t)=>{for(const[s,i,a]of e)t==="add"?n.addEventListener(s,i,a):n.removeEventListener(s,i,a)},Zt=r.forwardRef(({children:n,contentSize:e,viewportSize:t,scrollBarWidth:s=12,enableThumbDrag:i=!0,enableTrackClick:a=!0,enableArrowButtons:c=!0,enablePointerDrag:u=!0,pointerDragInputs:d=hr,onScroll:x,className:I,testId:S,style:E,background:h,tapScrollCircleOptions:N,inertiaOptions:F,itemCount:U,renderThumbOverlay:ie,wheelSpeedMultiplier:Q=1,onWheelHorizontal:ee,contentInsets:ge,visibleStartIndex:ye,visibleEndIndex:V,renderOverlay:L,initialScrollPosition:M=0,contentProps:j},G)=>{const P=r.useRef(Number.isFinite(M)?Math.max(0,M):0),ae=r.useRef(null),K=r.useRef(null),T=r.useRef(ee);r.useEffect(()=>{T.current=ee},[ee]);const B=r.useRef({frame:null,velocity:0,lastTimestamp:null,generation:0}),q=r.useMemo(()=>({maxVelocity:F?.maxVelocity??Mt.maxVelocity,minVelocity:F?.minVelocity??Mt.minVelocity,deceleration:F?.deceleration??Mt.deceleration,velocitySampleWindow:F?.velocitySampleWindow??Mt.velocitySampleWindow,startVelocityThreshold:F?.startVelocityThreshold??Mt.startVelocityThreshold}),[F]),Ye=r.useMemo(()=>({top:Math.max(0,ge?.top??0),bottom:Math.max(0,ge?.bottom??0)}),[ge]);w.debug("[ScrollPane] ScrollPane rendered",()=>({contentSize:e,viewportSize:t,scrollBarWidth:s,className:I,style:E,tapScrollCircleOptions:N,inertiaOptions:F,enablePointerDrag:u,contentInsets:Ye}));const Ne=r.useRef({contentSize:e,viewportSize:t});Ne.current={contentSize:e,viewportSize:t};const te=r.useMemo(()=>e>t,[e,t]),re=r.useCallback(g=>{const{contentSize:_,viewportSize:pe}=Ne.current,H=_>pe,Se=P.current;if(w.debug("[ScrollPane] scrollTo called",()=>({newPosition:g,contentSize:_,viewportSize:pe,currentIsScrollable:H,prevPosition:Se})),!H)return P.current!==0&&(P.current=0,x?.(0,Se)),P.current;const oe=typeof g=="function"?g(P.current):g;if(!Number.isFinite(oe))return w.warn("[ScrollPane] scrollTo received a non-finite position; keeping the current position",{nextPosition:oe}),P.current;const be=Math.max(_-pe,0),Me=J(oe,0,be);return P.current!==Me&&(P.current=Me,x?.(Me,Se)),P.current},[x]),W=r.useRef(re);r.useEffect(()=>{W.current=re},[re]);const Z=r.useCallback(()=>{const g=B.current;g.generation+=1,g.frame!==null&&cancelAnimationFrame(g.frame),g.frame=null,g.velocity=0,g.lastTimestamp=null},[]),Te=r.useRef(Z);r.useEffect(()=>{Te.current=Z},[Z]),r.useEffect(()=>()=>{Te.current()},[]);const Ve=r.useCallback(g=>{if(!te)return;const{maxVelocity:_,minVelocity:pe,deceleration:H,startVelocityThreshold:Se}=q,oe=J(g,-_,_);if(Math.abs(oe)<Se)return;Z(),B.current.velocity=oe,B.current.lastTimestamp=null;const be=B.current.generation,Me=Re=>{const le=B.current;if(le.generation!==be)return;if(le.lastTimestamp===null){le.lastTimestamp=Re,le.frame=requestAnimationFrame(Me);return}const ke=Re-le.lastTimestamp;if(le.lastTimestamp=Re,ke<=0){le.frame=requestAnimationFrame(Me);return}const ce=le.velocity;let se=ce;const De=H*ke;ce>0?se=Math.max(0,ce-De):ce<0&&(se=Math.min(0,ce+De));const Ce=(ce+se)/2*ke,Qe=P.current;if(Ce!==0&&W.current(xe=>xe+Ce),B.current.generation!==be)return;const Ue=P.current,{contentSize:we,viewportSize:m}=Ne.current,R=Math.max(we-m,0);le.velocity=se;const ue=Ue===Qe||Ue<=0&&se<=0||Ue>=R&&se>=0;if(Math.abs(se)<pe||ue){Z();return}le.frame=requestAnimationFrame(Me)};B.current.frame=requestAnimationFrame(Me)},[te,q,Z]),$e=r.useRef(Ve);r.useEffect(()=>{$e.current=Ve},[Ve]),r.useLayoutEffect(()=>{Ne.current={contentSize:e,viewportSize:t}},[e,t]),r.useLayoutEffect(()=>{const g=K.current;if(!g)return;const _=()=>{g.scrollTop!==0&&(w.debug("[ScrollPane] Native scroll detected, resetting to 0",()=>({scrollTop:g.scrollTop})),g.scrollTop=0),g.scrollLeft!==0&&(g.scrollLeft=0)};return g.addEventListener("scroll",_),()=>g.removeEventListener("scroll",_)},[]),r.useLayoutEffect(()=>{if(te){w.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change",()=>({contentSize:e,viewportSize:t,scrollPosition:P.current}));const g=J(e-t,0,e);P.current>g&&re(g)}else re(0)},[te,re,e,t]),r.useEffect(()=>{const g=H=>{if(H.ctrlKey)return;const Se=H.shiftKey&&H.deltaX===0,oe=Se?H.deltaY:H.deltaX,be=Se?0:H.deltaY;if(oe!==0&&Math.abs(oe)>=Math.abs(be)){if(T.current){H.preventDefault(),Z();let le=oe;H.deltaMode===1?le*=16:H.deltaMode===2&&(le*=t),T.current(le)}return}if(!te||H.deltaY===0)return;H.preventDefault(),Z();let Re=H.deltaY;H.deltaMode===1?Re*=16:H.deltaMode===2&&(Re*=t),Q!==1&&(Re*=Q),w.debug("[ScrollPane] wheel event",()=>({deltaY:Re,scrollPosition:P.current,wheelSpeedMultiplier:Q,deltaMode:H.deltaMode,scrollTop:K.current?.scrollTop})),re(le=>le+Re)},_=()=>{Z()},pe=ae.current;return pe&&(pe.addEventListener("wheel",g,{passive:!1}),pe.addEventListener("pointerdown",_,{capture:!0,passive:!0})),()=>{pe&&(pe.removeEventListener("wheel",g),pe.removeEventListener("pointerdown",_,{capture:!0}))}},[te,re,Z,t,Q]),r.useImperativeHandle(G,()=>({scrollTo:g=>(Z(),re(g)),getScrollPosition:()=>P.current,getContentSize:()=>e,getViewportSize:()=>t}),[re,e,t,Z]);const y=r.useId(),lt=j?.id??y,ne=r.useRef({pointerType:"",pointerId:null,startClientY:0,startScroll:0,isDragging:!1,shouldCancelNextClick:!1,clickResetTimer:null,velocitySamples:[]}),C=r.useRef(u),Ee=r.useRef(d);r.useEffect(()=>{C.current=u},[u]),r.useEffect(()=>{Ee.current=d},[d]);const _e=r.useRef(te);r.useEffect(()=>{_e.current=te},[te]);const We=r.useRef(q);r.useEffect(()=>{We.current=q},[q]),r.useEffect(()=>{const g=ne.current;if(u&&te&&(g.pointerId===null||Lt(g.pointerType,d))||g.pointerId===null)return;const _=K.current;g.clickResetTimer!==null&&(window.clearTimeout(g.clickResetTimer),g.clickResetTimer=null);const pe=g.isDragging&&g.shouldCancelNextClick,H=g.pointerId;g.pointerId=null,g.pointerType="",g.startClientY=0,g.startScroll=0,g.isDragging=!1,g.shouldCancelNextClick=pe,g.velocitySamples=[],_?.hasPointerCapture(H)&&_.releasePointerCapture(H)},[u,d,te]),r.useEffect(()=>{const g=K.current;if(!g)return;const _=6,pe=()=>typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),H=()=>{const m=ne.current;m.pointerId=null,m.pointerType="",m.startClientY=0,m.startScroll=0,m.isDragging=!1,m.velocitySamples=[]},Se=()=>{const m=ne.current;m.clickResetTimer!==null&&(window.clearTimeout(m.clickResetTimer),m.clickResetTimer=null)},oe=m=>{const R=ne.current,ue=pe();R.velocitySamples.push({clientY:m,time:ue});const xe=We.current.velocitySampleWindow;R.velocitySamples=R.velocitySamples.filter(ve=>ue-ve.time<=xe)},be=m=>m instanceof HTMLElement&&m.closest("[data-scrollpane-ignore-drag='true']")!==null,Me=m=>{const R=ne.current;R.shouldCancelNextClick&&(m.preventDefault(),m.stopPropagation(),R.shouldCancelNextClick=!1)},Re=m=>{const R=ne.current;if(!R.isDragging){if(R.isDragging=!0,R.shouldCancelNextClick=!0,!g.hasPointerCapture(m.pointerId))try{g.setPointerCapture(m.pointerId)}catch{}oe(m.clientY)}},le=m=>m.isTrusted||m.target===g,ke=m=>{const R=ne.current;g.hasPointerCapture(m)&&g.releasePointerCapture(m),R.shouldCancelNextClick=!1,Se(),H()},ce=m=>{const R=ne.current;if(R.pointerId!==m.pointerId)return;if(m.buttons===0&&gr(m.pointerType)){ke(m.pointerId);return}if(!(C.current&&_e.current)||!Lt(m.pointerType,Ee.current)||!R.isDragging&&(Math.abs(m.clientY-R.startClientY)<_||(Re(m),!R.isDragging)))return;oe(m.clientY);const ue=m.clientY-R.startClientY,xe=R.startScroll-ue;W.current(xe),m.cancelable&&m.preventDefault()},se=()=>{const m=ne.current;return m.pointerId!==null||!m.shouldCancelNextClick?!1:(Se(),m.clickResetTimer=window.setTimeout(()=>{const R=ne.current;R.shouldCancelNextClick=!1,R.clickResetTimer=null},0),!0)},De=m=>{const R=ne.current;if(R.pointerId!==m.pointerId){se();return}R.isDragging&&R.shouldCancelNextClick&&m.cancelable&&(m.preventDefault(),m.stopPropagation()),R.isDragging&&oe(m.clientY);let ue=0;if(R.isDragging&&R.velocitySamples.length>=2){const ve=R.velocitySamples,et=We.current.velocitySampleWindow,Ge=ve[ve.length-1],Ze=ve.find(Xe=>Ge.time-Xe.time<=et)??ve[0];if(Ge&&Ze&&Ge.time!==Ze.time){const Xe=Ge.clientY-Ze.clientY,tt=Ge.time-Ze.time;ue=-(Xe/tt)}}Se(),R.shouldCancelNextClick&&(R.clickResetTimer=window.setTimeout(()=>{const ve=ne.current;ve.shouldCancelNextClick=!1,ve.clickResetTimer=null},0));const xe=We.current.startVelocityThreshold;H(),g.hasPointerCapture(m.pointerId)&&g.releasePointerCapture(m.pointerId),Math.abs(ue)>=xe&&$e.current?.(ue)},Be=m=>{if(ne.current.pointerId!==null){if(!m.isPrimary||m.pointerType!==ne.current.pointerType)return;ke(ne.current.pointerId)}if(ne.current.shouldCancelNextClick&&(Se(),ne.current.shouldCancelNextClick=!1),!(C.current&&_e.current)||!Lt(m.pointerType,Ee.current)||m.button!==0&&m.pointerType==="mouse"||m.ctrlKey||m.metaKey||m.altKey||be(m.target))return;window.dispatchEvent(new CustomEvent(Ft,{detail:{paneId:y}})),Te.current?.();const R=ne.current;Se(),R.pointerId=m.pointerId,R.pointerType=m.pointerType,R.startClientY=m.clientY,R.startScroll=P.current,R.isDragging=!1,R.shouldCancelNextClick=!1,R.velocitySamples=[]},Ce=m=>{if(ne.current.pointerId!==m.pointerId){se();return}le(m)&&ke(m.pointerId)},Ue=[["click",Me,!0],["pointerdown",Be,{passive:!1}],["lostpointercapture",m=>{m.target!==g||ne.current.pointerId!==m.pointerId||ke(m.pointerId)},void 0]],we=[["pointermove",ce,{passive:!1}],["pointerup",De,void 0],["pointercancel",Ce,void 0]];return wt(g,Ue,"add"),wt(window,we,"add"),()=>{wt(g,Ue,"remove"),wt(window,we,"remove");const m=ne.current;m.pointerId!==null&&g.hasPointerCapture(m.pointerId)&&g.releasePointerCapture(m.pointerId),Se(),H()}},[y]);const qe=r.useCallback(g=>(Z(),re(g)),[re,Z]);return Y.jsxs("div",{ref:ae,"data-testid":S,className:It.twMerge("aqvs-scroll-pane",I),style:E,children:[Y.jsxs("div",{ref:K,className:It.twMerge("aqvs-scroll-pane-content"),"data-testid":"aqvs-scroll-pane-content",style:{height:t,paddingTop:Ye.top,paddingBottom:Ye.bottom,...u&&te&&d.some(g=>g==="touch"||g==="pen")?{touchAction:"none"}:{}},...j,id:lt,children:[h,n(P.current)]}),Y.jsx(Gt,{contentSize:e,viewportSize:t,scrollPosition:P.current,onScroll:qe,enableThumbDrag:i,enableTrackClick:a,enableArrowButtons:c,scrollBarWidth:s,ariaControls:lt,tapScrollCircleOptions:N,itemCount:U,renderThumbOverlay:ie,visibleStartIndex:ye,visibleEndIndex:V},"scrollbar"),L?.()]})}),Ht=(n,e,t)=>Math.min(Math.max(n,e),t),br=({dragState:n,normalizedDistance:e,sizeScale:t,size:s})=>{const i=Math.max(s/2,1),a=1+e*.65,c=Math.max(.65,1-e*.25),u=n.direction*e*26*t,d=.8+e*.18,x=3*t,I=6*t,S=22*t,E=Math.abs(u)+I,h=u>0?x:-Math.abs(u)-x,N=Math.max(2.5,3*t),F=Ht(n.offsetX,-i,i),U=Ht(n.offsetY,-i,i),ie=i*.35,Q=F/i*ie,ee=U/i*ie,ge=Q*.45,ye=ee*.45,V=Math.max(S*.38,6),L=.65+e*.2,M=n.active;return Y.jsxs(Y.Fragment,{children:[Y.jsx("div",{className:"aqvs-tap-scroll-circle-gradient",style:{transform:`scale(${c}, ${a})`,transition:M?"40ms transform ease-out":"200ms ease transform"}}),Y.jsx("div",{className:"aqvs-sample-visual-pupil",style:{width:S,height:S,transform:`translate(calc(-50% + ${Q}px), calc(-50% + ${ee}px)) scale(${c}, ${d*a})`,transition:M?"70ms transform ease-out":"200ms ease transform"}}),Y.jsx("div",{className:"aqvs-sample-visual-highlight",style:{width:V,height:V,transform:`translate(calc(-50% + ${ge}px), calc(-50% + ${ye}px)) scale(${c}, ${a})`,opacity:L,boxShadow:"0 0 8px rgba(255,255,255,0.45)",transition:M?"120ms opacity 150ms, 120ms transform ease-out ease-out":"220ms ease transform, 240ms opacity ease"}}),Y.jsx("div",{className:"aqvs-sample-visual-rod",style:{width:N,height:E,transform:`translate(-50%, ${h}px)`,opacity:e,transition:M?"40ms height, 60ms opacity ease-out ease-out":"200ms ease height, 120ms ease opacity"}})]})},Et=100,xr=n=>{if(!Number.isFinite(n))return 0n;const e=Math.trunc(n);return e<=0?0n:BigInt(e)},_t=(n,e)=>{if(!Number.isFinite(n))throw new Error(`valueFn returned a non-finite value at index ${e}: ${n}`);return n},xt=n=>{if(n<=0||!Number.isFinite(n))return 0;const e=Math.trunc(n);if(e<=2147483647)return e&-e;const t=BigInt(e)&-BigInt(e);return Number(t)};class ot{tree;deltas;size;baseValue;valueFn;total;constructor(e,t,s){this.reset(e,t,s)}reset(e,t,s){const i=Number.isFinite(e)&&e>0?Math.trunc(e):0;if(typeof t!="function"){this.size=i,this.tree=new Map,this.deltas=new Map,this.valueFn=void 0,this.baseValue=t,this.total=this.baseValue*this.size;return}let a=0,c;if(i>0){const u=s?.sampleRange??{from:0,to:Math.min(Et-1,i-1)};let d=Math.max(0,Math.trunc(u.from)),x=Math.min(Math.trunc(u.to),i-1);if(d>x&&(d=0,x=Math.min(Et-1,i-1)),i>Et)a=ot._sampleBaseValueStrided(t,i,Et),s?.materialize&&(c={from:d,values:ot._collectValidatedValues(t,d,x)});else{const I=ot._collectValidatedValues(t,d,x);a=ot._modeOrMedian([...I]),s?.materialize&&(c={from:d,values:I})}}if(this.size=i,this.tree=new Map,this.deltas=new Map,this.total=void 0,this.valueFn=t,this.baseValue=a,c)for(let u=0;u<c.values.length;u++){const d=c.from+u;if(d>=this.size)break;const x=c.values[u]-this.baseValue;x!==0&&(this.deltas.set(d,x),this._updateTree(d,x))}this.total=this.getTotal()}setValueFn(e,t){if(t?.reset){this.reset(this.size,e);return}typeof e=="function"?this.valueFn=e:(this.valueFn=void 0,this.baseValue=e,this.total=this._computeTreeTotal())}static _collectValidatedValues(e,t,s){const i=[];for(let a=t;a<=s;a++)i.push(_t(e(a),a));return i}static _modeOrMedian(e){if(e.length===0)return 0;e.sort((c,u)=>c-u);const t=Math.floor(e.length/2);let s;e.length%2===0?s=Math.floor((e[t-1]+e[t])/2):s=e[t];const i=new Map;let a=0;for(const c of e){const u=(i.get(c)??0)+1;i.set(c,u),u>a&&(a=u)}if(a>e.length*.2){const c=[];for(const[d,x]of i.entries())x===a&&c.push(d);const u=c.reduce((d,x)=>d+x,0);s=Math.floor(u/c.length)}return s}static _sampleBaseValueStrided(e,t,s){if(t<=0)return 0;let i=Math.max(1,Math.ceil(t/s));i%2===0&&(i+=1);const a=[];for(let c=0;c<t&&a.length<s;c+=i)a.push(_t(e(c),c));return ot._modeOrMedian(a)}update(e,t){return this.updates([{index:e,value:t}])}updates(e){const t=this._buildDeltaUpdates(e);return t.length>0?this.updateDeltas(t):this.total}updateDelta(e,t){return this.updateDeltas([{index:e,change:t}])}updateDeltas(e){const t=new Map;for(const{index:s,change:i}of e){if(s<0||s>=this.size)throw new Error(`Index ${s} out of bounds`);if(!Number.isInteger(s))throw new Error(`Index must be an integer: ${s}`);if(!Number.isFinite(i))throw new Error(`Change must be a finite number: ${i}`);const c=(t.get(s)??this.deltas.get(s)??0)+i;if(c+this.baseValue<-1e-9)throw new Error(`Change would make the value at index ${s} negative: ${c+this.baseValue}`);t.set(s,c)}for(const{index:s,change:i}of e){const c=(this.deltas.get(s)??0)+i;c===0?this.deltas.delete(s):this.deltas.set(s,c),this._updateTree(s,i)}return this.total}_updateTree(e,t){if(t===0)return;let s=e+1;for(;s<=this.size;){this.tree.set(s,(this.tree.get(s)??0)+t);const i=xt(s);if(i===0)break;s+=i}this.total!==void 0&&(this.total+=t)}_buildDeltaUpdates(e){const t=[],s=new Map;for(const{index:i,value:a}of e){if(i<0||i>=this.size)throw new Error(`Index ${i} out of bounds`);if(!Number.isInteger(i))throw new Error(`Index must be an integer: ${i}`);if(!Number.isFinite(a))throw new Error(`Value must be a finite number: ${a}`);if(a<0)throw new Error("Value cannot be negative.");const c=s.has(i)?s.get(i)??0:this.deltas.get(i)??0,u=c+this.baseValue,d=a-u;d!==0&&t.push({index:i,change:d}),s.set(i,c+d)}return t}_computeTreeTotal(){if(this.size<=0)return 0;let e=0,t=this.size;for(;t>0;){e+=this.tree.get(t)??0;const s=xt(t);if(s===0)break;t-=s}return e+this.baseValue*this.size}_materialize(e,t=!0){if(this.valueFn){const s=this.deltas.get(e)??0,a=_t(this.valueFn(e),e)-this.baseValue;if(a!==s&&(a===0?this.deltas.delete(e):this.deltas.set(e,a),t)){const c=a-s;this._updateTree(e,c)}}}_materializeRanges(e,t,s=!1){if(!(e?.materialize&&this.valueFn))return;const i=e.ranges;if(i&&i.length>0){for(const u of i){const d=Math.max(0,Math.trunc(u.from)),x=Math.min(Math.trunc(u.to),this.size-1);for(let I=d;I<=x;I++)this._materialize(I)}if(t===void 0)return;if(s){this._materialize(t);return}const a=i[0].from,c=i[i.length-1].to;t>=a&&t<=c&&this._materialize(t);return}t!==void 0&&this._materialize(t)}_findIndex(e,t={},s){if(this.size>=1073741824)return this._findIndexLarge(e,t,s);if(this.size===0)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};this._materializeRanges(t.materializeOption);const i=t.materializeOption?.materialize===!0;let a;for(;;){if(a=this._descend(e,s),a<0||a>=this.size)return{index:-1,total:this.total??this.getTotal(),cumulative:void 0,currentValue:void 0,safeIndex:void 0};if(!i)break;const u=this.deltas.get(a)??0;if(this._materialize(a),(this.deltas.get(a)??0)===u)break}const c=this.prefixSum(a);return{index:a,total:this.total??c.total,cumulative:c.cumulative,currentValue:c.currentValue,safeIndex:c.safeIndex}}_descend(e,t){let s=0,i=0,a=1;for(;a<<1<=this.size;)a<<=1;for(;a>0;a>>=1){const c=s+a;if(c<=this.size){const d=(this.tree.get(c)??0)+this.baseValue*a;(t?i+d<e:i+d<=e)&&(s=c,i+=d)}}return t?s:s-1}_findIndexLarge(e,t,s){if(this.size===0)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};const i=xr(this.size);if(i===0n)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};this._materializeRanges(t.materializeOption);const a=t.materializeOption?.materialize===!0;for(;;){let c=0n,u=i-1n,d,x,I=this.total;for(;c<=u;){const h=c+u>>1n,N=Number(h),F=this.prefixSum(N);if(I=F.total,s?F.cumulative>=e:F.cumulative<=e)if(d=h,x=F,s){if(h===0n)break;u=h-1n}else c=h+1n;else if(s)c=h+1n;else{if(h===0n)break;u=h-1n}}const S=x,E=d!==void 0?Number(d):-1;if(a&&E>=0){const h=this.deltas.get(E)??0;if(this._materialize(E),(this.deltas.get(E)??0)!==h)continue}return{index:E,total:I,cumulative:S?.cumulative,currentValue:S?.currentValue,safeIndex:S?.safeIndex}}}prefixSum(e,t){if(e<0||Number.isNaN(e))return{cumulative:0,total:this.total,currentValue:0,safeIndex:0};if(this.size===0)return{cumulative:0,total:this.total??0,currentValue:0,safeIndex:0};const s=J(Math.trunc(e),0,this.size-1),i=t?.materializeOption;this._materializeRanges(i,s,!0);let a=0,c=s+1;for(;c>0;){const d=this.tree.get(c)??0;a+=d;const x=xt(c);if(x===0)break;c-=x}const u=i?.materialize?this.get(s):(this.deltas.get(s)||0)+this.baseValue;return{cumulative:a+this.baseValue*(s+1),total:this.total,currentValue:u,safeIndex:s}}get(e,t){if(this.size===0)return 0;if(!Number.isInteger(e)||e<0||e>=this.size)throw new Error("Index out of bounds");const s=t?.materializeOption;return this._materializeRanges(s,e),(this.deltas.get(e)??0)+this.baseValue}getTotal(e){const t=e?.materializeOption;if(this._materializeRanges(t),this.total===void 0)if(this.size===0)this.total=0;else{this.total=this._computeTreeTotal();const s=this.prefixSum(this.getSize()-1);s.cumulative!==s.total&&w.error("Inconsistent Fenwick Tree state")}return this.total}rebuildTree(e){if(e?.materialize&&this.valueFn){const s=this.valueFn;this.reset(this.size,i=>s(i),{materialize:!0});return}const t=new Map;for(const[s,i]of this.deltas.entries()){if(i===0)continue;let a=s+1;for(;a<=this.size;){t.set(a,(t.get(a)??0)+i);const c=xt(a);if(c===0)break;a+=c}}this.tree=t,this.total=this._computeTreeTotal()}calculateAccumulatedError(){if(this.total===void 0)return 0;let e=this.baseValue*this.size;for(const[t,s]of this.deltas)t<this.size&&(e+=s);return this.total-e}changeSize(e){if(!Number.isFinite(e))throw new Error(`Size must be a finite number: ${e}`);const t=Math.max(0,Math.trunc(e)),s=this.size;if(t===s)return;if(t>s)if(s===0&&this.deltas.size>0){for(const a of this.deltas.keys())a>=t&&this.deltas.delete(a);this.size=t,this.rebuildTree()}else this._growSize(s,t);else{if(t>0)for(const a of this.deltas.keys())a>=t&&this.deltas.delete(a);this.size=t,this.rebuildTree()}const i=this.prefixSum(this.getSize()-1);i.cumulative!==i.total&&w.error("Inconsistent Fenwick Tree state")}static _minCoveredLowBound(e,t){let s=1;for(;;){const i=s*2;if(Math.floor(t/i)*i<=e)break;s=i}return s*Math.floor(e/s)}_propagateDeltaToGrownNodes(e,t,s,i){let a=e+1;for(;a<=s;){const c=xt(a);if(c===0)break;a+=c}for(;a<=i;){this.tree.set(a,(this.tree.get(a)??0)+t);const c=xt(a);if(c===0)break;a+=c}}_growSize(e,t){if(this.size=t,this.deltas.size>0){const s=ot._minCoveredLowBound(e,t);if(e-s<this.deltas.size)for(let a=s;a<e;a++){const c=this.deltas.get(a);c===void 0||c===0||this._propagateDeltaToGrownNodes(a,c,e,t)}else for(const[a,c]of this.deltas.entries())c===0||a<s||this._propagateDeltaToGrownNodes(a,c,e,t)}this.total=this._computeTreeTotal()}getSize(){return this.size}get base(){return this.baseValue}findIndexAtOrAfter(e,t){return this._findIndex(e,t??{},!0)}findIndexAtOrBefore(e,t){return this._findIndex(e,t??{},!1)}}const Ir=(n,e)=>{const t=n?.sampleRange,s=e?.sampleRange;return t===s?!1:t&&s?t.from!==s.from||t.to!==s.to:!0},Jt=(n,e,t)=>{const s=Number.isFinite(n)&&n>0?Math.trunc(n):0,i=r.useRef(null),a=r.useRef({size:s,valueOrFn:e,options:t});i.current===null&&(i.current=new ot(s,e,t));const c=i.current,u=a.current,d=u.size!==s,x=u.valueOrFn!==e,I=Ir(u.options,t),S=u.size===0&&s>0&&(!i.current||i.current.base===0);if(x||I){const E=t?.resetOnValueFnChange??!0;I||x&&E||S?(t?.debug&&w.debug("[useFenwickMapTree] reset",{valueOrFnChanged:x,optionsChanged:I}),c.reset(s,e,t)):(d&&(t?.debug&&w.debug("[useFenwickMapTree] resize (with valueFn change)",{from:u.size,to:s}),c.changeSize(s)),t?.debug&&w.debug("[useFenwickMapTree] setValueFn (no reset)",{valueOrFnChanged:x}),c.setValueFn(e,{reset:!1})),a.current={size:s,valueOrFn:e,options:t}}else d&&(t?.debug&&w.debug("[useFenwickMapTree] resize",{from:u.size,to:s}),S?c.reset(s,e,t):c.changeSize(s),a.current={size:s,valueOrFn:e,options:t});return c};class Tr{key;value;prev=null;next=null;constructor(e,t){this.key=e,this.value=t}}class Ot{head=null;tail=null;addToTail(e){this.tail?(this.tail.next=e,e.prev=this.tail,this.tail=e):this.head=this.tail=e}remove(e){e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=null,e.next=null}removeHead(){const e=this.head;return e&&this.remove(e),e}moveToTail(e){this.remove(e),this.addToTail(e)}}function Qt(n){const e=r.useRef(new Map),t=r.useRef(new Ot),s=Math.floor(n),i=r.useRef(s);r.useEffect(()=>{if(i.current=s,Number.isNaN(s)||s<0){w.warn(`useLruCache: invalid capacity ${n}; the cache will not store any entries.`),e.current.clear(),t.current=new Ot;return}if(Number.isFinite(s))for(;e.current.size>s;){const I=t.current.removeHead();if(I)e.current.delete(I.key);else break}},[n,s]);const a=r.useCallback(I=>{const S=e.current.get(I);if(S)return t.current.moveToTail(S),S.value},[]),c=r.useCallback((I,S)=>{const E=i.current;if(Number.isNaN(E)||E<=0)return;let h=e.current.get(I);if(h)h.value=S,t.current.moveToTail(h);else{if(e.current.size>=E){const N=t.current.removeHead();N&&e.current.delete(N.key)}h=new Tr(I,S),e.current.set(I,h),t.current.addToTail(h)}},[]),u=r.useCallback(I=>e.current.has(I),[]),d=r.useCallback(I=>{const S=e.current.get(I);S&&(t.current.remove(S),e.current.delete(I))},[]),x=r.useCallback(()=>{e.current.clear(),t.current=new Ot},[]);return r.useMemo(()=>({get:a,set:c,has:u,remove:d,clear:x}),[a,c,u,d,x])}const Sr=1e4,Mr=()=>{const{get:n,set:e,has:t,clear:s}=Qt(Sr);return r.useMemo(()=>({get:n,set:e,has:t,clear:s}),[n,e,t,s])},Ie=(n,e)=>e<=0?0:J(n,0,e-1),Xt=n=>({top:Math.max(0,n?.top??0),bottom:Math.max(0,n?.bottom??0)}),je=(n,e)=>n<=e?0:n-e,ht=(n,e)=>n<=0?0:n+e,Nt=1e3,jt=2e3,Rr=1048576,Rt=n=>{if(!Number.isFinite(n))return 0n;const e=Math.trunc(n);return e<=0?0n:BigInt(e)},vr=(n,e,t,s,i,a,c,u)=>{const d=Rt(s);if(d===0n)return{renderingStartIndex:0,renderingEndIndex:0,visibleStartIndex:0,visibleEndIndex:0};const x=V=>V<0n?0n:V>=d?d-1n:V,I={materializeOption:{materialize:!1}},{index:S,cumulative:E}=a.findIndexAtOrAfter(n,I);let h;S===-1?h=d-1n:(E===n?h=Rt(S+1):h=Rt(S),h>=d&&(h=d-1n)),n<=0&&(h=0n),u&&n>=c&&(h=d-1n);const N=V=>{const L=Number(V);if(!Number.isSafeInteger(L))return null;const{cumulative:M}=a.prefixSum(L,{materializeOption:{materialize:!1}});if(!Number.isFinite(M))return null;const{index:j}=a.findIndexAtOrAfter(M+.5,{materializeOption:{materialize:!1}});if(j===-1)return null;const G=Rt(j);return G>V?G:null},F=V=>{let L=0,M=V,j=V,G=0n,P=0;for(;M<d&&L<e;){const ae=Number(M),K=i(ae);if(L+=K,j=M,M+=1n,G+=1n,!Number.isFinite(K)||K<0)break;if(K===0){if(P+=1,P>Nt){const T=N(j);if(T!==null&&T>M)M=T,P=0;else if(T!==null&&T===M&&i(Number(M))>0)P=0;else break}}else P=0}return G===0n&&(j=V),{height:L,end:j}};let{height:U,end:ie}=F(h);if(U<e&&h>0n){let V=h,L=U,M=0;for(;V>0n&&L<e;){V-=1n;const G=Number(V),P=i(G);if(L+=P,!Number.isFinite(P)||P<0)break;if(P===0){if(M+=1,M>Nt){const ae=Number(V);if(!Number.isSafeInteger(ae))break;const{cumulative:K}=a.prefixSum(ae,{materializeOption:{materialize:!1}});if(!Number.isFinite(K))break;const{index:T}=a.findIndexAtOrAfter(K-.5,{materializeOption:{materialize:!1}}),B=T===-1?-1n:Rt(T);if(B>=0n&&B<V)V=B+1n,M=0;else if(B===V&&V>=1n&&i(Number(V-1n))>0)M=0;else break}}else M=0}h=x(V);const j=F(h);U=j.height,ie=j.end}const Q=x(h),ee=x(ie),ge=x(Q-BigInt(Math.max(0,t))),ye=x(ee+BigInt(Math.max(0,t)));return{renderingStartIndex:Ie(Number(ge),s),renderingEndIndex:Ie(Number(ye),s),visibleStartIndex:Ie(Number(Q),s),visibleEndIndex:Ie(Number(ee),s)}},Pr=(n,e,t,s,i,a,c)=>{if(s===0)return{renderingStartIndex:0,renderingEndIndex:0,visibleStartIndex:0,visibleEndIndex:0};const u=Number.isFinite(c),d=u?Math.min(Math.max(0,n),c):Math.max(0,n);if(s>=Number.MAX_SAFE_INTEGER)return vr(d,e,t,s,i,a,c,u);const{index:x,cumulative:I,currentValue:S}=a.findIndexAtOrAfter(d,{materializeOption:{materialize:!1}}),E=x===-1?e<=0||(I??0)<d+(S??0)?s-1:0:x;let h=Ie(E,s),N=0;if(x!==-1&&I===d)h=Ie(x+1,s),N=0;else if(h===x&&I!==void 0&&S!==void 0)N=I-S-d;else{const{cumulative:V,currentValue:L}=a.prefixSum(h,{materializeOption:{materialize:!1}});N=(V??0)-(L??0)-d}const F=N,U=(V,L)=>{let M=V,j=L,G=0;for(;M<s&&j<e;){const P=i(M);if(j+=P,M++,!Number.isFinite(P)||P<0)break;if(P===0){if(G++,G>Nt){const{cumulative:ae}=a.prefixSum(M-1,{materializeOption:{materialize:!1}}),{index:K}=Number.isFinite(ae)?a.findIndexAtOrAfter(ae+.5,{materializeOption:{materialize:!1}}):{index:-1};if(K>M)M=K,G=0;else if(K===M&&i(M)>0)G=0;else break}}else G=0}return{cursor:M,height:j}},ie=U(h,N);let Q=ie.cursor;if(N=ie.height,N<e&&h>0){let V=N+Math.abs(Math.min(0,F)),L=h-1,M=0;for(;L>=0&&V<e;){const G=i(L);if(V+=G,!Number.isFinite(G)||G<0){L--;break}if(G===0){if(M++,M>Nt){const{cumulative:P}=a.prefixSum(L,{materializeOption:{materialize:!1}}),{index:ae}=Number.isFinite(P)?a.findIndexAtOrAfter(P-.5,{materializeOption:{materialize:!1}}):{index:-1};if(ae!==-1&&ae<L){L=ae,M=0;continue}if(ae===L&&L>=1&&i(L-1)>0)M=0;else{L--;break}}}else M=0;L--}h=Ie(L+1,s);const j=U(h,0);Q=j.cursor,N=j.height}const ee=Ie(h-t,s),ge=Ie(Math.max(Q-1,h),s),ye=Ie(ge+t,s);return{renderingStartIndex:ee,renderingEndIndex:ye,visibleStartIndex:h,visibleEndIndex:ge}},$t=(n,e,t)=>{const s=Math.max(0,e??0),i=r.useRef({last:0,id:null,arg:null}).current;return r.useEffect(()=>()=>{if(i.id!==null&&(cancelAnimationFrame(i.id),i.id=null),i.arg!==null&&n.current){try{t(n.current,i.arg)}catch(a){console.error("[useThrottledInvoker] Error flushing pending callback on unmount",a)}i.arg=null}},[i,n,t]),r.useCallback(a=>{if(i.arg=a,i.id!==null)return;const c=u=>{if(i.id=null,i.arg===null)return;const d=u-i.last;if(s===0||i.last===0||d>=s){if(n.current)try{t(n.current,i.arg)}catch(x){console.error("[useThrottledInvoker] Error invoking callback",x)}i.arg=null,i.last=u}i.arg!==null&&(i.id=requestAnimationFrame(c))};i.id=requestAnimationFrame(c)},[s,t,n,i])},yr=r.memo(({index:n,top:e,height:t,item:s,children:i,clipItemHeight:a,enableKeyboardNavigation:c,onKeyDown:u,onFocus:d,registerItemRef:x})=>{const I=r.useCallback(N=>x(n,N),[n,x]),S=r.useCallback(N=>u(N,n),[n,u]),E=r.useCallback(()=>d(n),[n,d]),h=r.useCallback(N=>{N.currentTarget.focus({preventScroll:!0})},[]);return Y.jsx("div",{ref:I,"data-index":n,"data-virtualscroll-item":"true",className:"aqvs-item-container",style:{top:e,height:t,overflow:a?"hidden":void 0},tabIndex:c?-1:void 0,onPointerDown:c?h:void 0,onKeyDownCapture:c?S:void 0,onFocusCapture:c?E:void 0,children:i(s,n)})}),Cr=({itemCount:n,getItem:e,getItemKey:t,getItemHeight:s,viewportSize:i,overscanCount:a=15,className:c,testId:u,onScroll:d,onRangeChange:x,children:I,background:S,initialScrollIndex:E,initialScrollOffset:h,initialScrollAnchor:N,callbackThrottleMs:F=5,contentInsets:U,onItemFocus:ie,scrollBarOptions:Q,behaviorOptions:ee,onWheelHorizontal:ge,contentProps:ye},V)=>{const{width:L,enableThumbDrag:M,enableTrackClick:j,enableArrowButtons:G,enableScrollToTopBottomButtons:P,renderThumbOverlay:ae,tapScrollCircleOptions:K}=Q??{},{enablePointerDrag:T,pointerDragInputs:B,enableKeyboardNavigation:q=!0,wheelSpeedMultiplier:Ye,inertiaOptions:Ne,clipItemHeight:te=!1,resetOnGetItemHeightChange:re=!1}=ee??{},W=r.useRef(null),Z=r.useRef({renderingStartIndex:0,renderingEndIndex:0,visibleStartIndex:0,visibleEndIndex:0,scrollPosition:0,totalHeight:0}),Te=r.useRef(N&&n>0?{index:J(Math.trunc(N.index),0,n-1),align:"top",offset:-Math.max(0,N.offsetPx??0)}:null),Ve=r.useRef(!1),$e=r.useRef(!0);r.useEffect(()=>{if($e.current){$e.current=!1;return}re&&(Te.current=null)},[re,s]);const y=r.useMemo(()=>Xt(U),[U]),[lt]=r.useState(()=>{const f=N?.index??E,p=typeof f=="number"&&Number.isFinite(f)?Math.max(0,Math.trunc(f)):0;return{from:Math.max(0,p-50),to:p+50}}),ne=r.useMemo(()=>({sampleRange:lt,resetOnValueFnChange:re,materialize:!0}),[re,lt]),C=Jt(n,s,ne),[Ee]=r.useState(()=>{let l=0,f=0;if(N&&n>0){const p=J(Math.trunc(N.index),0,n-1),k=Math.max(0,N.offsetPx??0),A=J(p-a*2,0,n-1),O=J(p+a*2,0,n-1),X=p>0||k>0?{materializeOption:{materialize:!0,ranges:[{from:A,to:O}]}}:void 0,{cumulative:$,total:Pe,currentValue:de}=C.prefixSum(p,X),me=Math.max($-de+k,0);l=ht(me,y.top),f=Pe??C.getTotal()}else if(typeof E=="number"){const p=J(E,0,n-1),k=J(p-a*2,0,n-1),A=J(p+a*2,0,n-1),O=E>0?{materializeOption:{materialize:!0,ranges:[{from:k,to:A}]}}:void 0,{cumulative:X,total:$,currentValue:Pe}=C.prefixSum(E,O),de=Math.max(X-Pe,0);l=ht(de,y.top),f=$??C.getTotal()}else typeof h=="number"&&(l=ht(Math.max(h,0),y.top)),f=C.getTotal();return{position:l,total:f}}),[_e,We]=r.useState(Ee.position),[qe,g]=r.useState(Ee.total),_=r.useRef(Ee.position),pe=r.useRef(y.top),H=r.useRef(d??void 0),Se=r.useRef(x??void 0),oe=r.useRef(new Map),be=r.useRef(null),Me=r.useRef(null),[Re,le]=r.useState(null),[ke,ce]=r.useState(!1),se=r.useRef(null),De=r.useRef(!1),Be=r.useRef(0),Ce=r.useRef(!1),Qe=r.useRef(!1),Ue=r.useRef(n);Ue.current!==n&&(Ue.current=n,Qe.current=!0),r.useEffect(()=>{H.current=d??void 0,Se.current=x??void 0},[x,d]);const we=r.useCallback(l=>{if(q&&l&&typeof l.focus=="function")try{l.focus({preventScroll:!0})}catch{l.focus()}},[q]),m=r.useCallback((l,{position:f,totalHeight:p})=>{l(f,p)},[]),R=$t(H,F,m),ue=r.useCallback((l,f)=>{l(f)},[]),xe=$t(Se,F,ue),ve=r.useRef(y.top);ve.current=y.top;const et=r.useRef(R);et.current=R,r.useEffect(()=>(Ve.current=!1,()=>{Ve.current=!0,se.current&&(clearTimeout(se.current),se.current=null)}),[]),r.useEffect(()=>{q||(oe.current.clear(),be.current=null,Me.current=null)},[q]);const Ge=r.useCallback((l,f)=>{if(!f){oe.current.delete(l);return}q&&(oe.current.set(l,f),be.current===l&&(be.current=null,Me.current=l,we(f)))},[q,we]),Ze=.01,Xe=r.useRef({rafId:null,loopActive:!1,idleFrames:0,lastRenderedPosition:Ee.position}),tt=r.useCallback(()=>{const l=Xe.current;l.rafId!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(l.rafId),l.rafId=null,l.loopActive=!1,l.idleFrames=0},[]);r.useEffect(()=>()=>{tt()},[tt]);const ct=r.useRef(()=>{}),Ke=r.useCallback(()=>{const l=Xe.current;l.rafId=null;const f=_.current,p=je(f,ve.current),k=C.getTotal();if(We(O=>Math.abs(O-f)<Ze?O:f),Math.abs(l.lastRenderedPosition-f)>=Ze?(et.current({position:p,totalHeight:k}),l.lastRenderedPosition=f,l.idleFrames=0):l.idleFrames+=1,l.idleFrames>=2){tt();return}if(typeof requestAnimationFrame=="function"){l.rafId=requestAnimationFrame(O=>ct.current(O));return}l.loopActive=!1},[C,tt]);ct.current=Ke;const Tt=r.useCallback(()=>{const l=Xe.current;if(l.idleFrames=0,!l.loopActive){if(l.loopActive=!0,typeof requestAnimationFrame=="function"){l.rafId=requestAnimationFrame(Ke);return}l.loopActive=!1}},[Ke]),fe=r.useCallback((l,f)=>{const p=f?.immediate??!1,k=je(l,y.top);if(_.current=l,p){Xe.current.lastRenderedPosition=l,Xe.current.idleFrames=0,We(l),R({position:k,totalHeight:C.getTotal()});return}Tt()},[Tt,C,y.top,R]),ut=r.useCallback(l=>{const f=W.current;if(!f)return l;const p=f.getScrollPosition();Be.current+=1;const k=f.scrollTo(l);return k===p&&(Be.current=Math.max(0,Be.current-1)),Math.abs(k-l)>.5&&(Ce.current=!0),k},[]),vt=r.useRef(!1);r.useEffect(()=>{if(!vt.current)if(vt.current=!0,N==null&&typeof E!="number"&&typeof h=="number"){const l=ht(Math.max(h,0),y.top),f=Math.abs(l-_.current)>.5;fe(l,{immediate:!0}),f&&W.current?.scrollTo(l)}else fe(_.current,{immediate:!0})},[N,E,h,y.top,fe]),r.useEffect(()=>{const l=C.getTotal();if(qe!==l){g(l);return}if(Ce.current){Ce.current=!1;const f=W.current;if(f&&Math.abs(f.getScrollPosition()-_.current)>.5){const p=ut(_.current);Ce.current=!1,fe(p,{immediate:!0})}}},[C,qe,n,ut,fe]),r.useEffect(()=>{if(Te.current!==null){const{index:l,align:f,offset:p}=Te.current,k=Ie(l,n),{cumulative:A,currentValue:O}=C.prefixSum(k,{materializeOption:{materialize:!1}});if(A!==void 0&&O!==void 0){const X=Math.max(A-O,0);let $=X;f==="bottom"?$=A-i:f==="center"&&($=X+O/2-i/2),p&&($-=p),$=Math.max(0,$);const Pe=Math.max(0,qe+y.top+y.bottom-i),de=Math.min(ht($,y.top),Pe);Math.abs(de-_.current)>1&&(w.debug("[VirtualScroll] Drift correction",{from:_.current,to:de,targetIndex:k}),Be.current===0&&(Be.current+=1),W.current?.scrollTo(de),fe(de,{immediate:!0}))}}Qe.current=!1},[qe,C,n,y.top,fe,i,y.bottom]),r.useEffect(()=>{const l=pe.current;if(l===y.top||(pe.current=y.top,Te.current))return;const f=je(_.current,l),p=ht(f,y.top);_.current=p,W.current?.scrollTo(p),fe(p,{immediate:!0})},[y.top,fe]);const gt=r.useCallback((l,f)=>{if(n===0)return;const p=Ie(l,n),k=C.get(p),A=f-k,O=C.update(p,f);O!==void 0&&g(O),w.debug("[VirtualScroll] Updated item size manually",{index:p,size:f,total:O});let X=Te.current?Te.current.index:null;if(X===null){const $=_.current,Pe=Xt(U).top,de=je($,Pe),{index:me,cumulative:Fe}=C.findIndexAtOrAfter(de,{materializeOption:{materialize:!1}});X=Fe!==void 0&&Fe===de?me+1:me}if(X!==-1&&p<X&&A!==0){const $=_.current,Pe=$+A;ut(Pe),fe(Pe,{immediate:!0}),w.debug("[VirtualScroll] Adjusted scroll for layout shift (manual update)",{from:$,to:Pe,causedByIndex:p,delta:A,activeVisibleStartIndex:X})}},[C,n,ut,fe,U]),He=r.useCallback((l,f)=>{if(!W.current||n===0)return;const p=Ie(l,n),k=Ie(p-a*2,n),A=Ie(p+a*2,n),{cumulative:O,total:X,currentValue:$}=C.prefixSum(p,{materializeOption:{materialize:!0,ranges:[{from:k,to:A}]}});if(w.debug("[VirtualScroll] Scrolling to index:",p,"ItemBottom:",O,"Total height:",X,"ItemHeight:",$,"safeIndexFrom:",k,"safeIndexTo:",A),!X)return;const Pe=Math.max(O-$,0);let de=Pe;f?.align==="bottom"?de=O-i:f?.align==="center"&&(de=Pe+$/2-i/2),f?.offset&&(de-=f.offset),de=Math.max(0,de);const me=ht(de,y.top),Fe=W.current?.getContentSize()??X+y.top+y.bottom,Le=Math.max(0,Fe-i),ze=Math.min(me,Le);Te.current={index:p,align:f?.align,offset:f?.offset};const St=W.current?.getScrollPosition()??-1,Vt=Math.abs(St-ze)>.5;De.current=!1,Be.current=0,Vt&&(De.current=!0,Be.current+=1,W.current?.scrollTo(ze)),g(X),fe(ze,{immediate:!0}),w.debug("[VirtualScroll] Setting scroll position to:",ze,{original:me,max:Le})},[C,a,n,y.top,y.bottom,i,fe]),Pt=r.useRef(N&&n===0?N:null);r.useEffect(()=>{const l=Pt.current;!l||n===0||(Pt.current=null,He(J(Math.trunc(l.index),0,n-1),{align:"top",offset:-Math.max(0,l.offsetPx??0)}))},[n,He]);const yt=r.useCallback(l=>{if(!W.current||n===0)return;const f=C.getTotal(),p=J(Math.floor(l),0,f),{index:k,cumulative:A,currentValue:O}=C.findIndexAtOrAfter(p,{materializeOption:{materialize:!1}}),$=(A??0)-(O??0)-p;He(k,{offset:$})},[C,n,He]),mt=r.useCallback(()=>{if(n===0)return null;const l=je(_.current,y.top),{index:f,cumulative:p,currentValue:k}=C.findIndexAtOrAfter(l,{materializeOption:{materialize:!1}});if(f===-1)return{index:n-1,offsetPx:0};if(p===l)return{index:J(f+1,0,n-1),offsetPx:0};const A=(p??0)-(k??0);return{index:f,offsetPx:Math.max(0,l-A)}},[C,n,y.top]),Ct=r.useCallback(l=>{const f=je(_.current,y.top),p=typeof l=="function"?l(f):l;yt(p);const k=W.current?.getScrollPosition(),A=typeof k=="number"?k:_.current;return fe(A),je(A,ve.current)},[y.top,yt,fe]),kt=r.useCallback((l,f)=>{w.debug("[VirtualScroll] Scroll position changed:",l);const p=De.current;p&&(De.current=!1);const k=Be.current>0;if(k&&(Be.current=0),p||k||Qe.current||(Te.current=null),fe(l),P){if(p||k)return;const A=l-f;if(w.debug("[VirtualScroll] Scroll diff:",A,"New:",l,"Prev:",f),Math.abs(A)>1){const O=A>0?"down":"up";le(O),ce(!0),w.debug("[VirtualScroll] Showing scroll buttons. Direction:",O),se.current&&clearTimeout(se.current),se.current=setTimeout(()=>{ce(!1),w.debug("[VirtualScroll] Hiding scroll buttons")},2e3)}}},[fe,P]),rt=r.useMemo(()=>je(_e,y.top),[y.top,_e]),ft=r.useMemo(()=>{const l=C.getTotal(),f=Pr(rt,i,a,n,s,C,l);return w.debug("[VirtualScroll] Calculated rendering range:",()=>({...f,scrollPosition:rt,renderingContentSize:l,overscanCount:a,viewportSize:i})),f},[rt,i,a,n,s,C]),{renderingStartIndex:nt,renderingEndIndex:st,visibleStartIndex:it,visibleEndIndex:pt}=ft,o=r.useCallback((l,f)=>{if(!q||n===0)return;const p=Ie(l,n);if(!(f?.ensureVisible??!0)){const Le=oe.current.get(p);Le&&(be.current=null,Me.current=p,we(Le));return}const A=C.prefixSum(p,{materializeOption:{materialize:!1}}),O=A.currentValue,X=Math.max(A.cumulative-O,0),$=X+O,Pe=je(_.current,y.top),de=Pe+i;if(X<Pe||$>de){He(p);const Le=oe.current.get(p);Le?(be.current=null,Me.current=p,we(Le)):be.current=p;return}const Fe=oe.current.get(p);if(Fe){be.current=null,Me.current=p,we(Fe);return}be.current=p},[q,n,C,y.top,He,we,i]),b=r.useCallback((l,f)=>{if(!q||l.defaultPrevented||l.altKey||l.metaKey||l.ctrlKey)return;const p=l.target;if(p){const k=p.tagName;if(k==="INPUT"||k==="TEXTAREA"||k==="SELECT"||p.isContentEditable)return}if(l.key==="ArrowDown"){f<n-1&&(l.preventDefault(),o(f+1));return}if(l.key==="ArrowUp"){f>0&&(l.preventDefault(),o(f-1));return}if(l.key==="PageDown"){if(f<n-1){l.preventDefault();const{visibleStartIndex:k,visibleEndIndex:A}=Z.current,O=Math.max(A-k+1,1),X=Math.max(O,1),$=Ie(Math.min(f+X,n-1),n);o($)}return}if(l.key==="PageUp"&&f>0){l.preventDefault();const{visibleStartIndex:k,visibleEndIndex:A}=Z.current,O=Math.max(A-k+1,1),X=Math.max(O,1),$=Ie(f-X,n);o($)}},[q,n,o]),v=r.useCallback(l=>{if(!q)return;const f=Ie(l,n);be.current=null,Me.current=f,ie?.(f)},[q,n,ie]);r.useEffect(()=>{const l=W.current?.getScrollPosition()??0,f=_.current,p=je(f,y.top);w.debug("[VirtualScroll] Range change effect triggered",()=>({renderingStartIndex:nt,renderingEndIndex:st,visibleStartIndex:it,visibleEndIndex:pt,scrollPositionState:_e,paneScrollPosition:f,logicalScrollPosition:p,contentSize:qe,scrollPaneScrollPosition:l})),xe({renderingStartIndex:nt,renderingEndIndex:st,visibleStartIndex:it,visibleEndIndex:pt,scrollPosition:p,totalHeight:qe})},[qe,st,nt,y.top,xe,_e,pt,it]);const D=r.useCallback(()=>{if(!P)return null;const l=ke&&Re!==null,f=Re==="up";return Y.jsx("div",{className:"aqvs-scroll-to-edge-overlay","data-visible":l,children:f?Y.jsx("div",{className:"aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top",children:Y.jsx("button",{type:"button",className:"aqvs-scroll-to-edge-button",onClick:p=>{p.stopPropagation(),De.current=!0,He(0),ce(!1)},children:"Top"})}):Y.jsx("div",{className:"aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-bottom",children:Y.jsx("button",{type:"button",className:"aqvs-scroll-to-edge-button",onClick:p=>{p.stopPropagation(),De.current=!0,He(n-1),ce(!1)},children:"Bottom"})})})},[P,ke,Re,He,n]),z=r.useRef(0),{visibleItems:he,renderAnchor:Ae}=r.useMemo(()=>{if(n===0)return{visibleItems:Y.jsx("div",{className:"aqvs-no-items-container",children:Y.jsx("div",{className:"aqvs-no-items-text",children:"No items"})}),renderAnchor:0};const l=Ie(nt,n),f=Ie(st,n),{cumulative:p,currentValue:k}=C.prefixSum(l,{materializeOption:{materialize:!1}}),A=p-k;Number.isFinite(A)&&Math.abs(A-z.current)>Rr&&(z.current=A);const O=z.current,X=[],$=[];let Pe=0,de=A;for(let me=l;me<=f;me++){if($.length>=jt){w.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.",{cap:jt,safeRenderingStartIndex:l,safeRenderingEndIndex:f});break}const Fe=s(me),Le=C.get(me),ze=Fe-Le;ze!==0&&X.push({index:me,value:Fe});const St=de+Pe,Vt=t?t(me):me;$.push(Y.jsx(yr,{index:me,top:St-O,height:Fe,item:e(me),clipItemHeight:te,enableKeyboardNavigation:q,onKeyDown:b,onFocus:v,registerItemRef:Ge,children:I},Vt)),Pe+=ze,de+=Le}return X.length>0&&Promise.resolve().then(()=>{if(Ve.current)return;let me=0;for(const ze of X)if(ze.index<it){const St=C.get(ze.index);me+=ze.value-St}const Fe=C.updates(X);if(Ve.current||typeof Fe!="number")return;g(Fe),w.debug("[VirtualScroll] Updated heights for items",X,"New total height:",Fe);const Le=W.current?.getScrollPosition()??_.current;if(me!==0){const ze=Le+me;ut(ze),fe(ze,{immediate:!0}),w.debug("[VirtualScroll] Adjusted scroll for layout shift (auto update)",{from:Le,to:ze,shiftAmount:me})}else Le!==_.current&&fe(Le)}),{visibleItems:$,renderAnchor:O}},[I,te,qe,q,n,C,e,t,s,v,b,ut,Ge,st,nt,fe,it]),Oe=r.useCallback(l=>{const f=(F??0)>0,p=Math.abs(l-_e),k=f&&p>.5?_e:l,A=je(k,y.top);if(w.debug("[VirtualScroll] Rendering visible items",()=>({currentScrollPosition:l,effectiveScrollPosition:A,renderingStartIndex:nt,renderingEndIndex:st,itemCount:n,viewportSize:i,callbackThrottleMs:F,diff:p,rawEffectiveScrollPosition:k})),n===0)return he;const O=y.top+Ae-k,X=y.bottom>0?Y.jsx("div",{className:"aqvs-bottom-inset",style:{top:C.getTotal()-Ae,height:y.bottom}},"virtualscroll-bottom-inset"):null;return w.debug("[VirtualScroll] Rendering items",()=>({containerTop:O,logicalScrollPosition:rt,resolvedInsets:y,effectiveScrollPosition:A})),Y.jsxs("div",{className:"aqvs-items-wrapper",style:{top:0,transform:`translateY(${O}px)`,willChange:"transform"},children:[he,X]})},[F,n,C,rt,Ae,st,nt,y,_e,i,he]),bt=r.useMemo(()=>({renderingStartIndex:ft.renderingStartIndex,renderingEndIndex:ft.renderingEndIndex,visibleStartIndex:ft.visibleStartIndex,visibleEndIndex:ft.visibleEndIndex,scrollPosition:rt,totalHeight:C.getTotal()}),[ft,rt,C,qe]);r.useEffect(()=>{Z.current=bt},[bt]),r.useImperativeHandle(V,()=>({getScrollPosition:()=>{const l=W.current?.getScrollPosition();return typeof l=="number"?je(l,ve.current):-1},getContentSize:()=>W.current?.getContentSize()??-1,getViewportSize:()=>W.current?.getViewportSize()??-1,scrollTo:Ct,scrollToIndex:He,getFenwickTreeTotalHeight:()=>C.getTotal(),getFenwickSize:()=>C.getSize(),focusItemAtIndex:o,getRange:()=>Z.current,getScrollAnchor:mt,updateItemSize:gt}),[Ct,He,C,o,mt,gt]);const at=C.getTotal()+y.top+y.bottom;return Y.jsx(Zt,{ref:W,contentSize:at,viewportSize:i,className:c,testId:u,onScroll:kt,background:S,tapScrollCircleOptions:K,inertiaOptions:Ne,itemCount:n,scrollBarWidth:L,enableThumbDrag:M,enableTrackClick:j,enableArrowButtons:G,enablePointerDrag:T,pointerDragInputs:B,renderThumbOverlay:ae,wheelSpeedMultiplier:Ye,onWheelHorizontal:ge,contentInsets:y,contentProps:ye,visibleStartIndex:it,visibleEndIndex:pt,renderOverlay:D,initialScrollPosition:Ee.position,children:Oe})},wr=r.forwardRef(Cr);exports.FenwickMapTree=ot;exports.ScrollBar=Gt;exports.ScrollPane=Zt;exports.TAP_SCROLL_SPEED_DEFAULTS=zt;exports.VirtualScroll=wr;exports.computeAutoTapScrollMaxSpeedMultiplier=Wt;exports.computeTapScrollSpeed=Kt;exports.minmax=J;exports.tapScrollCircleSampleVisual=br;exports.useFenwickMapTree=Jt;exports.useHeightCache=Mr;exports.useLruCache=Qt;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { jsx as ot, jsxs as Se, Fragment as tr } from "react/jsx-runtime";
2
- import nr, { memo as ir, forwardRef as $e, useState as re, useRef as x, useCallback as S, useImperativeHandle as Ue, useMemo as Ft, useLayoutEffect as ye, useEffect as Y, useId as sr } from "react";
3
- import { twMerge as Te } from "tailwind-merge";
1
+ import { jsx as ot, jsxs as Te, Fragment as tr } from "react/jsx-runtime";
2
+ import nr, { memo as ir, forwardRef as $e, useState as re, useRef as x, useCallback as S, useImperativeHandle as Ue, useMemo as Ft, useLayoutEffect as Me, useEffect as Y, useId as sr } from "react";
3
+ import { twMerge as ye } from "tailwind-merge";
4
4
  class N {
5
5
  level;
6
6
  prefix;
@@ -155,7 +155,7 @@ const Ke = {
155
155
  pointerId: null
156
156
  }, ze = 6, or = 8, ar = ({ dragState: r, normalizedDistance: t }) => {
157
157
  const e = 1 + t * 0.18, n = 0.16 + t * 0.24, i = 0.38 + t * 0.28, s = r.active ? "80ms ease-out" : "220ms ease";
158
- return /* @__PURE__ */ Se(tr, { children: [
158
+ return /* @__PURE__ */ Te(tr, { children: [
159
159
  /* @__PURE__ */ ot(
160
160
  "div",
161
161
  {
@@ -297,7 +297,7 @@ const Ke = {
297
297
  {
298
298
  ref: p,
299
299
  "data-testid": "virtual-scroll-tap-circle",
300
- className: Te("aqvs-tap-scroll-circle", t),
300
+ className: ye("aqvs-tap-scroll-circle", t),
301
301
  style: j,
302
302
  tabIndex: -1,
303
303
  onPointerDown: tt,
@@ -461,7 +461,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
461
461
  onScroll: n,
462
462
  scrollPosition: e
463
463
  }), { mainSizeKey: zt, crossSizeKey: Jt, positionKey: $t, selectDelta: h, getPointerCoordinate: k, arrowLabels: gt, arrowIcons: X, directionClass: Pt, orientation: ct } = Dt, It = Math.max(Lt, 1), Mt = t / r, yt = Math.max(t - d * 2, 0), ut = Mt * yt, At = Math.min(Math.max(We, ut || 0), yt || We), dt = r - t, st = Math.max(yt - At, 0), _t = dt <= 0 || st <= 0 ? 0 : rt(e / dt * st, 0, st), Xt = _t + At / 2, Nt = r > t || W, ne = Nt && a;
464
- ye(() => {
464
+ Me(() => {
465
465
  Vt.current = {
466
466
  viewportSize: t,
467
467
  maxScrollPosition: dt,
@@ -475,9 +475,9 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
475
475
  onScroll: n,
476
476
  scrollPosition: e
477
477
  };
478
- }), ye(() => {
478
+ }), Me(() => {
479
479
  U.current = e;
480
- }, [e]), ye(() => {
480
+ }, [e]), Me(() => {
481
481
  Z.current = n;
482
482
  }, [n]), Y(() => {
483
483
  i || tt(!1);
@@ -500,8 +500,8 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
500
500
  }
501
501
  if (o === 0)
502
502
  return { nextPosition: y, actualDelta: 0, reachedBoundary: !1 };
503
- const B = Ct((ue) => rt(ue + o, 0, g.maxScrollPosition), y), bt = B - y, Ot = o < 0 && y + o <= 0, Yt = o > 0 && y + o >= g.maxScrollPosition, Pe = o < 0 && (B <= 0 || Ot && bt === 0) || o > 0 && (B >= g.maxScrollPosition || Yt && bt === 0);
504
- return { nextPosition: B, actualDelta: bt, reachedBoundary: Pe };
503
+ const B = Ct((ue) => rt(ue + o, 0, g.maxScrollPosition), y), bt = B - y, Ot = o < 0 && y + o <= 0, Yt = o > 0 && y + o >= g.maxScrollPosition, ve = o < 0 && (B <= 0 || Ot && bt === 0) || o > 0 && (B >= g.maxScrollPosition || Yt && bt === 0);
504
+ return { nextPosition: B, actualDelta: bt, reachedBoundary: ve };
505
505
  },
506
506
  [Ct]
507
507
  ), M = S(
@@ -606,8 +606,8 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
606
606
  return rt(B / y * L, 0, L);
607
607
  }, []), se = S(
608
608
  (o) => {
609
- const g = o.getBoundingClientRect(), y = c ? g.width : g.height, L = (Pe) => {
610
- const ue = Number.parseFloat(Pe);
609
+ const g = o.getBoundingClientRect(), y = c ? g.width : g.height, L = (ve) => {
610
+ const ue = Number.parseFloat(ve);
611
611
  return Number.isFinite(ue) ? ue : 0;
612
612
  }, B = window.getComputedStyle(o), bt = L(c ? B.width : B.height), Ot = bt > 0 ? bt + L(c ? B.paddingLeft : B.paddingTop) + L(c ? B.paddingRight : B.paddingBottom) + L(c ? B.borderLeftWidth : B.borderTopWidth) + L(c ? B.borderRightWidth : B.borderBottomWidth) : 0, Yt = Ot > 0 ? Ot : c ? o.offsetWidth : o.offsetHeight;
613
613
  return Yt <= 0 || y <= 0 ? 1 : y / Yt;
@@ -654,7 +654,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
654
654
  mt.current !== o && (mt.current = o, we.current = 0), M(we, o * g);
655
655
  },
656
656
  [M]
657
- ), { handleArrowPointerDown: Ce, handleArrowPointerUp: ve, handleArrowKeyDown: Ut } = Ir({
657
+ ), { handleArrowPointerDown: Ce, handleArrowPointerUp: Se, handleArrowKeyDown: Ut } = Ir({
658
658
  canUseArrowButtons: ne,
659
659
  enableArrowButtons: a,
660
660
  resetTapScroll: Tt,
@@ -751,9 +751,9 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
751
751
  },
752
752
  "aria-label": g,
753
753
  onPointerDown: Ce(o),
754
- onPointerUp: ve,
755
- onPointerLeave: ve,
756
- onPointerCancel: ve,
754
+ onPointerUp: Se,
755
+ onPointerLeave: Se,
756
+ onPointerCancel: Se,
757
757
  onKeyDown: Ut(o),
758
758
  "aria-disabled": !a,
759
759
  disabled: !ne,
@@ -775,14 +775,15 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
775
775
  visibleStartIndex: V,
776
776
  visibleEndIndex: z
777
777
  } : null;
778
- return /* @__PURE__ */ Se(
778
+ return /* @__PURE__ */ Te(
779
779
  "div",
780
780
  {
781
- className: Te("aqvs-scrollbar", Pt, !Nt && "pointer-events-none opacity-0", b),
781
+ className: ye("aqvs-scrollbar", Pt, b),
782
782
  style: {
783
783
  [zt]: t,
784
784
  [Jt]: d
785
785
  },
786
+ "data-visible": Nt ? "true" : "false",
786
787
  role: "scrollbar",
787
788
  tabIndex: -1,
788
789
  "aria-controls": I,
@@ -795,7 +796,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
795
796
  er,
796
797
  {
797
798
  ref: lt,
798
- className: Te("aqvs-scrollbar-tap-circle-wrapper", vt),
799
+ className: ye("aqvs-scrollbar-tap-circle-wrapper", vt),
799
800
  size: nt,
800
801
  maxVisualDistance: It,
801
802
  style: le,
@@ -806,7 +807,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
806
807
  "tap-circle"
807
808
  ),
808
809
  ce(-1, gt[0], X[0], "arrow-start"),
809
- /* @__PURE__ */ Se(
810
+ /* @__PURE__ */ Te(
810
811
  "div",
811
812
  {
812
813
  className: "aqvs-scrollbar-track",
@@ -824,12 +825,13 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
824
825
  /* @__PURE__ */ ot(
825
826
  "div",
826
827
  {
827
- className: Te("aqvs-scrollbar-thumb-wrapper", !(Nt || W) && "pointer-events-none opacity-0"),
828
+ className: "aqvs-scrollbar-thumb-wrapper",
828
829
  style: {
829
830
  [zt]: At,
830
831
  [$t]: _t,
831
832
  ...c ? { top: 0, bottom: 0 } : { left: 0, right: 0 }
832
833
  },
834
+ "data-visible": Nt || W ? "true" : "false",
833
835
  onPointerDown: Ve,
834
836
  role: "slider",
835
837
  "aria-orientation": c ? "horizontal" : "vertical",
@@ -842,7 +844,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
842
844
  "div",
843
845
  {
844
846
  ref: A,
845
- className: Te("aqvs-scrollbar-thumb", c ? "aqvs-scrollbar-thumb-horizontal" : "aqvs-scrollbar-thumb-vertical"),
847
+ className: ye("aqvs-scrollbar-thumb", c ? "aqvs-scrollbar-thumb-horizontal" : "aqvs-scrollbar-thumb-vertical"),
846
848
  "data-testid": "aqvs-scrollbar-thumb",
847
849
  "data-thumb-state": Gt,
848
850
  style: {
@@ -1010,16 +1012,16 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
1010
1012
  ), jt = x(Lt);
1011
1013
  Y(() => {
1012
1014
  jt.current = Lt;
1013
- }, [Lt]), ye(() => {
1015
+ }, [Lt]), Me(() => {
1014
1016
  Dt.current = { contentSize: t, viewportSize: e };
1015
- }, [t, e]), ye(() => {
1017
+ }, [t, e]), Me(() => {
1016
1018
  const h = j.current;
1017
1019
  if (!h) return;
1018
1020
  const k = () => {
1019
1021
  h.scrollTop !== 0 && (N.debug("[ScrollPane] Native scroll detected, resetting to 0", () => ({ scrollTop: h.scrollTop })), h.scrollTop = 0), h.scrollLeft !== 0 && (h.scrollLeft = 0);
1020
1022
  };
1021
1023
  return h.addEventListener("scroll", k), () => h.removeEventListener("scroll", k);
1022
- }, []), ye(() => {
1024
+ }, []), Me(() => {
1023
1025
  if (et) {
1024
1026
  N.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", () => ({ contentSize: t, viewportSize: e, scrollPosition: w.current }));
1025
1027
  const h = rt(t - e, 0, t);
@@ -1199,12 +1201,12 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
1199
1201
  (h) => (J(), nt(h)),
1200
1202
  [nt, J]
1201
1203
  );
1202
- return /* @__PURE__ */ Se("div", { ref: lt, "data-testid": v, className: Te("aqvs-scroll-pane", I), style: C, children: [
1203
- /* @__PURE__ */ Se(
1204
+ return /* @__PURE__ */ Te("div", { ref: lt, "data-testid": v, className: ye("aqvs-scroll-pane", I), style: C, children: [
1205
+ /* @__PURE__ */ Te(
1204
1206
  "div",
1205
1207
  {
1206
1208
  ref: j,
1207
- className: Te("aqvs-scroll-pane-content"),
1209
+ className: ye("aqvs-scroll-pane-content"),
1208
1210
  "data-testid": "aqvs-scroll-pane-content",
1209
1211
  style: {
1210
1212
  height: e,
@@ -1258,7 +1260,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
1258
1260
  }
1259
1261
  ), Ge = (r, t, e) => Math.min(Math.max(r, t), e), Br = ({ dragState: r, normalizedDistance: t, sizeScale: e, size: n }) => {
1260
1262
  const i = Math.max(n / 2, 1), s = 1 + t * 0.65, a = Math.max(0.65, 1 - t * 0.25), c = r.direction * t * 26 * e, d = 0.8 + t * 0.18, b = 3 * e, I = 6 * e, v = 22 * e, C = Math.abs(c) + I, p = c > 0 ? b : -Math.abs(c) - b, V = Math.max(2.5, 3 * e), z = Ge(r.offsetX, -i, i), W = Ge(r.offsetY, -i, i), at = i * 0.35, Q = z / i * at, tt = W / i * at, xt = Q * 0.45, Et = tt * 0.45, A = Math.max(v * 0.38, 6), O = 0.65 + t * 0.2, P = r.active;
1261
- return /* @__PURE__ */ Se(tr, { children: [
1263
+ return /* @__PURE__ */ Te(tr, { children: [
1262
1264
  /* @__PURE__ */ ot(
1263
1265
  "div",
1264
1266
  {
@@ -1318,7 +1320,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
1318
1320
  if (!Number.isFinite(r))
1319
1321
  throw new Error(`valueFn returned a non-finite value at index ${t}: ${r}`);
1320
1322
  return r;
1321
- }, Me = (r) => {
1323
+ }, Pe = (r) => {
1322
1324
  if (r <= 0 || !Number.isFinite(r))
1323
1325
  return 0;
1324
1326
  const t = Math.trunc(r);
@@ -1565,7 +1567,7 @@ class ge {
1565
1567
  let n = t + 1;
1566
1568
  for (; n <= this.size; ) {
1567
1569
  this.tree.set(n, (this.tree.get(n) ?? 0) + e);
1568
- const i = Me(n);
1570
+ const i = Pe(n);
1569
1571
  if (i === 0)
1570
1572
  break;
1571
1573
  n += i;
@@ -1609,7 +1611,7 @@ class ge {
1609
1611
  let t = 0, e = this.size;
1610
1612
  for (; e > 0; ) {
1611
1613
  t += this.tree.get(e) ?? 0;
1612
- const n = Me(e);
1614
+ const n = Pe(e);
1613
1615
  if (n === 0)
1614
1616
  break;
1615
1617
  e -= n;
@@ -1788,7 +1790,7 @@ class ge {
1788
1790
  for (; a > 0; ) {
1789
1791
  const d = this.tree.get(a) ?? 0;
1790
1792
  s += d;
1791
- const b = Me(a);
1793
+ const b = Pe(a);
1792
1794
  if (b === 0)
1793
1795
  break;
1794
1796
  a -= b;
@@ -1851,7 +1853,7 @@ class ge {
1851
1853
  let s = n + 1;
1852
1854
  for (; s <= this.size; ) {
1853
1855
  e.set(s, (e.get(s) ?? 0) + i);
1854
- const a = Me(s);
1856
+ const a = Pe(s);
1855
1857
  if (a === 0)
1856
1858
  break;
1857
1859
  s += a;
@@ -1968,14 +1970,14 @@ class ge {
1968
1970
  _propagateDeltaToGrownNodes(t, e, n, i) {
1969
1971
  let s = t + 1;
1970
1972
  for (; s <= n; ) {
1971
- const a = Me(s);
1973
+ const a = Pe(s);
1972
1974
  if (a === 0)
1973
1975
  break;
1974
1976
  s += a;
1975
1977
  }
1976
1978
  for (; s <= i; ) {
1977
1979
  this.tree.set(s, (this.tree.get(s) ?? 0) + e);
1978
- const a = Me(s);
1980
+ const a = Pe(s);
1979
1981
  if (a === 0)
1980
1982
  break;
1981
1983
  s += a;
@@ -2591,7 +2593,7 @@ const Dr = 1e4, qr = () => {
2591
2593
  const u = Wt(k.current, l), m = Ie(u, R.top);
2592
2594
  k.current = m, G.current?.scrollTo(m), mt(m, { immediate: !0 });
2593
2595
  }, [R.top, mt]);
2594
- const ve = S(
2596
+ const Se = S(
2595
2597
  (l, u) => {
2596
2598
  if (r === 0)
2597
2599
  return;
@@ -2901,13 +2903,13 @@ const Dr = 1e4, qr = () => {
2901
2903
  logicalScrollPosition: oe,
2902
2904
  resolvedInsets: R,
2903
2905
  effectiveScrollPosition: _
2904
- })), /* @__PURE__ */ Se("div", { className: "aqvs-items-wrapper", style: { top: 0, transform: `translateY(${F}px)`, willChange: "transform" }, children: [
2906
+ })), /* @__PURE__ */ Te("div", { className: "aqvs-items-wrapper", style: { top: 0, transform: `translateY(${F}px)`, willChange: "transform" }, children: [
2905
2907
  bt,
2906
2908
  $
2907
2909
  ] });
2908
2910
  },
2909
2911
  [z, r, E, oe, Ot, le, ae, R, zt, i, bt]
2910
- ), Pe = Ft(
2912
+ ), ve = Ft(
2911
2913
  () => ({
2912
2914
  renderingStartIndex: pe.renderingStartIndex,
2913
2915
  renderingEndIndex: pe.renderingEndIndex,
@@ -2922,8 +2924,8 @@ const Dr = 1e4, qr = () => {
2922
2924
  [pe, oe, E, $t]
2923
2925
  );
2924
2926
  Y(() => {
2925
- J.current = Pe;
2926
- }, [Pe]), Ue(
2927
+ J.current = ve;
2928
+ }, [ve]), Ue(
2927
2929
  A,
2928
2930
  () => ({
2929
2931
  getScrollPosition: () => {
@@ -2939,9 +2941,9 @@ const Dr = 1e4, qr = () => {
2939
2941
  focusItemAtIndex: o,
2940
2942
  getRange: () => J.current,
2941
2943
  getScrollAnchor: be,
2942
- updateItemSize: ve
2944
+ updateItemSize: Se
2943
2945
  }),
2944
- [Ae, Ut, E, o, be, ve]
2946
+ [Ae, Ut, E, o, be, Se]
2945
2947
  );
2946
2948
  const ue = E.getTotal() + R.top + R.bottom;
2947
2949
  return /* @__PURE__ */ ot(
@@ -1,2 +1,2 @@
1
1
  /*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
2
- @layer components{.aqvs-scroll-pane{display:flex;position:relative}.aqvs-scroll-pane-content{flex:1;height:100%;position:relative;overflow:hidden}.aqvs-tap-scroll-circle{touch-action:none;-webkit-user-select:none;user-select:none;justify-content:center;align-items:center;transition-property:transform;transition-duration:.1s;transition-timing-function:cubic-bezier(0,0,.2,1);display:flex;position:relative}.aqvs-tap-scroll-circle-visual-outer{border-radius:9999px;position:absolute;inset:0}.aqvs-tap-scroll-circle-gradient{background:linear-gradient(to bottom right,#1d4ed899,#60a5fa8c,#bfdbfe66);border-width:1px;border-color:#fff6;border-radius:9999px;position:absolute;inset:0;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f}.aqvs-tap-scroll-circle-inner{border-radius:9999px;position:absolute;inset:18%}.aqvs-sample-visual-pupil{background-color:#ffffffd9;border-width:1px;border-color:#ffffff80;border-radius:9999px;position:absolute;top:50%;left:50%}.aqvs-sample-visual-highlight{background-color:#fffc;border-radius:9999px;position:absolute;top:50%;left:50%}.aqvs-sample-visual-rod{background-color:#ffffff80;border-radius:9999px;position:absolute;top:50%;left:50%}.aqvs-scrollbar{z-index:50;cursor:default;-webkit-user-select:none;user-select:none;touch-action:none;background-color:#fff;position:relative}.aqvs-scrollbar-horizontal{flex-direction:row;align-items:stretch;display:flex}.aqvs-scrollbar-vertical{flex-direction:column;align-items:stretch;display:flex}.aqvs-scrollbar-tap-circle-wrapper{pointer-events:auto;transition-property:opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1);position:absolute}.aqvs-scrollbar-arrow-button{color:#313131;background-color:#e0e0e0;justify-content:center;align-items:center;font-size:.75rem;line-height:1rem;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1);display:flex}.aqvs-scrollbar-arrow-button:focus{outline-offset:2px;outline:2px solid #0000}.aqvs-scrollbar-arrow-button:focus-visible{outline-offset:1px;outline:2px solid #60a5fa}.aqvs-scrollbar-arrow-button:disabled{cursor:not-allowed;opacity:.5}.aqvs-scrollbar-arrow-button:enabled:hover{background-color:#d4d4d4}.aqvs-scrollbar-track{background-color:#f5f5f5;flex:1;position:relative}.aqvs-scrollbar-overlay{pointer-events:none;position:absolute;inset:0}.aqvs-scrollbar-thumb-wrapper{touch-action:none;position:absolute}.aqvs-scrollbar-thumb{transform-origin:50%;background-color:#7f7f7f;transition:transform 80ms ease-out;position:absolute}.aqvs-scrollbar-thumb[data-thumb-state=disabled]{transition:none;transform:none}.aqvs-scrollbar-thumb[data-thumb-state=hover]{background-color:#5f5f5f}.aqvs-scrollbar-thumb[data-thumb-state=dragging]{background-color:#4f4f4f;transition:transform 60ms ease-out}.aqvs-scrollbar-thumb-horizontal{inset:1.5px 0}.aqvs-scrollbar-thumb-horizontal[data-thumb-state=hover]{top:-.5px;bottom:-.5px;transform:scaleY(1.06)}.aqvs-scrollbar-thumb-horizontal[data-thumb-state=dragging]{top:-.5px;bottom:-.5px;transform:scaleY(1.12)}.aqvs-scrollbar-thumb-vertical{inset:0 1.5px}.aqvs-scrollbar-thumb-vertical[data-thumb-state=hover]{left:-.5px;right:-.5px;transform:scaleX(1.06)}.aqvs-scrollbar-thumb-vertical[data-thumb-state=dragging]{left:-.5px;right:-.5px;transform:scaleX(1.12)}.aqvs-scroll-to-edge-button{pointer-events:auto;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;color:#fff;text-transform:uppercase;letter-spacing:.05em;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background-color:#1f2937cc;border:none;border-radius:9999px;padding:.25rem 3rem;font-size:10px;font-weight:500;line-height:1.5;transition-property:transform,background-color;transition-duration:.15s;transform:none;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f}.aqvs-scroll-to-edge-button:focus{outline-offset:2px;outline:2px solid #0000}.aqvs-scroll-to-edge-button:focus-visible{outline-offset:1px;outline:2px solid #60a5fa}.aqvs-scroll-to-edge-button:hover{background-color:#374151}.aqvs-scroll-to-edge-button:active{transform:scale(.95)}.aqvs-scroll-to-edge-overlay{pointer-events:none;z-index:10;transition-property:opacity;transition-duration:.5s;position:absolute;inset:0}.aqvs-scroll-to-edge-overlay[data-visible=true]{opacity:1}.aqvs-scroll-to-edge-overlay[data-visible=false]{opacity:0}.aqvs-scroll-to-edge-button-container{justify-content:center;display:flex;position:absolute;left:0;right:0}.aqvs-scroll-to-edge-button-container-top{top:.5rem}.aqvs-scroll-to-edge-button-container-bottom{bottom:.5rem}.aqvs-no-items-container{width:100%;position:absolute;top:0}.aqvs-no-items-text{text-align:center;color:#6b7280}.aqvs-item-container,.aqvs-bottom-inset,.aqvs-items-wrapper{width:100%;position:absolute}}
2
+ @layer components{.aqvs-scroll-pane{display:flex;position:relative}.aqvs-scroll-pane-content{box-sizing:border-box;flex:1;height:100%;position:relative;overflow:hidden}.aqvs-tap-scroll-circle{touch-action:none;-webkit-user-select:none;user-select:none;justify-content:center;align-items:center;transition-property:transform;transition-duration:.1s;transition-timing-function:cubic-bezier(0,0,.2,1);display:flex;position:relative}.aqvs-tap-scroll-circle-visual-outer{border-radius:9999px;position:absolute;inset:0}.aqvs-tap-scroll-circle-gradient{background:linear-gradient(to bottom right,#1d4ed899,#60a5fa8c,#bfdbfe66);border:1px solid #fff6;border-radius:9999px;position:absolute;inset:0;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f}.aqvs-tap-scroll-circle-inner{border-radius:9999px;position:absolute;inset:18%}.aqvs-sample-visual-pupil{box-sizing:border-box;background-color:#ffffffd9;border:1px solid #ffffff80;border-radius:9999px;position:absolute;top:50%;left:50%}.aqvs-sample-visual-highlight{background-color:#fffc;border-radius:9999px;position:absolute;top:50%;left:50%}.aqvs-sample-visual-rod{background-color:#ffffff80;border-radius:9999px;position:absolute;top:50%;left:50%}.aqvs-scrollbar{z-index:50;cursor:default;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;touch-action:none;background-color:#fff;position:relative}.aqvs-scrollbar-horizontal{flex-direction:row;align-items:stretch;display:flex}.aqvs-scrollbar-vertical{flex-direction:column;align-items:stretch;display:flex}.aqvs-scrollbar[data-visible=false],.aqvs-scrollbar-thumb-wrapper[data-visible=false]{opacity:0;pointer-events:none}.aqvs-scrollbar-tap-circle-wrapper{pointer-events:auto;transition-property:opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1);position:absolute}.aqvs-scrollbar-arrow-button{color:#313131;letter-spacing:normal;background-color:#e0e0e0;border:0 solid;justify-content:center;align-items:center;padding:0;font-family:system-ui,sans-serif;font-size:.75rem;font-weight:400;line-height:1rem;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1);display:flex}.aqvs-scrollbar-arrow-button:focus{outline-offset:2px;outline:2px solid #0000}.aqvs-scrollbar-arrow-button:focus-visible{outline-offset:1px;outline:2px solid #60a5fa}.aqvs-scrollbar-arrow-button:disabled{cursor:not-allowed;opacity:.5}.aqvs-scrollbar-arrow-button:enabled:hover{background-color:#d4d4d4}.aqvs-scrollbar-track{background-color:#f5f5f5;flex:1;position:relative}.aqvs-scrollbar-overlay{pointer-events:none;position:absolute;inset:0}.aqvs-scrollbar-thumb-wrapper{touch-action:none;position:absolute}.aqvs-scrollbar-thumb{transform-origin:50%;background-color:#7f7f7f;transition:transform 80ms ease-out;position:absolute}.aqvs-scrollbar-thumb[data-thumb-state=disabled]{transition:none;transform:none}.aqvs-scrollbar-thumb[data-thumb-state=hover]{background-color:#5f5f5f}.aqvs-scrollbar-thumb[data-thumb-state=dragging]{background-color:#4f4f4f;transition:transform 60ms ease-out}.aqvs-scrollbar-thumb-horizontal{inset:1.5px 0}.aqvs-scrollbar-thumb-horizontal[data-thumb-state=hover]{top:-.5px;bottom:-.5px;transform:scaleY(1.06)}.aqvs-scrollbar-thumb-horizontal[data-thumb-state=dragging]{top:-.5px;bottom:-.5px;transform:scaleY(1.12)}.aqvs-scrollbar-thumb-vertical{inset:0 1.5px}.aqvs-scrollbar-thumb-vertical[data-thumb-state=hover]{left:-.5px;right:-.5px;transform:scaleX(1.06)}.aqvs-scrollbar-thumb-vertical[data-thumb-state=dragging]{left:-.5px;right:-.5px;transform:scaleX(1.12)}.aqvs-scroll-to-edge-button{pointer-events:auto;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;color:#fff;text-transform:uppercase;letter-spacing:.05em;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background-color:#1f2937cc;border:0 solid;border-radius:9999px;padding:.25rem 3rem;font-family:inherit;font-size:10px;font-weight:500;line-height:1.5;transition-property:transform,background-color;transition-duration:.15s;transform:none;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f}.aqvs-scroll-to-edge-button:focus{outline-offset:2px;outline:2px solid #0000}.aqvs-scroll-to-edge-button:focus-visible{outline-offset:1px;outline:2px solid #60a5fa}.aqvs-scroll-to-edge-button:hover{background-color:#374151}.aqvs-scroll-to-edge-button:active{transform:scale(.95)}.aqvs-scroll-to-edge-overlay{pointer-events:none;z-index:10;transition-property:opacity;transition-duration:.5s;position:absolute;inset:0}.aqvs-scroll-to-edge-overlay[data-visible=true]{opacity:1}.aqvs-scroll-to-edge-overlay[data-visible=false]{opacity:0}.aqvs-scroll-to-edge-overlay[data-visible=false] .aqvs-scroll-to-edge-button{pointer-events:none}.aqvs-scroll-to-edge-button-container{justify-content:center;display:flex;position:absolute;left:0;right:0}.aqvs-scroll-to-edge-button-container-top{top:.5rem}.aqvs-scroll-to-edge-button-container-bottom{bottom:.5rem}.aqvs-no-items-container{width:100%;position:absolute;top:0}.aqvs-no-items-text{text-align:center;color:#6b7280}.aqvs-item-container,.aqvs-bottom-inset,.aqvs-items-wrapper{width:100%;position:absolute}}
@@ -1,3 +1,3 @@
1
1
  /*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
2
2
  /*! @aiquants/virtualscroll standalone CSS — 非 Tailwind ホスト専用。ホストの Tailwind ビルドと混在させないこと */
3
- @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-ease:initial}}}@layer theme{:root,:host{--spacing:.25rem;--ease-out:cubic-bezier(0, 0, .2, 1);--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}}@layer base;@layer components{.aqvs-scroll-pane{display:flex;position:relative}.aqvs-scroll-pane-content{flex:1;height:100%;position:relative;overflow:hidden}.aqvs-tap-scroll-circle{touch-action:none;-webkit-user-select:none;user-select:none;justify-content:center;align-items:center;transition-property:transform;transition-duration:.1s;transition-timing-function:cubic-bezier(0,0,.2,1);display:flex;position:relative}.aqvs-tap-scroll-circle-visual-outer{border-radius:9999px;position:absolute;inset:0}.aqvs-tap-scroll-circle-gradient{background:linear-gradient(to bottom right,#1d4ed899,#60a5fa8c,#bfdbfe66);border-width:1px;border-color:#fff6;border-radius:9999px;position:absolute;inset:0;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f}.aqvs-tap-scroll-circle-inner{border-radius:9999px;position:absolute;inset:18%}.aqvs-sample-visual-pupil{background-color:#ffffffd9;border-width:1px;border-color:#ffffff80;border-radius:9999px;position:absolute;top:50%;left:50%}.aqvs-sample-visual-highlight{background-color:#fffc;border-radius:9999px;position:absolute;top:50%;left:50%}.aqvs-sample-visual-rod{background-color:#ffffff80;border-radius:9999px;position:absolute;top:50%;left:50%}.aqvs-scrollbar{z-index:50;cursor:default;-webkit-user-select:none;user-select:none;touch-action:none;background-color:#fff;position:relative}.aqvs-scrollbar-horizontal{flex-direction:row;align-items:stretch;display:flex}.aqvs-scrollbar-vertical{flex-direction:column;align-items:stretch;display:flex}.aqvs-scrollbar-tap-circle-wrapper{pointer-events:auto;transition-property:opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1);position:absolute}.aqvs-scrollbar-arrow-button{color:#313131;background-color:#e0e0e0;justify-content:center;align-items:center;font-size:.75rem;line-height:1rem;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1);display:flex}.aqvs-scrollbar-arrow-button:focus{outline-offset:2px;outline:2px solid #0000}.aqvs-scrollbar-arrow-button:focus-visible{outline-offset:1px;outline:2px solid #60a5fa}.aqvs-scrollbar-arrow-button:disabled{cursor:not-allowed;opacity:.5}.aqvs-scrollbar-arrow-button:enabled:hover{background-color:#d4d4d4}.aqvs-scrollbar-track{background-color:#f5f5f5;flex:1;position:relative}.aqvs-scrollbar-overlay{pointer-events:none;position:absolute;inset:0}.aqvs-scrollbar-thumb-wrapper{touch-action:none;position:absolute}.aqvs-scrollbar-thumb{transform-origin:50%;background-color:#7f7f7f;transition:transform 80ms ease-out;position:absolute}.aqvs-scrollbar-thumb[data-thumb-state=disabled]{transition:none;transform:none}.aqvs-scrollbar-thumb[data-thumb-state=hover]{background-color:#5f5f5f}.aqvs-scrollbar-thumb[data-thumb-state=dragging]{background-color:#4f4f4f;transition:transform 60ms ease-out}.aqvs-scrollbar-thumb-horizontal{inset:1.5px 0}.aqvs-scrollbar-thumb-horizontal[data-thumb-state=hover]{top:-.5px;bottom:-.5px;transform:scaleY(1.06)}.aqvs-scrollbar-thumb-horizontal[data-thumb-state=dragging]{top:-.5px;bottom:-.5px;transform:scaleY(1.12)}.aqvs-scrollbar-thumb-vertical{inset:0 1.5px}.aqvs-scrollbar-thumb-vertical[data-thumb-state=hover]{left:-.5px;right:-.5px;transform:scaleX(1.06)}.aqvs-scrollbar-thumb-vertical[data-thumb-state=dragging]{left:-.5px;right:-.5px;transform:scaleX(1.12)}.aqvs-scroll-to-edge-button{pointer-events:auto;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;color:#fff;text-transform:uppercase;letter-spacing:.05em;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background-color:#1f2937cc;border:none;border-radius:9999px;padding:.25rem 3rem;font-size:10px;font-weight:500;line-height:1.5;transition-property:transform,background-color;transition-duration:.15s;transform:none;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f}.aqvs-scroll-to-edge-button:focus{outline-offset:2px;outline:2px solid #0000}.aqvs-scroll-to-edge-button:focus-visible{outline-offset:1px;outline:2px solid #60a5fa}.aqvs-scroll-to-edge-button:hover{background-color:#374151}.aqvs-scroll-to-edge-button:active{transform:scale(.95)}.aqvs-scroll-to-edge-overlay{pointer-events:none;z-index:10;transition-property:opacity;transition-duration:.5s;position:absolute;inset:0}.aqvs-scroll-to-edge-overlay[data-visible=true]{opacity:1}.aqvs-scroll-to-edge-overlay[data-visible=false]{opacity:0}.aqvs-scroll-to-edge-button-container{justify-content:center;display:flex;position:absolute;left:0;right:0}.aqvs-scroll-to-edge-button-container-top{top:.5rem}.aqvs-scroll-to-edge-button-container-bottom{bottom:.5rem}.aqvs-no-items-container{width:100%;position:absolute;top:0}.aqvs-no-items-text{text-align:center;color:#6b7280}.aqvs-item-container,.aqvs-bottom-inset,.aqvs-items-wrapper{width:100%;position:absolute}}@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.visible{visibility:visible}.fixed{position:fixed}.relative{position:relative}.static{position:static}.row-0{grid-row:0}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.block{display:block}.grid{display:grid}.hidden{display:none}.inline{display:inline}.size-1{width:calc(var(--spacing) * 1);height:calc(var(--spacing) * 1)}.shrink{flex-shrink:1}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.resize{resize:both}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.border{border-style:var(--tw-border-style);border-width:1px}.opacity-0{opacity:0}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}
3
+ @layer theme,base;@layer components{.aqvs-scroll-pane{display:flex;position:relative}.aqvs-scroll-pane-content{box-sizing:border-box;flex:1;height:100%;position:relative;overflow:hidden}.aqvs-tap-scroll-circle{touch-action:none;-webkit-user-select:none;user-select:none;justify-content:center;align-items:center;transition-property:transform;transition-duration:.1s;transition-timing-function:cubic-bezier(0,0,.2,1);display:flex;position:relative}.aqvs-tap-scroll-circle-visual-outer{border-radius:9999px;position:absolute;inset:0}.aqvs-tap-scroll-circle-gradient{background:linear-gradient(to bottom right,#1d4ed899,#60a5fa8c,#bfdbfe66);border:1px solid #fff6;border-radius:9999px;position:absolute;inset:0;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f}.aqvs-tap-scroll-circle-inner{border-radius:9999px;position:absolute;inset:18%}.aqvs-sample-visual-pupil{box-sizing:border-box;background-color:#ffffffd9;border:1px solid #ffffff80;border-radius:9999px;position:absolute;top:50%;left:50%}.aqvs-sample-visual-highlight{background-color:#fffc;border-radius:9999px;position:absolute;top:50%;left:50%}.aqvs-sample-visual-rod{background-color:#ffffff80;border-radius:9999px;position:absolute;top:50%;left:50%}.aqvs-scrollbar{z-index:50;cursor:default;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;touch-action:none;background-color:#fff;position:relative}.aqvs-scrollbar-horizontal{flex-direction:row;align-items:stretch;display:flex}.aqvs-scrollbar-vertical{flex-direction:column;align-items:stretch;display:flex}.aqvs-scrollbar[data-visible=false],.aqvs-scrollbar-thumb-wrapper[data-visible=false]{opacity:0;pointer-events:none}.aqvs-scrollbar-tap-circle-wrapper{pointer-events:auto;transition-property:opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1);position:absolute}.aqvs-scrollbar-arrow-button{color:#313131;letter-spacing:normal;background-color:#e0e0e0;border:0 solid;justify-content:center;align-items:center;padding:0;font-family:system-ui,sans-serif;font-size:.75rem;font-weight:400;line-height:1rem;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1);display:flex}.aqvs-scrollbar-arrow-button:focus{outline-offset:2px;outline:2px solid #0000}.aqvs-scrollbar-arrow-button:focus-visible{outline-offset:1px;outline:2px solid #60a5fa}.aqvs-scrollbar-arrow-button:disabled{cursor:not-allowed;opacity:.5}.aqvs-scrollbar-arrow-button:enabled:hover{background-color:#d4d4d4}.aqvs-scrollbar-track{background-color:#f5f5f5;flex:1;position:relative}.aqvs-scrollbar-overlay{pointer-events:none;position:absolute;inset:0}.aqvs-scrollbar-thumb-wrapper{touch-action:none;position:absolute}.aqvs-scrollbar-thumb{transform-origin:50%;background-color:#7f7f7f;transition:transform 80ms ease-out;position:absolute}.aqvs-scrollbar-thumb[data-thumb-state=disabled]{transition:none;transform:none}.aqvs-scrollbar-thumb[data-thumb-state=hover]{background-color:#5f5f5f}.aqvs-scrollbar-thumb[data-thumb-state=dragging]{background-color:#4f4f4f;transition:transform 60ms ease-out}.aqvs-scrollbar-thumb-horizontal{inset:1.5px 0}.aqvs-scrollbar-thumb-horizontal[data-thumb-state=hover]{top:-.5px;bottom:-.5px;transform:scaleY(1.06)}.aqvs-scrollbar-thumb-horizontal[data-thumb-state=dragging]{top:-.5px;bottom:-.5px;transform:scaleY(1.12)}.aqvs-scrollbar-thumb-vertical{inset:0 1.5px}.aqvs-scrollbar-thumb-vertical[data-thumb-state=hover]{left:-.5px;right:-.5px;transform:scaleX(1.06)}.aqvs-scrollbar-thumb-vertical[data-thumb-state=dragging]{left:-.5px;right:-.5px;transform:scaleX(1.12)}.aqvs-scroll-to-edge-button{pointer-events:auto;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;color:#fff;text-transform:uppercase;letter-spacing:.05em;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background-color:#1f2937cc;border:0 solid;border-radius:9999px;padding:.25rem 3rem;font-family:inherit;font-size:10px;font-weight:500;line-height:1.5;transition-property:transform,background-color;transition-duration:.15s;transform:none;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f}.aqvs-scroll-to-edge-button:focus{outline-offset:2px;outline:2px solid #0000}.aqvs-scroll-to-edge-button:focus-visible{outline-offset:1px;outline:2px solid #60a5fa}.aqvs-scroll-to-edge-button:hover{background-color:#374151}.aqvs-scroll-to-edge-button:active{transform:scale(.95)}.aqvs-scroll-to-edge-overlay{pointer-events:none;z-index:10;transition-property:opacity;transition-duration:.5s;position:absolute;inset:0}.aqvs-scroll-to-edge-overlay[data-visible=true]{opacity:1}.aqvs-scroll-to-edge-overlay[data-visible=false]{opacity:0}.aqvs-scroll-to-edge-overlay[data-visible=false] .aqvs-scroll-to-edge-button{pointer-events:none}.aqvs-scroll-to-edge-button-container{justify-content:center;display:flex;position:absolute;left:0;right:0}.aqvs-scroll-to-edge-button-container-top{top:.5rem}.aqvs-scroll-to-edge-button-container-bottom{bottom:.5rem}.aqvs-no-items-container{width:100%;position:absolute;top:0}.aqvs-no-items-text{text-align:center;color:#6b7280}.aqvs-item-container,.aqvs-bottom-inset,.aqvs-items-wrapper{width:100%;position:absolute}}@layer utilities;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiquants/virtualscroll",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "High-performance virtual scrolling component for React with variable item heights",
5
5
  "sideEffects": [
6
6
  "**/*.css"
package/src/ScrollBar.tsx CHANGED
@@ -1489,11 +1489,14 @@ export const ScrollBar = ({
1489
1489
 
1490
1490
  return (
1491
1491
  <div
1492
- className={twMerge("aqvs-scrollbar", directionClass, !scrollBarVisible && "pointer-events-none opacity-0", className)}
1492
+ className={twMerge("aqvs-scrollbar", directionClass, className)}
1493
1493
  style={{
1494
1494
  [mainSizeKey]: viewportSize,
1495
1495
  [crossSizeKey]: scrollBarWidth,
1496
1496
  }}
1497
+ // 非表示はパッケージ CSS が担う。Tailwind ユーティリティ (opacity-0 等) に委ねると
1498
+ // components-only アーティファクトには同梱されず、ホストのビルド内容任せになる
1499
+ data-visible={scrollBarVisible ? "true" : "false"}
1497
1500
  role="scrollbar"
1498
1501
  tabIndex={-1}
1499
1502
  aria-controls={ariaControls}
@@ -1536,12 +1539,14 @@ export const ScrollBar = ({
1536
1539
  {/* DOMの再生成を防ぐため、常にレンダリングしてスタイルで表示制御を行う */}
1537
1540
  <div
1538
1541
  key="thumb-wrapper"
1539
- className={twMerge("aqvs-scrollbar-thumb-wrapper", !(scrollBarVisible || isDragging) && "pointer-events-none opacity-0")}
1542
+ className="aqvs-scrollbar-thumb-wrapper"
1540
1543
  style={{
1541
1544
  [mainSizeKey]: thumbSize,
1542
1545
  [positionKey]: thumbPosition,
1543
1546
  ...(horizontal ? { top: 0, bottom: 0 } : { left: 0, right: 0 }),
1544
1547
  }}
1548
+ // ルート同様、非表示はパッケージ CSS の [data-visible="false"] が担う
1549
+ data-visible={scrollBarVisible || isDragging ? "true" : "false"}
1545
1550
  onPointerDown={handlePointerDownOnThumb}
1546
1551
  role="slider"
1547
1552
  aria-orientation={horizontal ? "horizontal" : "vertical"}
@@ -1,11 +1,11 @@
1
1
  /*! @aiquants/virtualscroll standalone CSS — 非 Tailwind ホスト専用。ホストの Tailwind ビルドと混在させないこと */
2
2
  /*
3
- * Artifact B: 自己完結スタンドアロン. virtualscroll JSX ユーティリティを持たないため
4
- * 実質 .aqvs-* コンポーネントクラスのみだが、命名統一のため standalone も配布する。
3
+ * Artifact B: 自己完結スタンドアロン。virtualscroll JSX は `.aqvs-*` クラスしか書かないため
4
+ * (src/preflightIndependence.spec.ts が機械的に固定)、ユーティリティは生成しない。
5
+ * かつて `@source` でパッケージ内を走査していたが、spec ファイルの識別子や docstring の英単語を
6
+ * 誤検出して `.hidden` / `.container` / `.truncate` などを利用側の名前空間へ注入していたため撤去した。
7
+ * レイヤー順序の宣言だけは残し、利用側の utilities から `.aqvs-*` を上書きできる状態を保つ。
5
8
  */
6
9
  @layer theme, base, components, utilities;
7
10
  @import "tailwindcss/theme.css" layer(theme);
8
- @import "tailwindcss/utilities.css" layer(utilities) source(none);
9
11
  @import "./virtualscroll.css" layer(components);
10
- @source "../**/*.{ts,tsx}";
11
- @custom-variant dark (&:where(.dark, .dark *));
@@ -4,6 +4,7 @@
4
4
  }
5
5
 
6
6
  .aqvs-scroll-pane-content {
7
+ box-sizing: border-box;
7
8
  position: relative;
8
9
  height: 100%;
9
10
  flex: 1 1 0%;
@@ -33,8 +34,7 @@
33
34
  position: absolute;
34
35
  inset: 0;
35
36
  border-radius: 9999px;
36
- border-width: 1px;
37
- border-color: rgba(255, 255, 255, 0.4);
37
+ border: 1px solid rgba(255, 255, 255, 0.4);
38
38
  box-shadow:
39
39
  0 4px 6px -1px rgba(0, 0, 0, 0.1),
40
40
  0 2px 4px -1px rgba(0, 0, 0, 0.06);
@@ -47,12 +47,12 @@
47
47
  }
48
48
 
49
49
  .aqvs-sample-visual-pupil {
50
+ box-sizing: border-box;
50
51
  position: absolute;
51
52
  top: 50%;
52
53
  left: 50%;
53
54
  border-radius: 9999px;
54
- border-width: 1px;
55
- border-color: rgba(255, 255, 255, 0.5);
55
+ border: 1px solid rgba(255, 255, 255, 0.5);
56
56
  background-color: rgba(255, 255, 255, 0.85);
57
57
  }
58
58
 
@@ -77,6 +77,7 @@
77
77
  z-index: 50;
78
78
  cursor: default;
79
79
  user-select: none;
80
+ -webkit-tap-highlight-color: transparent;
80
81
  background-color: white;
81
82
  touch-action: none;
82
83
  }
@@ -93,6 +94,12 @@
93
94
  align-items: stretch;
94
95
  }
95
96
 
97
+ .aqvs-scrollbar[data-visible="false"],
98
+ .aqvs-scrollbar-thumb-wrapper[data-visible="false"] {
99
+ opacity: 0;
100
+ pointer-events: none;
101
+ }
102
+
96
103
  .aqvs-scrollbar-tap-circle-wrapper {
97
104
  pointer-events: auto;
98
105
  position: absolute;
@@ -107,8 +114,13 @@
107
114
  display: flex;
108
115
  align-items: center;
109
116
  justify-content: center;
117
+ border: 0 solid;
118
+ padding: 0;
119
+ font-family: system-ui, sans-serif;
110
120
  font-size: 0.75rem;
121
+ font-weight: 400;
111
122
  line-height: 1rem;
123
+ letter-spacing: normal;
112
124
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
113
125
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
114
126
  transition-duration: 150ms;
@@ -215,10 +227,11 @@
215
227
  user-select: none;
216
228
  -webkit-tap-highlight-color: transparent;
217
229
  transform: none;
218
- border: none;
230
+ border: 0 solid;
219
231
  border-radius: 9999px;
220
232
  background-color: rgba(31, 41, 55, 0.8);
221
233
  padding: 0.25rem 3rem;
234
+ font-family: inherit;
222
235
  font-weight: 500;
223
236
  font-size: 10px;
224
237
  line-height: 1.5;
@@ -268,6 +281,10 @@
268
281
  opacity: 0;
269
282
  }
270
283
 
284
+ .aqvs-scroll-to-edge-overlay[data-visible="false"] .aqvs-scroll-to-edge-button {
285
+ pointer-events: none;
286
+ }
287
+
271
288
  .aqvs-scroll-to-edge-button-container {
272
289
  position: absolute;
273
290
  left: 0;