/* Copyright (C) YOOtheme GmbH, http://www.gnu.org/licenses/gpl.html GNU/GPL */

(function(a,m){function l(e,d){r=!1;var l=a.Deferred(),f=[],b=0;a.each(e.styles,function(b,d){a.each(e.less,function(a,e){f.push({target:"/styles/"+b+e.target,less:e.source+"\n"+d,css:"",error:""})})});if(!f.length)return l.resolve(f);a.less.getCSS(f[b].less,d).always(function g(h){"string"==a.type(h)?f[b].css=h:f[b].error=h;f[b].css=a.less.rewriteUrls(f[b].css,e.baseurl+f[b].target);a.isFunction(d.progress)&&d.progress.call(this,f[b],b,100*(b/f.length));if(f[++b]&&!r)setTimeout(function(){a.less.getCSS(f[b].less,
d).always(g)},150);else l[r?"reject":"resolve"](f)});return l.promise()}function h(){try{return!!new Blob&&void 0!==typeof FormData}catch(a){return!1}}var r;a(function(){function e(c,j){b.css("width","100%");var d={};a.each(j.styles,function(a,c){d["/styles/"+a+"/style.less"]=c});a.each(c,function(a,c){c.error||(d[c.target]=c.css)});v.text("Saving files...");System.saveFiles(d).fail(function(a){g.append('<div class="uk-alert uk-alert-danger">'+a+"</div>")}).done(function(){g.children().length||f.hide()})}
function d(c,j,d){j=c.target.replace(/^.*[\/\\]/g,"").replace(/css$/g,"less");v.text(c.target);b.css("width",Math.ceil(d)+"%");c.error&&0===a("[data-file='"+j+"']").length&&g.append('<div class="uk-alert uk-alert-danger" data-file="'+j+'"><strong>'+j+"</strong><br>"+c.error.message+"</div>")}var s=a("#config"),f=new a.UIkit.modal.Modal("#compilemodal",{bgclose:!1}),b=f.element.find(".uk-progress-bar"),v=f.element.find(".file-name"),g=f.element.find(".error-list"),z=a("[data-customizer]"),F=a("[data-style-selector]",
s),p=function(c){a('[value="'+c.prop("value")+'"]',u).not(c).attr("disabled",c.is(":checked")?"disabled":!1)},A=function(a,j){var b=a.data("layout");a.attr("data-layout",j).find('[name^="'+w+"["+b+']"]').attr("name",function(a,c){return c.replace(w+"["+b+"]",w+"["+j+"]")})},q=a("#layout"),n=a("[data-layout-selector]",q),w=q.data("field-name"),D=a("[data-action=rename], [data-action=remove]",q),u=a("[data-assignment]",q);u.filter('[data-layout="default"] [data-assignment]').hide();a("input:checked",
u).each(function(){p(a(this))});n.on("change",function(){var c=n.val();D.toggle("default"!==c);a("[data-layout]").not(a('[data-layout="'+c+'"]').show()).hide()}).trigger("change");q.on("change","[data-assignment] input",function(c){p(a(c.target))}).on("click",'[data-action="add"]',function(c){c.preventDefault();if((c=prompt("Please enter a layout name",""))&&!a('option[value="'+c+'"]',n).length){var j=a('[data-layout="default"]').clone(!0);A(j,c);a('[data-layout="default"]').parent().children("[data-layout]:last").after(j);
n.append('<option value="'+c+'">'+c+"</option>").val(c).trigger("change");a("[data-assignment]",j).show()}}).on("click",'[data-action="rename"]',function(c){c.preventDefault();c=n.val();var j=prompt("Please enter a layout name",c);j&&(c!==j&&!a('option[value="'+j+'"]',n).length)&&(A(a('[data-layout="'+c+'"]'),j),n.find('option[value="'+c+'"]').attr("value",j).html(j))}).on("click",'[data-action="remove"]',function(c){c.preventDefault();c=n.val();a('[data-layout="'+c+'"]').remove();n.find('option[value="'+
c+'"]').remove().end().trigger("change")});a("[data-layout]",q).each(function(){a('select[name$="[width]"]:first',this).on("change",function(){var c=a(this),j=c.find('option[value="'+c.val()+'"]').data("gcf");c.closest("[data-layout]").find('select[name$="[width]"]:gt(0)').each(function(){var b=a(this),d=b.val();b.empty().append(c.find("option").clone().filter(function(){return 0===a(this).val()%j})).val(b.find('option[value="'+d+'"]').length?d:b.val())})}).trigger("change")});var x=a("#menus",s);
a("tr[data-level='1'] + tr[data-level='2']",x).each(function(){a(this).prev().find("td:first").prepend('<i class="uk-icon-angle-right"></i> ').wrapInner("<span data-toggler />")});a("tbody tr[data-level!='1']",x).hide();a(x).on("click","[data-toggler]",function(){a(this).closest("tr").nextUntil("tr[data-level='1']",x).toggle();a("i",this).toggleClass("uk-icon-angle-down")});a("[data-menu-filter]",x).on("change",function(){a("[data-menu]").not(a('[data-menu="'+a(this).val()+'"]').show()).hide()}).trigger("change");
var t=s.find(".tm-sidebar ul"),G=s.find(".tm-main");t.on("click","a",function(c){c.preventDefault();G.children().not("p").hide().filter(":eq("+(m._index=t.children("li").removeClass("uk-active").index(a(this).parent().addClass("uk-active")))+")").show()}).find("li:eq("+(m._index<G.children().length?m._index:0)+") a").trigger("click");var q=function(){var c=B.val(),j=C.val();a("[data-position]","#widgets").each(function(){var b=a(this),d=b.data("position"),d=""===j||j===d;b[d?"show":"hide"]();d&&(b.find("tr[data-widget-name]").each(function(){var b=
a(this),j=b.data("widget-name"),j=""===c||-1!==j.toLowerCase().indexOf(c.toLowerCase());b.toggle(j)}),b.find("tbody>tr:visible").length||b.hide())})},C=a("[data-position-filter]","#widgets").on("change",q),B=a("[data-widget-filter]","#widgets").on("keyup",a.UIkit.Utils.debounce(q,300)),k=a('<div class="tm-icon-picker"></div>').css({position:"absolute",display:"none"}).appendTo("body"),y=[];y.push('<ul class="uk-list uk-list-space">');a.each({"Web Application Icons":"uk-icon-adjust uk-icon-anchor uk-icon-archive uk-icon-asterisk uk-icon-ban-circle uk-icon-bar-chart uk-icon-barcode uk-icon-beaker uk-icon-beer uk-icon-bell uk-icon-bell-alt uk-icon-bolt uk-icon-book uk-icon-bookmark uk-icon-bookmark-empty uk-icon-briefcase uk-icon-bug uk-icon-building uk-icon-bullhorn uk-icon-bullseye uk-icon-calendar uk-icon-calendar-empty uk-icon-camera uk-icon-camera-retro uk-icon-certificate uk-icon-check uk-icon-check-empty uk-icon-check-minus uk-icon-check-sign uk-icon-circle uk-icon-circle-blank uk-icon-cloud uk-icon-cloud-download uk-icon-cloud-upload uk-icon-code uk-icon-code-fork uk-icon-coffee uk-icon-cog uk-icon-cogs uk-icon-collapse uk-icon-collapse-alt uk-icon-collapse-top uk-icon-comment uk-icon-comment-alt uk-icon-comments uk-icon-comments-alt uk-icon-compass uk-icon-credit-card uk-icon-crop uk-icon-dashboard uk-icon-desktop uk-icon-download uk-icon-download-alt uk-icon-edit uk-icon-edit-sign uk-icon-ellipsis-horizontal uk-icon-ellipsis-vertical uk-icon-envelope uk-icon-envelope-alt uk-icon-eraser uk-icon-exchange uk-icon-exclamation uk-icon-exclamation-sign uk-icon-expand uk-icon-expand-alt uk-icon-external-link uk-icon-external-link-sign uk-icon-eye-close uk-icon-eye-open uk-icon-facetime-video uk-icon-female uk-icon-fighter-jet uk-icon-film uk-icon-filter uk-icon-fire uk-icon-fire-extinguisher uk-icon-flag uk-icon-flag-alt uk-icon-flag-checkered uk-icon-folder-close uk-icon-folder-close-alt uk-icon-folder-open uk-icon-folder-open-alt uk-icon-food uk-icon-frown uk-icon-gamepad uk-icon-gift uk-icon-glass uk-icon-globe uk-icon-group uk-icon-hdd uk-icon-headphones uk-icon-heart uk-icon-heart-empty uk-icon-home uk-icon-inbox uk-icon-info uk-icon-info-sign uk-icon-key uk-icon-keyboard uk-icon-laptop uk-icon-leaf uk-icon-legal uk-icon-lemon uk-icon-level-down uk-icon-level-up uk-icon-lightbulb uk-icon-location-arrow uk-icon-lock uk-icon-magic uk-icon-magnet uk-icon-mail-forward uk-icon-mail-reply uk-icon-mail-reply-all uk-icon-male uk-icon-map-marker uk-icon-meh uk-icon-microphone uk-icon-microphone-off uk-icon-minus uk-icon-minus-sign uk-icon-minus-sign-alt uk-icon-mobile-phone uk-icon-money uk-icon-moon uk-icon-move uk-icon-music uk-icon-off uk-icon-ok uk-icon-ok-circle uk-icon-ok-sign uk-icon-pencil uk-icon-phone uk-icon-phone-sign uk-icon-picture uk-icon-plane uk-icon-plus uk-icon-plus-sign uk-icon-plus-sign-alt uk-icon-power-off uk-icon-print uk-icon-pushpin uk-icon-puzzle-piece uk-icon-qrcode uk-icon-question uk-icon-question-sign uk-icon-quote-left uk-icon-quote-right uk-icon-random uk-icon-refresh uk-icon-remove uk-icon-remove-circle uk-icon-remove-sign uk-icon-reorder uk-icon-reply uk-icon-reply-all uk-icon-resize-horizontal uk-icon-resize-vertical uk-icon-retweet uk-icon-road uk-icon-rocket uk-icon-rss uk-icon-rss-sign uk-icon-screenshot uk-icon-search uk-icon-share uk-icon-share-alt uk-icon-share-sign uk-icon-shield uk-icon-shopping-cart uk-icon-sign-blank uk-icon-signal uk-icon-signin uk-icon-signout uk-icon-sitemap uk-icon-smile uk-icon-sort uk-icon-sort-by-alphabet uk-icon-sort-by-alphabet-alt uk-icon-sort-by-attributes uk-icon-sort-by-attributes-alt uk-icon-sort-by-order uk-icon-sort-by-order-alt uk-icon-sort-down uk-icon-sort-up uk-icon-spinner uk-icon-star uk-icon-star-empty uk-icon-star-half uk-icon-star-half-empty uk-icon-star-half-full uk-icon-subscript uk-icon-suitcase uk-icon-sun uk-icon-superscript uk-icon-tablet uk-icon-tag uk-icon-tags uk-icon-tasks uk-icon-terminal uk-icon-thumbs-down uk-icon-thumbs-down-alt uk-icon-thumbs-up uk-icon-thumbs-up-alt uk-icon-ticket uk-icon-time uk-icon-tint uk-icon-trash uk-icon-trophy uk-icon-truck uk-icon-umbrella uk-icon-unchecked uk-icon-unlock uk-icon-unlock-alt uk-icon-upload uk-icon-upload-alt uk-icon-user uk-icon-volume-down uk-icon-volume-off uk-icon-volume-up uk-icon-warning-sign uk-icon-wrench uk-icon-zoom-in uk-icon-zoom-out".split(" "),
"Currency Icons":"uk-icon-bitcoin uk-icon-btc uk-icon-cny uk-icon-dollar uk-icon-eur uk-icon-euro uk-icon-gbp uk-icon-inr uk-icon-jpy uk-icon-krw uk-icon-renminbi uk-icon-rupee uk-icon-usd uk-icon-won uk-icon-yen".split(" "),"Text Editor Icons":"uk-icon-align-center uk-icon-align-justify uk-icon-align-left uk-icon-align-right uk-icon-bold uk-icon-columns uk-icon-copy uk-icon-cut uk-icon-eraser uk-icon-file uk-icon-file-alt uk-icon-file-text uk-icon-file-text-alt uk-icon-font uk-icon-indent-left uk-icon-indent-right uk-icon-italic uk-icon-link uk-icon-list uk-icon-list-alt uk-icon-list-ol uk-icon-list-ul uk-icon-paper-clip uk-icon-paperclip uk-icon-paste uk-icon-repeat uk-icon-rotate-left uk-icon-rotate-right uk-icon-save uk-icon-strikethrough uk-icon-table uk-icon-text-height uk-icon-text-width uk-icon-th uk-icon-th-large uk-icon-th-list uk-icon-underline uk-icon-undo uk-icon-unlink".split(" "),
"Directional Icons":"uk-icon-angle-down uk-icon-angle-left uk-icon-angle-right uk-icon-angle-up uk-icon-arrow-down uk-icon-arrow-left uk-icon-arrow-right uk-icon-arrow-up uk-icon-caret-down uk-icon-caret-left uk-icon-caret-right uk-icon-caret-up uk-icon-chevron-down uk-icon-chevron-left uk-icon-chevron-right uk-icon-chevron-sign-down uk-icon-chevron-sign-left uk-icon-chevron-sign-right uk-icon-chevron-sign-up uk-icon-chevron-up uk-icon-circle-arrow-down uk-icon-circle-arrow-left uk-icon-circle-arrow-right uk-icon-circle-arrow-up uk-icon-double-angle-down uk-icon-double-angle-left uk-icon-double-angle-right uk-icon-double-angle-up uk-icon-hand-down uk-icon-hand-left uk-icon-hand-right uk-icon-hand-up uk-icon-long-arrow-down uk-icon-long-arrow-left uk-icon-long-arrow-right uk-icon-long-arrow-up".split(" "),
"Video Player Icons":"uk-icon-backward uk-icon-eject uk-icon-fast-backward uk-icon-fast-forward uk-icon-forward uk-icon-fullscreen uk-icon-pause uk-icon-play uk-icon-play-circle uk-icon-play-sign uk-icon-resize-full uk-icon-resize-small uk-icon-step-backward uk-icon-step-forward uk-icon-stop uk-icon-youtube-play".split(" "),"Brand Icons":"uk-icon-adn uk-icon-android uk-icon-apple uk-icon-bitbucket uk-icon-bitbucket-sign uk-icon-bitcoin uk-icon-btc uk-icon-css3 uk-icon-dribbble uk-icon-dropbox uk-icon-facebook uk-icon-facebook-sign uk-icon-flickr uk-icon-foursquare uk-icon-github uk-icon-github-alt uk-icon-github-sign uk-icon-gittip uk-icon-google-plus uk-icon-google-plus-sign uk-icon-html5 uk-icon-instagram uk-icon-linkedin uk-icon-linkedin-sign uk-icon-linux uk-icon-maxcdn uk-icon-pinterest uk-icon-pinterest-sign uk-icon-renren uk-icon-skype uk-icon-stackexchange uk-icon-trello uk-icon-tumblr uk-icon-tumblr-sign uk-icon-twitter uk-icon-twitter-sign uk-icon-vk uk-icon-weibo uk-icon-windows uk-icon-xing uk-icon-xing-sign uk-icon-youtube uk-icon-youtube-play uk-icon-youtube-sign".split(" "),
"Medical Icons":"uk-icon-ambulance uk-icon-h-sign uk-icon-hospital uk-icon-medkit uk-icon-plus-sign-alt uk-icon-stethoscope uk-icon-user-md".split(" ")},function(c,b){y.push("<li><strong>"+c+"</strong></li>");a.each(b,function(){y.push('<li><a href="" class="'+this+' uk-icon-small" data-icon="'+this+'"> '+this+"</a></li>")})});y.push("</ul>");k.append(y.join("\n"));a(".tm-main").on("focus","input[name$='[icon]']",function(c){c.preventDefault();c=a(this);var b=c.offset(),d=b.top+c.height()+15;left=
b.left;k.data("input",c).css({top:d,left:left}).show();k[0].scrollTop=0});k.on("click","[class*='uk-icon']",function(c){c.preventDefault();k.data("input").val(a(this).data("icon"));k.hide()});a(document).on("click",function(c){k.is(":visible")&&!a(c.target).is("input[name$='[icon]']")&&k.hide()});a("[data-list-devices]").on("click","li",function(c){c.preventDefault();a(this).toggleClass("active").find("input").val(a(this).hasClass("active")?"1":"0")}).find("li").each(function(){a(this).toggleClass("active",
"0"!==a(this).find("input").val())});f.element.find("button").on("click",function(){r=!0;f.hide()});if(h())a("[href=#compile]").on("click",function(a){a.preventDefault();b.css("width","0%");g.html("");v.html("");f.show();setTimeout(function(){System.data().done(function(a){l(a,{progress:d}).done(function(c){e(c,a)}).fail(function(){f.hide()})}).fail(function(){f.hide()})},300)});else a("[href=#compile]").attr("disabled","disabled").on("click",function(a){a.preventDefault()});if(h()){var E=!1;a("a",
z).on("click",function(c){c.preventDefault();E||(E=!0,System.data().done(function(c){var n=a("body").addClass("cm-open");a.cookie(c.cookie,"1",{expires:1,path:"/"});s.append(a("[type*=template]",z).mustache());var h=function(b){var d=u.contents(),e=!0,n=!1,k=!1;a.each(c.less,function(c,j){if(!n){var f=d.find("head [data-file='"+j.target+"']");f.length&&(a.less.getCSS(j.source,{id:j.target,variables:b.variables,compress:!0}).done(function(c){e&&b.fonts&&(c=b.fonts+"\n"+c);"rtl"==d.find("html").attr("dir")&&
(c=a.rtl.convert2RTL(c));f.attr("href")?f.replaceWith(a("<style>").attr("data-file",f.data("file")).text(c)):f.text(c)}).fail(function(a){w.trigger("show",a);n=!0}),e=!1,k=!0)}});n||(m.show(),u.css("visibility","visible"),y.hide(),w.trigger("hide"));B.trigger(!k?"show":"hide","The current theme is not customizable.")},k=a("#customizer"),q=a("select[name=style]",k),p=a("[href='#copy']",k),r=a("[href='#remove']",k).hide(),u=a("#cm-theme-preview",k).css("visibility","hidden"),y=a("i.cm-spinner",k),w=
a(".cm-error",k),x=function(){n.removeClass("cm-open")},D=function(k,h){n.removeClass("cm-open");var q=c.styles,u={};c.styles={};a.each(h,function(b,d){if(k!=d.name&&q[d.name])c.styles[d.name]=q[d.name];else{var n=[];d.fonts&&n.push(d.fonts);a.each(d.variables,function(a,c){n.push(a+": "+c+";")});c.styles[d.name]=u[d.name]=n.join("\n")}});var t={styles:[]};a.each(c.styles,function(a){t.styles.push({name:a})});F.each(function(){var c=a(this),b=c.val();c.html(a.mustache('{{#styles}}<option value="{{name}}">{{name}}</option>{{/styles}}',
t));c.trigger("update",b)});b.css("width","0%");g.html("");v.html("");f.show();l(a.extend({},c,{styles:u}),{progress:d}).done(function(a){e(a,c)}).fail(function(){f.hide()})},t=[],C,m=a(".cm-sidebar-content",k),B=a(".cm-sidebar-message",k).hide();a.each(c.styles,function(b,d){t.push({name:b,config:c.config,config_vars:c.config_vars,variables:a.less.getVars(d)})});k.customizer({styles:t,updating:function(a,c){r.toggle("default"!=c.name);m.hide();u.css("visibility","hidden");y.show()},updated:function(c,
b){var d;b.fonts="";a("option[data-url]:selected",k).each(function(){if((d=a(this).data("url"))&&-1===b.fonts.indexOf("'"+d+"'"))b.fonts+="@import '"+d+"';\n"});h(C=b)}});u.on("load",function(){C?h(C):k.trigger("update")});w.on({show:function(c,b){w.html(a.mustache('<h1 class="uk-h3">LESS {{type}} Error</h1><p>{{message}}</p>',b)).show();u.css("visibility","hidden")},hide:function(){w.hide();u.css("visibility","visible")}});B.on({show:function(a,c){B.html(c).show();m.css("visibility","hidden")},hide:function(){B.hide();
m.css("visibility","visible")}});p.on("click",function(b){b.preventDefault();(b=prompt("Please enter a style name",""))&&!a('option[value="'+b+'"]',q).length&&t.push({name:b,config:c.config,config_vars:c.config_vars,variables:a.extend({},C.variables)});k.trigger("update",b)});r.on("click",function(c){c.preventDefault();var b;a.each(t,function(a,c){q.val()==c.name&&(b=a)});null!==b&&t.splice(b,1);k.trigger("update")});a("[href='#save']",k).on("click",function(b){b.preventDefault();k.remove();a.removeCookie(c.cookie,
{path:"/"});a.isFunction(D)&&D.call(this,q.val(),t)});a("[href='#reset']",k).on("click",function(b){b.preventDefault();b=q.val();var d;a.each(t,function(a,c){q.val()==c.name&&(d=a)});c.styles[b]&&null!==d&&(a.extend(t[d],{config:c.config,variables:a.less.getVars(c.styles[b]),groups:""}),k.trigger("update",[b,!0]))});a("[href='#cancel']",k).on("click",function(b){b.preventDefault();k.remove();a.removeCookie(c.cookie,{path:"/"});a.isFunction(x)&&x.call(this)})}).fail(function(c){a("a",z).after(a('<div class="uk-alert uk-alert-danger" />').text(c))}).always(function(){E=
!1}))})}else a("a",z).attr("disabled","disabled").on("click",function(a){a.preventDefault()}),s.prepend('<div class="uk-alert uk-alert-danger">Your browser does not support the customizing and LESS compiling features. Please update your browser.</div>');F.on("update",function(c,b){var d=a(this);b||(b=d.data("selected"));d.val(d.find('option[value="'+b+'"]').length?b:d.val())}).trigger("update")})})(jQuery,window.sessionStorage||{});
(function(a){var m=function(l,h){function r(a,b){var d="^"+a.replace(/\//g,"\\/").replace(/\*\*/g,"(\\/[^\\/]+)*").replace(/\*/g,"[^\\/]+").replace(/((?!\\))\?/g,"$1.")+"$";return null!==b.match(RegExp("^"+d+"$"))}var e=a(h.select,l),d=a(h.sidebar,l),m=a(h.advanced,l),f=a(h.error,l),b;l.on({update:function(v,g,m){a("option",e).length!=h.styles.length&&e.html(a.mustache(h.template.select,h));g&&e.val(g);var s=e.val();v=b;a.each(h.styles,function(a,d){s==d.name&&(b=d)});if(b!==v||m){l.trigger("updating",
b);var p=b,A=a.Deferred();p.groups?m=A.resolve():(a.ajax({url:p.config,cache:!1,dataType:"json"}).done(function(b){var d=a.extend({},p.config_vars);p.config=b;p.groups=[];p.variables=p.variables||{};p.matchName=r;a.each(p.config.groups,function(b,e){var f,g={label:e.label,variables:[],advanced:e.advanced||!1,more:!1};a.each(e.vars,function(b,e){a.each(d,function(a,b){r(e,a)&&(delete d[a],f={name:a,"default":b,placeholder:b,label:a.replace(/^@/,"").replace(/^\w+\-/,"").replace(/\-/g," "),more:-1!==
b.indexOf("@"),value:function(){return p.variables[a]?p.variables[a]:""}},f.more&&(g.more=!0,f.placeholder="@"),g.variables.push(f))})});g.variables.length&&p.groups.push(g)});A.resolve()}).fail(function(a,b,d){A.reject("Unable to retrieve "+p.config+" ("+d+")")}),m=A.promise());m.done(function(){var e=b;d.html(a.mustache(h.template.sidebar,e));d.find("input[data-name]").each(function(){var b=a(this),d=b.val()||b.data("default"),f,g;-1===b.attr("data-default").indexOf("@")&&a.each(e.config.controls,
function(e,h){a.each(h.vars,function(e,l){if(r(l,b.attr("data-name")))switch(h.type){case "color":var m=a('<div class="sp-placeholder"><div class="sp-placeholder-color"></div></div>').find("div").css("background-color",d).end().on("click",function(){var e;b.spectrum({showInput:!0,showAlpha:!0,color:d,change:function(a){1>a.toRgb().a&&b.val(a.toRgbString()).trigger("change")},show:function(){e||(e=a.fn.spectrum.get(b.data("spectrum.id")),e.container.find(".sp-cancel").after(a('<a href="#" class="sp-reset">reset</a>').on("click",
function(a){a.preventDefault();e.set(b.data("default"));e.hide();b.val("")})))}}).on("show-spectrum",function(){parseInt(e.container.find(".sp-slider").css("top"))>e.container.find(".sp-hue").height()&&e.container.find(".sp-slider").css("top",0)});m.remove();setTimeout(function(){b.spectrum("show")},50)});b.hide().after(m);break;case "font":g=[];a.isArray(h.options)?g.push({group:"",options:h.options}):a.each(h.options,function(a,b){g.push({group:a,options:b})});f=a(a.mustache('<select>{{#groups}}{{#group}}<optgroup label="{{group}}">{{/group}}{{#options}}<option value="{{value}}"{{#url}} data-url="{{url}}"{{/url}}>{{name}}</option>{{/options}}{{#group}}</optgroup>{{/group}}{{/groups}}</select>',
{groups:g}));b.replaceWith(f.val(d).attr("class",b.attr("class")).attr("name",b.attr("name")).attr("data-name",b.attr("data-name")));break;case "select":f=a(a.mustache('<select>{{#options}}<option value="{{value}}">{{name}}</option>{{/options}}</select>',{options:h.options})),b.replaceWith(f.val(d).attr("class",b.attr("class")).attr("name",b.attr("name")).attr("data-name",b.attr("data-name")))}})})});l.trigger("updated",b)}).fail(function(b){f.html(a.mustache('<h1 class="uk-h3">Error</h1><p>{{message}}</p>',
{message:b})).show()})}},updating:h.updating,updated:h.updated});e.on("change",function(){setTimeout(function(){l.trigger("update")},1)});m.on("change",function(){d[a(this).prop("checked")?"addClass":"removeClass"]("cm-show-advanced")}).trigger("change");l.on("click","a.cm-more-link",function(b){b.preventDefault();a(this).parents("fieldset:first").toggleClass("cm-show-more")});l.on("change","input[name=vars], select[name=vars]",function(d){d.preventDefault();d=a(this).attr("data-name");var e=a(this).val();
""===e?delete b.variables[d]:b.variables[d]=e;l.trigger("updated",b)})};a.fn.customizer=function(l){return this.each(function(){var h={updating:a.noop(),updated:a.noop(),select:"select[name=style]",advanced:"input[name=advanced]",sidebar:"section.cm-sidebar-content",error:".cm-error",template:{select:'{{#styles}}<option value="{{name}}">{{name}}</option>{{/styles}}',sidebar:'<div class="cm-vars cm-form uk-form">                             {{#groups}}                             <fieldset{{#advanced}} class="cm-advanced"{{/advanced}}>                                 <h2 class="cm-form-title">{{label}}{{#more}} <a href="#" class="cm-more-link"></a>{{/more}}</h2>                                 {{#variables}}                                 <div class="uk-form-row{{#more}} cm-more{{/more}}">                                     <label class="uk-form-label" title="{{name}}">{{label}}</label>                                     <div class="uk-form-controls">                                         <input class="uk-form-small" name="vars" type="text"{{#value}} value="{{value}}"{{/value}} placeholder="{{placeholder}}" data-name="{{name}}" data-default="{{default}}">                                     </div>                                 </div>                                 {{/variables}}                             </fieldset>                             {{/groups}}                         </div>'}};
new m(a(this),a.extend({},h,l))})}})(jQuery);
if("function"!=typeof window.parse_str)var parse_str=function(a,m){var l=String(a).replace(/^&/,"").replace(/&$/,"").split("&"),h=l.length,r,e,d,s,f,b,v,g,z;m||(m=this.window);for(r=0;r<h;r++){e=l[r].split("=");d=decodeURIComponent(e[0].replace(/\+/g,"%20"));for(v=2>e.length?"":decodeURIComponent(e[1].replace(/\+/g,"%20"));" "===d.charAt(0);)d=d.slice(1);-1<d.indexOf("\x00")&&(d=d.slice(0,d.indexOf("\x00")));if(d&&"["!==d.charAt(0)){g=[];for(e=b=0;e<d.length;e++)if("["===d.charAt(e)&&!b)b=e+1;else if("]"===
d.charAt(e)&&b&&(g.length||g.push(d.slice(0,b-1)),g.push(d.substr(b,e-b)),b=0,"["!==d.charAt(e+1)))break;g.length||(g=[d]);for(e=0;e<g[0].length;e++){b=g[0].charAt(e);if(" "===b||"."===b||"["===b)g[0]=g[0].substr(0,e)+"_"+g[0].substr(e+1);if("["===b)break}b=m;e=0;for(z=g.length;e<z;e++)if(d=g[e].replace(/^['"]/,"").replace(/['"]$/,""),f=b,""!==d&&" "!==d||0===e)void 0===b[d]&&(b[d]={}),b=b[d];else{d=-1;for(s in b)b.hasOwnProperty(s)&&+s>d&&s.match(/^\d+$/g)&&(d=+s);d+=1}f[d]=v}}};
