!function(e,Z){var a,t,s,n,i,o,r,ee=wp.customize;ee.OverlayNotification=ee.Notification.extend({loading:!1,initialize:function(e,t){var n=this;ee.Notification.prototype.initialize.call(n,e,t),n.containerClasses+=" notification-overlay",n.loading&&(n.containerClasses+=" notification-loading")},render:function(){var e=ee.Notification.prototype.render.call(this);return e.on("keydown",_.bind(this.handleEscape,this)),e},handleEscape:function(e){var t=this;27===e.which&&(e.stopPropagation(),t.dismissible&&t.parent&&t.parent.remove(t.code))}}),ee.Notifications=ee.Values.extend({alt:!1,defaultConstructor:ee.Notification,initialize:function(e){var t=this;ee.Values.prototype.initialize.call(t,e),_.bindAll(t,"constrainFocus"),t._addedIncrement=0,t._addedOrder={},t.bind("add",function(e){t.trigger("change",e)}),t.bind("removed",function(e){t.trigger("change",e)})},count:function(){return _.size(this._value)},add:function(e,t){var n,i,a=this;return i="string"==typeof e?(n=e,t):(n=e.code,e),a.has(n)||(a._addedIncrement+=1,a._addedOrder[n]=a._addedIncrement),ee.Values.prototype.add.call(a,n,i)},remove:function(e){return delete this._addedOrder[e],ee.Values.prototype.remove.call(this,e)},get:function(e){var t,a,o=this;return t=_.values(o._value),_.extend({sort:!1},e).sort&&(a={error:4,warning:3,success:2,info:1},t.sort(function(e,t){var n=0,i=0;return _.isUndefined(a[e.type])||(n=a[e.type]),_.isUndefined(a[t.type])||(i=a[t.type]),n!==i?i-n:o._addedOrder[t.code]-o._addedOrder[e.code]})),t},render:function(){var e,t,n,i,a=this,o=!1,s=[],r={};a.container&&a.container.length&&(e=a.get({sort:!0}),a.container.toggle(0!==e.length),a.container.is(a.previousContainer)&&_.isEqual(e,a.previousNotifications)||((n=a.container.children("ul").first()).length||(n=Z("
"),a.container.append(n)),n.find("> [data-code]").remove(),_.each(a.previousNotifications,function(e){r[e.code]=e}),_.each(e,function(e){var t;!wp.a11y||r[e.code]&&_.isEqual(e.message,r[e.code].message)||wp.a11y.speak(e.message,"assertive"),t=Z(e.render()),e.container=t,n.append(t),e.extended(ee.OverlayNotification)&&s.push(e)}),t=Boolean(s.length),a.previousNotifications&&(o=Boolean(_.find(a.previousNotifications,function(e){return e.extended(ee.OverlayNotification)}))),t!==o&&(Z(document.body).toggleClass("customize-loading",t),a.container.toggleClass("has-overlay-notifications",t),t?(a.previousActiveElement=document.activeElement,Z(document).on("keydown",a.constrainFocus)):Z(document).off("keydown",a.constrainFocus)),t?(a.focusContainer=s[s.length-1].container,a.focusContainer.prop("tabIndex",-1),(i=a.focusContainer.find(":focusable")).length?i.first().focus():a.focusContainer.focus()):a.previousActiveElement&&(Z(a.previousActiveElement).focus(),a.previousActiveElement=null),a.previousNotifications=e,a.previousContainer=a.container,a.trigger("rendered")))},constrainFocus:function(e){var t,n=this;e.stopPropagation(),9===e.which&&(0===(t=n.focusContainer.find(":focusable")).length&&(t=n.focusContainer),Z.contains(n.focusContainer[0],e.target)&&Z.contains(n.focusContainer[0],document.activeElement)?t.last().is(e.target)&&!e.shiftKey?(e.preventDefault(),t.first().focus()):t.first().is(e.target)&&e.shiftKey&&(e.preventDefault(),t.last().focus()):(e.preventDefault(),t.first().focus()))}}),ee.Setting=ee.Value.extend({defaults:{transport:"refresh",dirty:!1},initialize:function(e,t,n){var i,a=this;i=_.extend({previewer:ee.previewer},a.defaults,n||{}),ee.Value.prototype.initialize.call(a,t,i),a.id=e,a._dirty=i.dirty,a.notifications=new ee.Notifications,a.bind(a.preview)},preview:function(){var e,t=this;"postMessage"!==(e=t.transport)||ee.state("previewerAlive").get()||(e="refresh"),"postMessage"===e?t.previewer.send("setting",[t.id,t()]):"refresh"===e&&t.previewer.refresh()},findControls:function(){var n=this,i=[];return ee.control.each(function(t){_.each(t.settings,function(e){e.id===n.id&&i.push(t)})}),i}}),ee._latestRevision=0,ee._lastSavedRevision=0,ee._latestSettingRevisions={},ee.bind("change",function(e){ee._latestRevision+=1,ee._latestSettingRevisions[e.id]=ee._latestRevision}),ee.bind("ready",function(){ee.bind("add",function(e){e._dirty&&(ee._latestRevision+=1,ee._latestSettingRevisions[e.id]=ee._latestRevision)})}),ee.dirtyValues=function(n){var i={};return ee.each(function(e){var t;e._dirty&&(t=ee._latestSettingRevisions[e.id],ee.state("changesetStatus").get()&&n&&n.unsaved&&(_.isUndefined(t)||t<=ee._lastSavedRevision)||(i[e.id]=e.get()))}),i},ee.requestChangesetUpdate=function(n,e){var t,i,a,o,s={};return t=new Z.Deferred,0!==ee.state("processing").get()?(t.reject("already_processing"),t.promise()):(o=_.extend({title:null,date:null,autosave:!1,force:!1},e),n&&_.extend(s,n),_.each(ee.dirtyValues({unsaved:!0}),function(e,t){n&&null===n[t]||(s[t]=_.extend({},s[t]||{},{value:e}))}),ee.trigger("changeset-save",s,o),!o.force&&_.isEmpty(s)&&null===o.title&&null===o.date?(t.resolve({}),t.promise()):o.status?t.reject({code:"illegal_status_in_changeset_update"}).promise():o.date&&o.autosave?t.reject({code:"illegal_autosave_with_date_gmt"}).promise():(ee.state("processing").set(ee.state("processing").get()+1),t.always(function(){ee.state("processing").set(ee.state("processing").get()-1)}),delete(a=ee.previewer.query({excludeCustomizedSaved:!0})).customized,_.extend(a,{nonce:ee.settings.nonce.save,customize_theme:ee.settings.theme.stylesheet,customize_changeset_data:JSON.stringify(s)}),null!==o.title&&(a.customize_changeset_title=o.title),null!==o.date&&(a.customize_changeset_date=o.date),!1!==o.autosave&&(a.customize_changeset_autosave="true"),ee.trigger("save-request-params",a),(i=wp.ajax.post("customize_save",a)).done(function(e){var n={};ee._lastSavedRevision=Math.max(ee._latestRevision,ee._lastSavedRevision),ee.state("changesetStatus").set(e.changeset_status),e.changeset_date&&ee.state("changesetDate").set(e.changeset_date),t.resolve(e),ee.trigger("changeset-saved",e),e.setting_validities&&_.each(e.setting_validities,function(e,t){!0===e&&_.isObject(s[t])&&!_.isUndefined(s[t].value)&&(n[t]=s[t].value)}),ee.previewer.send("changeset-saved",_.extend({},e,{saved_changeset_values:n}))}),i.fail(function(e){t.reject(e),ee.trigger("changeset-error",e)}),i.always(function(e){e.setting_validities&&ee._handleSettingValidities({settingValidities:e.setting_validities})}),t.promise()))},ee.utils.bubbleChildValueChanges=function(n,e){Z.each(e,function(e,t){n[t].bind(function(e,t){n.parent&&e!==t&&n.parent.trigger("change",n)})})},t=function(e){var t,n,i,a;t=this,i=function(){var e;e=(t.extended(ee.Panel)||t.extended(ee.Section))&&t.expanded&&t.expanded()?t.contentContainer:t.container,0===(a=e.find(".control-focus:first")).length&&(a=e.find("input, select, textarea, button, object, a[href], [tabindex]").filter(":visible").first()),a.focus()},(e=e||{}).completeCallback?(n=e.completeCallback,e.completeCallback=function(){i(),n()}):e.completeCallback=i,ee.state("paneVisible").set(!0),t.expand?t.expand(e):e.completeCallback()},ee.utils.prioritySort=function(e,t){return e.priority()===t.priority()&&"number"==typeof e.params.instanceNumber&&"number"==typeof t.params.instanceNumber?e.params.instanceNumber-t.params.instanceNumber:e.priority()-t.priority()},ee.utils.isKeydownButNotEnterEvent=function(e){return"keydown"===e.type&&13!==e.which},ee.utils.areElementListsEqual=function(e,t){return e.length===t.length&&-1===_.indexOf(_.map(_.zip(e,t),function(e){return Z(e[0]).is(e[1])}),!1)},ee.utils.highlightButton=function(e,t){var n,i="button-see-me",a=!1;function o(){a=!0}return(n=_.extend({delay:0,focusTarget:e},t)).focusTarget.on("focusin",o),setTimeout(function(){n.focusTarget.off("focusin",o),a||(e.addClass(i),e.one("animationend",function(){e.removeClass(i)}))},n.delay),o},ee.utils.getCurrentTimestamp=function(){var e,t,n;return t=_.now(),e=new Date(ee.settings.initialServerDate.replace(/-/g,"/")),n=t-ee.settings.initialClientTimestamp,n+=ee.settings.initialClientTimestamp-ee.settings.initialServerTimestamp,e.setTime(e.getTime()+n),e.getTime()},ee.utils.getRemainingTime=function(e){var t;return t=(e instanceof Date?e.getTime():"string"==typeof e?new Date(e.replace(/-/g,"/")).getTime():e)-ee.utils.getCurrentTimestamp(),t=Math.ceil(t/1e3)},n=document.createElement("div"),i={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"},s=(o=_.find(_.keys(i),function(e){return!_.isUndefined(n.style[e])}))?i[o]:null,a=ee.Class.extend({defaultActiveArguments:{duration:"fast",completeCallback:Z.noop},defaultExpandedArguments:{duration:"fast",completeCallback:Z.noop},containerType:"container",defaults:{title:"",description:"",priority:100,type:"default",content:null,active:!0,instanceNumber:null},initialize:function(e,t){var n=this;n.id=e,a.instanceCounter||(a.instanceCounter=0),a.instanceCounter++,Z.extend(n,{params:_.defaults(t.params||t,n.defaults)}),n.params.instanceNumber||(n.params.instanceNumber=a.instanceCounter),n.notifications=new ee.Notifications,n.templateSelector=n.params.templateId||"customize-"+n.containerType+"-"+n.params.type,n.container=Z(n.params.content),0===n.container.length&&(n.container=Z(n.getContainer())),n.headContainer=n.container,n.contentContainer=n.getContent(),n.container=n.container.add(n.contentContainer),n.deferred={embedded:new Z.Deferred},n.priority=new ee.Value,n.active=new ee.Value,n.activeArgumentsQueue=[],n.expanded=new ee.Value,n.expandedArgumentsQueue=[],n.active.bind(function(e){var t=n.activeArgumentsQueue.shift();t=Z.extend({},n.defaultActiveArguments,t),e=e&&n.isContextuallyActive(),n.onChangeActive(e,t)}),n.expanded.bind(function(e){var t=n.expandedArgumentsQueue.shift();t=Z.extend({},n.defaultExpandedArguments,t),n.onChangeExpanded(e,t)}),n.deferred.embedded.done(function(){n.setupNotifications(),n.attachEvents()}),ee.utils.bubbleChildValueChanges(n,["priority","active"]),n.priority.set(n.params.priority),n.active.set(n.params.active),n.expanded.set(!1)},getNotificationsContainerElement:function(){return this.contentContainer.find(".customize-control-notifications-container:first")},setupNotifications:function(){var e,t=this;t.notifications.container=t.getNotificationsContainerElement(),e=function(){t.expanded.get()&&t.notifications.render()},t.expanded.bind(e),e(),t.notifications.bind("change",_.debounce(e))},ready:function(){},_children:function(t,e){var n=this,i=[];return ee[e].each(function(e){e[t].get()===n.id&&i.push(e)}),i.sort(ee.utils.prioritySort),i},isContextuallyActive:function(){throw new Error("Container.isContextuallyActive() must be overridden in a subclass.")},onChangeActive:function(e,t){var n,i=this,a=i.headContainer;t.unchanged?t.completeCallback&&t.completeCallback():(n="resolved"===ee.previewer.deferred.active.state()?t.duration:0,i.extended(ee.Panel)&&(ee.panel.each(function(e){e!==i&&e.expanded()&&(e,n=0)}),e||_.each(i.sections(),function(e){e.collapse({duration:0})})),Z.contains(document,a.get(0))?e?a.slideDown(n,t.completeCallback):i.expanded()?i.collapse({duration:n,completeCallback:function(){a.slideUp(n,t.completeCallback)}}):a.slideUp(n,t.completeCallback):(a.toggle(e),t.completeCallback&&t.completeCallback()))},_toggleActive:function(e,t){return t=t||{},e&&this.active.get()||!e&&!this.active.get()?(t.unchanged=!0,this.onChangeActive(this.active.get(),t),!1):(t.unchanged=!1,this.activeArgumentsQueue.push(t),this.active.set(e),!0)},activate:function(e){return this._toggleActive(!0,e)},deactivate:function(e){return this._toggleActive(!1,e)},onChangeExpanded:function(){throw new Error("Must override with subclass.")},_toggleExpanded:function(e,t){var n,i=this;return n=(t=t||{}).completeCallback,!(e&&!i.active())&&(ee.state("paneVisible").set(!0),t.completeCallback=function(){n&&n.apply(i,arguments),e?i.container.trigger("expanded"):i.container.trigger("collapsed")},e&&i.expanded.get()||!e&&!i.expanded.get()?(t.unchanged=!0,i.onChangeExpanded(i.expanded.get(),t),!1):(t.unchanged=!1,i.expandedArgumentsQueue.push(t),i.expanded.set(e),!0))},expand:function(e){return this._toggleExpanded(!0,e)},collapse:function(e){return this._toggleExpanded(!1,e)},_animateChangeExpanded:function(t){if(s){var n,i,a=this,o=a.contentContainer,e=o.closest(".wp-full-overlay");n=e.add(o),(!a.panel||""===a.panel()||!!ee.panel(a.panel()).contentContainer.hasClass("skip-transition"))&&(n=n.add("#customize-info, .customize-pane-parent")),i=function(e){2===e.eventPhase&&Z(e.target).is(o)&&(o.off(s,i),n.removeClass("busy"),t&&t())},o.on(s,i),n.addClass("busy"),_.defer(function(){var e=o.closest(".wp-full-overlay-sidebar-content"),t=e.scrollTop(),n=o.data("previous-scrollTop")||0,i=a.expanded();i&&0"},getContent:function(){var e=this.container,t=e.find(".accordion-section-content, .control-panel-content").first(),n="sub-"+e.attr("id"),i=n,a=e.attr("aria-owns");return a&&(i=i+" "+a),e.attr("aria-owns",i),t.detach().attr({id:n,class:"customize-pane-child "+t.attr("class")+" "+e.attr("class")})}}),ee.Section=a.extend({containerType:"section",containerParent:"#customize-theme-controls",containerPaneParent:".customize-pane-parent",defaults:{title:"",description:"",priority:100,type:"default",content:null,active:!0,instanceNumber:null,panel:null,customizeAction:""},initialize:function(e,t){var n,i=this;(n=t.params||t).type||_.find(ee.sectionConstructor,function(e,t){return e===i.constructor&&(n.type=t,!0)}),a.prototype.initialize.call(i,e,n),i.id=e,i.panel=new ee.Value,i.panel.bind(function(e){Z(i.headContainer).toggleClass("control-subsection",!!e)}),i.panel.set(i.params.panel||""),ee.utils.bubbleChildValueChanges(i,["panel"]),i.embed(),i.deferred.embedded.done(function(){i.ready()})},embed:function(){var e,n=this;n.containerParent=ee.ensure(n.containerParent),e=function(e){var t;e?ee.panel(e,function(e){e.deferred.embedded.done(function(){t=e.contentContainer,n.headContainer.parent().is(t)||t.append(n.headContainer),n.contentContainer.parent().is(n.headContainer)||n.containerParent.append(n.contentContainer),n.deferred.embedded.resolve()})}):(t=ee.ensure(n.containerPaneParent),n.headContainer.parent().is(t)||t.append(n.headContainer),n.contentContainer.parent().is(n.headContainer)||n.containerParent.append(n.contentContainer),n.deferred.embedded.resolve())},n.panel.bind(e),e(n.panel.get())},attachEvents:function(){var e,t,n=this;n.container.hasClass("cannot-expand")||(n.container.find(".accordion-section-title, .customize-section-back").on("click keydown",function(e){ee.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.expanded()?n.collapse():n.expand())}),n.container.find(".customize-section-title .customize-help-toggle").on("click",function(){(e=n.container.find(".section-meta")).hasClass("cannot-expand")||((t=e.find(".customize-section-description:first")).toggleClass("open"),t.slideToggle(n.defaultExpandedArguments.duration,function(){t.trigger("toggled")}),Z(this).attr("aria-expanded",function(e,t){return"true"===t?"false":"true"}))}))},isContextuallyActive:function(){var e=this.controls(),t=0;return _(e).each(function(e){e.active()&&(t+=1)}),0!==t},controls:function(){return this._children("section","control")},onChangeExpanded:function(e,t){var n,i,a=this,o=a.headContainer.closest(".wp-full-overlay-sidebar-content"),s=a.contentContainer,r=a.headContainer.closest(".wp-full-overlay"),c=s.find(".customize-section-back"),l=a.headContainer.find(".accordion-section-title").first();e&&!s.hasClass("open")?(n=t.unchanged?t.completeCallback:Z.proxy(function(){a._animateChangeExpanded(function(){l.attr("tabindex","-1"),c.attr("tabindex","0"),c.focus(),s.css("top",""),o.scrollTop(0),t.completeCallback&&t.completeCallback()}),s.addClass("open"),r.addClass("section-open"),ee.state("expandedSection").set(a)},this),t.allowMultiple||ee.section.each(function(e){e!==a&&e.collapse({duration:t.duration})}),a.panel()?ee.panel(a.panel()).expand({duration:t.duration,completeCallback:n}):(t.allowMultiple||ee.panel.each(function(e){e.collapse()}),n())):!e&&s.hasClass("open")?(a.panel()&&(i=ee.panel(a.panel())).contentContainer.hasClass("skip-transition")&&i.collapse(),a._animateChangeExpanded(function(){c.attr("tabindex","-1"),l.attr("tabindex","0"),l.focus(),s.css("top",""),t.completeCallback&&t.completeCallback()}),s.removeClass("open"),r.removeClass("section-open"),a===ee.state("expandedSection").get()&&ee.state("expandedSection").set(!1)):t.completeCallback&&t.completeCallback()}}),ee.ThemesSection=ee.Section.extend({currentTheme:"",overlay:"",template:"",screenshotQueue:null,$window:null,$body:null,loaded:0,loading:!1,fullyLoaded:!1,term:"",tags:"",nextTerm:"",nextTags:"",filtersHeight:0,headerContainer:null,updateCountDebounced:null,initialize:function(e,t){var n=this;n.headerContainer=Z(),n.$window=Z(window),n.$body=Z(document.body),ee.Section.prototype.initialize.call(n,e,t),n.updateCountDebounced=_.debounce(n.updateCount,500)},embed:function(){var e,n=this;e=function(e){var t;ee.panel(e,function(e){e.deferred.embedded.done(function(){t=e.contentContainer,n.headContainer.parent().is(t)||t.find(".customize-themes-full-container-container").before(n.headContainer),n.contentContainer.parent().is(n.headContainer)||n.containerParent.append(n.contentContainer),n.deferred.embedded.resolve()})})},n.panel.bind(e),e(n.panel.get())},ready:function(){var t=this;t.overlay=t.container.find(".theme-overlay"),t.template=wp.template("customize-themes-details-view"),t.container.on("keydown",function(e){t.overlay.find(".theme-wrap").is(":visible")&&(39===e.keyCode&&t.nextTheme(),37===e.keyCode&&t.previousTheme(),27===e.keyCode&&(t.$body.hasClass("modal-open")?t.closeDetails():t.headerContainer.find(".customize-themes-section-title").focus(),e.stopPropagation()))}),t.renderScreenshots=_.throttle(t.renderScreenshots,100),_.bindAll(t,"renderScreenshots","loadMore","checkTerm","filtersChecked")},isContextuallyActive:function(){return this.active()},attachEvents:function(){var e,a=this;function t(){var e=a.headerContainer.find(".customize-themes-section-title");e.toggleClass("selected",a.expanded()),e.attr("aria-expanded",a.expanded()?"true":"false"),a.expanded()||e.removeClass("details-open")}a.container.find(".customize-section-back").on("click keydown",function(e){ee.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),a.collapse())}),a.headerContainer=Z("#accordion-section-"+a.id),a.headerContainer.on("click",".customize-themes-section-title",function(){a.headerContainer.find(".filter-details").length&&(a.headerContainer.find(".customize-themes-section-title").toggleClass("details-open").attr("aria-expanded",function(e,t){return"true"===t?"false":"true"}),a.headerContainer.find(".filter-details").slideToggle(180)),a.expanded()||a.expand()}),a.container.on("click",".theme-actions .preview-theme",function(){ee.panel("themes").loadThemePreview(Z(this).data("slug"))}),a.container.on("click",".left",function(){a.previousTheme()}),a.container.on("click",".right",function(){a.nextTheme()}),a.container.on("click",".theme-backdrop, .close",function(){a.closeDetails()}),"local"===a.params.filter_type?a.container.on("input",".wp-filter-search-themes",function(e){a.filterSearch(e.currentTarget.value)}):"remote"===a.params.filter_type&&(e=_.debounce(a.checkTerm,500),a.contentContainer.on("input",".wp-filter-search",function(){ee.panel("themes").expanded()&&(e(a),a.expanded()||a.expand())}),a.contentContainer.on("click",".filter-group input",function(){a.filtersChecked(),a.checkTerm(a)})),a.contentContainer.on("click",".feature-filter-toggle",function(e){var t=Z(".customize-themes-full-container"),n=Z(e.currentTarget);if(a.filtersHeight=n.parent().next(".filter-drawer").height(),!(0 .accordion-section-title .customize-help-toggle").on("click",function(){if(!t.hasClass("cannot-expand")){var e=t.find(".customize-panel-description:first");t.hasClass("open")?(t.toggleClass("open"),e.slideUp(n.defaultExpandedArguments.duration,function(){e.trigger("toggled")}),Z(this).attr("aria-expanded",!1)):(e.slideDown(n.defaultExpandedArguments.duration,function(){e.trigger("toggled")}),t.toggleClass("open"),Z(this).attr("aria-expanded",!0))}})},sections:function(){return this._children("panel","section")},isContextuallyActive:function(){var e=this.sections(),t=0;return _(e).each(function(e){e.active()&&e.isContextuallyActive()&&(t+=1)}),0!==t},onChangeExpanded:function(e,t){if(t.unchanged)t.completeCallback&&t.completeCallback();else{var n=this,i=n.contentContainer,a=i.closest(".wp-full-overlay"),o=i.closest(".wp-full-overlay-sidebar-content"),s=n.headContainer.find(".accordion-section-title"),r=i.find(".customize-panel-back"),c=n.sections();e&&!i.hasClass("current-panel")?(ee.section.each(function(e){n.id!==e.panel()&&e.collapse({duration:0})}),ee.panel.each(function(e){n!==e&&e.collapse({duration:0})}),n.params.autoExpandSoleSection&&1===c.length&&c[0].active.get()?(i.addClass("current-panel skip-transition"),a.addClass("in-sub-panel"),c[0].expand({completeCallback:t.completeCallback})):(n._animateChangeExpanded(function(){s.attr("tabindex","-1"),r.attr("tabindex","0"),r.focus(),i.css("top",""),o.scrollTop(0),t.completeCallback&&t.completeCallback()}),i.addClass("current-panel"),a.addClass("in-sub-panel")),ee.state("expandedPanel").set(n)):!e&&i.hasClass("current-panel")&&(i.hasClass("skip-transition")?i.removeClass("skip-transition"):n._animateChangeExpanded(function(){s.attr("tabindex","0"),r.attr("tabindex","-1"),s.focus(),i.css("top",""),t.completeCallback&&t.completeCallback()}),a.removeClass("in-sub-panel"),i.removeClass("current-panel"),n===ee.state("expandedPanel").get()&&ee.state("expandedPanel").set(!1))}},renderContent:function(){var e,t=this;(e=0!==Z("#tmpl-"+t.templateSelector+"-content").length?wp.template(t.templateSelector+"-content"):wp.template("customize-panel-default-content"))&&t.headContainer&&t.contentContainer.html(e(_.extend({id:t.id},t.params)))}}),ee.ThemesPanel=ee.Panel.extend({initialize:function(e,t){this.installingThemes=[],ee.Panel.prototype.initialize.call(this,e,t)},canSwitchTheme:function(e){return!(!e||e!==ee.settings.theme.stylesheet)||"publish"===ee.state("selectedChangesetStatus").get()&&(""===ee.state("changesetStatus").get()||"auto-draft"===ee.state("changesetStatus").get())},attachEvents:function(){var t=this;function e(){t.canSwitchTheme()?t.notifications.remove("theme_switch_unavailable"):t.notifications.add(new ee.Notification("theme_switch_unavailable",{message:ee.l10n.themePreviewUnavailable,type:"warning"}))}ee.Panel.prototype.attachEvents.apply(t),ee.settings.theme._canInstall&&ee.settings.theme._filesystemCredentialsNeeded&&t.notifications.add(new ee.Notification("theme_install_unavailable",{message:ee.l10n.themeInstallUnavailable,type:"info",dismissible:!0})),e(),ee.state("selectedChangesetStatus").bind(e),ee.state("changesetStatus").bind(e),t.contentContainer.on("click",".customize-theme",function(){t.collapse()}),t.contentContainer.on("click",".customize-themes-section-title, .customize-themes-mobile-back",function(){Z(".wp-full-overlay").toggleClass("showing-themes")}),t.contentContainer.on("click",".theme-install",function(e){t.installTheme(e)}),t.contentContainer.on("click",".update-theme, #update-theme",function(e){e.preventDefault(),e.stopPropagation(),t.updateTheme(e)}),t.contentContainer.on("click",".delete-theme",function(e){t.deleteTheme(e)}),_.bindAll(t,"installTheme","updateTheme")},onChangeExpanded:function(e,t){var n,i,a=!1;ee.Panel.prototype.onChangeExpanded.apply(this,[e,t]),t.unchanged?t.completeCallback&&t.completeCallback():(n=this.headContainer.closest(".wp-full-overlay"),e?(n.addClass("in-themes-panel").delay(200).find(".customize-themes-full-container").addClass("animate"),_.delay(function(){n.addClass("themes-panel-expanded")},200),600",{id:"customize-control-"+e.replace(/]/g,"").replace(/\[/g,"-"),class:"customize-control customize-control-"+a.params.type})),a.id=e,a.selector="#customize-control-"+e.replace(/\]/g,"").replace(/\[/g,"-"),a.params.content?a.container=Z(a.params.content):a.container=Z(a.selector),a.params.templateId?a.templateSelector=a.params.templateId:a.templateSelector="customize-control-"+a.params.type+"-content",a.deferred=_.extend(a.deferred||{},{embedded:new Z.Deferred}),a.section=new ee.Value,a.priority=new ee.Value,a.active=new ee.Value,a.activeArgumentsQueue=[],a.notifications=new ee.Notifications({alt:a.altNotice}),a.elements=[],a.active.bind(function(e){var t=a.activeArgumentsQueue.shift();t=Z.extend({},a.defaultActiveArguments,t),a.onChangeActive(e,t)}),a.section.set(a.params.section),a.priority.set(isNaN(a.params.priority)?10:a.params.priority),a.active.set(a.params.active),ee.utils.bubbleChildValueChanges(a,["section","priority","active"]),a.settings={},n={},a.params.setting&&(n.default=a.params.setting),_.extend(n,a.params.settings),_.each(n,function(e,t){var n;_.isObject(e)&&_.isFunction(e.extended)&&e.extended(ee.Value)?a.settings[t]=e:_.isString(e)&&((n=ee(e))?a.settings[t]=n:o.push(e))}),i=function(){_.each(n,function(e,t){!a.settings[t]&&_.isString(e)&&(a.settings[t]=ee(e))}),a.settings[0]&&!a.settings.default&&(a.settings.default=a.settings[0]),a.setting=a.settings.default||null,a.linkElements(),a.embed()},0===o.length?i():ee.apply(ee,o.concat(i)),a.deferred.embedded.done(function(){a.linkElements(),a.setupNotifications(),a.ready()})},linkElements:function(){var i,a,o,s=this;i=s.container.find("[data-customize-setting-link], [data-customize-setting-key-link]"),a={},i.each(function(){var e,t,n=Z(this);if(!n.data("customizeSettingLinked")){if(n.data("customizeSettingLinked",!0),n.is(":radio")){if(e=n.prop("name"),a[e])return;a[e]=!0,n=i.filter('[name="'+e+'"]')}n.data("customizeSettingLink")?t=ee(n.data("customizeSettingLink")):n.data("customizeSettingKeyLink")&&(t=s.settings[n.data("customizeSettingKeyLink")]),t&&(o=new ee.Element(n),s.elements.push(o),o.sync(t),o.set(t()))}})},embed:function(){var e,n=this;e=function(e){var t;e&&ee.section(e,function(e){e.deferred.embedded.done(function(){t=e.contentContainer.is("ul")?e.contentContainer:e.contentContainer.find("ul:first"),n.container.parent().is(t)||(t.append(n.container),n.renderContent()),n.deferred.embedded.resolve()})})},n.section.bind(e),e(n.section.get())},ready:function(){var t,n=this;"dropdown-pages"===n.params.type&&n.params.allow_addition&&((t=n.container.find(".new-content-item")).hide(),n.container.on("click",".add-new-toggle",function(e){Z(e.currentTarget).slideUp(180),t.slideDown(180),t.find(".create-item-input").focus()}),n.container.on("click",".add-content",function(){n.addNewPage()}),n.container.on("keydown",".create-item-input",function(e){13===e.which&&n.addNewPage()}))},getNotificationsContainerElement:function(){var e,t,n=this;return(t=n.container.find(".customize-control-notifications-container:first")).length||(t=Z(''),n.container.hasClass("customize-control-nav_menu_item")?n.container.find(".menu-item-settings:first").prepend(t):n.container.hasClass("customize-control-widget_form")?n.container.find(".widget-inside:first").prepend(t):(e=n.container.find(".customize-control-title")).length?e.after(t):n.container.prepend(t)),t},setupNotifications:function(){var n,e,i=this;_.each(i.settings,function(n){n.notifications&&(n.notifications.bind("add",function(e){var t=_.extend({},e,{setting:n.id});i.notifications.add(new ee.Notification(n.id+":"+e.code,t))}),n.notifications.bind("remove",function(e){i.notifications.remove(n.id+":"+e.code)}))}),n=function(){var e=i.section();(!e||ee.section.has(e)&&ee.section(e).expanded())&&i.notifications.render()},i.notifications.bind("rendered",function(){var e=i.notifications.get();i.container.toggleClass("has-notifications",0!==e.length),i.container.toggleClass("has-error",0!==_.where(e,{type:"error"}).length)}),e=function(e,t){t&&ee.section.has(t)&&ee.section(t).expanded.unbind(n),e&&ee.section(e,function(e){e.expanded.bind(n),n()})},i.section.bind(e),e(i.section.get()),i.notifications.bind("change",_.debounce(n))},renderNotifications:function(){var e,t,n=this,i=!1;"undefined"!=typeof console&&console.warn&&console.warn("[DEPRECATED] wp.customize.Control.prototype.renderNotifications() is deprecated in favor of instantating a wp.customize.Notifications and calling its render() method."),(e=n.getNotificationsContainerElement())&&e.length&&(t=[],n.notifications.each(function(e){t.push(e),"error"===e.type&&(i=!0)}),0===t.length?e.stop().slideUp("fast"):e.stop().slideDown("fast",null,function(){Z(this).css("height","auto")}),n.notificationsTemplate||(n.notificationsTemplate=wp.template("customize-control-notifications")),n.container.toggleClass("has-notifications",0!==t.length),n.container.toggleClass("has-error",i),e.empty().append(Z.trim(n.notificationsTemplate({notifications:t,altNotice:Boolean(n.altNotice)}))))},expand:function(e){ee.section(this.section()).expand(e)},focus:t,onChangeActive:function(e,t){t.unchanged?t.completeCallback&&t.completeCallback():Z.contains(document,this.container[0])?e?this.container.slideDown(t.duration,t.completeCallback):this.container.slideUp(t.duration,t.completeCallback):(this.container.toggle(e),t.completeCallback&&t.completeCallback())},toggle:function(e){return this.onChangeActive(e,this.defaultActiveArguments)},activate:a.prototype.activate,deactivate:a.prototype.deactivate,_toggleActive:a.prototype._toggleActive,dropdownInit:function(){function e(e){"string"==typeof e&&i.statuses&&i.statuses[e]?n.html(i.statuses[e]).show():n.hide()}var t=this,n=this.container.find(".dropdown-status"),i=this.params,a=!1;this.container.on("click keydown",".dropdown",function(e){ee.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),a||t.container.toggleClass("open"),t.container.hasClass("open")&&t.container.parent().parent().find("li.library-selected").focus(),a=!0,setTimeout(function(){a=!1},400))}),this.setting.bind(e),e(this.setting())},renderContent:function(){var e,t,n,i,a=this;t=["button","checkbox","date","datetime-local","email","month","number","password","radio","range","search","select","tel","time","text","textarea","week","url"],(n=a.templateSelector)==="customize-control-"+a.params.type+"-content"&&_.contains(t,a.params.type)&&!document.getElementById("tmpl-"+n)&&0===a.container.children().length&&(n="customize-control-default-content"),document.getElementById("tmpl-"+n)&&(e=wp.template(n))&&a.container&&a.container.html(e(a.params)),a.notifications.container=a.getNotificationsContainerElement(),(!(i=a.section())||ee.section.has(i)&&ee.section(i).expanded())&&a.notifications.render()},addNewPage:function(){var e,a,o,t,s,r,c=this;"dropdown-pages"===c.params.type&&c.params.allow_addition&&ee.Menus&&(a=c.container.find(".add-new-toggle"),o=c.container.find(".new-content-item"),t=c.container.find(".create-item-input"),s=t.val(),r=c.container.find("select"),s?(t.removeClass("invalid"),t.attr("disabled","disabled"),(e=ee.Menus.insertAutoDraftPost({post_title:s,post_type:"page"})).done(function(e){var t,n,i;t=new ee.Menus.AvailableItemModel({id:"post-"+e.post_id,title:s,type:"post_type",type_label:ee.Menus.data.l10n.page_label,object:"page",object_id:e.post_id,url:e.url}),ee.Menus.availableMenuItemsPanel.collection.add(t),n=Z("#available-menu-items-post_type-page").find(".available-menu-items-list"),i=wp.template("available-menu-item"),n.prepend(i(t.attributes)),r.focus(),c.setting.set(String(e.post_id)),o.slideUp(180),a.slideDown(180)}),e.always(function(){t.val("").removeAttr("disabled")})):t.addClass("invalid"))}}),ee.ColorControl=ee.Control.extend({ready:function(){var t,n=this,e="hue"===this.params.mode,i=!1;e?(t=this.container.find(".color-picker-hue")).val(n.setting()).wpColorPicker({change:function(e,t){i=!0,n.setting(t.color.h()),i=!1}}):(t=this.container.find(".color-picker-hex")).val(n.setting()).wpColorPicker({change:function(){i=!0,n.setting.set(t.wpColorPicker("color")),i=!1},clear:function(){i=!0,n.setting.set(""),i=!1}}),n.setting.bind(function(e){i||(t.val(e),t.wpColorPicker("color",e))}),n.container.on("keydown",function(e){27===e.which&&n.container.find(".wp-picker-container").hasClass("wp-picker-active")&&(t.wpColorPicker("close"),n.container.find(".wp-color-result").focus(),e.stopPropagation())})}}),ee.MediaControl=ee.Control.extend({ready:function(){var n=this;function e(e){var t=Z.Deferred();n.extended(ee.UploadControl)?t.resolve():(e=parseInt(e,10),_.isNaN(e)||e<=0?(delete n.params.attachment,t.resolve()):n.params.attachment&&n.params.attachment.id===e&&t.resolve()),"pending"===t.state()&&wp.media.attachment(e).fetch().done(function(){n.params.attachment=this.attributes,t.resolve(),wp.customize.previewer.send(n.setting.id+"-attachment-data",this.attributes)}),t.done(function(){n.renderContent()})}_.bindAll(n,"restoreDefault","removeFile","openFrame","select","pausePlayer"),n.container.on("click keydown",".upload-button",n.openFrame),n.container.on("click keydown",".upload-button",n.pausePlayer),n.container.on("click keydown",".thumbnail-image img",n.openFrame),n.container.on("click keydown",".default-button",n.restoreDefault),n.container.on("click keydown",".remove-button",n.pausePlayer),n.container.on("click keydown",".remove-button",n.removeFile),n.container.on("click keydown",".remove-button",n.cleanupPlayer),ee.section(n.section()).container.on("expanded",function(){n.player&&n.player.setControlsSize()}).on("collapsed",function(){n.pausePlayer()}),e(n.setting()),n.setting.bind(e)},pausePlayer:function(){this.player&&this.player.pause()},cleanupPlayer:function(){this.player&&wp.media.mixin.removePlayer(this.player)},openFrame:function(e){ee.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),this.frame||this.initFrame(),this.frame.open())},initFrame:function(){this.frame=wp.media({button:{text:this.params.button_labels.frame_button},states:[new wp.media.controller.Library({title:this.params.button_labels.frame_title,library:wp.media.query({type:this.params.mime_type}),multiple:!1,date:!1})]}),this.frame.on("select",this.select)},select:function(){var e,t=this.frame.state().get("selection").first().toJSON(),n=window._wpmejsSettings||{};this.params.attachment=t,this.setting(t.id),(e=this.container.find("audio, video").get(0))?this.player=new MediaElementPlayer(e,n):this.cleanupPlayer()},restoreDefault:function(e){ee.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),this.params.attachment=this.params.defaultAttachment,this.setting(this.params.defaultAttachment.url))},removeFile:function(e){ee.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),this.params.attachment={},this.setting(""),this.renderContent())}}),ee.UploadControl=ee.MediaControl.extend({select:function(){var e,t=this.frame.state().get("selection").first().toJSON(),n=window._wpmejsSettings||{};this.params.attachment=t,this.setting(t.url),(e=this.container.find("audio, video").get(0))?this.player=new MediaElementPlayer(e,n):this.cleanupPlayer()},success:function(){},removerVisibility:function(){}}),ee.ImageControl=ee.UploadControl.extend({thumbnailSrc:function(){}}),ee.BackgroundControl=ee.UploadControl.extend({ready:function(){ee.UploadControl.prototype.ready.apply(this,arguments)},select:function(){ee.UploadControl.prototype.select.apply(this,arguments),wp.ajax.post("custom-background-add",{nonce:_wpCustomizeBackground.nonces.add,wp_customize:"on",customize_theme:ee.settings.theme.stylesheet,attachment_id:this.params.attachment.id})}}),ee.BackgroundPositionControl=ee.Control.extend({ready:function(){var e,i=this;i.container.on("change",'input[name="background-position"]',function(){var e=Z(this).val().split(" ");i.settings.x(e[0]),i.settings.y(e[1])}),e=_.debounce(function(){var e,t,n;e=i.settings.x.get(),t=i.settings.y.get(),n=String(e)+" "+String(t),i.container.find('input[name="background-position"][value="'+n+'"]').click()}),i.settings.x.bind(e),i.settings.y.bind(e),e()}}),ee.CroppedImageControl=ee.MediaControl.extend({openFrame:function(e){ee.utils.isKeydownButNotEnterEvent(e)||(this.initFrame(),this.frame.setState("library").open())},initFrame:function(){var e=_wpMediaViewsL10n;this.frame=wp.media({button:{text:e.select,close:!1},states:[new wp.media.controller.Library({title:this.params.button_labels.frame_title,library:wp.media.query({type:"image"}),multiple:!1,date:!1,priority:20,suggestedWidth:this.params.width,suggestedHeight:this.params.height}),new wp.media.controller.CustomizeImageCropper({imgSelectOptions:this.calculateImageSelectOptions,control:this})]}),this.frame.on("select",this.onSelect,this),this.frame.on("cropped",this.onCropped,this),this.frame.on("skippedcrop",this.onSkippedCrop,this)},onSelect:function(){var e=this.frame.state().get("selection").first().toJSON();this.params.width!==e.width||this.params.height!==e.height||this.params.flex_width||this.params.flex_height?this.frame.setState("cropper"):(this.setImageFromAttachment(e),this.frame.close())},onCropped:function(e){this.setImageFromAttachment(e)},calculateImageSelectOptions:function(e,t){var n,i,a,o=t.get("control"),s=!!parseInt(o.params.flex_width,10),r=!!parseInt(o.params.flex_height,10),c=e.get("width"),l=e.get("height"),d=parseInt(o.params.width,10),u=parseInt(o.params.height,10),p=d/u,h=d,f=u;return t.set("canSkipCrop",!o.mustBeCropped(s,r,d,u,c,l)),p",{title:ee.l10n.previewIframeTitle,name:"customize-"+a.channel()}),a.iframe.attr("onmousewheel",""),a.iframe.attr("sandbox","allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-presentation allow-same-origin allow-scripts"),c?a.iframe.attr("data-src",e.href):a.iframe.attr("src",e.href),a.iframe.appendTo(a.container),a.targetWindow(a.iframe[0].contentWindow),c&&((i=Z("