function Z(){var e=window.navigator.userAgent,t=e.indexOf("MSIE ");if(t>0)return parseInt(e.substring(t+5,e.indexOf(".",t)),10);var i=e.indexOf("Trident/");if(i>0){var s=e.indexOf("rv:");return parseInt(e.substring(s+3,e.indexOf(".",s)),10)}var r=e.indexOf("Edge/");return r>0?parseInt(e.substring(r+5,e.indexOf(".",r)),10):-1}let D;function M(){M.init||(M.init=!0,D=Z()!==-1)}var A={name:"ResizeObserver",props:{emitOnMount:{type:Boolean,default:!1},ignoreWidth:{type:Boolean,default:!1},ignoreHeight:{type:Boolean,default:!1}},emits:["notify"],mounted(){M(),Vue.nextTick(()=>{this._w=this.$el.offsetWidth,this._h=this.$el.offsetHeight,this.emitOnMount&&this.emitSize()});const e=document.createElement("object");this._resizeObject=e,e.setAttribute("aria-hidden","true"),e.setAttribute("tabindex",-1),e.onload=this.addResizeHandlers,e.type="text/html",D&&this.$el.appendChild(e),e.data="about:blank",D||this.$el.appendChild(e)},beforeUnmount(){this.removeResizeHandlers()},methods:{compareAndNotify(){(!this.ignoreWidth&&this._w!==this.$el.offsetWidth||!this.ignoreHeight&&this._h!==this.$el.offsetHeight)&&(this._w=this.$el.offsetWidth,this._h=this.$el.offsetHeight,this.emitSize())},emitSize(){this.$emit("notify",{width:this._w,height:this._h})},addResizeHandlers(){this._resizeObject.contentDocument.defaultView.addEventListener("resize",this.compareAndNotify),this.compareAndNotify()},removeResizeHandlers(){this._resizeObject&&this._resizeObject.onload&&(!D&&this._resizeObject.contentDocument&&this._resizeObject.contentDocument.defaultView.removeEventListener("resize",this.compareAndNotify),this.$el.removeChild(this._resizeObject),this._resizeObject.onload=null,this._resizeObject=null)}}};const ee=Vue.withScopeId("data-v-b329ee4c");Vue.pushScopeId("data-v-b329ee4c");const te={class:"resize-observer",tabindex:"-1"};Vue.popScopeId();const ie=ee((e,t,i,s,r,o)=>(Vue.openBlock(),Vue.createBlock("div",te)));A.render=ie;A.__scopeId="data-v-b329ee4c";A.__file="src/components/ResizeObserver.vue";function R(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?R=function(t){return typeof t}:R=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R(e)}function se(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function H(e,t){for(var i=0;ie.length)&&(t=e.length);for(var i=0,s=new Array(t);i2&&arguments[2]!==void 0?arguments[2]:{},s,r,o,l=function(n){for(var d=arguments.length,f=new Array(d>1?d-1:0),g=1;g1){var d=a.find(function(g){return g.isIntersecting});d&&(n=d)}if(r.callback){var f=n.isIntersecting&&n.intersectionRatio>=r.threshold;if(f===r.oldResult)return;r.oldResult=f,r.callback(f,n)}},this.options.intersection),Vue.nextTick(function(){r.observer&&r.observer.observe(r.el)})}}},{key:"destroyObserver",value:function(){this.observer&&(this.observer.disconnect(),this.observer=null),this.callback&&this.callback._clear&&(this.callback._clear(),this.callback=null)}},{key:"threshold",get:function(){return this.options.intersection&&typeof this.options.intersection.threshold=="number"?this.options.intersection.threshold:0}}]),e}();function K(e,t,i){var s=t.value;if(!!s)if(typeof IntersectionObserver>"u")console.warn("[vue-observe-visibility] IntersectionObserver API is not available in your browser. Please install this polyfill: https://github.com/w3c/IntersectionObserver/tree/master/polyfill");else{var r=new de(e,s,i);e._vue_visibilityState=r}}function he(e,t,i){var s=t.value,r=t.oldValue;if(!q(s,r)){var o=e._vue_visibilityState;if(!s){Y(e);return}o?o.createObserver(s,i):K(e,{value:s},i)}}function Y(e){var t=e._vue_visibilityState;t&&(t.destroyObserver(),delete e._vue_visibilityState)}var fe={beforeMount:K,updated:he,unmounted:Y};function me(e){return{all:e=e||new Map,on:function(t,i){var s=e.get(t);s&&s.push(i)||e.set(t,[i])},off:function(t,i){var s=e.get(t);s&&s.splice(s.indexOf(i)>>>0,1)},emit:function(t,i){(e.get(t)||[]).slice().map(function(s){s(i)}),(e.get("*")||[]).slice().map(function(s){s(t,i)})}}}var pe={itemsLimit:1e3},ve=/(auto|scroll)/;function X(e,t){return e.parentNode===null?t:X(e.parentNode,t.concat([e]))}var x=function(t,i){return getComputedStyle(t,null).getPropertyValue(i)},ye=function(t){return x(t,"overflow")+x(t,"overflow-y")+x(t,"overflow-x")},be=function(t){return ve.test(ye(t))};function W(e){if(e instanceof HTMLElement||e instanceof SVGElement){for(var t=X(e.parentNode,[]),i=0;i{this.$_prerender=!1,this.updateVisibleItems(!0),this.ready=!0})},activated(){const e=this.$_lastUpdateScrollPosition;typeof e=="number"&&this.$nextTick(()=>{this.scrollToPosition(e)})},beforeUnmount(){this.removeListeners()},methods:{addView(e,t,i,s,r){const o=Vue.markRaw({id:ze++,index:t,used:!0,key:s,type:r}),l=Vue.shallowReactive({item:i,position:0,nr:o});return e.push(l),l},unuseView(e,t=!1){const i=this.$_unusedViews,s=e.nr.type;let r=i.get(s);r||(r=[],i.set(s,r)),r.push(e),t||(e.nr.used=!1,e.position=-9999,this.$_views.delete(e.nr.key))},handleResize(){this.$emit("resize"),this.ready&&this.updateVisibleItems(!1)},handleScroll(e){this.$_scrollDirty||(this.$_scrollDirty=!0,requestAnimationFrame(()=>{this.$_scrollDirty=!1;const{continuous:t}=this.updateVisibleItems(!1,!0);t||(clearTimeout(this.$_refreshTimout),this.$_refreshTimout=setTimeout(this.handleScroll,100))}))},handleVisibilityChange(e,t){this.ready&&(e||t.boundingClientRect.width!==0||t.boundingClientRect.height!==0?(this.$emit("visible"),requestAnimationFrame(()=>{this.updateVisibleItems(!1)})):this.$emit("hidden"))},updateVisibleItems(e,t=!1){const i=this.itemSize,s=this.gridItems||1,r=this.itemSecondarySize||i,o=this.$_computedMinItemSize,l=this.typeField,a=this.simpleArray?null:this.keyField,n=this.items,d=n.length,f=this.sizes,g=this.$_views,_=this.$_unusedViews,I=this.pool;let m,h,T,b,z;if(!d)m=h=b=z=T=0;else if(this.$_prerender)m=b=0,h=z=Math.min(this.prerender,n.length),T=null;else{const c=this.getScroll();if(t){let v=c.start-this.$_lastUpdateScrollPosition;if(v<0&&(v=-v),i===null&&vc.start&&(L=y),y=~~((N+L)/2);while(y!==F);for(y<0&&(y=0),m=y,T=f[d-1].accumulator,h=y;hd&&(h=d)),b=m;bd&&(h=d),b<0&&(b=0),z>d&&(z=d),T=Math.ceil(d/s)*i}}h-m>pe.itemsLimit&&this.itemsLimitError(),this.totalSize=T;let u;const w=m<=this.$_endIndex&&h>=this.$_startIndex;if(this.$_continuous!==w){if(w){g.clear(),_.clear();for(let c=0,p=I.length;c=h)&&this.unuseView(u));const U=w?null:new Map;let S,$,V,O;for(let c=m;c=V.length)&&(u=this.addView(I,c,S,p,$),this.unuseView(u,!0),V=_.get($)),u=V[O],u.item=S,u.nr.used=!0,u.nr.index=c,u.nr.key=p,u.nr.type=$,U.set($,O+1),O++),g.set(p,u)),i===null?(u.position=f[c-1].accumulator,u.offset=0):(u.position=Math.floor(c/s)*i,u.offset=c%s*r)}return this.$_startIndex=m,this.$_endIndex=h,this.emitUpdate&&this.$emit("update",m,h,b,z),clearTimeout(this.$_sortTimer),this.$_sortTimer=setTimeout(this.sortViews,300),{continuous:w}},getListenerTarget(){let e=W(this.$el);return window.document&&(e===window.document.documentElement||e===window.document.body)&&(e=window),e},getScroll(){const{$el:e,direction:t}=this,i=t==="vertical";let s;if(this.pageMode){const r=e.getBoundingClientRect(),o=i?r.height:r.width;let l=-(i?r.top:r.left),a=i?window.innerHeight:window.innerWidth;l<0&&(a+=l,l=0),l+a>o&&(a=o-l),s={start:l,end:l+a}}else i?s={start:e.scrollTop,end:e.scrollTop+e.clientHeight}:s={start:e.scrollLeft,end:e.scrollLeft+e.clientWidth};return s},applyPageMode(){this.pageMode?this.addListeners():this.removeListeners()},addListeners(){this.listenerTarget=this.getListenerTarget(),this.listenerTarget.addEventListener("scroll",this.handleScroll,E?{passive:!0}:!1),this.listenerTarget.addEventListener("resize",this.handleResize)},removeListeners(){!this.listenerTarget||(this.listenerTarget.removeEventListener("scroll",this.handleScroll),this.listenerTarget.removeEventListener("resize",this.handleResize),this.listenerTarget=null)},scrollToItem(e){let t;this.itemSize===null?t=e>0?this.sizes[e-1].accumulator:0:t=Math.floor(e/this.gridItems)*this.itemSize,this.scrollToPosition(t)},scrollToPosition(e){const t=this.direction==="vertical"?{scroll:"scrollTop",start:"top"}:{scroll:"scrollLeft",start:"left"};let i,s,r;if(this.pageMode){const o=W(this.$el),l=o.tagName==="HTML"?0:o[t.scroll],a=o.getBoundingClientRect(),d=this.$el.getBoundingClientRect()[t.start]-a[t.start];i=o,s=t.scroll,r=e+l+d}else i=this.$el,s=t.scroll,r=e;i[s]=r},itemsLimitError(){throw setTimeout(()=>{console.log("It seems the scroller element isn't scrolling, so it tries to render all the items at once.","Scroller:",this.$el),console.log("Make sure the scroller has a fixed height (or width) and 'overflow-y' (or 'overflow-x') set to 'auto' so it can scroll correctly and only render the items visible in the scroll viewport.")}),new Error("Rendered items limit reached")},sortViews(){this.pool.sort((e,t)=>e.index-t.index)}}};const Se={key:0,ref:"before",class:"vue-recycle-scroller__slot"},$e={key:1,ref:"after",class:"vue-recycle-scroller__slot"};function _e(e,t,i,s,r,o){const l=Vue.resolveComponent("ResizeObserver"),a=Vue.resolveDirective("observe-visibility");return Vue.withDirectives((Vue.openBlock(),Vue.createElementBlock("div",{class:Vue.normalizeClass(["vue-recycle-scroller",{ready:r.ready,"page-mode":i.pageMode,[`direction-${e.direction}`]:!0}]),onScrollPassive:t[0]||(t[0]=(...n)=>o.handleScroll&&o.handleScroll(...n))},[e.$slots.before?(Vue.openBlock(),Vue.createElementBlock("div",Se,[Vue.renderSlot(e.$slots,"before")],512)):Vue.createCommentVNode("v-if",!0),(Vue.openBlock(),Vue.createBlock(Vue.resolveDynamicComponent(i.listTag),{ref:"wrapper",style:Vue.normalizeStyle({[e.direction==="vertical"?"minHeight":"minWidth"]:r.totalSize+"px"}),class:Vue.normalizeClass(["vue-recycle-scroller__item-wrapper",i.listClass])},{default:Vue.withCtx(()=>[(Vue.openBlock(!0),Vue.createElementBlock(Vue.Fragment,null,Vue.renderList(r.pool,n=>(Vue.openBlock(),Vue.createBlock(Vue.resolveDynamicComponent(i.itemTag),Vue.mergeProps({key:n.nr.id,style:r.ready?{transform:`translate${e.direction==="vertical"?"Y":"X"}(${n.position}px) translate${e.direction==="vertical"?"X":"Y"}(${n.offset}px)`,width:i.gridItems?`${e.direction==="vertical"&&i.itemSecondarySize||i.itemSize}px`:void 0,height:i.gridItems?`${e.direction==="horizontal"&&i.itemSecondarySize||i.itemSize}px`:void 0}:null,class:["vue-recycle-scroller__item-view",[i.itemClass,{hover:!i.skipHover&&r.hoverKey===n.nr.key}]]},Vue.toHandlers(i.skipHover?{}:{mouseenter:()=>{r.hoverKey=n.nr.key},mouseleave:()=>{r.hoverKey=null}})),{default:Vue.withCtx(()=>[Vue.renderSlot(e.$slots,"default",{item:n.item,index:n.nr.index,active:n.nr.used})]),_:2},1040,["style","class"]))),128)),Vue.renderSlot(e.$slots,"empty")]),_:3},8,["style","class"])),e.$slots.after?(Vue.openBlock(),Vue.createElementBlock("div",$e,[Vue.renderSlot(e.$slots,"after")],512)):Vue.createCommentVNode("v-if",!0),Vue.createVNode(l,{onNotify:o.handleResize},null,8,["onNotify"])],34)),[[a,o.handleVisibilityChange]])}B.render=_e;B.__file="src/components/RecycleScroller.vue";var Q={name:"DynamicScroller",components:{RecycleScroller:B},provide(){return typeof ResizeObserver<"u"&&(this.$_resizeObserver=new ResizeObserver(e=>{requestAnimationFrame(()=>{if(!!Array.isArray(e)){for(const t of e)if(t.target){const i=new CustomEvent("resize",{detail:{contentRect:t.contentRect}});t.target.dispatchEvent(i)}}})})),{vscrollData:this.vscrollData,vscrollParent:this,vscrollResizeObserver:this.$_resizeObserver}},inheritAttrs:!1,props:{...G,minItemSize:{type:[Number,String],required:!0}},emits:["resize","visible"],data(){return{vscrollData:{active:!0,sizes:{},validSizes:{},keyField:this.keyField,simpleArray:!1}}},computed:{simpleArray:J,itemsWithSize(){const e=[],{items:t,keyField:i,simpleArray:s}=this,r=this.vscrollData.sizes,o=t.length;for(let l=0;l"u"&&!this.$_undefinedMap[n]&&(d=0),e.push({item:a,id:n,size:d})}return e}},watch:{items(){this.forceUpdate(!1)},simpleArray:{handler(e){this.vscrollData.simpleArray=e},immediate:!0},direction(e){this.forceUpdate(!0)},itemsWithSize(e,t){const i=this.$el.scrollTop;let s=0,r=0;const o=Math.min(e.length,t.length);for(let a=0;a=i);a++)s+=t[a].size||this.minItemSize,r+=e[a].size||this.minItemSize;const l=r-s;l!==0&&(this.$el.scrollTop+=l)}},beforeCreate(){this.$_updates=[],this.$_undefinedSizes=0,this.$_undefinedMap={},this.$_events=me()},activated(){this.vscrollData.active=!0},deactivated(){this.vscrollData.active=!1},unmounted(){this.$_events.all.clear()},methods:{onScrollerResize(){this.$refs.scroller&&this.forceUpdate(),this.$emit("resize")},onScrollerVisible(){this.$_events.emit("vscroll:update",{force:!1}),this.$emit("visible")},forceUpdate(e=!0){(e||this.simpleArray)&&(this.vscrollData.validSizes={}),this.$_events.emit("vscroll:update",{force:!0})},scrollToItem(e){const t=this.$refs.scroller;t&&t.scrollToItem(e)},getItemSize(e,t=void 0){const i=this.simpleArray?t!=null?t:this.items.indexOf(e):e[this.keyField];return this.vscrollData.sizes[i]||0},scrollToBottom(){if(this.$_scrollingToBottom)return;this.$_scrollingToBottom=!0;const e=this.$el;this.$nextTick(()=>{e.scrollTop=e.scrollHeight+5e3;const t=()=>{e.scrollTop=e.scrollHeight+5e3,requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight+5e3,this.$_undefinedSizes===0?this.$_scrollingToBottom=!1:requestAnimationFrame(t)})};requestAnimationFrame(t)})}}};function Ve(e,t,i,s,r,o){const l=Vue.resolveComponent("RecycleScroller");return Vue.openBlock(),Vue.createBlock(l,Vue.mergeProps({ref:"scroller",items:o.itemsWithSize,"min-item-size":i.minItemSize,direction:e.direction,"key-field":"id","list-tag":e.listTag,"item-tag":e.itemTag},e.$attrs,{onResize:o.onScrollerResize,onVisible:o.onScrollerVisible}),{default:Vue.withCtx(({item:a,index:n,active:d})=>[Vue.renderSlot(e.$slots,"default",Vue.normalizeProps(Vue.guardReactiveProps({item:a.item,index:n,active:d,itemWithSize:a})))]),before:Vue.withCtx(()=>[Vue.renderSlot(e.$slots,"before")]),after:Vue.withCtx(()=>[Vue.renderSlot(e.$slots,"after")]),empty:Vue.withCtx(()=>[Vue.renderSlot(e.$slots,"empty")]),_:3},16,["items","min-item-size","direction","list-tag","item-tag","onResize","onVisible"])}Q.render=Ve;Q.__file="src/components/DynamicScroller.vue";var we={name:"DynamicScrollerItem",inject:["vscrollData","vscrollParent","vscrollResizeObserver"],props:{item:{required:!0},watchData:{type:Boolean,default:!1},active:{type:Boolean,required:!0},index:{type:Number,default:void 0},sizeDependencies:{type:[Array,Object],default:null},emitResize:{type:Boolean,default:!1},tag:{type:String,default:"div"}},emits:["resize"],computed:{id(){if(this.vscrollData.simpleArray)return this.index;if(this.item.hasOwnProperty(this.vscrollData.keyField))return this.item[this.vscrollData.keyField];throw new Error(`keyField '${this.vscrollData.keyField}' not found in your item. You should set a valid keyField prop on your Scroller`)},size(){return this.vscrollData.validSizes[this.id]&&this.vscrollData.sizes[this.id]||0},finalActive(){return this.active&&this.vscrollData.active}},watch:{watchData:"updateWatchData",id(){this.size||this.onDataUpdate()},finalActive(e){this.size||(e?this.vscrollParent.$_undefinedMap[this.id]||(this.vscrollParent.$_undefinedSizes++,this.vscrollParent.$_undefinedMap[this.id]=!0):this.vscrollParent.$_undefinedMap[this.id]&&(this.vscrollParent.$_undefinedSizes--,this.vscrollParent.$_undefinedMap[this.id]=!1)),this.vscrollResizeObserver?e?this.observeSize():this.unobserveSize():e&&this.$_pendingVScrollUpdate===this.id&&this.updateSize()}},created(){if(!this.$isServer&&(this.$_forceNextVScrollUpdate=null,this.updateWatchData(),!this.vscrollResizeObserver)){for(const e in this.sizeDependencies)this.$watch(()=>this.sizeDependencies[e],this.onDataUpdate);this.vscrollParent.$_events.on("vscroll:update",this.onVscrollUpdate)}},mounted(){this.vscrollData.active&&(this.updateSize(),this.observeSize())},beforeUnmount(){this.vscrollParent.$_events.off("vscroll:update",this.onVscrollUpdate),this.unobserveSize()},methods:{updateSize(){this.finalActive?this.$_pendingSizeUpdate!==this.id&&(this.$_pendingSizeUpdate=this.id,this.$_forceNextVScrollUpdate=null,this.$_pendingVScrollUpdate=null,this.computeSize(this.id)):this.$_forceNextVScrollUpdate=this.id},updateWatchData(){this.watchData&&!this.vscrollResizeObserver?this.$_watchData=this.$watch("item",()=>{this.onDataUpdate()},{deep:!0}):this.$_watchData&&(this.$_watchData(),this.$_watchData=null)},onVscrollUpdate({force:e}){!this.finalActive&&e&&(this.$_pendingVScrollUpdate=this.id),(this.$_forceNextVScrollUpdate===this.id||e||!this.size)&&this.updateSize()},onDataUpdate(){this.updateSize()},computeSize(e){this.$nextTick(()=>{if(this.id===e){const t=this.$el.offsetWidth,i=this.$el.offsetHeight;this.applySize(t,i)}this.$_pendingSizeUpdate=null})},applySize(e,t){const i=~~(this.vscrollParent.direction==="vertical"?t:e);i&&this.size!==i&&(this.vscrollParent.$_undefinedMap[this.id]&&(this.vscrollParent.$_undefinedSizes--,this.vscrollParent.$_undefinedMap[this.id]=void 0),this.vscrollData.sizes[this.id]=i,this.vscrollData.validSizes[this.id]=!0,this.emitResize&&this.$emit("resize",this.id))},observeSize(){!this.vscrollResizeObserver||!this.$el.parentNode||(this.vscrollResizeObserver.observe(this.$el.parentNode),this.$el.parentNode.addEventListener("resize",this.onResize))},unobserveSize(){!this.vscrollResizeObserver||(this.vscrollResizeObserver.unobserve(this.$el.parentNode),this.$el.parentNode.removeEventListener("resize",this.onResize))},onResize(e){const{width:t,height:i}=e.detail.contentRect;this.applySize(t,i)}},render(){return Vue.h(this.tag,this.$slots.default())}};we.__file="src/components/DynamicScrollerItem.vue";export{we as a,Q as s};