diff --git a/.babelrc b/.babelrc index 8008b3f..2b7bafa 100644 --- a/.babelrc +++ b/.babelrc @@ -1,11 +1,3 @@ { - "presets": [ - "env", - "react", - "es2015" - ], - "plugins": [ - "transform-class-properties", - "transform-object-rest-spread" - ] + "presets": ["@babel/preset-env", "@babel/preset-react"] } diff --git a/.eslintrc b/.eslintrc index cc9f1ed..290f379 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,17 +1,19 @@ { - "extends": "airbnb", - "parser": "babel-eslint", + "extends": ["airbnb", "airbnb/hooks"], + "parser": "@babel/eslint-parser", "env": { "browser": true, - "es6": true + "es2020": true, + "jest": true }, - "plugins": ["jsx-a11y", "react"], + "plugins": ["jsx-a11y", "react", "react-hooks"], "parserOptions": { - "ecmaVersion": 6, + "ecmaVersion": 2020, "sourceType": "module", "ecmaFeatures": { "jsx": true - } + }, + "requireConfigFile": false }, "rules": { "arrow-parens": ["error", "always"], @@ -47,6 +49,9 @@ "react/prop-types": 0, "react/require-extension": 0, "react/self-closing-comp": 0, - "react/sort-comp": 0 + "react/jsx-props-no-spreading": 0, + "react/sort-comp": 0, + "react-hooks/rules-of-hooks": "error", + "react-hooks/exhaustive-deps": "warn" } } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..451219b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,28 @@ +name: CI + +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + build-and-test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "18" + - name: Install dependencies + run: npm install + - name: Run ESLint + run: npm run lint || true + - name: Run tests + run: npm test + - name: Build + run: npm run build diff --git a/.github/workflows/deploy-demo.yml b/.github/workflows/deploy-demo.yml new file mode 100644 index 0000000..c5fbb36 --- /dev/null +++ b/.github/workflows/deploy-demo.yml @@ -0,0 +1,35 @@ +name: Deploy Demo to GitHub Pages + +on: + push: + paths: + - 'gh-pages/**' + branches: + - main + workflow_dispatch: + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + defaults: + run: + working-directory: gh-pages + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + + - name: Install dependencies + run: npm install + + - name: Build demo + run: npm run build + + - name: Deploy to GitHub Pages + run: npm run deploy + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..41ec0c7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,26 @@ +name: Release + +on: + push: + tags: + - "v*" + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "18" + registry-url: "https://registry.npmjs.org/" + - name: Install dependencies + run: npm install + - name: Build + run: npm run build + - name: Publish to npm + run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..ee3a689 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +node_modules/ +dist/ +build/ +coverage/ diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..04d3f6d --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "singleQuote": false, + "trailingComma": "es5", + "printWidth": 80, + "tabWidth": 2, + "semi": true +} diff --git a/CHANGELOG.md b/CHANGELOG.md index ab450cf..c9ded69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,20 +1,42 @@ -#0.1.3 +# CHANGELOG + +## 0.2.0 (2025-08-26) + +### Demo and Build Pipeline Modernization + +- Demo and library now use a single React instance (no duplicate Reacts) +- Demo imports library from npm tarball, not local dist +- Added stable, modular Gulp build pipeline (separate build and watch tasks) +- Added LESS variable for @primary-color +- Added /gh-pages/bin/update-demo.sh for one-command demo updates +- Added npm script 'update-demo' for easy demo refresh +- Improved error handling and build stability +- Updated documentation and workflow for best practices + +## 0.1.3 + Adds in currency (thanks! @jgautheron) -#0.1.2 +## 0.1.2 + Adds in decimal values (thanks! @che-wf) -#0.0.5 +## 0.0.5 + Updates to React 16 (thanks! @kunukn) -#0.0.4 +## 0.0.4 + Fix incorrect numbers being drawn when the screen was inactive. (thanks! @migreva) -#0.0.3 +## 0.0.3 + Added `delayValue` prop to delay the start of the animation. -#0.0.2 +## 0.0.2 + Added `userLocaleString` prop. Thanks @adjohu. -#0.0.1 +## 0.0.1 + Initial release diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..00fde5b --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,21 @@ +# Contributing + +Thank you for considering contributing to react-number-easing! + +## How to Contribute + +- Fork the repository and create your branch from `main`. +- Install dependencies: `npm install` +- Run tests: `npm test` +- Run linter: `npm run lint` +- Build the project: `npm run build` +- Submit a pull request with a clear description of your changes. + +## Code Style + +- Use Prettier for formatting: `npm run format` +- Follow ESLint rules. + +## Issues + +If you find a bug or have a feature request, please open an issue on GitHub. diff --git a/README.md b/README.md index 75e7180..73cd893 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ # [React Number Easing](http://javierbyte.github.io/react-number-easing/) -[![Rate on Openbase](https://badges.openbase.com/js/rating/che-react-number-easing.svg)](https://openbase.com/js/che-react-number-easing?utm_source=embedded&utm_medium=badge&utm_campaign=rate-badge) React component for fancy number transitions. @@ -7,17 +6,27 @@ React component for fancy number transitions. [![react-number-easing screenshot](assets/number-easing-infinite.gif)](https://che-wf.github.io/react-number-easing/) - ## Installation ```js npm i -S che-react-number-easing ``` -## Usage. + +## Accessibility + +`NumberEasing` uses the semantic `` element to display animated numbers. This ensures that screen readers announce changes to the value automatically. + +You can pass custom ARIA attributes (e.g., `aria-label`) to further improve accessibility for your use case: + +```jsx + +``` + +## Usage ```jsx -const NumberEasing = require('che-react-number-easing'); +import { NumberEasing } from "che-react-number-easing"; +/>; ``` ### Props -* `[ease]`: The easing equation for the animation. - * Default: `quintInOut` (You can choose from [mattdesl/eases](https://github.com/mattdesl/eases/blob/master/index.js).) - * Type: `string` -* `[precision]`: How many decimal places you want to show? - * Default: `2` - * Type: `number` -* `[speed]`: How fast do you want to finish the animation? - * Default:`500` (ms) - * Type: `number` -* `[trail]`: Do you want trailing zeroes? - * Default: `false` - * Type: `boolean` -* `[useLocaleString]`: Use number formatting based on locale? - * Default: `false` - * Type: `boolean` -* `[value]`: The value that you want to display at the end of the animation. - * `Required` - * Type: `number` - -# Build - -If you want to build this from source, you will need babel and less. - -```js +- `[ease]`: The easing equation for the animation. + - Default: `quintInOut` (You can choose from [mattdesl/eases](https://github.com/mattdesl/eases/blob/master/index.js).) + - Type: `string` +- `[precision]`: How many decimal places you want to show? + - Default: `2` + - Type: `number` +- `[speed]`: How fast do you want to finish the animation? + - Default:`500` (ms) + - Type: `number` +- `[trail]`: Do you want trailing zeroes? + - Default: `false` + - Type: `boolean` +- `[useLocaleString]`: Use number formatting based on locale? + - Default: `false` + - Type: `boolean` +- `[value]`: The value that you want to display at the end of the animation. + - `Required` + - Type: `number` + +## Requirements + +- React 18 or newer + +## Build + +To build from source: + +```sh npm install +npm run build ``` -And run the pre publish script +## Test -```js -npm run prepare +To run tests: + +```sh +npm test ``` + [![HitCount](http://hits.dwyl.com/{username}/che-wf/react-number-easing.svg)](http://hits.dwyl.com/{username}/che-wf/react-number-easing) + +## Project Structure + +- Main component: `src/components/NumberEasing.jsx` +- All components are exported from `src/index.jsx` + [![HitCount](http://hits.dwyl.com/{username}/che-wf/react-number-easing.svg)](http://hits.dwyl.com/{username}/che-wf/react-number-easing) diff --git a/che-react-number-easing-0.2.0.tgz b/che-react-number-easing-0.2.0.tgz new file mode 100644 index 0000000..1234b3f Binary files /dev/null and b/che-react-number-easing-0.2.0.tgz differ diff --git a/gh-pages/.babelrc b/gh-pages/.babelrc new file mode 100644 index 0000000..18151f1 --- /dev/null +++ b/gh-pages/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["@babel/preset-env", "@babel/preset-react"] +} \ No newline at end of file diff --git a/gh-pages/bin/update-demo.sh b/gh-pages/bin/update-demo.sh new file mode 100755 index 0000000..513b27c --- /dev/null +++ b/gh-pages/bin/update-demo.sh @@ -0,0 +1,23 @@ +#!/bin/zsh +# Update demo to use latest local library build + +set -e + +LIB_DIR="$(cd "$(dirname "$0")/../.." && pwd)" +LIB_NAME="che-react-number-easing" + +cd "$LIB_DIR" +echo "Building library..." +npm run build +echo "Packing library..." +TARBALL=$(npm pack | tail -n1) + +cd "$LIB_DIR/gh-pages" +echo "Cleaning demo node_modules..." +rm -rf node_modules package-lock.json +echo "Installing new library tarball..." +npm install "../$TARBALL" +npm install +echo "Building demo..." +npm run build +echo "Demo updated to latest library version!" diff --git a/gh-pages/dist/app.js b/gh-pages/dist/app.js index 511dc72..97c1fcd 100644 --- a/gh-pages/dist/app.js +++ b/gh-pages/dist/app.js @@ -1,41871 +1,35694 @@ -(function () { - function r(e, n, t) { - function o(i, f) { - if (!n[i]) { - if (!e[i]) { - var c = 'function' == typeof require && require; - if (!f && c) return c(i, !0); - if (u) return u(i, !0); - var a = new Error("Cannot find module '" + i + "'"); - throw ((a.code = 'MODULE_NOT_FOUND'), a); - } - var p = (n[i] = { exports: {} }); - e[i][0].call( - p.exports, - function (r) { - var n = e[i][1][r]; - return o(n || r); - }, - p, - p.exports, - r, - e, - n, - t - ); - } - return n[i].exports; +(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i -1 ? precision : 0) : value); + const timeoutRef = (0, _react.useRef)(null); + const delayTimeoutRef = (0, _react.useRef)(null); + const startAnimationTimeRef = (0, _react.useRef)(null); + (0, _react.useEffect)(() => { + // Only animate if value changes + if (parseFloat(value) === parseFloat(previousValue)) return; + setPreviousValue(displayValue); + if (!window.isNaN(parseInt(delayValue, 10))) { + delayTimeoutRef.current = setTimeout(() => { + startAnimationTimeRef.current = new Date().getTime(); + updateNumber(); + }, delayValue); + } else { + startAnimationTimeRef.current = new Date().getTime(); + updateNumber(); + } + return () => { + clearTimeout(timeoutRef.current); + clearTimeout(delayTimeoutRef.current); + }; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [value]); + const updateNumber = () => { + const now = new Date().getTime(); + const elapsedTime = Math.min(speed, now - startAnimationTimeRef.current); + const progress = _eases.default[ease](elapsedTime / speed); + const currentDisplayValue = Math.round(((value - previousValue) * progress + Number(previousValue)) * 10 ** precision) / 10 ** precision; + setDisplayValue(currentDisplayValue); + if (elapsedTime < speed) { + timeoutRef.current = setTimeout(updateNumber, 16); + } else { + setPreviousValue(value); } - for ( - var u = 'function' == typeof require && require, i = 0; - i < t.length; - i++ - ) - o(t[i]); - return o; + }; + let classes = "react-number-easing"; + if (className) { + classes += ` ${className}`; + } + const opts = {}; + if (useLocaleString && currency) { + opts.currency = currency; + opts.style = "currency"; } - return r; -})()( - { - 1: [ - function (require, module, exports) { - 'use strict'; - - var _typeof = - typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' - ? function (obj) { - return typeof obj; - } - : function (obj) { - return obj && - typeof Symbol === 'function' && - obj.constructor === Symbol && - obj !== Symbol.prototype - ? 'symbol' - : typeof obj; - }; - - Object.defineProperty(exports, '__esModule', { - value: true, - }); - - var _extends = - Object.assign || - function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - return target; - }; - var _createClass = (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); - } - } - return function (Constructor, protoProps, staticProps) { - if (protoProps) defineProperties(Constructor.prototype, protoProps); - if (staticProps) defineProperties(Constructor, staticProps); - return Constructor; - }; - })(); + // eslint-disable-next-line react/jsx-props-no-spreading + return /*#__PURE__*/_react.default.createElement("span", _extends({}, other, { + className: classes + }), useLocaleString ? parseFloat(displayValue).toLocaleString(locale, opts) : trail ? Number(displayValue).toFixed(precision > -1 ? precision : 0) : Number(displayValue).toString()); +} +NumberEasing.propTypes = { + currency: _propTypes.default.string, + delayValue: _propTypes.default.number, + ease: _propTypes.default.oneOf(Object.keys(_eases.default)), + locale: _propTypes.default.string, + precision: _propTypes.default.number, + speed: _propTypes.default.number, + trail: _propTypes.default.bool, + useLocaleString: _propTypes.default.bool, + value: _propTypes.default.any.isRequired +}; +var _default = exports.default = NumberEasing; +},{"eases":22,"prop-types":41,"react":53}],2:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "NumberEasing", { + enumerable: true, + get: function () { + return _NumberEasing.default; + } +}); +var _NumberEasing = _interopRequireDefault(require("./NumberEasing")); +function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } +},{"./NumberEasing":1}],3:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +var _components = require("./components"); +Object.keys(_components).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _components[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _components[key]; + } + }); +}); +},{"./components":2}],4:[function(require,module,exports){ +function backInOut(t) { + var s = 1.70158 * 1.525 + if ((t *= 2) < 1) + return 0.5 * (t * t * ((s + 1) * t - s)) + return 0.5 * ((t -= 2) * t * ((s + 1) * t + s) + 2) +} + +module.exports = backInOut +},{}],5:[function(require,module,exports){ +function backIn(t) { + var s = 1.70158 + return t * t * ((s + 1) * t - s) +} + +module.exports = backIn +},{}],6:[function(require,module,exports){ +function backOut(t) { + var s = 1.70158 + return --t * t * ((s + 1) * t + s) + 1 +} + +module.exports = backOut +},{}],7:[function(require,module,exports){ +var bounceOut = require('./bounce-out') + +function bounceInOut(t) { + return t < 0.5 + ? 0.5 * (1.0 - bounceOut(1.0 - t * 2.0)) + : 0.5 * bounceOut(t * 2.0 - 1.0) + 0.5 +} + +module.exports = bounceInOut +},{"./bounce-out":9}],8:[function(require,module,exports){ +var bounceOut = require('./bounce-out') + +function bounceIn(t) { + return 1.0 - bounceOut(1.0 - t) +} + +module.exports = bounceIn +},{"./bounce-out":9}],9:[function(require,module,exports){ +function bounceOut(t) { + var a = 4.0 / 11.0 + var b = 8.0 / 11.0 + var c = 9.0 / 10.0 + + var ca = 4356.0 / 361.0 + var cb = 35442.0 / 1805.0 + var cc = 16061.0 / 1805.0 + + var t2 = t * t + + return t < a + ? 7.5625 * t2 + : t < b + ? 9.075 * t2 - 9.9 * t + 3.4 + : t < c + ? ca * t2 - cb * t + cc + : 10.8 * t * t - 20.52 * t + 10.72 +} + +module.exports = bounceOut +},{}],10:[function(require,module,exports){ +function circInOut(t) { + if ((t *= 2) < 1) return -0.5 * (Math.sqrt(1 - t * t) - 1) + return 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1) +} + +module.exports = circInOut +},{}],11:[function(require,module,exports){ +function circIn(t) { + return 1.0 - Math.sqrt(1.0 - t * t) +} + +module.exports = circIn +},{}],12:[function(require,module,exports){ +function circOut(t) { + return Math.sqrt(1 - ( --t * t )) +} + +module.exports = circOut +},{}],13:[function(require,module,exports){ +function cubicInOut(t) { + return t < 0.5 + ? 4.0 * t * t * t + : 0.5 * Math.pow(2.0 * t - 2.0, 3.0) + 1.0 +} + +module.exports = cubicInOut +},{}],14:[function(require,module,exports){ +function cubicIn(t) { + return t * t * t +} + +module.exports = cubicIn +},{}],15:[function(require,module,exports){ +function cubicOut(t) { + var f = t - 1.0 + return f * f * f + 1.0 +} + +module.exports = cubicOut +},{}],16:[function(require,module,exports){ +function elasticInOut(t) { + return t < 0.5 + ? 0.5 * Math.sin(+13.0 * Math.PI/2 * 2.0 * t) * Math.pow(2.0, 10.0 * (2.0 * t - 1.0)) + : 0.5 * Math.sin(-13.0 * Math.PI/2 * ((2.0 * t - 1.0) + 1.0)) * Math.pow(2.0, -10.0 * (2.0 * t - 1.0)) + 1.0 +} + +module.exports = elasticInOut +},{}],17:[function(require,module,exports){ +function elasticIn(t) { + return Math.sin(13.0 * t * Math.PI/2) * Math.pow(2.0, 10.0 * (t - 1.0)) +} + +module.exports = elasticIn +},{}],18:[function(require,module,exports){ +function elasticOut(t) { + return Math.sin(-13.0 * (t + 1.0) * Math.PI/2) * Math.pow(2.0, -10.0 * t) + 1.0 +} + +module.exports = elasticOut +},{}],19:[function(require,module,exports){ +function expoInOut(t) { + return (t === 0.0 || t === 1.0) + ? t + : t < 0.5 + ? +0.5 * Math.pow(2.0, (20.0 * t) - 10.0) + : -0.5 * Math.pow(2.0, 10.0 - (t * 20.0)) + 1.0 +} + +module.exports = expoInOut +},{}],20:[function(require,module,exports){ +function expoIn(t) { + return t === 0.0 ? t : Math.pow(2.0, 10.0 * (t - 1.0)) +} + +module.exports = expoIn +},{}],21:[function(require,module,exports){ +function expoOut(t) { + return t === 1.0 ? t : 1.0 - Math.pow(2.0, -10.0 * t) +} + +module.exports = expoOut +},{}],22:[function(require,module,exports){ +module.exports = { + 'backInOut': require('./back-in-out'), + 'backIn': require('./back-in'), + 'backOut': require('./back-out'), + 'bounceInOut': require('./bounce-in-out'), + 'bounceIn': require('./bounce-in'), + 'bounceOut': require('./bounce-out'), + 'circInOut': require('./circ-in-out'), + 'circIn': require('./circ-in'), + 'circOut': require('./circ-out'), + 'cubicInOut': require('./cubic-in-out'), + 'cubicIn': require('./cubic-in'), + 'cubicOut': require('./cubic-out'), + 'elasticInOut': require('./elastic-in-out'), + 'elasticIn': require('./elastic-in'), + 'elasticOut': require('./elastic-out'), + 'expoInOut': require('./expo-in-out'), + 'expoIn': require('./expo-in'), + 'expoOut': require('./expo-out'), + 'linear': require('./linear'), + 'quadInOut': require('./quad-in-out'), + 'quadIn': require('./quad-in'), + 'quadOut': require('./quad-out'), + 'quartInOut': require('./quart-in-out'), + 'quartIn': require('./quart-in'), + 'quartOut': require('./quart-out'), + 'quintInOut': require('./quint-in-out'), + 'quintIn': require('./quint-in'), + 'quintOut': require('./quint-out'), + 'sineInOut': require('./sine-in-out'), + 'sineIn': require('./sine-in'), + 'sineOut': require('./sine-out') +} +},{"./back-in":5,"./back-in-out":4,"./back-out":6,"./bounce-in":8,"./bounce-in-out":7,"./bounce-out":9,"./circ-in":11,"./circ-in-out":10,"./circ-out":12,"./cubic-in":14,"./cubic-in-out":13,"./cubic-out":15,"./elastic-in":17,"./elastic-in-out":16,"./elastic-out":18,"./expo-in":20,"./expo-in-out":19,"./expo-out":21,"./linear":23,"./quad-in":25,"./quad-in-out":24,"./quad-out":26,"./quart-in":28,"./quart-in-out":27,"./quart-out":29,"./quint-in":31,"./quint-in-out":30,"./quint-out":32,"./sine-in":34,"./sine-in-out":33,"./sine-out":35}],23:[function(require,module,exports){ +function linear(t) { + return t +} + +module.exports = linear +},{}],24:[function(require,module,exports){ +function quadInOut(t) { + t /= 0.5 + if (t < 1) return 0.5*t*t + t-- + return -0.5 * (t*(t-2) - 1) +} + +module.exports = quadInOut +},{}],25:[function(require,module,exports){ +function quadIn(t) { + return t * t +} + +module.exports = quadIn +},{}],26:[function(require,module,exports){ +function quadOut(t) { + return -t * (t - 2.0) +} + +module.exports = quadOut +},{}],27:[function(require,module,exports){ +function quarticInOut(t) { + return t < 0.5 + ? +8.0 * Math.pow(t, 4.0) + : -8.0 * Math.pow(t - 1.0, 4.0) + 1.0 +} + +module.exports = quarticInOut +},{}],28:[function(require,module,exports){ +function quarticIn(t) { + return Math.pow(t, 4.0) +} + +module.exports = quarticIn +},{}],29:[function(require,module,exports){ +function quarticOut(t) { + return Math.pow(t - 1.0, 3.0) * (1.0 - t) + 1.0 +} + +module.exports = quarticOut +},{}],30:[function(require,module,exports){ +function qinticInOut(t) { + if ( ( t *= 2 ) < 1 ) return 0.5 * t * t * t * t * t + return 0.5 * ( ( t -= 2 ) * t * t * t * t + 2 ) +} + +module.exports = qinticInOut +},{}],31:[function(require,module,exports){ +function qinticIn(t) { + return t * t * t * t * t +} + +module.exports = qinticIn +},{}],32:[function(require,module,exports){ +function qinticOut(t) { + return --t * t * t * t * t + 1 +} + +module.exports = qinticOut +},{}],33:[function(require,module,exports){ +function sineInOut(t) { + return -0.5 * (Math.cos(Math.PI*t) - 1) +} + +module.exports = sineInOut +},{}],34:[function(require,module,exports){ +function sineIn (t) { + var v = Math.cos(t * Math.PI * 0.5) + if (Math.abs(v) < 1e-14) return 1 + else return 1 - v +} + +module.exports = sineIn + +},{}],35:[function(require,module,exports){ +function sineOut(t) { + return Math.sin(t * Math.PI/2) +} + +module.exports = sineOut +},{}],36:[function(require,module,exports){ +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ - var _eases = require('eases'); +'use strict'; +/* eslint-disable no-unused-vars */ +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var propIsEnumerable = Object.prototype.propertyIsEnumerable; + +function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); +} + +function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } +} + +module.exports = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; +}; + +},{}],37:[function(require,module,exports){ +// shim for using process in browser +var process = module.exports = {}; + +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } - var _eases2 = _interopRequireDefault(_eases); - var _propTypes = require('prop-types'); +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } - var _propTypes2 = _interopRequireDefault(_propTypes); - var _react = require('react'); - var _react2 = _interopRequireDefault(_react); +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; - function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { default: obj }; - } +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} - function _objectWithoutProperties(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; +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError('Cannot call a class as a function'); - } +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; } - - function _possibleConstructorReturn(self, call) { - if (!self) { - throw new ReferenceError( - "this hasn't been initialised - super() hasn't been called" - ); - } - return call && - ((typeof call === 'undefined' ? 'undefined' : _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 === 'undefined' - ? 'undefined' - : _typeof(superClass)) + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + +},{}],38:[function(require,module,exports){ +(function (process){(function (){ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +var printWarning = function() {}; + +if (process.env.NODE_ENV !== 'production') { + var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); + var loggedTypeFailures = {}; + var has = require('./lib/has'); + + printWarning = function(text) { + var message = 'Warning: ' + text; + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) { /**/ } + }; +} + +/** + * Assert that the values match with the type specs. + * Error messages are memorized and will only be shown once. + * + * @param {object} typeSpecs Map of name to a ReactPropType + * @param {object} values Runtime values that need to be type-checked + * @param {string} location e.g. "prop", "context", "child context" + * @param {string} componentName Name of the component for error messages. + * @param {?Function} getStack Returns the component stack. + * @private + */ +function checkPropTypes(typeSpecs, values, location, componentName, getStack) { + if (process.env.NODE_ENV !== 'production') { + for (var typeSpecName in typeSpecs) { + if (has(typeSpecs, typeSpecName)) { + var error; + // Prop type validation may throw. In case they do, we don't want to + // fail the render phase where it didn't fail before. So we log it. + // After these have been cleaned up, we'll let them throw. + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + if (typeof typeSpecs[typeSpecName] !== 'function') { + var err = Error( + (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.' ); + err.name = 'Invariant Violation'; + throw err; } - subClass.prototype = Object.create( - superClass && superClass.prototype, - { - constructor: { - value: subClass, - enumerable: false, - writable: true, - configurable: true, - }, - } + error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); + } catch (ex) { + error = ex; + } + if (error && !(error instanceof Error)) { + printWarning( + (componentName || 'React class') + ': type specification of ' + + location + ' `' + typeSpecName + '` is invalid; the type checker ' + + 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + + 'You may have forgotten to pass an argument to the type checker ' + + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + + 'shape all require an argument).' ); - if (superClass) - Object.setPrototypeOf - ? Object.setPrototypeOf(subClass, superClass) - : (subClass.__proto__ = superClass); - } /* - From - https://github.com/javierbyte/react-number-easing - Refactored to use React class. - */ - - var NumberEasing = (function (_React$Component) { - _inherits(NumberEasing, _React$Component); - - function NumberEasing(props) { - _classCallCheck(this, NumberEasing); - - var _this = _possibleConstructorReturn( - this, - ( - NumberEasing.__proto__ || Object.getPrototypeOf(NumberEasing) - ).call(this, props) - ); - - _initialiseProps.call(_this); - - var _this$props = _this.props, - value = _this$props.value, - precision = _this$props.precision, - trail = _this$props.trail; - - _this.timeout = null; - _this.startAnimationTime = null; - _this.state = { - displayValue: value, - // eslint-disable-next-line no-restricted-globals - previousValue: - trail && !isNaN(parseFloat(value)) - ? parseFloat(value).toFixed(precision > -1 ? precision : 0) - : value, - }; - return _this; - } + } + if (error instanceof Error && !(error.message in loggedTypeFailures)) { + // Only monitor this failure once because there tends to be a lot of the + // same error. + loggedTypeFailures[error.message] = true; - _createClass(NumberEasing, [ - { - key: 'componentWillReceiveProps', - value: function componentWillReceiveProps(nextProps) { - var _this2 = this; + var stack = getStack ? getStack() : ''; - var value = this.props.value; + printWarning( + 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '') + ); + } + } + } + } +} + +/** + * Resets warning cache when testing. + * + * @private + */ +checkPropTypes.resetWarningCache = function() { + if (process.env.NODE_ENV !== 'production') { + loggedTypeFailures = {}; + } +} - if (parseFloat(nextProps.value) === value) { - return; - } +module.exports = checkPropTypes; - this.setState({ - previousValue: this.state.displayValue, - }); +}).call(this)}).call(this,require('_process')) - if (!window.isNaN(parseInt(this.props.delayValue, 10))) { - this.delayTimeout = setTimeout(function () { - _this2.startAnimationTime = new Date().getTime(); - _this2.updateNumber(); - }, this.props.delayValue); - } else { - this.startAnimationTime = new Date().getTime(); - this.updateNumber(); - } - }, - }, - { - key: 'shouldComponentUpdate', - value: function shouldComponentUpdate(nextProps, nextState) { - return nextState.displayValue !== this.state.displayValue; - }, - }, - { - key: 'componentWillUnmount', - value: function componentWillUnmount() { - clearTimeout(this.timeout); - clearTimeout(this.delayTimeout); - }, - }, - { - key: 'render', - value: function render() { - var _props = this.props, - className = _props.className, - currency = _props.currency, - delayValue = _props.delayValue, - ease = _props.ease, - locale = _props.locale, - precision = _props.precision, - speed = _props.speed, - trail = _props.trail, - useLocaleString = _props.useLocaleString, - value = _props.value, - other = _objectWithoutProperties(_props, [ - 'className', - 'currency', - 'delayValue', - 'ease', - 'locale', - 'precision', - 'speed', - 'trail', - 'useLocaleString', - 'value', - ]); - - var displayValue = this.state.displayValue; - - var classes = 'react-number-easing'; - if (className) { - classes += ' ' + className; - } +},{"./lib/ReactPropTypesSecret":42,"./lib/has":43,"_process":37}],39:[function(require,module,exports){ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ - var opts = {}; - if (useLocaleString && currency) { - opts.currency = currency; - opts.style = 'currency'; - } +'use strict'; - return _react2.default.createElement( - 'span', - _extends({}, other, { className: classes }), - useLocaleString - ? parseFloat(displayValue).toLocaleString(locale, opts) - : trail - ? parseFloat(displayValue).toFixed( - precision > -1 ? precision : 0 - ) - : displayValue - ); - }, - }, - ]); - - return NumberEasing; - })(_react2.default.Component); - - var _initialiseProps = function _initialiseProps() { - var _this3 = this; - - this.updateNumber = function () { - var _props2 = _this3.props, - value = _props2.value, - precision = _props2.precision; - - var now = new Date().getTime(); - var elapsedTime = Math.min( - _this3.props.speed, - now - _this3.startAnimationTime - ); - var progress = _eases2.default[_this3.props.ease]( - elapsedTime / _this3.props.speed - ); +var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); - var currentDisplayValue = - Math.round( - ((value - _this3.state.previousValue) * progress + - _this3.state.previousValue) * - Math.pow(10, precision) - ) / Math.pow(10, precision); +function emptyFunction() {} +function emptyFunctionWithReset() {} +emptyFunctionWithReset.resetWarningCache = emptyFunction; - _this3.setState({ - displayValue: currentDisplayValue, - }); +module.exports = function() { + function shim(props, propName, componentName, location, propFullName, secret) { + if (secret === ReactPropTypesSecret) { + // It is still safe when called from React. + return; + } + var err = new Error( + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use PropTypes.checkPropTypes() to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + err.name = 'Invariant Violation'; + throw err; + }; + shim.isRequired = shim; + function getShim() { + return shim; + }; + // Important! + // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. + var ReactPropTypes = { + array: shim, + bigint: shim, + bool: shim, + func: shim, + number: shim, + object: shim, + string: shim, + symbol: shim, + + any: shim, + arrayOf: getShim, + element: shim, + elementType: shim, + instanceOf: getShim, + node: shim, + objectOf: getShim, + oneOf: getShim, + oneOfType: getShim, + shape: getShim, + exact: getShim, + + checkPropTypes: emptyFunctionWithReset, + resetWarningCache: emptyFunction + }; + + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; +}; + +},{"./lib/ReactPropTypesSecret":42}],40:[function(require,module,exports){ +(function (process){(function (){ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +var ReactIs = require('react-is'); +var assign = require('object-assign'); + +var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); +var has = require('./lib/has'); +var checkPropTypes = require('./checkPropTypes'); + +var printWarning = function() {}; + +if (process.env.NODE_ENV !== 'production') { + printWarning = function(text) { + var message = 'Warning: ' + text; + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; +} + +function emptyFunctionThatReturnsNull() { + return null; +} + +module.exports = function(isValidElement, throwOnDirectAccess) { + /* global Symbol */ + var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; + var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. + + /** + * Returns the iterator method function contained on the iterable object. + * + * Be sure to invoke the function with the iterable as context: + * + * var iteratorFn = getIteratorFn(myIterable); + * if (iteratorFn) { + * var iterator = iteratorFn.call(myIterable); + * ... + * } + * + * @param {?object} maybeIterable + * @return {?function} + */ + function getIteratorFn(maybeIterable) { + var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); + if (typeof iteratorFn === 'function') { + return iteratorFn; + } + } - if (elapsedTime < _this3.props.speed) { - _this3.timeout = setTimeout(_this3.updateNumber, 16); - } else { - _this3.setState({ - previousValue: value, - }); - } - }; - }; + /** + * Collection of methods that allow declaration and validation of props that are + * supplied to React components. Example usage: + * + * var Props = require('ReactPropTypes'); + * var MyArticle = React.createClass({ + * propTypes: { + * // An optional string prop named "description". + * description: Props.string, + * + * // A required enum prop named "category". + * category: Props.oneOf(['News','Photos']).isRequired, + * + * // A prop named "dialog" that requires an instance of Dialog. + * dialog: Props.instanceOf(Dialog).isRequired + * }, + * render: function() { ... } + * }); + * + * A more formal specification of how these methods are used: + * + * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) + * decl := ReactPropTypes.{type}(.isRequired)? + * + * Each and every declaration produces a function with the same signature. This + * allows the creation of custom validation functions. For example: + * + * var MyLink = React.createClass({ + * propTypes: { + * // An optional string or URI prop named "href". + * href: function(props, propName, componentName) { + * var propValue = props[propName]; + * if (propValue != null && typeof propValue !== 'string' && + * !(propValue instanceof URI)) { + * return new Error( + * 'Expected a string or an URI for ' + propName + ' in ' + + * componentName + * ); + * } + * } + * }, + * render: function() {...} + * }); + * + * @internal + */ + + var ANONYMOUS = '<>'; + + // Important! + // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. + var ReactPropTypes = { + array: createPrimitiveTypeChecker('array'), + bigint: createPrimitiveTypeChecker('bigint'), + bool: createPrimitiveTypeChecker('boolean'), + func: createPrimitiveTypeChecker('function'), + number: createPrimitiveTypeChecker('number'), + object: createPrimitiveTypeChecker('object'), + string: createPrimitiveTypeChecker('string'), + symbol: createPrimitiveTypeChecker('symbol'), + + any: createAnyTypeChecker(), + arrayOf: createArrayOfTypeChecker, + element: createElementTypeChecker(), + elementType: createElementTypeTypeChecker(), + instanceOf: createInstanceTypeChecker, + node: createNodeChecker(), + objectOf: createObjectOfTypeChecker, + oneOf: createEnumTypeChecker, + oneOfType: createUnionTypeChecker, + shape: createShapeTypeChecker, + exact: createStrictShapeTypeChecker, + }; + + /** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ + /*eslint-disable no-self-compare*/ + function is(x, y) { + // SameValue algorithm + if (x === y) { + // Steps 1-5, 7-10 + // Steps 6.b-6.e: +0 != -0 + return x !== 0 || 1 / x === 1 / y; + } else { + // Step 6.a: NaN == NaN + return x !== x && y !== y; + } + } + /*eslint-enable no-self-compare*/ + + /** + * We use an Error-like object for backward compatibility as people may call + * PropTypes directly and inspect their output. However, we don't use real + * Errors anymore. We don't inspect their stack anyway, and creating them + * is prohibitively expensive if they are created too often, such as what + * happens in oneOfType() for any type before the one that matched. + */ + function PropTypeError(message, data) { + this.message = message; + this.data = data && typeof data === 'object' ? data: {}; + this.stack = ''; + } + // Make `instanceof Error` still work for returned errors. + PropTypeError.prototype = Error.prototype; - NumberEasing.propTypes = { - currency: _propTypes2.default.string, - delayValue: _propTypes2.default.number, - ease: _propTypes2.default.oneOf(Object.keys(_eases2.default)), - locale: _propTypes2.default.string, - precision: _propTypes2.default.number, - speed: _propTypes2.default.number, - trail: _propTypes2.default.bool, - useLocaleString: _propTypes2.default.bool, - value: _propTypes2.default.any.isRequired, - }; + function createChainableTypeChecker(validate) { + if (process.env.NODE_ENV !== 'production') { + var manualPropTypeCallCache = {}; + var manualPropTypeWarningCount = 0; + } + function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { + componentName = componentName || ANONYMOUS; + propFullName = propFullName || propName; + + if (secret !== ReactPropTypesSecret) { + if (throwOnDirectAccess) { + // New behavior only for users of `prop-types` package + var err = new Error( + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use `PropTypes.checkPropTypes()` to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + err.name = 'Invariant Violation'; + throw err; + } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') { + // Old behavior for people using React.PropTypes + var cacheKey = componentName + ':' + propName; + if ( + !manualPropTypeCallCache[cacheKey] && + // Avoid spamming the console because they are often not actionable except for lib authors + manualPropTypeWarningCount < 3 + ) { + printWarning( + 'You are manually calling a React.PropTypes validation ' + + 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + + 'and will throw in the standalone `prop-types` package. ' + + 'You may be seeing this warning due to a third-party PropTypes ' + + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.' + ); + manualPropTypeCallCache[cacheKey] = true; + manualPropTypeWarningCount++; + } + } + } + if (props[propName] == null) { + if (isRequired) { + if (props[propName] === null) { + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); + } + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); + } + return null; + } else { + return validate(props, propName, componentName, location, propFullName); + } + } - NumberEasing.defaultProps = { - currency: '', - delayValue: 50, - ease: 'quintInOut', - locale: 'en-US', - precision: 2, - speed: 500, - trail: false, - useLocaleString: true, - }; + var chainedCheckType = checkType.bind(null, false); + chainedCheckType.isRequired = checkType.bind(null, true); - exports.default = NumberEasing; - }, - { eases: 37, 'prop-types': 55, react: 59 }, - ], - 2: [ - function (require, module, exports) { - /* -object-assign -(c) Sindre Sorhus -@license MIT -*/ + return chainedCheckType; + } - 'use strict'; - /* eslint-disable no-unused-vars */ - var getOwnPropertySymbols = Object.getOwnPropertySymbols; - var hasOwnProperty = Object.prototype.hasOwnProperty; - var propIsEnumerable = Object.prototype.propertyIsEnumerable; + function createPrimitiveTypeChecker(expectedType) { + function validate(props, propName, componentName, location, propFullName, secret) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== expectedType) { + // `propValue` being instance of, say, date/regexp, pass the 'object' + // check, but we can offer a more precise error message here rather than + // 'of type `object`'. + var preciseType = getPreciseType(propValue); + + return new PropTypeError( + 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'), + {expectedType: expectedType} + ); + } + return null; + } + return createChainableTypeChecker(validate); + } - function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError( - 'Object.assign cannot be called with null or undefined' - ); - } + function createAnyTypeChecker() { + return createChainableTypeChecker(emptyFunctionThatReturnsNull); + } - return Object(val); + function createArrayOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); + } + var propValue = props[propName]; + if (!Array.isArray(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); + } + for (var i = 0; i < propValue.length; i++) { + var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); + if (error instanceof Error) { + return error; } + } + return null; + } + return createChainableTypeChecker(validate); + } - function shouldUseNative() { - try { - if (!Object.assign) { - return false; - } - - // Detect buggy property enumeration order in older V8 versions. + function createElementTypeChecker() { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + if (!isValidElement(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); + } + return null; + } + return createChainableTypeChecker(validate); + } - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 - var test1 = new String('abc'); // eslint-disable-line no-new-wrappers - test1[5] = 'de'; - if (Object.getOwnPropertyNames(test1)[0] === '5') { - return false; - } + function createElementTypeTypeChecker() { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + if (!ReactIs.isValidElementType(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.')); + } + return null; + } + return createChainableTypeChecker(validate); + } - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test2 = {}; - for (var i = 0; i < 10; i++) { - test2['_' + String.fromCharCode(i)] = i; - } - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { - return test2[n]; - }); - if (order2.join('') !== '0123456789') { - return false; - } + function createInstanceTypeChecker(expectedClass) { + function validate(props, propName, componentName, location, propFullName) { + if (!(props[propName] instanceof expectedClass)) { + var expectedClassName = expectedClass.name || ANONYMOUS; + var actualClassName = getClassName(props[propName]); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); + } - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test3 = {}; - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { - test3[letter] = letter; - }); - if ( - Object.keys(Object.assign({}, test3)).join('') !== - 'abcdefghijklmnopqrst' - ) { - return false; - } + function createEnumTypeChecker(expectedValues) { + if (!Array.isArray(expectedValues)) { + if (process.env.NODE_ENV !== 'production') { + if (arguments.length > 1) { + printWarning( + 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' + + 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).' + ); + } else { + printWarning('Invalid argument supplied to oneOf, expected an array.'); + } + } + return emptyFunctionThatReturnsNull; + } - return true; - } catch (err) { - // We don't expect any of the above to throw, but better to be safe. - return false; - } + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + for (var i = 0; i < expectedValues.length; i++) { + if (is(propValue, expectedValues[i])) { + return null; } + } - module.exports = shouldUseNative() - ? Object.assign - : function (target, source) { - var from; - var to = toObject(target); - var symbols; + var valuesString = JSON.stringify(expectedValues, function replacer(key, value) { + var type = getPreciseType(value); + if (type === 'symbol') { + return String(value); + } + return value; + }); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); + } + return createChainableTypeChecker(validate); + } - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); + function createObjectOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); + } + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); + } + for (var key in propValue) { + if (has(propValue, key)) { + var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + } + return null; + } + return createChainableTypeChecker(validate); + } - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } + function createUnionTypeChecker(arrayOfTypeCheckers) { + if (!Array.isArray(arrayOfTypeCheckers)) { + process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; + return emptyFunctionThatReturnsNull; + } - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (typeof checker !== 'function') { + printWarning( + 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + + 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.' + ); + return emptyFunctionThatReturnsNull; + } + } - return to; - }; - }, - {}, - ], - 3: [ - function (require, module, exports) { - // shim for using process in browser - var process = (module.exports = {}); + function validate(props, propName, componentName, location, propFullName) { + var expectedTypes = []; + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret); + if (checkerResult == null) { + return null; + } + if (checkerResult.data && has(checkerResult.data, 'expectedType')) { + expectedTypes.push(checkerResult.data.expectedType); + } + } + var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': ''; + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.')); + } + return createChainableTypeChecker(validate); + } - // cached from whatever global is present so that test runners that stub it - // don't break things. But we need to wrap it in a try catch in case it is - // wrapped in strict mode code which doesn't define any globals. It's inside a - // function because try/catches deoptimize in certain engines. + function createNodeChecker() { + function validate(props, propName, componentName, location, propFullName) { + if (!isNode(props[propName])) { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); + } + return null; + } + return createChainableTypeChecker(validate); + } - var cachedSetTimeout; - var cachedClearTimeout; + function invalidValidatorError(componentName, location, propFullName, key, type) { + return new PropTypeError( + (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' + + 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.' + ); + } - function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); + function createShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + for (var key in shapeTypes) { + var checker = shapeTypes[key]; + if (typeof checker !== 'function') { + return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); } - function defaultClearTimeout() { - throw new Error('clearTimeout has not been defined'); + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; } - (function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } - })(); - function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ( - (cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && - setTimeout - ) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch (e) { - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch (e) { - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createStrictShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + // We need to check all keys in case some are required but missing from props. + var allKeys = assign({}, props[propName], shapeTypes); + for (var key in allKeys) { + var checker = shapeTypes[key]; + if (has(shapeTypes, key) && typeof checker !== 'function') { + return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); + } + if (!checker) { + return new PropTypeError( + 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') + ); } - function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ( - (cachedClearTimeout === defaultClearTimeout || - !cachedClearTimeout) && - clearTimeout - ) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e) { - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e) { - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; } - var queue = []; - var draining = false; - var currentQueue; - var queueIndex = -1; + } + return null; + } - function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } - } + return createChainableTypeChecker(validate); + } - function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while (len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); + function isNode(propValue) { + switch (typeof propValue) { + case 'number': + case 'string': + case 'undefined': + return true; + case 'boolean': + return !propValue; + case 'object': + if (Array.isArray(propValue)) { + return propValue.every(isNode); + } + if (propValue === null || isValidElement(propValue)) { + return true; + } + + var iteratorFn = getIteratorFn(propValue); + if (iteratorFn) { + var iterator = iteratorFn.call(propValue); + var step; + if (iteratorFn !== propValue.entries) { + while (!(step = iterator.next()).done) { + if (!isNode(step.value)) { + return false; } } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); - } - - process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; + } else { + // Iterator will provide entry [k,v] tuples rather than values. + while (!(step = iterator.next()).done) { + var entry = step.value; + if (entry) { + if (!isNode(entry[1])) { + return false; + } + } } } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } - }; - - // v8 likes predictible objects - function Item(fun, array) { - this.fun = fun; - this.array = array; + } else { + return false; } - Item.prototype.run = function () { - this.fun.apply(null, this.array); - }; - process.title = 'browser'; - process.browser = true; - process.env = {}; - process.argv = []; - process.version = ''; // empty string to avoid regexp issues - process.versions = {}; - - function noop() {} - - process.on = noop; - process.addListener = noop; - process.once = noop; - process.off = noop; - process.removeListener = noop; - process.removeAllListeners = noop; - process.emit = noop; - process.prependListener = noop; - process.prependOnceListener = noop; - - process.listeners = function (name) { - return []; - }; - process.binding = function (name) { - throw new Error('process.binding is not supported'); - }; + return true; + default: + return false; + } + } - process.cwd = function () { - return '/'; - }; - process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); - }; - process.umask = function () { - return 0; - }; - }, - {}, - ], - 4: [ - function (require, module, exports) { - (function (process) { - /** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ + function isSymbol(propType, propValue) { + // Native Symbol. + if (propType === 'symbol') { + return true; + } - 'use strict'; + // falsy value can't be a Symbol + if (!propValue) { + return false; + } - var printWarning = function () {}; + // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' + if (propValue['@@toStringTag'] === 'Symbol') { + return true; + } - if (process.env.NODE_ENV !== 'production') { - var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); - var loggedTypeFailures = {}; + // Fallback for non-spec compliant Symbols which are polyfilled. + if (typeof Symbol === 'function' && propValue instanceof Symbol) { + return true; + } - printWarning = function (text) { - var message = 'Warning: ' + text; - if (typeof console !== 'undefined') { - console.error(message); - } - try { - // --- Welcome to debugging React --- - // This error was thrown as a convenience so that you can use this stack - // to find the callsite that caused this warning to fire. - throw new Error(message); - } catch (x) {} - }; - } + return false; + } - /** - * Assert that the values match with the type specs. - * Error messages are memorized and will only be shown once. - * - * @param {object} typeSpecs Map of name to a ReactPropType - * @param {object} values Runtime values that need to be type-checked - * @param {string} location e.g. "prop", "context", "child context" - * @param {string} componentName Name of the component for error messages. - * @param {?Function} getStack Returns the component stack. - * @private - */ - function checkPropTypes( - typeSpecs, - values, - location, - componentName, - getStack - ) { - if (process.env.NODE_ENV !== 'production') { - for (var typeSpecName in typeSpecs) { - if (typeSpecs.hasOwnProperty(typeSpecName)) { - var error; - // Prop type validation may throw. In case they do, we don't want to - // fail the render phase where it didn't fail before. So we log it. - // After these have been cleaned up, we'll let them throw. - try { - // This is intentionally an invariant that gets caught. It's the same - // behavior as without this statement except with a better message. - if (typeof typeSpecs[typeSpecName] !== 'function') { - var err = Error( - (componentName || 'React class') + - ': ' + - location + - ' type `' + - typeSpecName + - '` is invalid; ' + - 'it must be a function, usually from the `prop-types` package, but received `' + - typeof typeSpecs[typeSpecName] + - '`.' - ); - err.name = 'Invariant Violation'; - throw err; - } - error = typeSpecs[typeSpecName]( - values, - typeSpecName, - componentName, - location, - null, - ReactPropTypesSecret - ); - } catch (ex) { - error = ex; - } - if (error && !(error instanceof Error)) { - printWarning( - (componentName || 'React class') + - ': type specification of ' + - location + - ' `' + - typeSpecName + - '` is invalid; the type checker ' + - 'function must return `null` or an `Error` but returned a ' + - typeof error + - '. ' + - 'You may have forgotten to pass an argument to the type checker ' + - 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + - 'shape all require an argument).' - ); - } - if ( - error instanceof Error && - !(error.message in loggedTypeFailures) - ) { - // Only monitor this failure once because there tends to be a lot of the - // same error. - loggedTypeFailures[error.message] = true; - - var stack = getStack ? getStack() : ''; - - printWarning( - 'Failed ' + - location + - ' type: ' + - error.message + - (stack != null ? stack : '') - ); - } - } - } - } - } + // Equivalent of `typeof` but with special handling for array and regexp. + function getPropType(propValue) { + var propType = typeof propValue; + if (Array.isArray(propValue)) { + return 'array'; + } + if (propValue instanceof RegExp) { + // Old webkits (at least until Android 4.0) return 'function' rather than + // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ + // passes PropTypes.object. + return 'object'; + } + if (isSymbol(propType, propValue)) { + return 'symbol'; + } + return propType; + } - module.exports = checkPropTypes; - }.call(this, require('_process'))); - }, - { './lib/ReactPropTypesSecret': 5, _process: 3 }, - ], - 5: [ - function (require, module, exports) { - /** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - 'use strict'; - - var ReactPropTypesSecret = - 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; - - module.exports = ReactPropTypesSecret; - }, - {}, - ], - 6: [ - function (require, module, exports) { - (function (process) { - /** @license React v16.6.1 - * react-dom.development.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ + // This handles more types than `getPropType`. Only used for error messages. + // See `createPrimitiveTypeChecker`. + function getPreciseType(propValue) { + if (typeof propValue === 'undefined' || propValue === null) { + return '' + propValue; + } + var propType = getPropType(propValue); + if (propType === 'object') { + if (propValue instanceof Date) { + return 'date'; + } else if (propValue instanceof RegExp) { + return 'regexp'; + } + } + return propType; + } - 'use strict'; + // Returns a string that is postfixed to a warning about an invalid type. + // For example, "undefined" or "of type array" + function getPostfixForTypeWarning(value) { + var type = getPreciseType(value); + switch (type) { + case 'array': + case 'object': + return 'an ' + type; + case 'boolean': + case 'date': + case 'regexp': + return 'a ' + type; + default: + return type; + } + } - if (process.env.NODE_ENV !== 'production') { - (function () { - 'use strict'; - - var React = require('react'); - var _assign = require('object-assign'); - var checkPropTypes = require('prop-types/checkPropTypes'); - var scheduler = require('scheduler'); - var tracing = require('scheduler/tracing'); - - /** - * Use invariant() to assert state which your program assumes to be true. - * - * Provide sprintf-style format (only %s is supported) and arguments - * to provide information about what broke and what you were - * expecting. - * - * The invariant message will be stripped in production, but the invariant - * will remain to ensure logic does not differ in production. - */ - - var validateFormat = function () {}; + // Returns class name of the object, if any. + function getClassName(propValue) { + if (!propValue.constructor || !propValue.constructor.name) { + return ANONYMOUS; + } + return propValue.constructor.name; + } - { - validateFormat = function (format) { - if (format === undefined) { - throw new Error( - 'invariant requires an error message argument' - ); - } - }; - } + ReactPropTypes.checkPropTypes = checkPropTypes; + ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache; + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; +}; + +}).call(this)}).call(this,require('_process')) + +},{"./checkPropTypes":38,"./lib/ReactPropTypesSecret":42,"./lib/has":43,"_process":37,"object-assign":36,"react-is":50}],41:[function(require,module,exports){ +(function (process){(function (){ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +if (process.env.NODE_ENV !== 'production') { + var ReactIs = require('react-is'); + + // By explicitly using `prop-types` you are opting into new development behavior. + // http://fb.me/prop-types-in-prod + var throwOnDirectAccess = true; + module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess); +} else { + // By explicitly using `prop-types` you are opting into new production behavior. + // http://fb.me/prop-types-in-prod + module.exports = require('./factoryWithThrowingShims')(); +} + +}).call(this)}).call(this,require('_process')) + +},{"./factoryWithThrowingShims":39,"./factoryWithTypeCheckers":40,"_process":37,"react-is":50}],42:[function(require,module,exports){ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + +module.exports = ReactPropTypesSecret; + +},{}],43:[function(require,module,exports){ +module.exports = Function.call.bind(Object.prototype.hasOwnProperty); + +},{}],44:[function(require,module,exports){ +(function (process){(function (){ +/** + * @license React + * react-dom.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +if (process.env.NODE_ENV !== "production") { + (function() { - function invariant(condition, format, a, b, c, d, e, f) { - validateFormat(format); - - if (!condition) { - var error = void 0; - if (format === undefined) { - error = new Error( - 'Minified exception occurred; use the non-minified dev environment ' + - 'for the full error message and additional helpful warnings.' - ); - } else { - var args = [a, b, c, d, e, f]; - var argIndex = 0; - error = new Error( - format.replace(/%s/g, function () { - return args[argIndex++]; - }) - ); - error.name = 'Invariant Violation'; - } + 'use strict'; - error.framesToPop = 1; // we don't care about invariant's own frame - throw error; - } - } +/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ +if ( + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === + 'function' +) { + __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); +} + var React = require('react'); +var Scheduler = require('scheduler'); + +var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + +var suppressWarning = false; +function setSuppressWarning(newSuppressWarning) { + { + suppressWarning = newSuppressWarning; + } +} // In DEV, calls to console.warn and console.error get replaced +// by calls to these methods by a Babel plugin. +// +// In PROD (or in packages without access to React internals), +// they are left as they are instead. - // Relying on the `invariant()` implementation lets us - // preserve the format and params in the www builds. - - !React - ? invariant( - false, - 'ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM.' - ) - : void 0; - - var invokeGuardedCallbackImpl = function ( - name, - func, - context, - a, - b, - c, - d, - e, - f - ) { - var funcArgs = Array.prototype.slice.call(arguments, 3); - try { - func.apply(context, funcArgs); - } catch (error) { - this.onError(error); - } - }; +function warn(format) { + { + if (!suppressWarning) { + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } - { - // In DEV mode, we swap out invokeGuardedCallback for a special version - // that plays more nicely with the browser's DevTools. The idea is to preserve - // "Pause on exceptions" behavior. Because React wraps all user-provided - // functions in invokeGuardedCallback, and the production version of - // invokeGuardedCallback uses a try-catch, all user exceptions are treated - // like caught exceptions, and the DevTools won't pause unless the developer - // takes the extra step of enabling pause on caught exceptions. This is - // untintuitive, though, because even though React has caught the error, from - // the developer's perspective, the error is uncaught. - // - // To preserve the expected "Pause on exceptions" behavior, we don't use a - // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake - // DOM node, and call the user-provided callback from inside an event handler - // for that fake event. If the callback throws, the error is "captured" using - // a global event handler. But because the error happens in a different - // event loop context, it does not interrupt the normal program flow. - // Effectively, this gives us try-catch behavior without actually using - // try-catch. Neat! - - // Check that the browser supports the APIs we need to implement our special - // DEV version of invokeGuardedCallback - if ( - typeof window !== 'undefined' && - typeof window.dispatchEvent === 'function' && - typeof document !== 'undefined' && - typeof document.createEvent === 'function' - ) { - var fakeNode = document.createElement('react'); - - var invokeGuardedCallbackDev = function ( - name, - func, - context, - a, - b, - c, - d, - e, - f - ) { - // If document doesn't exist we know for sure we will crash in this method - // when we call document.createEvent(). However this can cause confusing - // errors: https://github.com/facebookincubator/create-react-app/issues/3482 - // So we preemptively throw with a better message instead. - !(typeof document !== 'undefined') - ? invariant( - false, - 'The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous.' - ) - : void 0; - var evt = document.createEvent('Event'); - - // Keeps track of whether the user-provided callback threw an error. We - // set this to true at the beginning, then set it to false right after - // calling the function. If the function errors, `didError` will never be - // set to false. This strategy works even if the browser is flaky and - // fails to call our global error handler, because it doesn't rely on - // the error event at all. - var didError = true; - - // Keeps track of the value of window.event so that we can reset it - // during the callback to let user code access window.event in the - // browsers that support it. - var windowEvent = window.event; - - // Keeps track of the descriptor of window.event to restore it after event - // dispatching: https://github.com/facebook/react/issues/13688 - var windowEventDescriptor = Object.getOwnPropertyDescriptor( - window, - 'event' - ); - - // Create an event handler for our fake event. We will synchronously - // dispatch our fake event using `dispatchEvent`. Inside the handler, we - // call the user-provided callback. - var funcArgs = Array.prototype.slice.call(arguments, 3); - function callCallback() { - // We immediately remove the callback from event listeners so that - // nested `invokeGuardedCallback` calls do not clash. Otherwise, a - // nested call would trigger the fake event handlers of any call higher - // in the stack. - fakeNode.removeEventListener( - evtType, - callCallback, - false - ); - - // We check for window.hasOwnProperty('event') to prevent the - // window.event assignment in both IE <= 10 as they throw an error - // "Member not found" in strict mode, and in Firefox which does not - // support window.event. - if ( - typeof window.event !== 'undefined' && - window.hasOwnProperty('event') - ) { - window.event = windowEvent; - } - - func.apply(context, funcArgs); - didError = false; - } + printWarning('warn', format, args); + } + } +} +function error(format) { + { + if (!suppressWarning) { + for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + args[_key2 - 1] = arguments[_key2]; + } - // Create a global error event handler. We use this to capture the value - // that was thrown. It's possible that this error handler will fire more - // than once; for example, if non-React code also calls `dispatchEvent` - // and a handler for that event throws. We should be resilient to most of - // those cases. Even if our error event handler fires more than once, the - // last error event is always used. If the callback actually does error, - // we know that the last error event is the correct one, because it's not - // possible for anything else to have happened in between our callback - // erroring and the code that follows the `dispatchEvent` call below. If - // the callback doesn't error, but the error event was fired, we know to - // ignore it because `didError` will be false, as described above. - var error = void 0; - // Use this to track whether the error event is ever called. - var didSetError = false; - var isCrossOriginError = false; - - function handleWindowError(event) { - error = event.error; - didSetError = true; - if ( - error === null && - event.colno === 0 && - event.lineno === 0 - ) { - isCrossOriginError = true; - } - if (event.defaultPrevented) { - // Some other error handler has prevented default. - // Browsers silence the error report if this happens. - // We'll remember this to later decide whether to log it or not. - if (error != null && typeof error === 'object') { - try { - error._suppressLogging = true; - } catch (inner) { - // Ignore. - } - } - } - } + printWarning('error', format, args); + } + } +} - // Create a fake event type. - var evtType = - 'react-' + (name ? name : 'invokeguardedcallback'); - - // Attach our event handlers - window.addEventListener('error', handleWindowError); - fakeNode.addEventListener(evtType, callCallback, false); - - // Synchronously dispatch our fake event. If the user-provided function - // errors, it will trigger our global error handler. - evt.initEvent(evtType, false, false); - fakeNode.dispatchEvent(evt); - - if (windowEventDescriptor) { - Object.defineProperty( - window, - 'event', - windowEventDescriptor - ); - } +function printWarning(level, format, args) { + // When changing this logic, you might want to also + // update consoleWithStackDev.www.js as well. + { + var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; + var stack = ReactDebugCurrentFrame.getStackAddendum(); - if (didError) { - if (!didSetError) { - // The callback errored, but the error event never fired. - error = new Error( - 'An error was thrown inside one of your components, but React ' + - "doesn't know what it was. This is likely due to browser " + - 'flakiness. React does its best to preserve the "Pause on ' + - 'exceptions" behavior of the DevTools, which requires some ' + - "DEV-mode only tricks. It's possible that these don't work in " + - 'your browser. Try triggering the error in production mode, ' + - 'or switching to a modern browser. If you suspect that this is ' + - 'actually an issue with React, please file an issue.' - ); - } else if (isCrossOriginError) { - error = new Error( - "A cross-origin error was thrown. React doesn't have access to " + - 'the actual error object in development. ' + - 'See https://fb.me/react-crossorigin-error for more information.' - ); - } - this.onError(error); - } + if (stack !== '') { + format += '%s'; + args = args.concat([stack]); + } // eslint-disable-next-line react-internal/safe-string-coercion - // Remove our event listeners - window.removeEventListener('error', handleWindowError); - }; - invokeGuardedCallbackImpl = invokeGuardedCallbackDev; - } - } + var argsWithFormat = args.map(function (item) { + return String(item); + }); // Careful: RN currently depends on this prefix - var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl; - - // Used by Fiber to simulate a try-catch. - var hasError = false; - var caughtError = null; - - // Used by event system to capture/rethrow the first error. - var hasRethrowError = false; - var rethrowError = null; - - var reporter = { - onError: function (error) { - hasError = true; - caughtError = error; - }, - }; - - /** - * Call a function while guarding against errors that happens within it. - * Returns an error if it throws, otherwise null. - * - * In production, this is implemented using a try-catch. The reason we don't - * use a try-catch directly is so that we can swap out a different - * implementation in DEV mode. - * - * @param {String} name of the guard to use for logging or debugging - * @param {Function} func The function to invoke - * @param {*} context The context to use when calling the function - * @param {...*} args Arguments for function - */ - function invokeGuardedCallback( - name, - func, - context, - a, - b, - c, - d, - e, - f - ) { - hasError = false; - caughtError = null; - invokeGuardedCallbackImpl$1.apply(reporter, arguments); - } + argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it + // breaks IE9: https://github.com/facebook/react/issues/13610 + // eslint-disable-next-line react-internal/no-production-logging - /** - * Same as invokeGuardedCallback, but instead of returning an error, it stores - * it in a global so it can be rethrown by `rethrowCaughtError` later. - * TODO: See if caughtError and rethrowError can be unified. - * - * @param {String} name of the guard to use for logging or debugging - * @param {Function} func The function to invoke - * @param {*} context The context to use when calling the function - * @param {...*} args Arguments for function - */ - function invokeGuardedCallbackAndCatchFirstError( - name, - func, - context, - a, - b, - c, - d, - e, - f - ) { - invokeGuardedCallback.apply(this, arguments); - if (hasError) { - var error = clearCaughtError(); - if (!hasRethrowError) { - hasRethrowError = true; - rethrowError = error; - } - } - } + Function.prototype.apply.call(console[level], console, argsWithFormat); + } +} + +var FunctionComponent = 0; +var ClassComponent = 1; +var IndeterminateComponent = 2; // Before we know whether it is function or class + +var HostRoot = 3; // Root of a host tree. Could be nested inside another node. + +var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. + +var HostComponent = 5; +var HostText = 6; +var Fragment = 7; +var Mode = 8; +var ContextConsumer = 9; +var ContextProvider = 10; +var ForwardRef = 11; +var Profiler = 12; +var SuspenseComponent = 13; +var MemoComponent = 14; +var SimpleMemoComponent = 15; +var LazyComponent = 16; +var IncompleteClassComponent = 17; +var DehydratedFragment = 18; +var SuspenseListComponent = 19; +var ScopeComponent = 21; +var OffscreenComponent = 22; +var LegacyHiddenComponent = 23; +var CacheComponent = 24; +var TracingMarkerComponent = 25; + +// ----------------------------------------------------------------------------- + +var enableClientRenderFallbackOnTextMismatch = true; // TODO: Need to review this code one more time before landing +// the react-reconciler package. + +var enableNewReconciler = false; // Support legacy Primer support on internal FB www + +var enableLazyContextPropagation = false; // FB-only usage. The new API has different semantics. + +var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber + +var enableSuspenseAvoidThisFallback = false; // Enables unstable_avoidThisFallback feature in Fizz +// React DOM Chopping Block +// +// Similar to main Chopping Block but only flags related to React DOM. These are +// grouped because we will likely batch all of them into a single major release. +// ----------------------------------------------------------------------------- +// Disable support for comment nodes as React DOM containers. Already disabled +// in open source, but www codebase still relies on it. Need to remove. + +var disableCommentsAsDOMContainers = true; // Disable javascript: URL strings in href for XSS protection. +// and client rendering, mostly to allow JSX attributes to apply to the custom +// element's object properties instead of only HTML attributes. +// https://github.com/facebook/react/issues/11347 + +var enableCustomElementPropertySupport = false; // Disables children for