/*
 =======================================================================*\
|| ###################################################################### ||
|| # 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("cancel_new_with_quote create_new_conversation_with_quote error_fetching_comments error_fetching_quotes error_x existing_message_will_be_deleted invalid_server_response_please_try_again new_with_quote please_click_on_the_quote_icon_of_the_post_you_want_to_quote post_reply share_post_link_help visitor_message x_comment x_comments_lower your_post_is_now_being_reviewed_and_waiting_for_moderators_approval add_bookmark remove_bookmark".split(" "),[]);vBulletin.ensureObj("conversation");
$.extend(vBulletin.conversation,function(b,f,L){function E(d,g){g&&(d=y(),0<d.length?f.AJAX({call:"/createcontent/fetch-quotes",data:{nodeid:d},success:h=>{let q=Object.values(h).join("<br/><br/>")+"<br/><br/>";g.setData("",()=>{g.insertHtml(q.replace(/(\n)/gi,"<br />"));g.focus()})},title_phrase:"conversation",error_phrase:"error_fetching_quotes"}):g.focus())}function z(){let d=b(".post-reply-btn .js-button__text-secondary"),g=y().length;d.text(0<g?"("+g+")":"");return g}function F(){let d=y();b(".js-post-control__quote").filter((g,
h)=>d.includes(b(h).parent().data("node-id"))).addClass("b-post-control__quote--selected")}function M(){b(".b-post-control__quote--selected").removeClass("b-post-control__quote--selected");t.unsetAll();z()}function N(d){f.qtip.apply(d,"qtip-sharepostlink",{content:{title:{text:f.phrase.get("share_post_link_help"),button:!0},text:'<input type="text" class="textbox stretch" value="'+d.attr("href")+'" />'},show:{event:"click",solo:!0,ready:!0},events:{visible:function(g,h){h.elements.content.find("input.textbox").trigger("select").trigger("focus")}},
hide:{event:"unfocus",fixed:!0}})}function O(d){return 1==b(".conversation-media-view",d).length?2:1==b(".conversation-stream-view",d).length?1:0}if(!f.pageHasSelectors([".forum-conversation-content-widget",".group-conversation-content-widget",".blog-conversation-content-widget",".profile-widget","#privateMessageContainer .infractions"]))return!1;const u=f.ckeditor;let v=()=>b(".js-content-entry").has("form[data-message-type=reply]"),t=f.storagetools.createStorage("quotes"),y=()=>Object.keys(t.getAll()).map(d=>
parseInt(d));b(()=>{var d=b(".conversation-content-widget"),g="1"==b(".conversation-toolbar-wrapper",d).data("allow-history"),h=d.filter(".widget-tabs").tabs({active:O(d)});h.trigger("vb-tabinit");h.find(".widget-header .widget-tabs-nav li.ui-state-default:not(.ui-tabs-active) a").off("click").on("click",function(){location.href=b(this).attr("data-href");return!1});var q=new f.pagination({context:d,allowHistory:g,onPageChanged:function(a,c,e){w.updatePageNumber(a);if(!c){if(c=w.getOption("customFilter"))c.pagenum=
a,delete w.lastFilters,e&&delete c[b(".toolbar-search-form .js-filter-search",d).attr("name")];w.applyFilters(!1,!1,!1,!0)}f.Responsive.checkForVideoSignature();F()}});f.conversation.pagination=q;var G=b(".conversation-toolbar-wrapper.scrolltofixed-floating",d),H=function(){return 0<d.length?d.offset().top+(d.outerHeight()-parseFloat(d.css("border-bottom-width")))-G.height():0};try{var P=new f.scrollToFixed({element:G,limit:H()})}catch(a){}var w=new f.conversation.filter({context:d,scrollToTop:d,
pagination:q,allowHistory:g,hash:d.find(".js-module-top-anchor").attr("id"),onContentLoad:function(){P.updateLimit(H())}});g=b(document);g.offon("click",".js-show-post-link",function(a){a.preventDefault();N(b(a.currentTarget))});g.offon("click","a.js-scroll-if-on-page",a=>{a=b(a.currentTarget);a=parseInt(a.data("nodeid"),10);$anchor=b(".js-post[data-node-id='"+a+"']:not(.pinned-answer)");if($anchor.length)return vBulletin.animateScrollTop($anchor.offset().top),!1});b(".conversation-toolbar .post-reply-btn").offon("click",
function(a){var c=v();if(1==c.length){a=c.find(".js-editor");var e=u.getEditor(a),l=b(".conversation-toolbar-wrapper"),k=l.hasClass("scrolltofixed");l=l.length&&l.outerHeight(!0)||0;c=c.offset().top;k||(c+=l);e?E(d,e):u.initEditor(a,{success:()=>{e=u.getEditor(v($container).find(".js-editor"));E(d,e)}});f.animateScrollTop(c,{duration:500,complete:()=>{e&&e.focus()}})}});F();z();g.offon("mouseover",".js-userinfo__signature",function(){var a=b(this);"1"!=a.data("qtip-initialized")&&(a.data("qtip-initialized",
"1"),a.find(".user-signature"),f.qtip.apply(a,"qtip-signature",{content:a.find(".user-signature"),hide:{event:"unfocus"},show:{solo:!0}}),b(this).trigger("mouseover"))});h=b(".conversation-list",d);b(".js-post-controls",h).disableSelection();h.offon("click",".js-post-control__quote",function(){var a=b(this);a.toggleClass("b-post-control__quote--selected");var c=a.parent().data("node-id");(a=a.hasClass("b-post-control__quote--selected"))?t.set(c,1):t.unset(c);c=z();a&&1==c&&b(".post-reply-btn:visible").trigger("click");
0==c&&(c=u.getEditor(v($container).find(".js-editor")))&&c.setData("")});vBulletin.conversation.initContentEvents(h);"inlinemod"in f&&f.ensureFun(f.inlinemod.init)(d);h.offon("click",".js-comment-entry__post",function(a){vBulletin.conversation.postComment.apply(this,[a,function(c){if(c)if(c.redirecturl)location.replace(c.redirecturl);else{var e=b(this).closest(".js-post"),l=c.totalcomments,k=e.find(".js-comments").removeClass("h-hide"),A=e.find(".js-comments__comments");b(this).closest(".js-comment-entry").addClass("b-comment-entry--has-comments").find(".js-comment-entry__textbox").val("").trigger("input");
var m=b(c.template),n=m.find(".js-comment");m.appendTo(A);k.find(".js-comments__footer").addClass("h-hide");k.find(".js-comments__page--prev").show().data("page-num",1).prev("label").hide();k.find(".js-comments__header").removeClass("h-hide").find(".js-comments__pagination").removeClass(function(){return 1<l?"h-hide":""}).end().find(".js-comments__total-text").text(function(){return f.phrase.get(1<l?"x_comments_lower":"x_comment",l)});e=e.closest(".ui-tabs-panel").find(".conversation-toolbar-wrapper");
e.hasClass("scrolltofixed-floating")&&(e=e.data("object-instance"))&&e.addLimit(n.outerHeight(!0));f.scrollToAnchor("#post"+c.nodeId)}}])});h.offon("click",".js-comments__page--prev, .js-comments__page--next",function(){b("body").css("cursor","wait");var a=b(this),c=a.closest(".js-post"),e=c.find(".js-comments"),l=e.find(".js-comments__comments"),k=Number(a.data("page-num"))||0,A=a.closest(".canvas-widget").attr("data-widget-instance-id");f.AJAX({call:"/ajax/fetch-comments",data:{page:k,parentid:c.attr("data-node-id"),
postindex:c.find(".js-post__content .js-show-post-link").text().replace("#",""),widgetInstanceId:A,isblogcomment:1==a.closest(".blog-list").length?1:0,isarticlecomment:1==a.closest(".article-list").length?1:0},complete:function(m,n){b("body").css("cursor","auto")},success:function(m,n,p){if(m.templates){var x=b("<ul />").attr("class",l.attr("class")),B=m.totalcomments;b.each(m.templates,function(I,r){x.append(r)});l.replaceWith(x);n=Number(x.find(".js-comment:first-child .js-show-post-link span").text().replace(/\D/g,
""));p=Number(x.find(".js-comment:last-child .js-show-post-link span").text().replace(/\D/g,""));var Q=Math.ceil(B/vBulletin.conversation.COMMENTS_PER_PAGE);if(a.hasClass("js-comments__page--prev")){var C=a;var D=e.find(".js-comments__page--next")}else C=e.find(".js-comments__page--prev"),D=a;var K=function(I,r,J){I.find(".js-comments__pagination > label").show().text(r==J?r:"{0} - {1}".format(r,J))};k=m.page;K(e.find(".js-comments__header"),n,p);1==k?e.find(".js-comments__footer").addClass("h-hide"):
(n=p+1,p=n+vBulletin.conversation.COMMENTS_PER_PAGE-1,p=p>B?B:p,m=e.find(".js-comments__footer"),m.removeClass("h-hide"),K(m,n,p));C.data("page-num",k+1);D.data("page-num",k-1||1);C.removeClass("h-hide-imp")[Q>k?"show":"hide"]().prev("label").show();D[1<k?"show":"hide"]()}},title_phrase:"conversation",error_phrase:"error_fetching_comments"})});vBulletin.conversation.bindEditFormEventHandlers("all");if(h=parseInt(pageData.nodeid))f.markTopicAsRead(h),f.AJAX({call:"/ajax/api/node/incrementNodeview",
data:{nodeid:h},error:f.ajaxtools.logAjaxError,api_error:f.ajaxtools.logApiError});-1!=location.href.indexOf("edit=1")&&pageData.nodeid&&0<pageData.nodeid&&b("#edit-"+pageData.nodeid).trigger("click");g.offon("change",".js-article-content-pagenav",function(){location.href=b(this).val()});0<pageData.userid&&(b(" .js-goto-first-unread-page").offon("click",a=>{a=b(a.currentTarget).data("unread-page");let c=b(".pagenav-controls .pagenav-form",d);q.updatePageNavigation(c,a,!1);return!1}),g.on("vb-postpagination",
(a,c)=>{$goToUnreadBtn=b(" .js-goto-first-unread-page");if($goToUnreadBtn.length){({ajaxResult:a}=c);const {first_unread_page:e,pageinfo:l,page_sort:k}=a;a=l.pagenumber||l.currentpage||1;c=l.totalpages;a="ASC"==k&&1==e||a==c||0>=e||e>c||"DESC"==k||("ASC"==k?e<a:e>a);$goToUnreadBtn.data("unread-page",e);$goToUnreadBtn.attr("data-unread-page",e);$goToUnreadBtn.toggleClass("h-hide-imp",a)}}));g=v();g.length&&L.entryBoxEvent(g,"afterCancel afterSave",M)});return{}}(jQuery,vBulletin,vBulletin.contentEntryBox));
