1
0

main.min.js 46 KB

12
  1. /* Codestar Framework | A Simple and Lightweight WordPress Option Framework - v2.2.9*/
  2. !function(S,_,b,y){"use strict";var j={funcs:{}};j.vars={onloaded:!1,$body:S("body"),$window:S(_),$document:S(b),$form_warning:null,is_confirm:!1,form_modified:!1,code_themes:[],is_rtl:S("body").hasClass("rtl")},j.helper={uid:function(e){return(e||"")+Math.random().toString(36).substr(2,9)},preg_quote:function(e){return(e+"").replace(/(\[|\])/g,"\\$1")},name_nested_replace:function(e,t){var n=new RegExp(j.helper.preg_quote(t+"[\\d+]"),"g");e.find(":radio").each(function(){(this.checked||this.orginal_checked)&&(this.orginal_checked=!0)}),e.each(function(e){S(this).find(":input").each(function(){this.name=this.name.replace(n,t+"["+e+"]"),this.orginal_checked&&(this.checked=!0)})})},debounce:function(i,s,c){var a;return function(){var e=this,t=arguments,n=c&&!a;clearTimeout(a),a=setTimeout(function(){a=null,c||i.apply(e,t)},s),n&&i.apply(e,t)}}},S.fn.csf_clone=function(){for(var e=S.fn.clone.apply(this,arguments),t=this.find("select").add(this.filter("select")),n=e.find("select").add(e.filter("select")),i=0;i<t.length;++i)for(var s=0;s<t[i].options.length;++s)!0===t[i].options[s].selected&&(n[i].options[s].selected=!0);return this.find(":radio").each(function(){this.orginal_checked=this.checked}),e},S.fn.csf_expand_all=function(){return this.each(function(){S(this).on("click",function(e){e.preventDefault(),S(".csf-wrapper").toggleClass("csf-show-all"),S(".csf-section").csf_reload_script(),S(this).find(".fa").toggleClass("fa-indent").toggleClass("fa-outdent")})})},S.fn.csf_nav_options=function(){return this.each(function(){var n,e=S(this),t=S(_),i=S("#wpwrap"),s=e.find("a");t.on("hashchange csf.hashchange",function(){var e=_.location.hash.replace("#tab=",""),e=e||s.first().attr("href").replace("#tab=",""),t=S('[data-tab-id="'+e+'"]');t.length&&(t.closest(".csf-tab-item").addClass("csf-tab-expanded").siblings().removeClass("csf-tab-expanded"),t.next().is("ul")&&(e=(t=t.next().find("li").first().find("a")).data("tab-id")),s.removeClass("csf-active"),t.addClass("csf-active"),n&&n.addClass("hidden"),(t=S('[data-section-id="'+e+'"]')).removeClass("hidden"),t.csf_reload_script(),S(".csf-section-id").val(t.index()+1),n=t,i.hasClass("wp-responsive-open")&&(S("html, body").animate({scrollTop:t.offset().top-50},200),i.removeClass("wp-responsive-open")))}).trigger("csf.hashchange")})},S.fn.csf_nav_metabox=function(){return this.each(function(){var n,e=S(this),i=e.find("a"),s=e.parent().find(".csf-section");i.each(function(t){S(this).on("click",function(e){e.preventDefault();e=S(this),i.removeClass("csf-active"),e.addClass("csf-active"),n!==y&&n.addClass("hidden"),e=s.eq(t);e.removeClass("hidden"),e.csf_reload_script(),n=e})}),i.first().trigger("click")})},S.fn.csf_page_templates=function(){this.length&&S(b).on("change",".editor-page-attributes__template select, #page_template, .edit-post-post-status + div select",function(){var e=S(this).val()||"default";S(".csf-page-templates").removeClass("csf-metabox-show").addClass("csf-metabox-hide"),S(".csf-page-"+e.toLowerCase().replace(/[^a-zA-Z0-9]+/g,"-")).removeClass("csf-metabox-hide").addClass("csf-metabox-show")})},S.fn.csf_post_formats=function(){this.length&&S(b).on("change",'.editor-post-format select, #formatdiv input[name="post_format"]',function(){var e="0"===(e=S(this).val()||"default")?"default":e;S(".csf-post-formats").removeClass("csf-metabox-show").addClass("csf-metabox-hide"),S(".csf-post-format-"+e).removeClass("csf-metabox-hide").addClass("csf-metabox-show")})},S.fn.csf_search=function(){return this.each(function(){S(this).find("input").on("change keyup",function(){var t=S(this).val(),e=S(".csf-wrapper"),n=e.find(".csf-section").find("> .csf-field:not(.csf-depend-on)"),i=n.find("> .csf-title, .csf-search-tags");1<t.length?(n.addClass("csf-metabox-hide"),e.addClass("csf-search-all"),i.each(function(){var e=S(this);e.text().match(new RegExp(".*?"+t+".*?","i"))&&((e=e.closest(".csf-field")).removeClass("csf-metabox-hide"),e.parent().csf_reload_script())})):(n.removeClass("csf-metabox-hide"),e.removeClass("csf-search-all"))})})},S.fn.csf_sticky=function(){return this.each(function(){function e(){r=i.scrollTop(),f()}var n=S(this),i=S(_),s=n.find(".csf-header-inner"),c=parseInt(s.css("padding-left"))+parseInt(s.css("padding-right")),a=32,r=0,t=!1,o=function(){var e=n.offset().top,e=Math.max(a,e-r),t=i.innerWidth();e<=a&&782<t?(s.css({width:n.outerWidth()-c}),n.css({height:n.outerHeight()}).addClass("csf-sticky")):(s.removeAttr("style"),n.removeAttr("style").removeClass("csf-sticky"))},f=function(){t||requestAnimationFrame(function(){o(),t=!1}),t=!0};i.on("scroll resize",e),e()})},S.fn.csf_dependency=function(){return this.each(function(){var t,n,o,f,e=S(this),i=e.children("[data-controller]");i.length&&(t=S.csf_deps.createRuleset(),n=S.csf_deps.createRuleset(),o=[],f=[],i.each(function(){var i=S(this),e=i.data("controller").split("|"),s=i.data("condition").split("|"),c=i.data("value").toString().split("|"),a=!!i.data("depend-global"),r=a?n:t;S.each(e,function(e,t){var n=c[e]||"",e=s[e]||s[0];(r=r.createRule('[data-depend-id="'+t+'"]',e,n)).include(i),(a?f:o).push(t)})}),o.length&&S.csf_deps.enable(e,t,o),f.length&&S.csf_deps.enable(j.vars.$body,n,f))})},S.fn.csf_field_accordion=function(){return this.each(function(){S(this).find(".csf-accordion-title").on("click",function(){var e=S(this),t=e.find(".csf-accordion-icon"),e=e.next();t.hasClass("fa-angle-right")?t.removeClass("fa-angle-right").addClass("fa-angle-down"):t.removeClass("fa-angle-down").addClass("fa-angle-right"),e.data("opened")||(e.csf_reload_script(),e.data("opened",!0)),e.toggleClass("csf-accordion-open")})})},S.fn.csf_field_backup=function(){return this.each(function(){var t,n,i,s;_.wp.customize!==y&&(n=S(t=this),S("body"),i=n.find(".csf-import"),s=n.find(".csf-reset"),t.notificationOverlay=function(){wp.customize.notifications&&wp.customize.OverlayNotification&&(wp.customize.state("saved").get()||(wp.customize.state("changesetStatus").set("trash"),wp.customize.each(function(e){e._dirty=!1}),wp.customize.state("saved").set(!0)),wp.customize.notifications.add(new wp.customize.OverlayNotification("csf_field_backup_notification",{type:"default",message:"&nbsp;",loading:!0})))},s.on("click",function(e){e.preventDefault(),j.vars.is_confirm&&(t.notificationOverlay(),_.wp.ajax.post("csf-reset",{unique:s.data("unique"),nonce:s.data("nonce")}).done(function(e){_.location.reload(!0)}).fail(function(e){alert(e.error),wp.customize.notifications.remove("csf_field_backup_notification")}))}),i.on("click",function(e){e.preventDefault(),j.vars.is_confirm&&(t.notificationOverlay(),_.wp.ajax.post("csf-import",{unique:i.data("unique"),nonce:i.data("nonce"),data:n.find(".csf-import-data").val()}).done(function(e){_.location.reload(!0)}).fail(function(e){alert(e.error),wp.customize.notifications.remove("csf_field_backup_notification")}))}))})},S.fn.csf_field_background=function(){return this.each(function(){S(this).find(".csf--background-image").csf_reload_script()})},S.fn.csf_field_code_editor=function(){return this.each(function(){var t,i,e,s,c;"function"==typeof CodeMirror&&(t=S(this),i=t.find("textarea"),e=t.find(".CodeMirror"),s=i.data("editor"),e.length&&e.remove(),c=setInterval(function(){var n,e;t.is(":visible")&&(n=CodeMirror.fromTextArea(i[0],s),"default"!==s.theme&&-1===j.vars.code_themes.indexOf(s.theme)&&(e=S("<link>"),S("#csf-codemirror-css").after(e),e.attr({rel:"stylesheet",id:"csf-codemirror-"+s.theme+"-css",href:s.cdnURL+"/theme/"+s.theme+".min.css",type:"text/css",media:"all"}),j.vars.code_themes.push(s.theme)),CodeMirror.modeURL=s.cdnURL+"/mode/%N/%N.min.js",CodeMirror.autoLoadMode(n,s.mode),n.on("change",function(e,t){i.val(n.getValue()).trigger("change")}),clearInterval(c))}))})},S.fn.csf_field_date=function(){return this.each(function(){var e=S(this),n=e.find("input"),i=e.find(".csf-date-settings").data("settings"),i=S.extend({},i,{showAnim:"",beforeShow:function(e,t){S(t.dpDiv).addClass("csf-datepicker-wrapper")},onClose:function(e,t){S(t.dpDiv).removeClass("csf-datepicker-wrapper")}});2===n.length&&(i=S.extend({},i,{onSelect:function(e){S(this),n.first();var t=n.first().attr("id")===S(this).attr("id")?"minDate":"maxDate",e=S.datepicker.parseDate(i.dateFormat,e);n.not(this).datepicker("option",t,e)}})),n.each(function(){var e=S(this);e.hasClass("hasDatepicker")&&e.removeAttr("id").removeClass("hasDatepicker"),e.datepicker(i)})})},S.fn.csf_field_datetime=function(){return this.each(function(){var e=S(this),i=e.find("input"),t=e.find(".csf-datetime-settings").data("settings"),t=S.extend({},t,{onReady:function(e,t,n){S(n.calendarContainer).addClass("csf-flatpickr")}});2===i.length&&(t=S.extend({},t,{onChange:function(e,t,n){"from"===S(n.element).data("type")?i.last().get(0)._flatpickr.set("minDate",e[0]):i.first().get(0)._flatpickr.set("maxDate",e[0])}})),i.each(function(){S(this).flatpickr(t)})})},S.fn.csf_field_fieldset=function(){return this.each(function(){S(this).find(".csf-fieldset-content").csf_reload_script()})},S.fn.csf_field_gallery=function(){return this.each(function(){var s,e=S(this),c=e.find(".csf-edit-gallery"),a=e.find(".csf-clear-gallery"),r=e.find("ul"),o=e.find("input");e.find("img");e.on("click",".csf-button, .csf-edit-gallery",function(e){var t=S(this),n=o.val(),t=t.hasClass("csf-edit-gallery")?"edit":"add",i="add"!=t||n.length?"gallery-edit":"gallery";e.preventDefault(),void 0!==_.wp&&_.wp.media&&_.wp.media.gallery&&("gallery"==i?(s=_.wp.media({library:{type:"image"},frame:"post",state:"gallery",multiple:!0})).open():(s=_.wp.media.gallery.edit('[gallery ids="'+n+'"]'),"add"==t&&s.setState("gallery-library")),s.on("update",function(e){r.empty();e=e.models.map(function(e){var e=e.toJSON(),t=(e.sizes&&e.sizes.thumbnail&&e.sizes.thumbnail.url?e.sizes.thumbnail:e).url;return r.append('<li><img src="'+t+'"></li>'),e.id});o.val(e.join(",")).trigger("change"),a.removeClass("hidden"),c.removeClass("hidden")}))}),a.on("click",function(e){e.preventDefault(),r.empty(),o.val("").trigger("change"),a.addClass("hidden"),c.addClass("hidden")})})},S.fn.csf_field_group=function(){return this.each(function(){function e(e){e.preventDefault();var t,n,i,s,e=c.children(".csf-cloneable-item").length;r.hide(),h&&h<e+1?a.show():(t=(e=S(this).parent().parent()).children(".csf-cloneable-helper").csf_clone(!0),n=e.children(".csf-cloneable-title").csf_clone(),i=e.children(".csf-cloneable-content").csf_clone(),(s=S('<div class="csf-cloneable-item" />')).append(t),s.append(n),s.append(i),c.children().eq(e.index()).after(s),j.helper.name_nested_replace(c.children(".csf-cloneable-item"),l),c.accordion("refresh"),c.csf_customizer_refresh(),c.csf_customizer_listen({closest:!0}),d&&u(c))}function t(e){e.preventDefault(),e=c.children(".csf-cloneable-item").length,a.hide(),r.hide(),p&&e-1<p?r.show():(S(this).closest(".csf-cloneable-item").remove(),j.helper.name_nested_replace(c.children(".csf-cloneable-item"),l),c.csf_customizer_refresh(),d&&u(c))}var n=S(this),i=n.children(".csf-fieldset"),i=i.length?i:n,c=i.children(".csf-cloneable-wrapper"),s=i.children(".csf-cloneable-hidden"),a=i.children(".csf-cloneable-max"),r=i.children(".csf-cloneable-min"),o=c.data("title-by"),f=c.data("title-by-prefix"),l=c.data("field-id"),d=Boolean(Number(c.data("title-number"))),h=parseInt(c.data("max")),p=parseInt(c.data("min")),u=(c.hasClass("ui-accordion")&&c.find(".ui-accordion-header-icon").remove(),function(e){e.find(".csf-cloneable-title-number").each(function(e){S(this).html(S(this).closest(".csf-cloneable-item").index()+1+".")})});c.accordion({header:"> .csf-cloneable-item > .csf-cloneable-title",collapsible:!0,active:!1,animate:!1,heightStyle:"content",icons:{header:"csf-cloneable-header-icon fas fa-angle-right",activeHeader:"csf-cloneable-header-icon fas fa-angle-down"},activate:function(e,t){var i,s,n=t.newPanel,t=t.newHeader;n.length&&!n.data("opened")?(i=t.find(".csf-cloneable-value"),s=[],S.each(o,function(e,t){s.push(n.find('[data-depend-id="'+t+'"]'))}),S.each(s,function(e,t){t.on("change keyup csf.keyup",function(){var n=[];S.each(s,function(e,t){t=t.val();t&&n.push(t)}),n.length&&i.text(n.join(f))}).trigger("csf.keyup")}),n.csf_reload_script(),n.data("opened",!0),n.data("retry",!1)):n.data("retry")&&(n.csf_reload_script_retry(),n.data("retry",!1))}}),c.sortable({axis:"y",handle:".csf-cloneable-title,.csf-cloneable-sort",helper:"original",cursor:"move",placeholder:"widget-placeholder",start:function(e,t){c.accordion({active:!1}),c.sortable("refreshPositions"),t.item.children(".csf-cloneable-content").data("retry",!0)},update:function(e,t){j.helper.name_nested_replace(c.children(".csf-cloneable-item"),l),c.csf_customizer_refresh(),d&&u(c)}}),i.children(".csf-cloneable-add").on("click",function(e){e.preventDefault();var t=c.children(".csf-cloneable-item").length;r.hide(),h&&h<t+1?a.show():((e=s.csf_clone(!0)).removeClass("csf-cloneable-hidden"),e.find(':input[name!="_pseudo"]').each(function(){this.name=this.name.replace("___","").replace(l+"[0]",l+"["+t+"]")}),c.append(e),c.accordion("refresh"),c.accordion({active:t}),c.csf_customizer_refresh(),c.csf_customizer_listen({closest:!0}),d&&u(c))}),c.children(".csf-cloneable-item").children(".csf-cloneable-helper").on("click",".csf-cloneable-clone",e),i.children(".csf-cloneable-hidden").children(".csf-cloneable-helper").on("click",".csf-cloneable-clone",e);c.children(".csf-cloneable-item").children(".csf-cloneable-helper").on("click",".csf-cloneable-remove",t),i.children(".csf-cloneable-hidden").children(".csf-cloneable-helper").on("click",".csf-cloneable-remove",t)})},S.fn.csf_field_icon=function(){return this.each(function(){var n=S(this);n.on("click",".csf-icon-add",function(e){e.preventDefault();var e=S(this),t=S("#csf-modal-icon");t.removeClass("hidden"),j.vars.$icon_target=n,j.vars.icon_modal_loaded||(t.find(".csf-modal-loading").show(),_.wp.ajax.post("csf-get-icons",{nonce:e.data("nonce")}).done(function(e){t.find(".csf-modal-loading").hide(),j.vars.icon_modal_loaded=!0;var n=t.find(".csf-modal-load").html(e.content);n.on("click","i",function(e){e.preventDefault();e=S(this).attr("title");j.vars.$icon_target.find(".csf-icon-preview i").removeAttr("class").addClass(e),j.vars.$icon_target.find(".csf-icon-preview").removeClass("hidden"),j.vars.$icon_target.find(".csf-icon-remove").removeClass("hidden"),j.vars.$icon_target.find("input").val(e).trigger("change"),t.addClass("hidden")}),t.on("change keyup",".csf-icon-search",function(){var t=S(this).val();n.find("i").each(function(){var e=S(this);e.attr("title").search(new RegExp(t,"i"))<0?e.hide():e.show()})}),t.on("click",".csf-modal-close, .csf-modal-overlay",function(){t.addClass("hidden")})}).fail(function(e){t.find(".csf-modal-loading").hide(),t.find(".csf-modal-load").html(e.error),t.on("click",function(){t.addClass("hidden")})}))}),n.on("click",".csf-icon-remove",function(e){e.preventDefault(),n.find(".csf-icon-preview").addClass("hidden"),n.find("input").val("").trigger("change"),S(this).addClass("hidden")})})},S.fn.csf_field_map=function(){return this.each(function(){var e,t,n,i,s,c,a,r,o,f,l;"undefined"!=typeof L&&(l=(e=S(this)).find(".csf--map-osm"),t=e.find(".csf--map-search input"),n=e.find(".csf--latitude"),i=e.find(".csf--longitude"),s=e.find(".csf--zoom"),c=l.data("map"),a=L.map(l.get(0),c),L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}).addTo(a),r=L.marker(c.center,{draggable:!0}).addTo(a),o=function(e){n.val(e.lat),i.val(e.lng),s.val(a.getZoom())},a.on("click",function(e){r.setLatLng(e.latlng),o(e.latlng)}),a.on("zoom",function(){o(r.getLatLng())}),r.on("drag",function(){o(r.getLatLng())}),t.length||(t=S('[data-depend-id="'+e.find(".csf--address-field").data("address-field")+'"]')),f={},t.autocomplete({source:function(e,t){var n=e.term;n in f?t(f[n]):S.get("https://nominatim.openstreetmap.org/search",{format:"json",q:n},function(e){e=e.length?e.map(function(e){return{value:e.display_name,label:e.display_name,lat:e.lat,lon:e.lon}},"json"):[{value:"no-data",label:"No Results."}];f[n]=e,t(e)})},select:function(e,t){if("no-data"===t.item.value)return!1;t=L.latLng(t.item.lat,t.item.lon);a.panTo(t),r.setLatLng(t),o(t)},create:function(e,t){S(this).autocomplete("widget").addClass("csf-map-ui-autocomplate")}}),n.on("change",l=function(){var e=L.latLng(n.val(),i.val());a.panTo(e),r.setLatLng(e)}),i.on("change",l))})},S.fn.csf_field_link=function(){return this.each(function(){var i=S(this),e=i.find(".csf--link"),s=i.find(".csf--add"),c=i.find(".csf--edit"),a=i.find(".csf--remove"),r=i.find(".csf--result"),t=j.helper.uid("csf-wplink-textarea-");s.on("click",function(e){e.preventDefault(),_.wpLink.open(t)}),c.on("click",function(e){e.preventDefault(),s.trigger("click"),S("#wp-link-url").val(i.find(".csf--url").val()),S("#wp-link-text").val(i.find(".csf--text").val()),S("#wp-link-target").prop("checked","_blank"===i.find(".csf--target").val())}),a.on("click",function(e){e.preventDefault(),i.find(".csf--url").val("").trigger("change"),i.find(".csf--text").val(""),i.find(".csf--target").val(""),s.removeClass("hidden"),c.addClass("hidden"),a.addClass("hidden"),r.parent().addClass("hidden")}),e.attr("id",t).on("change",function(){var e=_.wpLink.getAttrs(),t=e.href,n=S("#wp-link-text").val(),e=e.target||"";i.find(".csf--url").val(t).trigger("change"),i.find(".csf--text").val(n),i.find(".csf--target").val(e),r.html('{url:"'+t+'", text:"'+n+'", target:"'+e+'"}'),s.addClass("hidden"),c.removeClass("hidden"),a.removeClass("hidden"),r.parent().removeClass("hidden")})})},S.fn.csf_field_media=function(){return this.each(function(){var n,i=S(this),s=i.find(".csf--button"),c=i.find(".csf--remove"),a=s.data("library")&&s.data("library").split(",")||"",r=!!i.hasClass("csf-assign-field-background")&&i.closest(".csf-field-background").find(".csf--auto-attributes");s.on("click",function(e){e.preventDefault(),void 0!==_.wp&&_.wp.media&&_.wp.media.gallery&&(n||(n=_.wp.media({library:{type:a}})).on("select",function(){var e=n.state().get("selection").first().attributes,t=s.data("preview-size")||"thumbnail";a.length&&-1===a.indexOf(e.subtype)&&-1===a.indexOf(e.type)||(i.find(".csf--id").val(e.id),i.find(".csf--width").val(e.width),i.find(".csf--height").val(e.height),i.find(".csf--alt").val(e.alt),i.find(".csf--title").val(e.title),i.find(".csf--description").val(e.description),t=void 0!==e.sizes&&void 0!==e.sizes.thumbnail&&"thumbnail"===t?e.sizes.thumbnail.url:void 0!==e.sizes&&void 0!==e.sizes.full?e.sizes.full.url:"image"===e.type?e.url:e.icon,r&&r.removeClass("csf--attributes-hidden"),c.removeClass("hidden"),i.find(".csf--preview").removeClass("hidden"),i.find(".csf--src").attr("src",t),i.find(".csf--thumbnail").val(t),i.find(".csf--url").val(e.url).trigger("change"))}),n.open())}),c.on("click",function(e){e.preventDefault(),r&&r.addClass("csf--attributes-hidden"),c.addClass("hidden"),i.find("input").val(""),i.find(".csf--preview").addClass("hidden"),i.find(".csf--url").trigger("change")})})},S.fn.csf_field_repeater=function(){return this.each(function(){function e(e){e.preventDefault();var t,n,i,e=s.children(".csf-repeater-item").length;r.hide(),f&&f<e+1?a.show():(t=(e=S(this).parent().parent().parent()).children(".csf-repeater-content").csf_clone(),n=e.children(".csf-repeater-helper").csf_clone(!0),(i=S('<div class="csf-repeater-item" />')).append(t),i.append(n),s.children().eq(e.index()).after(i),i.children(".csf-repeater-content").csf_reload_script(),j.helper.name_nested_replace(s.children(".csf-repeater-item"),o),s.csf_customizer_refresh(),s.csf_customizer_listen({closest:!0}))}function t(e){e.preventDefault(),e=s.children(".csf-repeater-item").length,a.hide(),r.hide(),l&&e-1<l?r.show():(S(this).closest(".csf-repeater-item").remove(),j.helper.name_nested_replace(s.children(".csf-repeater-item"),o),s.csf_customizer_refresh())}var n=S(this),i=n.children(".csf-fieldset"),i=i.length?i:n,s=i.children(".csf-repeater-wrapper"),c=i.children(".csf-repeater-hidden"),a=i.children(".csf-repeater-max"),r=i.children(".csf-repeater-min"),o=s.data("field-id"),f=parseInt(s.data("max")),l=parseInt(s.data("min"));s.children(".csf-repeater-item").children(".csf-repeater-content").csf_reload_script(),s.sortable({axis:"y",handle:".csf-repeater-sort",helper:"original",cursor:"move",placeholder:"widget-placeholder",update:function(e,t){j.helper.name_nested_replace(s.children(".csf-repeater-item"),o),s.csf_customizer_refresh(),t.item.csf_reload_script_retry()}}),i.children(".csf-repeater-add").on("click",function(e){e.preventDefault();var t=s.children(".csf-repeater-item").length;r.hide(),f&&f<t+1?a.show():((e=c.csf_clone(!0)).removeClass("csf-repeater-hidden"),e.find(':input[name!="_pseudo"]').each(function(){this.name=this.name.replace("___","").replace(o+"[0]",o+"["+t+"]")}),s.append(e),e.children(".csf-repeater-content").csf_reload_script(),s.csf_customizer_refresh(),s.csf_customizer_listen({closest:!0}))}),s.children(".csf-repeater-item").children(".csf-repeater-helper").on("click",".csf-repeater-clone",e),i.children(".csf-repeater-hidden").children(".csf-repeater-helper").on("click",".csf-repeater-clone",e);s.children(".csf-repeater-item").children(".csf-repeater-helper").on("click",".csf-repeater-remove",t),i.children(".csf-repeater-hidden").children(".csf-repeater-helper").on("click",".csf-repeater-remove",t)})},S.fn.csf_field_slider=function(){return this.each(function(){var e=S(this),n=e.find("input"),t=e.find(".csf-slider-ui"),e=n.data(),i=n.val()||0;t.hasClass("ui-slider")&&t.empty(),t.slider({range:"min",value:i,min:e.min||0,max:e.max||100,step:e.step||1,slide:function(e,t){n.val(t.value).trigger("change")}}),n.on("keyup",function(){t.slider("value",n.val())})})},S.fn.csf_field_sortable=function(){return this.each(function(){var n=S(this).find(".csf-sortable");n.sortable({axis:"y",helper:"original",cursor:"move",placeholder:"widget-placeholder",update:function(e,t){n.csf_customizer_refresh()}}),n.find(".csf-sortable-content").csf_reload_script()})},S.fn.csf_field_sorter=function(){return this.each(function(){var i=S(this),e=i.find(".csf-enabled"),t=i.find(".csf-disabled"),t=!!t.length&&t;e.sortable({connectWith:t,placeholder:"ui-sortable-placeholder",update:function(e,t){var n=t.item.find("input");t.item.parent().hasClass("csf-enabled")?n.attr("name",n.attr("name").replace("disabled","enabled")):n.attr("name",n.attr("name").replace("enabled","disabled")),i.csf_customizer_refresh()}}),t&&t.sortable({connectWith:e,placeholder:"ui-sortable-placeholder",update:function(e,t){i.csf_customizer_refresh()}})})},S.fn.csf_field_spinner=function(){return this.each(function(){var e=S(this),n=e.find("input"),e=e.find(".ui-button"),i=n.data();e.length&&e.remove(),n.spinner({min:i.min||0,max:i.max||100,step:i.step||1,create:function(e,t){i.unit&&n.after('<span class="ui-button csf--unit">'+i.unit+"</span>")},spin:function(e,t){n.val(t.value).trigger("change")}})})},S.fn.csf_field_switcher=function(){return this.each(function(){var n=S(this).find(".csf--switcher");n.on("click",function(){var e=0,t=n.find("input");n.hasClass("csf--active")?n.removeClass("csf--active"):(e=1,n.addClass("csf--active")),t.val(e).trigger("change")})})},S.fn.csf_field_tabbed=function(){return this.each(function(){var e=S(this),t=e.find(".csf-tabbed-nav a"),n=e.find(".csf-tabbed-content");n.eq(0).csf_reload_script(),t.on("click",function(e){e.preventDefault();var e=S(this),t=e.index(),t=n.eq(t);e.addClass("csf-tabbed-active").siblings().removeClass("csf-tabbed-active"),t.csf_reload_script(),t.removeClass("hidden").siblings().addClass("hidden")})})},S.fn.csf_field_typography=function(){return this.each(function(){var x=this,z=S(this),i=[],D=csf_typography_json.webfonts,t=csf_typography_json.googlestyles,O=csf_typography_json.defaultstyles;x.sanitize_subset=function(e){return e=(e=e.replace("-ext"," Extended")).charAt(0).toUpperCase()+e.slice(1)},x.sanitize_style=function(e){return t[e]||e},x.load_google_font=function(e,t,n){e&&"object"==typeof WebFont&&(t=t?t.replace("normal",""):"",n=n?n.replace("normal",""):"",-1===i.indexOf(e=t||n?e+":"+t+n:e)&&WebFont.load({google:{families:[e]}}),i.push(e))},x.append_select_options=function(e,t,s,c,a){e.find("option").not(":first").remove();var r="";S.each(t,function(e,t){var n=t,i=a?s&&-1!==s.indexOf(t)?" selected":"":s&&s===t?" selected":"";"subset"===c?n=x.sanitize_subset(t):"style"===c&&(n=x.sanitize_style(t)),r+='<option value="'+t+'"'+i+">"+n+"</option>"}),e.append(r).trigger("csf.change").trigger("chosen:updated")},x.init=function(){var c,a,r,o,f,l,d,h,g,p=[],e=z.find(".csf--typography"),u=z.find(".csf--type"),v=z.find(".csf--block-font-style"),m=e.data("unit"),_=e.data("line-height-unit"),t=e.data("exclude")?e.data("exclude").split(","):[],b=(z.find(".csf--chosen").length&&z.find("select").each(function(){var e=S(this),t=e.parent().find(".chosen-container");t.length&&t.remove(),e.chosen({allow_single_deselect:!0,disable_search_threshold:15,width:"100%"})}),z.find(".csf--font-family")),i=b.val(),s=(b.find("option").not(":first-child").remove(),""),y=(S.each(D,function(n,e){t&&-1!==t.indexOf(n)||(s+='<optgroup label="'+e.label+'">',S.each(e.fonts,function(e,t){s+='<option value="'+(t="object"==typeof t?e:t)+'" data-type="'+n+'"'+(t===i?" selected":"")+">"+t+"</option>"}),s+="</optgroup>")}),b.append(s).trigger("chosen:updated"),z.find(".csf--block-font-style")),w=(y.length&&(c=z.find(".csf--font-style-select"),a=c.val()?c.val().replace(/normal/g,""):"",c.on("change csf.change",function(e){var t=c.val(),n=(t=!t&&p&&-1===p.indexOf("normal")?p[0]:t)&&"italic"!==t&&"normal"===t?"normal":"",n=t&&"italic"!==t&&"normal"!==t?t.replace("italic",""):n,t=t&&"italic"===t.substr(-6)?"italic":"";z.find(".csf--font-weight").val(n),z.find(".csf--font-style").val(t)}),(r=z.find(".csf--block-extra-styles")).length&&(o=z.find(".csf--extra-styles"),f=o.val())),z.find(".csf--block-subset")),C=(w.length&&(l=z.find(".csf--subset"),d=l.val(),h=l.data("multiple")||!1),z.find(".csf--block-backup-font-family")),k=(b.on("change csf.change",function(e){w.length&&w.addClass("hidden"),r.length&&r.addClass("hidden"),C.length&&C.addClass("hidden");var t,n,i=b.find(":selected"),s=i.val(),i=i.data("type");i&&s?("google"!==i&&"custom"!==i||!C.length||C.removeClass("hidden"),y.length&&(n=O,"google"===i&&D[i].fonts[s][0]?n=D[i].fonts[s][0]:"custom"===i&&D[i].fonts[s]&&(n=D[i].fonts[s]),t=-1!==(p=n).indexOf("normal")?"normal":n[0],t=a&&-1!==n.indexOf(a)?a:t,x.append_select_options(c,n,t,"style"),a=!1,y.removeClass("hidden"),"google"===i&&r.length&&1<n.length&&(x.append_select_options(o,n,f,"style",!0),f=!1,r.removeClass("hidden"))),"google"===i&&w.length&&D[i].fonts[s][1]&&(n=(t=D[i].fonts[s][1]).length<2&&"latin"!==t[0]?t[0]:"",s=d&&-1!==t.indexOf(d)?d:n,s=h&&d?d:s,x.append_select_options(l,t,s,"subset",h),d=!1,w.removeClass("hidden"))):(v.find(":input").val(""),w.length&&(l.find("option").not(":first-child").remove(),l.trigger("chosen:updated")),y.length&&(c.find("option").not(":first-child").remove(),c.trigger("chosen:updated"))),u.val(i)}).trigger("csf.change"),z.find(".csf--block-preview"));k.length&&(g=z.find(".csf--preview"),z.on("change",j.helper.debounce(function(e){k.removeClass("hidden");var t=b.val(),n=z.find(".csf--font-weight").val(),i=z.find(".csf--font-style").val(),s=z.find(".csf--font-size").val(),c=z.find(".csf--font-variant").val(),a=z.find(".csf--line-height").val(),r=z.find(".csf--text-align").val(),o=z.find(".csf--text-transform").val(),f=z.find(".csf--text-decoration").val(),l=z.find(".csf--color").val(),d=z.find(".csf--word-spacing").val(),h=z.find(".csf--letter-spacing").val(),p=z.find(".csf--custom-style").val(),u=("google"===z.find(".csf--type").val()&&x.load_google_font(t,n,i),{});t&&(u.fontFamily=t),n&&(u.fontWeight=n),i&&(u.fontStyle=i),c&&(u.fontVariant=c),s&&(u.fontSize=s+m),a&&(u.lineHeight=a+_),h&&(u.letterSpacing=h+m),d&&(u.wordSpacing=d+m),r&&(u.textAlign=r),o&&(u.textTransform=o),f&&(u.textDecoration=f),l&&(u.color=l),g.removeAttr("style"),p&&g.attr("style",p),g.css(u)},100)),k.on("click",function(){g.toggleClass("csf--black-background");var e=k.find(".csf--toggle");e.hasClass("fa-toggle-off")?e.removeClass("fa-toggle-off").addClass("fa-toggle-on"):e.removeClass("fa-toggle-on").addClass("fa-toggle-off")}),k.hasClass("hidden")||z.trigger("change"))},x.init()})},S.fn.csf_field_upload=function(){return this.each(function(){var t,e=S(this),n=e.find("input"),i=e.find(".csf--button"),s=e.find(".csf--remove"),c=e.find(".csf--preview"),a=e.find(".csf--src"),r=i.data("library")&&i.data("library").split(",")||"";i.on("click",function(e){e.preventDefault(),void 0!==_.wp&&_.wp.media&&_.wp.media.gallery&&(t||(t=_.wp.media({library:{type:r}})).on("select",function(){var e=t.state().get("selection").first().attributes;r.length&&-1===r.indexOf(e.subtype)&&-1===r.indexOf(e.type)||n.val(e.url).trigger("change")}),t.open())}),s.on("click",function(e){e.preventDefault(),n.val("").trigger("change")}),n.on("change",function(e){var t=n.val();t?s.removeClass("hidden"):s.addClass("hidden"),c.length&&(-1!==S.inArray(t.split(".").pop().toLowerCase(),["jpg","jpeg","gif","png","svg","webp"])?(c.removeClass("hidden"),a.attr("src",t)):c.addClass("hidden"))})})},S.fn.csf_field_wp_editor=function(){return this.each(function(){var e,t,n,i,s,c,a,r;void 0!==_.wp.editor&&void 0!==_.tinyMCEPreInit&&void 0!==_.tinyMCEPreInit.mceInit.csf_wp_editor&&(t=(e=S(this)).find(".csf-wp-editor"),n=e.find("textarea"),(e.find(".wp-editor-wrap").length||e.find(".mce-container").length)&&(t.empty(),t.append(n),n.css("display","")),i=j.helper.uid("csf-editor-"),n.attr("id",i),s={tinymce:_.tinyMCEPreInit.mceInit.csf_wp_editor,quicktags:_.tinyMCEPreInit.qtInit.csf_wp_editor},c=t.data("editor-settings"),(r=wp.oldEditor||wp.editor)&&r.hasOwnProperty("autop")&&(wp.editor.autop=r.autop,wp.editor.removep=r.removep,wp.editor.initialize=r.initialize),s.tinymce=S.extend({},s.tinymce,{selector:"#"+i,setup:function(t){t.on("change keyup",function(){var e=c.wpautop?t.getContent():wp.editor.removep(t.getContent());n.val(e).trigger("change")})}}),!1===c.tinymce&&(s.tinymce=!1,t.addClass("csf-no-tinymce")),!1===c.quicktags&&(s.quicktags=!1,t.addClass("csf-no-quicktags")),a=setInterval(function(){e.is(":visible")&&(_.wp.editor.initialize(i,s),clearInterval(a))}),c.media_buttons&&_.csf_media_buttons&&((r=t.find(".wp-media-buttons")).length?r.find(".csf-shortcode-button").data("editor-id",i):((r=S(_.csf_media_buttons)).find(".csf-shortcode-button").data("editor-id",i),t.prepend(r))))})},S.fn.csf_confirm=function(){return this.each(function(){S(this).on("click",function(e){var t=S(this).data("confirm")||_.csf_vars.i18n.confirm;if(!confirm(t))return e.preventDefault(),!1;j.vars.is_confirm=!0,j.vars.form_modified=!1})})},S.fn.serializeObject=function(){var i={};return S.each(this.serializeArray(),function(e,t){var n=t.name,t=t.value;i[n]=i[n]===y?t:S.isArray(i[n])?i[n].concat(t):[i[n],t]}),i},S.fn.csf_save=function(){return this.each(function(){var i,s=S(this),c=S(".csf-save"),a=S(".csf-options"),r=!1;s.on("click",function(e){var t,n;r||(t=s.data("save"),n=s.val(),c.attr("value",t),s.hasClass("csf-save-ajax")?(e.preventDefault(),a.addClass("csf-saving"),c.prop("disabled",!0),_.wp.ajax.post("csf_"+a.data("unique")+"_ajax_save",{data:S("#csf-form").serializeJSONCSF()}).done(function(e){S(".csf-error").remove(),Object.keys(e.errors).length&&(s='<i class="csf-label-error csf-error">!</i>',S.each(e.errors,function(e,t){var e=S('[data-depend-id="'+e+'"]'),n=S('a[href="#tab='+e.closest(".csf-section").data("section-id")+'"]'),i=n.closest(".csf-tab-item");e.closest(".csf-fieldset").append('<p class="csf-error csf-error-text">'+t+"</p>"),n.find(".csf-error").length||n.append(s),i.find(".csf-arrow .csf-error").length||i.find(".csf-arrow").append(s)})),a.removeClass("csf-saving"),c.prop("disabled",!1).attr("value",n),r=!1,j.vars.form_modified=!1,j.vars.$form_warning.hide(),clearTimeout(i);var s,t=S(".csf-form-success");t.empty().append(e.notice).fadeIn("fast",function(){i=setTimeout(function(){t.fadeOut("fast")},1e3)})}).fail(function(e){alert(e.error)})):j.vars.form_modified=!1),r=!0})})},S.fn.csf_options=function(){return this.each(function(){var e=S(this),t=e.find(".csf-content"),n=e.find(".csf-form-success"),i=e.find(".csf-form-warning"),s=e.find(".csf-header .csf-save");(j.vars.$form_warning=i).length&&(_.onbeforeunload=function(){return!!j.vars.form_modified||y},t.on("change keypress",":input",function(){j.vars.form_modified||(n.hide(),i.fadeIn("fast"),j.vars.form_modified=!0)})),n.hasClass("csf-form-show")&&setTimeout(function(){n.fadeOut("fast")},1e3),S(b).keydown(function(e){if((e.ctrlKey||e.metaKey)&&83===e.which)return s.trigger("click"),e.preventDefault(),!1})})},S.fn.csf_taxonomy=function(){return this.each(function(){var e,t,n=S(this),i=n.parents("form");"addtag"===i.attr("id")&&(e=i.find("#submit"),t=n.find(".csf-field").csf_clone(),e.on("click",function(){i.find(".form-required").hasClass("form-invalid")||(n.data("inited",!1),n.empty(),n.html(t),t=t.csf_clone(),n.csf_reload_script())}))})},S.fn.csf_shortcode=function(){var m=this;return m.shortcode_parse=function(e,n){var i="";return S.each(e,function(e,t){i+="["+(n=n||e),S.each(t,function(e,t){"content"===e?i=(i+="]")+t+"[/"+n:i+=m.shortcode_tags(e,t)}),i+="]"}),i},m.shortcode_tags=function(e,t){var n="";return""!==t&&("object"!=typeof t||S.isArray(t)?n+=" "+e+'="'+t.toString()+'"':S.each(t,function(e,t){""!==(t="background-image"===e?t.url||"":t)&&(n+=" "+e+'="'+t.toString()+'"')})),n},m.insertAtChars=function(e,t){e=void 0!==e[0].name?e[0]:e;return e.value.length&&void 0!==e.selectionStart?(e.focus(),e.value.substring(0,e.selectionStart)+t+e.value.substring(e.selectionEnd,e.value.length)):(e.focus(),t)},m.send_to_editor=function(e,t){var n;(n="undefined"!=typeof tinymce?tinymce.get(t):n)&&!n.isHidden()?n.execCommand("mceInsertContent",!1,e):(n=S("#"+t)).val(m.insertAtChars(n,e)).trigger("change")},this.each(function(){var s,c,a,n,r,o,f,i,l,d=S(this),h=d.find(".csf-modal-load"),p=(d.find(".csf-modal-content"),d.find(".csf-modal-insert")),u=d.find(".csf-modal-loading"),t=d.find("select"),g=d.data("modal-id"),v=d.data("nonce");S(b).on("click",'.csf-shortcode-button[data-modal-id="'+g+'"]',function(e){e.preventDefault(),l=S(this),s=l.data("editor-id")||!1,c=l.data("target-id")||!1,a=l.data("gutenberg-id")||!1,d.removeClass("hidden"),d.hasClass("csf-shortcode-single")&&r===y&&t.trigger("change")}),t.on("change",function(){var e=S(this),t=e.find(":selected");n=e.val(),r=t.data("shortcode"),o=t.data("view")||"normal",f=t.data("group")||r,h.empty(),n?(u.show(),_.wp.ajax.post("csf-get-shortcode-"+g,{shortcode_key:n,nonce:v}).done(function(e){u.hide();e=S(e.content).appendTo(h);p.parent().removeClass("hidden"),i=e.find(".csf--repeat-shortcode").csf_clone(),e.csf_reload_script(),e.find(".csf-fields").csf_reload_script()})):p.parent().addClass("hidden")}),p.on("click",function(e){if(e.preventDefault(),!p.prop("disabled")&&!p.attr("disabled")){var n="",t=d.find(".csf-field:not(.csf-depend-on)").find(":input:not(.ignore)").serializeObjectCSF();switch(o){case"contents":var i=r?t[r]:t;S.each(i,function(e,t){e=r||e;n+="["+e+"]"+t+"[/"+e+"]"});break;case"group":n+="["+r,S.each(t[r],function(e,t){n+=m.shortcode_tags(e,t)}),n=(n=(n+="]")+m.shortcode_parse(t[f],f))+("[/"+r+"]");break;case"repeater":n+=m.shortcode_parse(t[f],f);break;default:n+=m.shortcode_parse(t)}n=""===n?"["+r+"]":n,a?(e=_.csf_gutenberg_props.attributes.hasOwnProperty("shortcode")?_.csf_gutenberg_props.attributes.shortcode:"",_.csf_gutenberg_props.setAttributes({shortcode:e+n})):s?m.send_to_editor(n,s):(e=c?S(c):l.parent().find("textarea")).val(m.insertAtChars(e,n)).trigger("change"),d.addClass("hidden")}}),d.on("click",".csf--repeat-button",function(e){e.preventDefault();var e=d.find(".csf--repeatable"),t=i.csf_clone(),n=t.find(".csf-repeat-remove");t.appendTo(e);t.find(".csf-fields").csf_reload_script(),j.helper.name_nested_replace(d.find(".csf--repeat-shortcode"),f),n.on("click",function(){t.remove(),j.helper.name_nested_replace(d.find(".csf--repeat-shortcode"),f)})}),d.on("click",".csf-modal-close, .csf-modal-overlay",function(){d.addClass("hidden")})})},"function"==typeof Color&&(Color.prototype.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var e=parseInt(this._color,10).toString(16);if(this.error)return"";if(e.length<6)for(var t=6-e.length-1;0<=t;t--)e="0"+e;return"#"+e}),j.funcs.parse_color=function(e){var e=e.replace(/\s+/g,""),t=-1!==e.indexOf("rgba")?parseFloat(100*e.replace(/^.*,(.+)\)/,"$1")):100;return{value:e,transparent:t,rgba:t<100}},S.fn.csf_color=function(){return this.each(function(){var a,r=S(this),n=j.funcs.parse_color(r.val()),e=!_.csf_vars.color_palette.length||_.csf_vars.color_palette;r.hasClass("wp-color-picker")&&r.closest(".wp-picker-container").after(r).remove(),r.wpColorPicker({palettes:e,change:function(e,t){t=t.color.toString();a.removeClass("csf--transparent-active"),a.find(".csf--transparent-offset").css("background-color",t),r.val(t).trigger("change")},create:function(){a=r.closest(".wp-picker-container");var i=r.data("a8cIris"),e=S('<div class="csf--transparent-wrap"><div class="csf--transparent-slider"></div><div class="csf--transparent-offset"></div><div class="csf--transparent-text"></div><div class="csf--transparent-button">transparent <i class="fas fa-toggle-off"></i></div></div>').appendTo(a.find(".wp-picker-holder")),s=e.find(".csf--transparent-slider"),c=e.find(".csf--transparent-text"),t=e.find(".csf--transparent-offset"),e=e.find(".csf--transparent-button");"transparent"===r.val()&&a.addClass("csf--transparent-active"),e.on("click",function(){"transparent"!==r.val()?(r.val("transparent").trigger("change").removeClass("iris-error"),a.addClass("csf--transparent-active")):(r.val(i._color.toString()).trigger("change"),a.removeClass("csf--transparent-active"))}),s.slider({value:n.transparent,step:1,min:0,max:100,slide:function(e,t){t=parseFloat(t.value/100);i._color._alpha=t,r.wpColorPicker("color",i._color.toString()),c.text(1===t||0===t?"":t)},create:function(){var e=parseFloat(n.transparent/100);c.text(e<1?e:""),t.css("background-color",n.value),a.on("click",".wp-picker-clear",function(){i._color._alpha=1,c.text(""),s.slider("option","value",100),a.removeClass("csf--transparent-active"),r.trigger("change")}),a.on("click",".wp-picker-default",function(){var e=j.funcs.parse_color(r.data("default-color")),t=parseFloat(e.transparent/100),n=t<1?t:"";i._color._alpha=t,c.text(n),s.slider("option","value",e.transparent),"transparent"===e.value&&(r.removeClass("iris-error"),a.addClass("csf--transparent-active"))})}})}})})},S.fn.csf_chosen=function(){return this.each(function(){var n,c,a=S(this),e=a.parent().find(".chosen-container"),t=a.hasClass("csf-chosen-sortable")||!1,i=a.hasClass("csf-chosen-ajax")||!1,s=a.attr("multiple")||!1,r=S.extend({allow_single_deselect:!0,disable_search_threshold:10,width:s?"100%":"auto",no_results_text:_.csf_vars.i18n.no_results_text},a.data("chosen-settings"));e.length&&e.remove(),i?(e=S.extend({data:{type:"post",nonce:""},allow_single_deselect:!0,disable_search_threshold:-1,width:"100%",min_length:3,type_delay:500,typing_text:_.csf_vars.i18n.typing_text,searching_text:_.csf_vars.i18n.searching_text,no_results_text:_.csf_vars.i18n.no_results_text},a.data("chosen-settings")),a.CSFAjaxChosen(e)):a.chosen(r),s&&(i=(n=a.parent().find(".csf-hide-select")).val()||[],a.on("change",function(e,t){t&&t.selected?n.append('<option value="'+t.selected+'" selected="selected">'+t.selected+"</option>"):t&&t.deselected&&n.find('option[value="'+t.deselected+'"]').remove(),_.wp.customize!==y&&0===n.children().length&&n.data("customize-setting-link")&&_.wp.customize.control(n.data("customize-setting-link")).setting.set(""),n.trigger("change")}),a.CSFChosenOrder(i,!0)),t&&((c=a.parent().find(".chosen-container").find(".chosen-choices")).bind("mousedown",function(e){S(e.target).is("span")&&e.stopPropagation()}),c.sortable({items:"li:not(.search-field)",helper:"orginal",cursor:"move",placeholder:"search-choice-placeholder",start:function(e,t){t.placeholder.width(t.item.innerWidth()),t.placeholder.height(t.item.innerHeight())},update:function(e,t){var i="",s=a.data("chosen"),n=a.parent().find(".csf-hide-select");c.find(".search-choice-close").each(function(){var n=S(this).data("option-array-index");S.each(s.results_data,function(e,t){t.array_index===n&&(i+='<option value="'+t.value+'" selected>'+t.value+"</option>")})}),n.children().remove(),n.append(i),n.trigger("change")}}))})},S.fn.csf_checkbox=function(){return this.each(function(){var e=S(this),t=e.find(".csf--input"),n=e.find(".csf--checkbox");n.on("click",function(){t.val(Number(n.prop("checked"))).trigger("change")})})},S.fn.csf_checkbox_all=function(){return this.each(function(){var n=S(this);n.on("click",function(){var e=n.closest(".csf-field-checkbox").find(":input"),t=!1;e.each(function(){S(this).prop("checked")||(t=!0)}),t?(e.prop("checked","checked"),e.attr("checked","checked")):(e.prop("checked",""),e.removeAttr("checked")),e.first().trigger("change")})})},S.fn.csf_siblings=function(){return this.each(function(){var t=S(this),e=t.find(".csf--sibling"),n=t.data("multiple")||!1;e.on("click",function(){var e=S(this);n?e.hasClass("csf--active")?(e.removeClass("csf--active"),e.find("input").prop("checked",!1).trigger("change")):(e.addClass("csf--active"),e.find("input").prop("checked",!0).trigger("change")):(t.find("input").prop("checked",!1),e.find("input").prop("checked",!0).trigger("change"),e.addClass("csf--active").siblings().removeClass("csf--active"))})})},S.fn.csf_help=function(){return this.each(function(){var e,t,n=S(this);n.on({mouseenter:function(){e=S('<div class="csf-tooltip"></div>').html(n.find(".csf-help-text").html()).appendTo("body"),t=j.vars.is_rtl?n.offset().left+24:n.offset().left-e.outerWidth(),e.css({top:n.offset().top-(e.outerHeight()/2-14),left:t})},mouseleave:function(){e!==y&&e.remove()}})})},S.fn.csf_customizer_refresh=function(){return this.each(function(){var e=S(this),t=e.closest(".csf-customize-complex");if(t.length){var n=t.data("unique-id");if(n===y)return;var i=t.find(":input"),t=t.data("option-id"),i=i.serializeObjectCSF(),i=!S.isEmptyObject(i)&&i[n]&&i[n][t]?i[n][t]:"",n=_.wp.customize.control(n+"["+t+"]");n.setting._value=null,n.setting.set(i)}else e.find(":input").first().trigger("change");S(b).trigger("csf-customizer-refresh",e)})},S.fn.csf_customizer_listen=function(e){var s=S.extend({closest:!1},e);return this.each(function(){var t,e,n,i;_.wp.customize!==y&&(e=(t=s.closest?S(this).closest(".csf-customize-complex"):S(this)).find(":input"),n=t.data("unique-id"),i=t.data("option-id"),n!==y&&e.on("change keyup csf.change",function(){var e=t.find(":input").serializeObjectCSF(),e=!S.isEmptyObject(e)&&e[n]&&e[n][i]?e[n][i]:"";_.wp.customize.control(n+"["+i+"]").setting.set(e)}))})},S(b).on("expanded",".control-section",function(){var e,t,n=S(this);n.hasClass("open")&&!n.data("inited")&&(e=n.find(".csf-customize-field"),t=n.find(".csf-customize-complex"),e.length&&(n.csf_dependency(),e.csf_reload_script({dependency:!1}),t.csf_customizer_listen()),n.data("inited",!0))}),j.vars.$window.on("resize csf.resize",j.helper.debounce(function(e){(-1<navigator.userAgent.indexOf("AppleWebKit/")?j.vars.$window.width():_.innerWidth)<=782&&!j.vars.onloaded&&(S(".csf-section").csf_reload_script(),j.vars.onloaded=!0)},200)).trigger("csf.resize"),S.fn.csf_widgets=function(){return this.each(function(){S(b).on("widget-added widget-updated",function(e,t){t=t.find(".csf-fields");t.length&&t.csf_reload_script()}),S(b).on("click",".widget-top",function(e){var t=S(this).parent().find(".csf-fields");t.length&&t.csf_reload_script()}),S(".widgets-sortables, .control-section-sidebar").on("sortstop",function(e,t){t.item.find(".csf-fields").csf_reload_script_retry()})})},S.fn.csf_nav_menu=function(){return this.each(function(){var e=S(this);e.on("click","a.item-edit",function(){S(this).closest("li.menu-item").find(".csf-fields").csf_reload_script()}),e.on("sortstop",function(e,t){t.item.find(".csf-fields").csf_reload_script_retry()})})},S.fn.csf_reload_script_retry=function(){return this.each(function(){var e=S(this);e.data("inited")&&e.children(".csf-field-wp_editor").csf_field_wp_editor()})},S.fn.csf_reload_script=function(e){var t=S.extend({dependency:!0},e);return this.each(function(){var e=S(this);e.data("inited")||(e.children(".csf-field-accordion").csf_field_accordion(),e.children(".csf-field-backup").csf_field_backup(),e.children(".csf-field-background").csf_field_background(),e.children(".csf-field-code_editor").csf_field_code_editor(),e.children(".csf-field-date").csf_field_date(),e.children(".csf-field-datetime").csf_field_datetime(),e.children(".csf-field-fieldset").csf_field_fieldset(),e.children(".csf-field-gallery").csf_field_gallery(),e.children(".csf-field-group").csf_field_group(),e.children(".csf-field-icon").csf_field_icon(),e.children(".csf-field-link").csf_field_link(),e.children(".csf-field-media").csf_field_media(),e.children(".csf-field-map").csf_field_map(),e.children(".csf-field-repeater").csf_field_repeater(),e.children(".csf-field-slider").csf_field_slider(),e.children(".csf-field-sortable").csf_field_sortable(),e.children(".csf-field-sorter").csf_field_sorter(),e.children(".csf-field-spinner").csf_field_spinner(),e.children(".csf-field-switcher").csf_field_switcher(),e.children(".csf-field-tabbed").csf_field_tabbed(),e.children(".csf-field-typography").csf_field_typography(),e.children(".csf-field-upload").csf_field_upload(),e.children(".csf-field-wp_editor").csf_field_wp_editor(),e.children(".csf-field-border").find(".csf-color").csf_color(),e.children(".csf-field-background").find(".csf-color").csf_color(),e.children(".csf-field-color").find(".csf-color").csf_color(),e.children(".csf-field-color_group").find(".csf-color").csf_color(),e.children(".csf-field-link_color").find(".csf-color").csf_color(),e.children(".csf-field-typography").find(".csf-color").csf_color(),e.children(".csf-field-select").find(".csf-chosen").csf_chosen(),e.children(".csf-field-checkbox").find(".csf-checkbox").csf_checkbox(),e.children(".csf-field-checkbox").find(".csf-checkbox-all").csf_checkbox_all(),e.children(".csf-field-button_set").find(".csf-siblings").csf_siblings(),e.children(".csf-field-image_select").find(".csf-siblings").csf_siblings(),e.children(".csf-field-palette").find(".csf-siblings").csf_siblings(),e.children(".csf-field").find(".csf-help").csf_help(),t.dependency&&e.csf_dependency(),e.data("inited",!0),S(b).trigger("csf-reload-script",e))})},S(b).ready(function(){S(".csf-save").csf_save(),S(".csf-options").csf_options(),S(".csf-sticky-header").csf_sticky(),S(".csf-nav-options").csf_nav_options(),S(".csf-nav-metabox").csf_nav_metabox(),S(".csf-taxonomy").csf_taxonomy(),S(".csf-page-templates").csf_page_templates(),S(".csf-post-formats").csf_post_formats(),S(".csf-shortcode").csf_shortcode(),S(".csf-search").csf_search(),S(".csf-confirm").csf_confirm(),S(".csf-expand-all").csf_expand_all(),S(".csf-onload").csf_reload_script(),S("#widgets-editor").csf_widgets(),S("#widgets-right").csf_widgets(),S("#menu-to-edit").csf_nav_menu()})}(jQuery,window,document);