text: (function(){"use strict";BX.namespace("BX.Landing.UI.Field");var t=BX.Landing.Utils.isArray;BX.Landing.UI.Field.ButtonGroup=function(t){this.items="items"in t&&t.items?t.items:[];BX.Landing.UI.Field.BaseField.apply(this,arguments);this.layout.classList.add("landing-ui-field-button-group");this.frame=typeof t.frame==="object"?t.frame:null;this.format=typeof t.format==="function"?t.format:function(){};this.postfix=typeof t.postfix==="string"?t.postfix:"";this.property=typeof t.property==="string"?t.property:"";this.multiple=typeof t.multiple==="boolean"?t.multiple:false;this.changeHandler=typeof t.onChange==="function"?t.onChange:function(){};this.elements=[];this.buttons=new BX.Landing.UI.Collection.ButtonCollection;this.value=this.getValue();this.onButtonClick=this.onButtonClick.bind(this);this.input.innerHTML="";this.items.forEach(function(t){var e=this.createButtonByItem(t);this.buttons.add(e);this.input.appendChild(e.layout)},this);if(this.content){this.setValue(this.content,true)}if(this.frame){this.onFrameLoad()}};BX.Landing.UI.Field.ButtonGroup.prototype={constructor:BX.Landing.UI.Field.ButtonGroup,__proto__:BX.Landing.UI.Field.BaseField.prototype,superClass:BX.Landing.UI.Field.BaseField,onFrameLoad:function(){this.elements=[].slice.call(this.frame.document.querySelectorAll(this.selector));if(this.elements.length){this.items.some(function(t){if(this.elements[0].classList.contains(t.value)){this.buttons.getByValue(t.value).activate();return!this.multiple}},this)}},createButtonByItem:function(t){return new BX.Landing.UI.Button.BaseButton(t.value,{html:t.name,active:t.active,attrs:{value:t.value},onClick:this.onButtonClick})},onButtonClick:function(t){var e=this.buttons.getByNode(t.currentTarget);var i=e.layout.value;if(this.multiple){if(e.isActive()){e.deactivate()}else{e.activate()}}else{this.deactivateAll();e.activate()}this.onChange(i)},onChange:function(t){if(!this.multiple){this.changeHandler(t,this.items,this.postfix,this.property)}else{this.elements.forEach(function(e){e.classList.toggle(t)},this);this.changeHandler()}this.onValueChangeHandler(this)},isChanged:function(){return this.value!==this.getValue()},setValue:function(e,i){this.deactivateAll();if(this.multiple){e=t(e)?e:[e];e.forEach(function(t){var e=this.buttons.getByValue(t);if(e){e.activate()}},this)}else{var n=this.buttons.getByValue(e);if(n){n.activate()}}if(!i){this.onChange(e)}},deactivateAll:function(){this.buttons.forEach(function(t){t.deactivate()})},getValue:function(){var t=this.buttons.getActive();if(t){return t.layout.value}return null}}})();