/*
 =======================================================================*\
|| ###################################################################### ||
|| # 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("add_folder are_you_sure_move_to_trash are_you_sure_permanently_delete_messages delete_folder edit_folder error error_deleting_folder error_editing_folder error_x folder_name follow_request_denied invalid_node_id messages_updated_desc need_folder_name no_moderate_permissions no_publish_permissions page_does_not_exist pending_posts delete_pending_posts please_enter_a_valid_page_number please_select_messages pm_ajax_error_desc selected_folder_and_contents_will_be_deleted sent_follow_request private_messages mark_message_status_text_for_move mark_messages_status_text_for_move mark_message_status_text_for_delete mark_messages_status_text_for_delete mark_message_status_text_for_read mark_messages_status_text_for_read mark_message_status_text_for_unread mark_messages_status_text_for_unread mark_message_status_text_generic mark_messages_status_text_generic mark_report_status_text_for_delete mark_reports_status_text_for_delete mark_report_status_text_for_open mark_reports_status_text_for_open mark_report_status_text_for_closed mark_reports_status_text_for_closed mark_report_status_text_generic mark_reports_status_text_generic messages_header move following following_pending follow members_in_this_message cancel need_privatemessage_text invalid_pm_recipients".split(" "),
[]);var $pmWidget;vBulletin.ensureObj("privateMessage");
(function(a,f,k,l){function r(e){a.each(["readFilter","sortDir","typename"],function(h,n){h="filter_"+n;e.hasOwnProperty(h)&&(e[n]=e[h],delete e[h])});e.hasOwnProperty("readFilter")||(e.readFilter="unread_only");e.hasOwnProperty("sortDir")||(e.sortDir="DESC");e.hasOwnProperty("typename")||(e.typename="");a("#notificationFilters").find("input:radio").each(function(h,n){h=a(this);n=h.attr("name");e.hasOwnProperty(n)&&e[n]==h.val()&&h.prop("checked",!0)})}function t(e){a(this).closest(".filter-options").find(":input[type=radio]").removeAttr("checked");
a(this).prop("checked",!0);w(1)}function w(e,h){e=e||1;h=h||!1;var n=getNotificationsFilterParams();n.page=e;vBulletin.AJAX({call:"/ajax/render/privatemessage_notificationcontent",data:{params:n,isAjaxTemplateRenderWithData:!0},success:function(m){a("#notificationContent").html(m.template);pmPageNum=e;a("#notificationPageto").val(pmPageNum);a("#iconNotificationNext").toggleClass("h-disabled",e>=pmPages);a("#iconNotificationPrevious").toggleClass("h-disabled",1>=e);B.isEnabled()&&!h&&(m=y(pmPageNum),
B.pushState({notificationFilterParams:n},document.title,m.url));m={folderid,page:pmPageNum,perpage:pmPerPage,about:"",filterParams:n};vBulletin.privateMessage.updatePaginationLinks(a("#notificationContent").parent(),a("#notificationPageto").val());vBulletin.AJAX({call:"/ajax/api/content_privatemessage/getFolderMsgCount",data:m,success:function(p){if(p&&0<p.pages){if(B.isEnabled()&&!h&&pmPageNum!=p.pagenum){var u=y(p.pagenum);B.setDefaultState({notificationFilterParams:n},document.title,u.url)}pmPageNum=
p.pagenum;pmPages=p.pages;pmNotificationCount=p.count;a("#notificationPageCount").html(pmPages);a("#maxPageNum").val(pmPages);a("#iconNotificationNext").toggleClass("h-disabled",!(1<pmPages));a("#privatemessagePaging").toggleClass("h-hide",1>=pmPages);a("#notificationPageto").val(pmPageNum);a("#iconNotificationPrevious").toggleClass("h-disabled",1>=pmPageNum);a("#iconNotificationNext").toggleClass("h-disabled",pmPageNum>=pmPages);vBulletin.privateMessage.updatePaginationLinks(a("#notificationContent").parent(),
pmPageNum,pmPages)}}})}})}function y(e,h){var n={},m="",p={};"undefined"==typeof h&&(h=window.location.href);m=h;p=vBulletin.parseUrl(h);if(1<p.search.length){h=p.search.substr(1).split("&");for(m=0;m<h.length;m++){var u=h[m].split("=");1<u.length&&(n[u[0]]=u[1])}m=window.location.protocol+"//"+p.hostname;m=0<p.port.length?m+(":"+p.port+p.pathname):m+p.pathname}m=m.replace(/\/(\d+)\/?$/,"/"+e);if(a("#notificationFilters").length){var x=getNotificationsFilterParams();a.each(["readFilter","sortDir",
"typename"],function(C,b){x.hasOwnProperty(b)&&(n["filter_"+b]=x[b])})}n=vBulletin.privateMessage.getPageFiltersForUrl(n);queryString="?"+a.param(n);return{newHrefBase:m,queryString,hash:p.hash,url:m+queryString+p.hash}}function E(e){e=e.target.id.substring(15);e=parseInt(e);isNaN(e)||vBulletin.AJAX({call:"/ajax/render/privatemessage_participants",data:{nodeid:e,showFollowButtons:"undefined"!=typeof messageDetailPage&&messageDetailPage?0:1,isAjaxTemplateRenderWithData:!0},success:function(h){a("#pmInfoContent").html(h.template);
a(".pmBtnFollowRequest").off("click").on("click",sendFollowRequest);a("#pmInfoDialog").dialog({title:vBulletin.phrase.get("members_in_this_message"),autoOpen:!1,modal:!0,resizable:!1,closeOnEscape:!0,showCloseButton:!0,width:500,dialogClass:"dialog-container member-list-dialog-container dialog-box"}).dialog("open")},error_phrase:"pm_ajax_error_desc"})}function F(e,h,n){var m=this;$promtDlg=l.openPromptDialogSimple({title:"add_folder",message:"folder_name",validation:p=>isFolderNameValid(p,"add_folder",
!0),onClickOk:function(p){vBulletin.AJAX({call:"/ajax/api/content_privatemessage/createMessageFolder",data:{folderName:p},success:function(u){$promtDlg.dialog("close");f.ensureFun(h).apply(m,[u,p])},api_error:u=>{$promtDlg.find(".js-prompt-error").html(k.get(u[0])).removeClass("h-hide")},error_phrase:"pm_ajax_error_desc"});return!1},onAfterClose:()=>{f.ensureFun(n).apply(m)}});return!1}function I(e){if("pmBtnNotificationDismissAll"==e.currentTarget.id)e=parseInt(a(".js-notifications-folder-count").data("count")),
isNaN(e)||0>=e?vBulletin.warning("dismiss_notification_all","nothing_to_dismiss"):l.openConfirmDialogSimple({title:"dismiss_notification_all",message:["confirm_about_to_dismiss_x_notifications",e],iconType:"warning",onClickYes:n=>{f.AJAX({call:"/ajax/api/notification/dismissAllNotifications",data:{},success:function(){location.reload()},error_phrase:"error_dismissing_notification"})}});else if("pmBtnNotificationDismissPage"==e.currentTarget.id){var h={};a(".pm-notification-list").find(".js-notification-dismiss").each(function(n){n=
a(this).data("notificationid");null!=n&&(h[n]=n)});a.isEmptyObject(h)?vBulletin.warning("dismiss_notification_page","nothing_to_dismiss"):(e={readIds:h,idsOnPage:h,filterParams:getNotificationsFilterParams(),skipFetch:!0},vBulletin.AJAX({call:"/ajax/api/notification/dismissNotification",data:e,success:function(){a(".pm-notification-list").find(".js-notification-dismiss").each(function(n){a(this).removeClass("notification-unread")});location.reload()},error_phrase:"error_dismissing_notification"}))}}
var B=vBulletin.history.instance(!0),J=getNotificationsFilterParams(),K={};0<Object.keys(J).length&&(K.notificationFilterParams=J);B.setDefaultState(K,document.title,window.location.href);B.setStateChange(function(e){e=B.getState();e.data.hasOwnProperty("notificationFilterParams")&&(e=e.data.notificationFilterParams,r(e),w(e.page,!0))},"privatemessage");vBulletin.privateMessage.pmFilterHistory=B;vBulletin.privateMessage.updatePaginationLinks=function(e,h,n){e=e.find(".js-pagenav");if(0<e.length){var m=
e.find(".js-pagenav-button:not(.js-pagenav-button--template)"),p=e.find(".js-pagenav-next-button"),u=e.find(".js-pagenav-prev-button"),x=e.find(".js-pagenav-button--template"),C=/\/(\d+)\/?$/;var b=h-2;var c=a("#maxPageNum").val();""==x.attr("href")&&""!=e.data("baseurl")&&x.attr("href",e.data("baseurl"));var d=x.attr("href");d=y(h,d);x.attr("href",d.newHrefBase);d=d.queryString;1>b&&(b=1);var g=b+4;g>c&&(g=c);m.not(".js-pagenav-next-button, .js-pagenav-prev-button").remove();for(m=b;m<=g;m++)b=x.attr("href").replace(C,
"/"+m)+d,b=x.clone().removeClass("js-pagenav-button--template h-hide-imp").attr("data-page",m).text(m).attr("href",b),m==h&&b.removeClass("b-button--secondary").addClass("b-button--primary"),b.insertBefore(p),a(document.createTextNode("\n")).insertBefore(p);g=parseInt(h,10)-1;g=1<g?g:1;u.data("page",g);b=x.attr("href").replace(C,"/"+g)+d;u.attr("href",b);g=parseInt(h,10)+1;g=g<=c?g:c;p.data("page",g);b=x.attr("href").replace(C,"/"+g)+d;p.attr("href",b);u.add(p).removeClass("h-hide h-hide-imp");1==
h&&u.addClass("h-hide-imp");h==c&&p.addClass("h-hide-imp");"undefined"!=typeof n&&(h=1<n,e.closest(".pagenav-container").toggleClass("h-hide",!h),e.closest(".js-pagenav-wrapper").toggleClass("h-hide",!h))}};vBulletin.privateMessage.getPageFiltersForUrl=function(e){return e};vBulletin.privateMessage.getPrivateMessageUrl=y;a(function(){function e(b,c){var d=!1,g=b.find(".edit-folder-box").val().toLowerCase(),q=a(".folder-list.custom-folder-list"),v;q.find(".folder-item",c).each(function(){v=a(this);
if(g<v.find(".label").text().toLowerCase())return v.before(b),d=!0,!1});d||q.append(b)}function h(b,c){var d=!1,g=a("folder_"+b),q;c=vBulletin.htmlEntities(c);g.length?(g.find("span").html(c),g.parent().detach()):g=a('<li class="pmMoveToFolder" id="folder_'+b+'"><span>'+c+"</span></li>");c=c.toLowerCase();a("#pmMoveToFolder li.pmMoveToFolder").each(function(v){q=a(this);if(0<v&&c<q.html().trim().toLowerCase())return q.before(g),d=!0,!1});!d&&q&&q.after(g)}function n(b){if(b){var c="data-href";var d=
"href"}else c="href",d="data-href";a(".folder-list .folder-item a",$pmWidget).each(function(){var g=a(this),q={};q[c]=g.attr(d);g.attr(q).removeAttr(d)})}function m(b,c,d,g){let q,v,D,G;b||(b=a("#private-message-toolbar .pending-posts-paginator .pendingpostsPageTo"),0==b.length&&(console.log("Failed to find pagination button."),D=v=q=1,G=""));let z=b.closest(".pending-posts-paginator"),L=z.find("#maxPageNum").filter("input[type=hidden]"),M=z.find("input[name=pagenum]");q=L.val();v=parseInt(M.val(),
10);D=parseInt(z.find("input[name=per-page]").val(),10);G=z.find("input[name=routeInfoJson]").val();"current"==c&&(c=v);c=parseInt(c,10);if(isNaN(c)||isNaN(q)||isNaN(v))return!1;if(1>c||c>q)return vBulletin.error("error","please_enter_a_valid_page_number"),!1;if(c==v&&!g)return!1;var N={setCurrentPage:c,setPerPage:D,options:{},routeInfoJson:G,isAjaxTemplateRenderWithData:!0};a("#pendingFilters input:checked").each(function(){N.options[this.name]=this.value});vBulletin.AJAX({call:"/ajax/render/privatemessage_pendingpost_main",
data:N,success:function(A){a("#privateMessageContainer .main-pane .pending-posts-container").html(A.template);A=c-1;var H=0;c<q&&(H=c+1);M.val(c);z.find("input[name=next-page]").val(H);z.find("input[name=prev-page]").val(A);z.find(".pendingpostsNext").toggleClass("h-disabled",!H);z.find(".pendingpostsPrev").toggleClass("h-disabled",!A);z.find(".pendingpostsPageTo").val(c);d&&(A=a("#privateMessageContainer .main-pane .pending-posts-container .pending-posts-pageinfo"),A=parseInt(A.find(".totalpages").val(),
10),L.val(A),z.find("div.pendingpostsPageCount").text(A),a(".folder-list .folder-item.pending-posts .count",$pmWidget).text(A))},error_phrase:"unable_to_contact_server_please_try_again"})}function p(b){a(b).each(function(){a(".pending-posts-container .list-container .list-item[data-node-id={0}]".format(this)).remove()})}$pmWidget=a(".private-message-widget");var u=a(".js-pm-content-entry-container"),x=a(".js-editor",u);a(document).off("focus",".js-editor.js-focus-on-page-load").on("focus",".ckeditor-bare-box.ckeditor-load-on-focus",
function(){vBulletin.ckeditor.initEditor(a(this).attr("id"),{error:function(b){a("#"+b).prop("disabled",!1).removeClass("ckeditor-load-on-focus").closest(".js-pm-content-entry-container").addClass("no-ckeditor")}})});0<x.length&&(u.hasClass("msg-type-new")||u.hasClass("msg-type-forward"))&&vBulletin.ckeditor.initEditor(x.attr("id"),{success:function(b){b=x.prev(".js-editor-parsed-text");0<b.length&&this.setData(b.html());setTimeout(function(){a(".autocompleteHelper",u)[0].focus()},200)},error:function(b){a("#"+
b).prop("disabled",!1).removeClass("ckeditor-load-on-focus").closest(".js-pm-content-entry-container").addClass("no-ckeditor")}});a(".folder-list.custom-folder-list form",$pmWidget).trigger("reset");$pmWidget.off("click",".folder-item.custom-folder .edit-icon-wrapper").on("click",".folder-item.custom-folder .edit-icon-wrapper",function(b){b.stopPropagation();b=a(this).closest(".custom-folder").addClass("edit-folder-mode").find(".edit-folder-box").trigger("select").trigger("focus");b.val(vBulletin.htmlEntities_decode(b.val()));
b.data({origFolderName:b.val(),updateFlag:!0});n(!0);return!1});var C;$pmWidget.off("keydown blur",".folder-item.custom-folder .edit-folder-box").on("keydown",".folder-item.custom-folder .edit-folder-box",function(b){var c=a(this),d=!1;switch(b.which){case 27:c.data("updateFlag",!1);c.closest(".custom-folder").removeClass("edit-folder-mode");n(!1);c.val(c.data("origFolderName"));d=!0;break;case 13:c.data("updateFlag",!0),c.trigger("blur",[!0]),d=!0}return!d}).on("blur",".folder-item.custom-folder .edit-folder-box",
function(b,c){var d=a(this);b=function(){if(!d.data("updateFlag"))return!1;d.data("updateFlag",!1);if(!isFolderNameValid(d,"edit_folder"))return d.data("updateFlag",!0),!1;n(!1);var g=d.closest(".custom-folder"),q=d.val().trim(),v=d.data("origFolderName"),D=d.data("nodeId");q!=v?vBulletin.AJAX({call:"/ajax/api/content_privatemessage/updateFolderTitle",data:{folderName:q,folderid:D},success:function(G){g.find(".label").text(q);e(g.detach(),$pmWidget);h(D,q)},title_phrase:"edit_folder",error_phrase:"error_editing_folder",
complete:function(){g.removeClass("edit-folder-mode")},after_error:function(){d.val(v)}}):g.removeClass("edit-folder-mode")};c?b():C=setTimeout(b,200)});$pmWidget.offon("click",".folder-item.custom-folder .js-delete-icon",function(b,c){clearTimeout(C);b.stopPropagation();var d=a(this),g=d.prev(".edit-folder-box");if(!c)return l.openConfirmDialogSimple({title:"delete_folder",message:"selected_folder_and_contents_will_be_deleted",iconType:"warning",onClickYes:()=>{d.trigger("click",[!0])},onClickNo:()=>
{g.trigger("select").trigger("focus")}}),!1;f.AJAX({call:"/ajax/api/content_privatemessage/deleteFolder",data:{folderid:g.attr("data-node-id")},success:function(q){n(!1);q=d.closest(".custom-folder");var v=q.find("a").hasClass("selected");q.remove();v&&(location.href=a(".nav-pane .folder-list .folder-item.messages a",$pmWidget).attr("href"))},title_phrase:"delete_folder",error_phrase:"error_deleting_folder"})});$pmWidget.off("click",".folder-list .folder-item > a[href]").on("click",".folder-list .folder-item > a[href]",
function(b){b=a(".folder-list .custom-folder.edit-folder-mode",$pmWidget);if(0<b.length)return b.trigger("blur",[!0]),!1;b=a(this);var c=b.parent();if(c.hasClass("edit-folder-mode")||!c.hasClass("special-folder")&&b.hasClass("selected"))return!1;c.hasClass("add-folder")||(a(".folder-list .folder-item > a.selected",$pmWidget).removeClass("selected"),b.addClass("selected"));return!0});$pmWidget.off("click",".folder-list .folder-item.add-folder > a[href]").on("click",".folder-list .folder-item.add-folder > a[href]",
function(b){F.apply(this,[b,function(c,d){var g=a(".folder-item.custom-folder.template",$pmWidget).clone(!0).removeClass("h-hide template"),q=g.find("a");g.find(".label").text(d);q.attr("href",q.attr("href").replace(/\/list\/0\//i,"/list/"+c+"/"));g.find(".edit-folder-box").attr("data-node-id",c).val(d);e(g,$pmWidget);h(c,d)},function(){a(this).removeClass("selected")}]);return!1});a("#pmBtnMarkRead").offon("click",function(){markMessages(a(this).text(),"setRead","read",1,!1)});a("#pmBtnMarkUnRead").offon("click",
function(){markMessages(a(this).text(),"setRead","read",0,!1)});a("#pmBtnDelete").offon("click",function(b){var c="undefined"!=typeof messageDetailPage&&messageDetailPage,d=getSelectedMessages(),g=a(this).text();0<d.length&&l.openConfirmDialogSimple({title:"messages_header",message:"are_you_sure_move_to_trash",iconType:"warning",onClickYes:()=>{markMessages(g,"toTrashcan",!1,!1,c,d)}})});a(".pmBtnDeletePermanently").offon("click",function(b){var c=getSelectedMessages(),d=a(this).text();0<c.length&&
l.openConfirmDialogSimple({title:"messages_header",message:"are_you_sure_permanently_delete_messages",iconType:"warning",onClickYes:()=>{markMessages(d,"deleteMessages",!1,!1,!1,c)}})});a(".pmBtnUndelete").offon("click",function(b){markMessages(a(this).text(),"undeleteMessage",!1,!1,!1)});a("#reportBtnMarkOpen").offon("click",function(b){markReports(a(this).text(),"openClose","op","open")});a("#reportBtnMarkClosed").offon("click",function(b){markReports(a(this).text(),"openClose","op","closed")});
a("#reportBtnDelete").offon("click",function(b){markReports(a(this).text(),"bulkdelete",!1,!1)});a(".js-move-pm").offon("click",function(b){b=parseInt(this.id.substr(7),10);var c="undefined"!=typeof messageDetailPage&&messageDetailPage,d=vBulletin.phrase.get("move");b&&markMessages(d,"moveMessage","newFolderid",b,c)});a(".js-pm-movenewfolder").offon("click",function(b){var c=getSelectedMessages(),d="undefined"!=typeof messageDetailPage&&messageDetailPage,g=vBulletin.phrase.get("move");0<c.length&&
F.apply(this,[b,function(q,v){markMessages(g,"moveMessage","newFolderid",q,d)}]);return!1});a("#pmBtnForward").offon("click",startForward);a("#pmInfoClose").offon("click",function(b){a("#pmInfoDialog").dialog("close")});a("#privatemessagePageto, #sentItemsPageTo").on("keydown blur",gotoPage);a(".pmRequestAccept").offon("click",acceptRequest);a(".pmRequestDeny").offon("click",denyRequest);a("#pmBtnReply").offon("click",function(){var b=a(".js-pm-content-entry-container .js-editor"),c=b.attr("id"),
d=vBulletin.ckeditor.editorExists(c)?vBulletin.ckeditor.getEditor(c):null;a("body,html").animate({scrollTop:a(".js-pm-content-entry-container").offset().top},"slow",function(){(d||b[0]||a()).focus()})});a("#pmFloatingBarContent .toolbar-filter").offon("click",function(b){var c=a(this);b=a(".filter-wrapper",c);b.toggleClass("selected");b.attr("aria-expanded",b.is(".selected"));a(".js-expanded-indicator",c).toggleClass("fa-caret-down fa-caret-up");c.closest(".toolbar-wrapper").find(".toolbar-filter-overlay").slideToggle("slow",
function(){if(a(this).is(":visible")){a("body").off("click.pm_filter").on("click.pm_filter",function(g){0==a(g.target).closest(".toolbar-filter-overlay").length&&0==a(g.target).closest(".toolbar-filter").length&&(a("body").off("click.pm_filter"),c.triggerHandler("click"))});var d={};vBulletin.isScrolledIntoView(this,d)||a("html,body").animate({scrollTop:"+="+Math.abs(d.bottom)},"fast")}else a("body").off("click.pm_filter")})});a(".list-controls .select-all").off("click").on("click",function(b){a(".privateMessageActionCheck").prop("checked",
!0)});a(".list-controls .select-none").off("click").on("click",function(b){a(".privateMessageActionCheck").prop("checked",!1)});if("undefined"!=typeof messageDetailPage&&messageDetailPage)a("#pmBtnBackToMessage").off("click").on("click",function(b){pmParentFolderId?location.href="{0}/messagecenter/list/{1}/1".format(pageData.baseurl,pmParentFolderId):(b=a(".nav-pane .folder-list .folder-item.special-folder.messages a").attr("href"),location.href=b)});a("#notificationFilters").trigger("reset").find(".filter-options input").off("click").on("click",
t);a("#pmBtnNotificationDismissAll").offon("click",I);a("#pmBtnNotificationDismissPage").offon("click",I);a("#iconNotificationNext").offon("click",function(b){b.preventDefault();pmPageNum=parseInt(pmPageNum);pmPageNum<pmPages&&w(pmPageNum+1)});a("#iconNotificationPrevious").offon("click",function(b){b.preventDefault();pmPageNum=parseInt(pmPageNum);1<pmPageNum&&w(pmPageNum-1)});a("#notificationContent").on("click",".js-notification-dismiss",dismissSingleNotification);a("#notificationContent").on("click",
".js-notification-others-dialog",toggleOthersDialog);0==a("#notificationContent").length&&(a("ul.pm-notification-list").on("click",".js-notification-dismiss",dismissSingleNotification),a("ul.pm-notification-list").on("click",".js-notification-others-dialog",toggleOthersDialog));a("#notificationPageto").on("keydown blur",function(b){var c=a(this);return"blur"==b.type||"keydown"==b.type&&13==b.keyCode?(b=Number(c.val()),!isNaN(b)&&b!=pmPageNum&&0<b&&b<=pmPages?w(b):c.val(pmPageNum),!1):!0});searchAuthorAutocomplete=
new vBulletin_Autocomplete(a(".privatemessage_author"),{apiClass:"user",delimiter:" ; "});a(document).off("click",".pmNotifDlgLink").on("click",".pmNotifDlgLink",E);a("#pmSearch").submit(function(){var b=a(this),c=b.find("[name=searchJSON]");b=b.find("[name=q]");var d={};d.keywords=b.val();d.type="vBForum_PrivateMessage";d.ignore_protected=0;c.val(JSON.stringify(d));return 3<b.val().length});a(document).offon("click",".pending-post-approve",b=>{let c=[];b=a(b.currentTarget);b.closest("#pmFloatingBarContent").length?
a(".pending-posts-container .list-item .privateMessageActionCheck:checked").each(function(){let d=a(this).closest("li.list-item");c.push(parseInt(d.data("nodeId"),10))}):(b=b.closest("li.list-item"),c.push(parseInt(b.data("nodeId"),10)));if(0==c.length)return!1;vBulletin.AJAX({call:"/ajax/api/node/setApprovedPost",data:{nodeid:c,approved:1,data:{}},error_phrase:"unable_to_contact_server_please_try_again",success:function(d){p(d)}})});a(document).offon("click",".pending-post-delete",b=>{var c=[],d=
[];b=a(b.currentTarget);b.closest("#pmFloatingBarContent").length?a(".pending-posts-container .list-item .privateMessageActionCheck:checked").each(function(){let g=a(this).closest("li.list-item");c.push(parseInt(g.data("nodeId"),10));d.push(parseInt(g.data("userId"),10))}):(b=b.closest("li.list-item"),c.push(parseInt(b.data("nodeId"),10)));if(0==c.length)return!1;vBulletin.inlinemod.delete_dialog(c,function(g){p(g)})});a(document).offon("click",".pending-posts-paginator .pendingpostsPrev",function(b){b.preventDefault();
b=a(this).closest(".pending-posts-paginator").find(':input[type=hidden][name="prev-page"]').val();m(a(this),b)});a(document).offon("click",".pending-posts-paginator .pendingpostsNext",function(b){b.preventDefault();b=a(this).closest(".pending-posts-paginator").find(':input[type=hidden][name="next-page"]').val();m(a(this),b)});a(document).offon("keypress",".pending-posts-paginator .pendingpostsPageTo",function(b){if(13==b.keyCode){b.preventDefault();b=a(this);var c=parseInt(b.val(),10);if(isNaN(c))return vBulletin.error("error",
"please_enter_a_valid_page_number"),!1;m(b,c)}});$pmWidget.filter(".private-message-toolbar").offon("click",".message-filters .filter-options :input[type=radio]",function(b){b=a(this).closest("form.toolbar-filter-overlay");b.attr("action",b.attr("action")+"?sortDir="+a(this).val());b.submit()});a("#pendingFilters").trigger("reset").find(".filter-options input").off("click").on("click",function(b){m(!1,"current",!1,!0)});vBulletin.truncatePostContent(a(".pm-message-list"));vBulletin.privateMessage.jsReady=
!0;a(document).trigger("vb-privatemessage-js-ready")})})(jQuery,vBulletin,vBulletin.phrase,vBulletin.dialogtools);
isFolderNameValid=function(a,f,k){var l="",r=$.trim(a.val()).toLowerCase();""==r?l="error_enter_folder":50<r.length?l="error_foldername_maxlength":$(".folder-list.custom-folder-list .folder-item .edit-folder-box",$pmWidget).each(function(){if(a.hasClass("edit-folder-box")&&a.get(0)==this)return!0;if(r==this.value.toLowerCase())return l="error_folder_exists",!1});if(""==l)return!0;if(!0===k)return l;vBulletin.warning(f,l,function(){a.trigger("focus")});return!1};
getSelectedMessages=function(a){var f=[];!a&&$("#privateMessageNodeid").val()?f.push($("#privateMessageNodeid").val()):f=$(".privateMessageActionCheck:checked").map(function(){return this.value}).get();0==f.length&&vBulletin.warning("error","please_select_messages");return f};
markMessages=function(a,f,k,l,r,t){t||(t=getSelectedMessages());if(0<t.length){var w={nodeid:t.join(",")};k&&(w[k]=l);vBulletin.AJAX({call:"/ajax/api/content_privatemessage/"+f,data:w,success:function(y){y="mark_message"+(1<t.length?"s":"")+"_status_text_";var E={methodName:"for_move",toTrashcan:"for_delete",setRead:"for_"+(l?"read":"unread"),deleteMessages:"for_delete_permanently"};y=E[f]?y+E[f]:y+"generic";openAlertDialog({title:a,message:vBulletin.phrase.get(y),onAfterClose:function(){if(r)if(pmParentFolderId)location.replace("{0}/messagecenter/list/{1}/1".format(pageData.baseurl,
pmParentFolderId));else{var F=$(".nav-pane .folder-list .folder-item.special-folder.messages a").attr("href");location.replace(F)}else location.reload(!0)}})}})}return!1};
markReports=function(a,f,k,l){var r=getSelectedMessages();if(0<r.length){var t={nodeids:r.join(",")};k&&(t[k]=l);vBulletin.AJAX({call:"/ajax/api/content_report/"+f,data:t,success:function(){var w="mark_report"+(1<r.length?"s":"")+"_status_text_",y={bulkdelete:"for_delete",openClose:"for_"+l};w=y[f]?w+y[f]:w+"generic";openAlertDialog({title:a,message:vBulletin.phrase.get(w),onAfterClose:function(){"bulkdelete"==f?location.replace(pageData.baseurl+"/messagecenter/report/1"):location.reload(!0)}})},
error_phrase:"pm_ajax_error_desc"})}return!1};gotoPage=function(a){var f=$(this);if("blur"==a.type||"keydown"==a.type&&13==a.keyCode){a=Number(f.val());var k=$("#maxPageNum").val();if(!isNaN(a)&&a!=pmPageNum&&0<a&&a<=k){f="";if("undefined"!=typeof folderid)f="/"+routeAction+"/"+folderid+"/";else switch(routeAction){case "report":f="/"+routeAction+"/"}if(""!=f)newpage=window.location.href.replace(f+pmPageNum,f+a),window.location=newpage;else return!0}else f.val(pmPageNum);return!1}return!0};
startForward=function(a){if(1==$(".privateMessageDetail .js-post").length)a=getSelectedMessages(),window.location=pageData.baseurl+"/messagecenter/forward/"+a[0];else{var f=function(k){$(".js-hide-on-forward").toggleClass("h-hide-imp",k);$(".js-show-on-forward").toggleClass("h-hide-imp h-hide",!k);$(".pmViewCb").toggleClass("h-hide",!k)};f(!0);$("#pmBtnCancel").off("click").on("click",function(k){f(!1);$("#pmBtnForward").off("click").on("click",startForward);$(".conversation-content.private-message-detail").removeClass("show-subcontrols")});
$(".conversation-content.private-message-detail").addClass("show-subcontrols");$("#pmBtnForward").off("click").on("click",function(k){k=getSelectedMessages(!0);0<k.length&&(window.location=pageData.baseurl+"/messagecenter/forward/"+k.join(","))})}};
acceptRequest=function(a){var f=parseInt(a.target.id.substr(16));vBulletin.AJAX({call:"/ajax/api/content_privatemessage/acceptRequest",data:{nodeid:f},success:function(k){openAlertDialog({title:vBulletin.phrase.get("private_messages"),message:k});$("#msgSummary_"+f).remove()}})};
denyRequest=function(a){var f=parseInt(a.target.id.substr(14));vBulletin.AJAX({call:"/ajax/api/content_privatemessage/denyRequest",data:{nodeid:f},success:function(k){k.result&&vBulletin.alert("private_messages",k.result,"");$("#msgSummary_"+f).remove()}})};notificationFadeOut=function(a){a.animate({opacity:"0.0"},{duration:500,complete:function(){a.empty();a.animate({height:0,width:0,"padding-top":0,"padding-right":0,"padding-bottom":0,"padding-left":0},{duration:100,complete:function(){a.remove()}})}})};
notificationFadeIn=function(a,f,k){a&&($container=$(".js-notification-container"),$temp=$(a).hide(),$container.append($temp),$temp.fadeIn())};function getNotificationsFilterParams(){var a={},f=$("#notificationFilters");if(!f.length)return{};f.find("input[type=hidden], input[type=radio]:checked").each(function(k){a[this.name]=this.value});"undefined"!=typeof pmPageNum&&(a.page=parseInt(pmPageNum));"undefined"!=typeof pmPerPage&&(a.perpage=parseInt(pmPerPage));return a}
decrementNotificationCount=function(){var a=$(".inbox .count"),f=$(".notifications .count"),k=a.text(),l=f.text();--k;0>=k&&a.hide();--l;0>=l&&f.hide();a.text(k);f.text(l);$(".js-header-count-contains-notifications").each(function(r,t){r=$(t).text();r--;0>=r&&$(t).addClass("h-hide-imp");$(t).text(r)})};
toggleOthersDialog=function(a){if($othersBox=$(a.currentTarget).closest("li.message-item").find(".js-others-wrapper"))a=$othersBox.data("titlephrase")||"members_in_this_message",vBulletin.qtip.apply($(this),"qtip-notificationothers",{content:{title:{text:vBulletin.phrase.get(a),button:!0},text:$othersBox.html()},position:{my:"top center",at:"bottom center",viewport:$(window)},show:{event:"click",solo:!0,ready:!0},events:{visible:function(f,k){$(".pmBtnFollowRequest").off("click").on("click",sendFollowRequest)}},
hide:{event:"unfocus",fixed:!0}})};
dismissSingleNotification=function(a){var f=$(a.currentTarget).closest("li.message-item");a=f.data("notificationid");if(null!=a){var k={};$(".pm-notification-list").find("li.message-item.notification-unread").each(function(r){r=$(this).data("notificationid");null!=r&&(k[r]=r)});var l={readIds:a,idsOnPage:k,filterParams:getNotificationsFilterParams()};"unread_only"!=l.filterParams.readFilter&&(l.skipFetch=!0);f.find(".js-waiting-for-ajax-response").removeClass("h-hide");vBulletin.AJAX({call:"/ajax/api/notification/dismissNotification",
data:l,success:function(r){var t=r.insertNotification||"";r=r.lastsenttime||-1;var w=l.filterParams.sortDir;f.removeClass("notification-unread js-notification-dismiss-touch");f.find("button.js-notification-dismiss").remove();decrementNotificationCount();"unread_only"==l.filterParams.readFilter&&(notificationFadeOut(f),notificationFadeIn(t,r,w),"undefined"!==typeof pmNotificationCount&&(pmNotificationCount--,0<=pmNotificationCount&&(t=$("#notificationPageto"),1<l.filterParams.page&&pmNotificationCount<
(l.filterParams.page-1)*l.filterParams.perpage+1&&(t.val(l.filterParams.page-1),t.trigger("blur")),1<pmPages&&pmNotificationCount<(pmPages-1)*l.filterParams.perpage+1&&(pmPages--,$("#notificationPageCount").text(pmPages),$("#maxPageNum").val(pmPages),vBulletin.privateMessage.updatePaginationLinks($("#notificationContent").parent(),t.val(),pmPages)))))},complete:function(){f.find(".js-waiting-for-ajax-response").addClass("h-hide")},error_phrase:"error_dismissing_notification"})}};
sendFollowRequest=function(a){var f=$(this);a=Number(f.data("userid"));isNaN(a)||vBulletin.AJAX({call:"/ajax/api/follow/add",data:{follow_item:a},success:function(k){if("1"==k){f.removeClass("b-button--secondary").addClass("isSubscribed b-button--special");var l="following"}else"2"==k&&(f.addClass("subscribepending_button"),l="following_pending");l&&f.prop("disabled",!0).find(".js-button__text-primary").html(vBulletin.phrase.get(l))},error_phrase:"pm_ajax_error_desc"})};
