/*!
vue-handy-scroll v3.0.2
https://amphiluke.github.io/vue-handy-scroll/
*/
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("vue")):"function"==typeof define&&define.amd?define(["vue"],n):(e="undefined"!=typeof globalThis?globalThis:e||self).HandyScroll=n(e.Vue)}(this,(function(e){"use strict";var n=Object.create(null),t={emit:function(e){for(var t=[],o=arguments.length-1;o-- >0;)t[o]=arguments[o+1];var i=n[e];i&&i.forEach((function(e){return e.apply(void 0,t)}))},on:function(e,t){var o=n[e];o||(o=[],n[e]=o),o.push(t)},off:function(e,t){var o=n[e];if(o){var i=o.indexOf(t);i>=0&&(o.splice(i,1),o.length||delete n[e])}}},o={EventBus:t,props:{customViewport:{type:Boolean,default:!1},unobtrusive:{type:Boolean,default:!1}},data:function(){return{visible:!0}},created:function(){this.skipSyncContainer=this.skipSyncWidget=!1},mounted:function(){var e=this;this.queueUpdate().then((function(){e.addEventHandlers()}))},unmounted:function(){this.removeEventHandlers()},methods:{queueUpdate:function(){var e=this;return e.$nextTick().then((function(){e.update(),e.skipSyncContainer=e.skipSyncWidget=!1}))},addEventHandlers:function(){var e=this;if(!e.$refs.scrollBody){var n=e.windowScrollHandler=function(){return e.checkVisibility()},o=e.windowResizeHandler=function(){return e.update()};window.addEventListener("scroll",n,!1),window.addEventListener("resize",o,!1)}var i=e.updateHandler=function(n){void 0===n&&(n={});var t=n.sourceElement;t&&!e.$el.contains(t)||e.queueUpdate()};t.on("update",i)},removeEventHandlers:function(){var e=this;window.removeEventListener("scroll",e.windowScrollHandler,!1),window.removeEventListener("resize",e.windowResizeHandler,!1),t.off("update",e.updateHandler)},handleWidgetScroll:function(){var e=this;e.visible&&!e.skipSyncContainer&&e.syncContainer(),e.skipSyncContainer=!1},handleContainerScroll:function(){var e=this;e.skipSyncWidget||e.syncWidget(),e.skipSyncWidget=!1},handleContainerFocus:function(){var e=this;setTimeout((function(){e.$refs&&e.$refs.widget&&e.syncWidget()}),0)},checkVisibility:function(){var e=this,n=e.$refs,t=n.widget,o=n.container,i=n.scrollBody,r=t.scrollWidth<=t.offsetWidth;if(!r){var l=o.getBoundingClientRect(),d=i?i.getBoundingClientRect().bottom:window.innerHeight||document.documentElement.clientHeight;r=l.bottom<=d||l.top>d}e.visible===r&&(e.visible=!r)},syncContainer:function(){var e=this.$refs,n=e.widget,t=e.container,o=n.scrollLeft;t.scrollLeft!==o&&(this.skipSyncWidget=!0,t.scrollLeft=o)},syncWidget:function(){var e=this.$refs,n=e.widget,t=e.container.scrollLeft;n.scrollLeft!==t&&(this.skipSyncContainer=!0,n.scrollLeft=t)},update:function(){var e=this.$refs,n=e.widget,t=e.strut,o=e.container,i=e.scrollBody,r=n.style,l=o.clientWidth,d=o.scrollWidth;r.width=l+"px",i||(r.left=o.getBoundingClientRect().left+"px"),t.style.width=d+"px",d>l&&(r.height=n.offsetHeight-n.clientHeight+1+"px"),this.syncWidget(),this.checkVisibility()}}},i={key:0,class:"handy-scroll-viewport"},r={ref:"strut"},l={ref:"strut"};return function(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===t&&o.firstChild?o.insertBefore(i,o.firstChild):o.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}('.handy-scroll[data-v-71ecdf2e]{bottom:0;min-height:17px;overflow:auto;position:fixed}.handy-scroll div[data-v-71ecdf2e]{height:1px;overflow:hidden;pointer-events:none}.handy-scroll div[data-v-71ecdf2e]:before{content:"\\A0"}.handy-scroll div[data-v-71ecdf2e],.handy-scroll[data-v-71ecdf2e]{font-size:1px;line-height:0;margin:0;padding:0}.handy-scroll-hidden[data-v-71ecdf2e]{bottom:9999px}.handy-scroll-hidden div[data-v-71ecdf2e]:before{content:"\\A0\\A0"}.handy-scroll-viewport[data-v-71ecdf2e]{position:relative}.handy-scroll-area[data-v-71ecdf2e],.handy-scroll-body[data-v-71ecdf2e]{overflow:auto}.handy-scroll-viewport .handy-scroll[data-v-71ecdf2e]{left:0;position:absolute}.handy-scroll-unobtrusive .handy-scroll[data-v-71ecdf2e]{opacity:0;transition:opacity .5s ease .3s}.handy-scroll-unobtrusive:hover .handy-scroll[data-v-71ecdf2e]{opacity:1}'),o.render=function(n,t,o,d,a,c){return o.customViewport?(e.openBlock(),e.createElementBlock("div",i,[e.renderSlot(n.$slots,"viewport-before"),e.createElementVNode("div",{ref:"scrollBody",class:"handy-scroll-body",onScroll:t[3]||(t[3]=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return c.checkVisibility&&c.checkVisibility.apply(c,e)})},[e.renderSlot(n.$slots,"body-before"),e.createElementVNode("div",{ref:"container",class:e.normalizeClass(["handy-scroll-area",{"handy-scroll-unobtrusive":o.unobtrusive}]),onScroll:t[1]||(t[1]=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return c.handleContainerScroll&&c.handleContainerScroll.apply(c,e)}),onFocusin:t[2]||(t[2]=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return c.handleContainerFocus&&c.handleContainerFocus.apply(c,e)})},[e.renderSlot(n.$slots,"default"),e.createElementVNode("div",{ref:"widget",class:e.normalizeClass(["handy-scroll",{"handy-scroll-hidden":!a.visible}]),onScroll:t[0]||(t[0]=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return c.handleWidgetScroll&&c.handleWidgetScroll.apply(c,e)})},[e.createElementVNode("div",r,null,512)],34)],34),e.renderSlot(n.$slots,"body-after")],544),e.renderSlot(n.$slots,"viewport-after")])):(e.openBlock(),e.createElementBlock("div",{key:1,ref:"container",class:e.normalizeClass(["handy-scroll-area",{"handy-scroll-unobtrusive":o.unobtrusive}]),onScroll:t[5]||(t[5]=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return c.handleContainerScroll&&c.handleContainerScroll.apply(c,e)}),onFocusin:t[6]||(t[6]=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return c.handleContainerFocus&&c.handleContainerFocus.apply(c,e)})},[e.renderSlot(n.$slots,"default"),e.createElementVNode("div",{ref:"widget",class:e.normalizeClass(["handy-scroll",{"handy-scroll-hidden":!a.visible}]),onScroll:t[4]||(t[4]=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return c.handleWidgetScroll&&c.handleWidgetScroll.apply(c,e)})},[e.createElementVNode("div",l,null,512)],34)],34))},o.__scopeId="data-v-71ecdf2e",o.__file="src/handy-scroll.vue",o}));
