virtua 0.46.6 → 0.46.7

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.
@@ -13,6 +13,7 @@
13
13
  shift,
14
14
  horizontal,
15
15
  keepMounted,
16
+ cache,
16
17
  children,
17
18
  onscroll,
18
19
  onscrollend,
@@ -21,6 +22,8 @@
21
22
 
22
23
  let ref: Virtualizer<T> = $state()!;
23
24
 
25
+ export const getCache = (() =>
26
+ ref.getCache()) satisfies VListHandle["getCache"] as VListHandle["getCache"];
24
27
  export const getScrollOffset = (() =>
25
28
  ref.getScrollOffset()) satisfies VListHandle["getScrollOffset"] as VListHandle["getScrollOffset"];
26
29
  export const getScrollSize = (() =>
@@ -76,6 +79,7 @@
76
79
  {shift}
77
80
  {horizontal}
78
81
  {keepMounted}
82
+ {cache}
79
83
  {onscroll}
80
84
  {onscrollend}
81
85
  />
@@ -3,7 +3,7 @@ import type { VirtualizerHandle, VirtualizerProps } from "./Virtualizer.type.js"
3
3
  /**
4
4
  * Props of {@link VList}.
5
5
  */
6
- export interface VListProps<T> extends Pick<VirtualizerProps<T>, "data" | "getKey" | "bufferSize" | "itemSize" | "shift" | "horizontal" | "children" | "onscroll" | "onscrollend" | "keepMounted">, ViewportComponentAttributes {
6
+ export interface VListProps<T> extends Pick<VirtualizerProps<T>, "data" | "getKey" | "bufferSize" | "itemSize" | "shift" | "horizontal" | "children" | "onscroll" | "onscrollend" | "keepMounted" | "cache">, ViewportComponentAttributes {
7
7
  }
8
8
  /**
9
9
  * Methods of {@link VList}.
@@ -32,6 +32,7 @@
32
32
  shift = false,
33
33
  horizontal = false,
34
34
  keepMounted,
35
+ cache,
35
36
  startMargin = 0,
36
37
  children,
37
38
  onscroll,
@@ -42,7 +43,7 @@
42
43
  data.length,
43
44
  itemSize,
44
45
  undefined,
45
- undefined,
46
+ cache,
46
47
  !itemSize
47
48
  );
48
49
  const resizer = createResizer(store, horizontal);
@@ -104,6 +105,8 @@
104
105
  scroller.$fixScrollJump();
105
106
  });
106
107
 
108
+ export const getCache =
109
+ store.$getCacheSnapshot satisfies VirtualizerHandle["getCache"] as VirtualizerHandle["getCache"];
107
110
  export const getScrollOffset =
108
111
  store.$getScrollOffset satisfies VirtualizerHandle["getScrollOffset"] as VirtualizerHandle["getScrollOffset"];
109
112
  export const getScrollSize = (() =>
@@ -1,6 +1,6 @@
1
1
  import { type Snippet } from "svelte";
2
2
  import type { SvelteHTMLElements } from "svelte/elements";
3
- import { type ScrollToIndexOpts } from "../core/index.js";
3
+ import { type CacheSnapshot, type ScrollToIndexOpts } from "../core/index.js";
4
4
  /**
5
5
  * Props of {@link Virtualizer}.
6
6
  */
@@ -56,6 +56,12 @@ export interface VirtualizerProps<T> {
56
56
  * List of indexes that should be always mounted, even when off screen.
57
57
  */
58
58
  keepMounted?: readonly number[];
59
+ /**
60
+ * You can restore cache by passing a {@link CacheSnapshot} on mount. This is useful when you want to restore scroll position after navigation. The snapshot can be obtained from {@link VirtualizerHandle.cache}.
61
+ *
62
+ * **The length of items should be the same as when you take the snapshot, otherwise restoration may not work as expected.**
63
+ */
64
+ cache?: CacheSnapshot;
59
65
  /**
60
66
  * The offset to the scrollable parent before virtualizer in pixels. If you put an element before virtualizer, you have to set its height to this prop.
61
67
  */
@@ -74,6 +80,10 @@ export interface VirtualizerProps<T> {
74
80
  * Methods of {@link Virtualizer}.
75
81
  */
76
82
  export interface VirtualizerHandle {
83
+ /**
84
+ * Get current {@link CacheSnapshot}.
85
+ */
86
+ getCache: () => CacheSnapshot;
77
87
  /**
78
88
  * Get current scrollTop, or scrollLeft if horizontal: true.
79
89
  */
@@ -27,6 +27,7 @@
27
27
  itemSize,
28
28
  shift = false,
29
29
  horizontal = false,
30
+ cache,
30
31
  children,
31
32
  onscroll,
32
33
  onscrollend,
@@ -36,7 +37,7 @@
36
37
  data.length,
37
38
  itemSize,
38
39
  undefined,
39
- undefined,
40
+ cache,
40
41
  !itemSize
41
42
  );
42
43
  const resizer = createWindowResizer(store, horizontal);
@@ -83,6 +84,8 @@
83
84
  scroller.$fixScrollJump();
84
85
  });
85
86
 
87
+ export const getCache =
88
+ store.$getCacheSnapshot satisfies WindowVirtualizerHandle["getCache"] as WindowVirtualizerHandle["getCache"];
86
89
  export const findStartIndex =
87
90
  store.$findStartIndex satisfies WindowVirtualizerHandle["findStartIndex"] as WindowVirtualizerHandle["findStartIndex"];
88
91
  export const findEndIndex =
@@ -1,5 +1,5 @@
1
1
  import { type Snippet } from "svelte";
2
- import { type ScrollToIndexOpts } from "../core/index.js";
2
+ import { type CacheSnapshot, type ScrollToIndexOpts } from "../core/index.js";
3
3
  /**
4
4
  * Props of {@link WindowVirtualizer}.
5
5
  */
@@ -37,6 +37,12 @@ export interface WindowVirtualizerProps<T> {
37
37
  * If true, rendered as a horizontally scrollable list. Otherwise rendered as a vertically scrollable list.
38
38
  */
39
39
  horizontal?: boolean;
40
+ /**
41
+ * You can restore cache by passing a {@link CacheSnapshot} on mount. This is useful when you want to restore scroll position after navigation. The snapshot can be obtained from {@link WindowVirtualizerHandle.cache}.
42
+ *
43
+ * **The length of items should be the same as when you take the snapshot, otherwise restoration may not work as expected.**
44
+ */
45
+ cache?: CacheSnapshot;
40
46
  /**
41
47
  * Callback invoked whenever scroll offset changes.
42
48
  */
@@ -50,6 +56,10 @@ export interface WindowVirtualizerProps<T> {
50
56
  * Methods of {@link WindowVirtualizer}.
51
57
  */
52
58
  export interface WindowVirtualizerHandle {
59
+ /**
60
+ * Get current {@link CacheSnapshot}.
61
+ */
62
+ getCache: () => CacheSnapshot;
53
63
  /**
54
64
  * Find the start index of visible range of items.
55
65
  */
@@ -1,7 +1,8 @@
1
1
  /** @jsxImportSource vue */
2
- import { ComponentOptionsMixin, SlotsType, VNode, PropType } from "vue";
3
- import { VirtualizerHandle } from "./Virtualizer.js";
4
- import { ItemProps } from "./utils.js";
2
+ import { type ComponentOptionsMixin, type SlotsType, type VNode, type PropType } from "vue";
3
+ import { type VirtualizerHandle } from "./Virtualizer.js";
4
+ import { type ItemProps } from "./utils.js";
5
+ import { type CacheSnapshot } from "../core/index.js";
5
6
  interface VListHandle extends VirtualizerHandle {
6
7
  }
7
8
  export declare const VList: import("vue").DefineComponent<{
@@ -46,6 +47,12 @@ export declare const VList: import("vue").DefineComponent<{
46
47
  * List of indexes that should be always mounted, even when off screen.
47
48
  */
48
49
  keepMounted: PropType<readonly number[]>;
50
+ /**
51
+ * You can restore cache by passing a {@link CacheSnapshot} on mount. This is useful when you want to restore scroll position after navigation. The snapshot can be obtained from {@link VirtualizerHandle.cache}.
52
+ *
53
+ * **The length of items should be the same as when you take the snapshot, otherwise restoration may not work as expected.**
54
+ */
55
+ cache: PropType<CacheSnapshot>;
49
56
  }, VListHandle, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
50
57
  /**
51
58
  * Callback invoked whenever scroll offset changes.
@@ -98,6 +105,12 @@ export declare const VList: import("vue").DefineComponent<{
98
105
  * List of indexes that should be always mounted, even when off screen.
99
106
  */
100
107
  keepMounted: PropType<readonly number[]>;
108
+ /**
109
+ * You can restore cache by passing a {@link CacheSnapshot} on mount. This is useful when you want to restore scroll position after navigation. The snapshot can be obtained from {@link VirtualizerHandle.cache}.
110
+ *
111
+ * **The length of items should be the same as when you take the snapshot, otherwise restoration may not work as expected.**
112
+ */
113
+ cache: PropType<CacheSnapshot>;
101
114
  }>> & {
102
115
  onScroll?: ((offset: number) => any) | undefined;
103
116
  onScrollEnd?: (() => any) | undefined;
@@ -1,8 +1,12 @@
1
1
  /** @jsxImportSource vue */
2
- import { VNode, ComponentOptionsMixin, SlotsType, PropType, NativeElements } from "vue";
3
- import { ScrollToIndexOpts } from "../core/index.js";
4
- import { ItemProps } from "./utils.js";
2
+ import { type VNode, type ComponentOptionsMixin, type SlotsType, type PropType, type NativeElements } from "vue";
3
+ import { type ScrollToIndexOpts, type CacheSnapshot } from "../core/index.js";
4
+ import { type ItemProps } from "./utils.js";
5
5
  export interface VirtualizerHandle {
6
+ /**
7
+ * Get current {@link CacheSnapshot}.
8
+ */
9
+ readonly cache: CacheSnapshot;
6
10
  /**
7
11
  * Get current scrollTop, or scrollLeft if horizontal: true.
8
12
  */
@@ -119,6 +123,12 @@ export declare const Virtualizer: import("vue").DefineComponent<{
119
123
  * List of indexes that should be always mounted, even when off screen.
120
124
  */
121
125
  keepMounted: PropType<readonly number[]>;
126
+ /**
127
+ * You can restore cache by passing a {@link CacheSnapshot} on mount. This is useful when you want to restore scroll position after navigation. The snapshot can be obtained from {@link VirtualizerHandle.cache}.
128
+ *
129
+ * **The length of items should be the same as when you take the snapshot, otherwise restoration may not work as expected.**
130
+ */
131
+ cache: PropType<CacheSnapshot>;
122
132
  }, VirtualizerHandle, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
123
133
  /**
124
134
  * Callback invoked whenever scroll offset changes.
@@ -198,6 +208,12 @@ export declare const Virtualizer: import("vue").DefineComponent<{
198
208
  * List of indexes that should be always mounted, even when off screen.
199
209
  */
200
210
  keepMounted: PropType<readonly number[]>;
211
+ /**
212
+ * You can restore cache by passing a {@link CacheSnapshot} on mount. This is useful when you want to restore scroll position after navigation. The snapshot can be obtained from {@link VirtualizerHandle.cache}.
213
+ *
214
+ * **The length of items should be the same as when you take the snapshot, otherwise restoration may not work as expected.**
215
+ */
216
+ cache: PropType<CacheSnapshot>;
201
217
  }>> & {
202
218
  onScroll?: ((offset: number) => any) | undefined;
203
219
  onScrollEnd?: (() => any) | undefined;
@@ -1,7 +1,11 @@
1
1
  /** @jsxImportSource vue */
2
- import { VNode, ComponentOptionsMixin, SlotsType, PropType, NativeElements } from "vue";
3
- import { ScrollToIndexOpts } from "../core/index.js";
2
+ import { type VNode, type ComponentOptionsMixin, type SlotsType, type PropType, type NativeElements } from "vue";
3
+ import { type ScrollToIndexOpts, type CacheSnapshot } from "../core/index.js";
4
4
  export interface WindowVirtualizerHandle {
5
+ /**
6
+ * Get current {@link CacheSnapshot}.
7
+ */
8
+ readonly cache: CacheSnapshot;
5
9
  /**
6
10
  * Find the start index of visible range of items.
7
11
  */
@@ -61,6 +65,12 @@ export declare const WindowVirtualizer: import("vue").DefineComponent<{
61
65
  type: PropType<keyof NativeElements>;
62
66
  default: string;
63
67
  };
68
+ /**
69
+ * You can restore cache by passing a {@link CacheSnapshot} on mount. This is useful when you want to restore scroll position after navigation. The snapshot can be obtained from {@link WindowVirtualizerHandle.cache}.
70
+ *
71
+ * **The length of items should be the same as when you take the snapshot, otherwise restoration may not work as expected.**
72
+ */
73
+ cache: PropType<CacheSnapshot>;
64
74
  }, void, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
65
75
  /**
66
76
  * Callback invoked whenever scroll offset changes.
@@ -114,6 +124,12 @@ export declare const WindowVirtualizer: import("vue").DefineComponent<{
114
124
  type: PropType<keyof NativeElements>;
115
125
  default: string;
116
126
  };
127
+ /**
128
+ * You can restore cache by passing a {@link CacheSnapshot} on mount. This is useful when you want to restore scroll position after navigation. The snapshot can be obtained from {@link WindowVirtualizerHandle.cache}.
129
+ *
130
+ * **The length of items should be the same as when you take the snapshot, otherwise restoration may not work as expected.**
131
+ */
132
+ cache: PropType<CacheSnapshot>;
117
133
  }>> & {
118
134
  onScroll?: (() => any) | undefined;
119
135
  onScrollEnd?: (() => any) | undefined;
package/lib/vue/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- var e=require("vue");const t=null,{min:r,max:o,abs:n,floor:s}=Math,i=(e,t,n)=>r(n,o(t,e)),l=e=>[...e].sort(((e,t)=>e-t)),c="function"==typeof queueMicrotask?queueMicrotask:e=>{Promise.resolve().then(e)},a=()=>{let e;return[new Promise((t=>{e=t})),e]},u=e=>{let t;return()=>(e&&(t=e(),e=void 0),t)},f=(e,t,r)=>{const o=r?"unshift":"push";for(let r=0;r<t;r++)e[o](-1);return e},d=(e,t)=>{const r=e.t[t];return-1===r?e.o:r},p=(e,t,o)=>{const n=-1===e.t[t];return e.t[t]=o,e.i=r(t,e.i),n},m=(e,t)=>{if(!e.l)return 0;if(e.i>=t)return e.u[t];e.i<0&&(e.u[0]=0,e.i=0);let r=e.i,o=e.u[r];for(;r<t;)o+=d(e,r),e.u[++r]=o;return e.i=t,o},h=(e,t,r=0,o=e.l-1)=>{for(;r<=o;){const n=s((r+o)/2);if(m(e,n)<=t){if(m(e,n+1)>t)return n;r=n+1}else o=n-1}return i(r,0,e.l-1)},_=(e,t,o)=>{const n=t-e.l;return e.i=o?-1:r(t-1,e.i),e.l=t,n>0?(f(e.u,n),f(e.t,n,o),e.o*n):(e.u.splice(n),(o?e.t.splice(0,-n):e.t.splice(n)).reduce(((t,r)=>t-(-1===r?e.o:r)),0))},b="undefined"!=typeof window,v=()=>document.documentElement,S=e=>e.ownerDocument,y=e=>e.defaultView,g=/*#__PURE__*/u((()=>!!b&&"rtl"===getComputedStyle(v()).direction)),z=/*#__PURE__*/u((()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>0)),x=/*#__PURE__*/u((()=>"scrollBehavior"in v().style)),$=(e,s=40,i=0,c,a=!1)=>{let u=!!i,b=1,v=0,S=0,y=0,g=0,x=0,$=0,w=0,I=0,k=t,O=[0,u?o(i-1,0):-1],j=0;const E=((e,t)=>({o:t,t:f([],e),l:e,i:-1,u:f([],e+1)}))(e,s),q=new Set,T=()=>y-S,B=()=>T()+x+g,M=(e,t)=>((e,t,o,n)=>{if(n=r(n,e.l-1),m(e,n)<=t){const r=h(e,o,n);return[h(e,t,n,r),r]}{const r=h(e,t,void 0,n);return[r,h(e,o,r)]}})(E,e,t,O[0]),N=()=>m(E,E.l),P=e=>m(E,e)-x,R=e=>d(E,e),A=(e,t=-1)=>E.t[e]===t,H=e=>{e&&(z()&&0!==w||k&&1===I?x+=e:g+=e)};return{p:()=>{q.clear()},m:()=>b,h:()=>(e=>[e.t.slice(),e.o])(E),v:(e=200)=>{if(!v||u)return O;let t,n;if($)[t,n]=O;else{let s=o(0,B()),i=s+v;a||(e=o(0,e),1!==w&&(s-=e),2!==w&&(i+=e)),[t,n]=O=M(o(0,s),o(0,i)),k&&(t=r(t,k[0]),n=o(n,k[1]))}return[o(t,0),r(n,E.l-1)]},S:()=>h(E,B()),I:()=>h(E,B()+v),k:A,O:P,j:R,q:()=>E.l,T:()=>y,B:()=>0!==w,M:()=>v,N:()=>S,P:N,R:()=>($=g,g=0,[$,2===I]),A:(e,t)=>{const r=[e,t];return q.add(r),()=>{q.delete(r)}},H:(e,r)=>{let s,i,c=0;switch(e){case 1:{if(r===y&&0===I)break;const e=$;$=0;const t=r-y,o=n(t);e&&o<n(e)+1||0!==I||(w=t<0?2:1),u&&(u=!1),y=r,c=4;const s=T();s>=-v&&s<=N()&&(c+=1,i=o>v);break}case 2:c=8,0!==w&&(s=!0,c+=1),w=0,I=0,k=t;break;case 3:{const e=r.filter((([e,t])=>!A(e,t)));if(!e.length)break;H(e.reduce(((e,[t,r])=>((2===I||(k&&1===I?t<k[0]:P(t+(0===w&&0===I?1:0))<T()))&&(e+=r-R(t)),e)),0));for(const[t,r]of e){const e=R(t),o=p(E,t,r);a&&(j+=o?r:r-e)}a&&v&&j>v&&(H(((e,t)=>{let r=0;const n=[];e.t.forEach(((e,o)=>{-1!==e&&(n.push(e),o<t&&r++)})),e.i=-1;const s=l(n),i=s.length,c=i/2|0,a=i%2==0?(s[c-1]+s[c])/2:s[c],u=e.o;return((e.o=a)-u)*o(t-r,0)})(E,h(E,B()))),a=!1),c=3,i=!0;break}case 4:v!==r&&(v||(i=!0),v=r,c=3);break;case 5:r[1]?(H(_(E,r[0],!0)),I=2,c=1):(_(E,r[0]),c=1);break;case 6:S=r;break;case 7:I=1;break;case 8:k=M(r,r+v),c=1}c&&(b=1+(2147483647&b),s&&x&&(g+=x,x=0),q.forEach((([e,t])=>{c&e&&t(i)})))}}},w=setTimeout,I=(e,t)=>t&&g()?-e:e,k=(e,r,o,n,s,i)=>{const l=Date.now;let c=0,a=!1,u=!1,f=!1,d=!1;const p=(()=>{let r;const o=()=>{r!=t&&clearTimeout(r)},n=()=>{o(),r=w((()=>{r=t,(()=>{if(a||u)return a=!1,void p();f=!1,e.H(2)})()}),150)};return n.V=o,n})(),m=()=>{c=l(),f&&(d=!0),i&&e.H(6,i()),e.H(1,n()),p()},h=t=>{if(a||!e.B()||t.ctrlKey)return;const r=l()-c;150>r&&50<r&&(o?t.deltaX:t.deltaY)&&(a=!0)},_=()=>{u=!0,f=d=!1},b=()=>{u=!1,z()&&(f=!0)};return r.addEventListener("scroll",m),r.addEventListener("wheel",h,{passive:!0}),r.addEventListener("touchstart",_,{passive:!0}),r.addEventListener("touchend",b,{passive:!0}),{C:()=>{r.removeEventListener("scroll",m),r.removeEventListener("wheel",h),r.removeEventListener("touchstart",_),r.removeEventListener("touchend",b),p.V()},F:()=>{const[t,r]=e.R();t&&(s(I(t,o),r,d),d=!1,r&&e.M()>e.P()&&e.H(1,n()))}}},O=(e,t,r)=>{let o;return[async(n,s)=>{if(!await t())return;o&&o();const i=()=>{const[t,r]=a();return o=()=>{r(!1)},e.M()&&w(o,150),[t,e.A(2,(()=>{r(!0)}))]};if(s&&x())e.H(8,n()),c((async()=>{for(;;){let t=!0;for(let[r,o]=e.v();r<=o;r++)if(e.k(r)){t=!1;break}if(t)break;const[r,o]=i();try{if(!await r)return}finally{o()}}e.H(7),r(n(),s)}));else for(;;){const[t,o]=i();try{if(e.H(7),r(n()),!await t)return}finally{o()}}},()=>{o&&o()}]},j=e=>{let t;return{J(r){(t||(t=new(y(S(r)).ResizeObserver)(e))).observe(r)},L(e){t.unobserve(e)},C(){t&&t.disconnect()}}},E=/*#__PURE__*/e.defineComponent({props:{W:{type:Object,required:!0},X:{type:Object,required:!0},Y:{type:Object,required:!0},D:{type:Function,required:!0},U:{type:Number,required:!0},G:{type:Boolean},K:{type:Boolean},Z:{type:String,required:!0},ee:Object},setup(t){const r=e.ref(),o=e.computed((()=>t.W.value&&t.X.O(t.U))),n=e.computed((()=>t.W.value&&t.X.k(t.U)));return e.watch((()=>r.value&&t.U),((e,o,n)=>{n(t.D(r.value,t.U))}),{flush:"post"}),()=>{var s;const{Y:i,G:l,K:c,Z:a}=t,u=n.value,{style:f,...d}=null!==(s=t.ee)&&void 0!==s?s:{},p={contain:"layout style",position:u&&c?void 0:"absolute",[l?"height":"width"]:"100%",[l?"top":"left"]:"0px",[l?g()?"right":"left":"top"]:o.value+"px",visibility:!u||c?void 0:"hidden",...f};return l&&(p.display="inline-flex"),e.createVNode(a,e.mergeProps({ref:r,style:p},d),"function"==typeof(m=i)||"[object Object]"===Object.prototype.toString.call(m)&&!e.isVNode(m)?i:{default:()=>[i],_:2},16,["style"]);var m}}}),q=(e,t)=>{const r=e.key;return null!=r?r:"_"+t},T=(e,t)=>e[0]===t[0]&&e[1]===t[1],B={data:{type:Array,required:!0},bufferSize:Number,itemSize:Number,shift:Boolean,horizontal:Boolean,startMargin:{type:Number,default:0},ssrCount:Number,scrollRef:Object,as:{type:String,default:"div"},item:{type:String,default:"div"},itemProps:Function,keepMounted:Array},M=/*#__PURE__*/e.defineComponent({props:B,emits:["scroll","scrollEnd"],setup(r,{emit:n,expose:s,slots:c}){let u=!!r.ssrCount;const f=r.horizontal,d=e.ref(),p=$(r.data.length,r.itemSize,r.ssrCount,0,!r.itemSize),m=((e,r)=>{let o;const n=r?"width":"height",s=new WeakMap,i=j((r=>{const i=[];for(const{target:l,contentRect:c}of r)if(l.offsetParent)if(l===o)e.H(4,c[n]);else{const e=s.get(l);e!=t&&i.push([e,c[n]])}i.length&&e.H(3,i)}));return{te(e){i.J(o=e)},re:(e,t)=>(s.set(e,t),i.J(e),()=>{s.delete(e),i.L(e)}),p:i.C}})(p,f),h=((e,t)=>{let r,o,n=a();const s=t?"scrollLeft":"scrollTop",l=t?"overflowX":"overflowY",[c,u]=O(e,(()=>n[0]),((e,o)=>{e=I(e,t),o?r.scrollTo({[t?"left":"top"]:e,behavior:"smooth"}):r[s]=e}));return{oe(i){r=i,o=k(e,i,t,(()=>I(i[s],t)),((t,r,o)=>{if(o){const e=i.style,t=e[l];e[l]="hidden",w((()=>{e[l]=t}))}i[s]=e.T()+t,r&&u()})),n[1](!0)},p(){o&&o.C(),n[1](!1),n=a()},ne(e){c((()=>e))},se(t){t+=e.T(),c((()=>t))},ie(t,{align:r,smooth:o,offset:n=0}={}){if(t=i(t,0,e.q()-1),"nearest"===r){const o=e.O(t),n=e.T();if(o<n)r="start";else{if(!(o+e.j(t)>n+e.M()))return;r="end"}}c((()=>n+e.N()+e.O(t)+("end"===r?e.j(t)-e.M():"center"===r?(e.j(t)-e.M())/2:0)),o)},le:()=>{o&&o.F()}}})(p,f),_=e.ref(p.m());p.A(1,(()=>{_.value=p.m()})),p.A(4,(()=>{n("scroll",p.T())})),p.A(8,(()=>{n("scrollEnd")}));const b=e.computed((e=>{_.value;const t=p.v(r.bufferSize);return e&&T(e,t)?e:t})),v=e.computed((()=>_.value&&p.B())),S=e.computed((()=>_.value&&p.P()));return e.onMounted((()=>{u=!1;const t=requestAnimationFrame((()=>{const e=e=>{m.te(e),h.oe(e)};r.scrollRef?e(r.scrollRef):e(d.value.parentElement)}));e.onUnmounted((()=>{cancelAnimationFrame(t)}))})),e.onUnmounted((()=>{p.p(),m.p(),h.p()})),e.watch((()=>r.data.length),(e=>{p.H(5,[e,r.shift])})),e.watch((()=>r.startMargin),(e=>{p.H(6,e)}),{immediate:!0}),e.watch([_],(()=>{h.le()}),{flush:"post"}),s({get scrollOffset(){return p.T()},get scrollSize(){return(e=>o(e.P(),e.M()))(p)},get viewportSize(){return p.M()},findStartIndex:p.S,findEndIndex:p.I,getItemOffset:p.O,getItemSize:p.j,scrollToIndex:h.ie,scrollTo:h.ne,scrollBy:h.se}),()=>{const t=r.as,o=r.item,n=S.value,s=[],i=t=>{var n;const s=c.default({item:r.data[t],index:t})[0];return e.createVNode(E,{key:q(s,t),W:_,X:p,D:m.re,U:t,Y:s,G:f,K:u,Z:o,ee:null===(n=r.itemProps)||void 0===n?void 0:n.call(r,{item:r.data[t],index:t})},null,8,["_stateVersion","_store","_resizer","_index","_children","_isHorizontal","_isSSR","_as","_itemProps"])};if(r.keepMounted){const e=new Set(r.keepMounted);for(let[t,r]=b.value;t<=r;t++)e.add(t);l([...e]).forEach((e=>{s.push(i(e))}))}else for(let[e,t]=b.value;e<=t;e++)s.push(i(e));return e.createVNode(t,{ref:d,style:{contain:"size style",overflowAnchor:"none",flex:"none",position:"relative",width:f?n+"px":"100%",height:f?"100%":n+"px",pointerEvents:v.value?"none":void 0}},"function"==typeof(a=s)||"[object Object]"===Object.prototype.toString.call(a)&&!e.isVNode(a)?s:{default:()=>[s],_:2},8,["style"]);var a}}}),N={data:{type:Array,required:!0},bufferSize:Number,itemSize:Number,shift:Boolean,horizontal:Boolean,ssrCount:Number,itemProps:Function,keepMounted:Array},P=/*#__PURE__*/e.defineComponent({props:N,emits:["scroll","scrollEnd"],setup(t,{emit:r,expose:o,slots:n}){const s=t.horizontal,i=e=>{r("scroll",e)},l=()=>{r("scrollEnd")},c=e.ref();return o({get scrollOffset(){return c.value.scrollOffset},get scrollSize(){return c.value.scrollSize},get viewportSize(){return c.value.viewportSize},findStartIndex:(...e)=>c.value.findStartIndex(...e),findEndIndex:(...e)=>c.value.findEndIndex(...e),getItemOffset:(...e)=>c.value.getItemOffset(...e),getItemSize:(...e)=>c.value.getItemSize(...e),scrollToIndex:(...e)=>c.value.scrollToIndex(...e),scrollTo:(...e)=>c.value.scrollTo(...e),scrollBy:(...e)=>c.value.scrollBy(...e)}),()=>{return e.createVNode("div",{style:{display:s?"inline-block":"block",[s?"overflowX":"overflowY"]:"auto",contain:"strict",width:"100%",height:"100%"}},[e.createVNode(M,{ref:c,data:t.data,bufferSize:t.bufferSize,itemSize:t.itemSize,itemProps:t.itemProps,shift:t.shift,ssrCount:t.ssrCount,horizontal:s,keepMounted:t.keepMounted,onScroll:i,onScrollEnd:l},(r=n,"function"==typeof r||"[object Object]"===Object.prototype.toString.call(r)&&!e.isVNode(r)?n:{default:()=>[n],_:2}),8,["data","bufferSize","itemSize","itemProps","shift","ssrCount","horizontal","keepMounted","onScroll","onScrollEnd"])],4);var r}}}),R={data:{type:Array,required:!0},bufferSize:Number,itemSize:Number,shift:Boolean,horizontal:Boolean,as:{type:String,default:"div"},item:{type:String,default:"div"}},A=/*#__PURE__*/e.defineComponent({props:R,emits:["scroll","scrollEnd"],setup(r,{emit:o,slots:n,expose:s}){const l=r.horizontal,u=e.ref(),f=$(r.data.length,r.itemSize,void 0,0,!r.itemSize),d=((e,r)=>{const o=r?"width":"height",n=r?"innerWidth":"innerHeight",s=new WeakMap,i=j((r=>{const n=[];for(const{target:e,contentRect:i}of r){if(!e.offsetParent)continue;const r=s.get(e);r!=t&&n.push([r,i[o]])}n.length&&e.H(3,n)}));let l;return{te(t){const r=y(S(t)),o=()=>{e.H(4,r[n])};r.addEventListener("resize",o),c(o),l=()=>{r.removeEventListener("resize",o)}},re:(e,t)=>(s.set(e,t),i.J(e),()=>{s.delete(e),i.L(e)}),p(){l&&l(),i.C()}}})(f,l),p=((e,t)=>{let r,o,n=a();const s=t?"left":"top",[l]=O(e,(()=>n[0]),((e,o)=>{e=I(e,t);const n=y(S(r));o?n.scroll({[s]:e,behavior:"smooth"}):n.scroll({[s]:e})})),c=(e,t,r,o,n=0)=>{const s=o?"offsetLeft":"offsetTop",i=n+(o&&g()?r.innerWidth-e[s]-e.offsetWidth:e[s]),l=e.offsetParent;return e!==t&&l?c(l,t,r,o,i):i};return{oe(i){r=i;const l=t?"scrollX":"scrollY",a=S(i),u=y(a);o=k(e,u,t,(()=>I(u[l],t)),((t,r)=>{r?u.scroll({[s]:e.T()+t}):u.scrollBy({[s]:t})}),(()=>c(i,a.body,u,t))),n[1](!0)},p(){o&&o.C(),r=void 0,n[1](!1),n=a()},le:()=>{o&&o.F()},ie(o,{align:n,smooth:s,offset:a=0}={}){if(!r)return;if(o=i(o,0,e.q()-1),"nearest"===n){const t=e.O(o),r=e.T();if(t<r)n="start";else{if(!(t+e.j(o)>r+e.M()))return;n="end"}}const u=S(r),f=y(u),d=u.documentElement,p=()=>e.M()-(t?d.clientWidth:d.clientHeight);l((()=>a+c(r,u.body,f,t)+e.O(o)+("end"===n?e.j(o)-(e.M()-p()):"center"===n?(e.j(o)-(e.M()-p()))/2:0)),s)}}})(f,l),m=e.ref(f.m());f.A(1,(()=>{m.value=f.m()})),f.A(4,(()=>{o("scroll")})),f.A(8,(()=>{o("scrollEnd")}));const h=e.computed((e=>{m.value;const t=f.v(r.bufferSize);return e&&T(e,t)?e:t})),_=e.computed((()=>m.value&&f.B())),b=e.computed((()=>m.value&&f.P()));return e.onMounted((()=>{const e=u.value;e&&(d.te(e),p.oe(e))})),e.onUnmounted((()=>{f.p(),d.p(),p.p()})),e.watch((()=>r.data.length),(e=>{f.H(5,[e,r.shift])})),e.watch([m],(()=>{p.le()}),{flush:"post"}),s({findStartIndex:f.S,findEndIndex:f.I,scrollToIndex:p.ie}),()=>{const t=r.as,o=r.item,s=b.value,i=[];for(let[t,s]=h.value;t<=s;t++){const s=n.default({item:r.data[t],index:t})[0];i.push(e.createVNode(E,{key:q(s,t),W:m,X:f,D:d.re,U:t,Y:s,G:l,Z:o},null,8,["_stateVersion","_store","_resizer","_index","_children","_isHorizontal","_as"]))}return e.createVNode(t,{ref:u,style:{contain:"size style",overflowAnchor:"none",flex:"none",position:"relative",width:l?s+"px":"100%",height:l?"100%":s+"px",pointerEvents:_.value?"none":void 0}},"function"==typeof(c=i)||"[object Object]"===Object.prototype.toString.call(c)&&!e.isVNode(c)?i:{default:()=>[i],_:2},8,["style"]);var c}}});exports.VList=P,exports.Virtualizer=M,exports.WindowVirtualizer=A;
1
+ var e=require("vue");const t=null,{min:r,max:o,abs:n,floor:s}=Math,i=(e,t,n)=>r(n,o(t,e)),l=e=>[...e].sort(((e,t)=>e-t)),c="function"==typeof queueMicrotask?queueMicrotask:e=>{Promise.resolve().then(e)},a=()=>{let e;return[new Promise((t=>{e=t})),e]},u=e=>{let t;return()=>(e&&(t=e(),e=void 0),t)},f=(e,t,r)=>{const o=r?"unshift":"push";for(let r=0;r<t;r++)e[o](-1);return e},d=(e,t)=>{const r=e.t[t];return-1===r?e.o:r},p=(e,t,o)=>{const n=-1===e.t[t];return e.t[t]=o,e.i=r(t,e.i),n},h=(e,t)=>{if(!e.l)return 0;if(e.i>=t)return e.u[t];e.i<0&&(e.u[0]=0,e.i=0);let r=e.i,o=e.u[r];for(;r<t;)o+=d(e,r),e.u[++r]=o;return e.i=t,o},m=(e,t,r=0,o=e.l-1)=>{for(;r<=o;){const n=s((r+o)/2);if(h(e,n)<=t){if(h(e,n+1)>t)return n;r=n+1}else o=n-1}return i(r,0,e.l-1)},b=(e,t,o)=>{const n=t-e.l;return e.i=o?-1:r(t-1,e.i),e.l=t,n>0?(f(e.u,n),f(e.t,n,o),e.o*n):(e.u.splice(n),(o?e.t.splice(0,-n):e.t.splice(n)).reduce(((t,r)=>t-(-1===r?e.o:r)),0))},_="undefined"!=typeof window,v=()=>document.documentElement,S=e=>e.ownerDocument,y=e=>e.defaultView,g=/*#__PURE__*/u((()=>!!_&&"rtl"===getComputedStyle(v()).direction)),z=/*#__PURE__*/u((()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>0)),x=/*#__PURE__*/u((()=>"scrollBehavior"in v().style)),$=(e,s=40,i=0,c,a=!1)=>{let u=!!i,_=1,v=0,S=0,y=0,g=0,x=0,$=0,w=0,I=0,k=t,O=[0,u?o(i-1,0):-1],j=0;const E=((e,t,n)=>({o:n?n[1]:t,t:n&&n[0]?f(n[0].slice(0,r(e,n[0].length)),o(0,e-n[0].length)):f([],e),l:e,i:-1,u:f([],e+1)}))(e,s,c),q=new Set,T=()=>y-S,B=()=>T()+x+g,M=(e,t)=>((e,t,o,n)=>{if(n=r(n,e.l-1),h(e,n)<=t){const r=m(e,o,n);return[m(e,t,n,r),r]}{const r=m(e,t,void 0,n);return[r,m(e,o,r)]}})(E,e,t,O[0]),N=()=>h(E,E.l),P=e=>h(E,e)-x,R=e=>d(E,e),A=(e,t=-1)=>E.t[e]===t,H=e=>{e&&(z()&&0!==w||k&&1===I?x+=e:g+=e)};return{p:()=>{q.clear()},h:()=>_,m:()=>(e=>[e.t.slice(),e.o])(E),v:(e=200)=>{if(!v||u)return O;let t,n;if($)[t,n]=O;else{let s=o(0,B()),i=s+v;a||(e=o(0,e),1!==w&&(s-=e),2!==w&&(i+=e)),[t,n]=O=M(o(0,s),o(0,i)),k&&(t=r(t,k[0]),n=o(n,k[1]))}return[o(t,0),r(n,E.l-1)]},S:()=>m(E,B()),I:()=>m(E,B()+v),k:A,O:P,j:R,q:()=>E.l,T:()=>y,B:()=>0!==w,M:()=>v,N:()=>S,P:N,R:()=>($=g,g=0,[$,2===I]),A:(e,t)=>{const r=[e,t];return q.add(r),()=>{q.delete(r)}},H:(e,r)=>{let s,i,c=0;switch(e){case 1:{if(r===y&&0===I)break;const e=$;$=0;const t=r-y,o=n(t);e&&o<n(e)+1||0!==I||(w=t<0?2:1),u&&(u=!1),y=r,c=4;const s=T();s>=-v&&s<=N()&&(c+=1,i=o>v);break}case 2:c=8,0!==w&&(s=!0,c+=1),w=0,I=0,k=t;break;case 3:{const e=r.filter((([e,t])=>!A(e,t)));if(!e.length)break;H(e.reduce(((e,[t,r])=>((2===I||(k&&1===I?t<k[0]:P(t+(0===w&&0===I?1:0))<T()))&&(e+=r-R(t)),e)),0));for(const[t,r]of e){const e=R(t),o=p(E,t,r);a&&(j+=o?r:r-e)}a&&v&&j>v&&(H(((e,t)=>{let r=0;const n=[];e.t.forEach(((e,o)=>{-1!==e&&(n.push(e),o<t&&r++)})),e.i=-1;const s=l(n),i=s.length,c=i/2|0,a=i%2==0?(s[c-1]+s[c])/2:s[c],u=e.o;return((e.o=a)-u)*o(t-r,0)})(E,m(E,B()))),a=!1),c=3,i=!0;break}case 4:v!==r&&(v||(i=!0),v=r,c=3);break;case 5:r[1]?(H(b(E,r[0],!0)),I=2,c=1):(b(E,r[0]),c=1);break;case 6:S=r;break;case 7:I=1;break;case 8:k=M(r,r+v),c=1}c&&(_=1+(2147483647&_),s&&x&&(g+=x,x=0),q.forEach((([e,t])=>{c&e&&t(i)})))}}},w=setTimeout,I=(e,t)=>t&&g()?-e:e,k=(e,r,o,n,s,i)=>{const l=Date.now;let c=0,a=!1,u=!1,f=!1,d=!1;const p=(()=>{let r;const o=()=>{r!=t&&clearTimeout(r)},n=()=>{o(),r=w((()=>{r=t,(()=>{if(a||u)return a=!1,void p();f=!1,e.H(2)})()}),150)};return n.V=o,n})(),h=()=>{c=l(),f&&(d=!0),i&&e.H(6,i()),e.H(1,n()),p()},m=t=>{if(a||!e.B()||t.ctrlKey)return;const r=l()-c;150>r&&50<r&&(o?t.deltaX:t.deltaY)&&(a=!0)},b=()=>{u=!0,f=d=!1},_=()=>{u=!1,z()&&(f=!0)};return r.addEventListener("scroll",h),r.addEventListener("wheel",m,{passive:!0}),r.addEventListener("touchstart",b,{passive:!0}),r.addEventListener("touchend",_,{passive:!0}),{C:()=>{r.removeEventListener("scroll",h),r.removeEventListener("wheel",m),r.removeEventListener("touchstart",b),r.removeEventListener("touchend",_),p.V()},F:()=>{const[t,r]=e.R();t&&(s(I(t,o),r,d),d=!1,r&&e.M()>e.P()&&e.H(1,n()))}}},O=(e,t,r)=>{let o;return[async(n,s)=>{if(!await t())return;o&&o();const i=()=>{const[t,r]=a();return o=()=>{r(!1)},e.M()&&w(o,150),[t,e.A(2,(()=>{r(!0)}))]};if(s&&x())e.H(8,n()),c((async()=>{for(;;){let t=!0;for(let[r,o]=e.v();r<=o;r++)if(e.k(r)){t=!1;break}if(t)break;const[r,o]=i();try{if(!await r)return}finally{o()}}e.H(7),r(n(),s)}));else for(;;){const[t,o]=i();try{if(e.H(7),r(n()),!await t)return}finally{o()}}},()=>{o&&o()}]},j=e=>{let t;return{J(r){(t||(t=new(y(S(r)).ResizeObserver)(e))).observe(r)},L(e){t.unobserve(e)},C(){t&&t.disconnect()}}},E=/*#__PURE__*/e.defineComponent({props:{W:{type:Object,required:!0},X:{type:Object,required:!0},Y:{type:Object,required:!0},D:{type:Function,required:!0},U:{type:Number,required:!0},G:{type:Boolean},K:{type:Boolean},Z:{type:String,required:!0},ee:Object},setup(t){const r=e.ref(),o=e.computed((()=>t.W.value&&t.X.O(t.U))),n=e.computed((()=>t.W.value&&t.X.k(t.U)));return e.watch((()=>r.value&&t.U),((e,o,n)=>{n(t.D(r.value,t.U))}),{flush:"post"}),()=>{var s;const{Y:i,G:l,K:c,Z:a}=t,u=n.value,{style:f,...d}=null!==(s=t.ee)&&void 0!==s?s:{},p={contain:"layout style",position:u&&c?void 0:"absolute",[l?"height":"width"]:"100%",[l?"top":"left"]:"0px",[l?g()?"right":"left":"top"]:o.value+"px",visibility:!u||c?void 0:"hidden",...f};return l&&(p.display="inline-flex"),e.createVNode(a,e.mergeProps({ref:r,style:p},d),"function"==typeof(h=i)||"[object Object]"===Object.prototype.toString.call(h)&&!e.isVNode(h)?i:{default:()=>[i],_:2},16,["style"]);var h}}}),q=(e,t)=>{const r=e.key;return null!=r?r:"_"+t},T=(e,t)=>e[0]===t[0]&&e[1]===t[1],B={data:{type:Array,required:!0},bufferSize:Number,itemSize:Number,shift:Boolean,horizontal:Boolean,startMargin:{type:Number,default:0},ssrCount:Number,scrollRef:Object,as:{type:String,default:"div"},item:{type:String,default:"div"},itemProps:Function,keepMounted:Array,cache:Object},M=/*#__PURE__*/e.defineComponent({props:B,emits:["scroll","scrollEnd"],setup(r,{emit:n,expose:s,slots:c}){let u=!!r.ssrCount;const f=r.horizontal,d=e.ref(),p=$(r.data.length,r.itemSize,r.ssrCount,r.cache,!r.itemSize),h=((e,r)=>{let o;const n=r?"width":"height",s=new WeakMap,i=j((r=>{const i=[];for(const{target:l,contentRect:c}of r)if(l.offsetParent)if(l===o)e.H(4,c[n]);else{const e=s.get(l);e!=t&&i.push([e,c[n]])}i.length&&e.H(3,i)}));return{te(e){i.J(o=e)},re:(e,t)=>(s.set(e,t),i.J(e),()=>{s.delete(e),i.L(e)}),p:i.C}})(p,f),m=((e,t)=>{let r,o,n=a();const s=t?"scrollLeft":"scrollTop",l=t?"overflowX":"overflowY",[c,u]=O(e,(()=>n[0]),((e,o)=>{e=I(e,t),o?r.scrollTo({[t?"left":"top"]:e,behavior:"smooth"}):r[s]=e}));return{oe(i){r=i,o=k(e,i,t,(()=>I(i[s],t)),((t,r,o)=>{if(o){const e=i.style,t=e[l];e[l]="hidden",w((()=>{e[l]=t}))}i[s]=e.T()+t,r&&u()})),n[1](!0)},p(){o&&o.C(),n[1](!1),n=a()},ne(e){c((()=>e))},se(t){t+=e.T(),c((()=>t))},ie(t,{align:r,smooth:o,offset:n=0}={}){if(t=i(t,0,e.q()-1),"nearest"===r){const o=e.O(t),n=e.T();if(o<n)r="start";else{if(!(o+e.j(t)>n+e.M()))return;r="end"}}c((()=>n+e.N()+e.O(t)+("end"===r?e.j(t)-e.M():"center"===r?(e.j(t)-e.M())/2:0)),o)},le:()=>{o&&o.F()}}})(p,f),b=e.ref(p.h());p.A(1,(()=>{b.value=p.h()})),p.A(4,(()=>{n("scroll",p.T())})),p.A(8,(()=>{n("scrollEnd")}));const _=e.computed((e=>{b.value;const t=p.v(r.bufferSize);return e&&T(e,t)?e:t})),v=e.computed((()=>b.value&&p.B())),S=e.computed((()=>b.value&&p.P()));return e.onMounted((()=>{u=!1;const t=requestAnimationFrame((()=>{const e=e=>{h.te(e),m.oe(e)};r.scrollRef?e(r.scrollRef):e(d.value.parentElement)}));e.onUnmounted((()=>{cancelAnimationFrame(t)}))})),e.onUnmounted((()=>{p.p(),h.p(),m.p()})),e.watch((()=>r.data.length),(e=>{p.H(5,[e,r.shift])})),e.watch((()=>r.startMargin),(e=>{p.H(6,e)}),{immediate:!0}),e.watch([b],(()=>{m.le()}),{flush:"post"}),s({get cache(){return p.m()},get scrollOffset(){return p.T()},get scrollSize(){return(e=>o(e.P(),e.M()))(p)},get viewportSize(){return p.M()},findStartIndex:p.S,findEndIndex:p.I,getItemOffset:p.O,getItemSize:p.j,scrollToIndex:m.ie,scrollTo:m.ne,scrollBy:m.se}),()=>{const t=r.as,o=r.item,n=S.value,s=[],i=t=>{var n;const s=c.default({item:r.data[t],index:t})[0];return e.createVNode(E,{key:q(s,t),W:b,X:p,D:h.re,U:t,Y:s,G:f,K:u,Z:o,ee:null===(n=r.itemProps)||void 0===n?void 0:n.call(r,{item:r.data[t],index:t})},null,8,["_stateVersion","_store","_resizer","_index","_children","_isHorizontal","_isSSR","_as","_itemProps"])};if(r.keepMounted){const e=new Set(r.keepMounted);for(let[t,r]=_.value;t<=r;t++)e.add(t);l([...e]).forEach((e=>{s.push(i(e))}))}else for(let[e,t]=_.value;e<=t;e++)s.push(i(e));return e.createVNode(t,{ref:d,style:{contain:"size style",overflowAnchor:"none",flex:"none",position:"relative",width:f?n+"px":"100%",height:f?"100%":n+"px",pointerEvents:v.value?"none":void 0}},"function"==typeof(a=s)||"[object Object]"===Object.prototype.toString.call(a)&&!e.isVNode(a)?s:{default:()=>[s],_:2},8,["style"]);var a}}}),N={data:{type:Array,required:!0},bufferSize:Number,itemSize:Number,shift:Boolean,horizontal:Boolean,ssrCount:Number,itemProps:Function,keepMounted:Array,cache:Object},P=/*#__PURE__*/e.defineComponent({props:N,emits:["scroll","scrollEnd"],setup(t,{emit:r,expose:o,slots:n}){const s=t.horizontal,i=e=>{r("scroll",e)},l=()=>{r("scrollEnd")},c=e.ref();return o({get cache(){return c.value.cache},get scrollOffset(){return c.value.scrollOffset},get scrollSize(){return c.value.scrollSize},get viewportSize(){return c.value.viewportSize},findStartIndex:(...e)=>c.value.findStartIndex(...e),findEndIndex:(...e)=>c.value.findEndIndex(...e),getItemOffset:(...e)=>c.value.getItemOffset(...e),getItemSize:(...e)=>c.value.getItemSize(...e),scrollToIndex:(...e)=>c.value.scrollToIndex(...e),scrollTo:(...e)=>c.value.scrollTo(...e),scrollBy:(...e)=>c.value.scrollBy(...e)}),()=>{return e.createVNode("div",{style:{display:s?"inline-block":"block",[s?"overflowX":"overflowY"]:"auto",contain:"strict",width:"100%",height:"100%"}},[e.createVNode(M,{ref:c,data:t.data,bufferSize:t.bufferSize,itemSize:t.itemSize,itemProps:t.itemProps,shift:t.shift,ssrCount:t.ssrCount,horizontal:s,keepMounted:t.keepMounted,cache:t.cache,onScroll:i,onScrollEnd:l},(r=n,"function"==typeof r||"[object Object]"===Object.prototype.toString.call(r)&&!e.isVNode(r)?n:{default:()=>[n],_:2}),8,["data","bufferSize","itemSize","itemProps","shift","ssrCount","horizontal","keepMounted","cache","onScroll","onScrollEnd"])],4);var r}}}),R={data:{type:Array,required:!0},bufferSize:Number,itemSize:Number,shift:Boolean,horizontal:Boolean,as:{type:String,default:"div"},item:{type:String,default:"div"},cache:Object},A=/*#__PURE__*/e.defineComponent({props:R,emits:["scroll","scrollEnd"],setup(r,{emit:o,slots:n,expose:s}){const l=r.horizontal,u=e.ref(),f=$(r.data.length,r.itemSize,void 0,r.cache,!r.itemSize),d=((e,r)=>{const o=r?"width":"height",n=r?"innerWidth":"innerHeight",s=new WeakMap,i=j((r=>{const n=[];for(const{target:e,contentRect:i}of r){if(!e.offsetParent)continue;const r=s.get(e);r!=t&&n.push([r,i[o]])}n.length&&e.H(3,n)}));let l;return{te(t){const r=y(S(t)),o=()=>{e.H(4,r[n])};r.addEventListener("resize",o),c(o),l=()=>{r.removeEventListener("resize",o)}},re:(e,t)=>(s.set(e,t),i.J(e),()=>{s.delete(e),i.L(e)}),p(){l&&l(),i.C()}}})(f,l),p=((e,t)=>{let r,o,n=a();const s=t?"left":"top",[l]=O(e,(()=>n[0]),((e,o)=>{e=I(e,t);const n=y(S(r));o?n.scroll({[s]:e,behavior:"smooth"}):n.scroll({[s]:e})})),c=(e,t,r,o,n=0)=>{const s=o?"offsetLeft":"offsetTop",i=n+(o&&g()?r.innerWidth-e[s]-e.offsetWidth:e[s]),l=e.offsetParent;return e!==t&&l?c(l,t,r,o,i):i};return{oe(i){r=i;const l=t?"scrollX":"scrollY",a=S(i),u=y(a);o=k(e,u,t,(()=>I(u[l],t)),((t,r)=>{r?u.scroll({[s]:e.T()+t}):u.scrollBy({[s]:t})}),(()=>c(i,a.body,u,t))),n[1](!0)},p(){o&&o.C(),r=void 0,n[1](!1),n=a()},le:()=>{o&&o.F()},ie(o,{align:n,smooth:s,offset:a=0}={}){if(!r)return;if(o=i(o,0,e.q()-1),"nearest"===n){const t=e.O(o),r=e.T();if(t<r)n="start";else{if(!(t+e.j(o)>r+e.M()))return;n="end"}}const u=S(r),f=y(u),d=u.documentElement,p=()=>e.M()-(t?d.clientWidth:d.clientHeight);l((()=>a+c(r,u.body,f,t)+e.O(o)+("end"===n?e.j(o)-(e.M()-p()):"center"===n?(e.j(o)-(e.M()-p()))/2:0)),s)}}})(f,l),h=e.ref(f.h());f.A(1,(()=>{h.value=f.h()})),f.A(4,(()=>{o("scroll")})),f.A(8,(()=>{o("scrollEnd")}));const m=e.computed((e=>{h.value;const t=f.v(r.bufferSize);return e&&T(e,t)?e:t})),b=e.computed((()=>h.value&&f.B())),_=e.computed((()=>h.value&&f.P()));return e.onMounted((()=>{const e=u.value;e&&(d.te(e),p.oe(e))})),e.onUnmounted((()=>{f.p(),d.p(),p.p()})),e.watch((()=>r.data.length),(e=>{f.H(5,[e,r.shift])})),e.watch([h],(()=>{p.le()}),{flush:"post"}),s({get cache(){return f.m()},findStartIndex:f.S,findEndIndex:f.I,scrollToIndex:p.ie}),()=>{const t=r.as,o=r.item,s=_.value,i=[];for(let[t,s]=m.value;t<=s;t++){const s=n.default({item:r.data[t],index:t})[0];i.push(e.createVNode(E,{key:q(s,t),W:h,X:f,D:d.re,U:t,Y:s,G:l,Z:o},null,8,["_stateVersion","_store","_resizer","_index","_children","_isHorizontal","_as"]))}return e.createVNode(t,{ref:u,style:{contain:"size style",overflowAnchor:"none",flex:"none",position:"relative",width:l?s+"px":"100%",height:l?"100%":s+"px",pointerEvents:b.value?"none":void 0}},"function"==typeof(c=i)||"[object Object]"===Object.prototype.toString.call(c)&&!e.isVNode(c)?i:{default:()=>[i],_:2},8,["style"]);var c}}});exports.VList=P,exports.Virtualizer=M,exports.WindowVirtualizer=A;
2
2
  //# sourceMappingURL=index.cjs.map