/*
 =======================================================================*\
|| ###################################################################### ||
|| # vBulletin 6.2.3
|| # ------------------------------------------------------------------ # ||
|| # Copyright 2000-2026 MH Sub I, LLC dba vBulletin. All Rights Reserved.  # ||
|| # This file may not be redistributed in whole or significant part.   # ||
|| # ----------------- VBULLETIN IS NOT FREE SOFTWARE ----------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html   # ||
|| ###################################################################### ||
\*========================================================================*/
vBulletin.vBScroller=function(r){function D(e){function t(b){if("1"!=e.data("vbscroller-resetting-scrollbar")){e.data("vbscroller-resetting-scrollbar","1");h=x.innerWidth();l=g.prop("scrollWidth");y=0;q=l-h;p("to_pixel",0);z=[];w=0;Math.max(e.innerWidth(),g.outerWidth())>=l?(E.removeClass("b-vbscroller--enabled"),p("to_pixel",0)):E.addClass("b-vbscroller--enabled");F=h;h=x.innerWidth();l=g.prop("scrollWidth");q=l-h;0<F&&0<q&&p("to_pixel",y*q);b=G&&g.find(G)||g.children();if(w=b.length){var d=0;"right"==
m&&(d=r(b[w-1]).position().left);for(var f=0;f<w;f++){var a=r(b[f]);var c=a.position().left-d;var n=c+a.outerWidth();if("left"==m){var k=c;c=n}else k=l-n,c=l-c;z.push({$:a,start:k,end:c})}}b=g.find(".js-vbscroller-selected-item");1==b.length&&(b=b.position().left-h/2+b.outerWidth()/2,p("to_pixel",b));A();e.data("vbscroller-resetting-scrollbar","0")}}function H(){e.find("img").on("load",function(b){t()})}function A(){var b=I();if("left"==m){var d=b;b=l-(b+h)}else d=l-(b+h);0>=d?B.addClass("b-vbscroller__navigation-control-button--disabled"):
B.removeClass("b-vbscroller__navigation-control-button--disabled");0>=b?C.addClass("b-vbscroller__navigation-control-button--disabled"):C.removeClass("b-vbscroller__navigation-control-button--disabled")}function I(){var b=-parseFloat(g.css(m));isNaN(b)&&(b=0,currentOtherEdge=h,g.css(m,0));return b}function p(b,d,f){var a=0,c=I(),n=c+h;a=1;"right"==m&&(a=-1);switch(b){case "left":case "right":var k=0,u=0;r.each(z,function(K,v){v.start>=c&&v.end<=n&&(k||(k=v.start),k=Math.min(k,v.start),u=Math.max(u,
v.end))});a=b==m?k-h:u;break;case "left_small":a=c-60*a;break;case "right_small":a=c+60*a;break;case "by_pixels":case "pixels":if(d)a=c+a*d;else return;break;case "to_pixel":if("undefined"!=typeof d)isNaN(d)&&(d=0),a=d;else return;break;default:a=c}a=Math.min(Math.max(a,0),q);f?(b={},b[m]=-a,g.animate(b,{duration:200,queue:!1,complete:function(){A()}})):g.css(m,-a);0<q&&(y=a/q);A()}function J(){function b(d){if(d.is(".js-vbscroller-scroll-right"))var f="right";else if(d.is(".js-vbscroller-scroll-left"))f=
"left";else return;var a,c,n,k;d.on("mousedown",function(u){c=!0;a=Date.now();n=setTimeout(function(){p(f+"_small");k=setInterval(function(){p(f+"_small")},100)},500)});d.on("mouseup mouseleave",function(u){clearTimeout(n);clearInterval(k);c&&500>=Date.now()-a&&p(f,0,!0);c=!1})}(function(){var d=vBulletin.isRtl();e.on("DOMMouseScroll mousewheel",function(f){var a=f.originalEvent.wheelDelta?f.originalEvent.wheelDelta:-f.originalEvent.detail;if(0<a)a="left";else if(0>a)a="right";else return;d&&(a="left"==
a?"right":"left");p(a+"_small");f.preventDefault()})})();(function(){var d=!1,f=!1,a=0;g.on("mousedown touchstart",function(c){f=!1;d=!0;a=c.pageX||c.originalEvent.touches[0].pageX||0;c.preventDefault()});g.on("mousemove touchmove",function(c){if(d){c=c.pageX||c.originalEvent.touches[0].pageX||0;var n=a-c;0!=n&&(f=!0,p("pixels",n));a=c}});g.on("mouseup mouseleave touchcancel",function(c){d=!1;c.preventDefault()});g.on("click touchend",function(c){if(f)return!1;f=!1})})();b(C);b(B)}var E=e,x=e.find(".js-vbscroller-viewport"),
g=e.find(".js-vbscroller-content"),G=g.data("child-selector")&&"."+g.data("child-selector")||"",C=e.find(".js-vbscroller-scroll-right"),B=e.find(".js-vbscroller-scroll-left"),z=[],w=0,h=x.innerWidth(),F=0,l=g.prop("scrollWidth"),y=0,q=l-h;(function(){"1"==e.data("vbscroller-initialized")?setTimeout(function(){e.trigger("event-js-vbscroller-reset")},0):(vBulletin.Responsive.Debounce.registerCallback(t),e.on("event-js-element-resize-start",t),e.on("event-js-content-change",H),e.on("event-js-vbscroller-reset",
t),J(),H(),t(),e.data("vbscroller-initialized","1"))})()}var m="left";r(function(){pageData.textdirection&&"rtl"==pageData.textdirection&&(m="right");r(".js-vbscroller-wrapper").each(function(){var e=r(this);e.data("manual-init")||D(e)})});return{initializeScroller:D}}(jQuery);
