"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.MediaPlayerDecorator = exports.MediaPlayerBase = exports.MediaPlayer = exports["default"] = void 0;

var _jsxRuntime = require("react/jsx-runtime");

var _handle = require("@enact/core/handle");

var _hoc = _interopRequireDefault(require("@enact/core/hoc"));

var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));

var _kind = _interopRequireDefault(require("@enact/core/kind"));

var _util = require("@enact/core/util");

var _I18nDecorator = require("@enact/i18n/I18nDecorator");

var _AnnounceDecorator = require("@enact/ui/AnnounceDecorator");

var _Pure = _interopRequireDefault(require("@enact/ui/internal/Pure"));

var _Media = _interopRequireDefault(require("@enact/ui/Media"));

var _Slottable = _interopRequireDefault(require("@enact/ui/Slottable"));

var _DurationFmt = _interopRequireDefault(require("ilib/lib/DurationFmt"));

var _propTypes2 = _interopRequireDefault(require("prop-types"));

var _compose = _interopRequireDefault(require("ramda/src/compose"));

var _react = require("react");

var _$L = _interopRequireDefault(require("../internal/$L"));

var _MediaControls = _interopRequireDefault(require("./MediaControls"));

var _MediaSlider = _interopRequireDefault(require("./MediaSlider"));

var _Skinnable = _interopRequireDefault(require("../Skinnable"));

var _Times = _interopRequireDefault(require("./Times"));

var _util2 = require("./util");

var _MediaPlayerModule = _interopRequireDefault(require("./MediaPlayer.module.css"));

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

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }

function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }

function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }

function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }

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

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }

function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }

function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

var forwardWithState = function forwardWithState(type) {
  return (0, _handle.adaptEvent)((0, _handle.call)('addStateToEvent'), (0, _handle.forwardWithPrevent)(type));
}; // provide forwarding of events on media controls


var forwardPlay = forwardWithState('onPlay');
var forwardPause = forwardWithState('onPause');
var memoGetDurFmt = (0, _util.memoize)(function () {
  return (
    /* locale */
    new _DurationFmt["default"]({
      length: 'medium',
      style: 'clock',
      useNative: false
    })
  );
});

var getDurFmt = function getDurFmt(locale) {
  if (typeof window === 'undefined') return null;
  return memoGetDurFmt(locale);
};
/**
 * A player for media {@link agate/MediaPlayer.MediaPlayer}.
 *
 * @class MediaPlayerBase
 * @memberof agate/MediaPlayer
 * @ui
 * @public
 */


