@pdanpdan/virtual-scroll 0.6.0 → 0.7.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/dist/index.d.ts CHANGED
@@ -366,6 +366,9 @@ export declare class FenwickTree {
366
366
  */
367
367
  export declare function findPrevStickyIndex(stickyIndices: number[], index: number): number | undefined;
368
368
 
369
+ /** Helper to get ARIA attributes for an item. */
370
+ export declare type GetItemAriaProps = (index: number) => Record<string, string | number | undefined>;
371
+
369
372
  /**
370
373
  * Extracts the horizontal padding from a padding configuration.
371
374
  *
@@ -487,10 +490,14 @@ export declare interface ItemSlotProps<T = unknown> {
487
490
  item: T;
488
491
  /** The 0-based index of the item. */
489
492
  index: number;
493
+ /** Helper to get ARIA attributes for the item. */
494
+ getItemAriaProps: GetItemAriaProps;
490
495
  /** Information about the currently visible range of columns. */
491
496
  columnRange: ColumnRange;
492
497
  /** Helper to get the current calculated width of any column index. */
493
498
  getColumnWidth: (index: number) => number;
499
+ /** Helper to get ARIA attributes for a cell. */
500
+ getCellAriaProps: (colIndex: number) => Record<string, string | number | undefined>;
494
501
  /** Vertical gap between items. */
495
502
  gap: number;
496
503
  /** Horizontal gap between columns. */
@@ -1141,6 +1148,7 @@ export declare function useVirtualScrollbar(props: UseVirtualScrollbarProps): {
1141
1148
  inlineSize?: never;
1142
1149
  };
1143
1150
  role: string;
1151
+ 'aria-label': string | undefined;
1144
1152
  'aria-orientation': ScrollAxis;
1145
1153
  'aria-valuenow': number;
1146
1154
  'aria-valuemin': number;
@@ -1193,6 +1201,8 @@ export declare interface UseVirtualScrollbarProps {
1193
1201
  containerId?: MaybeRefOrGetter<string | undefined>;
1194
1202
  /** Whether the scrollbar is in Right-to-Left (RTL) mode. */
1195
1203
  isRtl?: MaybeRefOrGetter<boolean>;
1204
+ /** Accessible label for the scrollbar. */
1205
+ ariaLabel?: MaybeRefOrGetter<string | undefined>;
1196
1206
  }
1197
1207
 
1198
1208
  export declare const VirtualScroll: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
@@ -1237,6 +1247,16 @@ export declare const VirtualScroll: <T>(__VLS_props: NonNullable<Awaited<typeof
1237
1247
  */
1238
1248
  getRowHeight: (index: number) => number;
1239
1249
  /**
1250
+ * Helper to get ARIA attributes for a cell.
1251
+ * @param colIndex - The column index.
1252
+ */
1253
+ getCellAriaProps: (colIndex: number) => Record<string, string | number | undefined>;
1254
+ /**
1255
+ * Helper to get ARIA attributes for an item.
1256
+ * @param index - The item index.
1257
+ */
1258
+ getItemAriaProps: (index: number) => Record<string, string | number | undefined>;
1259
+ /**
1240
1260
  * Helper to get the virtual offset of a specific row.
1241
1261
  * @param index - The row index.
1242
1262
  * @see useVirtualScroll
@@ -1346,6 +1366,9 @@ export declare const VirtualScroll: <T>(__VLS_props: NonNullable<Awaited<typeof
1346
1366
  initialScrollAlign: Ref<ScrollAlignment | ScrollAlignmentOptions | undefined, ScrollAlignment | ScrollAlignmentOptions | undefined>;
1347
1367
  defaultItemSize: Ref<number | undefined, number | undefined>;
1348
1368
  defaultColumnWidth: Ref<number | undefined, number | undefined>;
1369
+ role: Ref<string | undefined, string | undefined>;
1370
+ ariaLabel: Ref<string | undefined, string | undefined>;
1371
+ ariaLabelledby: Ref<string | undefined, string | undefined>;
1349
1372
  direction: Ref<ScrollDirection, ScrollDirection>;
1350
1373
  bufferBefore: Ref<number, number>;
1351
1374
  bufferAfter: Ref<number, number>;
@@ -1365,6 +1388,7 @@ export declare const VirtualScroll: <T>(__VLS_props: NonNullable<Awaited<typeof
1365
1388
  restoreScrollOnPrepend: Ref<boolean, boolean>;
1366
1389
  debug: Ref<boolean, boolean>;
1367
1390
  virtualScrollbar: Ref<boolean, boolean>;
1391
+ itemRole: Ref<string | undefined, string | undefined>;
1368
1392
  }>): void;
1369
1393
  attrs: any;
1370
1394
  slots: Readonly<{
@@ -1476,6 +1500,10 @@ export declare interface VirtualScrollbarProps {
1476
1500
  * @default false
1477
1501
  */
1478
1502
  isRtl?: boolean;
1503
+ /**
1504
+ * Accessible label for the scrollbar.
1505
+ */
1506
+ ariaLabel?: string;
1479
1507
  }
1480
1508
 
1481
1509
  /** Base configuration properties shared between the component and the composable. */
@@ -1577,6 +1605,25 @@ export declare interface VirtualScrollBaseProps<T = unknown> {
1577
1605
  * Enable debug visualization of buffers and indices.
1578
1606
  */
1579
1607
  debug?: boolean | undefined;
1608
+ /**
1609
+ * ARIA role for the scroll container.
1610
+ * Defaults to 'list' for vertical/horizontal and 'grid' for both.
1611
+ */
1612
+ role?: string | undefined;
1613
+ /**
1614
+ * ARIA label for the scroll container.
1615
+ */
1616
+ ariaLabel?: string | undefined;
1617
+ /**
1618
+ * ID of the element that labels the scroll container.
1619
+ */
1620
+ ariaLabelledby?: string | undefined;
1621
+ /**
1622
+ * ARIA role for each rendered item.
1623
+ * Defaults to 'listitem' for list roles and 'row' for grid roles.
1624
+ * Set to 'none' or 'presentation' to disable automatic role assignment on the wrapper.
1625
+ */
1626
+ itemRole?: string | undefined;
1580
1627
  }
1581
1628
 
1582
1629
  /** Configuration properties for the `VirtualScroll` component. */
@@ -1605,6 +1652,8 @@ export declare interface VirtualScrollInstance<T = unknown> extends VirtualScrol
1605
1652
  getColumnWidth: (index: number) => number;
1606
1653
  /** Helper to get the height of a specific row. */
1607
1654
  getRowHeight: (index: number) => number;
1655
+ /** Helper to get ARIA attributes for a cell. */
1656
+ getCellAriaProps: (colIndex: number) => Record<string, string | number | undefined>;
1608
1657
  /** Helper to get the virtual offset of a specific row. */
1609
1658
  getRowOffset: (index: number) => number;
1610
1659
  /** Helper to get the virtual offset of a specific column. */
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`)):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.VirtualScroll={},e.Vue))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let n={items:[],currentIndex:0,currentColIndex:0,currentEndIndex:0,currentEndColIndex:0,scrollOffset:{x:0,y:0},displayScrollOffset:{x:0,y:0},viewportSize:{width:0,height:0},displayViewportSize:{width:0,height:0},totalSize:{width:0,height:0},isScrolling:!1,isProgrammaticScroll:!1,range:{start:0,end:0},columnRange:{start:0,end:0,padStart:0,padEnd:0}};var r=class{tree;values;constructor(e){this.tree=new Float64Array(e+1),this.values=new Float64Array(e)}update(e,t){if(!(e<0||e>=this.values.length))for(this.values[e]=this.values[e]+t,e++;e<this.tree.length;)this.tree[e]=this.tree[e]+t,e+=e&-e}query(e){let t=0;for(;e>0;)t+=this.tree[e]||0,e-=e&-e;return t}set(e,t){e<0||e>=this.values.length||(this.values[e]=t)}get length(){return this.values.length}get(e){return this.values[e]||0}getValues(){return this.values}findLowerBound(e){let t=0,n=this.tree.length,r=1<<Math.floor(Math.log2(n-1));for(;r>0;){let i=t+r;if(i<n){let n=this.tree[i]||0;n<=e&&(t=i,e-=n)}r>>=1}return t}rebuild(){this.tree.fill(0);for(let e=0;e<this.values.length;e++)this.tree[e+1]=this.values[e]||0;for(let e=1;e<this.tree.length;e++){let t=e+(e&-e);t<this.tree.length&&(this.tree[t]=this.tree[t]+this.tree[e])}}resize(e){if(e===this.values.length)return;let t=new Float64Array(e);t.set(this.values.subarray(0,Math.min(e,this.values.length))),this.values=t,this.tree=new Float64Array(e+1),this.rebuild()}shift(e){if(e===0)return;let t=this.values.length,n=new Float64Array(t);e>0?n.set(this.values.subarray(0,Math.min(t-e,this.values.length)),e):n.set(this.values.subarray(-e)),this.values=n,this.rebuild()}};let i=1e7;function a(e){return e===null||e===document.documentElement||typeof window<`u`&&e===window}function o(e){return typeof e==`object`&&!!e&&`tagName`in e&&e.tagName===`BODY`}function s(e){return a(e)||o(e)}function c(e){return e!=null&&`getBoundingClientRect`in e}function l(e){return e!=null&&`scrollLeft`in e}function u(e,t){a(e)?window.scrollTo(t):e!=null&&l(e)&&(typeof e.scrollTo==`function`?e.scrollTo(t):(t.left!==void 0&&(e.scrollLeft=t.left),t.top!==void 0&&(e.scrollTop=t.top)))}function d(e){return typeof e==`object`&&!!e&&(`align`in e||`behavior`in e||`isCorrection`in e)}function f(e,t){return typeof e==`object`&&e?e.x||0:(t===`horizontal`||t===`both`)&&e||0}function p(e,t){return typeof e==`object`&&e?e.y||0:(t===`vertical`||t===`both`)&&e||0}function m({scrollPos:e,containerSize:t,count:n,bufferBefore:r,bufferAfter:i,gap:a,fixedSize:o,findLowerBound:s,query:c}){let l=0,u=n,d=e+t;if(o!==null){let t=o+a;l=Math.floor(e/t),u=Math.ceil(d/t)}else l=s(e),u=s(d),u<n&&c(u)<d&&u++;return{start:Math.max(0,l-r),end:Math.min(n,u+i)}}function h(e,t){let n=0,r=e.length-1,i;for(;n<=r;){let a=n+r>>>1;e[a]>t?(i=e[a],r=a-1):n=a+1}return i}function g(e,t){let n=0,r=e.length-1,i;for(;n<=r;){let a=n+r>>>1;e[a]<t?(i=e[a],n=a+1):r=a-1}return i}function _({align:e,targetPos:t,itemSize:n,scrollPos:r,viewSize:i,stickyOffsetStart:a,stickyOffsetEnd:o}){let s=t-a,c=t-(i-o-n);return e===`start`?{target:s,effectiveAlign:`start`}:e===`center`?{target:t-a-(i-a-o-n)/2,effectiveAlign:`center`}:e===`end`?{target:c,effectiveAlign:`end`}:x(t,n,r,i,a,o)?{target:r,effectiveAlign:`auto`}:n<=i-a-o?t<r+a?{target:s,effectiveAlign:`start`}:{target:c,effectiveAlign:`end`}:Math.abs(s-r)<Math.abs(c-r)?{target:s,effectiveAlign:`start`}:{target:c,effectiveAlign:`end`}}function v(e,t,n,r){return e<=0?0:t===null?Math.max(0,r(e)-n):Math.max(0,e*(t+n)-n)}function y({index:e,align:t,viewSize:n,scrollPos:r,fixedSize:i,gap:a,query:o,getSize:s,stickyIndices:c,stickyStart:l,stickyEnd:u=0}){let d=l;if(c&&c.length>0){let t=g(c,e);t!==void 0&&(d+=v(1,i,0,()=>s(t)))}let f=i===null?o(e):e*(i+a),p=i===null?s(e)-a:i,{target:m,effectiveAlign:h}=_({align:t,targetPos:f,itemSize:p,scrollPos:r,viewSize:n,stickyOffsetStart:d,stickyOffsetEnd:u});return{target:m,itemSize:p,effectiveAlign:h}}function b(e,t,n,r,i,a){if(e<=t)return{isActive:!1,offset:0};let o=h(i,r);if(o===void 0)return{isActive:!0,offset:0};let s=a(o);return e>=s?{isActive:!1,offset:0}:{isActive:!0,offset:Math.max(0,Math.min(n,s-e))-n}}function x(e,t,n,r,i=0,a=0){let o=n+i,s=n+r-a;return t<=r-i-a?e>=o-.5&&e+t<=s+.5:e<=o+.5&&e+t>=s-.5}function S(e,t,n){return(e-t)*n}function C(e,t,n){return e/n+t}function ee({rowIndex:e,colIndex:t,options:n,direction:r,viewportWidth:a,viewportHeight:o,totalWidth:s,totalHeight:c,gap:l,columnGap:u,fixedSize:f,fixedWidth:p,relativeScrollX:m,relativeScrollY:h,getItemSizeY:g,getItemSizeX:_,getItemQueryY:v,getItemQueryX:b,getColumnSize:x,getColumnQuery:S,scaleX:C,scaleY:ee,hostOffsetX:te,hostOffsetY:w,stickyIndices:ne,stickyStartX:re=0,stickyStartY:T=0,stickyEndX:ie=0,stickyEndY:E=0,flowPaddingStartX:D=0,flowPaddingStartY:O=0,paddingStartX:k=0,paddingStartY:A=0,paddingEndX:ae=0,paddingEndY:j=0}){let M;M=d(n)?n.align:n;let N=(M&&typeof M==`object`?M.x:M)||`auto`,P=(M&&typeof M==`object`?M.y:M)||`auto`,F=m,I=h,L=0,R=0,z=`auto`,oe=`auto`,se=C===1?s:i,B=ee===1?c:i,V=Math.max(0,te+se-a),ce=Math.max(0,w+B-o),H=(V-te)*C,U=(ce-w)*ee,le=D+re+k,ue=O+T+A;if(e!=null){let t=y({index:e,align:P,viewSize:o,scrollPos:h,fixedSize:f,gap:l,query:v,getSize:g,stickyIndices:ne,stickyStart:T+A,stickyEnd:E+j});I=t.target+ue,R=t.itemSize,oe=t.effectiveAlign}if(t!=null){let e=r===`both`,n=y({index:t,align:N,viewSize:a,scrollPos:m,fixedSize:e?p:f,gap:e||r===`horizontal`?u:l,query:e?S:b,getSize:e?x:_,stickyIndices:ne,stickyStart:re+k,stickyEnd:ie+ae});F=n.target+le,L=n.itemSize,z=n.effectiveAlign}return F=Math.max(0,Math.min(F,H)),I=Math.max(0,Math.min(I,U)),{targetX:F,targetY:I,itemWidth:L,itemHeight:R,effectiveAlignX:z,effectiveAlignY:oe}}function te({direction:e,relativeScrollX:t,relativeScrollY:n,usableWidth:r,usableHeight:i,itemsLength:a,bufferBefore:o,bufferAfter:s,gap:c,columnGap:l,fixedSize:u,findLowerBoundY:d,findLowerBoundX:f,queryY:p,queryX:h}){let g=e===`vertical`||e===`both`;return m({scrollPos:g?n:t,containerSize:g?i:r,count:a,bufferBefore:o,bufferAfter:s,gap:g?c:l,fixedSize:u,findLowerBound:g?d:f,query:g?p:h})}function w({columnCount:e,relativeScrollX:t,usableWidth:n,colBuffer:r,fixedWidth:i,columnGap:a,findLowerBound:o,query:s,totalColsQuery:c}){if(!e)return{start:0,end:0,padStart:0,padEnd:0};let{start:l,end:u}=m({scrollPos:t,containerSize:n,count:e,bufferBefore:r,bufferAfter:r,gap:a,fixedSize:i,findLowerBound:o,query:s}),d=l,f=u,p=i===null?s(d):d*(i+a),h=i===null?Math.max(0,c()-a):e*(i+a)-a,g=i===null?s(f)-(f>0?a:0):f*(i+a)-(f>0?a:0);return{start:d,end:f,padStart:p,padEnd:Math.max(0,h-g)}}function ne({index:e,isSticky:t,direction:n,relativeScrollX:r,relativeScrollY:i,originalX:a,originalY:o,width:s,height:c,stickyIndices:l,fixedSize:u,gap:d,columnGap:f,getItemQueryY:p,getItemQueryX:m}){let h=!1,g=!1,_={x:0,y:0};if(!t)return{isStickyActiveX:h,isStickyActiveY:g,isStickyActive:!1,stickyOffset:_};if(n===`vertical`||n===`both`){let t=b(i,o,c,e,l,e=>u===null?p(e):e*(u+d));g=t.isActive,_.y=t.offset}if(n===`horizontal`){let t=b(r,a,s,e,l,e=>u===null?m(e):e*(u+f));t.isActive&&(h=!0,_.x=t.offset)}return{isStickyActiveX:h,isStickyActiveY:g,isStickyActive:h||g,stickyOffset:_}}function re({index:e,direction:t,fixedSize:n,gap:r,columnGap:i,usableWidth:a,usableHeight:o,totalWidth:s,queryY:c,queryX:l,getSizeY:u,getSizeX:d,columnRange:f}){let p=0,m=0,h=0,g=0;return t===`horizontal`?(p=n===null?l(e):e*(n+i),h=n===null?d(e)-i:n,g=o):t===`both`&&f?(m=n===null?c(e):e*(n+r),g=n===null?u(e)-r:n,p=f.padStart,h=Math.max(0,s-f.padStart-f.padEnd)):(m=n===null?c(e):e*(n+r),g=n===null?u(e)-r:n,h=t===`both`?s:a),{height:g,width:h,x:p,y:m}}function T({item:e,direction:t,itemSize:n,containerTag:r,paddingStartX:i,paddingStartY:a,isHydrated:o,isRtl:s}){let c=t===`vertical`,l=t===`horizontal`,u=t===`both`,d=n==null||n===0,f={blockSize:l?`100%`:d?`auto`:`${e.size.height}px`};if(c&&r===`table`?f.minInlineSize=`100%`:f.inlineSize=c?`100%`:d?`auto`:`${e.size.width}px`,d&&(c||(f.minInlineSize=`1px`),l||(f.minBlockSize=`1px`)),o){let t=e.isStickyActiveY??(e.isStickyActive&&(c||u)),n=e.isStickyActiveX??(e.isStickyActive&&l),r=s?-(n?e.stickyOffset.x:e.offset.x):n?e.stickyOffset.x:e.offset.x,o=t?e.stickyOffset.y:e.offset.y;e.isStickyActive||e.isStickyActiveX||e.isStickyActiveY?(f.insetBlockStart=t?`${a}px`:`auto`,f.insetInlineStart=n?`${i}px`:`auto`,f.transform=`translate(${r}px, ${o}px)`):f.transform=`translate(${r}px, ${e.offset.y}px)`}return f}function ie({direction:e,itemsLength:t,columnCount:n,fixedSize:r,fixedWidth:i,gap:a,columnGap:o,usableWidth:s,usableHeight:c,queryY:l,queryX:u,queryColumn:d}){let f=e===`both`,p=e===`horizontal`,m=0,h=0;return f?(m=v(n,i,o,d),h=v(t,r,a,l)):p?(m=v(t,r,o,u),h=c):(m=s,h=v(t,r,a,l)),{width:f?Math.max(m,s):m,height:f?Math.max(h,c):h}}function E(e){let n=(0,t.computed)(()=>(0,t.toValue)(e)),a=(0,t.ref)(0),o=(0,t.ref)(0),m=(0,t.ref)(!1),h=(0,t.ref)(!1),_=(0,t.ref)(!1),v=(0,t.ref)(!1),y=(0,t.ref)(!1),b=(0,t.ref)(0),x=(0,t.ref)(0),T=(0,t.reactive)({x:0,y:0}),E=(0,t.reactive)({x:0,y:0}),D,O=(0,t.ref)(!1),k=(0,t.ref)(0),A=(0,t.ref)(0),ae=null,j=()=>{if(typeof window>`u`)return;let e=n.value.container||n.value.hostRef||window,t=c(e)?e:document.documentElement;(!ae||!(`direction`in ae))&&(ae=window.getComputedStyle(t));let r=ae.direction===`rtl`;y.value!==r&&(y.value=r)},M=new r(n.value.items?.length||0),N=new r(n.value.items?.length||0),P=new r(n.value.columnCount||0),F=(0,t.ref)(0),I=new Uint8Array,L=new Uint8Array,R=new Uint8Array,z=(0,t.ref)(null),oe=(0,t.ref)(!1),se=[],B=(0,t.computed)(()=>[`vertical`,`horizontal`,`both`].includes(n.value.direction)?n.value.direction:`vertical`),V=(0,t.computed)(()=>n.value.itemSize===void 0||n.value.itemSize===null||n.value.itemSize===0),ce=(0,t.computed)(()=>n.value.columnWidth===void 0||n.value.columnWidth===null||n.value.columnWidth===0),H=(0,t.computed)(()=>typeof n.value.itemSize==`number`&&n.value.itemSize>0?n.value.itemSize:null),U=(0,t.computed)(()=>typeof n.value.columnWidth==`number`&&n.value.columnWidth>0?n.value.columnWidth:null),le=(0,t.computed)(()=>n.value.defaultItemSize||H.value||40),ue=(0,t.computed)(()=>[...n.value.stickyIndices||[]].sort((e,t)=>e-t)),de=(0,t.computed)(()=>new Set(ue.value)),W=(0,t.computed)(()=>f(n.value.scrollPaddingStart,n.value.direction)),fe=(0,t.computed)(()=>f(n.value.scrollPaddingEnd,n.value.direction)),pe=(0,t.computed)(()=>p(n.value.scrollPaddingStart,n.value.direction)),me=(0,t.computed)(()=>p(n.value.scrollPaddingEnd,n.value.direction)),G=(0,t.computed)(()=>f(n.value.stickyStart,n.value.direction)),K=(0,t.computed)(()=>f(n.value.stickyEnd,n.value.direction)),q=(0,t.computed)(()=>p(n.value.stickyStart,n.value.direction)),he=(0,t.computed)(()=>p(n.value.stickyEnd,n.value.direction)),J=(0,t.computed)(()=>f(n.value.flowPaddingStart,n.value.direction)),ge=(0,t.computed)(()=>f(n.value.flowPaddingEnd,n.value.direction)),Y=(0,t.computed)(()=>p(n.value.flowPaddingStart,n.value.direction)),_e=(0,t.computed)(()=>p(n.value.flowPaddingEnd,n.value.direction)),ve=(0,t.computed)(()=>b.value-(B.value===`vertical`?0:G.value+K.value)),ye=(0,t.computed)(()=>x.value-(B.value===`horizontal`?0:q.value+he.value)),be=(0,t.computed)(()=>{if(F.value,!h.value&&n.value.ssrRange&&!v.value){let{start:e=0,end:t=0,colStart:r=0,colEnd:i=0}=n.value.ssrRange,a=n.value.columnCount||0,o=n.value.gap||0,s=n.value.columnGap||0,c=0,l=0;if(B.value===`both`){if(a>0){let e=i||a,t=P.query(e)-P.query(r);c=Math.max(0,t-(e>r?s:0))}if(H.value!==null){let n=t-e;l=Math.max(0,n*(H.value+o)-(n>0?o:0))}else{let n=N.query(t)-N.query(e);l=Math.max(0,n-(t>e?o:0))}}else if(B.value===`horizontal`){if(H.value!==null){let n=t-e;c=Math.max(0,n*(H.value+s)-(n>0?s:0))}else{let n=M.query(t)-M.query(e);c=Math.max(0,n-(t>e?s:0))}l=ye.value}else if(c=ve.value,H.value!==null){let n=t-e;l=Math.max(0,n*(H.value+o)-(n>0?o:0))}else{let n=N.query(t)-N.query(e);l=Math.max(0,n-(t>e?o:0))}return{width:Math.max(c,ve.value),height:Math.max(l,ye.value)}}return ie({direction:B.value,itemsLength:n.value.items.length,columnCount:n.value.columnCount||0,fixedSize:H.value,fixedWidth:U.value,gap:n.value.gap||0,columnGap:n.value.columnGap||0,usableWidth:ve.value,usableHeight:ye.value,queryY:e=>N.query(e),queryX:e=>M.query(e),queryColumn:e=>P.query(e)})}),xe=(0,t.computed)(()=>s(n.value.container)),Se=(0,t.computed)(()=>be.value.width+W.value+fe.value),Ce=(0,t.computed)(()=>be.value.height+pe.value+me.value),X=(0,t.computed)(()=>J.value+G.value+K.value+ge.value+Se.value),Z=(0,t.computed)(()=>Y.value+q.value+he.value+_e.value+Ce.value),we=(0,t.reactive)({x:(0,t.computed)(()=>Math.max(0,T.x-(J.value+G.value))),y:(0,t.computed)(()=>Math.max(0,T.y-(Y.value+q.value)))}),Te=(0,t.computed)(()=>xe.value?X.value:Math.min(X.value,i)),Ee=(0,t.computed)(()=>xe.value?Z.value:Math.min(Z.value,i)),De=(0,t.computed)(()=>xe.value?Se.value:Math.max(0,Te.value-(J.value+G.value+K.value+ge.value))),Oe=(0,t.computed)(()=>xe.value?Ce.value:Math.max(0,Ee.value-(Y.value+q.value+he.value+_e.value))),Q=(0,t.computed)(()=>{if(xe.value||X.value<=1e7)return 1;let e=X.value-b.value,t=Te.value-b.value;return t>0?e/t:1}),ke=(0,t.computed)(()=>{if(xe.value||Z.value<=1e7)return 1;let e=Z.value-x.value,t=Ee.value-x.value;return t>0?e/t:1}),Ae=(0,t.computed)(()=>{if(B.value===`vertical`)return 0;let e=J.value+G.value+W.value;return k.value-e}),$=(0,t.computed)(()=>{if(B.value===`horizontal`)return 0;let e=Y.value+q.value+pe.value;return A.value-e}),je=e=>{F.value;let t=n.value.columnGap||0,r=n.value.columnWidth;if(typeof r==`number`&&r>0)return r;if(Array.isArray(r)&&r.length>0){let t=r[e%r.length];return t!=null&&t>0?t:n.value.defaultColumnWidth||100}if(typeof r==`function`)return r(e);let i=P.get(e);return i>0?i-t:n.value.defaultColumnWidth||100},Me=e=>{if(F.value,B.value===`horizontal`)return ye.value;let t=n.value.gap||0,r=n.value.itemSize;if(typeof r==`number`&&r>0)return r;if(typeof r==`function`){let t=n.value.items[e];return t===void 0?n.value.defaultItemSize||40:r(t,e)}let i=N.get(e);return i>0?i-t:n.value.defaultItemSize||40};function Ne(e,t,r){let i=typeof r==`object`&&r&&`isCorrection`in r?r.isCorrection:!1,s=n.value.container||window,{targetX:c,targetY:l,effectiveAlignX:f,effectiveAlignY:p}=ee({rowIndex:e,colIndex:t,options:r,direction:B.value,viewportWidth:b.value,viewportHeight:x.value,totalWidth:X.value,totalHeight:Z.value,gap:n.value.gap||0,columnGap:n.value.columnGap||0,fixedSize:H.value,fixedWidth:U.value,relativeScrollX:Ae.value,relativeScrollY:$.value,getItemSizeY:e=>N.get(e),getItemSizeX:e=>M.get(e),getItemQueryY:e=>N.query(e),getItemQueryX:e=>M.query(e),getColumnSize:e=>P.get(e),getColumnQuery:e=>P.query(e),scaleX:Q.value,scaleY:ke.value,hostOffsetX:we.x,hostOffsetY:we.y,stickyIndices:ue.value,stickyStartX:G.value,stickyStartY:q.value,stickyEndX:K.value,stickyEndY:he.value,flowPaddingStartX:J.value,flowPaddingStartY:Y.value,paddingStartX:W.value,paddingStartY:pe.value,paddingEndX:fe.value,paddingEndY:me.value});if(!i){let n=d(r)?r.behavior:void 0;z.value={rowIndex:e,colIndex:t,options:{align:{x:f,y:p},...n==null?{}:{behavior:n}}}}let m=C(c,we.x,Q.value),h=C(l,we.y,ke.value),g=y.value?-m:m,_=h,v;d(r)&&(v=r.behavior);let S=i?`auto`:v||`smooth`;O.value=!0;let te={behavior:S};if(t!=null&&(te.left=y.value?g:Math.max(0,g)),e!=null&&(te.top=Math.max(0,_)),u(s,te),(S===`auto`||S===void 0)&&(t!=null&&(a.value=y.value?g:Math.max(0,g),k.value=c),e!=null&&(o.value=Math.max(0,_),A.value=l),z.value)){let e=z.value.options;d(e)?e.behavior=`auto`:z.value.options={align:e,behavior:`auto`}}}let Pe=(e,t,r)=>{let i=n.value.container||window;O.value=!0,z.value=null;let s=e==null?null:Math.max(0,Math.min(e,X.value-b.value)),c=t==null?null:Math.max(0,Math.min(t,Z.value-x.value));s!==null&&(k.value=s),c!==null&&(A.value=c);let l=typeof window<`u`&&i===window?window.scrollX:i.scrollLeft,d=typeof window<`u`&&i===window?window.scrollY:i.scrollTop,f=s===null?null:C(s,we.x,Q.value),p=c===null?null:C(c,we.y,ke.value),m=f===null?l:y.value?-f:f,h=p===null?d:p,g={behavior:r?.behavior||`auto`};e!=null&&(g.left=m),t!=null&&(g.top=h),u(i,g),(r?.behavior===`auto`||r?.behavior===void 0)&&(e!=null&&(a.value=m),t!=null&&(o.value=h))},Fe=(e,t)=>{if(M.resize(e),N.resize(e),P.resize(t),L.length!==e){let t=new Uint8Array(e);t.set(L.subarray(0,Math.min(e,L.length))),L=t}if(R.length!==e){let t=new Uint8Array(e);t.set(R.subarray(0,Math.min(e,R.length))),R=t}if(I.length!==t){let e=new Uint8Array(t);e.set(I.subarray(0,Math.min(t,I.length))),I=e}},Ie=()=>{let e=n.value.items.length,t=n.value.columnCount||0,r=n.value.gap||0,i=n.value.columnGap||0,a=n.value.columnWidth,o=!1,s=!1;if(t>0)for(let e=0;e<t;e++){let t=P.get(e),r=I[e]===1;if(!ce.value||!r&&t===0){let r=0;r=typeof a==`number`&&a>0?a:Array.isArray(a)&&a.length>0?a[e%a.length]||n.value.defaultColumnWidth||100:typeof a==`function`?a(e):n.value.defaultColumnWidth||100;let s=r+i;Math.abs(t-s)>.5?(P.set(e,s),I[e]=ce.value?0:1,o=!0):ce.value||(I[e]=1)}}for(let t=0;t<e;t++){let e=n.value.items[t],a=M.get(t),o=N.get(t),c=L[t]===1,l=R[t]===1;if(B.value===`horizontal`){if(!V.value||!c&&a===0){let r=(typeof n.value.itemSize==`function`?n.value.itemSize(e,t):le.value)+i;Math.abs(a-r)>.5?(M.set(t,r),L[t]=V.value?0:1,s=!0):V.value||(L[t]=1)}}else a!==0&&(M.set(t,0),L[t]=0,s=!0);if(B.value!==`horizontal`){if(!V.value||!l&&o===0){let i=(typeof n.value.itemSize==`function`?n.value.itemSize(e,t):le.value)+r;Math.abs(o-i)>.5?(N.set(t,i),R[t]=V.value?0:1,s=!0):V.value||(R[t]=1)}}else o!==0&&(N.set(t,0),R[t]=0,s=!0)}o&&P.rebuild(),s&&(M.rebuild(),N.rebuild())},Le=()=>{let e=n.value.items,r=e.length;Fe(r,n.value.columnCount||0);let i=0;if(n.value.restoreScrollOnPrepend&&se.length>0&&r>se.length){let t=se[0];if(t!==void 0){for(let n=1;n<=r-se.length;n++)if(e[n]===t){i=n;break}}}if(i>0){M.shift(i),N.shift(i),z.value&&z.value.rowIndex!==null&&z.value.rowIndex!==void 0&&(z.value.rowIndex+=i);let a=new Uint8Array(r),o=new Uint8Array(r);a.set(L.subarray(0,Math.min(r-i,L.length)),i),o.set(R.subarray(0,Math.min(r-i,R.length)),i),L=a,R=o;let s=n.value.gap||0,c=n.value.columnGap||0,l=0,u=0;for(let t=0;t<i;t++){let r=typeof n.value.itemSize==`function`?n.value.itemSize(e[t],t):le.value;B.value===`horizontal`?l+=r+c:u+=r+s}(l>0||u>0)&&(0,t.nextTick)(()=>{Pe(l>0?Ae.value+l:null,u>0?$.value+u:null,{behavior:`auto`,isCorrection:!0})})}Ie(),se=[...e],oe.value=!0,F.value++},Re=()=>{if(typeof window>`u`)return;let e=n.value.container||window,t=t=>{let n=t.getBoundingClientRect();if(e===window)return{x:y.value?document.documentElement.clientWidth-n.right-window.scrollX:n.left+window.scrollX,y:n.top+window.scrollY};if(e===t)return{x:0,y:0};if(c(e)){let t=e.getBoundingClientRect();return{x:y.value?t.right-n.right-e.scrollLeft:n.left-t.left+e.scrollLeft,y:n.top-t.top+e.scrollTop}}return{x:0,y:0}};if(n.value.hostElement){let e=t(n.value.hostElement);(Math.abs(T.x-e.x)>.1||Math.abs(T.y-e.y)>.1)&&(T.x=e.x,T.y=e.y)}if(n.value.hostRef){let e=t(n.value.hostRef);(Math.abs(E.x-e.x)>.1||Math.abs(E.y-e.y)>.1)&&(E.x=e.x,E.y=e.y)}};(0,t.watch)([()=>n.value.items,()=>n.value.items.length,()=>n.value.direction,()=>n.value.columnCount,()=>n.value.columnWidth,()=>n.value.itemSize,()=>n.value.gap,()=>n.value.columnGap,()=>n.value.defaultItemSize,()=>n.value.defaultColumnWidth],Le,{immediate:!0}),(0,t.watch)(()=>[n.value.container,n.value.hostElement],()=>{Re()}),(0,t.watch)(y,(e,t)=>{if(t===void 0||e===t||!v.value)return;if(B.value===`vertical`){Re();return}let n=S(t?Math.abs(a.value):a.value,T.x,Q.value);Re(),Pe(n,null,{behavior:`auto`})},{flush:`sync`}),(0,t.watch)([Q,ke],()=>{!v.value||m.value||O.value||Pe(k.value,A.value,{behavior:`auto`})}),(0,t.watch)([()=>n.value.items.length,()=>n.value.columnCount],([e,n],[r,i])=>{(0,t.nextTick)(()=>{let t=Math.max(0,X.value-b.value),a=Math.max(0,Z.value-x.value);k.value>t||A.value>a?Pe(Math.min(k.value,t),Math.min(A.value,a),{behavior:`auto`}):(e!==r&&ke.value!==1||n!==i&&Q.value!==1)&&Pe(k.value,A.value,{behavior:`auto`}),Re()})});let ze=e=>{let t=n.value.gap||0,r=n.value.columnGap||0,i=H.value;if(B.value===`horizontal`){let t=(i||0)+r;return i!==null&&t>0?Math.floor(e/t):M.findLowerBound(e)}let a=(i||0)+t;return i!==null&&a>0?Math.floor(e/a):N.findLowerBound(e)},Be=e=>B.value===`both`?P.findLowerBound(e):B.value===`horizontal`?ze(e):0,Ve=(0,t.computed)(()=>{if(F.value,(!h.value||_.value)&&n.value.ssrRange)return{start:n.value.ssrRange.start,end:n.value.ssrRange.end};let e=n.value.ssrRange&&!m.value?0:n.value.bufferBefore??5,t=n.value.bufferAfter??5;return te({direction:B.value,relativeScrollX:Ae.value,relativeScrollY:$.value,usableWidth:ve.value,usableHeight:ye.value,itemsLength:n.value.items.length,bufferBefore:e,bufferAfter:t,gap:n.value.gap||0,columnGap:n.value.columnGap||0,fixedSize:H.value,findLowerBoundY:e=>N.findLowerBound(e),findLowerBoundX:e=>M.findLowerBound(e),queryY:e=>N.query(e),queryX:e=>M.query(e)})}),He=(0,t.computed)(()=>{F.value;let e=Ae.value+G.value,t=$.value+q.value;return ze(B.value===`horizontal`?e:t)}),Ue=(0,t.computed)(()=>{F.value;let e=n.value.columnCount||0;if(!e)return{start:0,end:0,padStart:0,padEnd:0};if((!h.value||_.value)&&n.value.ssrRange){let{colStart:t=0,colEnd:r=0}=n.value.ssrRange,i=Math.max(0,t),a=Math.min(e,r||e),o=n.value.columnGap||0,s=U.value===null?P.query(i):i*(U.value+o),c=U.value===null?Math.max(0,P.query(e)-o):e*(U.value+o)-o,l=U.value===null?P.query(a)-(a>0?o:0):a*(U.value+o)-(a>0?o:0);return{start:i,end:a,padStart:s,padEnd:Math.max(0,c-l)}}let t=n.value.ssrRange&&!m.value?0:2;return w({columnCount:e,relativeScrollX:Ae.value,usableWidth:ve.value,colBuffer:t,fixedWidth:U.value,columnGap:n.value.columnGap||0,findLowerBound:e=>P.findLowerBound(e),query:e=>P.query(e),totalColsQuery:()=>P.query(e)})}),We=[],Ge=(0,t.computed)(()=>{F.value;let{start:e,end:t}=Ve.value,r=[],i=H.value,a=n.value.gap||0,o=n.value.columnGap||0,s=ue.value,c=de.value,l=[];if(h.value||!n.value.ssrRange){let t=He.value,n=g(s,t);n!==void 0&&n<e&&l.push(n)}for(let n=e;n<t;n++)l.push(n);let u=n.value.ssrRange?.start||0,d=n.value.ssrRange?.colStart||0,f=0,p=0;!h.value&&n.value.ssrRange&&(p=B.value===`horizontal`?0:i===null?N.query(u):u*(i+a),B.value===`horizontal`?f=i===null?M.query(d):d*(i+o):B.value===`both`&&(f=P.query(d)));let m=new Map(We.map(e=>[e.index,e])),_=-1,v=0,y=-1,b=0,x=e=>e===_+1?(v+=M.get(_),_=e,v):(v=M.query(e),_=e,v),S=e=>e===y+1?(b+=N.get(y),y=e,b):(b=N.query(e),y=e,b),C=J.value+G.value+W.value,ee=Y.value+q.value+pe.value,te=J.value+G.value,w=Y.value+q.value,T=Ue.value;for(let e of l){let t=n.value.items[e];if(t===void 0)continue;let{x:i,y:a,width:o,height:l}=re({index:e,direction:B.value,fixedSize:H.value,gap:n.value.gap||0,columnGap:n.value.columnGap||0,usableWidth:ve.value,usableHeight:ye.value,totalWidth:be.value.width,queryY:S,queryX:x,getSizeY:e=>N.get(e),getSizeX:e=>M.get(e),columnRange:T}),u=c.has(e),d=i,g=a,{isStickyActive:_,isStickyActiveX:v,isStickyActiveY:y,stickyOffset:b}=ne({index:e,isSticky:u,direction:B.value,relativeScrollX:Ae.value,relativeScrollY:$.value,originalX:d,originalY:g,width:o,height:l,stickyIndices:s,fixedSize:H.value,fixedWidth:U.value,gap:n.value.gap||0,columnGap:n.value.columnGap||0,getItemQueryY:S,getItemQueryX:x}),ie=h.value?k.value/Q.value+(i+C-k.value)-te:i-f,E=h.value?A.value/ke.value+(a+ee-A.value)-w:a-p,D=m.get(e);D&&D.item===t&&D.offset.x===ie&&D.offset.y===E&&D.size.width===o&&D.size.height===l&&D.isSticky===u&&D.isStickyActive===_&&D.isStickyActiveX===v&&D.isStickyActiveY===y&&D.stickyOffset.x===b.x&&D.stickyOffset.y===b.y?r.push(D):r.push({item:t,index:e,offset:{x:ie,y:E},size:{width:o,height:l},originalX:d,originalY:g,isSticky:u,isStickyActive:_,isStickyActiveX:v,isStickyActiveY:y,stickyOffset:b})}return We=r,r}),Ke=(0,t.computed)(()=>{F.value;let e=Ae.value+G.value,t=$.value+q.value,n=Ae.value+(b.value-K.value)-1,r=$.value+(x.value-he.value)-1,i=Be(e),s=ze(t),c=ze(B.value===`horizontal`?n:r),l=Be(n);return{items:Ge.value,currentIndex:s,currentColIndex:i,currentEndIndex:c,currentEndColIndex:l,scrollOffset:{x:k.value,y:A.value},displayScrollOffset:{x:y.value?Math.abs(a.value+E.x):Math.max(0,a.value-E.x),y:Math.max(0,o.value-E.y)},viewportSize:{width:b.value,height:x.value},displayViewportSize:{width:b.value,height:x.value},totalSize:{width:X.value,height:Z.value},isScrolling:m.value,isProgrammaticScroll:O.value,range:Ve.value,columnRange:Ue.value}}),qe=()=>{O.value=!1,z.value=null},Je=e=>{let t=e.target;typeof window>`u`||(j(),t===window||t===document?(a.value=window.scrollX,o.value=window.scrollY,b.value=document.documentElement.clientWidth,x.value=document.documentElement.clientHeight):l(t)&&(a.value=t.scrollLeft,o.value=t.scrollTop,b.value=t.clientWidth,x.value=t.clientHeight),k.value=S(y.value?Math.abs(a.value):a.value,we.x,Q.value),A.value=S(o.value,we.y,ke.value),m.value||=(O.value||(z.value=null),!0),clearTimeout(D),D=setTimeout(()=>{m.value=!1,O.value=!1},250))},Ye=e=>{let t=!1,r=0,i=0,a=n.value.gap||0,o=n.value.columnGap||0,s=Ae.value,c=$.value,l=ze(B.value===`horizontal`?s:c),u=Be(s),d=B.value===`horizontal`,f=B.value===`both`,p=new Set,m=new Set,h=(e,i)=>{if(e>=0&&e<(n.value.columnCount||0)&&!m.has(e)){m.add(e);let n=P.get(e),a=i+o;if(!I[e]||Math.abs(n-a)>.1){let i=a-n;Math.abs(i)>.1&&(P.update(e,i),t=!0,e<u&&(r+=i)),I[e]=1}}};for(let{index:s,inlineSize:c,blockSize:u,element:m}of e){if(c<=0&&u<=0)continue;let e=V.value||typeof n.value.itemSize==`function`;if(s>=0&&!p.has(s)&&e&&u>0){if(p.add(s),d&&c>0){let e=M.get(s),n=c+o;if(!L[s]||Math.abs(n-e)>.1){let i=n-e;M.update(s,i),L[s]=1,t=!0,s<l&&(r+=i)}}if(!d){let e=N.get(s),n=u+a;if(!R[s]||Math.abs(n-e)>.1){let r=n-e;N.update(s,r),R[s]=1,t=!0,s<l&&(i+=r)}}}let g=ce.value||typeof n.value.columnWidth==`function`;if(f&&m&&n.value.columnCount&&g&&(c>0||m.dataset.colIndex===void 0)){let e=m.dataset.colIndex;if(e!=null)h(Number.parseInt(e,10),c);else{let e=Array.from(m.querySelectorAll(`[data-col-index]`));for(let t of e)h(Number.parseInt(t.dataset.colIndex,10),t.getBoundingClientRect().width)}}}if(t&&(F.value++,!(z.value!==null||O.value)&&(r!==0||i!==0))){let e=J.value+G.value+W.value,t=Y.value+q.value+pe.value;Pe(r===0?null:s+r+e,i===0?null:c+i+t,{behavior:`auto`})}},Xe=(e,t,n,r)=>{Ye([{index:e,inlineSize:t,blockSize:n,element:r}])};function Ze(){if(z.value&&!_.value){let{rowIndex:e,colIndex:t,options:r}=z.value;if(d(r)&&r.behavior===`smooth`&&m.value)return;let i=n.value.container||window,a=typeof window<`u`&&i===window?window.scrollX:i.scrollLeft,o=typeof window<`u`&&i===window?window.scrollY:i.scrollTop,s=y.value?Math.abs(a):a,c=o,l=S(s,0,Q.value),u=S(c,0,ke.value),{targetX:f,targetY:p}=ee({rowIndex:e,colIndex:t,options:r,direction:B.value,viewportWidth:b.value,viewportHeight:x.value,totalWidth:Se.value,totalHeight:Ce.value,gap:n.value.gap||0,columnGap:n.value.columnGap||0,fixedSize:H.value,fixedWidth:U.value,relativeScrollX:l,relativeScrollY:u,getItemSizeY:e=>N.get(e),getItemSizeX:e=>M.get(e),getItemQueryY:e=>N.query(e),getItemQueryX:e=>M.query(e),getColumnSize:e=>P.get(e),getColumnQuery:e=>P.query(e),scaleX:Q.value,scaleY:ke.value,hostOffsetX:we.x,hostOffsetY:we.y,stickyIndices:ue.value,stickyStartX:G.value,stickyStartY:q.value,stickyEndX:K.value,stickyEndY:he.value,flowPaddingStartX:J.value,flowPaddingStartY:Y.value,paddingStartX:W.value,paddingStartY:pe.value,paddingEndX:fe.value,paddingEndY:me.value}),h=t==null||Math.abs(l-f)<2,g=e==null||Math.abs(u-p)<2,_=t==null||t===void 0||I[t]===1,v=e==null||e===void 0||R[e]===1;h&&g?_&&v&&!m.value&&!O.value&&(z.value=null):Ne(e,t,d(r)?{...r,isCorrection:!0}:{align:r,isCorrection:!0})}}(0,t.watch)([F,b,x],Ze),(0,t.watch)(m,e=>{e||Ze()});let Qe=null,$e=null,et,tt=e=>{if(typeof window>`u`)return;let t=e||window,n=t===window||c(t)&&t===document.documentElement?document:t;if(n.addEventListener(`scroll`,Je,{passive:!0}),ae=null,j(),c(t)&&($e=new MutationObserver(()=>j()),$e.observe(t,{attributes:!0,attributeFilter:[`dir`,`style`]})),et=setInterval(j,1e3),t===window){b.value=document.documentElement.clientWidth,x.value=document.documentElement.clientHeight,a.value=window.scrollX,o.value=window.scrollY;let e=()=>{j(),b.value=document.documentElement.clientWidth,x.value=document.documentElement.clientHeight,Re()};return window.addEventListener(`resize`,e),()=>{n.removeEventListener(`scroll`,Je),window.removeEventListener(`resize`,e),$e?.disconnect(),clearInterval(et),ae=null}}else return b.value=t.clientWidth,x.value=t.clientHeight,a.value=t.scrollLeft,o.value=t.scrollTop,Qe=new ResizeObserver(()=>{j(),b.value=t.clientWidth,x.value=t.clientHeight,Re()}),Qe.observe(t),()=>{n.removeEventListener(`scroll`,Je),Qe?.disconnect(),$e?.disconnect(),clearInterval(et),ae=null}},nt;return(0,t.getCurrentInstance)()&&((0,t.onMounted)(()=>{v.value=!0,j(),(0,t.watch)(()=>n.value.container,e=>{nt?.(),nt=tt(e||null)},{immediate:!0}),Re(),(0,t.nextTick)(()=>{if(Re(),n.value.ssrRange||n.value.initialScrollIndex!==void 0){let e=n.value.initialScrollIndex===void 0?n.value.ssrRange?.start:n.value.initialScrollIndex,r=n.value.initialScrollAlign||`start`;e!=null&&Ne(e,n.value.ssrRange?.colStart,{align:r,behavior:`auto`}),h.value=!0,_.value=!0,(0,t.nextTick)(()=>{_.value=!1})}else h.value=!0})}),(0,t.onUnmounted)(()=>{nt?.()})),{renderedItems:Ge,totalWidth:X,totalHeight:Z,renderedWidth:Te,renderedHeight:Ee,scrollDetails:Ke,getRowHeight:Me,getColumnWidth:je,getRowOffset:e=>Y.value+q.value+pe.value+N.query(e),getColumnOffset:e=>J.value+G.value+W.value+P.query(e),getItemOffset:e=>B.value===`horizontal`?J.value+G.value+W.value+M.query(e):Y.value+q.value+pe.value+N.query(e),getItemSize:e=>{if(B.value===`horizontal`)return Math.max(0,M.get(e)-(n.value.columnGap||0));let t=n.value.itemSize;if(typeof t==`number`&&t>0)return t;if(typeof t==`function`){let r=n.value.items[e];return r===void 0?n.value.defaultItemSize||40:t(r,e)}return Math.max(0,N.get(e)-(n.value.gap||0))},scrollToIndex:Ne,scrollToOffset:Pe,stopProgrammaticScroll:qe,updateItemSize:Xe,updateItemSizes:Ye,updateHostOffset:Re,updateDirection:j,columnRange:Ue,refresh:()=>{M.resize(0),N.resize(0),P.resize(0),I.fill(0),L.fill(0),R.fill(0),Le()},isHydrated:h,isWindowContainer:xe,isRtl:y,scaleX:Q,scaleY:ke,componentOffset:we,renderedVirtualWidth:De,renderedVirtualHeight:Oe}}function D(e){let n=(0,t.computed)(()=>(0,t.toValue)(e.axis)),r=(0,t.computed)(()=>(0,t.toValue)(e.totalSize)),i=(0,t.computed)(()=>(0,t.toValue)(e.position)),a=(0,t.computed)(()=>(0,t.toValue)(e.viewportSize)),o=(0,t.computed)(()=>(0,t.toValue)(e.containerId)),s=(0,t.computed)(()=>!!(0,t.toValue)(e.isRtl)),c=(0,t.computed)(()=>n.value===`horizontal`),l=(0,t.computed)(()=>r.value<=0?0:Math.min(1,a.value/r.value)),u=(0,t.computed)(()=>{let e=r.value-a.value;return e<=0?0:Math.max(0,Math.min(1,i.value/e))}),d=(0,t.computed)(()=>{let e=a.value>0?32/a.value:.1;return Math.max(Math.min(e,.1),l.value)*100}),f=(0,t.computed)(()=>u.value*(100-d.value)),p=(0,t.computed)(()=>c.value?{inlineSize:`${d.value}%`,insetInlineStart:`${f.value}%`}:{blockSize:`${d.value}%`,insetBlockStart:`${f.value}%`}),m=(0,t.computed)(()=>{let e=a.value,t=`var(--vs-scrollbar-has-cross-gap, var(--vsi-scrollbar-has-cross-gap, 0)) * var(--vs-scrollbar-cross-gap, var(--vsi-scrollbar-size, 8px))`;return c.value?{inlineSize:`calc(${Math.max(0,e-4)}px - ${t})`}:{blockSize:`calc(${Math.max(0,e-4)}px - ${t})`}}),h=(0,t.ref)(!1),g=0,_=0;function v(t){let n=t.currentTarget;if(t.target!==n)return;let i=n.getBoundingClientRect(),o=c.value?i.width:i.height,l=0;l=c.value?s.value?i.right-t.clientX:t.clientX-i.left:t.clientY-i.top;let u=d.value/100*o,f=(l-u/2)/(o-u),p=r.value-a.value,m=f*p;m>p-1&&(m=p),e.scrollToOffset(Math.max(0,Math.min(p,m)))}function y(e){h.value=!0,g=c.value?s.value?-e.clientX:e.clientX:e.clientY,_=i.value,e.currentTarget.setPointerCapture(e.pointerId),e.preventDefault(),e.stopPropagation()}function b(t){if(!h.value)return;let n=t.currentTarget.parentElement;if(!n)return;let i=(c.value?s.value?-t.clientX:t.clientX:t.clientY)-g,o=n.getBoundingClientRect(),l=c.value?o.width:o.height,u=l-d.value/100*l;if(u<=0)return;let f=r.value-a.value,p=_+i/u*f;p>f-1&&(p=f),e.scrollToOffset(Math.max(0,Math.min(f,p)))}function x(e){h.value&&(h.value=!1,e.currentTarget.releasePointerCapture(e.pointerId))}return(0,t.getCurrentInstance)()&&(0,t.onUnmounted)(()=>{h.value=!1}),{viewportPercent:l,positionPercent:u,thumbSizePercent:d,thumbPositionPercent:f,trackStyle:m,thumbStyle:p,trackProps:(0,t.computed)(()=>({class:[`virtual-scrollbar-track`,`virtual-scrollbar-track--${c.value?`horizontal`:`vertical`}`],style:m.value,role:`scrollbar`,"aria-orientation":n.value,"aria-valuenow":Math.round(i.value),"aria-valuemin":0,"aria-valuemax":Math.round(r.value-a.value),"aria-controls":o.value,tabindex:-1,onMousedown:v})),thumbProps:(0,t.computed)(()=>({class:[`virtual-scrollbar-thumb`,`virtual-scrollbar-thumb--${c.value?`horizontal`:`vertical`}`,{"virtual-scrollbar-thumb--active":h.value}],style:p.value,onPointerdown:y,onPointermove:b,onPointerup:x,onPointercancel:x})),isDragging:h}}var O=(0,t.defineComponent)({__name:`VirtualScrollbar`,props:{axis:{default:`vertical`},totalSize:{},position:{},viewportSize:{},scrollToOffset:{},containerId:{},isRtl:{type:Boolean,default:!1}},emits:[`scrollToOffset`],setup(e,{emit:n}){let r=e,i=n,{trackProps:a,thumbProps:o}=D({axis:()=>r.axis,totalSize:()=>r.totalSize,position:()=>r.position,viewportSize:()=>r.viewportSize,containerId:()=>r.containerId,isRtl:()=>r.isRtl,scrollToOffset:e=>{r.scrollToOffset?.(e),i(`scrollToOffset`,e)}});return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,(0,t.normalizeProps)((0,t.guardReactiveProps)((0,t.unref)(a))),[(0,t.createElementVNode)(`div`,(0,t.normalizeProps)((0,t.guardReactiveProps)((0,t.unref)(o))),null,16)],16))}}),k={key:0,class:`virtual-scroll-scrollbar-container`},A={key:0,class:`virtual-scroll-debug-info`},ae=.95,j=.1,M=((e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n})((0,t.defineComponent)({__name:`VirtualScroll`,props:{containerTag:{default:`div`},wrapperTag:{default:`div`},itemTag:{default:`div`},stickyHeader:{type:Boolean,default:!1},stickyFooter:{type:Boolean,default:!1},virtualScrollbar:{type:Boolean,default:!1},items:{},itemSize:{},direction:{default:`vertical`},bufferBefore:{default:5},bufferAfter:{default:5},container:{},ssrRange:{},columnCount:{default:0},columnWidth:{},scrollPaddingStart:{default:0},scrollPaddingEnd:{default:0},gap:{default:0},columnGap:{default:0},stickyIndices:{default:()=>[]},loadDistance:{default:200},loading:{type:Boolean,default:!1},restoreScrollOnPrepend:{type:Boolean,default:!1},initialScrollIndex:{},initialScrollAlign:{},defaultItemSize:{},defaultColumnWidth:{},debug:{type:Boolean,default:!1}},emits:[`scroll`,`load`,`visibleRangeChange`],setup(e,{expose:n,emit:r}){let i=e,a=r,o=(0,t.useSlots)(),s=(0,t.ref)(null),c=(0,t.ref)(null),l=(0,t.ref)(null),u=(0,t.ref)(null),d=new Map,m=(0,t.useId)(),h=(0,t.computed)(()=>`vs-container-${m}`),g=(0,t.ref)(0),_=(0,t.ref)(0),v=(0,t.computed)(()=>i.container===void 0?s.value:i.container),y=(0,t.computed)(()=>{let e=v.value;return e===s.value||typeof window<`u`&&(e===window||e===null)}),b=(0,t.computed)(()=>(i.items.length,{items:i.items,itemSize:i.itemSize,direction:i.direction,bufferBefore:i.bufferBefore,bufferAfter:i.bufferAfter,container:v.value,hostElement:c.value,hostRef:s.value,ssrRange:i.ssrRange,columnCount:i.columnCount,columnWidth:i.columnWidth,scrollPaddingStart:{x:f(i.scrollPaddingStart,i.direction),y:p(i.scrollPaddingStart,i.direction)},scrollPaddingEnd:{x:f(i.scrollPaddingEnd,i.direction),y:p(i.scrollPaddingEnd,i.direction)},flowPaddingStart:{x:0,y:i.stickyHeader?0:g.value},flowPaddingEnd:{x:0,y:i.stickyFooter?0:_.value},stickyStart:{x:0,y:i.stickyHeader&&y.value?g.value:0},stickyEnd:{x:0,y:i.stickyFooter&&y.value?_.value:0},gap:i.gap,columnGap:i.columnGap,stickyIndices:i.stickyIndices,loadDistance:i.loadDistance,loading:i.loading,restoreScrollOnPrepend:i.restoreScrollOnPrepend,initialScrollIndex:i.initialScrollIndex,initialScrollAlign:i.initialScrollAlign,defaultItemSize:i.defaultItemSize,defaultColumnWidth:i.defaultColumnWidth,debug:i.debug})),{isHydrated:x,isRtl:C,columnRange:ee,renderedItems:te,scrollDetails:w,renderedHeight:ne,renderedWidth:re,getColumnWidth:ie,getRowHeight:M,scrollToIndex:N,scrollToOffset:P,updateHostOffset:F,updateItemSizes:I,updateDirection:L,getItemOffset:R,getRowOffset:z,getColumnOffset:oe,getItemSize:se,refresh:B,stopProgrammaticScroll:V,scaleX:ce,scaleY:H,isWindowContainer:U,componentOffset:le,renderedVirtualWidth:ue,renderedVirtualHeight:de}=E(b),W=(0,t.computed)(()=>ce.value!==1||H.value!==1),fe=(0,t.computed)(()=>U.value?!1:i.virtualScrollbar===!0||ce.value!==1||H.value!==1);function pe(e){let{displayViewportSize:t}=w.value;e>=ne.value-t.height-.5?P(null,1/0):P(null,S(e,le.y,H.value))}function me(e){let{displayViewportSize:t}=w.value;e>=re.value-t.width-.5?P(1/0,null):P(S(e,le.x,ce.value),null)}let G=D({axis:`vertical`,totalSize:ne,position:(0,t.computed)(()=>w.value.displayScrollOffset.y),viewportSize:(0,t.computed)(()=>w.value.displayViewportSize.height),scrollToOffset:pe,containerId:h,isRtl:C}),K=D({axis:`horizontal`,totalSize:re,position:(0,t.computed)(()=>w.value.displayScrollOffset.x),viewportSize:(0,t.computed)(()=>w.value.displayViewportSize.width),scrollToOffset:me,containerId:h,isRtl:C}),q=(0,t.computed)(()=>i.direction===`both`?{...ee.value,padStart:0,padEnd:0}:ee.value);function he(){B(),L(),(0,t.nextTick)(()=>{let e=[];for(let[t,n]of d.entries())n&&e.push({index:t,inlineSize:n.offsetWidth,blockSize:n.offsetHeight,element:n});e.length>0&&I(e)})}(0,t.watch)(w,(e,t)=>{!x.value||!e||(a(`scroll`,e),(!t||!t.range||!t.columnRange||e.range.start!==t.range.start||e.range.end!==t.range.end||e.columnRange.start!==t.columnRange.start||e.columnRange.end!==t.columnRange.end)&&a(`visibleRangeChange`,{start:e.range.start,end:e.range.end,colStart:e.columnRange.start,colEnd:e.columnRange.end}),!i.loading&&(i.direction!==`horizontal`&&e.totalSize&&e.totalSize.height-(e.scrollOffset.y+e.viewportSize.height)<=i.loadDistance&&a(`load`,`vertical`),i.direction!==`vertical`&&e.totalSize&&e.totalSize.width-(e.scrollOffset.x+e.viewportSize.width)<=i.loadDistance&&a(`load`,`horizontal`)))}),(0,t.watch)(x,e=>{e&&w.value?.range&&w.value?.columnRange&&a(`visibleRangeChange`,{start:w.value.range.start,end:w.value.range.end,colStart:w.value.columnRange.start,colEnd:w.value.columnRange.end})},{once:!0});let J=typeof window>`u`?null:new ResizeObserver(F),ge=typeof window>`u`?null:new ResizeObserver(e=>{let t=[];for(let n of e){let e=n.target,r=Number(e.dataset.index),i=e.dataset.colIndex,a=n.contentRect.width,o=n.contentRect.height;n.borderBoxSize&&n.borderBoxSize.length>0?(a=n.borderBoxSize[0].inlineSize,o=n.borderBoxSize[0].blockSize):(a=e.offsetWidth,o=e.offsetHeight),i===void 0?Number.isNaN(r)||t.push({index:r,inlineSize:a,blockSize:o,element:e}):t.push({index:-1,inlineSize:a,blockSize:o,element:e})}t.length>0&&I(t)}),Y=typeof window>`u`?null:new ResizeObserver(()=>{g.value=l.value?.offsetHeight||0,_.value=u.value?.offsetHeight||0,F()});function _e(e,n){(0,t.watch)(e,(e,t)=>{t&&Y?.unobserve(t),e?Y?.observe(e):n.value=0},{immediate:!0})}_e(l,g),_e(u,_),(0,t.onMounted)(()=>{s.value&&J?.observe(s.value);for(let e of d.values())ge?.observe(e),i.direction===`both`&&e.querySelectorAll(`[data-col-index]`).forEach(e=>ge?.observe(e))}),(0,t.watch)([s,c],([e],[t])=>{t&&J?.unobserve(t),e&&J?.observe(e)}),(0,t.watch)([s,W],([e,t],[n,r])=>{let i=e!==n||t!==r;n&&i&&n.removeEventListener(`wheel`,Q),e&&i&&e.addEventListener(`wheel`,Q,{passive:!t})},{immediate:!0});function ve(e,t){if(e)d.set(t,e),ge?.observe(e),i.direction===`both`&&e.querySelectorAll(`[data-col-index]`).forEach(e=>ge?.observe(e));else{let e=d.get(t);e&&(ge?.unobserve(e),i.direction===`both`&&e.querySelectorAll(`[data-col-index]`).forEach(e=>ge?.unobserve(e)),d.delete(t))}}let ye=(0,t.ref)(!1),be={x:0,y:0},xe={x:0,y:0},Se={x:0,y:0},Ce=0,X={x:0,y:0},Z=null;function we(){let e=()=>{X.x*=ae,X.y*=ae;let t=w.value.scrollOffset.x,n=w.value.scrollOffset.y;P(t+X.x*16,n+X.y*16,{behavior:`auto`}),Math.abs(X.x)>j||Math.abs(X.y)>j?Z=requestAnimationFrame(e):Te()};Z=requestAnimationFrame(e)}function Te(){Z!==null&&(cancelAnimationFrame(Z),Z=null),X={x:0,y:0}}function Ee(e){V(),Te(),W.value&&(e.pointerType===`mouse`&&e.button!==0||(ye.value=!0,be={x:e.clientX,y:e.clientY},Se={x:e.clientX,y:e.clientY},Ce=performance.now(),xe={x:w.value.scrollOffset.x,y:w.value.scrollOffset.y},e.currentTarget.setPointerCapture(e.pointerId)))}function De(e){if(!ye.value)return;let t=performance.now(),n=t-Ce;if(n>0){let t=(Se.x-e.clientX)/n,r=(Se.y-e.clientY)/n;X.x=X.x*.2+t*.8,X.y=X.y*.2+r*.8}Se={x:e.clientX,y:e.clientY},Ce=t;let r=be.x-e.clientX,i=be.y-e.clientY;requestAnimationFrame(()=>{P(xe.x+r,xe.y+i,{behavior:`auto`})})}function Oe(e){ye.value&&(ye.value=!1,e.currentTarget.releasePointerCapture(e.pointerId),(Math.abs(X.x)>j||Math.abs(X.y)>j)&&(Math.abs(X.x)>4*Math.abs(X.y)?X.y=0:Math.abs(X.y)>4*Math.abs(X.x)&&(X.x=0),we()))}function Q(e){let{scrollOffset:t}=w.value;if(V(),W.value){e.preventDefault();let n=e.deltaX,r=e.deltaY;e.shiftKey&&n===0&&(n=r,r=0),P(t.x+n,t.y+r,{behavior:`auto`})}}function ke(e){let{viewportSize:t,scrollOffset:n}=w.value,r=i.direction!==`vertical`,a=i.direction!==`horizontal`,o=b.value.stickyStart,s=b.value.stickyEnd;switch(e.key){case`Home`:e.preventDefault(),V(),N(0,0,{behavior:Math.max(n.x,n.y)>10*(i.direction===`horizontal`?t.width:t.height)?`auto`:`smooth`,align:`start`});break;case`End`:{e.preventDefault(),V();let r=i.items.length-1,a=(i.columnCount||0)>0?i.columnCount-1:0,{totalSize:o}=w.value,s=Math.max(o.width-n.x-t.width,o.height-n.y-t.height)>10*(i.direction===`horizontal`?t.width:t.height)?`auto`:`smooth`;i.direction===`both`?N(r,a,{behavior:s,align:`end`}):N(i.direction===`vertical`?r:0,i.direction===`horizontal`?r:0,{behavior:s,align:`end`});break}case`ArrowUp`:{if(e.preventDefault(),V(),!a)return;let{currentIndex:t,scrollOffset:n}=w.value,r=n.y+o.y+b.value.scrollPaddingStart.y;z(t)<r-1?N(t,null,{align:`start`}):t>0&&N(t-1,null,{align:`start`});break}case`ArrowDown`:{if(e.preventDefault(),V(),!a)return;let{currentEndIndex:r}=w.value,o=n.y+t.height-(s.y+b.value.scrollPaddingEnd.y);z(r)+M(r)>o+1?N(r,null,{align:`end`}):r<i.items.length-1&&N(r+1,null,{align:`end`});break}case`ArrowLeft`:{if(e.preventDefault(),V(),!r)return;let{currentColIndex:a,currentEndColIndex:c}=w.value;if(C.value){let e=n.x+t.width-(s.x+b.value.scrollPaddingEnd.x);(i.columnCount?oe(c)+ie(c):R(c)+se(c))>e+1?N(null,c,{align:`end`}):c<(i.columnCount?i.columnCount-1:i.items.length-1)&&N(null,c+1,{align:`end`})}else{let e=n.x+o.x+b.value.scrollPaddingStart.x;(i.columnCount?oe(a):R(a))<e-1?N(null,a,{align:`start`}):a>0&&N(null,a-1,{align:`start`})}break}case`ArrowRight`:{if(e.preventDefault(),V(),!r)return;let{currentColIndex:a,currentEndColIndex:c}=w.value;if(C.value){let e=n.x+o.x+b.value.scrollPaddingStart.x;(i.columnCount?oe(a):R(a))<e-1?N(null,a,{align:`start`}):a>0&&N(null,a-1,{align:`start`})}else{let e=n.x+t.width-(s.x+b.value.scrollPaddingEnd.x);(i.columnCount?oe(c)+ie(c):R(c)+se(c))>e+1?N(null,c,{align:`end`}):c<(i.columnCount?i.columnCount-1:i.items.length-1)&&N(null,c+1,{align:`end`})}break}case`PageUp`:e.preventDefault(),V(),P(!a&&r?n.x-t.width:null,a?n.y-t.height:null);break;case`PageDown`:e.preventDefault(),V(),P(!a&&r?n.x+t.width:null,a?n.y+t.height:null);break}}(0,t.onUnmounted)(()=>{J?.disconnect(),ge?.disconnect(),Y?.disconnect()});let Ae=(0,t.computed)(()=>{let e={...i.direction===`vertical`?{}:{whiteSpace:`nowrap`}};return(fe.value||!U.value)&&(e.overflow=`auto`),W.value&&(e.touchAction=`none`),U.value?e:i.containerTag===`table`?{...e,display:`block`,minInlineSize:i.direction===`vertical`?`100%`:`auto`}:e}),$=(0,t.computed)(()=>{if(i.direction===`horizontal`)return null;let{displayViewportSize:e,displayScrollOffset:t}=w.value;if(ne.value<=e.height)return null;let n={axis:`vertical`,totalSize:ne.value,position:t.y,viewportSize:e.height,scrollToOffset:pe,containerId:h.value,isRtl:C.value};return{axis:`vertical`,positionPercent:G.positionPercent.value,viewportPercent:G.viewportPercent.value,thumbSizePercent:G.thumbSizePercent.value,thumbPositionPercent:G.thumbPositionPercent.value,trackProps:G.trackProps.value,thumbProps:G.thumbProps.value,scrollbarProps:n,isDragging:G.isDragging.value}}),je=(0,t.computed)(()=>{if(i.direction===`vertical`)return null;let{displayViewportSize:e,displayScrollOffset:t}=w.value;if(re.value<=e.width)return null;let n={axis:`horizontal`,totalSize:re.value,position:t.x,viewportSize:e.width,scrollToOffset:me,containerId:h.value,isRtl:C.value};return{axis:`horizontal`,positionPercent:K.positionPercent.value,viewportPercent:K.viewportPercent.value,thumbSizePercent:K.thumbSizePercent.value,thumbPositionPercent:K.thumbPositionPercent.value,trackProps:K.trackProps.value,thumbProps:K.thumbProps.value,scrollbarProps:n,isDragging:K.isDragging.value}}),Me=(0,t.computed)(()=>{let e=i.direction===`horizontal`,t=i.direction===`vertical`,n=i.direction===`both`,r={inlineSize:t?`100%`:`${ue.value}px`,blockSize:e?`100%`:`${de.value}px`};return x.value||(r.display=`flex`,r.flexDirection=e?`row`:`column`,(e||n)&&i.columnGap&&(r.columnGap=`${i.columnGap}px`),(t||n)&&i.gap&&(r.rowGap=`${i.gap}px`)),r}),Ne=(0,t.computed)(()=>{let e=i.direction===`horizontal`;return{display:e?`inline-block`:`block`,...e?{blockSize:`100%`,verticalAlign:`top`}:{inlineSize:`100%`}}}),Pe=(0,t.computed)(()=>({inlineSize:i.direction===`vertical`?`1px`:`${ue.value}px`,blockSize:i.direction===`horizontal`?`1px`:`${de.value}px`}));function Fe(e){let t=T({containerTag:i.containerTag||`div`,direction:i.direction,isHydrated:x.value,item:e,itemSize:i.itemSize,paddingStartX:b.value.scrollPaddingStart.x,paddingStartY:b.value.scrollPaddingStart.y,isRtl:C.value});return!x.value&&i.direction===`both`&&(t.display=`flex`,i.columnGap&&(t.columnGap=`${i.columnGap}px`)),t}let Ie=(0,t.computed)(()=>i.debug),Le=(0,t.computed)(()=>i.containerTag===`table`),Re=(0,t.computed)(()=>Le.value?`thead`:`div`),ze=(0,t.computed)(()=>Le.value?`tfoot`:`div`);return n({...(0,t.toRefs)(i),scrollDetails:w,columnRange:ee,getColumnWidth:ie,getRowHeight:M,getRowOffset:z,getColumnOffset:oe,getItemOffset:R,getItemSize:se,scrollToIndex:N,scrollToOffset:P,refresh:he,stopProgrammaticScroll:()=>{V(),Te()},updateDirection:L,isRtl:C,isHydrated:x,scaleX:ce,scaleY:H,renderedWidth:re,renderedHeight:ne,componentOffset:le,scrollbarPropsVertical:$,scrollbarPropsHorizontal:je}),(n,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.containerTag),{id:h.value,ref_key:`hostRef`,ref:s,class:(0,t.normalizeClass)([`virtual-scroll-container`,[`virtual-scroll--${e.direction}`,{"virtual-scroll--hydrated":(0,t.unref)(x),"virtual-scroll--window":(0,t.unref)(U),"virtual-scroll--table":Le.value,"virtual-scroll--hide-scrollbar":fe.value}]]),style:(0,t.normalizeStyle)(Ae.value),tabindex:`0`,onKeydown:ke,onPointerdown:Ee,onPointermove:De,onPointerup:Oe,onPointercancel:Oe},{default:(0,t.withCtx)(()=>[fe.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,k,[(0,t.createElementVNode)(`div`,{class:`virtual-scroll-scrollbar-viewport`,style:(0,t.normalizeStyle)({inlineSize:`${(0,t.unref)(w).displayViewportSize.width}px`,blockSize:`${(0,t.unref)(w).displayViewportSize.height}px`,"--vsi-scrollbar-has-cross-gap":e.direction===`both`?1:0})},[o.scrollbar&&$.value?(0,t.renderSlot)(n.$slots,`scrollbar`,(0,t.normalizeProps)((0,t.mergeProps)({key:0},$.value)),void 0,!0):$.value?((0,t.openBlock)(),(0,t.createBlock)(O,(0,t.normalizeProps)((0,t.mergeProps)({key:1},$.value.scrollbarProps)),null,16)):(0,t.createCommentVNode)(``,!0),o.scrollbar&&je.value?(0,t.renderSlot)(n.$slots,`scrollbar`,(0,t.normalizeProps)((0,t.mergeProps)({key:2},je.value)),void 0,!0):je.value?((0,t.openBlock)(),(0,t.createBlock)(O,(0,t.normalizeProps)((0,t.mergeProps)({key:3},je.value.scrollbarProps)),null,16)):(0,t.createCommentVNode)(``,!0)],4)])):(0,t.createCommentVNode)(``,!0),o.header?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(Re.value),{key:1,ref_key:`headerRef`,ref:l,class:(0,t.normalizeClass)([`virtual-scroll-header`,{"virtual-scroll--sticky":e.stickyHeader}])},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(n.$slots,`header`,{},void 0,!0)]),_:3},8,[`class`])):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.wrapperTag),{ref_key:`wrapperRef`,ref:c,class:`virtual-scroll-wrapper`,style:(0,t.normalizeStyle)(Me.value)},{default:(0,t.withCtx)(()=>[Le.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.itemTag),{key:0,class:`virtual-scroll-spacer`,style:(0,t.normalizeStyle)(Pe.value)},{default:(0,t.withCtx)(()=>[...r[0]||=[(0,t.createElementVNode)(`td`,{style:{padding:`0`,border:`none`,"block-size":`inherit`}},null,-1)]]),_:1},8,[`style`])):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(te),r=>((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.itemTag),{key:r.index,ref_for:!0,ref:e=>ve(e,r.index),"data-index":r.index,class:(0,t.normalizeClass)([`virtual-scroll-item`,{"virtual-scroll--sticky":r.isStickyActive,"virtual-scroll--debug":Ie.value}]),style:(0,t.normalizeStyle)(Fe(r))},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(n.$slots,`item`,{item:r.item,index:r.index,columnRange:q.value,getColumnWidth:(0,t.unref)(ie),gap:i.gap,columnGap:i.columnGap,isSticky:r.isSticky,isStickyActive:r.isStickyActive,isStickyActiveX:r.isStickyActiveX,isStickyActiveY:r.isStickyActiveY,offset:r.offset},void 0,!0),Ie.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,A,` #`+(0,t.toDisplayString)(r.index)+` (`+(0,t.toDisplayString)(Math.round(r.offset.x))+`, `+(0,t.toDisplayString)(Math.round(r.offset.y))+`) `,1)):(0,t.createCommentVNode)(``,!0)]),_:2},1032,[`data-index`,`class`,`style`]))),128))]),_:3},8,[`style`])),e.loading&&o.loading?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:2,class:`virtual-scroll-loading`,style:(0,t.normalizeStyle)(Ne.value)},[(0,t.renderSlot)(n.$slots,`loading`,{},void 0,!0)],4)):(0,t.createCommentVNode)(``,!0),o.footer?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(ze.value),{key:3,ref_key:`footerRef`,ref:u,class:(0,t.normalizeClass)([`virtual-scroll-footer`,{"virtual-scroll--sticky":e.stickyFooter}])},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(n.$slots,`footer`,{},void 0,!0)]),_:3},8,[`class`])):(0,t.createCommentVNode)(``,!0)]),_:3},40,[`id`,`class`,`style`]))}}),[[`__scopeId`,`data-v-408dd72c`]]);e.BROWSER_MAX_SIZE=i,e.DEFAULT_BUFFER=5,e.DEFAULT_COLUMN_WIDTH=100,e.DEFAULT_ITEM_SIZE=40,e.EMPTY_SCROLL_DETAILS=n,e.FenwickTree=r,e.VirtualScroll=M,e.VirtualScrollbar=O,e.calculateColumnRange=w,e.calculateItemPosition=re,e.calculateItemStyle=T,e.calculateRange=te,e.calculateScrollTarget=ee,e.calculateStickyItem=ne,e.calculateTotalSize=ie,e.displayToVirtual=S,e.findPrevStickyIndex=g,e.getPaddingX=f,e.getPaddingY=p,e.isBody=o,e.isElement=c,e.isItemVisible=x,e.isScrollToIndexOptions=d,e.isScrollableElement=l,e.isWindow=a,e.isWindowLike=s,e.scrollTo=u,e.useVirtualScroll=E,e.useVirtualScrollbar=D,e.virtualToDisplay=C});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`)):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.VirtualScroll={},e.Vue))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let n={items:[],currentIndex:0,currentColIndex:0,currentEndIndex:0,currentEndColIndex:0,scrollOffset:{x:0,y:0},displayScrollOffset:{x:0,y:0},viewportSize:{width:0,height:0},displayViewportSize:{width:0,height:0},totalSize:{width:0,height:0},isScrolling:!1,isProgrammaticScroll:!1,range:{start:0,end:0},columnRange:{start:0,end:0,padStart:0,padEnd:0}};var r=class{tree;values;constructor(e){this.tree=new Float64Array(e+1),this.values=new Float64Array(e)}update(e,t){if(!(e<0||e>=this.values.length))for(this.values[e]=this.values[e]+t,e++;e<this.tree.length;)this.tree[e]=this.tree[e]+t,e+=e&-e}query(e){let t=0;for(;e>0;)t+=this.tree[e]||0,e-=e&-e;return t}set(e,t){e<0||e>=this.values.length||(this.values[e]=t)}get length(){return this.values.length}get(e){return this.values[e]||0}getValues(){return this.values}findLowerBound(e){let t=0,n=this.tree.length,r=1<<Math.floor(Math.log2(n-1));for(;r>0;){let i=t+r;if(i<n){let n=this.tree[i]||0;n<=e&&(t=i,e-=n)}r>>=1}return t}rebuild(){this.tree.fill(0);for(let e=0;e<this.values.length;e++)this.tree[e+1]=this.values[e]||0;for(let e=1;e<this.tree.length;e++){let t=e+(e&-e);t<this.tree.length&&(this.tree[t]=this.tree[t]+this.tree[e])}}resize(e){if(e===this.values.length)return;let t=new Float64Array(e);t.set(this.values.subarray(0,Math.min(e,this.values.length))),this.values=t,this.tree=new Float64Array(e+1),this.rebuild()}shift(e){if(e===0)return;let t=this.values.length,n=new Float64Array(t);e>0?n.set(this.values.subarray(0,Math.min(t-e,this.values.length)),e):n.set(this.values.subarray(-e)),this.values=n,this.rebuild()}};let i=1e7;function a(e){return e===null||e===document.documentElement||typeof window<`u`&&e===window}function o(e){return typeof e==`object`&&!!e&&`tagName`in e&&e.tagName===`BODY`}function s(e){return a(e)||o(e)}function c(e){return e!=null&&`getBoundingClientRect`in e}function l(e){return e!=null&&`scrollLeft`in e}function u(e,t){a(e)?window.scrollTo(t):e!=null&&l(e)&&(typeof e.scrollTo==`function`?e.scrollTo(t):(t.left!==void 0&&(e.scrollLeft=t.left),t.top!==void 0&&(e.scrollTop=t.top)))}function d(e){return typeof e==`object`&&!!e&&(`align`in e||`behavior`in e||`isCorrection`in e)}function f(e,t){return typeof e==`object`&&e?e.x||0:(t===`horizontal`||t===`both`)&&e||0}function p(e,t){return typeof e==`object`&&e?e.y||0:(t===`vertical`||t===`both`)&&e||0}function m({scrollPos:e,containerSize:t,count:n,bufferBefore:r,bufferAfter:i,gap:a,fixedSize:o,findLowerBound:s,query:c}){let l=0,u=n,d=e+t;if(o!==null){let t=o+a;l=Math.floor(e/t),u=Math.ceil(d/t)}else l=s(e),u=s(d),u<n&&c(u)<d&&u++;return{start:Math.max(0,l-r),end:Math.min(n,u+i)}}function h(e,t){let n=0,r=e.length-1,i;for(;n<=r;){let a=n+r>>>1;e[a]>t?(i=e[a],r=a-1):n=a+1}return i}function g(e,t){let n=0,r=e.length-1,i;for(;n<=r;){let a=n+r>>>1;e[a]<t?(i=e[a],n=a+1):r=a-1}return i}function _({align:e,targetPos:t,itemSize:n,scrollPos:r,viewSize:i,stickyOffsetStart:a,stickyOffsetEnd:o}){let s=t-a,c=t-(i-o-n);return e===`start`?{target:s,effectiveAlign:`start`}:e===`center`?{target:t-a-(i-a-o-n)/2,effectiveAlign:`center`}:e===`end`?{target:c,effectiveAlign:`end`}:x(t,n,r,i,a,o)?{target:r,effectiveAlign:`auto`}:n<=i-a-o?t<r+a?{target:s,effectiveAlign:`start`}:{target:c,effectiveAlign:`end`}:Math.abs(s-r)<Math.abs(c-r)?{target:s,effectiveAlign:`start`}:{target:c,effectiveAlign:`end`}}function v(e,t,n,r){return e<=0?0:t===null?Math.max(0,r(e)-n):Math.max(0,e*(t+n)-n)}function y({index:e,align:t,viewSize:n,scrollPos:r,fixedSize:i,gap:a,query:o,getSize:s,stickyIndices:c,stickyStart:l,stickyEnd:u=0}){let d=l;if(c&&c.length>0){let t=g(c,e);t!==void 0&&(d+=v(1,i,0,()=>s(t)))}let f=i===null?o(e):e*(i+a),p=i===null?s(e)-a:i,{target:m,effectiveAlign:h}=_({align:t,targetPos:f,itemSize:p,scrollPos:r,viewSize:n,stickyOffsetStart:d,stickyOffsetEnd:u});return{target:m,itemSize:p,effectiveAlign:h}}function b(e,t,n,r,i,a){if(e<=t)return{isActive:!1,offset:0};let o=h(i,r);if(o===void 0)return{isActive:!0,offset:0};let s=a(o);return e>=s?{isActive:!1,offset:0}:{isActive:!0,offset:Math.max(0,Math.min(n,s-e))-n}}function x(e,t,n,r,i=0,a=0){let o=n+i,s=n+r-a;return t<=r-i-a?e>=o-.5&&e+t<=s+.5:e<=o+.5&&e+t>=s-.5}function S(e,t,n){return(e-t)*n}function C(e,t,n){return e/n+t}function ee({rowIndex:e,colIndex:t,options:n,direction:r,viewportWidth:a,viewportHeight:o,totalWidth:s,totalHeight:c,gap:l,columnGap:u,fixedSize:f,fixedWidth:p,relativeScrollX:m,relativeScrollY:h,getItemSizeY:g,getItemSizeX:_,getItemQueryY:v,getItemQueryX:b,getColumnSize:x,getColumnQuery:S,scaleX:C,scaleY:ee,hostOffsetX:te,hostOffsetY:w,stickyIndices:ne,stickyStartX:re=0,stickyStartY:T=0,stickyEndX:ie=0,stickyEndY:ae=0,flowPaddingStartX:E=0,flowPaddingStartY:D=0,paddingStartX:O=0,paddingStartY:k=0,paddingEndX:oe=0,paddingEndY:A=0}){let j;j=d(n)?n.align:n;let M=(j&&typeof j==`object`?j.x:j)||`auto`,N=(j&&typeof j==`object`?j.y:j)||`auto`,P=m,F=h,I=0,L=0,R=`auto`,se=`auto`,ce=C===1?s:i,z=ee===1?c:i,B=Math.max(0,te+ce-a),le=Math.max(0,w+z-o),V=(B-te)*C,H=(le-w)*ee,ue=E+re+O,de=D+T+k;if(e!=null){let t=y({index:e,align:N,viewSize:o,scrollPos:h,fixedSize:f,gap:l,query:v,getSize:g,stickyIndices:ne,stickyStart:T+k,stickyEnd:ae+A});F=t.target+de,L=t.itemSize,se=t.effectiveAlign}if(t!=null){let e=r===`both`,n=y({index:t,align:M,viewSize:a,scrollPos:m,fixedSize:e?p:f,gap:e||r===`horizontal`?u:l,query:e?S:b,getSize:e?x:_,stickyIndices:ne,stickyStart:re+O,stickyEnd:ie+oe});P=n.target+ue,I=n.itemSize,R=n.effectiveAlign}return P=Math.max(0,Math.min(P,V)),F=Math.max(0,Math.min(F,H)),{targetX:P,targetY:F,itemWidth:I,itemHeight:L,effectiveAlignX:R,effectiveAlignY:se}}function te({direction:e,relativeScrollX:t,relativeScrollY:n,usableWidth:r,usableHeight:i,itemsLength:a,bufferBefore:o,bufferAfter:s,gap:c,columnGap:l,fixedSize:u,findLowerBoundY:d,findLowerBoundX:f,queryY:p,queryX:h}){let g=e===`vertical`||e===`both`;return m({scrollPos:g?n:t,containerSize:g?i:r,count:a,bufferBefore:o,bufferAfter:s,gap:g?c:l,fixedSize:u,findLowerBound:g?d:f,query:g?p:h})}function w({columnCount:e,relativeScrollX:t,usableWidth:n,colBuffer:r,fixedWidth:i,columnGap:a,findLowerBound:o,query:s,totalColsQuery:c}){if(!e)return{start:0,end:0,padStart:0,padEnd:0};let{start:l,end:u}=m({scrollPos:t,containerSize:n,count:e,bufferBefore:r,bufferAfter:r,gap:a,fixedSize:i,findLowerBound:o,query:s}),d=l,f=u,p=i===null?s(d):d*(i+a),h=i===null?Math.max(0,c()-a):e*(i+a)-a,g=i===null?s(f)-(f>0?a:0):f*(i+a)-(f>0?a:0);return{start:d,end:f,padStart:p,padEnd:Math.max(0,h-g)}}function ne({index:e,isSticky:t,direction:n,relativeScrollX:r,relativeScrollY:i,originalX:a,originalY:o,width:s,height:c,stickyIndices:l,fixedSize:u,gap:d,columnGap:f,getItemQueryY:p,getItemQueryX:m}){let h=!1,g=!1,_={x:0,y:0};if(!t)return{isStickyActiveX:h,isStickyActiveY:g,isStickyActive:!1,stickyOffset:_};if(n===`vertical`||n===`both`){let t=b(i,o,c,e,l,e=>u===null?p(e):e*(u+d));g=t.isActive,_.y=t.offset}if(n===`horizontal`){let t=b(r,a,s,e,l,e=>u===null?m(e):e*(u+f));t.isActive&&(h=!0,_.x=t.offset)}return{isStickyActiveX:h,isStickyActiveY:g,isStickyActive:h||g,stickyOffset:_}}function re({index:e,direction:t,fixedSize:n,gap:r,columnGap:i,usableWidth:a,usableHeight:o,totalWidth:s,queryY:c,queryX:l,getSizeY:u,getSizeX:d,columnRange:f}){let p=0,m=0,h=0,g=0;return t===`horizontal`?(p=n===null?l(e):e*(n+i),h=n===null?d(e)-i:n,g=o):t===`both`&&f?(m=n===null?c(e):e*(n+r),g=n===null?u(e)-r:n,p=f.padStart,h=Math.max(0,s-f.padStart-f.padEnd)):(m=n===null?c(e):e*(n+r),g=n===null?u(e)-r:n,h=t===`both`?s:a),{height:g,width:h,x:p,y:m}}function T({item:e,direction:t,itemSize:n,containerTag:r,paddingStartX:i,paddingStartY:a,isHydrated:o,isRtl:s}){let c=t===`vertical`,l=t===`horizontal`,u=t===`both`,d=n==null||n===0,f={blockSize:l?`100%`:d?`auto`:`${e.size.height}px`};if(c&&r===`table`?f.minInlineSize=`100%`:f.inlineSize=c?`100%`:d?`auto`:`${e.size.width}px`,d&&(c||(f.minInlineSize=`1px`),l||(f.minBlockSize=`1px`)),o){let t=e.isStickyActiveY??(e.isStickyActive&&(c||u)),n=e.isStickyActiveX??(e.isStickyActive&&l),r=s?-(n?e.stickyOffset.x:e.offset.x):n?e.stickyOffset.x:e.offset.x,o=t?e.stickyOffset.y:e.offset.y;e.isStickyActive||e.isStickyActiveX||e.isStickyActiveY?(f.insetBlockStart=t?`${a}px`:`auto`,f.insetInlineStart=n?`${i}px`:`auto`,f.transform=`translate(${r}px, ${o}px)`):f.transform=`translate(${r}px, ${e.offset.y}px)`}return f}function ie({direction:e,itemsLength:t,columnCount:n,fixedSize:r,fixedWidth:i,gap:a,columnGap:o,usableWidth:s,usableHeight:c,queryY:l,queryX:u,queryColumn:d}){let f=e===`both`,p=e===`horizontal`,m=0,h=0;return f?(m=v(n,i,o,d),h=v(t,r,a,l)):p?(m=v(t,r,o,u),h=c):(m=s,h=v(t,r,a,l)),{width:f?Math.max(m,s):m,height:f?Math.max(h,c):h}}function ae(e){let n=(0,t.computed)(()=>(0,t.toValue)(e)),a=(0,t.ref)(0),o=(0,t.ref)(0),m=(0,t.ref)(!1),h=(0,t.ref)(!1),_=(0,t.ref)(!1),v=(0,t.ref)(!1),y=(0,t.ref)(!1),b=(0,t.ref)(0),x=(0,t.ref)(0),T=(0,t.reactive)({x:0,y:0}),ae=(0,t.reactive)({x:0,y:0}),E,D=(0,t.ref)(!1),O=(0,t.ref)(0),k=(0,t.ref)(0),oe=null,A=()=>{if(typeof window>`u`)return;let e=n.value.container||n.value.hostRef||window,t=c(e)?e:document.documentElement;(!oe||!(`direction`in oe))&&(oe=window.getComputedStyle(t));let r=oe.direction===`rtl`;y.value!==r&&(y.value=r)},j=new r(n.value.items?.length||0),M=new r(n.value.items?.length||0),N=new r(n.value.columnCount||0),P=(0,t.ref)(0),F=new Uint8Array,I=new Uint8Array,L=new Uint8Array,R=(0,t.ref)(null),se=(0,t.ref)(!1),ce=[],z=(0,t.computed)(()=>[`vertical`,`horizontal`,`both`].includes(n.value.direction)?n.value.direction:`vertical`),B=(0,t.computed)(()=>n.value.itemSize===void 0||n.value.itemSize===null||n.value.itemSize===0),le=(0,t.computed)(()=>n.value.columnWidth===void 0||n.value.columnWidth===null||n.value.columnWidth===0),V=(0,t.computed)(()=>typeof n.value.itemSize==`number`&&n.value.itemSize>0?n.value.itemSize:null),H=(0,t.computed)(()=>typeof n.value.columnWidth==`number`&&n.value.columnWidth>0?n.value.columnWidth:null),ue=(0,t.computed)(()=>n.value.defaultItemSize||V.value||40),de=(0,t.computed)(()=>[...n.value.stickyIndices||[]].sort((e,t)=>e-t)),fe=(0,t.computed)(()=>new Set(de.value)),U=(0,t.computed)(()=>f(n.value.scrollPaddingStart,n.value.direction)),pe=(0,t.computed)(()=>f(n.value.scrollPaddingEnd,n.value.direction)),me=(0,t.computed)(()=>p(n.value.scrollPaddingStart,n.value.direction)),he=(0,t.computed)(()=>p(n.value.scrollPaddingEnd,n.value.direction)),W=(0,t.computed)(()=>f(n.value.stickyStart,n.value.direction)),G=(0,t.computed)(()=>f(n.value.stickyEnd,n.value.direction)),K=(0,t.computed)(()=>p(n.value.stickyStart,n.value.direction)),ge=(0,t.computed)(()=>p(n.value.stickyEnd,n.value.direction)),q=(0,t.computed)(()=>f(n.value.flowPaddingStart,n.value.direction)),_e=(0,t.computed)(()=>f(n.value.flowPaddingEnd,n.value.direction)),J=(0,t.computed)(()=>p(n.value.flowPaddingStart,n.value.direction)),ve=(0,t.computed)(()=>p(n.value.flowPaddingEnd,n.value.direction)),ye=(0,t.computed)(()=>b.value-(z.value===`vertical`?0:W.value+G.value)),be=(0,t.computed)(()=>x.value-(z.value===`horizontal`?0:K.value+ge.value)),xe=(0,t.computed)(()=>{if(P.value,!h.value&&n.value.ssrRange&&!v.value){let{start:e=0,end:t=0,colStart:r=0,colEnd:i=0}=n.value.ssrRange,a=n.value.columnCount||0,o=n.value.gap||0,s=n.value.columnGap||0,c=0,l=0;if(z.value===`both`){if(a>0){let e=i||a,t=N.query(e)-N.query(r);c=Math.max(0,t-(e>r?s:0))}if(V.value!==null){let n=t-e;l=Math.max(0,n*(V.value+o)-(n>0?o:0))}else{let n=M.query(t)-M.query(e);l=Math.max(0,n-(t>e?o:0))}}else if(z.value===`horizontal`){if(V.value!==null){let n=t-e;c=Math.max(0,n*(V.value+s)-(n>0?s:0))}else{let n=j.query(t)-j.query(e);c=Math.max(0,n-(t>e?s:0))}l=be.value}else if(c=ye.value,V.value!==null){let n=t-e;l=Math.max(0,n*(V.value+o)-(n>0?o:0))}else{let n=M.query(t)-M.query(e);l=Math.max(0,n-(t>e?o:0))}return{width:Math.max(c,ye.value),height:Math.max(l,be.value)}}return ie({direction:z.value,itemsLength:n.value.items.length,columnCount:n.value.columnCount||0,fixedSize:V.value,fixedWidth:H.value,gap:n.value.gap||0,columnGap:n.value.columnGap||0,usableWidth:ye.value,usableHeight:be.value,queryY:e=>M.query(e),queryX:e=>j.query(e),queryColumn:e=>N.query(e)})}),Se=(0,t.computed)(()=>s(n.value.container)),Ce=(0,t.computed)(()=>xe.value.width+U.value+pe.value),we=(0,t.computed)(()=>xe.value.height+me.value+he.value),Y=(0,t.computed)(()=>q.value+W.value+G.value+_e.value+Ce.value),X=(0,t.computed)(()=>J.value+K.value+ge.value+ve.value+we.value),Te=(0,t.reactive)({x:(0,t.computed)(()=>Math.max(0,T.x-(q.value+W.value))),y:(0,t.computed)(()=>Math.max(0,T.y-(J.value+K.value)))}),Ee=(0,t.computed)(()=>Se.value?Y.value:Math.min(Y.value,i)),De=(0,t.computed)(()=>Se.value?X.value:Math.min(X.value,i)),Oe=(0,t.computed)(()=>Se.value?Ce.value:Math.max(0,Ee.value-(q.value+W.value+G.value+_e.value))),ke=(0,t.computed)(()=>Se.value?we.value:Math.max(0,De.value-(J.value+K.value+ge.value+ve.value))),Z=(0,t.computed)(()=>{if(Se.value||Y.value<=1e7)return 1;let e=Y.value-b.value,t=Ee.value-b.value;return t>0?e/t:1}),Ae=(0,t.computed)(()=>{if(Se.value||X.value<=1e7)return 1;let e=X.value-x.value,t=De.value-x.value;return t>0?e/t:1}),je=(0,t.computed)(()=>{if(z.value===`vertical`)return 0;let e=q.value+W.value+U.value;return O.value-e}),Q=(0,t.computed)(()=>{if(z.value===`horizontal`)return 0;let e=J.value+K.value+me.value;return k.value-e}),Me=e=>{P.value;let t=n.value.columnGap||0,r=n.value.columnWidth;if(typeof r==`number`&&r>0)return r;if(Array.isArray(r)&&r.length>0){let t=r[e%r.length];return t!=null&&t>0?t:n.value.defaultColumnWidth||100}if(typeof r==`function`)return r(e);let i=N.get(e);return i>0?i-t:n.value.defaultColumnWidth||100},Ne=e=>{if(P.value,z.value===`horizontal`)return be.value;let t=n.value.gap||0,r=n.value.itemSize;if(typeof r==`number`&&r>0)return r;if(typeof r==`function`){let t=n.value.items[e];return t===void 0?n.value.defaultItemSize||40:r(t,e)}let i=M.get(e);return i>0?i-t:n.value.defaultItemSize||40};function Pe(e,t,r){let i=typeof r==`object`&&r&&`isCorrection`in r?r.isCorrection:!1,s=n.value.container||window,{targetX:c,targetY:l,effectiveAlignX:f,effectiveAlignY:p}=ee({rowIndex:e,colIndex:t,options:r,direction:z.value,viewportWidth:b.value,viewportHeight:x.value,totalWidth:Y.value,totalHeight:X.value,gap:n.value.gap||0,columnGap:n.value.columnGap||0,fixedSize:V.value,fixedWidth:H.value,relativeScrollX:je.value,relativeScrollY:Q.value,getItemSizeY:e=>M.get(e),getItemSizeX:e=>j.get(e),getItemQueryY:e=>M.query(e),getItemQueryX:e=>j.query(e),getColumnSize:e=>N.get(e),getColumnQuery:e=>N.query(e),scaleX:Z.value,scaleY:Ae.value,hostOffsetX:Te.x,hostOffsetY:Te.y,stickyIndices:de.value,stickyStartX:W.value,stickyStartY:K.value,stickyEndX:G.value,stickyEndY:ge.value,flowPaddingStartX:q.value,flowPaddingStartY:J.value,paddingStartX:U.value,paddingStartY:me.value,paddingEndX:pe.value,paddingEndY:he.value});if(!i){let n=d(r)?r.behavior:void 0;R.value={rowIndex:e,colIndex:t,options:{align:{x:f,y:p},...n==null?{}:{behavior:n}}}}let m=C(c,Te.x,Z.value),h=C(l,Te.y,Ae.value),g=y.value?-m:m,_=h,v;d(r)&&(v=r.behavior);let S=i?`auto`:v||`smooth`;D.value=!0;let te={behavior:S};if(t!=null&&(te.left=y.value?g:Math.max(0,g)),e!=null&&(te.top=Math.max(0,_)),u(s,te),(S===`auto`||S===void 0)&&(t!=null&&(a.value=y.value?g:Math.max(0,g),O.value=c),e!=null&&(o.value=Math.max(0,_),k.value=l),R.value)){let e=R.value.options;d(e)?e.behavior=`auto`:R.value.options={align:e,behavior:`auto`}}}let Fe=(e,t,r)=>{let i=n.value.container||window;D.value=!0,R.value=null;let s=e==null?null:Math.max(0,Math.min(e,Y.value-b.value)),c=t==null?null:Math.max(0,Math.min(t,X.value-x.value));s!==null&&(O.value=s),c!==null&&(k.value=c);let l=typeof window<`u`&&i===window?window.scrollX:i.scrollLeft,d=typeof window<`u`&&i===window?window.scrollY:i.scrollTop,f=s===null?null:C(s,Te.x,Z.value),p=c===null?null:C(c,Te.y,Ae.value),m=f===null?l:y.value?-f:f,h=p===null?d:p,g={behavior:r?.behavior||`auto`};e!=null&&(g.left=m),t!=null&&(g.top=h),u(i,g),(r?.behavior===`auto`||r?.behavior===void 0)&&(e!=null&&(a.value=m),t!=null&&(o.value=h))},Ie=(e,t)=>{if(j.resize(e),M.resize(e),N.resize(t),I.length!==e){let t=new Uint8Array(e);t.set(I.subarray(0,Math.min(e,I.length))),I=t}if(L.length!==e){let t=new Uint8Array(e);t.set(L.subarray(0,Math.min(e,L.length))),L=t}if(F.length!==t){let e=new Uint8Array(t);e.set(F.subarray(0,Math.min(t,F.length))),F=e}},Le=()=>{let e=n.value.items.length,t=n.value.columnCount||0,r=n.value.gap||0,i=n.value.columnGap||0,a=n.value.columnWidth,o=!1,s=!1;if(t>0)for(let e=0;e<t;e++){let t=N.get(e),r=F[e]===1;if(!le.value||!r&&t===0){let r=0;r=typeof a==`number`&&a>0?a:Array.isArray(a)&&a.length>0?a[e%a.length]||n.value.defaultColumnWidth||100:typeof a==`function`?a(e):n.value.defaultColumnWidth||100;let s=r+i;Math.abs(t-s)>.5?(N.set(e,s),F[e]=le.value?0:1,o=!0):le.value||(F[e]=1)}}for(let t=0;t<e;t++){let e=n.value.items[t],a=j.get(t),o=M.get(t),c=I[t]===1,l=L[t]===1;if(z.value===`horizontal`){if(!B.value||!c&&a===0){let r=(typeof n.value.itemSize==`function`?n.value.itemSize(e,t):ue.value)+i;Math.abs(a-r)>.5?(j.set(t,r),I[t]=B.value?0:1,s=!0):B.value||(I[t]=1)}}else a!==0&&(j.set(t,0),I[t]=0,s=!0);if(z.value!==`horizontal`){if(!B.value||!l&&o===0){let i=(typeof n.value.itemSize==`function`?n.value.itemSize(e,t):ue.value)+r;Math.abs(o-i)>.5?(M.set(t,i),L[t]=B.value?0:1,s=!0):B.value||(L[t]=1)}}else o!==0&&(M.set(t,0),L[t]=0,s=!0)}o&&N.rebuild(),s&&(j.rebuild(),M.rebuild())},$=()=>{let e=n.value.items,r=e.length;Ie(r,n.value.columnCount||0);let i=0;if(n.value.restoreScrollOnPrepend&&ce.length>0&&r>ce.length){let t=ce[0];if(t!==void 0){for(let n=1;n<=r-ce.length;n++)if(e[n]===t){i=n;break}}}if(i>0){j.shift(i),M.shift(i),R.value&&R.value.rowIndex!==null&&R.value.rowIndex!==void 0&&(R.value.rowIndex+=i);let a=new Uint8Array(r),o=new Uint8Array(r);a.set(I.subarray(0,Math.min(r-i,I.length)),i),o.set(L.subarray(0,Math.min(r-i,L.length)),i),I=a,L=o;let s=n.value.gap||0,c=n.value.columnGap||0,l=0,u=0;for(let t=0;t<i;t++){let r=typeof n.value.itemSize==`function`?n.value.itemSize(e[t],t):ue.value;z.value===`horizontal`?l+=r+c:u+=r+s}(l>0||u>0)&&(0,t.nextTick)(()=>{Fe(l>0?je.value+l:null,u>0?Q.value+u:null,{behavior:`auto`,isCorrection:!0})})}Le(),ce=[...e],se.value=!0,P.value++},Re=()=>{if(typeof window>`u`)return;let e=n.value.container||window,t=t=>{let n=t.getBoundingClientRect();if(e===window)return{x:y.value?document.documentElement.clientWidth-n.right-window.scrollX:n.left+window.scrollX,y:n.top+window.scrollY};if(e===t)return{x:0,y:0};if(c(e)){let t=e.getBoundingClientRect();return{x:y.value?t.right-n.right-e.scrollLeft:n.left-t.left+e.scrollLeft,y:n.top-t.top+e.scrollTop}}return{x:0,y:0}};if(n.value.hostElement){let e=t(n.value.hostElement);(Math.abs(T.x-e.x)>.1||Math.abs(T.y-e.y)>.1)&&(T.x=e.x,T.y=e.y)}if(n.value.hostRef){let e=t(n.value.hostRef);(Math.abs(ae.x-e.x)>.1||Math.abs(ae.y-e.y)>.1)&&(ae.x=e.x,ae.y=e.y)}};(0,t.watch)([()=>n.value.items,()=>n.value.items.length,()=>n.value.direction,()=>n.value.columnCount,()=>n.value.columnWidth,()=>n.value.itemSize,()=>n.value.gap,()=>n.value.columnGap,()=>n.value.defaultItemSize,()=>n.value.defaultColumnWidth],$,{immediate:!0}),(0,t.watch)(()=>[n.value.container,n.value.hostElement],()=>{Re()}),(0,t.watch)(y,(e,t)=>{if(t===void 0||e===t||!v.value)return;if(z.value===`vertical`){Re();return}let n=S(t?Math.abs(a.value):a.value,T.x,Z.value);Re(),Fe(n,null,{behavior:`auto`})},{flush:`sync`}),(0,t.watch)([Z,Ae],()=>{!v.value||m.value||D.value||Fe(O.value,k.value,{behavior:`auto`})}),(0,t.watch)([()=>n.value.items.length,()=>n.value.columnCount],([e,n],[r,i])=>{(0,t.nextTick)(()=>{let t=Math.max(0,Y.value-b.value),a=Math.max(0,X.value-x.value);O.value>t||k.value>a?Fe(Math.min(O.value,t),Math.min(k.value,a),{behavior:`auto`}):(e!==r&&Ae.value!==1||n!==i&&Z.value!==1)&&Fe(O.value,k.value,{behavior:`auto`}),Re()})});let ze=e=>{let t=n.value.gap||0,r=n.value.columnGap||0,i=V.value;if(z.value===`horizontal`){let t=(i||0)+r;return i!==null&&t>0?Math.floor(e/t):j.findLowerBound(e)}let a=(i||0)+t;return i!==null&&a>0?Math.floor(e/a):M.findLowerBound(e)},Be=e=>z.value===`both`?N.findLowerBound(e):z.value===`horizontal`?ze(e):0,Ve=(0,t.computed)(()=>{if(P.value,(!h.value||_.value)&&n.value.ssrRange)return{start:n.value.ssrRange.start,end:n.value.ssrRange.end};let e=n.value.ssrRange&&!m.value?0:n.value.bufferBefore??5,t=n.value.bufferAfter??5;return te({direction:z.value,relativeScrollX:je.value,relativeScrollY:Q.value,usableWidth:ye.value,usableHeight:be.value,itemsLength:n.value.items.length,bufferBefore:e,bufferAfter:t,gap:n.value.gap||0,columnGap:n.value.columnGap||0,fixedSize:V.value,findLowerBoundY:e=>M.findLowerBound(e),findLowerBoundX:e=>j.findLowerBound(e),queryY:e=>M.query(e),queryX:e=>j.query(e)})}),He=(0,t.computed)(()=>{P.value;let e=je.value+W.value,t=Q.value+K.value;return ze(z.value===`horizontal`?e:t)}),Ue=(0,t.computed)(()=>{P.value;let e=n.value.columnCount||0;if(!e)return{start:0,end:0,padStart:0,padEnd:0};if((!h.value||_.value)&&n.value.ssrRange){let{colStart:t=0,colEnd:r=0}=n.value.ssrRange,i=Math.max(0,t),a=Math.min(e,r||e),o=n.value.columnGap||0,s=H.value===null?N.query(i):i*(H.value+o),c=H.value===null?Math.max(0,N.query(e)-o):e*(H.value+o)-o,l=H.value===null?N.query(a)-(a>0?o:0):a*(H.value+o)-(a>0?o:0);return{start:i,end:a,padStart:s,padEnd:Math.max(0,c-l)}}let t=n.value.ssrRange&&!m.value?0:2;return w({columnCount:e,relativeScrollX:je.value,usableWidth:ye.value,colBuffer:t,fixedWidth:H.value,columnGap:n.value.columnGap||0,findLowerBound:e=>N.findLowerBound(e),query:e=>N.query(e),totalColsQuery:()=>N.query(e)})}),We=[],Ge=(0,t.computed)(()=>{P.value;let{start:e,end:t}=Ve.value,r=[],i=V.value,a=n.value.gap||0,o=n.value.columnGap||0,s=de.value,c=fe.value,l=[];if(h.value||!n.value.ssrRange){let t=He.value,n=g(s,t);n!==void 0&&n<e&&l.push(n)}for(let n=e;n<t;n++)l.push(n);let u=n.value.ssrRange?.start||0,d=n.value.ssrRange?.colStart||0,f=0,p=0;!h.value&&n.value.ssrRange&&(p=z.value===`horizontal`?0:i===null?M.query(u):u*(i+a),z.value===`horizontal`?f=i===null?j.query(d):d*(i+o):z.value===`both`&&(f=N.query(d)));let m=new Map(We.map(e=>[e.index,e])),_=-1,v=0,y=-1,b=0,x=e=>e===_+1?(v+=j.get(_),_=e,v):(v=j.query(e),_=e,v),S=e=>e===y+1?(b+=M.get(y),y=e,b):(b=M.query(e),y=e,b),C=q.value+W.value+U.value,ee=J.value+K.value+me.value,te=q.value+W.value,w=J.value+K.value,T=Ue.value;for(let e of l){let t=n.value.items[e];if(t===void 0)continue;let{x:i,y:a,width:o,height:l}=re({index:e,direction:z.value,fixedSize:V.value,gap:n.value.gap||0,columnGap:n.value.columnGap||0,usableWidth:ye.value,usableHeight:be.value,totalWidth:xe.value.width,queryY:S,queryX:x,getSizeY:e=>M.get(e),getSizeX:e=>j.get(e),columnRange:T}),u=c.has(e),d=i,g=a,{isStickyActive:_,isStickyActiveX:v,isStickyActiveY:y,stickyOffset:b}=ne({index:e,isSticky:u,direction:z.value,relativeScrollX:je.value,relativeScrollY:Q.value,originalX:d,originalY:g,width:o,height:l,stickyIndices:s,fixedSize:V.value,fixedWidth:H.value,gap:n.value.gap||0,columnGap:n.value.columnGap||0,getItemQueryY:S,getItemQueryX:x}),ie=h.value?O.value/Z.value+(i+C-O.value)-te:i-f,ae=h.value?k.value/Ae.value+(a+ee-k.value)-w:a-p,E=m.get(e);E&&E.item===t&&E.offset.x===ie&&E.offset.y===ae&&E.size.width===o&&E.size.height===l&&E.isSticky===u&&E.isStickyActive===_&&E.isStickyActiveX===v&&E.isStickyActiveY===y&&E.stickyOffset.x===b.x&&E.stickyOffset.y===b.y?r.push(E):r.push({item:t,index:e,offset:{x:ie,y:ae},size:{width:o,height:l},originalX:d,originalY:g,isSticky:u,isStickyActive:_,isStickyActiveX:v,isStickyActiveY:y,stickyOffset:b})}return We=r,r}),Ke=(0,t.computed)(()=>{P.value;let e=je.value+W.value,t=Q.value+K.value,n=je.value+(b.value-G.value)-1,r=Q.value+(x.value-ge.value)-1,i=Be(e),s=ze(t),c=ze(z.value===`horizontal`?n:r),l=Be(n);return{items:Ge.value,currentIndex:s,currentColIndex:i,currentEndIndex:c,currentEndColIndex:l,scrollOffset:{x:O.value,y:k.value},displayScrollOffset:{x:y.value?Math.abs(a.value+ae.x):Math.max(0,a.value-ae.x),y:Math.max(0,o.value-ae.y)},viewportSize:{width:b.value,height:x.value},displayViewportSize:{width:b.value,height:x.value},totalSize:{width:Y.value,height:X.value},isScrolling:m.value,isProgrammaticScroll:D.value,range:Ve.value,columnRange:Ue.value}}),qe=()=>{D.value=!1,R.value=null},Je=e=>{let t=e.target;typeof window>`u`||(A(),t===window||t===document?(a.value=window.scrollX,o.value=window.scrollY,b.value=document.documentElement.clientWidth,x.value=document.documentElement.clientHeight):l(t)&&(a.value=t.scrollLeft,o.value=t.scrollTop,b.value=t.clientWidth,x.value=t.clientHeight),O.value=S(y.value?Math.abs(a.value):a.value,Te.x,Z.value),k.value=S(o.value,Te.y,Ae.value),m.value||=(D.value||(R.value=null),!0),clearTimeout(E),E=setTimeout(()=>{m.value=!1,D.value=!1},250))},Ye=e=>{let t=!1,r=0,i=0,a=n.value.gap||0,o=n.value.columnGap||0,s=je.value,c=Q.value,l=ze(z.value===`horizontal`?s:c),u=Be(s),d=z.value===`horizontal`,f=z.value===`both`,p=new Set,m=new Set,h=(e,i)=>{if(e>=0&&e<(n.value.columnCount||0)&&!m.has(e)){m.add(e);let n=N.get(e),a=i+o;if(!F[e]||Math.abs(n-a)>.1){let i=a-n;Math.abs(i)>.1&&(N.update(e,i),t=!0,e<u&&(r+=i)),F[e]=1}}};for(let{index:s,inlineSize:c,blockSize:u,element:m}of e){if(c<=0&&u<=0)continue;let e=B.value||typeof n.value.itemSize==`function`;if(s>=0&&!p.has(s)&&e&&u>0){if(p.add(s),d&&c>0){let e=j.get(s),n=c+o;if(!I[s]||Math.abs(n-e)>.1){let i=n-e;j.update(s,i),I[s]=1,t=!0,s<l&&(r+=i)}}if(!d){let e=M.get(s),n=u+a;if(!L[s]||Math.abs(n-e)>.1){let r=n-e;M.update(s,r),L[s]=1,t=!0,s<l&&(i+=r)}}}let g=le.value||typeof n.value.columnWidth==`function`;if(f&&m&&n.value.columnCount&&g&&(c>0||m.dataset.colIndex===void 0)){let e=m.dataset.colIndex;if(e!=null)h(Number.parseInt(e,10),c);else{let e=Array.from(m.querySelectorAll(`[data-col-index]`));for(let t of e)h(Number.parseInt(t.dataset.colIndex,10),t.getBoundingClientRect().width)}}}if(t&&(P.value++,!(R.value!==null||D.value)&&(r!==0||i!==0))){let e=q.value+W.value+U.value,t=J.value+K.value+me.value;Fe(r===0?null:s+r+e,i===0?null:c+i+t,{behavior:`auto`})}},Xe=(e,t,n,r)=>{Ye([{index:e,inlineSize:t,blockSize:n,element:r}])};function Ze(){if(R.value&&!_.value){let{rowIndex:e,colIndex:t,options:r}=R.value;if(d(r)&&r.behavior===`smooth`&&m.value)return;let i=n.value.container||window,a=typeof window<`u`&&i===window?window.scrollX:i.scrollLeft,o=typeof window<`u`&&i===window?window.scrollY:i.scrollTop,s=y.value?Math.abs(a):a,c=o,l=S(s,0,Z.value),u=S(c,0,Ae.value),{targetX:f,targetY:p}=ee({rowIndex:e,colIndex:t,options:r,direction:z.value,viewportWidth:b.value,viewportHeight:x.value,totalWidth:Ce.value,totalHeight:we.value,gap:n.value.gap||0,columnGap:n.value.columnGap||0,fixedSize:V.value,fixedWidth:H.value,relativeScrollX:l,relativeScrollY:u,getItemSizeY:e=>M.get(e),getItemSizeX:e=>j.get(e),getItemQueryY:e=>M.query(e),getItemQueryX:e=>j.query(e),getColumnSize:e=>N.get(e),getColumnQuery:e=>N.query(e),scaleX:Z.value,scaleY:Ae.value,hostOffsetX:Te.x,hostOffsetY:Te.y,stickyIndices:de.value,stickyStartX:W.value,stickyStartY:K.value,stickyEndX:G.value,stickyEndY:ge.value,flowPaddingStartX:q.value,flowPaddingStartY:J.value,paddingStartX:U.value,paddingStartY:me.value,paddingEndX:pe.value,paddingEndY:he.value}),h=t==null||Math.abs(l-f)<2,g=e==null||Math.abs(u-p)<2,_=t==null||t===void 0||F[t]===1,v=e==null||e===void 0||L[e]===1;h&&g?_&&v&&!m.value&&!D.value&&(R.value=null):Pe(e,t,d(r)?{...r,isCorrection:!0}:{align:r,isCorrection:!0})}}(0,t.watch)([P,b,x],Ze),(0,t.watch)(m,e=>{e||Ze()});let Qe=null,$e=null,et,tt=e=>{if(typeof window>`u`)return;let t=e||window,n=t===window||c(t)&&t===document.documentElement?document:t;if(n.addEventListener(`scroll`,Je,{passive:!0}),oe=null,A(),c(t)&&($e=new MutationObserver(()=>A()),$e.observe(t,{attributes:!0,attributeFilter:[`dir`,`style`]})),et=setInterval(A,1e3),t===window){b.value=document.documentElement.clientWidth,x.value=document.documentElement.clientHeight,a.value=window.scrollX,o.value=window.scrollY;let e=()=>{A(),b.value=document.documentElement.clientWidth,x.value=document.documentElement.clientHeight,Re()};return window.addEventListener(`resize`,e),()=>{n.removeEventListener(`scroll`,Je),window.removeEventListener(`resize`,e),$e?.disconnect(),clearInterval(et),oe=null}}else return b.value=t.clientWidth,x.value=t.clientHeight,a.value=t.scrollLeft,o.value=t.scrollTop,Qe=new ResizeObserver(()=>{A(),b.value=t.clientWidth,x.value=t.clientHeight,Re()}),Qe.observe(t),()=>{n.removeEventListener(`scroll`,Je),Qe?.disconnect(),$e?.disconnect(),clearInterval(et),oe=null}},nt;return(0,t.getCurrentInstance)()&&((0,t.onMounted)(()=>{v.value=!0,A(),(0,t.watch)(()=>n.value.container,e=>{nt?.(),nt=tt(e||null)},{immediate:!0}),Re(),(0,t.nextTick)(()=>{if(Re(),n.value.ssrRange||n.value.initialScrollIndex!==void 0){let e=n.value.initialScrollIndex===void 0?n.value.ssrRange?.start:n.value.initialScrollIndex,r=n.value.initialScrollAlign||`start`;e!=null&&Pe(e,n.value.ssrRange?.colStart,{align:r,behavior:`auto`}),h.value=!0,_.value=!0,(0,t.nextTick)(()=>{_.value=!1})}else h.value=!0})}),(0,t.onUnmounted)(()=>{nt?.()})),{renderedItems:Ge,totalWidth:Y,totalHeight:X,renderedWidth:Ee,renderedHeight:De,scrollDetails:Ke,getRowHeight:Ne,getColumnWidth:Me,getRowOffset:e=>J.value+K.value+me.value+M.query(e),getColumnOffset:e=>q.value+W.value+U.value+N.query(e),getItemOffset:e=>z.value===`horizontal`?q.value+W.value+U.value+j.query(e):J.value+K.value+me.value+M.query(e),getItemSize:e=>{if(z.value===`horizontal`)return Math.max(0,j.get(e)-(n.value.columnGap||0));let t=n.value.itemSize;if(typeof t==`number`&&t>0)return t;if(typeof t==`function`){let r=n.value.items[e];return r===void 0?n.value.defaultItemSize||40:t(r,e)}return Math.max(0,M.get(e)-(n.value.gap||0))},scrollToIndex:Pe,scrollToOffset:Fe,stopProgrammaticScroll:qe,updateItemSize:Xe,updateItemSizes:Ye,updateHostOffset:Re,updateDirection:A,columnRange:Ue,refresh:()=>{j.resize(0),M.resize(0),N.resize(0),F.fill(0),I.fill(0),L.fill(0),$()},isHydrated:h,isWindowContainer:Se,isRtl:y,scaleX:Z,scaleY:Ae,componentOffset:Te,renderedVirtualWidth:Oe,renderedVirtualHeight:ke}}function E(e){let n=(0,t.computed)(()=>(0,t.toValue)(e.axis)),r=(0,t.computed)(()=>(0,t.toValue)(e.totalSize)),i=(0,t.computed)(()=>(0,t.toValue)(e.position)),a=(0,t.computed)(()=>(0,t.toValue)(e.viewportSize)),o=(0,t.computed)(()=>(0,t.toValue)(e.containerId)),s=(0,t.computed)(()=>!!(0,t.toValue)(e.isRtl)),c=(0,t.computed)(()=>n.value===`horizontal`),l=(0,t.computed)(()=>r.value<=0?0:Math.min(1,a.value/r.value)),u=(0,t.computed)(()=>{let e=r.value-a.value;return e<=0?0:Math.max(0,Math.min(1,i.value/e))}),d=(0,t.computed)(()=>{let e=a.value>0?32/a.value:.1;return Math.max(Math.min(e,.1),l.value)*100}),f=(0,t.computed)(()=>u.value*(100-d.value)),p=(0,t.computed)(()=>c.value?{inlineSize:`${d.value}%`,insetInlineStart:`${f.value}%`}:{blockSize:`${d.value}%`,insetBlockStart:`${f.value}%`}),m=(0,t.computed)(()=>{let e=a.value,t=`var(--vs-scrollbar-has-cross-gap, var(--vsi-scrollbar-has-cross-gap, 0)) * var(--vs-scrollbar-cross-gap, var(--vsi-scrollbar-size, 8px))`;return c.value?{inlineSize:`calc(${Math.max(0,e-4)}px - ${t})`}:{blockSize:`calc(${Math.max(0,e-4)}px - ${t})`}}),h=(0,t.ref)(!1),g=0,_=0;function v(t){let n=t.currentTarget;if(t.target!==n)return;let i=n.getBoundingClientRect(),o=c.value?i.width:i.height,l=0;l=c.value?s.value?i.right-t.clientX:t.clientX-i.left:t.clientY-i.top;let u=d.value/100*o,f=(l-u/2)/(o-u),p=r.value-a.value,m=f*p;m>p-1&&(m=p),e.scrollToOffset(Math.max(0,Math.min(p,m)))}function y(e){h.value=!0,g=c.value?s.value?-e.clientX:e.clientX:e.clientY,_=i.value,e.currentTarget.setPointerCapture(e.pointerId),e.preventDefault(),e.stopPropagation()}function b(t){if(!h.value)return;let n=t.currentTarget.parentElement;if(!n)return;let i=(c.value?s.value?-t.clientX:t.clientX:t.clientY)-g,o=n.getBoundingClientRect(),l=c.value?o.width:o.height,u=l-d.value/100*l;if(u<=0)return;let f=r.value-a.value,p=_+i/u*f;p>f-1&&(p=f),e.scrollToOffset(Math.max(0,Math.min(f,p)))}function x(e){h.value&&(h.value=!1,e.currentTarget.releasePointerCapture(e.pointerId))}return(0,t.getCurrentInstance)()&&(0,t.onUnmounted)(()=>{h.value=!1}),{viewportPercent:l,positionPercent:u,thumbSizePercent:d,thumbPositionPercent:f,trackStyle:m,thumbStyle:p,trackProps:(0,t.computed)(()=>({class:[`virtual-scrollbar-track`,`virtual-scrollbar-track--${c.value?`horizontal`:`vertical`}`],style:m.value,role:`scrollbar`,"aria-label":(0,t.toValue)(e.ariaLabel),"aria-orientation":n.value,"aria-valuenow":Math.round(i.value),"aria-valuemin":0,"aria-valuemax":Math.round(r.value-a.value),"aria-controls":o.value,tabindex:-1,onMousedown:v})),thumbProps:(0,t.computed)(()=>({class:[`virtual-scrollbar-thumb`,`virtual-scrollbar-thumb--${c.value?`horizontal`:`vertical`}`,{"virtual-scrollbar-thumb--active":h.value}],style:p.value,onPointerdown:y,onPointermove:b,onPointerup:x,onPointercancel:x})),isDragging:h}}var D=(0,t.defineComponent)({__name:`VirtualScrollbar`,props:{axis:{default:`vertical`},totalSize:{},position:{},viewportSize:{},scrollToOffset:{},containerId:{},isRtl:{type:Boolean,default:!1},ariaLabel:{}},emits:[`scrollToOffset`],setup(e,{emit:n}){let r=e,i=n,{trackProps:a,thumbProps:o}=E({axis:()=>r.axis,totalSize:()=>r.totalSize,position:()=>r.position,viewportSize:()=>r.viewportSize,containerId:()=>r.containerId,isRtl:()=>r.isRtl,scrollToOffset:e=>{r.scrollToOffset?.(e),i(`scrollToOffset`,e)}});return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,(0,t.normalizeProps)((0,t.guardReactiveProps)((0,t.unref)(a))),[(0,t.createElementVNode)(`div`,(0,t.normalizeProps)((0,t.guardReactiveProps)((0,t.unref)(o))),null,16)],16))}}),O={key:0,class:`virtual-scroll-scrollbar-container`,"aria-hidden":`true`},k={key:0,class:`virtual-scroll-debug-info`},oe=.95,A=.1,j=((e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n})((0,t.defineComponent)({__name:`VirtualScroll`,props:{containerTag:{default:`div`},wrapperTag:{default:`div`},itemTag:{default:`div`},stickyHeader:{type:Boolean,default:!1},stickyFooter:{type:Boolean,default:!1},virtualScrollbar:{type:Boolean,default:!1},items:{},itemSize:{},direction:{default:`vertical`},bufferBefore:{default:5},bufferAfter:{default:5},container:{},ssrRange:{},columnCount:{default:0},columnWidth:{},scrollPaddingStart:{default:0},scrollPaddingEnd:{default:0},gap:{default:0},columnGap:{default:0},stickyIndices:{default:()=>[]},loadDistance:{default:200},loading:{type:Boolean,default:!1},restoreScrollOnPrepend:{type:Boolean,default:!1},initialScrollIndex:{},initialScrollAlign:{},defaultItemSize:{},defaultColumnWidth:{},debug:{type:Boolean,default:!1},role:{},ariaLabel:{},ariaLabelledby:{},itemRole:{default:void 0}},emits:[`scroll`,`load`,`visibleRangeChange`],setup(e,{expose:n,emit:r}){let i=e,a=r,o=(0,t.useSlots)(),s=(0,t.ref)(null),c=(0,t.ref)(null),l=(0,t.ref)(null),u=(0,t.ref)(null),d=new Map,m=(0,t.useId)(),h=(0,t.computed)(()=>`vs-container-${m}`),g=(0,t.ref)(0),_=(0,t.ref)(0),v=(0,t.computed)(()=>i.container===void 0?s.value:i.container),y=(0,t.computed)(()=>{let e=v.value;return e===s.value||typeof window<`u`&&(e===window||e===null)}),b=(0,t.computed)(()=>(i.items.length,{items:i.items,itemSize:i.itemSize,direction:i.direction,bufferBefore:i.bufferBefore,bufferAfter:i.bufferAfter,container:v.value,hostElement:c.value,hostRef:s.value,ssrRange:i.ssrRange,columnCount:i.columnCount,columnWidth:i.columnWidth,scrollPaddingStart:{x:f(i.scrollPaddingStart,i.direction),y:p(i.scrollPaddingStart,i.direction)},scrollPaddingEnd:{x:f(i.scrollPaddingEnd,i.direction),y:p(i.scrollPaddingEnd,i.direction)},flowPaddingStart:{x:0,y:i.stickyHeader?0:g.value},flowPaddingEnd:{x:0,y:i.stickyFooter?0:_.value},stickyStart:{x:0,y:i.stickyHeader&&y.value?g.value:0},stickyEnd:{x:0,y:i.stickyFooter&&y.value?_.value:0},gap:i.gap,columnGap:i.columnGap,stickyIndices:i.stickyIndices,loadDistance:i.loadDistance,loading:i.loading,restoreScrollOnPrepend:i.restoreScrollOnPrepend,initialScrollIndex:i.initialScrollIndex,initialScrollAlign:i.initialScrollAlign,defaultItemSize:i.defaultItemSize,defaultColumnWidth:i.defaultColumnWidth,debug:i.debug})),{isHydrated:x,isRtl:C,columnRange:ee,renderedItems:te,scrollDetails:w,renderedHeight:ne,renderedWidth:re,getColumnWidth:ie,getRowHeight:j,scrollToIndex:M,scrollToOffset:N,updateHostOffset:P,updateItemSizes:F,updateDirection:I,getItemOffset:L,getRowOffset:R,getColumnOffset:se,getItemSize:ce,refresh:z,stopProgrammaticScroll:B,scaleX:le,scaleY:V,isWindowContainer:H,componentOffset:ue,renderedVirtualWidth:de,renderedVirtualHeight:fe}=ae(b),U=(0,t.computed)(()=>le.value!==1||V.value!==1),pe=(0,t.computed)(()=>H.value?!1:i.virtualScrollbar===!0||le.value!==1||V.value!==1);function me(e){let{displayViewportSize:t}=w.value;e>=ne.value-t.height-.5?N(null,1/0):N(null,S(e,ue.y,V.value))}function he(e){let{displayViewportSize:t}=w.value;e>=re.value-t.width-.5?N(1/0,null):N(S(e,ue.x,le.value),null)}let W=E({axis:`vertical`,totalSize:ne,position:(0,t.computed)(()=>w.value.displayScrollOffset.y),viewportSize:(0,t.computed)(()=>w.value.displayViewportSize.height),scrollToOffset:me,containerId:h,isRtl:C}),G=E({axis:`horizontal`,totalSize:re,position:(0,t.computed)(()=>w.value.displayScrollOffset.x),viewportSize:(0,t.computed)(()=>w.value.displayViewportSize.width),scrollToOffset:he,containerId:h,isRtl:C}),K=(0,t.computed)(()=>i.direction===`both`?{...ee.value,padStart:0,padEnd:0}:ee.value);function ge(){z(),I(),(0,t.nextTick)(()=>{let e=[];for(let[t,n]of d.entries())n&&e.push({index:t,inlineSize:n.offsetWidth,blockSize:n.offsetHeight,element:n});e.length>0&&F(e)})}(0,t.watch)(w,(e,t)=>{!x.value||!e||(a(`scroll`,e),(!t||!t.range||!t.columnRange||e.range.start!==t.range.start||e.range.end!==t.range.end||e.columnRange.start!==t.columnRange.start||e.columnRange.end!==t.columnRange.end)&&a(`visibleRangeChange`,{start:e.range.start,end:e.range.end,colStart:e.columnRange.start,colEnd:e.columnRange.end}),!i.loading&&(i.direction!==`horizontal`&&e.totalSize&&e.totalSize.height-(e.scrollOffset.y+e.viewportSize.height)<=i.loadDistance&&a(`load`,`vertical`),i.direction!==`vertical`&&e.totalSize&&e.totalSize.width-(e.scrollOffset.x+e.viewportSize.width)<=i.loadDistance&&a(`load`,`horizontal`)))}),(0,t.watch)(x,e=>{e&&w.value?.range&&w.value?.columnRange&&a(`visibleRangeChange`,{start:w.value.range.start,end:w.value.range.end,colStart:w.value.columnRange.start,colEnd:w.value.columnRange.end})},{once:!0});let q=typeof window>`u`?null:new ResizeObserver(P),_e=typeof window>`u`?null:new ResizeObserver(e=>{let t=[];for(let n of e){let e=n.target,r=Number(e.dataset.index),i=e.dataset.colIndex,a=n.contentRect.width,o=n.contentRect.height;n.borderBoxSize&&n.borderBoxSize.length>0?(a=n.borderBoxSize[0].inlineSize,o=n.borderBoxSize[0].blockSize):(a=e.offsetWidth,o=e.offsetHeight),i===void 0?Number.isNaN(r)||t.push({index:r,inlineSize:a,blockSize:o,element:e}):t.push({index:-1,inlineSize:a,blockSize:o,element:e})}t.length>0&&F(t)}),J=typeof window>`u`?null:new ResizeObserver(()=>{g.value=l.value?.offsetHeight||0,_.value=u.value?.offsetHeight||0,P()});function ve(e,n){(0,t.watch)(e,(e,t)=>{t&&J?.unobserve(t),e?J?.observe(e):n.value=0},{immediate:!0})}ve(l,g),ve(u,_),(0,t.onMounted)(()=>{s.value&&q?.observe(s.value);for(let e of d.values())_e?.observe(e),i.direction===`both`&&e.querySelectorAll(`[data-col-index]`).forEach(e=>_e?.observe(e))}),(0,t.watch)([s,c],([e],[t])=>{t&&q?.unobserve(t),e&&q?.observe(e)}),(0,t.watch)([s,U],([e,t],[n,r])=>{let i=e!==n||t!==r;n&&i&&n.removeEventListener(`wheel`,Z),e&&i&&e.addEventListener(`wheel`,Z,{passive:!t})},{immediate:!0});function ye(e,t){if(e)d.set(t,e),_e?.observe(e),i.direction===`both`&&e.querySelectorAll(`[data-col-index]`).forEach(e=>_e?.observe(e));else{let e=d.get(t);e&&(_e?.unobserve(e),i.direction===`both`&&e.querySelectorAll(`[data-col-index]`).forEach(e=>_e?.unobserve(e)),d.delete(t))}}let be=(0,t.ref)(!1),xe={x:0,y:0},Se={x:0,y:0},Ce={x:0,y:0},we=0,Y={x:0,y:0},X=null;function Te(){let e=()=>{Y.x*=oe,Y.y*=oe;let t=w.value.scrollOffset.x,n=w.value.scrollOffset.y;N(t+Y.x*16,n+Y.y*16,{behavior:`auto`}),Math.abs(Y.x)>A||Math.abs(Y.y)>A?X=requestAnimationFrame(e):Ee()};X=requestAnimationFrame(e)}function Ee(){X!==null&&(cancelAnimationFrame(X),X=null),Y={x:0,y:0}}function De(e){B(),Ee(),U.value&&(e.pointerType===`mouse`&&e.button!==0||(be.value=!0,xe={x:e.clientX,y:e.clientY},Ce={x:e.clientX,y:e.clientY},we=performance.now(),Se={x:w.value.scrollOffset.x,y:w.value.scrollOffset.y},e.currentTarget.setPointerCapture(e.pointerId)))}function Oe(e){if(!be.value)return;let t=performance.now(),n=t-we;if(n>0){let t=(Ce.x-e.clientX)/n,r=(Ce.y-e.clientY)/n;Y.x=Y.x*.2+t*.8,Y.y=Y.y*.2+r*.8}Ce={x:e.clientX,y:e.clientY},we=t;let r=xe.x-e.clientX,i=xe.y-e.clientY;requestAnimationFrame(()=>{N(Se.x+r,Se.y+i,{behavior:`auto`})})}function ke(e){be.value&&(be.value=!1,e.currentTarget.releasePointerCapture(e.pointerId),(Math.abs(Y.x)>A||Math.abs(Y.y)>A)&&(Math.abs(Y.x)>4*Math.abs(Y.y)?Y.y=0:Math.abs(Y.y)>4*Math.abs(Y.x)&&(Y.x=0),Te()))}function Z(e){let{scrollOffset:t}=w.value;if(B(),U.value){e.preventDefault();let n=e.deltaX,r=e.deltaY;e.shiftKey&&n===0&&(n=r,r=0),N(t.x+n,t.y+r,{behavior:`auto`})}}function Ae(e){let{viewportSize:t,scrollOffset:n}=w.value,r=i.direction!==`vertical`,a=i.direction!==`horizontal`,o=b.value.stickyStart,s=b.value.stickyEnd;switch(e.key){case`Home`:e.preventDefault(),B(),M(0,0,{behavior:Math.max(n.x,n.y)>10*(i.direction===`horizontal`?t.width:t.height)?`auto`:`smooth`,align:`start`});break;case`End`:{e.preventDefault(),B();let r=i.items.length-1,a=(i.columnCount||0)>0?i.columnCount-1:0,{totalSize:o}=w.value,s=Math.max(o.width-n.x-t.width,o.height-n.y-t.height)>10*(i.direction===`horizontal`?t.width:t.height)?`auto`:`smooth`;i.direction===`both`?M(r,a,{behavior:s,align:`end`}):M(i.direction===`vertical`?r:0,i.direction===`horizontal`?r:0,{behavior:s,align:`end`});break}case`ArrowUp`:{if(e.preventDefault(),B(),!a)return;let{currentIndex:t,scrollOffset:n}=w.value,r=n.y+o.y+b.value.scrollPaddingStart.y;R(t)<r-1?M(t,null,{align:`start`}):t>0&&M(t-1,null,{align:`start`});break}case`ArrowDown`:{if(e.preventDefault(),B(),!a)return;let{currentEndIndex:r}=w.value,o=n.y+t.height-(s.y+b.value.scrollPaddingEnd.y);R(r)+j(r)>o+1?M(r,null,{align:`end`}):r<i.items.length-1&&M(r+1,null,{align:`end`});break}case`ArrowLeft`:{if(e.preventDefault(),B(),!r)return;let{currentColIndex:a,currentEndColIndex:c}=w.value;if(C.value){let e=n.x+t.width-(s.x+b.value.scrollPaddingEnd.x);(i.columnCount?se(c)+ie(c):L(c)+ce(c))>e+1?M(null,c,{align:`end`}):c<(i.columnCount?i.columnCount-1:i.items.length-1)&&M(null,c+1,{align:`end`})}else{let e=n.x+o.x+b.value.scrollPaddingStart.x;(i.columnCount?se(a):L(a))<e-1?M(null,a,{align:`start`}):a>0&&M(null,a-1,{align:`start`})}break}case`ArrowRight`:{if(e.preventDefault(),B(),!r)return;let{currentColIndex:a,currentEndColIndex:c}=w.value;if(C.value){let e=n.x+o.x+b.value.scrollPaddingStart.x;(i.columnCount?se(a):L(a))<e-1?M(null,a,{align:`start`}):a>0&&M(null,a-1,{align:`start`})}else{let e=n.x+t.width-(s.x+b.value.scrollPaddingEnd.x);(i.columnCount?se(c)+ie(c):L(c)+ce(c))>e+1?M(null,c,{align:`end`}):c<(i.columnCount?i.columnCount-1:i.items.length-1)&&M(null,c+1,{align:`end`})}break}case`PageUp`:e.preventDefault(),B(),N(!a&&r?n.x-t.width:null,a?n.y-t.height:null);break;case`PageDown`:e.preventDefault(),B(),N(!a&&r?n.x+t.width:null,a?n.y+t.height:null);break}}(0,t.onUnmounted)(()=>{q?.disconnect(),_e?.disconnect(),J?.disconnect()});let je=(0,t.computed)(()=>{let e={...i.direction===`vertical`?{}:{whiteSpace:`nowrap`}};return(pe.value||!H.value)&&(e.overflow=`auto`),U.value&&(e.touchAction=`none`),H.value?e:i.containerTag===`table`?{...e,display:`block`,minInlineSize:i.direction===`vertical`?`100%`:`auto`}:e}),Q=(0,t.computed)(()=>{if(i.direction===`horizontal`)return null;let{displayViewportSize:e,displayScrollOffset:t}=w.value;if(ne.value<=e.height)return null;let n={axis:`vertical`,totalSize:ne.value,position:t.y,viewportSize:e.height,scrollToOffset:me,containerId:h.value,isRtl:C.value,ariaLabel:`Vertical scroll`};return{axis:`vertical`,positionPercent:W.positionPercent.value,viewportPercent:W.viewportPercent.value,thumbSizePercent:W.thumbSizePercent.value,thumbPositionPercent:W.thumbPositionPercent.value,trackProps:W.trackProps.value,thumbProps:W.thumbProps.value,scrollbarProps:n,isDragging:W.isDragging.value}}),Me=(0,t.computed)(()=>{if(i.direction===`vertical`)return null;let{displayViewportSize:e,displayScrollOffset:t}=w.value;if(re.value<=e.width)return null;let n={axis:`horizontal`,totalSize:re.value,position:t.x,viewportSize:e.width,scrollToOffset:he,containerId:h.value,isRtl:C.value,ariaLabel:`Horizontal scroll`};return{axis:`horizontal`,positionPercent:G.positionPercent.value,viewportPercent:G.viewportPercent.value,thumbSizePercent:G.thumbSizePercent.value,thumbPositionPercent:G.thumbPositionPercent.value,trackProps:G.trackProps.value,thumbProps:G.thumbProps.value,scrollbarProps:n,isDragging:G.isDragging.value}}),Ne=(0,t.computed)(()=>{let e=i.direction===`horizontal`,t=i.direction===`vertical`,n=i.direction===`both`,r={inlineSize:t?`100%`:`${de.value}px`,blockSize:e?`100%`:`${fe.value}px`};return x.value||(r.display=`flex`,r.flexDirection=e?`row`:`column`,(e||n)&&i.columnGap&&(r.columnGap=`${i.columnGap}px`),(t||n)&&i.gap&&(r.rowGap=`${i.gap}px`)),r}),Pe=(0,t.computed)(()=>{let e=i.direction===`horizontal`;return{display:e?`inline-block`:`block`,...e?{blockSize:`100%`,verticalAlign:`top`}:{inlineSize:`100%`}}}),Fe=(0,t.computed)(()=>({inlineSize:i.direction===`vertical`?`1px`:`${de.value}px`,blockSize:i.direction===`horizontal`?`1px`:`${fe.value}px`}));function Ie(e){let t=T({containerTag:i.containerTag||`div`,direction:i.direction,isHydrated:x.value,item:e,itemSize:i.itemSize,paddingStartX:b.value.scrollPaddingStart.x,paddingStartY:b.value.scrollPaddingStart.y,isRtl:C.value});return!x.value&&i.direction===`both`&&(t.display=`flex`,i.columnGap&&(t.columnGap=`${i.columnGap}px`)),t}let Le=(0,t.computed)(()=>i.debug),$=(0,t.computed)(()=>i.containerTag===`table`),Re=(0,t.computed)(()=>$.value?`thead`:`div`),ze=(0,t.computed)(()=>$.value?`tfoot`:`div`),Be=(0,t.computed)(()=>i.role?i.role:$.value?null:i.direction===`both`?`grid`:`list`),Ve=(0,t.computed)(()=>Be.value===`grid`||$.value),He=(0,t.computed)(()=>$.value?null:i.ariaLabel||i.ariaLabelledby?`region`:`none`),Ue=(0,t.computed)(()=>$.value?null:Be.value),We=(0,t.computed)(()=>{if(Ve.value)return`row`;let e=Be.value;return e===`tree`?`treeitem`:e===`listbox`?`option`:e===`menu`?`menuitem`:`listitem`}),Ge=(0,t.computed)(()=>i.itemRole==null?We.value:i.itemRole),Ke=(0,t.computed)(()=>i.role===`grid`||!i.role&&i.direction===`both`?`gridcell`:$.value?`cell`:null),qe=(0,t.computed)(()=>{let e=Ge.value;return e==null||e!==`none`&&e!==`presentation`}),Je=(0,t.computed)(()=>({"aria-label":i.ariaLabel,"aria-labelledby":i.ariaLabelledby,"aria-busy":i.loading?`true`:void 0})),Ye=(0,t.computed)(()=>{let e={},t=Be.value;return t&&[`grid`,`tree`,`listbox`,`menu`,`tablist`].includes(t)&&(e[`aria-orientation`]=i.direction===`both`?void 0:i.direction),Ve.value&&(e[`aria-rowcount`]=i.items.length,i.columnCount>0&&(e[`aria-colcount`]=i.columnCount)),e});function Xe(e){let t={};Ve.value?t[`aria-rowindex`]=e+1:(t[`aria-setsize`]=i.items.length,t[`aria-posinset`]=e+1);let n=Ge.value;return n!==null&&(t.role=n===`none`||n===`presentation`?We.value:n),t}function Ze(e){let t=Ke.value;if(!t)return{};let n={role:t};return Ve.value&&(n[`aria-colindex`]=e+1),n}return n({...(0,t.toRefs)(i),scrollDetails:w,columnRange:ee,getColumnWidth:ie,getRowHeight:j,getCellAriaProps:Ze,getItemAriaProps:Xe,getRowOffset:R,getColumnOffset:se,getItemOffset:L,getItemSize:ce,scrollToIndex:M,scrollToOffset:N,refresh:ge,stopProgrammaticScroll:()=>{B(),Ee()},updateDirection:I,isRtl:C,isHydrated:x,scaleX:le,scaleY:V,renderedWidth:re,renderedHeight:ne,componentOffset:ue,scrollbarPropsVertical:Q,scrollbarPropsHorizontal:Me}),(n,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.containerTag),(0,t.mergeProps)({id:h.value,ref_key:`hostRef`,ref:s,class:[`virtual-scroll-container`,[`virtual-scroll--${e.direction}`,{"virtual-scroll--hydrated":(0,t.unref)(x),"virtual-scroll--window":(0,t.unref)(H),"virtual-scroll--table":$.value,"virtual-scroll--hide-scrollbar":pe.value}]],style:je.value,tabindex:`0`,role:$.value?void 0:He.value},$.value?{...Je.value,...Ye.value}:Je.value,{onKeydown:Ae,onPointerdown:De,onPointermove:Oe,onPointerup:ke,onPointercancel:ke}),{default:(0,t.withCtx)(()=>[pe.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,O,[(0,t.createElementVNode)(`div`,{class:`virtual-scroll-scrollbar-viewport`,style:(0,t.normalizeStyle)({inlineSize:`${(0,t.unref)(w).displayViewportSize.width}px`,blockSize:`${(0,t.unref)(w).displayViewportSize.height}px`,"--vsi-scrollbar-has-cross-gap":e.direction===`both`?1:0})},[o.scrollbar&&Q.value?(0,t.renderSlot)(n.$slots,`scrollbar`,(0,t.normalizeProps)((0,t.mergeProps)({key:0},Q.value)),void 0,!0):Q.value?((0,t.openBlock)(),(0,t.createBlock)(D,(0,t.normalizeProps)((0,t.mergeProps)({key:1},Q.value.scrollbarProps)),null,16)):(0,t.createCommentVNode)(``,!0),o.scrollbar&&Me.value?(0,t.renderSlot)(n.$slots,`scrollbar`,(0,t.normalizeProps)((0,t.mergeProps)({key:2},Me.value)),void 0,!0):Me.value?((0,t.openBlock)(),(0,t.createBlock)(D,(0,t.normalizeProps)((0,t.mergeProps)({key:3},Me.value.scrollbarProps)),null,16)):(0,t.createCommentVNode)(``,!0)],4)])):(0,t.createCommentVNode)(``,!0),o.header?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(Re.value),{key:1,ref_key:`headerRef`,ref:l,class:(0,t.normalizeClass)([`virtual-scroll-header`,{"virtual-scroll--sticky":e.stickyHeader}]),role:$.value?void 0:`none`},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(n.$slots,`header`,{},void 0,!0)]),_:3},8,[`class`,`role`])):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.wrapperTag),(0,t.mergeProps)({ref_key:`wrapperRef`,ref:c,class:`virtual-scroll-wrapper`,style:Ne.value,role:$.value?void 0:Ue.value},$.value?{}:Ye.value),{default:(0,t.withCtx)(()=>[$.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.itemTag),{key:0,class:`virtual-scroll-spacer`,style:(0,t.normalizeStyle)(Fe.value)},{default:(0,t.withCtx)(()=>[...r[0]||=[(0,t.createElementVNode)(`td`,{style:{padding:`0`,border:`none`,"block-size":`inherit`}},null,-1)]]),_:1},8,[`style`])):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(te),r=>((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.itemTag),(0,t.mergeProps)({key:r.index,ref_for:!0,ref:e=>ye(e,r.index),"data-index":r.index,class:[`virtual-scroll-item`,{"virtual-scroll--sticky":r.isStickyActive,"virtual-scroll--debug":Le.value}],style:Ie(r)},{ref_for:!0},qe.value?Xe(r.index):{role:`none`}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(n.$slots,`item`,{item:r.item,index:r.index,getItemAriaProps:Xe,columnRange:K.value,getColumnWidth:(0,t.unref)(ie),getCellAriaProps:Ze,gap:i.gap,columnGap:i.columnGap,isSticky:r.isSticky,isStickyActive:r.isStickyActive,isStickyActiveX:r.isStickyActiveX,isStickyActiveY:r.isStickyActiveY,offset:r.offset},void 0,!0),Le.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,k,` #`+(0,t.toDisplayString)(r.index)+` (`+(0,t.toDisplayString)(Math.round(r.offset.x))+`, `+(0,t.toDisplayString)(Math.round(r.offset.y))+`) `,1)):(0,t.createCommentVNode)(``,!0)]),_:2},1040,[`data-index`,`class`,`style`]))),128))]),_:3},16,[`style`,`role`])),e.loading&&o.loading?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:2,class:`virtual-scroll-loading`,style:(0,t.normalizeStyle)(Pe.value),"aria-live":`polite`,"aria-atomic":`true`},[(0,t.renderSlot)(n.$slots,`loading`,{},void 0,!0)],4)):(0,t.createCommentVNode)(``,!0),o.footer?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(ze.value),{key:3,ref_key:`footerRef`,ref:u,class:(0,t.normalizeClass)([`virtual-scroll-footer`,{"virtual-scroll--sticky":e.stickyFooter}]),role:$.value?void 0:`none`},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(n.$slots,`footer`,{},void 0,!0)]),_:3},8,[`class`,`role`])):(0,t.createCommentVNode)(``,!0)]),_:3},16,[`id`,`class`,`style`,`role`]))}}),[[`__scopeId`,`data-v-184bc0a9`]]);e.BROWSER_MAX_SIZE=i,e.DEFAULT_BUFFER=5,e.DEFAULT_COLUMN_WIDTH=100,e.DEFAULT_ITEM_SIZE=40,e.EMPTY_SCROLL_DETAILS=n,e.FenwickTree=r,e.VirtualScroll=j,e.VirtualScrollbar=D,e.calculateColumnRange=w,e.calculateItemPosition=re,e.calculateItemStyle=T,e.calculateRange=te,e.calculateScrollTarget=ee,e.calculateStickyItem=ne,e.calculateTotalSize=ie,e.displayToVirtual=S,e.findPrevStickyIndex=g,e.getPaddingX=f,e.getPaddingY=p,e.isBody=o,e.isElement=c,e.isItemVisible=x,e.isScrollToIndexOptions=d,e.isScrollableElement=l,e.isWindow=a,e.isWindowLike=s,e.scrollTo=u,e.useVirtualScroll=ae,e.useVirtualScrollbar=E,e.virtualToDisplay=C});
2
2
  //# sourceMappingURL=index.js.map