/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes} checked by tsc
 */
import { Component, Input, HostBinding, Output, EventEmitter, HostListener, ElementRef } from '@angular/core';
import { SegmentService } from '../segment/segment.service';
/**
 * @param {?} value
 * @return {?}
 */
function inputAttrToBoolean(value) {
    return value === '' || !!value;
}
var SegmentButtonComponent = /** @class */ (function () {
    function SegmentButtonComponent(elementRef, segmentService) {
        this.elementRef = elementRef;
        this.segmentService = segmentService;
        this.uiChecked = new EventEmitter();
        this.value = '';
        this._disabled = false;
        this._selected = false;
    }
    Object.defineProperty(SegmentButtonComponent.prototype, "disabled", {
        get: /**
         * @return {?}
         */
        function () {
            return this._disabled;
        },
        set: /**
         * @param {?} isDisabled
         * @return {?}
         */
        function (isDisabled) {
            this._disabled = inputAttrToBoolean(isDisabled);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(SegmentButtonComponent.prototype, "selected", {
        get: /**
         * @return {?}
         */
        function () {
            return this._selected;
        },
        set: /**
         * @param {?} isSelected
         * @return {?}
         */
        function (isSelected) {
            this._selected = inputAttrToBoolean(isSelected);
        },
        enumerable: true,
        configurable: true
    });
    /**
     * @return {?}
     */
    SegmentButtonComponent.prototype.click = /**
     * @return {?}
     */
    function () {
        if (!this.disabled) {
            this.segmentService.checked(this);
            this.uiChecked.emit(this);
        }
    };
    /**
     * @return {?}
     */
    SegmentButtonComponent.prototype.ngAfterViewInit = /**
     * @return {?}
     */
    function () {
        this.nativeElement = this.elementRef.nativeElement;
    };
    SegmentButtonComponent.decorators = [
        { type: Component, args: [{
                    selector: 'ui-segment-button',
                    template: "<ng-content></ng-content>"
                },] },
    ];
    /** @nocollapse */
    SegmentButtonComponent.ctorParameters = function () { return [
        { type: ElementRef, },
        { type: SegmentService, },
    ]; };
    SegmentButtonComponent.propDecorators = {
        "uiChecked": [{ type: Output },],
        "value": [{ type: Input },],
        "disabled": [{ type: Input }, { type: HostBinding, args: ['class.ui-disabled',] },],
        "selected": [{ type: Input }, { type: HostBinding, args: ['class.ui-selected',] },],
        "click": [{ type: HostListener, args: ['click',] },],
    };
    return SegmentButtonComponent;
}());
export { SegmentButtonComponent };
function SegmentButtonComponent_tsickle_Closure_declarations() {
    /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
    SegmentButtonComponent.decorators;
    /**
     * @nocollapse
     * @type {function(): !Array<(null|{type: ?, decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>)})>}
     */
    SegmentButtonComponent.ctorParameters;
    /** @type {!Object<string,!Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
    SegmentButtonComponent.propDecorators;
    /** @type {?} */
    SegmentButtonComponent.prototype.uiChecked;
    /** @type {?} */
    SegmentButtonComponent.prototype.value;
    /** @type {?} */
    SegmentButtonComponent.prototype.nativeElement;
    /** @type {?} */
    SegmentButtonComponent.prototype._disabled;
    /** @type {?} */
    SegmentButtonComponent.prototype._selected;
    /** @type {?} */
    SegmentButtonComponent.prototype.elementRef;
    /** @type {?} */
    SegmentButtonComponent.prototype.segmentService;
}

//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VnbWVudC1idXR0b24uY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Im5nOi8vQHRhbmJvL3VpLW5hdGl2ZS8iLCJzb3VyY2VzIjpbImxpYi9zZWdtZW50L3NlZ21lbnQtYnV0dG9uL3NlZ21lbnQtYnV0dG9uLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQUEsT0FBTyxFQUNMLFNBQVMsRUFFVCxLQUFLLEVBQ0wsV0FBVyxFQUNYLE1BQU0sRUFDTixZQUFZLEVBQ1osWUFBWSxFQUNaLFVBQVUsRUFDWCxNQUFNLGVBQWUsQ0FBQztBQUV2QixPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sNEJBQTRCLENBQUM7Ozs7O0FBRTVELDRCQUE0QixLQUFVO0lBQ3BDLE1BQU0sQ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