var MediaPlayerBase = (0, _kind["default"])({
  name: 'MediaPlayer',
  propTypes:
  /** @lends agate/MediaPlayer.MediaPlayerBase.prototype */
  {
    /**
     * Any children `<source>` tag elements will be sent directly to the media element as
     * sources.
     *
     * @type {Node}
     * @public
     */
    source: _propTypes2["default"].node.isRequired,

    /**
     * The current time in seconds of the media source.
     *
     * @type {Number}
     * @public
     */
    currentTime: _propTypes2["default"].number,

    /**
     * The current locale as a
     * {@link https://tools.ietf.org/html/rfc5646|BCP 47 language tag}.
     *
     * @type {String}
     * @public
     */
    locale: _propTypes2["default"].string,

    /**
     * `true` when the media loops.
     *
     * @type {Boolean}
     * @public
     */
    loop: _propTypes2["default"].bool,

    /**
     * Media component to use.
     *
     * The default (`'video'`) renders an `HTMLVideoElement`. Custom media components must have
     * a similar API structure, exposing the following APIs:
     *
     * Methods:
     * * `load()` - load media
     *
     * @type {String|Component}
     * @default 'audio'
     * @public
     */
    mediaComponent: _propTypes["default"].renderable,

    /**
     * Function that generates a reference to the current loaded media
     *
     * @type {Function}
     * @public
     */
    mediaRef: _propTypes2["default"].func,

    /**
     * Called when position of media slider is changed.
     *
     * @type {Function}
     * @public
     */
    onChange: _propTypes2["default"].func,

    /**
     * Called when the media file reaches the end of its duration.
     *
     * @type {Function}
     * @public
     */
    onEnded: _propTypes2["default"].func,

    /**
     * Called when jumping to next media
     *
     * @type {Function}
     * @public
     */
    onNext: _propTypes2["default"].func,

    /**
     * Called when media is paused
     *
     * @type {Function}
     * @public
     */
    onPause: _propTypes2["default"].func,

    /**
     * Called when media is played
     *
     * @type {Function}
     * @public
     */
    onPlay: _propTypes2["default"].func,

    /**
     * Called when jumping to previous media
     *
     * @type {Function}
     * @public
     */
    onPrevious: _propTypes2["default"].func,

    /**
     * Called when media is on repeat.
     *
     * @type {Function}
     * @public
     */
    onRepeat: _propTypes2["default"].func,

    /**
     * Called when jumping to a random media
     *
     * @type {Function}
     * @public
     */
    onShuffle: _propTypes2["default"].func,

    /**
     * Called when media is updating.
     *
     * @type {Function}
     * @public
     */
    onUpdate: _propTypes2["default"].func,

    /**
     * The media pause state.
     *
     * @type {Boolean}
     * @public
     */
    paused: _propTypes2["default"].bool,

    /**
     * The current list of media.
     *
     * @type {Array}
     * @public
     */
    playlist: _propTypes2["default"].arrayOf(_propTypes2["default"].node),

    /**
     * Proportion of media file played.
     *
     * @type {Number}
     * @public
     */
    proportionPlayed: _propTypes2["default"].number,

    /**
     * The repeat mode of the media playlist.
     *
     * @type {('none'|'one'|'all')}
     * @default 'none'
     * @public
     */
    repeat: _propTypes2["default"].oneOf(['none', 'one', 'all']),

    /**
     * `true` when the media playlist is shuffled.
     *
     * @type {Boolean}
     * @public
     */
    shuffle: _propTypes2["default"].bool,

    /**
     * The index of the current played media.
     *
     * @type {Number}
     * @public
     */
    sourceIndex: _propTypes2["default"].number,

    /**
     * The total time (duration) in seconds of the loaded media source.
     *
     * @type {Number}
     * @public
     */
    total: _propTypes2["default"].number
  },
  defaultProps: {
    mediaComponent: 'audio'
  },
  styles: {
    css: _MediaPlayerModule["default"],
    className: 'mediaPlayer'
  },
  computed: {
    durFmt: function durFmt(_ref) {
      var locale = _ref.locale;
      return getDurFmt(locale);
    }
  },
  render: function render(_ref2) {
    var currentTime = _ref2.currentTime,
        durFmt = _ref2.durFmt,
        loop = _ref2.loop,
        mediaComponent = _ref2.mediaComponent,
        mediaRef = _ref2.mediaRef,
        onChange = _ref2.onChange,
        onEnded = _ref2.onEnded,
        onNext = _ref2.onNext,
        onPause = _ref2.onPause,
        onPlay = _ref2.onPlay,
        onPrevious = _ref2.onPrevious,
        onRepeat = _ref2.onRepeat,
        onShuffle = _ref2.onShuffle,
        onUpdate = _ref2.onUpdate,
        paused = _ref2.paused,
        playlist = _ref2.playlist,
        proportionPlayed = _ref2.proportionPlayed,
        repeat = _ref2.repeat,
        shuffle = _ref2.shuffle,
        sourceIndex = _ref2.sourceIndex,
        total = _ref2.total,
        rest = _objectWithoutProperties(_ref2, ["currentTime", "durFmt", "loop", "mediaComponent", "mediaRef", "onChange", "onEnded", "onNext", "onPause", "onPlay", "onPrevious", "onRepeat", "onShuffle", "onUpdate", "paused", "playlist", "proportionPlayed", "repeat", "shuffle", "sourceIndex", "total"]);

    return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread({}, rest), {}, {
      children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Media["default"], {
        loop: loop,
        mediaComponent: mediaComponent,
        onEnded: onEnded,
        onUpdate: onUpdate,
        ref: mediaRef,
        source: playlist ? playlist[sourceIndex] : null
      }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MediaSlider["default"], {
        onChange: onChange,
        value: proportionPlayed
      }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Times["default"], {
        current: currentTime,
        formatter: durFmt,
        total: total
      }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MediaControls["default"], {
        onNext: onNext,
        onPause: onPause,
        onPlay: onPlay,
        onPrevious: onPrevious,
        onRepeat: onRepeat,
        onShuffle: onShuffle,
        paused: paused,
        repeat: repeat,
        shuffle: shuffle
      })]
    }));
  }
});
/**
 * Media player behaviors to apply to [MediaPlayerBase]{@link agate/MediaPlayer.MediaPlayerBase}.
 *
 * @class MediaPlayerBehaviorDecorator
 * @hoc
 * @memberof agate/MediaPlayer
 * @private
 */

