react-slide-deck-windowsfixed
Version:
react slide deck, carousel, page scroll, swipe
1,580 lines (1,319 loc) • 109 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"), require("react-dom"));
else if(typeof define === 'function' && define.amd)
define(["react", "react-dom"], factory);
else if(typeof exports === 'object')
exports["ReactDeck"] = factory(require("react"), require("react-dom"));
else
root["ReactDeck"] = factory(root["React"], root["ReactDOM"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_89__, __WEBPACK_EXTERNAL_MODULE_90__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _objectWithoutProperties2 = __webpack_require__(1);
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
var _defineProperty2 = __webpack_require__(2);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _getPrototypeOf = __webpack_require__(21);
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _classCallCheck2 = __webpack_require__(32);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = __webpack_require__(33);
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = __webpack_require__(34);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(81);
var _inherits3 = _interopRequireDefault(_inherits2);
var _symbol = __webpack_require__(65);
var _symbol2 = _interopRequireDefault(_symbol);
var _react = __webpack_require__(89);
var _react2 = _interopRequireDefault(_react);
var _reactDom = __webpack_require__(90);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _tween = __webpack_require__(91);
var _tween2 = _interopRequireDefault(_tween);
var _classnames = __webpack_require__(97);
var _classnames2 = _interopRequireDefault(_classnames);
var _raf = __webpack_require__(93);
var _raf2 = _interopRequireDefault(_raf);
var _slide = __webpack_require__(98);
var _slide2 = _interopRequireDefault(_slide);
var _style = __webpack_require__(99);
var _style2 = _interopRequireDefault(_style);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// import throttle from 'utils/throttle';
var SWIPE_DURA = 1000; // default transition duration
/**
* <Deck
* horizontal={true|false}
* loop
* swipe
* wheel
* slideClasses
* animate
* dura=1400
* factor=0.4
* current=2
* easing=function(currentTime/duration)||string
* onSwitching
* onSwitchDone
* >
* <Deck.Slide>
* </Deck.Slide>
*
* <Deck.Slide>
* </Deck.Slide>
* </Deck>
*
*/
var SWIPE_MIN_DISTANCE = 0;
var SWIPE_FACTOR = 0.22;
var FORWARD_SPEED = 6;
var CURRENT_SLIDE_REF = (0, _symbol2.default)('current slide');
// really hacky to disable wheel event during scrolling
var WHEELABLE_AFTER_SCROLL_MS = 100;
var SCROLL_THROTTLE_MS = 100;
var STATUS = {
NORMAL: 0,
SWIPE_STARTED: 1,
SWIPING: 2,
FORWARDING: 4,
CANCELING: 8,
UP: 16,
DOWN: 32,
SWIPED: 64,
WHEELING: 128
};
var Deck = function (_Component) {
(0, _inherits3.default)(Deck, _Component);
function Deck(props, context) {
(0, _classCallCheck3.default)(this, Deck);
var _this = (0, _possibleConstructorReturn3.default)(this, (Deck.__proto__ || (0, _getPrototypeOf2.default)(Deck)).call(this, props, context));
var current = props.current,
easing = props.easing,
_props$dura = props.dura,
dura = _props$dura === undefined ? SWIPE_DURA : _props$dura;
_this.state = { current: current, prev: _this.normalizeIndex(current + 1), status: STATUS.NORMAL };
_this.handleTouchStart = _this.handleTouchStart.bind(_this);
_this.handleTouchMove = _this.handleTouchMove.bind(_this);
_this.handleTouchEnd = _this.handleTouchEnd.bind(_this);
_this.handleWheel = _this.handleWheel.bind(_this);
_this.calcDimension = _this.calcDimension.bind(_this);
//this.handleScroll = throttle(::this.handleScroll, SCROLL_THROTTLE_MS);
_this.handleScroll = _this.handleScroll.bind(_this);
_this.tween = new _tween2.default();
_this.tween.ease(easing).duration(dura).on('started', _this.onSwitchStarted.bind(_this)).on('updating', _this.onSwitching.bind(_this)).on('stopped', _this.onSwitchStopped.bind(_this)).on('paused', _this.onSwitchPaused.bind(_this)).on('done', _this.onSwitchDone.bind(_this));
return _this;
}
(0, _createClass3.default)(Deck, [{
key: 'componentDidMount',
value: function componentDidMount() {
this.calcDimension();
window.addEventListener('resize', this.calcDimension);
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
window.removeEventListener('resize', this.calcDimension);
}
}, {
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(nextProps, nextState) {
if (nextState.status & STATUS.SWIPE_STARTED) return false;
return true;
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
var _state = this.state,
prev = _state.current,
prevStatus = _state.status;
if (prevStatus & STATUS.SWIPED || prevStatus & STATUS.WHEELING) return;
var current = this.normalizeIndex(nextProps.current);
if (prev === current) return;
if (prevStatus === STATUS.NORMAL && nextProps.animate !== false) {
var status = STATUS.FORWARDING | (prev < current ? STATUS.DOWN : STATUS.UP);
this.setState({ prev: prev, current: current, status: status });
this.startTran(0, (status & STATUS.DOWN ? -1 : 1) * (nextProps.horizontal ? this.state.width : this.state.height));
} else {
this.setState({ prev: prev, current: current, status: STATUS.NORMAL });
this.onSwitchDone();
}
}
}, {
key: 'normalizeIndex',
value: function normalizeIndex(index) {
var slidesCount = _react.Children.count(this.props.children);
return (index + slidesCount) % slidesCount;
}
}, {
key: 'calcDimension',
value: function calcDimension() {
var dom = _reactDom2.default.findDOMNode(this);
this.setState({
width: dom.offsetWidth,
height: dom.offsetHeight
});
}
}, {
key: 'onSwitchStarted',
value: function onSwitchStarted() {
var _this2 = this;
var callback = this.props.onSwitchStarted;
callback && (0, _raf2.default)(function () {
return callback.call(_this2, _this2.state);
});
}
}, {
key: 'onSwitching',
value: function onSwitching(_ref) {
var _this3 = this;
var distance = _ref.distance,
factor = _ref.factor;
this.setState({ distance: distance });
var callback = this.props.onSwitching;
callback && (0, _raf2.default)(function () {
var progress = factor || Math.abs(distance) / (_this3.props.horizontal ? _this3.state.width : _this3.state.height);
return callback.call(_this3, progress, _this3);
});
}
}, {
key: 'onSwitchDone',
value: function onSwitchDone(props) {
var _this4 = this;
this.setState({ distance: 0, status: STATUS.NORMAL });
var callback = this.props.onSwitchDone;
callback && (0, _raf2.default)(function () {
return callback.call(_this4, _this4.state);
});
}
}, {
key: 'onSwitchPaused',
value: function onSwitchPaused(props) {
var callback = this.props.onSwitchPaused;
callback && callback.call(this, this.state);
}
}, {
key: 'onSwitchStopped',
value: function onSwitchStopped(props) {
var callback = this.props.onSwitchStopped;
callback && callback.call(this, this.state);
}
}, {
key: 'startTran',
value: function startTran(from, to) {
this.tween.reset({ distance: from }).to({ distance: to }).start();
}
}, {
key: 'backTran',
value: function backTran() {
this.tween.back();
}
}, {
key: 'reverseTran',
value: function reverseTran() {
var _state2 = this.state,
distance = _state2.distance,
width = _state2.width,
height = _state2.height;
var total = (distance > 0 ? 1 : -1) * (this.props.horizontal ? width : height);
this.tween.reset({ distance: this.state.distance - total }).to({ distance: -total }).start();
}
}, {
key: 'resumeTran',
value: function resumeTran() {
var status = this.state.status & ~STATUS.SWIPE_STARTED;
this.setState({ status: status });
this.tween.resume();
}
}, {
key: 'isCurrentSlideScrolling',
value: function isCurrentSlideScrolling(_ref2) {
var delta = _ref2.delta,
_ref2$horizontal = _ref2.horizontal,
horizontal = _ref2$horizontal === undefined ? false : _ref2$horizontal;
var currentSlideDom = _reactDom2.default.findDOMNode(this.refs[CURRENT_SLIDE_REF]);
var offsetWidth = currentSlideDom.offsetWidth,
scrollLeft = currentSlideDom.scrollLeft,
scrollWidth = currentSlideDom.scrollWidth,
offsetHeight = currentSlideDom.offsetHeight,
scrollTop = currentSlideDom.scrollTop,
scrollHeight = currentSlideDom.scrollHeight;
var sizes = horizontal ? [offsetWidth, scrollLeft, scrollWidth] : [offsetHeight, scrollTop, scrollHeight];
if (delta > 0 && sizes[0] + sizes[1] < sizes[2]) return true;
if (delta < 0 && sizes[1] > 0) return true;
return false;
}
}, {
key: 'handleWheel',
value: function handleWheel(e) {
var _props = this.props,
slides = _props.children,
loop = _props.loop,
horizontal = _props.horizontal;
var delta = horizontal ? e.deltaX : e.deltaY;
var _state3 = this.state,
prevStatus = _state3.status,
prevWheelDelta = _state3.prevWheelDelta;
var status = STATUS.WHEELING | STATUS.FORWARDING | (delta > 0 ? STATUS.DOWN : STATUS.UP);
Math.abs(delta) > 0 && this.setState({ prevWheelDelta: delta });
if (Date.now() - this.latestScroll <= WHEELABLE_AFTER_SCROLL_MS) {
return;
}
if (prevStatus & STATUS.WHEELING && delta * prevWheelDelta < 0) {
this.setState({
prev: this.state.current,
current: this.state.prev,
status: status
});
this.reverseTran();
return;
}
//if (prevWheelDelta !== undefined && Math.abs(delta) / Math.abs(prevWheelDelta) <= 2) return;
if (prevStatus !== STATUS.NORMAL || delta === 0 || this.isCurrentSlideScrolling({ delta: delta, horizontal: horizontal })) return;
var slidesCount = _react.Children.count(slides);
var prev = this.state.current;
var current = prev + (delta > 0 ? 1 : -1);
current = loop ? (current + slidesCount) % slidesCount : current;
if (current >= 0 && current < slidesCount) {
this.setState({ prev: prev, current: current, status: status });
this.startTran(0, (status & STATUS.DOWN ? -1 : 1) * (horizontal ? this.state.width : this.state.height));
}
}
}, {
key: 'handleSwipeStart',
value: function handleSwipeStart(_ref3) {
var x = _ref3.x,
y = _ref3.y;
this.tween.stop();
this.setState({ oriX: x, oriY: y, status: this.state.status | STATUS.SWIPE_STARTED });
}
}, {
key: 'handleSwipeMove',
value: function handleSwipeMove(_ref4) {
var x = _ref4.x,
y = _ref4.y;
var status = this.state.status;
if (!(status & STATUS.SWIPING || status & STATUS.SWIPE_STARTED)) return;
var _state4 = this.state,
prev = _state4.prev,
current = _state4.current,
oriX = _state4.oriX,
oriY = _state4.oriY,
width = _state4.width,
height = _state4.height,
_state4$distance = _state4.distance,
distance = _state4$distance === undefined ? 0 : _state4$distance;
var horizontal = this.props.horizontal;
var slidesCount = _react.Children.count(this.props.children);
var distanceDimen = horizontal ? width : height;
// new swipe started during Canceling or Forwarding tweening
if (status & STATUS.SWIPE_STARTED && distance !== 0) {
horizontal ? oriX = x - distance : oriY = y - distance;
}
distance = horizontal ? x - oriX : y - oriY;
var gear = distance - (this.state.distance || 0);
// swipe direction detection, if not corresponds with this.props;
// or if current slide can swipe;
// then return false to cancel this swipe
var xDiff = Math.abs(x - oriX);
var yDiff = Math.abs(y - oriY);
var swipeDirectionOk = (xDiff >= SWIPE_MIN_DISTANCE || yDiff >= SWIPE_MIN_DISTANCE) && (xDiff >= yDiff ? horizontal : !horizontal);
if (!swipeDirectionOk) return false;
if (this.isCurrentSlideScrolling({ delta: (gear > 0 ? -1 : 1) * (horizontal ? yDiff : xDiff), horizontal: horizontal })) return false;
if (status === STATUS.SWIPE_STARTED || status & STATUS.CANCELING) {
prev = current;
}
if (Math.abs(distance) >= distanceDimen) {
distance %= distanceDimen;
horizontal ? oriX = x - distance : oriY = y - distance;
prev = current;
}
current = prev + (distance > 0 ? -1 : 1);
current = this.props.loop ? (current + slidesCount) % slidesCount : current;
if (current < 0 || current >= slidesCount) {
return;
}
status = STATUS.SWIPING | (distance < 0 ? STATUS.DOWN : STATUS.UP);
this.setState({ prev: prev, current: current, status: status, oriX: oriX, oriY: oriY, gear: gear });
this.onSwitching({ distance: distance, factor: Math.abs(distance) / (horizontal ? width : height) });
}
}, {
key: 'handleSwipeEnd',
value: function handleSwipeEnd(_ref5) {
var x = _ref5.x,
y = _ref5.y;
var _props2 = this.props,
horizontal = _props2.horizontal,
_props2$factor = _props2.factor,
factor = _props2$factor === undefined ? SWIPE_FACTOR : _props2$factor,
_props2$speed = _props2.speed,
speed = _props2$speed === undefined ? FORWARD_SPEED : _props2$speed;
var _state5 = this.state,
prev = _state5.prev,
current = _state5.current,
width = _state5.width,
height = _state5.height,
status = _state5.status,
_state5$distance = _state5.distance,
distance = _state5$distance === undefined ? 0 : _state5$distance,
_state5$gear = _state5.gear,
gear = _state5$gear === undefined ? 0 : _state5$gear;
gear = Math.floor(gear);
if (distance == 0) return;
if (status & STATUS.SWIPE_STARTED) return this.resumeTran();
var shouldForward = distance * gear >= 0 && (Math.abs(distance) / (horizontal ? width : height) >= factor || Math.abs(gear) >= speed);
if (!shouldForward) {
;
var _ref6 = [prev, current];
current = _ref6[0];
prev = _ref6[1];
}status = STATUS.SWIPED | (shouldForward ? STATUS.FORWARDING : STATUS.CANCELING) | (distance > 0 ? STATUS.UP : STATUS.DOWN);
this.setState({ prev: prev, current: current, status: status });
this.startTran(distance, shouldForward ? (distance > 0 ? 1 : -1) * (horizontal ? width : height) : 0);
}
}, {
key: 'handleSwipeCancel',
value: function handleSwipeCancel() {
this.setState({ status: STATUS.NORMAL });
}
// For touch events
}, {
key: 'handleTouchStart',
value: function handleTouchStart(e) {
var touch = e.changedTouches[0];
this.handleSwipeStart({ x: touch.clientX, y: touch.clientY });
}
}, {
key: 'handleTouchMove',
value: function handleTouchMove(e) {
//e.preventDefault();
var touch = e.changedTouches[0];
this.handleSwipeMove({ x: touch.clientX, y: touch.clientY }) === undefined && e.preventDefault();
}
}, {
key: 'handleTouchEnd',
value: function handleTouchEnd(e) {
var touch = e.changedTouches[0];
this.handleSwipeEnd({ x: touch.clientX, y: touch.clientY });
}
}, {
key: 'handleTouchCancel',
value: function handleTouchCancel(e) {
this.handleSwipeCancel();
}
}, {
key: 'genSlideStyle',
value: function genSlideStyle(factor) {
var _props3 = this.props,
horizontal = _props3.horizontal,
loop = _props3.loop,
swipe = _props3.swipe;
var _state6 = this.state,
prev = _state6.prev,
current = _state6.current,
status = _state6.status,
distance = _state6.distance,
width = _state6.width,
height = _state6.height;
var dx = horizontal ? distance + factor * width : 0;
var dy = !horizontal ? distance + factor * height : 0;
var transform = 'translate3d(' + dx + 'px, ' + dy + 'px, 0)';
return { transform: transform, WebkitTransform: transform };
}
}, {
key: 'renderSlides',
value: function renderSlides() {
var _props4 = this.props,
children = _props4.children,
horizontal = _props4.horizontal,
loop = _props4.loop,
slideClasses = _props4.slideClasses;
var _state7 = this.state,
prev = _state7.prev,
current = _state7.current,
status = _state7.status;
// const slides = Children.toArray(children);
var slides = Array.isArray(children) ? children : [children];
var slidesCount = _react.Children.count(slides),
lastIndex = slidesCount - 1;
var isSwiping = status & STATUS.SWIPING,
isForwarding = status & STATUS.FORWARDING,
isCanceling = status & STATUS.CANCELING,
isUping = status & STATUS.UP,
isDowning = status & STATUS.DOWN,
isNormal = status === STATUS.NORMAL;
var slidesProps = _react.Children.map(slides, function (slide, index) {
return (0, _defineProperty3.default)({
key: index, done: isNormal, classes: slideClasses
}, index === current ? 'current' : index < current ? 'before' : 'after', true);
});
var prevSlideProps = slidesProps[prev];
var currentSlideProps = slidesProps[current];
prevSlideProps.prev = true;
// compute transform style for current and prev Slide
if (prev !== current && !isNormal) {
var prevFactor = 0;
var currentFactor = current > prev ? 1 : -1;
if (isCanceling && isDowning) {
currentFactor = 0;
prevFactor = 1;
} else if (isCanceling && isUping) {
currentFactor = 0;
prevFactor = -1;
}
if (loop) {
if (isSwiping && isDowning) {
currentFactor = 1;
} else if (isSwiping && isUping) {
currentFactor = -1;
} else if (isForwarding && isDowning) {
currentFactor = 1;
} else if (isForwarding && isUping) {
currentFactor = -1;
}
}
prevSlideProps.style = this.genSlideStyle(prevFactor);
currentSlideProps.style = this.genSlideStyle(currentFactor);
}
currentSlideProps.ref = CURRENT_SLIDE_REF;
return slidesProps.map(function (props, index) {
return _react2.default.cloneElement(slides[index], props);
});
}
}, {
key: 'handleScroll',
value: function handleScroll() {
this.latestScroll = Date.now();
}
}, {
key: 'render',
value: function render() {
var _cx;
var _props5 = this.props,
children = _props5.children,
current = _props5.current,
horizontal = _props5.horizontal,
loop = _props5.loop,
swipe = _props5.swipe,
wheel = _props5.wheel,
slideClasses = _props5.slideClasses,
props = (0, _objectWithoutProperties3.default)(_props5, ['children', 'current', 'horizontal', 'loop', 'swipe', 'wheel', 'slideClasses']);
if (wheel) {
props.onWheel = this.handleWheel;
}
if (swipe) {
props.onTouchStart = this.handleTouchStart;
props.onTouchMove = this.handleTouchMove;
props.onTouchEnd = this.handleTouchEnd;
}
props.onScroll = this.handleScroll;
props.className = (0, _classnames2.default)((_cx = {}, (0, _defineProperty3.default)(_cx, _style2.default.horizontalDeck, horizontal), (0, _defineProperty3.default)(_cx, _style2.default.verticalDeck, !horizontal), _cx), _style2.default.deck, props.className);
return _react2.default.createElement(
'div',
props,
this.renderSlides()
);
}
}]);
return Deck;
}(_react.Component);
Deck.STATUS = STATUS;
Deck.Slide = _slide2.default;
exports.default = Deck;
/***/ }),
/* 1 */
/***/ (function(module, exports) {
"use strict";
exports.__esModule = true;
exports.default = function (obj, keys) {
var target = {};
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
}
return target;
};
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _defineProperty = __webpack_require__(3);
var _defineProperty2 = _interopRequireDefault(_defineProperty);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function (obj, key, value) {
if (key in obj) {
(0, _defineProperty2.default)(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
};
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(4), __esModule: true };
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(5);
var $Object = __webpack_require__(8).Object;
module.exports = function defineProperty(it, key, desc){
return $Object.defineProperty(it, key, desc);
};
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
var $export = __webpack_require__(6);
// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
$export($export.S + $export.F * !__webpack_require__(16), 'Object', {defineProperty: __webpack_require__(12).f});
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(7)
, core = __webpack_require__(8)
, ctx = __webpack_require__(9)
, hide = __webpack_require__(11)
, PROTOTYPE = 'prototype';
var $export = function(type, name, source){
var IS_FORCED = type & $export.F
, IS_GLOBAL = type & $export.G
, IS_STATIC = type & $export.S
, IS_PROTO = type & $export.P
, IS_BIND = type & $export.B
, IS_WRAP = type & $export.W
, exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
, expProto = exports[PROTOTYPE]
, target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]
, key, own, out;
if(IS_GLOBAL)source = name;
for(key in source){
// contains in native
own = !IS_FORCED && target && target[key] !== undefined;
if(own && key in exports)continue;
// export native or passed
out = own ? target[key] : source[key];
// prevent global pollution for namespaces
exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
// bind timers to global for call from export context
: IS_BIND && own ? ctx(out, global)
// wrap global constructors for prevent change them in library
: IS_WRAP && target[key] == out ? (function(C){
var F = function(a, b, c){
if(this instanceof C){
switch(arguments.length){
case 0: return new C;
case 1: return new C(a);
case 2: return new C(a, b);
} return new C(a, b, c);
} return C.apply(this, arguments);
};
F[PROTOTYPE] = C[PROTOTYPE];
return F;
// make static versions for prototype methods
})(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
// export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
if(IS_PROTO){
(exports.virtual || (exports.virtual = {}))[key] = out;
// export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out);
}
}
};
// type bitmap
$export.F = 1; // forced
$export.G = 2; // global
$export.S = 4; // static
$export.P = 8; // proto
$export.B = 16; // bind
$export.W = 32; // wrap
$export.U = 64; // safe
$export.R = 128; // real proto method for `library`
module.exports = $export;
/***/ }),
/* 7 */
/***/ (function(module, exports) {
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math
? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
/***/ }),
/* 8 */
/***/ (function(module, exports) {
var core = module.exports = {version: '2.4.0'};
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
// optional / simple context binding
var aFunction = __webpack_require__(10);
module.exports = function(fn, that, length){
aFunction(fn);
if(that === undefined)return fn;
switch(length){
case 1: return function(a){
return fn.call(that, a);
};
case 2: return function(a, b){
return fn.call(that, a, b);
};
case 3: return function(a, b, c){
return fn.call(that, a, b, c);
};
}
return function(/* ...args */){
return fn.apply(that, arguments);
};
};
/***/ }),
/* 10 */
/***/ (function(module, exports) {
module.exports = function(it){
if(typeof it != 'function')throw TypeError(it + ' is not a function!');
return it;
};
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
var dP = __webpack_require__(12)
, createDesc = __webpack_require__(20);
module.exports = __webpack_require__(16) ? function(object, key, value){
return dP.f(object, key, createDesc(1, value));
} : function(object, key, value){
object[key] = value;
return object;
};
/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(13)
, IE8_DOM_DEFINE = __webpack_require__(15)
, toPrimitive = __webpack_require__(19)
, dP = Object.defineProperty;
exports.f = __webpack_require__(16) ? Object.defineProperty : function defineProperty(O, P, Attributes){
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if(IE8_DOM_DEFINE)try {
return dP(O, P, Attributes);
} catch(e){ /* empty */ }
if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
if('value' in Attributes)O[P] = Attributes.value;
return O;
};
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(14);
module.exports = function(it){
if(!isObject(it))throw TypeError(it + ' is not an object!');
return it;
};
/***/ }),
/* 14 */
/***/ (function(module, exports) {
module.exports = function(it){
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = !__webpack_require__(16) && !__webpack_require__(17)(function(){
return Object.defineProperty(__webpack_require__(18)('div'), 'a', {get: function(){ return 7; }}).a != 7;
});
/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {
// Thank's IE8 for his funny defineProperty
module.exports = !__webpack_require__(17)(function(){
return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
});
/***/ }),
/* 17 */
/***/ (function(module, exports) {
module.exports = function(exec){
try {
return !!exec();
} catch(e){
return true;
}
};
/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(14)
, document = __webpack_require__(7).document
// in old IE typeof document.createElement is 'object'
, is = isObject(document) && isObject(document.createElement);
module.exports = function(it){
return is ? document.createElement(it) : {};
};
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
// 7.1.1 ToPrimitive(input [, PreferredType])
var isObject = __webpack_require__(14);
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
module.exports = function(it, S){
if(!isObject(it))return it;
var fn, val;
if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;
if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
throw TypeError("Can't convert object to primitive value");
};
/***/ }),
/* 20 */
/***/ (function(module, exports) {
module.exports = function(bitmap, value){
return {
enumerable : !(bitmap & 1),
configurable: !(bitmap & 2),
writable : !(bitmap & 4),
value : value
};
};
/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(22), __esModule: true };
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(23);
module.exports = __webpack_require__(8).Object.getPrototypeOf;
/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.9 Object.getPrototypeOf(O)
var toObject = __webpack_require__(24)
, $getPrototypeOf = __webpack_require__(26);
__webpack_require__(31)('getPrototypeOf', function(){
return function getPrototypeOf(it){
return $getPrototypeOf(toObject(it));
};
});
/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
// 7.1.13 ToObject(argument)
var defined = __webpack_require__(25);
module.exports = function(it){
return Object(defined(it));
};
/***/ }),
/* 25 */
/***/ (function(module, exports) {
// 7.2.1 RequireObjectCoercible(argument)
module.exports = function(it){
if(it == undefined)throw TypeError("Can't call method on " + it);
return it;
};
/***/ }),
/* 26 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
var has = __webpack_require__(27)
, toObject = __webpack_require__(24)
, IE_PROTO = __webpack_require__(28)('IE_PROTO')
, ObjectProto = Object.prototype;
module.exports = Object.getPrototypeOf || function(O){
O = toObject(O);
if(has(O, IE_PROTO))return O[IE_PROTO];
if(typeof O.constructor == 'function' && O instanceof O.constructor){
return O.constructor.prototype;
} return O instanceof Object ? ObjectProto : null;
};
/***/ }),
/* 27 */
/***/ (function(module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function(it, key){
return hasOwnProperty.call(it, key);
};
/***/ }),
/* 28 */
/***/ (function(module, exports, __webpack_require__) {
var shared = __webpack_require__(29)('keys')
, uid = __webpack_require__(30);
module.exports = function(key){
return shared[key] || (shared[key] = uid(key));
};
/***/ }),
/* 29 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(7)
, SHARED = '__core-js_shared__'
, store = global[SHARED] || (global[SHARED] = {});
module.exports = function(key){
return store[key] || (store[key] = {});
};
/***/ }),
/* 30 */
/***/ (function(module, exports) {
var id = 0
, px = Math.random();
module.exports = function(key){
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};
/***/ }),
/* 31 */
/***/ (function(module, exports, __webpack_require__) {
// most Object methods by ES6 should accept primitives
var $export = __webpack_require__(6)
, core = __webpack_require__(8)
, fails = __webpack_require__(17);
module.exports = function(KEY, exec){
var fn = (core.Object || {})[KEY] || Object[KEY]
, exp = {};
exp[KEY] = exec(fn);
$export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp);
};
/***/ }),
/* 32 */
/***/ (function(module, exports) {
"use strict";
exports.__esModule = true;
exports.default = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
/***/ }),
/* 33 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _defineProperty = __webpack_require__(3);
var _defineProperty2 = _interopRequireDefault(_defineProperty);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = 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;
(0, _defineProperty2.default)(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
/***/ }),
/* 34 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _typeof2 = __webpack_require__(35);
var _typeof3 = _interopRequireDefault(_typeof2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function (self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self;
};
/***/ }),
/* 35 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _iterator = __webpack_require__(36);
var _iterator2 = _interopRequireDefault(_iterator);
var _symbol = __webpack_require__(65);
var _symbol2 = _interopRequireDefault(_symbol);
var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
return typeof obj === "undefined" ? "undefined" : _typeof(obj);
} : function (obj) {
return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
};
/***/ }),
/* 36 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(37), __esModule: true };
/***/ }),
/* 37 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(38);
__webpack_require__(60);
module.exports = __webpack_require__(64).f('iterator');
/***/ }),
/* 38 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var $at = __webpack_require__(39)(true);
// 21.1.3.27 String.prototype[@@iterator]()
__webpack_require__(41)(String, 'String', function(iterated){
this._t = String(iterated); // target
this._i = 0; // next index
// 21.1.5.2.1 %StringIteratorPrototype%.next()
}, function(){
var O = this._t
, index = this._i
, point;
if(index >= O.length)return {value: undefined, done: true};
point = $at(O, index);
this._i += point.length;
return {value: point, done: false};
});
/***/ }),
/* 39 */
/***/ (function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(40)
, defined = __webpack_require__(25);
// true -> String#at
// false -> String#codePointAt
module.exports = function(TO_STRING){
return function(that, pos){
var s = String(defined(that))
, i = toInteger(pos)
, l = s.length
, a, b;
if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
a = s.charCodeAt(i);
return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
? TO_STRING ? s.charAt(i) : a
: TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
};
};
/***/ }),
/* 40 */
/***/ (function(module, exports) {
// 7.1.4 ToInteger
var ceil = Math.ceil
, floor = Math.floor;
module.exports = function(it){
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};
/***/ }),
/* 41 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var LIBRARY = __webpack_require__(42)
, $export = __webpack_require__(6)
, redefine = __webpack_require__(43)
, hide = __webpack_require__(11)
, has = __webpack_require__(27)
, Iterators = __webpack_require__(44)
, $iterCreate = __webpack_require__(45)
, setToStringTag = __webpack_require__(58)
, getPrototypeOf = __webpack_require__(26)
, ITERATOR = __webpack_require__(59)('iterator')
, BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`
, FF_ITERATOR = '@@iterator'
, KEYS = 'keys'
, VALUES = 'values';
var returnThis = function(){ return this; };
module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){
$iterCreate(Constructor, NAME, next);
var getMethod = function(kind){
if(!BUGGY && kind in proto)return proto[kind];
switch(kind){
case KEYS: return function keys(){ return new Constructor(this, kind); };
case VALUES: return function values(){ return new Constructor(this, kind); };
} return function entries(){ return new Constructor(this, kind); };
};
var TAG = NAME + ' Iterator'
, DEF_VALUES = DEFAULT == VALUES
, VALUES_BUG = false
, proto = Base.prototype
, $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
, $default = $native || getMethod(DEFAULT)
, $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined
, $anyNative = NAME == 'Array' ? proto.entries || $native : $native
, methods, key, IteratorPrototype;
// Fix native
if($anyNative){
IteratorPrototype = getPrototypeOf($anyNative.call(new Base));
if(IteratorPrototype !== Object.prototype){
// Set @@toStringTag to native iterators
setToStringTag(IteratorPrototype, TAG, true);
// fix for some old engines
if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);
}
}
// fix Array#{values, @@iterator}.name in V8 / FF
if(DEF_VALUES && $native && $native.name !== VALUES){
VALUES_BUG = true;
$default = function values(){ return $native.call(this); };
}
// Define iterator
if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){
hide(proto, ITERATOR, $default);
}
// Plug for library
Iterators[NAME] = $default;
Iterators[TAG] = returnThis;
if(DEFAULT){
methods = {
values: DEF_VALUES ? $default : getMethod(VALUES),
keys: IS_SET ? $default : getMethod(KEYS),
entries: $entries
};
if(FORCED)for(key in methods){
if(!(key in proto))redefine(proto, key, methods[key]);
} else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
}
return methods;
};
/***/ }),
/* 42 */
/***/ (function(module, exports) {
module.exports = true;
/***/ }),
/* 43 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(11);
/***/ }),
/* 44 */
/***/ (function(module, exports) {
module.exports = {};
/***/ }),
/* 45 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var create = __webpack_require__(46)
, descriptor = __webpack_require__(20)
, setToStringTag = __webpack_require__(58)
, IteratorPrototype = {};
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
__webpack_require__(11)(IteratorPrototype, __webpack_require__(59)('iterator'), function(){ return this; });
module.exports = function(Constructor, NAME, next){
Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)});
setToStringTag(Constructor, NAME + ' Iterator');
};
/***/ }),
/* 46 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
var anObject = __webpack_require__(13)
, dPs = __webpack_require__(47)
, enumBugKeys = __webpack_require__(56)
, IE_PROTO = __webpack_require__(28)('IE_PROTO')
, Empty = function(){ /* empty */ }
, PROTOTYPE = 'prototype';
// Create object with fake `null` prototype: use iframe Object with cleared prototype
var createDict = function(){
// Thrash, waste and sodomy: IE GC bug
var iframe = __webpack_require__(18)('iframe')
, i = enumBugKeys.length
, lt = '<'
, gt = '>'
, iframeDocument;
iframe.style.display = 'none';
__webpack_require__(57).appendChild(iframe);
iframe.src = 'javascript:'; // eslint-disable-line no-script-url
// createDict = iframe.contentWindow.Object;
// html.removeChild(iframe);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
iframeDocument.close();
createDict = iframeDocument.F;
while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]];
return createDict();
};
module.exports = Object.create || function create(O, Properties){
var result;
if(O !== null){
Empty[PROTOTYPE] = anObject(O);
result = new Empty;
Empty[PROTOTYPE] = null;
// add "__proto__" for Object.getPrototypeOf polyfill
result[IE_PROTO] = O;
} else result = createDict();
return Properties === undefined ? result : dPs(result, Properties);
};
/***/ }),
/* 47 */
/***/ (function(module, exports, __webpack_require__) {
var dP = __webpack_require__(12)
, anObject = __webpack_require__(13)
, getKeys = __webpack_require__(48);
module.exports = __webpack_require__(16) ? Object.defineProperties : function defineProperties(O, Properties){
anObject(O);
var keys = getKeys(Properties)
, length = keys.length
, i = 0
, P;
while(length > i)dP.f(O, P = keys[i++], Properties[P]);
return O;
};
/***/ }),
/* 48 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
var $keys = __webpack_require__(49)
, enumBugKeys = __webpack_require__(56);
module.exports = Object.keys || function keys(O){
return $keys(O, enumBugKeys);
};
/***/ }),
/* 49 */
/***/ (function(module, exports, __webpack_require__) {
var has = __webpack_require__(27)
, toIObject = __webpack_require__(50)
, arrayIndexOf = __webpack_require__(53)(false)
, IE_PROTO = __webpack_require__(28)('IE_PROTO');
module.exports = function(object, names){
var O = toIObject(object)
, i = 0
, result = []
, key;
for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);
// Don't enum bug & hidden keys
while(names.length > i)if(has(O, key = names[i++])){
~arrayIndexOf(result, key) || result.push(key);
}
return result;
};
/***/ }),
/* 50 */
/***/ (function(module, exports, __webpack_require__) {
// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = __webpack_require__(51)
, defined = __webpack_require__(25);
module.exports = function(it){
return IObject(defined(it));
};
/***/ }),
/* 51 */
/***/ (function(module, exports, __webpack_require__) {
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var cof = __webpack_require__(52);
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
return cof(it) == 'String' ? it.split('') : Object(it);
};
/***/ }),
/* 52 */
/***/ (function(module, exports) {
var toString = {}.toString;
module.exports = function(it){
return toString.call(it).slice(8, -1);
};
/***/ }),
/* 53 */
/***/ (function(module, exports, __webpack_require__) {
// false -> Array#indexOf
// true -> Array#includes
var toIObject = __webpack_require__(50)
, toLength = __webpack_require__(54)
, toIndex = __webpack_require__(55);
module.exports = function(IS_INCLUDES){
return function($this, el, fromIndex){
var O = toIObject($this)
, length = toLength(O.length)
, index = toIndex(fromIndex, length)
, value;
// Array#includes uses SameValueZero equality algorithm
if(IS_INCLUDES && el != el)while(length > index){
value = O[index++];
if(value != value)return true;
// Array#toIndex ignores holes, Array#includes - not
} else for(;length > index; index++)if(IS_INCLUDES || index in O){
if(O[index] === el)return IS_INCLUDES || index || 0;
} return !IS_INCLUDES && -1;
};
};
/***/ }),
/* 54 */
/***/ (function(module, exports, __webpack_require__) {
// 7.1.15 ToLength
var toInteger = __webpack_require__(40)
, min = Math.min;
module.exports = function(it){
return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
};
/***/ }),
/* 55 */
/***/ (function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(40)
, max = Math.max
, min = Math.min;
module.exports = function(index, length){
index = toInteger(index);
return index < 0 ? max(index + length, 0) : min(index, length);
};
/***/ }),
/* 56 */
/***/ (function(module, exports) {
// IE 8- don't enum bug keys
module.exports = (
'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
).split(',');
/***/ }),
/* 57 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(7).document && document.documentElement;
/***/ }),
/* 58 */
/***/ (function(module, exports, __webpack_require__) {
var def = __webpack_require__(12).f
, has = __webpack_require__(27)
, TAG = __webpack_require__(59)('toStringTag');
module.exports = function(it, tag, stat){
if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});
};
/***/ }),
/* 59 *