/*
 =======================================================================*\
|| ###################################################################### ||
|| # 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("answer_must_be_approved_published conversation compare_versions edit_conversation error_loading_post flag_a_post onbeforeunload_message_while_editing_post people_who_liked please_enter_your_reason_why_you_want_to_flag_this_post send_report the_report_has_been_sent topic_answered you_have_a_pending_edit_unsaved".split(" "),[]);vBulletin.ensureObj("conversation");
$.extend(vBulletin.conversation,function(b,g,y,t,u,w){function G(a){function c(k,r,n,v){r=b.Event("afterSave");v.trigger(r,k);if(r.isDefaultPrevented())w.destroyEditor(h);else{if(k&&k.warnings){if(y.hasError(k.warnings,"warning_spam_post")){y.showApiError(k.warnings,k,{title_phrase:"warning",after_error:function(){k.warningReturnUrl?location.href=k.warningReturnUrl:location.reload(!0)}});return}g.flashPhrase(k.warnings[0])}r=v.data("content-type");n=v.closest(".js-content-entry").data("current-channelid");
v=v.find('input[name="parentid"]:checked').val();0<n&&0<v&&n!=v?location.reload(!0):(w.destroyEditor(h),H(m,p,q,d,e.closest(".js-post"),r))}}var e=b(this),d,f=e.closest(".conversation-list");0<e.closest(".js-comments").length&&(d="comment");var l=b(".edit-conversation-container form",f);if(0<l.length)t.warning("edit_conversation","you_have_a_pending_edit_unsaved",function(){g.animateScrollTop(l.closest(".js-post").offset().top,{duration:"slow"})});else{a.preventDefault();var m=e.parent().attr("data-node-id"),
h="comment"==d?e.closest(".js-comment"):e.closest(".js-post__content-wrapper");var p=f.hasClass("thread-view")?"thread":f.hasClass("full-activity-view")?"full-activity-stream":f.hasClass("activity-view")?"activity-stream":"stream";d=d||h.attr("data-node-type")||"";a=b(".js-show-post-link",h).text()||"1";var q=Number(a.replace("#",""));("comment"!=d||"thread"!=p&&1!=f.closest(".blog-conversation-content-widget").length)&&q--;g.AJAX({call:"/create-content/loadeditor",data:{nodeid:m,type:d,view:p,isAjaxTemplateRender:!0,
isAjaxTemplateRenderWithData:!0},success:function(k){var r=function(){if("upload"in g&&"tagEditor"in g&&"initEntryBox"in w){h.addClass("b-post--edit");h.find(".js-post__content").first().addClass("b-post__content--edit");h.find(".b-post__footer").first().addClass("b-post__footer--edit");$container=h.find(".edit-conversation-container").first();h.closest(".js-album-detail").find(".conversation-body, .profile-media-uploadphotos, .js-photo-preview").addClass("h-hide-imp");var n=$container.find(".js-content-entry");
0<n.length||(n=$container.find("#newTextForm"));w.initEntryBox(n,!1,c);$container.show();n=$container.find(".js-attach-list");g.tagEditor.initEditTagsContent(".js-post[data-node-id={0}] .tag-editor-container .tag-input".format(m));0<n.data("attach-count")&&(n=$container.find(".b-toolbar__item").filter(function(){return"b-content-entry-panel__content--attachment"==b(this).data("panel")}),n.hasClass("b-toolbar__item--active")||n.trigger("click"));w.afterPanelChange(h);g.flatpickr&&g.flatpickr.initPickers()}else u.loadScripts("",
{},r)};b(".edit-conversation-container",h).first().hide().html(k.template);k=b(".edit-conversation-container form",h).data("content-type");b(window).offon("beforeunload.editPost",()=>g.phrase.get("onbeforeunload_message_while_editing_post"));b("body").trigger(k+"_editform_onload",[h,r])},title_phrase:"edit_conversation"})}}function H(a,c,e,d,f,l){let m=pageData;m["posts-perpage"]=A;"thread"==c&&(m["comments-perpage"]=B);g.AJAX({call:"/create-content/loadnode",data:{nodeid:a,view:c,index:e,page:m,
type:d,isAjaxTemplateRender:!0,isAjaxTemplateRenderWithData:!0},success:function(h){var p=b(h.template),q=f.parent();f.replaceWith(p);p=q.find(".js-post").filter((r,n)=>b(n).data("node-id")==a);if(h.hasOwnProperty("template_article_title_info")){q=b(".js-update-article-title-info");var k=b(h.template_article_title_info);0<q.length&&q.empty().append(k)}b("body").trigger(l+"_newcontent_onload",[p]);b(document).trigger("vb-loadnode",{insertedHtml:p,context:"conversationcommon"});p.hasClass("js-conversation-starter")&&
(q=b(".js-post-title",p).first().text(),k=q+" - "+g.options.get("bbtitle"),"topic_url"in h&&(h=pageData.baseurl+h.topic_url,h!=location.href&&window.history.replaceState({},k,h)),document.title=k,b(".page-title-widget .js-main-title").text(q));b(".js-select-box",p).selectBox();g.animateScrollTop(p.offset().top,{duration:"slow"})},title_phrase:"conversation",error_phrase:"error_loading_post"})}function C(a,c=3){var e=0,d=b("ul.poll li",a),f=parseInt(d.css("line-height"),10);d.each(function(l){b(this).removeClass("h-hide");
l=b(this).height();e+=l/f;e>c?b(this).addClass("h-hide"):b(this).css("display","")});d=e>c;b(".view-more-ctrl",a).toggleClass("h-hide-imp",!d).next(".js-button-group").toggleClass("h-hide",d).next(".view-less-ctrl").toggleClass("h-hide-imp",d)}function z(a){return a.closest(".js-post").data("node-id")}function I(){var a=b(this),c=a.data("post-ip");a.data("post-host");x.register(["ip_info","ip_address_is","host_name_is","no_ip_found"]);c?(t.openAlertDialog({title:x.get("ip_info"),message:x.get("ip_address_is")+
": "+c+"<br />"+x.get("host_name_is")+': <span class="ip-host-name loading">...</span>',iconType:"none"}),g.AJAX({call:"/ajax/api/node/getHostName",data:{ip:c},success:function(e){b(".ip-host-name").removeClass("loading").html(e)}})):g.alert("ip_info","no_ip_found");return!1}function J(){var a=z(b(this)),c=t.openPromptDialogSimple({title:"flag_a_post",message:"please_enter_your_reason_why_you_want_to_flag_this_post",okPhrase:"send_report",multiline:!0,validation:t.validationString,onClickOk:function(e){g.AJAX({call:"/report/report",
data:{reason:e,reportnodeid:a},success:function(d){c.dialog("close");g.alert("flag_a_post","the_report_has_been_sent")},api_error:d=>{c.find(".js-prompt-error").html(x.get(d[0])).removeClass("h-hide")},error_phrase:"unable_to_contact_server_please_try_again"});return!1}});return!1}function K(){var a=b(this).closest(".js-comment-entry__parent").find(".js-comment-entry");a.slideToggle("fast",function(){var c=b(this).find(".js-comment-entry__textbox");c.is(":visible")&&c.trigger("focus")});a.find(".js-comment-entry__cancel").offon("click.convocom",
function(c){a.slideToggle();return!1});return!1}function L(){let a=z(b(this));t.openTemplateConfirmDialog(y,{title:"post_history",width:800,yesPhrase:"compare_versions",noPhrase:"cancel",onClickYes:c=>{c=g.getFormData(c.find(".post-history-form"));t.openTemplateAlertDialog(y,{title:"post_history",width:800,okPhrase:"close"},{template:"post_history_form",data:{oldpost:c.old||1,newpost:c["new"]||1,nodeid:a}});return!1}},{template:"post_history_form",data:{nodeid:a}})}function M(){var a=b(this),c=z(a);
a=!a.closest(".js-post").hasClass("isanswer");var e=vBulletin.getSelectedFilters(b(".toolbar-filter-overlay"));b("body").css("cursor","wait");g.AJAX({call:"/create-content/setExclusiveAnswer",data:{nodeid:c,set:a?1:0,searchFilters:e,isAjaxTemplateRender:!0,isAjaxTemplateRenderWithData:!0},success:function(d){b(".js-post.isanswer").toggleClass("isanswer",!1);d.answers&&0<d.answers.length&&d.answers.forEach(m=>{b(".js-post[data-node-id="+parseInt(m,10)+"]").toggleClass("isanswer",!0)});let f=b(".js-post.pinned-answer");
f.length&&f.hide("slow",()=>{f.remove()});if(d.template){var l=b(".js-conversation-starter");d=b(d.template);d.hide();d.insertAfter(l).show("slow")}},complete:function(){b("body").css("cursor","default")},error_phrase:"unable_to_contact_server_please_try_again",title_phrase:"setasanswer"});return!1}function N(a,c){if(g.isFun(c)){console.log("Edit mode: initializeEditor");var e=a.find(".js-editor");0<e.length?u.initEditor(e,{success:function(d){c();w.afterPanelChange(a);u.initEditorComponents(a);var f=
this;setTimeout(function(){f.setData(e.prev(".js-editor-parsed-text").html(),function(){var l=u.getEditor(d);u.fixTableFunctionality.call(u,{},l);setTimeout(function(){u.modifyImagePaths(b(l.container.$))},0);l.focus()})},0)},error:function(d){c();e.prop("disabled",!1).removeClass("ckeditor-load-on-focus").closest(".js-content-entry").addClass("b-content-entry--no-ckeditor");d=e.prev(".js-editor-parsed-text").html();""!=d&&vBulletin.AJAX({call:"/ajax/api/editor/convertHtmlToBbcode",data:{nodeid:pageData.nodeid,
data:d,allowsmilie:1,securitytoken:pageData.securitytoken},success:function(f){e.html(f.data)},error_phrase:"error_converting_message"})},hideLoadingDialog:!1}):g.isFun(c)&&(c(),e.trigger("focus"))}}const D=g.data("conversation-data"),E=(a,c,e)=>Number(a[c]||a["default_"+c]||e)||0,B=E(D,"comments_per_page",25),A=E(D,"posts_per_page",15);let x=g.phrase,F=a=>0<a.length?1:0;return{postComment:function(a,c){let e=this;a=b(e);let d=a.closest(".js-comment-entry"),f=d.find(".js-comment-entry__textbox"),
l=b.trim(f.val());if(!l)return t.warning("post_comment","please_enter_your_comment",f),!1;a.blur();let m=a.closest(".js-comment-entry__parent"),h=F(a.closest(".js-comment-entry--blog")),p=F(a.closest(".js-comment-entry--article")),q={text:l,parentid:m.attr("data-node-id"),postindex:m.find(".js-post__content .js-show-post-link").text().replace("#",""),view:m.parent().hasClass("stream-view")?"stream":"thread",redirecturl:f.hasClass(".reload-on-post")?1:0,isblogcomment:h,isarticlecomment:p};d.find('[name^="humanverify"]').each((k,
r)=>{k=b(r);q[k.attr("name")]=k.val()});vBulletin.AJAX({call:"/ajax/post-comment",data:q,complete:()=>{g.hv.reset()},success:function(k,r,n){g.ensureFun(c).apply(e,[k]);h||p||d.slideToggle();g.subscribe.updateSubscribeButton(k.topic_subscribed)},api_error:vBulletin.hv.resetOnError,title_phrase:"conversation",error_phrase:"error_posting_comment_code"})},initContentEvents:function(a){a.offon("click.convocom",".js-post-control__ip-address",I);a.offon("click.convocom",".js-post-control__edit",G);a.offon("click.convocom",
".js-post-control__flag",J);a.offon("click.convocom",".js-post-control__comment",K);a.offon("click.convocom",".js-post__history",L);a.offon("click.convocom",".js-post-control__answer",M)},initPollEvents:function(a){a.offon("click.convocom",".list-item-poll .view-more-ctrl",function(c){var e=b(this).closest("form.poll");c=e.find("ul.poll");b(this).addClass("h-hide-imp");c.css("max-height","none").find("li.h-hide").slideDown(100,function(){e.find(".js-button-group").removeClass("h-hide").next(".view-less-ctrl").removeClass("h-hide-imp");
g.animateScrollTop(e.offset().top,{duration:"fast"})});return!1});a.offon("click.convocom",".list-item-poll .view-less-ctrl",function(c){c=b(this).closest("form.poll");C(c,3);c.find("ul.poll").css("max-height","").find("li.h-hide").slideUp(100);return!1})},limitVisiblePollOptionsInAPost:C,bindEditFormEventHandlers:function(a){function c(f){b("body").offon(f+"_newcontent_onload",function(l,m){0<m.closest(".conversation-list.stream-view.activity-view").length&&g.truncatePostContent(m)});b("body").offon(f+
"_editform_onload",function(l,m,h){N(m,h)})}a=a?a.toLowerCase():"";let e={comment:function(){b("body").offon("comment_editform_onload",function(f,l,m){g.isFun(m)&&(m(),b(".js-editor",l).trigger("focus").filter(".autogrow").css("min-height",function(){return b(this).css("height")}).autogrow())})},poll:function(){b("body").offon("poll_newcontent_onload",function(f,l){0<l.closest(".conversation-list.stream-view.activity-view").length&&(g.truncatePostContent(l),conversation.limitVisiblePollOptionsInAPost(b("form.poll",
l),3))})}},d="text gallery video event poll link".split(" ");if("all"==a){for(const f of d)c(f);for(const f in e)e[f]()}else if(d.includes(a)&&c(a),a in e)e[a]()},COMMENTS_PER_PAGE:B,POSTS_PER_PAGE:A}}(jQuery,vBulletin,vBulletin.ajaxtools,vBulletin.dialogtools,vBulletin.ckeditor,vBulletin.contentEntryBox));
