芝麻web文件管理V1.00
编辑当前文件:/var/www/website.cognitioglobal.co/wp-admin/js/customize-controls.min.js
/*! This file is auto-generated */ !function(J){var a,s,t,e,n,i,Y=wp.customize,o=window.matchMedia("(prefers-reduced-motion: reduce)"),r=o.matches;o.addEventListener("change",function(e){r=e.matches}),Y.OverlayNotification=Y.Notification.extend({loading:!1,initialize:function(e,t){var n=this;Y.Notification.prototype.initialize.call(n,e,t),n.containerClasses+=" notification-overlay",n.loading&&(n.containerClasses+=" notification-loading")},render:function(){var e=Y.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)}}),Y.Notifications=Y.Values.extend({alt:!1,defaultConstructor:Y.Notification,initialize:function(e){var t=this;Y.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=this,t="string"==typeof e?(n=e,t):(n=e.code,e);return i.has(n)||(i._addedIncrement+=1,i._addedOrder[n]=i._addedIncrement),Y.Values.prototype.add.call(i,n,t)},remove:function(e){return delete this._addedOrder[e],Y.Values.prototype.remove.call(this,e)},get:function(e){var a,o=this,t=_.values(o._value);return _.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(n=_.isUndefined(a[e.type])?n:a[e.type])!==(i=_.isUndefined(a[t.type])?i:a[t.type])?i-n:o._addedOrder[t.code]-o._addedOrder[e.code]})),t},render:function(){var e,t,n,i=this,a=!1,o=[],s={};i.container&&i.container.length&&(e=i.get({sort:!0}),i.container.toggle(0!==e.length),i.container.is(i.previousContainer)&&_.isEqual(e,i.previousNotifications)||((n=i.container.children("ul").first()).length||(n=J("
"),i.container.append(n)),n.find("> [data-code]").remove(),_.each(i.previousNotifications,function(e){s[e.code]=e}),_.each(e,function(e){var t;!wp.a11y||s[e.code]&&_.isEqual(e.message,s[e.code].message)||wp.a11y.speak(e.message,"assertive"),t=J(e.render()),e.container=t,n.append(t),e.extended(Y.OverlayNotification)&&o.push(e)}),(t=Boolean(o.length))!==(a=i.previousNotifications?Boolean(_.find(i.previousNotifications,function(e){return e.extended(Y.OverlayNotification)})):a)&&(J(document.body).toggleClass("customize-loading",t),i.container.toggleClass("has-overlay-notifications",t),t?(i.previousActiveElement=document.activeElement,J(document).on("keydown",i.constrainFocus)):J(document).off("keydown",i.constrainFocus)),t?(i.focusContainer=o[o.length-1].container,i.focusContainer.prop("tabIndex",-1),((a=i.focusContainer.find(":focusable")).length?a.first():i.focusContainer).focus()):i.previousActiveElement&&(J(i.previousActiveElement).trigger("focus"),i.previousActiveElement=null),i.previousNotifications=e,i.previousContainer=i.container,i.trigger("rendered")))},constrainFocus:function(e){var t,n=this;e.stopPropagation(),9===e.which&&(0===(t=n.focusContainer.find(":focusable")).length&&(t=n.focusContainer),!J.contains(n.focusContainer[0],e.target)||!J.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()))}}),Y.Setting=Y.Value.extend({defaults:{transport:"refresh",dirty:!1},initialize:function(e,t,n){var i=this,n=_.extend({previewer:Y.previewer},i.defaults,n||{});Y.Value.prototype.initialize.call(i,t,n),i.id=e,i._dirty=n.dirty,i.notifications=new Y.Notifications,i.bind(i.preview)},preview:function(){var e=this,t=e.transport;"postMessage"===(t="postMessage"!==t||Y.state("previewerAlive").get()?t:"refresh")?e.previewer.send("setting",[e.id,e()]):"refresh"===t&&e.previewer.refresh()},findControls:function(){var n=this,i=[];return Y.control.each(function(t){_.each(t.settings,function(e){e.id===n.id&&i.push(t)})}),i}}),Y._latestRevision=0,Y._lastSavedRevision=0,Y._latestSettingRevisions={},Y.bind("change",function(e){Y._latestRevision+=1,Y._latestSettingRevisions[e.id]=Y._latestRevision}),Y.bind("ready",function(){Y.bind("add",function(e){e._dirty&&(Y._latestRevision+=1,Y._latestSettingRevisions[e.id]=Y._latestRevision)})}),Y.dirtyValues=function(n){var i={};return Y.each(function(e){var t;e._dirty&&(t=Y._latestSettingRevisions[e.id],Y.state("changesetStatus").get()&&n&&n.unsaved&&(_.isUndefined(t)||t<=Y._lastSavedRevision)||(i[e.id]=e.get()))}),i},Y.requestChangesetUpdate=function(n,e){var t,i={},a=new J.Deferred;if(0!==Y.state("processing").get())a.reject("already_processing");else if(e=_.extend({title:null,date:null,autosave:!1,force:!1},e),n&&_.extend(i,n),_.each(Y.dirtyValues({unsaved:!0}),function(e,t){n&&null===n[t]||(i[t]=_.extend({},i[t]||{},{value:e}))}),Y.trigger("changeset-save",i,e),!e.force&&_.isEmpty(i)&&null===e.title&&null===e.date)a.resolve({});else{if(e.status)return a.reject({code:"illegal_status_in_changeset_update"}).promise();if(e.date&&e.autosave)return a.reject({code:"illegal_autosave_with_date_gmt"}).promise();Y.state("processing").set(Y.state("processing").get()+1),a.always(function(){Y.state("processing").set(Y.state("processing").get()-1)}),delete(t=Y.previewer.query({excludeCustomizedSaved:!0})).customized,_.extend(t,{nonce:Y.settings.nonce.save,customize_theme:Y.settings.theme.stylesheet,customize_changeset_data:JSON.stringify(i)}),null!==e.title&&(t.customize_changeset_title=e.title),null!==e.date&&(t.customize_changeset_date=e.date),!1!==e.autosave&&(t.customize_changeset_autosave="true"),Y.trigger("save-request-params",t),(e=wp.ajax.post("customize_save",t)).done(function(e){var n={};Y._lastSavedRevision=Math.max(Y._latestRevision,Y._lastSavedRevision),Y.state("changesetStatus").set(e.changeset_status),e.changeset_date&&Y.state("changesetDate").set(e.changeset_date),a.resolve(e),Y.trigger("changeset-saved",e),e.setting_validities&&_.each(e.setting_validities,function(e,t){!0===e&&_.isObject(i[t])&&!_.isUndefined(i[t].value)&&(n[t]=i[t].value)}),Y.previewer.send("changeset-saved",_.extend({},e,{saved_changeset_values:n}))}),e.fail(function(e){a.reject(e),Y.trigger("changeset-error",e)}),e.always(function(e){e.setting_validities&&Y._handleSettingValidities({settingValidities:e.setting_validities})})}return a.promise()},Y.utils.bubbleChildValueChanges=function(n,e){J.each(e,function(e,t){n[t].bind(function(e,t){n.parent&&e!==t&&n.parent.trigger("change",n)})})},o=function(e){var t,n,i=this,a=function(){var e;i.extended(Y.Panel)&&1<(n=i.sections()).length&&n.forEach(function(e){e.expanded()&&e.collapse()}),e=(i.extended(Y.Panel)||i.extended(Y.Section))&&i.expanded&&i.expanded()?i.contentContainer:i.container,(n=0===(n=e.find(".control-focus:first")).length?e.find("input, select, textarea, button, object, a[href], [tabindex]").filter(":visible").first():n).focus()};(e=e||{}).completeCallback?(t=e.completeCallback,e.completeCallback=function(){a(),t()}):e.completeCallback=a,Y.state("paneVisible").set(!0),i.expand?i.expand(e):e.completeCallback()},Y.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()},Y.utils.isKeydownButNotEnterEvent=function(e){return"keydown"===e.type&&13!==e.which},Y.utils.areElementListsEqual=function(e,t){return e.length===t.length&&-1===_.indexOf(_.map(_.zip(e,t),function(e){return J(e[0]).is(e[1])}),!1)},Y.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},Y.utils.getCurrentTimestamp=function(){var e=_.now(),t=new Date(Y.settings.initialServerDate.replace(/-/g,"/")),e=e-Y.settings.initialClientTimestamp;return e+=Y.settings.initialClientTimestamp-Y.settings.initialServerTimestamp,t.setTime(t.getTime()+e),t.getTime()},Y.utils.getRemainingTime=function(e){e=e instanceof Date?e.getTime():"string"==typeof e?new Date(e.replace(/-/g,"/")).getTime():e,e-=Y.utils.getCurrentTimestamp();return Math.ceil(e/1e3)},t=document.createElement("div"),e={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"},n=_.find(_.keys(e),function(e){return!_.isUndefined(t.style[e])}),s=n?e[n]:null,a=Y.Class.extend({defaultActiveArguments:{duration:"fast",completeCallback:J.noop},defaultExpandedArguments:{duration:"fast",completeCallback:J.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++,J.extend(n,{params:_.defaults(t.params||t,n.defaults)}),n.params.instanceNumber||(n.params.instanceNumber=a.instanceCounter),n.notifications=new Y.Notifications,n.templateSelector=n.params.templateId||"customize-"+n.containerType+"-"+n.params.type,n.container=J(n.params.content),0===n.container.length&&(n.container=J(n.getContainer())),n.headContainer=n.container,n.contentContainer=n.getContent(),n.container=n.container.add(n.contentContainer),n.deferred={embedded:new J.Deferred},n.priority=new Y.Value,n.active=new Y.Value,n.activeArgumentsQueue=[],n.expanded=new Y.Value,n.expandedArgumentsQueue=[],n.active.bind(function(e){var t=n.activeArgumentsQueue.shift(),t=J.extend({},n.defaultActiveArguments,t);e=e&&n.isContextuallyActive(),n.onChangeActive(e,t)}),n.expanded.bind(function(e){var t=n.expandedArgumentsQueue.shift(),t=J.extend({},n.defaultExpandedArguments,t);n.onChangeExpanded(e,t)}),n.deferred.embedded.done(function(){n.setupNotifications(),n.attachEvents()}),Y.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(),t.expanded.bind(e=function(){t.expanded.get()&&t.notifications.render()}),e(),t.notifications.bind("change",_.debounce(e))},ready:function(){},_children:function(t,e){var n=this,i=[];return Y[e].each(function(e){e[t].get()===n.id&&i.push(e)}),i.sort(Y.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"===Y.previewer.deferred.active.state()?t.duration:0,i.extended(Y.Panel)&&(Y.panel.each(function(e){e!==i&&e.expanded()&&(n=0)}),e||_.each(i.sections(),function(e){e.collapse({duration:0})})),J.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()||(Y.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){var a,o,n,i;!s||r?_.defer(function(){t&&t()}):(o=(a=this).contentContainer,i=o.closest(".wp-full-overlay").add(o),a.panel&&""!==a.panel()&&!Y.panel(a.panel()).contentContainer.hasClass("skip-transition")||(i=i.add("#customize-info, .customize-pane-parent")),n=function(e){2===e.eventPhase&&J(e.target).is(o)&&(o.off(s,n),i.removeClass("busy"),t)&&t()},o.on(s,n),i.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 e.attr("aria-owns",i=a?i+" "+a:i),t.detach().attr({id:n,class:"customize-pane-child "+t.attr("class")+" "+e.attr("class")})}}),Y.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=this,i=t.params||t;i.type||_.find(Y.sectionConstructor,function(e,t){return e===n.constructor&&(i.type=t,!0)}),a.prototype.initialize.call(n,e,i),n.id=e,n.panel=new Y.Value,n.panel.bind(function(e){J(n.headContainer).toggleClass("control-subsection",!!e)}),n.panel.set(n.params.panel||""),Y.utils.bubbleChildValueChanges(n,["panel"]),n.embed(),n.deferred.embedded.done(function(){n.ready()})},embed:function(){var e,n=this;n.containerParent=Y.ensure(n.containerParent),n.panel.bind(e=function(e){var t;e?Y.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=Y.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())}),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){Y.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")}),J(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=this,a=i.headContainer.closest(".wp-full-overlay-sidebar-content"),o=i.contentContainer,s=i.headContainer.closest(".wp-full-overlay"),r=o.find(".customize-section-back"),c=i.headContainer.find(".accordion-section-title").first();e&&!o.hasClass("open")?(n=t.unchanged?t.completeCallback:function(){i._animateChangeExpanded(function(){c.attr("tabindex","-1"),r.attr("tabindex","0"),r.trigger("focus"),o.css("top",""),a.scrollTop(0),t.completeCallback&&t.completeCallback()}),o.addClass("open"),s.addClass("section-open"),Y.state("expandedSection").set(i)}.bind(this),t.allowMultiple||Y.section.each(function(e){e!==i&&e.collapse({duration:t.duration})}),i.panel()?Y.panel(i.panel()).expand({duration:t.duration,completeCallback:n}):(t.allowMultiple||Y.panel.each(function(e){e.collapse()}),n())):!e&&o.hasClass("open")?(i.panel()&&(n=Y.panel(i.panel())).contentContainer.hasClass("skip-transition")&&n.collapse(),i._animateChangeExpanded(function(){r.attr("tabindex","-1"),c.attr("tabindex","0"),c.trigger("focus"),o.css("top",""),t.completeCallback&&t.completeCallback()}),o.removeClass("open"),s.removeClass("section-open"),i===Y.state("expandedSection").get()&&Y.state("expandedSection").set(!1)):t.completeCallback&&t.completeCallback()}}),Y.ThemesSection=Y.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=J(),n.$window=J(window),n.$body=J(document.body),Y.Section.prototype.initialize.call(n,e,t),n.updateCountDebounced=_.debounce(n.updateCount,500)},embed:function(){var n=this,e=function(e){var t;Y.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,n=this;function t(){var e=n.headerContainer.find(".customize-themes-section-title");e.toggleClass("selected",n.expanded()),e.attr("aria-expanded",n.expanded()?"true":"false"),n.expanded()||e.removeClass("details-open")}n.container.find(".customize-section-back").on("click keydown",function(e){Y.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.collapse())}),n.headerContainer=J("#accordion-section-"+n.id),n.headerContainer.on("click",".customize-themes-section-title",function(){n.headerContainer.find(".filter-details").length&&(n.headerContainer.find(".customize-themes-section-title").toggleClass("details-open").attr("aria-expanded",function(e,t){return"true"===t?"false":"true"}),n.headerContainer.find(".filter-details").slideToggle(180)),n.expanded()||n.expand()}),n.container.on("click",".theme-actions .preview-theme",function(){Y.panel("themes").loadThemePreview(J(this).data("slug"))}),n.container.on("click",".left",function(){n.previousTheme()}),n.container.on("click",".right",function(){n.nextTheme()}),n.container.on("click",".theme-backdrop, .close",function(){n.closeDetails()}),"local"===n.params.filter_type?n.container.on("input",".wp-filter-search-themes",function(e){n.filterSearch(e.currentTarget.value)}):"remote"===n.params.filter_type&&(e=_.debounce(n.checkTerm,500),n.contentContainer.on("input",".wp-filter-search",function(){Y.panel("themes").expanded()&&(e(n),n.expanded()||n.expand())}),n.contentContainer.on("click",".filter-group input",function(){n.filtersChecked(),n.checkTerm(n)})),n.contentContainer.on("click",".feature-filter-toggle",function(e){var t=J(".customize-themes-full-container"),e=J(e.currentTarget);n.filtersHeight=e.parents(".themes-filter-bar").next(".filter-drawer").height(),0
.accordion-section-title .customize-help-toggle").on("click",function(){var e;t.hasClass("cannot-expand")||(e=t.find(".customize-panel-description:first"),t.hasClass("open")?(t.toggleClass("open"),e.slideUp(n.defaultExpandedArguments.duration,function(){e.trigger("toggled")}),J(this).attr("aria-expanded",!1)):(e.slideDown(n.defaultExpandedArguments.duration,function(){e.trigger("toggled")}),t.toggleClass("open"),J(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){var n,i,a,o,s,r,c;t.unchanged?t.completeCallback&&t.completeCallback():(a=(i=(n=this).contentContainer).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")?(Y.section.each(function(e){n.id!==e.panel()&&e.collapse({duration:0})}),Y.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.trigger("focus"),i.css("top",""),o.scrollTop(0),t.completeCallback&&t.completeCallback()}),i.addClass("current-panel"),a.addClass("in-sub-panel")),Y.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===Y.state("expandedPanel").get())&&Y.state("expandedPanel").set(!1))},renderContent:function(){var e=this,t=0!==J("#tmpl-"+e.templateSelector+"-content").length?wp.template(e.templateSelector+"-content"):wp.template("customize-panel-default-content");t&&e.headContainer&&e.contentContainer.html(t(_.extend({id:e.id},e.params)))}}),Y.ThemesPanel=Y.Panel.extend({initialize:function(e,t){this.installingThemes=[],Y.Panel.prototype.initialize.call(this,e,t)},canSwitchTheme:function(e){return!(!e||e!==Y.settings.theme.stylesheet)||"publish"===Y.state("selectedChangesetStatus").get()&&(""===Y.state("changesetStatus").get()||"auto-draft"===Y.state("changesetStatus").get())},attachEvents:function(){var t=this;function e(){t.canSwitchTheme()?t.notifications.remove("theme_switch_unavailable"):t.notifications.add(new Y.Notification("theme_switch_unavailable",{message:Y.l10n.themePreviewUnavailable,type:"warning"}))}Y.Panel.prototype.attachEvents.apply(t),Y.settings.theme._canInstall&&Y.settings.theme._filesystemCredentialsNeeded&&t.notifications.add(new Y.Notification("theme_install_unavailable",{message:Y.l10n.themeInstallUnavailable,type:"info",dismissible:!0})),e(),Y.state("selectedChangesetStatus").bind(e),Y.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(){J(".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=!1;Y.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-"+i.params.type})),i.id=e,i.selector="#customize-control-"+e.replace(/\]/g,"").replace(/\[/g,"-"),i.params.content?i.container=J(i.params.content):i.container=J(i.selector),i.params.templateId?i.templateSelector=i.params.templateId:i.templateSelector="customize-control-"+i.params.type+"-content",i.deferred=_.extend(i.deferred||{},{embedded:new J.Deferred}),i.section=new Y.Value,i.priority=new Y.Value,i.active=new Y.Value,i.activeArgumentsQueue=[],i.notifications=new Y.Notifications({alt:i.altNotice}),i.elements=[],i.active.bind(function(e){var t=i.activeArgumentsQueue.shift(),t=J.extend({},i.defaultActiveArguments,t);i.onChangeActive(e,t)}),i.section.set(i.params.section),i.priority.set(isNaN(i.params.priority)?10:i.params.priority),i.active.set(i.params.active),Y.utils.bubbleChildValueChanges(i,["section","priority","active"]),i.settings={},n={},i.params.setting&&(n.default=i.params.setting),_.extend(n,i.params.settings),_.each(n,function(e,t){var n;_.isObject(e)&&_.isFunction(e.extended)&&e.extended(Y.Value)?i.settings[t]=e:_.isString(e)&&((n=Y(e))?i.settings[t]=n:a.push(e))}),t=function(){_.each(n,function(e,t){!i.settings[t]&&_.isString(e)&&(i.settings[t]=Y(e))}),i.settings[0]&&!i.settings.default&&(i.settings.default=i.settings[0]),i.setting=i.settings.default||null,i.linkElements(),i.embed()},0===a.length?t():Y.apply(Y,a.concat(t)),i.deferred.embedded.done(function(){i.linkElements(),i.setupNotifications(),i.ready()})},linkElements:function(){var i,a=this,o=a.container.find("[data-customize-setting-link], [data-customize-setting-key-link]"),s={};o.each(function(){var e,t,n=J(this);if(!n.data("customizeSettingLinked")){if(n.data("customizeSettingLinked",!0),n.is(":radio")){if(e=n.prop("name"),s[e])return;s[e]=!0,n=o.filter('[name="'+e+'"]')}n.data("customizeSettingLink")?t=Y(n.data("customizeSettingLink")):n.data("customizeSettingKeyLink")&&(t=a.settings[n.data("customizeSettingKeyLink")]),t&&(i=new Y.Element(n),a.elements.push(i),i.sync(t),i.set(t()))}})},embed:function(){var n=this,e=function(e){var t;e&&Y.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-wrapper")).hide(),n.container.on("click",".add-new-toggle",function(e){J(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=this,n=t.container.find(".customize-control-notifications-container:first");return n.length||(n=J('
'),t.container.hasClass("customize-control-nav_menu_item")?t.container.find(".menu-item-settings:first").prepend(n):t.container.hasClass("customize-control-widget_form")?t.container.find(".widget-inside:first").prepend(n):(e=t.container.find(".customize-control-title")).length?e.after(n):t.container.prepend(n)),n},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 Y.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||Y.section.has(e)&&Y.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)}),i.section.bind(e=function(e,t){t&&Y.section.has(t)&&Y.section(t).expanded.unbind(n),e&&Y.section(e,function(e){e.expanded.bind(n),n()})}),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 instantiating 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(){J(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(n.notificationsTemplate({notifications:t,altNotice:Boolean(n.altNotice)}).trim()))},expand:function(e){Y.section(this.section()).expand(e)},focus:o,onChangeActive:function(e,t){t.unchanged?t.completeCallback&&t.completeCallback():J.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){Y.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=this,t=e.templateSelector;t==="customize-control-"+e.params.type+"-content"&&_.contains(["button","checkbox","date","datetime-local","email","month","number","password","radio","range","search","select","tel","time","text","textarea","week","url"],e.params.type)&&!document.getElementById("tmpl-"+t)&&0===e.container.children().length&&(t="customize-control-default-content"),document.getElementById("tmpl-"+t)&&(t=wp.template(t))&&e.container&&e.container.html(t(e.params)),e.notifications.container=e.getNotificationsContainerElement(),(!(t=e.section())||Y.section.has(t)&&Y.section(t).expanded())&&e.notifications.render()},addNewPage:function(){var e,a,o,t,s,r,c=this;"dropdown-pages"===c.params.type&&c.params.allow_addition&&Y.Menus&&(a=c.container.find(".add-new-toggle"),o=c.container.find(".new-content-item-wrapper"),t=c.container.find(".create-item-input"),s=t.val(),r=c.container.find("select"),s?(t.removeClass("invalid"),t.attr("disabled","disabled"),(e=Y.Menus.insertAutoDraftPost({post_title:s,post_type:"page"})).done(function(e){var t,n,i=new Y.Menus.AvailableItemModel({id:"post-"+e.post_id,title:s,type:"post_type",type_label:Y.Menus.data.l10n.page_label,object:"page",object_id:e.post_id,url:e.url});Y.Menus.availableMenuItemsPanel.collection.add(i),t=J("#available-menu-items-post_type-page").find(".available-menu-items-list"),n=wp.template("available-menu-item"),t.prepend(n(i.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"))}}),Y.ColorControl=Y.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())})}}),Y.MediaControl=Y.Control.extend({ready:function(){var n=this;function e(e){var t=J.Deferred();n.extended(Y.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),Y.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){Y.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=this.frame.state().get("selection").first().toJSON(),t=window._wpmejsSettings||{};this.params.attachment=e,this.setting(e.id),(e=this.container.find("audio, video").get(0))?this.player=new MediaElementPlayer(e,t):this.cleanupPlayer()},restoreDefault:function(e){Y.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),this.params.attachment=this.params.defaultAttachment,this.setting(this.params.defaultAttachment.url))},removeFile:function(e){Y.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),this.params.attachment={},this.setting(""),this.renderContent())}}),Y.UploadControl=Y.MediaControl.extend({select:function(){var e=this.frame.state().get("selection").first().toJSON(),t=window._wpmejsSettings||{};this.params.attachment=e,this.setting(e.url),(e=this.container.find("audio, video").get(0))?this.player=new MediaElementPlayer(e,t):this.cleanupPlayer()},success:function(){},removerVisibility:function(){}}),Y.ImageControl=Y.UploadControl.extend({thumbnailSrc:function(){}}),Y.BackgroundControl=Y.UploadControl.extend({ready:function(){Y.UploadControl.prototype.ready.apply(this,arguments)},select:function(){Y.UploadControl.prototype.select.apply(this,arguments),wp.ajax.post("custom-background-add",{nonce:_wpCustomizeBackground.nonces.add,wp_customize:"on",customize_theme:Y.settings.theme.stylesheet,attachment_id:this.params.attachment.id})}}),Y.BackgroundPositionControl=Y.Control.extend({ready:function(){var e,n=this;n.container.on("change",'input[name="background-position"]',function(){var e=J(this).val().split(" ");n.settings.x(e[0]),n.settings.y(e[1])}),e=_.debounce(function(){var e=n.settings.x.get(),t=n.settings.y.get(),e=String(e)+" "+String(t);n.container.find('input[name="background-position"][value="'+e+'"]').trigger("click")}),n.settings.x.bind(e),n.settings.y.bind(e),e()}}),Y.CroppedImageControl=Y.MediaControl.extend({openFrame:function(e){Y.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=t.get("control"),i=!!parseInt(n.params.flex_width,10),a=!!parseInt(n.params.flex_height,10),o=e.get("width"),e=e.get("height"),s=parseInt(n.params.width,10),r=parseInt(n.params.height,10),c=s/r,l=s,d=r;return t.set("canSkipCrop",!n.mustBeCropped(i,a,s,r,o,e)),c
",{title:Y.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=J("
",{action:e.href,target:a.iframe.attr("name"),method:"post",hidden:"hidden"})).append(J("
",{type:"hidden",name:"_method",value:"GET"})),_.each(a.query,function(e,t){i.append(J("
",{type:"hidden",name:t,value:e}))}),a.container.append(i),i.trigger("submit"),i.remove()),a.bind("iframe-loading-error",function(e){a.iframe.remove(),0===e?a.login(t):-1===e?t.rejectWith(a,["cheatin"]):t.rejectWith(a,["request failure"])}),a.iframe.one("load",function(){o=!0,s?t.resolveWith(a,[r]):setTimeout(function(){t.rejectWith(a,["ready timeout"])},a.sensitivity)})},login:function(n){var i=this,a=function(){n.rejectWith(i,["logged out"])};if(this.triedLogin)return a();J.get(Y.settings.url.ajax,{action:"logged-in"}).fail(a).done(function(e){var t;"1"!==e&&a(),(t=J("
",{src:i.previewUrl(),title:Y.l10n.previewIframeTitle}).hide()).appendTo(i.container),t.on("load",function(){i.triedLogin=!0,t.remove(),i.run(n)})})},destroy:function(){Y.Messenger.prototype.destroy.call(this),this.iframe&&this.iframe.remove(),delete this.iframe,delete this.targetWindow}}),i=0,Y.PreviewFrame.uuid=function(){return"preview-"+String(i++)},Y.setDocumentTitle=function(e){e=Y.settings.documentTitleTmpl.replace("%s",e);document.title=e,Y.trigger("title",e)},Y.Previewer=Y.Messenger.extend({refreshBuffer:null,initialize:function(e,t){var n,o=this,i=document.createElement("a");J.extend(o,t||{}),o.deferred={active:J.Deferred()},o.refresh=_.debounce((n=o.refresh,function(){var e,t=function(){return 0===Y.state("processing").get()};t()?n.call(o):(e=function(){t()&&(n.call(o),Y.state("processing").unbind(e))},Y.state("processing").bind(e))}),o.refreshBuffer),o.container=Y.ensure(e.container),o.allowedUrls=e.allowedUrls,e.url=window.location.href,Y.Messenger.prototype.initialize.call(o,e),i.href=o.origin(),o.add("scheme",i.protocol.replace(/:$/,"")),o.add("previewUrl",e.previewUrl).setter(function(e){var n,i=null,t=[],a=document.createElement("a");return a.href=e,/\/wp-(admin|includes|content)(\/|$)/.test(a.pathname)?null:(1
",{src:Y.settings.url.login,title:Y.l10n.loginIframeTitle}).appendTo(this.container),n.targetWindow(i[0].contentWindow),n.bind("login",function(){var e=a.refreshNonces();e.always(function(){i.remove(),n.destroy(),delete a._login}),e.done(function(){t.resolve()}),e.fail(function(){a.cheatin(),t.reject()})})),this._login},cheatin:function(){J(document.body).empty().addClass("cheatin").append("
"+Y.l10n.notAllowedHeading+"
"+Y.l10n.notAllowed+"
")},refreshNonces:function(){var e,t=J.Deferred();return t.promise(),(e=wp.ajax.post("customize_refresh_nonces",{wp_customize:"on",customize_theme:Y.settings.theme.stylesheet})).done(function(e){Y.trigger("nonce-refresh",e),t.resolve()}),e.fail(function(){t.reject()}),t}}),Y.settingConstructor={},Y.controlConstructor={color:Y.ColorControl,media:Y.MediaControl,upload:Y.UploadControl,image:Y.ImageControl,cropped_image:Y.CroppedImageControl,site_icon:Y.SiteIconControl,header:Y.HeaderControl,background:Y.BackgroundControl,background_position:Y.BackgroundPositionControl,theme:Y.ThemeControl,date_time:Y.DateTimeControl,code_editor:Y.CodeEditorControl},Y.panelConstructor={themes:Y.ThemesPanel},Y.sectionConstructor={themes:Y.ThemesSection,outer:Y.OuterSection},Y._handleSettingValidities=function(e){var o=[],n=!1;_.each(e.settingValidities,function(t,e){var a=Y(e);a&&(_.isObject(t)&&_.each(t,function(e,t){var n=!1,e=new Y.Notification(t,_.extend({fromServer:!0},e)),i=a.notifications(e.code);(n=i?e.type!==i.type||e.message!==i.message||!_.isEqual(e.data,i.data):n)&&a.notifications.remove(t),a.notifications.has(e.code)||a.notifications.add(e),o.push(a.id)}),a.notifications.each(function(e){!e.fromServer||"error"!==e.type||!0!==t&&t[e.code]||a.notifications.remove(e.code)}))}),e.focusInvalidControl&&(e=Y.findControlsForSettings(o),_(_.values(e)).find(function(e){return _(e).find(function(e){var t=e.section()&&Y.section.has(e.section())&&Y.section(e.section()).expanded();return(t=t&&e.expanded?e.expanded():t)&&(e.focus(),n=!0),n})}),n||_.isEmpty(e)||_.values(e)[0][0].focus())},Y.findControlsForSettings=function(e){var n,i={};return _.each(_.unique(e),function(e){var t=Y(e);t&&(n=t.findControls())&&0
.accordion-section-title .customize-help-toggle").on("click",function(){var e=J(this).closest(".accordion-section"),t=e.find(".customize-panel-description:first");e.hasClass("cannot-expand")||(e.hasClass("open")?(e.toggleClass("open"),t.slideUp(Y.Panel.prototype.defaultExpandedArguments.duration,function(){t.trigger("toggled")}),J(this).attr("aria-expanded",!1)):(t.slideDown(Y.Panel.prototype.defaultExpandedArguments.duration,function(){t.trigger("toggled")}),e.toggleClass("open"),J(this).attr("aria-expanded",!0)))}),Y.previewer=new Y.Previewer({container:"#customize-preview",form:"#customize-controls",previewUrl:Y.settings.url.preview,allowedUrls:Y.settings.url.allowed},{nonce:Y.settings.nonce,query:function(e){var t={wp_customize:"on",customize_theme:Y.settings.theme.stylesheet,nonce:this.nonce.preview,customize_changeset_uuid:Y.settings.changeset.uuid};return!Y.settings.changeset.autosaved&&Y.state("saved").get()||(t.customize_autosaved="on"),t.customized=JSON.stringify(Y.dirtyValues({unsaved:e&&e.excludeCustomizedSaved})),t},save:function(i){var e,t,a=this,o=J.Deferred(),s=Y.state("selectedChangesetStatus").get(),r=Y.state("selectedChangesetDate").get(),n=Y.state("processing"),c={},l=[],d=[],u=[];function p(e){c[e.id]=!0}return i&&i.status&&(s=i.status),Y.state("saving").get()&&(o.reject("already_saving"),o.promise()),Y.state("saving").set(!0),t=function(){var n={},t=Y._latestRevision,e="client_side_error";if(Y.bind("change",p),Y.notifications.remove(e),Y.each(function(t){t.notifications.each(function(e){"error"!==e.type||e.fromServer||(l.push(t.id),n[t.id]||(n[t.id]={}),n[t.id][e.code]=e)})}),Y.control.each(function(t){t.setting&&(t.setting.id||!t.active.get())||t.notifications.each(function(e){"error"===e.type&&u.push([t])})}),d=_.union(u,_.values(Y.findControlsForSettings(l))),!_.isEmpty(d))return d[0][0].focus(),Y.unbind("change",p),l.length&&Y.notifications.add(new Y.Notification(e,{message:(1===l.length?Y.l10n.saveBlockedError.singular:Y.l10n.saveBlockedError.plural).replace(/%s/g,String(l.length)),type:"error",dismissible:!0,saveFailure:!0})),o.rejectWith(a,[{setting_invalidities:n}]),Y.state("saving").set(!1),o.promise();e=J.extend(a.query({excludeCustomizedSaved:!1}),{nonce:a.nonce.save,customize_changeset_status:s}),i&&i.date?e.customize_changeset_date=i.date:"future"===s&&r&&(e.customize_changeset_date=r),i&&i.title&&(e.customize_changeset_title=i.title),Y.trigger("save-request-params",e),e=wp.ajax.post("customize_save",e),Y.state("processing").set(Y.state("processing").get()+1),Y.trigger("save",e),e.always(function(){Y.state("processing").set(Y.state("processing").get()-1),Y.state("saving").set(!1),Y.unbind("change",p)}),Y.notifications.each(function(e){e.saveFailure&&Y.notifications.remove(e.code)}),e.fail(function(e){var t,n={type:"error",dismissible:!0,fromServer:!0,saveFailure:!0};"0"===e?e="not_logged_in":"-1"===e&&(e="invalid_nonce"),"invalid_nonce"===e?a.cheatin():"not_logged_in"===e?(a.preview.iframe.hide(),a.login().done(function(){a.save(),a.preview.iframe.show()})):e.code?"not_future_date"===e.code&&Y.section.has("publish_settings")&&Y.section("publish_settings").active.get()&&Y.control.has("changeset_scheduled_date")?Y.control("changeset_scheduled_date").toggleFutureDateNotification(!0).focus():"changeset_locked"!==e.code&&(t=new Y.Notification(e.code,_.extend(n,{message:e.message}))):t=new Y.Notification("unknown_error",_.extend(n,{message:Y.l10n.unknownRequestFail})),t&&Y.notifications.add(t),e.setting_validities&&Y._handleSettingValidities({settingValidities:e.setting_validities,focusInvalidControl:!0}),o.rejectWith(a,[e]),Y.trigger("error",e),"changeset_already_published"===e.code&&e.next_changeset_uuid&&(Y.settings.changeset.uuid=e.next_changeset_uuid,Y.state("changesetStatus").set(""),Y.settings.changeset.branching&&h.send("changeset-uuid",Y.settings.changeset.uuid),Y.previewer.send("changeset-uuid",Y.settings.changeset.uuid))}),e.done(function(e){a.send("saved",e),Y.state("changesetStatus").set(e.changeset_status),e.changeset_date&&Y.state("changesetDate").set(e.changeset_date),"publish"===e.changeset_status&&(Y.each(function(e){e._dirty&&(_.isUndefined(Y._latestSettingRevisions[e.id])||Y._latestSettingRevisions[e.id]<=t)&&(e._dirty=!1)}),Y.state("changesetStatus").set(""),Y.settings.changeset.uuid=e.next_changeset_uuid,Y.settings.changeset.branching)&&h.send("changeset-uuid",Y.settings.changeset.uuid),Y._lastSavedRevision=Math.max(t,Y._lastSavedRevision),e.setting_validities&&Y._handleSettingValidities({settingValidities:e.setting_validities,focusInvalidControl:!0}),o.resolveWith(a,[e]),Y.trigger("saved",e),_.isEmpty(c)||Y.state("saved").set(!1)})},0===n()?t():(e=function(){0===n()&&(Y.state.unbind("change",e),t())},Y.state.bind("change",e)),o.promise()},trash:function(){var e,n,i;Y.state("trashing").set(!0),Y.state("processing").set(Y.state("processing").get()+1),e=wp.ajax.post("customize_trash",{customize_changeset_uuid:Y.settings.changeset.uuid,nonce:Y.settings.nonce.trash}),Y.notifications.add(new Y.OverlayNotification("changeset_trashing",{type:"info",message:Y.l10n.revertingChanges,loading:!0})),n=function(){var e,t=document.createElement("a");Y.state("changesetStatus").set("trash"),Y.each(function(e){e._dirty=!1}),Y.state("saved").set(!0),t.href=location.href,delete(e=Y.utils.parseQueryString(t.search.substr(1))).changeset_uuid,e.return=Y.settings.url.return,t.search=J.param(e),location.replace(t.href)},i=function(e,t){e=e||"unknown_error";Y.state("processing").set(Y.state("processing").get()-1),Y.state("trashing").set(!1),Y.notifications.remove("changeset_trashing"),Y.notifications.add(new Y.Notification(e,{message:t||Y.l10n.unknownError,dismissible:!0,type:"error"}))},e.done(function(e){n(e.message)}),e.fail(function(e){var t=e.code||"trashing_failed";e.success||"non_existent_changeset"===t||"changeset_already_trashed"===t?n(e.message):i(t,e.message)})},getFrontendPreviewUrl:function(){var e,t=document.createElement("a");return t.href=this.previewUrl.get(),e=Y.utils.parseQueryString(t.search.substr(1)),Y.state("changesetStatus").get()&&"publish"!==Y.state("changesetStatus").get()&&(e.customize_changeset_uuid=Y.settings.changeset.uuid),Y.state("activated").get()||(e.customize_theme=Y.settings.theme.stylesheet),t.search=J.param(e),t.href}}),J.ajaxPrefilter(function(e){/wp_customize=on/.test(e.data)&&(e.data+="&"+J.param({customize_preview_nonce:Y.settings.nonce.preview}))}),Y.previewer.bind("nonce",function(e){J.extend(this.nonce,e)}),Y.bind("nonce-refresh",function(e){J.extend(Y.settings.nonce,e),J.extend(Y.previewer.nonce,e),Y.previewer.send("nonce-refresh",e)}),J.each(Y.settings.settings,function(e,t){var n=Y.settingConstructor[t.type]||Y.Setting;Y.add(new n(e,t.value,{transport:t.transport,previewer:Y.previewer,dirty:!!t.dirty}))}),J.each(Y.settings.panels,function(e,t){var n=Y.panelConstructor[t.type]||Y.Panel,t=_.extend({params:t},t);Y.panel.add(new n(e,t))}),J.each(Y.settings.sections,function(e,t){var n=Y.sectionConstructor[t.type]||Y.Section,t=_.extend({params:t},t);Y.section.add(new n(e,t))}),J.each(Y.settings.controls,function(e,t){var n=Y.controlConstructor[t.type]||Y.Control,t=_.extend({params:t},t);Y.control.add(new n(e,t))}),_.each(["panel","section","control"],function(e){var t=Y.settings.autofocus[e];t&&Y[e](t,function(e){e.deferred.embedded.done(function(){Y.previewer.deferred.active.done(function(){e.focus()})})})}),Y.bind("ready",Y.reflowPaneContents),J([Y.panel,Y.section,Y.control]).each(function(e,t){var n=_.debounce(Y.reflowPaneContents,Y.settings.timeouts.reflowPaneContents);t.bind("add",n),t.bind("change",n),t.bind("remove",n)}),Y.bind("ready",function(){var e,t,n;Y.notifications.container=J("#customize-notifications-area"),Y.notifications.bind("change",_.debounce(function(){Y.notifications.render()})),e=J(".wp-full-overlay-sidebar-content"),Y.notifications.bind("rendered",function(){e.css("top",""),0!==Y.notifications.count()&&(t=Y.notifications.container.outerHeight()+1,n=parseInt(e.css("top"),10),e.css("top",n+t+"px")),Y.notifications.trigger("sidebarTopUpdated")}),Y.notifications.render()}),s=Y.state,c=s.instance("saved"),l=s.instance("saving"),f=s.instance("trashing"),m=s.instance("activated"),e=s.instance("processing"),I=s.instance("paneVisible"),H=s.instance("expandedPanel"),L=s.instance("expandedSection"),g=s.instance("changesetStatus"),v=s.instance("selectedChangesetStatus"),w=s.instance("changesetDate"),b=s.instance("selectedChangesetDate"),M=s.instance("previewerAlive"),O=s.instance("editShortcutVisibility"),C=s.instance("changesetLocked"),s.bind("change",function(){var e;m()?""===g.get()&&c()?(Y.settings.changeset.currentUserCanPublish?d.val(Y.l10n.published):d.val(Y.l10n.saved),i.find(".screen-reader-text").text(Y.l10n.close)):("draft"===v()?c()&&v()===g()?d.val(Y.l10n.draftSaved):d.val(Y.l10n.saveDraft):"future"===v()?!c()||v()!==g()||w.get()!==b.get()?d.val(Y.l10n.schedule):d.val(Y.l10n.scheduled):Y.settings.changeset.currentUserCanPublish&&d.val(Y.l10n.publish),i.find(".screen-reader-text").text(Y.l10n.cancel)):(d.val(Y.l10n.activate),i.find(".screen-reader-text").text(Y.l10n.cancel)),e=!l()&&!f()&&!C()&&(!m()||!c()||g()!==v()&&""!==g()||"future"===v()&&w.get()!==b.get()),d.prop("disabled",!e)}),v.validate=function(e){return""===e||"auto-draft"===e?null:e},S=Y.settings.changeset.currentUserCanPublish?"publish":"draft",g(Y.settings.changeset.status),C(Boolean(Y.settings.changeset.lockUser)),w(Y.settings.changeset.publishDate),b(Y.settings.changeset.publishDate),v(""===Y.settings.changeset.status||"auto-draft"===Y.settings.changeset.status?S:Y.settings.changeset.status),v.link(g),c(!0),""===g()&&Y.each(function(e){e._dirty&&c(!1)}),l(!1),m(Y.settings.theme.active),e(0),I(!0),H(!1),L(!1),M(!0),O("visible"),Y.bind("change",function(){s("saved").get()&&s("saved").set(!1)}),Y.settings.changeset.branching&&c.bind(function(e){e||r(!0)}),l.bind(function(e){o.toggleClass("saving",e)}),f.bind(function(e){o.toggleClass("trashing",e)}),Y.bind("saved",function(e){s("saved").set(!0),"publish"===e.changeset_status&&s("activated").set(!0)}),m.bind(function(e){e&&Y.trigger("activated")}),r=function(e){var t,n;if(history.replaceState){if((t=document.createElement("a")).href=location.href,n=Y.utils.parseQueryString(t.search.substr(1)),e){if(n.changeset_uuid===Y.settings.changeset.uuid)return;n.changeset_uuid=Y.settings.changeset.uuid}else{if(!n.changeset_uuid)return;delete n.changeset_uuid}t.search=J.param(n),history.replaceState({},document.title,t.href)}},Y.settings.changeset.branching&&g.bind(function(e){r(""!==e&&"publish"!==e&&"trash"!==e)}),j=Y.OverlayNotification.extend({templateId:"customize-changeset-locked-notification",lockUser:null,initialize:function(e,t){e=e||"changeset_locked",t=_.extend({message:"",type:"warning",containerClasses:"",lockUser:{}},t);t.containerClasses+=" notification-changeset-locked",Y.OverlayNotification.prototype.initialize.call(this,e,t)},render:function(){var t,n,i=this,e=_.extend({allowOverride:!1,returnUrl:Y.settings.url.return,previewUrl:Y.previewer.previewUrl.get(),frontendPreviewUrl:Y.previewer.getFrontendPreviewUrl()},this),a=Y.OverlayNotification.prototype.render.call(e);return Y.requestChangesetUpdate({},{autosave:!0}).fail(function(e){e.autosaved||a.find(".notice-error").prop("hidden",!1).text(e.message||Y.l10n.unknownRequestFail)}),(t=a.find(".customize-notice-take-over-button")).on("click",function(e){e.preventDefault(),n||(t.addClass("disabled"),(n=wp.ajax.post("customize_override_changeset_lock",{wp_customize:"on",customize_theme:Y.settings.theme.stylesheet,customize_changeset_uuid:Y.settings.changeset.uuid,nonce:Y.settings.nonce.override_lock})).done(function(){Y.notifications.remove(i.code),Y.state("changesetLocked").set(!1)}),n.fail(function(e){e=e.message||Y.l10n.unknownRequestFail;a.find(".notice-error").prop("hidden",!1).text(e),n.always(function(){t.removeClass("disabled")})}),n.always(function(){n=null}))}),a}}),Y.settings.changeset.lockUser&&F({allowOverride:!0}),J(document).on("heartbeat-send.update_lock_notice",function(e,t){t.check_changeset_lock=!0,t.changeset_uuid=Y.settings.changeset.uuid}),J(document).on("heartbeat-tick.update_lock_notice",function(e,t){var n,i="changeset_locked";t.customize_changeset_lock_user&&((n=Y.notifications(i))&&n.lockUser.id!==Y.settings.changeset.lockUser.id&&Y.notifications.remove(i),F({lockUser:t.customize_changeset_lock_user}))}),Y.bind("error",function(e){"changeset_locked"===e.code&&e.lock_user&&F({lockUser:e.lock_user})}),T=!(S=[]),Y.settings.changeset.autosaved&&(Y.state("saved").set(!1),S.push("customize_autosaved")),Y.settings.changeset.branching||Y.settings.changeset.status&&"auto-draft"!==Y.settings.changeset.status||S.push("changeset_uuid"),0