diff --git a/.babelrc b/.babelrc
new file mode 100644
index 0000000..27eef8d
--- /dev/null
+++ b/.babelrc
@@ -0,0 +1,48 @@
+{
+ "presets": [
+ [
+ "@babel/preset-env",
+ {
+ "loose": true,
+ "modules": false,
+ "useBuiltIns": "usage",
+ "targets": {
+ "browsers": [
+ "> 1%",
+ "last 2 versions",
+ "Android >= 4"
+ ]
+ }
+ }
+ ],
+ "@babel/preset-react"
+ ],
+ "plugins": [
+ [
+ "@babel/plugin-proposal-decorators",
+ {
+ "legacy": true
+ }
+ ],
+ "@babel/plugin-syntax-jsx",
+ "@babel/plugin-syntax-dynamic-import",
+ [
+ "@babel/plugin-proposal-class-properties",
+ {
+ "loose": true
+ }
+ ],
+ [
+ "@babel/plugin-transform-runtime",
+ {
+ "corejs": 2,
+ "helpers": true,
+ "regenerator": true,
+ "useESModules": false
+ }
+ ],
+ [
+ "lodash"
+ ]
+ ]
+}
diff --git a/.eslintrc b/.eslintrc
new file mode 100644
index 0000000..f8528b0
--- /dev/null
+++ b/.eslintrc
@@ -0,0 +1,91 @@
+{
+ "extends": [
+ "airbnb",
+ "eslint:recommended",
+ "plugin:react/recommended",
+ "prettier/react"
+ ],
+ "env": {
+ "browser": true,
+ "node": true,
+ "jasmine": true,
+ "jest": true,
+ "es6": true
+ },
+ "parser": "babel-eslint",
+ "parserOptions": {
+ "ecmaVersion": 6,
+ "sourceType": "module",
+ "ecmaFeatures": {
+ "jsx": true,
+ "experimentalObjectRestSpread": true
+ }
+ },
+ "plugins": [
+ "react",
+ "jsx-a11y",
+ "import",
+ "prettier",
+ "promise"
+ ],
+ "globals": {
+ "__VERSION__": true,
+ "__DEV__": false,
+ "__TEST__": false,
+ "__PROD__": false,
+ "__COVERAGE__": false,
+ "React": true,
+ "TestUtils": true
+ },
+ "rules": {
+ "semi": [
+ "error",
+ "always"
+ ],
+ "no-octal-escape": 0,
+ "no-console": 0,
+ "import/no-unresolved": 0,
+ "import/prefer-default-export": 0,
+ "import/no-extraneous-dependencies": 0,
+ "no-mixed-operators": 0,
+ "prefer-promise-reject-errors": 0,
+ "key-spacing": 0,
+ "quotes": ["error", "single"],
+ "jsx-quotes": [
+ 2,
+ "prefer-single"
+ ],
+ "max-len": [
+ 2,
+ 160,
+ 2
+ ],
+ "object-curly-spacing": [
+ 2,
+ "always"
+ ],
+ "prettier/prettier": [
+ "error",
+ {
+ "jsxSingleQuote": true
+ }
+ ],
+ "no-useless-constructor": 0,
+ "jsx-a11y/no-noninteractive-element-interactions": 0,
+ "react/no-unused-prop-types": 0,
+ "react/jsx-one-expression-per-line": 0,
+ "jsx-a11y/click-events-have-key-events": 0,
+ "jsx-a11y/no-static-element-interactions": 0,
+ "jsx-a11y/anchor-is-valid": 0,
+ "react/require-default-props": 0,
+ "react/forbid-prop-types": 0,
+ "react/no-danger": 0,
+ "react/no-array-index-key": 0,
+ "react/prefer-stateless-function": 0
+ },
+ "settings": {
+ "react": {
+ "version": "16"
+ }
+ }
+}
diff --git a/.gitignore b/.gitignore
index ec9be9f..aae5de8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,6 @@ node_modules/
dist/
.env
.DS_Store
-npm-debug.log
\ No newline at end of file
+npm-debug.log
+.idea/
+output/
diff --git a/.prettierrc b/.prettierrc
new file mode 100644
index 0000000..eaa0965
--- /dev/null
+++ b/.prettierrc
@@ -0,0 +1,13 @@
+{
+ "printWidth": 120,
+ "tabWidth": 2,
+ "arrowParens": "always",
+ "useTabs": false,
+ "singleQuote": true,
+ "jsxSingleQuote": true,
+ "jsxBracketSameLine": false,
+ "semi": true,
+ "trailingComma": "none",
+ "bracketSpacing": true,
+ "parser": "babylon"
+}
diff --git a/README.md b/README.md
index 559e6a8..c7fba02 100644
--- a/README.md
+++ b/README.md
@@ -1,25 +1,215 @@
-# React MobX React-Router 4 Boilerplate
+# Webpack4升级完全指南
-### :tada: React, React-Router@next, MobX and Webpack 2.
-## [Demo](http://boilerplate.mhaagens.me)
+> webpack4官方已经于近日升级到了V4.5的稳定版本,对应的一些必备插件(webpack-contrib)也陆续完成了更新支持,笔者在第一时间完成了项目由V3到V4的迁移,在此记录一下升级过程中遇到的种种问题和对应的解决手段,方便后续入坑者及时查阅,减少重复工作。
-Just run `npm install` and `npm start`, then go to localhost:3000 to start developing.
-To build, run `npm run build`, and to preview run `npm run preview`, then go
-to localhost:1234 for the minified production bundle.
+## 一、Node版本依赖重新调整
-#### Async component loading
-Components are now loaded async with react-router-loader and the store is injected via MobX Provider.
-If you've downloaded this boilerplate before remember to run `npm install` again.
+官方不再支持node4以下的版本,依赖node的环境版本>=6.11.5,当然考虑到最佳的es6特性实现,建议node版本可以升级到V8.9.4或以上版本,具体更新说明部分可以见:[webpack4更新日志](https://github.com/webpack/webpack/releases/tag/v4.0.0)
-#### Read this if you've been using an earlier version of this boilerplate
+```javascript
+"engines": {
+ "node": ">=6.11.5" // >=8.10.0 (recommendation version)
+ }
+```
-* 05/03/17 - Hot reloadable MobX stores
-* 04/04/17 - Upgraded to React Router 4 @ latest
-* 01/31/17 - Upgraded to React Router 4 Beta
-* 01/28/17 - Routes are now loaded through [Lazy-Route](https://github.com/mhaagens/lazy-route).
-### Todo
+## 二、用更加快捷的mode模式来优化配置文件
-- [X] Async loading of components
-- [X] Data fetching example
-- [X] Protected Routes
+webpack4中提供的mode有两个值:development和production,默认值是 production。mode是我们为减小生产环境构建体积以及节约开发环境的构建时间提供的一种优化方案,提供对应的构建参数项的默认开启或关闭,降低配置成本。
+
+### 开启方式 1:直接在启动命令后加入参数
+
+```javascript
+"scripts": {
+ "dev": "webpack --mode development",
+ "build": "webpack --mode production"
+}
+```
+
+### 开启方式 2:可以在配置文件中加入一个mode属性:
+
+```javascript
+module.exports = {
+ mode: 'production' // development
+};
+```
+
+### development模式下,将侧重于功能调试和优化开发体验,包含如下内容:
+> 1. 浏览器调试工具
+> 2. 注释、开发阶段的详细错误日志和提示
+> 3. 快速和优化的增量构建机制
+
+### production模式下,将侧重于模块体积优化和线上部署,包含如下内容:
+> 1. 开启所有的优化代码
+> 2. 更小的bundle大小
+> 3. 去除掉只在开发阶段运行的代码
+> 4. Scope hoisting和Tree-shaking
+> 5. 自动启用uglifyjs对代码进行压缩
+
+webpack一直以来最饱受诟病的就是其配置门槛极高,配置内容复杂而繁琐,容易让人从入门到放弃,而它的后起之秀如rollup,parcel等均在配置流程上做了极大的优化,做到开箱即用,webpack在V4中应该也从中借鉴了不少经验来提升自身的配置效率,详见内容可以参考这篇文章[《webpack 4: mode and optimization》](https://medium.com/webpack/webpack-4-mode-and-optimization-5423a6bc597a)
+
+
+## 三、再见commonchunk,你好optimization
+
+从webpack4开始官方移除了commonchunk插件,改用了optimization属性进行更加灵活的配置,这也应该是从V3升级到V4的代码修改过程中最为复杂的一部分,下面的代码即是optimize.splitChunks 中的一些配置参考,
+
+```javascript
+module.exports = {
+ optimization: {
+ runtimeChunk: {
+ name: 'manifest'
+ },
+ minimizer: true, // [new UglifyJsPlugin({...})]
+ splitChunks:{
+ chunks: 'async',
+ minSize: 30000,
+ minChunks: 1,
+ maxAsyncRequests: 5,
+ maxInitialRequests: 3,
+ name: false,
+ cacheGroups: {
+ vendor: {
+ name: 'vendor',
+ chunks: 'initial',
+ priority: -10,
+ reuseExistingChunk: false,
+ test: /node_modules\/(.*)\.js/
+ },
+ styles: {
+ name: 'styles',
+ test: /\.(scss|css)$/,
+ chunks: 'all',
+ minChunks: 1,
+ reuseExistingChunk: true,
+ enforce: true
+ }
+ }
+ }
+ }
+}
+```
+
+### 从中我们不难发现,其主要变化有如下几个方面:
+
+> 1. commonchunk配置项被彻底去掉,之前需要通过配置两次new webpack.optimize.CommonsChunkPlugin来分别获取vendor和manifest的通用chunk方式已经做了整合,** 直接在optimization中配置runtimeChunk和splitChunks即可 ** ,提取功能也更为强大,具体配置见:[splitChunks](https://webpack.js.org/plugins/split-chunks-plugin/#optimization-splitchunks)
+
+>1. runtimeChunk可以配置成true,single或者对象,用自动计算当前构建的一些基础chunk信息,类似之前版本中的manifest信息获取方式。
+
+>1. webpack.optimize.UglifyJsPlugin现在也不需要了,只需要使用optimization.minimize为true就行,production mode下面自动为true,当然如果想使用第三方的压缩插件也可以在optimization.minimizer的数组列表中进行配置
+
+## 四、ExtractTextWebpackPlugin调整,建议选用新的CSS文件提取插件mini-css-extract-plugin
+
+由于webpack4以后对css模块支持的逐步完善和commonchunk插件的移除,在处理css文件提取的计算方式上也做了些调整,之前我们首选使用的[extract-text-webpack-plugin](https://github.com/webpack-contrib/extract-text-webpack-plugin)也完成了其历史使命,将让位于[mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin)
+
+### 基本配置如下:
+
+```javascript
+const MiniCssExtractPlugin = require("mini-css-extract-plugin");
+module.exports = {
+ plugins: [
+ new MiniCssExtractPlugin({
+ // Options similar to the same options in webpackOptions.output
+ // both options are optional
+ filename: "[name].css",
+ chunkFilename: "[id].css"
+ })
+ ],
+ module: {
+ rules: [
+ {
+ test: /\.css$/,
+ use: [
+ MiniCssExtractPlugin.loader, // replace ExtractTextPlugin.extract({..})
+ "css-loader"
+ ]
+ }
+ ]
+ }
+}
+```
+
+### 生产环境下的配置优化:
+
+```javascript
+const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
+const MiniCssExtractPlugin = require("mini-css-extract-plugin");
+const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
+module.exports = {
+ optimization: {
+ minimizer: [
+ new UglifyJsPlugin({
+ cache: true,
+ parallel: true,
+ sourceMap: true
+ }),
+ new OptimizeCSSAssetsPlugin({
+ assetNameRegExp: /\.css$/g,
+ cssProcessor: require('cssnano'),
+ cssProcessorOptions: {
+ autoprefixer: false,
+ preset: [
+ 'default',
+ {
+ discardComments: {
+ removeAll: true
+ }
+ }
+ ]
+ }
+ }) // use OptimizeCSSAssetsPlugin
+ ]
+ },
+ plugins: [
+ new MiniCssExtractPlugin({
+ filename: 'css/app.[name].css',
+ chunkFilename: 'css/app.[contenthash:12].css' // use contenthash *
+ })
+ ]
+}
+
+```
+
+### 将多个css chunk合并成一个css文件
+
+```javascript
+const MiniCssExtractPlugin = require("mini-css-extract-plugin");
+module.exports = {
+ optimization: {
+ splitChunks: {
+ cacheGroups: {
+ styles: {
+ name: 'styles',
+ test: /\.scss|css$/,
+ chunks: 'all', // merge all the css chunk to one file
+ enforce: true
+ }
+ }
+ }
+ }
+}
+```
+
+
+## 五、其他调整项备忘
+
+> 1. NoEmitOnErrorsPlugin- > optimization.noEmitOnErrors(默认情况下处于生产模式)
+> 2. ModuleConcatenationPlugin- > optimization.concatenateModules(默认情况下处于生产模式)
+> 3. NamedModulesPlugin- > optimization.namedModules(在开发模式下默认开启)
+> 4. CommonsChunkPlugin 被删除 - > optimization.splitChunks
+> 5. webpack命令优化 -> 发布了独立的 [webpack-cli](https://webpack.js.org/api/cli/) 命令行工具包
+> 6. webpack-dev-server -> 建议升级到最新版本
+> 7. html-webpack-plugin -> 建议升级到的最新版本
+> 8. file-loader -> 建议升级到最新版本
+> 9. url-loader -> 建议升级到最新版本
+
+## 六、参考工程
+[webpack4配置工程实例](https://github.com/taikongfeizhu/react-mobx-react-router4-boilerplate)
+
+## 七、参阅资料
+
+1. [webpack4](https://blog.csdn.net/qq_20334295/article/details/79401231)
+2. [webpack4发布概览](https://zhuanlan.zhihu.com/p/34028750)
+3. [webpack 4: mode and optimization](https://medium.com/webpack/webpack-4-mode-and-optimization-5423a6bc597a)
+4. [webpack4新特性介绍](https://segmentfault.com/a/1190000013970017)
+5. [webpack4升级指北](https://segmentfault.com/a/1190000013420383)
+6. [webpack4升级指南以及从webpack3.x迁移](https://blog.csdn.net/qq_26733915/article/details/79446460)
diff --git a/index.hbs b/index.hbs
deleted file mode 100644
index fe4aeb8..0000000
--- a/index.hbs
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
- Boilerplate
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/package.json b/package.json
index 4c08369..71c88e4 100644
--- a/package.json
+++ b/package.json
@@ -4,10 +4,14 @@
"description": "",
"main": "webpack.config.js",
"scripts": {
- "start": "webpack-dev-server --config webpack.config.js",
- "build": "rimraf ./dist && webpack --config webpack.config.production.js",
- "preview": "pushstate-server ./dist 1234",
- "test": "echo \"Error: no test specified\" && exit 1"
+ "lint": "eslint ./src --ext .jsx,.js",
+ "lint:fix": "npm run lint -- --fix",
+ "format": "prettier-eslint --write './src/**/*.{ts,js,json,jsx}'",
+ "start": "cross-env NODE_ENV=development webpack-dev-server --inline --progress --config webpack.config.js",
+ "build": "rimraf ./output && cross-env NODE_ENV=production webpack --config webpack.config.production.js",
+ "preview": "pushstate-server ./output 3003",
+ "dll": "NODE_ENV=production webpack --config webpack.dll.lib.js --progress",
+ "dll:dev": "NODE_ENV=development webpack --config webpack.dll.lib.js --progress"
},
"keywords": [
"React",
@@ -20,48 +24,102 @@
"author": "Martin Haagensli",
"license": "ISC",
"devDependencies": {
- "babel-core": "^6.23.1",
- "babel-loader": "^7.1.2",
- "babel-plugin-transform-async-to-generator": "^6.16.0",
- "babel-plugin-transform-decorators-legacy": "^1.3.4",
- "babel-polyfill": "^6.23.0",
- "babel-preset-es2015": "^6.22.0",
- "babel-preset-react": "^6.16.0",
- "babel-preset-stage-0": "^6.16.0",
- "css-loader": "^0.28.7",
- "extract-text-webpack-plugin": "^3.0.0",
- "file-loader": "^0.11.2",
- "html-webpack-plugin": "^2.22.0",
- "image-webpack-loader": "^3.4.2",
- "node-sass": "^4.5.3",
- "postcss-loader": "^2.0.6",
- "react-hot-loader": "next",
- "resolve-url-loader": "^2.1.0",
+ "@babel/core": "^7.1.2",
+ "@babel/plugin-proposal-class-properties": "^7.1.0",
+ "@babel/plugin-proposal-decorators": "^7.1.2",
+ "@babel/plugin-syntax-dynamic-import": "^7.0.0",
+ "@babel/plugin-syntax-jsx": "^7.0.0",
+ "@babel/plugin-transform-runtime": "^7.1.0",
+ "@babel/polyfill": "^7.0.0",
+ "@babel/preset-env": "^7.1.0",
+ "@babel/preset-react": "^7.0.0",
+ "@babel/runtime": "^7.1.2",
+ "@babel/runtime-corejs2": "^7.1.2",
+ "add-asset-html-webpack-plugin": "^3.1.2",
+ "autoprefixer": "^9.4.2",
+ "babel-eslint": "^9.0.0",
+ "babel-loader": "^8.0.4",
+ "babel-plugin-add-module-exports": "^0.3.3",
+ "babel-plugin-import": "^1.6.6",
+ "babel-plugin-lodash": "^3.3.4",
+ "babel-plugin-react-css-modules": "^3.4.2",
+ "cross-env": "^5.1.4",
+ "css-loader": "^0.28.11",
+ "eslint": "^5.10.0",
+ "eslint-config-airbnb": "^17.0.0",
+ "eslint-config-prettier": "^3.3.0",
+ "eslint-loader": "^2.1.1",
+ "eslint-module-utils": "^2.0.0",
+ "eslint-plugin-import": "^2.2.0",
+ "eslint-plugin-jasmine": "^2.2.0",
+ "eslint-plugin-jsx-a11y": "^6.1.0",
+ "eslint-plugin-prettier": "^3.0.0",
+ "eslint-plugin-promise": "^3.8.0",
+ "eslint-plugin-react": "^7.11.1",
+ "file-loader": "^1.1.11",
+ "html-webpack-plugin": "^3.2.0",
+ "image-webpack-loader": "^4.2.0",
+ "less": "^3.8.1",
+ "less-loader": "^4.1.0",
+ "lint-staged": "^8.1.0",
+ "lodash-webpack-plugin": "^0.11.5",
+ "mini-css-extract-plugin": "^0.4.5",
+ "optimize-css-assets-webpack-plugin": "^4.0.0",
+ "postcss-loader": "^2.1.3",
+ "prerender-spa-plugin": "^3.4.0",
+ "prettier": "^1.15.3",
+ "prettier-eslint": "^8.8.2",
+ "prettier-eslint-cli": "^4.7.1",
+ "pushstate-server": "^3.0.1",
+ "react-hot-loader": "^4.6.0",
+ "redbox-react": "^1.6.0",
"rimraf": "^2.5.4",
- "sass-loader": "^6.0.6",
- "style-loader": "^0.18.2",
- "url-loader": "^0.5.7",
- "webpack": "^3.5.6",
- "webpack-dev-server": "^2.4.5"
+ "style-loader": "^0.20.3",
+ "uglifyjs-webpack-plugin": "^2.0.1",
+ "url-loader": "^1.0.1",
+ "webpack": "^4.20.2",
+ "webpack-bundle-analyzer": "^3.0.3",
+ "webpack-cli": "^3.1.2",
+ "webpack-dev-server": "^3.1.10",
+ "webpack-merge": "^4.1.5"
},
"dependencies": {
- "axios": "^0.16.2",
+ "axios": "^0.18.0",
+ "classnames": "^2.2.6",
"css-declaration-sorter": "^2.0.0",
"css-mqpacker": "^6.0.1",
"faker": "^4.1.0",
+ "history": "^4.7.2",
+ "husky": "^1.2.0",
+ "immer": "^1.9.0",
"lazy-route": "^1.0.7",
- "mobx": "^3.2.2",
- "mobx-react": "^4.2.2",
- "mobx-react-devtools": "^4.2.6",
+ "lodash": "^4.17.11",
+ "mobx": "^5.7.0",
+ "mobx-react": "^5.4.3",
+ "mobx-react-router": "^4.0.5",
"moment": "^2.15.1",
"package": "^1.0.1",
- "postcss-cssnext": "^3.0.2",
- "pushstate-server": "^3.0.1",
- "react": "^15.3.2",
- "react-dom": "^15.3.2",
- "react-router-dom": "latest",
- "rfx-core": "^1.5.3",
- "whatwg-fetch": "^2.0.3"
+ "postcss-preset-env": "^4.1.0",
+ "prop-types": "^15.5.10",
+ "puppeteer": "^1.11.0",
+ "querystring": "^0.2.0",
+ "react": "^16.8.2",
+ "react-dom": "^16.8.2",
+ "react-router": "^4.3.1",
+ "react-router-dom": "^4.3.1"
+ },
+ "lint-staged": {
+ "src/**/*.{js,jsx}": [
+ "npm run format",
+ "npm run lint:fix",
+ "git add"
+ ]
+ },
+ "husky": {
+ "hooks": {
+ "pre-commit": "lint-staged",
+ "pre-push": ""
+ }
},
"repository": {
"url": "git@github.com:mhaagens/react-mobx-react-router4-boilerplate.git",
diff --git a/postcss.config.js b/postcss.config.js
index c7d9b92..793b7b9 100644
--- a/postcss.config.js
+++ b/postcss.config.js
@@ -1,9 +1,24 @@
module.exports = {
- plugins: [
- require("postcss-cssnext")(),
- require("css-declaration-sorter")({
- order: "concentric-css"
- }),
- require("css-mqpacker")(),
- ]
-};
\ No newline at end of file
+ plugins: [
+ require('postcss-preset-env')({
+ autoprefixer: false
+ }),
+
+ require('css-declaration-sorter')({
+ order: 'concentric-css'
+ }),
+
+ require('cssnano')({
+ preset: 'advanced',
+ autoprefixer: false,
+ 'postcss-zindex': false
+ }),
+
+ require('autoprefixer')({
+ browsers: ['>1%', 'last 4 versions', 'Firefox ESR', 'not ie < 9'],
+ remove: true
+ }),
+
+ require('css-mqpacker')()
+ ]
+};
diff --git a/public/favicon.ico b/public/favicon.ico
new file mode 100644
index 0000000..5c125de
Binary files /dev/null and b/public/favicon.ico differ
diff --git a/public/lib/debug/lib.js b/public/lib/debug/lib.js
new file mode 100644
index 0000000..ee6938a
--- /dev/null
+++ b/public/lib/debug/lib.js
@@ -0,0 +1,37023 @@
+var lib =
+/******/ (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] = {
+/******/ i: moduleId,
+/******/ l: false,
+/******/ exports: {}
+/******/ };
+/******/
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+/******/
+/******/ // Flag the module as loaded
+/******/ module.l = 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;
+/******/
+/******/ // define getter function for harmony exports
+/******/ __webpack_require__.d = function(exports, name, getter) {
+/******/ if(!__webpack_require__.o(exports, name)) {
+/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
+/******/ }
+/******/ };
+/******/
+/******/ // define __esModule on exports
+/******/ __webpack_require__.r = function(exports) {
+/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
+/******/ }
+/******/ Object.defineProperty(exports, '__esModule', { value: true });
+/******/ };
+/******/
+/******/ // create a fake namespace object
+/******/ // mode & 1: value is a module id, require it
+/******/ // mode & 2: merge all properties of value into the ns
+/******/ // mode & 4: return value when already ns object
+/******/ // mode & 8|1: behave like require
+/******/ __webpack_require__.t = function(value, mode) {
+/******/ if(mode & 1) value = __webpack_require__(value);
+/******/ if(mode & 8) return value;
+/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
+/******/ var ns = Object.create(null);
+/******/ __webpack_require__.r(ns);
+/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
+/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
+/******/ return ns;
+/******/ };
+/******/
+/******/ // getDefaultExport function for compatibility with non-harmony modules
+/******/ __webpack_require__.n = function(module) {
+/******/ var getter = module && module.__esModule ?
+/******/ function getDefault() { return module['default']; } :
+/******/ function getModuleExports() { return module; };
+/******/ __webpack_require__.d(getter, 'a', getter);
+/******/ return getter;
+/******/ };
+/******/
+/******/ // Object.prototype.hasOwnProperty.call
+/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
+/******/
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "";
+/******/
+/******/
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(__webpack_require__.s = 0);
+/******/ })
+/************************************************************************/
+/******/ ({
+
+/***/ "./node_modules/axios/index.js":
+/*!*************************************!*\
+ !*** ./node_modules/axios/index.js ***!
+ \*************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js");
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/adapters/xhr.js":
+/*!************************************************!*\
+ !*** ./node_modules/axios/lib/adapters/xhr.js ***!
+ \************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
+var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js");
+var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
+var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js");
+var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js");
+var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js");
+var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || __webpack_require__(/*! ./../helpers/btoa */ "./node_modules/axios/lib/helpers/btoa.js");
+
+module.exports = function xhrAdapter(config) {
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
+ var requestData = config.data;
+ var requestHeaders = config.headers;
+
+ if (utils.isFormData(requestData)) {
+ delete requestHeaders['Content-Type']; // Let the browser set it
+ }
+
+ var request = new XMLHttpRequest();
+ var loadEvent = 'onreadystatechange';
+ var xDomain = false;
+
+ // For IE 8/9 CORS support
+ // Only supports POST and GET calls and doesn't returns the response headers.
+ // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
+ if ( true &&
+ typeof window !== 'undefined' &&
+ window.XDomainRequest && !('withCredentials' in request) &&
+ !isURLSameOrigin(config.url)) {
+ request = new window.XDomainRequest();
+ loadEvent = 'onload';
+ xDomain = true;
+ request.onprogress = function handleProgress() {};
+ request.ontimeout = function handleTimeout() {};
+ }
+
+ // HTTP basic authentication
+ if (config.auth) {
+ var username = config.auth.username || '';
+ var password = config.auth.password || '';
+ requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
+ }
+
+ request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
+
+ // Set the request timeout in MS
+ request.timeout = config.timeout;
+
+ // Listen for ready state
+ request[loadEvent] = function handleLoad() {
+ if (!request || (request.readyState !== 4 && !xDomain)) {
+ return;
+ }
+
+ // The request errored out and we didn't get a response, this will be
+ // handled by onerror instead
+ // With one exception: request that using file: protocol, most browsers
+ // will return status as 0 even though it's a successful request
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
+ return;
+ }
+
+ // Prepare the response
+ var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
+ var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
+ var response = {
+ data: responseData,
+ // IE sends 1223 instead of 204 (https://github.com/axios/axios/issues/201)
+ status: request.status === 1223 ? 204 : request.status,
+ statusText: request.status === 1223 ? 'No Content' : request.statusText,
+ headers: responseHeaders,
+ config: config,
+ request: request
+ };
+
+ settle(resolve, reject, response);
+
+ // Clean up request
+ request = null;
+ };
+
+ // Handle low level network errors
+ request.onerror = function handleError() {
+ // Real errors are hidden from us by the browser
+ // onerror should only fire if it's a network error
+ reject(createError('Network Error', config, null, request));
+
+ // Clean up request
+ request = null;
+ };
+
+ // Handle timeout
+ request.ontimeout = function handleTimeout() {
+ reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',
+ request));
+
+ // Clean up request
+ request = null;
+ };
+
+ // Add xsrf header
+ // This is only done if running in a standard browser environment.
+ // Specifically not if we're in a web worker, or react-native.
+ if (utils.isStandardBrowserEnv()) {
+ var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js");
+
+ // Add xsrf header
+ var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
+ cookies.read(config.xsrfCookieName) :
+ undefined;
+
+ if (xsrfValue) {
+ requestHeaders[config.xsrfHeaderName] = xsrfValue;
+ }
+ }
+
+ // Add headers to the request
+ if ('setRequestHeader' in request) {
+ utils.forEach(requestHeaders, function setRequestHeader(val, key) {
+ if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
+ // Remove Content-Type if data is undefined
+ delete requestHeaders[key];
+ } else {
+ // Otherwise add header to the request
+ request.setRequestHeader(key, val);
+ }
+ });
+ }
+
+ // Add withCredentials to request if needed
+ if (config.withCredentials) {
+ request.withCredentials = true;
+ }
+
+ // Add responseType to request if needed
+ if (config.responseType) {
+ try {
+ request.responseType = config.responseType;
+ } catch (e) {
+ // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
+ // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
+ if (config.responseType !== 'json') {
+ throw e;
+ }
+ }
+ }
+
+ // Handle progress if needed
+ if (typeof config.onDownloadProgress === 'function') {
+ request.addEventListener('progress', config.onDownloadProgress);
+ }
+
+ // Not all browsers support upload events
+ if (typeof config.onUploadProgress === 'function' && request.upload) {
+ request.upload.addEventListener('progress', config.onUploadProgress);
+ }
+
+ if (config.cancelToken) {
+ // Handle cancellation
+ config.cancelToken.promise.then(function onCanceled(cancel) {
+ if (!request) {
+ return;
+ }
+
+ request.abort();
+ reject(cancel);
+ // Clean up request
+ request = null;
+ });
+ }
+
+ if (requestData === undefined) {
+ requestData = null;
+ }
+
+ // Send the request
+ request.send(requestData);
+ });
+};
+
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/axios.js":
+/*!*****************************************!*\
+ !*** ./node_modules/axios/lib/axios.js ***!
+ \*****************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
+var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
+var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js");
+var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js");
+
+/**
+ * Create an instance of Axios
+ *
+ * @param {Object} defaultConfig The default config for the instance
+ * @return {Axios} A new instance of Axios
+ */
+function createInstance(defaultConfig) {
+ var context = new Axios(defaultConfig);
+ var instance = bind(Axios.prototype.request, context);
+
+ // Copy axios.prototype to instance
+ utils.extend(instance, Axios.prototype, context);
+
+ // Copy context to instance
+ utils.extend(instance, context);
+
+ return instance;
+}
+
+// Create the default instance to be exported
+var axios = createInstance(defaults);
+
+// Expose Axios class to allow class inheritance
+axios.Axios = Axios;
+
+// Factory for creating new instances
+axios.create = function create(instanceConfig) {
+ return createInstance(utils.merge(defaults, instanceConfig));
+};
+
+// Expose Cancel & CancelToken
+axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
+axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js");
+axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
+
+// Expose all/spread
+axios.all = function all(promises) {
+ return Promise.all(promises);
+};
+axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js");
+
+module.exports = axios;
+
+// Allow use of default import syntax in TypeScript
+module.exports.default = axios;
+
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/cancel/Cancel.js":
+/*!*************************************************!*\
+ !*** ./node_modules/axios/lib/cancel/Cancel.js ***!
+ \*************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+/**
+ * A `Cancel` is an object that is thrown when an operation is canceled.
+ *
+ * @class
+ * @param {string=} message The message.
+ */
+function Cancel(message) {
+ this.message = message;
+}
+
+Cancel.prototype.toString = function toString() {
+ return 'Cancel' + (this.message ? ': ' + this.message : '');
+};
+
+Cancel.prototype.__CANCEL__ = true;
+
+module.exports = Cancel;
+
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/cancel/CancelToken.js":
+/*!******************************************************!*\
+ !*** ./node_modules/axios/lib/cancel/CancelToken.js ***!
+ \******************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
+
+/**
+ * A `CancelToken` is an object that can be used to request cancellation of an operation.
+ *
+ * @class
+ * @param {Function} executor The executor function.
+ */
+function CancelToken(executor) {
+ if (typeof executor !== 'function') {
+ throw new TypeError('executor must be a function.');
+ }
+
+ var resolvePromise;
+ this.promise = new Promise(function promiseExecutor(resolve) {
+ resolvePromise = resolve;
+ });
+
+ var token = this;
+ executor(function cancel(message) {
+ if (token.reason) {
+ // Cancellation has already been requested
+ return;
+ }
+
+ token.reason = new Cancel(message);
+ resolvePromise(token.reason);
+ });
+}
+
+/**
+ * Throws a `Cancel` if cancellation has been requested.
+ */
+CancelToken.prototype.throwIfRequested = function throwIfRequested() {
+ if (this.reason) {
+ throw this.reason;
+ }
+};
+
+/**
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
+ * cancels the `CancelToken`.
+ */
+CancelToken.source = function source() {
+ var cancel;
+ var token = new CancelToken(function executor(c) {
+ cancel = c;
+ });
+ return {
+ token: token,
+ cancel: cancel
+ };
+};
+
+module.exports = CancelToken;
+
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/cancel/isCancel.js":
+/*!***************************************************!*\
+ !*** ./node_modules/axios/lib/cancel/isCancel.js ***!
+ \***************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+module.exports = function isCancel(value) {
+ return !!(value && value.__CANCEL__);
+};
+
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/core/Axios.js":
+/*!**********************************************!*\
+ !*** ./node_modules/axios/lib/core/Axios.js ***!
+ \**********************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var defaults = __webpack_require__(/*! ./../defaults */ "./node_modules/axios/lib/defaults.js");
+var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
+var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js");
+var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js");
+
+/**
+ * Create a new instance of Axios
+ *
+ * @param {Object} instanceConfig The default config for the instance
+ */
+function Axios(instanceConfig) {
+ this.defaults = instanceConfig;
+ this.interceptors = {
+ request: new InterceptorManager(),
+ response: new InterceptorManager()
+ };
+}
+
+/**
+ * Dispatch a request
+ *
+ * @param {Object} config The config specific for this request (merged with this.defaults)
+ */
+Axios.prototype.request = function request(config) {
+ /*eslint no-param-reassign:0*/
+ // Allow for axios('example/url'[, config]) a la fetch API
+ if (typeof config === 'string') {
+ config = utils.merge({
+ url: arguments[0]
+ }, arguments[1]);
+ }
+
+ config = utils.merge(defaults, {method: 'get'}, this.defaults, config);
+ config.method = config.method.toLowerCase();
+
+ // Hook up interceptors middleware
+ var chain = [dispatchRequest, undefined];
+ var promise = Promise.resolve(config);
+
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
+ chain.unshift(interceptor.fulfilled, interceptor.rejected);
+ });
+
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
+ chain.push(interceptor.fulfilled, interceptor.rejected);
+ });
+
+ while (chain.length) {
+ promise = promise.then(chain.shift(), chain.shift());
+ }
+
+ return promise;
+};
+
+// Provide aliases for supported request methods
+utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
+ /*eslint func-names:0*/
+ Axios.prototype[method] = function(url, config) {
+ return this.request(utils.merge(config || {}, {
+ method: method,
+ url: url
+ }));
+ };
+});
+
+utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
+ /*eslint func-names:0*/
+ Axios.prototype[method] = function(url, data, config) {
+ return this.request(utils.merge(config || {}, {
+ method: method,
+ url: url,
+ data: data
+ }));
+ };
+});
+
+module.exports = Axios;
+
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/core/InterceptorManager.js":
+/*!***********************************************************!*\
+ !*** ./node_modules/axios/lib/core/InterceptorManager.js ***!
+ \***********************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
+
+function InterceptorManager() {
+ this.handlers = [];
+}
+
+/**
+ * Add a new interceptor to the stack
+ *
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
+ *
+ * @return {Number} An ID used to remove interceptor later
+ */
+InterceptorManager.prototype.use = function use(fulfilled, rejected) {
+ this.handlers.push({
+ fulfilled: fulfilled,
+ rejected: rejected
+ });
+ return this.handlers.length - 1;
+};
+
+/**
+ * Remove an interceptor from the stack
+ *
+ * @param {Number} id The ID that was returned by `use`
+ */
+InterceptorManager.prototype.eject = function eject(id) {
+ if (this.handlers[id]) {
+ this.handlers[id] = null;
+ }
+};
+
+/**
+ * Iterate over all the registered interceptors
+ *
+ * This method is particularly useful for skipping over any
+ * interceptors that may have become `null` calling `eject`.
+ *
+ * @param {Function} fn The function to call for each interceptor
+ */
+InterceptorManager.prototype.forEach = function forEach(fn) {
+ utils.forEach(this.handlers, function forEachHandler(h) {
+ if (h !== null) {
+ fn(h);
+ }
+ });
+};
+
+module.exports = InterceptorManager;
+
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/core/createError.js":
+/*!****************************************************!*\
+ !*** ./node_modules/axios/lib/core/createError.js ***!
+ \****************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js");
+
+/**
+ * Create an Error with the specified message, config, error code, request and response.
+ *
+ * @param {string} message The error message.
+ * @param {Object} config The config.
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
+ * @param {Object} [request] The request.
+ * @param {Object} [response] The response.
+ * @returns {Error} The created error.
+ */
+module.exports = function createError(message, config, code, request, response) {
+ var error = new Error(message);
+ return enhanceError(error, config, code, request, response);
+};
+
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/core/dispatchRequest.js":
+/*!********************************************************!*\
+ !*** ./node_modules/axios/lib/core/dispatchRequest.js ***!
+ \********************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
+var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js");
+var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
+var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js");
+var isAbsoluteURL = __webpack_require__(/*! ./../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js");
+var combineURLs = __webpack_require__(/*! ./../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js");
+
+/**
+ * Throws a `Cancel` if cancellation has been requested.
+ */
+function throwIfCancellationRequested(config) {
+ if (config.cancelToken) {
+ config.cancelToken.throwIfRequested();
+ }
+}
+
+/**
+ * Dispatch a request to the server using the configured adapter.
+ *
+ * @param {object} config The config that is to be used for the request
+ * @returns {Promise} The Promise to be fulfilled
+ */
+module.exports = function dispatchRequest(config) {
+ throwIfCancellationRequested(config);
+
+ // Support baseURL config
+ if (config.baseURL && !isAbsoluteURL(config.url)) {
+ config.url = combineURLs(config.baseURL, config.url);
+ }
+
+ // Ensure headers exist
+ config.headers = config.headers || {};
+
+ // Transform request data
+ config.data = transformData(
+ config.data,
+ config.headers,
+ config.transformRequest
+ );
+
+ // Flatten headers
+ config.headers = utils.merge(
+ config.headers.common || {},
+ config.headers[config.method] || {},
+ config.headers || {}
+ );
+
+ utils.forEach(
+ ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
+ function cleanHeaderConfig(method) {
+ delete config.headers[method];
+ }
+ );
+
+ var adapter = config.adapter || defaults.adapter;
+
+ return adapter(config).then(function onAdapterResolution(response) {
+ throwIfCancellationRequested(config);
+
+ // Transform response data
+ response.data = transformData(
+ response.data,
+ response.headers,
+ config.transformResponse
+ );
+
+ return response;
+ }, function onAdapterRejection(reason) {
+ if (!isCancel(reason)) {
+ throwIfCancellationRequested(config);
+
+ // Transform response data
+ if (reason && reason.response) {
+ reason.response.data = transformData(
+ reason.response.data,
+ reason.response.headers,
+ config.transformResponse
+ );
+ }
+ }
+
+ return Promise.reject(reason);
+ });
+};
+
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/core/enhanceError.js":
+/*!*****************************************************!*\
+ !*** ./node_modules/axios/lib/core/enhanceError.js ***!
+ \*****************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+/**
+ * Update an Error with the specified config, error code, and response.
+ *
+ * @param {Error} error The error to update.
+ * @param {Object} config The config.
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
+ * @param {Object} [request] The request.
+ * @param {Object} [response] The response.
+ * @returns {Error} The error.
+ */
+module.exports = function enhanceError(error, config, code, request, response) {
+ error.config = config;
+ if (code) {
+ error.code = code;
+ }
+ error.request = request;
+ error.response = response;
+ return error;
+};
+
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/core/settle.js":
+/*!***********************************************!*\
+ !*** ./node_modules/axios/lib/core/settle.js ***!
+ \***********************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js");
+
+/**
+ * Resolve or reject a Promise based on response status.
+ *
+ * @param {Function} resolve A function that resolves the promise.
+ * @param {Function} reject A function that rejects the promise.
+ * @param {object} response The response.
+ */
+module.exports = function settle(resolve, reject, response) {
+ var validateStatus = response.config.validateStatus;
+ // Note: status is not exposed by XDomainRequest
+ if (!response.status || !validateStatus || validateStatus(response.status)) {
+ resolve(response);
+ } else {
+ reject(createError(
+ 'Request failed with status code ' + response.status,
+ response.config,
+ null,
+ response.request,
+ response
+ ));
+ }
+};
+
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/core/transformData.js":
+/*!******************************************************!*\
+ !*** ./node_modules/axios/lib/core/transformData.js ***!
+ \******************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
+
+/**
+ * Transform the data for a request or a response
+ *
+ * @param {Object|String} data The data to be transformed
+ * @param {Array} headers The headers for the request or response
+ * @param {Array|Function} fns A single function or Array of functions
+ * @returns {*} The resulting transformed data
+ */
+module.exports = function transformData(data, headers, fns) {
+ /*eslint no-param-reassign:0*/
+ utils.forEach(fns, function transform(fn) {
+ data = fn(data, headers);
+ });
+
+ return data;
+};
+
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/defaults.js":
+/*!********************************************!*\
+ !*** ./node_modules/axios/lib/defaults.js ***!
+ \********************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* WEBPACK VAR INJECTION */(function(process) {
+
+var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
+var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js");
+
+var DEFAULT_CONTENT_TYPE = {
+ 'Content-Type': 'application/x-www-form-urlencoded'
+};
+
+function setContentTypeIfUnset(headers, value) {
+ if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
+ headers['Content-Type'] = value;
+ }
+}
+
+function getDefaultAdapter() {
+ var adapter;
+ if (typeof XMLHttpRequest !== 'undefined') {
+ // For browsers use XHR adapter
+ adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js");
+ } else if (typeof process !== 'undefined') {
+ // For node use HTTP adapter
+ adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js");
+ }
+ return adapter;
+}
+
+var defaults = {
+ adapter: getDefaultAdapter(),
+
+ transformRequest: [function transformRequest(data, headers) {
+ normalizeHeaderName(headers, 'Content-Type');
+ if (utils.isFormData(data) ||
+ utils.isArrayBuffer(data) ||
+ utils.isBuffer(data) ||
+ utils.isStream(data) ||
+ utils.isFile(data) ||
+ utils.isBlob(data)
+ ) {
+ return data;
+ }
+ if (utils.isArrayBufferView(data)) {
+ return data.buffer;
+ }
+ if (utils.isURLSearchParams(data)) {
+ setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
+ return data.toString();
+ }
+ if (utils.isObject(data)) {
+ setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
+ return JSON.stringify(data);
+ }
+ return data;
+ }],
+
+ transformResponse: [function transformResponse(data) {
+ /*eslint no-param-reassign:0*/
+ if (typeof data === 'string') {
+ try {
+ data = JSON.parse(data);
+ } catch (e) { /* Ignore */ }
+ }
+ return data;
+ }],
+
+ /**
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
+ * timeout is not created.
+ */
+ timeout: 0,
+
+ xsrfCookieName: 'XSRF-TOKEN',
+ xsrfHeaderName: 'X-XSRF-TOKEN',
+
+ maxContentLength: -1,
+
+ validateStatus: function validateStatus(status) {
+ return status >= 200 && status < 300;
+ }
+};
+
+defaults.headers = {
+ common: {
+ 'Accept': 'application/json, text/plain, */*'
+ }
+};
+
+utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
+ defaults.headers[method] = {};
+});
+
+utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
+ defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
+});
+
+module.exports = defaults;
+
+/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node-libs-browser/node_modules/process/browser.js */ "./node_modules/node-libs-browser/node_modules/process/browser.js")))
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/helpers/bind.js":
+/*!************************************************!*\
+ !*** ./node_modules/axios/lib/helpers/bind.js ***!
+ \************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+module.exports = function bind(fn, thisArg) {
+ return function wrap() {
+ var args = new Array(arguments.length);
+ for (var i = 0; i < args.length; i++) {
+ args[i] = arguments[i];
+ }
+ return fn.apply(thisArg, args);
+ };
+};
+
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/helpers/btoa.js":
+/*!************************************************!*\
+ !*** ./node_modules/axios/lib/helpers/btoa.js ***!
+ \************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+// btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
+
+var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
+
+function E() {
+ this.message = 'String contains an invalid character';
+}
+E.prototype = new Error;
+E.prototype.code = 5;
+E.prototype.name = 'InvalidCharacterError';
+
+function btoa(input) {
+ var str = String(input);
+ var output = '';
+ for (
+ // initialize result and counter
+ var block, charCode, idx = 0, map = chars;
+ // if the next str index does not exist:
+ // change the mapping table to "="
+ // check if d has no fractional digits
+ str.charAt(idx | 0) || (map = '=', idx % 1);
+ // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
+ output += map.charAt(63 & block >> 8 - idx % 1 * 8)
+ ) {
+ charCode = str.charCodeAt(idx += 3 / 4);
+ if (charCode > 0xFF) {
+ throw new E();
+ }
+ block = block << 8 | charCode;
+ }
+ return output;
+}
+
+module.exports = btoa;
+
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/helpers/buildURL.js":
+/*!****************************************************!*\
+ !*** ./node_modules/axios/lib/helpers/buildURL.js ***!
+ \****************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
+
+function encode(val) {
+ return encodeURIComponent(val).
+ replace(/%40/gi, '@').
+ replace(/%3A/gi, ':').
+ replace(/%24/g, '$').
+ replace(/%2C/gi, ',').
+ replace(/%20/g, '+').
+ replace(/%5B/gi, '[').
+ replace(/%5D/gi, ']');
+}
+
+/**
+ * Build a URL by appending params to the end
+ *
+ * @param {string} url The base of the url (e.g., http://www.google.com)
+ * @param {object} [params] The params to be appended
+ * @returns {string} The formatted url
+ */
+module.exports = function buildURL(url, params, paramsSerializer) {
+ /*eslint no-param-reassign:0*/
+ if (!params) {
+ return url;
+ }
+
+ var serializedParams;
+ if (paramsSerializer) {
+ serializedParams = paramsSerializer(params);
+ } else if (utils.isURLSearchParams(params)) {
+ serializedParams = params.toString();
+ } else {
+ var parts = [];
+
+ utils.forEach(params, function serialize(val, key) {
+ if (val === null || typeof val === 'undefined') {
+ return;
+ }
+
+ if (utils.isArray(val)) {
+ key = key + '[]';
+ } else {
+ val = [val];
+ }
+
+ utils.forEach(val, function parseValue(v) {
+ if (utils.isDate(v)) {
+ v = v.toISOString();
+ } else if (utils.isObject(v)) {
+ v = JSON.stringify(v);
+ }
+ parts.push(encode(key) + '=' + encode(v));
+ });
+ });
+
+ serializedParams = parts.join('&');
+ }
+
+ if (serializedParams) {
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
+ }
+
+ return url;
+};
+
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/helpers/combineURLs.js":
+/*!*******************************************************!*\
+ !*** ./node_modules/axios/lib/helpers/combineURLs.js ***!
+ \*******************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+/**
+ * Creates a new URL by combining the specified URLs
+ *
+ * @param {string} baseURL The base URL
+ * @param {string} relativeURL The relative URL
+ * @returns {string} The combined URL
+ */
+module.exports = function combineURLs(baseURL, relativeURL) {
+ return relativeURL
+ ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
+ : baseURL;
+};
+
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/helpers/cookies.js":
+/*!***************************************************!*\
+ !*** ./node_modules/axios/lib/helpers/cookies.js ***!
+ \***************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
+
+module.exports = (
+ utils.isStandardBrowserEnv() ?
+
+ // Standard browser envs support document.cookie
+ (function standardBrowserEnv() {
+ return {
+ write: function write(name, value, expires, path, domain, secure) {
+ var cookie = [];
+ cookie.push(name + '=' + encodeURIComponent(value));
+
+ if (utils.isNumber(expires)) {
+ cookie.push('expires=' + new Date(expires).toGMTString());
+ }
+
+ if (utils.isString(path)) {
+ cookie.push('path=' + path);
+ }
+
+ if (utils.isString(domain)) {
+ cookie.push('domain=' + domain);
+ }
+
+ if (secure === true) {
+ cookie.push('secure');
+ }
+
+ document.cookie = cookie.join('; ');
+ },
+
+ read: function read(name) {
+ var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
+ return (match ? decodeURIComponent(match[3]) : null);
+ },
+
+ remove: function remove(name) {
+ this.write(name, '', Date.now() - 86400000);
+ }
+ };
+ })() :
+
+ // Non standard browser env (web workers, react-native) lack needed support.
+ (function nonStandardBrowserEnv() {
+ return {
+ write: function write() {},
+ read: function read() { return null; },
+ remove: function remove() {}
+ };
+ })()
+);
+
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js":
+/*!*********************************************************!*\
+ !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***!
+ \*********************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+/**
+ * Determines whether the specified URL is absolute
+ *
+ * @param {string} url The URL to test
+ * @returns {boolean} True if the specified URL is absolute, otherwise false
+ */
+module.exports = function isAbsoluteURL(url) {
+ // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL).
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
+ // by any combination of letters, digits, plus, period, or hyphen.
+ return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
+};
+
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js":
+/*!***********************************************************!*\
+ !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***!
+ \***********************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
+
+module.exports = (
+ utils.isStandardBrowserEnv() ?
+
+ // Standard browser envs have full support of the APIs needed to test
+ // whether the request URL is of the same origin as current location.
+ (function standardBrowserEnv() {
+ var msie = /(msie|trident)/i.test(navigator.userAgent);
+ var urlParsingNode = document.createElement('a');
+ var originURL;
+
+ /**
+ * Parse a URL to discover it's components
+ *
+ * @param {String} url The URL to be parsed
+ * @returns {Object}
+ */
+ function resolveURL(url) {
+ var href = url;
+
+ if (msie) {
+ // IE needs attribute set twice to normalize properties
+ urlParsingNode.setAttribute('href', href);
+ href = urlParsingNode.href;
+ }
+
+ urlParsingNode.setAttribute('href', href);
+
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
+ return {
+ href: urlParsingNode.href,
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
+ host: urlParsingNode.host,
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
+ hostname: urlParsingNode.hostname,
+ port: urlParsingNode.port,
+ pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
+ urlParsingNode.pathname :
+ '/' + urlParsingNode.pathname
+ };
+ }
+
+ originURL = resolveURL(window.location.href);
+
+ /**
+ * Determine if a URL shares the same origin as the current location
+ *
+ * @param {String} requestURL The URL to test
+ * @returns {boolean} True if URL shares the same origin, otherwise false
+ */
+ return function isURLSameOrigin(requestURL) {
+ var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
+ return (parsed.protocol === originURL.protocol &&
+ parsed.host === originURL.host);
+ };
+ })() :
+
+ // Non standard browser envs (web workers, react-native) lack needed support.
+ (function nonStandardBrowserEnv() {
+ return function isURLSameOrigin() {
+ return true;
+ };
+ })()
+);
+
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js":
+/*!***************************************************************!*\
+ !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***!
+ \***************************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
+
+module.exports = function normalizeHeaderName(headers, normalizedName) {
+ utils.forEach(headers, function processHeader(value, name) {
+ if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
+ headers[normalizedName] = value;
+ delete headers[name];
+ }
+ });
+};
+
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/helpers/parseHeaders.js":
+/*!********************************************************!*\
+ !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***!
+ \********************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
+
+// Headers whose duplicates are ignored by node
+// c.f. https://nodejs.org/api/http.html#http_message_headers
+var ignoreDuplicateOf = [
+ 'age', 'authorization', 'content-length', 'content-type', 'etag',
+ 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
+ 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
+ 'referer', 'retry-after', 'user-agent'
+];
+
+/**
+ * Parse headers into an object
+ *
+ * ```
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
+ * Content-Type: application/json
+ * Connection: keep-alive
+ * Transfer-Encoding: chunked
+ * ```
+ *
+ * @param {String} headers Headers needing to be parsed
+ * @returns {Object} Headers parsed into an object
+ */
+module.exports = function parseHeaders(headers) {
+ var parsed = {};
+ var key;
+ var val;
+ var i;
+
+ if (!headers) { return parsed; }
+
+ utils.forEach(headers.split('\n'), function parser(line) {
+ i = line.indexOf(':');
+ key = utils.trim(line.substr(0, i)).toLowerCase();
+ val = utils.trim(line.substr(i + 1));
+
+ if (key) {
+ if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
+ return;
+ }
+ if (key === 'set-cookie') {
+ parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
+ } else {
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
+ }
+ }
+ });
+
+ return parsed;
+};
+
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/helpers/spread.js":
+/*!**************************************************!*\
+ !*** ./node_modules/axios/lib/helpers/spread.js ***!
+ \**************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+/**
+ * Syntactic sugar for invoking a function and expanding an array for arguments.
+ *
+ * Common use case would be to use `Function.prototype.apply`.
+ *
+ * ```js
+ * function f(x, y, z) {}
+ * var args = [1, 2, 3];
+ * f.apply(null, args);
+ * ```
+ *
+ * With `spread` this example can be re-written.
+ *
+ * ```js
+ * spread(function(x, y, z) {})([1, 2, 3]);
+ * ```
+ *
+ * @param {Function} callback
+ * @returns {Function}
+ */
+module.exports = function spread(callback) {
+ return function wrap(arr) {
+ return callback.apply(null, arr);
+ };
+};
+
+
+/***/ }),
+
+/***/ "./node_modules/axios/lib/utils.js":
+/*!*****************************************!*\
+ !*** ./node_modules/axios/lib/utils.js ***!
+ \*****************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
+var isBuffer = __webpack_require__(/*! is-buffer */ "./node_modules/is-buffer/index.js");
+
+/*global toString:true*/
+
+// utils is a library of generic helper functions non-specific to axios
+
+var toString = Object.prototype.toString;
+
+/**
+ * Determine if a value is an Array
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is an Array, otherwise false
+ */
+function isArray(val) {
+ return toString.call(val) === '[object Array]';
+}
+
+/**
+ * Determine if a value is an ArrayBuffer
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is an ArrayBuffer, otherwise false
+ */
+function isArrayBuffer(val) {
+ return toString.call(val) === '[object ArrayBuffer]';
+}
+
+/**
+ * Determine if a value is a FormData
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is an FormData, otherwise false
+ */
+function isFormData(val) {
+ return (typeof FormData !== 'undefined') && (val instanceof FormData);
+}
+
+/**
+ * Determine if a value is a view on an ArrayBuffer
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
+ */
+function isArrayBufferView(val) {
+ var result;
+ if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
+ result = ArrayBuffer.isView(val);
+ } else {
+ result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
+ }
+ return result;
+}
+
+/**
+ * Determine if a value is a String
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a String, otherwise false
+ */
+function isString(val) {
+ return typeof val === 'string';
+}
+
+/**
+ * Determine if a value is a Number
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a Number, otherwise false
+ */
+function isNumber(val) {
+ return typeof val === 'number';
+}
+
+/**
+ * Determine if a value is undefined
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if the value is undefined, otherwise false
+ */
+function isUndefined(val) {
+ return typeof val === 'undefined';
+}
+
+/**
+ * Determine if a value is an Object
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is an Object, otherwise false
+ */
+function isObject(val) {
+ return val !== null && typeof val === 'object';
+}
+
+/**
+ * Determine if a value is a Date
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a Date, otherwise false
+ */
+function isDate(val) {
+ return toString.call(val) === '[object Date]';
+}
+
+/**
+ * Determine if a value is a File
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a File, otherwise false
+ */
+function isFile(val) {
+ return toString.call(val) === '[object File]';
+}
+
+/**
+ * Determine if a value is a Blob
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a Blob, otherwise false
+ */
+function isBlob(val) {
+ return toString.call(val) === '[object Blob]';
+}
+
+/**
+ * Determine if a value is a Function
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a Function, otherwise false
+ */
+function isFunction(val) {
+ return toString.call(val) === '[object Function]';
+}
+
+/**
+ * Determine if a value is a Stream
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a Stream, otherwise false
+ */
+function isStream(val) {
+ return isObject(val) && isFunction(val.pipe);
+}
+
+/**
+ * Determine if a value is a URLSearchParams object
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a URLSearchParams object, otherwise false
+ */
+function isURLSearchParams(val) {
+ return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
+}
+
+/**
+ * Trim excess whitespace off the beginning and end of a string
+ *
+ * @param {String} str The String to trim
+ * @returns {String} The String freed of excess whitespace
+ */
+function trim(str) {
+ return str.replace(/^\s*/, '').replace(/\s*$/, '');
+}
+
+/**
+ * Determine if we're running in a standard browser environment
+ *
+ * This allows axios to run in a web worker, and react-native.
+ * Both environments support XMLHttpRequest, but not fully standard globals.
+ *
+ * web workers:
+ * typeof window -> undefined
+ * typeof document -> undefined
+ *
+ * react-native:
+ * navigator.product -> 'ReactNative'
+ */
+function isStandardBrowserEnv() {
+ if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
+ return false;
+ }
+ return (
+ typeof window !== 'undefined' &&
+ typeof document !== 'undefined'
+ );
+}
+
+/**
+ * Iterate over an Array or an Object invoking a function for each item.
+ *
+ * If `obj` is an Array callback will be called passing
+ * the value, index, and complete array for each item.
+ *
+ * If 'obj' is an Object callback will be called passing
+ * the value, key, and complete object for each property.
+ *
+ * @param {Object|Array} obj The object to iterate
+ * @param {Function} fn The callback to invoke for each item
+ */
+function forEach(obj, fn) {
+ // Don't bother if no value provided
+ if (obj === null || typeof obj === 'undefined') {
+ return;
+ }
+
+ // Force an array if not already something iterable
+ if (typeof obj !== 'object') {
+ /*eslint no-param-reassign:0*/
+ obj = [obj];
+ }
+
+ if (isArray(obj)) {
+ // Iterate over array values
+ for (var i = 0, l = obj.length; i < l; i++) {
+ fn.call(null, obj[i], i, obj);
+ }
+ } else {
+ // Iterate over object keys
+ for (var key in obj) {
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
+ fn.call(null, obj[key], key, obj);
+ }
+ }
+ }
+}
+
+/**
+ * Accepts varargs expecting each argument to be an object, then
+ * immutably merges the properties of each object and returns result.
+ *
+ * When multiple objects contain the same key the later object in
+ * the arguments list will take precedence.
+ *
+ * Example:
+ *
+ * ```js
+ * var result = merge({foo: 123}, {foo: 456});
+ * console.log(result.foo); // outputs 456
+ * ```
+ *
+ * @param {Object} obj1 Object to merge
+ * @returns {Object} Result of all merge properties
+ */
+function merge(/* obj1, obj2, obj3, ... */) {
+ var result = {};
+ function assignValue(val, key) {
+ if (typeof result[key] === 'object' && typeof val === 'object') {
+ result[key] = merge(result[key], val);
+ } else {
+ result[key] = val;
+ }
+ }
+
+ for (var i = 0, l = arguments.length; i < l; i++) {
+ forEach(arguments[i], assignValue);
+ }
+ return result;
+}
+
+/**
+ * Extends object a by mutably adding to it the properties of object b.
+ *
+ * @param {Object} a The object to be extended
+ * @param {Object} b The object to copy properties from
+ * @param {Object} thisArg The object to bind function to
+ * @return {Object} The resulting value of object a
+ */
+function extend(a, b, thisArg) {
+ forEach(b, function assignValue(val, key) {
+ if (thisArg && typeof val === 'function') {
+ a[key] = bind(val, thisArg);
+ } else {
+ a[key] = val;
+ }
+ });
+ return a;
+}
+
+module.exports = {
+ isArray: isArray,
+ isArrayBuffer: isArrayBuffer,
+ isBuffer: isBuffer,
+ isFormData: isFormData,
+ isArrayBufferView: isArrayBufferView,
+ isString: isString,
+ isNumber: isNumber,
+ isObject: isObject,
+ isUndefined: isUndefined,
+ isDate: isDate,
+ isFile: isFile,
+ isBlob: isBlob,
+ isFunction: isFunction,
+ isStream: isStream,
+ isURLSearchParams: isURLSearchParams,
+ isStandardBrowserEnv: isStandardBrowserEnv,
+ forEach: forEach,
+ merge: merge,
+ extend: extend,
+ trim: trim
+};
+
+
+/***/ }),
+
+/***/ "./node_modules/classnames/index.js":
+/*!******************************************!*\
+ !*** ./node_modules/classnames/index.js ***!
+ \******************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
+ Copyright (c) 2017 Jed Watson.
+ Licensed under the MIT License (MIT), see
+ http://jedwatson.github.io/classnames
+*/
+/* global define */
+
+(function () {
+ 'use strict';
+
+ var hasOwn = {}.hasOwnProperty;
+
+ function classNames () {
+ var classes = [];
+
+ for (var i = 0; i < arguments.length; i++) {
+ var arg = arguments[i];
+ if (!arg) continue;
+
+ var argType = typeof arg;
+
+ if (argType === 'string' || argType === 'number') {
+ classes.push(arg);
+ } else if (Array.isArray(arg) && arg.length) {
+ var inner = classNames.apply(null, arg);
+ if (inner) {
+ classes.push(inner);
+ }
+ } else if (argType === 'object') {
+ for (var key in arg) {
+ if (hasOwn.call(arg, key) && arg[key]) {
+ classes.push(key);
+ }
+ }
+ }
+ }
+
+ return classes.join(' ');
+ }
+
+ if ( true && module.exports) {
+ classNames.default = classNames;
+ module.exports = classNames;
+ } else if (true) {
+ // register as 'classnames', consistent with npm package name
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
+ return classNames;
+ }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
+ } else {}
+}());
+
+
+/***/ }),
+
+/***/ "./node_modules/history/es/DOMUtils.js":
+/*!*********************************************!*\
+ !*** ./node_modules/history/es/DOMUtils.js ***!
+ \*********************************************/
+/*! exports provided: canUseDOM, addEventListener, removeEventListener, getConfirmation, supportsHistory, supportsPopStateOnHashChange, supportsGoWithoutReloadUsingHash, isExtraneousPopstateEvent */
+/*! all exports used */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "canUseDOM", function() { return canUseDOM; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addEventListener", function() { return addEventListener; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeEventListener", function() { return removeEventListener; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getConfirmation", function() { return getConfirmation; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "supportsHistory", function() { return supportsHistory; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "supportsPopStateOnHashChange", function() { return supportsPopStateOnHashChange; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "supportsGoWithoutReloadUsingHash", function() { return supportsGoWithoutReloadUsingHash; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isExtraneousPopstateEvent", function() { return isExtraneousPopstateEvent; });
+var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
+
+var addEventListener = function addEventListener(node, event, listener) {
+ return node.addEventListener ? node.addEventListener(event, listener, false) : node.attachEvent('on' + event, listener);
+};
+
+var removeEventListener = function removeEventListener(node, event, listener) {
+ return node.removeEventListener ? node.removeEventListener(event, listener, false) : node.detachEvent('on' + event, listener);
+};
+
+var getConfirmation = function getConfirmation(message, callback) {
+ return callback(window.confirm(message));
+}; // eslint-disable-line no-alert
+
+/**
+ * Returns true if the HTML5 history API is supported. Taken from Modernizr.
+ *
+ * https://github.com/Modernizr/Modernizr/blob/master/LICENSE
+ * https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js
+ * changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586
+ */
+var supportsHistory = function supportsHistory() {
+ var ua = window.navigator.userAgent;
+
+ if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false;
+
+ return window.history && 'pushState' in window.history;
+};
+
+/**
+ * Returns true if browser fires popstate on hash change.
+ * IE10 and IE11 do not.
+ */
+var supportsPopStateOnHashChange = function supportsPopStateOnHashChange() {
+ return window.navigator.userAgent.indexOf('Trident') === -1;
+};
+
+/**
+ * Returns false if using go(n) with hash history causes a full page reload.
+ */
+var supportsGoWithoutReloadUsingHash = function supportsGoWithoutReloadUsingHash() {
+ return window.navigator.userAgent.indexOf('Firefox') === -1;
+};
+
+/**
+ * Returns true if a given popstate event is an extraneous WebKit event.
+ * Accounts for the fact that Chrome on iOS fires real popstate events
+ * containing undefined state when pressing the back button.
+ */
+var isExtraneousPopstateEvent = function isExtraneousPopstateEvent(event) {
+ return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1;
+};
+
+/***/ }),
+
+/***/ "./node_modules/history/es/LocationUtils.js":
+/*!**************************************************!*\
+ !*** ./node_modules/history/es/LocationUtils.js ***!
+ \**************************************************/
+/*! exports provided: createLocation, locationsAreEqual */
+/*! all exports used */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createLocation", function() { return createLocation; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "locationsAreEqual", function() { return locationsAreEqual; });
+/* harmony import */ var resolve_pathname__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! resolve-pathname */ "./node_modules/resolve-pathname/index.js");
+/* harmony import */ var value_equal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! value-equal */ "./node_modules/value-equal/index.js");
+/* harmony import */ var _PathUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./PathUtils */ "./node_modules/history/es/PathUtils.js");
+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 createLocation = function createLocation(path, state, key, currentLocation) {
+ var location = void 0;
+ if (typeof path === 'string') {
+ // Two-arg form: push(path, state)
+ location = Object(_PathUtils__WEBPACK_IMPORTED_MODULE_2__["parsePath"])(path);
+ location.state = state;
+ } else {
+ // One-arg form: push(location)
+ location = _extends({}, path);
+
+ if (location.pathname === undefined) location.pathname = '';
+
+ if (location.search) {
+ if (location.search.charAt(0) !== '?') location.search = '?' + location.search;
+ } else {
+ location.search = '';
+ }
+
+ if (location.hash) {
+ if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash;
+ } else {
+ location.hash = '';
+ }
+
+ if (state !== undefined && location.state === undefined) location.state = state;
+ }
+
+ try {
+ location.pathname = decodeURI(location.pathname);
+ } catch (e) {
+ if (e instanceof URIError) {
+ throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.');
+ } else {
+ throw e;
+ }
+ }
+
+ if (key) location.key = key;
+
+ if (currentLocation) {
+ // Resolve incomplete/relative pathname relative to current location.
+ if (!location.pathname) {
+ location.pathname = currentLocation.pathname;
+ } else if (location.pathname.charAt(0) !== '/') {
+ location.pathname = Object(resolve_pathname__WEBPACK_IMPORTED_MODULE_0__["default"])(location.pathname, currentLocation.pathname);
+ }
+ } else {
+ // When there is no prior location and pathname is empty, set it to /
+ if (!location.pathname) {
+ location.pathname = '/';
+ }
+ }
+
+ return location;
+};
+
+var locationsAreEqual = function locationsAreEqual(a, b) {
+ return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash && a.key === b.key && Object(value_equal__WEBPACK_IMPORTED_MODULE_1__["default"])(a.state, b.state);
+};
+
+/***/ }),
+
+/***/ "./node_modules/history/es/PathUtils.js":
+/*!**********************************************!*\
+ !*** ./node_modules/history/es/PathUtils.js ***!
+ \**********************************************/
+/*! exports provided: addLeadingSlash, stripLeadingSlash, hasBasename, stripBasename, stripTrailingSlash, parsePath, createPath */
+/*! all exports used */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addLeadingSlash", function() { return addLeadingSlash; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stripLeadingSlash", function() { return stripLeadingSlash; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasBasename", function() { return hasBasename; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stripBasename", function() { return stripBasename; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stripTrailingSlash", function() { return stripTrailingSlash; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parsePath", function() { return parsePath; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPath", function() { return createPath; });
+var addLeadingSlash = function addLeadingSlash(path) {
+ return path.charAt(0) === '/' ? path : '/' + path;
+};
+
+var stripLeadingSlash = function stripLeadingSlash(path) {
+ return path.charAt(0) === '/' ? path.substr(1) : path;
+};
+
+var hasBasename = function hasBasename(path, prefix) {
+ return new RegExp('^' + prefix + '(\\/|\\?|#|$)', 'i').test(path);
+};
+
+var stripBasename = function stripBasename(path, prefix) {
+ return hasBasename(path, prefix) ? path.substr(prefix.length) : path;
+};
+
+var stripTrailingSlash = function stripTrailingSlash(path) {
+ return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path;
+};
+
+var parsePath = function parsePath(path) {
+ var pathname = path || '/';
+ var search = '';
+ var hash = '';
+
+ var hashIndex = pathname.indexOf('#');
+ if (hashIndex !== -1) {
+ hash = pathname.substr(hashIndex);
+ pathname = pathname.substr(0, hashIndex);
+ }
+
+ var searchIndex = pathname.indexOf('?');
+ if (searchIndex !== -1) {
+ search = pathname.substr(searchIndex);
+ pathname = pathname.substr(0, searchIndex);
+ }
+
+ return {
+ pathname: pathname,
+ search: search === '?' ? '' : search,
+ hash: hash === '#' ? '' : hash
+ };
+};
+
+var createPath = function createPath(location) {
+ var pathname = location.pathname,
+ search = location.search,
+ hash = location.hash;
+
+
+ var path = pathname || '/';
+
+ if (search && search !== '?') path += search.charAt(0) === '?' ? search : '?' + search;
+
+ if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : '#' + hash;
+
+ return path;
+};
+
+/***/ }),
+
+/***/ "./node_modules/history/es/createBrowserHistory.js":
+/*!*********************************************************!*\
+ !*** ./node_modules/history/es/createBrowserHistory.js ***!
+ \*********************************************************/
+/*! exports provided: default */
+/*! all exports used */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! warning */ "./node_modules/warning/browser.js");
+/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(warning__WEBPACK_IMPORTED_MODULE_0__);
+/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! invariant */ "./node_modules/invariant/browser.js");
+/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(invariant__WEBPACK_IMPORTED_MODULE_1__);
+/* harmony import */ var _LocationUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./LocationUtils */ "./node_modules/history/es/LocationUtils.js");
+/* harmony import */ var _PathUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./PathUtils */ "./node_modules/history/es/PathUtils.js");
+/* harmony import */ var _createTransitionManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./createTransitionManager */ "./node_modules/history/es/createTransitionManager.js");
+/* harmony import */ var _DOMUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./DOMUtils */ "./node_modules/history/es/DOMUtils.js");
+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; };
+
+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 PopStateEvent = 'popstate';
+var HashChangeEvent = 'hashchange';
+
+var getHistoryState = function getHistoryState() {
+ try {
+ return window.history.state || {};
+ } catch (e) {
+ // IE 11 sometimes throws when accessing window.history.state
+ // See https://github.com/ReactTraining/history/pull/289
+ return {};
+ }
+};
+
+/**
+ * Creates a history object that uses the HTML5 history API including
+ * pushState, replaceState, and the popstate event.
+ */
+var createBrowserHistory = function createBrowserHistory() {
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+
+ invariant__WEBPACK_IMPORTED_MODULE_1___default()(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["canUseDOM"], 'Browser history needs a DOM');
+
+ var globalHistory = window.history;
+ var canUseHistory = Object(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["supportsHistory"])();
+ var needsHashChangeListener = !Object(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["supportsPopStateOnHashChange"])();
+
+ var _props$forceRefresh = props.forceRefresh,
+ forceRefresh = _props$forceRefresh === undefined ? false : _props$forceRefresh,
+ _props$getUserConfirm = props.getUserConfirmation,
+ getUserConfirmation = _props$getUserConfirm === undefined ? _DOMUtils__WEBPACK_IMPORTED_MODULE_5__["getConfirmation"] : _props$getUserConfirm,
+ _props$keyLength = props.keyLength,
+ keyLength = _props$keyLength === undefined ? 6 : _props$keyLength;
+
+ var basename = props.basename ? Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["stripTrailingSlash"])(Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["addLeadingSlash"])(props.basename)) : '';
+
+ var getDOMLocation = function getDOMLocation(historyState) {
+ var _ref = historyState || {},
+ key = _ref.key,
+ state = _ref.state;
+
+ var _window$location = window.location,
+ pathname = _window$location.pathname,
+ search = _window$location.search,
+ hash = _window$location.hash;
+
+
+ var path = pathname + search + hash;
+
+ warning__WEBPACK_IMPORTED_MODULE_0___default()(!basename || Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["hasBasename"])(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".');
+
+ if (basename) path = Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["stripBasename"])(path, basename);
+
+ return Object(_LocationUtils__WEBPACK_IMPORTED_MODULE_2__["createLocation"])(path, state, key);
+ };
+
+ var createKey = function createKey() {
+ return Math.random().toString(36).substr(2, keyLength);
+ };
+
+ var transitionManager = Object(_createTransitionManager__WEBPACK_IMPORTED_MODULE_4__["default"])();
+
+ var setState = function setState(nextState) {
+ _extends(history, nextState);
+
+ history.length = globalHistory.length;
+
+ transitionManager.notifyListeners(history.location, history.action);
+ };
+
+ var handlePopState = function handlePopState(event) {
+ // Ignore extraneous popstate events in WebKit.
+ if (Object(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["isExtraneousPopstateEvent"])(event)) return;
+
+ handlePop(getDOMLocation(event.state));
+ };
+
+ var handleHashChange = function handleHashChange() {
+ handlePop(getDOMLocation(getHistoryState()));
+ };
+
+ var forceNextPop = false;
+
+ var handlePop = function handlePop(location) {
+ if (forceNextPop) {
+ forceNextPop = false;
+ setState();
+ } else {
+ var action = 'POP';
+
+ transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
+ if (ok) {
+ setState({ action: action, location: location });
+ } else {
+ revertPop(location);
+ }
+ });
+ }
+ };
+
+ var revertPop = function revertPop(fromLocation) {
+ var toLocation = history.location;
+
+ // TODO: We could probably make this more reliable by
+ // keeping a list of keys we've seen in sessionStorage.
+ // Instead, we just default to 0 for keys we don't know.
+
+ var toIndex = allKeys.indexOf(toLocation.key);
+
+ if (toIndex === -1) toIndex = 0;
+
+ var fromIndex = allKeys.indexOf(fromLocation.key);
+
+ if (fromIndex === -1) fromIndex = 0;
+
+ var delta = toIndex - fromIndex;
+
+ if (delta) {
+ forceNextPop = true;
+ go(delta);
+ }
+ };
+
+ var initialLocation = getDOMLocation(getHistoryState());
+ var allKeys = [initialLocation.key];
+
+ // Public interface
+
+ var createHref = function createHref(location) {
+ return basename + Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["createPath"])(location);
+ };
+
+ var push = function push(path, state) {
+ warning__WEBPACK_IMPORTED_MODULE_0___default()(!((typeof path === 'undefined' ? 'undefined' : _typeof(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored');
+
+ var action = 'PUSH';
+ var location = Object(_LocationUtils__WEBPACK_IMPORTED_MODULE_2__["createLocation"])(path, state, createKey(), history.location);
+
+ transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
+ if (!ok) return;
+
+ var href = createHref(location);
+ var key = location.key,
+ state = location.state;
+
+
+ if (canUseHistory) {
+ globalHistory.pushState({ key: key, state: state }, null, href);
+
+ if (forceRefresh) {
+ window.location.href = href;
+ } else {
+ var prevIndex = allKeys.indexOf(history.location.key);
+ var nextKeys = allKeys.slice(0, prevIndex === -1 ? 0 : prevIndex + 1);
+
+ nextKeys.push(location.key);
+ allKeys = nextKeys;
+
+ setState({ action: action, location: location });
+ }
+ } else {
+ warning__WEBPACK_IMPORTED_MODULE_0___default()(state === undefined, 'Browser history cannot push state in browsers that do not support HTML5 history');
+
+ window.location.href = href;
+ }
+ });
+ };
+
+ var replace = function replace(path, state) {
+ warning__WEBPACK_IMPORTED_MODULE_0___default()(!((typeof path === 'undefined' ? 'undefined' : _typeof(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored');
+
+ var action = 'REPLACE';
+ var location = Object(_LocationUtils__WEBPACK_IMPORTED_MODULE_2__["createLocation"])(path, state, createKey(), history.location);
+
+ transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
+ if (!ok) return;
+
+ var href = createHref(location);
+ var key = location.key,
+ state = location.state;
+
+
+ if (canUseHistory) {
+ globalHistory.replaceState({ key: key, state: state }, null, href);
+
+ if (forceRefresh) {
+ window.location.replace(href);
+ } else {
+ var prevIndex = allKeys.indexOf(history.location.key);
+
+ if (prevIndex !== -1) allKeys[prevIndex] = location.key;
+
+ setState({ action: action, location: location });
+ }
+ } else {
+ warning__WEBPACK_IMPORTED_MODULE_0___default()(state === undefined, 'Browser history cannot replace state in browsers that do not support HTML5 history');
+
+ window.location.replace(href);
+ }
+ });
+ };
+
+ var go = function go(n) {
+ globalHistory.go(n);
+ };
+
+ var goBack = function goBack() {
+ return go(-1);
+ };
+
+ var goForward = function goForward() {
+ return go(1);
+ };
+
+ var listenerCount = 0;
+
+ var checkDOMListeners = function checkDOMListeners(delta) {
+ listenerCount += delta;
+
+ if (listenerCount === 1) {
+ Object(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["addEventListener"])(window, PopStateEvent, handlePopState);
+
+ if (needsHashChangeListener) Object(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["addEventListener"])(window, HashChangeEvent, handleHashChange);
+ } else if (listenerCount === 0) {
+ Object(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["removeEventListener"])(window, PopStateEvent, handlePopState);
+
+ if (needsHashChangeListener) Object(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["removeEventListener"])(window, HashChangeEvent, handleHashChange);
+ }
+ };
+
+ var isBlocked = false;
+
+ var block = function block() {
+ var prompt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ var unblock = transitionManager.setPrompt(prompt);
+
+ if (!isBlocked) {
+ checkDOMListeners(1);
+ isBlocked = true;
+ }
+
+ return function () {
+ if (isBlocked) {
+ isBlocked = false;
+ checkDOMListeners(-1);
+ }
+
+ return unblock();
+ };
+ };
+
+ var listen = function listen(listener) {
+ var unlisten = transitionManager.appendListener(listener);
+ checkDOMListeners(1);
+
+ return function () {
+ checkDOMListeners(-1);
+ unlisten();
+ };
+ };
+
+ var history = {
+ length: globalHistory.length,
+ action: 'POP',
+ location: initialLocation,
+ createHref: createHref,
+ push: push,
+ replace: replace,
+ go: go,
+ goBack: goBack,
+ goForward: goForward,
+ block: block,
+ listen: listen
+ };
+
+ return history;
+};
+
+/* harmony default export */ __webpack_exports__["default"] = (createBrowserHistory);
+
+/***/ }),
+
+/***/ "./node_modules/history/es/createHashHistory.js":
+/*!******************************************************!*\
+ !*** ./node_modules/history/es/createHashHistory.js ***!
+ \******************************************************/
+/*! exports provided: default */
+/*! all exports used */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! warning */ "./node_modules/warning/browser.js");
+/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(warning__WEBPACK_IMPORTED_MODULE_0__);
+/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! invariant */ "./node_modules/invariant/browser.js");
+/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(invariant__WEBPACK_IMPORTED_MODULE_1__);
+/* harmony import */ var _LocationUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./LocationUtils */ "./node_modules/history/es/LocationUtils.js");
+/* harmony import */ var _PathUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./PathUtils */ "./node_modules/history/es/PathUtils.js");
+/* harmony import */ var _createTransitionManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./createTransitionManager */ "./node_modules/history/es/createTransitionManager.js");
+/* harmony import */ var _DOMUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./DOMUtils */ "./node_modules/history/es/DOMUtils.js");
+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 HashChangeEvent = 'hashchange';
+
+var HashPathCoders = {
+ hashbang: {
+ encodePath: function encodePath(path) {
+ return path.charAt(0) === '!' ? path : '!/' + Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["stripLeadingSlash"])(path);
+ },
+ decodePath: function decodePath(path) {
+ return path.charAt(0) === '!' ? path.substr(1) : path;
+ }
+ },
+ noslash: {
+ encodePath: _PathUtils__WEBPACK_IMPORTED_MODULE_3__["stripLeadingSlash"],
+ decodePath: _PathUtils__WEBPACK_IMPORTED_MODULE_3__["addLeadingSlash"]
+ },
+ slash: {
+ encodePath: _PathUtils__WEBPACK_IMPORTED_MODULE_3__["addLeadingSlash"],
+ decodePath: _PathUtils__WEBPACK_IMPORTED_MODULE_3__["addLeadingSlash"]
+ }
+};
+
+var getHashPath = function getHashPath() {
+ // We can't use window.location.hash here because it's not
+ // consistent across browsers - Firefox will pre-decode it!
+ var href = window.location.href;
+ var hashIndex = href.indexOf('#');
+ return hashIndex === -1 ? '' : href.substring(hashIndex + 1);
+};
+
+var pushHashPath = function pushHashPath(path) {
+ return window.location.hash = path;
+};
+
+var replaceHashPath = function replaceHashPath(path) {
+ var hashIndex = window.location.href.indexOf('#');
+
+ window.location.replace(window.location.href.slice(0, hashIndex >= 0 ? hashIndex : 0) + '#' + path);
+};
+
+var createHashHistory = function createHashHistory() {
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+
+ invariant__WEBPACK_IMPORTED_MODULE_1___default()(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["canUseDOM"], 'Hash history needs a DOM');
+
+ var globalHistory = window.history;
+ var canGoWithoutReload = Object(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["supportsGoWithoutReloadUsingHash"])();
+
+ var _props$getUserConfirm = props.getUserConfirmation,
+ getUserConfirmation = _props$getUserConfirm === undefined ? _DOMUtils__WEBPACK_IMPORTED_MODULE_5__["getConfirmation"] : _props$getUserConfirm,
+ _props$hashType = props.hashType,
+ hashType = _props$hashType === undefined ? 'slash' : _props$hashType;
+
+ var basename = props.basename ? Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["stripTrailingSlash"])(Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["addLeadingSlash"])(props.basename)) : '';
+
+ var _HashPathCoders$hashT = HashPathCoders[hashType],
+ encodePath = _HashPathCoders$hashT.encodePath,
+ decodePath = _HashPathCoders$hashT.decodePath;
+
+
+ var getDOMLocation = function getDOMLocation() {
+ var path = decodePath(getHashPath());
+
+ warning__WEBPACK_IMPORTED_MODULE_0___default()(!basename || Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["hasBasename"])(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".');
+
+ if (basename) path = Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["stripBasename"])(path, basename);
+
+ return Object(_LocationUtils__WEBPACK_IMPORTED_MODULE_2__["createLocation"])(path);
+ };
+
+ var transitionManager = Object(_createTransitionManager__WEBPACK_IMPORTED_MODULE_4__["default"])();
+
+ var setState = function setState(nextState) {
+ _extends(history, nextState);
+
+ history.length = globalHistory.length;
+
+ transitionManager.notifyListeners(history.location, history.action);
+ };
+
+ var forceNextPop = false;
+ var ignorePath = null;
+
+ var handleHashChange = function handleHashChange() {
+ var path = getHashPath();
+ var encodedPath = encodePath(path);
+
+ if (path !== encodedPath) {
+ // Ensure we always have a properly-encoded hash.
+ replaceHashPath(encodedPath);
+ } else {
+ var location = getDOMLocation();
+ var prevLocation = history.location;
+
+ if (!forceNextPop && Object(_LocationUtils__WEBPACK_IMPORTED_MODULE_2__["locationsAreEqual"])(prevLocation, location)) return; // A hashchange doesn't always == location change.
+
+ if (ignorePath === Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["createPath"])(location)) return; // Ignore this change; we already setState in push/replace.
+
+ ignorePath = null;
+
+ handlePop(location);
+ }
+ };
+
+ var handlePop = function handlePop(location) {
+ if (forceNextPop) {
+ forceNextPop = false;
+ setState();
+ } else {
+ var action = 'POP';
+
+ transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
+ if (ok) {
+ setState({ action: action, location: location });
+ } else {
+ revertPop(location);
+ }
+ });
+ }
+ };
+
+ var revertPop = function revertPop(fromLocation) {
+ var toLocation = history.location;
+
+ // TODO: We could probably make this more reliable by
+ // keeping a list of paths we've seen in sessionStorage.
+ // Instead, we just default to 0 for paths we don't know.
+
+ var toIndex = allPaths.lastIndexOf(Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["createPath"])(toLocation));
+
+ if (toIndex === -1) toIndex = 0;
+
+ var fromIndex = allPaths.lastIndexOf(Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["createPath"])(fromLocation));
+
+ if (fromIndex === -1) fromIndex = 0;
+
+ var delta = toIndex - fromIndex;
+
+ if (delta) {
+ forceNextPop = true;
+ go(delta);
+ }
+ };
+
+ // Ensure the hash is encoded properly before doing anything else.
+ var path = getHashPath();
+ var encodedPath = encodePath(path);
+
+ if (path !== encodedPath) replaceHashPath(encodedPath);
+
+ var initialLocation = getDOMLocation();
+ var allPaths = [Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["createPath"])(initialLocation)];
+
+ // Public interface
+
+ var createHref = function createHref(location) {
+ return '#' + encodePath(basename + Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["createPath"])(location));
+ };
+
+ var push = function push(path, state) {
+ warning__WEBPACK_IMPORTED_MODULE_0___default()(state === undefined, 'Hash history cannot push state; it is ignored');
+
+ var action = 'PUSH';
+ var location = Object(_LocationUtils__WEBPACK_IMPORTED_MODULE_2__["createLocation"])(path, undefined, undefined, history.location);
+
+ transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
+ if (!ok) return;
+
+ var path = Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["createPath"])(location);
+ var encodedPath = encodePath(basename + path);
+ var hashChanged = getHashPath() !== encodedPath;
+
+ if (hashChanged) {
+ // We cannot tell if a hashchange was caused by a PUSH, so we'd
+ // rather setState here and ignore the hashchange. The caveat here
+ // is that other hash histories in the page will consider it a POP.
+ ignorePath = path;
+ pushHashPath(encodedPath);
+
+ var prevIndex = allPaths.lastIndexOf(Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["createPath"])(history.location));
+ var nextPaths = allPaths.slice(0, prevIndex === -1 ? 0 : prevIndex + 1);
+
+ nextPaths.push(path);
+ allPaths = nextPaths;
+
+ setState({ action: action, location: location });
+ } else {
+ warning__WEBPACK_IMPORTED_MODULE_0___default()(false, 'Hash history cannot PUSH the same path; a new entry will not be added to the history stack');
+
+ setState();
+ }
+ });
+ };
+
+ var replace = function replace(path, state) {
+ warning__WEBPACK_IMPORTED_MODULE_0___default()(state === undefined, 'Hash history cannot replace state; it is ignored');
+
+ var action = 'REPLACE';
+ var location = Object(_LocationUtils__WEBPACK_IMPORTED_MODULE_2__["createLocation"])(path, undefined, undefined, history.location);
+
+ transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
+ if (!ok) return;
+
+ var path = Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["createPath"])(location);
+ var encodedPath = encodePath(basename + path);
+ var hashChanged = getHashPath() !== encodedPath;
+
+ if (hashChanged) {
+ // We cannot tell if a hashchange was caused by a REPLACE, so we'd
+ // rather setState here and ignore the hashchange. The caveat here
+ // is that other hash histories in the page will consider it a POP.
+ ignorePath = path;
+ replaceHashPath(encodedPath);
+ }
+
+ var prevIndex = allPaths.indexOf(Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["createPath"])(history.location));
+
+ if (prevIndex !== -1) allPaths[prevIndex] = path;
+
+ setState({ action: action, location: location });
+ });
+ };
+
+ var go = function go(n) {
+ warning__WEBPACK_IMPORTED_MODULE_0___default()(canGoWithoutReload, 'Hash history go(n) causes a full page reload in this browser');
+
+ globalHistory.go(n);
+ };
+
+ var goBack = function goBack() {
+ return go(-1);
+ };
+
+ var goForward = function goForward() {
+ return go(1);
+ };
+
+ var listenerCount = 0;
+
+ var checkDOMListeners = function checkDOMListeners(delta) {
+ listenerCount += delta;
+
+ if (listenerCount === 1) {
+ Object(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["addEventListener"])(window, HashChangeEvent, handleHashChange);
+ } else if (listenerCount === 0) {
+ Object(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["removeEventListener"])(window, HashChangeEvent, handleHashChange);
+ }
+ };
+
+ var isBlocked = false;
+
+ var block = function block() {
+ var prompt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ var unblock = transitionManager.setPrompt(prompt);
+
+ if (!isBlocked) {
+ checkDOMListeners(1);
+ isBlocked = true;
+ }
+
+ return function () {
+ if (isBlocked) {
+ isBlocked = false;
+ checkDOMListeners(-1);
+ }
+
+ return unblock();
+ };
+ };
+
+ var listen = function listen(listener) {
+ var unlisten = transitionManager.appendListener(listener);
+ checkDOMListeners(1);
+
+ return function () {
+ checkDOMListeners(-1);
+ unlisten();
+ };
+ };
+
+ var history = {
+ length: globalHistory.length,
+ action: 'POP',
+ location: initialLocation,
+ createHref: createHref,
+ push: push,
+ replace: replace,
+ go: go,
+ goBack: goBack,
+ goForward: goForward,
+ block: block,
+ listen: listen
+ };
+
+ return history;
+};
+
+/* harmony default export */ __webpack_exports__["default"] = (createHashHistory);
+
+/***/ }),
+
+/***/ "./node_modules/history/es/createMemoryHistory.js":
+/*!********************************************************!*\
+ !*** ./node_modules/history/es/createMemoryHistory.js ***!
+ \********************************************************/
+/*! exports provided: default */
+/*! all exports used */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! warning */ "./node_modules/warning/browser.js");
+/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(warning__WEBPACK_IMPORTED_MODULE_0__);
+/* harmony import */ var _PathUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./PathUtils */ "./node_modules/history/es/PathUtils.js");
+/* harmony import */ var _LocationUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./LocationUtils */ "./node_modules/history/es/LocationUtils.js");
+/* harmony import */ var _createTransitionManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./createTransitionManager */ "./node_modules/history/es/createTransitionManager.js");
+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; };
+
+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 clamp = function clamp(n, lowerBound, upperBound) {
+ return Math.min(Math.max(n, lowerBound), upperBound);
+};
+
+/**
+ * Creates a history object that stores locations in memory.
+ */
+var createMemoryHistory = function createMemoryHistory() {
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+ var getUserConfirmation = props.getUserConfirmation,
+ _props$initialEntries = props.initialEntries,
+ initialEntries = _props$initialEntries === undefined ? ['/'] : _props$initialEntries,
+ _props$initialIndex = props.initialIndex,
+ initialIndex = _props$initialIndex === undefined ? 0 : _props$initialIndex,
+ _props$keyLength = props.keyLength,
+ keyLength = _props$keyLength === undefined ? 6 : _props$keyLength;
+
+
+ var transitionManager = Object(_createTransitionManager__WEBPACK_IMPORTED_MODULE_3__["default"])();
+
+ var setState = function setState(nextState) {
+ _extends(history, nextState);
+
+ history.length = history.entries.length;
+
+ transitionManager.notifyListeners(history.location, history.action);
+ };
+
+ var createKey = function createKey() {
+ return Math.random().toString(36).substr(2, keyLength);
+ };
+
+ var index = clamp(initialIndex, 0, initialEntries.length - 1);
+ var entries = initialEntries.map(function (entry) {
+ return typeof entry === 'string' ? Object(_LocationUtils__WEBPACK_IMPORTED_MODULE_2__["createLocation"])(entry, undefined, createKey()) : Object(_LocationUtils__WEBPACK_IMPORTED_MODULE_2__["createLocation"])(entry, undefined, entry.key || createKey());
+ });
+
+ // Public interface
+
+ var createHref = _PathUtils__WEBPACK_IMPORTED_MODULE_1__["createPath"];
+
+ var push = function push(path, state) {
+ warning__WEBPACK_IMPORTED_MODULE_0___default()(!((typeof path === 'undefined' ? 'undefined' : _typeof(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored');
+
+ var action = 'PUSH';
+ var location = Object(_LocationUtils__WEBPACK_IMPORTED_MODULE_2__["createLocation"])(path, state, createKey(), history.location);
+
+ transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
+ if (!ok) return;
+
+ var prevIndex = history.index;
+ var nextIndex = prevIndex + 1;
+
+ var nextEntries = history.entries.slice(0);
+ if (nextEntries.length > nextIndex) {
+ nextEntries.splice(nextIndex, nextEntries.length - nextIndex, location);
+ } else {
+ nextEntries.push(location);
+ }
+
+ setState({
+ action: action,
+ location: location,
+ index: nextIndex,
+ entries: nextEntries
+ });
+ });
+ };
+
+ var replace = function replace(path, state) {
+ warning__WEBPACK_IMPORTED_MODULE_0___default()(!((typeof path === 'undefined' ? 'undefined' : _typeof(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored');
+
+ var action = 'REPLACE';
+ var location = Object(_LocationUtils__WEBPACK_IMPORTED_MODULE_2__["createLocation"])(path, state, createKey(), history.location);
+
+ transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
+ if (!ok) return;
+
+ history.entries[history.index] = location;
+
+ setState({ action: action, location: location });
+ });
+ };
+
+ var go = function go(n) {
+ var nextIndex = clamp(history.index + n, 0, history.entries.length - 1);
+
+ var action = 'POP';
+ var location = history.entries[nextIndex];
+
+ transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
+ if (ok) {
+ setState({
+ action: action,
+ location: location,
+ index: nextIndex
+ });
+ } else {
+ // Mimic the behavior of DOM histories by
+ // causing a render after a cancelled POP.
+ setState();
+ }
+ });
+ };
+
+ var goBack = function goBack() {
+ return go(-1);
+ };
+
+ var goForward = function goForward() {
+ return go(1);
+ };
+
+ var canGo = function canGo(n) {
+ var nextIndex = history.index + n;
+ return nextIndex >= 0 && nextIndex < history.entries.length;
+ };
+
+ var block = function block() {
+ var prompt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ return transitionManager.setPrompt(prompt);
+ };
+
+ var listen = function listen(listener) {
+ return transitionManager.appendListener(listener);
+ };
+
+ var history = {
+ length: entries.length,
+ action: 'POP',
+ location: entries[index],
+ index: index,
+ entries: entries,
+ createHref: createHref,
+ push: push,
+ replace: replace,
+ go: go,
+ goBack: goBack,
+ goForward: goForward,
+ canGo: canGo,
+ block: block,
+ listen: listen
+ };
+
+ return history;
+};
+
+/* harmony default export */ __webpack_exports__["default"] = (createMemoryHistory);
+
+/***/ }),
+
+/***/ "./node_modules/history/es/createTransitionManager.js":
+/*!************************************************************!*\
+ !*** ./node_modules/history/es/createTransitionManager.js ***!
+ \************************************************************/
+/*! exports provided: default */
+/*! all exports used */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! warning */ "./node_modules/warning/browser.js");
+/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(warning__WEBPACK_IMPORTED_MODULE_0__);
+
+
+var createTransitionManager = function createTransitionManager() {
+ var prompt = null;
+
+ var setPrompt = function setPrompt(nextPrompt) {
+ warning__WEBPACK_IMPORTED_MODULE_0___default()(prompt == null, 'A history supports only one prompt at a time');
+
+ prompt = nextPrompt;
+
+ return function () {
+ if (prompt === nextPrompt) prompt = null;
+ };
+ };
+
+ var confirmTransitionTo = function confirmTransitionTo(location, action, getUserConfirmation, callback) {
+ // TODO: If another transition starts while we're still confirming
+ // the previous one, we may end up in a weird state. Figure out the
+ // best way to handle this.
+ if (prompt != null) {
+ var result = typeof prompt === 'function' ? prompt(location, action) : prompt;
+
+ if (typeof result === 'string') {
+ if (typeof getUserConfirmation === 'function') {
+ getUserConfirmation(result, callback);
+ } else {
+ warning__WEBPACK_IMPORTED_MODULE_0___default()(false, 'A history needs a getUserConfirmation function in order to use a prompt message');
+
+ callback(true);
+ }
+ } else {
+ // Return false from a transition hook to cancel the transition.
+ callback(result !== false);
+ }
+ } else {
+ callback(true);
+ }
+ };
+
+ var listeners = [];
+
+ var appendListener = function appendListener(fn) {
+ var isActive = true;
+
+ var listener = function listener() {
+ if (isActive) fn.apply(undefined, arguments);
+ };
+
+ listeners.push(listener);
+
+ return function () {
+ isActive = false;
+ listeners = listeners.filter(function (item) {
+ return item !== listener;
+ });
+ };
+ };
+
+ var notifyListeners = function notifyListeners() {
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
+
+ listeners.forEach(function (listener) {
+ return listener.apply(undefined, args);
+ });
+ };
+
+ return {
+ setPrompt: setPrompt,
+ confirmTransitionTo: confirmTransitionTo,
+ appendListener: appendListener,
+ notifyListeners: notifyListeners
+ };
+};
+
+/* harmony default export */ __webpack_exports__["default"] = (createTransitionManager);
+
+/***/ }),
+
+/***/ "./node_modules/history/es/index.js":
+/*!******************************************!*\
+ !*** ./node_modules/history/es/index.js ***!
+ \******************************************/
+/*! exports provided: createBrowserHistory, createHashHistory, createMemoryHistory, createLocation, locationsAreEqual, parsePath, createPath */
+/*! all exports used */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony import */ var _createBrowserHistory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./createBrowserHistory */ "./node_modules/history/es/createBrowserHistory.js");
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createBrowserHistory", function() { return _createBrowserHistory__WEBPACK_IMPORTED_MODULE_0__["default"]; });
+
+/* harmony import */ var _createHashHistory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./createHashHistory */ "./node_modules/history/es/createHashHistory.js");
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createHashHistory", function() { return _createHashHistory__WEBPACK_IMPORTED_MODULE_1__["default"]; });
+
+/* harmony import */ var _createMemoryHistory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./createMemoryHistory */ "./node_modules/history/es/createMemoryHistory.js");
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createMemoryHistory", function() { return _createMemoryHistory__WEBPACK_IMPORTED_MODULE_2__["default"]; });
+
+/* harmony import */ var _LocationUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./LocationUtils */ "./node_modules/history/es/LocationUtils.js");
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createLocation", function() { return _LocationUtils__WEBPACK_IMPORTED_MODULE_3__["createLocation"]; });
+
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "locationsAreEqual", function() { return _LocationUtils__WEBPACK_IMPORTED_MODULE_3__["locationsAreEqual"]; });
+
+/* harmony import */ var _PathUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./PathUtils */ "./node_modules/history/es/PathUtils.js");
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parsePath", function() { return _PathUtils__WEBPACK_IMPORTED_MODULE_4__["parsePath"]; });
+
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createPath", function() { return _PathUtils__WEBPACK_IMPORTED_MODULE_4__["createPath"]; });
+
+
+
+
+
+
+
+
+
+
+
+/***/ }),
+
+/***/ "./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js":
+/*!**********************************************************************************!*\
+ !*** ./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js ***!
+ \**********************************************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+/**
+ * Copyright 2015, Yahoo! Inc.
+ * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
+ */
+var REACT_STATICS = {
+ childContextTypes: true,
+ contextTypes: true,
+ defaultProps: true,
+ displayName: true,
+ getDefaultProps: true,
+ getDerivedStateFromProps: true,
+ mixins: true,
+ propTypes: true,
+ type: true
+};
+
+var KNOWN_STATICS = {
+ name: true,
+ length: true,
+ prototype: true,
+ caller: true,
+ callee: true,
+ arguments: true,
+ arity: true
+};
+
+var defineProperty = Object.defineProperty;
+var getOwnPropertyNames = Object.getOwnPropertyNames;
+var getOwnPropertySymbols = Object.getOwnPropertySymbols;
+var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
+var getPrototypeOf = Object.getPrototypeOf;
+var objectPrototype = getPrototypeOf && getPrototypeOf(Object);
+
+function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
+ if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components
+
+ if (objectPrototype) {
+ var inheritedComponent = getPrototypeOf(sourceComponent);
+ if (inheritedComponent && inheritedComponent !== objectPrototype) {
+ hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
+ }
+ }
+
+ var keys = getOwnPropertyNames(sourceComponent);
+
+ if (getOwnPropertySymbols) {
+ keys = keys.concat(getOwnPropertySymbols(sourceComponent));
+ }
+
+ for (var i = 0; i < keys.length; ++i) {
+ var key = keys[i];
+ if (!REACT_STATICS[key] && !KNOWN_STATICS[key] && (!blacklist || !blacklist[key])) {
+ var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
+ try { // Avoid failures from read-only properties
+ defineProperty(targetComponent, key, descriptor);
+ } catch (e) {}
+ }
+ }
+
+ return targetComponent;
+ }
+
+ return targetComponent;
+}
+
+module.exports = hoistNonReactStatics;
+
+
+/***/ }),
+
+/***/ "./node_modules/invariant/browser.js":
+/*!*******************************************!*\
+ !*** ./node_modules/invariant/browser.js ***!
+ \*******************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/**
+ * 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 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 invariant = function(condition, format, a, b, c, d, e, f) {
+ if (true) {
+ if (format === undefined) {
+ throw new Error('invariant requires an error message argument');
+ }
+ }
+
+ if (!condition) {
+ var error;
+ 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';
+ }
+
+ error.framesToPop = 1; // we don't care about invariant's own frame
+ throw error;
+ }
+};
+
+module.exports = invariant;
+
+
+/***/ }),
+
+/***/ "./node_modules/is-buffer/index.js":
+/*!*****************************************!*\
+ !*** ./node_modules/is-buffer/index.js ***!
+ \*****************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports) {
+
+/*!
+ * Determine if an object is a Buffer
+ *
+ * @author Feross Aboukhadijeh
+ * @license MIT
+ */
+
+// The _isBuffer check is for Safari 5-7 support, because it's missing
+// Object.prototype.constructor. Remove this eventually
+module.exports = function (obj) {
+ return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
+}
+
+function isBuffer (obj) {
+ return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
+}
+
+// For Node v0.10 support. Remove this eventually.
+function isSlowBuffer (obj) {
+ return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
+}
+
+
+/***/ }),
+
+/***/ "./node_modules/mobx-react-router/dist/mobx-react-router.js":
+/*!******************************************************************!*\
+ !*** ./node_modules/mobx-react-router/dist/mobx-react-router.js ***!
+ \******************************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+(function webpackUniversalModuleDefinition(root, factory) {
+ if(true)
+ module.exports = factory(__webpack_require__(/*! mobx */ "./node_modules/mobx/lib/mobx.module.js"));
+ else {}
+})(this, function(__WEBPACK_EXTERNAL_MODULE_0__) {
+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] = {
+/******/ i: moduleId,
+/******/ l: false,
+/******/ exports: {}
+/******/ };
+/******/
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+/******/
+/******/ // Flag the module as loaded
+/******/ module.l = 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;
+/******/
+/******/ // identity function for calling harmony imports with the correct context
+/******/ __webpack_require__.i = function(value) { return value; };
+/******/
+/******/ // define getter function for harmony exports
+/******/ __webpack_require__.d = function(exports, name, getter) {
+/******/ if(!__webpack_require__.o(exports, name)) {
+/******/ Object.defineProperty(exports, name, {
+/******/ configurable: false,
+/******/ enumerable: true,
+/******/ get: getter
+/******/ });
+/******/ }
+/******/ };
+/******/
+/******/ // getDefaultExport function for compatibility with non-harmony modules
+/******/ __webpack_require__.n = function(module) {
+/******/ var getter = module && module.__esModule ?
+/******/ function getDefault() { return module['default']; } :
+/******/ function getModuleExports() { return module; };
+/******/ __webpack_require__.d(getter, 'a', getter);
+/******/ return getter;
+/******/ };
+/******/
+/******/ // Object.prototype.hasOwnProperty.call
+/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
+/******/
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "";
+/******/
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(__webpack_require__.s = 4);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ (function(module, exports) {
+
+module.exports = __WEBPACK_EXTERNAL_MODULE_0__;
+
+/***/ }),
+/* 1 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+var _store = __webpack_require__(2);
+
+Object.keys(_store).forEach(function (key) {
+ if (key === "default" || key === "__esModule") return;
+ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: function get() {
+ return _store[key];
+ }
+ });
+});
+
+var _sync = __webpack_require__(3);
+
+Object.keys(_sync).forEach(function (key) {
+ if (key === "default" || key === "__esModule") return;
+ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: function get() {
+ return _sync[key];
+ }
+ });
+});
+
+/***/ }),
+/* 2 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.RouterStore = undefined;
+
+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; }; }();
+
+var _desc, _value, _class, _descriptor;
+
+var _mobx = __webpack_require__(0);
+
+function _initDefineProp(target, property, descriptor, context) {
+ if (!descriptor) return;
+ Object.defineProperty(target, property, {
+ enumerable: descriptor.enumerable,
+ configurable: descriptor.configurable,
+ writable: descriptor.writable,
+ value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
+ });
+}
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
+ var desc = {};
+ Object['ke' + 'ys'](descriptor).forEach(function (key) {
+ desc[key] = descriptor[key];
+ });
+ desc.enumerable = !!desc.enumerable;
+ desc.configurable = !!desc.configurable;
+
+ if ('value' in desc || desc.initializer) {
+ desc.writable = true;
+ }
+
+ desc = decorators.slice().reverse().reduce(function (desc, decorator) {
+ return decorator(target, property, desc) || desc;
+ }, desc);
+
+ if (context && desc.initializer !== void 0) {
+ desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
+ desc.initializer = undefined;
+ }
+
+ if (desc.initializer === void 0) {
+ Object['define' + 'Property'](target, property, desc);
+ desc = null;
+ }
+
+ return desc;
+}
+
+function _initializerWarningHelper(descriptor, context) {
+ throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
+}
+
+var RouterStore = exports.RouterStore = (_class = function () {
+ function RouterStore() {
+ var _this = this;
+
+ _classCallCheck(this, RouterStore);
+
+ _initDefineProp(this, 'location', _descriptor, this);
+
+ this.history = null;
+
+ this.push = function (location) {
+ _this.history.push(location);
+ };
+
+ this.replace = function (location) {
+ _this.history.replace(location);
+ };
+
+ this.go = function (n) {
+ _this.history.go(n);
+ };
+
+ this.goBack = function () {
+ _this.history.goBack();
+ };
+
+ this.goForward = function () {
+ _this.history.goForward();
+ };
+
+ this.push = this.push.bind(this);
+ this.replace = this.replace.bind(this);
+ this.go = this.go.bind(this);
+ this.goBack = this.goBack.bind(this);
+ this.goForward = this.goForward.bind(this);
+ }
+
+ _createClass(RouterStore, [{
+ key: '_updateLocation',
+ value: function _updateLocation(newState) {
+ this.location = newState;
+ }
+
+ /*
+ * History methods
+ */
+
+ }]);
+
+ return RouterStore;
+}(), (_descriptor = _applyDecoratedDescriptor(_class.prototype, 'location', [_mobx.observable], {
+ enumerable: true,
+ initializer: function initializer() {
+ return null;
+ }
+}), _applyDecoratedDescriptor(_class.prototype, '_updateLocation', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, '_updateLocation'), _class.prototype)), _class);
+;
+
+/***/ }),
+/* 3 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.syncHistoryWithStore = undefined;
+
+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 _mobx = __webpack_require__(0);
+
+var syncHistoryWithStore = exports.syncHistoryWithStore = function syncHistoryWithStore(history, store) {
+ // Initialise store
+ store.history = history;
+
+ // Handle update from history object
+ var handleLocationChange = function handleLocationChange(location) {
+ store._updateLocation(location);
+ };
+
+ var unsubscribeFromHistory = history.listen(handleLocationChange);
+ handleLocationChange(history.location);
+
+ var subscribe = function subscribe(listener) {
+ var onStoreChange = function onStoreChange() {
+ var rawLocation = _extends({}, store.location);
+ listener(rawLocation, history.action);
+ };
+
+ // Listen for changes to location state in store
+ var unsubscribeFromStore = (0, _mobx.observe)(store, 'location', onStoreChange);
+
+ listener(store.location, history.action);
+
+ return unsubscribeFromStore;
+ };
+
+ history.subscribe = subscribe;
+ history.unsubscribe = unsubscribeFromHistory;
+
+ return history;
+};
+
+/***/ }),
+/* 4 */
+/***/ (function(module, exports, __webpack_require__) {
+
+module.exports = __webpack_require__(1);
+
+
+/***/ })
+/******/ ]);
+});
+
+/***/ }),
+
+/***/ "./node_modules/mobx-react/index.module.js":
+/*!*************************************************!*\
+ !*** ./node_modules/mobx-react/index.module.js ***!
+ \*************************************************/
+/*! exports provided: propTypes, PropTypes, onError, observer, Observer, renderReporter, componentByNodeRegistery, componentByNodeRegistry, trackComponents, useStaticRendering, Provider, inject, disposeOnUnmount */
+/*! all exports used */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "propTypes", function() { return propTypes; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PropTypes", function() { return propTypes; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onError", function() { return onError; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "observer", function() { return observer; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Observer", function() { return Observer; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderReporter", function() { return renderReporter; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "componentByNodeRegistery", function() { return componentByNodeRegistry; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "componentByNodeRegistry", function() { return componentByNodeRegistry; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "trackComponents", function() { return trackComponents; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useStaticRendering", function() { return useStaticRendering; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Provider", function() { return Provider; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return inject; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "disposeOnUnmount", function() { return disposeOnUnmount; });
+/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mobx */ "./node_modules/mobx/lib/mobx.module.js");
+/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");
+/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
+/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js");
+/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_2__);
+
+
+
+
+function _typeof(obj) {
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
+ _typeof = function (obj) {
+ return typeof obj;
+ };
+ } else {
+ _typeof = function (obj) {
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
+ };
+ }
+
+ return _typeof(obj);
+}
+
+function _classCallCheck(instance, Constructor) {
+ if (!(instance instanceof Constructor)) {
+ throw new TypeError("Cannot call a class as a function");
+ }
+}
+
+function _defineProperties(target, props) {
+ for (var i = 0; i < props.length; i++) {
+ var descriptor = props[i];
+ descriptor.enumerable = descriptor.enumerable || false;
+ descriptor.configurable = true;
+ if ("value" in descriptor) descriptor.writable = true;
+ Object.defineProperty(target, descriptor.key, descriptor);
+ }
+}
+
+function _createClass(Constructor, protoProps, staticProps) {
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
+ if (staticProps) _defineProperties(Constructor, staticProps);
+ return Constructor;
+}
+
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ });
+ } else {
+ obj[key] = value;
+ }
+
+ return obj;
+}
+
+function _inherits(subClass, superClass) {
+ if (typeof superClass !== "function" && superClass !== null) {
+ throw new TypeError("Super expression must either be null or a function");
+ }
+
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
+ constructor: {
+ value: subClass,
+ writable: true,
+ configurable: true
+ }
+ });
+ if (superClass) _setPrototypeOf(subClass, superClass);
+}
+
+function _getPrototypeOf(o) {
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
+ return o.__proto__ || Object.getPrototypeOf(o);
+ };
+ return _getPrototypeOf(o);
+}
+
+function _setPrototypeOf(o, p) {
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
+ o.__proto__ = p;
+ return o;
+ };
+
+ return _setPrototypeOf(o, p);
+}
+
+function _assertThisInitialized(self) {
+ if (self === void 0) {
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
+ }
+
+ return self;
+}
+
+function _possibleConstructorReturn(self, call) {
+ if (call && (typeof call === "object" || typeof call === "function")) {
+ return call;
+ }
+
+ return _assertThisInitialized(self);
+}
+
+// These functions can be stubbed out in specific environments
+
+function unwrapExports (x) {
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x.default : x;
+}
+
+function createCommonjsModule(fn, module) {
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
+}
+
+var reactIs_production_min = createCommonjsModule(function (module, exports) {
+Object.defineProperty(exports,"__esModule",{value:!0});
+var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,r=b?Symbol.for("react.memo"):
+60115,t=b?Symbol.for("react.lazy"):60116;function u(a){if("object"===typeof a&&null!==a){var q=a.$$typeof;switch(q){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case h:return a;default:return q}}case d:return q}}}function v(a){return u(a)===m}exports.typeOf=u;exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;
+exports.Profiler=g;exports.Portal=d;exports.StrictMode=f;exports.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n)};exports.isAsyncMode=function(a){return v(a)||u(a)===l};exports.isConcurrentMode=v;exports.isContextConsumer=function(a){return u(a)===k};exports.isContextProvider=function(a){return u(a)===h};
+exports.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return u(a)===n};exports.isFragment=function(a){return u(a)===e};exports.isProfiler=function(a){return u(a)===g};exports.isPortal=function(a){return u(a)===d};exports.isStrictMode=function(a){return u(a)===f};
+});
+
+unwrapExports(reactIs_production_min);
+var reactIs_production_min_1 = reactIs_production_min.typeOf;
+var reactIs_production_min_2 = reactIs_production_min.AsyncMode;
+var reactIs_production_min_3 = reactIs_production_min.ConcurrentMode;
+var reactIs_production_min_4 = reactIs_production_min.ContextConsumer;
+var reactIs_production_min_5 = reactIs_production_min.ContextProvider;
+var reactIs_production_min_6 = reactIs_production_min.Element;
+var reactIs_production_min_7 = reactIs_production_min.ForwardRef;
+var reactIs_production_min_8 = reactIs_production_min.Fragment;
+var reactIs_production_min_9 = reactIs_production_min.Profiler;
+var reactIs_production_min_10 = reactIs_production_min.Portal;
+var reactIs_production_min_11 = reactIs_production_min.StrictMode;
+var reactIs_production_min_12 = reactIs_production_min.isValidElementType;
+var reactIs_production_min_13 = reactIs_production_min.isAsyncMode;
+var reactIs_production_min_14 = reactIs_production_min.isConcurrentMode;
+var reactIs_production_min_15 = reactIs_production_min.isContextConsumer;
+var reactIs_production_min_16 = reactIs_production_min.isContextProvider;
+var reactIs_production_min_17 = reactIs_production_min.isElement;
+var reactIs_production_min_18 = reactIs_production_min.isForwardRef;
+var reactIs_production_min_19 = reactIs_production_min.isFragment;
+var reactIs_production_min_20 = reactIs_production_min.isProfiler;
+var reactIs_production_min_21 = reactIs_production_min.isPortal;
+var reactIs_production_min_22 = reactIs_production_min.isStrictMode;
+
+var reactIs = createCommonjsModule(function (module) {
+
+{
+ module.exports = reactIs_production_min;
+}
+});
+
+/**
+ * Copyright 2015, Yahoo! Inc.
+ * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
+ */
+
+var REACT_STATICS = {
+ childContextTypes: true,
+ contextType: true,
+ contextTypes: true,
+ defaultProps: true,
+ displayName: true,
+ getDefaultProps: true,
+ getDerivedStateFromError: true,
+ getDerivedStateFromProps: true,
+ mixins: true,
+ propTypes: true,
+ type: true
+};
+
+var KNOWN_STATICS = {
+ name: true,
+ length: true,
+ prototype: true,
+ caller: true,
+ callee: true,
+ arguments: true,
+ arity: true
+};
+
+var FORWARD_REF_STATICS = {
+ '$$typeof': true,
+ render: true,
+ defaultProps: true,
+ displayName: true,
+ propTypes: true
+};
+
+var TYPE_STATICS = {};
+TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
+
+var defineProperty = Object.defineProperty;
+var getOwnPropertyNames = Object.getOwnPropertyNames;
+var getOwnPropertySymbols = Object.getOwnPropertySymbols;
+var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
+var getPrototypeOf = Object.getPrototypeOf;
+var objectPrototype = Object.prototype;
+
+function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
+ if (typeof sourceComponent !== 'string') {
+ // don't hoist over string (html) components
+
+ if (objectPrototype) {
+ var inheritedComponent = getPrototypeOf(sourceComponent);
+ if (inheritedComponent && inheritedComponent !== objectPrototype) {
+ hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
+ }
+ }
+
+ var keys = getOwnPropertyNames(sourceComponent);
+
+ if (getOwnPropertySymbols) {
+ keys = keys.concat(getOwnPropertySymbols(sourceComponent));
+ }
+
+ var targetStatics = TYPE_STATICS[targetComponent['$$typeof']] || REACT_STATICS;
+ var sourceStatics = TYPE_STATICS[sourceComponent['$$typeof']] || REACT_STATICS;
+
+ for (var i = 0; i < keys.length; ++i) {
+ var key = keys[i];
+ if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
+ var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
+ try {
+ // Avoid failures from read-only properties
+ defineProperty(targetComponent, key, descriptor);
+ } catch (e) {}
+ }
+ }
+
+ return targetComponent;
+ }
+
+ return targetComponent;
+}
+
+var hoistNonReactStatics_cjs = hoistNonReactStatics;
+
+var EventEmitter =
+/*#__PURE__*/
+function () {
+ function EventEmitter() {
+ _classCallCheck(this, EventEmitter);
+
+ this.listeners = [];
+ }
+
+ _createClass(EventEmitter, [{
+ key: "on",
+ value: function on(cb) {
+ var _this = this;
+
+ this.listeners.push(cb);
+ return function () {
+ var index = _this.listeners.indexOf(cb);
+
+ if (index !== -1) _this.listeners.splice(index, 1);
+ };
+ }
+ }, {
+ key: "emit",
+ value: function emit(data) {
+ this.listeners.forEach(function (fn) {
+ return fn(data);
+ });
+ }
+ }]);
+
+ return EventEmitter;
+}();
+
+function createChainableTypeChecker(validate) {
+ function checkType(isRequired, props, propName, componentName, location, propFullName) {
+ for (var _len = arguments.length, rest = new Array(_len > 6 ? _len - 6 : 0), _key = 6; _key < _len; _key++) {
+ rest[_key - 6] = arguments[_key];
+ }
+
+ return Object(mobx__WEBPACK_IMPORTED_MODULE_0__["untracked"])(function () {
+ componentName = componentName || "<>";
+ propFullName = propFullName || propName;
+
+ if (props[propName] == null) {
+ if (isRequired) {
+ var actual = props[propName] === null ? "null" : "undefined";
+ return new Error("The " + location + " `" + propFullName + "` is marked as required " + "in `" + componentName + "`, but its value is `" + actual + "`.");
+ }
+
+ return null;
+ } else {
+ return validate.apply(void 0, [props, propName, componentName, location, propFullName].concat(rest));
+ }
+ });
+ }
+
+ var chainedCheckType = checkType.bind(null, false);
+ chainedCheckType.isRequired = checkType.bind(null, true);
+ return chainedCheckType;
+} // Copied from React.PropTypes
+
+
+function isSymbol(propType, propValue) {
+ // Native Symbol.
+ if (propType === "symbol") {
+ return true;
+ } // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
+
+
+ if (propValue["@@toStringTag"] === "Symbol") {
+ return true;
+ } // Fallback for non-spec compliant Symbols which are polyfilled.
+
+
+ if (typeof Symbol === "function" && propValue instanceof Symbol) {
+ return true;
+ }
+
+ return false;
+} // Copied from React.PropTypes
+
+
+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;
+} // This handles more types than `getPropType`. Only used for error messages.
+// Copied from React.PropTypes
+
+
+function getPreciseType(propValue) {
+ var propType = getPropType(propValue);
+
+ if (propType === "object") {
+ if (propValue instanceof Date) {
+ return "date";
+ } else if (propValue instanceof RegExp) {
+ return "regexp";
+ }
+ }
+
+ return propType;
+}
+
+function createObservableTypeCheckerCreator(allowNativeType, mobxType) {
+ return createChainableTypeChecker(function (props, propName, componentName, location, propFullName) {
+ return Object(mobx__WEBPACK_IMPORTED_MODULE_0__["untracked"])(function () {
+ if (allowNativeType) {
+ if (getPropType(props[propName]) === mobxType.toLowerCase()) return null;
+ }
+
+ var mobxChecker;
+
+ switch (mobxType) {
+ case "Array":
+ mobxChecker = mobx__WEBPACK_IMPORTED_MODULE_0__["isObservableArray"];
+ break;
+
+ case "Object":
+ mobxChecker = mobx__WEBPACK_IMPORTED_MODULE_0__["isObservableObject"];
+ break;
+
+ case "Map":
+ mobxChecker = mobx__WEBPACK_IMPORTED_MODULE_0__["isObservableMap"];
+ break;
+
+ default:
+ throw new Error("Unexpected mobxType: ".concat(mobxType));
+ }
+
+ var propValue = props[propName];
+
+ if (!mobxChecker(propValue)) {
+ var preciseType = getPreciseType(propValue);
+ var nativeTypeExpectationMessage = allowNativeType ? " or javascript `" + mobxType.toLowerCase() + "`" : "";
+ return new Error("Invalid prop `" + propFullName + "` of type `" + preciseType + "` supplied to" + " `" + componentName + "`, expected `mobx.Observable" + mobxType + "`" + nativeTypeExpectationMessage + ".");
+ }
+
+ return null;
+ });
+ });
+}
+
+function createObservableArrayOfTypeChecker(allowNativeType, typeChecker) {
+ return createChainableTypeChecker(function (props, propName, componentName, location, propFullName) {
+ for (var _len2 = arguments.length, rest = new Array(_len2 > 5 ? _len2 - 5 : 0), _key2 = 5; _key2 < _len2; _key2++) {
+ rest[_key2 - 5] = arguments[_key2];
+ }
+
+ return Object(mobx__WEBPACK_IMPORTED_MODULE_0__["untracked"])(function () {
+ if (typeof typeChecker !== "function") {
+ return new Error("Property `" + propFullName + "` of component `" + componentName + "` has " + "invalid PropType notation.");
+ }
+
+ var error = createObservableTypeCheckerCreator(allowNativeType, "Array")(props, propName, componentName);
+ if (error instanceof Error) return error;
+ var propValue = props[propName];
+
+ for (var i = 0; i < propValue.length; i++) {
+ error = typeChecker.apply(void 0, [propValue, i, componentName, location, propFullName + "[" + i + "]"].concat(rest));
+ if (error instanceof Error) return error;
+ }
+
+ return null;
+ });
+ });
+}
+
+var observableArray = createObservableTypeCheckerCreator(false, "Array");
+var observableArrayOf = createObservableArrayOfTypeChecker.bind(null, false);
+var observableMap = createObservableTypeCheckerCreator(false, "Map");
+var observableObject = createObservableTypeCheckerCreator(false, "Object");
+var arrayOrObservableArray = createObservableTypeCheckerCreator(true, "Array");
+var arrayOrObservableArrayOf = createObservableArrayOfTypeChecker.bind(null, true);
+var objectOrObservableObject = createObservableTypeCheckerCreator(true, "Object");
+
+var propTypes = /*#__PURE__*/Object.freeze({
+ observableArray: observableArray,
+ observableArrayOf: observableArrayOf,
+ observableMap: observableMap,
+ observableObject: observableObject,
+ arrayOrObservableArray: arrayOrObservableArray,
+ arrayOrObservableArrayOf: arrayOrObservableArrayOf,
+ objectOrObservableObject: objectOrObservableObject
+});
+
+function isStateless(component) {
+ // `function() {}` has prototype, but `() => {}` doesn't
+ // `() => {}` via Babel has prototype too.
+ return !(component.prototype && component.prototype.render);
+}
+var symbolId = 0;
+function newSymbol(name) {
+ if (typeof Symbol === "function") {
+ return Symbol(name);
+ }
+
+ var symbol = "__$mobx-react ".concat(name, " (").concat(symbolId, ")");
+ symbolId++;
+ return symbol;
+}
+var mobxMixins = newSymbol("patchMixins");
+var mobxPatchedDefinition = newSymbol("patchedDefinition");
+
+function getMixins(target, methodName) {
+ var mixins = target[mobxMixins] = target[mobxMixins] || {};
+ var methodMixins = mixins[methodName] = mixins[methodName] || {};
+ methodMixins.locks = methodMixins.locks || 0;
+ methodMixins.methods = methodMixins.methods || [];
+ return methodMixins;
+}
+
+function wrapper(realMethod, mixins) {
+ var _this = this;
+
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
+ args[_key - 2] = arguments[_key];
+ }
+
+ // locks are used to ensure that mixins are invoked only once per invocation, even on recursive calls
+ mixins.locks++;
+
+ try {
+ var retVal;
+
+ if (realMethod !== undefined && realMethod !== null) {
+ retVal = realMethod.apply(this, args);
+ }
+
+ return retVal;
+ } finally {
+ mixins.locks--;
+
+ if (mixins.locks === 0) {
+ mixins.methods.forEach(function (mx) {
+ mx.apply(_this, args);
+ });
+ }
+ }
+}
+
+function wrapFunction(realMethod, mixins) {
+ var fn = function fn() {
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
+ args[_key2] = arguments[_key2];
+ }
+
+ wrapper.call.apply(wrapper, [this, realMethod, mixins].concat(args));
+ };
+
+ return fn;
+}
+
+function patch(target, methodName) {
+ var mixins = getMixins(target, methodName);
+
+ for (var _len3 = arguments.length, mixinMethods = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
+ mixinMethods[_key3 - 2] = arguments[_key3];
+ }
+
+ for (var _i = 0; _i < mixinMethods.length; _i++) {
+ var mixinMethod = mixinMethods[_i];
+
+ if (mixins.methods.indexOf(mixinMethod) < 0) {
+ mixins.methods.push(mixinMethod);
+ }
+ }
+
+ var oldDefinition = Object.getOwnPropertyDescriptor(target, methodName);
+
+ if (oldDefinition && oldDefinition[mobxPatchedDefinition]) {
+ // already patched definition, do not repatch
+ return;
+ }
+
+ var originalMethod = target[methodName];
+ var newDefinition = createDefinition(target, methodName, oldDefinition ? oldDefinition.enumerable : undefined, mixins, originalMethod);
+ Object.defineProperty(target, methodName, newDefinition);
+}
+
+function createDefinition(target, methodName, enumerable, mixins, originalMethod) {
+ var _ref;
+
+ var wrappedFunc = wrapFunction(originalMethod, mixins);
+ return _ref = {}, _defineProperty(_ref, mobxPatchedDefinition, true), _defineProperty(_ref, "get", function get() {
+ return wrappedFunc;
+ }), _defineProperty(_ref, "set", function set(value) {
+ if (this === target) {
+ wrappedFunc = wrapFunction(value, mixins);
+ } else {
+ // when it is an instance of the prototype/a child prototype patch that particular case again separately
+ // since we need to store separate values depending on wether it is the actual instance, the prototype, etc
+ // e.g. the method for super might not be the same as the method for the prototype which might be not the same
+ // as the method for the instance
+ var newDefinition = createDefinition(this, methodName, enumerable, mixins, value);
+ Object.defineProperty(this, methodName, newDefinition);
+ }
+ }), _defineProperty(_ref, "configurable", true), _defineProperty(_ref, "enumerable", enumerable), _ref;
+}
+
+var injectorContextTypes = {
+ mobxStores: objectOrObservableObject
+};
+Object.seal(injectorContextTypes);
+var proxiedInjectorProps = {
+ contextTypes: {
+ get: function get() {
+ return injectorContextTypes;
+ },
+ set: function set(_) {
+ console.warn("Mobx Injector: you are trying to attach `contextTypes` on an component decorated with `inject` (or `observer`) HOC. Please specify the contextTypes on the wrapped component instead. It is accessible through the `wrappedComponent`");
+ },
+ configurable: true,
+ enumerable: false
+ },
+ isMobxInjector: {
+ value: true,
+ writable: true,
+ configurable: true,
+ enumerable: true
+ }
+ /**
+ * Store Injection
+ */
+
+};
+
+function createStoreInjector(grabStoresFn, component, injectNames) {
+ var displayName = "inject-" + (component.displayName || component.name || component.constructor && component.constructor.name || "Unknown");
+ if (injectNames) displayName += "-with-" + injectNames;
+
+ var Injector =
+ /*#__PURE__*/
+ function (_Component) {
+ _inherits(Injector, _Component);
+
+ function Injector() {
+ var _getPrototypeOf2;
+
+ var _this;
+
+ _classCallCheck(this, Injector);
+
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
+
+ _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Injector)).call.apply(_getPrototypeOf2, [this].concat(args)));
+
+ _this.storeRef = function (instance) {
+ _this.wrappedInstance = instance;
+ };
+
+ return _this;
+ }
+
+ _createClass(Injector, [{
+ key: "render",
+ value: function render() {
+ // Optimization: it might be more efficient to apply the mapper function *outside* the render method
+ // (if the mapper is a function), that could avoid expensive(?) re-rendering of the injector component
+ // See this test: 'using a custom injector is not too reactive' in inject.js
+ var newProps = {};
+
+ for (var key in this.props) {
+ if (this.props.hasOwnProperty(key)) {
+ newProps[key] = this.props[key];
+ }
+ }
+
+ var additionalProps = grabStoresFn(this.context.mobxStores || {}, newProps, this.context) || {};
+
+ for (var _key2 in additionalProps) {
+ newProps[_key2] = additionalProps[_key2];
+ }
+
+ if (!isStateless(component)) {
+ newProps.ref = this.storeRef;
+ }
+
+ return Object(react__WEBPACK_IMPORTED_MODULE_1__["createElement"])(component, newProps);
+ }
+ }]);
+
+ return Injector;
+ }(react__WEBPACK_IMPORTED_MODULE_1__["Component"]); // Static fields from component should be visible on the generated Injector
+
+
+ Injector.displayName = displayName;
+ hoistNonReactStatics_cjs(Injector, component);
+ Injector.wrappedComponent = component;
+ Object.defineProperties(Injector, proxiedInjectorProps);
+ return Injector;
+}
+
+function grabStoresByName(storeNames) {
+ return function (baseStores, nextProps) {
+ storeNames.forEach(function (storeName) {
+ if (storeName in nextProps // prefer props over stores
+ ) return;
+ if (!(storeName in baseStores)) throw new Error("MobX injector: Store '" + storeName + "' is not available! Make sure it is provided by some Provider");
+ nextProps[storeName] = baseStores[storeName];
+ });
+ return nextProps;
+ };
+}
+/**
+ * higher order component that injects stores to a child.
+ * takes either a varargs list of strings, which are stores read from the context,
+ * or a function that manually maps the available stores from the context to props:
+ * storesToProps(mobxStores, props, context) => newProps
+ */
+
+
+function inject()
+/* fn(stores, nextProps) or ...storeNames */
+{
+ var grabStoresFn;
+
+ if (typeof arguments[0] === "function") {
+ grabStoresFn = arguments[0];
+ return function (componentClass) {
+ var injected = createStoreInjector(grabStoresFn, componentClass);
+ injected.isMobxInjector = false; // supress warning
+ // mark the Injector as observer, to make it react to expressions in `grabStoresFn`,
+ // see #111
+
+ injected = observer(injected);
+ injected.isMobxInjector = true; // restore warning
+
+ return injected;
+ };
+ } else {
+ var storeNames = [];
+
+ for (var i = 0; i < arguments.length; i++) {
+ storeNames[i] = arguments[i];
+ }
+
+ grabStoresFn = grabStoresByName(storeNames);
+ return function (componentClass) {
+ return createStoreInjector(grabStoresFn, componentClass, storeNames.join("-"));
+ };
+ }
+}
+
+var mobxAdminProperty = mobx__WEBPACK_IMPORTED_MODULE_0__["$mobx"] || "$mobx";
+var mobxIsUnmounted = newSymbol("isUnmounted");
+/**
+ * dev tool support
+ */
+
+var isDevtoolsEnabled = false;
+var isUsingStaticRendering = false;
+var warnedAboutObserverInjectDeprecation = false; // WeakMap;
+
+var componentByNodeRegistry = typeof WeakMap !== "undefined" ? new WeakMap() : undefined;
+var renderReporter = new EventEmitter();
+var skipRenderKey = newSymbol("skipRender");
+var isForcingUpdateKey = newSymbol("isForcingUpdate"); // Using react-is had some issues (and operates on elements, not on types), see #608 / #609
+
+var ReactForwardRefSymbol = typeof react__WEBPACK_IMPORTED_MODULE_1__["forwardRef"] === "function" && Object(react__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function (_props, _ref) {})["$$typeof"];
+/**
+ * Helper to set `prop` to `this` as non-enumerable (hidden prop)
+ * @param target
+ * @param prop
+ * @param value
+ */
+
+function setHiddenProp(target, prop, value) {
+ if (!Object.hasOwnProperty.call(target, prop)) {
+ Object.defineProperty(target, prop, {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+ value: value
+ });
+ } else {
+ target[prop] = value;
+ }
+}
+
+function findDOMNode$2(component) {
+ if (react_dom__WEBPACK_IMPORTED_MODULE_2__["findDOMNode"]) {
+ try {
+ return Object(react_dom__WEBPACK_IMPORTED_MODULE_2__["findDOMNode"])(component);
+ } catch (e) {
+ // findDOMNode will throw in react-test-renderer, see:
+ // See https://github.com/mobxjs/mobx-react/issues/216
+ // Is there a better heuristic?
+ return null;
+ }
+ }
+
+ return null;
+}
+
+function reportRendering(component) {
+ var node = findDOMNode$2(component);
+ if (node && componentByNodeRegistry) componentByNodeRegistry.set(node, component);
+ renderReporter.emit({
+ event: "render",
+ renderTime: component.__$mobRenderEnd - component.__$mobRenderStart,
+ totalTime: Date.now() - component.__$mobRenderStart,
+ component: component,
+ node: node
+ });
+}
+
+function trackComponents() {
+ if (typeof WeakMap === "undefined") throw new Error("[mobx-react] tracking components is not supported in this browser.");
+ if (!isDevtoolsEnabled) isDevtoolsEnabled = true;
+}
+function useStaticRendering(useStaticRendering) {
+ isUsingStaticRendering = useStaticRendering;
+}
+/**
+ * Errors reporter
+ */
+
+var errorsReporter = new EventEmitter();
+/**
+ * Utilities
+ */
+
+function patch$1(target, funcName) {
+ patch(target, funcName, reactiveMixin[funcName]);
+}
+
+function shallowEqual(objA, objB) {
+ //From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js
+ if (is(objA, objB)) return true;
+
+ if (_typeof(objA) !== "object" || objA === null || _typeof(objB) !== "object" || objB === null) {
+ return false;
+ }
+
+ var keysA = Object.keys(objA);
+ var keysB = Object.keys(objB);
+ if (keysA.length !== keysB.length) return false;
+
+ for (var i = 0; i < keysA.length; i++) {
+ if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+function is(x, y) {
+ // From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js
+ if (x === y) {
+ return x !== 0 || 1 / x === 1 / y;
+ } else {
+ return x !== x && y !== y;
+ }
+}
+
+function makeComponentReactive(render) {
+ var _this2 = this;
+
+ if (isUsingStaticRendering === true) return render.call(this);
+
+ function reactiveRender() {
+ var _this = this;
+
+ isRenderingPending = false;
+ var exception = undefined;
+ var rendering = undefined;
+ reaction.track(function () {
+ if (isDevtoolsEnabled) {
+ _this.__$mobRenderStart = Date.now();
+ }
+
+ try {
+ rendering = Object(mobx__WEBPACK_IMPORTED_MODULE_0__["_allowStateChanges"])(false, baseRender);
+ } catch (e) {
+ exception = e;
+ }
+
+ if (isDevtoolsEnabled) {
+ _this.__$mobRenderEnd = Date.now();
+ }
+ });
+
+ if (exception) {
+ errorsReporter.emit(exception);
+ throw exception;
+ }
+
+ return rendering;
+ } // Generate friendly name for debugging
+
+
+ var initialName = this.displayName || this.name || this.constructor && (this.constructor.displayName || this.constructor.name) || "";
+ var rootNodeID = this._reactInternalInstance && this._reactInternalInstance._rootNodeID || this._reactInternalInstance && this._reactInternalInstance._debugID || this._reactInternalFiber && this._reactInternalFiber._debugID;
+ /**
+ * If props are shallowly modified, react will render anyway,
+ * so atom.reportChanged() should not result in yet another re-render
+ */
+
+ setHiddenProp(this, skipRenderKey, false);
+ /**
+ * forceUpdate will re-assign this.props. We don't want that to cause a loop,
+ * so detect these changes
+ */
+
+ setHiddenProp(this, isForcingUpdateKey, false); // wire up reactive render
+
+ var baseRender = render.bind(this);
+ var isRenderingPending = false;
+ var reaction = new mobx__WEBPACK_IMPORTED_MODULE_0__["Reaction"]("".concat(initialName, "#").concat(rootNodeID, ".render()"), function () {
+ if (!isRenderingPending) {
+ // N.B. Getting here *before mounting* means that a component constructor has side effects (see the relevant test in misc.js)
+ // This unidiomatic React usage but React will correctly warn about this so we continue as usual
+ // See #85 / Pull #44
+ isRenderingPending = true;
+ if (typeof _this2.componentWillReact === "function") _this2.componentWillReact(); // TODO: wrap in action?
+
+ if (_this2[mobxIsUnmounted] !== true) {
+ // If we are unmounted at this point, componentWillReact() had a side effect causing the component to unmounted
+ // TODO: remove this check? Then react will properly warn about the fact that this should not happen? See #73
+ // However, people also claim this might happen during unit tests..
+ var hasError = true;
+
+ try {
+ setHiddenProp(_this2, isForcingUpdateKey, true);
+ if (!_this2[skipRenderKey]) react__WEBPACK_IMPORTED_MODULE_1__["Component"].prototype.forceUpdate.call(_this2);
+ hasError = false;
+ } finally {
+ setHiddenProp(_this2, isForcingUpdateKey, false);
+ if (hasError) reaction.dispose();
+ }
+ }
+ }
+ });
+ reaction.reactComponent = this;
+ reactiveRender[mobxAdminProperty] = reaction;
+ this.render = reactiveRender;
+ return reactiveRender.call(this);
+}
+/**
+ * ReactiveMixin
+ */
+
+
+var reactiveMixin = {
+ componentWillUnmount: function componentWillUnmount() {
+ if (isUsingStaticRendering === true) return;
+ this.render[mobxAdminProperty] && this.render[mobxAdminProperty].dispose();
+ this[mobxIsUnmounted] = true;
+
+ if (isDevtoolsEnabled) {
+ var node = findDOMNode$2(this);
+
+ if (node && componentByNodeRegistry) {
+ componentByNodeRegistry.delete(node);
+ }
+
+ renderReporter.emit({
+ event: "destroy",
+ component: this,
+ node: node
+ });
+ }
+ },
+ componentDidMount: function componentDidMount() {
+ if (isDevtoolsEnabled) {
+ reportRendering(this);
+ }
+ },
+ componentDidUpdate: function componentDidUpdate() {
+ if (isDevtoolsEnabled) {
+ reportRendering(this);
+ }
+ },
+ shouldComponentUpdate: function shouldComponentUpdate(nextProps, nextState) {
+ if (isUsingStaticRendering) {
+ console.warn("[mobx-react] It seems that a re-rendering of a React component is triggered while in static (server-side) mode. Please make sure components are rendered only once server-side.");
+ } // update on any state changes (as is the default)
+
+
+ if (this.state !== nextState) {
+ return true;
+ } // update if props are shallowly not equal, inspired by PureRenderMixin
+ // we could return just 'false' here, and avoid the `skipRender` checks etc
+ // however, it is nicer if lifecycle events are triggered like usually,
+ // so we return true here if props are shallowly modified.
+
+
+ return !shallowEqual(this.props, nextProps);
+ }
+};
+
+function makeObservableProp(target, propName) {
+ var valueHolderKey = newSymbol("reactProp_".concat(propName, "_valueHolder"));
+ var atomHolderKey = newSymbol("reactProp_".concat(propName, "_atomHolder"));
+
+ function getAtom() {
+ if (!this[atomHolderKey]) {
+ setHiddenProp(this, atomHolderKey, Object(mobx__WEBPACK_IMPORTED_MODULE_0__["createAtom"])("reactive " + propName));
+ }
+
+ return this[atomHolderKey];
+ }
+
+ Object.defineProperty(target, propName, {
+ configurable: true,
+ enumerable: true,
+ get: function get() {
+ getAtom.call(this).reportObserved();
+ return this[valueHolderKey];
+ },
+ set: function set(v) {
+ if (!this[isForcingUpdateKey] && !shallowEqual(this[valueHolderKey], v)) {
+ setHiddenProp(this, valueHolderKey, v);
+ setHiddenProp(this, skipRenderKey, true);
+ getAtom.call(this).reportChanged();
+ setHiddenProp(this, skipRenderKey, false);
+ } else {
+ setHiddenProp(this, valueHolderKey, v);
+ }
+ }
+ });
+}
+/**
+ * Observer function / decorator
+ */
+
+
+function observer(arg1, arg2) {
+ if (typeof arg1 === "string") {
+ throw new Error("Store names should be provided as array");
+ }
+
+ if (Array.isArray(arg1)) {
+ // TODO: remove in next major
+ // component needs stores
+ if (!warnedAboutObserverInjectDeprecation) {
+ warnedAboutObserverInjectDeprecation = true;
+ console.warn('Mobx observer: Using observer to inject stores is deprecated since 4.0. Use `@inject("store1", "store2") @observer ComponentClass` or `inject("store1", "store2")(observer(componentClass))` instead of `@observer(["store1", "store2"]) ComponentClass`');
+ }
+
+ if (!arg2) {
+ // invoked as decorator
+ return function (componentClass) {
+ return observer(arg1, componentClass);
+ };
+ } else {
+ return inject.apply(null, arg1)(observer(arg2));
+ }
+ }
+
+ var componentClass = arg1;
+
+ if (componentClass.isMobxInjector === true) {
+ console.warn("Mobx observer: You are trying to use 'observer' on a component that already has 'inject'. Please apply 'observer' before applying 'inject'");
+ }
+
+ if (componentClass.__proto__ === react__WEBPACK_IMPORTED_MODULE_1__["PureComponent"]) {
+ console.warn("Mobx observer: You are using 'observer' on React.PureComponent. These two achieve two opposite goals and should not be used together");
+ } // Unwrap forward refs into `` component
+ // we need to unwrap the render, because it is the inner render that needs to be tracked,
+ // not the ForwardRef HoC
+
+
+ if (ReactForwardRefSymbol && componentClass["$$typeof"] === ReactForwardRefSymbol) {
+ var _baseRender = componentClass.render;
+ if (typeof _baseRender !== "function") throw new Error("render property of ForwardRef was not a function"); // TODO: do we need to hoist statics from baseRender to the forward ref?
+
+ return Object(react__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function ObserverForwardRef() {
+ var _arguments = arguments;
+ return react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(Observer, null, function () {
+ return _baseRender.apply(undefined, _arguments);
+ });
+ });
+ } // Stateless function component:
+ // If it is function but doesn't seem to be a react class constructor,
+ // wrap it to a react class automatically
+
+
+ if (typeof componentClass === "function" && (!componentClass.prototype || !componentClass.prototype.render) && !componentClass.isReactClass && !react__WEBPACK_IMPORTED_MODULE_1__["Component"].isPrototypeOf(componentClass)) {
+ var _class, _temp;
+
+ var observerComponent = observer((_temp = _class =
+ /*#__PURE__*/
+ function (_Component) {
+ _inherits(_class, _Component);
+
+ function _class() {
+ _classCallCheck(this, _class);
+
+ return _possibleConstructorReturn(this, _getPrototypeOf(_class).apply(this, arguments));
+ }
+
+ _createClass(_class, [{
+ key: "render",
+ value: function render() {
+ return componentClass.call(this, this.props, this.context);
+ }
+ }]);
+
+ return _class;
+ }(react__WEBPACK_IMPORTED_MODULE_1__["Component"]), _class.displayName = componentClass.displayName || componentClass.name, _class.contextTypes = componentClass.contextTypes, _class.propTypes = componentClass.propTypes, _class.defaultProps = componentClass.defaultProps, _temp));
+ hoistNonReactStatics_cjs(observerComponent, componentClass);
+ return observerComponent;
+ }
+
+ if (!componentClass) {
+ throw new Error("Please pass a valid component to 'observer'");
+ }
+
+ var target = componentClass.prototype || componentClass;
+ mixinLifecycleEvents(target);
+ componentClass.isMobXReactObserver = true;
+ makeObservableProp(target, "props");
+ makeObservableProp(target, "state");
+ var baseRender = target.render;
+
+ target.render = function () {
+ return makeComponentReactive.call(this, baseRender);
+ };
+
+ return componentClass;
+}
+
+function mixinLifecycleEvents(target) {
+ ["componentDidMount", "componentWillUnmount", "componentDidUpdate"].forEach(function (funcName) {
+ patch$1(target, funcName);
+ });
+
+ if (!target.shouldComponentUpdate) {
+ target.shouldComponentUpdate = reactiveMixin.shouldComponentUpdate;
+ } else {
+ if (target.shouldComponentUpdate !== reactiveMixin.shouldComponentUpdate) {
+ // TODO: make throw in next major
+ console.warn("Use `shouldComponentUpdate` in an `observer` based component breaks the behavior of `observer` and might lead to unexpected results. Manually implementing `sCU` should not be needed when using mobx-react.");
+ }
+ }
+}
+
+var Observer = observer(function (_ref2) {
+ var children = _ref2.children,
+ observerInject = _ref2.inject,
+ render = _ref2.render;
+ var component = children || render;
+
+ if (typeof component === "undefined") {
+ return null;
+ }
+
+ if (!observerInject) {
+ return component();
+ } // TODO: remove in next major
+
+
+ console.warn(" is no longer supported. Please use inject on the enclosing component instead");
+ var InjectComponent = inject(observerInject)(component);
+ return react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(InjectComponent, null);
+});
+Observer.displayName = "Observer";
+
+var ObserverPropsCheck = function ObserverPropsCheck(props, key, componentName, location, propFullName) {
+ var extraKey = key === "children" ? "render" : "children";
+
+ if (typeof props[key] === "function" && typeof props[extraKey] === "function") {
+ return new Error("Invalid prop,do not use children and render in the same time in`" + componentName);
+ }
+
+ if (typeof props[key] === "function" || typeof props[extraKey] === "function") {
+ return;
+ }
+
+ return new Error("Invalid prop `" + propFullName + "` of type `" + _typeof(props[key]) + "` supplied to" + " `" + componentName + "`, expected `function`.");
+};
+
+Observer.propTypes = {
+ render: ObserverPropsCheck,
+ children: ObserverPropsCheck
+};
+
+/**
+ * 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 componentWillMount() {
+ // Call this.constructor.gDSFP to support sub-classes.
+ var state = this.constructor.getDerivedStateFromProps(this.props, this.state);
+ if (state !== null && state !== undefined) {
+ this.setState(state);
+ }
+}
+
+function componentWillReceiveProps(nextProps) {
+ // Call this.constructor.gDSFP to support sub-classes.
+ // Use the setState() updater to ensure state isn't stale in certain edge cases.
+ function updater(prevState) {
+ var state = this.constructor.getDerivedStateFromProps(nextProps, prevState);
+ return state !== null && state !== undefined ? state : null;
+ }
+ // Binding "this" is important for shallow renderer support.
+ this.setState(updater.bind(this));
+}
+
+function componentWillUpdate(nextProps, nextState) {
+ try {
+ var prevProps = this.props;
+ var prevState = this.state;
+ this.props = nextProps;
+ this.state = nextState;
+ this.__reactInternalSnapshotFlag = true;
+ this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(
+ prevProps,
+ prevState
+ );
+ } finally {
+ this.props = prevProps;
+ this.state = prevState;
+ }
+}
+
+// React may warn about cWM/cWRP/cWU methods being deprecated.
+// Add a flag to suppress these warnings for this special case.
+componentWillMount.__suppressDeprecationWarning = true;
+componentWillReceiveProps.__suppressDeprecationWarning = true;
+componentWillUpdate.__suppressDeprecationWarning = true;
+
+function polyfill(Component$$1) {
+ var prototype = Component$$1.prototype;
+
+ if (!prototype || !prototype.isReactComponent) {
+ throw new Error('Can only polyfill class components');
+ }
+
+ if (
+ typeof Component$$1.getDerivedStateFromProps !== 'function' &&
+ typeof prototype.getSnapshotBeforeUpdate !== 'function'
+ ) {
+ return Component$$1;
+ }
+
+ // If new component APIs are defined, "unsafe" lifecycles won't be called.
+ // Error if any of these lifecycles are present,
+ // Because they would work differently between older and newer (16.3+) versions of React.
+ var foundWillMountName = null;
+ var foundWillReceivePropsName = null;
+ var foundWillUpdateName = null;
+ if (typeof prototype.componentWillMount === 'function') {
+ foundWillMountName = 'componentWillMount';
+ } else if (typeof prototype.UNSAFE_componentWillMount === 'function') {
+ foundWillMountName = 'UNSAFE_componentWillMount';
+ }
+ if (typeof prototype.componentWillReceiveProps === 'function') {
+ foundWillReceivePropsName = 'componentWillReceiveProps';
+ } else if (typeof prototype.UNSAFE_componentWillReceiveProps === 'function') {
+ foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
+ }
+ if (typeof prototype.componentWillUpdate === 'function') {
+ foundWillUpdateName = 'componentWillUpdate';
+ } else if (typeof prototype.UNSAFE_componentWillUpdate === 'function') {
+ foundWillUpdateName = 'UNSAFE_componentWillUpdate';
+ }
+ if (
+ foundWillMountName !== null ||
+ foundWillReceivePropsName !== null ||
+ foundWillUpdateName !== null
+ ) {
+ var componentName = Component$$1.displayName || Component$$1.name;
+ var newApiName =
+ typeof Component$$1.getDerivedStateFromProps === 'function'
+ ? 'getDerivedStateFromProps()'
+ : 'getSnapshotBeforeUpdate()';
+
+ throw Error(
+ 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
+ componentName +
+ ' uses ' +
+ newApiName +
+ ' but also contains the following legacy lifecycles:' +
+ (foundWillMountName !== null ? '\n ' + foundWillMountName : '') +
+ (foundWillReceivePropsName !== null
+ ? '\n ' + foundWillReceivePropsName
+ : '') +
+ (foundWillUpdateName !== null ? '\n ' + foundWillUpdateName : '') +
+ '\n\nThe above lifecycles should be removed. Learn more about this warning here:\n' +
+ 'https://fb.me/react-async-component-lifecycle-hooks'
+ );
+ }
+
+ // React <= 16.2 does not support static getDerivedStateFromProps.
+ // As a workaround, use cWM and cWRP to invoke the new static lifecycle.
+ // Newer versions of React will ignore these lifecycles if gDSFP exists.
+ if (typeof Component$$1.getDerivedStateFromProps === 'function') {
+ prototype.componentWillMount = componentWillMount;
+ prototype.componentWillReceiveProps = componentWillReceiveProps;
+ }
+
+ // React <= 16.2 does not support getSnapshotBeforeUpdate.
+ // As a workaround, use cWU to invoke the new lifecycle.
+ // Newer versions of React will ignore that lifecycle if gSBU exists.
+ if (typeof prototype.getSnapshotBeforeUpdate === 'function') {
+ if (typeof prototype.componentDidUpdate !== 'function') {
+ throw new Error(
+ 'Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype'
+ );
+ }
+
+ prototype.componentWillUpdate = componentWillUpdate;
+
+ var componentDidUpdate = prototype.componentDidUpdate;
+
+ prototype.componentDidUpdate = function componentDidUpdatePolyfill(
+ prevProps,
+ prevState,
+ maybeSnapshot
+ ) {
+ // 16.3+ will not execute our will-update method;
+ // It will pass a snapshot value to did-update though.
+ // Older versions will require our polyfilled will-update value.
+ // We need to handle both cases, but can't just check for the presence of "maybeSnapshot",
+ // Because for <= 15.x versions this might be a "prevContext" object.
+ // We also can't just check "__reactInternalSnapshot",
+ // Because get-snapshot might return a falsy value.
+ // So check for the explicit __reactInternalSnapshotFlag flag to determine behavior.
+ var snapshot = this.__reactInternalSnapshotFlag
+ ? this.__reactInternalSnapshot
+ : maybeSnapshot;
+
+ componentDidUpdate.call(this, prevProps, prevState, snapshot);
+ };
+ }
+
+ return Component$$1;
+}
+
+var specialReactKeys = {
+ children: true,
+ key: true,
+ ref: true
+};
+
+var Provider =
+/*#__PURE__*/
+function (_Component) {
+ _inherits(Provider, _Component);
+
+ function Provider(props, context) {
+ var _this;
+
+ _classCallCheck(this, Provider);
+
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(Provider).call(this, props, context));
+ _this.state = {};
+ copyStores(props, _this.state);
+ return _this;
+ }
+
+ _createClass(Provider, [{
+ key: "render",
+ value: function render() {
+ return react__WEBPACK_IMPORTED_MODULE_1__["Children"].only(this.props.children);
+ }
+ }, {
+ key: "getChildContext",
+ value: function getChildContext() {
+ var stores = {}; // inherit stores
+
+ copyStores(this.context.mobxStores, stores); // add own stores
+
+ copyStores(this.props, stores);
+ return {
+ mobxStores: stores
+ };
+ }
+ }], [{
+ key: "getDerivedStateFromProps",
+ value: function getDerivedStateFromProps(nextProps, prevState) {
+ if (!nextProps) return null;
+ if (!prevState) return nextProps; // Maybe this warning is too aggressive?
+
+ if (Object.keys(nextProps).filter(validStoreName).length !== Object.keys(prevState).filter(validStoreName).length) console.warn("MobX Provider: The set of provided stores has changed. Please avoid changing stores as the change might not propagate to all children");
+ if (!nextProps.suppressChangedStoreWarning) for (var key in nextProps) {
+ if (validStoreName(key) && prevState[key] !== nextProps[key]) console.warn("MobX Provider: Provided store '" + key + "' has changed. Please avoid replacing stores as the change might not propagate to all children");
+ }
+ return nextProps;
+ }
+ }]);
+
+ return Provider;
+}(react__WEBPACK_IMPORTED_MODULE_1__["Component"]);
+
+Provider.contextTypes = {
+ mobxStores: objectOrObservableObject
+};
+Provider.childContextTypes = {
+ mobxStores: objectOrObservableObject.isRequired
+};
+
+function copyStores(from, to) {
+ if (!from) return;
+
+ for (var key in from) {
+ if (validStoreName(key)) to[key] = from[key];
+ }
+}
+
+function validStoreName(key) {
+ return !specialReactKeys[key] && key !== "suppressChangedStoreWarning";
+} // TODO: kill in next major
+
+
+polyfill(Provider);
+
+var storeKey = newSymbol("disposeOnUnmount");
+
+function runDisposersOnWillUnmount() {
+ var _this = this;
+
+ if (!this[storeKey]) {
+ // when disposeOnUnmount is only set to some instances of a component it will still patch the prototype
+ return;
+ }
+
+ this[storeKey].forEach(function (propKeyOrFunction) {
+ var prop = typeof propKeyOrFunction === "string" ? _this[propKeyOrFunction] : propKeyOrFunction;
+
+ if (prop !== undefined && prop !== null) {
+ if (typeof prop !== "function") {
+ throw new Error("[mobx-react] disposeOnUnmount only works on functions such as disposers returned by reactions, autorun, etc.");
+ }
+
+ prop();
+ }
+ });
+ this[storeKey] = [];
+}
+
+function disposeOnUnmount(target, propertyKeyOrFunction) {
+ if (Array.isArray(propertyKeyOrFunction)) {
+ return propertyKeyOrFunction.map(function (fn) {
+ return disposeOnUnmount(target, fn);
+ });
+ }
+
+ if (!target instanceof react__WEBPACK_IMPORTED_MODULE_1__["Component"]) {
+ throw new Error("[mobx-react] disposeOnUnmount only works on class based React components.");
+ }
+
+ if (typeof propertyKeyOrFunction !== "string" && typeof propertyKeyOrFunction !== "function") {
+ throw new Error("[mobx-react] disposeOnUnmount only works if the parameter is either a property key or a function.");
+ } // add property key / function we want run (disposed) to the store
+
+
+ var componentWasAlreadyModified = !!target[storeKey];
+ var store = target[storeKey] || (target[storeKey] = []);
+ store.push(propertyKeyOrFunction); // tweak the component class componentWillUnmount if not done already
+
+ if (!componentWasAlreadyModified) {
+ patch(target, "componentWillUnmount", runDisposersOnWillUnmount);
+ } // return the disposer as is if invoked as a non decorator
+
+
+ if (typeof propertyKeyOrFunction !== "string") {
+ return propertyKeyOrFunction;
+ }
+}
+
+if (!react__WEBPACK_IMPORTED_MODULE_1__["Component"]) throw new Error("mobx-react requires React to be available");
+if (!mobx__WEBPACK_IMPORTED_MODULE_0__["spy"]) throw new Error("mobx-react requires mobx to be available");
+if (typeof react_dom__WEBPACK_IMPORTED_MODULE_2__["unstable_batchedUpdates"] === "function") Object(mobx__WEBPACK_IMPORTED_MODULE_0__["configure"])({
+ reactionScheduler: react_dom__WEBPACK_IMPORTED_MODULE_2__["unstable_batchedUpdates"]
+});
+var onError = function onError(fn) {
+ return errorsReporter.on(fn);
+};
+
+if ((typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === "undefined" ? "undefined" : _typeof(__MOBX_DEVTOOLS_GLOBAL_HOOK__)) === "object") {
+ var mobx = {
+ spy: mobx__WEBPACK_IMPORTED_MODULE_0__["spy"],
+ extras: {
+ getDebugName: mobx__WEBPACK_IMPORTED_MODULE_0__["getDebugName"]
+ }
+ };
+ var mobxReact = {
+ renderReporter: renderReporter,
+ componentByNodeRegistry: componentByNodeRegistry,
+ componentByNodeRegistery: componentByNodeRegistry,
+ trackComponents: trackComponents
+ };
+
+ __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobxReact(mobxReact, mobx);
+}
+
+
+
+
+/***/ }),
+
+/***/ "./node_modules/mobx/lib/mobx.module.js":
+/*!**********************************************!*\
+ !*** ./node_modules/mobx/lib/mobx.module.js ***!
+ \**********************************************/
+/*! exports provided: Reaction, untracked, IDerivationState, createAtom, spy, comparer, isObservableObject, isBoxedObservable, isObservableArray, ObservableMap, isObservableMap, transaction, observable, computed, isObservable, isObservableProp, isComputed, isComputedProp, extendObservable, observe, intercept, autorun, reaction, when, action, isAction, runInAction, keys, values, entries, set, remove, has, get, decorate, configure, onBecomeObserved, onBecomeUnobserved, flow, toJS, trace, getDependencyTree, getObserverTree, _resetGlobalState, _getGlobalState, getDebugName, getAtom, _getAdministration, _allowStateChanges, _allowStateChangesInsideComputed, isArrayLike, $mobx, _isComputingDerivation, onReactionError, _interceptReads */
+/*! all exports used */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* WEBPACK VAR INJECTION */(function(process, global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Reaction", function() { return Reaction$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "untracked", function() { return untracked$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IDerivationState", function() { return IDerivationState; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createAtom", function() { return createAtom$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "spy", function() { return spy$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "comparer", function() { return comparer$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObservableObject", function() { return isObservableObject$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isBoxedObservable", function() { return isObservableValue$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObservableArray", function() { return isObservableArray$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ObservableMap", function() { return ObservableMap$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObservableMap", function() { return isObservableMap$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transaction", function() { return transaction$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "observable", function() { return observable$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computed", function() { return computed$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObservable", function() { return isObservable$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObservableProp", function() { return isObservableProp$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isComputed", function() { return isComputed$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isComputedProp", function() { return isComputedProp$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extendObservable", function() { return extendObservable$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "observe", function() { return observe$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "intercept", function() { return intercept$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "autorun", function() { return autorun$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reaction", function() { return reaction$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "when", function() { return when$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "action", function() { return action$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isAction", function() { return isAction$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runInAction", function() { return runInAction$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return keys$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "values", function() { return values$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "entries", function() { return entries$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "set", function() { return set$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "remove", function() { return remove$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "has", function() { return has$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return get$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "decorate", function() { return decorate$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "configure", function() { return configure$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onBecomeObserved", function() { return onBecomeObserved$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onBecomeUnobserved", function() { return onBecomeUnobserved$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "flow", function() { return flow$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toJS", function() { return toJS$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "trace", function() { return trace$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDependencyTree", function() { return getDependencyTree$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getObserverTree", function() { return getObserverTree$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_resetGlobalState", function() { return resetGlobalState$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_getGlobalState", function() { return getGlobalState$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDebugName", function() { return getDebugName$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAtom", function() { return getAtom$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_getAdministration", function() { return getAdministration$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_allowStateChanges", function() { return allowStateChanges$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_allowStateChangesInsideComputed", function() { return allowStateChangesInsideComputed$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isArrayLike", function() { return isArrayLike$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "$mobx", function() { return $mobx$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_isComputingDerivation", function() { return isComputingDerivation$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onReactionError", function() { return onReactionError$$1; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_interceptReads", function() { return interceptReads$$1; });
+/** MobX - (c) Michel Weststrate 2015 - 2018 - MIT Licensed */
+/*! *****************************************************************************
+Copyright (c) Microsoft Corporation. All rights reserved.
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+this file except in compliance with the License. You may obtain a copy of the
+License at http://www.apache.org/licenses/LICENSE-2.0
+
+THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
+WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
+MERCHANTABLITY OR NON-INFRINGEMENT.
+
+See the Apache Version 2.0 License for specific language governing permissions
+and limitations under the License.
+***************************************************************************** */
+/* global Reflect, Promise */
+
+var extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+
+function __extends(d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+}
+
+var __assign = Object.assign || function __assign(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+ }
+ return t;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+function __values(o) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
+ if (m) return m.call(o);
+ return {
+ next: function () {
+ if (o && i >= o.length) o = void 0;
+ return { value: o && o[i++], done: !o };
+ }
+ };
+}
+
+function __read(o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+}
+
+function __spread() {
+ for (var ar = [], i = 0; i < arguments.length; i++)
+ ar = ar.concat(__read(arguments[i]));
+ return ar;
+}
+
+var OBFUSCATED_ERROR$$1 = "An invariant failed, however the error is obfuscated because this is an production build.";
+var EMPTY_ARRAY$$1 = [];
+Object.freeze(EMPTY_ARRAY$$1);
+var EMPTY_OBJECT$$1 = {};
+Object.freeze(EMPTY_OBJECT$$1);
+function getNextId$$1() {
+ return ++globalState$$1.mobxGuid;
+}
+function fail$$1(message) {
+ invariant$$1(false, message);
+ throw "X"; // unreachable
+}
+function invariant$$1(check, message) {
+ if (!check)
+ throw new Error("[mobx] " + (message || OBFUSCATED_ERROR$$1));
+}
+/**
+ * Prints a deprecation message, but only one time.
+ * Returns false if the deprecated message was already printed before
+ */
+var deprecatedMessages = [];
+function deprecated$$1(msg, thing) {
+ if (false)
+ {}
+ if (thing) {
+ return deprecated$$1("'" + msg + "', use '" + thing + "' instead.");
+ }
+ if (deprecatedMessages.indexOf(msg) !== -1)
+ return false;
+ deprecatedMessages.push(msg);
+ console.error("[mobx] Deprecated: " + msg);
+ return true;
+}
+/**
+ * Makes sure that the provided function is invoked at most once.
+ */
+function once$$1(func) {
+ var invoked = false;
+ return function () {
+ if (invoked)
+ return;
+ invoked = true;
+ return func.apply(this, arguments);
+ };
+}
+var noop$$1 = function () { };
+function unique$$1(list) {
+ var res = [];
+ list.forEach(function (item) {
+ if (res.indexOf(item) === -1)
+ res.push(item);
+ });
+ return res;
+}
+function isObject$$1(value) {
+ return value !== null && typeof value === "object";
+}
+function isPlainObject$$1(value) {
+ if (value === null || typeof value !== "object")
+ return false;
+ var proto = Object.getPrototypeOf(value);
+ return proto === Object.prototype || proto === null;
+}
+
+function addHiddenProp$$1(object, propName, value) {
+ Object.defineProperty(object, propName, {
+ enumerable: false,
+ writable: true,
+ configurable: true,
+ value: value
+ });
+}
+function addHiddenFinalProp$$1(object, propName, value) {
+ Object.defineProperty(object, propName, {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: value
+ });
+}
+function isPropertyConfigurable$$1(object, prop) {
+ var descriptor = Object.getOwnPropertyDescriptor(object, prop);
+ return !descriptor || (descriptor.configurable !== false && descriptor.writable !== false);
+}
+function assertPropertyConfigurable$$1(object, prop) {
+ if ( true && !isPropertyConfigurable$$1(object, prop))
+ fail$$1("Cannot make property '" + prop.toString() + "' observable, it is not configurable and writable in the target object");
+}
+function createInstanceofPredicate$$1(name, clazz) {
+ var propName = "isMobX" + name;
+ clazz.prototype[propName] = true;
+ return function (x) {
+ return isObject$$1(x) && x[propName] === true;
+ };
+}
+/**
+ * Returns whether the argument is an array, disregarding observability.
+ */
+function isArrayLike$$1(x) {
+ return Array.isArray(x) || isObservableArray$$1(x);
+}
+function isES6Map$$1(thing) {
+ return thing instanceof Map;
+}
+function getMapLikeKeys$$1(map) {
+ if (isPlainObject$$1(map))
+ return Object.keys(map);
+ if (Array.isArray(map))
+ return map.map(function (_a) {
+ var _b = __read(_a, 1), key = _b[0];
+ return key;
+ });
+ if (isES6Map$$1(map) || isObservableMap$$1(map))
+ return Array.from(map.keys());
+ return fail$$1("Cannot get keys from '" + map + "'");
+}
+function toPrimitive$$1(value) {
+ return value === null ? null : typeof value === "object" ? "" + value : value;
+}
+
+var $mobx$$1 = Symbol("mobx administration");
+var Atom$$1 = /** @class */ (function () {
+ /**
+ * Create a new atom. For debugging purposes it is recommended to give it a name.
+ * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.
+ */
+ function Atom$$1(name) {
+ if (name === void 0) { name = "Atom@" + getNextId$$1(); }
+ this.name = name;
+ this.isPendingUnobservation = false; // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed
+ this.isBeingObserved = false;
+ this.observers = new Set();
+ this.diffValue = 0;
+ this.lastAccessedBy = 0;
+ this.lowestObserverState = IDerivationState.NOT_TRACKING;
+ }
+ Atom$$1.prototype.onBecomeObserved = function () {
+ if (this.onBecomeObservedListeners) {
+ this.onBecomeObservedListeners.forEach(function (listener) { return listener(); });
+ }
+ };
+ Atom$$1.prototype.onBecomeUnobserved = function () {
+ if (this.onBecomeUnobservedListeners) {
+ this.onBecomeUnobservedListeners.forEach(function (listener) { return listener(); });
+ }
+ };
+ /**
+ * Invoke this method to notify mobx that your atom has been used somehow.
+ * Returns true if there is currently a reactive context.
+ */
+ Atom$$1.prototype.reportObserved = function () {
+ return reportObserved$$1(this);
+ };
+ /**
+ * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.
+ */
+ Atom$$1.prototype.reportChanged = function () {
+ startBatch$$1();
+ propagateChanged$$1(this);
+ endBatch$$1();
+ };
+ Atom$$1.prototype.toString = function () {
+ return this.name;
+ };
+ return Atom$$1;
+}());
+var isAtom$$1 = createInstanceofPredicate$$1("Atom", Atom$$1);
+function createAtom$$1(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {
+ if (onBecomeObservedHandler === void 0) { onBecomeObservedHandler = noop$$1; }
+ if (onBecomeUnobservedHandler === void 0) { onBecomeUnobservedHandler = noop$$1; }
+ var atom = new Atom$$1(name);
+ // default `noop` listener will not initialize the hook Set
+ if (onBecomeObservedHandler !== noop$$1) {
+ onBecomeObserved$$1(atom, onBecomeObservedHandler);
+ }
+ if (onBecomeUnobservedHandler !== noop$$1) {
+ onBecomeUnobserved$$1(atom, onBecomeUnobservedHandler);
+ }
+ return atom;
+}
+
+function identityComparer(a, b) {
+ return a === b;
+}
+function structuralComparer(a, b) {
+ return deepEqual$$1(a, b);
+}
+function defaultComparer(a, b) {
+ return Object.is(a, b);
+}
+var comparer$$1 = {
+ identity: identityComparer,
+ structural: structuralComparer,
+ default: defaultComparer
+};
+
+var mobxDidRunLazyInitializersSymbol$$1 = Symbol("mobx did run lazy initializers");
+var mobxPendingDecorators$$1 = Symbol("mobx pending decorators");
+var enumerableDescriptorCache = {};
+var nonEnumerableDescriptorCache = {};
+function createPropertyInitializerDescriptor(prop, enumerable) {
+ var cache = enumerable ? enumerableDescriptorCache : nonEnumerableDescriptorCache;
+ return (cache[prop] ||
+ (cache[prop] = {
+ configurable: true,
+ enumerable: enumerable,
+ get: function () {
+ initializeInstance$$1(this);
+ return this[prop];
+ },
+ set: function (value) {
+ initializeInstance$$1(this);
+ this[prop] = value;
+ }
+ }));
+}
+function initializeInstance$$1(target) {
+ if (target[mobxDidRunLazyInitializersSymbol$$1] === true)
+ return;
+ var decorators = target[mobxPendingDecorators$$1];
+ if (decorators) {
+ addHiddenProp$$1(target, mobxDidRunLazyInitializersSymbol$$1, true);
+ for (var key in decorators) {
+ var d = decorators[key];
+ d.propertyCreator(target, d.prop, d.descriptor, d.decoratorTarget, d.decoratorArguments);
+ }
+ }
+}
+function createPropDecorator$$1(propertyInitiallyEnumerable, propertyCreator) {
+ return function decoratorFactory() {
+ var decoratorArguments;
+ var decorator = function decorate$$1(target, prop, descriptor, applyImmediately
+ // This is a special parameter to signal the direct application of a decorator, allow extendObservable to skip the entire type decoration part,
+ // as the instance to apply the decorator to equals the target
+ ) {
+ if (applyImmediately === true) {
+ propertyCreator(target, prop, descriptor, target, decoratorArguments);
+ return null;
+ }
+ if ( true && !quacksLikeADecorator$$1(arguments))
+ fail$$1("This function is a decorator, but it wasn't invoked like a decorator");
+ if (!Object.prototype.hasOwnProperty.call(target, mobxPendingDecorators$$1)) {
+ var inheritedDecorators = target[mobxPendingDecorators$$1];
+ addHiddenProp$$1(target, mobxPendingDecorators$$1, __assign({}, inheritedDecorators));
+ }
+ target[mobxPendingDecorators$$1][prop] = {
+ prop: prop,
+ propertyCreator: propertyCreator,
+ descriptor: descriptor,
+ decoratorTarget: target,
+ decoratorArguments: decoratorArguments
+ };
+ return createPropertyInitializerDescriptor(prop, propertyInitiallyEnumerable);
+ };
+ if (quacksLikeADecorator$$1(arguments)) {
+ // @decorator
+ decoratorArguments = EMPTY_ARRAY$$1;
+ return decorator.apply(null, arguments);
+ }
+ else {
+ // @decorator(args)
+ decoratorArguments = Array.prototype.slice.call(arguments);
+ return decorator;
+ }
+ };
+}
+function quacksLikeADecorator$$1(args) {
+ return (((args.length === 2 || args.length === 3) && typeof args[1] === "string") ||
+ (args.length === 4 && args[3] === true));
+}
+
+function deepEnhancer$$1(v, _, name) {
+ // it is an observable already, done
+ if (isObservable$$1(v))
+ return v;
+ // something that can be converted and mutated?
+ if (Array.isArray(v))
+ return observable$$1.array(v, { name: name });
+ if (isPlainObject$$1(v))
+ return observable$$1.object(v, undefined, { name: name });
+ if (isES6Map$$1(v))
+ return observable$$1.map(v, { name: name });
+ return v;
+}
+function shallowEnhancer$$1(v, _, name) {
+ if (v === undefined || v === null)
+ return v;
+ if (isObservableObject$$1(v) || isObservableArray$$1(v) || isObservableMap$$1(v))
+ return v;
+ if (Array.isArray(v))
+ return observable$$1.array(v, { name: name, deep: false });
+ if (isPlainObject$$1(v))
+ return observable$$1.object(v, undefined, { name: name, deep: false });
+ if (isES6Map$$1(v))
+ return observable$$1.map(v, { name: name, deep: false });
+ return fail$$1( true &&
+ "The shallow modifier / decorator can only used in combination with arrays, objects and maps");
+}
+function referenceEnhancer$$1(newValue) {
+ // never turn into an observable
+ return newValue;
+}
+function refStructEnhancer$$1(v, oldValue, name) {
+ if ( true && isObservable$$1(v))
+ throw "observable.struct should not be used with observable values";
+ if (deepEqual$$1(v, oldValue))
+ return oldValue;
+ return v;
+}
+
+function createDecoratorForEnhancer$$1(enhancer) {
+ invariant$$1(enhancer);
+ var decorator = createPropDecorator$$1(true, function (target, propertyName, descriptor, _decoratorTarget, decoratorArgs) {
+ if (true) {
+ invariant$$1(!descriptor || !descriptor.get, "@observable cannot be used on getter (property \"" + propertyName + "\"), use @computed instead.");
+ }
+ var initialValue = descriptor
+ ? descriptor.initializer
+ ? descriptor.initializer.call(target)
+ : descriptor.value
+ : undefined;
+ asObservableObject$$1(target).addObservableProp(propertyName, initialValue, enhancer);
+ });
+ var res =
+ // Extra process checks, as this happens during module initialization
+ typeof process !== "undefined" && process.env && "development" !== "production"
+ ? function observableDecorator() {
+ // This wrapper function is just to detect illegal decorator invocations, deprecate in a next version
+ // and simply return the created prop decorator
+ if (arguments.length < 2)
+ return fail$$1("Incorrect decorator invocation. @observable decorator doesn't expect any arguments");
+ return decorator.apply(null, arguments);
+ }
+ : decorator;
+ res.enhancer = enhancer;
+ return res;
+}
+
+// Predefined bags of create observable options, to avoid allocating temporarily option objects
+// in the majority of cases
+var defaultCreateObservableOptions$$1 = {
+ deep: true,
+ name: undefined,
+ defaultDecorator: undefined,
+ proxy: true
+};
+Object.freeze(defaultCreateObservableOptions$$1);
+function assertValidOption(key) {
+ if (!/^(deep|name|defaultDecorator|proxy)$/.test(key))
+ fail$$1("invalid option for (extend)observable: " + key);
+}
+function asCreateObservableOptions$$1(thing) {
+ if (thing === null || thing === undefined)
+ return defaultCreateObservableOptions$$1;
+ if (typeof thing === "string")
+ return { name: thing, deep: true, proxy: true };
+ if (true) {
+ if (typeof thing !== "object")
+ return fail$$1("expected options object");
+ Object.keys(thing).forEach(assertValidOption);
+ }
+ return thing;
+}
+var deepDecorator$$1 = createDecoratorForEnhancer$$1(deepEnhancer$$1);
+var shallowDecorator = createDecoratorForEnhancer$$1(shallowEnhancer$$1);
+var refDecorator$$1 = createDecoratorForEnhancer$$1(referenceEnhancer$$1);
+var refStructDecorator = createDecoratorForEnhancer$$1(refStructEnhancer$$1);
+function getEnhancerFromOptions(options) {
+ return options.defaultDecorator
+ ? options.defaultDecorator.enhancer
+ : options.deep === false
+ ? referenceEnhancer$$1
+ : deepEnhancer$$1;
+}
+/**
+ * Turns an object, array or function into a reactive structure.
+ * @param v the value which should become observable.
+ */
+function createObservable(v, arg2, arg3) {
+ // @observable someProp;
+ if (typeof arguments[1] === "string") {
+ return deepDecorator$$1.apply(null, arguments);
+ }
+ // it is an observable already, done
+ if (isObservable$$1(v))
+ return v;
+ // something that can be converted and mutated?
+ var res = isPlainObject$$1(v)
+ ? observable$$1.object(v, arg2, arg3)
+ : Array.isArray(v)
+ ? observable$$1.array(v, arg2)
+ : isES6Map$$1(v)
+ ? observable$$1.map(v, arg2)
+ : v;
+ // this value could be converted to a new observable data structure, return it
+ if (res !== v)
+ return res;
+ // otherwise, just box it
+ fail$$1( true &&
+ "The provided value could not be converted into an observable. If you want just create an observable reference to the object use 'observable.box(value)'");
+}
+var observableFactories = {
+ box: function (value, options) {
+ if (arguments.length > 2)
+ incorrectlyUsedAsDecorator("box");
+ var o = asCreateObservableOptions$$1(options);
+ return new ObservableValue$$1(value, getEnhancerFromOptions(o), o.name);
+ },
+ array: function (initialValues, options) {
+ if (arguments.length > 2)
+ incorrectlyUsedAsDecorator("array");
+ var o = asCreateObservableOptions$$1(options);
+ return createObservableArray$$1(initialValues, getEnhancerFromOptions(o), o.name);
+ },
+ map: function (initialValues, options) {
+ if (arguments.length > 2)
+ incorrectlyUsedAsDecorator("map");
+ var o = asCreateObservableOptions$$1(options);
+ return new ObservableMap$$1(initialValues, getEnhancerFromOptions(o), o.name);
+ },
+ object: function (props, decorators, options) {
+ if (typeof arguments[1] === "string")
+ incorrectlyUsedAsDecorator("object");
+ var o = asCreateObservableOptions$$1(options);
+ if (o.proxy === false) {
+ return extendObservable$$1({}, props, decorators, o);
+ }
+ else {
+ var defaultDecorator = getDefaultDecoratorFromObjectOptions$$1(o);
+ var base = extendObservable$$1({}, undefined, undefined, o);
+ var proxy = createDynamicObservableObject$$1(base);
+ extendObservableObjectWithProperties$$1(proxy, props, decorators, defaultDecorator);
+ return proxy;
+ }
+ },
+ ref: refDecorator$$1,
+ shallow: shallowDecorator,
+ deep: deepDecorator$$1,
+ struct: refStructDecorator
+};
+var observable$$1 = createObservable;
+// weird trick to keep our typings nicely with our funcs, and still extend the observable function
+Object.keys(observableFactories).forEach(function (name) { return (observable$$1[name] = observableFactories[name]); });
+function incorrectlyUsedAsDecorator(methodName) {
+ fail$$1(
+ // process.env.NODE_ENV !== "production" &&
+ "Expected one or two arguments to observable." + methodName + ". Did you accidentally try to use observable." + methodName + " as decorator?");
+}
+
+var computedDecorator$$1 = createPropDecorator$$1(false, function (instance, propertyName, descriptor, decoratorTarget, decoratorArgs) {
+ var get$$1 = descriptor.get, set$$1 = descriptor.set; // initialValue is the descriptor for get / set props
+ // Optimization: faster on decorator target or instance? Assuming target
+ // Optimization: find out if declaring on instance isn't just faster. (also makes the property descriptor simpler). But, more memory usage..
+ // Forcing instance now, fixes hot reloadig issues on React Native:
+ var options = decoratorArgs[0] || {};
+ asObservableObject$$1(instance).addComputedProp(instance, propertyName, __assign({ get: get$$1,
+ set: set$$1, context: instance }, options));
+});
+var computedStructDecorator = computedDecorator$$1({ equals: comparer$$1.structural });
+/**
+ * Decorator for class properties: @computed get value() { return expr; }.
+ * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;
+ */
+var computed$$1 = function computed$$1(arg1, arg2, arg3) {
+ if (typeof arg2 === "string") {
+ // @computed
+ return computedDecorator$$1.apply(null, arguments);
+ }
+ if (arg1 !== null && typeof arg1 === "object" && arguments.length === 1) {
+ // @computed({ options })
+ return computedDecorator$$1.apply(null, arguments);
+ }
+ // computed(expr, options?)
+ if (true) {
+ invariant$$1(typeof arg1 === "function", "First argument to `computed` should be an expression.");
+ invariant$$1(arguments.length < 3, "Computed takes one or two arguments if used as function");
+ }
+ var opts = typeof arg2 === "object" ? arg2 : {};
+ opts.get = arg1;
+ opts.set = typeof arg2 === "function" ? arg2 : opts.set;
+ opts.name = opts.name || arg1.name || ""; /* for generated name */
+ return new ComputedValue$$1(opts);
+};
+computed$$1.struct = computedStructDecorator;
+
+function createAction$$1(actionName, fn) {
+ if (true) {
+ invariant$$1(typeof fn === "function", "`action` can only be invoked on functions");
+ if (typeof actionName !== "string" || !actionName)
+ fail$$1("actions should have valid names, got: '" + actionName + "'");
+ }
+ var res = function () {
+ return executeAction$$1(actionName, fn, this, arguments);
+ };
+ res.isMobxAction = true;
+ return res;
+}
+function executeAction$$1(actionName, fn, scope, args) {
+ var runInfo = startAction(actionName, fn, scope, args);
+ try {
+ return fn.apply(scope, args);
+ }
+ finally {
+ endAction(runInfo);
+ }
+}
+function startAction(actionName, fn, scope, args) {
+ var notifySpy = isSpyEnabled$$1() && !!actionName;
+ var startTime = 0;
+ if (notifySpy && "development" !== "production") {
+ startTime = Date.now();
+ var l = (args && args.length) || 0;
+ var flattendArgs = new Array(l);
+ if (l > 0)
+ for (var i = 0; i < l; i++)
+ flattendArgs[i] = args[i];
+ spyReportStart$$1({
+ type: "action",
+ name: actionName,
+ object: scope,
+ arguments: flattendArgs
+ });
+ }
+ var prevDerivation = untrackedStart$$1();
+ startBatch$$1();
+ var prevAllowStateChanges = allowStateChangesStart$$1(true);
+ return {
+ prevDerivation: prevDerivation,
+ prevAllowStateChanges: prevAllowStateChanges,
+ notifySpy: notifySpy,
+ startTime: startTime
+ };
+}
+function endAction(runInfo) {
+ allowStateChangesEnd$$1(runInfo.prevAllowStateChanges);
+ endBatch$$1();
+ untrackedEnd$$1(runInfo.prevDerivation);
+ if (runInfo.notifySpy && "development" !== "production")
+ spyReportEnd$$1({ time: Date.now() - runInfo.startTime });
+}
+function allowStateChanges$$1(allowStateChanges$$1, func) {
+ var prev = allowStateChangesStart$$1(allowStateChanges$$1);
+ var res;
+ try {
+ res = func();
+ }
+ finally {
+ allowStateChangesEnd$$1(prev);
+ }
+ return res;
+}
+function allowStateChangesStart$$1(allowStateChanges$$1) {
+ var prev = globalState$$1.allowStateChanges;
+ globalState$$1.allowStateChanges = allowStateChanges$$1;
+ return prev;
+}
+function allowStateChangesEnd$$1(prev) {
+ globalState$$1.allowStateChanges = prev;
+}
+function allowStateChangesInsideComputed$$1(func) {
+ var prev = globalState$$1.computationDepth;
+ globalState$$1.computationDepth = 0;
+ var res;
+ try {
+ res = func();
+ }
+ finally {
+ globalState$$1.computationDepth = prev;
+ }
+ return res;
+}
+
+var ObservableValue$$1 = /** @class */ (function (_super) {
+ __extends(ObservableValue$$1, _super);
+ function ObservableValue$$1(value, enhancer, name, notifySpy) {
+ if (name === void 0) { name = "ObservableValue@" + getNextId$$1(); }
+ if (notifySpy === void 0) { notifySpy = true; }
+ var _this = _super.call(this, name) || this;
+ _this.enhancer = enhancer;
+ _this.hasUnreportedChange = false;
+ _this.value = enhancer(value, undefined, name);
+ if (notifySpy && isSpyEnabled$$1() && "development" !== "production") {
+ // only notify spy if this is a stand-alone observable
+ spyReport$$1({ type: "create", name: _this.name, newValue: "" + _this.value });
+ }
+ return _this;
+ }
+ ObservableValue$$1.prototype.dehanceValue = function (value) {
+ if (this.dehancer !== undefined)
+ return this.dehancer(value);
+ return value;
+ };
+ ObservableValue$$1.prototype.set = function (newValue) {
+ var oldValue = this.value;
+ newValue = this.prepareNewValue(newValue);
+ if (newValue !== globalState$$1.UNCHANGED) {
+ var notifySpy = isSpyEnabled$$1();
+ if (notifySpy && "development" !== "production") {
+ spyReportStart$$1({
+ type: "update",
+ name: this.name,
+ newValue: newValue,
+ oldValue: oldValue
+ });
+ }
+ this.setNewValue(newValue);
+ if (notifySpy && "development" !== "production")
+ spyReportEnd$$1();
+ }
+ };
+ ObservableValue$$1.prototype.prepareNewValue = function (newValue) {
+ checkIfStateModificationsAreAllowed$$1(this);
+ if (hasInterceptors$$1(this)) {
+ var change = interceptChange$$1(this, {
+ object: this,
+ type: "update",
+ newValue: newValue
+ });
+ if (!change)
+ return globalState$$1.UNCHANGED;
+ newValue = change.newValue;
+ }
+ // apply modifier
+ newValue = this.enhancer(newValue, this.value, this.name);
+ return this.value !== newValue ? newValue : globalState$$1.UNCHANGED;
+ };
+ ObservableValue$$1.prototype.setNewValue = function (newValue) {
+ var oldValue = this.value;
+ this.value = newValue;
+ this.reportChanged();
+ if (hasListeners$$1(this)) {
+ notifyListeners$$1(this, {
+ type: "update",
+ object: this,
+ newValue: newValue,
+ oldValue: oldValue
+ });
+ }
+ };
+ ObservableValue$$1.prototype.get = function () {
+ this.reportObserved();
+ return this.dehanceValue(this.value);
+ };
+ ObservableValue$$1.prototype.intercept = function (handler) {
+ return registerInterceptor$$1(this, handler);
+ };
+ ObservableValue$$1.prototype.observe = function (listener, fireImmediately) {
+ if (fireImmediately)
+ listener({
+ object: this,
+ type: "update",
+ newValue: this.value,
+ oldValue: undefined
+ });
+ return registerListener$$1(this, listener);
+ };
+ ObservableValue$$1.prototype.toJSON = function () {
+ return this.get();
+ };
+ ObservableValue$$1.prototype.toString = function () {
+ return this.name + "[" + this.value + "]";
+ };
+ ObservableValue$$1.prototype.valueOf = function () {
+ return toPrimitive$$1(this.get());
+ };
+ ObservableValue$$1.prototype[Symbol.toPrimitive] = function () {
+ return this.valueOf();
+ };
+ return ObservableValue$$1;
+}(Atom$$1));
+var isObservableValue$$1 = createInstanceofPredicate$$1("ObservableValue", ObservableValue$$1);
+
+/**
+ * A node in the state dependency root that observes other nodes, and can be observed itself.
+ *
+ * ComputedValue will remember the result of the computation for the duration of the batch, or
+ * while being observed.
+ *
+ * During this time it will recompute only when one of its direct dependencies changed,
+ * but only when it is being accessed with `ComputedValue.get()`.
+ *
+ * Implementation description:
+ * 1. First time it's being accessed it will compute and remember result
+ * give back remembered result until 2. happens
+ * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.
+ * 3. When it's being accessed, recompute if any shallow dependency changed.
+ * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.
+ * go to step 2. either way
+ *
+ * If at any point it's outside batch and it isn't observed: reset everything and go to 1.
+ */
+var ComputedValue$$1 = /** @class */ (function () {
+ /**
+ * Create a new computed value based on a function expression.
+ *
+ * The `name` property is for debug purposes only.
+ *
+ * The `equals` property specifies the comparer function to use to determine if a newly produced
+ * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`
+ * compares based on identity comparison (===), and `structualComparer` deeply compares the structure.
+ * Structural comparison can be convenient if you always produce a new aggregated object and
+ * don't want to notify observers if it is structurally the same.
+ * This is useful for working with vectors, mouse coordinates etc.
+ */
+ function ComputedValue$$1(options) {
+ this.dependenciesState = IDerivationState.NOT_TRACKING;
+ this.observing = []; // nodes we are looking at. Our value depends on these nodes
+ this.newObserving = null; // during tracking it's an array with new observed observers
+ this.isBeingObserved = false;
+ this.isPendingUnobservation = false;
+ this.observers = new Set();
+ this.diffValue = 0;
+ this.runId = 0;
+ this.lastAccessedBy = 0;
+ this.lowestObserverState = IDerivationState.UP_TO_DATE;
+ this.unboundDepsCount = 0;
+ this.__mapid = "#" + getNextId$$1();
+ this.value = new CaughtException$$1(null);
+ this.isComputing = false; // to check for cycles
+ this.isRunningSetter = false;
+ this.isTracing = TraceMode$$1.NONE;
+ if ( true && !options.get)
+ throw "[mobx] missing option for computed: get";
+ this.derivation = options.get;
+ this.name = options.name || "ComputedValue@" + getNextId$$1();
+ if (options.set)
+ this.setter = createAction$$1(this.name + "-setter", options.set);
+ this.equals =
+ options.equals ||
+ (options.compareStructural || options.struct
+ ? comparer$$1.structural
+ : comparer$$1.default);
+ this.scope = options.context;
+ this.requiresReaction = !!options.requiresReaction;
+ this.keepAlive = !!options.keepAlive;
+ }
+ ComputedValue$$1.prototype.onBecomeStale = function () {
+ propagateMaybeChanged$$1(this);
+ };
+ ComputedValue$$1.prototype.onBecomeObserved = function () {
+ if (this.onBecomeObservedListeners) {
+ this.onBecomeObservedListeners.forEach(function (listener) { return listener(); });
+ }
+ };
+ ComputedValue$$1.prototype.onBecomeUnobserved = function () {
+ if (this.onBecomeUnobservedListeners) {
+ this.onBecomeUnobservedListeners.forEach(function (listener) { return listener(); });
+ }
+ };
+ /**
+ * Returns the current value of this computed value.
+ * Will evaluate its computation first if needed.
+ */
+ ComputedValue$$1.prototype.get = function () {
+ if (this.isComputing)
+ fail$$1("Cycle detected in computation " + this.name + ": " + this.derivation);
+ if (globalState$$1.inBatch === 0 && this.observers.size === 0 && !this.keepAlive) {
+ if (shouldCompute$$1(this)) {
+ this.warnAboutUntrackedRead();
+ startBatch$$1(); // See perf test 'computed memoization'
+ this.value = this.computeValue(false);
+ endBatch$$1();
+ }
+ }
+ else {
+ reportObserved$$1(this);
+ if (shouldCompute$$1(this))
+ if (this.trackAndCompute())
+ propagateChangeConfirmed$$1(this);
+ }
+ var result = this.value;
+ if (isCaughtException$$1(result))
+ throw result.cause;
+ return result;
+ };
+ ComputedValue$$1.prototype.peek = function () {
+ var res = this.computeValue(false);
+ if (isCaughtException$$1(res))
+ throw res.cause;
+ return res;
+ };
+ ComputedValue$$1.prototype.set = function (value) {
+ if (this.setter) {
+ invariant$$1(!this.isRunningSetter, "The setter of computed value '" + this.name + "' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?");
+ this.isRunningSetter = true;
+ try {
+ this.setter.call(this.scope, value);
+ }
+ finally {
+ this.isRunningSetter = false;
+ }
+ }
+ else
+ invariant$$1(false, true &&
+ "[ComputedValue '" + this.name + "'] It is not possible to assign a new value to a computed value.");
+ };
+ ComputedValue$$1.prototype.trackAndCompute = function () {
+ if (isSpyEnabled$$1() && "development" !== "production") {
+ spyReport$$1({
+ object: this.scope,
+ type: "compute",
+ name: this.name
+ });
+ }
+ var oldValue = this.value;
+ var wasSuspended =
+ /* see #1208 */ this.dependenciesState === IDerivationState.NOT_TRACKING;
+ var newValue = this.computeValue(true);
+ var changed = wasSuspended ||
+ isCaughtException$$1(oldValue) ||
+ isCaughtException$$1(newValue) ||
+ !this.equals(oldValue, newValue);
+ if (changed) {
+ this.value = newValue;
+ }
+ return changed;
+ };
+ ComputedValue$$1.prototype.computeValue = function (track) {
+ this.isComputing = true;
+ globalState$$1.computationDepth++;
+ var res;
+ if (track) {
+ res = trackDerivedFunction$$1(this, this.derivation, this.scope);
+ }
+ else {
+ if (globalState$$1.disableErrorBoundaries === true) {
+ res = this.derivation.call(this.scope);
+ }
+ else {
+ try {
+ res = this.derivation.call(this.scope);
+ }
+ catch (e) {
+ res = new CaughtException$$1(e);
+ }
+ }
+ }
+ globalState$$1.computationDepth--;
+ this.isComputing = false;
+ return res;
+ };
+ ComputedValue$$1.prototype.suspend = function () {
+ if (!this.keepAlive) {
+ clearObserving$$1(this);
+ this.value = undefined; // don't hold on to computed value!
+ }
+ };
+ ComputedValue$$1.prototype.observe = function (listener, fireImmediately) {
+ var _this = this;
+ var firstTime = true;
+ var prevValue = undefined;
+ return autorun$$1(function () {
+ var newValue = _this.get();
+ if (!firstTime || fireImmediately) {
+ var prevU = untrackedStart$$1();
+ listener({
+ type: "update",
+ object: _this,
+ newValue: newValue,
+ oldValue: prevValue
+ });
+ untrackedEnd$$1(prevU);
+ }
+ firstTime = false;
+ prevValue = newValue;
+ });
+ };
+ ComputedValue$$1.prototype.warnAboutUntrackedRead = function () {
+ if (false)
+ {}
+ if (this.requiresReaction === true) {
+ fail$$1("[mobx] Computed value " + this.name + " is read outside a reactive context");
+ }
+ if (this.isTracing !== TraceMode$$1.NONE) {
+ console.log("[mobx.trace] '" + this.name + "' is being read outside a reactive context. Doing a full recompute");
+ }
+ if (globalState$$1.computedRequiresReaction) {
+ console.warn("[mobx] Computed value " + this.name + " is being read outside a reactive context. Doing a full recompute");
+ }
+ };
+ ComputedValue$$1.prototype.toJSON = function () {
+ return this.get();
+ };
+ ComputedValue$$1.prototype.toString = function () {
+ return this.name + "[" + this.derivation.toString() + "]";
+ };
+ ComputedValue$$1.prototype.valueOf = function () {
+ return toPrimitive$$1(this.get());
+ };
+ ComputedValue$$1.prototype[Symbol.toPrimitive] = function () {
+ return this.valueOf();
+ };
+ return ComputedValue$$1;
+}());
+var isComputedValue$$1 = createInstanceofPredicate$$1("ComputedValue", ComputedValue$$1);
+
+var IDerivationState;
+(function (IDerivationState$$1) {
+ // before being run or (outside batch and not being observed)
+ // at this point derivation is not holding any data about dependency tree
+ IDerivationState$$1[IDerivationState$$1["NOT_TRACKING"] = -1] = "NOT_TRACKING";
+ // no shallow dependency changed since last computation
+ // won't recalculate derivation
+ // this is what makes mobx fast
+ IDerivationState$$1[IDerivationState$$1["UP_TO_DATE"] = 0] = "UP_TO_DATE";
+ // some deep dependency changed, but don't know if shallow dependency changed
+ // will require to check first if UP_TO_DATE or POSSIBLY_STALE
+ // currently only ComputedValue will propagate POSSIBLY_STALE
+ //
+ // having this state is second big optimization:
+ // don't have to recompute on every dependency change, but only when it's needed
+ IDerivationState$$1[IDerivationState$$1["POSSIBLY_STALE"] = 1] = "POSSIBLY_STALE";
+ // A shallow dependency has changed since last computation and the derivation
+ // will need to recompute when it's needed next.
+ IDerivationState$$1[IDerivationState$$1["STALE"] = 2] = "STALE";
+})(IDerivationState || (IDerivationState = {}));
+var TraceMode$$1;
+(function (TraceMode$$1) {
+ TraceMode$$1[TraceMode$$1["NONE"] = 0] = "NONE";
+ TraceMode$$1[TraceMode$$1["LOG"] = 1] = "LOG";
+ TraceMode$$1[TraceMode$$1["BREAK"] = 2] = "BREAK";
+})(TraceMode$$1 || (TraceMode$$1 = {}));
+var CaughtException$$1 = /** @class */ (function () {
+ function CaughtException$$1(cause) {
+ this.cause = cause;
+ // Empty
+ }
+ return CaughtException$$1;
+}());
+function isCaughtException$$1(e) {
+ return e instanceof CaughtException$$1;
+}
+/**
+ * Finds out whether any dependency of the derivation has actually changed.
+ * If dependenciesState is 1 then it will recalculate dependencies,
+ * if any dependency changed it will propagate it by changing dependenciesState to 2.
+ *
+ * By iterating over the dependencies in the same order that they were reported and
+ * stopping on the first change, all the recalculations are only called for ComputedValues
+ * that will be tracked by derivation. That is because we assume that if the first x
+ * dependencies of the derivation doesn't change then the derivation should run the same way
+ * up until accessing x-th dependency.
+ */
+function shouldCompute$$1(derivation) {
+ switch (derivation.dependenciesState) {
+ case IDerivationState.UP_TO_DATE:
+ return false;
+ case IDerivationState.NOT_TRACKING:
+ case IDerivationState.STALE:
+ return true;
+ case IDerivationState.POSSIBLY_STALE: {
+ var prevUntracked = untrackedStart$$1(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.
+ var obs = derivation.observing, l = obs.length;
+ for (var i = 0; i < l; i++) {
+ var obj = obs[i];
+ if (isComputedValue$$1(obj)) {
+ if (globalState$$1.disableErrorBoundaries) {
+ obj.get();
+ }
+ else {
+ try {
+ obj.get();
+ }
+ catch (e) {
+ // we are not interested in the value *or* exception at this moment, but if there is one, notify all
+ untrackedEnd$$1(prevUntracked);
+ return true;
+ }
+ }
+ // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.
+ // and `derivation` is an observer of `obj`
+ // invariantShouldCompute(derivation)
+ if (derivation.dependenciesState === IDerivationState.STALE) {
+ untrackedEnd$$1(prevUntracked);
+ return true;
+ }
+ }
+ }
+ changeDependenciesStateTo0$$1(derivation);
+ untrackedEnd$$1(prevUntracked);
+ return false;
+ }
+ }
+}
+// function invariantShouldCompute(derivation: IDerivation) {
+// const newDepState = (derivation as any).dependenciesState
+// if (
+// process.env.NODE_ENV === "production" &&
+// (newDepState === IDerivationState.POSSIBLY_STALE ||
+// newDepState === IDerivationState.NOT_TRACKING)
+// )
+// fail("Illegal dependency state")
+// }
+function isComputingDerivation$$1() {
+ return globalState$$1.trackingDerivation !== null; // filter out actions inside computations
+}
+function checkIfStateModificationsAreAllowed$$1(atom) {
+ var hasObservers$$1 = atom.observers.size > 0;
+ // Should never be possible to change an observed observable from inside computed, see #798
+ if (globalState$$1.computationDepth > 0 && hasObservers$$1)
+ fail$$1( true &&
+ "Computed values are not allowed to cause side effects by changing observables that are already being observed. Tried to modify: " + atom.name);
+ // Should not be possible to change observed state outside strict mode, except during initialization, see #563
+ if (!globalState$$1.allowStateChanges && (hasObservers$$1 || globalState$$1.enforceActions === "strict"))
+ fail$$1( true &&
+ (globalState$$1.enforceActions
+ ? "Since strict-mode is enabled, changing observed observable values outside actions is not allowed. Please wrap the code in an `action` if this change is intended. Tried to modify: "
+ : "Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, the render function of a React component? Tried to modify: ") +
+ atom.name);
+}
+/**
+ * Executes the provided function `f` and tracks which observables are being accessed.
+ * The tracking information is stored on the `derivation` object and the derivation is registered
+ * as observer of any of the accessed observables.
+ */
+function trackDerivedFunction$$1(derivation, f, context) {
+ // pre allocate array allocation + room for variation in deps
+ // array will be trimmed by bindDependencies
+ changeDependenciesStateTo0$$1(derivation);
+ derivation.newObserving = new Array(derivation.observing.length + 100);
+ derivation.unboundDepsCount = 0;
+ derivation.runId = ++globalState$$1.runId;
+ var prevTracking = globalState$$1.trackingDerivation;
+ globalState$$1.trackingDerivation = derivation;
+ var result;
+ if (globalState$$1.disableErrorBoundaries === true) {
+ result = f.call(context);
+ }
+ else {
+ try {
+ result = f.call(context);
+ }
+ catch (e) {
+ result = new CaughtException$$1(e);
+ }
+ }
+ globalState$$1.trackingDerivation = prevTracking;
+ bindDependencies(derivation);
+ return result;
+}
+/**
+ * diffs newObserving with observing.
+ * update observing to be newObserving with unique observables
+ * notify observers that become observed/unobserved
+ */
+function bindDependencies(derivation) {
+ // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, "INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1");
+ var prevObserving = derivation.observing;
+ var observing = (derivation.observing = derivation.newObserving);
+ var lowestNewObservingDerivationState = IDerivationState.UP_TO_DATE;
+ // Go through all new observables and check diffValue: (this list can contain duplicates):
+ // 0: first occurrence, change to 1 and keep it
+ // 1: extra occurrence, drop it
+ var i0 = 0, l = derivation.unboundDepsCount;
+ for (var i = 0; i < l; i++) {
+ var dep = observing[i];
+ if (dep.diffValue === 0) {
+ dep.diffValue = 1;
+ if (i0 !== i)
+ observing[i0] = dep;
+ i0++;
+ }
+ // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,
+ // not hitting the condition
+ if (dep.dependenciesState > lowestNewObservingDerivationState) {
+ lowestNewObservingDerivationState = dep.dependenciesState;
+ }
+ }
+ observing.length = i0;
+ derivation.newObserving = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)
+ // Go through all old observables and check diffValue: (it is unique after last bindDependencies)
+ // 0: it's not in new observables, unobserve it
+ // 1: it keeps being observed, don't want to notify it. change to 0
+ l = prevObserving.length;
+ while (l--) {
+ var dep = prevObserving[l];
+ if (dep.diffValue === 0) {
+ removeObserver$$1(dep, derivation);
+ }
+ dep.diffValue = 0;
+ }
+ // Go through all new observables and check diffValue: (now it should be unique)
+ // 0: it was set to 0 in last loop. don't need to do anything.
+ // 1: it wasn't observed, let's observe it. set back to 0
+ while (i0--) {
+ var dep = observing[i0];
+ if (dep.diffValue === 1) {
+ dep.diffValue = 0;
+ addObserver$$1(dep, derivation);
+ }
+ }
+ // Some new observed derivations may become stale during this derivation computation
+ // so they have had no chance to propagate staleness (#916)
+ if (lowestNewObservingDerivationState !== IDerivationState.UP_TO_DATE) {
+ derivation.dependenciesState = lowestNewObservingDerivationState;
+ derivation.onBecomeStale();
+ }
+}
+function clearObserving$$1(derivation) {
+ // invariant(globalState.inBatch > 0, "INTERNAL ERROR clearObserving should be called only inside batch");
+ var obs = derivation.observing;
+ derivation.observing = [];
+ var i = obs.length;
+ while (i--)
+ removeObserver$$1(obs[i], derivation);
+ derivation.dependenciesState = IDerivationState.NOT_TRACKING;
+}
+function untracked$$1(action$$1) {
+ var prev = untrackedStart$$1();
+ try {
+ return action$$1();
+ }
+ finally {
+ untrackedEnd$$1(prev);
+ }
+}
+function untrackedStart$$1() {
+ var prev = globalState$$1.trackingDerivation;
+ globalState$$1.trackingDerivation = null;
+ return prev;
+}
+function untrackedEnd$$1(prev) {
+ globalState$$1.trackingDerivation = prev;
+}
+/**
+ * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0
+ *
+ */
+function changeDependenciesStateTo0$$1(derivation) {
+ if (derivation.dependenciesState === IDerivationState.UP_TO_DATE)
+ return;
+ derivation.dependenciesState = IDerivationState.UP_TO_DATE;
+ var obs = derivation.observing;
+ var i = obs.length;
+ while (i--)
+ obs[i].lowestObserverState = IDerivationState.UP_TO_DATE;
+}
+
+/**
+ * These values will persist if global state is reset
+ */
+var persistentKeys = [
+ "mobxGuid",
+ "spyListeners",
+ "enforceActions",
+ "computedRequiresReaction",
+ "disableErrorBoundaries",
+ "runId",
+ "UNCHANGED"
+];
+var MobXGlobals$$1 = /** @class */ (function () {
+ function MobXGlobals$$1() {
+ /**
+ * MobXGlobals version.
+ * MobX compatiblity with other versions loaded in memory as long as this version matches.
+ * It indicates that the global state still stores similar information
+ *
+ * N.B: this version is unrelated to the package version of MobX, and is only the version of the
+ * internal state storage of MobX, and can be the same across many different package versions
+ */
+ this.version = 5;
+ /**
+ * globally unique token to signal unchanged
+ */
+ this.UNCHANGED = {};
+ /**
+ * Currently running derivation
+ */
+ this.trackingDerivation = null;
+ /**
+ * Are we running a computation currently? (not a reaction)
+ */
+ this.computationDepth = 0;
+ /**
+ * Each time a derivation is tracked, it is assigned a unique run-id
+ */
+ this.runId = 0;
+ /**
+ * 'guid' for general purpose. Will be persisted amongst resets.
+ */
+ this.mobxGuid = 0;
+ /**
+ * Are we in a batch block? (and how many of them)
+ */
+ this.inBatch = 0;
+ /**
+ * Observables that don't have observers anymore, and are about to be
+ * suspended, unless somebody else accesses it in the same batch
+ *
+ * @type {IObservable[]}
+ */
+ this.pendingUnobservations = [];
+ /**
+ * List of scheduled, not yet executed, reactions.
+ */
+ this.pendingReactions = [];
+ /**
+ * Are we currently processing reactions?
+ */
+ this.isRunningReactions = false;
+ /**
+ * Is it allowed to change observables at this point?
+ * In general, MobX doesn't allow that when running computations and React.render.
+ * To ensure that those functions stay pure.
+ */
+ this.allowStateChanges = true;
+ /**
+ * If strict mode is enabled, state changes are by default not allowed
+ */
+ this.enforceActions = false;
+ /**
+ * Spy callbacks
+ */
+ this.spyListeners = [];
+ /**
+ * Globally attached error handlers that react specifically to errors in reactions
+ */
+ this.globalReactionErrorHandlers = [];
+ /**
+ * Warn if computed values are accessed outside a reactive context
+ */
+ this.computedRequiresReaction = false;
+ /*
+ * Don't catch and rethrow exceptions. This is useful for inspecting the state of
+ * the stack when an exception occurs while debugging.
+ */
+ this.disableErrorBoundaries = false;
+ }
+ return MobXGlobals$$1;
+}());
+var canMergeGlobalState = true;
+var isolateCalled = false;
+var globalState$$1 = (function () {
+ var global = getGlobal$$1();
+ if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals)
+ canMergeGlobalState = false;
+ if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals$$1().version)
+ canMergeGlobalState = false;
+ if (!canMergeGlobalState) {
+ setTimeout(function () {
+ if (!isolateCalled) {
+ fail$$1("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`");
+ }
+ }, 1);
+ return new MobXGlobals$$1();
+ }
+ else if (global.__mobxGlobals) {
+ global.__mobxInstanceCount += 1;
+ if (!global.__mobxGlobals.UNCHANGED)
+ global.__mobxGlobals.UNCHANGED = {}; // make merge backward compatible
+ return global.__mobxGlobals;
+ }
+ else {
+ global.__mobxInstanceCount = 1;
+ return (global.__mobxGlobals = new MobXGlobals$$1());
+ }
+})();
+function isolateGlobalState$$1() {
+ if (globalState$$1.pendingReactions.length ||
+ globalState$$1.inBatch ||
+ globalState$$1.isRunningReactions)
+ fail$$1("isolateGlobalState should be called before MobX is running any reactions");
+ isolateCalled = true;
+ if (canMergeGlobalState) {
+ if (--getGlobal$$1().__mobxInstanceCount === 0)
+ getGlobal$$1().__mobxGlobals = undefined;
+ globalState$$1 = new MobXGlobals$$1();
+ }
+}
+function getGlobalState$$1() {
+ return globalState$$1;
+}
+/**
+ * For testing purposes only; this will break the internal state of existing observables,
+ * but can be used to get back at a stable state after throwing errors
+ */
+function resetGlobalState$$1() {
+ var defaultGlobals = new MobXGlobals$$1();
+ for (var key in defaultGlobals)
+ if (persistentKeys.indexOf(key) === -1)
+ globalState$$1[key] = defaultGlobals[key];
+ globalState$$1.allowStateChanges = !globalState$$1.enforceActions;
+}
+function getGlobal$$1() {
+ return typeof window !== "undefined" ? window : global;
+}
+
+function hasObservers$$1(observable$$1) {
+ return observable$$1.observers && observable$$1.observers.size > 0;
+}
+function getObservers$$1(observable$$1) {
+ return observable$$1.observers;
+}
+// function invariantObservers(observable: IObservable) {
+// const list = observable.observers
+// const map = observable.observersIndexes
+// const l = list.length
+// for (let i = 0; i < l; i++) {
+// const id = list[i].__mapid
+// if (i) {
+// invariant(map[id] === i, "INTERNAL ERROR maps derivation.__mapid to index in list") // for performance
+// } else {
+// invariant(!(id in map), "INTERNAL ERROR observer on index 0 shouldn't be held in map.") // for performance
+// }
+// }
+// invariant(
+// list.length === 0 || Object.keys(map).length === list.length - 1,
+// "INTERNAL ERROR there is no junk in map"
+// )
+// }
+function addObserver$$1(observable$$1, node) {
+ // invariant(node.dependenciesState !== -1, "INTERNAL ERROR, can add only dependenciesState !== -1");
+ // invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR add already added node");
+ // invariantObservers(observable);
+ observable$$1.observers.add(node);
+ if (observable$$1.lowestObserverState > node.dependenciesState)
+ observable$$1.lowestObserverState = node.dependenciesState;
+ // invariantObservers(observable);
+ // invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR didn't add node");
+}
+function removeObserver$$1(observable$$1, node) {
+ // invariant(globalState.inBatch > 0, "INTERNAL ERROR, remove should be called only inside batch");
+ // invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR remove already removed node");
+ // invariantObservers(observable);
+ observable$$1.observers.delete(node);
+ if (observable$$1.observers.size === 0) {
+ // deleting last observer
+ queueForUnobservation$$1(observable$$1);
+ }
+ // invariantObservers(observable);
+ // invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR remove already removed node2");
+}
+function queueForUnobservation$$1(observable$$1) {
+ if (observable$$1.isPendingUnobservation === false) {
+ // invariant(observable._observers.length === 0, "INTERNAL ERROR, should only queue for unobservation unobserved observables");
+ observable$$1.isPendingUnobservation = true;
+ globalState$$1.pendingUnobservations.push(observable$$1);
+ }
+}
+/**
+ * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.
+ * During a batch `onBecomeUnobserved` will be called at most once per observable.
+ * Avoids unnecessary recalculations.
+ */
+function startBatch$$1() {
+ globalState$$1.inBatch++;
+}
+function endBatch$$1() {
+ if (--globalState$$1.inBatch === 0) {
+ runReactions$$1();
+ // the batch is actually about to finish, all unobserving should happen here.
+ var list = globalState$$1.pendingUnobservations;
+ for (var i = 0; i < list.length; i++) {
+ var observable$$1 = list[i];
+ observable$$1.isPendingUnobservation = false;
+ if (observable$$1.observers.size === 0) {
+ if (observable$$1.isBeingObserved) {
+ // if this observable had reactive observers, trigger the hooks
+ observable$$1.isBeingObserved = false;
+ observable$$1.onBecomeUnobserved();
+ }
+ if (observable$$1 instanceof ComputedValue$$1) {
+ // computed values are automatically teared down when the last observer leaves
+ // this process happens recursively, this computed might be the last observabe of another, etc..
+ observable$$1.suspend();
+ }
+ }
+ }
+ globalState$$1.pendingUnobservations = [];
+ }
+}
+function reportObserved$$1(observable$$1) {
+ var derivation = globalState$$1.trackingDerivation;
+ if (derivation !== null) {
+ /**
+ * Simple optimization, give each derivation run an unique id (runId)
+ * Check if last time this observable was accessed the same runId is used
+ * if this is the case, the relation is already known
+ */
+ if (derivation.runId !== observable$$1.lastAccessedBy) {
+ observable$$1.lastAccessedBy = derivation.runId;
+ // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...
+ derivation.newObserving[derivation.unboundDepsCount++] = observable$$1;
+ if (!observable$$1.isBeingObserved) {
+ observable$$1.isBeingObserved = true;
+ observable$$1.onBecomeObserved();
+ }
+ }
+ return true;
+ }
+ else if (observable$$1.observers.size === 0 && globalState$$1.inBatch > 0) {
+ queueForUnobservation$$1(observable$$1);
+ }
+ return false;
+}
+// function invariantLOS(observable: IObservable, msg: string) {
+// // it's expensive so better not run it in produciton. but temporarily helpful for testing
+// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)
+// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`
+// throw new Error(
+// "lowestObserverState is wrong for " +
+// msg +
+// " because " +
+// min +
+// " < " +
+// observable.lowestObserverState
+// )
+// }
+/**
+ * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly
+ * It will propagate changes to observers from previous run
+ * It's hard or maybe impossible (with reasonable perf) to get it right with current approach
+ * Hopefully self reruning autoruns aren't a feature people should depend on
+ * Also most basic use cases should be ok
+ */
+// Called by Atom when its value changes
+function propagateChanged$$1(observable$$1) {
+ // invariantLOS(observable, "changed start");
+ if (observable$$1.lowestObserverState === IDerivationState.STALE)
+ return;
+ observable$$1.lowestObserverState = IDerivationState.STALE;
+ // Ideally we use for..of here, but the downcompiled version is really slow...
+ observable$$1.observers.forEach(function (d) {
+ if (d.dependenciesState === IDerivationState.UP_TO_DATE) {
+ if (d.isTracing !== TraceMode$$1.NONE) {
+ logTraceInfo(d, observable$$1);
+ }
+ d.onBecomeStale();
+ }
+ d.dependenciesState = IDerivationState.STALE;
+ });
+ // invariantLOS(observable, "changed end");
+}
+// Called by ComputedValue when it recalculate and its value changed
+function propagateChangeConfirmed$$1(observable$$1) {
+ // invariantLOS(observable, "confirmed start");
+ if (observable$$1.lowestObserverState === IDerivationState.STALE)
+ return;
+ observable$$1.lowestObserverState = IDerivationState.STALE;
+ observable$$1.observers.forEach(function (d) {
+ if (d.dependenciesState === IDerivationState.POSSIBLY_STALE)
+ d.dependenciesState = IDerivationState.STALE;
+ else if (d.dependenciesState === IDerivationState.UP_TO_DATE // this happens during computing of `d`, just keep lowestObserverState up to date.
+ )
+ observable$$1.lowestObserverState = IDerivationState.UP_TO_DATE;
+ });
+ // invariantLOS(observable, "confirmed end");
+}
+// Used by computed when its dependency changed, but we don't wan't to immediately recompute.
+function propagateMaybeChanged$$1(observable$$1) {
+ // invariantLOS(observable, "maybe start");
+ if (observable$$1.lowestObserverState !== IDerivationState.UP_TO_DATE)
+ return;
+ observable$$1.lowestObserverState = IDerivationState.POSSIBLY_STALE;
+ observable$$1.observers.forEach(function (d) {
+ if (d.dependenciesState === IDerivationState.UP_TO_DATE) {
+ d.dependenciesState = IDerivationState.POSSIBLY_STALE;
+ if (d.isTracing !== TraceMode$$1.NONE) {
+ logTraceInfo(d, observable$$1);
+ }
+ d.onBecomeStale();
+ }
+ });
+ // invariantLOS(observable, "maybe end");
+}
+function logTraceInfo(derivation, observable$$1) {
+ console.log("[mobx.trace] '" + derivation.name + "' is invalidated due to a change in: '" + observable$$1.name + "'");
+ if (derivation.isTracing === TraceMode$$1.BREAK) {
+ var lines = [];
+ printDepTree(getDependencyTree$$1(derivation), lines, 1);
+ // prettier-ignore
+ new Function("debugger;\n/*\nTracing '" + derivation.name + "'\n\nYou are entering this break point because derivation '" + derivation.name + "' is being traced and '" + observable$$1.name + "' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n" + (derivation instanceof ComputedValue$$1 ? derivation.derivation.toString() : "") + "\n\nThe dependencies for this derivation are:\n\n" + lines.join("\n") + "\n*/\n ")();
+ }
+}
+function printDepTree(tree, lines, depth) {
+ if (lines.length >= 1000) {
+ lines.push("(and many more)");
+ return;
+ }
+ lines.push("" + new Array(depth).join("\t") + tree.name); // MWE: not the fastest, but the easiest way :)
+ if (tree.dependencies)
+ tree.dependencies.forEach(function (child) { return printDepTree(child, lines, depth + 1); });
+}
+
+var Reaction$$1 = /** @class */ (function () {
+ function Reaction$$1(name, onInvalidate, errorHandler) {
+ if (name === void 0) { name = "Reaction@" + getNextId$$1(); }
+ this.name = name;
+ this.onInvalidate = onInvalidate;
+ this.errorHandler = errorHandler;
+ this.observing = []; // nodes we are looking at. Our value depends on these nodes
+ this.newObserving = [];
+ this.dependenciesState = IDerivationState.NOT_TRACKING;
+ this.diffValue = 0;
+ this.runId = 0;
+ this.unboundDepsCount = 0;
+ this.__mapid = "#" + getNextId$$1();
+ this.isDisposed = false;
+ this._isScheduled = false;
+ this._isTrackPending = false;
+ this._isRunning = false;
+ this.isTracing = TraceMode$$1.NONE;
+ }
+ Reaction$$1.prototype.onBecomeStale = function () {
+ this.schedule();
+ };
+ Reaction$$1.prototype.schedule = function () {
+ if (!this._isScheduled) {
+ this._isScheduled = true;
+ globalState$$1.pendingReactions.push(this);
+ runReactions$$1();
+ }
+ };
+ Reaction$$1.prototype.isScheduled = function () {
+ return this._isScheduled;
+ };
+ /**
+ * internal, use schedule() if you intend to kick off a reaction
+ */
+ Reaction$$1.prototype.runReaction = function () {
+ if (!this.isDisposed) {
+ startBatch$$1();
+ this._isScheduled = false;
+ if (shouldCompute$$1(this)) {
+ this._isTrackPending = true;
+ try {
+ this.onInvalidate();
+ if (this._isTrackPending &&
+ isSpyEnabled$$1() &&
+ "development" !== "production") {
+ // onInvalidate didn't trigger track right away..
+ spyReport$$1({
+ name: this.name,
+ type: "scheduled-reaction"
+ });
+ }
+ }
+ catch (e) {
+ this.reportExceptionInDerivation(e);
+ }
+ }
+ endBatch$$1();
+ }
+ };
+ Reaction$$1.prototype.track = function (fn) {
+ startBatch$$1();
+ var notify = isSpyEnabled$$1();
+ var startTime;
+ if (notify && "development" !== "production") {
+ startTime = Date.now();
+ spyReportStart$$1({
+ name: this.name,
+ type: "reaction"
+ });
+ }
+ this._isRunning = true;
+ var result = trackDerivedFunction$$1(this, fn, undefined);
+ this._isRunning = false;
+ this._isTrackPending = false;
+ if (this.isDisposed) {
+ // disposed during last run. Clean up everything that was bound after the dispose call.
+ clearObserving$$1(this);
+ }
+ if (isCaughtException$$1(result))
+ this.reportExceptionInDerivation(result.cause);
+ if (notify && "development" !== "production") {
+ spyReportEnd$$1({
+ time: Date.now() - startTime
+ });
+ }
+ endBatch$$1();
+ };
+ Reaction$$1.prototype.reportExceptionInDerivation = function (error) {
+ var _this = this;
+ if (this.errorHandler) {
+ this.errorHandler(error, this);
+ return;
+ }
+ if (globalState$$1.disableErrorBoundaries)
+ throw error;
+ var message = "[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '" + this;
+ console.error(message, error);
+ /** If debugging brought you here, please, read the above message :-). Tnx! */
+ if (isSpyEnabled$$1()) {
+ spyReport$$1({
+ type: "error",
+ name: this.name,
+ message: message,
+ error: "" + error
+ });
+ }
+ globalState$$1.globalReactionErrorHandlers.forEach(function (f) { return f(error, _this); });
+ };
+ Reaction$$1.prototype.dispose = function () {
+ if (!this.isDisposed) {
+ this.isDisposed = true;
+ if (!this._isRunning) {
+ // if disposed while running, clean up later. Maybe not optimal, but rare case
+ startBatch$$1();
+ clearObserving$$1(this);
+ endBatch$$1();
+ }
+ }
+ };
+ Reaction$$1.prototype.getDisposer = function () {
+ var r = this.dispose.bind(this);
+ r[$mobx$$1] = this;
+ return r;
+ };
+ Reaction$$1.prototype.toString = function () {
+ return "Reaction[" + this.name + "]";
+ };
+ Reaction$$1.prototype.trace = function (enterBreakPoint) {
+ if (enterBreakPoint === void 0) { enterBreakPoint = false; }
+ trace$$1(this, enterBreakPoint);
+ };
+ return Reaction$$1;
+}());
+function onReactionError$$1(handler) {
+ globalState$$1.globalReactionErrorHandlers.push(handler);
+ return function () {
+ var idx = globalState$$1.globalReactionErrorHandlers.indexOf(handler);
+ if (idx >= 0)
+ globalState$$1.globalReactionErrorHandlers.splice(idx, 1);
+ };
+}
+/**
+ * Magic number alert!
+ * Defines within how many times a reaction is allowed to re-trigger itself
+ * until it is assumed that this is gonna be a never ending loop...
+ */
+var MAX_REACTION_ITERATIONS = 100;
+var reactionScheduler = function (f) { return f(); };
+function runReactions$$1() {
+ // Trampolining, if runReactions are already running, new reactions will be picked up
+ if (globalState$$1.inBatch > 0 || globalState$$1.isRunningReactions)
+ return;
+ reactionScheduler(runReactionsHelper);
+}
+function runReactionsHelper() {
+ globalState$$1.isRunningReactions = true;
+ var allReactions = globalState$$1.pendingReactions;
+ var iterations = 0;
+ // While running reactions, new reactions might be triggered.
+ // Hence we work with two variables and check whether
+ // we converge to no remaining reactions after a while.
+ while (allReactions.length > 0) {
+ if (++iterations === MAX_REACTION_ITERATIONS) {
+ console.error("Reaction doesn't converge to a stable state after " + MAX_REACTION_ITERATIONS + " iterations." +
+ (" Probably there is a cycle in the reactive function: " + allReactions[0]));
+ allReactions.splice(0); // clear reactions
+ }
+ var remainingReactions = allReactions.splice(0);
+ for (var i = 0, l = remainingReactions.length; i < l; i++)
+ remainingReactions[i].runReaction();
+ }
+ globalState$$1.isRunningReactions = false;
+}
+var isReaction$$1 = createInstanceofPredicate$$1("Reaction", Reaction$$1);
+function setReactionScheduler$$1(fn) {
+ var baseScheduler = reactionScheduler;
+ reactionScheduler = function (f) { return fn(function () { return baseScheduler(f); }); };
+}
+
+function isSpyEnabled$$1() {
+ return true && !!globalState$$1.spyListeners.length;
+}
+function spyReport$$1(event) {
+ if (false)
+ {} // dead code elimination can do the rest
+ if (!globalState$$1.spyListeners.length)
+ return;
+ var listeners = globalState$$1.spyListeners;
+ for (var i = 0, l = listeners.length; i < l; i++)
+ listeners[i](event);
+}
+function spyReportStart$$1(event) {
+ if (false)
+ {}
+ var change = __assign({}, event, { spyReportStart: true });
+ spyReport$$1(change);
+}
+var END_EVENT = { spyReportEnd: true };
+function spyReportEnd$$1(change) {
+ if (false)
+ {}
+ if (change)
+ spyReport$$1(__assign({}, change, { spyReportEnd: true }));
+ else
+ spyReport$$1(END_EVENT);
+}
+function spy$$1(listener) {
+ if (false) {}
+ else {
+ globalState$$1.spyListeners.push(listener);
+ return once$$1(function () {
+ globalState$$1.spyListeners = globalState$$1.spyListeners.filter(function (l) { return l !== listener; });
+ });
+ }
+}
+
+function dontReassignFields() {
+ fail$$1( true && "@action fields are not reassignable");
+}
+function namedActionDecorator$$1(name) {
+ return function (target, prop, descriptor) {
+ if (descriptor) {
+ if ( true && descriptor.get !== undefined) {
+ return fail$$1("@action cannot be used with getters");
+ }
+ // babel / typescript
+ // @action method() { }
+ if (descriptor.value) {
+ // typescript
+ return {
+ value: createAction$$1(name, descriptor.value),
+ enumerable: false,
+ configurable: true,
+ writable: true // for typescript, this must be writable, otherwise it cannot inherit :/ (see inheritable actions test)
+ };
+ }
+ // babel only: @action method = () => {}
+ var initializer_1 = descriptor.initializer;
+ return {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+ initializer: function () {
+ // N.B: we can't immediately invoke initializer; this would be wrong
+ return createAction$$1(name, initializer_1.call(this));
+ }
+ };
+ }
+ // bound instance methods
+ return actionFieldDecorator$$1(name).apply(this, arguments);
+ };
+}
+function actionFieldDecorator$$1(name) {
+ // Simple property that writes on first invocation to the current instance
+ return function (target, prop, descriptor) {
+ Object.defineProperty(target, prop, {
+ configurable: true,
+ enumerable: false,
+ get: function () {
+ return undefined;
+ },
+ set: function (value) {
+ addHiddenProp$$1(this, prop, action$$1(name, value));
+ }
+ });
+ };
+}
+function boundActionDecorator$$1(target, propertyName, descriptor, applyToInstance) {
+ if (applyToInstance === true) {
+ defineBoundAction$$1(target, propertyName, descriptor.value);
+ return null;
+ }
+ if (descriptor) {
+ // if (descriptor.value)
+ // Typescript / Babel: @action.bound method() { }
+ // also: babel @action.bound method = () => {}
+ return {
+ configurable: true,
+ enumerable: false,
+ get: function () {
+ defineBoundAction$$1(this, propertyName, descriptor.value || descriptor.initializer.call(this));
+ return this[propertyName];
+ },
+ set: dontReassignFields
+ };
+ }
+ // field decorator Typescript @action.bound method = () => {}
+ return {
+ enumerable: false,
+ configurable: true,
+ set: function (v) {
+ defineBoundAction$$1(this, propertyName, v);
+ },
+ get: function () {
+ return undefined;
+ }
+ };
+}
+
+var action$$1 = function action$$1(arg1, arg2, arg3, arg4) {
+ // action(fn() {})
+ if (arguments.length === 1 && typeof arg1 === "function")
+ return createAction$$1(arg1.name || "", arg1);
+ // action("name", fn() {})
+ if (arguments.length === 2 && typeof arg2 === "function")
+ return createAction$$1(arg1, arg2);
+ // @action("name") fn() {}
+ if (arguments.length === 1 && typeof arg1 === "string")
+ return namedActionDecorator$$1(arg1);
+ // @action fn() {}
+ if (arg4 === true) {
+ // apply to instance immediately
+ addHiddenProp$$1(arg1, arg2, createAction$$1(arg1.name || arg2, arg3.value));
+ }
+ else {
+ return namedActionDecorator$$1(arg2).apply(null, arguments);
+ }
+};
+action$$1.bound = boundActionDecorator$$1;
+function runInAction$$1(arg1, arg2) {
+ var actionName = typeof arg1 === "string" ? arg1 : arg1.name || "";
+ var fn = typeof arg1 === "function" ? arg1 : arg2;
+ if (true) {
+ invariant$$1(typeof fn === "function" && fn.length === 0, "`runInAction` expects a function without arguments");
+ if (typeof actionName !== "string" || !actionName)
+ fail$$1("actions should have valid names, got: '" + actionName + "'");
+ }
+ return executeAction$$1(actionName, fn, this, undefined);
+}
+function isAction$$1(thing) {
+ return typeof thing === "function" && thing.isMobxAction === true;
+}
+function defineBoundAction$$1(target, propertyName, fn) {
+ addHiddenProp$$1(target, propertyName, createAction$$1(propertyName, fn.bind(target)));
+}
+
+/**
+ * Creates a named reactive view and keeps it alive, so that the view is always
+ * updated if one of the dependencies changes, even when the view is not further used by something else.
+ * @param view The reactive view
+ * @returns disposer function, which can be used to stop the view from being updated in the future.
+ */
+function autorun$$1(view, opts) {
+ if (opts === void 0) { opts = EMPTY_OBJECT$$1; }
+ if (true) {
+ invariant$$1(typeof view === "function", "Autorun expects a function as first argument");
+ invariant$$1(isAction$$1(view) === false, "Autorun does not accept actions since actions are untrackable");
+ }
+ var name = (opts && opts.name) || view.name || "Autorun@" + getNextId$$1();
+ var runSync = !opts.scheduler && !opts.delay;
+ var reaction$$1;
+ if (runSync) {
+ // normal autorun
+ reaction$$1 = new Reaction$$1(name, function () {
+ this.track(reactionRunner);
+ }, opts.onError);
+ }
+ else {
+ var scheduler_1 = createSchedulerFromOptions(opts);
+ // debounced autorun
+ var isScheduled_1 = false;
+ reaction$$1 = new Reaction$$1(name, function () {
+ if (!isScheduled_1) {
+ isScheduled_1 = true;
+ scheduler_1(function () {
+ isScheduled_1 = false;
+ if (!reaction$$1.isDisposed)
+ reaction$$1.track(reactionRunner);
+ });
+ }
+ }, opts.onError);
+ }
+ function reactionRunner() {
+ view(reaction$$1);
+ }
+ reaction$$1.schedule();
+ return reaction$$1.getDisposer();
+}
+var run = function (f) { return f(); };
+function createSchedulerFromOptions(opts) {
+ return opts.scheduler
+ ? opts.scheduler
+ : opts.delay
+ ? function (f) { return setTimeout(f, opts.delay); }
+ : run;
+}
+function reaction$$1(expression, effect, opts) {
+ if (opts === void 0) { opts = EMPTY_OBJECT$$1; }
+ if (true) {
+ invariant$$1(typeof expression === "function", "First argument to reaction should be a function");
+ invariant$$1(typeof opts === "object", "Third argument of reactions should be an object");
+ }
+ var name = opts.name || "Reaction@" + getNextId$$1();
+ var effectAction = action$$1(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);
+ var runSync = !opts.scheduler && !opts.delay;
+ var scheduler = createSchedulerFromOptions(opts);
+ var firstTime = true;
+ var isScheduled = false;
+ var value;
+ var equals = opts.compareStructural
+ ? comparer$$1.structural
+ : opts.equals || comparer$$1.default;
+ var r = new Reaction$$1(name, function () {
+ if (firstTime || runSync) {
+ reactionRunner();
+ }
+ else if (!isScheduled) {
+ isScheduled = true;
+ scheduler(reactionRunner);
+ }
+ }, opts.onError);
+ function reactionRunner() {
+ isScheduled = false; // Q: move into reaction runner?
+ if (r.isDisposed)
+ return;
+ var changed = false;
+ r.track(function () {
+ var nextValue = expression(r);
+ changed = firstTime || !equals(value, nextValue);
+ value = nextValue;
+ });
+ if (firstTime && opts.fireImmediately)
+ effectAction(value, r);
+ if (!firstTime && changed === true)
+ effectAction(value, r);
+ if (firstTime)
+ firstTime = false;
+ }
+ r.schedule();
+ return r.getDisposer();
+}
+function wrapErrorHandler(errorHandler, baseFn) {
+ return function () {
+ try {
+ return baseFn.apply(this, arguments);
+ }
+ catch (e) {
+ errorHandler.call(this, e);
+ }
+ };
+}
+
+function onBecomeObserved$$1(thing, arg2, arg3) {
+ return interceptHook("onBecomeObserved", thing, arg2, arg3);
+}
+function onBecomeUnobserved$$1(thing, arg2, arg3) {
+ return interceptHook("onBecomeUnobserved", thing, arg2, arg3);
+}
+function interceptHook(hook, thing, arg2, arg3) {
+ var atom = typeof arg2 === "string" ? getAtom$$1(thing, arg2) : getAtom$$1(thing);
+ var cb = typeof arg2 === "string" ? arg3 : arg2;
+ var listenersKey = hook + "Listeners";
+ if (atom[listenersKey]) {
+ atom[listenersKey].add(cb);
+ }
+ else {
+ atom[listenersKey] = new Set([cb]);
+ }
+ var orig = atom[hook];
+ if (typeof orig !== "function")
+ return fail$$1( true && "Not an atom that can be (un)observed");
+ return function () {
+ var hookListeners = atom[listenersKey];
+ if (hookListeners) {
+ hookListeners.delete(cb);
+ if (hookListeners.size === 0) {
+ delete atom[listenersKey];
+ }
+ }
+ };
+}
+
+function configure$$1(options) {
+ var enforceActions = options.enforceActions, computedRequiresReaction = options.computedRequiresReaction, disableErrorBoundaries = options.disableErrorBoundaries, reactionScheduler = options.reactionScheduler;
+ if (enforceActions !== undefined) {
+ if (typeof enforceActions === "boolean" || enforceActions === "strict")
+ deprecated$$1("Deprecated value for 'enforceActions', use 'false' => '\"never\"', 'true' => '\"observed\"', '\"strict\"' => \"'always'\" instead");
+ var ea = void 0;
+ switch (enforceActions) {
+ case true:
+ case "observed":
+ ea = true;
+ break;
+ case false:
+ case "never":
+ ea = false;
+ break;
+ case "strict":
+ case "always":
+ ea = "strict";
+ break;
+ default:
+ fail$$1("Invalid value for 'enforceActions': '" + enforceActions + "', expected 'never', 'always' or 'observed'");
+ }
+ globalState$$1.enforceActions = ea;
+ globalState$$1.allowStateChanges = ea === true || ea === "strict" ? false : true;
+ }
+ if (computedRequiresReaction !== undefined) {
+ globalState$$1.computedRequiresReaction = !!computedRequiresReaction;
+ }
+ if (options.isolateGlobalState === true) {
+ isolateGlobalState$$1();
+ }
+ if (disableErrorBoundaries !== undefined) {
+ if (disableErrorBoundaries === true)
+ console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.");
+ globalState$$1.disableErrorBoundaries = !!disableErrorBoundaries;
+ }
+ if (reactionScheduler) {
+ setReactionScheduler$$1(reactionScheduler);
+ }
+}
+
+function decorate$$1(thing, decorators) {
+ true &&
+ invariant$$1(isPlainObject$$1(decorators), "Decorators should be a key value map");
+ var target = typeof thing === "function" ? thing.prototype : thing;
+ var _loop_1 = function (prop) {
+ var propertyDecorators = decorators[prop];
+ if (!Array.isArray(propertyDecorators)) {
+ propertyDecorators = [propertyDecorators];
+ }
+ true &&
+ invariant$$1(propertyDecorators.every(function (decorator) { return typeof decorator === "function"; }), "Decorate: expected a decorator function or array of decorator functions for '" + prop + "'");
+ var descriptor = Object.getOwnPropertyDescriptor(target, prop);
+ var newDescriptor = propertyDecorators.reduce(function (accDescriptor, decorator) { return decorator(target, prop, accDescriptor); }, descriptor);
+ if (newDescriptor)
+ Object.defineProperty(target, prop, newDescriptor);
+ };
+ for (var prop in decorators) {
+ _loop_1(prop);
+ }
+ return thing;
+}
+
+function extendObservable$$1(target, properties, decorators, options) {
+ if (true) {
+ invariant$$1(arguments.length >= 2 && arguments.length <= 4, "'extendObservable' expected 2-4 arguments");
+ invariant$$1(typeof target === "object", "'extendObservable' expects an object as first argument");
+ invariant$$1(!isObservableMap$$1(target), "'extendObservable' should not be used on maps, use map.merge instead");
+ }
+ options = asCreateObservableOptions$$1(options);
+ var defaultDecorator = getDefaultDecoratorFromObjectOptions$$1(options);
+ initializeInstance$$1(target); // Fixes #1740
+ asObservableObject$$1(target, options.name, defaultDecorator.enhancer); // make sure object is observable, even without initial props
+ if (properties)
+ extendObservableObjectWithProperties$$1(target, properties, decorators, defaultDecorator);
+ return target;
+}
+function getDefaultDecoratorFromObjectOptions$$1(options) {
+ return options.defaultDecorator || (options.deep === false ? refDecorator$$1 : deepDecorator$$1);
+}
+function extendObservableObjectWithProperties$$1(target, properties, decorators, defaultDecorator) {
+ if (true) {
+ invariant$$1(!isObservable$$1(properties), "Extending an object with another observable (object) is not supported. Please construct an explicit propertymap, using `toJS` if need. See issue #540");
+ if (decorators)
+ for (var key in decorators)
+ if (!(key in properties))
+ fail$$1("Trying to declare a decorator for unspecified property '" + key + "'");
+ }
+ startBatch$$1();
+ try {
+ for (var key in properties) {
+ var descriptor = Object.getOwnPropertyDescriptor(properties, key);
+ if (true) {
+ if (Object.getOwnPropertyDescriptor(target, key))
+ fail$$1("'extendObservable' can only be used to introduce new properties. Use 'set' or 'decorate' instead. The property '" + key + "' already exists on '" + target + "'");
+ if (isComputed$$1(descriptor.value))
+ fail$$1("Passing a 'computed' as initial property value is no longer supported by extendObservable. Use a getter or decorator instead");
+ }
+ var decorator = decorators && key in decorators
+ ? decorators[key]
+ : descriptor.get
+ ? computedDecorator$$1
+ : defaultDecorator;
+ if ( true && typeof decorator !== "function")
+ fail$$1("Not a valid decorator for '" + key + "', got: " + decorator);
+ var resultDescriptor = decorator(target, key, descriptor, true);
+ if (resultDescriptor // otherwise, assume already applied, due to `applyToInstance`
+ )
+ Object.defineProperty(target, key, resultDescriptor);
+ }
+ }
+ finally {
+ endBatch$$1();
+ }
+}
+
+function getDependencyTree$$1(thing, property) {
+ return nodeToDependencyTree(getAtom$$1(thing, property));
+}
+function nodeToDependencyTree(node) {
+ var result = {
+ name: node.name
+ };
+ if (node.observing && node.observing.length > 0)
+ result.dependencies = unique$$1(node.observing).map(nodeToDependencyTree);
+ return result;
+}
+function getObserverTree$$1(thing, property) {
+ return nodeToObserverTree(getAtom$$1(thing, property));
+}
+function nodeToObserverTree(node) {
+ var result = {
+ name: node.name
+ };
+ if (hasObservers$$1(node))
+ result.observers = Array.from(getObservers$$1(node)).map(nodeToObserverTree);
+ return result;
+}
+
+var generatorId = 0;
+function flow$$1(generator) {
+ if (arguments.length !== 1)
+ fail$$1( true && "Flow expects one 1 argument and cannot be used as decorator");
+ var name = generator.name || "";
+ // Implementation based on https://github.com/tj/co/blob/master/index.js
+ return function () {
+ var ctx = this;
+ var args = arguments;
+ var runId = ++generatorId;
+ var gen = action$$1(name + " - runid: " + runId + " - init", generator).apply(ctx, args);
+ var rejector;
+ var pendingPromise = undefined;
+ var res = new Promise(function (resolve, reject) {
+ var stepId = 0;
+ rejector = reject;
+ function onFulfilled(res) {
+ pendingPromise = undefined;
+ var ret;
+ try {
+ ret = action$$1(name + " - runid: " + runId + " - yield " + stepId++, gen.next).call(gen, res);
+ }
+ catch (e) {
+ return reject(e);
+ }
+ next(ret);
+ }
+ function onRejected(err) {
+ pendingPromise = undefined;
+ var ret;
+ try {
+ ret = action$$1(name + " - runid: " + runId + " - yield " + stepId++, gen.throw).call(gen, err);
+ }
+ catch (e) {
+ return reject(e);
+ }
+ next(ret);
+ }
+ function next(ret) {
+ if (ret && typeof ret.then === "function") {
+ // an async iterator
+ ret.then(next, reject);
+ return;
+ }
+ if (ret.done)
+ return resolve(ret.value);
+ pendingPromise = Promise.resolve(ret.value);
+ return pendingPromise.then(onFulfilled, onRejected);
+ }
+ onFulfilled(undefined); // kick off the process
+ });
+ res.cancel = action$$1(name + " - runid: " + runId + " - cancel", function () {
+ try {
+ if (pendingPromise)
+ cancelPromise(pendingPromise);
+ // Finally block can return (or yield) stuff..
+ var res_1 = gen.return();
+ // eat anything that promise would do, it's cancelled!
+ var yieldedPromise = Promise.resolve(res_1.value);
+ yieldedPromise.then(noop$$1, noop$$1);
+ cancelPromise(yieldedPromise); // maybe it can be cancelled :)
+ // reject our original promise
+ rejector(new Error("FLOW_CANCELLED"));
+ }
+ catch (e) {
+ rejector(e); // there could be a throwing finally block
+ }
+ });
+ return res;
+ };
+}
+function cancelPromise(promise) {
+ if (typeof promise.cancel === "function")
+ promise.cancel();
+}
+
+function interceptReads$$1(thing, propOrHandler, handler) {
+ var target;
+ if (isObservableMap$$1(thing) || isObservableArray$$1(thing) || isObservableValue$$1(thing)) {
+ target = getAdministration$$1(thing);
+ }
+ else if (isObservableObject$$1(thing)) {
+ if (typeof propOrHandler !== "string")
+ return fail$$1( true &&
+ "InterceptReads can only be used with a specific property, not with an object in general");
+ target = getAdministration$$1(thing, propOrHandler);
+ }
+ else {
+ return fail$$1( true &&
+ "Expected observable map, object or array as first array");
+ }
+ if (target.dehancer !== undefined)
+ return fail$$1( true && "An intercept reader was already established");
+ target.dehancer = typeof propOrHandler === "function" ? propOrHandler : handler;
+ return function () {
+ target.dehancer = undefined;
+ };
+}
+
+function intercept$$1(thing, propOrHandler, handler) {
+ if (typeof handler === "function")
+ return interceptProperty(thing, propOrHandler, handler);
+ else
+ return interceptInterceptable(thing, propOrHandler);
+}
+function interceptInterceptable(thing, handler) {
+ return getAdministration$$1(thing).intercept(handler);
+}
+function interceptProperty(thing, property, handler) {
+ return getAdministration$$1(thing, property).intercept(handler);
+}
+
+function _isComputed$$1(value, property) {
+ if (value === null || value === undefined)
+ return false;
+ if (property !== undefined) {
+ if (isObservableObject$$1(value) === false)
+ return false;
+ if (!value[$mobx$$1].values.has(property))
+ return false;
+ var atom = getAtom$$1(value, property);
+ return isComputedValue$$1(atom);
+ }
+ return isComputedValue$$1(value);
+}
+function isComputed$$1(value) {
+ if (arguments.length > 1)
+ return fail$$1( true &&
+ "isComputed expects only 1 argument. Use isObservableProp to inspect the observability of a property");
+ return _isComputed$$1(value);
+}
+function isComputedProp$$1(value, propName) {
+ if (typeof propName !== "string")
+ return fail$$1( true &&
+ "isComputed expected a property name as second argument");
+ return _isComputed$$1(value, propName);
+}
+
+function _isObservable(value, property) {
+ if (value === null || value === undefined)
+ return false;
+ if (property !== undefined) {
+ if ( true &&
+ (isObservableMap$$1(value) || isObservableArray$$1(value)))
+ return fail$$1("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.");
+ if (isObservableObject$$1(value)) {
+ return value[$mobx$$1].values.has(property);
+ }
+ return false;
+ }
+ // For first check, see #701
+ return (isObservableObject$$1(value) ||
+ !!value[$mobx$$1] ||
+ isAtom$$1(value) ||
+ isReaction$$1(value) ||
+ isComputedValue$$1(value));
+}
+function isObservable$$1(value) {
+ if (arguments.length !== 1)
+ fail$$1( true &&
+ "isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property");
+ return _isObservable(value);
+}
+function isObservableProp$$1(value, propName) {
+ if (typeof propName !== "string")
+ return fail$$1( true && "expected a property name as second argument");
+ return _isObservable(value, propName);
+}
+
+function keys$$1(obj) {
+ if (isObservableObject$$1(obj)) {
+ return obj[$mobx$$1].getKeys();
+ }
+ if (isObservableMap$$1(obj)) {
+ return Array.from(obj.keys());
+ }
+ if (isObservableArray$$1(obj)) {
+ return obj.map(function (_, index) { return index; });
+ }
+ return fail$$1( true &&
+ "'keys()' can only be used on observable objects, arrays and maps");
+}
+function values$$1(obj) {
+ if (isObservableObject$$1(obj)) {
+ return keys$$1(obj).map(function (key) { return obj[key]; });
+ }
+ if (isObservableMap$$1(obj)) {
+ return keys$$1(obj).map(function (key) { return obj.get(key); });
+ }
+ if (isObservableArray$$1(obj)) {
+ return obj.slice();
+ }
+ return fail$$1( true &&
+ "'values()' can only be used on observable objects, arrays and maps");
+}
+function entries$$1(obj) {
+ if (isObservableObject$$1(obj)) {
+ return keys$$1(obj).map(function (key) { return [key, obj[key]]; });
+ }
+ if (isObservableMap$$1(obj)) {
+ return keys$$1(obj).map(function (key) { return [key, obj.get(key)]; });
+ }
+ if (isObservableArray$$1(obj)) {
+ return obj.map(function (key, index) { return [index, key]; });
+ }
+ return fail$$1( true &&
+ "'entries()' can only be used on observable objects, arrays and maps");
+}
+function set$$1(obj, key, value) {
+ if (arguments.length === 2) {
+ startBatch$$1();
+ var values_1 = key;
+ try {
+ for (var key_1 in values_1)
+ set$$1(obj, key_1, values_1[key_1]);
+ }
+ finally {
+ endBatch$$1();
+ }
+ return;
+ }
+ if (isObservableObject$$1(obj)) {
+ var adm = obj[$mobx$$1];
+ var existingObservable = adm.values.get(key);
+ if (existingObservable) {
+ adm.write(key, value);
+ }
+ else {
+ adm.addObservableProp(key, value, adm.defaultEnhancer);
+ }
+ }
+ else if (isObservableMap$$1(obj)) {
+ obj.set(key, value);
+ }
+ else if (isObservableArray$$1(obj)) {
+ if (typeof key !== "number")
+ key = parseInt(key, 10);
+ invariant$$1(key >= 0, "Not a valid index: '" + key + "'");
+ startBatch$$1();
+ if (key >= obj.length)
+ obj.length = key + 1;
+ obj[key] = value;
+ endBatch$$1();
+ }
+ else {
+ return fail$$1( true &&
+ "'set()' can only be used on observable objects, arrays and maps");
+ }
+}
+function remove$$1(obj, key) {
+ if (isObservableObject$$1(obj)) {
+
+ obj[$mobx$$1].remove(key);
+ }
+ else if (isObservableMap$$1(obj)) {
+ obj.delete(key);
+ }
+ else if (isObservableArray$$1(obj)) {
+ if (typeof key !== "number")
+ key = parseInt(key, 10);
+ invariant$$1(key >= 0, "Not a valid index: '" + key + "'");
+ obj.splice(key, 1);
+ }
+ else {
+ return fail$$1( true &&
+ "'remove()' can only be used on observable objects, arrays and maps");
+ }
+}
+function has$$1(obj, key) {
+ if (isObservableObject$$1(obj)) {
+ // return keys(obj).indexOf(key) >= 0
+ var adm = getAdministration$$1(obj);
+ return adm.has(key);
+ }
+ else if (isObservableMap$$1(obj)) {
+ return obj.has(key);
+ }
+ else if (isObservableArray$$1(obj)) {
+ return key >= 0 && key < obj.length;
+ }
+ else {
+ return fail$$1( true &&
+ "'has()' can only be used on observable objects, arrays and maps");
+ }
+}
+function get$$1(obj, key) {
+ if (!has$$1(obj, key))
+ return undefined;
+ if (isObservableObject$$1(obj)) {
+ return obj[key];
+ }
+ else if (isObservableMap$$1(obj)) {
+ return obj.get(key);
+ }
+ else if (isObservableArray$$1(obj)) {
+ return obj[key];
+ }
+ else {
+ return fail$$1( true &&
+ "'get()' can only be used on observable objects, arrays and maps");
+ }
+}
+
+function observe$$1(thing, propOrCb, cbOrFire, fireImmediately) {
+ if (typeof cbOrFire === "function")
+ return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);
+ else
+ return observeObservable(thing, propOrCb, cbOrFire);
+}
+function observeObservable(thing, listener, fireImmediately) {
+ return getAdministration$$1(thing).observe(listener, fireImmediately);
+}
+function observeObservableProperty(thing, property, listener, fireImmediately) {
+ return getAdministration$$1(thing, property).observe(listener, fireImmediately);
+}
+
+var defaultOptions = {
+ detectCycles: true,
+ exportMapsAsObjects: true,
+ recurseEverything: false
+};
+function cache(map, key, value, options) {
+ if (options.detectCycles)
+ map.set(key, value);
+ return value;
+}
+function toJSHelper(source, options, __alreadySeen) {
+ if (!options.recurseEverything && !isObservable$$1(source))
+ return source;
+ if (typeof source !== "object")
+ return source;
+ // Directly return null if source is null
+ if (source === null)
+ return null;
+ // Directly return the Date object itself if contained in the observable
+ if (source instanceof Date)
+ return source;
+ if (isObservableValue$$1(source))
+ return toJSHelper(source.get(), options, __alreadySeen);
+ // make sure we track the keys of the object
+ if (isObservable$$1(source))
+ keys$$1(source);
+ var detectCycles = options.detectCycles === true;
+ if (detectCycles && source !== null && __alreadySeen.has(source)) {
+ return __alreadySeen.get(source);
+ }
+ if (isObservableArray$$1(source) || Array.isArray(source)) {
+ var res_1 = cache(__alreadySeen, source, [], options);
+ var toAdd = source.map(function (value) { return toJSHelper(value, options, __alreadySeen); });
+ res_1.length = toAdd.length;
+ for (var i = 0, l = toAdd.length; i < l; i++)
+ res_1[i] = toAdd[i];
+ return res_1;
+ }
+ if (isObservableMap$$1(source) || Object.getPrototypeOf(source) === Map.prototype) {
+ if (options.exportMapsAsObjects === false) {
+ var res_2 = cache(__alreadySeen, source, new Map(), options);
+ source.forEach(function (value, key) {
+ res_2.set(key, toJSHelper(value, options, __alreadySeen));
+ });
+ return res_2;
+ }
+ else {
+ var res_3 = cache(__alreadySeen, source, {}, options);
+ source.forEach(function (value, key) {
+ res_3[key] = toJSHelper(value, options, __alreadySeen);
+ });
+ return res_3;
+ }
+ }
+ // Fallback to the situation that source is an ObservableObject or a plain object
+ var res = cache(__alreadySeen, source, {}, options);
+ for (var key in source) {
+ res[key] = toJSHelper(source[key], options, __alreadySeen);
+ }
+ return res;
+}
+function toJS$$1(source, options) {
+ // backward compatibility
+ if (typeof options === "boolean")
+ options = { detectCycles: options };
+ if (!options)
+ options = defaultOptions;
+ options.detectCycles =
+ options.detectCycles === undefined
+ ? options.recurseEverything === true
+ : options.detectCycles === true;
+ var __alreadySeen;
+ if (options.detectCycles)
+ __alreadySeen = new Map();
+ return toJSHelper(source, options, __alreadySeen);
+}
+
+function trace$$1() {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ var enterBreakPoint = false;
+ if (typeof args[args.length - 1] === "boolean")
+ enterBreakPoint = args.pop();
+ var derivation = getAtomFromArgs(args);
+ if (!derivation) {
+ return fail$$1( true &&
+ "'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");
+ }
+ if (derivation.isTracing === TraceMode$$1.NONE) {
+ console.log("[mobx.trace] '" + derivation.name + "' tracing enabled");
+ }
+ derivation.isTracing = enterBreakPoint ? TraceMode$$1.BREAK : TraceMode$$1.LOG;
+}
+function getAtomFromArgs(args) {
+ switch (args.length) {
+ case 0:
+ return globalState$$1.trackingDerivation;
+ case 1:
+ return getAtom$$1(args[0]);
+ case 2:
+ return getAtom$$1(args[0], args[1]);
+ }
+}
+
+/**
+ * During a transaction no views are updated until the end of the transaction.
+ * The transaction will be run synchronously nonetheless.
+ *
+ * @param action a function that updates some reactive state
+ * @returns any value that was returned by the 'action' parameter.
+ */
+function transaction$$1(action$$1, thisArg) {
+ if (thisArg === void 0) { thisArg = undefined; }
+ startBatch$$1();
+ try {
+ return action$$1.apply(thisArg);
+ }
+ finally {
+ endBatch$$1();
+ }
+}
+
+function when$$1(predicate, arg1, arg2) {
+ if (arguments.length === 1 || (arg1 && typeof arg1 === "object"))
+ return whenPromise(predicate, arg1);
+ return _when(predicate, arg1, arg2 || {});
+}
+function _when(predicate, effect, opts) {
+ var timeoutHandle;
+ if (typeof opts.timeout === "number") {
+ timeoutHandle = setTimeout(function () {
+ if (!disposer[$mobx$$1].isDisposed) {
+ disposer();
+ var error = new Error("WHEN_TIMEOUT");
+ if (opts.onError)
+ opts.onError(error);
+ else
+ throw error;
+ }
+ }, opts.timeout);
+ }
+ opts.name = opts.name || "When@" + getNextId$$1();
+ var effectAction = createAction$$1(opts.name + "-effect", effect);
+ var disposer = autorun$$1(function (r) {
+ if (predicate()) {
+ r.dispose();
+ if (timeoutHandle)
+ clearTimeout(timeoutHandle);
+ effectAction();
+ }
+ }, opts);
+ return disposer;
+}
+function whenPromise(predicate, opts) {
+ if ( true && opts && opts.onError)
+ return fail$$1("the options 'onError' and 'promise' cannot be combined");
+ var cancel;
+ var res = new Promise(function (resolve, reject) {
+ var disposer = _when(predicate, resolve, __assign({}, opts, { onError: reject }));
+ cancel = function () {
+ disposer();
+ reject("WHEN_CANCELLED");
+ };
+ });
+ res.cancel = cancel;
+ return res;
+}
+
+function getAdm(target) {
+ return target[$mobx$$1];
+}
+// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,
+// and skip either the internal values map, or the base object with its property descriptors!
+var objectProxyTraps = {
+ has: function (target, name) {
+ if (name === $mobx$$1 || name === "constructor" || name === mobxDidRunLazyInitializersSymbol$$1)
+ return true;
+ var adm = getAdm(target);
+ // MWE: should `in` operator be reactive? If not, below code path will be faster / more memory efficient
+ // TODO: check performance stats!
+ // if (adm.values.get(name as string)) return true
+ if (typeof name === "string")
+ return adm.has(name);
+ return name in target;
+ },
+ get: function (target, name) {
+ if (name === $mobx$$1 || name === "constructor" || name === mobxDidRunLazyInitializersSymbol$$1)
+ return target[name];
+ var adm = getAdm(target);
+ var observable$$1 = adm.values.get(name);
+ if (observable$$1 instanceof Atom$$1) {
+ var result = observable$$1.get();
+ if (result === undefined) {
+ // This fixes #1796, because deleting a prop that has an
+ // undefined value won't retrigger a observer (no visible effect),
+ // the autorun wouldn't subscribe to future key changes (see also next comment)
+ adm.has(name);
+ }
+ return result;
+ }
+ // make sure we start listening to future keys
+ // note that we only do this here for optimization
+ if (typeof name === "string")
+ adm.has(name);
+ return target[name];
+ },
+ set: function (target, name, value) {
+ if (typeof name !== "string")
+ return false;
+ set$$1(target, name, value);
+ return true;
+ },
+ deleteProperty: function (target, name) {
+ if (typeof name !== "string")
+ return false;
+ var adm = getAdm(target);
+ adm.remove(name);
+ return true;
+ },
+ ownKeys: function (target) {
+ var adm = getAdm(target);
+ adm.keysAtom.reportObserved();
+ return Reflect.ownKeys(target);
+ },
+ preventExtensions: function (target) {
+ fail$$1("Dynamic observable objects cannot be frozen");
+ return false;
+ }
+};
+function createDynamicObservableObject$$1(base) {
+ var proxy = new Proxy(base, objectProxyTraps);
+ base[$mobx$$1].proxy = proxy;
+ return proxy;
+}
+
+function hasInterceptors$$1(interceptable) {
+ return interceptable.interceptors !== undefined && interceptable.interceptors.length > 0;
+}
+function registerInterceptor$$1(interceptable, handler) {
+ var interceptors = interceptable.interceptors || (interceptable.interceptors = []);
+ interceptors.push(handler);
+ return once$$1(function () {
+ var idx = interceptors.indexOf(handler);
+ if (idx !== -1)
+ interceptors.splice(idx, 1);
+ });
+}
+function interceptChange$$1(interceptable, change) {
+ var prevU = untrackedStart$$1();
+ try {
+ var interceptors = interceptable.interceptors;
+ if (interceptors)
+ for (var i = 0, l = interceptors.length; i < l; i++) {
+ change = interceptors[i](change);
+ invariant$$1(!change || change.type, "Intercept handlers should return nothing or a change object");
+ if (!change)
+ break;
+ }
+ return change;
+ }
+ finally {
+ untrackedEnd$$1(prevU);
+ }
+}
+
+function hasListeners$$1(listenable) {
+ return listenable.changeListeners !== undefined && listenable.changeListeners.length > 0;
+}
+function registerListener$$1(listenable, handler) {
+ var listeners = listenable.changeListeners || (listenable.changeListeners = []);
+ listeners.push(handler);
+ return once$$1(function () {
+ var idx = listeners.indexOf(handler);
+ if (idx !== -1)
+ listeners.splice(idx, 1);
+ });
+}
+function notifyListeners$$1(listenable, change) {
+ var prevU = untrackedStart$$1();
+ var listeners = listenable.changeListeners;
+ if (!listeners)
+ return;
+ listeners = listeners.slice();
+ for (var i = 0, l = listeners.length; i < l; i++) {
+ listeners[i](change);
+ }
+ untrackedEnd$$1(prevU);
+}
+
+var MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859
+var arrayTraps = {
+ get: function (target, name) {
+ if (name === $mobx$$1)
+ return target[$mobx$$1];
+ if (name === "length")
+ return target[$mobx$$1].getArrayLength();
+ if (typeof name === "number") {
+ return arrayExtensions.get.call(target, name);
+ }
+ if (typeof name === "string" && !isNaN(name)) {
+ return arrayExtensions.get.call(target, parseInt(name));
+ }
+ if (arrayExtensions.hasOwnProperty(name)) {
+ return arrayExtensions[name];
+ }
+ return target[name];
+ },
+ set: function (target, name, value) {
+ if (name === "length") {
+ target[$mobx$$1].setArrayLength(value);
+ return true;
+ }
+ if (typeof name === "number") {
+ arrayExtensions.set.call(target, name, value);
+ return true;
+ }
+ if (!isNaN(name)) {
+ arrayExtensions.set.call(target, parseInt(name), value);
+ return true;
+ }
+ return false;
+ },
+ preventExtensions: function (target) {
+ fail$$1("Observable arrays cannot be frozen");
+ return false;
+ }
+};
+function createObservableArray$$1(initialValues, enhancer, name, owned) {
+ if (name === void 0) { name = "ObservableArray@" + getNextId$$1(); }
+ if (owned === void 0) { owned = false; }
+ var adm = new ObservableArrayAdministration(name, enhancer, owned);
+ addHiddenFinalProp$$1(adm.values, $mobx$$1, adm);
+ var proxy = new Proxy(adm.values, arrayTraps);
+ adm.proxy = proxy;
+ if (initialValues && initialValues.length) {
+ var prev = allowStateChangesStart$$1(true);
+ adm.spliceWithArray(0, 0, initialValues);
+ allowStateChangesEnd$$1(prev);
+ }
+ return proxy;
+}
+var ObservableArrayAdministration = /** @class */ (function () {
+ function ObservableArrayAdministration(name, enhancer, owned) {
+ this.owned = owned;
+ this.values = [];
+ this.proxy = undefined;
+ this.lastKnownLength = 0;
+ this.atom = new Atom$$1(name || "ObservableArray@" + getNextId$$1());
+ this.enhancer = function (newV, oldV) { return enhancer(newV, oldV, name + "[..]"); };
+ }
+ ObservableArrayAdministration.prototype.dehanceValue = function (value) {
+ if (this.dehancer !== undefined)
+ return this.dehancer(value);
+ return value;
+ };
+ ObservableArrayAdministration.prototype.dehanceValues = function (values$$1) {
+ if (this.dehancer !== undefined && values$$1.length > 0)
+ return values$$1.map(this.dehancer);
+ return values$$1;
+ };
+ ObservableArrayAdministration.prototype.intercept = function (handler) {
+ return registerInterceptor$$1(this, handler);
+ };
+ ObservableArrayAdministration.prototype.observe = function (listener, fireImmediately) {
+ if (fireImmediately === void 0) { fireImmediately = false; }
+ if (fireImmediately) {
+ listener({
+ object: this.proxy,
+ type: "splice",
+ index: 0,
+ added: this.values.slice(),
+ addedCount: this.values.length,
+ removed: [],
+ removedCount: 0
+ });
+ }
+ return registerListener$$1(this, listener);
+ };
+ ObservableArrayAdministration.prototype.getArrayLength = function () {
+ this.atom.reportObserved();
+ return this.values.length;
+ };
+ ObservableArrayAdministration.prototype.setArrayLength = function (newLength) {
+ if (typeof newLength !== "number" || newLength < 0)
+ throw new Error("[mobx.array] Out of range: " + newLength);
+ var currentLength = this.values.length;
+ if (newLength === currentLength)
+ return;
+ else if (newLength > currentLength) {
+ var newItems = new Array(newLength - currentLength);
+ for (var i = 0; i < newLength - currentLength; i++)
+ newItems[i] = undefined; // No Array.fill everywhere...
+ this.spliceWithArray(currentLength, 0, newItems);
+ }
+ else
+ this.spliceWithArray(newLength, currentLength - newLength);
+ };
+ ObservableArrayAdministration.prototype.updateArrayLength = function (oldLength, delta) {
+ if (oldLength !== this.lastKnownLength)
+ throw new Error("[mobx] Modification exception: the internal structure of an observable array was changed.");
+ this.lastKnownLength += delta;
+ };
+ ObservableArrayAdministration.prototype.spliceWithArray = function (index, deleteCount, newItems) {
+ var _this = this;
+ checkIfStateModificationsAreAllowed$$1(this.atom);
+ var length = this.values.length;
+ if (index === undefined)
+ index = 0;
+ else if (index > length)
+ index = length;
+ else if (index < 0)
+ index = Math.max(0, length + index);
+ if (arguments.length === 1)
+ deleteCount = length - index;
+ else if (deleteCount === undefined || deleteCount === null)
+ deleteCount = 0;
+ else
+ deleteCount = Math.max(0, Math.min(deleteCount, length - index));
+ if (newItems === undefined)
+ newItems = EMPTY_ARRAY$$1;
+ if (hasInterceptors$$1(this)) {
+ var change = interceptChange$$1(this, {
+ object: this.proxy,
+ type: "splice",
+ index: index,
+ removedCount: deleteCount,
+ added: newItems
+ });
+ if (!change)
+ return EMPTY_ARRAY$$1;
+ deleteCount = change.removedCount;
+ newItems = change.added;
+ }
+ newItems = newItems.length === 0 ? newItems : newItems.map(function (v) { return _this.enhancer(v, undefined); });
+ if (true) {
+ var lengthDelta = newItems.length - deleteCount;
+ this.updateArrayLength(length, lengthDelta); // checks if internal array wasn't modified
+ }
+ var res = this.spliceItemsIntoValues(index, deleteCount, newItems);
+ if (deleteCount !== 0 || newItems.length !== 0)
+ this.notifyArraySplice(index, newItems, res);
+ return this.dehanceValues(res);
+ };
+ ObservableArrayAdministration.prototype.spliceItemsIntoValues = function (index, deleteCount, newItems) {
+ var _a;
+ if (newItems.length < MAX_SPLICE_SIZE) {
+ return (_a = this.values).splice.apply(_a, __spread([index, deleteCount], newItems));
+ }
+ else {
+ var res = this.values.slice(index, index + deleteCount);
+ this.values = this.values
+ .slice(0, index)
+ .concat(newItems, this.values.slice(index + deleteCount));
+ return res;
+ }
+ };
+ ObservableArrayAdministration.prototype.notifyArrayChildUpdate = function (index, newValue, oldValue) {
+ var notifySpy = !this.owned && isSpyEnabled$$1();
+ var notify = hasListeners$$1(this);
+ var change = notify || notifySpy
+ ? {
+ object: this.proxy,
+ type: "update",
+ index: index,
+ newValue: newValue,
+ oldValue: oldValue
+ }
+ : null;
+ // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't
+ // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled
+ if (notifySpy && "development" !== "production")
+ spyReportStart$$1(__assign({}, change, { name: this.atom.name }));
+ this.atom.reportChanged();
+ if (notify)
+ notifyListeners$$1(this, change);
+ if (notifySpy && "development" !== "production")
+ spyReportEnd$$1();
+ };
+ ObservableArrayAdministration.prototype.notifyArraySplice = function (index, added, removed) {
+ var notifySpy = !this.owned && isSpyEnabled$$1();
+ var notify = hasListeners$$1(this);
+ var change = notify || notifySpy
+ ? {
+ object: this.proxy,
+ type: "splice",
+ index: index,
+ removed: removed,
+ added: added,
+ removedCount: removed.length,
+ addedCount: added.length
+ }
+ : null;
+ if (notifySpy && "development" !== "production")
+ spyReportStart$$1(__assign({}, change, { name: this.atom.name }));
+ this.atom.reportChanged();
+ // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe
+ if (notify)
+ notifyListeners$$1(this, change);
+ if (notifySpy && "development" !== "production")
+ spyReportEnd$$1();
+ };
+ return ObservableArrayAdministration;
+}());
+var arrayExtensions = {
+ intercept: function (handler) {
+ return this[$mobx$$1].intercept(handler);
+ },
+ observe: function (listener, fireImmediately) {
+ if (fireImmediately === void 0) { fireImmediately = false; }
+ var adm = this[$mobx$$1];
+ return adm.observe(listener, fireImmediately);
+ },
+ clear: function () {
+ return this.splice(0);
+ },
+ replace: function (newItems) {
+ var adm = this[$mobx$$1];
+ return adm.spliceWithArray(0, adm.values.length, newItems);
+ },
+ /**
+ * Converts this array back to a (shallow) javascript structure.
+ * For a deep clone use mobx.toJS
+ */
+ toJS: function () {
+ return this.slice();
+ },
+ toJSON: function () {
+ // Used by JSON.stringify
+ return this.toJS();
+ },
+ /*
+ * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)
+ * since these functions alter the inner structure of the array, the have side effects.
+ * Because the have side effects, they should not be used in computed function,
+ * and for that reason the do not call dependencyState.notifyObserved
+ */
+ splice: function (index, deleteCount) {
+ var newItems = [];
+ for (var _i = 2; _i < arguments.length; _i++) {
+ newItems[_i - 2] = arguments[_i];
+ }
+ var adm = this[$mobx$$1];
+ switch (arguments.length) {
+ case 0:
+ return [];
+ case 1:
+ return adm.spliceWithArray(index);
+ case 2:
+ return adm.spliceWithArray(index, deleteCount);
+ }
+ return adm.spliceWithArray(index, deleteCount, newItems);
+ },
+ spliceWithArray: function (index, deleteCount, newItems) {
+ var adm = this[$mobx$$1];
+ return adm.spliceWithArray(index, deleteCount, newItems);
+ },
+ push: function () {
+ var items = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ items[_i] = arguments[_i];
+ }
+ var adm = this[$mobx$$1];
+ adm.spliceWithArray(adm.values.length, 0, items);
+ return adm.values.length;
+ },
+ pop: function () {
+ return this.splice(Math.max(this[$mobx$$1].values.length - 1, 0), 1)[0];
+ },
+ shift: function () {
+ return this.splice(0, 1)[0];
+ },
+ unshift: function () {
+ var items = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ items[_i] = arguments[_i];
+ }
+ var adm = this[$mobx$$1];
+ adm.spliceWithArray(0, 0, items);
+ return adm.values.length;
+ },
+ reverse: function () {
+ // reverse by default mutates in place before returning the result
+ // which makes it both a 'derivation' and a 'mutation'.
+ // so we deviate from the default and just make it an dervitation
+ if (true) {
+ console.warn("[mobx] `observableArray.reverse()` will not update the array in place. Use `observableArray.slice().reverse()` to supress this warning and perform the operation on a copy, or `observableArray.replace(observableArray.slice().reverse())` to reverse & update in place");
+ }
+ var clone = this.slice();
+ return clone.reverse.apply(clone, arguments);
+ },
+ sort: function (compareFn) {
+ // sort by default mutates in place before returning the result
+ // which goes against all good practices. Let's not change the array in place!
+ if (true) {
+ console.warn("[mobx] `observableArray.sort()` will not update the array in place. Use `observableArray.slice().sort()` to supress this warning and perform the operation on a copy, or `observableArray.replace(observableArray.slice().sort())` to sort & update in place");
+ }
+ var clone = this.slice();
+ return clone.sort.apply(clone, arguments);
+ },
+ remove: function (value) {
+ var adm = this[$mobx$$1];
+ var idx = adm.dehanceValues(adm.values).indexOf(value);
+ if (idx > -1) {
+ this.splice(idx, 1);
+ return true;
+ }
+ return false;
+ },
+ get: function (index) {
+ var adm = this[$mobx$$1];
+ if (adm) {
+ if (index < adm.values.length) {
+ adm.atom.reportObserved();
+ return adm.dehanceValue(adm.values[index]);
+ }
+ console.warn("[mobx.array] Attempt to read an array index (" + index + ") that is out of bounds (" + adm.values.length + "). Please check length first. Out of bound indices will not be tracked by MobX");
+ }
+ return undefined;
+ },
+ set: function (index, newValue) {
+ var adm = this[$mobx$$1];
+ var values$$1 = adm.values;
+ if (index < values$$1.length) {
+ // update at index in range
+ checkIfStateModificationsAreAllowed$$1(adm.atom);
+ var oldValue = values$$1[index];
+ if (hasInterceptors$$1(adm)) {
+ var change = interceptChange$$1(adm, {
+ type: "update",
+ object: this,
+ index: index,
+ newValue: newValue
+ });
+ if (!change)
+ return;
+ newValue = change.newValue;
+ }
+ newValue = adm.enhancer(newValue, oldValue);
+ var changed = newValue !== oldValue;
+ if (changed) {
+ values$$1[index] = newValue;
+ adm.notifyArrayChildUpdate(index, newValue, oldValue);
+ }
+ }
+ else if (index === values$$1.length) {
+ // add a new item
+ adm.spliceWithArray(index, 0, [newValue]);
+ }
+ else {
+ // out of bounds
+ throw new Error("[mobx.array] Index out of bounds, " + index + " is larger than " + values$$1.length);
+ }
+ }
+};
+[
+ "concat",
+ "every",
+ "filter",
+ "forEach",
+ "indexOf",
+ "join",
+ "lastIndexOf",
+ "map",
+ "reduce",
+ "reduceRight",
+ "slice",
+ "some",
+ "toString",
+ "toLocaleString"
+].forEach(function (funcName) {
+ arrayExtensions[funcName] = function () {
+ var adm = this[$mobx$$1];
+ adm.atom.reportObserved();
+ var res = adm.dehanceValues(adm.values);
+ return res[funcName].apply(res, arguments);
+ };
+});
+var isObservableArrayAdministration = createInstanceofPredicate$$1("ObservableArrayAdministration", ObservableArrayAdministration);
+function isObservableArray$$1(thing) {
+ return isObject$$1(thing) && isObservableArrayAdministration(thing[$mobx$$1]);
+}
+
+var _a;
+var ObservableMapMarker = {};
+// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54
+// But: https://github.com/mobxjs/mobx/issues/1556
+var ObservableMap$$1 = /** @class */ (function () {
+ function ObservableMap$$1(initialData, enhancer, name) {
+ if (enhancer === void 0) { enhancer = deepEnhancer$$1; }
+ if (name === void 0) { name = "ObservableMap@" + getNextId$$1(); }
+ this.enhancer = enhancer;
+ this.name = name;
+ this[_a] = ObservableMapMarker;
+ this._keysAtom = createAtom$$1(this.name + ".keys()");
+ this[Symbol.toStringTag] = "Map";
+ if (typeof Map !== "function") {
+ throw new Error("mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js");
+ }
+ this._data = new Map();
+ this._hasMap = new Map();
+ this.merge(initialData);
+ }
+ ObservableMap$$1.prototype._has = function (key) {
+ return this._data.has(key);
+ };
+ ObservableMap$$1.prototype.has = function (key) {
+ if (this._hasMap.has(key))
+ return this._hasMap.get(key).get();
+ return this._updateHasMapEntry(key, false).get();
+ };
+ ObservableMap$$1.prototype.set = function (key, value) {
+ var hasKey = this._has(key);
+ if (hasInterceptors$$1(this)) {
+ var change = interceptChange$$1(this, {
+ type: hasKey ? "update" : "add",
+ object: this,
+ newValue: value,
+ name: key
+ });
+ if (!change)
+ return this;
+ value = change.newValue;
+ }
+ if (hasKey) {
+ this._updateValue(key, value);
+ }
+ else {
+ this._addValue(key, value);
+ }
+ return this;
+ };
+ ObservableMap$$1.prototype.delete = function (key) {
+ var _this = this;
+ if (hasInterceptors$$1(this)) {
+ var change = interceptChange$$1(this, {
+ type: "delete",
+ object: this,
+ name: key
+ });
+ if (!change)
+ return false;
+ }
+ if (this._has(key)) {
+ var notifySpy = isSpyEnabled$$1();
+ var notify = hasListeners$$1(this);
+ var change = notify || notifySpy
+ ? {
+ type: "delete",
+ object: this,
+ oldValue: this._data.get(key).value,
+ name: key
+ }
+ : null;
+ if (notifySpy && "development" !== "production")
+ spyReportStart$$1(__assign({}, change, { name: this.name, key: key }));
+ transaction$$1(function () {
+ _this._keysAtom.reportChanged();
+ _this._updateHasMapEntry(key, false);
+ var observable$$1 = _this._data.get(key);
+ observable$$1.setNewValue(undefined);
+ _this._data.delete(key);
+ });
+ if (notify)
+ notifyListeners$$1(this, change);
+ if (notifySpy && "development" !== "production")
+ spyReportEnd$$1();
+ return true;
+ }
+ return false;
+ };
+ ObservableMap$$1.prototype._updateHasMapEntry = function (key, value) {
+ // optimization; don't fill the hasMap if we are not observing, or remove entry if there are no observers anymore
+ var entry = this._hasMap.get(key);
+ if (entry) {
+ entry.setNewValue(value);
+ }
+ else {
+ entry = new ObservableValue$$1(value, referenceEnhancer$$1, this.name + "." + key + "?", false);
+ this._hasMap.set(key, entry);
+ }
+ return entry;
+ };
+ ObservableMap$$1.prototype._updateValue = function (key, newValue) {
+ var observable$$1 = this._data.get(key);
+ newValue = observable$$1.prepareNewValue(newValue);
+ if (newValue !== globalState$$1.UNCHANGED) {
+ var notifySpy = isSpyEnabled$$1();
+ var notify = hasListeners$$1(this);
+ var change = notify || notifySpy
+ ? {
+ type: "update",
+ object: this,
+ oldValue: observable$$1.value,
+ name: key,
+ newValue: newValue
+ }
+ : null;
+ if (notifySpy && "development" !== "production")
+ spyReportStart$$1(__assign({}, change, { name: this.name, key: key }));
+ observable$$1.setNewValue(newValue);
+ if (notify)
+ notifyListeners$$1(this, change);
+ if (notifySpy && "development" !== "production")
+ spyReportEnd$$1();
+ }
+ };
+ ObservableMap$$1.prototype._addValue = function (key, newValue) {
+ var _this = this;
+ checkIfStateModificationsAreAllowed$$1(this._keysAtom);
+ transaction$$1(function () {
+ var observable$$1 = new ObservableValue$$1(newValue, _this.enhancer, _this.name + "." + key, false);
+ _this._data.set(key, observable$$1);
+ newValue = observable$$1.value; // value might have been changed
+ _this._updateHasMapEntry(key, true);
+ _this._keysAtom.reportChanged();
+ });
+ var notifySpy = isSpyEnabled$$1();
+ var notify = hasListeners$$1(this);
+ var change = notify || notifySpy
+ ? {
+ type: "add",
+ object: this,
+ name: key,
+ newValue: newValue
+ }
+ : null;
+ if (notifySpy && "development" !== "production")
+ spyReportStart$$1(__assign({}, change, { name: this.name, key: key }));
+ if (notify)
+ notifyListeners$$1(this, change);
+ if (notifySpy && "development" !== "production")
+ spyReportEnd$$1();
+ };
+ ObservableMap$$1.prototype.get = function (key) {
+ if (this.has(key))
+ return this.dehanceValue(this._data.get(key).get());
+ return this.dehanceValue(undefined);
+ };
+ ObservableMap$$1.prototype.dehanceValue = function (value) {
+ if (this.dehancer !== undefined) {
+ return this.dehancer(value);
+ }
+ return value;
+ };
+ ObservableMap$$1.prototype.keys = function () {
+ this._keysAtom.reportObserved();
+ return this._data.keys();
+ };
+ ObservableMap$$1.prototype.values = function () {
+ var self = this;
+ var nextIndex = 0;
+ var keys$$1 = Array.from(this.keys());
+ return makeIterable({
+ next: function () {
+ return nextIndex < keys$$1.length
+ ? { value: self.get(keys$$1[nextIndex++]), done: false }
+ : { done: true };
+ }
+ });
+ };
+ ObservableMap$$1.prototype.entries = function () {
+ var self = this;
+ var nextIndex = 0;
+ var keys$$1 = Array.from(this.keys());
+ return makeIterable({
+ next: function () {
+ if (nextIndex < keys$$1.length) {
+ var key = keys$$1[nextIndex++];
+ return {
+ value: [key, self.get(key)],
+ done: false
+ };
+ }
+ return { done: true };
+ }
+ });
+ };
+ ObservableMap$$1.prototype[(_a = $mobx$$1, Symbol.iterator)] = function () {
+ return this.entries();
+ };
+ ObservableMap$$1.prototype.forEach = function (callback, thisArg) {
+ var e_1, _a;
+ try {
+ for (var _b = __values(this), _c = _b.next(); !_c.done; _c = _b.next()) {
+ var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
+ callback.call(thisArg, value, key, this);
+ }
+ }
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
+ finally {
+ try {
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
+ }
+ finally { if (e_1) throw e_1.error; }
+ }
+ };
+ /** Merge another object into this object, returns this. */
+ ObservableMap$$1.prototype.merge = function (other) {
+ var _this = this;
+ if (isObservableMap$$1(other)) {
+ other = other.toJS();
+ }
+ transaction$$1(function () {
+ if (isPlainObject$$1(other))
+ Object.keys(other).forEach(function (key) { return _this.set(key, other[key]); });
+ else if (Array.isArray(other))
+ other.forEach(function (_a) {
+ var _b = __read(_a, 2), key = _b[0], value = _b[1];
+ return _this.set(key, value);
+ });
+ else if (isES6Map$$1(other))
+ other.forEach(function (value, key) { return _this.set(key, value); });
+ else if (other !== null && other !== undefined)
+ fail$$1("Cannot initialize map from " + other);
+ });
+ return this;
+ };
+ ObservableMap$$1.prototype.clear = function () {
+ var _this = this;
+ transaction$$1(function () {
+ untracked$$1(function () {
+ var e_2, _a;
+ try {
+ for (var _b = __values(_this.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
+ var key = _c.value;
+ _this.delete(key);
+ }
+ }
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
+ finally {
+ try {
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
+ }
+ finally { if (e_2) throw e_2.error; }
+ }
+ });
+ });
+ };
+ ObservableMap$$1.prototype.replace = function (values$$1) {
+ var _this = this;
+ transaction$$1(function () {
+ // grab all the keys that are present in the new map but not present in the current map
+ // and delete them from the map, then merge the new map
+ // this will cause reactions only on changed values
+ var newKeys = getMapLikeKeys$$1(values$$1);
+ var oldKeys = Array.from(_this.keys());
+ var missingKeys = oldKeys.filter(function (k) { return newKeys.indexOf(k) === -1; });
+ missingKeys.forEach(function (k) { return _this.delete(k); });
+ _this.merge(values$$1);
+ });
+ return this;
+ };
+ Object.defineProperty(ObservableMap$$1.prototype, "size", {
+ get: function () {
+ this._keysAtom.reportObserved();
+ return this._data.size;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ /**
+ * Returns a plain object that represents this map.
+ * Note that all the keys being stringified.
+ * If there are duplicating keys after converting them to strings, behaviour is undetermined.
+ */
+ ObservableMap$$1.prototype.toPOJO = function () {
+ var e_3, _a;
+ var res = {};
+ try {
+ for (var _b = __values(this), _c = _b.next(); !_c.done; _c = _b.next()) {
+ var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
+ res["" + key] = value;
+ }
+ }
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
+ finally {
+ try {
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
+ }
+ finally { if (e_3) throw e_3.error; }
+ }
+ return res;
+ };
+ /**
+ * Returns a shallow non observable object clone of this map.
+ * Note that the values migth still be observable. For a deep clone use mobx.toJS.
+ */
+ ObservableMap$$1.prototype.toJS = function () {
+ return new Map(this);
+ };
+ ObservableMap$$1.prototype.toJSON = function () {
+ // Used by JSON.stringify
+ return this.toPOJO();
+ };
+ ObservableMap$$1.prototype.toString = function () {
+ var _this = this;
+ return (this.name +
+ "[{ " +
+ Array.from(this.keys())
+ .map(function (key) { return key + ": " + ("" + _this.get(key)); })
+ .join(", ") +
+ " }]");
+ };
+ /**
+ * Observes this object. Triggers for the events 'add', 'update' and 'delete'.
+ * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe
+ * for callback details
+ */
+ ObservableMap$$1.prototype.observe = function (listener, fireImmediately) {
+ true &&
+ invariant$$1(fireImmediately !== true, "`observe` doesn't support fireImmediately=true in combination with maps.");
+ return registerListener$$1(this, listener);
+ };
+ ObservableMap$$1.prototype.intercept = function (handler) {
+ return registerInterceptor$$1(this, handler);
+ };
+ return ObservableMap$$1;
+}());
+/* 'var' fixes small-build issue */
+var isObservableMap$$1 = createInstanceofPredicate$$1("ObservableMap", ObservableMap$$1);
+
+var ObservableObjectAdministration$$1 = /** @class */ (function () {
+ function ObservableObjectAdministration$$1(target, values$$1, name, defaultEnhancer) {
+ if (values$$1 === void 0) { values$$1 = new Map(); }
+ this.target = target;
+ this.values = values$$1;
+ this.name = name;
+ this.defaultEnhancer = defaultEnhancer;
+ this.keysAtom = new Atom$$1(name + ".keys");
+ }
+ ObservableObjectAdministration$$1.prototype.read = function (key) {
+ return this.values.get(key).get();
+ };
+ ObservableObjectAdministration$$1.prototype.write = function (key, newValue) {
+ var instance = this.target;
+ var observable$$1 = this.values.get(key);
+ if (observable$$1 instanceof ComputedValue$$1) {
+ observable$$1.set(newValue);
+ return;
+ }
+ // intercept
+ if (hasInterceptors$$1(this)) {
+ var change = interceptChange$$1(this, {
+ type: "update",
+ object: this.proxy || instance,
+ name: key,
+ newValue: newValue
+ });
+ if (!change)
+ return;
+ newValue = change.newValue;
+ }
+ newValue = observable$$1.prepareNewValue(newValue);
+ // notify spy & observers
+ if (newValue !== globalState$$1.UNCHANGED) {
+ var notify = hasListeners$$1(this);
+ var notifySpy = isSpyEnabled$$1();
+ var change = notify || notifySpy
+ ? {
+ type: "update",
+ object: this.proxy || instance,
+ oldValue: observable$$1.value,
+ name: key,
+ newValue: newValue
+ }
+ : null;
+ if (notifySpy && "development" !== "production")
+ spyReportStart$$1(__assign({}, change, { name: this.name, key: key }));
+ observable$$1.setNewValue(newValue);
+ if (notify)
+ notifyListeners$$1(this, change);
+ if (notifySpy && "development" !== "production")
+ spyReportEnd$$1();
+ }
+ };
+ ObservableObjectAdministration$$1.prototype.has = function (key) {
+ var map = this.pendingKeys || (this.pendingKeys = new Map());
+ var entry = map.get(key);
+ if (entry)
+ return entry.get();
+ else {
+ var exists = !!this.values.get(key);
+ // Possible optimization: Don't have a separate map for non existing keys,
+ // but store them in the values map instead, using a special symbol to denote "not existing"
+ entry = new ObservableValue$$1(exists, referenceEnhancer$$1, this.name + "." + key.toString() + "?", false);
+ map.set(key, entry);
+ return entry.get(); // read to subscribe
+ }
+ };
+ ObservableObjectAdministration$$1.prototype.addObservableProp = function (propName, newValue, enhancer) {
+ if (enhancer === void 0) { enhancer = this.defaultEnhancer; }
+ var target = this.target;
+ assertPropertyConfigurable$$1(target, propName);
+ if (hasInterceptors$$1(this)) {
+ var change = interceptChange$$1(this, {
+ object: this.proxy || target,
+ name: propName,
+ type: "add",
+ newValue: newValue
+ });
+ if (!change)
+ return;
+ newValue = change.newValue;
+ }
+ var observable$$1 = new ObservableValue$$1(newValue, enhancer, this.name + "." + propName, false);
+ this.values.set(propName, observable$$1);
+ newValue = observable$$1.value; // observableValue might have changed it
+ Object.defineProperty(target, propName, generateObservablePropConfig$$1(propName));
+ this.notifyPropertyAddition(propName, newValue);
+ };
+ ObservableObjectAdministration$$1.prototype.addComputedProp = function (propertyOwner, // where is the property declared?
+ propName, options) {
+ var target = this.target;
+ options.name = options.name || this.name + "." + propName;
+ this.values.set(propName, new ComputedValue$$1(options));
+ if (propertyOwner === target || isPropertyConfigurable$$1(propertyOwner, propName))
+ Object.defineProperty(propertyOwner, propName, generateComputedPropConfig$$1(propName));
+ };
+ ObservableObjectAdministration$$1.prototype.remove = function (key) {
+ if (!this.values.has(key))
+ return;
+ var target = this.target;
+ if (hasInterceptors$$1(this)) {
+ var change = interceptChange$$1(this, {
+ object: this.proxy || target,
+ name: key,
+ type: "remove"
+ });
+ if (!change)
+ return;
+ }
+ try {
+ startBatch$$1();
+ var notify = hasListeners$$1(this);
+ var notifySpy = isSpyEnabled$$1();
+ var oldObservable = this.values.get(key);
+ var oldValue = oldObservable && oldObservable.get();
+ oldObservable && oldObservable.set(undefined);
+ // notify key and keyset listeners
+ this.keysAtom.reportChanged();
+ this.values.delete(key);
+ if (this.pendingKeys) {
+ var entry = this.pendingKeys.get(key);
+ if (entry)
+ entry.set(false);
+ }
+ // delete the prop
+ delete this.target[key];
+ var change = notify || notifySpy
+ ? {
+ type: "remove",
+ object: this.proxy || target,
+ oldValue: oldValue,
+ name: key
+ }
+ : null;
+ if (notifySpy && "development" !== "production")
+ spyReportStart$$1(__assign({}, change, { name: this.name, key: key }));
+ if (notify)
+ notifyListeners$$1(this, change);
+ if (notifySpy && "development" !== "production")
+ spyReportEnd$$1();
+ }
+ finally {
+ endBatch$$1();
+ }
+ };
+ ObservableObjectAdministration$$1.prototype.illegalAccess = function (owner, propName) {
+ /**
+ * This happens if a property is accessed through the prototype chain, but the property was
+ * declared directly as own property on the prototype.
+ *
+ * E.g.:
+ * class A {
+ * }
+ * extendObservable(A.prototype, { x: 1 })
+ *
+ * classB extens A {
+ * }
+ * console.log(new B().x)
+ *
+ * It is unclear whether the property should be considered 'static' or inherited.
+ * Either use `console.log(A.x)`
+ * or: decorate(A, { x: observable })
+ *
+ * When using decorate, the property will always be redeclared as own property on the actual instance
+ */
+ console.warn("Property '" + propName + "' of '" + owner + "' was accessed through the prototype chain. Use 'decorate' instead to declare the prop or access it statically through it's owner");
+ };
+ /**
+ * Observes this object. Triggers for the events 'add', 'update' and 'delete'.
+ * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe
+ * for callback details
+ */
+ ObservableObjectAdministration$$1.prototype.observe = function (callback, fireImmediately) {
+ true &&
+ invariant$$1(fireImmediately !== true, "`observe` doesn't support the fire immediately property for observable objects.");
+ return registerListener$$1(this, callback);
+ };
+ ObservableObjectAdministration$$1.prototype.intercept = function (handler) {
+ return registerInterceptor$$1(this, handler);
+ };
+ ObservableObjectAdministration$$1.prototype.notifyPropertyAddition = function (key, newValue) {
+ var notify = hasListeners$$1(this);
+ var notifySpy = isSpyEnabled$$1();
+ var change = notify || notifySpy
+ ? {
+ type: "add",
+ object: this.proxy || this.target,
+ name: key,
+ newValue: newValue
+ }
+ : null;
+ if (notifySpy && "development" !== "production")
+ spyReportStart$$1(__assign({}, change, { name: this.name, key: key }));
+ if (notify)
+ notifyListeners$$1(this, change);
+ if (notifySpy && "development" !== "production")
+ spyReportEnd$$1();
+ if (this.pendingKeys) {
+ var entry = this.pendingKeys.get(key);
+ if (entry)
+ entry.set(true);
+ }
+ this.keysAtom.reportChanged();
+ };
+ ObservableObjectAdministration$$1.prototype.getKeys = function () {
+ var e_1, _a;
+ this.keysAtom.reportObserved();
+ // return Reflect.ownKeys(this.values) as any
+ var res = [];
+ try {
+ for (var _b = __values(this.values), _c = _b.next(); !_c.done; _c = _b.next()) {
+ var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
+ if (value instanceof ObservableValue$$1)
+ res.push(key);
+ }
+ }
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
+ finally {
+ try {
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
+ }
+ finally { if (e_1) throw e_1.error; }
+ }
+ return res;
+ };
+ return ObservableObjectAdministration$$1;
+}());
+function asObservableObject$$1(target, name, defaultEnhancer) {
+ if (name === void 0) { name = ""; }
+ if (defaultEnhancer === void 0) { defaultEnhancer = deepEnhancer$$1; }
+ if (Object.prototype.hasOwnProperty.call(target, $mobx$$1))
+ return target[$mobx$$1];
+ true &&
+ invariant$$1(Object.isExtensible(target), "Cannot make the designated object observable; it is not extensible");
+ if (!isPlainObject$$1(target))
+ name = (target.constructor.name || "ObservableObject") + "@" + getNextId$$1();
+ if (!name)
+ name = "ObservableObject@" + getNextId$$1();
+ var adm = new ObservableObjectAdministration$$1(target, new Map(), name, defaultEnhancer);
+ addHiddenProp$$1(target, $mobx$$1, adm);
+ return adm;
+}
+var observablePropertyConfigs = Object.create(null);
+var computedPropertyConfigs = Object.create(null);
+function generateObservablePropConfig$$1(propName) {
+ return (observablePropertyConfigs[propName] ||
+ (observablePropertyConfigs[propName] = {
+ configurable: true,
+ enumerable: true,
+ get: function () {
+ return this[$mobx$$1].read(propName);
+ },
+ set: function (v) {
+ this[$mobx$$1].write(propName, v);
+ }
+ }));
+}
+function getAdministrationForComputedPropOwner(owner) {
+ var adm = owner[$mobx$$1];
+ if (!adm) {
+ // because computed props are declared on proty,
+ // the current instance might not have been initialized yet
+ initializeInstance$$1(owner);
+ return owner[$mobx$$1];
+ }
+ return adm;
+}
+function generateComputedPropConfig$$1(propName) {
+ return (computedPropertyConfigs[propName] ||
+ (computedPropertyConfigs[propName] = {
+ configurable: true,
+ enumerable: false,
+ get: function () {
+ return getAdministrationForComputedPropOwner(this).read(propName);
+ },
+ set: function (v) {
+ getAdministrationForComputedPropOwner(this).write(propName, v);
+ }
+ }));
+}
+var isObservableObjectAdministration = createInstanceofPredicate$$1("ObservableObjectAdministration", ObservableObjectAdministration$$1);
+function isObservableObject$$1(thing) {
+ if (isObject$$1(thing)) {
+ // Initializers run lazily when transpiling to babel, so make sure they are run...
+ initializeInstance$$1(thing);
+ return isObservableObjectAdministration(thing[$mobx$$1]);
+ }
+ return false;
+}
+
+function getAtom$$1(thing, property) {
+ if (typeof thing === "object" && thing !== null) {
+ if (isObservableArray$$1(thing)) {
+ if (property !== undefined)
+ fail$$1( true &&
+ "It is not possible to get index atoms from arrays");
+ return thing[$mobx$$1].atom;
+ }
+ if (isObservableMap$$1(thing)) {
+ var anyThing = thing;
+ if (property === undefined)
+ return anyThing._keysAtom;
+ var observable$$1 = anyThing._data.get(property) || anyThing._hasMap.get(property);
+ if (!observable$$1)
+ fail$$1( true &&
+ "the entry '" + property + "' does not exist in the observable map '" + getDebugName$$1(thing) + "'");
+ return observable$$1;
+ }
+ // Initializers run lazily when transpiling to babel, so make sure they are run...
+ initializeInstance$$1(thing);
+ if (property && !thing[$mobx$$1])
+ thing[property]; // See #1072
+ if (isObservableObject$$1(thing)) {
+ if (!property)
+ return fail$$1( true && "please specify a property");
+ var observable$$1 = thing[$mobx$$1].values.get(property);
+ if (!observable$$1)
+ fail$$1( true &&
+ "no observable property '" + property + "' found on the observable object '" + getDebugName$$1(thing) + "'");
+ return observable$$1;
+ }
+ if (isAtom$$1(thing) || isComputedValue$$1(thing) || isReaction$$1(thing)) {
+ return thing;
+ }
+ }
+ else if (typeof thing === "function") {
+ if (isReaction$$1(thing[$mobx$$1])) {
+ // disposer function
+ return thing[$mobx$$1];
+ }
+ }
+ return fail$$1( true && "Cannot obtain atom from " + thing);
+}
+function getAdministration$$1(thing, property) {
+ if (!thing)
+ fail$$1("Expecting some object");
+ if (property !== undefined)
+ return getAdministration$$1(getAtom$$1(thing, property));
+ if (isAtom$$1(thing) || isComputedValue$$1(thing) || isReaction$$1(thing))
+ return thing;
+ if (isObservableMap$$1(thing))
+ return thing;
+ // Initializers run lazily when transpiling to babel, so make sure they are run...
+ initializeInstance$$1(thing);
+ if (thing[$mobx$$1])
+ return thing[$mobx$$1];
+ fail$$1( true && "Cannot obtain administration from " + thing);
+}
+function getDebugName$$1(thing, property) {
+ var named;
+ if (property !== undefined)
+ named = getAtom$$1(thing, property);
+ else if (isObservableObject$$1(thing) || isObservableMap$$1(thing))
+ named = getAdministration$$1(thing);
+ else
+ named = getAtom$$1(thing); // valid for arrays as well
+ return named.name;
+}
+
+var toString = Object.prototype.toString;
+function deepEqual$$1(a, b) {
+ return eq(a, b);
+}
+// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289
+// Internal recursive comparison function for `isEqual`.
+function eq(a, b, aStack, bStack) {
+ // Identical objects are equal. `0 === -0`, but they aren't identical.
+ // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
+ if (a === b)
+ return a !== 0 || 1 / a === 1 / b;
+ // `null` or `undefined` only equal to itself (strict comparison).
+ if (a == null || b == null)
+ return false;
+ // `NaN`s are equivalent, but non-reflexive.
+ if (a !== a)
+ return b !== b;
+ // Exhaust primitive checks
+ var type = typeof a;
+ if (type !== "function" && type !== "object" && typeof b != "object")
+ return false;
+ return deepEq(a, b, aStack, bStack);
+}
+// Internal recursive comparison function for `isEqual`.
+function deepEq(a, b, aStack, bStack) {
+ // Unwrap any wrapped objects.
+ a = unwrap(a);
+ b = unwrap(b);
+ // Compare `[[Class]]` names.
+ var className = toString.call(a);
+ if (className !== toString.call(b))
+ return false;
+ switch (className) {
+ // Strings, numbers, regular expressions, dates, and booleans are compared by value.
+ case "[object RegExp]":
+ // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
+ case "[object String]":
+ // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
+ // equivalent to `new String("5")`.
+ return "" + a === "" + b;
+ case "[object Number]":
+ // `NaN`s are equivalent, but non-reflexive.
+ // Object(NaN) is equivalent to NaN.
+ if (+a !== +a)
+ return +b !== +b;
+ // An `egal` comparison is performed for other numeric values.
+ return +a === 0 ? 1 / +a === 1 / b : +a === +b;
+ case "[object Date]":
+ case "[object Boolean]":
+ // Coerce dates and booleans to numeric primitive values. Dates are compared by their
+ // millisecond representations. Note that invalid dates with millisecond representations
+ // of `NaN` are not equivalent.
+ return +a === +b;
+ case "[object Symbol]":
+ return (typeof Symbol !== "undefined" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b));
+ }
+ var areArrays = className === "[object Array]";
+ if (!areArrays) {
+ if (typeof a != "object" || typeof b != "object")
+ return false;
+ // Objects with different constructors are not equivalent, but `Object`s or `Array`s
+ // from different frames are.
+ var aCtor = a.constructor, bCtor = b.constructor;
+ if (aCtor !== bCtor &&
+ !(typeof aCtor === "function" &&
+ aCtor instanceof aCtor &&
+ typeof bCtor === "function" &&
+ bCtor instanceof bCtor) &&
+ ("constructor" in a && "constructor" in b)) {
+ return false;
+ }
+ }
+ // Assume equality for cyclic structures. The algorithm for detecting cyclic
+ // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
+ // Initializing stack of traversed objects.
+ // It's done here since we only need them for objects and arrays comparison.
+ aStack = aStack || [];
+ bStack = bStack || [];
+ var length = aStack.length;
+ while (length--) {
+ // Linear search. Performance is inversely proportional to the number of
+ // unique nested structures.
+ if (aStack[length] === a)
+ return bStack[length] === b;
+ }
+ // Add the first object to the stack of traversed objects.
+ aStack.push(a);
+ bStack.push(b);
+ // Recursively compare objects and arrays.
+ if (areArrays) {
+ // Compare array lengths to determine if a deep comparison is necessary.
+ length = a.length;
+ if (length !== b.length)
+ return false;
+ // Deep compare the contents, ignoring non-numeric properties.
+ while (length--) {
+ if (!eq(a[length], b[length], aStack, bStack))
+ return false;
+ }
+ }
+ else {
+ // Deep compare objects.
+ var keys$$1 = Object.keys(a), key;
+ length = keys$$1.length;
+ // Ensure that both objects contain the same number of properties before comparing deep equality.
+ if (Object.keys(b).length !== length)
+ return false;
+ while (length--) {
+ // Deep compare each member
+ key = keys$$1[length];
+ if (!(has$1(b, key) && eq(a[key], b[key], aStack, bStack)))
+ return false;
+ }
+ }
+ // Remove the first object from the stack of traversed objects.
+ aStack.pop();
+ bStack.pop();
+ return true;
+}
+function unwrap(a) {
+ if (isObservableArray$$1(a))
+ return a.slice();
+ if (isES6Map$$1(a) || isObservableMap$$1(a))
+ return Array.from(a.entries());
+ return a;
+}
+function has$1(a, key) {
+ return Object.prototype.hasOwnProperty.call(a, key);
+}
+
+function makeIterable(iterator) {
+ iterator[Symbol.iterator] = self;
+ return iterator;
+}
+function self() {
+ return this;
+}
+
+/*
+The only reason for this file to exist is pure horror:
+Without it rollup can make the bundling fail at any point in time; when it rolls up the files in the wrong order
+it will cause undefined errors (for example because super classes or local variables not being hosted).
+With this file that will still happen,
+but at least in this file we can magically reorder the imports with trial and error until the build succeeds again.
+*/
+
+/**
+ * (c) Michel Weststrate 2015 - 2018
+ * MIT Licensed
+ *
+ * Welcome to the mobx sources! To get an global overview of how MobX internally works,
+ * this is a good place to start:
+ * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74
+ *
+ * Source folders:
+ * ===============
+ *
+ * - api/ Most of the public static methods exposed by the module can be found here.
+ * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.
+ * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.
+ * - utils/ Utility stuff.
+ *
+ */
+if (typeof Proxy === "undefined" || typeof Symbol === "undefined") {
+ throw new Error("[mobx] MobX 5+ requires Proxy and Symbol objects. If your environment doesn't support Proxy objects, please downgrade to MobX 4. For React Native Android, consider upgrading JSCore.");
+}
+try {
+ // define process.env if needed
+ // if this is not a production build in the first place
+ // (in which case the expression below would be substituted with 'production')
+ "development";
+}
+catch (e) {
+ var g = typeof window !== "undefined" ? window : global;
+ if (typeof process === "undefined")
+ g.process = {};
+ g.process.env = {};
+}
+
+(function () {
+ function testCodeMinification() { }
+ if (testCodeMinification.name !== "testCodeMinification" &&
+ "development" !== "production" &&
+ process.env.IGNORE_MOBX_MINIFY_WARNING !== "true") {
+ console.warn(
+ // Template literal(backtick) is used for fix issue with rollup-plugin-commonjs https://github.com/rollup/rollup-plugin-commonjs/issues/344
+ "[mobx] you are running a minified build, but 'process.env.NODE_ENV' was not set to 'production' in your bundler. This results in an unnecessarily large and slow bundle");
+ }
+})();
+// Devtools support
+if (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === "object") {
+ // See: https://github.com/andykog/mobx-devtools/
+ __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({
+ spy: spy$$1,
+ extras: {
+ getDebugName: getDebugName$$1
+ },
+ $mobx: $mobx$$1
+ });
+}
+
+
+
+/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node-libs-browser/node_modules/process/browser.js */ "./node_modules/node-libs-browser/node_modules/process/browser.js"), __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
+
+/***/ }),
+
+/***/ "./node_modules/node-libs-browser/node_modules/process/browser.js":
+/*!************************************************************************!*\
+ !*** ./node_modules/node-libs-browser/node_modules/process/browser.js ***!
+ \************************************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(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);
+ }
+ }
+
+
+}
+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 queue = [];
+var draining = false;
+var currentQueue;
+var queueIndex = -1;
+
+function cleanUpNextTick() {
+ if (!draining || !currentQueue) {
+ return;
+ }
+ draining = false;
+ if (currentQueue.length) {
+ queue = currentQueue.concat(queue);
+ } else {
+ queueIndex = -1;
+ }
+ if (queue.length) {
+ drainQueue();
+ }
+}
+
+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);
+}
+
+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];
+ }
+ }
+ 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; };
+
+
+/***/ }),
+
+/***/ "./node_modules/object-assign/index.js":
+/*!*********************************************!*\
+ !*** ./node_modules/object-assign/index.js ***!
+ \*********************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/*
+object-assign
+(c) Sindre Sorhus
+@license MIT
+*/
+
+
+/* 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;
+};
+
+
+/***/ }),
+
+/***/ "./node_modules/path-to-regexp/index.js":
+/*!**********************************************!*\
+ !*** ./node_modules/path-to-regexp/index.js ***!
+ \**********************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+var isarray = __webpack_require__(/*! isarray */ "./node_modules/path-to-regexp/node_modules/isarray/index.js")
+
+/**
+ * Expose `pathToRegexp`.
+ */
+module.exports = pathToRegexp
+module.exports.parse = parse
+module.exports.compile = compile
+module.exports.tokensToFunction = tokensToFunction
+module.exports.tokensToRegExp = tokensToRegExp
+
+/**
+ * The main path matching regexp utility.
+ *
+ * @type {RegExp}
+ */
+var PATH_REGEXP = new RegExp([
+ // Match escaped characters that would otherwise appear in future matches.
+ // This allows the user to escape special characters that won't transform.
+ '(\\\\.)',
+ // Match Express-style parameters and un-named parameters with a prefix
+ // and optional suffixes. Matches appear as:
+ //
+ // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
+ // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
+ // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
+ '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
+].join('|'), 'g')
+
+/**
+ * Parse a string for the raw tokens.
+ *
+ * @param {string} str
+ * @param {Object=} options
+ * @return {!Array}
+ */
+function parse (str, options) {
+ var tokens = []
+ var key = 0
+ var index = 0
+ var path = ''
+ var defaultDelimiter = options && options.delimiter || '/'
+ var res
+
+ while ((res = PATH_REGEXP.exec(str)) != null) {
+ var m = res[0]
+ var escaped = res[1]
+ var offset = res.index
+ path += str.slice(index, offset)
+ index = offset + m.length
+
+ // Ignore already escaped sequences.
+ if (escaped) {
+ path += escaped[1]
+ continue
+ }
+
+ var next = str[index]
+ var prefix = res[2]
+ var name = res[3]
+ var capture = res[4]
+ var group = res[5]
+ var modifier = res[6]
+ var asterisk = res[7]
+
+ // Push the current path onto the tokens.
+ if (path) {
+ tokens.push(path)
+ path = ''
+ }
+
+ var partial = prefix != null && next != null && next !== prefix
+ var repeat = modifier === '+' || modifier === '*'
+ var optional = modifier === '?' || modifier === '*'
+ var delimiter = res[2] || defaultDelimiter
+ var pattern = capture || group
+
+ tokens.push({
+ name: name || key++,
+ prefix: prefix || '',
+ delimiter: delimiter,
+ optional: optional,
+ repeat: repeat,
+ partial: partial,
+ asterisk: !!asterisk,
+ pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
+ })
+ }
+
+ // Match any characters still remaining.
+ if (index < str.length) {
+ path += str.substr(index)
+ }
+
+ // If the path exists, push it onto the end.
+ if (path) {
+ tokens.push(path)
+ }
+
+ return tokens
+}
+
+/**
+ * Compile a string to a template function for the path.
+ *
+ * @param {string} str
+ * @param {Object=} options
+ * @return {!function(Object=, Object=)}
+ */
+function compile (str, options) {
+ return tokensToFunction(parse(str, options))
+}
+
+/**
+ * Prettier encoding of URI path segments.
+ *
+ * @param {string}
+ * @return {string}
+ */
+function encodeURIComponentPretty (str) {
+ return encodeURI(str).replace(/[\/?#]/g, function (c) {
+ return '%' + c.charCodeAt(0).toString(16).toUpperCase()
+ })
+}
+
+/**
+ * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
+ *
+ * @param {string}
+ * @return {string}
+ */
+function encodeAsterisk (str) {
+ return encodeURI(str).replace(/[?#]/g, function (c) {
+ return '%' + c.charCodeAt(0).toString(16).toUpperCase()
+ })
+}
+
+/**
+ * Expose a method for transforming tokens into the path function.
+ */
+function tokensToFunction (tokens) {
+ // Compile all the tokens into regexps.
+ var matches = new Array(tokens.length)
+
+ // Compile all the patterns before compilation.
+ for (var i = 0; i < tokens.length; i++) {
+ if (typeof tokens[i] === 'object') {
+ matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$')
+ }
+ }
+
+ return function (obj, opts) {
+ var path = ''
+ var data = obj || {}
+ var options = opts || {}
+ var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent
+
+ for (var i = 0; i < tokens.length; i++) {
+ var token = tokens[i]
+
+ if (typeof token === 'string') {
+ path += token
+
+ continue
+ }
+
+ var value = data[token.name]
+ var segment
+
+ if (value == null) {
+ if (token.optional) {
+ // Prepend partial segment prefixes.
+ if (token.partial) {
+ path += token.prefix
+ }
+
+ continue
+ } else {
+ throw new TypeError('Expected "' + token.name + '" to be defined')
+ }
+ }
+
+ if (isarray(value)) {
+ if (!token.repeat) {
+ throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
+ }
+
+ if (value.length === 0) {
+ if (token.optional) {
+ continue
+ } else {
+ throw new TypeError('Expected "' + token.name + '" to not be empty')
+ }
+ }
+
+ for (var j = 0; j < value.length; j++) {
+ segment = encode(value[j])
+
+ if (!matches[i].test(segment)) {
+ throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
+ }
+
+ path += (j === 0 ? token.prefix : token.delimiter) + segment
+ }
+
+ continue
+ }
+
+ segment = token.asterisk ? encodeAsterisk(value) : encode(value)
+
+ if (!matches[i].test(segment)) {
+ throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
+ }
+
+ path += token.prefix + segment
+ }
+
+ return path
+ }
+}
+
+/**
+ * Escape a regular expression string.
+ *
+ * @param {string} str
+ * @return {string}
+ */
+function escapeString (str) {
+ return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
+}
+
+/**
+ * Escape the capturing group by escaping special characters and meaning.
+ *
+ * @param {string} group
+ * @return {string}
+ */
+function escapeGroup (group) {
+ return group.replace(/([=!:$\/()])/g, '\\$1')
+}
+
+/**
+ * Attach the keys as a property of the regexp.
+ *
+ * @param {!RegExp} re
+ * @param {Array} keys
+ * @return {!RegExp}
+ */
+function attachKeys (re, keys) {
+ re.keys = keys
+ return re
+}
+
+/**
+ * Get the flags for a regexp from the options.
+ *
+ * @param {Object} options
+ * @return {string}
+ */
+function flags (options) {
+ return options.sensitive ? '' : 'i'
+}
+
+/**
+ * Pull out keys from a regexp.
+ *
+ * @param {!RegExp} path
+ * @param {!Array} keys
+ * @return {!RegExp}
+ */
+function regexpToRegexp (path, keys) {
+ // Use a negative lookahead to match only capturing groups.
+ var groups = path.source.match(/\((?!\?)/g)
+
+ if (groups) {
+ for (var i = 0; i < groups.length; i++) {
+ keys.push({
+ name: i,
+ prefix: null,
+ delimiter: null,
+ optional: false,
+ repeat: false,
+ partial: false,
+ asterisk: false,
+ pattern: null
+ })
+ }
+ }
+
+ return attachKeys(path, keys)
+}
+
+/**
+ * Transform an array into a regexp.
+ *
+ * @param {!Array} path
+ * @param {Array} keys
+ * @param {!Object} options
+ * @return {!RegExp}
+ */
+function arrayToRegexp (path, keys, options) {
+ var parts = []
+
+ for (var i = 0; i < path.length; i++) {
+ parts.push(pathToRegexp(path[i], keys, options).source)
+ }
+
+ var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options))
+
+ return attachKeys(regexp, keys)
+}
+
+/**
+ * Create a path regexp from string input.
+ *
+ * @param {string} path
+ * @param {!Array} keys
+ * @param {!Object} options
+ * @return {!RegExp}
+ */
+function stringToRegexp (path, keys, options) {
+ return tokensToRegExp(parse(path, options), keys, options)
+}
+
+/**
+ * Expose a function for taking tokens and returning a RegExp.
+ *
+ * @param {!Array} tokens
+ * @param {(Array|Object)=} keys
+ * @param {Object=} options
+ * @return {!RegExp}
+ */
+function tokensToRegExp (tokens, keys, options) {
+ if (!isarray(keys)) {
+ options = /** @type {!Object} */ (keys || options)
+ keys = []
+ }
+
+ options = options || {}
+
+ var strict = options.strict
+ var end = options.end !== false
+ var route = ''
+
+ // Iterate over the tokens and create our regexp string.
+ for (var i = 0; i < tokens.length; i++) {
+ var token = tokens[i]
+
+ if (typeof token === 'string') {
+ route += escapeString(token)
+ } else {
+ var prefix = escapeString(token.prefix)
+ var capture = '(?:' + token.pattern + ')'
+
+ keys.push(token)
+
+ if (token.repeat) {
+ capture += '(?:' + prefix + capture + ')*'
+ }
+
+ if (token.optional) {
+ if (!token.partial) {
+ capture = '(?:' + prefix + '(' + capture + '))?'
+ } else {
+ capture = prefix + '(' + capture + ')?'
+ }
+ } else {
+ capture = prefix + '(' + capture + ')'
+ }
+
+ route += capture
+ }
+ }
+
+ var delimiter = escapeString(options.delimiter || '/')
+ var endsWithDelimiter = route.slice(-delimiter.length) === delimiter
+
+ // In non-strict mode we allow a slash at the end of match. If the path to
+ // match already ends with a slash, we remove it for consistency. The slash
+ // is valid at the end of a path match, not in the middle. This is important
+ // in non-ending mode, where "/test/" shouldn't match "/test//route".
+ if (!strict) {
+ route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?'
+ }
+
+ if (end) {
+ route += '$'
+ } else {
+ // In non-ending mode, we need the capturing groups to match as much as
+ // possible by using a positive lookahead to the end or next path segment.
+ route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)'
+ }
+
+ return attachKeys(new RegExp('^' + route, flags(options)), keys)
+}
+
+/**
+ * Normalize the given path string, returning a regular expression.
+ *
+ * An empty array can be passed in for the keys, which will hold the
+ * placeholder key descriptions. For example, using `/user/:id`, `keys` will
+ * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
+ *
+ * @param {(string|RegExp|Array)} path
+ * @param {(Array|Object)=} keys
+ * @param {Object=} options
+ * @return {!RegExp}
+ */
+function pathToRegexp (path, keys, options) {
+ if (!isarray(keys)) {
+ options = /** @type {!Object} */ (keys || options)
+ keys = []
+ }
+
+ options = options || {}
+
+ if (path instanceof RegExp) {
+ return regexpToRegexp(path, /** @type {!Array} */ (keys))
+ }
+
+ if (isarray(path)) {
+ return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
+ }
+
+ return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
+}
+
+
+/***/ }),
+
+/***/ "./node_modules/path-to-regexp/node_modules/isarray/index.js":
+/*!*******************************************************************!*\
+ !*** ./node_modules/path-to-regexp/node_modules/isarray/index.js ***!
+ \*******************************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports) {
+
+module.exports = Array.isArray || function (arr) {
+ return Object.prototype.toString.call(arr) == '[object Array]';
+};
+
+
+/***/ }),
+
+/***/ "./node_modules/prop-types/checkPropTypes.js":
+/*!***************************************************!*\
+ !*** ./node_modules/prop-types/checkPropTypes.js ***!
+ \***************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/**
+ * 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 printWarning = function() {};
+
+if (true) {
+ var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js");
+ var loggedTypeFailures = {};
+
+ 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 (true) {
+ 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 : '')
+ );
+ }
+ }
+ }
+ }
+}
+
+module.exports = checkPropTypes;
+
+
+/***/ }),
+
+/***/ "./node_modules/prop-types/factoryWithTypeCheckers.js":
+/*!************************************************************!*\
+ !*** ./node_modules/prop-types/factoryWithTypeCheckers.js ***!
+ \************************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/**
+ * 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 assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js");
+
+var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js");
+var checkPropTypes = __webpack_require__(/*! ./checkPropTypes */ "./node_modules/prop-types/checkPropTypes.js");
+
+var printWarning = function() {};
+
+if (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) {}
+ };
+}
+
+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;
+ }
+ }
+
+ /**
+ * 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'),
+ bool: createPrimitiveTypeChecker('boolean'),
+ func: createPrimitiveTypeChecker('function'),
+ number: createPrimitiveTypeChecker('number'),
+ object: createPrimitiveTypeChecker('object'),
+ string: createPrimitiveTypeChecker('string'),
+ symbol: createPrimitiveTypeChecker('symbol'),
+
+ any: createAnyTypeChecker(),
+ arrayOf: createArrayOfTypeChecker,
+ element: createElementTypeChecker(),
+ 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) {
+ this.message = message;
+ this.stack = '';
+ }
+ // Make `instanceof Error` still work for returned errors.
+ PropTypeError.prototype = Error.prototype;
+
+ function createChainableTypeChecker(validate) {
+ if (true) {
+ 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 ( true && 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);
+ }
+ }
+
+ var chainedCheckType = checkType.bind(null, false);
+ chainedCheckType.isRequired = checkType.bind(null, true);
+
+ return chainedCheckType;
+ }
+
+ 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 + '`.'));
+ }
+ return null;
+ }
+ return createChainableTypeChecker(validate);
+ }
+
+ function createAnyTypeChecker() {
+ return createChainableTypeChecker(emptyFunctionThatReturnsNull);
+ }
+
+ 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 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);
+ }
+
+ 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);
+ }
+
+ function createEnumTypeChecker(expectedValues) {
+ if (!Array.isArray(expectedValues)) {
+ true ? printWarning('Invalid argument supplied to oneOf, expected an instance of array.') : undefined;
+ return emptyFunctionThatReturnsNull;
+ }
+
+ 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;
+ }
+ }
+
+ var valuesString = JSON.stringify(expectedValues);
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
+ }
+ return createChainableTypeChecker(validate);
+ }
+
+ 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 (propValue.hasOwnProperty(key)) {
+ var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
+ if (error instanceof Error) {
+ return error;
+ }
+ }
+ }
+ return null;
+ }
+ return createChainableTypeChecker(validate);
+ }
+
+ function createUnionTypeChecker(arrayOfTypeCheckers) {
+ if (!Array.isArray(arrayOfTypeCheckers)) {
+ true ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : undefined;
+ return emptyFunctionThatReturnsNull;
+ }
+
+ 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;
+ }
+ }
+
+ function validate(props, propName, componentName, location, propFullName) {
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
+ var checker = arrayOfTypeCheckers[i];
+ if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
+ return null;
+ }
+ }
+
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
+ }
+ return createChainableTypeChecker(validate);
+ }
+
+ 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);
+ }
+
+ 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 (!checker) {
+ continue;
+ }
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
+ if (error) {
+ return error;
+ }
+ }
+ 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 (!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, ' ')
+ );
+ }
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
+ if (error) {
+ return error;
+ }
+ }
+ return null;
+ }
+
+ return createChainableTypeChecker(validate);
+ }
+
+ 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;
+ }
+ }
+ } 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;
+ }
+ }
+ }
+ }
+ } else {
+ return false;
+ }
+
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ function isSymbol(propType, propValue) {
+ // Native Symbol.
+ if (propType === 'symbol') {
+ return true;
+ }
+
+ // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
+ if (propValue['@@toStringTag'] === 'Symbol') {
+ return true;
+ }
+
+ // Fallback for non-spec compliant Symbols which are polyfilled.
+ if (typeof Symbol === 'function' && propValue instanceof Symbol) {
+ return true;
+ }
+
+ return false;
+ }
+
+ // 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;
+ }
+
+ // 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;
+ }
+
+ // 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;
+ }
+ }
+
+ // Returns class name of the object, if any.
+ function getClassName(propValue) {
+ if (!propValue.constructor || !propValue.constructor.name) {
+ return ANONYMOUS;
+ }
+ return propValue.constructor.name;
+ }
+
+ ReactPropTypes.checkPropTypes = checkPropTypes;
+ ReactPropTypes.PropTypes = ReactPropTypes;
+
+ return ReactPropTypes;
+};
+
+
+/***/ }),
+
+/***/ "./node_modules/prop-types/index.js":
+/*!******************************************!*\
+ !*** ./node_modules/prop-types/index.js ***!
+ \******************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * 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 (true) {
+ var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
+ Symbol.for &&
+ Symbol.for('react.element')) ||
+ 0xeac7;
+
+ var isValidElement = function(object) {
+ return typeof object === 'object' &&
+ object !== null &&
+ object.$$typeof === REACT_ELEMENT_TYPE;
+ };
+
+ // By explicitly using `prop-types` you are opting into new development behavior.
+ // http://fb.me/prop-types-in-prod
+ var throwOnDirectAccess = true;
+ module.exports = __webpack_require__(/*! ./factoryWithTypeCheckers */ "./node_modules/prop-types/factoryWithTypeCheckers.js")(isValidElement, throwOnDirectAccess);
+} else {}
+
+
+/***/ }),
+
+/***/ "./node_modules/prop-types/lib/ReactPropTypesSecret.js":
+/*!*************************************************************!*\
+ !*** ./node_modules/prop-types/lib/ReactPropTypesSecret.js ***!
+ \*************************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/**
+ * 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 ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
+
+module.exports = ReactPropTypesSecret;
+
+
+/***/ }),
+
+/***/ "./node_modules/react-dom/cjs/react-dom.development.js":
+/*!*************************************************************!*\
+ !*** ./node_modules/react-dom/cjs/react-dom.development.js ***!
+ \*************************************************************/
+/*! no static exports found */
+/*! all exports used */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/** @license React v16.8.2
+ * 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.
+ */
+
+
+
+
+
+if (true) {
+ (function() {
+'use strict';
+
+var React = __webpack_require__(/*! react */ "./node_modules/react/index.js");
+var _assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js");
+var checkPropTypes = __webpack_require__(/*! prop-types/checkPropTypes */ "./node_modules/prop-types/checkPropTypes.js");
+var scheduler = __webpack_require__(/*! scheduler */ "./node_modules/scheduler/index.js");
+var tracing = __webpack_require__(/*! scheduler/tracing */ "./node_modules/scheduler/tracing.js");
+
+/**
+ * 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 () {};
+
+{
+ validateFormat = function (format) {
+ if (format === undefined) {
+ throw new Error('invariant requires an error message argument');
+ }
+ };
+}
+
+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';
+ }
+
+ error.framesToPop = 1; // we don't care about invariant's own frame
+ throw error;
+ }
+}
+
+// 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);
+ }
+};
+
+{
+ // 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
+ // unintuitive, 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;
+ }
+
+ // 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.
+ }
+ }
+ }
+ }
+
+ // 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);
+ }
+
+ 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);
+ }
+
+ // Remove our event listeners
+ window.removeEventListener('error', handleWindowError);
+ };
+
+ invokeGuardedCallbackImpl = invokeGuardedCallbackDev;
+ }
+}
+
+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);
+}
+
+/**
+ * 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;
+ }
+ }
+}
+
+/**
+ * During execution of guarded functions we will capture the first error which
+ * we will rethrow to be handled by the top level error handler.
+ */
+function rethrowCaughtError() {
+ if (hasRethrowError) {
+ var error = rethrowError;
+ hasRethrowError = false;
+ rethrowError = null;
+ throw error;
+ }
+}
+
+function hasCaughtError() {
+ return hasError;
+}
+
+function clearCaughtError() {
+ if (hasError) {
+ var error = caughtError;
+ hasError = false;
+ caughtError = null;
+ return error;
+ } else {
+ invariant(false, 'clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.');
+ }
+}
+
+/**
+ * Injectable ordering of event plugins.
+ */
+var eventPluginOrder = null;
+
+/**
+ * Injectable mapping from names to event plugin modules.
+ */
+var namesToPlugins = {};
+
+/**
+ * Recomputes the plugin list using the injected plugins and plugin ordering.
+ *
+ * @private
+ */
+function recomputePluginOrdering() {
+ if (!eventPluginOrder) {
+ // Wait until an `eventPluginOrder` is injected.
+ return;
+ }
+ for (var pluginName in namesToPlugins) {
+ var pluginModule = namesToPlugins[pluginName];
+ var pluginIndex = eventPluginOrder.indexOf(pluginName);
+ !(pluginIndex > -1) ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : void 0;
+ if (plugins[pluginIndex]) {
+ continue;
+ }
+ !pluginModule.extractEvents ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : void 0;
+ plugins[pluginIndex] = pluginModule;
+ var publishedEvents = pluginModule.eventTypes;
+ for (var eventName in publishedEvents) {
+ !publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : void 0;
+ }
+ }
+}
+
+/**
+ * Publishes an event so that it can be dispatched by the supplied plugin.
+ *
+ * @param {object} dispatchConfig Dispatch configuration for the event.
+ * @param {object} PluginModule Plugin publishing the event.
+ * @return {boolean} True if the event was successfully published.
+ * @private
+ */
+function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
+ !!eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0;
+ eventNameDispatchConfigs[eventName] = dispatchConfig;
+
+ var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
+ if (phasedRegistrationNames) {
+ for (var phaseName in phasedRegistrationNames) {
+ if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
+ var phasedRegistrationName = phasedRegistrationNames[phaseName];
+ publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
+ }
+ }
+ return true;
+ } else if (dispatchConfig.registrationName) {
+ publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
+ return true;
+ }
+ return false;
+}
+
+/**
+ * Publishes a registration name that is used to identify dispatched events.
+ *
+ * @param {string} registrationName Registration name to add.
+ * @param {object} PluginModule Plugin publishing the event.
+ * @private
+ */
+function publishRegistrationName(registrationName, pluginModule, eventName) {
+ !!registrationNameModules[registrationName] ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : void 0;
+ registrationNameModules[registrationName] = pluginModule;
+ registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
+
+ {
+ var lowerCasedName = registrationName.toLowerCase();
+ possibleRegistrationNames[lowerCasedName] = registrationName;
+
+ if (registrationName === 'onDoubleClick') {
+ possibleRegistrationNames.ondblclick = registrationName;
+ }
+ }
+}
+
+/**
+ * Registers plugins so that they can extract and dispatch events.
+ *
+ * @see {EventPluginHub}
+ */
+
+/**
+ * Ordered list of injected plugins.
+ */
+var plugins = [];
+
+/**
+ * Mapping from event name to dispatch config
+ */
+var eventNameDispatchConfigs = {};
+
+/**
+ * Mapping from registration name to plugin module
+ */
+var registrationNameModules = {};
+
+/**
+ * Mapping from registration name to event name
+ */
+var registrationNameDependencies = {};
+
+/**
+ * Mapping from lowercase registration names to the properly cased version,
+ * used to warn in the case of missing event handlers. Available
+ * only in true.
+ * @type {Object}
+ */
+var possibleRegistrationNames = {};
+// Trust the developer to only use possibleRegistrationNames in true
+
+/**
+ * Injects an ordering of plugins (by plugin name). This allows the ordering
+ * to be decoupled from injection of the actual plugins so that ordering is
+ * always deterministic regardless of packaging, on-the-fly injection, etc.
+ *
+ * @param {array} InjectedEventPluginOrder
+ * @internal
+ * @see {EventPluginHub.injection.injectEventPluginOrder}
+ */
+function injectEventPluginOrder(injectedEventPluginOrder) {
+ !!eventPluginOrder ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : void 0;
+ // Clone the ordering so it cannot be dynamically mutated.
+ eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
+ recomputePluginOrdering();
+}
+
+/**
+ * Injects plugins to be used by `EventPluginHub`. The plugin names must be
+ * in the ordering injected by `injectEventPluginOrder`.
+ *
+ * Plugins can be injected as part of page initialization or on-the-fly.
+ *
+ * @param {object} injectedNamesToPlugins Map from names to plugin modules.
+ * @internal
+ * @see {EventPluginHub.injection.injectEventPluginsByName}
+ */
+function injectEventPluginsByName(injectedNamesToPlugins) {
+ var isOrderingDirty = false;
+ for (var pluginName in injectedNamesToPlugins) {
+ if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
+ continue;
+ }
+ var pluginModule = injectedNamesToPlugins[pluginName];
+ if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) {
+ !!namesToPlugins[pluginName] ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : void 0;
+ namesToPlugins[pluginName] = pluginModule;
+ isOrderingDirty = true;
+ }
+ }
+ if (isOrderingDirty) {
+ recomputePluginOrdering();
+ }
+}
+
+/**
+ * Similar to invariant but only logs a warning if the condition is not met.
+ * This can be used to log issues in development environments in critical
+ * paths. Removing the logging code for production environments will keep the
+ * same logic and follow the same code paths.
+ */
+
+var warningWithoutStack = function () {};
+
+{
+ warningWithoutStack = function (condition, format) {
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
+ args[_key - 2] = arguments[_key];
+ }
+
+ if (format === undefined) {
+ throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
+ }
+ if (args.length > 8) {
+ // Check before the condition to catch violations early.
+ throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
+ }
+ if (condition) {
+ return;
+ }
+ if (typeof console !== 'undefined') {
+ var argsWithFormat = args.map(function (item) {
+ return '' + item;
+ });
+ argsWithFormat.unshift('Warning: ' + format);
+
+ // We intentionally don't use spread (or .apply) directly because it
+ // breaks IE9: https://github.com/facebook/react/issues/13610
+ Function.prototype.apply.call(console.error, console, argsWithFormat);
+ }
+ 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.
+ var argIndex = 0;
+ var message = 'Warning: ' + format.replace(/%s/g, function () {
+ return args[argIndex++];
+ });
+ throw new Error(message);
+ } catch (x) {}
+ };
+}
+
+var warningWithoutStack$1 = warningWithoutStack;
+
+var getFiberCurrentPropsFromNode = null;
+var getInstanceFromNode = null;
+var getNodeFromInstance = null;
+
+function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) {
+ getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl;
+ getInstanceFromNode = getInstanceFromNodeImpl;
+ getNodeFromInstance = getNodeFromInstanceImpl;
+ {
+ !(getNodeFromInstance && getInstanceFromNode) ? warningWithoutStack$1(false, 'EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
+ }
+}
+
+var validateEventDispatches = void 0;
+{
+ validateEventDispatches = function (event) {
+ var dispatchListeners = event._dispatchListeners;
+ var dispatchInstances = event._dispatchInstances;
+
+ var listenersIsArr = Array.isArray(dispatchListeners);
+ var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
+
+ var instancesIsArr = Array.isArray(dispatchInstances);
+ var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
+
+ !(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ? warningWithoutStack$1(false, 'EventPluginUtils: Invalid `event`.') : void 0;
+ };
+}
+
+/**
+ * Dispatch the event to the listener.
+ * @param {SyntheticEvent} event SyntheticEvent to handle
+ * @param {function} listener Application-level callback
+ * @param {*} inst Internal component instance
+ */
+function executeDispatch(event, listener, inst) {
+ var type = event.type || 'unknown-event';
+ event.currentTarget = getNodeFromInstance(inst);
+ invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event);
+ event.currentTarget = null;
+}
+
+/**
+ * Standard/simple iteration through an event's collected dispatches.
+ */
+function executeDispatchesInOrder(event) {
+ var dispatchListeners = event._dispatchListeners;
+ var dispatchInstances = event._dispatchInstances;
+ {
+ validateEventDispatches(event);
+ }
+ if (Array.isArray(dispatchListeners)) {
+ for (var i = 0; i < dispatchListeners.length; i++) {
+ if (event.isPropagationStopped()) {
+ break;
+ }
+ // Listeners and Instances are two parallel arrays that are always in sync.
+ executeDispatch(event, dispatchListeners[i], dispatchInstances[i]);
+ }
+ } else if (dispatchListeners) {
+ executeDispatch(event, dispatchListeners, dispatchInstances);
+ }
+ event._dispatchListeners = null;
+ event._dispatchInstances = null;
+}
+
+/**
+ * @see executeDispatchesInOrderStopAtTrueImpl
+ */
+
+
+/**
+ * Execution of a "direct" dispatch - there must be at most one dispatch
+ * accumulated on the event or it is considered an error. It doesn't really make
+ * sense for an event with multiple dispatches (bubbled) to keep track of the
+ * return values at each dispatch execution, but it does tend to make sense when
+ * dealing with "direct" dispatches.
+ *
+ * @return {*} The return value of executing the single dispatch.
+ */
+
+
+/**
+ * @param {SyntheticEvent} event
+ * @return {boolean} True iff number of dispatches accumulated is greater than 0.
+ */
+
+/**
+ * Accumulates items that must not be null or undefined into the first one. This
+ * is used to conserve memory by avoiding array allocations, and thus sacrifices
+ * API cleanness. Since `current` can be null before being passed in and not
+ * null after this function, make sure to assign it back to `current`:
+ *
+ * `a = accumulateInto(a, b);`
+ *
+ * This API should be sparingly used. Try `accumulate` for something cleaner.
+ *
+ * @return {*|array<*>} An accumulation of items.
+ */
+
+function accumulateInto(current, next) {
+ !(next != null) ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : void 0;
+
+ if (current == null) {
+ return next;
+ }
+
+ // Both are not empty. Warning: Never call x.concat(y) when you are not
+ // certain that x is an Array (x could be a string with concat method).
+ if (Array.isArray(current)) {
+ if (Array.isArray(next)) {
+ current.push.apply(current, next);
+ return current;
+ }
+ current.push(next);
+ return current;
+ }
+
+ if (Array.isArray(next)) {
+ // A bit too dangerous to mutate `next`.
+ return [current].concat(next);
+ }
+
+ return [current, next];
+}
+
+/**
+ * @param {array} arr an "accumulation" of items which is either an Array or
+ * a single item. Useful when paired with the `accumulate` module. This is a
+ * simple utility that allows us to reason about a collection of items, but
+ * handling the case when there is exactly one item (and we do not need to
+ * allocate an array).
+ * @param {function} cb Callback invoked with each element or a collection.
+ * @param {?} [scope] Scope used as `this` in a callback.
+ */
+function forEachAccumulated(arr, cb, scope) {
+ if (Array.isArray(arr)) {
+ arr.forEach(cb, scope);
+ } else if (arr) {
+ cb.call(scope, arr);
+ }
+}
+
+/**
+ * Internal queue of events that have accumulated their dispatches and are
+ * waiting to have their dispatches executed.
+ */
+var eventQueue = null;
+
+/**
+ * Dispatches an event and releases it back into the pool, unless persistent.
+ *
+ * @param {?object} event Synthetic event to be dispatched.
+ * @private
+ */
+var executeDispatchesAndRelease = function (event) {
+ if (event) {
+ executeDispatchesInOrder(event);
+
+ if (!event.isPersistent()) {
+ event.constructor.release(event);
+ }
+ }
+};
+var executeDispatchesAndReleaseTopLevel = function (e) {
+ return executeDispatchesAndRelease(e);
+};
+
+function isInteractive(tag) {
+ return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
+}
+
+function shouldPreventMouseEvent(name, type, props) {
+ switch (name) {
+ case 'onClick':
+ case 'onClickCapture':
+ case 'onDoubleClick':
+ case 'onDoubleClickCapture':
+ case 'onMouseDown':
+ case 'onMouseDownCapture':
+ case 'onMouseMove':
+ case 'onMouseMoveCapture':
+ case 'onMouseUp':
+ case 'onMouseUpCapture':
+ return !!(props.disabled && isInteractive(type));
+ default:
+ return false;
+ }
+}
+
+/**
+ * This is a unified interface for event plugins to be installed and configured.
+ *
+ * Event plugins can implement the following properties:
+ *
+ * `extractEvents` {function(string, DOMEventTarget, string, object): *}
+ * Required. When a top-level event is fired, this method is expected to
+ * extract synthetic events that will in turn be queued and dispatched.
+ *
+ * `eventTypes` {object}
+ * Optional, plugins that fire events must publish a mapping of registration
+ * names that are used to register listeners. Values of this mapping must
+ * be objects that contain `registrationName` or `phasedRegistrationNames`.
+ *
+ * `executeDispatch` {function(object, function, string)}
+ * Optional, allows plugins to override how an event gets dispatched. By
+ * default, the listener is simply invoked.
+ *
+ * Each plugin that is injected into `EventsPluginHub` is immediately operable.
+ *
+ * @public
+ */
+
+/**
+ * Methods for injecting dependencies.
+ */
+var injection = {
+ /**
+ * @param {array} InjectedEventPluginOrder
+ * @public
+ */
+ injectEventPluginOrder: injectEventPluginOrder,
+
+ /**
+ * @param {object} injectedNamesToPlugins Map from names to plugin modules.
+ */
+ injectEventPluginsByName: injectEventPluginsByName
+};
+
+/**
+ * @param {object} inst The instance, which is the source of events.
+ * @param {string} registrationName Name of listener (e.g. `onClick`).
+ * @return {?function} The stored callback.
+ */
+function getListener(inst, registrationName) {
+ var listener = void 0;
+
+ // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
+ // live here; needs to be moved to a better place soon
+ var stateNode = inst.stateNode;
+ if (!stateNode) {
+ // Work in progress (ex: onload events in incremental mode).
+ return null;
+ }
+ var props = getFiberCurrentPropsFromNode(stateNode);
+ if (!props) {
+ // Work in progress.
+ return null;
+ }
+ listener = props[registrationName];
+ if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
+ return null;
+ }
+ !(!listener || typeof listener === 'function') ? invariant(false, 'Expected `%s` listener to be a function, instead got a value of `%s` type.', registrationName, typeof listener) : void 0;
+ return listener;
+}
+
+/**
+ * Allows registered plugins an opportunity to extract events from top-level
+ * native browser events.
+ *
+ * @return {*} An accumulation of synthetic events.
+ * @internal
+ */
+function extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
+ var events = null;
+ for (var i = 0; i < plugins.length; i++) {
+ // Not every plugin in the ordering may be loaded at runtime.
+ var possiblePlugin = plugins[i];
+ if (possiblePlugin) {
+ var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
+ if (extractedEvents) {
+ events = accumulateInto(events, extractedEvents);
+ }
+ }
+ }
+ return events;
+}
+
+function runEventsInBatch(events) {
+ if (events !== null) {
+ eventQueue = accumulateInto(eventQueue, events);
+ }
+
+ // Set `eventQueue` to null before processing it so that we can tell if more
+ // events get enqueued while processing.
+ var processingEventQueue = eventQueue;
+ eventQueue = null;
+
+ if (!processingEventQueue) {
+ return;
+ }
+
+ forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
+ !!eventQueue ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.') : void 0;
+ // This would be a good time to rethrow if any of the event handlers threw.
+ rethrowCaughtError();
+}
+
+function runExtractedEventsInBatch(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
+ var events = extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
+ runEventsInBatch(events);
+}
+
+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 DehydratedSuspenseComponent = 18;
+
+var randomKey = Math.random().toString(36).slice(2);
+var internalInstanceKey = '__reactInternalInstance$' + randomKey;
+var internalEventHandlersKey = '__reactEventHandlers$' + randomKey;
+
+function precacheFiberNode(hostInst, node) {
+ node[internalInstanceKey] = hostInst;
+}
+
+/**
+ * Given a DOM node, return the closest ReactDOMComponent or
+ * ReactDOMTextComponent instance ancestor.
+ */
+function getClosestInstanceFromNode(node) {
+ if (node[internalInstanceKey]) {
+ return node[internalInstanceKey];
+ }
+
+ while (!node[internalInstanceKey]) {
+ if (node.parentNode) {
+ node = node.parentNode;
+ } else {
+ // Top of the tree. This node must not be part of a React tree (or is
+ // unmounted, potentially).
+ return null;
+ }
+ }
+
+ var inst = node[internalInstanceKey];
+ if (inst.tag === HostComponent || inst.tag === HostText) {
+ // In Fiber, this will always be the deepest root.
+ return inst;
+ }
+
+ return null;
+}
+
+/**
+ * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
+ * instance, or null if the node was not rendered by this React.
+ */
+function getInstanceFromNode$1(node) {
+ var inst = node[internalInstanceKey];
+ if (inst) {
+ if (inst.tag === HostComponent || inst.tag === HostText) {
+ return inst;
+ } else {
+ return null;
+ }
+ }
+ return null;
+}
+
+/**
+ * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
+ * DOM node.
+ */
+function getNodeFromInstance$1(inst) {
+ if (inst.tag === HostComponent || inst.tag === HostText) {
+ // In Fiber this, is just the state node right now. We assume it will be
+ // a host component or host text.
+ return inst.stateNode;
+ }
+
+ // Without this first invariant, passing a non-DOM-component triggers the next
+ // invariant for a missing parent, which is super confusing.
+ invariant(false, 'getNodeFromInstance: Invalid argument.');
+}
+
+function getFiberCurrentPropsFromNode$1(node) {
+ return node[internalEventHandlersKey] || null;
+}
+
+function updateFiberProps(node, props) {
+ node[internalEventHandlersKey] = props;
+}
+
+function getParent(inst) {
+ do {
+ inst = inst.return;
+ // TODO: If this is a HostRoot we might want to bail out.
+ // That is depending on if we want nested subtrees (layers) to bubble
+ // events to their parent. We could also go through parentNode on the
+ // host node but that wouldn't work for React Native and doesn't let us
+ // do the portal feature.
+ } while (inst && inst.tag !== HostComponent);
+ if (inst) {
+ return inst;
+ }
+ return null;
+}
+
+/**
+ * Return the lowest common ancestor of A and B, or null if they are in
+ * different trees.
+ */
+function getLowestCommonAncestor(instA, instB) {
+ var depthA = 0;
+ for (var tempA = instA; tempA; tempA = getParent(tempA)) {
+ depthA++;
+ }
+ var depthB = 0;
+ for (var tempB = instB; tempB; tempB = getParent(tempB)) {
+ depthB++;
+ }
+
+ // If A is deeper, crawl up.
+ while (depthA - depthB > 0) {
+ instA = getParent(instA);
+ depthA--;
+ }
+
+ // If B is deeper, crawl up.
+ while (depthB - depthA > 0) {
+ instB = getParent(instB);
+ depthB--;
+ }
+
+ // Walk in lockstep until we find a match.
+ var depth = depthA;
+ while (depth--) {
+ if (instA === instB || instA === instB.alternate) {
+ return instA;
+ }
+ instA = getParent(instA);
+ instB = getParent(instB);
+ }
+ return null;
+}
+
+/**
+ * Return if A is an ancestor of B.
+ */
+
+
+/**
+ * Return the parent instance of the passed-in instance.
+ */
+
+
+/**
+ * Simulates the traversal of a two-phase, capture/bubble event dispatch.
+ */
+function traverseTwoPhase(inst, fn, arg) {
+ var path = [];
+ while (inst) {
+ path.push(inst);
+ inst = getParent(inst);
+ }
+ var i = void 0;
+ for (i = path.length; i-- > 0;) {
+ fn(path[i], 'captured', arg);
+ }
+ for (i = 0; i < path.length; i++) {
+ fn(path[i], 'bubbled', arg);
+ }
+}
+
+/**
+ * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
+ * should would receive a `mouseEnter` or `mouseLeave` event.
+ *
+ * Does not invoke the callback on the nearest common ancestor because nothing
+ * "entered" or "left" that element.
+ */
+function traverseEnterLeave(from, to, fn, argFrom, argTo) {
+ var common = from && to ? getLowestCommonAncestor(from, to) : null;
+ var pathFrom = [];
+ while (true) {
+ if (!from) {
+ break;
+ }
+ if (from === common) {
+ break;
+ }
+ var alternate = from.alternate;
+ if (alternate !== null && alternate === common) {
+ break;
+ }
+ pathFrom.push(from);
+ from = getParent(from);
+ }
+ var pathTo = [];
+ while (true) {
+ if (!to) {
+ break;
+ }
+ if (to === common) {
+ break;
+ }
+ var _alternate = to.alternate;
+ if (_alternate !== null && _alternate === common) {
+ break;
+ }
+ pathTo.push(to);
+ to = getParent(to);
+ }
+ for (var i = 0; i < pathFrom.length; i++) {
+ fn(pathFrom[i], 'bubbled', argFrom);
+ }
+ for (var _i = pathTo.length; _i-- > 0;) {
+ fn(pathTo[_i], 'captured', argTo);
+ }
+}
+
+/**
+ * Some event types have a notion of different registration names for different
+ * "phases" of propagation. This finds listeners by a given phase.
+ */
+function listenerAtPhase(inst, event, propagationPhase) {
+ var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
+ return getListener(inst, registrationName);
+}
+
+/**
+ * A small set of propagation patterns, each of which will accept a small amount
+ * of information, and generate a set of "dispatch ready event objects" - which
+ * are sets of events that have already been annotated with a set of dispatched
+ * listener functions/ids. The API is designed this way to discourage these
+ * propagation strategies from actually executing the dispatches, since we
+ * always want to collect the entire set of dispatches before executing even a
+ * single one.
+ */
+
+/**
+ * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
+ * here, allows us to not have to bind or create functions for each event.
+ * Mutating the event's members allows us to not have to create a wrapping
+ * "dispatch" object that pairs the event with the listener.
+ */
+function accumulateDirectionalDispatches(inst, phase, event) {
+ {
+ !inst ? warningWithoutStack$1(false, 'Dispatching inst must not be null') : void 0;
+ }
+ var listener = listenerAtPhase(inst, event, phase);
+ if (listener) {
+ event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
+ event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
+ }
+}
+
+/**
+ * Collect dispatches (must be entirely collected before dispatching - see unit
+ * tests). Lazily allocate the array to conserve memory. We must loop through
+ * each event and perform the traversal for each one. We cannot perform a
+ * single traversal for the entire collection of events because each event may
+ * have a different target.
+ */
+function accumulateTwoPhaseDispatchesSingle(event) {
+ if (event && event.dispatchConfig.phasedRegistrationNames) {
+ traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
+ }
+}
+
+/**
+ * Accumulates without regard to direction, does not look for phased
+ * registration names. Same as `accumulateDirectDispatchesSingle` but without
+ * requiring that the `dispatchMarker` be the same as the dispatched ID.
+ */
+function accumulateDispatches(inst, ignoredDirection, event) {
+ if (inst && event && event.dispatchConfig.registrationName) {
+ var registrationName = event.dispatchConfig.registrationName;
+ var listener = getListener(inst, registrationName);
+ if (listener) {
+ event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
+ event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
+ }
+ }
+}
+
+/**
+ * Accumulates dispatches on an `SyntheticEvent`, but only for the
+ * `dispatchMarker`.
+ * @param {SyntheticEvent} event
+ */
+function accumulateDirectDispatchesSingle(event) {
+ if (event && event.dispatchConfig.registrationName) {
+ accumulateDispatches(event._targetInst, null, event);
+ }
+}
+
+function accumulateTwoPhaseDispatches(events) {
+ forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
+}
+
+
+
+function accumulateEnterLeaveDispatches(leave, enter, from, to) {
+ traverseEnterLeave(from, to, accumulateDispatches, leave, enter);
+}
+
+function accumulateDirectDispatches(events) {
+ forEachAccumulated(events, accumulateDirectDispatchesSingle);
+}
+
+var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
+
+// Do not uses the below two methods directly!
+// Instead use constants exported from DOMTopLevelEventTypes in ReactDOM.
+// (It is the only module that is allowed to access these methods.)
+
+function unsafeCastStringToDOMTopLevelType(topLevelType) {
+ return topLevelType;
+}
+
+function unsafeCastDOMTopLevelTypeToString(topLevelType) {
+ return topLevelType;
+}
+
+/**
+ * Generate a mapping of standard vendor prefixes using the defined style property and event name.
+ *
+ * @param {string} styleProp
+ * @param {string} eventName
+ * @returns {object}
+ */
+function makePrefixMap(styleProp, eventName) {
+ var prefixes = {};
+
+ prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
+ prefixes['Webkit' + styleProp] = 'webkit' + eventName;
+ prefixes['Moz' + styleProp] = 'moz' + eventName;
+
+ return prefixes;
+}
+
+/**
+ * A list of event names to a configurable list of vendor prefixes.
+ */
+var vendorPrefixes = {
+ animationend: makePrefixMap('Animation', 'AnimationEnd'),
+ animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
+ animationstart: makePrefixMap('Animation', 'AnimationStart'),
+ transitionend: makePrefixMap('Transition', 'TransitionEnd')
+};
+
+/**
+ * Event names that have already been detected and prefixed (if applicable).
+ */
+var prefixedEventNames = {};
+
+/**
+ * Element to check for prefixes on.
+ */
+var style = {};
+
+/**
+ * Bootstrap if a DOM exists.
+ */
+if (canUseDOM) {
+ style = document.createElement('div').style;
+
+ // On some platforms, in particular some releases of Android 4.x,
+ // the un-prefixed "animation" and "transition" properties are defined on the
+ // style object but the events that fire will still be prefixed, so we need
+ // to check if the un-prefixed events are usable, and if not remove them from the map.
+ if (!('AnimationEvent' in window)) {
+ delete vendorPrefixes.animationend.animation;
+ delete vendorPrefixes.animationiteration.animation;
+ delete vendorPrefixes.animationstart.animation;
+ }
+
+ // Same as above
+ if (!('TransitionEvent' in window)) {
+ delete vendorPrefixes.transitionend.transition;
+ }
+}
+
+/**
+ * Attempts to determine the correct vendor prefixed event name.
+ *
+ * @param {string} eventName
+ * @returns {string}
+ */
+function getVendorPrefixedEventName(eventName) {
+ if (prefixedEventNames[eventName]) {
+ return prefixedEventNames[eventName];
+ } else if (!vendorPrefixes[eventName]) {
+ return eventName;
+ }
+
+ var prefixMap = vendorPrefixes[eventName];
+
+ for (var styleProp in prefixMap) {
+ if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
+ return prefixedEventNames[eventName] = prefixMap[styleProp];
+ }
+ }
+
+ return eventName;
+}
+
+/**
+ * To identify top level events in ReactDOM, we use constants defined by this
+ * module. This is the only module that uses the unsafe* methods to express
+ * that the constants actually correspond to the browser event names. This lets
+ * us save some bundle size by avoiding a top level type -> event name map.
+ * The rest of ReactDOM code should import top level types from this file.
+ */
+var TOP_ABORT = unsafeCastStringToDOMTopLevelType('abort');
+var TOP_ANIMATION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationend'));
+var TOP_ANIMATION_ITERATION = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationiteration'));
+var TOP_ANIMATION_START = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationstart'));
+var TOP_BLUR = unsafeCastStringToDOMTopLevelType('blur');
+var TOP_CAN_PLAY = unsafeCastStringToDOMTopLevelType('canplay');
+var TOP_CAN_PLAY_THROUGH = unsafeCastStringToDOMTopLevelType('canplaythrough');
+var TOP_CANCEL = unsafeCastStringToDOMTopLevelType('cancel');
+var TOP_CHANGE = unsafeCastStringToDOMTopLevelType('change');
+var TOP_CLICK = unsafeCastStringToDOMTopLevelType('click');
+var TOP_CLOSE = unsafeCastStringToDOMTopLevelType('close');
+var TOP_COMPOSITION_END = unsafeCastStringToDOMTopLevelType('compositionend');
+var TOP_COMPOSITION_START = unsafeCastStringToDOMTopLevelType('compositionstart');
+var TOP_COMPOSITION_UPDATE = unsafeCastStringToDOMTopLevelType('compositionupdate');
+var TOP_CONTEXT_MENU = unsafeCastStringToDOMTopLevelType('contextmenu');
+var TOP_COPY = unsafeCastStringToDOMTopLevelType('copy');
+var TOP_CUT = unsafeCastStringToDOMTopLevelType('cut');
+var TOP_DOUBLE_CLICK = unsafeCastStringToDOMTopLevelType('dblclick');
+var TOP_AUX_CLICK = unsafeCastStringToDOMTopLevelType('auxclick');
+var TOP_DRAG = unsafeCastStringToDOMTopLevelType('drag');
+var TOP_DRAG_END = unsafeCastStringToDOMTopLevelType('dragend');
+var TOP_DRAG_ENTER = unsafeCastStringToDOMTopLevelType('dragenter');
+var TOP_DRAG_EXIT = unsafeCastStringToDOMTopLevelType('dragexit');
+var TOP_DRAG_LEAVE = unsafeCastStringToDOMTopLevelType('dragleave');
+var TOP_DRAG_OVER = unsafeCastStringToDOMTopLevelType('dragover');
+var TOP_DRAG_START = unsafeCastStringToDOMTopLevelType('dragstart');
+var TOP_DROP = unsafeCastStringToDOMTopLevelType('drop');
+var TOP_DURATION_CHANGE = unsafeCastStringToDOMTopLevelType('durationchange');
+var TOP_EMPTIED = unsafeCastStringToDOMTopLevelType('emptied');
+var TOP_ENCRYPTED = unsafeCastStringToDOMTopLevelType('encrypted');
+var TOP_ENDED = unsafeCastStringToDOMTopLevelType('ended');
+var TOP_ERROR = unsafeCastStringToDOMTopLevelType('error');
+var TOP_FOCUS = unsafeCastStringToDOMTopLevelType('focus');
+var TOP_GOT_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('gotpointercapture');
+var TOP_INPUT = unsafeCastStringToDOMTopLevelType('input');
+var TOP_INVALID = unsafeCastStringToDOMTopLevelType('invalid');
+var TOP_KEY_DOWN = unsafeCastStringToDOMTopLevelType('keydown');
+var TOP_KEY_PRESS = unsafeCastStringToDOMTopLevelType('keypress');
+var TOP_KEY_UP = unsafeCastStringToDOMTopLevelType('keyup');
+var TOP_LOAD = unsafeCastStringToDOMTopLevelType('load');
+var TOP_LOAD_START = unsafeCastStringToDOMTopLevelType('loadstart');
+var TOP_LOADED_DATA = unsafeCastStringToDOMTopLevelType('loadeddata');
+var TOP_LOADED_METADATA = unsafeCastStringToDOMTopLevelType('loadedmetadata');
+var TOP_LOST_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('lostpointercapture');
+var TOP_MOUSE_DOWN = unsafeCastStringToDOMTopLevelType('mousedown');
+var TOP_MOUSE_MOVE = unsafeCastStringToDOMTopLevelType('mousemove');
+var TOP_MOUSE_OUT = unsafeCastStringToDOMTopLevelType('mouseout');
+var TOP_MOUSE_OVER = unsafeCastStringToDOMTopLevelType('mouseover');
+var TOP_MOUSE_UP = unsafeCastStringToDOMTopLevelType('mouseup');
+var TOP_PASTE = unsafeCastStringToDOMTopLevelType('paste');
+var TOP_PAUSE = unsafeCastStringToDOMTopLevelType('pause');
+var TOP_PLAY = unsafeCastStringToDOMTopLevelType('play');
+var TOP_PLAYING = unsafeCastStringToDOMTopLevelType('playing');
+var TOP_POINTER_CANCEL = unsafeCastStringToDOMTopLevelType('pointercancel');
+var TOP_POINTER_DOWN = unsafeCastStringToDOMTopLevelType('pointerdown');
+
+
+var TOP_POINTER_MOVE = unsafeCastStringToDOMTopLevelType('pointermove');
+var TOP_POINTER_OUT = unsafeCastStringToDOMTopLevelType('pointerout');
+var TOP_POINTER_OVER = unsafeCastStringToDOMTopLevelType('pointerover');
+var TOP_POINTER_UP = unsafeCastStringToDOMTopLevelType('pointerup');
+var TOP_PROGRESS = unsafeCastStringToDOMTopLevelType('progress');
+var TOP_RATE_CHANGE = unsafeCastStringToDOMTopLevelType('ratechange');
+var TOP_RESET = unsafeCastStringToDOMTopLevelType('reset');
+var TOP_SCROLL = unsafeCastStringToDOMTopLevelType('scroll');
+var TOP_SEEKED = unsafeCastStringToDOMTopLevelType('seeked');
+var TOP_SEEKING = unsafeCastStringToDOMTopLevelType('seeking');
+var TOP_SELECTION_CHANGE = unsafeCastStringToDOMTopLevelType('selectionchange');
+var TOP_STALLED = unsafeCastStringToDOMTopLevelType('stalled');
+var TOP_SUBMIT = unsafeCastStringToDOMTopLevelType('submit');
+var TOP_SUSPEND = unsafeCastStringToDOMTopLevelType('suspend');
+var TOP_TEXT_INPUT = unsafeCastStringToDOMTopLevelType('textInput');
+var TOP_TIME_UPDATE = unsafeCastStringToDOMTopLevelType('timeupdate');
+var TOP_TOGGLE = unsafeCastStringToDOMTopLevelType('toggle');
+var TOP_TOUCH_CANCEL = unsafeCastStringToDOMTopLevelType('touchcancel');
+var TOP_TOUCH_END = unsafeCastStringToDOMTopLevelType('touchend');
+var TOP_TOUCH_MOVE = unsafeCastStringToDOMTopLevelType('touchmove');
+var TOP_TOUCH_START = unsafeCastStringToDOMTopLevelType('touchstart');
+var TOP_TRANSITION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('transitionend'));
+var TOP_VOLUME_CHANGE = unsafeCastStringToDOMTopLevelType('volumechange');
+var TOP_WAITING = unsafeCastStringToDOMTopLevelType('waiting');
+var TOP_WHEEL = unsafeCastStringToDOMTopLevelType('wheel');
+
+// List of events that need to be individually attached to media elements.
+// Note that events in this list will *not* be listened to at the top level
+// unless they're explicitly whitelisted in `ReactBrowserEventEmitter.listenTo`.
+var mediaEventTypes = [TOP_ABORT, TOP_CAN_PLAY, TOP_CAN_PLAY_THROUGH, TOP_DURATION_CHANGE, TOP_EMPTIED, TOP_ENCRYPTED, TOP_ENDED, TOP_ERROR, TOP_LOADED_DATA, TOP_LOADED_METADATA, TOP_LOAD_START, TOP_PAUSE, TOP_PLAY, TOP_PLAYING, TOP_PROGRESS, TOP_RATE_CHANGE, TOP_SEEKED, TOP_SEEKING, TOP_STALLED, TOP_SUSPEND, TOP_TIME_UPDATE, TOP_VOLUME_CHANGE, TOP_WAITING];
+
+function getRawEventName(topLevelType) {
+ return unsafeCastDOMTopLevelTypeToString(topLevelType);
+}
+
+/**
+ * These variables store information about text content of a target node,
+ * allowing comparison of content before and after a given event.
+ *
+ * Identify the node where selection currently begins, then observe
+ * both its text content and its current position in the DOM. Since the
+ * browser may natively replace the target node during composition, we can
+ * use its position to find its replacement.
+ *
+ *
+ */
+
+var root = null;
+var startText = null;
+var fallbackText = null;
+
+function initialize(nativeEventTarget) {
+ root = nativeEventTarget;
+ startText = getText();
+ return true;
+}
+
+function reset() {
+ root = null;
+ startText = null;
+ fallbackText = null;
+}
+
+function getData() {
+ if (fallbackText) {
+ return fallbackText;
+ }
+
+ var start = void 0;
+ var startValue = startText;
+ var startLength = startValue.length;
+ var end = void 0;
+ var endValue = getText();
+ var endLength = endValue.length;
+
+ for (start = 0; start < startLength; start++) {
+ if (startValue[start] !== endValue[start]) {
+ break;
+ }
+ }
+
+ var minEnd = startLength - start;
+ for (end = 1; end <= minEnd; end++) {
+ if (startValue[startLength - end] !== endValue[endLength - end]) {
+ break;
+ }
+ }
+
+ var sliceTail = end > 1 ? 1 - end : undefined;
+ fallbackText = endValue.slice(start, sliceTail);
+ return fallbackText;
+}
+
+function getText() {
+ if ('value' in root) {
+ return root.value;
+ }
+ return root.textContent;
+}
+
+/* eslint valid-typeof: 0 */
+
+var EVENT_POOL_SIZE = 10;
+
+/**
+ * @interface Event
+ * @see http://www.w3.org/TR/DOM-Level-3-Events/
+ */
+var EventInterface = {
+ type: null,
+ target: null,
+ // currentTarget is set when dispatching; no use in copying it here
+ currentTarget: function () {
+ return null;
+ },
+ eventPhase: null,
+ bubbles: null,
+ cancelable: null,
+ timeStamp: function (event) {
+ return event.timeStamp || Date.now();
+ },
+ defaultPrevented: null,
+ isTrusted: null
+};
+
+function functionThatReturnsTrue() {
+ return true;
+}
+
+function functionThatReturnsFalse() {
+ return false;
+}
+
+/**
+ * Synthetic events are dispatched by event plugins, typically in response to a
+ * top-level event delegation handler.
+ *
+ * These systems should generally use pooling to reduce the frequency of garbage
+ * collection. The system should check `isPersistent` to determine whether the
+ * event should be released into the pool after being dispatched. Users that
+ * need a persisted event should invoke `persist`.
+ *
+ * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
+ * normalizing browser quirks. Subclasses do not necessarily have to implement a
+ * DOM interface; custom application-specific events can also subclass this.
+ *
+ * @param {object} dispatchConfig Configuration used to dispatch this event.
+ * @param {*} targetInst Marker identifying the event target.
+ * @param {object} nativeEvent Native browser event.
+ * @param {DOMEventTarget} nativeEventTarget Target node.
+ */
+function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) {
+ {
+ // these have a getter/setter for warnings
+ delete this.nativeEvent;
+ delete this.preventDefault;
+ delete this.stopPropagation;
+ delete this.isDefaultPrevented;
+ delete this.isPropagationStopped;
+ }
+
+ this.dispatchConfig = dispatchConfig;
+ this._targetInst = targetInst;
+ this.nativeEvent = nativeEvent;
+
+ var Interface = this.constructor.Interface;
+ for (var propName in Interface) {
+ if (!Interface.hasOwnProperty(propName)) {
+ continue;
+ }
+ {
+ delete this[propName]; // this has a getter/setter for warnings
+ }
+ var normalize = Interface[propName];
+ if (normalize) {
+ this[propName] = normalize(nativeEvent);
+ } else {
+ if (propName === 'target') {
+ this.target = nativeEventTarget;
+ } else {
+ this[propName] = nativeEvent[propName];
+ }
+ }
+ }
+
+ var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
+ if (defaultPrevented) {
+ this.isDefaultPrevented = functionThatReturnsTrue;
+ } else {
+ this.isDefaultPrevented = functionThatReturnsFalse;
+ }
+ this.isPropagationStopped = functionThatReturnsFalse;
+ return this;
+}
+
+_assign(SyntheticEvent.prototype, {
+ preventDefault: function () {
+ this.defaultPrevented = true;
+ var event = this.nativeEvent;
+ if (!event) {
+ return;
+ }
+
+ if (event.preventDefault) {
+ event.preventDefault();
+ } else if (typeof event.returnValue !== 'unknown') {
+ event.returnValue = false;
+ }
+ this.isDefaultPrevented = functionThatReturnsTrue;
+ },
+
+ stopPropagation: function () {
+ var event = this.nativeEvent;
+ if (!event) {
+ return;
+ }
+
+ if (event.stopPropagation) {
+ event.stopPropagation();
+ } else if (typeof event.cancelBubble !== 'unknown') {
+ // The ChangeEventPlugin registers a "propertychange" event for
+ // IE. This event does not support bubbling or cancelling, and
+ // any references to cancelBubble throw "Member not found". A
+ // typeof check of "unknown" circumvents this issue (and is also
+ // IE specific).
+ event.cancelBubble = true;
+ }
+
+ this.isPropagationStopped = functionThatReturnsTrue;
+ },
+
+ /**
+ * We release all dispatched `SyntheticEvent`s after each event loop, adding
+ * them back into the pool. This allows a way to hold onto a reference that
+ * won't be added back into the pool.
+ */
+ persist: function () {
+ this.isPersistent = functionThatReturnsTrue;
+ },
+
+ /**
+ * Checks if this event should be released back into the pool.
+ *
+ * @return {boolean} True if this should not be released, false otherwise.
+ */
+ isPersistent: functionThatReturnsFalse,
+
+ /**
+ * `PooledClass` looks for `destructor` on each instance it releases.
+ */
+ destructor: function () {
+ var Interface = this.constructor.Interface;
+ for (var propName in Interface) {
+ {
+ Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
+ }
+ }
+ this.dispatchConfig = null;
+ this._targetInst = null;
+ this.nativeEvent = null;
+ this.isDefaultPrevented = functionThatReturnsFalse;
+ this.isPropagationStopped = functionThatReturnsFalse;
+ this._dispatchListeners = null;
+ this._dispatchInstances = null;
+ {
+ Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
+ Object.defineProperty(this, 'isDefaultPrevented', getPooledWarningPropertyDefinition('isDefaultPrevented', functionThatReturnsFalse));
+ Object.defineProperty(this, 'isPropagationStopped', getPooledWarningPropertyDefinition('isPropagationStopped', functionThatReturnsFalse));
+ Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', function () {}));
+ Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', function () {}));
+ }
+ }
+});
+
+SyntheticEvent.Interface = EventInterface;
+
+/**
+ * Helper to reduce boilerplate when creating subclasses.
+ */
+SyntheticEvent.extend = function (Interface) {
+ var Super = this;
+
+ var E = function () {};
+ E.prototype = Super.prototype;
+ var prototype = new E();
+
+ function Class() {
+ return Super.apply(this, arguments);
+ }
+ _assign(prototype, Class.prototype);
+ Class.prototype = prototype;
+ Class.prototype.constructor = Class;
+
+ Class.Interface = _assign({}, Super.Interface, Interface);
+ Class.extend = Super.extend;
+ addEventPoolingTo(Class);
+
+ return Class;
+};
+
+addEventPoolingTo(SyntheticEvent);
+
+/**
+ * Helper to nullify syntheticEvent instance properties when destructing
+ *
+ * @param {String} propName
+ * @param {?object} getVal
+ * @return {object} defineProperty object
+ */
+function getPooledWarningPropertyDefinition(propName, getVal) {
+ var isFunction = typeof getVal === 'function';
+ return {
+ configurable: true,
+ set: set,
+ get: get
+ };
+
+ function set(val) {
+ var action = isFunction ? 'setting the method' : 'setting the property';
+ warn(action, 'This is effectively a no-op');
+ return val;
+ }
+
+ function get() {
+ var action = isFunction ? 'accessing the method' : 'accessing the property';
+ var result = isFunction ? 'This is a no-op function' : 'This is set to null';
+ warn(action, result);
+ return getVal;
+ }
+
+ function warn(action, result) {
+ var warningCondition = false;
+ !warningCondition ? warningWithoutStack$1(false, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
+ }
+}
+
+function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
+ var EventConstructor = this;
+ if (EventConstructor.eventPool.length) {
+ var instance = EventConstructor.eventPool.pop();
+ EventConstructor.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst);
+ return instance;
+ }
+ return new EventConstructor(dispatchConfig, targetInst, nativeEvent, nativeInst);
+}
+
+function releasePooledEvent(event) {
+ var EventConstructor = this;
+ !(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0;
+ event.destructor();
+ if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) {
+ EventConstructor.eventPool.push(event);
+ }
+}
+
+function addEventPoolingTo(EventConstructor) {
+ EventConstructor.eventPool = [];
+ EventConstructor.getPooled = getPooledEvent;
+ EventConstructor.release = releasePooledEvent;
+}
+
+/**
+ * @interface Event
+ * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
+ */
+var SyntheticCompositionEvent = SyntheticEvent.extend({
+ data: null
+});
+
+/**
+ * @interface Event
+ * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
+ * /#events-inputevents
+ */
+var SyntheticInputEvent = SyntheticEvent.extend({
+ data: null
+});
+
+var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
+var START_KEYCODE = 229;
+
+var canUseCompositionEvent = canUseDOM && 'CompositionEvent' in window;
+
+var documentMode = null;
+if (canUseDOM && 'documentMode' in document) {
+ documentMode = document.documentMode;
+}
+
+// Webkit offers a very useful `textInput` event that can be used to
+// directly represent `beforeInput`. The IE `textinput` event is not as
+// useful, so we don't use it.
+var canUseTextInputEvent = canUseDOM && 'TextEvent' in window && !documentMode;
+
+// In IE9+, we have access to composition events, but the data supplied
+// by the native compositionend event may be incorrect. Japanese ideographic
+// spaces, for instance (\u3000) are not recorded correctly.
+var useFallbackCompositionData = canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
+
+var SPACEBAR_CODE = 32;
+var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
+
+// Events and their corresponding property names.
+var eventTypes = {
+ beforeInput: {
+ phasedRegistrationNames: {
+ bubbled: 'onBeforeInput',
+ captured: 'onBeforeInputCapture'
+ },
+ dependencies: [TOP_COMPOSITION_END, TOP_KEY_PRESS, TOP_TEXT_INPUT, TOP_PASTE]
+ },
+ compositionEnd: {
+ phasedRegistrationNames: {
+ bubbled: 'onCompositionEnd',
+ captured: 'onCompositionEndCapture'
+ },
+ dependencies: [TOP_BLUR, TOP_COMPOSITION_END, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
+ },
+ compositionStart: {
+ phasedRegistrationNames: {
+ bubbled: 'onCompositionStart',
+ captured: 'onCompositionStartCapture'
+ },
+ dependencies: [TOP_BLUR, TOP_COMPOSITION_START, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
+ },
+ compositionUpdate: {
+ phasedRegistrationNames: {
+ bubbled: 'onCompositionUpdate',
+ captured: 'onCompositionUpdateCapture'
+ },
+ dependencies: [TOP_BLUR, TOP_COMPOSITION_UPDATE, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
+ }
+};
+
+// Track whether we've ever handled a keypress on the space key.
+var hasSpaceKeypress = false;
+
+/**
+ * Return whether a native keypress event is assumed to be a command.
+ * This is required because Firefox fires `keypress` events for key commands
+ * (cut, copy, select-all, etc.) even though no character is inserted.
+ */
+function isKeypressCommand(nativeEvent) {
+ return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
+ // ctrlKey && altKey is equivalent to AltGr, and is not a command.
+ !(nativeEvent.ctrlKey && nativeEvent.altKey);
+}
+
+/**
+ * Translate native top level events into event types.
+ *
+ * @param {string} topLevelType
+ * @return {object}
+ */
+function getCompositionEventType(topLevelType) {
+ switch (topLevelType) {
+ case TOP_COMPOSITION_START:
+ return eventTypes.compositionStart;
+ case TOP_COMPOSITION_END:
+ return eventTypes.compositionEnd;
+ case TOP_COMPOSITION_UPDATE:
+ return eventTypes.compositionUpdate;
+ }
+}
+
+/**
+ * Does our fallback best-guess model think this event signifies that
+ * composition has begun?
+ *
+ * @param {string} topLevelType
+ * @param {object} nativeEvent
+ * @return {boolean}
+ */
+function isFallbackCompositionStart(topLevelType, nativeEvent) {
+ return topLevelType === TOP_KEY_DOWN && nativeEvent.keyCode === START_KEYCODE;
+}
+
+/**
+ * Does our fallback mode think that this event is the end of composition?
+ *
+ * @param {string} topLevelType
+ * @param {object} nativeEvent
+ * @return {boolean}
+ */
+function isFallbackCompositionEnd(topLevelType, nativeEvent) {
+ switch (topLevelType) {
+ case TOP_KEY_UP:
+ // Command keys insert or clear IME input.
+ return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
+ case TOP_KEY_DOWN:
+ // Expect IME keyCode on each keydown. If we get any other
+ // code we must have exited earlier.
+ return nativeEvent.keyCode !== START_KEYCODE;
+ case TOP_KEY_PRESS:
+ case TOP_MOUSE_DOWN:
+ case TOP_BLUR:
+ // Events are not possible without cancelling IME.
+ return true;
+ default:
+ return false;
+ }
+}
+
+/**
+ * Google Input Tools provides composition data via a CustomEvent,
+ * with the `data` property populated in the `detail` object. If this
+ * is available on the event object, use it. If not, this is a plain
+ * composition event and we have nothing special to extract.
+ *
+ * @param {object} nativeEvent
+ * @return {?string}
+ */
+function getDataFromCustomEvent(nativeEvent) {
+ var detail = nativeEvent.detail;
+ if (typeof detail === 'object' && 'data' in detail) {
+ return detail.data;
+ }
+ return null;
+}
+
+/**
+ * Check if a composition event was triggered by Korean IME.
+ * Our fallback mode does not work well with IE's Korean IME,
+ * so just use native composition events when Korean IME is used.
+ * Although CompositionEvent.locale property is deprecated,
+ * it is available in IE, where our fallback mode is enabled.
+ *
+ * @param {object} nativeEvent
+ * @return {boolean}
+ */
+function isUsingKoreanIME(nativeEvent) {
+ return nativeEvent.locale === 'ko';
+}
+
+// Track the current IME composition status, if any.
+var isComposing = false;
+
+/**
+ * @return {?object} A SyntheticCompositionEvent.
+ */
+function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
+ var eventType = void 0;
+ var fallbackData = void 0;
+
+ if (canUseCompositionEvent) {
+ eventType = getCompositionEventType(topLevelType);
+ } else if (!isComposing) {
+ if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
+ eventType = eventTypes.compositionStart;
+ }
+ } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
+ eventType = eventTypes.compositionEnd;
+ }
+
+ if (!eventType) {
+ return null;
+ }
+
+ if (useFallbackCompositionData && !isUsingKoreanIME(nativeEvent)) {
+ // The current composition is stored statically and must not be
+ // overwritten while composition continues.
+ if (!isComposing && eventType === eventTypes.compositionStart) {
+ isComposing = initialize(nativeEventTarget);
+ } else if (eventType === eventTypes.compositionEnd) {
+ if (isComposing) {
+ fallbackData = getData();
+ }
+ }
+ }
+
+ var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget);
+
+ if (fallbackData) {
+ // Inject data generated from fallback path into the synthetic event.
+ // This matches the property of native CompositionEventInterface.
+ event.data = fallbackData;
+ } else {
+ var customData = getDataFromCustomEvent(nativeEvent);
+ if (customData !== null) {
+ event.data = customData;
+ }
+ }
+
+ accumulateTwoPhaseDispatches(event);
+ return event;
+}
+
+/**
+ * @param {TopLevelType} topLevelType Number from `TopLevelType`.
+ * @param {object} nativeEvent Native browser event.
+ * @return {?string} The string corresponding to this `beforeInput` event.
+ */
+function getNativeBeforeInputChars(topLevelType, nativeEvent) {
+ switch (topLevelType) {
+ case TOP_COMPOSITION_END:
+ return getDataFromCustomEvent(nativeEvent);
+ case TOP_KEY_PRESS:
+ /**
+ * If native `textInput` events are available, our goal is to make
+ * use of them. However, there is a special case: the spacebar key.
+ * In Webkit, preventing default on a spacebar `textInput` event
+ * cancels character insertion, but it *also* causes the browser
+ * to fall back to its default spacebar behavior of scrolling the
+ * page.
+ *
+ * Tracking at:
+ * https://code.google.com/p/chromium/issues/detail?id=355103
+ *
+ * To avoid this issue, use the keypress event as if no `textInput`
+ * event is available.
+ */
+ var which = nativeEvent.which;
+ if (which !== SPACEBAR_CODE) {
+ return null;
+ }
+
+ hasSpaceKeypress = true;
+ return SPACEBAR_CHAR;
+
+ case TOP_TEXT_INPUT:
+ // Record the characters to be added to the DOM.
+ var chars = nativeEvent.data;
+
+ // If it's a spacebar character, assume that we have already handled
+ // it at the keypress level and bail immediately. Android Chrome
+ // doesn't give us keycodes, so we need to ignore it.
+ if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
+ return null;
+ }
+
+ return chars;
+
+ default:
+ // For other native event types, do nothing.
+ return null;
+ }
+}
+
+/**
+ * For browsers that do not provide the `textInput` event, extract the
+ * appropriate string to use for SyntheticInputEvent.
+ *
+ * @param {number} topLevelType Number from `TopLevelEventTypes`.
+ * @param {object} nativeEvent Native browser event.
+ * @return {?string} The fallback string for this `beforeInput` event.
+ */
+function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
+ // If we are currently composing (IME) and using a fallback to do so,
+ // try to extract the composed characters from the fallback object.
+ // If composition event is available, we extract a string only at
+ // compositionevent, otherwise extract it at fallback events.
+ if (isComposing) {
+ if (topLevelType === TOP_COMPOSITION_END || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) {
+ var chars = getData();
+ reset();
+ isComposing = false;
+ return chars;
+ }
+ return null;
+ }
+
+ switch (topLevelType) {
+ case TOP_PASTE:
+ // If a paste event occurs after a keypress, throw out the input
+ // chars. Paste events should not lead to BeforeInput events.
+ return null;
+ case TOP_KEY_PRESS:
+ /**
+ * As of v27, Firefox may fire keypress events even when no character
+ * will be inserted. A few possibilities:
+ *
+ * - `which` is `0`. Arrow keys, Esc key, etc.
+ *
+ * - `which` is the pressed key code, but no char is available.
+ * Ex: 'AltGr + d` in Polish. There is no modified character for
+ * this key combination and no character is inserted into the
+ * document, but FF fires the keypress for char code `100` anyway.
+ * No `input` event will occur.
+ *
+ * - `which` is the pressed key code, but a command combination is
+ * being used. Ex: `Cmd+C`. No character is inserted, and no
+ * `input` event will occur.
+ */
+ if (!isKeypressCommand(nativeEvent)) {
+ // IE fires the `keypress` event when a user types an emoji via
+ // Touch keyboard of Windows. In such a case, the `char` property
+ // holds an emoji character like `\uD83D\uDE0A`. Because its length
+ // is 2, the property `which` does not represent an emoji correctly.
+ // In such a case, we directly return the `char` property instead of
+ // using `which`.
+ if (nativeEvent.char && nativeEvent.char.length > 1) {
+ return nativeEvent.char;
+ } else if (nativeEvent.which) {
+ return String.fromCharCode(nativeEvent.which);
+ }
+ }
+ return null;
+ case TOP_COMPOSITION_END:
+ return useFallbackCompositionData && !isUsingKoreanIME(nativeEvent) ? null : nativeEvent.data;
+ default:
+ return null;
+ }
+}
+
+/**
+ * Extract a SyntheticInputEvent for `beforeInput`, based on either native
+ * `textInput` or fallback behavior.
+ *
+ * @return {?object} A SyntheticInputEvent.
+ */
+function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
+ var chars = void 0;
+
+ if (canUseTextInputEvent) {
+ chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
+ } else {
+ chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
+ }
+
+ // If no characters are being inserted, no BeforeInput event should
+ // be fired.
+ if (!chars) {
+ return null;
+ }
+
+ var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget);
+
+ event.data = chars;
+ accumulateTwoPhaseDispatches(event);
+ return event;
+}
+
+/**
+ * Create an `onBeforeInput` event to match
+ * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
+ *
+ * This event plugin is based on the native `textInput` event
+ * available in Chrome, Safari, Opera, and IE. This event fires after
+ * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
+ *
+ * `beforeInput` is spec'd but not implemented in any browsers, and
+ * the `input` event does not provide any useful information about what has
+ * actually been added, contrary to the spec. Thus, `textInput` is the best
+ * available event to identify the characters that have actually been inserted
+ * into the target node.
+ *
+ * This plugin is also responsible for emitting `composition` events, thus
+ * allowing us to share composition fallback code for both `beforeInput` and
+ * `composition` event types.
+ */
+var BeforeInputEventPlugin = {
+ eventTypes: eventTypes,
+
+ extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
+ var composition = extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget);
+
+ var beforeInput = extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget);
+
+ if (composition === null) {
+ return beforeInput;
+ }
+
+ if (beforeInput === null) {
+ return composition;
+ }
+
+ return [composition, beforeInput];
+ }
+};
+
+// Use to restore controlled state after a change event has fired.
+
+var restoreImpl = null;
+var restoreTarget = null;
+var restoreQueue = null;
+
+function restoreStateOfTarget(target) {
+ // We perform this translation at the end of the event loop so that we
+ // always receive the correct fiber here
+ var internalInstance = getInstanceFromNode(target);
+ if (!internalInstance) {
+ // Unmounted
+ return;
+ }
+ !(typeof restoreImpl === 'function') ? invariant(false, 'setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ var props = getFiberCurrentPropsFromNode(internalInstance.stateNode);
+ restoreImpl(internalInstance.stateNode, internalInstance.type, props);
+}
+
+function setRestoreImplementation(impl) {
+ restoreImpl = impl;
+}
+
+function enqueueStateRestore(target) {
+ if (restoreTarget) {
+ if (restoreQueue) {
+ restoreQueue.push(target);
+ } else {
+ restoreQueue = [target];
+ }
+ } else {
+ restoreTarget = target;
+ }
+}
+
+function needsStateRestore() {
+ return restoreTarget !== null || restoreQueue !== null;
+}
+
+function restoreStateIfNeeded() {
+ if (!restoreTarget) {
+ return;
+ }
+ var target = restoreTarget;
+ var queuedTargets = restoreQueue;
+ restoreTarget = null;
+ restoreQueue = null;
+
+ restoreStateOfTarget(target);
+ if (queuedTargets) {
+ for (var i = 0; i < queuedTargets.length; i++) {
+ restoreStateOfTarget(queuedTargets[i]);
+ }
+ }
+}
+
+// Used as a way to call batchedUpdates when we don't have a reference to
+// the renderer. Such as when we're dispatching events or if third party
+// libraries need to call batchedUpdates. Eventually, this API will go away when
+// everything is batched by default. We'll then have a similar API to opt-out of
+// scheduled work and instead do synchronous work.
+
+// Defaults
+var _batchedUpdatesImpl = function (fn, bookkeeping) {
+ return fn(bookkeeping);
+};
+var _interactiveUpdatesImpl = function (fn, a, b) {
+ return fn(a, b);
+};
+var _flushInteractiveUpdatesImpl = function () {};
+
+var isBatching = false;
+function batchedUpdates(fn, bookkeeping) {
+ if (isBatching) {
+ // If we are currently inside another batch, we need to wait until it
+ // fully completes before restoring state.
+ return fn(bookkeeping);
+ }
+ isBatching = true;
+ try {
+ return _batchedUpdatesImpl(fn, bookkeeping);
+ } finally {
+ // Here we wait until all updates have propagated, which is important
+ // when using controlled components within layers:
+ // https://github.com/facebook/react/issues/1698
+ // Then we restore state of any controlled component.
+ isBatching = false;
+ var controlledComponentsHavePendingUpdates = needsStateRestore();
+ if (controlledComponentsHavePendingUpdates) {
+ // If a controlled event was fired, we may need to restore the state of
+ // the DOM node back to the controlled value. This is necessary when React
+ // bails out of the update without touching the DOM.
+ _flushInteractiveUpdatesImpl();
+ restoreStateIfNeeded();
+ }
+ }
+}
+
+function interactiveUpdates(fn, a, b) {
+ return _interactiveUpdatesImpl(fn, a, b);
+}
+
+
+
+function setBatchingImplementation(batchedUpdatesImpl, interactiveUpdatesImpl, flushInteractiveUpdatesImpl) {
+ _batchedUpdatesImpl = batchedUpdatesImpl;
+ _interactiveUpdatesImpl = interactiveUpdatesImpl;
+ _flushInteractiveUpdatesImpl = flushInteractiveUpdatesImpl;
+}
+
+/**
+ * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
+ */
+var supportedInputTypes = {
+ color: true,
+ date: true,
+ datetime: true,
+ 'datetime-local': true,
+ email: true,
+ month: true,
+ number: true,
+ password: true,
+ range: true,
+ search: true,
+ tel: true,
+ text: true,
+ time: true,
+ url: true,
+ week: true
+};
+
+function isTextInputElement(elem) {
+ var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
+
+ if (nodeName === 'input') {
+ return !!supportedInputTypes[elem.type];
+ }
+
+ if (nodeName === 'textarea') {
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * HTML nodeType values that represent the type of the node
+ */
+
+var ELEMENT_NODE = 1;
+var TEXT_NODE = 3;
+var COMMENT_NODE = 8;
+var DOCUMENT_NODE = 9;
+var DOCUMENT_FRAGMENT_NODE = 11;
+
+/**
+ * Gets the target node from a native browser event by accounting for
+ * inconsistencies in browser DOM APIs.
+ *
+ * @param {object} nativeEvent Native browser event.
+ * @return {DOMEventTarget} Target node.
+ */
+function getEventTarget(nativeEvent) {
+ // Fallback to nativeEvent.srcElement for IE9
+ // https://github.com/facebook/react/issues/12506
+ var target = nativeEvent.target || nativeEvent.srcElement || window;
+
+ // Normalize SVG