exports.MediaPlayerBase = MediaPlayerBase;
var MediaPlayerBehaviorDecorator = (0, _hoc["default"])(function (config, Wrapped) {
  var _class, _temp;

  // eslint-disable-line no-unused-vars
  return _temp = _class = /*#__PURE__*/function (_Component) {
    _inherits(_class, _Component);

    var _super = _createSuper(_class);

    function _class(_props) {
      var _this;

      _classCallCheck(this, _class);

      _this = _super.call(this, _props); // Internal State

      _this.handle = _handle.handle.bind(_assertThisInitialized(_this));
      _this.handlePlay = _this.handle(forwardPlay, function () {
        return _this.play();
      });
      _this.handlePause = _this.handle(forwardPause, function () {
        return _this.pause();
      });

      _this.addStateToEvent = function (ev) {
        return _objectSpread({
          // More props from `ev` may be added here as needed, but a full copy via `...ev`
          // overloads Storybook's Action Logger and likely has other perf fallout.
          type: ev.type
        }, _this.getMediaState());
      };

      _this.getMediaState = function () {
        return {
          currentTime: _this.state.currentTime,
          duration: _this.state.duration,
          loop: _this.state.loop,
          paused: _this.state.paused,
          proportionPlayed: _this.state.proportionPlayed
        };
      };

      _this.send = function (action, props) {
        return _this.media[action](props);
      };

      _this.handleEvent = function () {
        var el = _this.media;
        var updatedState = {
          currentTime: el.currentTime,
          duration: el.duration,
          loop: el.loop,
          paused: el.paused,
          proportionPlayed: el.proportionPlayed || 0
        }; // If there's an error, we're obviously not loading, no matter what the readyState is.

        if (updatedState.error) updatedState.loading = false;

        _this.setState(updatedState);
      };

      _this.play = function () {
        var playPromise = _this.send('play');

        if (playPromise) {
          playPromise.then(function () {// Automatic playback started!
          })["catch"](function () {// Auto-play was prevented
          });
        }
      };

      _this.pause = function () {
        _this.send('pause');
      };

      _this.handleOnRepeat = function () {
        // Handling the 3 states of repeat: repeat none, repeat one and repeat all
        var loop = false;

        _this.setState(function (_ref3) {
          var repeat = _ref3.repeat;

          switch (repeat) {
            case 'none':
              loop = !repeat.loop;
              return {
                loop: loop,
                repeat: 'one'
              };

            case 'one':
              return {
                repeat: 'all'
              };

            case 'all':
              return {
                repeat: 'none'
              };
          }
        }, function () {
          _this.media.loop = loop;
        });
      };

      _this.handleOnEnded = function () {
        // Play next media only if current media is not last or, if it is last, only if repeat='all'
        if (_this.state.sourceIndex !== _this.state.playlist.length - 1 || _this.state.sourceIndex === _this.state.playlist.length - 1 && _this.state.repeat === 'all') {
          _this.handleNext();
        }
      };

      _this.handleNext = function () {
        var currentIndex = _this.state.sourceIndex;

        if (_this.state.repeat !== 'one') {
          if (currentIndex < _this.state.playlist.length - 1) {
            ++currentIndex;
          } else if (_this.state.repeat === 'all') {
            // When shuffle is true, the playback of the list restarts and the media list is reshuffled.
            currentIndex = 0;

            if (_this.state.shuffle) {
              _this.shufflePlaylist();
            }
          }

          _this.setState(function () {
            return {
              sourceIndex: currentIndex
            };
          }, function () {
            _this.play();
          });
        } else {
          _this.media.currentTime = 0;

          _this.play();
        }
      };

      _this.handlePrevious = function () {
        var currentIndex = _this.state.sourceIndex;

        if (_this.state.repeat !== 'one' && (_this.media.paused || _this.media.currentTime < 2)) {
          if (currentIndex > 0) {
            --currentIndex;
          } else if (!_this.state.shuffle && _this.state.repeat === 'all') {
            currentIndex = _this.state.playlist.length - 1;
          }

          _this.setState(function () {
            return {
              sourceIndex: currentIndex
            };
          }, function () {
            _this.media.currentTime = 0;

            _this.play();
          });
        } else {
          _this.media.currentTime = 0;

          _this.play();
        }
      };

      _this.shufflePlaylist = function (currentMedia) {
        var remainingSize = _this.props.children.length;

        var playlist = _toConsumableArray(_this.props.children);

        var currentMediaIndex; // While there are elements in the array

        while (remainingSize > 0) {
          // Pick a random index
          var randomIndex = Math.floor(Math.random() * remainingSize); // Decrease size by 1

          remainingSize--; // And swap the last element with it

          var _ref4 = [playlist[randomIndex], playlist[remainingSize]];
          playlist[remainingSize] = _ref4[0];
          playlist[randomIndex] = _ref4[1];

          if (playlist[remainingSize] === currentMedia) {
            currentMediaIndex = remainingSize;
          }
        } // Keep the current media active and set it as the first element in the shuffled array


        if (currentMediaIndex) {
          var _ref5 = [playlist[currentMediaIndex], playlist[0]];
          playlist[0] = _ref5[0];
          playlist[currentMediaIndex] = _ref5[1];
        }

        _this.setState({
          playlist: playlist,
          sourceIndex: 0
        });
      };

      _this.handleShuffle = function () {
        var currentMedia = _this.state.playlist[_this.state.sourceIndex];

        _this.setState(function (_ref6) {
          var shuffle = _ref6.shuffle;

          if (!shuffle) {
            return {
              shuffle: true
            };
          } else {
            // When resetting shuffle to false, the initial playlist is set with the last played media kept active.
            return {
              shuffle: false,
              playlist: _this.props.children,
              sourceIndex: parseInt(currentMedia.key)
            };
          }
        }, function () {
          if (_this.state.shuffle) {
            _this.shufflePlaylist(currentMedia);
          }
        });
      };

      _this.onSliderChange = function (_ref7) {
        var value = _ref7.value;
        var currentTime = value * _this.state.duration;
        var seconds = Math.floor(currentTime);
        _this.media.currentTime = currentTime;

        if (!isNaN(seconds)) {
          var knobTime = (0, _util2.secondsToTime)(seconds, getDurFmt(_this.props.locale), {
            includeHour: true
          });

          _this.props.announce("".concat((0, _$L["default"])('jump to'), " ").concat(knobTime), true);
        }
      };

      _this.setMediaRef = function (node) {
        _this.media = node;
      };

      _this.media = null;
      _this.state = {
        currentTime: 0,
        duration: 0,
        loop: false,
        paused: true,
        playlist: _this.props.children,
        proportionPlayed: 0,
        repeat: 'none',
        shuffle: false,
        sourceIndex: 0
      };
      return _this;
    }

    _createClass(_class, [{
      key: "render",
      value: function render() {
        var rest = Object.assign({}, this.props);
        delete rest.announce;
        return /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapped, _objectSpread(_objectSpread({}, rest), {}, {
          currentTime: this.state.currentTime,
          loop: this.state.loop,
          mediaRef: this.setMediaRef,
          onChange: this.onSliderChange,
          onEnded: this.handleOnEnded,
          onNext: this.handleNext,
          onPause: this.handlePause,
          onPlay: this.handlePlay,
          onPrevious: this.handlePrevious,
          onRepeat: this.handleOnRepeat,
          onShuffle: this.handleShuffle,
          onUpdate: this.handleEvent,
          paused: this.state.paused,
          playlist: this.state.playlist,
          proportionPlayed: this.state.proportionPlayed,
          repeat: this.state.repeat,
          shuffle: this.state.shuffle,
          sourceIndex: this.state.sourceIndex,
          total: this.state.duration
        }));
      }
    }]);

    return _class;
  }(_react.Component), _class.displayName = 'MediaPlayerBehaviorDecorator', _class.propTypes =
  /** @lends agate/MediaPlayer.MediaPlayerBehaviorDecorator.prototype */
  {
    /**
     * Passed by AnnounceDecorator for accessibility.
     *
     * @type {Object}
     * @public
     */
    announce: _propTypes2["default"].func,

    /**
     * The current locale as a
     * {@link https://tools.ietf.org/html/rfc5646|BCP 47 language tag}.
     *
     * @type {String}
     * @public
     */
    locale: _propTypes2["default"].string,

    /**
     * Media component to use.
     *
     * The default (`'video'`) renders an `HTMLVideoElement`. Custom media components must have
     * a similar API structure, exposing the following APIs:
     *
     * Methods:
     * * `load()` - load media
     *
     * @type {String|Component}
     * @default 'audio'
     * @public
     */
    mediaComponent: _propTypes["default"].renderable,

    /**
     * Called when jumping to next media
     *
     * @type {Function}
     * @public
     */
    onNext: _propTypes2["default"].func,

    /**
     * Called when media is paused
     *
     * @type {Function}
     * @public
     */
    onPause: _propTypes2["default"].func,

    /**
     * Called when media is played
     *
     * @type {Function}
     * @public
     */
    onPlay: _propTypes2["default"].func,

    /**
     * Called when jumping to previous media
     *
     * @type {Function}
     * @public
     */
    onPrevious: _propTypes2["default"].func,

    /**
     * Called when media is on repeat mode.
     *
     * @type {Function}
     * @public
     */
    onRepeat: _propTypes2["default"].func,

    /**
     * Called when jumping to a random media
     *
     * @type {Function}
     * @public
     */
    onShuffle: _propTypes2["default"].func
  }, _temp;
}); // eslint-disable-next-line no-shadow

