!function(){var e={fields:{},styleTag:{add:function(e){if(e=e.replace(/[^\w\s]/gi,"-"),null===document.getElementById("kirki-postmessage-"+e)||void 0===document.getElementById("kirki-postmessage-"+e)){var t=document.createElement("style");t.id="kirki-postmessage-"+e,document.head.appendChild(t)}},addData:function(t,n){t=t.replace("[","-").replace("]",""),e.styleTag.add(t);var i=document.getElementById("kirki-postmessage-"+t);i&&(i.textContent=n)}},util:{processValue:function(e,t){var n=this,i=window.parent.wp.customize.get(),a=!1;return"object"==typeof t?(_.each(t,function(i,a){t[a]=n.processValue(e,i)}),t):(1<=(e=_.defaults(e,{prefix:"",units:"",suffix:"",value_pattern:"$",pattern_replace:{},exclude:[]})).exclude.length&&_.each(e.exclude,function(e){t==e&&(a=!0)}),!a&&(t=e.value_pattern.replace(RegExp("\\$","g"),t),_.each(e.pattern_replace,function(e,n){_.isUndefined(i[e])||(t=t.replace(n,i[e]))}),e.prefix+t+e.units+e.suffix))},backgroundImageValue:function(e){return -1===e.indexOf("url(")?"url("+e+")":e}},css:{fromOutput:function(t,n,i){var a,c="",o=!1;try{n=JSON.parse(n)}catch(e){}if(t.js_callback&&"function"==typeof window[t.js_callback]&&(n=window[t.js_callback[0]](n,t.js_callback[1])),""===(c=wp.hooks.applyFilters("kirkiPostMessageStylesOutput",c,n,t,i)))switch(i){case"kirki-multicolor":case"kirki-sortable":c+=t.element+"{",_.each(n,function(n,o){if(!t.choice||o===t.choice){""===(a=e.util.processValue(t,n))&&("background-color"===t.property?a="unset":"background-image"===t.property&&(a="none"));var r="kirki-sortable"===i?t.property+"-"+o:t.property;!1!==a&&(c+=t.property?r+":"+a+";":o+":"+a+";")}}),c+="}";break;default:"kirki-image"===i&&(n=_.isUndefined(n.url)?e.util.backgroundImageValue(n):e.util.backgroundImageValue(n.url)),_.isObject(n)?(c+=t.element+"{",_.each(n,function(n,i){var o;t.choice&&i!==t.choice||(a=e.util.processValue(t,n),o=t.property?t.property:i,""===a&&("background-color"===o?a="unset":"background-image"===o&&(a="none")),!1!==a&&(c+=o+":"+a+";"))}),c+="}"):(""===(a=e.util.processValue(t,n))&&("background-color"===t.property?a="unset":"background-image"===t.property&&(a="none")),!1!==a&&(c+=t.element+"{"+t.property+":"+a+";}"))}return(t.media_query&&"string"==typeof t.media_query&&!_.isEmpty(t.media_query)&&-1===(o=t.media_query).indexOf("@media")&&(o="@media "+o),o)?o+"{"+c+"}":c}},html:{fromOutput:function(t,n){if(t.js_callback&&"function"==typeof window[t.js_callback]&&(n=window[t.js_callback[0]](n,t.js_callback[1])),_.isObject(n)||_.isArray(n)){if(!t.choice)return;_.each(n,function(e,i){t.choice&&i!==t.choice||(n=e)})}n=e.util.processValue(t,n);var i=document.querySelector(t.element);i&&(t.attr?i.setAttribute(t.attr,n):i.innerHTML=n)}},toggleClass:{fromOutput:function(e,t){if(void 0!==e.class&&void 0!==e.value){var n=document.querySelector(e.element);n&&(t!==e.value||n.classList.contains(e.class)?n.classList.remove(e.class):n.classList.add(e.class))}}}};window.kirkiPostMessage=e,document.addEventListener("DOMContentLoaded",function(){var t;_.each(kirkiPostMessageFields,function(n){var i=n.settings;"option"===n.option_type&&n.option_name&&0!==i.indexOf(n.option_name+"[")&&(i=n.option_name+"["+i+"]"),wp.customize(i,function(a){a.bind(function(a){t="",_.each(n.js_vars,function(i){i.function=i.function&&void 0!==e[i.function]?i.function:"css",n.type=n.choices&&n.choices.parent_type?n.choices.parent_type:n.type,"css"===i.function?t+=e.css.fromOutput(i,a,n.type):e[i.function].fromOutput(i,a,n.type)}),e.styleTag.addData(i,t)})})})})}();