/*
 =======================================================================*\
|| ###################################################################### ||
|| # 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.precache(["gallery_slideshow","no_photos_found_or_post_deleted"],[]);
(function(d,B){function C(a,b,c,f){var e=a.find(".caption");e.html("").hide();b.links&&e.append(d("<div />").addClass("links ellipsis").html(b.links));b.title&&e.append(d("<div />").addClass("title ellipsis").html(b.title));b.caption&&e.append(d("<div />").addClass("title ellipsis").html(b.caption));b=b.links&&b.title?15:b.links||b.title?35:50;c=a.find(".slideshow-wrapper .jcarousel-item-"+c+" img");e.css({marginBottom:b+"px",width:"100%",textAlign:"center",marginLeft:"auto",marginRight:"auto"});
c.one("load",function(){var g=d(this).outerWidth();e.css("width",g+"px")});f?e.fadeIn("fast",function(){a.trigger("click")}):e.show()}function D(a){var b=vBulletin.isRtl();37==a.which?k.jcarousel("scroll",b?"+=1":"-=1"):39==a.which&&k.jcarousel("scroll",b?"-=1":"+=1");if(33<=a.which&&40>=a.which)return!1;27==a.which&&h.dialog("instance")&&h.dialog("close")}function E(a){0<(a.originalEvent.wheelDelta||-a.originalEvent.detail)?k.jcarousel("scroll","-=1"):k.jcarousel("scroll","+=1");return!1}function L(){var a=
d("body"),b=a.css("overflow")||"auto";a.css("overflow","hidden");var c=d(window).innerWidth(),f=window.innerHeight;c=parseInt(c-0,10);f=parseInt(f-0,10);h.css({borderRadius:0,borderWidth:0});a.css("overflow",b);h.dialog("instance")&&(h.dialog("option","width",c),h.dialog("option","height",f))}function M(a){var b=a.closest(".js-slideshow__gallery-node"),c=0,f="",e=null,g=null;0<b.length&&(c=parseInt(b.attr("data-node-id")||b.attr("data-nodeid"),10),f=b.data("sort")||"",b=b.closest(".ui-widget-content"),
b=b.find(".toolbar-filter-overlay .filter-options"),b.length&&(e=d("input[name=filter_time]:checked",b).val(),g=d("input[name=filter_show]:checked",b).val()));0==c&&(b=a.closest(".js-post-sm"),0<b.length&&(c=parseInt(b.attr("data-nodeid"),10)));0==c&&(a=a.closest(".js-post"),0<a.length&&(c=parseInt(a.attr("data-node-id"),10)));return{nodeid:c,sort:f,filter_time:e,filter_show:g}}function N(a){var b=a.closest(".js-post__content-text"),c={photos:[]},f=0;(b.length&&b.find(".js-lightbox, .js-lightbox-participant")||
a).each(function(){var e=d(this),g=e.data("fullsize-url")||e.parent().attr("href")||e.attr("src")||"";let n=e.data("thumb-url")||g,v=e.data("title")||"";e=e.data("caption")||"";g&&(g={url:g,thumb:n,links:v,title:e},c.photos.push(g),this===a[0]&&(p=f),f++)});return c}async function O(a){if(a.hasClass("js-lightbox"))return N(a);let b=a.closest(".b-content-entry-panel__content--gallery").find(".js-photo-postdata input");if(0<b.length){let q={photos:[]};b.filter('[name="filedataid[]"]').each(function(){var r=
this.value;let z=pageData.baseurl+"/filedata/fetch?filedataid="+r;r={title:JShtmlEncode(b.filter('[name="title_'+r+'"]').val()),url:z,thumb:z+"&thumb=1"};q.photos.push(r)});return new Promise((r,z)=>{setTimeout(()=>{r(q)},10)})}let c=a.attr("data-channelid"),f=a.attr("src")||a.attr("href");var e=M(a);let g=e.nodeid,n=e.sort,v=e.filter_time;e=e.filter_show;let l={nodeid:g},F=parseInt(d(".albumSlideShowPageNo").val(),10),G=parseInt(d(".albumSlideShowPerPage").val(),10),H=d(".media-tab .media-filter-overlay .filter-options input:checked").val();
(a=a.closest(".js-slideshow__gallery-node").data("userid"))&&(l.userid=a);c&&(l.channelid=c);isNaN(F)||(l.pageno=F);isNaN(G)||(l.perpage=G);H&&(l.dateFilter=H);isNaN(p)||(l.startIndex=p);n&&(l.sort=n);v&&(l.dateFilter=v);e&&(l.showFilter=e);0<g&&(l.startIndex="");let w=JSON.stringify(l);0<g&&(t[g]=t[g]||[],t[g].push(w));x[w]||await vBulletin.AJAX({call:"/filedata/gallery",data:l}).always(q=>{!q&&f&&(q={photos:[{title:"",url:f,thumb:""}]});x[w]=q});return x[w]}function I(a){if(!a)return 1;const b=
a.jcarousel("target");return b&&a.jcarousel("items").index(b)||0}function P(a,b,c,f){let e=I(k);b!=e&&a.jcarousel("scroll",b,c,f)}function Q(){m.jcarousel("items").each((a,b)=>{let c=d(b);a=k.jcarousel("items").eq(a);a.length&&c.on("jcarouselcontrol:active",()=>{m.jcarousel("scrollIntoView",c);c.find(".image-wrapper").removeClass("dimmed")}).on("jcarouselcontrol:inactive",()=>{c.find(".image-wrapper").addClass("dimmed")}).jcarouselControl({target:a,carousel:k})});m.on("jcarousel:destroy",a=>{m.jcarousel("items").off("jcarouselcontrol:active jcarouselcontrol:inactive")})}
function J(a,b,c){const f=a.add(b);f.offon("jcarouselcontrol:inactive",(e,g)=>{d(e.currentTarget).addClass("b-icon--disabled")});f.offon("jcarouselcontrol:active",(e,g)=>{d(e.currentTarget).removeClass("b-icon--disabled")});b.jcarouselControl({target:c?"-=3":"-=1"});a.jcarouselControl({target:c?"+=3":"+=1"})}function R(){var a=h.find(".slideshow-wrapper");0==a.find(".slideshow-list").length&&a.append(d("<ul />").addClass("slideshow-list"));u.slideshow=a.jcarousel({list:".slideshow-list",items:".jcarousel-item",
vertical:!1,center:!0,wrap:null,animation:"fast",easing:"swing",scroll:1,rtl:vBulletin.isRtl()}).jcarouselSwipe();a=d("#slideshow-dialog .thumbnails");0==a.find(".thumbnail-list").length&&a.append(d("<ul />").addClass("thumbnail-list"));u.thumbnails=a.jcarousel({list:".thumbnail-list",items:".jcarousel-item",wrap:null,animation:"fast",easing:"swing",rtl:vBulletin.isRtl()}).jcarouselSwipe();k=u.slideshow;m=u.thumbnails;k.disableSelection();m.disableSelection()}function A(a){let b=d(a.currentTarget);
y=a&&a.currentTarget;if(1==b.closest("#preview-overlay").length)return!1;a&&a.preventDefault&&a.preventDefault();R();a=k.jcarousel("list").parent();!1===p&&(p=b.index());h.dialog("open");window.vBulletin.loadingIndicator.show();O(b).then(c=>{window.vBulletin.loadingIndicator.hide();S(c,k)});a.on("jcarousel:targetin","li",(c,f)=>{const e=h.data("image-data");if(e){c=f.index(c.currentTarget)||0;f=e.photos.length;var g;c=Math.max(Math.round(c,10),0);var n;(g=null!=(n=e.photos[c])?n:{})||console.warn("onBeforeAnimation() - no photoInfo found for index:",
c,"photoCount:",f,"imageData:",e);C(h,g,c,!0)}});return!1}function S(a,b){if(a&&a.photos){h.data("image-data",a);T(b,a,h);C(h,a.photos[0],1);1<a.photos.length&&vBulletin.gallery.thumbnails.jcarousel("first").find(".image-wrapper").removeClass("dimmed");var c=p;a=parseInt(d(".albumSlideShowPerPage").val(),10);isNaN(a)||(c=p%a);0<c&&P(k,c+1,!1,function(f){"undefined"!=typeof f&&(h.find(".slideshow-wrapper").css("visibility","hidden"),window.setTimeout(function(){d(".thumbnails .image-wrapper",h).eq(c).trigger("click",
[!1]);h.find(".slideshow-wrapper").css("visibility","")},0))});window.vBulletin.loadingIndicator.hide()}else vBulletin.warning("gallery_slideshow","no_photos_found_or_post_deleted")}function K(a,b){a=a.jcarousel("list");const c=d("<li/>").addClass("jcarousel-item");c.append(b);a.append(c)}function T(a,b,c){a.jcarousel("list").empty();var f=1<b.photos.length;d("#slideshow-dialog .thumbnails").toggle(f);f&&U(b);c.toggleClass("no-thumbnails",!f);d.each(b.photos,function(e,g){e=d("<a></a>").attr("href",
g.url);g=d('<img alt="{0}" class="image" />'.format(g.htmltitle||"")).attr("src",g.url);let n=d('<div class="image-wrapper"></div>');e.append(g);n.append(e);K(a,n)});a.jcarousel("reload");b=d(".js-jcarousel-next-button");c=d(".js-jcarousel-prev-button");J(b,c);if(f){Q();f=d(".js-jcarousel-thumb-next-button");b=d(".js-jcarousel-thumb-prev-button");c=m.jcarousel("items").length;const e=m.jcarousel("visible").length;c=c<=e;J(f,b,!0);f.toggleClass("h-hide-imp",c);b.toggleClass("h-hide-imp",c)}}function U(a){let b=
d("#slideshow-dialog .thumbnails .thumbnail-list");0==b.length&&(b=d("#slideshow-dialog .thumbnails").append(d("<ul />").addClass("thumbnail-list")));const c=m;c.jcarousel("list").empty();d.each(a.photos,function(f,e){f=d("<img />").addClass("thumbnail").on("load",function(){}).attr({src:e.thumb,alt:""}).appendTo(d("<div />").addClass("image-wrapper dimmed"));K(c,f.parent().get(0))});c.jcarousel("reload")}function V(){if(y){var a=y,b=p,c=I(k);c&&(b=c);h.dialog("close");p=b;A.call(a)}}B.ensureObj("gallery");
const h=d("#slideshow-dialog"),u=B.gallery;let k,m,p=!1,y=!1,x={},t={};u.clearCacheForNodeid=function(a){t.hasOwnProperty(a)&&t[a].forEach(b=>delete x[b]);t[a]=[]};d(function(){h.data("vb-lightbox-initialized")||(h.data("vb-lightbox-initialized",!0),d(document).offon("click","#slideshow-dialog .close-btn",function(){h.dialog("instance")&&h.dialog("close")}),h.dialog({autoOpen:!1,resizable:!1,closeOnEscape:!0,showTitleBar:!1,modal:!0,dialogClass:"slideshow-dialog",open:function(){L();d("body").css("overflow",
"hidden");d(".ui-widget-overlay").on("click",function(){h.dialog("close")});d(document).offon("keydown",D);d(document).offon("mousewheel DOMMouseScroll",E)},close:function(a,b){m&&(m.jcarousel("destroy"),m=null);k&&(k.jcarousel("destroy"),k=null);d("body").css("overflow","auto");d(document).off("keydown",D);d(document).off("mousewheel DOMMouseScroll",E);p=y=!1}}))});d(function(){d(document).offon("click",".js-slideshow--item",A);d(document).offon("click",".js-lightbox",A);h.addClass("js-no-responsive-resize");
d(window).on("resize",d.debounce(300,V))})})(jQuery,vBulletin);
