import{r as t,a as e}from"./vendor-react-RSDKEZ60.js";function s(t,e,s){let i,n=s.initialDeps??[],o=!0;function l(){const l=t();return l.length!==n.length||l.some((t,e)=>n[e]!==t)?(n=l,i=e(...l),!(null==s?void 0:s.onChange)||o&&s.skipInitialOnChange||s.onChange(i),o=!1,i):i}return l.updateDeps=t=>{n=t},l}function i(t,e){if(void 0===t)throw new Error("Unexpected undefined");return t}const n=(t,e,s)=>{let i;return function(...n){t.clearTimeout(i),i=t.setTimeout(()=>e.apply(this,n),s)}};let o;const l=()=>{if(void 0!==o)return o;if("undefined"==typeof navigator)return o=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return o=!0;const t=navigator.maxTouchPoints;return o="MacIntel"===navigator.platform&&void 0!==t&&t>0},r=t=>{const{offsetWidth:e,offsetHeight:s}=t;return{width:e,height:s}},h=t=>t,a=t=>{const e=Math.max(t.startIndex-t.overscan,0),s=Math.min(t.endIndex+t.overscan,t.count-1)-e+1,i=new Array(s);for(let n=0;n<s;n++)i[n]=e+n;return i},c=(t,e)=>{const s=t.scrollElement;if(!s)return;const i=t.targetWindow;if(!i)return;const n=t=>{const{width:s,height:i}=t;e({width:Math.round(s),height:Math.round(i)})};if(n(r(s)),!i.ResizeObserver)return()=>{};const o=new i.ResizeObserver(e=>{const i=()=>{const t=e[0];if(null==t?void 0:t.borderBoxSize){const e=t.borderBoxSize[0];if(e)return void n({width:e.inlineSize,height:e.blockSize})}n(r(s))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()});return o.observe(s,{box:"border-box"}),()=>{o.unobserve(s)}},d={passive:!0},u="undefined"==typeof window||"onscrollend"in window,f=(t,e)=>((t,e,s)=>{const i=t.scrollElement;if(!i)return;const o=t.targetWindow;if(!o)return;const l=t.options.useScrollendEvent&&u;let r=0;const h=l?null:n(o,()=>e(r,!1),t.options.isScrollingResetDelay),a=t=>()=>{r=s(i),null==h||h(),e(r,t)},c=a(!0),f=a(!1);return i.addEventListener("scroll",c,d),l&&i.addEventListener("scrollend",f,d),()=>{i.removeEventListener("scroll",c),l&&i.removeEventListener("scrollend",f)}})(t,e,e=>{const{horizontal:s,isRtl:i}=t.options;return s?e.scrollLeft*(i?-1:1):e.scrollTop}),m=(t,e,s)=>{if(s.options.useCachedMeasurements){const e=s.indexFromElement(t),i=s.options.getItemKey(e);return s.itemSizeCache.get(i)??s.options.estimateSize(e)}if(null==e?void 0:e.borderBoxSize){const t=e.borderBoxSize[0];if(t){return Math.round(t[s.options.horizontal?"inlineSize":"blockSize"])}}if(!e){const e=s.indexFromElement(t),i=s.options.getItemKey(e),n=s.itemSizeCache.get(i);if(void 0!==n)return n}return t[s.options.horizontal?"offsetWidth":"offsetHeight"]},g=(t,{adjustments:e=0,behavior:s},i)=>{var n,o;null==(o=null==(n=i.scrollElement)?void 0:n.scrollTo)||o.call(n,{[i.options.horizontal?"left":"top"]:t+e,behavior:s})};class p{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var t,e,s;return(null==(s=null==(e=null==(t=this.targetWindow)?void 0:t.performance)?void 0:e.now)?void 0:s.call(e))??Date.now()},this.observer=(()=>{let t=null;const e=()=>t||(this.targetWindow&&this.targetWindow.ResizeObserver?t=new this.targetWindow.ResizeObserver(t=>{t.forEach(t=>{const e=()=>{const e=t.target,s=this.indexFromElement(e);if(e.isConnected)this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(e,t,this));else{this.observer.unobserve(e);for(const[t,s]of this.elementsCache)if(s===e){this.elementsCache.delete(t);break}}};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(e):e()})}):null);return{disconnect:()=>{var s;null==(s=e())||s.disconnect(),t=null},observe:t=>{var s;return null==(s=e())?void 0:s.observe(t,{box:"border-box"})},unobserve:t=>{var s;return null==(s=e())?void 0:s.unobserve(t)}}})(),this.range=null,this.setOptions=t=>{var e,s;const i={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:h,rangeExtractor:a,onChange:()=>{},measureElement:m,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const h in t){const e=t[h];void 0!==e&&(i[h]=e)}const n=this.options;let o=null,l=null,r=!1;if(void 0!==n&&n.enabled&&i.enabled&&"end"===i.anchorTo&&null!==this.scrollElement){const t=n.count,h=i.count,a=this.getMeasurements(),c=t>0?(null==(e=a[0])?void 0:e.key)??n.getItemKey(0):null,d=t>0?(null==(s=a[t-1])?void 0:s.key)??n.getItemKey(t-1):null;if(h!==t||t>0&&h>0&&(i.getItemKey(0)!==c||i.getItemKey(h-1)!==d)){r=!0;const e=t>0?this.getVirtualItemForOffset(this.getScrollOffset())??a[0]:null;e&&(o=[e.key,this.getScrollOffset()-e.start]);const s=!0===i.followOnAppend?"auto":i.followOnAppend||null;s&&h>t&&this.isAtEnd(n.scrollEndThreshold)&&(0===t||i.getItemKey(h-1)!==d)&&(l=s)}}this.options=i,r&&(this.pendingMin=0,this.itemSizeCacheVersion++);let c=!1,d=0;if(o&&null!==this.scrollOffset){const[t,e]=o,s=this.getMeasurements(),{count:i,getItemKey:n}=this.options;let l=0;for(;l<i&&n(l)!==t;)l++;if(l<i){const t=s[l];if(t){const s=t.start+e;s!==this.scrollOffset&&(d=s-this.scrollOffset,this.scrollOffset=s,c=!0)}}}(c||l)&&(this.pendingScrollAnchor=[c?o[0]:null,c?o[1]:0,l,d])},this.notify=t=>{var e,s;null==(s=(e=this.options).onChange)||s.call(e,this,t)},this.maybeNotify=s(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),null!=this.rafId&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e)return void this.maybeNotify();if(this.scrollElement=e,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(t=this.scrollElement)?void 0:t.window)??null,this.elementsCache.forEach(t=>{this.observer.observe(t)}),this.unsubs.push(this.options.observeElementRect(this,t=>{this.scrollRect=t,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(t,e)=>{if(e&&null===this._intendedScrollOffset&&t===this.scrollOffset)return;null!==this._intendedScrollOffset&&Math.abs(t-this._intendedScrollOffset)<1.5&&(t=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;const s=this.getScrollOffset();this.scrollDirection=e?s===t?this.scrollDirection:s<t?"forward":"backward":null,this.scrollOffset=t,this.isScrolling=e,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const t=this.scrollElement,e=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},s=()=>{this._iosTouching=!1,l()&&null!=this.targetWindow&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};t.addEventListener("touchstart",e,d),t.addEventListener("touchend",s,d),this.unsubs.push(()=>{t.removeEventListener("touchstart",e),t.removeEventListener("touchend",s),null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const s=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,s&&this.scrollElement&&this.options.enabled){const[t,e,i,n]=s;null===t||i||(l()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?0!==n&&(this._iosDeferredAdjustment+=n):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),i&&this.scrollToEnd({behavior:i})}},this._flushIosDeferredIfReady=()=>{if(0===this._iosDeferredAdjustment)return;if(this.isScrolling)return;if(this._iosTouching)return;if(this._iosJustTouchEnded)return;const t=this.getScrollOffset(),e=this.getMaxScrollOffset();if(t<0||t>e)return;const s=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(t,{adjustments:this.scrollAdjustments+=s,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,e)=>{const s=new Map,i=new Map;for(let n=e-1;n>=0;n--){const e=t[n];if(s.has(e.lane))continue;const o=i.get(e.lane);if(null==o||e.end>o.end?i.set(e.lane,e):e.end<o.end&&s.set(e.lane,!0),s.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((t,e)=>t.end===e.end?t.index-e.index:t.end-e.end)[0]:void 0},this.getMeasurementOptions=s(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(t,e,s,i,n,o,l)=>(void 0!==this.prevLanes&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMin=null,{count:t,paddingStart:e,scrollMargin:s,getItemKey:i,enabled:n,lanes:o,laneAssignmentMode:l}),{key:!1}),this.getMeasurements=s(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:e,scrollMargin:s,getItemKey:i,enabled:n,lanes:o,laneAssignmentMode:l},r)=>{const h=this.itemSizeCache;if(!n)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const u of this.laneAssignments.keys())u>=t&&this.laneAssignments.delete(u);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),0!==this.measurementsCache.length||this.lanesSettling||(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(t=>{this.itemSizeCache.set(t.key,t.size)}));const a=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),1===o){const n=this.options.gap,o=2*t;let l,r=this._flatMeasurements;if(!r||r.length<o){const t=new Float64Array(o);r&&a>0&&t.set(r.subarray(0,2*a)),r=t,this._flatMeasurements=r}if(0===a)l=e+s;else{const t=a-1;l=r[2*t]+r[2*t+1]+n}for(let e=a;e<t;e++){const t=i(e),s=h.get(t),o="number"==typeof s?s:this.options.estimateSize(e);r[2*e]=l,r[2*e+1]=o,l+=o+n}const c=function(t,e,s){const i=new Array(t);return new Proxy(i,{get(i,n,o){if("string"==typeof n){const o=n.charCodeAt(0);if(o>=48&&o<=57){const o=+n;if(Number.isInteger(o)&&o>=0&&o<t){let t=i[o];if(!t){const n=e[2*o];t=i[o]={index:o,key:s(o),start:n,size:e[2*o+1],end:n+e[2*o+1],lane:0}}return t}}if("length"===n)return t}return Reflect.get(i,n,o)}})}(t,r,i);return this.measurementsCache=c,c}const c=this.measurementsCache.slice(0,a),d=new Array(o).fill(void 0);for(let u=0;u<a;u++){const t=c[u];t&&(d[t.lane]=u)}for(let u=a;u<t;u++){const t=i(u),n=this.laneAssignments.get(u);let o,r;const a="estimate"===l||h.has(t);if(void 0!==n&&this.options.lanes>1){o=n;const t=d[o],i=void 0!==t?c[t]:void 0;r=i?i.end+this.options.gap:e+s}else{const t=1===this.options.lanes?c[u-1]:this.getFurthestMeasurement(c,u);r=t?t.end+this.options.gap:e+s,o=t?t.lane:u%this.options.lanes,this.options.lanes>1&&a&&this.laneAssignments.set(u,o)}const f=h.get(t),m="number"==typeof f?f:this.options.estimateSize(u),g=r+m;c[u]={index:u,start:r,size:m,end:g,key:t,lane:o},d[o]=u}return this.measurementsCache=c,c},{key:!1,debug:()=>this.options.debug}),this.calculateRange=s(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,e,s,i)=>this.range=t.length>0&&e>0?function({measurements:t,outerSize:e,scrollOffset:s,lanes:i,flat:n}){const o=t.length-1,l=n?t=>n[2*t]:e=>t[e].start,r=n?t=>n[2*t]+n[2*t+1]:e=>t[e].end;if(t.length<=i)return{startIndex:0,endIndex:o};let h=S(0,o,l,s),a=h;if(1===i)for(;a<o&&r(a)<s+e;)a++;else if(i>1){const n=Array(i).fill(0);for(;a<o&&n.some(t=>t<s+e);){const e=t[a];n[e.lane]=e.end,a++}const l=Array(i).fill(s+e);for(;h>=0&&l.some(t=>t>=s);){const e=t[h];l[e.lane]=e.start,h--}h=Math.max(0,h-h%i),a=Math.min(o,a+(i-1-a%i))}return{startIndex:h,endIndex:a}}({measurements:t,outerSize:e,scrollOffset:s,lanes:i,flat:1===i&&null!=this._flatMeasurements?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=s(()=>{let t=null,e=null;const s=this.calculateRange();return s&&(t=s.startIndex,e=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,e]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,e]},(t,e,s,i,n)=>null===i||null===n?[]:t({startIndex:i,endIndex:n,overscan:e,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const e=this.options.indexAttribute,s=t.getAttribute(e);return s?parseInt(s,10):(console.warn(`Missing attribute name '${e}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var e;if(!this.scrollState||"smooth"!==this.scrollState.behavior)return!0;const s=this.scrollState.index??(null==(e=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))?void 0:e.index);if(void 0!==s&&this.range){const e=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),i=Math.max(0,s-e),n=Math.min(this.options.count-1,s+e);return t>=i&&t<=n}return!0},this.measureElement=t=>{if(!t)return void this.elementsCache.forEach((t,e)=>{t.isConnected||(this.observer.unobserve(t),this.elementsCache.delete(e))});const e=this.indexFromElement(t),s=this.options.getItemKey(e),i=this.elementsCache.get(s);i!==t&&(i&&this.observer.unobserve(i),this.observer.observe(t),this.elementsCache.set(s,t)),this.isScrolling&&!this.scrollState||!this.shouldMeasureDuringScroll(e)||this.resizeItem(e,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,e)=>{var s,i;if(t<0||t>=this.options.count)return;let n,o,l;const r=this._flatMeasurements;if(1===this.options.lanes&&null!==r)l=this.options.getItemKey(t),o=r[2*t],n=r[2*t+1];else{const e=this.measurementsCache[t];if(!e)return;l=e.key,o=e.start,n=e.size}const h=e-(this.itemSizeCache.get(l)??n);if(0!==h){const r="end"===this.options.anchorTo&&"smooth"!==(null==(s=this.scrollState)?void 0:s.behavior)&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,a=r?this.getTotalSize():0,c="smooth"!==(null==(i=this.scrollState)?void 0:i.behavior)&&(void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:l,start:o,size:n,end:o+n,lane:0},h,this):o<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(l)||"backward"!==this.scrollDirection));(null===this.pendingMin||t<this.pendingMin)&&(this.pendingMin=t),this.itemSizeCache.set(l,e),this.itemSizeCacheVersion++,r?this.applyScrollAdjustment(this.getTotalSize()-a):c&&this.applyScrollAdjustment(h),this.notify(!1)}},this.getVirtualItems=s(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,e)=>{const s=[];for(let i=0,n=t.length;i<n;i++){const n=e[t[i]];s.push(n)}return s},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const e=this.getMeasurements();if(0===e.length)return;const s=this._flatMeasurements,n=1===this.options.lanes&&null!=s,o=S(0,e.length-1,n?t=>s[2*t]:t=>i(e[t]).start,t);return i(e[o])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(t=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=t,this.getOffsetForAlignment=(t,e,s=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),n=this.getScrollOffset();"auto"===e&&(e=t>=n+i?"end":"start"),"center"===e?t+=(s-i)/2:"end"===e&&(t-=i);const o=this.getMaxScrollOffset();return Math.max(Math.min(o,t),0)},this.getOffsetForIndex=(t,e="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const s=this.getSize(),i=this.getScrollOffset(),n=this.measurementsCache[t];if(!n)return;if("auto"===e)if(n.end>=i+s-this.options.scrollPaddingEnd)e="end";else{if(!(n.start<=i+this.options.scrollPaddingStart))return[i,e];e="start"}if("end"===e&&t===this.options.count-1)return[this.getMaxScrollOffset(),e];const o="end"===e?n.end+this.options.scrollPaddingEnd:n.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,e,n.size),e]},this.scrollToOffset=(t,{align:e="start",behavior:s="auto"}={})=>{const i=this.getOffsetForAlignment(t,e),n=this.now();this.scrollState={index:null,align:e,behavior:s,startedAt:n,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:e="auto",behavior:s="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const i=this.getOffsetForIndex(t,e);if(!i)return;const[n,o]=i,l=this.now();this.scrollState={index:t,align:o,behavior:s,startedAt:l,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:e="auto"}={})=>{const s=this.getScrollOffset()+t,i=this.now();this.scrollState={index:null,align:"start",behavior:e,startedAt:i,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:e}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:t="auto"}={})=>{this.options.count>0?this.scrollToIndex(this.options.count-1,{align:"end",behavior:t}):this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:t})},this.getTotalSize=()=>{var t;const e=this.getMeasurements();let s;if(0===e.length)s=this.options.paddingStart;else if(1===this.options.lanes){const i=e.length-1,n=this._flatMeasurements;s=null!=n?n[2*i]+n[2*i+1]:(null==(t=e[i])?void 0:t.end)??0}else{const t=Array(this.options.lanes).fill(null);let i=e.length-1;for(;i>=0&&t.some(t=>null===t);){const s=e[i];null===t[s.lane]&&(t[s.lane]=s.end),i--}s=Math.max(...t.filter(t=>null!==t))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const t=[];if(0===this.itemSizeCache.size)return t;const e=this.getMeasurements();for(const s of e)s&&this.itemSizeCache.has(s.key)&&t.push({index:s.index,key:s.key,start:s.start,size:s.size,end:s.end,lane:s.lane});return t},this._scrollToOffset=(t,{adjustments:e,behavior:s})=>{this._intendedScrollOffset=t+(e??0),this.options.scrollToFn(t,{behavior:s,adjustments:e},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,e){0!==t&&(l()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:e}),null!==this.scrollOffset&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){this.targetWindow?null==this.rafId&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})):this.scrollState=null}reconcileScroll(){if(!this.scrollState)return;if(!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3)return void(this.scrollState=null);const t=null!=this.scrollState.index?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,e=t?t[0]:this.scrollState.lastTargetOffset,s=e!==this.scrollState.lastTargetOffset;if(!s&&(i=e,n=this.getScrollOffset(),Math.abs(i-n)<1.01)){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1)return this.getScrollOffset()!==e&&this._scrollToOffset(e,{adjustments:void 0,behavior:"auto"}),void(this.scrollState=null)}else if(this.scrollState.stableFrames=0,s){const t=this.getSize()||600,s=Math.abs(e-this.getScrollOffset()),i="smooth"===this.scrollState.behavior&&s>t;this.scrollState.lastTargetOffset=e,i||(this.scrollState.behavior="auto"),this._scrollToOffset(e,{adjustments:void 0,behavior:i?"smooth":"auto"})}var i,n;this.scheduleScrollReconcile()}}const S=(t,e,s,i)=>{for(;t<=e;){const n=(t+e)/2|0,o=s(n);if(o<i)t=n+1;else{if(!(o>i))return n;e=n-1}}return t>0?t-1:0};const v="undefined"!=typeof document?t.useLayoutEffect:t.useEffect;function b(s){return function({useFlushSync:s=!0,directDomUpdates:i=!1,directDomUpdatesMode:n="transform",...o}){const l=t.useReducer(t=>t+1,0)[1],r=t.useRef({enabled:i,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});r.current.enabled=i,r.current.mode=n;const h=t=>{const e=r.current;if(!e.enabled||!e.container)return;const s=t.getTotalSize();if(s!==e.lastSize){e.lastSize=s;const i=t.options.horizontal?"width":"height";e.container.style[i]=`${s}px`}const i=!!t.options.horizontal,n="transform"===e.mode,o=i?"left":"top",l=t.options.scrollMargin,h=t.getVirtualItems();for(const r of h){const s=r.start-l,h=t.elementsCache.get(r.key);h&&e.lastPositions.get(h)!==s&&(e.lastPositions.set(h,s),n?h.style.transform=i?`translate3d(${s}px, 0, 0)`:`translate3d(0, ${s}px, 0)`:h.style[o]=`${s}px`)}},a={...o,onChange:(t,i)=>{var n;const a=r.current;let c=!0;if(a.enabled){h(t);const e=t.range,s=a.prevRange;c=!s||s.isScrolling!==t.isScrolling||s.startIndex!==(null==e?void 0:e.startIndex)||s.endIndex!==(null==e?void 0:e.endIndex),c&&(a.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}c&&(s&&i?e.flushSync(l):l()),null==(n=o.onChange)||n.call(o,t,i)}},[c]=t.useState(()=>{const t=new p(a);return Object.assign(t,{containerRef:e=>{const s=r.current;if(s.container=e,s.lastSize=null,e&&s.enabled){const i=t.getTotalSize();s.lastSize=i;const n=t.options.horizontal?"width":"height";e.style[n]=`${i}px`}}})});return c.setOptions(a),v(()=>c._didMount(),[]),v(()=>c._willUpdate()),v(()=>{h(c)}),c}({observeElementRect:c,observeElementOffset:f,scrollToFn:g,...s})}export{p as V,c as a,a as d,g as e,f as o,b as u};
