"use strict";
var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var angular = require("angular");
var button_ng1_1 = require("../button/button.ng1");
exports.moduleName = 'rl.ui.components.buttonToggle';
exports.componentName = 'rlButtonToggle';
exports.controllerName = 'ButtonToggleController';
var ButtonToggleController = (function (_super) {
    __extends(ButtonToggleController, _super);
    function ButtonToggleController() {
        return _super.call(this) || this;
    }
    Object.defineProperty(ButtonToggleController.prototype, "checked", {
        get: function () {
            return this.ngModel.$viewValue;
        },
        set: function (value) {
            this.ngModel.$setViewValue(value);
        },
        enumerable: true,
        configurable: true
    });
    ButtonToggleController.prototype.clicked = function () {
        if (!this.ngDisabled) {
            this.checked = !this.checked;
            this.onToggle({ value: this.checked });
        }
    };
    return ButtonToggleController;
}(button_ng1_1.ButtonController));
exports.ButtonToggleController = ButtonToggleController;
var buttonToggle = button_ng1_1.buildButton({
    require: { ngModel: '^ngModel' },
    template: require('./buttonToggle.ng1.html'),
    controller: exports.controllerName,
    controllerAs: 'buttonToggle',
    bindings: {
        onToggle: '&',
        action: null,
    },
});
angular.module(exports.moduleName, [])
    .component(exports.componentName, buttonToggle)
    .controller(exports.controllerName, ButtonToggleController);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnV0dG9uVG9nZ2xlLm5nMS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImJ1dHRvblRvZ2dsZS5uZzEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsaUNBQW1DO0FBSW5DLG1EQUFxRTtBQUV4RCxRQUFBLFVBQVUsR0FBVywrQkFBK0IsQ0FBQztBQUNyRCxRQUFBLGFBQWEsR0FBVyxnQkFBZ0IsQ0FBQztBQUN6QyxRQUFBLGNBQWMsR0FBVyx3QkFBd0Is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