var FPF_Toggles=function(){function e(){this.init()}var t=e.prototype;return t.init=function(){document.addEventListener("click",function(e){e.target.classList.contains("fpf-toggle-control-item")&&(this.clearToggle(e.target),this.changeSelection(e.target))}.bind(this))},t.clearToggle=function(e){var t=this.getWrapper(e);if(e.closest(".item").querySelector("label").classList.contains("active"))return!1;t.querySelectorAll("label").forEach(function(e){e.classList.remove("btn-success","btn-danger","active")})},t.changeSelection=function(e){var t=e.closest(".item").querySelector("label"),s=this.getWrapper(e);this.isDisabledYesNo(e)?"1"==e.closest(".item").querySelector("input").value?t.classList.add("btn-success"):"2"==e.closest(".item").querySelector("input").value&&t.classList.add("btn-danger"):this.isYesNo(e)&&"0"!=e.closest(".item").querySelector("input").value&&t.classList.add("btn-success"),s.classList.contains("disabled-red")&&"0"==e.closest(".item").querySelector("input").value&&t.classList.add("btn-danger"),t.classList.add("active")},t.isYesNo=function(e){return!!this.getWrapper(e).classList.contains("yesno")},t.isDisabledYesNo=function(e){return!!this.getWrapper(e).classList.contains("disabled-yes-no")},t.getWrapper=function(e){return e.closest(".fpf-control-group-field")},e}();document.addEventListener("DOMContentLoaded",function(e){new FPF_Toggles});

