!function(a){var i=wp.customize,t=(i.bind("pane-contents-reflowed",function(){var e=[],n=(i.section.each(function(t){"ast_section"===t.params.type&&void 0!==t.params.section&&e.push(t)}),e.sort(i.utils.prioritySort).reverse(),a.each(e,function(t,e){a("#sub-accordion-section-"+e.params.section).children(".section-meta").after(e.headContainer)}),[]);i.panel.each(function(t){"ast_panel"===t.params.type&&void 0!==t.params.panel&&n.push(t)}),n.sort(i.utils.prioritySort).reverse(),a.each(n,function(t,e){a("#sub-accordion-panel-"+e.params.panel).children(".panel-meta").after(e.headContainer)})}),wp.customize.Panel.prototype.embed),s=wp.customize.Panel.prototype.isContextuallyActive,e=wp.customize.Panel.prototype.attachEvents,n=(wp.customize.Panel=wp.customize.Panel.extend({attachEvents:function(){var n;"ast_panel"!==this.params.type||void 0===this.params.panel?e.call(this):(e.call(this),(n=this).expanded.bind(function(t){var e=i.panel(n.params.panel);t?e.contentContainer.addClass("current-panel-parent"):e.contentContainer.removeClass("current-panel-parent")}),n.container.find(".customize-panel-back").off("click keydown").on("click keydown",function(t){i.utils.isKeydownButNotEnterEvent(t)||(t.preventDefault(),n.expanded()&&i.panel(n.params.panel).expand())}))},embed:function(){"ast_panel"!==this.params.type||void 0===this.params.panel?t.call(this):(t.call(this),a("#sub-accordion-panel-"+this.params.panel).append(this.headContainer))},isContextuallyActive:function(){var e,n,a;return"ast_panel"!==this.params.type?s.call(this):(n=(e=this)._children("panel","section"),i.panel.each(function(t){t.params.panel&&t.params.panel===e.id&&n.push(t)}),n.sort(i.utils.prioritySort),a=0,_(n).each(function(t){t.active()&&t.isContextuallyActive()&&(a+=1)}),0!==a)}}),wp.customize.Section.prototype.embed),o=wp.customize.Section.prototype.isContextuallyActive,c=wp.customize.Section.prototype.attachEvents;wp.customize.Section=wp.customize.Section.extend({attachEvents:function(){var n;"ast_section"!==this.params.type||void 0===this.params.section?c.call(this):(c.call(this),(n=this).expanded.bind(function(t){var e=i.section(n.params.section);t?e.contentContainer.addClass("current-section-parent"):e.contentContainer.removeClass("current-section-parent")}),n.container.find(".customize-section-back").off("click keydown").on("click keydown",function(t){i.utils.isKeydownButNotEnterEvent(t)||(t.preventDefault(),n.expanded()&&i.section(n.params.section).expand())}))},embed:function(){"ast_section"!==this.params.type||void 0===this.params.section?n.call(this):(n.call(this),a("#sub-accordion-section-"+this.params.section).append(this.headContainer))},isContextuallyActive:function(){var e,n,a;return"ast_section"!==this.params.type?o.call(this):(n=(e=this)._children("section","control"),i.section.each(function(t){t.params.section&&t.params.section===e.id&&n.push(t)}),n.sort(i.utils.prioritySort),a=0,_(n).each(function(t){void 0!==t.isContextuallyActive?t.active()&&t.isContextuallyActive()&&(a+=1):t.active()&&(a+=1)}),0!==a)}})}(jQuery);