!function r(a,n,c){function l(e,t){if(!n[e]){if(!a[e]){var o="function"==typeof require&&require;if(!t&&o)return o(e,!0);if(h)return h(e,!0);var i=new Error("Cannot find module '"+e+"'");throw i.code="MODULE_NOT_FOUND",i}var s=n[e]={exports:{}};a[e][0].call(s.exports,function(t){return l(a[e][1][t]||t)},s,s.exports,r,a,n,c)}return n[e].exports}for(var h="function"==typeof require&&require,t=0;t<c.length;t++)l(c[t]);return l}({1:[function(t,e,o){"use strict";function i(t,e){return(e.match(/(^|\s)layout--theme--\S+/g)||[]).join(" ")}function r(t){var e=null;return t.attr("class").split(/\s+/).forEach(function(t){0<=t.indexOf("layout--theme--")&&(e=t)}),e}function a(t){var e=t.split("--");if("layout"!==e[0]&&"theme"!==e[1]||4!==e.length)throw"ThemeConfig: Invalid class porvided to parser";return{type:e[2],color:e[3]}}function s(t,e,o,i){if(this.$layout=t,this.$typeSwitches=e,this.$colorSwitches=o,this.initialStyleClass=r(t),this.initialStyleClass&&i){var s=this;i.on("click",function(){s.clearClass(),s.$layout.addClass(s.initialStyleClass),s.updateCheckboxes();var t=a(s.initialStyleClass);s.$layout.trigger("theme-changed",{type:t.type,color:t.color})})}}var n;n={saveTheme:function(t){window.sessionStorage&&window.sessionStorage.setItem("dashboard-layout-class",t)},restoreTheme:function(t){if(window.sessionStorage&&0<t.length){var e=window.sessionStorage.getItem("dashboard-layout-class");if(e){t.removeClass(i),t.addClass(e);var o=a(e);t.trigger("theme-changed",{type:o.type,color:o.color})}}}},s.prototype.buildClass=function(t,e){return"layout--theme--"+t+"--"+e},s.prototype.clearClass=function(){this.$layout.removeClass(i)},s.prototype.updateCheckboxes=function(){var t=r(this.$layout),e=a(t);this.$typeSwitches.each(function(){this.checked=this.value===e.type}),this.$colorSwitches.each(function(){this.checked=this.value===e.color})},s.prototype.startup=function(){var i=this;function t(){var t=i.$typeSwitches.filter(":checked").val(),e=i.$colorSwitches.filter(":checked").val();i.clearClass();var o=this.buildClass(t,e);i.$layout.addClass(o).trigger("theme-changed",{type:t,color:e}),n.saveTheme(o)}this.updateCheckboxes(),this.$typeSwitches.on("change",t.bind(this)),this.$colorSwitches.on("change",t.bind(this))},window.Dashboard=Object.assign({},window.Dashboard||{},{ThemeConfig:s,ThemeConfigMemento:n})},{}]},{},[1]);
//# sourceMappingURL=theme-config.js.map