var AnnounceDecorator = function AnnounceDecorator(Wrapped) {
  return function AnnounceDecorator(props) {
    var _useAnnounce = (0, _AnnounceDecorator.useAnnounce)(),
        announce = _useAnnounce.announce,
        children = _useAnnounce.children;

    return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
      children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapped, _objectSpread(_objectSpread({}, props), {}, {
        announce: announce
      })), children]
    });
  };
};
/**
 * A higher-order component that adds Agate specific behaviors to `MediaPlayer`.
 *
 * @hoc
 * @memberof agate/MediaPlayer
 * @mixes ui/Slottable.Slottable
 * @mixes agate/Skinnable.Skinnable
 * @public
 */


var MediaPlayerDecorator = (0, _compose["default"])(AnnounceDecorator, MediaPlayerBehaviorDecorator, _Pure["default"], (0, _Slottable["default"])({
  slots: ['source']
}), _Skinnable["default"], (0, _I18nDecorator.I18nContextDecorator)({
  localeProp: 'locale'
}));
/**
 * An Agate-styled `MediaPlayer` component.
 *
 * Usage:
 * ```
 * <MediaPlayer>
 *   <source src={['https://sampleswap.org/mp3/artist/254731/BossPlayer_Your-Right-Here-160.mp3']} type='audio/mp3' />
 * </MediaPlayer>
 * ```
 *
 * @class MediaPlayer
 * @memberof agate/MediaPlayer
 * @extends agate/MediaPlayer.MediaPlayerBase
 * @mixes agate/MediaPlayer.MediaPlayerDecorator
 * @ui
 * @public
 */

exports.MediaPlayerDecorator = MediaPlayerDecorator;
var MediaPlayer = MediaPlayerDecorator(MediaPlayerBase);
exports.MediaPlayer = MediaPlayer;
var _default = MediaPlayer;
exports["default"] = _default;