"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CircularProgress = exports.CircularProgressLabel = void 0;

var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));

var _react = require("@emotion/react");

var _react2 = _interopRequireWildcard(require("react"));

var _Box = require("../Box");

var _styles = _interopRequireDefault(require("./styles"));

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var __jsx = _react2["default"].createElement;

function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }

function _templateObject2() {
  var data = (0, _taggedTemplateLiteral2["default"])(["\n  0% {\n    transform: rotate(0deg);\n  }\n  100% {\n    transform: rotate(360deg);\n  }\n"]);

  _templateObject2 = function _templateObject2() {
    return data;
  };

  return data;
}

function _templateObject() {
  var data = (0, _taggedTemplateLiteral2["default"])(["\n  0% {\n    stroke-dasharray: 1, 400;\n    stroke-dashoffset: 0;\n  }\n\n  50% {\n    stroke-dasharray: 400, 400;\n    stroke-dashoffset: -100;\n  }\n\n  100% {\n    stroke-dasharray: 400, 400;\n    stroke-dashoffset: -300;\n  }\n"]);

  _templateObject = function _templateObject() {
    return data;
  };

  return data;
}

var circularProgressCircle = (0, _react.keyframes)(_templateObject());
var spin = (0, _react.keyframes)(_templateObject2());

var _ref = process.env.NODE_ENV === "production" ? {
  name: "kow0uz",
  styles: "font-variant-numeric:tabular-nums"
} : {
  name: "z4z7gg-CircularProgressLabel",
  styles: "font-variant-numeric:tabular-nums;label:CircularProgressLabel;",
  map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9DaXJjdWxhclByb2dyZXNzL0NpcmN1bGFyUHJvZ3Jlc3MudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXdDUSIsImZpbGUiOiIuLi8uLi9zcmMvQ2lyY3VsYXJQcm9ncmVzcy9DaXJjdWxhclByb2dyZXNzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGtleWZyYW1lcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcbmltcG9ydCBSZWFjdCwgeyBmb3J3YXJkUmVmIH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsgQm94IH0gZnJvbSAnLi4vQm94JztcbmltcG9ydCB1c2VDaXJjdWxhclByb2dyZXNzU3R5bGUgZnJvbSAnLi9zdHlsZXMnO1xuaW1wb3J0IHsgQ2lyY3VsYXJQcm9ncmVzc0xhYmVsUHJvcHMsIENpcmN1bGFyUHJvZ3Jlc3NQcm9wcyB9IGZyb20gJy4vdHlwZXMnO1xuXG5jb25zdCBja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gIDxCb3ggey4uLnRyYWNrU3R5bGVQcm9wc30gZGF0YS1wcm9ncmVzcy10cmFjayAvPlxuICAgICAgICAgICAgICAgIDxCb3ggey4uLmluZGljYXRvclN0eWxlUHJvcHN9IGRhdGEtcHJvZ3Jlc3MtaW5kaWNhdG9yIC8+XG4gICAgICAgICAgICA8L0JveD5cbiAgICAgICAgICAgIHtjaGlsZHJlbn1cbiAgICAgICAgPC9Cb3g+XG4gICAgKTtcbn0pO1xuIl19 */",
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};

var CircularProgressLabel = function CircularProgressLabel(props) {
  return __jsx(_Box.Box, (0, _extends2["default"])({
    position: "absolute",
    left: "50%",
    top: "50%",
    lineHeight: "1",
    textAlign: "center",
    transform: "translate(-50%, -50%)",
    css: _ref
  }, props), props.children);
};

exports.CircularProgressLabel = CircularProgressLabel;
var CircularProgress = /*#__PURE__*/(0, _react2.forwardRef)(function (props, ref) {
  var size = props.size,
      max = props.max,
      min = props.min,
      isIndeterminate = props.isIndeterminate,
      thickness = props.thickness,
      value = props.value,
      angle = props.angle,
      capIsRound = props.capIsRound,
      children = props.children,
      trackColor = props.trackColor,
      color = props.color,
      rest = (0, _objectWithoutProperties2["default"])(props, ["size", "max", "min", "isIndeterminate", "thickness", "value", "angle", "capIsRound", "children", "trackColor", "color"]);

  var _useCircularProgressS = (0, _styles["default"])({
    min: min,
    max: max,
    value: value,
    size: size,
    angle: angle,
    thickness: thickness,
    capIsRound: capIsRound,
    isIndeterminate: isIndeterminate,
    color: color,
    trackColor: trackColor,
    spin: spin,
    circularProgressCircle: circularProgressCircle
  }),
      rootStyleProps = _useCircularProgressS.root,
      svgStyleProps = _useCircularProgressS.svg,
      trackStyleProps = _useCircularProgressS.track,
      indicatorStyleProps = _useCircularProgressS.indicator;

  return __jsx(_Box.Box, (0, _extends2["default"])({
    ref: ref
  }, rootStyleProps, rest), __jsx(_Box.Box, svgStyleProps, __jsx(_Box.Box, (0, _extends2["default"])({}, trackStyleProps, {
    "data-progress-track": true
  })), __jsx(_Box.Box, (0, _extends2["default"])({}, indicatorStyleProps, {
    "data-progress-indicator": true
  }))), children);
});
exports.CircularProgress = CircularProgress;
//# sourceMappingURL=CircularProgress.js.map