/*
 =======================================================================*\
|| ###################################################################### ||
|| # 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("action active add_subnavigation_markchannelread ad_list_description ad_otherlocations ad_used_one_other_location ad_used_x_other_locations add_modules add_subforum adding_multiple_modules_not_allowed all applying_new_template are_you_sure_want_to_delete_ad_x cancel cannot_add_system_module cannot_convert_channel cannot_remove_system_module change_homepage change_homepage_confirm_x change_homepage_confirm_x_to_y change_homepage_please_select channels check_to_hide_module choose_base_module choose_options_favicon choose_options_site_logo click_text_edit_title confirm_deletion_gcpglobal confirm_deletion_x confirm_remove_page_desc content_types create_ad create_new_custom_module delete display_order do_you_want_to_cancel_editing_search_module do_you_want_to_exit_without_saving_page do_you_want_to_remove_channel do_you_want_to_remove_forum do_you_want_to_remove_module do_you_want_to_remove_tab drag_and_drop_module_here drop_page_here dropping_container_module_into_container_module_not_allowed edit edit_ad_x edit_blog_categories edit_custom_html_module edit_favicon edit_navigation_item edit_search_module edit_site_logo error_adding_widgets error_cloning_widget error_deleting_page error_fetching_channels error_loading_search_config_script error_processing_favicon error_processing_site_logo error_renaming_module_title error_retrieving_cloned_widget_template error_retrieving_configuration error_retrieving_list_user_groups error_retrieving_modules error_retrieving_navigation_bar_configuration error_retrieving_page_map error_retrieving_templates error_saving_configuration_module error_saving_forums error_saving_navigation_bar_configuration error_saving_page error_saving_search_config error_saving_site_logo error_uploading_logo exit_without_saving_page expand forum_changes_will_be_lost global_section_notice hompage_updated_reload input_navigation_item_name input_target_url invalid_image_url main_navigation_bar make_category make_forum manage_ads module_configuration module_icon move_not_allowed moving_main_nav_to_own_sub_nav_error moving_main_nav_with_sub_nav_error navbar_mark_channels_read new_navigation_item new_subnavigation_item next no no_ad_added no_configurations_found no_modules no_permission none overwrite_template_continue page_saved page_template_title_cannot_be_empty page_title_cannot_be_empty page_view_perm_admincp please_choose_overwrite_template_options please_enter_channel_title please_enter_new_module_title please_enter_new_template_name please_enter_page_name previous remove_channel remove_channel_q remove_forum remove_forum_q remove_module_q rename rename_custom_module reset save save_new_page save_page search_results select_edit_link_header special_options sub_navigation_bar subchannels_will_be_deleted switch_template template_changes_will_be_lost this_url_is_already_used title unable_to_delete_widget_instances uncheck_to_unhide_module url_too_long user_group_settings warning warning_gcpuser yes you_are_here you_can_also_drag_and_drop_modules_here you_cannot_revert_this_layout_confirm you_must_specify_a_screen_layout".split(" "),
[]);vBulletin.ensureObj("sitebuilder");
(function(a,R,O,ia){function La(b){return b.val()==b.prop("defaultValue")}function ja(){location.reload(!0)}function Ma(b,d,c){return new Promise((e,k)=>{b?O.openConfirmDialogSimple({title:d,message:c,iconType:"warning",onClickYes:e,onClickNo:k}):e()})}function Aa(b){var d=()=>b.css("maxHeight","80vh");d();b.on("dialogopen",d);return b}function Z(){setTimeout(function(){vBulletin.vBScroller&&vBulletin.vBScroller.initializeScroller&&a(".js-vbscroller-wrapper:visible").each(function(){vBulletin.vBScroller.initializeScroller(a(this))});let b=
a(".scroller.category"),d=a(".categories");b.length&&d.length&&(d.width()<=b.width()?a(".category-arrow-left, .category-arrow-right").css("visibility","hidden"):a(".category-arrow-right").css("visibility","visible"))},0)}function ra(){var b=a("#edit-page-dropdown .panel .panel-main-content:visible");0<b.length&&(b=parseFloat(b.css("margin-left"))+parseFloat(b.css("margin-right"))+parseFloat(b.css("border-left-width"))+parseFloat(b.css("border-right-width"))+parseFloat(b.css("padding-left"))+parseFloat(b.css("padding-right")),
a("#edit-page-dropdown .panel .panel-main-content").width(a("#edit-page-dropdown .panel:visible").width()-a("#edit-page-dropdown .panel .panel-header-text:visible").outerWidth(!0)-b-1),a("#edit-page-dropdown form .form-gutter-right").width(Math.ceil((a("#edit-page-dropdown form:visible").width()-a("#edit-page-dropdown .panel:visible").outerWidth(!0))/2)),Z())}function pb(b,d){if(b.is(".container-widget")){var c=b.find(".js-admin-widget-list");c.css({minHeight:"35px",height:"auto",paddingBottom:"10px"}).closest(".js-widget-content").removeClass("h-hide").css({minHeight:"35px"});
if(!a.isEmptyObject(d)){var e=[];a.each(d,function(){e.push(this)});e.sort(function(k,r){return k.displayorder==r.displayorder?0:k.displayorder<r.displayorder?-1:1});a.each(e,function(){var k=a(this.rendered_template);this.hidden&&k.addClass("hidden-widget");c.append(k)})}}}function ca(b,d,c){var e=b.attr("data-widget-id");b={widgetinstanceid:b.attr("data-widget-instance-id")||"",widgetid:e,guid:"",userid:0,channelId:0,withTemplate:!1};c="undefined"==typeof c?!1:!!c;vBulletin.AJAX({call:"/ajax/api/widget/fetchConfigAndIsUserEditable",
data:b,success:function(k){var r=k;c||(r=k.config);"function"==typeof d&&d(r)}})}function ka(b){b.tab_data||(b.tab_data=[]);b.default_tab||(b.default_tab=0);b.submodules_key||(b.submodules_key="tabbedContainerSubModules__temp");b.display_tabs||(b.display_tabs="");if(""==b.display_tabs){var d={};a.each(b.tab_data,function(c,e){d[c]="1"});b.display_tabs=d}return b}function la(){"undefined"==typeof da&&(da=a("#config_pagetemplateid").val()||a("#select-template input[type=radio]:checked").val()||"");
return da}function Na(b){b=parseInt(b,10);0<b&&(da=b,a("#config_pagetemplateid, #save-page-form #pagetemplateid-yes, #save-page-form #pagetemplateid-new").val(da))}function sa(b){b=b.closest(".js-section");return b.length?b.data("section")||0:0}function ta(b){b=b.prev(".canvas-widget");return b.length?b.data("widget-instance-id")||0:0}function ma(b,d){vBulletin.AJAX({call:"/ajax/api/widget/saveAdminConfig",data:{widgetid:b.attr("data-widget-id"),widgetinstanceid:b.attr("data-widget-instance-id")||
"",pagetemplateid:la(),data:d,displaysection:sa(b),displayafterwidgetinstanceid:ta(b)},complete:function(){a("body").css("cursor","auto")}})}function ua(b){b=b.parents(".canvas-widget");return b.length?($parentModule=a(b[0]),parseInt($parentModule.data("widget-instance-id"),10)):0}function na(b){var d=b.parents(".canvas-widget[data-is-tabbed-container='true']");b.data("is-tabbed-container")&&Ba(b);0!=d.length&&Ba(a(d[0]))}function aa(b){var d={};b.find("> .js-admin-widget-content > .js-admin-widget-tab").each(function(){var c=
a(this),e=[],k=c&&c.data("tab-number")||0,r=c&&c.data("tab-title")||"";d[k]={title:r};c.find("> .widget-content > .canvas-layout-row > .canvas-widget-list > .canvas-widget:not(.dummy-widget)").each(function(){var v=a(this),p=v.data("widget-id");v=v.data("widget-instance-id")||v.attr("data-widget-instance-id");var f={};v&&(f.widgetinstanceid=v);p&&(f.widgetid=p);a.isEmptyObject(f)||e.push(f)});d[k].widgets=e});return d}function Ba(b){ca(b,function(d){d=ka(d);d.tab_data=aa(b);a.isEmptyObject(d)||ma(b,
d)})}function Oa(b){vBulletin.AJAX({call:"/ajax/api/widget/deleteWidgetInstances",data:{widgetInstanceIds:b},api_error:vBulletin.ajaxtools.logApiError})}function va(b,d,c,e,k,r){var v=la(),p=""==v||0==v;if(p){if(Pa.saveNewWidgetInstance){Qa.one("save-new-widgetinstance-pagetemplateid-ready",function(f){va(b,d,c,e,k,r)});return}Pa.saveNewWidgetInstance=!0}vBulletin.AJAX({call:"/ajax/api/widget/saveNewWidgetInstance",data:{containerinstanceid:b,widgetid:d,pagetemplateid:v,subWidgetConfig:c,displaysection:k,
displayafterwidgetinstanceid:r},success:function(f){p&&f.pagetemplateid&&(Na(f.pagetemplateid),Qa.trigger("save-new-widgetinstance-pagetemplateid-ready"));f.widgetinstanceid&&"function"==typeof e&&e(f.widgetinstanceid)}})}function oa(b){if(b.data("is-tabbed-container")){var d=b.attr("data-widget-instance-id");if(!d){var c=ua(b),e=sa(b),k=ta(b);return va(c,b.attr("data-widget-id"),{},function(q){b.attr("data-widget-instance-id",q);return oa(b)},e,k)}if(a.isEmptyObject(wa))return Ra(oa,[b]);if(!b.data("tabbed-container-initialized")){var r=
b.find(".js-admin-widget-tab-panel-template");c=r.find(".js-admin-widget-list");var v=b.find(".js-admin-widget-tab-header-template");e=b.find(".js-admin-widget-content");var p=e.find(".js-tab-headers"),f=p.find(".js-tab-add");r.detach().removeClass("js-admin-widget-tab-panel-template");v.detach().removeClass("js-admin-widget-tab-header-template");e.tabs({beforeActivate:function(q,h){if(a(h.newTab).hasClass("js-tab-add"))return!1}});var m=e.tabs("widget");c.css({minHeight:"60px",height:"auto",paddingBottom:"10px"});
p.find(".js-tab-add").on("click",function(){ca(b,function(q){var h=ka(q.config),g=h.tab_data.length||0,t=q.isusereditable.tab_data||!1;O.openPromptDialogSimple({title:"enter_tab_title",onClickOk:function(n){if(!n)return!1;y(n,[],g,g,t);h.display_tabs[g]="1";h.tab_data=aa(b);a.isEmptyObject(h)||ma(b,h)}})},!0)});v.find(".js-edit-tab-button").on("click",function(){var q=a(this).closest("li[aria-controls]"),h=q.attr("aria-controls"),g=m.find(".js-admin-widget-tab[id='"+h+"']"),t=g&&g.data("tab-title")||
"";ca(b,function(n){var u=ka(n);O.openPromptDialogSimple({title:"enter_tab_title",initialValue:t,onClickOk:function(w){q.find("span.js-tab-title").text(w);g.data("tab-title",w);u.tab_data=aa(b);a.isEmptyObject(u)||ma(b,u)}})});return!1});v.find(".js-remove-tab-button").on("click",function(){var q=a(this).closest("li[aria-controls]"),h=q.attr("aria-controls"),g=m.find(".js-admin-widget-tab[id='"+h+"']");ca(b,function(t){var n=ka(t.config),u=g.data("tab-number");O.openConfirmDialogSimple({title:"remove_tab_q",
message:["do_you_want_to_remove_tab",g.data("tab-title")],iconType:"warning",onClickYes:function(){n.default_tab==u&&(n.default_tab=0);Array.isArray(n.display_tabs)||(n.display_tabs=a.map(n.display_tabs,function(x){return x}));n.display_tabs.splice(u,1);var w=[];g.find(".canvas-widget").each(function(x,F){(x=a(this).data("widget-instance-id"))&&w.push(x)});w.length&&Oa(w);q.remove();g.remove();p.find("li:not('.js-tab-add')").each(function(x,F){F=a(this).attr("aria-controls");F=m.find(".js-admin-widget-tab[id='"+
F+"']");F.length&&F.data("tab-number",x)});m.tabs("refresh");n.tab_data=aa(b);a.isEmptyObject(n)||ma(b,n);ea();V=!0}})},!0);return!1});var y=function(q,h,g,t,n){"undefined"==typeof q&&(q="Untitled Tab");"undefined"==typeof h&&(h=[]);"undefined"==typeof g&&(g=b.find(".js-admin-widget-tab").length);var u=[];for(J in h)h.hasOwnProperty(J)&&u.push(J);u.sort(function(A,D){return A-D});var w=u.length,x=r.clone().uniqueId().removeClass("h-hide").data("tab-number",g).data("tab-title",q),F=x.find(".js-admin-widget-list");
J=x.attr("id");var N=v.clone(!0).removeClass("h-hide");N.children("a.js-tab-header-link").attr("href","#"+J);N.find("span.js-tab-title").text(q);for(j=0;j<w;j++){var J=u[j],I=h[J],K=I.widgetid||wa[I.guid],l=I.widgetinstanceid||"";q=a('<div data-widget-id="'+K+'" />');q.attr("data-tab-number",g);q.attr("data-widget-order",J);q.attr("data-widget-instance-id",l);q.append(a('<img src="images/loader-box-blue.gif" /> '));F.append(q);K&&(J=function(A,D,z,G){return function(E){E=E.filter(function(){return this.nodeType===
Node.ELEMENT_NODE});if(z)E.attr("data-widget-instance-id",z);else{var B=A.adminconfig||{},C=sa(G),H=ta(G);va(d,D,B,function(U){E.attr("data-widget-instance-id",U);Ba(b)},C,H)}if(!n){B=E.find(".js-move-button");C=E.find(".js-edit-button");H=E.find(".js-remove-button");var L=E.find(".js-edit-tab-button"),M=E.find(".js-remove-tab-button");B.hide();C.hide();H.hide();L.hide();M.hide();E.addClass("js-widget-non-sortable")}G.replaceWith(E);E.filter(":not(.container-widget)").find(".toggle-button").trigger("click",
[!0]);oa(E)}}(I,K,l,q),Sa(q,J))}f.before(N);m.append(x);m.tabs("refresh");m.tabs("option","active",t);F.prepend('<div class="canvas-widget dummy-widget dummy-widget--no-fixed-height"><span>{0}</span></div>'.format(vBulletin.phrase.get("drag_and_drop_modules_below")))};ca(b,function(q){var h=ka(q.config),g=h.tab_data,t=g.length,n=h.default_tab;q=q.isusereditable.tab_data||!1;for(h=0;h<t;h++)y(g[h].title,g[h].widgets,h,n,q);q?p.sortable({helper:"clone",opacity:1,axis:"x",items:"li:not('.js-tab-add')",
cancel:".js-edit-tab-button, .js-remove-tab-button",start:function(){old_numidx_to_controls={};new_controls_to_numidx={};m.find(".js-admin-widget-tab").each(function(u,w){old_numidx_to_controls[u]=a(this).attr("id")})},stop:function(){p.find("li:not('.js-tab-add')").each(function(u,w){w=a(this).attr("aria-controls");var x=m.find(".js-admin-widget-tab[id='"+w+"']");x.length&&(x.data("tab-number",u),m.append(x));new_controls_to_numidx[w]=u});m.tabs("refresh");ca(b,function(u){n=new_controls_to_numidx[old_numidx_to_controls[n]];
u.default_tab=n;var w={},x;for(x in u.display_tabs)w[new_controls_to_numidx[old_numidx_to_controls[x]]]=u.display_tabs[x];u.display_tabs=w;u.tab_data=aa(b);a.isEmptyObject(u)||ma(b,u)})}}):f.hide()},!0);b.data("tabbed-container-initialized",!0)}}}function Ta(b,d){var c=a(".js-canvas-layout-container > .canvas-layout").attr("id");S.tempModuleHTMLCache||(S.tempModuleHTMLCache={},a(".js-canvas-layout-container .canvas-widget").each(function(){var k=a(this).data("widget-instance-id");S.tempModuleHTMLCache["widgetinstance_"+
k]=this.outerHTML}));let e=a(".js-canvas-layout-container");e.text("");vBulletin.AJAX({call:"/admin/get-layouts-for-sitebuilder",data:{pagetemplateid:pageData.pagetemplateid,channelid:pageData.channelid},success:function(k){e.html(k.screenlayoutlist);if(k.widgets&&0<k.widgets.length){let r=a("#"+c);a.each(k.widgets,function(v,p){v=r.find(".canvas-widget-list.section-"+v);for(let f of p)v.append(f.rendered_template),p=v.find(".canvas-widget").filter(function(){return a(this).data("widget-instance-id")==
f.widgetinstanceid}),"undefined"!=typeof f.subModules&&pb(p,f.subModules),oa(p)})}a(".js-section-global").each((r,v)=>{a("<div />").addClass("global-section-notice").html(vBulletin.phrase.get("global_section_notice")).prependTo(v)});vBulletin.ensureFun(d)()},title_phrase:"sitebuilder",error_phrase:"unable_to_load_layouts"})}function W(b,d){var c=d.enableButtons;b=a(".js-top-menu-sitebuilder--list .js-top-menu-link");c?(a(".js-top-menu-user").removeClass("h-hide"),b.removeClass("b-top-menu__item-link--selected b-top-menu__item-link--disabled")):
(d=a(d.currentButton),b.removeClass("b-top-menu__item-link--selected").addClass("b-top-menu__item-link--disabled"),d.addClass("b-top-menu__item-link--selected"),a(".js-top-menu-user").addClass("h-hide"))}function Ua(b,d){a(".js-top-menu-sitebuilder .js-top-menu-link");W(null,{enableButtons:!d,currentButton:b});a(document.body).toggleClass("edit-mode "+b.id,d).toggleClass("view-mode",!d);a(".js-top-menu-user").toggleClass("h-hide",d)}function Y(){a(this).hasClass("selected")||a(document.body).hasClass("edit-mode")||
Ua(this,!0);return!1}function Va(){Ua(this,!1);return!1}function Wa(b,d){b=a("<div />").append(b.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,'<span class="axd-placeholder">{0}'.format(vBulletin.phrase.get("x_will_show_up_here_when_saved",d))).replace(/<vb:/g,"&lt;vb:").replace(/<\/vb:/g,"&lt;/vb:"));b.find("span.axd-placeholder").not(":first").remove();b.find("iframe").remove();return b.html()}function qb(){function b(l,A={}){let D=a("<div />").addClass("nav-item-controls h-right"),
z=a("<li />").append("<label>{0}</label>".format(l.label));A={showDelete:!0,showEdit:!0,...A};A.showDelete&&D.append('<i>|</i><span class="navbar-item-delete b-icon b-icon__trash b-icon--active" title="{0}"></span>'.format(Q("delete")));A.showEdit&&D.append('<i>|</i><span class="navbar-item-edit b-icon b-icon__pencil b-icon--active" title="{0}"></span>'.format(Q("edit")));D.append('<i>|</i><span class="navbar-item-opensubnav b-icon b-icon__arrow-right-m" title="{0}"></span>'.format(Q("expand")));
z.append(D).data({"item-phrase":l.phrase,"item-name":l.label,"item-name-translations":l.labelTranslations,"item-url":l.url,"item-routeid":l.routeid,"item-newwindow":l.newWindow,"item-usergroups":l.userGroups,"item-attr":l.attr,...(l.special&&{"item-special":l.special})});return z}function d(){return new Promise((l,A)=>{R.AJAX({call:"/ajax/api/site/loadHeaderNavbar",data:{siteId:1,url:location.pathname+location.search,edit:0,channelId:pageData.channelid||pageData.nodeid||0},success:function(D){l(D)}})})}
function c(l=!1){let A="navbar"==h,D=A?a("#channel-tabbar ul"):a("#footer-tabbar ul.nav-list"),z=A?a("#channel-subtabbar ul"):a(),G={};const E=new Promise((C,H)=>{l?d().then(L=>{L.forEach(M=>{0<M.routeid&&(G[M.routeid]=M.normalizedUrl)});C()}):C()});D.html("");z.html("");var B=function(C,H,L){var M=(H.data("item-newwindow")?' target="_blank" ':" ")+(H.data("item-attr")||"");L=H.hasClass("selected")&&L?' class="current"':"";var U="<li{0}><a {1}>{2}</a></li>".format;{var pa=H.data("item-name");const Ca=
H.data("item-name-translations"),Da=pageData.languageid;pa=Ca[Da]&&""!=Ca[Da]?Ca[Da]:pa}M=a(U.call("<li{0}><a {1}>{2}</a></li>",L,M,pa));L=H.data("item-routeid");H=H.data("item-url");0<L&&G.hasOwnProperty(L)&&(H=G[L]);M.find("a").prop("href",g(H));C.append(M)};E.then(()=>{a("#edit-navbar .navbar-ui-wrapper ul li").each(function(){var C=a(this);B(D,C,A);C.hasClass("selected")&&a(C.data("subnav-element")).find("li").each(function(){B(z,a(this),!0)})})})}function e(l){var A=l.closest("li"),D=a("#edit-navbar"),
z=D.find(".subnavbar-ui-wrapper");D.find("li").removeClass("h-disabled selected");D.find(".navbar-item-opensubnav").removeClass("b-icon--active");A.addClass("selected");l.addClass("b-icon--active");z.find("ul").hide();a(A.data("subnav-element")).show();z.show()}function k(l){return a(".js-sitenav-translations",N).filter((A,D)=>l?a(D).data("languageid")==l:!0).find("input")}function r(l=null){let A="url",D="",z=0,G="",E="",B=!1;k(void 0).val("");if(l){D=l.data("item-url")||"";G=l.data("item-attr")||
"";E=l.data("item-name")||"";B=l.data("item-newwindow")||!1;z=parseInt(l.data("item-routeid")||0,10);0<z&&(D="",A="routeid");l=l.data("item-name-translations");for(const [C,H]of Object.entries(l))l=H,k(C).val(l)}a("#navbar-edit-name").val(E);a("#navbar-edit-url").val(D);a("#navbar-edit-attr").val(G);a("#navbar-edit-newwindow").prop("checked",B);a(`.js-navbar-pagelist option[value="${z}"]`).prop("selected",!0);a(`#navbar-edit-item input[name="navitem_type"][value="${A}"]`).prop("checked",!0)}function v(l){if("markchannelsread"==
l)return l=new n("navbar_mark_channels_read"),l.label=Q("navbar_mark_channels_read"),l.special="markchannelsread",b(l,{showEdit:!1});throw Error("Unknown special navbar item type: "+l);}var p=null,f=null,m="",y="",q="",h="",g=function(l){l||(l="");return l.match(/^(https?:\/\/|mailto:)/i)?l:"/"==l.substr(0,1)?pageData.baseurl+l:pageData.baseurl+"/"+l},t=function(l,A,D,z,G,E,B){l=new n(l,A,D,z,G,E,B);return b(l)};class n{constructor(l="",A=[],D="#",z=!1,G=[],E="",B="",C=""){this.phrase=l;this.labelTranslations=
A;this.url=D;this.newWindow=z;this.userGroups=G||[];this.attr=E;this.routeid=B;this.special=C;this.label=JShtmlEncode(this.labelTranslations[0]||"")}}var u=function(l,A,D,z,G,E,B,C){l=t(l,A,D,z,G,B,C);l.appendTo(f);var H=a("<ul />").addClass("sub-navbar-list navbar-list sortable");for(const L in E)if(E.hasOwnProperty(L)){A=E[L];D=A.phrase?A.phrase:"";z=A.title_translations||[];G=A.url?A.url:"";B=A.newWindow?A.newWindow:!1;C=A.usergroups?A.usergroups:[];let M=A.attr?A.attr:"",U=A.routeid?A.routeid:
0;(A.special&&""!=A.special?v(A.special):t(D,z,G,B,C,M,U)).appendTo(H)}(function(){H.sortable({start:function(L,M){M.placeholder.html(vBulletin.phrase.get("drop_page_here")).height(M.item.height()-2)},stop:function(L,M){c()},receive:function(L,M){L=M.item.data("subnav-element")||a();L.is(":visible")?(M.sender.sortable("cancel"),vBulletin.warning("move_not_allowed","moving_main_nav_to_own_sub_nav_error")):0<L.find("li").length&&(M.sender.sortable("cancel"),vBulletin.warning("move_not_allowed","moving_main_nav_with_sub_nav_error"))},
connectWith:".sortable",placeholder:"sortable-highlight",forcePlaceholderSize:!0}).disableSelection()})();H.hide();H.appendTo("#navbar-ui-container .subnavbar-list-container");l.data("subnav-element",H);return l},w=function(l,A,D,z,G,E,B){$newItem=t(l.data("item-phrase"),A,D,z,G,E,B);l.data("subnav-element")&&$newItem.data("subnav-element",l.data("subnav-element"));l.hasClass("selected")&&$newItem.addClass("selected");l.replaceWith($newItem)},x=function(l){h=l;"navbar"==h?(m=a("#channel-tabbar ul").html(),
y=a("#channel-subtabbar ul").html(),q=a("#channel-tabbar ul li.current a").attr("href"),a("#channel-subtabbar.h-hide").toggleClass("h-hide default-hide")):(m=a("#footer-tabbar ul.nav-list").html(),q=a("#footer-tabbar ul.nav-list li.current a").attr("href"));a("#admin-navbar-strip-gutter").removeClass().addClass("navbar-"+h);a("#header").add("#header-axd").hide();a("#navbar-ui-container").find(".navbar-ui-wrapper, .subnavbar-ui-wrapper").remove();var A=a("#edit-navbar");A.find(".panel-header-text").hide();
a("#edit-navbar #panel-header-"+h).show();vBulletin.AJAX({call:"/ajax/api/site/"+("navbar"==h?"loadHeaderNavbar":"loadFooterNavbar"),data:{siteId:1,edit:1},success:function(D){var z=a("<ul />").addClass("main-navbar-list navbar-list sortable "+h),G=a("<div />").addClass("new-nav-item main-nav js-new-nav").html(vBulletin.phrase.get("new_navigation_item")),E=a("<h4 />").text(vBulletin.phrase.get("main_navigation_bar"));G=a("<div />").addClass("navbar-ui-wrapper").append(E).append(z).append(G).appendTo("#navbar-ui-container");
z.sortable({start:function(H,L){L.placeholder.html(vBulletin.phrase.get("drop_page_here")).height(L.item.height()-2)},stop:function(H,L){c()},connectWith:".sortable",placeholder:"sortable-highlight",forcePlaceholderSize:!0}).disableSelection();f=z;z=a("<div />").addClass("subnavbar-list-container");E=a("<div />").addClass("new-nav-item sub-nav js-new-nav").html(vBulletin.phrase.get("new_subnavigation_item"));var B=a("<div />").addClass("new-nav-item sub-nav js-add-mark-channels").html(vBulletin.phrase.get("add_subnavigation_markchannelread")),
C=a("<h4 />").text(vBulletin.phrase.get("sub_navigation_bar"));a("<div />").addClass("subnavbar-ui-wrapper").append(C).append(z).append(E).append(B).appendTo("#navbar-ui-container").hide();if(D){for(const H in D)D.hasOwnProperty(H)&&(z=D[H],u(z.phrase?z.phrase:"",z.title_translations||[],z.url?z.url:"",z.newWindow?!0:!1,z.usergroups?z.usergroups:[],z.subnav?z.subnav:[],z.attr?z.attr:"",z.routeid?z.routeid:0));"navbar"==h&&e(G.find(".navbar-item-opensubnav").first());c();A.slideDown("slow")}},error_phrase:"error_retrieving_navigation_bar_configuration"})};
a(document).on("vb-sitebuilder-panel--navbar",function(){var l=a(".js-top-menu-tab--navbar").get(0);a("#edit-navbar").is(":hidden")&&vBulletin.assertUserHasAdminPermission("canusesitebuilder",l,function(){Y.apply(l);x("navbar")});return!1});a(document).on("vb-sitebuilder-panel--footer",function(){var l=a(".js-top-menu-tab--footer").get(0);a("#edit-navbar").is(":hidden")&&vBulletin.assertUserHasAdminPermission("canusesitebuilder",l,function(){Y.apply(l);x("footer")});return!1});var F=function(l){a("#navbar-edit-item").dialog({autoOpen:!0,
modal:!0,resizable:!1,closeOnEscape:!1,showCloseButton:!1,width:400,dialogClass:"dialog-container navbar-item-dialog-container",open:function(){a("#navbar-edit-name").trigger("focus")}}).dialog("option","title",l||vBulletin.phrase.get("edit_navigation_item")).dialog("open")};const N=a("#navbar-edit-item");a("#edit-navbar").on("click",".js-new-nav",function(){p=null;f=0<a(this).closest(".navbar-ui-wrapper").length?a(this).closest(".navbar-ui-wrapper").find("ul"):a(this).closest(".subnavbar-ui-wrapper").find("ul").filter(":visible");
r();F(a(this).html());return!1});let J=null;a("#edit-navbar").on("click",".js-add-mark-channels",function(){const l=a(this).closest(".subnavbar-ui-wrapper").find("ul").filter(":visible"),A=l.find("li").filter((D,z)=>"markchannelsread"==a(z).data("item-special"));0==A.length?v("markchannelsread").appendTo(l):(clearTimeout(J),A.addClass("flash"),J=setTimeout(()=>A.removeClass("flash"),1500));return!1});a(document).on("click","#navbar-edit-save",function(){var l=a("#navbar-edit-name"),A=a("#navbar-edit-url"),
D=a('input[name="navitem_type"]:checked').val(),z=l.val(),G=A.val(),E=a(".js-navbar-pagelist option:selected").val();let B=[];k().each((C,H)=>B[H.dataset.languageid]=H.value);null!=B[0]||(B[0]=z);"routeid"!=D&&(E=0);""==B[0]?vBulletin.warning("edit_navigation_item","input_navigation_item_name",l):""==G&&"url"==D?vBulletin.warning("edit_navigation_item","input_target_url",A):(l=a("#navbar-edit-newwindow").prop("checked"),A=a("#navbar-edit-item").data("edit-usergroups"),D=a("#navbar-edit-attr").val(),
p?w(p,B,G,l,A,D,E):(G=u("",B,G,l,A,[],D,E),f.is(".main-navbar-list.navbar")&&e(G)),c(),f=p=null,a("#navbar-edit-item").dialog("close"));return!1});a(document).on("click","#navbar-edit-cancel",function(){a("#navbar-edit-item").dialog("close");return!1});var I=!1;a(document).on("click","#navbar-edit-usergroups",function(){var l=a("#navbar-edit-usergroups-dialog"),A=function(){var z=l.find(".select_all"),G=l.find(".navbar-usergroup-checkbox");G.prop("checked",!1);var E=function(){var C=G.filter(":checked").length==
G.length&&G.eq(0).is(":checked");z.prop("checked",C)};G.off("change").on("change",E);z.off("change").on("change",function(){G.prop("checked",a(this).prop("checked"))});if(!p)return!1;var B=p.data("item-usergroups-temp");B||(B=p.data("item-usergroups"));a.each(B,function(C,H){a("#navbar-usergroup-checkbox-"+H).prop("checked",!0)});E()},D=function(){var z=[];l.find(".dialog-body input[type=checkbox]").each(function(){a(this).prop("checked")&&z.push(a(this).val())});a("#navbar-edit-item").data("edit-usergroups",
z);p&&p.data("item-usergroups-temp",z)};I?l.dialog("open"):(l.dialog({title:vBulletin.phrase.get("user_group_settings"),autoOpen:!0,modal:!0,resizable:!1,closeOnEscape:!1,showCloseButton:!1,width:500,dialogClass:"dialog-container pagemap-dialog-container input-dialog",create:function(){var z=a(this);z.find(".cancel-button").on("click",function(){z.dialog("close")});z.find(".save-button").on("click",function(){D();z.dialog("close")});vBulletin.AJAX({call:"/ajax/api/usergroup/fetchUsergroupList",success:function(G){var E=
[];a(G).each(function(){E.push('<div class="blockrow"><label><input type="checkbox" class="navbar-usergroup-checkbox" id="navbar-usergroup-checkbox-{0}" value="{0}"><span>{1}</span></label></div>'.format(this.usergroupid,this.title))});z.find(".dialog-body").html(E.join(""));z.dialog("option","position",{of:window});A()},error_phrase:"error_retrieving_list_user_groups",after_error:function(){z.dialog("close")}})},open:function(){A()}}),I=!0);return!1});a("#edit-navbar").on("click",".navbar-item-delete",
function(){var l=a(this).closest("li");l.is(".selected")&&(a("#edit-navbar .subnavbar-ui-wrapper").hide(),a(l.data("subnav-element")).remove());l.remove();c();return!1});a("#edit-navbar").on("click",".navbar-item-edit",function(){var l=a(this).closest("li");p=l;f=l.closest("ul");p.data("item-usergroups-temp",null);r(p);F(a(this).html());return!1});a(".js-onclick-set-navitem-type").on("click",l=>{a("#edit-navbar input[name='navitem_type']").prop("checked",!1);a(l.currentTarget).find("input[name='navitem_type']").prop("checked",
!0)});a("#edit-navbar").on("click",".navbar-item-opensubnav",function(){e(a(this));c();return!1});a(document).on("click",".navbar-navbar #admin-navbar-strip .lnkExitWithoutSaving, .navbar-footer #admin-navbar-strip .lnkExitWithoutSaving",function(){a("#edit-navbar").slideUp();a("#header").add("#header-axd").show();"navbar"==h?(a("#channel-tabbar ul").html(m),a("#channel-subtabbar ul").html(y).parent(".default-hide").toggleClass("h-hide default-hide")):a("#footer-tabbar ul.nav-list").html(m)});var K=
function(){var l=[];a("#edit-navbar .navbar-ui-wrapper ul li").each(function(){var A=a(this),D=function(G){return{phrase:G.data("item-phrase"),title:G.data("item-name"),title_translations:G.data("item-name-translations"),url:G.data("item-url"),routeid:G.data("item-routeid"),special:G.data("item-special")||"",newWindow:G.data("item-newwindow"),usergroups:G.data("item-usergroups"),attr:G.data("item-attr")}},z=[];A.data("subnav-element").find("li").each(function(){$subLi=a(this);z.push(D($subLi))});
A=D(A);A.subnav=z;l.push(A)});R.AJAX({call:"/ajax/api/site/"+("navbar"==h?"saveHeaderNavbar":"saveFooterNavbar"),data:{siteId:1,data:l},success:function(A){a("#edit-navbar").slideUp();a("#header").add("#header-axd").show();a("#admin-navbar-strip-gutter").addClass("h-hide");a(document.body).removeClass("edit-mode lnkEditPage lnkNewPage lnkHeader lnkNavBar lnkFooter").addClass("view-mode");W(null,{enableButtons:!0,currentButton:null});if("navbar"==h){var D=!1;a("#edit-navbar .navbar-ui-wrapper ul li").each(function(){var z=
a(this);if(g(z.data("item-url"))==g(q))return D=!0,a("#edit-navbar .navbar-ui-wrapper ul li").removeClass("selected"),z.addClass("selected"),!1});D?c(!0):(a("#channel-tabbar ul li").removeClass("current"),a("#channel-subtabbar ul").html(""))}},error_phrase:"error_saving_navigation_bar_configuration"})};a(document).on("click",".navbar-navbar #admin-navbar-strip .lnkSaveChanges, .navbar-footer #admin-navbar-strip .lnkSaveChanges",function(){K()})}function rb(b){return a(b).on("reset",function(d,c){R.ensureFun(c)()})}
function sb(){function b(){var f=a(".js-sbpanel-pagelist-wrapper");f.find(".tab-item a").on("click",function(m){m.preventDefault()});f.tabs({beforeActivate:(m,y)=>{y.oldPanel.removeClass("js-panel-active");y.newPanel.addClass("js-panel-active");a(".js-sbpanel-pagelist-wrapper .js-sb-sethomepage-btn").prop("disabled",y.newPanel.is("#sb-pagelist-tab-orphans"))}})}function d(){var f=a(".js-pagelist-filter:checked").val();c(f,!0)}function c(f="all",m=!1){var y=a(".js-sbpanel-pagelist-wrapper"),q=y.find(".js-delayed-template-render-insert-here"),
h=y.find(".js-loading-placeholder"),g={};y.find(".js-simple-pagination-wrapper").each(function(){var t=a(this);g[t.attr("id")]=t.find(".js-pagenum").val()||0});y.tabs("disable");q.html("");h.removeClass("h-hide");vBulletin.AJAX({call:"/ajax/render/admin_sbpanel_pagelist_content_wrapper",data:{urlOptions:{type:f},isAjaxTemplateRenderWithData:!0},success:function(t){q.html(t.template);y.tabs("refresh");y.tabs("enable");y.find(".js-simple-pagination-wrapper").each(function(){var n=a(this),u=m?0:g[n.attr("id")];
r(n,u);e(n);k(n)});y.tabs({active:1});y.tabs({active:0})},error_phrase:"error_fetching_dialog",complete:function(){h.addClass("h-hide")}})}function e(f){f.data("select-all-checkboxes-initialized")||(f.data("select-all-checkboxes-initialized",!0),f.find(".js-checkbox--checkall").each(function(){var m=a(this),y=m.data("group-id"),q=f.find(".js-checkbox[data-group-id='"+y+"']"),h=q.length;m.on("change",function(g){g=a(this).prop("checked");m.prop("indeterminate",!1);g?q.prop("checked",!0):q.prop("checked",
!1)});q.on("change",function(g){a(this).prop("checked");g=q.filter(":checked").length;h>g?(m.prop("checked")&&0<g&&m.prop("indeterminate",!0),m.prop("checked",!1)):(m.prop("indeterminate",!1),m.prop("checked",!0))})}))}function k(f){f.data("actions-initialized")||(f.data("actions-initialized",!0),f.find(".js-delete-orphaned-pagetemplates").on("click",function(m){m=a(this).data("group-id");let y=f.find(".js-checkbox[data-group-id='"+m+"']:checked");1>y.length?O.error("error","delete_orphaned_pagetemplates_please_select_one"):
O.openConfirmDialogSimple({title:"delete",message:["delete_orphaned_pagetemplates_prompt_x",y.length],iconType:"warning",onClickYes:()=>{R.AJAX({call:"/ajax/api/page/deleteOrphanedPagetemplates",data:y.serializeArray(),success:d})}})}))}function r(f,m){function y(w){1>w&&(w=1);w>u&&(w=u);t.addClass("h-hide");n[w]&&n[w].removeClass("h-hide");g.val(w)}if(!f.data("pagination-initialized")){f.data("pagination-initialized",!0);var q=f.find(".js-pagenav-goprev"),h=f.find(".js-pagenav-gopost"),g=f.find(".js-pagenum");
m=m&&parseInt(m,10)||parseInt(g.val(),10);var t=f.find(".js-paginated-page"),n={},u=0;t.each(function(){u++;n[u]=a(this)});g.on("blur keyup",function(w){if("blur"==w.type||"13"==w.keyCode)w=parseInt(g.val(),10),y(w)});q.on("click",function(w){w=parseInt(g.val(),10);w--;y(w)});h.on("click",function(w){w=parseInt(g.val(),10);w++;y(w)});y(m)}}function v(f,m,y,q){var h=vBulletin.phrase.get(q.titlephrase),g=vBulletin.phrase.get(q.subtitlephrase),t=f.closest(".header-edit-box");a(".header-edit-box.selected").removeClass("selected");
t.addClass("selected");y.removeData(["styleselection","fileid"]).data("orig-src",y.attr("src"));m.dialog({autoOpen:!0,modal:!0,resizable:!1,closeOnEscape:!1,showCloseButton:!1,width:520,dialogClass:"dialog-container site-logo-dialog-container input-dialog",title:h,create:function(n,u){n=m.closest(".ui-dialog").find(".ui-dialog-title");n.append('<span class="dialog-subtitle"></span>');n.children("span.dialog-subtitle").text(g);m.find(".js-cancel-edit").on("click",function(){var w=y.data("orig-src");
w&&y.removeData(["styleselection","fileid"]).attr("src",w);m.dialog("close")});m.find(".js-save-edit").on("click",q.onClickSave);m.find(".styleselection").on("change",function(){y.data("styleselection",a(this).val())});m.fileupload({dropZone:"vb-self",dataType:"json",add:function(w,x){a("body").css("cursor","wait");a(w.target).find(".js-upload-progress:first").removeClass("h-hide");x.submit()},done:function(w,x){if(x.result&&x.result.filedataid)q.onLocalUploadSuccess(x);else vBulletin.error("error",
q.errorphrase)},fail:function(w,x){vBulletin.error("error",q.errorphrase)},always:function(w,x){a("body").css("cursor","auto");a(w.target).find(".js-upload-progress:first").addClass("h-hide")}});m.find(".js-upload-from-url").offon("click",function(){var w=m.find("#imageUrl"),x=a.trim(w.val()),F=a(this).closest(".dialog-content").find(".js-upload-progress:last");x?(a("body").css("cursor","wait"),F.removeClass("h-hide"),vBulletin.AJAX({call:"/uploader/Url",data:{urlupload:x},complete:function(){a("body").css("cursor",
"auto");F.addClass("h-hide")},success:q.onUploadFromUrlSuccess,title_phrase:q.titlephrase,error_phrase:q.errorphrase,after_error:function(){w.trigger("focus")}})):w.trigger("focus")})},close:(n,u)=>{t.removeClass("selected")}})}rb("#edit-page-dropdown form").trigger("reset",function(){a("input[type=hidden]",this).each((f,m)=>{m.value=m.defaultValue})});a(".js-top-menu-sitebuilder--list .js-top-menu-link").removeClass("b-top-menu__item-link--disabled");a(document).on("click","#sitebuilder-wrapper .lnkExitWithoutSaving",
function(){0==a(this).closest("#edit-page-dropdown").length&&W(null,{enableButtons:!0,currentButton:null})});a(document).on("vb-sitebuilder-panel--channels",function(){var f=a(".js-top-menu-tab--channels").get(0);vBulletin.assertUserHasAdminPermission("canusesitebuilder",f,function(){Y.apply(f);Xa(!1);a(".edit-mode .canvas-widget-list .canvas-widget").addClass("shadow");a("#header, #header-axd, #save-content").hide();a("#manage-page").show();a("#edit-page-dropdown .lnkDeletePage").removeClass("h-hide");
a("#manage-page-dropdown").removeClass("h-hide").slideDown("slow",tb)});return!1});a(document).on("click",".js-sb-delete-page",f=>{var m=a(f.currentTarget),y=parseInt(m.data("pageid")||0,10);f=m.data("url")||"";m=m.data("label")||"";O.openConfirmDialogSimple({title:"confirm_deletion_gcpglobal",message:["delete_page_x_confirm",m,f],yesPhrase:"delete_page",noPhrase:"cancel",iconType:"warning",onClickYes:()=>{R.AJAX({call:"/ajax/api/page/delete",data:{pageid:y},success:()=>d()})}})});a(document).on("click",
".js-pagelist-filter",f=>{d()});a(document).on("vb-sitebuilder-panel--pages",function(){var f=a(".js-top-menu-tab--pages").get(0),m=a(".js-sbpanel-pagelist-wrapper");m.data("panel-initialized")||(m.data("tabspanel-initialized",!0),b());vBulletin.assertUserHasAdminPermission("canusesitebuilder",f,function(){m.hasClass("h-hide")?(Y.apply(f),m.removeClass("h-hide").slideDown("slow"),c()):(Va.apply(f),m.slideUp("fast",function(){m.addClass("h-hide")}))});return!1});a(document).on("click",".js-clickarea--target",
f=>{f.stopPropagation()});a(document).on("click",".js-clickarea",f=>{a(f.currentTarget).find(".js-clickarea--target").click()});a(document).on("click",".js-sbpanel-pagelist-wrapper .js-button--close-panel",function(){var f=a("#lnkPageList")[0],m=a(".js-sbpanel-pagelist-wrapper");m.hasClass("h-hide")||(Va.apply(f),m.slideUp("fast",function(){m.addClass("h-hide")}))});a(document).on("submit",".js-ignoreform",()=>!1);a(document).on("click",".js-sbpanel-pagelist-wrapper .js-sb-sethomepage-btn",f=>{function m(h){return h.length?
{pageid:h.val()||"",url:h.data("url")||"",label:h.data("label")||""}:null}function y(h,g){O.openConfirmDialogSimple({title:"change_homepage",message:g,iconType:"warning",onClickYes:()=>{R.AJAX({call:"/ajax/api/page/setAsHomePage",data:{pageid:h},success:function(t){d();O.alert("change_homepage","hompage_updated_reload")}})}})}f=a(".js-panel-active");var q=a("input.js-sb-page-sethompage-chk:checked",f);f=m(a(".js-sb-page-prev-homepage"));q=m(q);!f&&q?y(q.pageid,["change_homepage_confirm_x",q.label,
q.url]):f&&q&&q.pageid!=f.pageid?y(q.pageid,["change_homepage_confirm_x_to_y",f.label,f.url,q.label,q.url]):O.error("change_homepage","change_homepage_please_select")});a(document).on("vb-sitebuilder-panel--editpage",function(){var f=a(".js-top-menu-tab--editpage").get(0);a("#edit-page-dropdown-gutter").is(":hidden")&&vBulletin.assertUserHasAdminPermission("canusesitebuilder",f,function(){function m(){T=!1;y();ea();Xa(!1,".container-widget");a(".edit-mode .canvas-widget-list .canvas-widget").addClass("shadow");
xa.tabs("option","active",0);a("#header, #header-axd, #save-content").hide();a("#edit-content").show();a("#edit-page-dropdown .lnkSaveChanges .label").text(vBulletin.phrase.get("save_page"));a("#edit-page-dropdown .lnkDeletePage").removeClass("h-hide");a("#edit-page-dropdown-gutter").removeClass("h-hide").slideDown("slow",Ya);a(".canvas-widget.axd-widget .widget-content").each(function(){a(this).html(Wa(a(this).html(),vBulletin.phrase.get("ad")))})}function y(){var q=[];a(".hidden-widget-placeholder").each(function(){q.push(a(this).attr("data-widget-instance-id"))});
1>q.length||vBulletin.AJAX({call:"/ajax/fetch-hidden-modules",data:{modules:q},complete:function(){m()},success:function(h){0<h.length&&a.each(h,function(g,t){g=a(t.template).addClass("hidden-widget");a('.hidden-widget-placeholder[data-widget-instance-id="'+t.widgetinstanceid+'"]').replaceWith(g)})}})}Y.apply(f);Ta(!1,m)});return!1});a(document).on("vb-sitebuilder-panel--newpage",function(){var f=a(".js-top-menu-tab--newpage").get(0);a("#edit-page-dropdown-gutter").is(":hidden")&&vBulletin.assertUserHasAdminPermission("canusesitebuilder",
f,function(){Y.apply(f);Ta(!0,function(){T=!0;a(".canvas-widget-list:not(.js-section-global)").empty();xa.tabs("option","active",0);a("#change-layout .layout-border.selected").removeClass("selected");a("#layout-wide-narrow").prev().trigger("click");V=!1;a("#header, #header-axd, #save-content").hide();a("#edit-content").show();a("#edit-page-dropdown .lnkSaveChanges .label").text(vBulletin.phrase.get("save_new_page"));a("#edit-page-dropdown .lnkDeletePage").addClass("h-hide");a("#edit-page-dropdown-gutter").removeClass("h-hide").slideDown("slow",
Ya)})});return!1});var p=!1;a(document).on("vb-sitebuilder-panel--header",function(){var f=a(".js-top-menu-tab--header").get(0);a("#admin-navbar-strip-gutter").is(":hidden")&&vBulletin.assertUserHasAdminPermission("canusesitebuilder",f,function(){Y.apply(f);p=!1;a("#admin-navbar-strip-gutter").addClass("navbar-header").removeClass("h-hide").find(".prompt-text").text(vBulletin.phrase.get("select_edit_link_header"));var m=a("#header"),y=a(".header-cell",m),q=a("> .admin-only",y).addClass("h-hide-imp");
y=y.outerWidth();a(".disable-overlay",m).width(m.innerWidth()-y).height(m.innerHeight()).show();q.width(y-(parseInt(q.css("padding-left"),10)+parseInt(q.css("padding-right"),10))).removeClass("h-hide-imp");a(document).on("focus click mousedown",".edit-mode.lnkHeader #header .site-logo > a",function(h){this.blur();h.stopPropagation();return!1})});return!1});qb();a(".js-top-menu-sitebuilder").removeClass("h-hide");a(document).on("click",".lnkHeader #admin-navbar-strip .lnkSaveChanges",function(){0<
Number(a("#header .site-logo img").data("fileid"))?Za(p?function(){location.reload(!0)}:null):p?location.reload(!0):(a("#admin-navbar-strip-gutter").addClass("h-hide").find(".prompt-text").text(""),a(document.body).removeClass("edit-mode lnkHeader").addClass("view-mode"),a("#header .disable-overlay").hide(),W(null,{enableButtons:!0,currentButton:null}))});a(document).on("click",".lnkHeader #admin-navbar-strip .lnkExitWithoutSaving",function(f){if(p)return f.stopImmediatePropagation(),location.reload(!0),
!1;f=a("#header .site-logo img");f.attr("src")!=f.attr("data-orig-src")&&f.attr("src",f.attr("data-orig-src")).removeData("fileid");a("#admin-navbar-strip-gutter").find(".prompt-text").text("");a("#header .disable-overlay").hide();W(null,{enableButtons:!0,currentButton:null})});a(document).on("click","#admin-navbar-strip .lnkExitWithoutSaving",function(){a("#admin-navbar-strip-gutter").addClass("h-hide");a(document.body).removeClass("edit-mode lnkEditPage lnkNewPage lnkHeader lnkNavBar lnkFooter").addClass("view-mode");
a("#header").add("#header-axd").show();a("#edit-navbar").hide();W(null,{enableButtons:!0,currentButton:null})});a("#header-axd .axdnum").on("change",function(){var f=a(this),m=parseInt(f.val());vBulletin.AJAX({call:"/ajax/api/ad/saveNumberOfHeaderAds",data:{number:m},success:function(y){y=1==m;a("#header-axd").toggleClass("axdnum_1",y).toggleClass("axdnum_2",!y)}})});a(document).offon("click",".axd-edit-button",function(){function f(n){n=n||!1;vBulletin.AJAX({call:"/ajax/api/ad/listAdsByLocation",
data:{adlocation:g},cache:!1,success:function(u){vBulletin.isEmptyList(u)&&!n?y({adlocation:g}):m(u)}})}function m(n){"undefined"==typeof qa.axd_list_dialog?vBulletin.AJAX({call:"/ajax/render/dialog_axd_list",success(u){qa.axd_list_dialog=u;a("body").append(u);m(n)},error_phrase:"error_fetching_dialog"}):a("#axd-list-dialog").dialog({title:Q("manage_ads"),autoOpen:!0,modal:!0,resizable:!1,closeOnEscape:!1,showCloseButton:!1,width:600,dialogClass:"dialog-container ad-list-dialog-container input-dialog",
open(){let u=a(this),w=[],x=function(){u.dialog("close");u.dialog("destroy")},F=a(".axdtable",u),N;for(var J in n)w.push([n[J].title,n[J].otherlocationscount,n[J].active,n[J].displayorder,n[J].adid]);a(".title",u).text(Q("ad_list_description"));N=F.dataTable({bPaginate:!0,bLengthChange:!0,aLengthMenu:[5,10,25,50,100],sPaginationType:"full_numbers",bInfo:!1,bAutoWidth:!1,bDestroy:!0,aaSorting:[[2,"desc"],[3,"asc"]],aoColumns:[{sTitle:Q("title")+'<span class="sort-icon"></span>',sClass:"axdtable-title axd-cell"},
{sTitle:Q("ad_otherlocations")+'<span class="sort-icon"></span>',sClass:"axdtable-others axd-cell",bSearchable:!1,bUseRendered:!1,fnRender(I,K){return 1>K?K:`<span class="others-tooltip js-other-ad-locations-qtip" data-id="${I.aData[4]}">${K}</span>`}},{sTitle:Q("active")+'<span class="sort-icon"></span>',sClass:"axdtable-active axd-cell",bSearchable:!1,bUseRendered:!1,fnRender:function(I,K){return'<input type="checkbox" class="isactive" data-id="{0}"{1} />'.format(I.aData[4],"1"==K?' checked="checked"':
"")}},{sTitle:Q("display_order")+'<span class="sort-icon"></span>',sClass:"axdtable-display-order axd-cell",bSearchable:!1,bUseRendered:!1,fnRender:function(I,K){return'<input type="text" class="displayorder textbox" value="{0}" data-id="{1}" />'.format(I.aData[3],I.aData[4])}},{sTitle:Q("action"),sClass:"axdtable-action axd-cell",bSearchable:!1,bSortable:!1,bUseRendered:!1,fnRender:function(I,K){return'<a href="#" class="editlink" data-id="{0}" title="{1}"><span></span></a> <a href="#" class="deletelink" data-id="{0}" title="{2}"><span></span></a>'.format(I.aData[4],
Q("edit"),Q("delete"))}}],aaData:w});F.offon("mouseover",".js-other-ad-locations-qtip",function(){const I=a(this);"object"!==typeof I.data("qtip")&&R.qtip.apply(I,"qtip-ad-otherlocations",{position:{viewport:a(window),adjust:{method:"shift flip"}},content:{text:function(K,l){K=a(l.target).data("id");K=n[K]&&n[K].otherlocations||[];l="<ul>";for(var A in K){let D=R.htmlEntities(K[A]);l+=`<li>${D}</li>`}return l+"</ul>"}},show:{event:"mouseover",ready:!0},hide:{event:"mouseout"}})});a(".dataTables_filter input[type=text]",
u).addClass("axdfilter textbox").on("keyup",function(){a(this).next()[""!=this.value?"removeClass":"addClass"]("h-hide")}).after('<button type="button" class="axdSearchBtn b-button b-button--secondary b-button--sitebuilder h-hide">{0}</button>'.format(Q("reset")));a(".axdSearchBtn",u).on("click",function(){a(this).addClass("h-hide").prev().val("").trigger("keyup")});F.offon("click",".editlink",function(){const I=a(this).attr("data-id");x();y(n[I]);return!1});F.offon("click",".deletelink",function(){let I=
a(this).attr("data-id"),K=a(this).closest("tr").find(".isactive").prop("checked"),l=parseInt(n[I].otherlocationscount,10),A=Q("are_you_sure_want_to_delete_ad_x",n[I].title,"adid",I);1==l?A+="<br />"+Q("ad_used_one_other_location",l):1<l&&(A+="<br />"+Q("ad_used_x_other_locations",l));x();O.openConfirmDialog({title:Q("confirm_deletion_x",n[I].title),message:A,iconType:"warning",onClickYes(){a("body").css("cursor","wait");R.AJAX({call:"/ajax/api/ad/delete",data:{adid:I},success(D){f(!0);K&&(p=!0)}})},
onClickNo(){f()}});return!1});a(".axdlist",u).show();a(".btnAddAxd",u).offon("click",function(){x();y({adlocation:g});return!1});a(".btnCancelAxd",u).offon("click",function(){x()});a(".btnSaveAxd",u).offon("click",function(){let I={},K=[];var l=N&&N.$(".isactive"),A=N&&N.$(".displayorder");let D={};if(0==l.length)return x(),!1;for(var z of A){var G=a(z);A=G.data("id");G=G.val();D[A]=G}for(const E of l)z=a(E),l=z.data("id"),z=z.is(":checked")?1:0,I[l]={displayorder:D[l]||1,active:z},z&&(z={...I[l]},
z.snippet=n[l].snippet,z.title=n[l].title,K.push(z));vBulletin.AJAX({call:"/ajax/api/ad/quickSave",data:{data:I,adlocation:g},success(E){E=a(".axd_"+g,t);0==E.length&&(E=a(".widget-content",t));if(0<K.length){K.sort(function(H,L){return H.displayorder-L.displayorder});let B="",C="";a.map(K,function(H,L){H.snippet&&(C+=Wa(H.snippet,H.title),B+=H.snippet)});E.html(C);p=h(B)}else E.html("");E.show();x();a("html,body").animate({scrollTop:0},"slow")}})})}})}function y(n){vBulletin.AJAX({call:"/ajax/render/dialog_axd_config",
data:{isAjaxTemplateRenderWithData:!0},success:function(u){qa.axd_config_dialog=u.template;a("body").append(u.template);q(n)},error_phrase:"error_fetching_dialog"})}function q(n){var u=n.adlocation;Aa(a("#axd-config-dialog").dialog({title:vBulletin.phrase.get(n.adid?["edit_ad_x",n.title]:"create_ad"),autoOpen:!0,modal:!0,resizable:!1,closeOnEscape:!1,showCloseButton:!1,width:720,dialogClass:"dialog-container axd-dialog-container input-dialog",open:function(){function w(I){I=I||!1;a(":checkbox",x).prop("checked",
!1);a("select",x).val("");x.dialog("close");x.dialog("destroy");a("#axd-config-dialog").remove();f(I)}var x=a(this);if(n.adid){a(".title",x).val(n.title);a(".axd_html",x).val(n.snippet);a(".active",x).prop("checked","1"==n.active);a(".axdid",x).val(n.adid);for(var F in n.criterias){var N=n.criterias[F],J=N.criteriaid;a("[name=data\\[criteria\\]\\["+J+"\\]\\[active\\]]",x).prop("checked",!0);a("."+J,x).each(function(){var I=a(this),K=I.attr("name").match(/condition\d/);K&&I.val(N[K[0]])})}}else a(".axdid",
x).val(0),a(".configform",x).trigger("reset");a(".axd_location",x).val(u);a(".blockrow select.custom-dropdown",x).selectBox();a(".blockrow a.custom-dropdown, .blockrow input[type=text]",x).on("click",function(I){return!1});a(".btnAttachHtmlAxd",x).off("click").on("click",function(){var I=a(".configform",x).serialize();a("body").css("cursor","wait");vBulletin.AJAX({call:"/ajax/api/ad/save",data:I,success:function(K){w();p=h(a(".configform .axd_html",x).val())},complete:function(){a("body").css("cursor",
"default")}})});a(".btnCancelEditHtmlAxd",x).off("click").on("click",function(){w(!0)})}}))}function h(n){var u=a("<div>"+n+"</div>");return 0<u.filter("script").length?!0:0<u.find("*").filter(function(){return 0==this.nodeName.toLowerCase().indexOf("vb:")?this:null}).length||/\{vb\s*:\s*[a-z]+\s+.*\}/.test(n)}var g=a(this).attr("data-location"),t=a(this).closest(".axd-container");0==t.length&&(t=a('.axd-container[data-widget-instance-id="'+g+'"]'));f();return!1});a("#header .header-cell .js-edit-logo").on("click",
f=>{var m=a("#edit-site-logo-dialog"),y=a("#header .site-logo img");v(a(f.currentTarget),m,y,{titlephrase:"edit_site_logo",subtitlephrase:"choose_options_site_logo",errorphrase:"error_processing_site_logo",onClickSave:()=>{0<Number(y.data("fileid"))?Za(function(){m.dialog("close")}):m.dialog("close")},onUploadFromUrlSuccess:q=>{y.attr("src",q.imageUrl).data({fileid:q.filedataid,styleselection:m.find(".styleselection:checked").val()})},onLocalUploadSuccess:q=>{y.attr("src",q.result.imageUrl).data({fileid:q.result.filedataid,
styleselection:m.find(".styleselection:checked").val()})}})});a(".favicon-editor .js-edit-favicon").offon("click",f=>{var m=a("#edit-favicon-dialog"),y=a(".js-sitebuilder-favicon");v(a(f.currentTarget),m,y,{titlephrase:"edit_favicon",subtitlephrase:"choose_options_favicon",errorphrase:"error_processing_favicon",onClickSave:()=>{vBulletin.AJAX({call:"/uploader/setfavicon",data:{filedataid:y.data("fileid"),styleselection:y.data("styleselection")},complete:function(){a("body").css("cursor","auto")},
success:function(q){"true"===a.trim(q)&&(a("#admin-navbar-strip-gutter").addClass("h-hide").find(".prompt-text").text(""),a(document.body).removeClass("edit-mode lnkHeader").addClass("view-mode"),a("#header .disable-overlay").hide(),W(null,{enableButtons:!0,currentButton:null}),m.dialog("close"),a('link[rel="Shortcut Icon"]').attr("href",y.attr("src")))},error_phrase:"error_saving_favicon"})},onUploadFromUrlSuccess:q=>{y.attr("src",q.imageUrl).data({fileid:q.filedataid,styleselection:m.find(".styleselection:checked").val()})},
onLocalUploadSuccess:q=>{y.attr("src",q.result.imageUrl).data({fileid:q.result.filedataid,styleselection:m.find(".styleselection:checked").val()})}})});a(".admin-button-flat").disableSelection();xa=a("#edit-content .tabs").tabs({beforeActivate:function(f,m){a("#save-content").hide();1==m.newTab.index()&&fa&&(a("#edit-page-dropdown .layout-list .layout-border.selected").removeClass("selected"),f=a("#edit-page-dropdown .layout-list input[type=radio][value={0}]".format(a(".canvas-layout:visible").attr("data-layout-id"))),
f.prev().addClass("selected"),X="canvas-"+f.attr("id"))},create:function(f,m){m.tab.index();ra()},activate:function(f,m){m.newTab.index();ra()}});a("#lnkAddModules").on("click",function(){xa.tabs("option","active",0);return!1});ub();a(document).on("click",".module-buttons .hide-icon input",function(){var f=a(this);f.closest(".canvas-widget")[this.checked?"addClass":"removeClass"]("hidden-widget");var m=f.attr("title");f.attr("title",f.data("toggle-title")).data("toggle-title",m)});a(".canvas-layout-container .canvas-layout").each(function(){$a[this.id]=
a("#"+this.id+' div[class*="section-"]').length});T||(X="canvas-"+a("#edit-page-dropdown .layout-list input[type=radio][value={0}]".format(a(".canvas-layout:visible").attr("data-layout-id"))).prop("checked",!0).attr("id"));ab=a("#edit-page-dropdown .layout-list input[type=radio]").thumbnailRadioCheckbox({thumbnailClass:"layout-border"});ab.thumbnailRadioCheckbox("option","select",function(f,m){a(".canvas-layout").addClass("h-hide");a("#canvas-"+m.attr("id")).removeClass("h-hide");vb("canvas-"+m.attr("id"));
ya();V=!0});a(".js-toggle-controller").offon("click.sitebuilder",f=>{let m=a(f.currentTarget),y=m.data("toggleid"),q=m.closest(`.js-toggle-context[data-toggleid="${y}"]`),h=q.find(`.js-toggle-worker[data-toggleid="${y}"]`);f.preventDefault();h.toggleClass("h-hide");console.log({$toggle:m,id:y,$context:q,$workers:h})})}function vb(b){if(X){if(X!=b){a(".canvas-layout.h-hide input[type=hidden]").prop("disabled",!0);a("#"+b+" input[type=hidden]").prop("disabled",!1);var d=$a[b],c=!1,e=0;a("#"+X+" > .canvas-layout-row > .canvas-widget-list").each(function(){var k=
a(this);c=wb(k,a("#"+b+" > .canvas-layout-row > .canvas-widget-list"));c.length||(e=bb(this),c=a("#"+b+" > .canvas-layout-row > div.section-"+e));if(!c.length){for(var r=d;0<=r&&0==a("#"+b+" > .canvas-layout-row > div.section-"+r).length;)r--;c=a("#"+b+" > .canvas-layout-row > div.section-"+r)}k=k.children(".canvas-widget");var v=parseInt(Math.ceil(k.length/c.length),10);if(0<v){var p=0,f=0;k.each(function(){a(this).appendTo(c.eq(f));++p;p>=v&&(p=0,++f)})}});X=b}}else a(".canvas-layout.h-hide input[type=hidden]").prop("disabled",
!0),a("#"+b+" input[type=hidden]").prop("disabled",!1),X=b}function wb(b,d){var c="js-sectiontype-notice js-sectiontype-primary js-sectiontype-secondary js-sectiontype-extra js-sectiontype-global_after_breadcrumb js-sectiontype-global_before_footer".split(" "),e;for(e in c)if(b.is("."+c[e])){var k=c[e];break}return d.filter(function(){return a(this).is("."+k)})}function bb(b){var d=/section-(\d+)/gi,c=null;a(a(b).attr("class").split(" ")).each(function(e,k){(e=d.exec(k))&&!isNaN(e[1])&&(c=e[1])});
return c}function xb(b){if(a.isArray(b)&&0!=b.length)return vBulletin.AJAX({call:"/ajax/admin-template/widget",data:{widgets:b,pagetemplateid:a("#save-page-form #pagetemplateid-yes").val()},success:function(d){a.isArray(d.widgets)&&a.each(d.widgets,function(c,e){if(!e.widgetid||1>Number(e.widgetid)||!a.trim(e.template))return!0;c=e.displaysection&&0<Number(e.displaysection)?e.displaysection:0;e=a(e.template);e.appendTo(a(".canvas-layout:not(.h-hide) .canvas-widget-list.section-"+c).height("auto")).filter(":not(.container-widget)").find(".toggle-button").trigger("click",
[!0]);e.find(".tabs").tabs()})},error_phrase:"error_adding_widgets"}),!1}function Ea(b,d){var c=b.closest(".channel-item-container").children(".sub-channel-container").children(".channel-item-container");b=b.find(".b-icon");b.is(".b-icon__arrow-right-m")?(b.removeClass("b-icon__arrow-right-m").addClass("b-icon__arrow-down-m"),c.slideDown(150)):"undefined"!==typeof d&&d||(c.slideUp(150),b.addClass("b-icon__arrow-right-m").removeClass("b-icon__arrow-down-m"))}function Fa(){a(".channel-config-dialog .channel-list").sortable({placeholder:"main-channel-container-highlight drag-highlight h-clear",
update:function(b,d){P=ba=!0},start:function(b,d){d.placeholder.height(d.item.outerHeight())},handle:".grip-icon-main",items:".main-channel-container"})}function cb(b){b.find(".main-channel-container").sortable({connectWith:".sub-channel-container",placeholder:"channel-item-highlight drag-highlight",revert:!0,update:function(d,c){c.item.closest(".main-channel-container");c.sender&&c.sender.hasClass("main-channel-container")&&0==a("> .channel-item-container",c.sender).length&&c.sender.slideUp("fast",
function(){a(this).remove()});P=ba=!0},stop:function(d,c){a(".main-channel-container, .sub-channel-container").height("auto")},handle:".channel-item-inner > .grip-icon-item",items:".channel-item-container"})}function db(b){b.find(".sub-channel-container").sortable({connectWith:".sub-channel-container",revert:!0,placeholder:"channel-item-highlight drag-highlight",update:function(d,c){c.sender&&c.sender.hasClass("main-channel-container")&&0==a("> .channel-item-container",c.sender).length&&c.sender.slideUp("fast",
function(){a(this).remove()});P=ba=!0},sort:function(d,c){},start:function(d,c){},stop:function(d,c){a(".main-channel-container, .sub-channel-container").height("auto")},over:function(d,c){d=a(this).closest(".channel-item-container").children(".channel-item").find(".toggle-button");Ea(d,!0)},receive:function(d,c){},out:function(d,c){},handle:".channel-item-inner > .grip-icon-item",items:".channel-item-container"})}function eb(b,d,c,e,k,r,v){k='<div class="'+(k?"category-to-channel":"channel-to-category")+
'"><a href="#">'+vBulletin.phrase.get(k?"make_forum":"make_category")+"</a></div>";b=a(('<div class="main-channel-container">\t\t\t\t<div class="grip-icon grip-icon-main h-left"><div>&uml;</div><div>&uml;</div><div>&uml;</div><div>&uml;</div><div>&uml;</div></div>\t\t\t\t<div class="channel-item-container">\t\t\t\t\t<div class="channel-item shadow" data-channel-id="{0}" data-parent-id="{2}">\t\t\t\t\t\t<div class="channel-item-inner">\t\t\t\t\t\t\t<div class="grip-icon grip-icon-item h-left"><div>&uml;</div><div>&uml;</div><div>&uml;</div><div>&uml;</div><div>&uml;</div></div>\t\t\t\t\t\t\t<div class="channel-title"><div title="'+
vBulletin.phrase.get("click_text_edit_title")+'">{1}</div><input type="text" name="channeltitle" value="{1}" /></div>\t\t\t\t\t\t\t<div class="close-button" title="'+vBulletin.phrase.get("remove_forum")+'">x</div>\t\t\t\t\t\t\t<div class="toggle-button"><div class="b-icon b-icon__arrow-right-m"></div></div>\t\t\t\t\t\t\t<div class="num-subchannels">'+v+'</div>\t\t\t\t\t\t\t<div class="add-subchannel-button h-right" title="'+vBulletin.phrase.get("add_subforum")+'"><a href="#">+</a></div>\t\t\t\t\t\t\t'+
k+'\t\t\t\t\t\t\t<div class="h-clear"></div>\t\t\t\t\t\t</div>\t\t\t\t\t</div>\t\t\t\t\t<div class="sub-channel-container"></div>\t\t\t\t</div>\t\t </div>').format(d,e,c)).appendTo(b);r&&(r=a("#top-level-forum .channel-config-dialog .channel-list").find(".main-channel-container").last(),a("html, body").animate({scrollTop:r.offset().top},"fast"));P=ba=!0;return b}function fb(b,d,c,e,k,r){e='<div class="'+(e?"category-to-channel":"channel-to-category")+'"><a href="#">'+vBulletin.phrase.get(e?"make_forum":
"make_category")+"</a></div>";k=k.hasClass("main-channel-container")?a("> .channel-item-container > .sub-channel-container",k):a("> .sub-channel-container",k);b=a(('<div class="channel-item-container">\t\t\t\t<div class="channel-item shadow" data-channel-id="{0}" data-parent-id="{2}">\t\t\t\t\t<div class="channel-item-inner">\t\t\t\t\t\t<div class="grip-icon grip-icon-item h-left"><div>&uml;</div><div>&uml;</div><div>&uml;</div><div>&uml;</div><div>&uml;</div></div>\t\t\t\t\t\t<div class="channel-title"><div title="Click text to edit title">{1}</div><input type="text" name="channeltitle" value="{1}" /></div>\t\t\t\t\t\t<div class="close-button" title="'+
vBulletin.phrase.get("remove_forum")+'">x</div>\t\t\t\t\t\t<div class="toggle-button"><div class="b-icon b-icon__arrow-right-m"></div></div>\t\t\t\t\t\t<div class="num-subchannels">'+r+'</div>\t\t\t\t\t\t<div class="add-subchannel-button h-right" title="'+vBulletin.phrase.get("add_subforum")+'"><a href="#">+</a></div>\t\t\t\t\t\t'+e+'\t\t\t\t\t\t<div class="h-clear"></div>\t\t\t\t\t</div>\t\t\t </div>\t\t\t <div class="sub-channel-container"></div>\t\t\t</div>').format(b,c,d)).hide().appendTo(k);
P=ba=!0;return b}function yb(){vBulletin.AJAX({call:"/ajax/fetch-widget-admin-template-list",complete:function(){ra();a(window).resize(ra)},success:function(b){gb=!0;if(a.isArray(b))if(0<b.length){var d={},c=0;a.each(b,function(k,r){if(!r.widgetid||1>Number(r.widgetid))return!0;c++;d[r.category]?d[r.category].count++:d[r.category]={count:1,title:r.category_title};k=a("#edit-page-dropdown .module-list .module-icon-template").clone();k.attr("data-widget-id",r.widgetid).attr("data-title",a.trim(r.title).toLowerCase()).data("canbemultiple",
r.canbemultiple).removeClass("module-icon-template").addClass(("module-item category-{0}"+("1"==r.cloneable?" module-cloneable":"")).format(r.category));a(".module-icon",k).html(a("<img />").attr("src",pageData.baseurl+"/images/sitebuilder/"+a.trim(r.icon)).attr("height",60).attr("width",60).attr("alt",vBulletin.phrase.get("module_icon")));a(".module-title .main-title",k).html(a.trim(r.title));k.appendTo("#edit-page-dropdown .module-list").removeClass("h-hide")});a(('<div class="module-categories-scroller-container">\t\t\t\t\t\t\t<div class="category-arrow-left h-left" title="'+
vBulletin.phrase.get("previous")+'">&lsaquo;</div>\t\t\t\t\t\t\t<div class="scroller category h-left">\t\t\t\t\t\t\t\t<div class="categories h-left">\t\t\t\t\t\t\t\t\t<div id="category-all" class="category selected">'+vBulletin.phrase.get("all")+' ({0})</div>\t\t\t\t\t\t\t\t\t<div id="category-result" class="category h-hide">'+vBulletin.phrase.get("search_results")+' (<span></span>)</div>\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t<div class="category-arrow-right h-left" title="'+vBulletin.phrase.get("next")+
'">&rsaquo;</div>\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t<div class="h-clear"></div>').format(c)).insertBefore("#edit-page-dropdown .module-list-container .scroller");a.each(d,function(k,r){a('<div id="category-{0}" class="category">{1} ({2})</div>'.format(k,r.title,r.count)).insertBefore("#category-result")});Z();hb=a("#edit-page-dropdown .module-list .module-item").not(".non-module-item");hb.draggable({connectToSortable:".canvas-layout-row > .canvas-widget-list:visible",helper:"clone",revert:"invalid",
appendTo:"#add-modules .module-list-container",zIndex:2E3,start:function(k,r){if("0"==a(this).data("canbemultiple")&&0<a("#content .canvas-layout .canvas-widget[data-widget-id={0}]".format(a(this).attr("data-widget-id"))).length)return vBulletin.warning("move_not_allowed",["adding_multiple_modules_not_allowed",a(".main-title",this).html()]),!1;Ga=!0},stop:function(k,r){Ga=!1}}).disableSelection();a("#search-module-keyword").on("keyup",function(k,r){var v=a("#add-modules"),p=a("#category-result"),
f=a(".categories",v);k=a(".scroller.category",v);var m=!1;a(".module-item",v).hide();r||a(".category.selected",v).removeClass("selected");(r=a.trim(this.value.toLowerCase()))?(a('.module-item[data-title*="{0}"]'.format(r),v).show(),p.removeClass("h-hide").addClass("selected")):(a(".module-item",v).show(),a("#category-all").removeClass("h-hide").addClass("selected"),p.addClass("h-hide").removeClass("selected"),m=!0);r=a(".module-item:visible",v).length;a("span",p).text(r);Z();0==r?a(".empty-module",
v).show():a(".empty-module",v).hide();f.width()<=k.width()?(a(".category-arrow-left, .category-arrow-right",v).css("visibility","hidden"),k.scrollLeft(0)):m?(a(".category-arrow-left",v).css("visibility","hidden"),a(".category-arrow-right",v).css("visibility","visible"),k.scrollLeft(0)):(a(".category-arrow-left",v).css("visibility","visible"),a(".category-arrow-right",v).css("visibility","hidden"),v=k.get(0),k.scrollLeft(v.scrollWidth-v.clientWidth));return!0});a("#add-modules .categories .category").on("click",
function(k){k.stopPropagation();if(a(this).hasClass("selected"))return!1;k=a(this).closest(".module-list-container");var r=a(".module-item",k);a(".category.selected",k).removeClass("selected");a(this).addClass("selected");r.hide();a(".empty-module",k).hide();var v=this.id;"category-all"==v?(r.show(),a(".non-module-item",k).hide()):"category-result"==v?a("#search-module-keyword").triggerHandler("keyup",[!0]):a(".module-item.{0}".format(v),k).show();Z();return!1}).disableSelection();var e;a(".category-arrow-left").on({mousedown:function(){a(".category-arrow-right").css("visibility",
"visible");e=setInterval(function(){var k=a(".scroller.category");k.scrollLeft(k.scrollLeft()-20);0==k.scrollLeft()&&(a(".category-arrow-left").css("visibility","hidden"),clearInterval(e))},50)},mouseup:function(){clearInterval(e)}}).disableSelection();a(".category-arrow-right").on({mousedown:function(){a(".category-arrow-left").css("visibility","visible");e=setInterval(function(){var k=a(".scroller.category"),r=k.get(0);r=r.scrollWidth-r.clientWidth;var v=Math.min(k.scrollLeft()+20,r);k.scrollLeft(v);
1>Math.abs(r-k.scrollLeft())&&(a(".category-arrow-right").css("visibility","hidden"),clearInterval(e))},50)},mouseup:function(){clearInterval(e)}}).disableSelection()}else a('<div class="empty-module">'+vBulletin.phrase.get("no_modules")+"</div>").appendTo("#edit-page-dropdown .module-list")},error_phrase:"error_retrieving_modules"})}function Ra(b,d){vBulletin.AJAX({call:"/ajax/api/widget/fetchWidgetGuidToWidgetidMap",success:function(c){wa=c.map?c.map:{error_result:c};"function"==typeof b&&b.apply(this,
d)}})}function zb(){a("#edit-page-dropdown .template-list").empty();vBulletin.AJAX({call:"/ajax/api/pagetemplate/fetchPageTemplateList",data:{pagetemplateid:a("#save-page-form #pagetemplateid-yes").val()},success:function(b){ib=!0;if(a.isArray(b)&&0<b.length){var d=!1;a.each(b,function(c,e){a('<div class="template-item">\t\t\t\t\t\t\t\t<input type="radio" id="pagetemplateid-{0}" name="pagetemplateid" value="{0}" data-thumbnail="{1}/images/sitebuilder/icon-layout-{4}.png"{2} />\t\t\t\t\t\t\t\t<label class="label">{3}</label>\t\t\t\t\t\t\t</div>'.format(e.pagetemplateid,
pageData.baseurl,T||a("#save-page-form #pagetemplateid-yes").val()!=e.pagetemplateid?"":' checked="checked"',e.title,e.screenlayoutvarname)).appendTo("#edit-page-dropdown .template-list").data({screenlayoutid:e.screenlayoutid,widgetinstances:e.widgetinstances});a("#save-page-form #pagetemplateid-yes").val()==e.pagetemplateid&&(d=!0,""==e.title&&console.warn("The page template for this page does not have a title."))});T||d||console.error("The page template for this page was not in the list returned by fetchPageTemplateList! Expected pagetemplateid: {0}. Please ensure that this page template has a title.".format(a("#save-page-form #pagetemplateid-yes").val()));
a(".template-item",a("#edit-page-dropdown .template-list")).each(function(c){a(this).attr("data-title",a(".label",a(this)).text().toLowerCase())});a("#search-template-keyword").on("keyup",function(c){if(13==c.keyCode)return c.preventDefault(),!1;c=a("#select-template");a(".scroller",c);a(".template-item",c).hide();var e=a.trim(this.value.toLowerCase());e?a('.template-item[data-title*="{0}"]'.format(e),c).show():a(".template-item",c).show();e=a(".template-item:visible",c).length;Z();a(".empty-template",
c).toggle(0==e);return!0});a("#search-template-keyword").on("keydown",function(c){if(13==c.keyCode)return c.preventDefault(),!1});Ha=a("#edit-page-dropdown .template-list .template-item input[type=radio]").thumbnailRadioCheckbox({thumbnailClass:"template-border",preselect:function(c,e){return e.is(":checked")?!1:V||P?(O.openConfirmDialogSimple({title:"switch_template",message:"template_changes_will_be_lost",iconType:"warning",onClickYes:()=>{P=V=!1;fa=!0;Ha.thumbnailRadioCheckbox("check",e,!0)}}),
!1):fa=!0},select:function(c,e){a(".canvas-layout").addClass("h-hide");c=e.closest(".template-item").data("screenlayoutid");a(".canvas-layout[data-layout-id="+c+"]").removeClass("h-hide");ya();a("#save-page-form #pagetemplateid-yes, #config_pagetemplateid").val(e.val());c=e.closest(".template-item").find(".label").html();a("#save-page-form .page-template-name").html(vBulletin.phrase.get("page_template_name_id",c,e.val()));if(fa)if(a(".canvas-widget-list").empty(),e=e.closest(".template-item").data("widgetinstances"),
a.isArray(e)&&0<e.length){var k=[];a.each(e,function(r,v){k.push({widgetid:v.widgetid,widgetinstanceid:v.widgetinstanceid})});xb(k,!0);ea()}else window.vBulletin.loadingIndicator.hide();a("body").removeClass("lnkNewPage").addClass("lnkEditPage");a("#save-page-form .new-page-template input").prop("disabled",!0);a("#save-page-form .edit-page-template input").prop("disabled",!1);fa=!0},unselect:function(){}});Z()}}})}function Za(b){var d=a("#header .site-logo img");vBulletin.AJAX({call:"/uploader/setlogo",
data:{filedataid:d.data("fileid"),styleselection:d.data("styleselection")},success:function(c){"true"===a.trim(c)&&(d.removeData(["styleselection","fileid"]).data("orig-src",d.attr("src")),a("#admin-navbar-strip-gutter").addClass("h-hide").find(".prompt-text").text(""),a(document.body).removeClass("edit-mode lnkHeader").addClass("view-mode"),a("#header .disable-overlay").hide(),W(null,{enableButtons:!0,currentButton:null}),R.ensureFun(b)())},error_phrase:"error_saving_site_logo"})}function jb(b,d){a.each(b,
function(c,e){c=a.map(e.subchannels,function(k,r){return r}).length;c=fb(e.nodeid,e.parentid,e.title,e.category,d,c);jb(e.subchannels,c)})}function Xa(b,d){d=d&&0<d.length?a(".canvas-layout .canvas-widget").not(d).find(".widget-content"):a(".canvas-layout .canvas-widget .widget-content");b?d.each(function(){a(this).is(":hidden")&&a(this).closest(".canvas-widget").find(".widget-header .toggle-button").trigger("click",[!0])}):d.each(function(){a(this).is(":hidden")||a(this).closest(".canvas-widget").find(".widget-header .toggle-button").trigger("click",
[!0])})}function ea(){if(!T){var b=a(".canvas-layout:visible .canvas-widget.subchannel-widget");1==b.length?b.find(".close-button").hide():b.find(".close-button").show()}}function Sa(b,d){var c=b.attr("data-widget-id");null==Ia[c]?vBulletin.AJAX({call:"/ajax/fetch-widget-template",data:{widgetid:c},success:function(e){if(e=a.trim(e)){var k=a(e.replace(/<\s*script[^>]*>(.*?)<\s*\/\s*script>/g,""));k.attr("data-title",function(){var r=a(".module-title",k).clone();r.find(".hide-on-viewmode").children().unwrap();
r.find("*:hidden").remove();return a.trim(r.text()).toLowerCase()});Ia[c]=k;"function"==typeof d&&d(k.clone(!0))}},error_phrase:"error_retrieving_cloned_widget_template"}):"function"==typeof d&&d(Ia[c].clone(!0))}function ha(b,d){a(".edit-mode .canvas-widget.youtube-widget .widget-content").css("visibility",b);d&&d.find(".widget-content").css("visibility","hidden"==b?"visible":"hidden")}function Ab(b,d){let c;switch(b.name){case "tab_data":c=a("<div />");b=aa(d);a.each(b,function(e,k){var r="[tab_data]["+
e+"][title]",v=k.title,p=a('<input type="text" name="data{0}" id="data{0}" />'.format(r)).addClass("textbox config-textbox").attr("value",v);c.append(p);a.each(k.widgets,function(f,m){a.each(m,function(y,q){r="[tab_data]["+e+"][widgets]["+f+"]["+y+"]";v=q;p=a('<input type="text" name="data{0}" id="data{0}" />'.format(r)).addClass("textbox config-textbox").attr("value",v);c.append(p)})})});break;case "module_viewpermissions":c=kb(b)}return c}function kb(b){var d=a(".js-sb-module-config--viewpermissions--template");
if(!d.length)return"";b.hasOwnProperty("defaultvalue")||(b.defaultvalue={show:"all"});d=d.clone().removeClass("js-sb-module-config--viewpermissions--template h-hide");b=b.defaultvalue.show;var c=!Array.isArray(b),e=d.find("input.js-module_viewpermissions__key"),k=d.find(".js-module_viewpermissions_ugchecklist");e.filter("[value='show_all']").prop("checked",c);e.filter("[value='show']").prop("checked",!c);c?k.addClass("h-hide"):a.each(b,function(r,v){k.find("input.js-module_viewpermissions__value[value='"+
v+"']").prop("checked",!0)});e.on("change",function(){k.toggleClass("h-hide","show_all"==this.value)});return d}function ub(){function b(d){return a("ul.widget-tabs-nav li, .widget-header ul.ui-tabs-nav li, .widget-tabs-nav ul.ui-tabs-nav li",d).map((c,e)=>{c=a(e);$link=a("a",c);return{selector:$link.attr("href"),label:$link.text(),displayed:c.is(":not(.h-hide, h-hide-imp), .js-tab-hidden-this-page")}}).get()}a(document).offon("click",".canvas-widget.default-widget:not(.js-search-widget) .edit-button",
function(){var d=a(this).closest(".canvas-widget"),c=d,e=a("> .widget-header .module-title",d);(function(){var v=d.data("widget-instance-id");if(S.tempModuleHTMLCache["widgetinstance_"+v]){0==a("#sb-temp-module-cache").length&&a('<div id="sb-temp-module-cache" class="h-hide"></div>').appendTo("body");var p=a(S.tempModuleHTMLCache["widgetinstance_"+v]);if(0<p.find(".widget-tabs").length||p.is(".widget-tabs"))a("#sb-temp-module-cache").append(p),delete S.tempModuleHTMLCache["widgetinstance_"+v]}p=a("#sb-temp-module-cache .canvas-widget").filter(function(){return a(this).data("widget-instance-id")==
v});1==p.length&&(0<p.find(".widget-tabs").length||p.is(".widget-tabs"))&&(d=p)})();if(!d.is(".js-search-widget")){var k=d.attr("data-widget-id");e=0<a("span.admin-only",e).length?a("span.admin-only",e).text():0<a(".hide-on-viewmode",e).length?a(".hide-on-viewmode",e).text():e.text();a("#config-dialog .loader").show();a("#config-dialog .widget-name h1").html(e);a("#config-dialog .dialog-content .widget-config-container").hide().empty().removeClass("error notice");a("#config-dialog").data("selected-module",
c);ha("hidden");a("#config-dialog").dialog("open");var r=c.attr("data-widget-instance-id")||"";vBulletin.AJAX({call:"/ajax/api/widget/fetchConfigSchema",data:{widgetid:k,widgetinstanceid:r,pagetemplateid:la(),configtype:"admin"},success:function(v){a("#config_widgetid").val(v.widgetid);a("#config_widgetinstanceid").val(v.widgetinstanceid);Na(v.pagetemplateid);c.attr("data-widget-instance-id",v.widgetinstanceid);r||na(c);var p=a("#config-dialog .dialog-content .widget-config-container");if(v.configs&&
0!=v.configs.length){var f=!1,m=!1,y=!1,q=!1,h=!1,g=c.data("is-tabbed-container"),t=!1,n=!1;a("#debug-information");var u=vBulletin.isRtl();const E=["Select","ChannelSelect","ContentTypeSelect","ProfileFieldSelect","ChannelIncludeExclude"];a.each(v.configs,function(B,C){!h&&E.includes(C.type)&&(h=!0);"Custom"==C.type&&(C.customValue=Ab(C,c));if(B=S.renderModuleConfig(C))p.append(B),"default_tab"==C.name&&(g?n=C:f=!0),"display_tabs"==C.name&&(g?t=C:m=!0),"tab_order"==C.name&&(g||(y=!0)),"axd"==C.name&&
(q=!0)});S.attachTranslatableToggleEvent(p);var w=function(){function B(U){return a('input:checkbox[value="'+U+'"]',N).is(":checked")}F=b(d);var C=a('select[name="data[default_tab]"]',p),H=C.val();H&&B(H)||(H=v.configs.default_tab.defaultvalue);C.selectBox("destroy");C.empty();for(var L in F){var M=F[L].selector;B(M)&&(M=a('<option value="'+M+'">'+F[L].label+"</option>").prop("selected",H==M),C.append(M))}C.selectBox()},x=function(){F=b(d);var B=a(".config-value.tab_order",p);B.empty().append("<ul>");
for(var C in F){if(m){if(!a('input:checkbox[value="'+F[C].selector+'"]',N).is(":checked"))continue}else if(!F[C].displayed)continue;var H=a('<li id="'+F[C].selector+'">'+F[C].label+"</li>");a("ul",B).append(H);var L=a('<input name="data[tab_order]['+F[C].selector.substring(1)+']" value="'+C+'" type="hidden">');B.append(L)}a("ul",B).sortable({stop:function(){var M=a(this).sortable("toArray");B.find("input:hidden").remove();for(C in M)L=a('<input name="data[tab_order]['+M[C].substring(1)+']" value="'+
C+'" type="hidden">'),B.append(L)}});a("ul",B).disableSelection()};if(m){var F=b(d);var N=a(".config-value.display_tabs",p),J;for(J in F){var I=a('<label><input type="checkbox" name="data[display_tabs][]" value="'+F[J].selector+'">'+F[J].label+"</label>");F[J].displayed&&I.find("input:checkbox").prop("checked",!0);N.append(I)}if(f)a("input:checkbox",N).on("click",function(){w();x()})}y&&x();f&&w();(I=ua(c))&&a("<input type='hidden' name='data[containerinstanceid]' value='"+I+"' />").appendTo(p);if(g){var K=
aa(c),l=a('select[name="data[default_tab]"]',p),A=a(".config-value.display_tabs",p),D=t&&t.defaultvalue||"";""==D&&(D={},a.each(K,function(B,C){D[B]="1"}));var z=function(){var B;l.empty();a.each(K,function(C,H){B=a('<option value="'+C+'">'+H.title+"</option>");"0"==D[C]?B.prop("disabled",!0):n.defaultvalue==C&&B.prop("selected",!0);l.append(B)});l.is(".selectBox")&&l.selectBox("refresh")};n&&z();if(t){var G;A.empty();a.each(D,function(B,C){var H="data[display_tabs]["+B+"]";G=a("<label />").append(a('<input type="hidden" name="'+
H+"\" value='0'/>")).append(a('<input type="checkbox" name="'+H+"\" value='1' data-tab-number=\""+B+'" />')).append(document.createTextNode(K[B].title));"1"==C&&G.find("input:checkbox").prop("checked",!0);A.append(G)});a("input:checkbox",A).on("click",function(){var B=a(this),C=B.prop("checked");B=B.data("tab-number");var H=l.find("option[value='"+B+"']").prop("disabled")!=!C;D[B]=C;H&&z()})}}q&&a(".config-value.axd",p).append('<button class="axd-edit-button b-button b-button--secondary b-button--sitebuilder" data-location="'+
v.widgetinstanceid+'">'+vBulletin.phrase.get("edit")+"</button>")}else a("#config-dialog .widget-config-container").html(vBulletin.phrase.get("no_configurations_found")).addClass("notice"),a("#btnSaveConfig").prop("disabled",!0),a("#btnCloseConfig").trigger("focus");p.show();a("#config-dialog .loader").hide();h&&p.find("select").selectBox();p.find(".js-module-config-slider").each(function(E){E=a(this);var B=E.find("input"),C=E.parent().find(".js-slider-output"),H=E.data("min"),L=E.data("max"),M=E.data("interval");
B.length&&E.slider({min:H,max:L,step:M,value:B.val(),isRTL:u,change:function(U,pa){U=pa.value;C.length&&C.val(U);B.val(U)}})});(function(){function E(){var B=a(this),C=B.next(".js-checkbox-always-send-hidden");0!=C.length||B.prop("checked")?C.remove():a('<input type="hidden" name="{0}" class="js-checkbox-always-send-hidden" value="0" />'.format(B.prop("name"))).insertAfter(B)}a(".js-checkbox-always-send").off("click").on("click",E);a(".js-checkbox-always-send").each(E)})();a("#config-dialog .dialog-content .widget-config-container").find("input, textarea, select, button").filter(":visible").first().trigger("focus")},
error_phrase:["error_retrieving_configuration",e],after_error:function(){a("#config-dialog .loader").hide();a("#config-dialog").dialog("close")}});return!1}})}function ya(){a(".edit-mode .canvas-layout:visible > .canvas-widget-list").width("").each(function(){a(this).width(a(this).width())})}function Bb(){vBulletin.AJAX({call:"/ajax/api/widget/fetchPageManagerForums",complete:function(){a("#config-dialog .loader").hide()},success:function(b){lb=!0;var d=a("<div>").addClass("channel-list");a.each(b,
function(c,e){c=a.map(e.subchannels,function(k,r){return r}).length;c=eb(d,e.nodeid,e.parentid,e.title,e.category,!1,c);jb(e.subchannels,c)});b=a("#top-level-forum .channel-config-dialog");b.find(".channel-list").remove();cb(d);db(d);b.append(d);a(document).on("mousedown",".main-channel-container > .channel-item-container > .channel-item .grip-icon",function(){a(this).closest(".main-channel-container").height(a(this).closest(".main-channel-container").height())});a(document).on("mousedown",".sub-channel-container > .channel-item-container > .channel-item .grip-icon",
function(){a(this).closest(".sub-channel-container").height(a(this).closest(".sub-channel-container").height())});P=!1;Fa()},error_phrase:"error_fetching_channels"});a(document).on("click keydown",".channel-config-dialog .add-channel-fieldset .add-button, .channel-config-dialog .add-channel-fieldset input",function(b){if(("click"==b.type||13!=b.which)&&"text"==this.type||"keydown"==b.type&&"button"==this.type&&13!=b.which)return!0;var d="text"==this.type?a(this):a(this).prev();if((b=a.trim(d.val()))&&
b!=d.prop("defaultValue")){var c=a("#top-level-forum .channel-config-dialog .channel-list");eb(c,"","",vBulletin.htmlEntities(b),0,!0,0);cb(c);Fa();d.val("");"button"==this.type&&d.trigger("focus")}else vBulletin.warning("warning_gcpuser","please_enter_channel_title",function(){d.trigger("focus")})});a(document).on("click",".channel-config-dialog .main-channel-container .channel-item .channel-title div",function(){a(this).hide().next().show().trigger("select").trigger("focus")});a(document).on("keydown blur",
".channel-config-dialog .main-channel-container .channel-item .channel-title input",function(b){if("focusout"==b.type||"keydown"==b.type&&13==b.which)a.trim(this.value)||"focusout"!=b.type||(this.value=this.defaultValue),a.trim(this.value)&&a(this).hide().prev().text(this.value).show()});a(document).on("click",".channel-config-dialog .channel-item .category-to-channel a",function(){var b=a(this);b.closest(".channel-item").attr("data-switch-category",0);b.parent().removeClass("category-to-channel").addClass("channel-to-category");
b.html(vBulletin.phrase.get("make_category"));return!1});a(document).on("click",".channel-config-dialog .channel-item .channel-to-category a",function(){var b=a(this);b.closest(".channel-item").attr("data-switch-category",1);b.parent().removeClass("channel-to-category").addClass("category-to-channel");b.html(vBulletin.phrase.get("make_forum"));return!1});a(document).on("click",".channel-config-dialog .channel-item .toggle-button",function(){Ea(a(this));return!1});a(document).on("click",".channel-config-dialog .channel-item .add-subchannel-button a",
function(){var b=a(this).parent().siblings(".toggle-button");Ea(b,!0);var d=a(this).closest(".channel-item-container"),c=fb("","",vBulletin.phrase.get("new_channel"),0,d,0);db(d);c.slideDown(100,function(){var e=d.find(".channel-item-inner").first().find(".num-subchannels");e.text(parseInt(e.text())+1);a(".channel-title div",c).trigger("click");a(".channel-title input",c).get(0).scrollIntoView(!1);Fa()});return!1});a(document).on("click",".channel-config-dialog .channel-list .channel-item .close-button",
function(){var b=a(this),d=0<a("> .sub-channel-container > .channel-item-container",b.closest(".channel-item-container")).length,c=vBulletin.htmlEntities(b.prev().text());O.openConfirmDialogSimple({title:"remove_forum_q",message:["do_you_want_to_remove_forum",c,d?" "+ia.get("subchannels_will_be_deleted"):""],iconType:"warning",onClickYes:function(){var e=b.closest(".channel-item-container"),k=e.parent(),r=b.closest(".channel-item").attr("data-channel-id"),v=function(){e.remove();k.hasClass("main-channel-container")&&
k.slideUp("fast",function(){a(this).remove()})};r?vBulletin.AJAX({call:"/ajax/api/content_channel/delete",data:{nodeid:r},success:function(p){v()}}):v()}})})}function Cb(b){function d(c,e,k){vBulletin.AJAX({call:"/ajax/render/{0}_list".format(c),data:{page:e,isAjaxTemplateRenderWithData:!0},complete:function(){a("#config-dialog .loader").hide();a("body").css("cursor","auto")},success:function(r){a("#top-level-{0} .channel-config-dialog".format(c)).html(r.template);k&&vBulletin.pagination({context:"#top-level-{0} .channel-config-dialog".format(c),
onPageChanged:function(v,p){d(c,v)}})},error_phrase:"error_fetching_channels"})}d(b,1,!0);a(document).on("click",".page_manager_table .channel_name div",function(){a(this).hide().next().show().trigger("select").trigger("focus")});a(document).on("keydown blur",".page_manager_table .channel_name input",function(c){if("focusout"==c.type||"keydown"==c.type&&13==c.which){a.trim(this.value)||"focusout"!=c.type||(this.value=this.defaultValue);var e=a.trim(this.value),k=a(this);e&&k.prev().html()!=e&&(a("body").css("cursor",
"wait"),vBulletin.AJAX({call:"/ajax/api/Content_Channel/update",data:{nodeid:k.parents(".channel_row").data("nodeid"),data:{title:e}},complete:function(){a("#config-dialog .loader").hide();a("body").css("cursor","auto")},success:function(r){k.hide();k.prev().html(e);k.prev().show()},error_phrase:"error_saving_page"}))}});a(document).on("click",".page_manager_table .delete",function(){let c=a(this).parents(".channel_row");O.openConfirmDialogSimple({title:"remove_channel_q",message:["do_you_want_to_remove_channel",
c.find(".channel_name_val").html()],iconType:"warning",onClickYes:()=>{vBulletin.AJAX({call:"/ajax/api/content_channel/delete",data:{nodeid:c.data("nodeid")},success:()=>{c.remove()}})}})})}function tb(){a("body").css("cursor","wait");var b=function(d,c){d=d.index();0!=d||lb||Bb();1!=d&&2!=d||Cb(a(c).data("top-level"))};Ja=a("#manage-pages").tabs({beforeActivate:function(d,c){var e=c.newTab.index();if(0!=e&&P)return O.openConfirmDialogSimple({title:"exit_without_saving_page",message:"forum_changes_will_be_lost",
iconType:"warning",onClickYes:()=>{P=!1;Ja.tabs("option","active",e)}}),!1},create:function(d,c){b(c.tab,d.currentTarget)},activate:function(d,c){b(c.newTab,d.currentTarget)}});Ja.tabs("option","active",0);a("#manage-page-dropdown .lnkSaveChanges").on("click",function(){function d(k,r,v){k=a("> .channel-item-container",k);0<k.length&&k.each(function(p){var f=a("> .channel-item",this),m=f.attr("data-channel-id"),y=f.attr("data-parent-id");subchannelObj={nodeid:m||"0",previousParentId:y,title:a(".channel-title div",
f).html(),displayorder:p+1,parentid:v||"0",subchannels:[]};null!=f.attr("data-switch-category")&&(subchannelObj.switchCategory=f.attr("data-switch-category"));r.subchannels.push(subchannelObj);d(f.next(".sub-channel-container"),r.subchannels[p],m)})}var c=a(this);if(c.hasClass("h-disabled"))console.log("We are busy saving already. Try again later.");else{c.addClass("h-disabled");var e=[];ba?(a(".channel-config-dialog .channel-list .main-channel-container").each(function(k){var r=a("> .channel-item-container > .channel-item",
this),v=r.attr("data-channel-id"),p=r.attr("data-parent-id");k={nodeid:v,previousParentId:p,title:a(".channel-title div",r).html(),displayorder:k+1,subchannels:[]};null!=r.attr("data-switch-category")&&(k.switchCategory=r.attr("data-switch-category"));d(r.next(".sub-channel-container"),k,v);e.push(k)}),vBulletin.AJAX({call:"/ajax/api/widget/saveForums",data:{data:JSON.stringify(e)},complete:function(){c.removeClass("h-disabled")},success:function(k){ba=P=!1;ja()},title_phrase:"error_saving_forums"})):
c.removeClass("h-disabled")}});a(document).on("click","#manage-page-dropdown .lnkExitWithoutSaving",function(){Ma(P,"exit_without_saving_page","do_you_want_to_exit_without_saving_page").then(ja)})}function Ya(){function b(h){let g=a("#save-page-form");g.find(".template-name").toggleClass("h-hide",h);g.find(".page-template-name").toggleClass("h-hide",!h);g.find("#templatetitle-edit").prop("disabled",h)}function d(h){"undefined"==typeof qa.search_config_dialog?vBulletin.AJAX({call:"/ajax/render/dialog_search_config",
success:function(g){qa.search_config_dialog=g;a("body").append(g);d(h)},error_phrase:"error_fetching_dialog"}):(h&&a("#search-config-dialog").data("search-widget",h),Aa(a("#search-config-dialog").dialog({title:vBulletin.phrase.get("edit_search_module"),autoOpen:!0,modal:!0,resizable:!1,closeOnEscape:!1,showCloseButton:!1,width:800,dialogClass:"dialog-container search-config-dialog-container input-dialog",close:function(){ha("visible");a(this).trigger("vb-deinstrument")},open:function(){var g=this;
a("#customSearchDialog",g).addClass("h-invisible");a("body").css("cursor","wait");vBulletin.search=vBulletin.search||{};var t=function(){za=new vBulletin.search.SearchControl("#customSearchDialog");Db(za)},n=a("#search-config-dialog").data("search-widget");n.attr("data-widget-id");n.attr("data-widget-instance-id");if("undefined"==typeof vBulletin.search.SearchControl){var u=["/js/tag-editor.js","/js/sb_search.js"],w=function(){if(0==u.length)a("body").css("cursor","auto"),a("#customSearchDialog",
g).removeClass("h-invisible"),t();else{var x=u.shift();a.getScript(vBulletin.getAjaxBaseurl()+x+"?c="+pageData.cachebuster,w).fail(function(F,N,J){F=J&&J.message?"{0}: {1}".format(vBulletin.phrase.get("error"),J.message):"HTTP {0}: {1}".format(F.status,F.statusText);a("#search-config-dialog").dialog("close");openAlertDialog({title:vBulletin.phrase.get("error"),message:"{0}<br /><br />({1})".format(vBulletin.phrase.get("error_loading_search_config_script"),F),iconType:"error"})})}};w()}else a("#customSearchDialog",
g).removeClass("h-invisible"),t();P=!1},create:function(){a("#btnSaveSearchConfig").on("click",function(){a("body").css("cursor","wait");var g=a("#search-config-dialog");let t=g.data("search-widget");var n=t.attr("data-widget-id"),u=t.attr("data-widget-instance-id");let w={pageid:pageData.pageid,widgetid:n,widgetinstanceid:u,pagetemplateid:a("#select-template input[type=radio]:checked").val(),searchJSON:{}};n=a("#searchTitle");0<n.length&&0<a.trim(n.val()).length&&(w.searchTitle=a.trim(n.val()),n.data("defaultValue",
w.searchTitle));let x={};a('input[name^="data[searchTitle]"]',g).each((J,I)=>{if(J=/data\[searchTitle\]\[(\d+)\]/.exec(I.name))x[J[1]]=I.value});Object.keys(x).length&&(w.searchTitle=x);g=a("#resultsPerPage");0<g.length&&0<a.trim(g.val()).length&&(w.resultsPerPage=a.trim(g.val()),g.data("defaultValue",w.resultsPerPage));g=["hide_avatars","hide_module_when_empty","hide_usernames","displayFooter"];for(n=0;n<g.length;n++){u=g[n];var F=a("input[name='"+u+"'][value='1']");0<F.length&&F.prop("checked")?
(w[u]="1",F.data("defaultValue","1")):(w[u]="0",F.data("defaultValue","0"))}g=a(".js-searchmodule-show-at-breakpoints");0<g.length&&(w.show_at_breakpoints={desktop:1,small:1,xsmall:1},g.find("input").each(function(){var J=a(this);switch(J.prop("name")){case "show_at_breakpoints[desktop]":w.show_at_breakpoints.desktop=J.prop("checked")?1:0;break;case "show_at_breakpoints[small]":w.show_at_breakpoints.small=J.prop("checked")?1:0;break;case "show_at_breakpoints[xsmall]":w.show_at_breakpoints.xsmall=
J.prop("checked")?1:0}}),g.data("defaultValue",w.show_at_breakpoints));u=a("#search-config-dialog .js-sb-module-config--viewpermissions");if(0<u.length){w.module_viewpermissions={};g=u.find("input.js-module_viewpermissions__key:checked");n="show_all";u=u.find("input.js-module_viewpermissions__value:checked");var N="all";g.length&&(n=g.prop("value"));u.length&&(N=[],a.each(u,function(J,I){N.push(a(I).prop("value"))}));w.module_viewpermissions={key:n,value:N}}g=a("#search-config-dialog .js-sb-module-config--filter_nodes");
0<g.length&&(g=Eb(g.find(":input")),w.module_filter_nodes="data"in g&&"module_filter_nodes"in g.data?g.data.module_filter_nodes:{});w.searchJSON=za.load();vBulletin.AJAX({call:"/ajax/api/widget/saveSearchWidgetConfig",data:{data:JSON.stringify(w)},complete:function(){a("body").css("cursor","auto")},success:function(J){0<J.widgetinstanceid&&J.searchJSON&&(t.attr("data-widget-instance-id",J.widgetinstanceid),t.find(".main-title").text(w.searchTitle),a("#config_widgetinstanceid").val(J.widgetinstanceid),
a("#config_pagetemplateid").val(J.pagetemplateid),a("#pagetemplateid-new").val(J.pagetemplateid),a("#search-config-dialog").dialog("close"),t.find(".widget-content").is(":hidden")&&t.find(".toggle-button").trigger("click",[!0]),P=!0)},error_phrase:"error_saving_search_config"})});a("#btnCancelSearchConfig").on("click",function(){function g(){a("#search-config-dialog").dialog("close");za.set("{}");var t=a("#search-config-dialog #searchTitle");t.val(t.data("defaultValue"));t=a("#search-config-dialog #resultsPerPage");
t.val(t.data("defaultValue"));t=["hide_avatars","hide_module_when_empty","hide_usernames","displayFooter"];for(var n=0;n<t.length;n++){var u=t[n],w=a("#search-config-dialog input[name='"+u+"'][value='1']");u=a("#search-config-dialog input[name='"+u+"'][value='0']");"1"==w.data("defaultValue")?w.prop("checked",!0):u.prop("checked",!0)}t=a("#search-config-dialog .js-searchmodule-show-at-breakpoints");if(0<t.length){var x=t.data("defaultValue");"undefined"!=typeof x&&t.find("input").each(function(){var F=
a(this);switch(F.prop("name")){case "show_at_breakpoints[desktop]":F.prop("checked",x.desktop);break;case "show_at_breakpoints[small]":F.prop("checked",x.small);break;case "show_at_breakpoints[xsmall]":F.prop("checked",x.xsmall)}})}}P?O.openConfirmDialogSimple({title:"cancel_edit",message:"do_you_want_to_cancel_editing_search_module",iconType:"warning",onClickYes:g}):g()})}})))}a(document).on("focus click",".edit-mode .widget-content a, .edit-mode #channel-tabbar a, .edit-mode #btnSearch, .edit-mode #q",
function(h){this.blur();return!1});gb||yb();ib?(Ha.thumbnailRadioCheckbox("check",a("#select-template .template-border.selected").next("input"),!1),T||a("#select-template .template-item input[value={0}]".format(a("#pagetemplateid-yes").val())).prev().trigger("click")):zb();a.isEmptyObject(wa)&&Ra();Z();a("#config_pagetemplateid").val("");da=void 0;if(T){var c=a("#save-page-form");c.find("#pageurl, #pagetitle").val("");c.find("#pageid").val(0);c.find("#ishomeroute").prop({disabled:!1,checked:!1})}a("#edit-page-dropdown .lnkDeletePage").on("click",
()=>{O.openConfirmDialogSimple({title:"confirm_deletion_gcpglobal",message:"confirm_remove_page_desc",yesPhrase:"delete_page",noPhrase:"cancel",iconType:"warning",onClickYes:()=>{vBulletin.AJAX({call:"/ajax/api/page/delete",data:{pageid:pageData.pageid},success:()=>{location.href=pageData.baseurl}})}})});a("#edit-page-dropdown .lnkSaveChanges").on("click",function(){var h=a("#save-page-form");let g=h.find(".new-page-template");h=h.find(".edit-page-template");var t=a("#edit-page-dropdown .tabs");t.find("li").removeClass("ui-tabs-active ui-state-active");
t.find(".tab").addClass("ui-tabs-hide");a("#save-content").show();let n=(t=a("body").hasClass("lnkNewPage"))||!T||V||P?"":"none";h.css("display",n).prev("label").css("display",n);g.find("input").prop("disabled",!t);h.find("input").prop("disabled",t);t||(a("#pagetemplateid-yes").prop("checked")||a("#pagetemplateid-no").prop("checked")||a("#pagetemplateid-yes").prop("checked",!0),b(a("#pagetemplateid-yes").prop("checked")))});a(document).on("click","#edit-page-dropdown .lnkExitWithoutSaving",function(){V||
P||fa||!(T||La(a("#pagetitle"))&&La(a("#pageurl")))||T&&(""!=a("#pagetitle").val()||""!=a("#pageurl").val())?O.openConfirmDialogSimple({title:"exit_without_saving_page",message:"do_you_want_to_exit_without_saving_page",iconType:"warning",onClickYes:()=>{let h=parseInt(a("input#pagetemplateid-new").val(),10);!isNaN(h)&&0<h?R.AJAX({call:"/ajax/api/page/deleteOrphanedPagetemplates",data:{pagetemplateids:[h]},complete:ja}):ja()}}):ja()});var e=0;a(window).on("resize.canvas",function(){clearTimeout(e);
e=setTimeout(ya,200)});var k=function(h){return'<label class="hide-icon module-button-item"><input type="checkbox" title="{0}" data-toggle-title="{1}"{2} /></label>'.format(ia.get("check_to_hide_module"),ia.get("uncheck_to_unhide_module"),h?' checked="checked"':"")};a(".canvas-widget.container-widget .canvas-widget:not(.dummy-widget)").each(function(){var h=a(this).hasClass("hidden-widget");a(".module-buttons .admin-only",this).prepend(k(!1));h&&a(".module-buttons .admin-only .hide-icon input",this).trigger("click")});
var r=function(h,g,t){t=g.item.hasClass("module-item");h=a("> .canvas-widget.container-widget {0}".format(t?".module-item":".canvas-widget.container-widget"),this);return 0<h.length&&h.closest(".canvas-widget.container-widget").attr("data-widget-id")==h.attr("data-widget-id")?(t?h.remove():g.sender?g.sender.sortable("cancel"):a(this).sortable("cancel"),p=!0,openAlertDialog({title:vBulletin.phrase.get("move_not_allowed"),message:vBulletin.phrase.get("dropping_container_module_into_container_module_not_allowed"),
iconType:"warning"}),!0):!1},v=function(h){0<h.parents(".canvas-widget.container-widget").length?0==a(".module-buttons .admin-only .hide-icon",h).length&&a(".module-buttons .admin-only",h).prepend(k()):h.removeClass("hidden-widget").find("> .widget-header .module-buttons .admin-only .hide-icon").remove()},p=!1;mb=a(".edit-mode .canvas-layout .canvas-widget-list:not(.js-draggable-module-target)");mb.sortable({revert:200,addWidthAnimation:!0,tolerance:"pointer",connectWith:".edit-mode .canvas-layout:visible .canvas-widget-list",
placeholder:"canvas-widget canvas-widget-highlight drag-highlight",create:function(){ya()},update:function(h,g){var t=this;if(Ka)p||Sa(g.item,function(x){x=x.filter(function(){return this.nodeType===Node.ELEMENT_NODE});g.item.replaceWith(x);x.filter(":not(.container-widget)").find(".toggle-button").trigger("click",[!0]);if(!r.apply(t,[h,g])){v(x);x.addClass("shadow").find(".widget-tabs").addBack().filter(".widget-tabs").tabs();ea();x.parents(".canvas-widget.container-widget").find(".canvas-widget.dummy-widget").remove();
var F=x.parents(".canvas-widget.container-widget");1==F.length&&(F.find(".canvas-widget-highlight").remove(),F.find(".module-item").remove())}F=x.data("widget-id");var N=ua(x),J=function(l){x.attr("data-widget-instance-id",l);N&&na(x);oa(x)};if(F){var I=a(t).data("section"),K=0;a(t.children).filter(".canvas-widget").each(function(){a(this);var l=a(this).attr("data-widget-instance-id");if(!l)return!1;K=l});va(N,F,{},J,I,K)}});else if(r.apply(t,[h,g])||(v(g.item),ea()),a.contains(this,g.item[0])){var n=
g.item.closest(".canvas-widget"),u=ua(n),w=n.data("widget-instance-id")||0;na(n);w&&vBulletin.AJAX({call:"/ajax/api/widget/saveWidgetinstanceContainerinstanceid",data:{widgetinstanceid:w,containerinstanceid:u,pagetemplateid:la(),displaysection:sa(n),displayafterwidgetinstanceid:ta(n)}})}g.sender&&(n=g.sender.closest(".canvas-widget"),n.length&&na(n));V=!0},out:function(h,g){a(this).css("overflow","")},sort:function(h,g){Ga&&(Ka=!0)},start:function(h,g){ha("hidden",g.item)},stop:function(h,g){a(this).css("overflow",
"");Ka=p=!1;g.item.height("auto");ha("visible");a(".canvas-layout .canvas-widget-list .canvas-widget-highlight").remove();a(".canvas-layout > .canvas-layout-row .canvas-widget-list > .canvas-widget.container-widget");a(".canvas-layout > .canvas-layout-row .canvas-widget-list > .canvas-widget.container-widget").each(function(){var t=a(".canvas-widget-list",this);0==t.children().length?t.append('<div class="canvas-widget dummy-widget"><span>{0}</span></div>'.format(vBulletin.phrase.get("you_can_also_drag_and_drop_modules_here"))):
0<t.find(".canvas-widget.dummy-widget").length&&0<t.find(".canvas-widget:not(.dummy-widget,.canvas-widget-highlight)").length&&t.find(".canvas-widget.dummy-widget").remove()})},receive:function(h,g){g.item.hasClass("module-item")&&r.apply(this,[h,g,!0])},handle:".move-icon",items:".canvas-widget:not(.js-widget-non-sortable,.js-widget-pinned-sortable)"}).find(".canvas-widget .widget-header").disableSelection();var f=a.ui.sortable.prototype._mouseStop,m=a.ui.sortable.prototype._clear,y=!1,q=jQuery.fn.animate;
a.ui.sortable.prototype._mouseStop=function(h,g){if(y=h&&this.options.revert&&this.options.addWidthAnimation){var t=this.placeholder.outerWidth();jQuery.fn.animate=function(){y&&t&&(arguments[0].width=t);return q.apply(this,arguments)}}return f.apply(this,arguments)};a.ui.sortable.prototype._clear=function(h){y&&q&&(jQuery.fn.animate=q);return m.apply(this,arguments)};a(document).on("click",".edit-mode .canvas-widget .js-pin-module-button",function(){var h=a(this),g=h.closest(".canvas-widget");g.find("js-move-button");
var t=g.hasClass("js-widget-pinned-sortable");g.toggleClass("js-widget-pinned-sortable",!t);h.toggleClass("pin-icon--pinned",!t)});a(document).on("click",".edit-mode .canvas-widget .close-button",function(){var h=a(this);O.openConfirmDialogSimple({title:"remove_module_q",message:["do_you_want_to_remove_module",h.closest(".widget-header").find(".module-title").text()],iconType:"warning",onClickYes:function(){var g=h.closest(".canvas-widget"),t=g.data("widget-instance-id"),n=g.parent(),u=g.parents(".canvas-widget.container-widget");
g.remove();ea();V=!0;Oa([t]);na(n);0==u.find(".canvas-widget").length&&u.find(".canvas-widget-list").append('<div class="canvas-widget dummy-widget"><span>{0}</span></div>'.format(vBulletin.phrase.get("you_can_also_drag_and_drop_modules_here")))}})});a(document).on("click",".edit-mode .js-search-widget .edit-button",function(){ha("hidden");d(a(this).closest(".js-search-widget"));a("#search-config-dialog").dialog("open");return!1});a(document).on("click","#save-page-form #btnOK",function(h,g){function t(u){var w=
{widgetId:u.attr("data-widget-id"),widgetInstanceId:u.attr("data-widget-instance-id")||"0"};if(u.is(".container-widget")){var x=[],F=[];a("div.canvas-widget-list > div.canvas-widget",u).each(function(J){a(this).hasClass("hidden-widget")||F.push(a(this).attr("data-widget-instance-id"));x.push(t(a(this)))});w.subModules=x;w.displaySubModules=F}if(u.data("is-tabbed-container")){var N=[];u.find("> .js-admin-widget-content > .js-admin-widget-tab").each(function(){a(this).find("> .widget-content > .canvas-layout-row > .canvas-widget-list > .canvas-widget:not(.dummy-widget)").each(function(){var J=
a(this);N.push(t(J))})});w.tabbedContainerSubModules=N}return w}h=a("#edit-page-dropdown .lnkSaveChanges .label").text();var n=a("#save-page-form");if(!g){function u(w,x){O.openConfirmDialogSimple({title:["phrase_passthrough",w],message:x,yesPhrase:"save_page",noPhrase:"cancel",iconType:"warning",onClickYes:()=>{a("#save-page-form #btnOK").trigger("click",!0)}})}g=n.find("#pagetitle");if(!a.trim(g.val()))return O.warning(h,"please_enter_page_name",g),!1;if(a("body").hasClass("lnkEditPage"))if(g=n.find("#pagetemplateid-yes"),
noChecked=n.find("#pagetemplateid-no").prop("checked"),yesChecked=g.prop("checked"),noChecked||yesChecked){if(noChecked){n=n.find("#templatetitle-edit");g=a.trim(n.val());if(!g||g==n.prop("defaultValue"))return O.warning(h,"please_enter_new_template_name",n),!1;u(h,["applying_new_template",g]);return!1}if(yesChecked)return!T||V||P?u(h,"overwrite_template_continue"):a("#save-page-form #btnOK").trigger("click",!0),!1}else return O.warning(h,"please_choose_overwrite_template_options",g),!1;else if(n=
n.find("#templatetitle-new"),g=a.trim(n.val()),!g||g==n.prop("defaultValue"))return vBulletin.warning(h,"please_enter_new_template_name",n),!1}h=a(".canvas-layout:visible");X=h.attr("id");n=parseInt(h.attr("data-layout-id"),10);a("#save-page-form #screenlayoutid").val(n);a('input[type=hidden][name*="displaysections"]',h).clone().appendTo(a("#moduleData").empty());a("#"+X+" > .canvas-layout-row > div.canvas-widget-list").each(function(){var u=[],w=bb(this);a(this).children("div.canvas-widget").each(function(){u.push(t(a(this)))});
a('#save-page-form input[name="displaysections['+w+']"]').val(JSON.stringify(u))});h="vbulletin-screenlayout-bare-full-57433eecd10803.93763070"==a("input[name='screenlayoutid'][value='"+n+"']").attr("data-guid");Ma(h,"warning","you_cannot_revert_this_layout_confirm").then(()=>{vBulletin.AJAX({call:"/admin/savepage",data:{input:R.getFormData(a("#save-page-form"),0),url:location.href},success:function(u){u.viewControlEligible?O.alert("page_saved","page_view_perm_admincp","",()=>{location.href=u.url}):
location.href=u.url},error_phrase:"error_saving_page"})})});Aa(a("#config-dialog").dialog({title:vBulletin.phrase.get("module_configuration"),autoOpen:!1,modal:!0,resizable:!1,closeOnEscape:!1,showCloseButton:!1,height:500,width:800,dialogClass:"dialog-container config-dialog-container input-dialog",open:function(){a("#config-dialog .loader").show()},create:function(){a(document).on("submit",".sitebuilder-widget-form",function(){(function(h){a("#config-dialog .js-button").prop("disabled",!0);var g=
a("#config-dialog").data("selected-module");vBulletin.AJAX({url:h.action,type:h.method,data:a(h).serializeArray(),success:function(t){if(t.data){if(t=t.data.title||t.data.searchResultTitle||t.data.searchTitle)t.match(/^widget_[\d]+_title$/)&&(t=ia.get(t,0)),t=vBulletin.phrase.get("x_module",t),g.find(".module-title .admin-only").html(t);t=a('select[name="data[default_tab]"]',a(h));0<t.length&&g.attr("data-widget-default-tab",t.val());P=!0}a("#config-dialog").dialog("close")},after_error:function(){a("#config-dialog .loader").hide();
a("#config-dialog .js-button").prop("disabled",!1)},error_phrase:["error_saving_configuration_module",a("#config-dialog .widget-name h1").text()]})})(this);return!1});a("#btnCloseConfig").on("click",function(){a("#config-dialog").dialog("close")})},close:function(){ha("visible");a("#config-dialog .js-button").prop("disabled",!1)}}));if(T){c=a("#pagetitle");let h=a("#pageurl"),g=!0;c.on("focus",t=>{var n=h.val();g=""==n||n==t.currentTarget.value.replace(/[^\w-]+/g,"")});c.on("keyup blur",t=>{g&&h.val(t.currentTarget.value.replace(/[^\w-]+/g,
""))})}a("#pagetemplateid-yes").on("click",()=>b(!0));a("#pagetemplateid-no").on("click",()=>b(!1))}function Eb(b){if(1>b.length)return{};var d={};b.serializeArray().forEach(function(c){var e=c.value;var k=c.name,r=k.indexOf("[");c=0<=r&&k.substring(0,r)||k;k=0<=r&&k.substring(r)||"";r=/\[([^\]]*)\]/g;var v=5,p=[c];if(0<k.length){do(c=r.exec(k))&&"1"in c&&p.push(c[1]);while(null!==c&&0<v--)}e=nb(p,e);d=ob(d,e)});return d}function ob(b,d){if(Array.isArray(d))d.forEach(function(e){b.push(e)});else{if("object"!=
typeof d)return d;for(var c in d)d.hasOwnProperty(c)&&(b[c]=c in b?ob(b[c],d[c]):d[c])}return b}function nb(b,d){var c=b.shift(),e={};0<b.length&&(d=nb(b,d));if(""==c)return[d];e[c]=d;return e}function Db(b){let d=a("#search-config-dialog"),c=d.data("search-widget");var e=c.attr("data-widget-id"),k=c.attr("data-widget-instance-id");let r=a("#searchTitle",d),v=r.closest(".js-config-row");vBulletin.AJAX({call:"/ajax/api/widget/fetchSearchConfig",data:{widgetid:e,widgetinstanceid:k||"",pagetemplateid:la(),
configtype:"admin"},success(p){v.removeClass("h-hide-imp");p.hasOwnProperty("searchTitle")&&r.val(p.searchTitle);p.hasOwnProperty("resultsPerPage")&&a("#resultsPerPage").val(p.resultsPerPage);for(var f=["hide_avatars","hide_module_when_empty","hide_usernames","displayFooter"],m=0;m<f.length;m++){var y=f[m];value=p[y]&&1==parseInt(p[y],10)?1:0;a("input[name='"+y+"'][value='"+value+"']").prop("checked",!0)}p.hasOwnProperty("show_at_breakpoints")&&(f=a("#search-config-dialog .js-searchmodule-show-at-breakpoints"),
0<f.length&&f.find("input").each(function(){var q=a(this);switch(q.prop("name")){case "show_at_breakpoints[desktop]":q.prop("checked",p.show_at_breakpoints.desktop);break;case "show_at_breakpoints[small]":q.prop("checked",p.show_at_breakpoints.small);break;case "show_at_breakpoints[xsmall]":q.prop("checked",p.show_at_breakpoints.xsmall)}}));p.hasOwnProperty("module_viewpermissions")&&(m=a("#search-config-dialog .js-searchmodule-module_viewpermissions--replaceme"),f=kb({defaultvalue:p.module_viewpermissions}),
m.replaceWith(f));if(p.hasOwnProperty("searchJSON")&&("string"==typeof p.searchJSON&&(p.searchJSON=JSON.parse(p.searchJSON||"{}")),p.searchJSON.channel&&0<p.searchJSON.channel.length))if("param"in p.searchJSON.channel)p.module_filter_nodes={include:["current"]},p.module_filter_nodes.include_children=!0;else{p.module_filter_nodes={include:[]};p.module_filter_nodes.include_children=!0;if("number"==typeof p.searchJSON.channel||"string"==typeof p.searchJSON.channel)p.searchJSON.channel=[p.searchJSON.channel];
p.searchJSON.channel&&0<p.searchJSON.channel.length&&p.searchJSON.channel.forEach(function(q){p.module_filter_nodes.include.push(q)})}p.hasOwnProperty("module_filter_nodes")&&(m=a("#search-config-dialog .js-searchmodule-module_filter_nodes--replaceme"),f=S.generateConfigInputs__Module_Filter_Nodes({defaultvalue:p.module_filter_nodes}),m.replaceWith(f),a("#search-config-dialog select.js-module_filter_nodes-values").selectBox());b.set(p.searchJSON||{},p.contentTypes||{},p.channels||{});a("#config-dialog .dialog-content .widget-config-container").show();
a("#search-config-dialog .form_layout .form_row .field_column select").selectBox()},after_error:function(){a("#config-dialog .loader").hide();a("#config-dialog").dialog("close")}}).then(p=>k?vBulletin.AJAX({call:"/ajax/api/widget/fetchModuleTranslatableConfigs",data:{widgetinstanceid:k},success(f){if(f.translatables)for(const [m,y]of Object.entries(f.translatables)){f=a("#"+m);f=f.closest(".js-config-row")||f.parent();let q=S.generateTranslatableForSearchModuleConfig(y);q&&(f.addClass("h-hide-imp"),
f.after(q),S.attachTranslatableToggleEvent(q.parent()),d.on("vb-deinstrument",h=>{S.detachTranslatableToggleEvent(q.parent());q.remove()}))}}}):a.Deferred().resolve()).then(()=>{a("#config-dialog .loader").hide()})}const Q=ia.get,S=R.sitebuilder;let xa,Ja,X,ab,Ha,$a=[],V=!1,P=!1;var ba=void 0;let ib=!1,gb=!1,fa=!1,Ga=!1,Ka=!1,za=!1,T=!1,qa={},Ia={},wa={},hb,mb,da,Pa={saveNewWidgetInstance:!1},Qa=a("<div>");a(document).on("vb-toggle-sitebuilder-menu",W);a(document).on("click",".js-top-menu-sitebuilder--list .js-top-menu-link:not(.js-top-menu-tab--admincp)",
function(b){var d=a(b.target),c=d.data("panel-name");if(d.is(".b-top-menu__item-link--disabled"))return this.blur(),b.stopPropagation(),!1;b="vb-sitebuilder-panel--"+c;a(document).trigger(b);return!1});S.activateSB=Y;var lb=!1;a(()=>{sb();vBulletin.ready("sb_page").resolve()})})(jQuery,vBulletin,vBulletin.dialogtools,vBulletin.phrase);
