!function(n){vara=n(document),d=wp.i18n.__;window.postboxes={handle_click:function(){vare,o=n(this),s=o.closest(".postbox"),t=s.attr("id");"dashboard_browser_nag"!==t&&(s.toggleClass("closed"),e=!s.hasClass("closed"),o.hasClass("handlediv")?o.attr("aria-expanded",e):o.closest(".postbox").find("button.handlediv").attr("aria-expanded",e),"press-this"!==postboxes.page&&postboxes.save_state(postboxes.page),t&&(!s.hasClass("closed")&&n.isFunction(postboxes.pbshow)?postboxes.pbshow(t):s.hasClass("closed")&&n.isFunction(postboxes.pbhide)&&postboxes.pbhide(t)),a.trigger("postbox-toggled",s))},handleOrder:function(){vare,o=n(this),s=o.closest(".postbox"),t=s.attr("id"),a=s.closest(".meta-box-sortables").find(".postbox:visible"),r=a.length,i=a.index(s);if("dashboard_browser_nag"!==t){if("true"===o.attr("aria-disabled"))returne=o.hasClass("handle-order-higher")?d("The box is on the first position"):d("The box is on the last position"),voidwp.a11y.speak(e);if(o.hasClass("handle-order-higher")){if(0===i)returnvoidpostboxes.handleOrderBetweenSortables("previous",o,s);s.prevAll(".postbox:visible").eq(0).before(s),o.focus(),postboxes.updateOrderButtonsProperties(),postboxes.save_order(postboxes.page)}if(o.hasClass("handle-order-lower")){if(i+1===r)returnvoidpostboxes.handleOrderBetweenSortables("next",o,s);s.nextAll(".postbox:visible").eq(0).after(s),o.focus(),postboxes.updateOrderButtonsProperties(),postboxes.save_order(postboxes.page)}}},handleOrderBetweenSortables:function(e,o,s){vart,a,r=o.closest(".meta-box-sortables").attr("id"),i=[];n(".meta-box-sortables:visible").each(function(){i.push(n(this).attr("id"))}),1!==i.length&&(t=n.inArray(r,i),a=s.detach(),"previous"===e&&n(a).appendTo("#"+i[t-1]),"next"===e&&n(a).prependTo("#"+i[t+1]),postboxes._mark_area(),o.focus(),postboxes.updateOrderButtonsProperties(),postboxes.save_order(postboxes.page))},updateOrderButtonsProperties:function(){vare=n(".meta-box-sortables:first").attr("id"),o=n(".meta-box-sortables:last").attr("id"),s=n(".postbox:visible:first"),t=n(".postbox:visible:last"),a=s.closest(".meta-box-sortables").attr("id"),r=t.closest(".meta-box-sortables").attr("id");n(".handle-order-higher").attr("aria-disabled","false"),n(".handle-order-lower").attr("aria-disabled","false"),e===a&&n(s).find(".handle-order-higher").attr("aria-disabled","true"),o===r&&n(".postbox:visible .handle-order-lower").last().attr("aria-disabled","true")},add_postbox_toggles:function(t,e){varo=n(".postbox .hndle, .postbox .handlediv"),s=n(".postbox .handle-order-higher, .postbox .handle-order-lower");this.page=t,this.init(t,e),o.on("click.postboxes",this.handle_click),s.on("click.postboxes",this.handleOrder),n(".postbox .hndle a").click(function(e){e.stopPropagation()}),n(".postbox a.dismiss").on("click.postboxes",function(e){varo=n(this).parents(".postbox").attr("id")+"-hide";e.preventDefault(),n("#"+o).prop("checked",!1).triggerHandler("click")}),n(".hide-postbox-tog").bind("click.postboxes",function(){vare=n(this),o=e.val(),s=n("#"+o);e.prop("checked")?(s.show(),n.isFunction(postboxes.pbshow)&&postboxes.pbshow(o)):(s.hide(),n.isFunction(postboxes.pbhide)&&postboxes.pbhide(o)),postboxes.save_state(t),postboxes._mark_area(),a.trigger("postbox-toggled",s)}),n('.columns-prefs input[type="radio"]').bind("click.postboxes",function(){vare=parseInt(n(this).val(),10);e&&(postboxes._pb_edit(e),postboxes.save_order(t))})},init:function(o,e){vars=n(document.body).hasClass("mobile"),t=n(".postbox .handlediv");n.extend(this,e||{}),n(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:".meta-box-sortables",items:".postbox",handle:".hndle",cursor:"move",delay:s?200:0,distance:2,tolerance:"pointer",forcePlaceholderSize:!0,helper:function(e,o){returno.clone().find(":input").attr("name",function(e,o){return"sort_"+parseInt(1e5*Math.random(),10).toString()+"_"+o}).end()},opacity:.65,start:function(){n("body").addClass("is-dragging-metaboxes")},stop:function(){vare=n(this);n("body").removeClass("is-dragging-metaboxes"),e.find("#dashboard_browser_nag").is(":visible")&&"dashboa