'use strict';

Liferay.Loader.define('frontend-taglib-clay$clay-progress-bar@2.24.1/lib/ClayProgressBar.soy', ['module', 'exports', 'require', 'frontend-js-metal-web$metal-component', 'frontend-js-metal-web$metal-soy'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.templates = exports.ClayProgressBar = undefined;

    var _metalComponent = require('frontend-js-metal-web$metal-component');

    var _metalComponent2 = _interopRequireDefault(_metalComponent);

    var _metalSoy = require('frontend-js-metal-web$metal-soy');

    var _metalSoy2 = _interopRequireDefault(_metalSoy);

    function _interopRequireDefault(obj) {
      return obj && obj.__esModule ? obj : { default: obj };
    }

    function _classCallCheck(instance, Constructor) {
      if (!(instance instanceof Constructor)) {
        throw new TypeError("Cannot call a class as a function");
      }
    }

    function _possibleConstructorReturn(self, call) {
      if (!self) {
        throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
      }return call && (typeof call === "object" || typeof call === "function") ? call : self;
    }

    function _inherits(subClass, superClass) {
      if (typeof superClass !== "function" && superClass !== null) {
        throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
      }subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
    } /* jshint ignore:start */

    var templates;
    goog.loadModule(function (exports) {
      var soy = goog.require('soy');

      goog.require('soydata');

      // This file was automatically generated from ClayProgressBar.soy.
      // Please don't edit this file by hand.

      /**
       * @fileoverview Templates in namespace ClayProgressBar.
       * @public
       */

      goog.module('ClayProgressBar.incrementaldom');

      goog.require('goog.soy.data.SanitizedContent');
      var incrementalDom = goog.require('incrementaldom');
      goog.require('soy.asserts');
      var soyIdom = goog.require('soy.idom');

      var $templateAlias1 = _metalSoy2.default.getTemplate('ClayIcon.incrementaldom', 'render');

      /**
       * @param {{
       *  elementClasses: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  id: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  spritemap: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  status: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  value: (null|number|undefined)
       * }} opt_data
       * @param {Object<string, *>=} opt_ijData
       * @param {Object<string, *>=} opt_ijData_deprecated
       * @return {void}
       * @suppress {checkTypes}
       */
      function $render(opt_data, opt_ijData, opt_ijData_deprecated) {
        opt_ijData = opt_ijData_deprecated || opt_ijData;
        opt_data = opt_data || {};
        /** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
        var elementClasses = soy.asserts.assertType(opt_data.elementClasses == null || goog.isString(opt_data.elementClasses) || opt_data.elementClasses instanceof goog.soy.data.SanitizedContent, 'elementClasses', opt_data.elementClasses, '!goog.soy.data.SanitizedContent|null|string|undefined');
        /** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
        var id = soy.asserts.assertType(opt_data.id == null || goog.isString(opt_data.id) || opt_data.id instanceof goog.soy.data.SanitizedContent, 'id', opt_data.id, '!goog.soy.data.SanitizedContent|null|string|undefined');
        /** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
        var spritemap = soy.asserts.assertType(opt_data.spritemap == null || goog.isString(opt_data.spritemap) || opt_data.spritemap instanceof goog.soy.data.SanitizedContent, 'spritemap', opt_data.spritemap, '!goog.soy.data.SanitizedContent|null|string|undefined');
        /** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
        var status = soy.asserts.assertType(opt_data.status == null || goog.isString(opt_data.status) || opt_data.status instanceof goog.soy.data.SanitizedContent, 'status', opt_data.status, '!goog.soy.data.SanitizedContent|null|string|undefined');
        /** @type {null|number|undefined} */
        var value = soy.asserts.assertType(opt_data.value == null || goog.isNumber(opt_data.value), 'value', opt_data.value, 'null|number|undefined');
        var maxValue__soy9 = 100;
        var minValue__soy11 = 0;
        var succeed__soy13 = status == 'complete' || value == maxValue__soy9;

        var currentValue__soy40 = '';
        var $tmp$$2 = null;
        if (value) {
          var $tmp$$1 = null;
          if (value <= maxValue__soy9 && value >= minValue__soy11) {
            $tmp$$1 = value;
          } else if (value < minValue__soy11) {
            $tmp$$1 = minValue__soy11;
          } else {
            $tmp$$1 = maxValue__soy9;
          }
          $tmp$$2 = $tmp$$1;
        } else {
          $tmp$$2 = succeed__soy13 ? maxValue__soy9 : minValue__soy11;
        }
        currentValue__soy40 += $tmp$$2;
        incrementalDom.elementOpenStart('div');
        (function progressGroupAttributes__soy17() {
          var $tmp = null;
          if (succeed__soy13) {
            $tmp = ' progress-success';
          } else if (status == 'warning') {
            $tmp = ' progress-warning';
          } else {
            $tmp = ' progress-info';
          }
          incrementalDom.attr('class', 'progress-group' + $tmp + (elementClasses ? ' ' + elementClasses : ''));
          if (id) {
            incrementalDom.attr('id', id);
          }
        })();
        incrementalDom.elementOpenEnd();
        incrementalDom.elementOpenStart('div');
        incrementalDom.attr('class', 'progress');
        incrementalDom.elementOpenEnd();
        var barAttributes__soy67 = function barAttributes__soy67() {
          incrementalDom.attr('aria-valuemax', maxValue__soy9);
          incrementalDom.attr('aria-valuemin', minValue__soy11);
          incrementalDom.attr('aria-valuenow', currentValue__soy40);
          incrementalDom.attr('class', 'progress-bar');
          incrementalDom.attr('role', 'progressbar');
          incrementalDom.attr('style', 'width: ' + currentValue__soy40 + '%;');
        };
        incrementalDom.elementOpenStart('div');
        barAttributes__soy67();
        incrementalDom.elementOpenEnd();
        incrementalDom.elementClose('div');
        incrementalDom.elementClose('div');
        incrementalDom.elementOpenStart('div');
        incrementalDom.attr('class', 'progress-group-addon');
        incrementalDom.elementOpenEnd();
        if (succeed__soy13 && spritemap) {
          incrementalDom.elementOpenStart('div');
          incrementalDom.attr('class', 'progress-group-feedback');
          incrementalDom.elementOpenEnd();
          $templateAlias1({ spritemap: spritemap, symbol: 'check-circle' }, null, opt_ijData);
          incrementalDom.elementClose('div');
        } else if (currentValue__soy40 != null) {
          soyIdom.print(currentValue__soy40);
          incrementalDom.text('%');
        }
        incrementalDom.elementClose('div');
        incrementalDom.elementClose('div');
      }
      exports.render = $render;
      /**
       * @typedef {{
       *  elementClasses: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  id: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  spritemap: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  status: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  value: (null|number|undefined)
       * }}
       */
      $render.Params;
      if (goog.DEBUG) {
        $render.soyTemplateName = 'ClayProgressBar.render';
      }

      exports.render.params = ["elementClasses", "id", "spritemap", "status", "value"];
      exports.render.types = { "elementClasses": "string", "id": "string", "spritemap": "string", "status": "string", "value": "int" };
      exports.templates = templates = exports;
      return exports;
    });

    var ClayProgressBar = function (_Component) {
      _inherits(ClayProgressBar, _Component);

      function ClayProgressBar() {
        _classCallCheck(this, ClayProgressBar);

        return _possibleConstructorReturn(this, (ClayProgressBar.__proto__ || Object.getPrototypeOf(ClayProgressBar)).apply(this, arguments));
      }

      return ClayProgressBar;
    }(_metalComponent2.default);

    _metalSoy2.default.register(ClayProgressBar, templates);
    exports.ClayProgressBar = ClayProgressBar;
    exports.templates = templates;
    exports.default = templates;
    /* jshint ignore:end */
    //# sourceMappingURL=ClayProgressBar.soy.js.map
  }
});
//# sourceMappingURL=ClayProgressBar.soy.js.map