(self["webpackChunkdashboard_react"] = self["webpackChunkdashboard_react"] || []).push([["main-27545368"],{ /***/ 38: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { U1: () => (/* binding */ configureStore), Ks: () => (/* binding */ getDefaultMiddleware) }); // UNUSED EXPORTS: EnhancerArray, MiddlewareArray, SHOULD_AUTOBATCH, TaskAbortError, __DO_NOT_USE__ActionTypes, addListener, applyMiddleware, autoBatchEnhancer, bindActionCreators, clearAllListeners, combineReducers, compose, createAction, createActionCreatorInvariantMiddleware, createAsyncThunk, createDraftSafeSelector, createEntityAdapter, createImmutableStateInvariantMiddleware, createListenerMiddleware, createNextState, createReducer, createSelector, createSerializableStateInvariantMiddleware, createSlice, createStore, current, findNonSerializableValue, freeze, getType, isAction, isActionCreator, isAllOf, isAnyOf, isAsyncThunkAction, isDraft, isFluxStandardAction, isFulfilled, isImmutableDefault, isPending, isPlain, isPlainObject, isRejected, isRejectedWithValue, legacy_createStore, miniSerializeError, nanoid, original, prepareAutoBatched, removeListener, unwrapResult // EXTERNAL MODULE: ./node_modules/immer/dist/immer.esm.mjs var immer_esm = __webpack_require__(6535); // EXTERNAL MODULE: ./node_modules/redux/es/redux.js var redux = __webpack_require__(2960); ;// ./node_modules/redux-thunk/es/index.js /** A function that accepts a potential "extra argument" value to be injected later, * and returns an instance of the thunk middleware that uses that value */ function createThunkMiddleware(extraArgument) { // Standard Redux middleware definition pattern: // See: https://redux.js.org/tutorials/fundamentals/part-4-store#writing-custom-middleware var middleware = function middleware(_ref) { var dispatch = _ref.dispatch, getState = _ref.getState; return function (next) { return function (action) { // The thunk middleware looks for any functions that were passed to `store.dispatch`. // If this "action" is really a function, call it and return the result. if (typeof action === 'function') { // Inject the store's `dispatch` and `getState` methods, as well as any "extra arg" return action(dispatch, getState, extraArgument); } // Otherwise, pass the action down the middleware chain as usual return next(action); }; }; }; return middleware; } var thunk = createThunkMiddleware(); // Attach the factory function so users can create a customized version // with whatever "extra arg" they want to inject into their thunks thunk.withExtraArgument = createThunkMiddleware; /* harmony default export */ const es = (thunk); ;// ./node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __generator = (undefined && undefined.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from) { for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) to[j] = from[i]; return to; }; var __defProp = Object.defineProperty; var __defProps = Object.defineProperties; var __getOwnPropDescs = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = function (obj, key, value) { return key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value: value }) : obj[key] = value; }; var __spreadValues = function (a, b) { for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var _i = 0, _c = __getOwnPropSymbols(b); _i < _c.length; _i++) { var prop = _c[_i]; if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; var __spreadProps = function (a, b) { return __defProps(a, __getOwnPropDescs(b)); }; var __async = function (__this, __arguments, generator) { return new Promise(function (resolve, reject) { var fulfilled = function (value) { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = function (value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = function (x) { return x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); }; step((generator = generator.apply(__this, __arguments)).next()); }); }; // src/index.ts // src/createDraftSafeSelector.ts var createDraftSafeSelector = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var selector = createSelector.apply(void 0, args); var wrappedSelector = function (value) { var rest = []; for (var _i = 1; _i < arguments.length; _i++) { rest[_i - 1] = arguments[_i]; } return selector.apply(void 0, __spreadArray([isDraft(value) ? current(value) : value], rest)); }; return wrappedSelector; }; // src/configureStore.ts // src/devtoolsExtension.ts var composeWithDevTools = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function () { if (arguments.length === 0) return void 0; if (typeof arguments[0] === "object") return redux/* compose */.Zz; return redux/* compose */.Zz.apply(null, arguments); }; var devToolsEnhancer = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__ : function () { return function (noop2) { return noop2; }; }; // src/isPlainObject.ts function isPlainObject(value) { if (typeof value !== "object" || value === null) return false; var proto = Object.getPrototypeOf(value); if (proto === null) return true; var baseProto = proto; while (Object.getPrototypeOf(baseProto) !== null) { baseProto = Object.getPrototypeOf(baseProto); } return proto === baseProto; } // src/getDefaultMiddleware.ts // src/tsHelpers.ts var hasMatchFunction = function (v) { return v && typeof v.match === "function"; }; // src/createAction.ts function createAction(type, prepareAction) { function actionCreator() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } if (prepareAction) { var prepared = prepareAction.apply(void 0, args); if (!prepared) { throw new Error("prepareAction did not return an object"); } return __spreadValues(__spreadValues({ type: type, payload: prepared.payload }, "meta" in prepared && { meta: prepared.meta }), "error" in prepared && { error: prepared.error }); } return { type: type, payload: args[0] }; } actionCreator.toString = function () { return "" + type; }; actionCreator.type = type; actionCreator.match = function (action) { return action.type === type; }; return actionCreator; } function isAction(action) { return isPlainObject(action) && "type" in action; } function isActionCreator(action) { return typeof action === "function" && "type" in action && hasMatchFunction(action); } function isFSA(action) { return isAction(action) && typeof action.type === "string" && Object.keys(action).every(isValidKey); } function isValidKey(key) { return ["type", "payload", "error", "meta"].indexOf(key) > -1; } function getType(actionCreator) { return "" + actionCreator; } // src/actionCreatorInvariantMiddleware.ts function getMessage(type) { var splitType = type ? ("" + type).split("/") : []; var actionName = splitType[splitType.length - 1] || "actionCreator"; return "Detected an action creator with type \"" + (type || "unknown") + "\" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. `dispatch(" + actionName + "())` instead of `dispatch(" + actionName + ")`. This is necessary even if the action has no payload."; } function createActionCreatorInvariantMiddleware(options) { if (options === void 0) { options = {}; } if (true) { return function () { return function (next) { return function (action) { return next(action); }; }; }; } // removed by dead control flow { var _c, isActionCreator2; } // removed by dead control flow {} } // src/utils.ts function getTimeMeasureUtils(maxDelay, fnName) { var elapsed = 0; return { measureTime: function (fn) { var started = Date.now(); try { return fn(); } finally { var finished = Date.now(); elapsed += finished - started; } }, warnIfExceeded: function () { if (elapsed > maxDelay) { console.warn(fnName + " took " + elapsed + "ms, which is more than the warning threshold of " + maxDelay + "ms. \nIf your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.\nIt is disabled in production builds, so you don't need to worry about that."); } } }; } var MiddlewareArray = /** @class */ (function (_super) { __extends(MiddlewareArray, _super); function MiddlewareArray() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var _this = _super.apply(this, args) || this; Object.setPrototypeOf(_this, MiddlewareArray.prototype); return _this; } Object.defineProperty(MiddlewareArray, Symbol.species, { get: function () { return MiddlewareArray; }, enumerable: false, configurable: true }); MiddlewareArray.prototype.concat = function () { var arr = []; for (var _i = 0; _i < arguments.length; _i++) { arr[_i] = arguments[_i]; } return _super.prototype.concat.apply(this, arr); }; MiddlewareArray.prototype.prepend = function () { var arr = []; for (var _i = 0; _i < arguments.length; _i++) { arr[_i] = arguments[_i]; } if (arr.length === 1 && Array.isArray(arr[0])) { return new (MiddlewareArray.bind.apply(MiddlewareArray, __spreadArray([void 0], arr[0].concat(this))))(); } return new (MiddlewareArray.bind.apply(MiddlewareArray, __spreadArray([void 0], arr.concat(this))))(); }; return MiddlewareArray; }(Array)); var EnhancerArray = /** @class */ (function (_super) { __extends(EnhancerArray, _super); function EnhancerArray() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var _this = _super.apply(this, args) || this; Object.setPrototypeOf(_this, EnhancerArray.prototype); return _this; } Object.defineProperty(EnhancerArray, Symbol.species, { get: function () { return EnhancerArray; }, enumerable: false, configurable: true }); EnhancerArray.prototype.concat = function () { var arr = []; for (var _i = 0; _i < arguments.length; _i++) { arr[_i] = arguments[_i]; } return _super.prototype.concat.apply(this, arr); }; EnhancerArray.prototype.prepend = function () { var arr = []; for (var _i = 0; _i < arguments.length; _i++) { arr[_i] = arguments[_i]; } if (arr.length === 1 && Array.isArray(arr[0])) { return new (EnhancerArray.bind.apply(EnhancerArray, __spreadArray([void 0], arr[0].concat(this))))(); } return new (EnhancerArray.bind.apply(EnhancerArray, __spreadArray([void 0], arr.concat(this))))(); }; return EnhancerArray; }(Array)); function freezeDraftable(val) { return isDraftable(val) ? createNextState(val, function () { }) : val; } // src/immutableStateInvariantMiddleware.ts var isProduction = (/* unused pure expression or super */ null && ("production" === "production")); var prefix = "Invariant failed"; function invariant(condition, message) { if (condition) { return; } if (isProduction) { throw new Error(prefix); } throw new Error(prefix + ": " + (message || "")); } function stringify(obj, serializer, indent, decycler) { return JSON.stringify(obj, getSerialize(serializer, decycler), indent); } function getSerialize(serializer, decycler) { var stack = [], keys = []; if (!decycler) decycler = function (_, value) { if (stack[0] === value) return "[Circular ~]"; return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]"; }; return function (key, value) { if (stack.length > 0) { var thisPos = stack.indexOf(this); ~thisPos ? stack.splice(thisPos + 1) : stack.push(this); ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key); if (~stack.indexOf(value)) value = decycler.call(this, key, value); } else stack.push(value); return serializer == null ? value : serializer.call(this, key, value); }; } function isImmutableDefault(value) { return typeof value !== "object" || value == null || Object.isFrozen(value); } function trackForMutations(isImmutable, ignorePaths, obj) { var trackedProperties = trackProperties(isImmutable, ignorePaths, obj); return { detectMutations: function () { return detectMutations(isImmutable, ignorePaths, trackedProperties, obj); } }; } function trackProperties(isImmutable, ignorePaths, obj, path, checkedObjects) { if (ignorePaths === void 0) { ignorePaths = []; } if (path === void 0) { path = ""; } if (checkedObjects === void 0) { checkedObjects = new Set(); } var tracked = { value: obj }; if (!isImmutable(obj) && !checkedObjects.has(obj)) { checkedObjects.add(obj); tracked.children = {}; for (var key in obj) { var childPath = path ? path + "." + key : key; if (ignorePaths.length && ignorePaths.indexOf(childPath) !== -1) { continue; } tracked.children[key] = trackProperties(isImmutable, ignorePaths, obj[key], childPath); } } return tracked; } function detectMutations(isImmutable, ignoredPaths, trackedProperty, obj, sameParentRef, path) { if (ignoredPaths === void 0) { ignoredPaths = []; } if (sameParentRef === void 0) { sameParentRef = false; } if (path === void 0) { path = ""; } var prevObj = trackedProperty ? trackedProperty.value : void 0; var sameRef = prevObj === obj; if (sameParentRef && !sameRef && !Number.isNaN(obj)) { return { wasMutated: true, path: path }; } if (isImmutable(prevObj) || isImmutable(obj)) { return { wasMutated: false }; } var keysToDetect = {}; for (var key in trackedProperty.children) { keysToDetect[key] = true; } for (var key in obj) { keysToDetect[key] = true; } var hasIgnoredPaths = ignoredPaths.length > 0; var _loop_1 = function (key) { var nestedPath = path ? path + "." + key : key; if (hasIgnoredPaths) { var hasMatches = ignoredPaths.some(function (ignored) { if (ignored instanceof RegExp) { return ignored.test(nestedPath); } return nestedPath === ignored; }); if (hasMatches) { return "continue"; } } var result = detectMutations(isImmutable, ignoredPaths, trackedProperty.children[key], obj[key], sameRef, nestedPath); if (result.wasMutated) { return { value: result }; } }; for (var key in keysToDetect) { var state_1 = _loop_1(key); if (typeof state_1 === "object") return state_1.value; } return { wasMutated: false }; } function createImmutableStateInvariantMiddleware(options) { if (options === void 0) { options = {}; } if (true) { return function () { return function (next) { return function (action) { return next(action); }; }; }; } // removed by dead control flow { var _c, isImmutable, ignoredPaths, _d, warnAfter, ignore; } // removed by dead control flow {} // removed by dead control flow { var track; } // removed by dead control flow {} } // src/serializableStateInvariantMiddleware.ts function isPlain(val) { var type = typeof val; return val == null || type === "string" || type === "boolean" || type === "number" || Array.isArray(val) || isPlainObject(val); } function findNonSerializableValue(value, path, isSerializable, getEntries, ignoredPaths, cache) { if (path === void 0) { path = ""; } if (isSerializable === void 0) { isSerializable = isPlain; } if (ignoredPaths === void 0) { ignoredPaths = []; } var foundNestedSerializable; if (!isSerializable(value)) { return { keyPath: path || "", value: value }; } if (typeof value !== "object" || value === null) { return false; } if (cache == null ? void 0 : cache.has(value)) return false; var entries = getEntries != null ? getEntries(value) : Object.entries(value); var hasIgnoredPaths = ignoredPaths.length > 0; var _loop_2 = function (key, nestedValue) { var nestedPath = path ? path + "." + key : key; if (hasIgnoredPaths) { var hasMatches = ignoredPaths.some(function (ignored) { if (ignored instanceof RegExp) { return ignored.test(nestedPath); } return nestedPath === ignored; }); if (hasMatches) { return "continue"; } } if (!isSerializable(nestedValue)) { return { value: { keyPath: nestedPath, value: nestedValue } }; } if (typeof nestedValue === "object") { foundNestedSerializable = findNonSerializableValue(nestedValue, nestedPath, isSerializable, getEntries, ignoredPaths, cache); if (foundNestedSerializable) { return { value: foundNestedSerializable }; } } }; for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) { var _c = entries_1[_i], key = _c[0], nestedValue = _c[1]; var state_2 = _loop_2(key, nestedValue); if (typeof state_2 === "object") return state_2.value; } if (cache && isNestedFrozen(value)) cache.add(value); return false; } function isNestedFrozen(value) { if (!Object.isFrozen(value)) return false; for (var _i = 0, _c = Object.values(value); _i < _c.length; _i++) { var nestedValue = _c[_i]; if (typeof nestedValue !== "object" || nestedValue === null) continue; if (!isNestedFrozen(nestedValue)) return false; } return true; } function createSerializableStateInvariantMiddleware(options) { if (options === void 0) { options = {}; } if (true) { return function () { return function (next) { return function (action) { return next(action); }; }; }; } // removed by dead control flow { var _c, isSerializable, getEntries, _d, ignoredActions, _e, ignoredActionPaths, _f, ignoredPaths, _g, warnAfter, _h, ignoreState, _j, ignoreActions, _k, disableCache; } // removed by dead control flow { var cache; } // removed by dead control flow {} } // src/getDefaultMiddleware.ts function isBoolean(x) { return typeof x === "boolean"; } function curryGetDefaultMiddleware() { return function curriedGetDefaultMiddleware(options) { return getDefaultMiddleware(options); }; } function getDefaultMiddleware(options) { if (options === void 0) { options = {}; } var _c = options.thunk, thunk = _c === void 0 ? true : _c, _d = options.immutableCheck, immutableCheck = _d === void 0 ? true : _d, _e = options.serializableCheck, serializableCheck = _e === void 0 ? true : _e, _f = options.actionCreatorCheck, actionCreatorCheck = _f === void 0 ? true : _f; var middlewareArray = new MiddlewareArray(); if (thunk) { if (isBoolean(thunk)) { middlewareArray.push(es); } else { middlewareArray.push(es.withExtraArgument(thunk.extraArgument)); } } if (false) // removed by dead control flow { var actionCreatorOptions, serializableOptions, immutableOptions; } return middlewareArray; } // src/configureStore.ts var IS_PRODUCTION = "production" === "production"; function configureStore(options) { var curriedGetDefaultMiddleware = curryGetDefaultMiddleware(); var _c = options || {}, _d = _c.reducer, reducer = _d === void 0 ? void 0 : _d, _e = _c.middleware, middleware = _e === void 0 ? curriedGetDefaultMiddleware() : _e, _f = _c.devTools, devTools = _f === void 0 ? true : _f, _g = _c.preloadedState, preloadedState = _g === void 0 ? void 0 : _g, _h = _c.enhancers, enhancers = _h === void 0 ? void 0 : _h; var rootReducer; if (typeof reducer === "function") { rootReducer = reducer; } else if (isPlainObject(reducer)) { rootReducer = (0,redux/* combineReducers */.HY)(reducer); } else { throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers'); } var finalMiddleware = middleware; if (typeof finalMiddleware === "function") { finalMiddleware = finalMiddleware(curriedGetDefaultMiddleware); if (!IS_PRODUCTION && !Array.isArray(finalMiddleware)) { throw new Error("when using a middleware builder function, an array of middleware must be returned"); } } if (!IS_PRODUCTION && finalMiddleware.some(function (item) { return typeof item !== "function"; })) { throw new Error("each middleware provided to configureStore must be a function"); } var middlewareEnhancer = redux/* applyMiddleware */.Tw.apply(void 0, finalMiddleware); var finalCompose = redux/* compose */.Zz; if (devTools) { finalCompose = composeWithDevTools(__spreadValues({ trace: !IS_PRODUCTION }, typeof devTools === "object" && devTools)); } var defaultEnhancers = new EnhancerArray(middlewareEnhancer); var storeEnhancers = defaultEnhancers; if (Array.isArray(enhancers)) { storeEnhancers = __spreadArray([middlewareEnhancer], enhancers); } else if (typeof enhancers === "function") { storeEnhancers = enhancers(defaultEnhancers); } var composedEnhancer = finalCompose.apply(void 0, storeEnhancers); return (0,redux/* createStore */.y$)(rootReducer, preloadedState, composedEnhancer); } // src/createReducer.ts // src/mapBuilders.ts function executeReducerBuilderCallback(builderCallback) { var actionsMap = {}; var actionMatchers = []; var defaultCaseReducer; var builder = { addCase: function (typeOrActionCreator, reducer) { if (false) // removed by dead control flow {} var type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type; if (!type) { throw new Error("`builder.addCase` cannot be called with an empty action type"); } if (type in actionsMap) { throw new Error("`builder.addCase` cannot be called with two reducers for the same action type"); } actionsMap[type] = reducer; return builder; }, addMatcher: function (matcher, reducer) { if (false) // removed by dead control flow {} actionMatchers.push({ matcher: matcher, reducer: reducer }); return builder; }, addDefaultCase: function (reducer) { if (false) // removed by dead control flow {} defaultCaseReducer = reducer; return builder; } }; builderCallback(builder); return [actionsMap, actionMatchers, defaultCaseReducer]; } // src/createReducer.ts function isStateFunction(x) { return typeof x === "function"; } var hasWarnedAboutObjectNotation = false; function createReducer(initialState, mapOrBuilderCallback, actionMatchers, defaultCaseReducer) { if (actionMatchers === void 0) { actionMatchers = []; } if (false) // removed by dead control flow {} var _c = typeof mapOrBuilderCallback === "function" ? executeReducerBuilderCallback(mapOrBuilderCallback) : [mapOrBuilderCallback, actionMatchers, defaultCaseReducer], actionsMap = _c[0], finalActionMatchers = _c[1], finalDefaultCaseReducer = _c[2]; var getInitialState; if (isStateFunction(initialState)) { getInitialState = function () { return freezeDraftable(initialState()); }; } else { var frozenInitialState_1 = freezeDraftable(initialState); getInitialState = function () { return frozenInitialState_1; }; } function reducer(state, action) { if (state === void 0) { state = getInitialState(); } var caseReducers = __spreadArray([ actionsMap[action.type] ], finalActionMatchers.filter(function (_c) { var matcher = _c.matcher; return matcher(action); }).map(function (_c) { var reducer2 = _c.reducer; return reducer2; })); if (caseReducers.filter(function (cr) { return !!cr; }).length === 0) { caseReducers = [finalDefaultCaseReducer]; } return caseReducers.reduce(function (previousState, caseReducer) { if (caseReducer) { if (isDraft2(previousState)) { var draft = previousState; var result = caseReducer(draft, action); if (result === void 0) { return previousState; } return result; } else if (!isDraftable2(previousState)) { var result = caseReducer(previousState, action); if (result === void 0) { if (previousState === null) { return previousState; } throw Error("A case reducer on a non-draftable value must not return undefined"); } return result; } else { return createNextState2(previousState, function (draft) { return caseReducer(draft, action); }); } } return previousState; }, state); } reducer.getInitialState = getInitialState; return reducer; } // src/createSlice.ts var hasWarnedAboutObjectNotation2 = false; function getType2(slice, actionKey) { return slice + "/" + actionKey; } function createSlice(options) { var name = options.name; if (!name) { throw new Error("`name` is a required option for createSlice"); } if (typeof process !== "undefined" && "production" === "development") // removed by dead control flow {} var initialState = typeof options.initialState == "function" ? options.initialState : freezeDraftable(options.initialState); var reducers = options.reducers || {}; var reducerNames = Object.keys(reducers); var sliceCaseReducersByName = {}; var sliceCaseReducersByType = {}; var actionCreators = {}; reducerNames.forEach(function (reducerName) { var maybeReducerWithPrepare = reducers[reducerName]; var type = getType2(name, reducerName); var caseReducer; var prepareCallback; if ("reducer" in maybeReducerWithPrepare) { caseReducer = maybeReducerWithPrepare.reducer; prepareCallback = maybeReducerWithPrepare.prepare; } else { caseReducer = maybeReducerWithPrepare; } sliceCaseReducersByName[reducerName] = caseReducer; sliceCaseReducersByType[type] = caseReducer; actionCreators[reducerName] = prepareCallback ? createAction(type, prepareCallback) : createAction(type); }); function buildReducer() { if (false) // removed by dead control flow {} var _c = typeof options.extraReducers === "function" ? executeReducerBuilderCallback(options.extraReducers) : [options.extraReducers], _d = _c[0], extraReducers = _d === void 0 ? {} : _d, _e = _c[1], actionMatchers = _e === void 0 ? [] : _e, _f = _c[2], defaultCaseReducer = _f === void 0 ? void 0 : _f; var finalCaseReducers = __spreadValues(__spreadValues({}, extraReducers), sliceCaseReducersByType); return createReducer(initialState, function (builder) { for (var key in finalCaseReducers) { builder.addCase(key, finalCaseReducers[key]); } for (var _i = 0, actionMatchers_1 = actionMatchers; _i < actionMatchers_1.length; _i++) { var m = actionMatchers_1[_i]; builder.addMatcher(m.matcher, m.reducer); } if (defaultCaseReducer) { builder.addDefaultCase(defaultCaseReducer); } }); } var _reducer; return { name: name, reducer: function (state, action) { if (!_reducer) _reducer = buildReducer(); return _reducer(state, action); }, actions: actionCreators, caseReducers: sliceCaseReducersByName, getInitialState: function () { if (!_reducer) _reducer = buildReducer(); return _reducer.getInitialState(); } }; } // src/entities/entity_state.ts function getInitialEntityState() { return { ids: [], entities: {} }; } function createInitialStateFactory() { function getInitialState(additionalState) { if (additionalState === void 0) { additionalState = {}; } return Object.assign(getInitialEntityState(), additionalState); } return { getInitialState: getInitialState }; } // src/entities/state_selectors.ts function createSelectorsFactory() { function getSelectors(selectState) { var selectIds = function (state) { return state.ids; }; var selectEntities = function (state) { return state.entities; }; var selectAll = createDraftSafeSelector(selectIds, selectEntities, function (ids, entities) { return ids.map(function (id) { return entities[id]; }); }); var selectId = function (_, id) { return id; }; var selectById = function (entities, id) { return entities[id]; }; var selectTotal = createDraftSafeSelector(selectIds, function (ids) { return ids.length; }); if (!selectState) { return { selectIds: selectIds, selectEntities: selectEntities, selectAll: selectAll, selectTotal: selectTotal, selectById: createDraftSafeSelector(selectEntities, selectId, selectById) }; } var selectGlobalizedEntities = createDraftSafeSelector(selectState, selectEntities); return { selectIds: createDraftSafeSelector(selectState, selectIds), selectEntities: selectGlobalizedEntities, selectAll: createDraftSafeSelector(selectState, selectAll), selectTotal: createDraftSafeSelector(selectState, selectTotal), selectById: createDraftSafeSelector(selectGlobalizedEntities, selectId, selectById) }; } return { getSelectors: getSelectors }; } // src/entities/state_adapter.ts function createSingleArgumentStateOperator(mutator) { var operator = createStateOperator(function (_, state) { return mutator(state); }); return function operation(state) { return operator(state, void 0); }; } function createStateOperator(mutator) { return function operation(state, arg) { function isPayloadActionArgument(arg2) { return isFSA(arg2); } var runMutator = function (draft) { if (isPayloadActionArgument(arg)) { mutator(arg.payload, draft); } else { mutator(arg, draft); } }; if (isDraft3(state)) { runMutator(state); return state; } else { return createNextState3(state, runMutator); } }; } // src/entities/utils.ts function selectIdValue(entity, selectId) { var key = selectId(entity); if (false) // removed by dead control flow {} return key; } function ensureEntitiesArray(entities) { if (!Array.isArray(entities)) { entities = Object.values(entities); } return entities; } function splitAddedUpdatedEntities(newEntities, selectId, state) { newEntities = ensureEntitiesArray(newEntities); var added = []; var updated = []; for (var _i = 0, newEntities_1 = newEntities; _i < newEntities_1.length; _i++) { var entity = newEntities_1[_i]; var id = selectIdValue(entity, selectId); if (id in state.entities) { updated.push({ id: id, changes: entity }); } else { added.push(entity); } } return [added, updated]; } // src/entities/unsorted_state_adapter.ts function createUnsortedStateAdapter(selectId) { function addOneMutably(entity, state) { var key = selectIdValue(entity, selectId); if (key in state.entities) { return; } state.ids.push(key); state.entities[key] = entity; } function addManyMutably(newEntities, state) { newEntities = ensureEntitiesArray(newEntities); for (var _i = 0, newEntities_2 = newEntities; _i < newEntities_2.length; _i++) { var entity = newEntities_2[_i]; addOneMutably(entity, state); } } function setOneMutably(entity, state) { var key = selectIdValue(entity, selectId); if (!(key in state.entities)) { state.ids.push(key); } state.entities[key] = entity; } function setManyMutably(newEntities, state) { newEntities = ensureEntitiesArray(newEntities); for (var _i = 0, newEntities_3 = newEntities; _i < newEntities_3.length; _i++) { var entity = newEntities_3[_i]; setOneMutably(entity, state); } } function setAllMutably(newEntities, state) { newEntities = ensureEntitiesArray(newEntities); state.ids = []; state.entities = {}; addManyMutably(newEntities, state); } function removeOneMutably(key, state) { return removeManyMutably([key], state); } function removeManyMutably(keys, state) { var didMutate = false; keys.forEach(function (key) { if (key in state.entities) { delete state.entities[key]; didMutate = true; } }); if (didMutate) { state.ids = state.ids.filter(function (id) { return id in state.entities; }); } } function removeAllMutably(state) { Object.assign(state, { ids: [], entities: {} }); } function takeNewKey(keys, update, state) { var original2 = state.entities[update.id]; var updated = Object.assign({}, original2, update.changes); var newKey = selectIdValue(updated, selectId); var hasNewKey = newKey !== update.id; if (hasNewKey) { keys[update.id] = newKey; delete state.entities[update.id]; } state.entities[newKey] = updated; return hasNewKey; } function updateOneMutably(update, state) { return updateManyMutably([update], state); } function updateManyMutably(updates, state) { var newKeys = {}; var updatesPerEntity = {}; updates.forEach(function (update) { if (update.id in state.entities) { updatesPerEntity[update.id] = { id: update.id, changes: __spreadValues(__spreadValues({}, updatesPerEntity[update.id] ? updatesPerEntity[update.id].changes : null), update.changes) }; } }); updates = Object.values(updatesPerEntity); var didMutateEntities = updates.length > 0; if (didMutateEntities) { var didMutateIds = updates.filter(function (update) { return takeNewKey(newKeys, update, state); }).length > 0; if (didMutateIds) { state.ids = Object.keys(state.entities); } } } function upsertOneMutably(entity, state) { return upsertManyMutably([entity], state); } function upsertManyMutably(newEntities, state) { var _c = splitAddedUpdatedEntities(newEntities, selectId, state), added = _c[0], updated = _c[1]; updateManyMutably(updated, state); addManyMutably(added, state); } return { removeAll: createSingleArgumentStateOperator(removeAllMutably), addOne: createStateOperator(addOneMutably), addMany: createStateOperator(addManyMutably), setOne: createStateOperator(setOneMutably), setMany: createStateOperator(setManyMutably), setAll: createStateOperator(setAllMutably), updateOne: createStateOperator(updateOneMutably), updateMany: createStateOperator(updateManyMutably), upsertOne: createStateOperator(upsertOneMutably), upsertMany: createStateOperator(upsertManyMutably), removeOne: createStateOperator(removeOneMutably), removeMany: createStateOperator(removeManyMutably) }; } // src/entities/sorted_state_adapter.ts function createSortedStateAdapter(selectId, sort) { var _c = createUnsortedStateAdapter(selectId), removeOne = _c.removeOne, removeMany = _c.removeMany, removeAll = _c.removeAll; function addOneMutably(entity, state) { return addManyMutably([entity], state); } function addManyMutably(newEntities, state) { newEntities = ensureEntitiesArray(newEntities); var models = newEntities.filter(function (model) { return !(selectIdValue(model, selectId) in state.entities); }); if (models.length !== 0) { merge(models, state); } } function setOneMutably(entity, state) { return setManyMutably([entity], state); } function setManyMutably(newEntities, state) { newEntities = ensureEntitiesArray(newEntities); if (newEntities.length !== 0) { merge(newEntities, state); } } function setAllMutably(newEntities, state) { newEntities = ensureEntitiesArray(newEntities); state.entities = {}; state.ids = []; addManyMutably(newEntities, state); } function updateOneMutably(update, state) { return updateManyMutably([update], state); } function updateManyMutably(updates, state) { var appliedUpdates = false; for (var _i = 0, updates_1 = updates; _i < updates_1.length; _i++) { var update = updates_1[_i]; var entity = state.entities[update.id]; if (!entity) { continue; } appliedUpdates = true; Object.assign(entity, update.changes); var newId = selectId(entity); if (update.id !== newId) { delete state.entities[update.id]; state.entities[newId] = entity; } } if (appliedUpdates) { resortEntities(state); } } function upsertOneMutably(entity, state) { return upsertManyMutably([entity], state); } function upsertManyMutably(newEntities, state) { var _c = splitAddedUpdatedEntities(newEntities, selectId, state), added = _c[0], updated = _c[1]; updateManyMutably(updated, state); addManyMutably(added, state); } function areArraysEqual(a, b) { if (a.length !== b.length) { return false; } for (var i = 0; i < a.length && i < b.length; i++) { if (a[i] === b[i]) { continue; } return false; } return true; } function merge(models, state) { models.forEach(function (model) { state.entities[selectId(model)] = model; }); resortEntities(state); } function resortEntities(state) { var allEntities = Object.values(state.entities); allEntities.sort(sort); var newSortedIds = allEntities.map(selectId); var ids = state.ids; if (!areArraysEqual(ids, newSortedIds)) { state.ids = newSortedIds; } } return { removeOne: removeOne, removeMany: removeMany, removeAll: removeAll, addOne: createStateOperator(addOneMutably), updateOne: createStateOperator(updateOneMutably), upsertOne: createStateOperator(upsertOneMutably), setOne: createStateOperator(setOneMutably), setMany: createStateOperator(setManyMutably), setAll: createStateOperator(setAllMutably), addMany: createStateOperator(addManyMutably), updateMany: createStateOperator(updateManyMutably), upsertMany: createStateOperator(upsertManyMutably) }; } // src/entities/create_adapter.ts function createEntityAdapter(options) { if (options === void 0) { options = {}; } var _c = __spreadValues({ sortComparer: false, selectId: function (instance) { return instance.id; } }, options), selectId = _c.selectId, sortComparer = _c.sortComparer; var stateFactory = createInitialStateFactory(); var selectorsFactory = createSelectorsFactory(); var stateAdapter = sortComparer ? createSortedStateAdapter(selectId, sortComparer) : createUnsortedStateAdapter(selectId); return __spreadValues(__spreadValues(__spreadValues({ selectId: selectId, sortComparer: sortComparer }, stateFactory), selectorsFactory), stateAdapter); } // src/nanoid.ts var urlAlphabet = "ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"; var nanoid = function (size) { if (size === void 0) { size = 21; } var id = ""; var i = size; while (i--) { id += urlAlphabet[Math.random() * 64 | 0]; } return id; }; // src/createAsyncThunk.ts var commonProperties = [ "name", "message", "stack", "code" ]; var RejectWithValue = /** @class */ (function () { function RejectWithValue(payload, meta) { this.payload = payload; this.meta = meta; } return RejectWithValue; }()); var FulfillWithMeta = /** @class */ (function () { function FulfillWithMeta(payload, meta) { this.payload = payload; this.meta = meta; } return FulfillWithMeta; }()); var miniSerializeError = function (value) { if (typeof value === "object" && value !== null) { var simpleError = {}; for (var _i = 0, commonProperties_1 = commonProperties; _i < commonProperties_1.length; _i++) { var property = commonProperties_1[_i]; if (typeof value[property] === "string") { simpleError[property] = value[property]; } } return simpleError; } return { message: String(value) }; }; var createAsyncThunk = (function () { function createAsyncThunk2(typePrefix, payloadCreator, options) { var fulfilled = createAction(typePrefix + "/fulfilled", function (payload, requestId, arg, meta) { return ({ payload: payload, meta: __spreadProps(__spreadValues({}, meta || {}), { arg: arg, requestId: requestId, requestStatus: "fulfilled" }) }); }); var pending = createAction(typePrefix + "/pending", function (requestId, arg, meta) { return ({ payload: void 0, meta: __spreadProps(__spreadValues({}, meta || {}), { arg: arg, requestId: requestId, requestStatus: "pending" }) }); }); var rejected = createAction(typePrefix + "/rejected", function (error, requestId, arg, payload, meta) { return ({ payload: payload, error: (options && options.serializeError || miniSerializeError)(error || "Rejected"), meta: __spreadProps(__spreadValues({}, meta || {}), { arg: arg, requestId: requestId, rejectedWithValue: !!payload, requestStatus: "rejected", aborted: (error == null ? void 0 : error.name) === "AbortError", condition: (error == null ? void 0 : error.name) === "ConditionError" }) }); }); var displayedWarning = false; var AC = typeof AbortController !== "undefined" ? AbortController : /** @class */ (function () { function class_1() { this.signal = { aborted: false, addEventListener: function () { }, dispatchEvent: function () { return false; }, onabort: function () { }, removeEventListener: function () { }, reason: void 0, throwIfAborted: function () { } }; } class_1.prototype.abort = function () { if (false) // removed by dead control flow {} }; return class_1; }()); function actionCreator(arg) { return function (dispatch, getState, extra) { var requestId = (options == null ? void 0 : options.idGenerator) ? options.idGenerator(arg) : nanoid(); var abortController = new AC(); var abortReason; var started = false; function abort(reason) { abortReason = reason; abortController.abort(); } var promise2 = function () { return __async(this, null, function () { var _a, _b, finalAction, conditionResult, abortedPromise, err_1, skipDispatch; return __generator(this, function (_c) { switch (_c.label) { case 0: _c.trys.push([0, 4, , 5]); conditionResult = (_a = options == null ? void 0 : options.condition) == null ? void 0 : _a.call(options, arg, { getState: getState, extra: extra }); if (!isThenable(conditionResult)) return [3 /*break*/, 2]; return [4 /*yield*/, conditionResult]; case 1: conditionResult = _c.sent(); _c.label = 2; case 2: if (conditionResult === false || abortController.signal.aborted) { throw { name: "ConditionError", message: "Aborted due to condition callback returning false." }; } started = true; abortedPromise = new Promise(function (_, reject) { return abortController.signal.addEventListener("abort", function () { return reject({ name: "AbortError", message: abortReason || "Aborted" }); }); }); dispatch(pending(requestId, arg, (_b = options == null ? void 0 : options.getPendingMeta) == null ? void 0 : _b.call(options, { requestId: requestId, arg: arg }, { getState: getState, extra: extra }))); return [4 /*yield*/, Promise.race([ abortedPromise, Promise.resolve(payloadCreator(arg, { dispatch: dispatch, getState: getState, extra: extra, requestId: requestId, signal: abortController.signal, abort: abort, rejectWithValue: function (value, meta) { return new RejectWithValue(value, meta); }, fulfillWithValue: function (value, meta) { return new FulfillWithMeta(value, meta); } })).then(function (result) { if (result instanceof RejectWithValue) { throw result; } if (result instanceof FulfillWithMeta) { return fulfilled(result.payload, requestId, arg, result.meta); } return fulfilled(result, requestId, arg); }) ])]; case 3: finalAction = _c.sent(); return [3 /*break*/, 5]; case 4: err_1 = _c.sent(); finalAction = err_1 instanceof RejectWithValue ? rejected(null, requestId, arg, err_1.payload, err_1.meta) : rejected(err_1, requestId, arg); return [3 /*break*/, 5]; case 5: skipDispatch = options && !options.dispatchConditionRejection && rejected.match(finalAction) && finalAction.meta.condition; if (!skipDispatch) { dispatch(finalAction); } return [2 /*return*/, finalAction]; } }); }); }(); return Object.assign(promise2, { abort: abort, requestId: requestId, arg: arg, unwrap: function () { return promise2.then(unwrapResult); } }); }; } return Object.assign(actionCreator, { pending: pending, rejected: rejected, fulfilled: fulfilled, typePrefix: typePrefix }); } createAsyncThunk2.withTypes = function () { return createAsyncThunk2; }; return createAsyncThunk2; })(); function unwrapResult(action) { if (action.meta && action.meta.rejectedWithValue) { throw action.payload; } if (action.error) { throw action.error; } return action.payload; } function isThenable(value) { return value !== null && typeof value === "object" && typeof value.then === "function"; } // src/matchers.ts var matches = function (matcher, action) { if (hasMatchFunction(matcher)) { return matcher.match(action); } else { return matcher(action); } }; function isAnyOf() { var matchers = []; for (var _i = 0; _i < arguments.length; _i++) { matchers[_i] = arguments[_i]; } return function (action) { return matchers.some(function (matcher) { return matches(matcher, action); }); }; } function isAllOf() { var matchers = []; for (var _i = 0; _i < arguments.length; _i++) { matchers[_i] = arguments[_i]; } return function (action) { return matchers.every(function (matcher) { return matches(matcher, action); }); }; } function hasExpectedRequestMetadata(action, validStatus) { if (!action || !action.meta) return false; var hasValidRequestId = typeof action.meta.requestId === "string"; var hasValidRequestStatus = validStatus.indexOf(action.meta.requestStatus) > -1; return hasValidRequestId && hasValidRequestStatus; } function isAsyncThunkArray(a) { return typeof a[0] === "function" && "pending" in a[0] && "fulfilled" in a[0] && "rejected" in a[0]; } function isPending() { var asyncThunks = []; for (var _i = 0; _i < arguments.length; _i++) { asyncThunks[_i] = arguments[_i]; } if (asyncThunks.length === 0) { return function (action) { return hasExpectedRequestMetadata(action, ["pending"]); }; } if (!isAsyncThunkArray(asyncThunks)) { return isPending()(asyncThunks[0]); } return function (action) { var matchers = asyncThunks.map(function (asyncThunk) { return asyncThunk.pending; }); var combinedMatcher = isAnyOf.apply(void 0, matchers); return combinedMatcher(action); }; } function isRejected() { var asyncThunks = []; for (var _i = 0; _i < arguments.length; _i++) { asyncThunks[_i] = arguments[_i]; } if (asyncThunks.length === 0) { return function (action) { return hasExpectedRequestMetadata(action, ["rejected"]); }; } if (!isAsyncThunkArray(asyncThunks)) { return isRejected()(asyncThunks[0]); } return function (action) { var matchers = asyncThunks.map(function (asyncThunk) { return asyncThunk.rejected; }); var combinedMatcher = isAnyOf.apply(void 0, matchers); return combinedMatcher(action); }; } function isRejectedWithValue() { var asyncThunks = []; for (var _i = 0; _i < arguments.length; _i++) { asyncThunks[_i] = arguments[_i]; } var hasFlag = function (action) { return action && action.meta && action.meta.rejectedWithValue; }; if (asyncThunks.length === 0) { return function (action) { var combinedMatcher = isAllOf(isRejected.apply(void 0, asyncThunks), hasFlag); return combinedMatcher(action); }; } if (!isAsyncThunkArray(asyncThunks)) { return isRejectedWithValue()(asyncThunks[0]); } return function (action) { var combinedMatcher = isAllOf(isRejected.apply(void 0, asyncThunks), hasFlag); return combinedMatcher(action); }; } function isFulfilled() { var asyncThunks = []; for (var _i = 0; _i < arguments.length; _i++) { asyncThunks[_i] = arguments[_i]; } if (asyncThunks.length === 0) { return function (action) { return hasExpectedRequestMetadata(action, ["fulfilled"]); }; } if (!isAsyncThunkArray(asyncThunks)) { return isFulfilled()(asyncThunks[0]); } return function (action) { var matchers = asyncThunks.map(function (asyncThunk) { return asyncThunk.fulfilled; }); var combinedMatcher = isAnyOf.apply(void 0, matchers); return combinedMatcher(action); }; } function isAsyncThunkAction() { var asyncThunks = []; for (var _i = 0; _i < arguments.length; _i++) { asyncThunks[_i] = arguments[_i]; } if (asyncThunks.length === 0) { return function (action) { return hasExpectedRequestMetadata(action, ["pending", "fulfilled", "rejected"]); }; } if (!isAsyncThunkArray(asyncThunks)) { return isAsyncThunkAction()(asyncThunks[0]); } return function (action) { var matchers = []; for (var _i = 0, asyncThunks_1 = asyncThunks; _i < asyncThunks_1.length; _i++) { var asyncThunk = asyncThunks_1[_i]; matchers.push(asyncThunk.pending, asyncThunk.rejected, asyncThunk.fulfilled); } var combinedMatcher = isAnyOf.apply(void 0, matchers); return combinedMatcher(action); }; } // src/listenerMiddleware/utils.ts var assertFunction = function (func, expected) { if (typeof func !== "function") { throw new TypeError(expected + " is not a function"); } }; var noop = function () { }; var catchRejection = function (promise2, onError) { if (onError === void 0) { onError = noop; } promise2.catch(onError); return promise2; }; var addAbortSignalListener = function (abortSignal, callback) { abortSignal.addEventListener("abort", callback, { once: true }); return function () { return abortSignal.removeEventListener("abort", callback); }; }; var abortControllerWithReason = function (abortController, reason) { var signal = abortController.signal; if (signal.aborted) { return; } if (!("reason" in signal)) { Object.defineProperty(signal, "reason", { enumerable: true, value: reason, configurable: true, writable: true }); } ; abortController.abort(reason); }; // src/listenerMiddleware/exceptions.ts var task = "task"; var listener = "listener"; var completed = "completed"; var cancelled = "cancelled"; var taskCancelled = "task-" + cancelled; var taskCompleted = "task-" + completed; var listenerCancelled = listener + "-" + cancelled; var listenerCompleted = listener + "-" + completed; var TaskAbortError = /** @class */ (function () { function TaskAbortError(code) { this.code = code; this.name = "TaskAbortError"; this.message = task + " " + cancelled + " (reason: " + code + ")"; } return TaskAbortError; }()); // src/listenerMiddleware/task.ts var validateActive = function (signal) { if (signal.aborted) { throw new TaskAbortError(signal.reason); } }; function raceWithSignal(signal, promise2) { var cleanup = noop; return new Promise(function (resolve, reject) { var notifyRejection = function () { return reject(new TaskAbortError(signal.reason)); }; if (signal.aborted) { notifyRejection(); return; } cleanup = addAbortSignalListener(signal, notifyRejection); promise2.finally(function () { return cleanup(); }).then(resolve, reject); }).finally(function () { cleanup = noop; }); } var runTask = function (task2, cleanUp) { return __async(void 0, null, function () { var value, error_1; return __generator(this, function (_c) { switch (_c.label) { case 0: _c.trys.push([0, 3, 4, 5]); return [4 /*yield*/, Promise.resolve()]; case 1: _c.sent(); return [4 /*yield*/, task2()]; case 2: value = _c.sent(); return [2 /*return*/, { status: "ok", value: value }]; case 3: error_1 = _c.sent(); return [2 /*return*/, { status: error_1 instanceof TaskAbortError ? "cancelled" : "rejected", error: error_1 }]; case 4: cleanUp == null ? void 0 : cleanUp(); return [7 /*endfinally*/]; case 5: return [2 /*return*/]; } }); }); }; var createPause = function (signal) { return function (promise2) { return catchRejection(raceWithSignal(signal, promise2).then(function (output) { validateActive(signal); return output; })); }; }; var createDelay = function (signal) { var pause = createPause(signal); return function (timeoutMs) { return pause(new Promise(function (resolve) { return setTimeout(resolve, timeoutMs); })); }; }; // src/listenerMiddleware/index.ts var redux_toolkit_esm_assign = Object.assign; var INTERNAL_NIL_TOKEN = {}; var alm = "listenerMiddleware"; var createFork = function (parentAbortSignal, parentBlockingPromises) { var linkControllers = function (controller) { return addAbortSignalListener(parentAbortSignal, function () { return abortControllerWithReason(controller, parentAbortSignal.reason); }); }; return function (taskExecutor, opts) { assertFunction(taskExecutor, "taskExecutor"); var childAbortController = new AbortController(); linkControllers(childAbortController); var result = runTask(function () { return __async(void 0, null, function () { var result2; return __generator(this, function (_c) { switch (_c.label) { case 0: validateActive(parentAbortSignal); validateActive(childAbortController.signal); return [4 /*yield*/, taskExecutor({ pause: createPause(childAbortController.signal), delay: createDelay(childAbortController.signal), signal: childAbortController.signal })]; case 1: result2 = _c.sent(); validateActive(childAbortController.signal); return [2 /*return*/, result2]; } }); }); }, function () { return abortControllerWithReason(childAbortController, taskCompleted); }); if (opts == null ? void 0 : opts.autoJoin) { parentBlockingPromises.push(result); } return { result: createPause(parentAbortSignal)(result), cancel: function () { abortControllerWithReason(childAbortController, taskCancelled); } }; }; }; var createTakePattern = function (startListening, signal) { var take = function (predicate, timeout) { return __async(void 0, null, function () { var unsubscribe, tuplePromise, promises, output; return __generator(this, function (_c) { switch (_c.label) { case 0: validateActive(signal); unsubscribe = function () { }; tuplePromise = new Promise(function (resolve, reject) { var stopListening = startListening({ predicate: predicate, effect: function (action, listenerApi) { listenerApi.unsubscribe(); resolve([ action, listenerApi.getState(), listenerApi.getOriginalState() ]); } }); unsubscribe = function () { stopListening(); reject(); }; }); promises = [ tuplePromise ]; if (timeout != null) { promises.push(new Promise(function (resolve) { return setTimeout(resolve, timeout, null); })); } _c.label = 1; case 1: _c.trys.push([1, , 3, 4]); return [4 /*yield*/, raceWithSignal(signal, Promise.race(promises))]; case 2: output = _c.sent(); validateActive(signal); return [2 /*return*/, output]; case 3: unsubscribe(); return [7 /*endfinally*/]; case 4: return [2 /*return*/]; } }); }); }; return function (predicate, timeout) { return catchRejection(take(predicate, timeout)); }; }; var getListenerEntryPropsFrom = function (options) { var type = options.type, actionCreator = options.actionCreator, matcher = options.matcher, predicate = options.predicate, effect = options.effect; if (type) { predicate = createAction(type).match; } else if (actionCreator) { type = actionCreator.type; predicate = actionCreator.match; } else if (matcher) { predicate = matcher; } else if (predicate) { } else { throw new Error("Creating or removing a listener requires one of the known fields for matching an action"); } assertFunction(effect, "options.listener"); return { predicate: predicate, type: type, effect: effect }; }; var createListenerEntry = function (options) { var _c = getListenerEntryPropsFrom(options), type = _c.type, predicate = _c.predicate, effect = _c.effect; var id = nanoid(); var entry = { id: id, effect: effect, type: type, predicate: predicate, pending: new Set(), unsubscribe: function () { throw new Error("Unsubscribe not initialized"); } }; return entry; }; var cancelActiveListeners = function (entry) { entry.pending.forEach(function (controller) { abortControllerWithReason(controller, listenerCancelled); }); }; var createClearListenerMiddleware = function (listenerMap) { return function () { listenerMap.forEach(cancelActiveListeners); listenerMap.clear(); }; }; var safelyNotifyError = function (errorHandler, errorToNotify, errorInfo) { try { errorHandler(errorToNotify, errorInfo); } catch (errorHandlerError) { setTimeout(function () { throw errorHandlerError; }, 0); } }; var addListener = createAction(alm + "/add"); var clearAllListeners = createAction(alm + "/removeAll"); var removeListener = createAction(alm + "/remove"); var defaultErrorHandler = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } console.error.apply(console, __spreadArray([alm + "/error"], args)); }; function createListenerMiddleware(middlewareOptions) { var _this = this; if (middlewareOptions === void 0) { middlewareOptions = {}; } var listenerMap = new Map(); var extra = middlewareOptions.extra, _c = middlewareOptions.onError, onError = _c === void 0 ? defaultErrorHandler : _c; assertFunction(onError, "onError"); var insertEntry = function (entry) { entry.unsubscribe = function () { return listenerMap.delete(entry.id); }; listenerMap.set(entry.id, entry); return function (cancelOptions) { entry.unsubscribe(); if (cancelOptions == null ? void 0 : cancelOptions.cancelActive) { cancelActiveListeners(entry); } }; }; var findListenerEntry = function (comparator) { for (var _i = 0, _c = Array.from(listenerMap.values()); _i < _c.length; _i++) { var entry = _c[_i]; if (comparator(entry)) { return entry; } } return void 0; }; var startListening = function (options) { var entry = findListenerEntry(function (existingEntry) { return existingEntry.effect === options.effect; }); if (!entry) { entry = createListenerEntry(options); } return insertEntry(entry); }; var stopListening = function (options) { var _c = getListenerEntryPropsFrom(options), type = _c.type, effect = _c.effect, predicate = _c.predicate; var entry = findListenerEntry(function (entry2) { var matchPredicateOrType = typeof type === "string" ? entry2.type === type : entry2.predicate === predicate; return matchPredicateOrType && entry2.effect === effect; }); if (entry) { entry.unsubscribe(); if (options.cancelActive) { cancelActiveListeners(entry); } } return !!entry; }; var notifyListener = function (entry, action, api, getOriginalState) { return __async(_this, null, function () { var internalTaskController, take, autoJoinPromises, listenerError_1; return __generator(this, function (_c) { switch (_c.label) { case 0: internalTaskController = new AbortController(); take = createTakePattern(startListening, internalTaskController.signal); autoJoinPromises = []; _c.label = 1; case 1: _c.trys.push([1, 3, 4, 6]); entry.pending.add(internalTaskController); return [4 /*yield*/, Promise.resolve(entry.effect(action, redux_toolkit_esm_assign({}, api, { getOriginalState: getOriginalState, condition: function (predicate, timeout) { return take(predicate, timeout).then(Boolean); }, take: take, delay: createDelay(internalTaskController.signal), pause: createPause(internalTaskController.signal), extra: extra, signal: internalTaskController.signal, fork: createFork(internalTaskController.signal, autoJoinPromises), unsubscribe: entry.unsubscribe, subscribe: function () { listenerMap.set(entry.id, entry); }, cancelActiveListeners: function () { entry.pending.forEach(function (controller, _, set) { if (controller !== internalTaskController) { abortControllerWithReason(controller, listenerCancelled); set.delete(controller); } }); } })))]; case 2: _c.sent(); return [3 /*break*/, 6]; case 3: listenerError_1 = _c.sent(); if (!(listenerError_1 instanceof TaskAbortError)) { safelyNotifyError(onError, listenerError_1, { raisedBy: "effect" }); } return [3 /*break*/, 6]; case 4: return [4 /*yield*/, Promise.allSettled(autoJoinPromises)]; case 5: _c.sent(); abortControllerWithReason(internalTaskController, listenerCompleted); entry.pending.delete(internalTaskController); return [7 /*endfinally*/]; case 6: return [2 /*return*/]; } }); }); }; var clearListenerMiddleware = createClearListenerMiddleware(listenerMap); var middleware = function (api) { return function (next) { return function (action) { if (!isAction(action)) { return next(action); } if (addListener.match(action)) { return startListening(action.payload); } if (clearAllListeners.match(action)) { clearListenerMiddleware(); return; } if (removeListener.match(action)) { return stopListening(action.payload); } var originalState = api.getState(); var getOriginalState = function () { if (originalState === INTERNAL_NIL_TOKEN) { throw new Error(alm + ": getOriginalState can only be called synchronously"); } return originalState; }; var result; try { result = next(action); if (listenerMap.size > 0) { var currentState = api.getState(); var listenerEntries = Array.from(listenerMap.values()); for (var _i = 0, listenerEntries_1 = listenerEntries; _i < listenerEntries_1.length; _i++) { var entry = listenerEntries_1[_i]; var runListener = false; try { runListener = entry.predicate(action, currentState, originalState); } catch (predicateError) { runListener = false; safelyNotifyError(onError, predicateError, { raisedBy: "predicate" }); } if (!runListener) { continue; } notifyListener(entry, action, api, getOriginalState); } } } finally { originalState = INTERNAL_NIL_TOKEN; } return result; }; }; }; return { middleware: middleware, startListening: startListening, stopListening: stopListening, clearListeners: clearListenerMiddleware }; } // src/autoBatchEnhancer.ts var SHOULD_AUTOBATCH = "RTK_autoBatch"; var prepareAutoBatched = function () { return function (payload) { var _c; return ({ payload: payload, meta: (_c = {}, _c[SHOULD_AUTOBATCH] = true, _c) }); }; }; var promise; var queueMicrotaskShim = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : globalThis) : function (cb) { return (promise || (promise = Promise.resolve())).then(cb).catch(function (err) { return setTimeout(function () { throw err; }, 0); }); }; var createQueueWithTimer = function (timeout) { return function (notify) { setTimeout(notify, timeout); }; }; var rAF = typeof window !== "undefined" && window.requestAnimationFrame ? window.requestAnimationFrame : createQueueWithTimer(10); var autoBatchEnhancer = function (options) { if (options === void 0) { options = { type: "raf" }; } return function (next) { return function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var store = next.apply(void 0, args); var notifying = true; var shouldNotifyAtEndOfTick = false; var notificationQueued = false; var listeners = new Set(); var queueCallback = options.type === "tick" ? queueMicrotaskShim : options.type === "raf" ? rAF : options.type === "callback" ? options.queueNotification : createQueueWithTimer(options.timeout); var notifyListeners = function () { notificationQueued = false; if (shouldNotifyAtEndOfTick) { shouldNotifyAtEndOfTick = false; listeners.forEach(function (l) { return l(); }); } }; return Object.assign({}, store, { subscribe: function (listener2) { var wrappedListener = function () { return notifying && listener2(); }; var unsubscribe = store.subscribe(wrappedListener); listeners.add(listener2); return function () { unsubscribe(); listeners.delete(listener2); }; }, dispatch: function (action) { var _a; try { notifying = !((_a = action == null ? void 0 : action.meta) == null ? void 0 : _a[SHOULD_AUTOBATCH]); shouldNotifyAtEndOfTick = !notifying; if (shouldNotifyAtEndOfTick) { if (!notificationQueued) { notificationQueued = true; queueCallback(notifyListeners); } } return store.dispatch(action); } finally { notifying = true; } } }); }; }; }; // src/index.ts (0,immer_esm/* enableES5 */.rF)(); //# sourceMappingURL=redux-toolkit.esm.js.map /***/ }), /***/ 390: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ C: () => (/* binding */ copy), /* harmony export */ Cv: () => (/* binding */ identifier), /* harmony export */ G1: () => (/* binding */ position), /* harmony export */ K2: () => (/* binding */ next), /* harmony export */ Nc: () => (/* binding */ escaping), /* harmony export */ OW: () => (/* binding */ caret), /* harmony export */ Sh: () => (/* binding */ token), /* harmony export */ Tb: () => (/* binding */ delimit), /* harmony export */ Tp: () => (/* binding */ char), /* harmony export */ VF: () => (/* binding */ dealloc), /* harmony export */ YL: () => (/* binding */ prev), /* harmony export */ c4: () => (/* binding */ alloc), /* harmony export */ di: () => (/* binding */ slice), /* harmony export */ mw: () => (/* binding */ whitespace), /* harmony export */ nf: () => (/* binding */ commenter), /* harmony export */ rH: () => (/* binding */ node), /* harmony export */ se: () => (/* binding */ peek) /* harmony export */ }); /* unused harmony exports line, column, length, character, characters, tokenize, tokenizer, delimiter */ /* harmony import */ var _Utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9735); var line = 1 var column = 1 var length = 0 var position = 0 var character = 0 var characters = '' /** * @param {string} value * @param {object | null} root * @param {object | null} parent * @param {string} type * @param {string[] | string} props * @param {object[] | string} children * @param {number} length */ function node (value, root, parent, type, props, children, length) { return {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''} } /** * @param {object} root * @param {object} props * @return {object} */ function copy (root, props) { return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__/* .assign */ .kp)(node('', null, null, '', null, null, 0), root, {length: -root.length}, props) } /** * @return {number} */ function char () { return character } /** * @return {number} */ function prev () { character = position > 0 ? (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__/* .charat */ .wN)(characters, --position) : 0 if (column--, character === 10) column = 1, line-- return character } /** * @return {number} */ function next () { character = position < length ? (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__/* .charat */ .wN)(characters, position++) : 0 if (column++, character === 10) column = 1, line++ return character } /** * @return {number} */ function peek () { return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__/* .charat */ .wN)(characters, position) } /** * @return {number} */ function caret () { return position } /** * @param {number} begin * @param {number} end * @return {string} */ function slice (begin, end) { return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__/* .substr */ .c1)(characters, begin, end) } /** * @param {number} type * @return {number} */ function token (type) { switch (type) { // \0 \t \n \r \s whitespace token case 0: case 9: case 10: case 13: case 32: return 5 // ! + , / > @ ~ isolate token case 33: case 43: case 44: case 47: case 62: case 64: case 126: // ; { } breakpoint token case 59: case 123: case 125: return 4 // : accompanied token case 58: return 3 // " ' ( [ opening delimit token case 34: case 39: case 40: case 91: return 2 // ) ] closing delimit token case 41: case 93: return 1 } return 0 } /** * @param {string} value * @return {any[]} */ function alloc (value) { return line = column = 1, length = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__/* .strlen */ .b2)(characters = value), position = 0, [] } /** * @param {any} value * @return {any} */ function dealloc (value) { return characters = '', value } /** * @param {number} type * @return {string} */ function delimit (type) { return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__/* .trim */ .Bq)(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type))) } /** * @param {string} value * @return {string[]} */ function tokenize (value) { return dealloc(tokenizer(alloc(value))) } /** * @param {number} type * @return {string} */ function whitespace (type) { while (character = peek()) if (character < 33) next() else break return token(type) > 2 || token(character) > 3 ? '' : ' ' } /** * @param {string[]} children * @return {string[]} */ function tokenizer (children) { while (next()) switch (token(character)) { case 0: append(identifier(position - 1), children) break case 2: append(delimit(character), children) break default: append(from(character), children) } return children } /** * @param {number} index * @param {number} count * @return {string} */ function escaping (index, count) { while (--count && next()) // not 0-9 A-F a-f if (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97)) break return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32)) } /** * @param {number} type * @return {number} */ function delimiter (type) { while (next()) switch (character) { // ] ) " ' case type: return position // " ' case 34: case 39: if (type !== 34 && type !== 39) delimiter(character) break // ( case 40: if (type === 41) delimiter(type) break // \ case 92: next() break } return position } /** * @param {number} type * @param {number} index * @return {number} */ function commenter (type, index) { while (next()) // // if (type + character === 47 + 10) break // /* else if (type + character === 42 + 42 && peek() === 47) break return '/*' + slice(index, position - 1) + '*' + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__/* .from */ .HT)(type === 47 ? type : next()) } /** * @param {number} index * @return {string} */ function identifier (index) { while (!token(peek())) next() return slice(index, position) } /***/ }), /***/ 449: /***/ ((__unused_webpack_module, exports) => { "use strict"; exports.__esModule = true; exports["default"] = getStorage; function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function noop() {} var noopStorage = { getItem: noop, setItem: noop, removeItem: noop }; function hasStorage(storageType) { if ((typeof self === "undefined" ? "undefined" : _typeof(self)) !== 'object' || !(storageType in self)) { return false; } try { var storage = self[storageType]; var testKey = "redux-persist ".concat(storageType, " test"); storage.setItem(testKey, 'test'); storage.getItem(testKey); storage.removeItem(testKey); } catch (e) { if (false) // removed by dead control flow {} return false; } return true; } function getStorage(type) { var storageType = "".concat(type, "Storage"); if (hasStorage(storageType)) return self[storageType];else { if (false) // removed by dead control flow {} return noopStorage; } } /***/ }), /***/ 483: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (/* binding */ stringify), /* harmony export */ l: () => (/* binding */ serialize) /* harmony export */ }); /* harmony import */ var _Enum_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4534); /* harmony import */ var _Utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9735); /** * @param {object[]} children * @param {function} callback * @return {string} */ function serialize (children, callback) { var output = '' var length = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__/* .sizeof */ .FK)(children) for (var i = 0; i < length; i++) output += callback(children[i], i, children, callback) || '' return output } /** * @param {object} element * @param {number} index * @param {object[]} children * @param {function} callback * @return {string} */ function stringify (element, index, children, callback) { switch (element.type) { case _Enum_js__WEBPACK_IMPORTED_MODULE_1__/* .LAYER */ .IO: if (element.children.length) break case _Enum_js__WEBPACK_IMPORTED_MODULE_1__/* .IMPORT */ .yE: case _Enum_js__WEBPACK_IMPORTED_MODULE_1__/* .DECLARATION */ .LU: return element.return = element.return || element.value case _Enum_js__WEBPACK_IMPORTED_MODULE_1__/* .COMMENT */ .YK: return '' case _Enum_js__WEBPACK_IMPORTED_MODULE_1__/* .KEYFRAMES */ .Sv: return element.return = element.value + '{' + serialize(element.children, callback) + '}' case _Enum_js__WEBPACK_IMPORTED_MODULE_1__/* .RULESET */ .XZ: element.value = element.props.join(',') } return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__/* .strlen */ .b2)(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : '' } /***/ }), /***/ 540: /***/ ((module) => { "use strict"; /* istanbul ignore next */ function insertStyleElement(options) { var element = document.createElement("style"); options.setAttributes(element, options.attributes); options.insert(element, options.options); return element; } module.exports = insertStyleElement; /***/ }), /***/ 960: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { ZM: () => (/* reexport */ FLUSH), Hz: () => (/* reexport */ PAUSE), DY: () => (/* reexport */ PERSIST), Cq: () => (/* reexport */ PURGE), eY: () => (/* reexport */ REGISTER), r2: () => (/* reexport */ REHYDRATE), rL: () => (/* reexport */ persistReducer), GM: () => (/* reexport */ persistStore) }); // UNUSED EXPORTS: DEFAULT_VERSION, KEY_PREFIX, createMigrate, createPersistoid, createTransform, getStoredState, persistCombineReducers, purgeStoredState ;// ./node_modules/redux-persist/es/constants.js var KEY_PREFIX = 'persist:'; var FLUSH = 'persist/FLUSH'; var REHYDRATE = 'persist/REHYDRATE'; var PAUSE = 'persist/PAUSE'; var PERSIST = 'persist/PERSIST'; var PURGE = 'persist/PURGE'; var REGISTER = 'persist/REGISTER'; var DEFAULT_VERSION = -1; ;// ./node_modules/redux-persist/es/stateReconciler/autoMergeLevel1.js function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /* autoMergeLevel1: - merges 1 level of substate - skips substate if already modified */ function autoMergeLevel1(inboundState, originalState, reducedState, _ref) { var debug = _ref.debug; var newState = _objectSpread({}, reducedState); // only rehydrate if inboundState exists and is an object if (inboundState && _typeof(inboundState) === 'object') { Object.keys(inboundState).forEach(function (key) { // ignore _persist data if (key === '_persist') return; // if reducer modifies substate, skip auto rehydration if (originalState[key] !== reducedState[key]) { if (false) // removed by dead control flow {} return; } // otherwise hard set the new value newState[key] = inboundState[key]; }); } if (false) // removed by dead control flow {} return newState; } ;// ./node_modules/redux-persist/es/createPersistoid.js // @TODO remove once flow < 0.63 support is no longer required. function createPersistoid(config) { // defaults var blacklist = config.blacklist || null; var whitelist = config.whitelist || null; var transforms = config.transforms || []; var throttle = config.throttle || 0; var storageKey = "".concat(config.keyPrefix !== undefined ? config.keyPrefix : KEY_PREFIX).concat(config.key); var storage = config.storage; var serialize; if (config.serialize === false) { serialize = function serialize(x) { return x; }; } else if (typeof config.serialize === 'function') { serialize = config.serialize; } else { serialize = defaultSerialize; } var writeFailHandler = config.writeFailHandler || null; // initialize stateful values var lastState = {}; var stagedState = {}; var keysToProcess = []; var timeIterator = null; var writePromise = null; var update = function update(state) { // add any changed keys to the queue Object.keys(state).forEach(function (key) { if (!passWhitelistBlacklist(key)) return; // is keyspace ignored? noop if (lastState[key] === state[key]) return; // value unchanged? noop if (keysToProcess.indexOf(key) !== -1) return; // is key already queued? noop keysToProcess.push(key); // add key to queue }); //if any key is missing in the new state which was present in the lastState, //add it for processing too Object.keys(lastState).forEach(function (key) { if (state[key] === undefined && passWhitelistBlacklist(key) && keysToProcess.indexOf(key) === -1 && lastState[key] !== undefined) { keysToProcess.push(key); } }); // start the time iterator if not running (read: throttle) if (timeIterator === null) { timeIterator = setInterval(processNextKey, throttle); } lastState = state; }; function processNextKey() { if (keysToProcess.length === 0) { if (timeIterator) clearInterval(timeIterator); timeIterator = null; return; } var key = keysToProcess.shift(); var endState = transforms.reduce(function (subState, transformer) { return transformer.in(subState, key, lastState); }, lastState[key]); if (endState !== undefined) { try { stagedState[key] = serialize(endState); } catch (err) { console.error('redux-persist/createPersistoid: error serializing state', err); } } else { //if the endState is undefined, no need to persist the existing serialized content delete stagedState[key]; } if (keysToProcess.length === 0) { writeStagedState(); } } function writeStagedState() { // cleanup any removed keys just before write. Object.keys(stagedState).forEach(function (key) { if (lastState[key] === undefined) { delete stagedState[key]; } }); writePromise = storage.setItem(storageKey, serialize(stagedState)).catch(onWriteFail); } function passWhitelistBlacklist(key) { if (whitelist && whitelist.indexOf(key) === -1 && key !== '_persist') return false; if (blacklist && blacklist.indexOf(key) !== -1) return false; return true; } function onWriteFail(err) { // @TODO add fail handlers (typically storage full) if (writeFailHandler) writeFailHandler(err); if (err && "production" !== 'production') // removed by dead control flow {} } var flush = function flush() { while (keysToProcess.length !== 0) { processNextKey(); } return writePromise || Promise.resolve(); }; // return `persistoid` return { update: update, flush: flush }; } // @NOTE in the future this may be exposed via config function defaultSerialize(data) { return JSON.stringify(data); } ;// ./node_modules/redux-persist/es/getStoredState.js function getStoredState_getStoredState(config) { var transforms = config.transforms || []; var storageKey = "".concat(config.keyPrefix !== undefined ? config.keyPrefix : KEY_PREFIX).concat(config.key); var storage = config.storage; var debug = config.debug; var deserialize; if (config.deserialize === false) { deserialize = function deserialize(x) { return x; }; } else if (typeof config.deserialize === 'function') { deserialize = config.deserialize; } else { deserialize = defaultDeserialize; } return storage.getItem(storageKey).then(function (serialized) { if (!serialized) return undefined;else { try { var state = {}; var rawState = deserialize(serialized); Object.keys(rawState).forEach(function (key) { state[key] = transforms.reduceRight(function (subState, transformer) { return transformer.out(subState, key, rawState); }, deserialize(rawState[key])); }); return state; } catch (err) { if (false) // removed by dead control flow {} throw err; } } }); } function defaultDeserialize(serial) { return JSON.parse(serial); } ;// ./node_modules/redux-persist/es/purgeStoredState.js function purgeStoredState(config) { var storage = config.storage; var storageKey = "".concat(config.keyPrefix !== undefined ? config.keyPrefix : KEY_PREFIX).concat(config.key); return storage.removeItem(storageKey, warnIfRemoveError); } function warnIfRemoveError(err) { if (err && "production" !== 'production') // removed by dead control flow {} } ;// ./node_modules/redux-persist/es/persistReducer.js function persistReducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function persistReducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { persistReducer_ownKeys(source, true).forEach(function (key) { persistReducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { persistReducer_ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function persistReducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } var DEFAULT_TIMEOUT = 5000; /* @TODO add validation / handling for: - persisting a reducer which has nested _persist - handling actions that fire before reydrate is called */ function persistReducer(config, baseReducer) { if (false) // removed by dead control flow {} var version = config.version !== undefined ? config.version : DEFAULT_VERSION; var debug = config.debug || false; var stateReconciler = config.stateReconciler === undefined ? autoMergeLevel1 : config.stateReconciler; var getStoredState = config.getStoredState || getStoredState_getStoredState; var timeout = config.timeout !== undefined ? config.timeout : DEFAULT_TIMEOUT; var _persistoid = null; var _purge = false; var _paused = true; var conditionalUpdate = function conditionalUpdate(state) { // update the persistoid only if we are rehydrated and not paused state._persist.rehydrated && _persistoid && !_paused && _persistoid.update(state); return state; }; return function (state, action) { var _ref = state || {}, _persist = _ref._persist, rest = _objectWithoutProperties(_ref, ["_persist"]); // $FlowIgnore need to update State type var restState = rest; if (action.type === PERSIST) { var _sealed = false; var _rehydrate = function _rehydrate(payload, err) { // dev warning if we are already sealed if (false) // removed by dead control flow {} // only rehydrate if we are not already sealed if (!_sealed) { action.rehydrate(config.key, payload, err); _sealed = true; } }; timeout && setTimeout(function () { !_sealed && _rehydrate(undefined, new Error("redux-persist: persist timed out for persist key \"".concat(config.key, "\""))); }, timeout); // @NOTE PERSIST resumes if paused. _paused = false; // @NOTE only ever create persistoid once, ensure we call it at least once, even if _persist has already been set if (!_persistoid) _persistoid = createPersistoid(config); // @NOTE PERSIST can be called multiple times, noop after the first if (_persist) { // We still need to call the base reducer because there might be nested // uses of persistReducer which need to be aware of the PERSIST action return persistReducer_objectSpread({}, baseReducer(restState, action), { _persist: _persist }); } if (typeof action.rehydrate !== 'function' || typeof action.register !== 'function') throw new Error('redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.'); action.register(config.key); getStoredState(config).then(function (restoredState) { var migrate = config.migrate || function (s, v) { return Promise.resolve(s); }; migrate(restoredState, version).then(function (migratedState) { _rehydrate(migratedState); }, function (migrateErr) { if (false) // removed by dead control flow {} _rehydrate(undefined, migrateErr); }); }, function (err) { _rehydrate(undefined, err); }); return persistReducer_objectSpread({}, baseReducer(restState, action), { _persist: { version: version, rehydrated: false } }); } else if (action.type === PURGE) { _purge = true; action.result(purgeStoredState(config)); return persistReducer_objectSpread({}, baseReducer(restState, action), { _persist: _persist }); } else if (action.type === FLUSH) { action.result(_persistoid && _persistoid.flush()); return persistReducer_objectSpread({}, baseReducer(restState, action), { _persist: _persist }); } else if (action.type === PAUSE) { _paused = true; } else if (action.type === REHYDRATE) { // noop on restState if purging if (_purge) return persistReducer_objectSpread({}, restState, { _persist: persistReducer_objectSpread({}, _persist, { rehydrated: true }) // @NOTE if key does not match, will continue to default else below }); if (action.key === config.key) { var reducedState = baseReducer(restState, action); var inboundState = action.payload; // only reconcile state if stateReconciler and inboundState are both defined var reconciledRest = stateReconciler !== false && inboundState !== undefined ? stateReconciler(inboundState, state, reducedState, config) : reducedState; var _newState = persistReducer_objectSpread({}, reconciledRest, { _persist: persistReducer_objectSpread({}, _persist, { rehydrated: true }) }); return conditionalUpdate(_newState); } } // if we have not already handled PERSIST, straight passthrough if (!_persist) return baseReducer(state, action); // run base reducer: // is state modified ? return original : return updated var newState = baseReducer(restState, action); if (newState === restState) return state; return conditionalUpdate(persistReducer_objectSpread({}, newState, { _persist: _persist })); }; } // EXTERNAL MODULE: ./node_modules/redux/es/redux.js var redux = __webpack_require__(2960); ;// ./node_modules/redux-persist/es/persistStore.js function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } function persistStore_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function persistStore_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { persistStore_ownKeys(source, true).forEach(function (key) { persistStore_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { persistStore_ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function persistStore_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; } var initialState = { registry: [], bootstrapped: false }; var persistorReducer = function persistorReducer() { var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; var action = arguments.length > 1 ? arguments[1] : undefined; switch (action.type) { case REGISTER: return persistStore_objectSpread({}, state, { registry: [].concat(_toConsumableArray(state.registry), [action.key]) }); case REHYDRATE: var firstIndex = state.registry.indexOf(action.key); var registry = _toConsumableArray(state.registry); registry.splice(firstIndex, 1); return persistStore_objectSpread({}, state, { registry: registry, bootstrapped: registry.length === 0 }); default: return state; } }; function persistStore(store, options, cb) { // help catch incorrect usage of passing PersistConfig in as PersistorOptions if (false) // removed by dead control flow { var bannedKeys, optionsToTest; } var boostrappedCb = cb || false; var _pStore = (0,redux/* createStore */.y$)(persistorReducer, initialState, options && options.enhancer ? options.enhancer : undefined); var register = function register(key) { _pStore.dispatch({ type: REGISTER, key: key }); }; var rehydrate = function rehydrate(key, payload, err) { var rehydrateAction = { type: REHYDRATE, payload: payload, err: err, key: key // dispatch to `store` to rehydrate and `persistor` to track result }; store.dispatch(rehydrateAction); _pStore.dispatch(rehydrateAction); if (boostrappedCb && persistor.getState().bootstrapped) { boostrappedCb(); boostrappedCb = false; } }; var persistor = persistStore_objectSpread({}, _pStore, { purge: function purge() { var results = []; store.dispatch({ type: PURGE, result: function result(purgeResult) { results.push(purgeResult); } }); return Promise.all(results); }, flush: function flush() { var results = []; store.dispatch({ type: FLUSH, result: function result(flushResult) { results.push(flushResult); } }); return Promise.all(results); }, pause: function pause() { store.dispatch({ type: PAUSE }); }, persist: function persist() { store.dispatch({ type: PERSIST, register: register, rehydrate: rehydrate }); } }); if (!(options && options.manualPersist)) { persistor.persist(); } return persistor; } ;// ./node_modules/redux-persist/es/index.js /***/ }), /***/ 1113: /***/ ((module) => { "use strict"; /* istanbul ignore next */ function styleTagTransform(css, styleElement) { if (styleElement.styleSheet) { styleElement.styleSheet.cssText = css; } else { while (styleElement.firstChild) { styleElement.removeChild(styleElement.firstChild); } styleElement.appendChild(document.createTextNode(css)); } } module.exports = styleTagTransform; /***/ }), /***/ 1174: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { E: () => (/* binding */ Text) }); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(6540); // EXTERNAL MODULE: ./node_modules/lodash/isNil.js var isNil = __webpack_require__(9843); var isNil_default = /*#__PURE__*/__webpack_require__.n(isNil); // EXTERNAL MODULE: ./node_modules/recharts/node_modules/clsx/dist/clsx.mjs var clsx = __webpack_require__(8804); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/DataUtils.js var DataUtils = __webpack_require__(9744); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/Global.js var Global = __webpack_require__(9938); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/ReactUtils.js var ReactUtils = __webpack_require__(4501); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/DOMUtils.js var DOMUtils = __webpack_require__(1636); ;// ./node_modules/recharts/es6/util/ReduceCSSCalc.js function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } 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, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } var MULTIPLY_OR_DIVIDE_REGEX = /(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/; var ADD_OR_SUBTRACT_REGEX = /(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/; var CSS_LENGTH_UNIT_REGEX = /^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/; var NUM_SPLIT_REGEX = /(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/; var CONVERSION_RATES = { cm: 96 / 2.54, mm: 96 / 25.4, pt: 96 / 72, pc: 96 / 6, "in": 96, Q: 96 / (2.54 * 40), px: 1 }; var FIXED_CSS_LENGTH_UNITS = Object.keys(CONVERSION_RATES); var STR_NAN = 'NaN'; function convertToPx(value, unit) { return value * CONVERSION_RATES[unit]; } var DecimalCSS = /*#__PURE__*/function () { function DecimalCSS(num, unit) { _classCallCheck(this, DecimalCSS); this.num = num; this.unit = unit; this.num = num; this.unit = unit; if (Number.isNaN(num)) { this.unit = ''; } if (unit !== '' && !CSS_LENGTH_UNIT_REGEX.test(unit)) { this.num = NaN; this.unit = ''; } if (FIXED_CSS_LENGTH_UNITS.includes(unit)) { this.num = convertToPx(num, unit); this.unit = 'px'; } } return _createClass(DecimalCSS, [{ key: "add", value: function add(other) { if (this.unit !== other.unit) { return new DecimalCSS(NaN, ''); } return new DecimalCSS(this.num + other.num, this.unit); } }, { key: "subtract", value: function subtract(other) { if (this.unit !== other.unit) { return new DecimalCSS(NaN, ''); } return new DecimalCSS(this.num - other.num, this.unit); } }, { key: "multiply", value: function multiply(other) { if (this.unit !== '' && other.unit !== '' && this.unit !== other.unit) { return new DecimalCSS(NaN, ''); } return new DecimalCSS(this.num * other.num, this.unit || other.unit); } }, { key: "divide", value: function divide(other) { if (this.unit !== '' && other.unit !== '' && this.unit !== other.unit) { return new DecimalCSS(NaN, ''); } return new DecimalCSS(this.num / other.num, this.unit || other.unit); } }, { key: "toString", value: function toString() { return "".concat(this.num).concat(this.unit); } }, { key: "isNaN", value: function isNaN() { return Number.isNaN(this.num); } }], [{ key: "parse", value: function parse(str) { var _NUM_SPLIT_REGEX$exec; var _ref = (_NUM_SPLIT_REGEX$exec = NUM_SPLIT_REGEX.exec(str)) !== null && _NUM_SPLIT_REGEX$exec !== void 0 ? _NUM_SPLIT_REGEX$exec : [], _ref2 = _slicedToArray(_ref, 3), numStr = _ref2[1], unit = _ref2[2]; return new DecimalCSS(parseFloat(numStr), unit !== null && unit !== void 0 ? unit : ''); } }]); }(); function calculateArithmetic(expr) { if (expr.includes(STR_NAN)) { return STR_NAN; } var newExpr = expr; while (newExpr.includes('*') || newExpr.includes('/')) { var _MULTIPLY_OR_DIVIDE_R; var _ref3 = (_MULTIPLY_OR_DIVIDE_R = MULTIPLY_OR_DIVIDE_REGEX.exec(newExpr)) !== null && _MULTIPLY_OR_DIVIDE_R !== void 0 ? _MULTIPLY_OR_DIVIDE_R : [], _ref4 = _slicedToArray(_ref3, 4), leftOperand = _ref4[1], operator = _ref4[2], rightOperand = _ref4[3]; var lTs = DecimalCSS.parse(leftOperand !== null && leftOperand !== void 0 ? leftOperand : ''); var rTs = DecimalCSS.parse(rightOperand !== null && rightOperand !== void 0 ? rightOperand : ''); var result = operator === '*' ? lTs.multiply(rTs) : lTs.divide(rTs); if (result.isNaN()) { return STR_NAN; } newExpr = newExpr.replace(MULTIPLY_OR_DIVIDE_REGEX, result.toString()); } while (newExpr.includes('+') || /.-\d+(?:\.\d+)?/.test(newExpr)) { var _ADD_OR_SUBTRACT_REGE; var _ref5 = (_ADD_OR_SUBTRACT_REGE = ADD_OR_SUBTRACT_REGEX.exec(newExpr)) !== null && _ADD_OR_SUBTRACT_REGE !== void 0 ? _ADD_OR_SUBTRACT_REGE : [], _ref6 = _slicedToArray(_ref5, 4), _leftOperand = _ref6[1], _operator = _ref6[2], _rightOperand = _ref6[3]; var _lTs = DecimalCSS.parse(_leftOperand !== null && _leftOperand !== void 0 ? _leftOperand : ''); var _rTs = DecimalCSS.parse(_rightOperand !== null && _rightOperand !== void 0 ? _rightOperand : ''); var _result = _operator === '+' ? _lTs.add(_rTs) : _lTs.subtract(_rTs); if (_result.isNaN()) { return STR_NAN; } newExpr = newExpr.replace(ADD_OR_SUBTRACT_REGEX, _result.toString()); } return newExpr; } var PARENTHESES_REGEX = /\(([^()]*)\)/; function calculateParentheses(expr) { var newExpr = expr; while (newExpr.includes('(')) { var _PARENTHESES_REGEX$ex = PARENTHESES_REGEX.exec(newExpr), _PARENTHESES_REGEX$ex2 = _slicedToArray(_PARENTHESES_REGEX$ex, 2), parentheticalExpression = _PARENTHESES_REGEX$ex2[1]; newExpr = newExpr.replace(PARENTHESES_REGEX, calculateArithmetic(parentheticalExpression)); } return newExpr; } function evaluateExpression(expression) { var newExpr = expression.replace(/\s+/g, ''); newExpr = calculateParentheses(newExpr); newExpr = calculateArithmetic(newExpr); return newExpr; } function safeEvaluateExpression(expression) { try { return evaluateExpression(expression); } catch (e) { /* istanbul ignore next */ return STR_NAN; } } function reduceCSSCalc(expression) { var result = safeEvaluateExpression(expression.slice(5, -1)); if (result === STR_NAN) { // notify the user return ''; } return result; } ;// ./node_modules/recharts/es6/component/Text.js var _excluded = ["x", "y", "lineHeight", "capHeight", "scaleToFit", "textAnchor", "verticalAnchor", "fill"], _excluded2 = ["dx", "dy", "angle", "className", "breakAll"]; function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; } function Text_slicedToArray(arr, i) { return Text_arrayWithHoles(arr) || Text_iterableToArrayLimit(arr, i) || Text_unsupportedIterableToArray(arr, i) || Text_nonIterableRest(); } function Text_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function Text_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Text_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Text_arrayLikeToArray(o, minLen); } function Text_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function Text_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } function Text_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } var BREAKING_SPACES = /[ \f\n\r\t\v\u2028\u2029]+/; var calculateWordWidths = function calculateWordWidths(_ref) { var children = _ref.children, breakAll = _ref.breakAll, style = _ref.style; try { var words = []; if (!isNil_default()(children)) { if (breakAll) { words = children.toString().split(''); } else { words = children.toString().split(BREAKING_SPACES); } } var wordsWithComputedWidth = words.map(function (word) { return { word: word, width: (0,DOMUtils/* getStringSize */.Pu)(word, style).width }; }); var spaceWidth = breakAll ? 0 : (0,DOMUtils/* getStringSize */.Pu)("\xA0", style).width; return { wordsWithComputedWidth: wordsWithComputedWidth, spaceWidth: spaceWidth }; } catch (e) { return null; } }; var calculateWordsByLines = function calculateWordsByLines(_ref2, initialWordsWithComputedWith, spaceWidth, lineWidth, scaleToFit) { var maxLines = _ref2.maxLines, children = _ref2.children, style = _ref2.style, breakAll = _ref2.breakAll; var shouldLimitLines = (0,DataUtils/* isNumber */.Et)(maxLines); var text = children; var calculate = function calculate() { var words = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; return words.reduce(function (result, _ref3) { var word = _ref3.word, width = _ref3.width; var currentLine = result[result.length - 1]; if (currentLine && (lineWidth == null || scaleToFit || currentLine.width + width + spaceWidth < Number(lineWidth))) { // Word can be added to an existing line currentLine.words.push(word); currentLine.width += width + spaceWidth; } else { // Add first word to line or word is too long to scaleToFit on existing line var newLine = { words: [word], width: width }; result.push(newLine); } return result; }, []); }; var originalResult = calculate(initialWordsWithComputedWith); var findLongestLine = function findLongestLine(words) { return words.reduce(function (a, b) { return a.width > b.width ? a : b; }); }; if (!shouldLimitLines) { return originalResult; } var suffix = '…'; var checkOverflow = function checkOverflow(index) { var tempText = text.slice(0, index); var words = calculateWordWidths({ breakAll: breakAll, style: style, children: tempText + suffix }).wordsWithComputedWidth; var result = calculate(words); var doesOverflow = result.length > maxLines || findLongestLine(result).width > Number(lineWidth); return [doesOverflow, result]; }; var start = 0; var end = text.length - 1; var iterations = 0; var trimmedResult; while (start <= end && iterations <= text.length - 1) { var middle = Math.floor((start + end) / 2); var prev = middle - 1; var _checkOverflow = checkOverflow(prev), _checkOverflow2 = Text_slicedToArray(_checkOverflow, 2), doesPrevOverflow = _checkOverflow2[0], result = _checkOverflow2[1]; var _checkOverflow3 = checkOverflow(middle), _checkOverflow4 = Text_slicedToArray(_checkOverflow3, 1), doesMiddleOverflow = _checkOverflow4[0]; if (!doesPrevOverflow && !doesMiddleOverflow) { start = middle + 1; } if (doesPrevOverflow && doesMiddleOverflow) { end = middle - 1; } if (!doesPrevOverflow && doesMiddleOverflow) { trimmedResult = result; break; } iterations++; } // Fallback to originalResult (result without trimming) if we cannot find the // where to trim. This should not happen :tm: return trimmedResult || originalResult; }; var getWordsWithoutCalculate = function getWordsWithoutCalculate(children) { var words = !isNil_default()(children) ? children.toString().split(BREAKING_SPACES) : []; return [{ words: words }]; }; var getWordsByLines = function getWordsByLines(_ref4) { var width = _ref4.width, scaleToFit = _ref4.scaleToFit, children = _ref4.children, style = _ref4.style, breakAll = _ref4.breakAll, maxLines = _ref4.maxLines; // Only perform calculations if using features that require them (multiline, scaleToFit) if ((width || scaleToFit) && !Global/* Global */.m.isSsr) { var wordsWithComputedWidth, spaceWidth; var wordWidths = calculateWordWidths({ breakAll: breakAll, children: children, style: style }); if (wordWidths) { var wcw = wordWidths.wordsWithComputedWidth, sw = wordWidths.spaceWidth; wordsWithComputedWidth = wcw; spaceWidth = sw; } else { return getWordsWithoutCalculate(children); } return calculateWordsByLines({ breakAll: breakAll, children: children, maxLines: maxLines, style: style }, wordsWithComputedWidth, spaceWidth, width, scaleToFit); } return getWordsWithoutCalculate(children); }; var DEFAULT_FILL = '#808080'; var Text = function Text(_ref5) { var _ref5$x = _ref5.x, propsX = _ref5$x === void 0 ? 0 : _ref5$x, _ref5$y = _ref5.y, propsY = _ref5$y === void 0 ? 0 : _ref5$y, _ref5$lineHeight = _ref5.lineHeight, lineHeight = _ref5$lineHeight === void 0 ? '1em' : _ref5$lineHeight, _ref5$capHeight = _ref5.capHeight, capHeight = _ref5$capHeight === void 0 ? '0.71em' : _ref5$capHeight, _ref5$scaleToFit = _ref5.scaleToFit, scaleToFit = _ref5$scaleToFit === void 0 ? false : _ref5$scaleToFit, _ref5$textAnchor = _ref5.textAnchor, textAnchor = _ref5$textAnchor === void 0 ? 'start' : _ref5$textAnchor, _ref5$verticalAnchor = _ref5.verticalAnchor, verticalAnchor = _ref5$verticalAnchor === void 0 ? 'end' : _ref5$verticalAnchor, _ref5$fill = _ref5.fill, fill = _ref5$fill === void 0 ? DEFAULT_FILL : _ref5$fill, props = _objectWithoutProperties(_ref5, _excluded); var wordsByLines = (0,react.useMemo)(function () { return getWordsByLines({ breakAll: props.breakAll, children: props.children, maxLines: props.maxLines, scaleToFit: scaleToFit, style: props.style, width: props.width }); }, [props.breakAll, props.children, props.maxLines, scaleToFit, props.style, props.width]); var dx = props.dx, dy = props.dy, angle = props.angle, className = props.className, breakAll = props.breakAll, textProps = _objectWithoutProperties(props, _excluded2); if (!(0,DataUtils/* isNumOrStr */.vh)(propsX) || !(0,DataUtils/* isNumOrStr */.vh)(propsY)) { return null; } var x = propsX + ((0,DataUtils/* isNumber */.Et)(dx) ? dx : 0); var y = propsY + ((0,DataUtils/* isNumber */.Et)(dy) ? dy : 0); var startDy; switch (verticalAnchor) { case 'start': startDy = reduceCSSCalc("calc(".concat(capHeight, ")")); break; case 'middle': startDy = reduceCSSCalc("calc(".concat((wordsByLines.length - 1) / 2, " * -").concat(lineHeight, " + (").concat(capHeight, " / 2))")); break; default: startDy = reduceCSSCalc("calc(".concat(wordsByLines.length - 1, " * -").concat(lineHeight, ")")); break; } var transforms = []; if (scaleToFit) { var lineWidth = wordsByLines[0].width; var width = props.width; transforms.push("scale(".concat(((0,DataUtils/* isNumber */.Et)(width) ? width / lineWidth : 1) / lineWidth, ")")); } if (angle) { transforms.push("rotate(".concat(angle, ", ").concat(x, ", ").concat(y, ")")); } if (transforms.length) { textProps.transform = transforms.join(' '); } return /*#__PURE__*/react.createElement("text", _extends({}, (0,ReactUtils/* filterProps */.J9)(textProps, true), { x: x, y: y, className: (0,clsx/* default */.A)('recharts-text', className), textAnchor: textAnchor, fill: fill.includes('url') ? DEFAULT_FILL : fill }), wordsByLines.map(function (line, index) { var words = line.words.join(breakAll ? '' : ' '); return ( /*#__PURE__*/ // duplicate words will cause duplicate keys // eslint-disable-next-line react/no-array-index-key react.createElement("tspan", { x: x, dy: index === 0 ? startDy : lineHeight, key: "".concat(words, "-").concat(index) }, words) ); })); }; /***/ }), /***/ 1215: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; exports.__esModule = true; exports["default"] = createWebStorage; var _getStorage = _interopRequireDefault(__webpack_require__(449)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function createWebStorage(type) { var storage = (0, _getStorage.default)(type); return { getItem: function getItem(key) { return new Promise(function (resolve, reject) { resolve(storage.getItem(key)); }); }, setItem: function setItem(key, item) { return new Promise(function (resolve, reject) { resolve(storage.setItem(key, item)); }); }, removeItem: function removeItem(key) { return new Promise(function (resolve, reject) { resolve(storage.removeItem(key)); }); } }; } /***/ }), /***/ 1636: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A3: () => (/* binding */ getOffset), /* harmony export */ Pu: () => (/* binding */ getStringSize) /* harmony export */ }); /* unused harmony export getStyleString */ /* harmony import */ var _Global__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9938); function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } var stringCache = { widthCache: {}, cacheCount: 0 }; var MAX_CACHE_NUM = 2000; var SPAN_STYLE = { position: 'absolute', top: '-20000px', left: 0, padding: 0, margin: 0, border: 'none', whiteSpace: 'pre' }; var STYLE_LIST = (/* unused pure expression or super */ null && (['minWidth', 'maxWidth', 'width', 'minHeight', 'maxHeight', 'height', 'top', 'left', 'fontSize', 'lineHeight', 'padding', 'margin', 'paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom', 'marginLeft', 'marginRight', 'marginTop', 'marginBottom'])); var MEASUREMENT_SPAN_ID = 'recharts_measurement_span'; function autoCompleteStyle(name, value) { if (STYLE_LIST.indexOf(name) >= 0 && value === +value) { return "".concat(value, "px"); } return value; } function camelToMiddleLine(text) { var strs = text.split(''); var formatStrs = strs.reduce(function (result, entry) { if (entry === entry.toUpperCase()) { return [].concat(_toConsumableArray(result), ['-', entry.toLowerCase()]); } return [].concat(_toConsumableArray(result), [entry]); }, []); return formatStrs.join(''); } var getStyleString = function getStyleString(style) { return Object.keys(style).reduce(function (result, s) { return "".concat(result).concat(camelToMiddleLine(s), ":").concat(autoCompleteStyle(s, style[s]), ";"); }, ''); }; function removeInvalidKeys(obj) { var copyObj = _objectSpread({}, obj); Object.keys(copyObj).forEach(function (key) { if (!copyObj[key]) { delete copyObj[key]; } }); return copyObj; } var getStringSize = function getStringSize(text) { var style = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; if (text === undefined || text === null || _Global__WEBPACK_IMPORTED_MODULE_0__/* .Global */ .m.isSsr) { return { width: 0, height: 0 }; } var copyStyle = removeInvalidKeys(style); var cacheKey = JSON.stringify({ text: text, copyStyle: copyStyle }); if (stringCache.widthCache[cacheKey]) { return stringCache.widthCache[cacheKey]; } try { var measurementSpan = document.getElementById(MEASUREMENT_SPAN_ID); if (!measurementSpan) { measurementSpan = document.createElement('span'); measurementSpan.setAttribute('id', MEASUREMENT_SPAN_ID); measurementSpan.setAttribute('aria-hidden', 'true'); document.body.appendChild(measurementSpan); } // Need to use CSS Object Model (CSSOM) to be able to comply with Content Security Policy (CSP) // https://en.wikipedia.org/wiki/Content_Security_Policy var measurementSpanStyle = _objectSpread(_objectSpread({}, SPAN_STYLE), copyStyle); Object.assign(measurementSpan.style, measurementSpanStyle); measurementSpan.textContent = "".concat(text); var rect = measurementSpan.getBoundingClientRect(); var result = { width: rect.width, height: rect.height }; stringCache.widthCache[cacheKey] = result; if (++stringCache.cacheCount > MAX_CACHE_NUM) { stringCache.cacheCount = 0; stringCache.widthCache = {}; } return result; } catch (e) { return { width: 0, height: 0 }; } }; var getOffset = function getOffset(rect) { return { top: rect.top + window.scrollY - document.documentElement.clientTop, left: rect.left + window.scrollX - document.documentElement.clientLeft }; }; /***/ }), /***/ 1706: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ J: () => (/* binding */ Label) /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6540); /* harmony import */ var lodash_isNil__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9843); /* harmony import */ var lodash_isNil__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_isNil__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var lodash_isFunction__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1882); /* harmony import */ var lodash_isFunction__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_isFunction__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3805); /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_isObject__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(8804); /* harmony import */ var _Text__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(1174); /* harmony import */ var _util_ReactUtils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(4501); /* harmony import */ var _util_DataUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9744); /* harmony import */ var _util_PolarUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4040); function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } var _excluded = ["offset"]; function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; } function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); } var getLabel = function getLabel(props) { var value = props.value, formatter = props.formatter; var label = lodash_isNil__WEBPACK_IMPORTED_MODULE_1___default()(props.children) ? value : props.children; if (lodash_isFunction__WEBPACK_IMPORTED_MODULE_2___default()(formatter)) { return formatter(label); } return label; }; var getDeltaAngle = function getDeltaAngle(startAngle, endAngle) { var sign = (0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_4__/* .mathSign */ .sA)(endAngle - startAngle); var deltaAngle = Math.min(Math.abs(endAngle - startAngle), 360); return sign * deltaAngle; }; var renderRadialLabel = function renderRadialLabel(labelProps, label, attrs) { var position = labelProps.position, viewBox = labelProps.viewBox, offset = labelProps.offset, className = labelProps.className; var _ref = viewBox, cx = _ref.cx, cy = _ref.cy, innerRadius = _ref.innerRadius, outerRadius = _ref.outerRadius, startAngle = _ref.startAngle, endAngle = _ref.endAngle, clockWise = _ref.clockWise; var radius = (innerRadius + outerRadius) / 2; var deltaAngle = getDeltaAngle(startAngle, endAngle); var sign = deltaAngle >= 0 ? 1 : -1; var labelAngle, direction; if (position === 'insideStart') { labelAngle = startAngle + sign * offset; direction = clockWise; } else if (position === 'insideEnd') { labelAngle = endAngle - sign * offset; direction = !clockWise; } else if (position === 'end') { labelAngle = endAngle + sign * offset; direction = clockWise; } direction = deltaAngle <= 0 ? direction : !direction; var startPoint = (0,_util_PolarUtils__WEBPACK_IMPORTED_MODULE_5__/* .polarToCartesian */ .IZ)(cx, cy, radius, labelAngle); var endPoint = (0,_util_PolarUtils__WEBPACK_IMPORTED_MODULE_5__/* .polarToCartesian */ .IZ)(cx, cy, radius, labelAngle + (direction ? 1 : -1) * 359); var path = "M".concat(startPoint.x, ",").concat(startPoint.y, "\n A").concat(radius, ",").concat(radius, ",0,1,").concat(direction ? 0 : 1, ",\n ").concat(endPoint.x, ",").concat(endPoint.y); var id = lodash_isNil__WEBPACK_IMPORTED_MODULE_1___default()(labelProps.id) ? (0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_4__/* .uniqueId */ .NF)('recharts-radial-line-') : labelProps.id; return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("text", _extends({}, attrs, { dominantBaseline: "central", className: (0,clsx__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .A)('recharts-radial-bar-label', className) }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("defs", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { id: id, d: path })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("textPath", { xlinkHref: "#".concat(id) }, label)); }; var getAttrsOfPolarLabel = function getAttrsOfPolarLabel(props) { var viewBox = props.viewBox, offset = props.offset, position = props.position; var _ref2 = viewBox, cx = _ref2.cx, cy = _ref2.cy, innerRadius = _ref2.innerRadius, outerRadius = _ref2.outerRadius, startAngle = _ref2.startAngle, endAngle = _ref2.endAngle; var midAngle = (startAngle + endAngle) / 2; if (position === 'outside') { var _polarToCartesian = (0,_util_PolarUtils__WEBPACK_IMPORTED_MODULE_5__/* .polarToCartesian */ .IZ)(cx, cy, outerRadius + offset, midAngle), _x = _polarToCartesian.x, _y = _polarToCartesian.y; return { x: _x, y: _y, textAnchor: _x >= cx ? 'start' : 'end', verticalAnchor: 'middle' }; } if (position === 'center') { return { x: cx, y: cy, textAnchor: 'middle', verticalAnchor: 'middle' }; } if (position === 'centerTop') { return { x: cx, y: cy, textAnchor: 'middle', verticalAnchor: 'start' }; } if (position === 'centerBottom') { return { x: cx, y: cy, textAnchor: 'middle', verticalAnchor: 'end' }; } var r = (innerRadius + outerRadius) / 2; var _polarToCartesian2 = (0,_util_PolarUtils__WEBPACK_IMPORTED_MODULE_5__/* .polarToCartesian */ .IZ)(cx, cy, r, midAngle), x = _polarToCartesian2.x, y = _polarToCartesian2.y; return { x: x, y: y, textAnchor: 'middle', verticalAnchor: 'middle' }; }; var getAttrsOfCartesianLabel = function getAttrsOfCartesianLabel(props) { var viewBox = props.viewBox, parentViewBox = props.parentViewBox, offset = props.offset, position = props.position; var _ref3 = viewBox, x = _ref3.x, y = _ref3.y, width = _ref3.width, height = _ref3.height; // Define vertical offsets and position inverts based on the value being positive or negative var verticalSign = height >= 0 ? 1 : -1; var verticalOffset = verticalSign * offset; var verticalEnd = verticalSign > 0 ? 'end' : 'start'; var verticalStart = verticalSign > 0 ? 'start' : 'end'; // Define horizontal offsets and position inverts based on the value being positive or negative var horizontalSign = width >= 0 ? 1 : -1; var horizontalOffset = horizontalSign * offset; var horizontalEnd = horizontalSign > 0 ? 'end' : 'start'; var horizontalStart = horizontalSign > 0 ? 'start' : 'end'; if (position === 'top') { var attrs = { x: x + width / 2, y: y - verticalSign * offset, textAnchor: 'middle', verticalAnchor: verticalEnd }; return _objectSpread(_objectSpread({}, attrs), parentViewBox ? { height: Math.max(y - parentViewBox.y, 0), width: width } : {}); } if (position === 'bottom') { var _attrs = { x: x + width / 2, y: y + height + verticalOffset, textAnchor: 'middle', verticalAnchor: verticalStart }; return _objectSpread(_objectSpread({}, _attrs), parentViewBox ? { height: Math.max(parentViewBox.y + parentViewBox.height - (y + height), 0), width: width } : {}); } if (position === 'left') { var _attrs2 = { x: x - horizontalOffset, y: y + height / 2, textAnchor: horizontalEnd, verticalAnchor: 'middle' }; return _objectSpread(_objectSpread({}, _attrs2), parentViewBox ? { width: Math.max(_attrs2.x - parentViewBox.x, 0), height: height } : {}); } if (position === 'right') { var _attrs3 = { x: x + width + horizontalOffset, y: y + height / 2, textAnchor: horizontalStart, verticalAnchor: 'middle' }; return _objectSpread(_objectSpread({}, _attrs3), parentViewBox ? { width: Math.max(parentViewBox.x + parentViewBox.width - _attrs3.x, 0), height: height } : {}); } var sizeAttrs = parentViewBox ? { width: width, height: height } : {}; if (position === 'insideLeft') { return _objectSpread({ x: x + horizontalOffset, y: y + height / 2, textAnchor: horizontalStart, verticalAnchor: 'middle' }, sizeAttrs); } if (position === 'insideRight') { return _objectSpread({ x: x + width - horizontalOffset, y: y + height / 2, textAnchor: horizontalEnd, verticalAnchor: 'middle' }, sizeAttrs); } if (position === 'insideTop') { return _objectSpread({ x: x + width / 2, y: y + verticalOffset, textAnchor: 'middle', verticalAnchor: verticalStart }, sizeAttrs); } if (position === 'insideBottom') { return _objectSpread({ x: x + width / 2, y: y + height - verticalOffset, textAnchor: 'middle', verticalAnchor: verticalEnd }, sizeAttrs); } if (position === 'insideTopLeft') { return _objectSpread({ x: x + horizontalOffset, y: y + verticalOffset, textAnchor: horizontalStart, verticalAnchor: verticalStart }, sizeAttrs); } if (position === 'insideTopRight') { return _objectSpread({ x: x + width - horizontalOffset, y: y + verticalOffset, textAnchor: horizontalEnd, verticalAnchor: verticalStart }, sizeAttrs); } if (position === 'insideBottomLeft') { return _objectSpread({ x: x + horizontalOffset, y: y + height - verticalOffset, textAnchor: horizontalStart, verticalAnchor: verticalEnd }, sizeAttrs); } if (position === 'insideBottomRight') { return _objectSpread({ x: x + width - horizontalOffset, y: y + height - verticalOffset, textAnchor: horizontalEnd, verticalAnchor: verticalEnd }, sizeAttrs); } if (lodash_isObject__WEBPACK_IMPORTED_MODULE_3___default()(position) && ((0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_4__/* .isNumber */ .Et)(position.x) || (0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_4__/* .isPercent */ ._3)(position.x)) && ((0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_4__/* .isNumber */ .Et)(position.y) || (0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_4__/* .isPercent */ ._3)(position.y))) { return _objectSpread({ x: x + (0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_4__/* .getPercentValue */ .F4)(position.x, width), y: y + (0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_4__/* .getPercentValue */ .F4)(position.y, height), textAnchor: 'end', verticalAnchor: 'end' }, sizeAttrs); } return _objectSpread({ x: x + width / 2, y: y + height / 2, textAnchor: 'middle', verticalAnchor: 'middle' }, sizeAttrs); }; var isPolar = function isPolar(viewBox) { return 'cx' in viewBox && (0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_4__/* .isNumber */ .Et)(viewBox.cx); }; function Label(_ref4) { var _ref4$offset = _ref4.offset, offset = _ref4$offset === void 0 ? 5 : _ref4$offset, restProps = _objectWithoutProperties(_ref4, _excluded); var props = _objectSpread({ offset: offset }, restProps); var viewBox = props.viewBox, position = props.position, value = props.value, children = props.children, content = props.content, _props$className = props.className, className = _props$className === void 0 ? '' : _props$className, textBreakAll = props.textBreakAll; if (!viewBox || lodash_isNil__WEBPACK_IMPORTED_MODULE_1___default()(value) && lodash_isNil__WEBPACK_IMPORTED_MODULE_1___default()(children) && ! /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.isValidElement)(content) && !lodash_isFunction__WEBPACK_IMPORTED_MODULE_2___default()(content)) { return null; } if ( /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.isValidElement)(content)) { return /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.cloneElement)(content, props); } var label; if (lodash_isFunction__WEBPACK_IMPORTED_MODULE_2___default()(content)) { label = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(content, props); if ( /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.isValidElement)(label)) { return label; } } else { label = getLabel(props); } var isPolarLabel = isPolar(viewBox); var attrs = (0,_util_ReactUtils__WEBPACK_IMPORTED_MODULE_7__/* .filterProps */ .J9)(props, true); if (isPolarLabel && (position === 'insideStart' || position === 'insideEnd' || position === 'end')) { return renderRadialLabel(props, label, attrs); } var positionAttrs = isPolarLabel ? getAttrsOfPolarLabel(props) : getAttrsOfCartesianLabel(props); return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_Text__WEBPACK_IMPORTED_MODULE_8__/* .Text */ .E, _extends({ className: (0,clsx__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .A)('recharts-label', className) }, attrs, positionAttrs, { breakAll: textBreakAll }), label); } Label.displayName = 'Label'; var parseViewBox = function parseViewBox(props) { var cx = props.cx, cy = props.cy, angle = props.angle, startAngle = props.startAngle, endAngle = props.endAngle, r = props.r, radius = props.radius, innerRadius = props.innerRadius, outerRadius = props.outerRadius, x = props.x, y = props.y, top = props.top, left = props.left, width = props.width, height = props.height, clockWise = props.clockWise, labelViewBox = props.labelViewBox; if (labelViewBox) { return labelViewBox; } if ((0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_4__/* .isNumber */ .Et)(width) && (0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_4__/* .isNumber */ .Et)(height)) { if ((0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_4__/* .isNumber */ .Et)(x) && (0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_4__/* .isNumber */ .Et)(y)) { return { x: x, y: y, width: width, height: height }; } if ((0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_4__/* .isNumber */ .Et)(top) && (0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_4__/* .isNumber */ .Et)(left)) { return { x: top, y: left, width: width, height: height }; } } if ((0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_4__/* .isNumber */ .Et)(x) && (0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_4__/* .isNumber */ .Et)(y)) { return { x: x, y: y, width: 0, height: 0 }; } if ((0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_4__/* .isNumber */ .Et)(cx) && (0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_4__/* .isNumber */ .Et)(cy)) { return { cx: cx, cy: cy, startAngle: startAngle || angle || 0, endAngle: endAngle || angle || 0, innerRadius: innerRadius || 0, outerRadius: outerRadius || radius || r || 0, clockWise: clockWise }; } if (props.viewBox) { return props.viewBox; } return {}; }; var parseLabel = function parseLabel(label, viewBox) { if (!label) { return null; } if (label === true) { return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Label, { key: "label-implicit", viewBox: viewBox }); } if ((0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_4__/* .isNumOrStr */ .vh)(label)) { return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Label, { key: "label-implicit", viewBox: viewBox, value: label }); } if ( /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.isValidElement)(label)) { if (label.type === Label) { return /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.cloneElement)(label, { key: 'label-implicit', viewBox: viewBox }); } return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Label, { key: "label-implicit", content: label, viewBox: viewBox }); } if (lodash_isFunction__WEBPACK_IMPORTED_MODULE_2___default()(label)) { return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Label, { key: "label-implicit", content: label, viewBox: viewBox }); } if (lodash_isObject__WEBPACK_IMPORTED_MODULE_3___default()(label)) { return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Label, _extends({ viewBox: viewBox }, label, { key: "label-implicit" })); } return null; }; var renderCallByParent = function renderCallByParent(parentProps, viewBox) { var checkPropsLabel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; if (!parentProps || !parentProps.children && checkPropsLabel && !parentProps.label) { return null; } var children = parentProps.children; var parentViewBox = parseViewBox(parentProps); var explicitChildren = (0,_util_ReactUtils__WEBPACK_IMPORTED_MODULE_7__/* .findAllByType */ .aS)(children, Label).map(function (child, index) { return /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.cloneElement)(child, { viewBox: viewBox || parentViewBox, // eslint-disable-next-line react/no-array-index-key key: "label-".concat(index) }); }); if (!checkPropsLabel) { return explicitChildren; } var implicitLabel = parseLabel(parentProps.label, viewBox || parentViewBox); return [implicitLabel].concat(_toConsumableArray(explicitChildren)); }; Label.parseViewBox = parseViewBox; Label.renderCallByParent = renderCallByParent; /***/ }), /***/ 2050: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ f: () => (/* binding */ Cell) /* harmony export */ }); /** * @fileOverview Cross */ var Cell = function Cell(_props) { return null; }; Cell.displayName = 'Cell'; /***/ }), /***/ 2532: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ g: () => (/* binding */ getLegendProps) /* harmony export */ }); /* harmony import */ var _component_Legend__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4637); /* harmony import */ var _ChartUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3198); /* harmony import */ var _ReactUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4501); function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } var getLegendProps = function getLegendProps(_ref) { var children = _ref.children, formattedGraphicalItems = _ref.formattedGraphicalItems, legendWidth = _ref.legendWidth, legendContent = _ref.legendContent; var legendItem = (0,_ReactUtils__WEBPACK_IMPORTED_MODULE_0__/* .findChildByType */ .BU)(children, _component_Legend__WEBPACK_IMPORTED_MODULE_1__/* .Legend */ .s); if (!legendItem) { return null; } var legendDefaultProps = _component_Legend__WEBPACK_IMPORTED_MODULE_1__/* .Legend */ .s.defaultProps; var legendProps = legendDefaultProps !== undefined ? _objectSpread(_objectSpread({}, legendDefaultProps), legendItem.props) : {}; var legendData; if (legendItem.props && legendItem.props.payload) { legendData = legendItem.props && legendItem.props.payload; } else if (legendContent === 'children') { legendData = (formattedGraphicalItems || []).reduce(function (result, _ref2) { var item = _ref2.item, props = _ref2.props; var data = props.sectors || props.data || []; return result.concat(data.map(function (entry) { return { type: legendItem.props.iconType || item.props.legendType, value: entry.name, color: entry.fill, payload: entry }; })); }, []); } else { legendData = (formattedGraphicalItems || []).map(function (_ref3) { var item = _ref3.item; var itemDefaultProps = item.type.defaultProps; var itemProps = itemDefaultProps !== undefined ? _objectSpread(_objectSpread({}, itemDefaultProps), item.props) : {}; var dataKey = itemProps.dataKey, name = itemProps.name, legendType = itemProps.legendType, hide = itemProps.hide; return { inactive: hide, dataKey: dataKey, type: legendProps.iconType || legendType || 'square', color: (0,_ChartUtils__WEBPACK_IMPORTED_MODULE_2__/* .getMainColorOfGraphicItem */ .Ps)(item), value: name || dataKey, // @ts-expect-error property strokeDasharray is required in Payload but optional in props payload: itemProps }; }); } return _objectSpread(_objectSpread(_objectSpread({}, legendProps), _component_Legend__WEBPACK_IMPORTED_MODULE_1__/* .Legend */ .s.getWithHeight(legendItem, legendWidth)), {}, { payload: legendData, item: legendItem }); }; /***/ }), /***/ 2833: /***/ ((module) => { // module.exports = function shallowEqual(objA, objB, compare, compareContext) { var ret = compare ? compare.call(compareContext, objA, objB) : void 0; if (ret !== void 0) { return !!ret; } if (objA === objB) { return true; } if (typeof objA !== "object" || !objA || typeof objB !== "object" || !objB) { return false; } var keysA = Object.keys(objA); var keysB = Object.keys(objB); if (keysA.length !== keysB.length) { return false; } var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); // Test for A's keys different from B. for (var idx = 0; idx < keysA.length; idx++) { var key = keysA[idx]; if (!bHasOwnProperty(key)) { return false; } var valueA = objA[key]; var valueB = objB[key]; ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0; if (ret === false || (ret === void 0 && valueA !== valueB)) { return false; } } return true; }; /***/ }), /***/ 2954: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { F: () => (/* binding */ Pie) }); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(6540); // EXTERNAL MODULE: ./node_modules/react-smooth/es6/index.js + 6 modules var es6 = __webpack_require__(7011); // EXTERNAL MODULE: ./node_modules/lodash/get.js var get = __webpack_require__(8156); var get_default = /*#__PURE__*/__webpack_require__.n(get); // EXTERNAL MODULE: ./node_modules/lodash/isEqual.js var isEqual = __webpack_require__(2404); var isEqual_default = /*#__PURE__*/__webpack_require__.n(isEqual); // EXTERNAL MODULE: ./node_modules/lodash/isNil.js var isNil = __webpack_require__(9843); var isNil_default = /*#__PURE__*/__webpack_require__.n(isNil); // EXTERNAL MODULE: ./node_modules/lodash/isFunction.js var isFunction = __webpack_require__(1882); var isFunction_default = /*#__PURE__*/__webpack_require__.n(isFunction); // EXTERNAL MODULE: ./node_modules/recharts/node_modules/clsx/dist/clsx.mjs var clsx = __webpack_require__(8804); // EXTERNAL MODULE: ./node_modules/recharts/es6/container/Layer.js var Layer = __webpack_require__(6069); // EXTERNAL MODULE: ./node_modules/recharts/es6/shape/Curve.js var Curve = __webpack_require__(5249); // EXTERNAL MODULE: ./node_modules/recharts/es6/component/Text.js + 1 modules var Text = __webpack_require__(1174); // EXTERNAL MODULE: ./node_modules/recharts/es6/component/Label.js var Label = __webpack_require__(1706); // EXTERNAL MODULE: ./node_modules/lodash/isObject.js var isObject = __webpack_require__(3805); var isObject_default = /*#__PURE__*/__webpack_require__.n(isObject); // EXTERNAL MODULE: ./node_modules/lodash/last.js var last = __webpack_require__(8090); var last_default = /*#__PURE__*/__webpack_require__.n(last); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/ReactUtils.js var ReactUtils = __webpack_require__(4501); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/ChartUtils.js + 5 modules var ChartUtils = __webpack_require__(3198); ;// ./node_modules/recharts/es6/component/LabelList.js function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } var _excluded = ["valueAccessor"], _excluded2 = ["data", "dataKey", "clockWise", "id", "textBreakAll"]; function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); } function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; } var defaultAccessor = function defaultAccessor(entry) { return Array.isArray(entry.value) ? last_default()(entry.value) : entry.value; }; function LabelList(_ref) { var _ref$valueAccessor = _ref.valueAccessor, valueAccessor = _ref$valueAccessor === void 0 ? defaultAccessor : _ref$valueAccessor, restProps = _objectWithoutProperties(_ref, _excluded); var data = restProps.data, dataKey = restProps.dataKey, clockWise = restProps.clockWise, id = restProps.id, textBreakAll = restProps.textBreakAll, others = _objectWithoutProperties(restProps, _excluded2); if (!data || !data.length) { return null; } return /*#__PURE__*/react.createElement(Layer/* Layer */.W, { className: "recharts-label-list" }, data.map(function (entry, index) { var value = isNil_default()(dataKey) ? valueAccessor(entry, index) : (0,ChartUtils/* getValueByDataKey */.kr)(entry && entry.payload, dataKey); var idProps = isNil_default()(id) ? {} : { id: "".concat(id, "-").concat(index) }; return /*#__PURE__*/react.createElement(Label/* Label */.J, _extends({}, (0,ReactUtils/* filterProps */.J9)(entry, true), others, idProps, { parentViewBox: entry.parentViewBox, value: value, textBreakAll: textBreakAll, viewBox: Label/* Label */.J.parseViewBox(isNil_default()(clockWise) ? entry : _objectSpread(_objectSpread({}, entry), {}, { clockWise: clockWise })), key: "label-".concat(index) // eslint-disable-line react/no-array-index-key , index: index })); })); } LabelList.displayName = 'LabelList'; function parseLabelList(label, data) { if (!label) { return null; } if (label === true) { return /*#__PURE__*/react.createElement(LabelList, { key: "labelList-implicit", data: data }); } if ( /*#__PURE__*/react.isValidElement(label) || isFunction_default()(label)) { return /*#__PURE__*/react.createElement(LabelList, { key: "labelList-implicit", data: data, content: label }); } if (isObject_default()(label)) { return /*#__PURE__*/react.createElement(LabelList, _extends({ data: data }, label, { key: "labelList-implicit" })); } return null; } function renderCallByParent(parentProps, data) { var checkPropsLabel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; if (!parentProps || !parentProps.children && checkPropsLabel && !parentProps.label) { return null; } var children = parentProps.children; var explicitChildren = (0,ReactUtils/* findAllByType */.aS)(children, LabelList).map(function (child, index) { return /*#__PURE__*/(0,react.cloneElement)(child, { data: data, // eslint-disable-next-line react/no-array-index-key key: "labelList-".concat(index) }); }); if (!checkPropsLabel) { return explicitChildren; } var implicitLabelList = parseLabelList(parentProps.label, data); return [implicitLabelList].concat(_toConsumableArray(explicitChildren)); } LabelList.renderCallByParent = renderCallByParent; // EXTERNAL MODULE: ./node_modules/recharts/es6/component/Cell.js var Cell = __webpack_require__(2050); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/Global.js var Global = __webpack_require__(9938); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/PolarUtils.js var PolarUtils = __webpack_require__(4040); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/DataUtils.js var DataUtils = __webpack_require__(9744); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/LogUtils.js var LogUtils = __webpack_require__(6634); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/types.js var types = __webpack_require__(8940); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/ActiveShapeUtils.js + 1 modules var ActiveShapeUtils = __webpack_require__(5079); ;// ./node_modules/recharts/es6/polar/Pie.js var _Pie; function Pie_typeof(o) { "@babel/helpers - typeof"; return Pie_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, Pie_typeof(o); } function Pie_extends() { Pie_extends = Object.assign ? Object.assign.bind() : 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; }; return Pie_extends.apply(this, arguments); } function Pie_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function Pie_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? Pie_ownKeys(Object(t), !0).forEach(function (r) { Pie_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : Pie_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } 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, Pie_toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } function _possibleConstructorReturn(self, call) { if (call && (Pie_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function Pie_defineProperty(obj, key, value) { key = Pie_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function Pie_toPropertyKey(t) { var i = Pie_toPrimitive(t, "string"); return "symbol" == Pie_typeof(i) ? i : i + ""; } function Pie_toPrimitive(t, r) { if ("object" != Pie_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != Pie_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /** * @fileOverview Render sectors of a pie */ var Pie = /*#__PURE__*/function (_PureComponent) { function Pie(props) { var _this; _classCallCheck(this, Pie); _this = _callSuper(this, Pie, [props]); Pie_defineProperty(_this, "pieRef", null); Pie_defineProperty(_this, "sectorRefs", []); Pie_defineProperty(_this, "id", (0,DataUtils/* uniqueId */.NF)('recharts-pie-')); Pie_defineProperty(_this, "handleAnimationEnd", function () { var onAnimationEnd = _this.props.onAnimationEnd; _this.setState({ isAnimationFinished: true }); if (isFunction_default()(onAnimationEnd)) { onAnimationEnd(); } }); Pie_defineProperty(_this, "handleAnimationStart", function () { var onAnimationStart = _this.props.onAnimationStart; _this.setState({ isAnimationFinished: false }); if (isFunction_default()(onAnimationStart)) { onAnimationStart(); } }); _this.state = { isAnimationFinished: !props.isAnimationActive, prevIsAnimationActive: props.isAnimationActive, prevAnimationId: props.animationId, sectorToFocus: 0 }; return _this; } _inherits(Pie, _PureComponent); return _createClass(Pie, [{ key: "isActiveIndex", value: function isActiveIndex(i) { var activeIndex = this.props.activeIndex; if (Array.isArray(activeIndex)) { return activeIndex.indexOf(i) !== -1; } return i === activeIndex; } }, { key: "hasActiveIndex", value: function hasActiveIndex() { var activeIndex = this.props.activeIndex; return Array.isArray(activeIndex) ? activeIndex.length !== 0 : activeIndex || activeIndex === 0; } }, { key: "renderLabels", value: function renderLabels(sectors) { var isAnimationActive = this.props.isAnimationActive; if (isAnimationActive && !this.state.isAnimationFinished) { return null; } var _this$props = this.props, label = _this$props.label, labelLine = _this$props.labelLine, dataKey = _this$props.dataKey, valueKey = _this$props.valueKey; var pieProps = (0,ReactUtils/* filterProps */.J9)(this.props, false); var customLabelProps = (0,ReactUtils/* filterProps */.J9)(label, false); var customLabelLineProps = (0,ReactUtils/* filterProps */.J9)(labelLine, false); var offsetRadius = label && label.offsetRadius || 20; var labels = sectors.map(function (entry, i) { var midAngle = (entry.startAngle + entry.endAngle) / 2; var endPoint = (0,PolarUtils/* polarToCartesian */.IZ)(entry.cx, entry.cy, entry.outerRadius + offsetRadius, midAngle); var labelProps = Pie_objectSpread(Pie_objectSpread(Pie_objectSpread(Pie_objectSpread({}, pieProps), entry), {}, { stroke: 'none' }, customLabelProps), {}, { index: i, textAnchor: Pie.getTextAnchor(endPoint.x, entry.cx) }, endPoint); var lineProps = Pie_objectSpread(Pie_objectSpread(Pie_objectSpread(Pie_objectSpread({}, pieProps), entry), {}, { fill: 'none', stroke: entry.fill }, customLabelLineProps), {}, { index: i, points: [(0,PolarUtils/* polarToCartesian */.IZ)(entry.cx, entry.cy, entry.outerRadius, midAngle), endPoint] }); var realDataKey = dataKey; // TODO: compatible to lower versions if (isNil_default()(dataKey) && isNil_default()(valueKey)) { realDataKey = 'value'; } else if (isNil_default()(dataKey)) { realDataKey = valueKey; } return ( /*#__PURE__*/ // eslint-disable-next-line react/no-array-index-key react.createElement(Layer/* Layer */.W, { key: "label-".concat(entry.startAngle, "-").concat(entry.endAngle, "-").concat(entry.midAngle, "-").concat(i) }, labelLine && Pie.renderLabelLineItem(labelLine, lineProps, 'line'), Pie.renderLabelItem(label, labelProps, (0,ChartUtils/* getValueByDataKey */.kr)(entry, realDataKey))) ); }); return /*#__PURE__*/react.createElement(Layer/* Layer */.W, { className: "recharts-pie-labels" }, labels); } }, { key: "renderSectorsStatically", value: function renderSectorsStatically(sectors) { var _this2 = this; var _this$props2 = this.props, activeShape = _this$props2.activeShape, blendStroke = _this$props2.blendStroke, inactiveShapeProp = _this$props2.inactiveShape; return sectors.map(function (entry, i) { if ((entry === null || entry === void 0 ? void 0 : entry.startAngle) === 0 && (entry === null || entry === void 0 ? void 0 : entry.endAngle) === 0 && sectors.length !== 1) return null; var isActive = _this2.isActiveIndex(i); var inactiveShape = inactiveShapeProp && _this2.hasActiveIndex() ? inactiveShapeProp : null; var sectorOptions = isActive ? activeShape : inactiveShape; var sectorProps = Pie_objectSpread(Pie_objectSpread({}, entry), {}, { stroke: blendStroke ? entry.fill : entry.stroke, tabIndex: -1 }); return /*#__PURE__*/react.createElement(Layer/* Layer */.W, Pie_extends({ ref: function ref(_ref) { if (_ref && !_this2.sectorRefs.includes(_ref)) { _this2.sectorRefs.push(_ref); } }, tabIndex: -1, className: "recharts-pie-sector" }, (0,types/* adaptEventsOfChild */.XC)(_this2.props, entry, i), { // eslint-disable-next-line react/no-array-index-key key: "sector-".concat(entry === null || entry === void 0 ? void 0 : entry.startAngle, "-").concat(entry === null || entry === void 0 ? void 0 : entry.endAngle, "-").concat(entry.midAngle, "-").concat(i) }), /*#__PURE__*/react.createElement(ActiveShapeUtils/* Shape */.yp, Pie_extends({ option: sectorOptions, isActive: isActive, shapeType: "sector" }, sectorProps))); }); } }, { key: "renderSectorsWithAnimation", value: function renderSectorsWithAnimation() { var _this3 = this; var _this$props3 = this.props, sectors = _this$props3.sectors, isAnimationActive = _this$props3.isAnimationActive, animationBegin = _this$props3.animationBegin, animationDuration = _this$props3.animationDuration, animationEasing = _this$props3.animationEasing, animationId = _this$props3.animationId; var _this$state = this.state, prevSectors = _this$state.prevSectors, prevIsAnimationActive = _this$state.prevIsAnimationActive; return /*#__PURE__*/react.createElement(es6/* default */.Ay, { begin: animationBegin, duration: animationDuration, isActive: isAnimationActive, easing: animationEasing, from: { t: 0 }, to: { t: 1 }, key: "pie-".concat(animationId, "-").concat(prevIsAnimationActive), onAnimationStart: this.handleAnimationStart, onAnimationEnd: this.handleAnimationEnd }, function (_ref2) { var t = _ref2.t; var stepData = []; var first = sectors && sectors[0]; var curAngle = first.startAngle; sectors.forEach(function (entry, index) { var prev = prevSectors && prevSectors[index]; var paddingAngle = index > 0 ? get_default()(entry, 'paddingAngle', 0) : 0; if (prev) { var angleIp = (0,DataUtils/* interpolateNumber */.Dj)(prev.endAngle - prev.startAngle, entry.endAngle - entry.startAngle); var latest = Pie_objectSpread(Pie_objectSpread({}, entry), {}, { startAngle: curAngle + paddingAngle, endAngle: curAngle + angleIp(t) + paddingAngle }); stepData.push(latest); curAngle = latest.endAngle; } else { var endAngle = entry.endAngle, startAngle = entry.startAngle; var interpolatorAngle = (0,DataUtils/* interpolateNumber */.Dj)(0, endAngle - startAngle); var deltaAngle = interpolatorAngle(t); var _latest = Pie_objectSpread(Pie_objectSpread({}, entry), {}, { startAngle: curAngle + paddingAngle, endAngle: curAngle + deltaAngle + paddingAngle }); stepData.push(_latest); curAngle = _latest.endAngle; } }); return /*#__PURE__*/react.createElement(Layer/* Layer */.W, null, _this3.renderSectorsStatically(stepData)); }); } }, { key: "attachKeyboardHandlers", value: function attachKeyboardHandlers(pieRef) { var _this4 = this; // eslint-disable-next-line no-param-reassign pieRef.onkeydown = function (e) { if (!e.altKey) { switch (e.key) { case 'ArrowLeft': { var next = ++_this4.state.sectorToFocus % _this4.sectorRefs.length; _this4.sectorRefs[next].focus(); _this4.setState({ sectorToFocus: next }); break; } case 'ArrowRight': { var _next = --_this4.state.sectorToFocus < 0 ? _this4.sectorRefs.length - 1 : _this4.state.sectorToFocus % _this4.sectorRefs.length; _this4.sectorRefs[_next].focus(); _this4.setState({ sectorToFocus: _next }); break; } case 'Escape': { _this4.sectorRefs[_this4.state.sectorToFocus].blur(); _this4.setState({ sectorToFocus: 0 }); break; } default: { // There is nothing to do here } } } }; } }, { key: "renderSectors", value: function renderSectors() { var _this$props4 = this.props, sectors = _this$props4.sectors, isAnimationActive = _this$props4.isAnimationActive; var prevSectors = this.state.prevSectors; if (isAnimationActive && sectors && sectors.length && (!prevSectors || !isEqual_default()(prevSectors, sectors))) { return this.renderSectorsWithAnimation(); } return this.renderSectorsStatically(sectors); } }, { key: "componentDidMount", value: function componentDidMount() { if (this.pieRef) { this.attachKeyboardHandlers(this.pieRef); } } }, { key: "render", value: function render() { var _this5 = this; var _this$props5 = this.props, hide = _this$props5.hide, sectors = _this$props5.sectors, className = _this$props5.className, label = _this$props5.label, cx = _this$props5.cx, cy = _this$props5.cy, innerRadius = _this$props5.innerRadius, outerRadius = _this$props5.outerRadius, isAnimationActive = _this$props5.isAnimationActive; var isAnimationFinished = this.state.isAnimationFinished; if (hide || !sectors || !sectors.length || !(0,DataUtils/* isNumber */.Et)(cx) || !(0,DataUtils/* isNumber */.Et)(cy) || !(0,DataUtils/* isNumber */.Et)(innerRadius) || !(0,DataUtils/* isNumber */.Et)(outerRadius)) { return null; } var layerClass = (0,clsx/* default */.A)('recharts-pie', className); return /*#__PURE__*/react.createElement(Layer/* Layer */.W, { tabIndex: this.props.rootTabIndex, className: layerClass, ref: function ref(_ref3) { _this5.pieRef = _ref3; } }, this.renderSectors(), label && this.renderLabels(sectors), Label/* Label */.J.renderCallByParent(this.props, null, false), (!isAnimationActive || isAnimationFinished) && LabelList.renderCallByParent(this.props, sectors, false)); } }], [{ key: "getDerivedStateFromProps", value: function getDerivedStateFromProps(nextProps, prevState) { if (prevState.prevIsAnimationActive !== nextProps.isAnimationActive) { return { prevIsAnimationActive: nextProps.isAnimationActive, prevAnimationId: nextProps.animationId, curSectors: nextProps.sectors, prevSectors: [], isAnimationFinished: true }; } if (nextProps.isAnimationActive && nextProps.animationId !== prevState.prevAnimationId) { return { prevAnimationId: nextProps.animationId, curSectors: nextProps.sectors, prevSectors: prevState.curSectors, isAnimationFinished: true }; } if (nextProps.sectors !== prevState.curSectors) { return { curSectors: nextProps.sectors, isAnimationFinished: true }; } return null; } }, { key: "getTextAnchor", value: function getTextAnchor(x, cx) { if (x > cx) { return 'start'; } if (x < cx) { return 'end'; } return 'middle'; } }, { key: "renderLabelLineItem", value: function renderLabelLineItem(option, props, key) { if ( /*#__PURE__*/react.isValidElement(option)) { return /*#__PURE__*/react.cloneElement(option, props); } if (isFunction_default()(option)) { return option(props); } var className = (0,clsx/* default */.A)('recharts-pie-label-line', typeof option !== 'boolean' ? option.className : ''); return /*#__PURE__*/react.createElement(Curve/* Curve */.I, Pie_extends({}, props, { key: key, type: "linear", className: className })); } }, { key: "renderLabelItem", value: function renderLabelItem(option, props, value) { if ( /*#__PURE__*/react.isValidElement(option)) { return /*#__PURE__*/react.cloneElement(option, props); } var label = value; if (isFunction_default()(option)) { label = option(props); if ( /*#__PURE__*/react.isValidElement(label)) { return label; } } var className = (0,clsx/* default */.A)('recharts-pie-label-text', typeof option !== 'boolean' && !isFunction_default()(option) ? option.className : ''); return /*#__PURE__*/react.createElement(Text/* Text */.E, Pie_extends({}, props, { alignmentBaseline: "middle", className: className }), label); } }]); }(react.PureComponent); _Pie = Pie; Pie_defineProperty(Pie, "displayName", 'Pie'); Pie_defineProperty(Pie, "defaultProps", { stroke: '#fff', fill: '#808080', legendType: 'rect', cx: '50%', cy: '50%', startAngle: 0, endAngle: 360, innerRadius: 0, outerRadius: '80%', paddingAngle: 0, labelLine: true, hide: false, minAngle: 0, isAnimationActive: !Global/* Global */.m.isSsr, animationBegin: 400, animationDuration: 1500, animationEasing: 'ease', nameKey: 'name', blendStroke: false, rootTabIndex: 0 }); Pie_defineProperty(Pie, "parseDeltaAngle", function (startAngle, endAngle) { var sign = (0,DataUtils/* mathSign */.sA)(endAngle - startAngle); var deltaAngle = Math.min(Math.abs(endAngle - startAngle), 360); return sign * deltaAngle; }); Pie_defineProperty(Pie, "getRealPieData", function (itemProps) { var data = itemProps.data, children = itemProps.children; var presentationProps = (0,ReactUtils/* filterProps */.J9)(itemProps, false); var cells = (0,ReactUtils/* findAllByType */.aS)(children, Cell/* Cell */.f); if (data && data.length) { return data.map(function (entry, index) { return Pie_objectSpread(Pie_objectSpread(Pie_objectSpread({ payload: entry }, presentationProps), entry), cells && cells[index] && cells[index].props); }); } if (cells && cells.length) { return cells.map(function (cell) { return Pie_objectSpread(Pie_objectSpread({}, presentationProps), cell.props); }); } return []; }); Pie_defineProperty(Pie, "parseCoordinateOfPie", function (itemProps, offset) { var top = offset.top, left = offset.left, width = offset.width, height = offset.height; var maxPieRadius = (0,PolarUtils/* getMaxRadius */.lY)(width, height); var cx = left + (0,DataUtils/* getPercentValue */.F4)(itemProps.cx, width, width / 2); var cy = top + (0,DataUtils/* getPercentValue */.F4)(itemProps.cy, height, height / 2); var innerRadius = (0,DataUtils/* getPercentValue */.F4)(itemProps.innerRadius, maxPieRadius, 0); var outerRadius = (0,DataUtils/* getPercentValue */.F4)(itemProps.outerRadius, maxPieRadius, maxPieRadius * 0.8); var maxRadius = itemProps.maxRadius || Math.sqrt(width * width + height * height) / 2; return { cx: cx, cy: cy, innerRadius: innerRadius, outerRadius: outerRadius, maxRadius: maxRadius }; }); Pie_defineProperty(Pie, "getComposedData", function (_ref4) { var item = _ref4.item, offset = _ref4.offset; var itemProps = item.type.defaultProps !== undefined ? Pie_objectSpread(Pie_objectSpread({}, item.type.defaultProps), item.props) : item.props; var pieData = _Pie.getRealPieData(itemProps); if (!pieData || !pieData.length) { return null; } var cornerRadius = itemProps.cornerRadius, startAngle = itemProps.startAngle, endAngle = itemProps.endAngle, paddingAngle = itemProps.paddingAngle, dataKey = itemProps.dataKey, nameKey = itemProps.nameKey, valueKey = itemProps.valueKey, tooltipType = itemProps.tooltipType; var minAngle = Math.abs(itemProps.minAngle); var coordinate = _Pie.parseCoordinateOfPie(itemProps, offset); var deltaAngle = _Pie.parseDeltaAngle(startAngle, endAngle); var absDeltaAngle = Math.abs(deltaAngle); var realDataKey = dataKey; if (isNil_default()(dataKey) && isNil_default()(valueKey)) { (0,LogUtils/* warn */.R)(false, "Use \"dataKey\" to specify the value of pie,\n the props \"valueKey\" will be deprecated in 1.1.0"); realDataKey = 'value'; } else if (isNil_default()(dataKey)) { (0,LogUtils/* warn */.R)(false, "Use \"dataKey\" to specify the value of pie,\n the props \"valueKey\" will be deprecated in 1.1.0"); realDataKey = valueKey; } var notZeroItemCount = pieData.filter(function (entry) { return (0,ChartUtils/* getValueByDataKey */.kr)(entry, realDataKey, 0) !== 0; }).length; var totalPadingAngle = (absDeltaAngle >= 360 ? notZeroItemCount : notZeroItemCount - 1) * paddingAngle; var realTotalAngle = absDeltaAngle - notZeroItemCount * minAngle - totalPadingAngle; var sum = pieData.reduce(function (result, entry) { var val = (0,ChartUtils/* getValueByDataKey */.kr)(entry, realDataKey, 0); return result + ((0,DataUtils/* isNumber */.Et)(val) ? val : 0); }, 0); var sectors; if (sum > 0) { var prev; sectors = pieData.map(function (entry, i) { var val = (0,ChartUtils/* getValueByDataKey */.kr)(entry, realDataKey, 0); var name = (0,ChartUtils/* getValueByDataKey */.kr)(entry, nameKey, i); var percent = ((0,DataUtils/* isNumber */.Et)(val) ? val : 0) / sum; var tempStartAngle; if (i) { tempStartAngle = prev.endAngle + (0,DataUtils/* mathSign */.sA)(deltaAngle) * paddingAngle * (val !== 0 ? 1 : 0); } else { tempStartAngle = startAngle; } var tempEndAngle = tempStartAngle + (0,DataUtils/* mathSign */.sA)(deltaAngle) * ((val !== 0 ? minAngle : 0) + percent * realTotalAngle); var midAngle = (tempStartAngle + tempEndAngle) / 2; var middleRadius = (coordinate.innerRadius + coordinate.outerRadius) / 2; var tooltipPayload = [{ name: name, value: val, payload: entry, dataKey: realDataKey, type: tooltipType }]; var tooltipPosition = (0,PolarUtils/* polarToCartesian */.IZ)(coordinate.cx, coordinate.cy, middleRadius, midAngle); prev = Pie_objectSpread(Pie_objectSpread(Pie_objectSpread({ percent: percent, cornerRadius: cornerRadius, name: name, tooltipPayload: tooltipPayload, midAngle: midAngle, middleRadius: middleRadius, tooltipPosition: tooltipPosition }, entry), coordinate), {}, { value: (0,ChartUtils/* getValueByDataKey */.kr)(entry, realDataKey), startAngle: tempStartAngle, endAngle: tempEndAngle, payload: entry, paddingAngle: (0,DataUtils/* mathSign */.sA)(deltaAngle) * paddingAngle }); return prev; }); } return Pie_objectSpread(Pie_objectSpread({}, coordinate), {}, { sectors: sectors, data: pieData }); }); /***/ }), /***/ 2960: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ HY: () => (/* binding */ combineReducers), /* harmony export */ Tw: () => (/* binding */ applyMiddleware), /* harmony export */ Zz: () => (/* binding */ compose), /* harmony export */ y$: () => (/* binding */ createStore) /* harmony export */ }); /* unused harmony exports __DO_NOT_USE__ActionTypes, bindActionCreators, legacy_createStore */ /* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9379); /** * Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js * * Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes * during build. * @param {number} code */ function formatProdErrorMessage(code) { return "Minified Redux error #" + code + "; visit https://redux.js.org/Errors?code=" + code + " for the full message or " + 'use the non-minified dev environment for full errors. '; } // Inlined version of the `symbol-observable` polyfill var $$observable = (function () { return typeof Symbol === 'function' && Symbol.observable || '@@observable'; })(); /** * These are private action types reserved by Redux. * For any unknown actions, you must return the current state. * If the current state is undefined, you must return the initial state. * Do not reference these action types directly in your code. */ var randomString = function randomString() { return Math.random().toString(36).substring(7).split('').join('.'); }; var ActionTypes = { INIT: "@@redux/INIT" + randomString(), REPLACE: "@@redux/REPLACE" + randomString(), PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() { return "@@redux/PROBE_UNKNOWN_ACTION" + randomString(); } }; /** * @param {any} obj The object to inspect. * @returns {boolean} True if the argument appears to be a plain object. */ function isPlainObject(obj) { if (typeof obj !== 'object' || obj === null) return false; var proto = obj; while (Object.getPrototypeOf(proto) !== null) { proto = Object.getPrototypeOf(proto); } return Object.getPrototypeOf(obj) === proto; } // Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of function miniKindOf(val) { if (val === void 0) return 'undefined'; if (val === null) return 'null'; var type = typeof val; switch (type) { case 'boolean': case 'string': case 'number': case 'symbol': case 'function': { return type; } } if (Array.isArray(val)) return 'array'; if (isDate(val)) return 'date'; if (isError(val)) return 'error'; var constructorName = ctorName(val); switch (constructorName) { case 'Symbol': case 'Promise': case 'WeakMap': case 'WeakSet': case 'Map': case 'Set': return constructorName; } // other return type.slice(8, -1).toLowerCase().replace(/\s/g, ''); } function ctorName(val) { return typeof val.constructor === 'function' ? val.constructor.name : null; } function isError(val) { return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number'; } function isDate(val) { if (val instanceof Date) return true; return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function'; } function kindOf(val) { var typeOfVal = typeof val; if (false) // removed by dead control flow {} return typeOfVal; } /** * @deprecated * * **We recommend using the `configureStore` method * of the `@reduxjs/toolkit` package**, which replaces `createStore`. * * Redux Toolkit is our recommended approach for writing Redux logic today, * including store setup, reducers, data fetching, and more. * * **For more details, please read this Redux docs page:** * **https://redux.js.org/introduction/why-rtk-is-redux-today** * * `configureStore` from Redux Toolkit is an improved version of `createStore` that * simplifies setup and helps avoid common bugs. * * You should not be using the `redux` core package by itself today, except for learning purposes. * The `createStore` method from the core `redux` package will not be removed, but we encourage * all users to migrate to using Redux Toolkit for all Redux code. * * If you want to use `createStore` without this visual deprecation warning, use * the `legacy_createStore` import instead: * * `import { legacy_createStore as createStore} from 'redux'` * */ function createStore(reducer, preloadedState, enhancer) { var _ref2; if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') { throw new Error( true ? formatProdErrorMessage(0) : 0); } if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') { enhancer = preloadedState; preloadedState = undefined; } if (typeof enhancer !== 'undefined') { if (typeof enhancer !== 'function') { throw new Error( true ? formatProdErrorMessage(1) : 0); } return enhancer(createStore)(reducer, preloadedState); } if (typeof reducer !== 'function') { throw new Error( true ? formatProdErrorMessage(2) : 0); } var currentReducer = reducer; var currentState = preloadedState; var currentListeners = []; var nextListeners = currentListeners; var isDispatching = false; /** * This makes a shallow copy of currentListeners so we can use * nextListeners as a temporary list while dispatching. * * This prevents any bugs around consumers calling * subscribe/unsubscribe in the middle of a dispatch. */ function ensureCanMutateNextListeners() { if (nextListeners === currentListeners) { nextListeners = currentListeners.slice(); } } /** * Reads the state tree managed by the store. * * @returns {any} The current state tree of your application. */ function getState() { if (isDispatching) { throw new Error( true ? formatProdErrorMessage(3) : 0); } return currentState; } /** * Adds a change listener. It will be called any time an action is dispatched, * and some part of the state tree may potentially have changed. You may then * call `getState()` to read the current state tree inside the callback. * * You may call `dispatch()` from a change listener, with the following * caveats: * * 1. The subscriptions are snapshotted just before every `dispatch()` call. * If you subscribe or unsubscribe while the listeners are being invoked, this * will not have any effect on the `dispatch()` that is currently in progress. * However, the next `dispatch()` call, whether nested or not, will use a more * recent snapshot of the subscription list. * * 2. The listener should not expect to see all state changes, as the state * might have been updated multiple times during a nested `dispatch()` before * the listener is called. It is, however, guaranteed that all subscribers * registered before the `dispatch()` started will be called with the latest * state by the time it exits. * * @param {Function} listener A callback to be invoked on every dispatch. * @returns {Function} A function to remove this change listener. */ function subscribe(listener) { if (typeof listener !== 'function') { throw new Error( true ? formatProdErrorMessage(4) : 0); } if (isDispatching) { throw new Error( true ? formatProdErrorMessage(5) : 0); } var isSubscribed = true; ensureCanMutateNextListeners(); nextListeners.push(listener); return function unsubscribe() { if (!isSubscribed) { return; } if (isDispatching) { throw new Error( true ? formatProdErrorMessage(6) : 0); } isSubscribed = false; ensureCanMutateNextListeners(); var index = nextListeners.indexOf(listener); nextListeners.splice(index, 1); currentListeners = null; }; } /** * Dispatches an action. It is the only way to trigger a state change. * * The `reducer` function, used to create the store, will be called with the * current state tree and the given `action`. Its return value will * be considered the **next** state of the tree, and the change listeners * will be notified. * * The base implementation only supports plain object actions. If you want to * dispatch a Promise, an Observable, a thunk, or something else, you need to * wrap your store creating function into the corresponding middleware. For * example, see the documentation for the `redux-thunk` package. Even the * middleware will eventually dispatch plain object actions using this method. * * @param {Object} action A plain object representing “what changed”. It is * a good idea to keep actions serializable so you can record and replay user * sessions, or use the time travelling `redux-devtools`. An action must have * a `type` property which may not be `undefined`. It is a good idea to use * string constants for action types. * * @returns {Object} For convenience, the same action object you dispatched. * * Note that, if you use a custom middleware, it may wrap `dispatch()` to * return something else (for example, a Promise you can await). */ function dispatch(action) { if (!isPlainObject(action)) { throw new Error( true ? formatProdErrorMessage(7) : 0); } if (typeof action.type === 'undefined') { throw new Error( true ? formatProdErrorMessage(8) : 0); } if (isDispatching) { throw new Error( true ? formatProdErrorMessage(9) : 0); } try { isDispatching = true; currentState = currentReducer(currentState, action); } finally { isDispatching = false; } var listeners = currentListeners = nextListeners; for (var i = 0; i < listeners.length; i++) { var listener = listeners[i]; listener(); } return action; } /** * Replaces the reducer currently used by the store to calculate the state. * * You might need this if your app implements code splitting and you want to * load some of the reducers dynamically. You might also need this if you * implement a hot reloading mechanism for Redux. * * @param {Function} nextReducer The reducer for the store to use instead. * @returns {void} */ function replaceReducer(nextReducer) { if (typeof nextReducer !== 'function') { throw new Error( true ? formatProdErrorMessage(10) : 0); } currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT. // Any reducers that existed in both the new and old rootReducer // will receive the previous state. This effectively populates // the new state tree with any relevant data from the old one. dispatch({ type: ActionTypes.REPLACE }); } /** * Interoperability point for observable/reactive libraries. * @returns {observable} A minimal observable of state changes. * For more information, see the observable proposal: * https://github.com/tc39/proposal-observable */ function observable() { var _ref; var outerSubscribe = subscribe; return _ref = { /** * The minimal observable subscription method. * @param {Object} observer Any object that can be used as an observer. * The observer object should have a `next` method. * @returns {subscription} An object with an `unsubscribe` method that can * be used to unsubscribe the observable from the store, and prevent further * emission of values from the observable. */ subscribe: function subscribe(observer) { if (typeof observer !== 'object' || observer === null) { throw new Error( true ? formatProdErrorMessage(11) : 0); } function observeState() { if (observer.next) { observer.next(getState()); } } observeState(); var unsubscribe = outerSubscribe(observeState); return { unsubscribe: unsubscribe }; } }, _ref[$$observable] = function () { return this; }, _ref; } // When a store is created, an "INIT" action is dispatched so that every // reducer returns their initial state. This effectively populates // the initial state tree. dispatch({ type: ActionTypes.INIT }); return _ref2 = { dispatch: dispatch, subscribe: subscribe, getState: getState, replaceReducer: replaceReducer }, _ref2[$$observable] = observable, _ref2; } /** * Creates a Redux store that holds the state tree. * * **We recommend using `configureStore` from the * `@reduxjs/toolkit` package**, which replaces `createStore`: * **https://redux.js.org/introduction/why-rtk-is-redux-today** * * The only way to change the data in the store is to call `dispatch()` on it. * * There should only be a single store in your app. To specify how different * parts of the state tree respond to actions, you may combine several reducers * into a single reducer function by using `combineReducers`. * * @param {Function} reducer A function that returns the next state tree, given * the current state tree and the action to handle. * * @param {any} [preloadedState] The initial state. You may optionally specify it * to hydrate the state from the server in universal apps, or to restore a * previously serialized user session. * If you use `combineReducers` to produce the root reducer function, this must be * an object with the same shape as `combineReducers` keys. * * @param {Function} [enhancer] The store enhancer. You may optionally specify it * to enhance the store with third-party capabilities such as middleware, * time travel, persistence, etc. The only store enhancer that ships with Redux * is `applyMiddleware()`. * * @returns {Store} A Redux store that lets you read the state, dispatch actions * and subscribe to changes. */ var legacy_createStore = (/* unused pure expression or super */ null && (createStore)); /** * Prints a warning in the console if it exists. * * @param {String} message The warning message. * @returns {void} */ function warning(message) { /* eslint-disable no-console */ if (typeof console !== 'undefined' && typeof console.error === 'function') { console.error(message); } /* eslint-enable no-console */ try { // This error was thrown as a convenience so that if you enable // "break on all exceptions" in your console, // it would pause the execution at this line. throw new Error(message); } catch (e) {} // eslint-disable-line no-empty } function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) { var reducerKeys = Object.keys(reducers); var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer'; if (reducerKeys.length === 0) { return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.'; } if (!isPlainObject(inputState)) { return "The " + argumentName + " has unexpected type of \"" + kindOf(inputState) + "\". Expected argument to be an object with the following " + ("keys: \"" + reducerKeys.join('", "') + "\""); } var unexpectedKeys = Object.keys(inputState).filter(function (key) { return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]; }); unexpectedKeys.forEach(function (key) { unexpectedKeyCache[key] = true; }); if (action && action.type === ActionTypes.REPLACE) return; if (unexpectedKeys.length > 0) { return "Unexpected " + (unexpectedKeys.length > 1 ? 'keys' : 'key') + " " + ("\"" + unexpectedKeys.join('", "') + "\" found in " + argumentName + ". ") + "Expected to find one of the known reducer keys instead: " + ("\"" + reducerKeys.join('", "') + "\". Unexpected keys will be ignored."); } } function assertReducerShape(reducers) { Object.keys(reducers).forEach(function (key) { var reducer = reducers[key]; var initialState = reducer(undefined, { type: ActionTypes.INIT }); if (typeof initialState === 'undefined') { throw new Error( true ? formatProdErrorMessage(12) : 0); } if (typeof reducer(undefined, { type: ActionTypes.PROBE_UNKNOWN_ACTION() }) === 'undefined') { throw new Error( true ? formatProdErrorMessage(13) : 0); } }); } /** * Turns an object whose values are different reducer functions, into a single * reducer function. It will call every child reducer, and gather their results * into a single state object, whose keys correspond to the keys of the passed * reducer functions. * * @param {Object} reducers An object whose values correspond to different * reducer functions that need to be combined into one. One handy way to obtain * it is to use ES6 `import * as reducers` syntax. The reducers may never return * undefined for any action. Instead, they should return their initial state * if the state passed to them was undefined, and the current state for any * unrecognized action. * * @returns {Function} A reducer function that invokes every reducer inside the * passed object, and builds a state object with the same shape. */ function combineReducers(reducers) { var reducerKeys = Object.keys(reducers); var finalReducers = {}; for (var i = 0; i < reducerKeys.length; i++) { var key = reducerKeys[i]; if (false) // removed by dead control flow {} if (typeof reducers[key] === 'function') { finalReducers[key] = reducers[key]; } } var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same // keys multiple times. var unexpectedKeyCache; if (false) // removed by dead control flow {} var shapeAssertionError; try { assertReducerShape(finalReducers); } catch (e) { shapeAssertionError = e; } return function combination(state, action) { if (state === void 0) { state = {}; } if (shapeAssertionError) { throw shapeAssertionError; } if (false) // removed by dead control flow { var warningMessage; } var hasChanged = false; var nextState = {}; for (var _i = 0; _i < finalReducerKeys.length; _i++) { var _key = finalReducerKeys[_i]; var reducer = finalReducers[_key]; var previousStateForKey = state[_key]; var nextStateForKey = reducer(previousStateForKey, action); if (typeof nextStateForKey === 'undefined') { var actionType = action && action.type; throw new Error( true ? formatProdErrorMessage(14) : 0); } nextState[_key] = nextStateForKey; hasChanged = hasChanged || nextStateForKey !== previousStateForKey; } hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length; return hasChanged ? nextState : state; }; } function bindActionCreator(actionCreator, dispatch) { return function () { return dispatch(actionCreator.apply(this, arguments)); }; } /** * Turns an object whose values are action creators, into an object with the * same keys, but with every function wrapped into a `dispatch` call so they * may be invoked directly. This is just a convenience method, as you can call * `store.dispatch(MyActionCreators.doSomething())` yourself just fine. * * For convenience, you can also pass an action creator as the first argument, * and get a dispatch wrapped function in return. * * @param {Function|Object} actionCreators An object whose values are action * creator functions. One handy way to obtain it is to use ES6 `import * as` * syntax. You may also pass a single function. * * @param {Function} dispatch The `dispatch` function available on your Redux * store. * * @returns {Function|Object} The object mimicking the original object, but with * every action creator wrapped into the `dispatch` call. If you passed a * function as `actionCreators`, the return value will also be a single * function. */ function bindActionCreators(actionCreators, dispatch) { if (typeof actionCreators === 'function') { return bindActionCreator(actionCreators, dispatch); } if (typeof actionCreators !== 'object' || actionCreators === null) { throw new Error( true ? formatProdErrorMessage(16) : 0); } var boundActionCreators = {}; for (var key in actionCreators) { var actionCreator = actionCreators[key]; if (typeof actionCreator === 'function') { boundActionCreators[key] = bindActionCreator(actionCreator, dispatch); } } return boundActionCreators; } /** * Composes single-argument functions from right to left. The rightmost * function can take multiple arguments as it provides the signature for * the resulting composite function. * * @param {...Function} funcs The functions to compose. * @returns {Function} A function obtained by composing the argument functions * from right to left. For example, compose(f, g, h) is identical to doing * (...args) => f(g(h(...args))). */ function compose() { for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) { funcs[_key] = arguments[_key]; } if (funcs.length === 0) { return function (arg) { return arg; }; } if (funcs.length === 1) { return funcs[0]; } return funcs.reduce(function (a, b) { return function () { return a(b.apply(void 0, arguments)); }; }); } /** * Creates a store enhancer that applies middleware to the dispatch method * of the Redux store. This is handy for a variety of tasks, such as expressing * asynchronous actions in a concise manner, or logging every action payload. * * See `redux-thunk` package as an example of the Redux middleware. * * Because middleware is potentially asynchronous, this should be the first * store enhancer in the composition chain. * * Note that each middleware will be given the `dispatch` and `getState` functions * as named arguments. * * @param {...Function} middlewares The middleware chain to be applied. * @returns {Function} A store enhancer applying the middleware. */ function applyMiddleware() { for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) { middlewares[_key] = arguments[_key]; } return function (createStore) { return function () { var store = createStore.apply(void 0, arguments); var _dispatch = function dispatch() { throw new Error( true ? formatProdErrorMessage(15) : 0); }; var middlewareAPI = { getState: store.getState, dispatch: function dispatch() { return _dispatch.apply(void 0, arguments); } }; var chain = middlewares.map(function (middleware) { return middleware(middlewareAPI); }); _dispatch = compose.apply(void 0, chain)(store.dispatch); return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)({}, store), {}, { dispatch: _dispatch }); }; }; } /***/ }), /***/ 3198: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { s0: () => (/* binding */ appendOffsetOfLegend), gH: () => (/* binding */ calculateActiveTickIndex), YB: () => (/* binding */ checkDomainOfScale), HQ: () => (/* binding */ combineEventHandlers), Hj: () => (/* binding */ getBandSizeOfAxis), BX: () => (/* binding */ getBarPosition), tA: () => (/* binding */ getBarSizeList), Ay: () => (/* binding */ getDomainOfDataByKey), vf: () => (/* binding */ getDomainOfItemsWithSameAxis), Mk: () => (/* binding */ getDomainOfStackGroups), Ps: () => (/* binding */ getMainColorOfGraphicItem), Mn: () => (/* binding */ getStackGroupsByAxisId), kA: () => (/* binding */ getStackedDataOfItem), Rh: () => (/* binding */ getTicksOfAxis), w7: () => (/* binding */ getTicksOfScale), zb: () => (/* binding */ getTooltipItem), kr: () => (/* binding */ getValueByDataKey), _L: () => (/* binding */ isCategoricalAxis), KC: () => (/* binding */ parseDomainOfCategoryAxis), A1: () => (/* binding */ parseErrorBarsOfAxis), W7: () => (/* binding */ parseScale), AQ: () => (/* binding */ parseSpecifiedDomain) }); // UNUSED EXPORTS: MAX_VALUE_REG, MIN_VALUE_REG, findPositionOfBar, getBaseValueOfBar, getCateCoordinateOfBar, getCateCoordinateOfLine, getCoordinatesOfGrid, getDomainOfErrorBars, getLegendProps, getStackedData, offsetPositive, offsetSign, truncateByDomain // EXTERNAL MODULE: ./node_modules/d3-scale/src/band.js + 1 modules var band = __webpack_require__(9072); // EXTERNAL MODULE: ./node_modules/d3-scale/src/linear.js var linear = __webpack_require__(6502); // EXTERNAL MODULE: ./node_modules/victory-vendor/es/d3-scale.js var d3_scale = __webpack_require__(9625); // EXTERNAL MODULE: ./node_modules/d3-shape/src/offset/expand.js var expand = __webpack_require__(6488); // EXTERNAL MODULE: ./node_modules/d3-shape/src/offset/none.js var none = __webpack_require__(3414); // EXTERNAL MODULE: ./node_modules/d3-shape/src/offset/silhouette.js var silhouette = __webpack_require__(1530); // EXTERNAL MODULE: ./node_modules/d3-shape/src/offset/wiggle.js var wiggle = __webpack_require__(3629); // EXTERNAL MODULE: ./node_modules/d3-shape/src/stack.js var src_stack = __webpack_require__(8872); // EXTERNAL MODULE: ./node_modules/d3-shape/src/order/none.js var order_none = __webpack_require__(4873); // EXTERNAL MODULE: ./node_modules/lodash/max.js var max = __webpack_require__(4506); var max_default = /*#__PURE__*/__webpack_require__.n(max); // EXTERNAL MODULE: ./node_modules/lodash/min.js var min = __webpack_require__(1684); var min_default = /*#__PURE__*/__webpack_require__.n(min); // EXTERNAL MODULE: ./node_modules/lodash/isNil.js var lodash_isNil = __webpack_require__(9843); var isNil_default = /*#__PURE__*/__webpack_require__.n(lodash_isNil); // EXTERNAL MODULE: ./node_modules/lodash/isFunction.js var isFunction = __webpack_require__(1882); var isFunction_default = /*#__PURE__*/__webpack_require__.n(isFunction); // EXTERNAL MODULE: ./node_modules/lodash/isString.js var isString = __webpack_require__(5015); var isString_default = /*#__PURE__*/__webpack_require__.n(isString); // EXTERNAL MODULE: ./node_modules/lodash/get.js var get = __webpack_require__(8156); var get_default = /*#__PURE__*/__webpack_require__.n(get); // EXTERNAL MODULE: ./node_modules/lodash/flatMap.js var flatMap = __webpack_require__(7307); var flatMap_default = /*#__PURE__*/__webpack_require__.n(flatMap); // EXTERNAL MODULE: ./node_modules/lodash/isNaN.js var lodash_isNaN = __webpack_require__(1741); var isNaN_default = /*#__PURE__*/__webpack_require__.n(lodash_isNaN); // EXTERNAL MODULE: ./node_modules/lodash/upperFirst.js var upperFirst = __webpack_require__(5808); var upperFirst_default = /*#__PURE__*/__webpack_require__.n(upperFirst); // EXTERNAL MODULE: ./node_modules/lodash/isEqual.js var isEqual = __webpack_require__(2404); var isEqual_default = /*#__PURE__*/__webpack_require__.n(isEqual); // EXTERNAL MODULE: ./node_modules/lodash/sortBy.js var sortBy = __webpack_require__(3031); var sortBy_default = /*#__PURE__*/__webpack_require__.n(sortBy); // EXTERNAL MODULE: ./node_modules/decimal.js-light/decimal.js var decimal = __webpack_require__(8351); var decimal_default = /*#__PURE__*/__webpack_require__.n(decimal); ;// ./node_modules/recharts-scale/es6/util/utils.js function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } var identity = function identity(i) { return i; }; var PLACE_HOLDER = { '@@functional/placeholder': true }; var isPlaceHolder = function isPlaceHolder(val) { return val === PLACE_HOLDER; }; var curry0 = function curry0(fn) { return function _curried() { if (arguments.length === 0 || arguments.length === 1 && isPlaceHolder(arguments.length <= 0 ? undefined : arguments[0])) { return _curried; } return fn.apply(void 0, arguments); }; }; var curryN = function curryN(n, fn) { if (n === 1) { return fn; } return curry0(function () { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var argsLength = args.filter(function (arg) { return arg !== PLACE_HOLDER; }).length; if (argsLength >= n) { return fn.apply(void 0, args); } return curryN(n - argsLength, curry0(function () { for (var _len2 = arguments.length, restArgs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { restArgs[_key2] = arguments[_key2]; } var newArgs = args.map(function (arg) { return isPlaceHolder(arg) ? restArgs.shift() : arg; }); return fn.apply(void 0, _toConsumableArray(newArgs).concat(restArgs)); })); }); }; var curry = function curry(fn) { return curryN(fn.length, fn); }; var range = function range(begin, end) { var arr = []; for (var i = begin; i < end; ++i) { arr[i - begin] = i; } return arr; }; var map = curry(function (fn, arr) { if (Array.isArray(arr)) { return arr.map(fn); } return Object.keys(arr).map(function (key) { return arr[key]; }).map(fn); }); var compose = function compose() { for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { args[_key3] = arguments[_key3]; } if (!args.length) { return identity; } var fns = args.reverse(); // first function can receive multiply arguments var firstFn = fns[0]; var tailsFn = fns.slice(1); return function () { return tailsFn.reduce(function (res, fn) { return fn(res); }, firstFn.apply(void 0, arguments)); }; }; var reverse = function reverse(arr) { if (Array.isArray(arr)) { return arr.reverse(); } // can be string return arr.split('').reverse.join(''); }; var memoize = function memoize(fn) { var lastArgs = null; var lastResult = null; return function () { for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { args[_key4] = arguments[_key4]; } if (lastArgs && args.every(function (val, i) { return val === lastArgs[i]; })) { return lastResult; } lastArgs = args; lastResult = fn.apply(void 0, args); return lastResult; }; }; ;// ./node_modules/recharts-scale/es6/util/arithmetic.js /** * @fileOverview 一些公用的运算方法 * @author xile611 * @date 2015-09-17 */ /** * 获取数值的位数 * 其中绝对值属于区间[0.1, 1), 得到的值为0 * 绝对值属于区间[0.01, 0.1),得到的位数为 -1 * 绝对值属于区间[0.001, 0.01),得到的位数为 -2 * * @param {Number} value 数值 * @return {Integer} 位数 */ function getDigitCount(value) { var result; if (value === 0) { result = 1; } else { result = Math.floor(new (decimal_default())(value).abs().log(10).toNumber()) + 1; } return result; } /** * 按照固定的步长获取[start, end)这个区间的数据 * 并且需要处理js计算精度的问题 * * @param {Decimal} start 起点 * @param {Decimal} end 终点,不包含该值 * @param {Decimal} step 步长 * @return {Array} 若干数值 */ function rangeStep(start, end, step) { var num = new (decimal_default())(start); var i = 0; var result = []; // magic number to prevent infinite loop while (num.lt(end) && i < 100000) { result.push(num.toNumber()); num = num.add(step); i++; } return result; } /** * 对数值进行线性插值 * * @param {Number} a 定义域的极点 * @param {Number} b 定义域的极点 * @param {Number} t [0, 1]内的某个值 * @return {Number} 定义域内的某个值 */ var interpolateNumber = curry(function (a, b, t) { var newA = +a; var newB = +b; return newA + t * (newB - newA); }); /** * 线性插值的逆运算 * * @param {Number} a 定义域的极点 * @param {Number} b 定义域的极点 * @param {Number} x 可以认为是插值后的一个输出值 * @return {Number} 当x在 a ~ b这个范围内时,返回值属于[0, 1] */ var uninterpolateNumber = curry(function (a, b, x) { var diff = b - +a; diff = diff || Infinity; return (x - a) / diff; }); /** * 线性插值的逆运算,并且有截断的操作 * * @param {Number} a 定义域的极点 * @param {Number} b 定义域的极点 * @param {Number} x 可以认为是插值后的一个输出值 * @return {Number} 当x在 a ~ b这个区间内时,返回值属于[0, 1], * 当x不在 a ~ b这个区间时,会截断到 a ~ b 这个区间 */ var uninterpolateTruncation = curry(function (a, b, x) { var diff = b - +a; diff = diff || Infinity; return Math.max(0, Math.min(1, (x - a) / diff)); }); /* harmony default export */ const arithmetic = ({ rangeStep: rangeStep, getDigitCount: getDigitCount, interpolateNumber: interpolateNumber, uninterpolateNumber: uninterpolateNumber, uninterpolateTruncation: uninterpolateTruncation }); ;// ./node_modules/recharts-scale/es6/getNiceTickValues.js function getNiceTickValues_toConsumableArray(arr) { return getNiceTickValues_arrayWithoutHoles(arr) || getNiceTickValues_iterableToArray(arr) || getNiceTickValues_unsupportedIterableToArray(arr) || getNiceTickValues_nonIterableSpread(); } function getNiceTickValues_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function getNiceTickValues_iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } function getNiceTickValues_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return getNiceTickValues_arrayLikeToArray(arr); } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || getNiceTickValues_unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function getNiceTickValues_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return getNiceTickValues_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return getNiceTickValues_arrayLikeToArray(o, minLen); } function getNiceTickValues_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } /** * @fileOverview calculate tick values of scale * @author xile611, arcthur * @date 2015-09-17 */ /** * Calculate a interval of a minimum value and a maximum value * * @param {Number} min The minimum value * @param {Number} max The maximum value * @return {Array} An interval */ function getValidInterval(_ref) { var _ref2 = _slicedToArray(_ref, 2), min = _ref2[0], max = _ref2[1]; var validMin = min, validMax = max; // exchange if (min > max) { validMin = max; validMax = min; } return [validMin, validMax]; } /** * Calculate the step which is easy to understand between ticks, like 10, 20, 25 * * @param {Decimal} roughStep The rough step calculated by deviding the * difference by the tickCount * @param {Boolean} allowDecimals Allow the ticks to be decimals or not * @param {Integer} correctionFactor A correction factor * @return {Decimal} The step which is easy to understand between two ticks */ function getFormatStep(roughStep, allowDecimals, correctionFactor) { if (roughStep.lte(0)) { return new (decimal_default())(0); } var digitCount = arithmetic.getDigitCount(roughStep.toNumber()); // The ratio between the rough step and the smallest number which has a bigger // order of magnitudes than the rough step var digitCountValue = new (decimal_default())(10).pow(digitCount); var stepRatio = roughStep.div(digitCountValue); // When an integer and a float multiplied, the accuracy of result may be wrong var stepRatioScale = digitCount !== 1 ? 0.05 : 0.1; var amendStepRatio = new (decimal_default())(Math.ceil(stepRatio.div(stepRatioScale).toNumber())).add(correctionFactor).mul(stepRatioScale); var formatStep = amendStepRatio.mul(digitCountValue); return allowDecimals ? formatStep : new (decimal_default())(Math.ceil(formatStep)); } /** * calculate the ticks when the minimum value equals to the maximum value * * @param {Number} value The minimum valuue which is also the maximum value * @param {Integer} tickCount The count of ticks * @param {Boolean} allowDecimals Allow the ticks to be decimals or not * @return {Array} ticks */ function getTickOfSingleValue(value, tickCount, allowDecimals) { var step = 1; // calculate the middle value of ticks var middle = new (decimal_default())(value); if (!middle.isint() && allowDecimals) { var absVal = Math.abs(value); if (absVal < 1) { // The step should be a float number when the difference is smaller than 1 step = new (decimal_default())(10).pow(arithmetic.getDigitCount(value) - 1); middle = new (decimal_default())(Math.floor(middle.div(step).toNumber())).mul(step); } else if (absVal > 1) { // Return the maximum integer which is smaller than 'value' when 'value' is greater than 1 middle = new (decimal_default())(Math.floor(value)); } } else if (value === 0) { middle = new (decimal_default())(Math.floor((tickCount - 1) / 2)); } else if (!allowDecimals) { middle = new (decimal_default())(Math.floor(value)); } var middleIndex = Math.floor((tickCount - 1) / 2); var fn = compose(map(function (n) { return middle.add(new (decimal_default())(n - middleIndex).mul(step)).toNumber(); }), range); return fn(0, tickCount); } /** * Calculate the step * * @param {Number} min The minimum value of an interval * @param {Number} max The maximum value of an interval * @param {Integer} tickCount The count of ticks * @param {Boolean} allowDecimals Allow the ticks to be decimals or not * @param {Number} correctionFactor A correction factor * @return {Object} The step, minimum value of ticks, maximum value of ticks */ function calculateStep(min, max, tickCount, allowDecimals) { var correctionFactor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; // dirty hack (for recharts' test) if (!Number.isFinite((max - min) / (tickCount - 1))) { return { step: new (decimal_default())(0), tickMin: new (decimal_default())(0), tickMax: new (decimal_default())(0) }; } // The step which is easy to understand between two ticks var step = getFormatStep(new (decimal_default())(max).sub(min).div(tickCount - 1), allowDecimals, correctionFactor); // A medial value of ticks var middle; // When 0 is inside the interval, 0 should be a tick if (min <= 0 && max >= 0) { middle = new (decimal_default())(0); } else { // calculate the middle value middle = new (decimal_default())(min).add(max).div(2); // minus modulo value middle = middle.sub(new (decimal_default())(middle).mod(step)); } var belowCount = Math.ceil(middle.sub(min).div(step).toNumber()); var upCount = Math.ceil(new (decimal_default())(max).sub(middle).div(step).toNumber()); var scaleCount = belowCount + upCount + 1; if (scaleCount > tickCount) { // When more ticks need to cover the interval, step should be bigger. return calculateStep(min, max, tickCount, allowDecimals, correctionFactor + 1); } if (scaleCount < tickCount) { // When less ticks can cover the interval, we should add some additional ticks upCount = max > 0 ? upCount + (tickCount - scaleCount) : upCount; belowCount = max > 0 ? belowCount : belowCount + (tickCount - scaleCount); } return { step: step, tickMin: middle.sub(new (decimal_default())(belowCount).mul(step)), tickMax: middle.add(new (decimal_default())(upCount).mul(step)) }; } /** * Calculate the ticks of an interval, the count of ticks will be guraranteed * * @param {Number} min, max min: The minimum value, max: The maximum value * @param {Integer} tickCount The count of ticks * @param {Boolean} allowDecimals Allow the ticks to be decimals or not * @return {Array} ticks */ function getNiceTickValuesFn(_ref3) { var _ref4 = _slicedToArray(_ref3, 2), min = _ref4[0], max = _ref4[1]; var tickCount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 6; var allowDecimals = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; // More than two ticks should be return var count = Math.max(tickCount, 2); var _getValidInterval = getValidInterval([min, max]), _getValidInterval2 = _slicedToArray(_getValidInterval, 2), cormin = _getValidInterval2[0], cormax = _getValidInterval2[1]; if (cormin === -Infinity || cormax === Infinity) { var _values = cormax === Infinity ? [cormin].concat(getNiceTickValues_toConsumableArray(range(0, tickCount - 1).map(function () { return Infinity; }))) : [].concat(getNiceTickValues_toConsumableArray(range(0, tickCount - 1).map(function () { return -Infinity; })), [cormax]); return min > max ? reverse(_values) : _values; } if (cormin === cormax) { return getTickOfSingleValue(cormin, tickCount, allowDecimals); } // Get the step between two ticks var _calculateStep = calculateStep(cormin, cormax, count, allowDecimals), step = _calculateStep.step, tickMin = _calculateStep.tickMin, tickMax = _calculateStep.tickMax; var values = arithmetic.rangeStep(tickMin, tickMax.add(new (decimal_default())(0.1).mul(step)), step); return min > max ? reverse(values) : values; } /** * Calculate the ticks of an interval, the count of ticks won't be guraranteed * * @param {Number} min, max min: The minimum value, max: The maximum value * @param {Integer} tickCount The count of ticks * @param {Boolean} allowDecimals Allow the ticks to be decimals or not * @return {Array} ticks */ function getTickValuesFn(_ref5) { var _ref6 = _slicedToArray(_ref5, 2), min = _ref6[0], max = _ref6[1]; var tickCount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 6; var allowDecimals = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; // More than two ticks should be return var count = Math.max(tickCount, 2); var _getValidInterval3 = getValidInterval([min, max]), _getValidInterval4 = _slicedToArray(_getValidInterval3, 2), cormin = _getValidInterval4[0], cormax = _getValidInterval4[1]; if (cormin === -Infinity || cormax === Infinity) { return [min, max]; } if (cormin === cormax) { return getTickOfSingleValue(cormin, tickCount, allowDecimals); } var step = getFormatStep(new (decimal_default())(cormax).sub(cormin).div(count - 1), allowDecimals, 0); var fn = compose(map(function (n) { return new (decimal_default())(cormin).add(new (decimal_default())(n).mul(step)).toNumber(); }), range); var values = fn(0, count).filter(function (entry) { return entry >= cormin && entry <= cormax; }); return min > max ? reverse(values) : values; } /** * Calculate the ticks of an interval, the count of ticks won't be guraranteed, * but the domain will be guaranteed * * @param {Number} min, max min: The minimum value, max: The maximum value * @param {Integer} tickCount The count of ticks * @param {Boolean} allowDecimals Allow the ticks to be decimals or not * @return {Array} ticks */ function getTickValuesFixedDomainFn(_ref7, tickCount) { var _ref8 = _slicedToArray(_ref7, 2), min = _ref8[0], max = _ref8[1]; var allowDecimals = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; // More than two ticks should be return var _getValidInterval5 = getValidInterval([min, max]), _getValidInterval6 = _slicedToArray(_getValidInterval5, 2), cormin = _getValidInterval6[0], cormax = _getValidInterval6[1]; if (cormin === -Infinity || cormax === Infinity) { return [min, max]; } if (cormin === cormax) { return [cormin]; } var count = Math.max(tickCount, 2); var step = getFormatStep(new (decimal_default())(cormax).sub(cormin).div(count - 1), allowDecimals, 0); var values = [].concat(getNiceTickValues_toConsumableArray(arithmetic.rangeStep(new (decimal_default())(cormin), new (decimal_default())(cormax).sub(new (decimal_default())(0.99).mul(step)), step)), [cormax]); return min > max ? reverse(values) : values; } var getNiceTickValues = memoize(getNiceTickValuesFn); var getTickValues = memoize(getTickValuesFn); var getTickValuesFixedDomain = memoize(getTickValuesFixedDomainFn); ;// ./node_modules/recharts-scale/es6/index.js // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(6540); // EXTERNAL MODULE: ./node_modules/tiny-invariant/dist/esm/tiny-invariant.js var tiny_invariant = __webpack_require__(1561); // EXTERNAL MODULE: ./node_modules/recharts/es6/container/Layer.js var Layer = __webpack_require__(6069); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/ReactUtils.js var ReactUtils = __webpack_require__(4501); ;// ./node_modules/recharts/es6/cartesian/ErrorBar.js var _excluded = ["offset", "layout", "width", "dataKey", "data", "dataPointFormatter", "xAxis", "yAxis"]; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); } function ErrorBar_slicedToArray(arr, i) { return ErrorBar_arrayWithHoles(arr) || ErrorBar_iterableToArrayLimit(arr, i) || ErrorBar_unsupportedIterableToArray(arr, i) || ErrorBar_nonIterableRest(); } function ErrorBar_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function ErrorBar_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return ErrorBar_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return ErrorBar_arrayLikeToArray(o, minLen); } function ErrorBar_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function ErrorBar_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } function ErrorBar_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; } 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, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /** * @fileOverview Render a group of error bar */ // eslint-disable-next-line react/prefer-stateless-function -- requires static defaultProps var ErrorBar = /*#__PURE__*/function (_React$Component) { function ErrorBar() { _classCallCheck(this, ErrorBar); return _callSuper(this, ErrorBar, arguments); } _inherits(ErrorBar, _React$Component); return _createClass(ErrorBar, [{ key: "render", value: function render() { var _this$props = this.props, offset = _this$props.offset, layout = _this$props.layout, width = _this$props.width, dataKey = _this$props.dataKey, data = _this$props.data, dataPointFormatter = _this$props.dataPointFormatter, xAxis = _this$props.xAxis, yAxis = _this$props.yAxis, others = _objectWithoutProperties(_this$props, _excluded); var svgProps = (0,ReactUtils/* filterProps */.J9)(others, false); !!(this.props.direction === 'x' && xAxis.type !== 'number') ? false ? 0 : (0,tiny_invariant/* default */.A)(false) : void 0; var errorBars = data.map(function (entry) { var _dataPointFormatter = dataPointFormatter(entry, dataKey), x = _dataPointFormatter.x, y = _dataPointFormatter.y, value = _dataPointFormatter.value, errorVal = _dataPointFormatter.errorVal; if (!errorVal) { return null; } var lineCoordinates = []; var lowBound, highBound; if (Array.isArray(errorVal)) { var _errorVal = ErrorBar_slicedToArray(errorVal, 2); lowBound = _errorVal[0]; highBound = _errorVal[1]; } else { lowBound = highBound = errorVal; } if (layout === 'vertical') { // error bar for horizontal charts, the y is fixed, x is a range value var scale = xAxis.scale; var yMid = y + offset; var yMin = yMid + width; var yMax = yMid - width; var xMin = scale(value - lowBound); var xMax = scale(value + highBound); // the right line of |--| lineCoordinates.push({ x1: xMax, y1: yMin, x2: xMax, y2: yMax }); // the middle line of |--| lineCoordinates.push({ x1: xMin, y1: yMid, x2: xMax, y2: yMid }); // the left line of |--| lineCoordinates.push({ x1: xMin, y1: yMin, x2: xMin, y2: yMax }); } else if (layout === 'horizontal') { // error bar for horizontal charts, the x is fixed, y is a range value var _scale = yAxis.scale; var xMid = x + offset; var _xMin = xMid - width; var _xMax = xMid + width; var _yMin = _scale(value - lowBound); var _yMax = _scale(value + highBound); // the top line lineCoordinates.push({ x1: _xMin, y1: _yMax, x2: _xMax, y2: _yMax }); // the middle line lineCoordinates.push({ x1: xMid, y1: _yMin, x2: xMid, y2: _yMax }); // the bottom line lineCoordinates.push({ x1: _xMin, y1: _yMin, x2: _xMax, y2: _yMin }); } return /*#__PURE__*/react.createElement(Layer/* Layer */.W, _extends({ className: "recharts-errorBar", key: "bar-".concat(lineCoordinates.map(function (c) { return "".concat(c.x1, "-").concat(c.x2, "-").concat(c.y1, "-").concat(c.y2); })) }, svgProps), lineCoordinates.map(function (coordinates) { return /*#__PURE__*/react.createElement("line", _extends({}, coordinates, { key: "line-".concat(coordinates.x1, "-").concat(coordinates.x2, "-").concat(coordinates.y1, "-").concat(coordinates.y2) })); })); }); return /*#__PURE__*/react.createElement(Layer/* Layer */.W, { className: "recharts-errorBars" }, errorBars); } }]); }(react.Component); _defineProperty(ErrorBar, "defaultProps", { stroke: 'black', strokeWidth: 1.5, width: 5, offset: 0, layout: 'horizontal' }); _defineProperty(ErrorBar, "displayName", 'ErrorBar'); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/DataUtils.js var DataUtils = __webpack_require__(9744); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/getLegendProps.js var getLegendProps = __webpack_require__(2532); ;// ./node_modules/recharts/es6/util/ChartUtils.js function ChartUtils_typeof(o) { "@babel/helpers - typeof"; return ChartUtils_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, ChartUtils_typeof(o); } function ChartUtils_toConsumableArray(arr) { return ChartUtils_arrayWithoutHoles(arr) || ChartUtils_iterableToArray(arr) || ChartUtils_unsupportedIterableToArray(arr) || ChartUtils_nonIterableSpread(); } function ChartUtils_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function ChartUtils_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return ChartUtils_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return ChartUtils_arrayLikeToArray(o, minLen); } function ChartUtils_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function ChartUtils_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return ChartUtils_arrayLikeToArray(arr); } function ChartUtils_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { ChartUtils_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function ChartUtils_defineProperty(obj, key, value) { key = ChartUtils_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function ChartUtils_toPropertyKey(t) { var i = ChartUtils_toPrimitive(t, "string"); return "symbol" == ChartUtils_typeof(i) ? i : i + ""; } function ChartUtils_toPrimitive(t, r) { if ("object" != ChartUtils_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != ChartUtils_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } // TODO: Cause of circular dependency. Needs refactor. // import { RadiusAxisProps, AngleAxisProps } from '../polar/types'; // Exported for backwards compatibility function getValueByDataKey(obj, dataKey, defaultValue) { if (isNil_default()(obj) || isNil_default()(dataKey)) { return defaultValue; } if ((0,DataUtils/* isNumOrStr */.vh)(dataKey)) { return get_default()(obj, dataKey, defaultValue); } if (isFunction_default()(dataKey)) { return dataKey(obj); } return defaultValue; } /** * Get domain of data by key. * @param {Array} data The data displayed in the chart * @param {String} key The unique key of a group of data * @param {String} type The type of axis * @param {Boolean} filterNil Whether or not filter nil values * @return {Array} Domain of data */ function getDomainOfDataByKey(data, key, type, filterNil) { var flattenData = flatMap_default()(data, function (entry) { return getValueByDataKey(entry, key); }); if (type === 'number') { // @ts-expect-error parseFloat type only accepts strings var domain = flattenData.filter(function (entry) { return (0,DataUtils/* isNumber */.Et)(entry) || parseFloat(entry); }); return domain.length ? [min_default()(domain), max_default()(domain)] : [Infinity, -Infinity]; } var validateData = filterNil ? flattenData.filter(function (entry) { return !isNil_default()(entry); }) : flattenData; // Supports x-axis of Date type return validateData.map(function (entry) { return (0,DataUtils/* isNumOrStr */.vh)(entry) || entry instanceof Date ? entry : ''; }); } var calculateActiveTickIndex = function calculateActiveTickIndex(coordinate) { var _ticks$length; var ticks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; var unsortedTicks = arguments.length > 2 ? arguments[2] : undefined; var axis = arguments.length > 3 ? arguments[3] : undefined; var index = -1; var len = (_ticks$length = ticks === null || ticks === void 0 ? void 0 : ticks.length) !== null && _ticks$length !== void 0 ? _ticks$length : 0; // if there are 1 or less ticks ticks then the active tick is at index 0 if (len <= 1) { return 0; } if (axis && axis.axisType === 'angleAxis' && Math.abs(Math.abs(axis.range[1] - axis.range[0]) - 360) <= 1e-6) { var range = axis.range; // ticks are distributed in a circle for (var i = 0; i < len; i++) { var before = i > 0 ? unsortedTicks[i - 1].coordinate : unsortedTicks[len - 1].coordinate; var cur = unsortedTicks[i].coordinate; var after = i >= len - 1 ? unsortedTicks[0].coordinate : unsortedTicks[i + 1].coordinate; var sameDirectionCoord = void 0; if ((0,DataUtils/* mathSign */.sA)(cur - before) !== (0,DataUtils/* mathSign */.sA)(after - cur)) { var diffInterval = []; if ((0,DataUtils/* mathSign */.sA)(after - cur) === (0,DataUtils/* mathSign */.sA)(range[1] - range[0])) { sameDirectionCoord = after; var curInRange = cur + range[1] - range[0]; diffInterval[0] = Math.min(curInRange, (curInRange + before) / 2); diffInterval[1] = Math.max(curInRange, (curInRange + before) / 2); } else { sameDirectionCoord = before; var afterInRange = after + range[1] - range[0]; diffInterval[0] = Math.min(cur, (afterInRange + cur) / 2); diffInterval[1] = Math.max(cur, (afterInRange + cur) / 2); } var sameInterval = [Math.min(cur, (sameDirectionCoord + cur) / 2), Math.max(cur, (sameDirectionCoord + cur) / 2)]; if (coordinate > sameInterval[0] && coordinate <= sameInterval[1] || coordinate >= diffInterval[0] && coordinate <= diffInterval[1]) { index = unsortedTicks[i].index; break; } } else { var minValue = Math.min(before, after); var maxValue = Math.max(before, after); if (coordinate > (minValue + cur) / 2 && coordinate <= (maxValue + cur) / 2) { index = unsortedTicks[i].index; break; } } } } else { // ticks are distributed in a single direction for (var _i = 0; _i < len; _i++) { if (_i === 0 && coordinate <= (ticks[_i].coordinate + ticks[_i + 1].coordinate) / 2 || _i > 0 && _i < len - 1 && coordinate > (ticks[_i].coordinate + ticks[_i - 1].coordinate) / 2 && coordinate <= (ticks[_i].coordinate + ticks[_i + 1].coordinate) / 2 || _i === len - 1 && coordinate > (ticks[_i].coordinate + ticks[_i - 1].coordinate) / 2) { index = ticks[_i].index; break; } } } return index; }; /** * Get the main color of each graphic item * @param {ReactElement} item A graphic item * @return {String} Color */ var getMainColorOfGraphicItem = function getMainColorOfGraphicItem(item) { var _item$type; var _ref = item, displayName = _ref.type.displayName; // TODO: check if displayName is valid. var defaultedProps = (_item$type = item.type) !== null && _item$type !== void 0 && _item$type.defaultProps ? _objectSpread(_objectSpread({}, item.type.defaultProps), item.props) : item.props; var stroke = defaultedProps.stroke, fill = defaultedProps.fill; var result; switch (displayName) { case 'Line': result = stroke; break; case 'Area': case 'Radar': result = stroke && stroke !== 'none' ? stroke : fill; break; default: result = fill; break; } return result; }; /** * Calculate the size of all groups for stacked bar graph * @param {Object} stackGroups The items grouped by axisId and stackId * @return {Object} The size of all groups */ var getBarSizeList = function getBarSizeList(_ref2) { var globalSize = _ref2.barSize, totalSize = _ref2.totalSize, _ref2$stackGroups = _ref2.stackGroups, stackGroups = _ref2$stackGroups === void 0 ? {} : _ref2$stackGroups; if (!stackGroups) { return {}; } var result = {}; var numericAxisIds = Object.keys(stackGroups); for (var i = 0, len = numericAxisIds.length; i < len; i++) { var sgs = stackGroups[numericAxisIds[i]].stackGroups; var stackIds = Object.keys(sgs); for (var j = 0, sLen = stackIds.length; j < sLen; j++) { var _sgs$stackIds$j = sgs[stackIds[j]], items = _sgs$stackIds$j.items, cateAxisId = _sgs$stackIds$j.cateAxisId; var barItems = items.filter(function (item) { return (0,ReactUtils/* getDisplayName */.Mn)(item.type).indexOf('Bar') >= 0; }); if (barItems && barItems.length) { var barItemDefaultProps = barItems[0].type.defaultProps; var barItemProps = barItemDefaultProps !== undefined ? _objectSpread(_objectSpread({}, barItemDefaultProps), barItems[0].props) : barItems[0].props; var selfSize = barItemProps.barSize; var cateId = barItemProps[cateAxisId]; if (!result[cateId]) { result[cateId] = []; } var barSize = isNil_default()(selfSize) ? globalSize : selfSize; result[cateId].push({ item: barItems[0], stackList: barItems.slice(1), barSize: isNil_default()(barSize) ? undefined : (0,DataUtils/* getPercentValue */.F4)(barSize, totalSize, 0) }); } } } return result; }; /** * Calculate the size of each bar and offset between start of band and the bar * * @param {number} bandSize is the size of area where bars can render * @param {number | string} barGap is the gap size, as a percentage of `bandSize`. * Can be defined as number or percent string * @param {number | string} barCategoryGap is the gap size, as a percentage of `bandSize`. * Can be defined as number or percent string * @param {Array} sizeList Sizes of all groups * @param {number} maxBarSize The maximum size of each bar * @return {Array} The size and offset of each bar */ var getBarPosition = function getBarPosition(_ref3) { var barGap = _ref3.barGap, barCategoryGap = _ref3.barCategoryGap, bandSize = _ref3.bandSize, _ref3$sizeList = _ref3.sizeList, sizeList = _ref3$sizeList === void 0 ? [] : _ref3$sizeList, maxBarSize = _ref3.maxBarSize; var len = sizeList.length; if (len < 1) return null; var realBarGap = (0,DataUtils/* getPercentValue */.F4)(barGap, bandSize, 0, true); var result; var initialValue = []; // whether or not is barSize setted by user if (sizeList[0].barSize === +sizeList[0].barSize) { var useFull = false; var fullBarSize = bandSize / len; // @ts-expect-error the type check above does not check for type number explicitly var sum = sizeList.reduce(function (res, entry) { return res + entry.barSize || 0; }, 0); sum += (len - 1) * realBarGap; if (sum >= bandSize) { sum -= (len - 1) * realBarGap; realBarGap = 0; } if (sum >= bandSize && fullBarSize > 0) { useFull = true; fullBarSize *= 0.9; sum = len * fullBarSize; } var offset = (bandSize - sum) / 2 >> 0; var prev = { offset: offset - realBarGap, size: 0 }; result = sizeList.reduce(function (res, entry) { var newPosition = { item: entry.item, position: { offset: prev.offset + prev.size + realBarGap, // @ts-expect-error the type check above does not check for type number explicitly size: useFull ? fullBarSize : entry.barSize } }; var newRes = [].concat(ChartUtils_toConsumableArray(res), [newPosition]); prev = newRes[newRes.length - 1].position; if (entry.stackList && entry.stackList.length) { entry.stackList.forEach(function (item) { newRes.push({ item: item, position: prev }); }); } return newRes; }, initialValue); } else { var _offset = (0,DataUtils/* getPercentValue */.F4)(barCategoryGap, bandSize, 0, true); if (bandSize - 2 * _offset - (len - 1) * realBarGap <= 0) { realBarGap = 0; } var originalSize = (bandSize - 2 * _offset - (len - 1) * realBarGap) / len; if (originalSize > 1) { originalSize >>= 0; } var size = maxBarSize === +maxBarSize ? Math.min(originalSize, maxBarSize) : originalSize; result = sizeList.reduce(function (res, entry, i) { var newRes = [].concat(ChartUtils_toConsumableArray(res), [{ item: entry.item, position: { offset: _offset + (originalSize + realBarGap) * i + (originalSize - size) / 2, size: size } }]); if (entry.stackList && entry.stackList.length) { entry.stackList.forEach(function (item) { newRes.push({ item: item, position: newRes[newRes.length - 1].position }); }); } return newRes; }, initialValue); } return result; }; var appendOffsetOfLegend = function appendOffsetOfLegend(offset, _unused, props, legendBox) { var children = props.children, width = props.width, margin = props.margin; var legendWidth = width - (margin.left || 0) - (margin.right || 0); var legendProps = (0,getLegendProps/* getLegendProps */.g)({ children: children, legendWidth: legendWidth }); if (legendProps) { var _ref4 = legendBox || {}, boxWidth = _ref4.width, boxHeight = _ref4.height; var align = legendProps.align, verticalAlign = legendProps.verticalAlign, layout = legendProps.layout; if ((layout === 'vertical' || layout === 'horizontal' && verticalAlign === 'middle') && align !== 'center' && (0,DataUtils/* isNumber */.Et)(offset[align])) { return _objectSpread(_objectSpread({}, offset), {}, ChartUtils_defineProperty({}, align, offset[align] + (boxWidth || 0))); } if ((layout === 'horizontal' || layout === 'vertical' && align === 'center') && verticalAlign !== 'middle' && (0,DataUtils/* isNumber */.Et)(offset[verticalAlign])) { return _objectSpread(_objectSpread({}, offset), {}, ChartUtils_defineProperty({}, verticalAlign, offset[verticalAlign] + (boxHeight || 0))); } } return offset; }; var isErrorBarRelevantForAxis = function isErrorBarRelevantForAxis(layout, axisType, direction) { if (isNil_default()(axisType)) { return true; } if (layout === 'horizontal') { return axisType === 'yAxis'; } if (layout === 'vertical') { return axisType === 'xAxis'; } if (direction === 'x') { return axisType === 'xAxis'; } if (direction === 'y') { return axisType === 'yAxis'; } return true; }; var getDomainOfErrorBars = function getDomainOfErrorBars(data, item, dataKey, layout, axisType) { var children = item.props.children; var errorBars = (0,ReactUtils/* findAllByType */.aS)(children, ErrorBar).filter(function (errorBarChild) { return isErrorBarRelevantForAxis(layout, axisType, errorBarChild.props.direction); }); if (errorBars && errorBars.length) { var keys = errorBars.map(function (errorBarChild) { return errorBarChild.props.dataKey; }); return data.reduce(function (result, entry) { var entryValue = getValueByDataKey(entry, dataKey); if (isNil_default()(entryValue)) return result; var mainValue = Array.isArray(entryValue) ? [min_default()(entryValue), max_default()(entryValue)] : [entryValue, entryValue]; var errorDomain = keys.reduce(function (prevErrorArr, k) { var errorValue = getValueByDataKey(entry, k, 0); var lowerValue = mainValue[0] - Math.abs(Array.isArray(errorValue) ? errorValue[0] : errorValue); var upperValue = mainValue[1] + Math.abs(Array.isArray(errorValue) ? errorValue[1] : errorValue); return [Math.min(lowerValue, prevErrorArr[0]), Math.max(upperValue, prevErrorArr[1])]; }, [Infinity, -Infinity]); return [Math.min(errorDomain[0], result[0]), Math.max(errorDomain[1], result[1])]; }, [Infinity, -Infinity]); } return null; }; var parseErrorBarsOfAxis = function parseErrorBarsOfAxis(data, items, dataKey, axisType, layout) { var domains = items.map(function (item) { return getDomainOfErrorBars(data, item, dataKey, layout, axisType); }).filter(function (entry) { return !isNil_default()(entry); }); if (domains && domains.length) { return domains.reduce(function (result, entry) { return [Math.min(result[0], entry[0]), Math.max(result[1], entry[1])]; }, [Infinity, -Infinity]); } return null; }; /** * Get domain of data by the configuration of item element * @param {Array} data The data displayed in the chart * @param {Array} items The instances of item * @param {String} type The type of axis, number - Number Axis, category - Category Axis * @param {LayoutType} layout The type of layout * @param {Boolean} filterNil Whether or not filter nil values * @return {Array} Domain */ var getDomainOfItemsWithSameAxis = function getDomainOfItemsWithSameAxis(data, items, type, layout, filterNil) { var domains = items.map(function (item) { var dataKey = item.props.dataKey; if (type === 'number' && dataKey) { return getDomainOfErrorBars(data, item, dataKey, layout) || getDomainOfDataByKey(data, dataKey, type, filterNil); } return getDomainOfDataByKey(data, dataKey, type, filterNil); }); if (type === 'number') { // Calculate the domain of number axis return domains.reduce( // @ts-expect-error if (type === number) means that the domain is numerical type // - but this link is missing in the type definition function (result, entry) { return [Math.min(result[0], entry[0]), Math.max(result[1], entry[1])]; }, [Infinity, -Infinity]); } var tag = {}; // Get the union set of category axis return domains.reduce(function (result, entry) { for (var i = 0, len = entry.length; i < len; i++) { // @ts-expect-error Date cannot index an object if (!tag[entry[i]]) { // @ts-expect-error Date cannot index an object tag[entry[i]] = true; // @ts-expect-error Date cannot index an object result.push(entry[i]); } } return result; }, []); }; var isCategoricalAxis = function isCategoricalAxis(layout, axisType) { return layout === 'horizontal' && axisType === 'xAxis' || layout === 'vertical' && axisType === 'yAxis' || layout === 'centric' && axisType === 'angleAxis' || layout === 'radial' && axisType === 'radiusAxis'; }; /** * Calculate the Coordinates of grid * @param {Array} ticks The ticks in axis * @param {Number} minValue The minimun value of axis * @param {Number} maxValue The maximun value of axis * @param {boolean} syncWithTicks Synchronize grid lines with ticks or not * @return {Array} Coordinates */ var getCoordinatesOfGrid = function getCoordinatesOfGrid(ticks, minValue, maxValue, syncWithTicks) { if (syncWithTicks) { return ticks.map(function (entry) { return entry.coordinate; }); } var hasMin, hasMax; var values = ticks.map(function (entry) { if (entry.coordinate === minValue) { hasMin = true; } if (entry.coordinate === maxValue) { hasMax = true; } return entry.coordinate; }); if (!hasMin) { values.push(minValue); } if (!hasMax) { values.push(maxValue); } return values; }; /** * Get the ticks of an axis * @param {Object} axis The configuration of an axis * @param {Boolean} isGrid Whether or not are the ticks in grid * @param {Boolean} isAll Return the ticks of all the points or not * @return {Array} Ticks */ var getTicksOfAxis = function getTicksOfAxis(axis, isGrid, isAll) { if (!axis) return null; var scale = axis.scale; var duplicateDomain = axis.duplicateDomain, type = axis.type, range = axis.range; var offsetForBand = axis.realScaleType === 'scaleBand' ? scale.bandwidth() / 2 : 2; var offset = (isGrid || isAll) && type === 'category' && scale.bandwidth ? scale.bandwidth() / offsetForBand : 0; offset = axis.axisType === 'angleAxis' && (range === null || range === void 0 ? void 0 : range.length) >= 2 ? (0,DataUtils/* mathSign */.sA)(range[0] - range[1]) * 2 * offset : offset; // The ticks set by user should only affect the ticks adjacent to axis line if (isGrid && (axis.ticks || axis.niceTicks)) { var result = (axis.ticks || axis.niceTicks).map(function (entry) { var scaleContent = duplicateDomain ? duplicateDomain.indexOf(entry) : entry; return { // If the scaleContent is not a number, the coordinate will be NaN. // That could be the case for example with a PointScale and a string as domain. coordinate: scale(scaleContent) + offset, value: entry, offset: offset }; }); return result.filter(function (row) { return !isNaN_default()(row.coordinate); }); } // When axis is a categorial axis, but the type of axis is number or the scale of axis is not "auto" if (axis.isCategorical && axis.categoricalDomain) { return axis.categoricalDomain.map(function (entry, index) { return { coordinate: scale(entry) + offset, value: entry, index: index, offset: offset }; }); } if (scale.ticks && !isAll) { return scale.ticks(axis.tickCount).map(function (entry) { return { coordinate: scale(entry) + offset, value: entry, offset: offset }; }); } // When axis has duplicated text, serial numbers are used to generate scale return scale.domain().map(function (entry, index) { return { coordinate: scale(entry) + offset, value: duplicateDomain ? duplicateDomain[entry] : entry, index: index, offset: offset }; }); }; /** * combine the handlers * @param {Function} defaultHandler Internal private handler * @param {Function} childHandler Handler function specified in child component * @return {Function} The combined handler */ var handlerWeakMap = new WeakMap(); var combineEventHandlers = function combineEventHandlers(defaultHandler, childHandler) { if (typeof childHandler !== 'function') { return defaultHandler; } if (!handlerWeakMap.has(defaultHandler)) { handlerWeakMap.set(defaultHandler, new WeakMap()); } var childWeakMap = handlerWeakMap.get(defaultHandler); if (childWeakMap.has(childHandler)) { return childWeakMap.get(childHandler); } var combineHandler = function combineHandler() { defaultHandler.apply(void 0, arguments); childHandler.apply(void 0, arguments); }; childWeakMap.set(childHandler, combineHandler); return combineHandler; }; /** * Parse the scale function of axis * @param {Object} axis The option of axis * @param {String} chartType The displayName of chart * @param {Boolean} hasBar if it has a bar * @return {object} The scale function and resolved name */ var parseScale = function parseScale(axis, chartType, hasBar) { var scale = axis.scale, type = axis.type, layout = axis.layout, axisType = axis.axisType; if (scale === 'auto') { if (layout === 'radial' && axisType === 'radiusAxis') { return { scale: band/* default */.A(), realScaleType: 'band' }; } if (layout === 'radial' && axisType === 'angleAxis') { return { scale: linear/* default */.A(), realScaleType: 'linear' }; } if (type === 'category' && chartType && (chartType.indexOf('LineChart') >= 0 || chartType.indexOf('AreaChart') >= 0 || chartType.indexOf('ComposedChart') >= 0 && !hasBar)) { return { scale: band/* point */.z(), realScaleType: 'point' }; } if (type === 'category') { return { scale: band/* default */.A(), realScaleType: 'band' }; } return { scale: linear/* default */.A(), realScaleType: 'linear' }; } if (isString_default()(scale)) { var name = "scale".concat(upperFirst_default()(scale)); return { scale: (d3_scale[name] || band/* point */.z)(), realScaleType: d3_scale[name] ? name : 'point' }; } return isFunction_default()(scale) ? { scale: scale } : { scale: band/* point */.z(), realScaleType: 'point' }; }; var EPS = 1e-4; var checkDomainOfScale = function checkDomainOfScale(scale) { var domain = scale.domain(); if (!domain || domain.length <= 2) { return; } var len = domain.length; var range = scale.range(); var minValue = Math.min(range[0], range[1]) - EPS; var maxValue = Math.max(range[0], range[1]) + EPS; var first = scale(domain[0]); var last = scale(domain[len - 1]); if (first < minValue || first > maxValue || last < minValue || last > maxValue) { scale.domain([domain[0], domain[len - 1]]); } }; var findPositionOfBar = function findPositionOfBar(barPosition, child) { if (!barPosition) { return null; } for (var i = 0, len = barPosition.length; i < len; i++) { if (barPosition[i].item === child) { return barPosition[i].position; } } return null; }; /** * Both value and domain are tuples of two numbers * - but the type stays as array of numbers until we have better support in rest of the app * @param {Array} value input that will be truncated * @param {Array} domain boundaries * @returns {Array} tuple of two numbers */ var truncateByDomain = function truncateByDomain(value, domain) { if (!domain || domain.length !== 2 || !isNumber(domain[0]) || !isNumber(domain[1])) { return value; } var minValue = Math.min(domain[0], domain[1]); var maxValue = Math.max(domain[0], domain[1]); var result = [value[0], value[1]]; if (!isNumber(value[0]) || value[0] < minValue) { result[0] = minValue; } if (!isNumber(value[1]) || value[1] > maxValue) { result[1] = maxValue; } if (result[0] > maxValue) { result[0] = maxValue; } if (result[1] < minValue) { result[1] = minValue; } return result; }; /** * Stacks all positive numbers above zero and all negative numbers below zero. * * If all values in the series are positive then this behaves the same as 'none' stacker. * * @param {Array} series from d3-shape Stack * @return {Array} series with applied offset */ var offsetSign = function offsetSign(series) { var n = series.length; if (n <= 0) { return; } for (var j = 0, m = series[0].length; j < m; ++j) { var positive = 0; var negative = 0; for (var i = 0; i < n; ++i) { var value = isNaN_default()(series[i][j][1]) ? series[i][j][0] : series[i][j][1]; /* eslint-disable prefer-destructuring, no-param-reassign */ if (value >= 0) { series[i][j][0] = positive; series[i][j][1] = positive + value; positive = series[i][j][1]; } else { series[i][j][0] = negative; series[i][j][1] = negative + value; negative = series[i][j][1]; } /* eslint-enable prefer-destructuring, no-param-reassign */ } } }; /** * Replaces all negative values with zero when stacking data. * * If all values in the series are positive then this behaves the same as 'none' stacker. * * @param {Array} series from d3-shape Stack * @return {Array} series with applied offset */ var offsetPositive = function offsetPositive(series) { var n = series.length; if (n <= 0) { return; } for (var j = 0, m = series[0].length; j < m; ++j) { var positive = 0; for (var i = 0; i < n; ++i) { var value = isNaN_default()(series[i][j][1]) ? series[i][j][0] : series[i][j][1]; /* eslint-disable prefer-destructuring, no-param-reassign */ if (value >= 0) { series[i][j][0] = positive; series[i][j][1] = positive + value; positive = series[i][j][1]; } else { series[i][j][0] = 0; series[i][j][1] = 0; } /* eslint-enable prefer-destructuring, no-param-reassign */ } } }; /** * Function type to compute offset for stacked data. * * d3-shape has something fishy going on with its types. * In @definitelytyped/d3-shape, this function (the offset accessor) is typed as Series<> => void. * However! When I actually open the storybook I can see that the offset accessor actually receives Array>. * The same I can see in the source code itself: * https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/66042 * That one unfortunately has no types but we can tell it passes three-dimensional array. * * Which leads me to believe that definitelytyped is wrong on this one. * There's open discussion on this topic without much attention: * https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/66042 */ var STACK_OFFSET_MAP = { sign: offsetSign, // @ts-expect-error definitelytyped types are incorrect expand: expand/* default */.A, // @ts-expect-error definitelytyped types are incorrect none: none/* default */.A, // @ts-expect-error definitelytyped types are incorrect silhouette: silhouette/* default */.A, // @ts-expect-error definitelytyped types are incorrect wiggle: wiggle/* default */.A, positive: offsetPositive }; var getStackedData = function getStackedData(data, stackItems, offsetType) { var dataKeys = stackItems.map(function (item) { return item.props.dataKey; }); var offsetAccessor = STACK_OFFSET_MAP[offsetType]; var stack = (0,src_stack/* default */.A)() // @ts-expect-error stack.keys type wants an array of strings, but we provide array of DataKeys .keys(dataKeys).value(function (d, key) { return +getValueByDataKey(d, key, 0); }).order(order_none/* default */.A) // @ts-expect-error definitelytyped types are incorrect .offset(offsetAccessor); return stack(data); }; var getStackGroupsByAxisId = function getStackGroupsByAxisId(data, _items, numericAxisId, cateAxisId, offsetType, reverseStackOrder) { if (!data) { return null; } // reversing items to affect render order (for layering) var items = reverseStackOrder ? _items.reverse() : _items; var parentStackGroupsInitialValue = {}; var stackGroups = items.reduce(function (result, item) { var _item$type2; var defaultedProps = (_item$type2 = item.type) !== null && _item$type2 !== void 0 && _item$type2.defaultProps ? _objectSpread(_objectSpread({}, item.type.defaultProps), item.props) : item.props; var stackId = defaultedProps.stackId, hide = defaultedProps.hide; if (hide) { return result; } var axisId = defaultedProps[numericAxisId]; var parentGroup = result[axisId] || { hasStack: false, stackGroups: {} }; if ((0,DataUtils/* isNumOrStr */.vh)(stackId)) { var childGroup = parentGroup.stackGroups[stackId] || { numericAxisId: numericAxisId, cateAxisId: cateAxisId, items: [] }; childGroup.items.push(item); parentGroup.hasStack = true; parentGroup.stackGroups[stackId] = childGroup; } else { parentGroup.stackGroups[(0,DataUtils/* uniqueId */.NF)('_stackId_')] = { numericAxisId: numericAxisId, cateAxisId: cateAxisId, items: [item] }; } return _objectSpread(_objectSpread({}, result), {}, ChartUtils_defineProperty({}, axisId, parentGroup)); }, parentStackGroupsInitialValue); var axisStackGroupsInitialValue = {}; return Object.keys(stackGroups).reduce(function (result, axisId) { var group = stackGroups[axisId]; if (group.hasStack) { var stackGroupsInitialValue = {}; group.stackGroups = Object.keys(group.stackGroups).reduce(function (res, stackId) { var g = group.stackGroups[stackId]; return _objectSpread(_objectSpread({}, res), {}, ChartUtils_defineProperty({}, stackId, { numericAxisId: numericAxisId, cateAxisId: cateAxisId, items: g.items, stackedData: getStackedData(data, g.items, offsetType) })); }, stackGroupsInitialValue); } return _objectSpread(_objectSpread({}, result), {}, ChartUtils_defineProperty({}, axisId, group)); }, axisStackGroupsInitialValue); }; /** * Configure the scale function of axis * @param {Object} scale The scale function * @param {Object} opts The configuration of axis * @return {Object} null */ var getTicksOfScale = function getTicksOfScale(scale, opts) { var realScaleType = opts.realScaleType, type = opts.type, tickCount = opts.tickCount, originalDomain = opts.originalDomain, allowDecimals = opts.allowDecimals; var scaleType = realScaleType || opts.scale; if (scaleType !== 'auto' && scaleType !== 'linear') { return null; } if (tickCount && type === 'number' && originalDomain && (originalDomain[0] === 'auto' || originalDomain[1] === 'auto')) { // Calculate the ticks by the number of grid when the axis is a number axis var domain = scale.domain(); if (!domain.length) { return null; } var tickValues = getNiceTickValues(domain, tickCount, allowDecimals); scale.domain([min_default()(tickValues), max_default()(tickValues)]); return { niceTicks: tickValues }; } if (tickCount && type === 'number') { var _domain = scale.domain(); var _tickValues = getTickValuesFixedDomain(_domain, tickCount, allowDecimals); return { niceTicks: _tickValues }; } return null; }; function getCateCoordinateOfLine(_ref5) { var axis = _ref5.axis, ticks = _ref5.ticks, bandSize = _ref5.bandSize, entry = _ref5.entry, index = _ref5.index, dataKey = _ref5.dataKey; if (axis.type === 'category') { // find coordinate of category axis by the value of category // @ts-expect-error why does this use direct object access instead of getValueByDataKey? if (!axis.allowDuplicatedCategory && axis.dataKey && !isNil(entry[axis.dataKey])) { // @ts-expect-error why does this use direct object access instead of getValueByDataKey? var matchedTick = findEntryInArray(ticks, 'value', entry[axis.dataKey]); if (matchedTick) { return matchedTick.coordinate + bandSize / 2; } } return ticks[index] ? ticks[index].coordinate + bandSize / 2 : null; } var value = getValueByDataKey(entry, !isNil(dataKey) ? dataKey : axis.dataKey); return !isNil(value) ? axis.scale(value) : null; } var getCateCoordinateOfBar = function getCateCoordinateOfBar(_ref6) { var axis = _ref6.axis, ticks = _ref6.ticks, offset = _ref6.offset, bandSize = _ref6.bandSize, entry = _ref6.entry, index = _ref6.index; if (axis.type === 'category') { return ticks[index] ? ticks[index].coordinate + offset : null; } var value = getValueByDataKey(entry, axis.dataKey, axis.domain[index]); return !isNil(value) ? axis.scale(value) - bandSize / 2 + offset : null; }; var getBaseValueOfBar = function getBaseValueOfBar(_ref7) { var numericAxis = _ref7.numericAxis; var domain = numericAxis.scale.domain(); if (numericAxis.type === 'number') { var minValue = Math.min(domain[0], domain[1]); var maxValue = Math.max(domain[0], domain[1]); if (minValue <= 0 && maxValue >= 0) { return 0; } if (maxValue < 0) { return maxValue; } return minValue; } return domain[0]; }; var getStackedDataOfItem = function getStackedDataOfItem(item, stackGroups) { var _item$type3; var defaultedProps = (_item$type3 = item.type) !== null && _item$type3 !== void 0 && _item$type3.defaultProps ? _objectSpread(_objectSpread({}, item.type.defaultProps), item.props) : item.props; var stackId = defaultedProps.stackId; if ((0,DataUtils/* isNumOrStr */.vh)(stackId)) { var group = stackGroups[stackId]; if (group) { var itemIndex = group.items.indexOf(item); return itemIndex >= 0 ? group.stackedData[itemIndex] : null; } } return null; }; var getDomainOfSingle = function getDomainOfSingle(data) { return data.reduce(function (result, entry) { return [min_default()(entry.concat([result[0]]).filter(DataUtils/* isNumber */.Et)), max_default()(entry.concat([result[1]]).filter(DataUtils/* isNumber */.Et))]; }, [Infinity, -Infinity]); }; var getDomainOfStackGroups = function getDomainOfStackGroups(stackGroups, startIndex, endIndex) { return Object.keys(stackGroups).reduce(function (result, stackId) { var group = stackGroups[stackId]; var stackedData = group.stackedData; var domain = stackedData.reduce(function (res, entry) { var s = getDomainOfSingle(entry.slice(startIndex, endIndex + 1)); return [Math.min(res[0], s[0]), Math.max(res[1], s[1])]; }, [Infinity, -Infinity]); return [Math.min(domain[0], result[0]), Math.max(domain[1], result[1])]; }, [Infinity, -Infinity]).map(function (result) { return result === Infinity || result === -Infinity ? 0 : result; }); }; var MIN_VALUE_REG = /^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/; var MAX_VALUE_REG = /^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/; var parseSpecifiedDomain = function parseSpecifiedDomain(specifiedDomain, dataDomain, allowDataOverflow) { if (isFunction_default()(specifiedDomain)) { return specifiedDomain(dataDomain, allowDataOverflow); } if (!Array.isArray(specifiedDomain)) { return dataDomain; } var domain = []; /* eslint-disable prefer-destructuring */ if ((0,DataUtils/* isNumber */.Et)(specifiedDomain[0])) { domain[0] = allowDataOverflow ? specifiedDomain[0] : Math.min(specifiedDomain[0], dataDomain[0]); } else if (MIN_VALUE_REG.test(specifiedDomain[0])) { var value = +MIN_VALUE_REG.exec(specifiedDomain[0])[1]; domain[0] = dataDomain[0] - value; } else if (isFunction_default()(specifiedDomain[0])) { domain[0] = specifiedDomain[0](dataDomain[0]); } else { domain[0] = dataDomain[0]; } if ((0,DataUtils/* isNumber */.Et)(specifiedDomain[1])) { domain[1] = allowDataOverflow ? specifiedDomain[1] : Math.max(specifiedDomain[1], dataDomain[1]); } else if (MAX_VALUE_REG.test(specifiedDomain[1])) { var _value = +MAX_VALUE_REG.exec(specifiedDomain[1])[1]; domain[1] = dataDomain[1] + _value; } else if (isFunction_default()(specifiedDomain[1])) { domain[1] = specifiedDomain[1](dataDomain[1]); } else { domain[1] = dataDomain[1]; } /* eslint-enable prefer-destructuring */ return domain; }; /** * Calculate the size between two category * @param {Object} axis The options of axis * @param {Array} ticks The ticks of axis * @param {Boolean} isBar if items in axis are bars * @return {Number} Size */ var getBandSizeOfAxis = function getBandSizeOfAxis(axis, ticks, isBar) { // @ts-expect-error we need to rethink scale type if (axis && axis.scale && axis.scale.bandwidth) { // @ts-expect-error we need to rethink scale type var bandWidth = axis.scale.bandwidth(); if (!isBar || bandWidth > 0) { return bandWidth; } } if (axis && ticks && ticks.length >= 2) { var orderedTicks = sortBy_default()(ticks, function (o) { return o.coordinate; }); var bandSize = Infinity; for (var i = 1, len = orderedTicks.length; i < len; i++) { var cur = orderedTicks[i]; var prev = orderedTicks[i - 1]; bandSize = Math.min((cur.coordinate || 0) - (prev.coordinate || 0), bandSize); } return bandSize === Infinity ? 0 : bandSize; } return isBar ? undefined : 0; }; /** * parse the domain of a category axis when a domain is specified * @param {Array} specifiedDomain The domain specified by users * @param {Array} calculatedDomain The domain calculated by dateKey * @param {ReactElement} axisChild The axis ReactElement * @returns {Array} domains */ var parseDomainOfCategoryAxis = function parseDomainOfCategoryAxis(specifiedDomain, calculatedDomain, axisChild) { if (!specifiedDomain || !specifiedDomain.length) { return calculatedDomain; } if (isEqual_default()(specifiedDomain, get_default()(axisChild, 'type.defaultProps.domain'))) { return calculatedDomain; } return specifiedDomain; }; var getTooltipItem = function getTooltipItem(graphicalItem, payload) { var defaultedProps = graphicalItem.type.defaultProps ? _objectSpread(_objectSpread({}, graphicalItem.type.defaultProps), graphicalItem.props) : graphicalItem.props; var dataKey = defaultedProps.dataKey, name = defaultedProps.name, unit = defaultedProps.unit, formatter = defaultedProps.formatter, tooltipType = defaultedProps.tooltipType, chartType = defaultedProps.chartType, hide = defaultedProps.hide; return _objectSpread(_objectSpread({}, (0,ReactUtils/* filterProps */.J9)(graphicalItem, false)), {}, { dataKey: dataKey, unit: unit, formatter: formatter, name: name || dataKey, color: getMainColorOfGraphicItem(graphicalItem), value: getValueByDataKey(payload, dataKey), type: tooltipType, payload: payload, chartType: chartType, hide: hide }); }; /***/ }), /***/ 3521: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ b: () => (/* binding */ shallowEqual) /* harmony export */ }); function shallowEqual(a, b) { /* eslint-disable no-restricted-syntax */ for (var key in a) { if ({}.hasOwnProperty.call(a, key) && (!{}.hasOwnProperty.call(b, key) || a[key] !== b[key])) { return false; } } for (var _key in b) { if ({}.hasOwnProperty.call(b, _key) && !{}.hasOwnProperty.call(a, _key)) { return false; } } return true; } /***/ }), /***/ 3716: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ wE: () => (/* binding */ compile) /* harmony export */ }); /* unused harmony exports parse, ruleset, comment, declaration */ /* harmony import */ var _Enum_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4534); /* harmony import */ var _Utility_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9735); /* harmony import */ var _Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(390); /** * @param {string} value * @return {object[]} */ function compile (value) { return (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .dealloc */ .VF)(parse('', null, null, null, [''], value = (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .alloc */ .c4)(value), 0, [0], value)) } /** * @param {string} value * @param {object} root * @param {object?} parent * @param {string[]} rule * @param {string[]} rules * @param {string[]} rulesets * @param {number[]} pseudo * @param {number[]} points * @param {string[]} declarations * @return {object} */ function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) { var index = 0 var offset = 0 var length = pseudo var atrule = 0 var property = 0 var previous = 0 var variable = 1 var scanning = 1 var ampersand = 1 var character = 0 var type = '' var props = rules var children = rulesets var reference = rule var characters = type while (scanning) switch (previous = character, character = (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .next */ .K2)()) { // ( case 40: if (previous != 108 && (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .charat */ .wN)(characters, length - 1) == 58) { if ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .indexof */ .K5)(characters += (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .replace */ .HC)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .delimit */ .Tb)(character), '&', '&\f'), '&\f') != -1) ampersand = -1 break } // " ' [ case 34: case 39: case 91: characters += (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .delimit */ .Tb)(character) break // \t \n \r \s case 9: case 10: case 13: case 32: characters += (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .whitespace */ .mw)(previous) break // \ case 92: characters += (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .escaping */ .Nc)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .caret */ .OW)() - 1, 7) continue // / case 47: switch ((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .peek */ .se)()) { case 42: case 47: ;(0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .append */ .BC)(comment((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .commenter */ .nf)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .next */ .K2)(), (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .caret */ .OW)()), root, parent), declarations) break default: characters += '/' } break // { case 123 * variable: points[index++] = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .strlen */ .b2)(characters) * ampersand // } ; \0 case 125 * variable: case 59: case 0: switch (character) { // \0 } case 0: case 125: scanning = 0 // ; case 59 + offset: if (ampersand == -1) characters = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .replace */ .HC)(characters, /\f/g, '') if (property > 0 && ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .strlen */ .b2)(characters) - length)) (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .append */ .BC)(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .replace */ .HC)(characters, ' ', '') + ';', rule, parent, length - 2), declarations) break // @ ; case 59: characters += ';' // { rule/at-rule default: ;(0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .append */ .BC)(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets) if (character === 123) if (offset === 0) parse(characters, root, reference, reference, props, rulesets, length, points, children) else switch (atrule === 99 && (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .charat */ .wN)(characters, 3) === 110 ? 100 : atrule) { // d l m s case 100: case 108: case 109: case 115: parse(value, reference, reference, rule && (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .append */ .BC)(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children) break default: parse(characters, reference, reference, reference, [''], children, 0, points, children) } } index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo break // : case 58: length = 1 + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .strlen */ .b2)(characters), property = previous default: if (variable < 1) if (character == 123) --variable else if (character == 125 && variable++ == 0 && (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .prev */ .YL)() == 125) continue switch (characters += (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .from */ .HT)(character), character * variable) { // & case 38: ampersand = offset > 0 ? 1 : (characters += '\f', -1) break // , case 44: points[index++] = ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .strlen */ .b2)(characters) - 1) * ampersand, ampersand = 1 break // @ case 64: // - if ((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .peek */ .se)() === 45) characters += (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .delimit */ .Tb)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .next */ .K2)()) atrule = (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .peek */ .se)(), offset = length = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .strlen */ .b2)(type = characters += (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .identifier */ .Cv)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .caret */ .OW)())), character++ break // - case 45: if (previous === 45 && (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .strlen */ .b2)(characters) == 2) variable = 0 } } return rulesets } /** * @param {string} value * @param {object} root * @param {object?} parent * @param {number} index * @param {number} offset * @param {string[]} rules * @param {number[]} points * @param {string} type * @param {string[]} props * @param {string[]} children * @param {number} length * @return {object} */ function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) { var post = offset - 1 var rule = offset === 0 ? rules : [''] var size = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .sizeof */ .FK)(rule) for (var i = 0, j = 0, k = 0; i < index; ++i) for (var x = 0, y = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .substr */ .c1)(value, post + 1, post = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .abs */ .tn)(j = points[i])), z = value; x < size; ++x) if (z = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .trim */ .Bq)(j > 0 ? rule[x] + ' ' + y : (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .replace */ .HC)(y, /&\f/g, rule[x]))) props[k++] = z return (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .node */ .rH)(value, root, parent, offset === 0 ? _Enum_js__WEBPACK_IMPORTED_MODULE_2__/* .RULESET */ .XZ : type, props, children, length) } /** * @param {number} value * @param {object} root * @param {object?} parent * @return {object} */ function comment (value, root, parent) { return (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .node */ .rH)(value, root, parent, _Enum_js__WEBPACK_IMPORTED_MODULE_2__/* .COMMENT */ .YK, (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .from */ .HT)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .char */ .Tp)()), (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .substr */ .c1)(value, 2, -2), 0) } /** * @param {string} value * @param {object} root * @param {object?} parent * @param {number} length * @return {object} */ function declaration (value, root, parent, length) { return (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__/* .node */ .rH)(value, root, parent, _Enum_js__WEBPACK_IMPORTED_MODULE_2__/* .DECLARATION */ .LU, (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .substr */ .c1)(value, 0, length), (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__/* .substr */ .c1)(value, length + 1, -1), length) } /***/ }), /***/ 4040: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ IZ: () => (/* binding */ polarToCartesian), /* harmony export */ Kg: () => (/* binding */ RADIAN), /* harmony export */ Zk: () => (/* binding */ getTickClassName), /* harmony export */ lY: () => (/* binding */ getMaxRadius), /* harmony export */ pr: () => (/* binding */ formatAxisMap), /* harmony export */ yy: () => (/* binding */ inRangeOfSector) /* harmony export */ }); /* unused harmony exports degreeToRadian, radianToDegree, distanceBetweenPoints, getAngleOfPoint, formatAngleOfSector */ /* harmony import */ var lodash_isNil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9843); /* harmony import */ var lodash_isNil__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_isNil__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6540); /* harmony import */ var lodash_isFunction__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1882); /* harmony import */ var lodash_isFunction__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_isFunction__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _DataUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9744); /* harmony import */ var _ChartUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(3198); function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } var RADIAN = Math.PI / 180; var degreeToRadian = function degreeToRadian(angle) { return angle * Math.PI / 180; }; var radianToDegree = function radianToDegree(angleInRadian) { return angleInRadian * 180 / Math.PI; }; var polarToCartesian = function polarToCartesian(cx, cy, radius, angle) { return { x: cx + Math.cos(-RADIAN * angle) * radius, y: cy + Math.sin(-RADIAN * angle) * radius }; }; var getMaxRadius = function getMaxRadius(width, height) { var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { top: 0, right: 0, bottom: 0, left: 0 }; return Math.min(Math.abs(width - (offset.left || 0) - (offset.right || 0)), Math.abs(height - (offset.top || 0) - (offset.bottom || 0))) / 2; }; /** * Calculate the scale function, position, width, height of axes * @param {Object} props Latest props * @param {Object} axisMap The configuration of axes * @param {Object} offset The offset of main part in the svg element * @param {Object} axisType The type of axes, radius-axis or angle-axis * @param {String} chartName The name of chart * @return {Object} Configuration */ var formatAxisMap = function formatAxisMap(props, axisMap, offset, axisType, chartName) { var width = props.width, height = props.height; var startAngle = props.startAngle, endAngle = props.endAngle; var cx = (0,_DataUtils__WEBPACK_IMPORTED_MODULE_3__/* .getPercentValue */ .F4)(props.cx, width, width / 2); var cy = (0,_DataUtils__WEBPACK_IMPORTED_MODULE_3__/* .getPercentValue */ .F4)(props.cy, height, height / 2); var maxRadius = getMaxRadius(width, height, offset); var innerRadius = (0,_DataUtils__WEBPACK_IMPORTED_MODULE_3__/* .getPercentValue */ .F4)(props.innerRadius, maxRadius, 0); var outerRadius = (0,_DataUtils__WEBPACK_IMPORTED_MODULE_3__/* .getPercentValue */ .F4)(props.outerRadius, maxRadius, maxRadius * 0.8); var ids = Object.keys(axisMap); return ids.reduce(function (result, id) { var axis = axisMap[id]; var domain = axis.domain, reversed = axis.reversed; var range; if (lodash_isNil__WEBPACK_IMPORTED_MODULE_0___default()(axis.range)) { if (axisType === 'angleAxis') { range = [startAngle, endAngle]; } else if (axisType === 'radiusAxis') { range = [innerRadius, outerRadius]; } if (reversed) { range = [range[1], range[0]]; } } else { range = axis.range; var _range = range; var _range2 = _slicedToArray(_range, 2); startAngle = _range2[0]; endAngle = _range2[1]; } var _parseScale = (0,_ChartUtils__WEBPACK_IMPORTED_MODULE_4__/* .parseScale */ .W7)(axis, chartName), realScaleType = _parseScale.realScaleType, scale = _parseScale.scale; scale.domain(domain).range(range); (0,_ChartUtils__WEBPACK_IMPORTED_MODULE_4__/* .checkDomainOfScale */ .YB)(scale); var ticks = (0,_ChartUtils__WEBPACK_IMPORTED_MODULE_4__/* .getTicksOfScale */ .w7)(scale, _objectSpread(_objectSpread({}, axis), {}, { realScaleType: realScaleType })); var finalAxis = _objectSpread(_objectSpread(_objectSpread({}, axis), ticks), {}, { range: range, radius: outerRadius, realScaleType: realScaleType, scale: scale, cx: cx, cy: cy, innerRadius: innerRadius, outerRadius: outerRadius, startAngle: startAngle, endAngle: endAngle }); return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, id, finalAxis)); }, {}); }; var distanceBetweenPoints = function distanceBetweenPoints(point, anotherPoint) { var x1 = point.x, y1 = point.y; var x2 = anotherPoint.x, y2 = anotherPoint.y; return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2)); }; var getAngleOfPoint = function getAngleOfPoint(_ref, _ref2) { var x = _ref.x, y = _ref.y; var cx = _ref2.cx, cy = _ref2.cy; var radius = distanceBetweenPoints({ x: x, y: y }, { x: cx, y: cy }); if (radius <= 0) { return { radius: radius }; } var cos = (x - cx) / radius; var angleInRadian = Math.acos(cos); if (y > cy) { angleInRadian = 2 * Math.PI - angleInRadian; } return { radius: radius, angle: radianToDegree(angleInRadian), angleInRadian: angleInRadian }; }; var formatAngleOfSector = function formatAngleOfSector(_ref3) { var startAngle = _ref3.startAngle, endAngle = _ref3.endAngle; var startCnt = Math.floor(startAngle / 360); var endCnt = Math.floor(endAngle / 360); var min = Math.min(startCnt, endCnt); return { startAngle: startAngle - min * 360, endAngle: endAngle - min * 360 }; }; var reverseFormatAngleOfSetor = function reverseFormatAngleOfSetor(angle, _ref4) { var startAngle = _ref4.startAngle, endAngle = _ref4.endAngle; var startCnt = Math.floor(startAngle / 360); var endCnt = Math.floor(endAngle / 360); var min = Math.min(startCnt, endCnt); return angle + min * 360; }; var inRangeOfSector = function inRangeOfSector(_ref5, sector) { var x = _ref5.x, y = _ref5.y; var _getAngleOfPoint = getAngleOfPoint({ x: x, y: y }, sector), radius = _getAngleOfPoint.radius, angle = _getAngleOfPoint.angle; var innerRadius = sector.innerRadius, outerRadius = sector.outerRadius; if (radius < innerRadius || radius > outerRadius) { return false; } if (radius === 0) { return true; } var _formatAngleOfSector = formatAngleOfSector(sector), startAngle = _formatAngleOfSector.startAngle, endAngle = _formatAngleOfSector.endAngle; var formatAngle = angle; var inRange; if (startAngle <= endAngle) { while (formatAngle > endAngle) { formatAngle -= 360; } while (formatAngle < startAngle) { formatAngle += 360; } inRange = formatAngle >= startAngle && formatAngle <= endAngle; } else { while (formatAngle > startAngle) { formatAngle -= 360; } while (formatAngle < endAngle) { formatAngle += 360; } inRange = formatAngle >= endAngle && formatAngle <= startAngle; } if (inRange) { return _objectSpread(_objectSpread({}, sector), {}, { radius: radius, angle: reverseFormatAngleOfSetor(formatAngle, sector) }); } return null; }; var getTickClassName = function getTickClassName(tick) { return ! /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.isValidElement)(tick) && !lodash_isFunction__WEBPACK_IMPORTED_MODULE_2___default()(tick) && typeof tick !== 'boolean' ? tick.className : ''; }; /***/ }), /***/ 4501: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ AW: () => (/* binding */ parseChildIndex), /* harmony export */ BU: () => (/* binding */ findChildByType), /* harmony export */ J9: () => (/* binding */ filterProps), /* harmony export */ Me: () => (/* binding */ validateWidthHeight), /* harmony export */ Mn: () => (/* binding */ getDisplayName), /* harmony export */ OV: () => (/* binding */ isChildrenEqual), /* harmony export */ X_: () => (/* binding */ getReactEventByType), /* harmony export */ aS: () => (/* binding */ findAllByType), /* harmony export */ ee: () => (/* binding */ renderByOrder) /* harmony export */ }); /* unused harmony exports SCALE_TYPES, LEGEND_TYPES, TOOLTIP_TYPES, toArray, withoutType, hasClipDot, isValidSpreadableProp, filterSvgElements, isSingleChildEqual */ /* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8156); /* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_get__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var lodash_isNil__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9843); /* harmony import */ var lodash_isNil__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_isNil__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var lodash_isString__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5015); /* harmony import */ var lodash_isString__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_isString__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var lodash_isFunction__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1882); /* harmony import */ var lodash_isFunction__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_isFunction__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(3805); /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash_isObject__WEBPACK_IMPORTED_MODULE_4__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6540); /* harmony import */ var react_is__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4363); /* harmony import */ var _DataUtils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(9744); /* harmony import */ var _ShallowEqual__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(3521); /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(8940); var _excluded = ["children"], _excluded2 = ["children"]; function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; } function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } var REACT_BROWSER_EVENT_MAP = { click: 'onClick', mousedown: 'onMouseDown', mouseup: 'onMouseUp', mouseover: 'onMouseOver', mousemove: 'onMouseMove', mouseout: 'onMouseOut', mouseenter: 'onMouseEnter', mouseleave: 'onMouseLeave', touchcancel: 'onTouchCancel', touchend: 'onTouchEnd', touchmove: 'onTouchMove', touchstart: 'onTouchStart', contextmenu: 'onContextMenu', dblclick: 'onDoubleClick' }; var SCALE_TYPES = (/* unused pure expression or super */ null && (['auto', 'linear', 'pow', 'sqrt', 'log', 'identity', 'time', 'band', 'point', 'ordinal', 'quantile', 'quantize', 'utc', 'sequential', 'threshold'])); var LEGEND_TYPES = (/* unused pure expression or super */ null && (['plainline', 'line', 'square', 'rect', 'circle', 'cross', 'diamond', 'star', 'triangle', 'wye', 'none'])); var TOOLTIP_TYPES = (/* unused pure expression or super */ null && (['none'])); /** * Get the display name of a component * @param {Object} Comp Specified Component * @return {String} Display name of Component */ var getDisplayName = function getDisplayName(Comp) { if (typeof Comp === 'string') { return Comp; } if (!Comp) { return ''; } return Comp.displayName || Comp.name || 'Component'; }; // `toArray` gets called multiple times during the render // so we can memoize last invocation (since reference to `children` is the same) var lastChildren = null; var lastResult = null; var toArray = function toArray(children) { if (children === lastChildren && Array.isArray(lastResult)) { return lastResult; } var result = []; react__WEBPACK_IMPORTED_MODULE_5__.Children.forEach(children, function (child) { if (lodash_isNil__WEBPACK_IMPORTED_MODULE_1___default()(child)) return; if ((0,react_is__WEBPACK_IMPORTED_MODULE_6__.isFragment)(child)) { result = result.concat(toArray(child.props.children)); } else { // @ts-expect-error this could still be Iterable and TS does not like that result.push(child); } }); lastResult = result; lastChildren = children; return result; }; /* * Find and return all matched children by type. * `type` must be a React.ComponentType */ function findAllByType(children, type) { var result = []; var types = []; if (Array.isArray(type)) { types = type.map(function (t) { return getDisplayName(t); }); } else { types = [getDisplayName(type)]; } toArray(children).forEach(function (child) { var childType = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(child, 'type.displayName') || lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(child, 'type.name'); if (types.indexOf(childType) !== -1) { result.push(child); } }); return result; } /* * Return the first matched child by type, return null otherwise. * `type` must be a React.ComponentType */ function findChildByType(children, type) { var result = findAllByType(children, type); return result && result[0]; } /* * Create a new array of children excluding the ones matched the type */ var withoutType = function withoutType(children, type) { var newChildren = []; var types; if (Array.isArray(type)) { types = type.map(function (t) { return getDisplayName(t); }); } else { types = [getDisplayName(type)]; } toArray(children).forEach(function (child) { var displayName = get(child, 'type.displayName'); if (displayName && types.indexOf(displayName) !== -1) { return; } newChildren.push(child); }); return newChildren; }; /** * validate the width and height props of a chart element * @param {Object} el A chart element * @return {Boolean} true If the props width and height are number, and greater than 0 */ var validateWidthHeight = function validateWidthHeight(el) { if (!el || !el.props) { return false; } var _el$props = el.props, width = _el$props.width, height = _el$props.height; if (!(0,_DataUtils__WEBPACK_IMPORTED_MODULE_7__/* .isNumber */ .Et)(width) || width <= 0 || !(0,_DataUtils__WEBPACK_IMPORTED_MODULE_7__/* .isNumber */ .Et)(height) || height <= 0) { return false; } return true; }; var SVG_TAGS = ['a', 'altGlyph', 'altGlyphDef', 'altGlyphItem', 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'circle', 'clipPath', 'color-profile', 'cursor', 'defs', 'desc', 'ellipse', 'feBlend', 'feColormatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence', 'filter', 'font', 'font-face', 'font-face-format', 'font-face-name', 'font-face-url', 'foreignObject', 'g', 'glyph', 'glyphRef', 'hkern', 'image', 'line', 'lineGradient', 'marker', 'mask', 'metadata', 'missing-glyph', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script', 'set', 'stop', 'style', 'svg', 'switch', 'symbol', 'text', 'textPath', 'title', 'tref', 'tspan', 'use', 'view', 'vkern']; var isSvgElement = function isSvgElement(child) { return child && child.type && lodash_isString__WEBPACK_IMPORTED_MODULE_2___default()(child.type) && SVG_TAGS.indexOf(child.type) >= 0; }; var hasClipDot = function hasClipDot(dot) { return dot && _typeof(dot) === 'object' && 'clipDot' in dot; }; /** * Checks if the property is valid to spread onto an SVG element or onto a specific component * @param {unknown} property property value currently being compared * @param {string} key property key currently being compared * @param {boolean} includeEvents if events are included in spreadable props * @param {boolean} svgElementType checks against map of SVG element types to attributes * @returns {boolean} is prop valid */ var isValidSpreadableProp = function isValidSpreadableProp(property, key, includeEvents, svgElementType) { var _FilteredElementKeyMa; /** * If the svg element type is explicitly included, check against the filtered element key map * to determine if there are attributes that should only exist on that element type. * @todo Add an internal cjs version of https://github.com/wooorm/svg-element-attributes for full coverage. */ var matchingElementTypeKeys = (_FilteredElementKeyMa = _types__WEBPACK_IMPORTED_MODULE_8__/* .FilteredElementKeyMap */ .VU === null || _types__WEBPACK_IMPORTED_MODULE_8__/* .FilteredElementKeyMap */ .VU === void 0 ? void 0 : _types__WEBPACK_IMPORTED_MODULE_8__/* .FilteredElementKeyMap */ .VU[svgElementType]) !== null && _FilteredElementKeyMa !== void 0 ? _FilteredElementKeyMa : []; return key.startsWith('data-') || !lodash_isFunction__WEBPACK_IMPORTED_MODULE_3___default()(property) && (svgElementType && matchingElementTypeKeys.includes(key) || _types__WEBPACK_IMPORTED_MODULE_8__/* .SVGElementPropKeys */ .QQ.includes(key)) || includeEvents && _types__WEBPACK_IMPORTED_MODULE_8__/* .EventKeys */ .j2.includes(key); }; /** * Filter all the svg elements of children * @param {Array} children The children of a react element * @return {Array} All the svg elements */ var filterSvgElements = function filterSvgElements(children) { var svgElements = []; toArray(children).forEach(function (entry) { if (isSvgElement(entry)) { svgElements.push(entry); } }); return svgElements; }; var filterProps = function filterProps(props, includeEvents, svgElementType) { if (!props || typeof props === 'function' || typeof props === 'boolean') { return null; } var inputProps = props; if ( /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_5__.isValidElement)(props)) { inputProps = props.props; } if (!lodash_isObject__WEBPACK_IMPORTED_MODULE_4___default()(inputProps)) { return null; } var out = {}; /** * Props are blindly spread onto SVG elements. This loop filters out properties that we don't want to spread. * Items filtered out are as follows: * - functions in properties that are SVG attributes (functions are included when includeEvents is true) * - props that are SVG attributes but don't matched the passed svgElementType * - any prop that is not in SVGElementPropKeys (or in EventKeys if includeEvents is true) */ Object.keys(inputProps).forEach(function (key) { var _inputProps; if (isValidSpreadableProp((_inputProps = inputProps) === null || _inputProps === void 0 ? void 0 : _inputProps[key], key, includeEvents, svgElementType)) { out[key] = inputProps[key]; } }); return out; }; /** * Wether props of children changed * @param {Object} nextChildren The latest children * @param {Object} prevChildren The prev children * @return {Boolean} equal or not */ var isChildrenEqual = function isChildrenEqual(nextChildren, prevChildren) { if (nextChildren === prevChildren) { return true; } var count = react__WEBPACK_IMPORTED_MODULE_5__.Children.count(nextChildren); if (count !== react__WEBPACK_IMPORTED_MODULE_5__.Children.count(prevChildren)) { return false; } if (count === 0) { return true; } if (count === 1) { // eslint-disable-next-line @typescript-eslint/no-use-before-define return isSingleChildEqual(Array.isArray(nextChildren) ? nextChildren[0] : nextChildren, Array.isArray(prevChildren) ? prevChildren[0] : prevChildren); } for (var i = 0; i < count; i++) { var nextChild = nextChildren[i]; var prevChild = prevChildren[i]; if (Array.isArray(nextChild) || Array.isArray(prevChild)) { if (!isChildrenEqual(nextChild, prevChild)) { return false; } // eslint-disable-next-line @typescript-eslint/no-use-before-define } else if (!isSingleChildEqual(nextChild, prevChild)) { return false; } } return true; }; var isSingleChildEqual = function isSingleChildEqual(nextChild, prevChild) { if (lodash_isNil__WEBPACK_IMPORTED_MODULE_1___default()(nextChild) && lodash_isNil__WEBPACK_IMPORTED_MODULE_1___default()(prevChild)) { return true; } if (!lodash_isNil__WEBPACK_IMPORTED_MODULE_1___default()(nextChild) && !lodash_isNil__WEBPACK_IMPORTED_MODULE_1___default()(prevChild)) { var _ref = nextChild.props || {}, nextChildren = _ref.children, nextProps = _objectWithoutProperties(_ref, _excluded); var _ref2 = prevChild.props || {}, prevChildren = _ref2.children, prevProps = _objectWithoutProperties(_ref2, _excluded2); if (nextChildren && prevChildren) { return (0,_ShallowEqual__WEBPACK_IMPORTED_MODULE_9__/* .shallowEqual */ .b)(nextProps, prevProps) && isChildrenEqual(nextChildren, prevChildren); } if (!nextChildren && !prevChildren) { return (0,_ShallowEqual__WEBPACK_IMPORTED_MODULE_9__/* .shallowEqual */ .b)(nextProps, prevProps); } return false; } return false; }; var renderByOrder = function renderByOrder(children, renderMap) { var elements = []; var record = {}; toArray(children).forEach(function (child, index) { if (isSvgElement(child)) { elements.push(child); } else if (child) { var displayName = getDisplayName(child.type); var _ref3 = renderMap[displayName] || {}, handler = _ref3.handler, once = _ref3.once; if (handler && (!once || !record[displayName])) { var results = handler(child, displayName, index); elements.push(results); record[displayName] = true; } } }); return elements; }; var getReactEventByType = function getReactEventByType(e) { var type = e && e.type; if (type && REACT_BROWSER_EVENT_MAP[type]) { return REACT_BROWSER_EVENT_MAP[type]; } return null; }; var parseChildIndex = function parseChildIndex(child, children) { return toArray(children).indexOf(child); }; /***/ }), /***/ 4534: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ IO: () => (/* binding */ LAYER), /* harmony export */ LU: () => (/* binding */ DECLARATION), /* harmony export */ MS: () => (/* binding */ MS), /* harmony export */ Sv: () => (/* binding */ KEYFRAMES), /* harmony export */ XZ: () => (/* binding */ RULESET), /* harmony export */ YK: () => (/* binding */ COMMENT), /* harmony export */ j: () => (/* binding */ WEBKIT), /* harmony export */ vd: () => (/* binding */ MOZ), /* harmony export */ yE: () => (/* binding */ IMPORT) /* harmony export */ }); /* unused harmony exports PAGE, MEDIA, CHARSET, VIEWPORT, SUPPORTS, DOCUMENT, NAMESPACE, FONT_FACE, COUNTER_STYLE, FONT_FEATURE_VALUES */ var MS = '-ms-' var MOZ = '-moz-' var WEBKIT = '-webkit-' var COMMENT = 'comm' var RULESET = 'rule' var DECLARATION = 'decl' var PAGE = '@page' var MEDIA = '@media' var IMPORT = '@import' var CHARSET = '@charset' var VIEWPORT = '@viewport' var SUPPORTS = '@supports' var DOCUMENT = '@document' var NAMESPACE = '@namespace' var KEYFRAMES = '@keyframes' var FONT_FACE = '@font-face' var COUNTER_STYLE = '@counter-style' var FONT_FEATURE_VALUES = '@font-feature-values' var LAYER = '@layer' /***/ }), /***/ 4637: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { s: () => (/* binding */ Legend) }); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(6540); // EXTERNAL MODULE: ./node_modules/lodash/isFunction.js var isFunction = __webpack_require__(1882); var isFunction_default = /*#__PURE__*/__webpack_require__.n(isFunction); // EXTERNAL MODULE: ./node_modules/recharts/node_modules/clsx/dist/clsx.mjs var clsx = __webpack_require__(8804); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/LogUtils.js var LogUtils = __webpack_require__(6634); // EXTERNAL MODULE: ./node_modules/recharts/es6/container/Surface.js var Surface = __webpack_require__(9303); // EXTERNAL MODULE: ./node_modules/recharts/es6/shape/Symbols.js var Symbols = __webpack_require__(5787); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/types.js var types = __webpack_require__(8940); ;// ./node_modules/recharts/es6/component/DefaultLegendContent.js function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); } function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } 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, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /** * @fileOverview Default Legend Content */ var SIZE = 32; var DefaultLegendContent = /*#__PURE__*/function (_PureComponent) { function DefaultLegendContent() { _classCallCheck(this, DefaultLegendContent); return _callSuper(this, DefaultLegendContent, arguments); } _inherits(DefaultLegendContent, _PureComponent); return _createClass(DefaultLegendContent, [{ key: "renderIcon", value: /** * Render the path of icon * @param {Object} data Data of each legend item * @return {String} Path element */ function renderIcon(data) { var inactiveColor = this.props.inactiveColor; var halfSize = SIZE / 2; var sixthSize = SIZE / 6; var thirdSize = SIZE / 3; var color = data.inactive ? inactiveColor : data.color; if (data.type === 'plainline') { return /*#__PURE__*/react.createElement("line", { strokeWidth: 4, fill: "none", stroke: color, strokeDasharray: data.payload.strokeDasharray, x1: 0, y1: halfSize, x2: SIZE, y2: halfSize, className: "recharts-legend-icon" }); } if (data.type === 'line') { return /*#__PURE__*/react.createElement("path", { strokeWidth: 4, fill: "none", stroke: color, d: "M0,".concat(halfSize, "h").concat(thirdSize, "\n A").concat(sixthSize, ",").concat(sixthSize, ",0,1,1,").concat(2 * thirdSize, ",").concat(halfSize, "\n H").concat(SIZE, "M").concat(2 * thirdSize, ",").concat(halfSize, "\n A").concat(sixthSize, ",").concat(sixthSize, ",0,1,1,").concat(thirdSize, ",").concat(halfSize), className: "recharts-legend-icon" }); } if (data.type === 'rect') { return /*#__PURE__*/react.createElement("path", { stroke: "none", fill: color, d: "M0,".concat(SIZE / 8, "h").concat(SIZE, "v").concat(SIZE * 3 / 4, "h").concat(-SIZE, "z"), className: "recharts-legend-icon" }); } if ( /*#__PURE__*/react.isValidElement(data.legendIcon)) { var iconProps = _objectSpread({}, data); delete iconProps.legendIcon; return /*#__PURE__*/react.cloneElement(data.legendIcon, iconProps); } return /*#__PURE__*/react.createElement(Symbols/* Symbols */.i, { fill: color, cx: halfSize, cy: halfSize, size: SIZE, sizeType: "diameter", type: data.type }); } /** * Draw items of legend * @return {ReactElement} Items */ }, { key: "renderItems", value: function renderItems() { var _this = this; var _this$props = this.props, payload = _this$props.payload, iconSize = _this$props.iconSize, layout = _this$props.layout, formatter = _this$props.formatter, inactiveColor = _this$props.inactiveColor; var viewBox = { x: 0, y: 0, width: SIZE, height: SIZE }; var itemStyle = { display: layout === 'horizontal' ? 'inline-block' : 'block', marginRight: 10 }; var svgStyle = { display: 'inline-block', verticalAlign: 'middle', marginRight: 4 }; return payload.map(function (entry, i) { var finalFormatter = entry.formatter || formatter; var className = (0,clsx/* default */.A)(_defineProperty(_defineProperty({ 'recharts-legend-item': true }, "legend-item-".concat(i), true), "inactive", entry.inactive)); if (entry.type === 'none') { return null; } // Do not render entry.value as functions. Always require static string properties. var entryValue = !isFunction_default()(entry.value) ? entry.value : null; (0,LogUtils/* warn */.R)(!isFunction_default()(entry.value), "The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: " // eslint-disable-line max-len ); var color = entry.inactive ? inactiveColor : entry.color; return /*#__PURE__*/react.createElement("li", _extends({ className: className, style: itemStyle // eslint-disable-next-line react/no-array-index-key , key: "legend-item-".concat(i) }, (0,types/* adaptEventsOfChild */.XC)(_this.props, entry, i)), /*#__PURE__*/react.createElement(Surface/* Surface */.u, { width: iconSize, height: iconSize, viewBox: viewBox, style: svgStyle }, _this.renderIcon(entry)), /*#__PURE__*/react.createElement("span", { className: "recharts-legend-item-text", style: { color: color } }, finalFormatter ? finalFormatter(entryValue, entry, i) : entryValue)); }); } }, { key: "render", value: function render() { var _this$props2 = this.props, payload = _this$props2.payload, layout = _this$props2.layout, align = _this$props2.align; if (!payload || !payload.length) { return null; } var finalStyle = { padding: 0, margin: 0, textAlign: layout === 'horizontal' ? align : 'left' }; return /*#__PURE__*/react.createElement("ul", { className: "recharts-default-legend", style: finalStyle }, this.renderItems()); } }]); }(react.PureComponent); _defineProperty(DefaultLegendContent, "displayName", 'Legend'); _defineProperty(DefaultLegendContent, "defaultProps", { iconSize: 14, layout: 'horizontal', align: 'center', verticalAlign: 'middle', inactiveColor: '#ccc' }); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/DataUtils.js var DataUtils = __webpack_require__(9744); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/payload/getUniqPayload.js var getUniqPayload = __webpack_require__(9799); ;// ./node_modules/recharts/es6/component/Legend.js function Legend_typeof(o) { "@babel/helpers - typeof"; return Legend_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, Legend_typeof(o); } var _excluded = ["ref"]; function Legend_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function Legend_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? Legend_ownKeys(Object(t), !0).forEach(function (r) { Legend_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : Legend_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function Legend_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function Legend_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, Legend_toPropertyKey(descriptor.key), descriptor); } } function Legend_createClass(Constructor, protoProps, staticProps) { if (protoProps) Legend_defineProperties(Constructor.prototype, protoProps); if (staticProps) Legend_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function Legend_callSuper(t, o, e) { return o = Legend_getPrototypeOf(o), Legend_possibleConstructorReturn(t, Legend_isNativeReflectConstruct() ? Reflect.construct(o, e || [], Legend_getPrototypeOf(t).constructor) : o.apply(t, e)); } function Legend_possibleConstructorReturn(self, call) { if (call && (Legend_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Legend_assertThisInitialized(self); } function Legend_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function Legend_isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (Legend_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } function Legend_getPrototypeOf(o) { Legend_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Legend_getPrototypeOf(o); } function Legend_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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) Legend_setPrototypeOf(subClass, superClass); } function Legend_setPrototypeOf(o, p) { Legend_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Legend_setPrototypeOf(o, p); } function Legend_defineProperty(obj, key, value) { key = Legend_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function Legend_toPropertyKey(t) { var i = Legend_toPrimitive(t, "string"); return "symbol" == Legend_typeof(i) ? i : i + ""; } function Legend_toPrimitive(t, r) { if ("object" != Legend_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != Legend_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; } /** * @fileOverview Legend */ function defaultUniqBy(entry) { return entry.value; } function renderContent(content, props) { if ( /*#__PURE__*/react.isValidElement(content)) { return /*#__PURE__*/react.cloneElement(content, props); } if (typeof content === 'function') { return /*#__PURE__*/react.createElement(content, props); } var ref = props.ref, otherProps = _objectWithoutProperties(props, _excluded); return /*#__PURE__*/react.createElement(DefaultLegendContent, otherProps); } var EPS = 1; var Legend = /*#__PURE__*/function (_PureComponent) { function Legend() { var _this; Legend_classCallCheck(this, Legend); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = Legend_callSuper(this, Legend, [].concat(args)); Legend_defineProperty(_this, "lastBoundingBox", { width: -1, height: -1 }); return _this; } Legend_inherits(Legend, _PureComponent); return Legend_createClass(Legend, [{ key: "componentDidMount", value: function componentDidMount() { this.updateBBox(); } }, { key: "componentDidUpdate", value: function componentDidUpdate() { this.updateBBox(); } }, { key: "getBBox", value: function getBBox() { if (this.wrapperNode && this.wrapperNode.getBoundingClientRect) { var box = this.wrapperNode.getBoundingClientRect(); box.height = this.wrapperNode.offsetHeight; box.width = this.wrapperNode.offsetWidth; return box; } return null; } }, { key: "updateBBox", value: function updateBBox() { var onBBoxUpdate = this.props.onBBoxUpdate; var box = this.getBBox(); if (box) { if (Math.abs(box.width - this.lastBoundingBox.width) > EPS || Math.abs(box.height - this.lastBoundingBox.height) > EPS) { this.lastBoundingBox.width = box.width; this.lastBoundingBox.height = box.height; if (onBBoxUpdate) { onBBoxUpdate(box); } } } else if (this.lastBoundingBox.width !== -1 || this.lastBoundingBox.height !== -1) { this.lastBoundingBox.width = -1; this.lastBoundingBox.height = -1; if (onBBoxUpdate) { onBBoxUpdate(null); } } } }, { key: "getBBoxSnapshot", value: function getBBoxSnapshot() { if (this.lastBoundingBox.width >= 0 && this.lastBoundingBox.height >= 0) { return Legend_objectSpread({}, this.lastBoundingBox); } return { width: 0, height: 0 }; } }, { key: "getDefaultPosition", value: function getDefaultPosition(style) { var _this$props = this.props, layout = _this$props.layout, align = _this$props.align, verticalAlign = _this$props.verticalAlign, margin = _this$props.margin, chartWidth = _this$props.chartWidth, chartHeight = _this$props.chartHeight; var hPos, vPos; if (!style || (style.left === undefined || style.left === null) && (style.right === undefined || style.right === null)) { if (align === 'center' && layout === 'vertical') { var box = this.getBBoxSnapshot(); hPos = { left: ((chartWidth || 0) - box.width) / 2 }; } else { hPos = align === 'right' ? { right: margin && margin.right || 0 } : { left: margin && margin.left || 0 }; } } if (!style || (style.top === undefined || style.top === null) && (style.bottom === undefined || style.bottom === null)) { if (verticalAlign === 'middle') { var _box = this.getBBoxSnapshot(); vPos = { top: ((chartHeight || 0) - _box.height) / 2 }; } else { vPos = verticalAlign === 'bottom' ? { bottom: margin && margin.bottom || 0 } : { top: margin && margin.top || 0 }; } } return Legend_objectSpread(Legend_objectSpread({}, hPos), vPos); } }, { key: "render", value: function render() { var _this2 = this; var _this$props2 = this.props, content = _this$props2.content, width = _this$props2.width, height = _this$props2.height, wrapperStyle = _this$props2.wrapperStyle, payloadUniqBy = _this$props2.payloadUniqBy, payload = _this$props2.payload; var outerStyle = Legend_objectSpread(Legend_objectSpread({ position: 'absolute', width: width || 'auto', height: height || 'auto' }, this.getDefaultPosition(wrapperStyle)), wrapperStyle); return /*#__PURE__*/react.createElement("div", { className: "recharts-legend-wrapper", style: outerStyle, ref: function ref(node) { _this2.wrapperNode = node; } }, renderContent(content, Legend_objectSpread(Legend_objectSpread({}, this.props), {}, { payload: (0,getUniqPayload/* getUniqPayload */.s)(payload, payloadUniqBy, defaultUniqBy) }))); } }], [{ key: "getWithHeight", value: function getWithHeight(item, chartWidth) { var _this$defaultProps$it = Legend_objectSpread(Legend_objectSpread({}, this.defaultProps), item.props), layout = _this$defaultProps$it.layout; if (layout === 'vertical' && (0,DataUtils/* isNumber */.Et)(item.props.height)) { return { height: item.props.height }; } if (layout === 'horizontal') { return { width: item.props.width || chartWidth }; } return null; } }]); }(react.PureComponent); Legend_defineProperty(Legend, "displayName", 'Legend'); Legend_defineProperty(Legend, "defaultProps", { iconSize: 14, layout: 'horizontal', align: 'center', verticalAlign: 'bottom' }); /***/ }), /***/ 4723: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ J: () => (/* binding */ isInRectangle), /* harmony export */ M: () => (/* binding */ Rectangle) /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6540); /* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8804); /* harmony import */ var react_smooth__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7011); /* harmony import */ var _util_ReactUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4501); function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /** * @fileOverview Rectangle */ var getRectanglePath = function getRectanglePath(x, y, width, height, radius) { var maxRadius = Math.min(Math.abs(width) / 2, Math.abs(height) / 2); var ySign = height >= 0 ? 1 : -1; var xSign = width >= 0 ? 1 : -1; var clockWise = height >= 0 && width >= 0 || height < 0 && width < 0 ? 1 : 0; var path; if (maxRadius > 0 && radius instanceof Array) { var newRadius = [0, 0, 0, 0]; for (var i = 0, len = 4; i < len; i++) { newRadius[i] = radius[i] > maxRadius ? maxRadius : radius[i]; } path = "M".concat(x, ",").concat(y + ySign * newRadius[0]); if (newRadius[0] > 0) { path += "A ".concat(newRadius[0], ",").concat(newRadius[0], ",0,0,").concat(clockWise, ",").concat(x + xSign * newRadius[0], ",").concat(y); } path += "L ".concat(x + width - xSign * newRadius[1], ",").concat(y); if (newRadius[1] > 0) { path += "A ".concat(newRadius[1], ",").concat(newRadius[1], ",0,0,").concat(clockWise, ",\n ").concat(x + width, ",").concat(y + ySign * newRadius[1]); } path += "L ".concat(x + width, ",").concat(y + height - ySign * newRadius[2]); if (newRadius[2] > 0) { path += "A ".concat(newRadius[2], ",").concat(newRadius[2], ",0,0,").concat(clockWise, ",\n ").concat(x + width - xSign * newRadius[2], ",").concat(y + height); } path += "L ".concat(x + xSign * newRadius[3], ",").concat(y + height); if (newRadius[3] > 0) { path += "A ".concat(newRadius[3], ",").concat(newRadius[3], ",0,0,").concat(clockWise, ",\n ").concat(x, ",").concat(y + height - ySign * newRadius[3]); } path += 'Z'; } else if (maxRadius > 0 && radius === +radius && radius > 0) { var _newRadius = Math.min(maxRadius, radius); path = "M ".concat(x, ",").concat(y + ySign * _newRadius, "\n A ").concat(_newRadius, ",").concat(_newRadius, ",0,0,").concat(clockWise, ",").concat(x + xSign * _newRadius, ",").concat(y, "\n L ").concat(x + width - xSign * _newRadius, ",").concat(y, "\n A ").concat(_newRadius, ",").concat(_newRadius, ",0,0,").concat(clockWise, ",").concat(x + width, ",").concat(y + ySign * _newRadius, "\n L ").concat(x + width, ",").concat(y + height - ySign * _newRadius, "\n A ").concat(_newRadius, ",").concat(_newRadius, ",0,0,").concat(clockWise, ",").concat(x + width - xSign * _newRadius, ",").concat(y + height, "\n L ").concat(x + xSign * _newRadius, ",").concat(y + height, "\n A ").concat(_newRadius, ",").concat(_newRadius, ",0,0,").concat(clockWise, ",").concat(x, ",").concat(y + height - ySign * _newRadius, " Z"); } else { path = "M ".concat(x, ",").concat(y, " h ").concat(width, " v ").concat(height, " h ").concat(-width, " Z"); } return path; }; var isInRectangle = function isInRectangle(point, rect) { if (!point || !rect) { return false; } var px = point.x, py = point.y; var x = rect.x, y = rect.y, width = rect.width, height = rect.height; if (Math.abs(width) > 0 && Math.abs(height) > 0) { var minX = Math.min(x, x + width); var maxX = Math.max(x, x + width); var minY = Math.min(y, y + height); var maxY = Math.max(y, y + height); return px >= minX && px <= maxX && py >= minY && py <= maxY; } return false; }; var defaultProps = { x: 0, y: 0, width: 0, height: 0, // The radius of border // The radius of four corners when radius is a number // The radius of left-top, right-top, right-bottom, left-bottom when radius is an array radius: 0, isAnimationActive: false, isUpdateAnimationActive: false, animationBegin: 0, animationDuration: 1500, animationEasing: 'ease' }; var Rectangle = function Rectangle(rectangleProps) { var props = _objectSpread(_objectSpread({}, defaultProps), rectangleProps); var pathRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(); var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(-1), _useState2 = _slicedToArray(_useState, 2), totalLength = _useState2[0], setTotalLength = _useState2[1]; (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () { if (pathRef.current && pathRef.current.getTotalLength) { try { var pathTotalLength = pathRef.current.getTotalLength(); if (pathTotalLength) { setTotalLength(pathTotalLength); } } catch (err) { // calculate total length error } } }, []); var x = props.x, y = props.y, width = props.width, height = props.height, radius = props.radius, className = props.className; var animationEasing = props.animationEasing, animationDuration = props.animationDuration, animationBegin = props.animationBegin, isAnimationActive = props.isAnimationActive, isUpdateAnimationActive = props.isUpdateAnimationActive; if (x !== +x || y !== +y || width !== +width || height !== +height || width === 0 || height === 0) { return null; } var layerClass = (0,clsx__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)('recharts-rectangle', className); if (!isUpdateAnimationActive) { return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", _extends({}, (0,_util_ReactUtils__WEBPACK_IMPORTED_MODULE_2__/* .filterProps */ .J9)(props, true), { className: layerClass, d: getRectanglePath(x, y, width, height, radius) })); } return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react_smooth__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Ay, { canBegin: totalLength > 0, from: { width: width, height: height, x: x, y: y }, to: { width: width, height: height, x: x, y: y }, duration: animationDuration, animationEasing: animationEasing, isActive: isUpdateAnimationActive }, function (_ref) { var currWidth = _ref.width, currHeight = _ref.height, currX = _ref.x, currY = _ref.y; return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react_smooth__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Ay, { canBegin: totalLength > 0, from: "0px ".concat(totalLength === -1 ? 1 : totalLength, "px"), to: "".concat(totalLength, "px 0px"), attributeName: "strokeDasharray", begin: animationBegin, duration: animationDuration, isActive: isAnimationActive, easing: animationEasing }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", _extends({}, (0,_util_ReactUtils__WEBPACK_IMPORTED_MODULE_2__/* .filterProps */ .J9)(props, true), { className: layerClass, d: getRectanglePath(currX, currY, currWidth, currHeight, radius), ref: pathRef }))); }); }; /***/ }), /***/ 4950: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { r: () => (/* binding */ PieChart) }); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(6540); // EXTERNAL MODULE: ./node_modules/lodash/isNil.js var isNil = __webpack_require__(9843); var isNil_default = /*#__PURE__*/__webpack_require__.n(isNil); // EXTERNAL MODULE: ./node_modules/lodash/isFunction.js var isFunction = __webpack_require__(1882); var isFunction_default = /*#__PURE__*/__webpack_require__.n(isFunction); // EXTERNAL MODULE: ./node_modules/lodash/range.js var range = __webpack_require__(3181); var range_default = /*#__PURE__*/__webpack_require__.n(range); // EXTERNAL MODULE: ./node_modules/lodash/get.js var get = __webpack_require__(8156); var get_default = /*#__PURE__*/__webpack_require__.n(get); // EXTERNAL MODULE: ./node_modules/lodash/sortBy.js var sortBy = __webpack_require__(3031); var sortBy_default = /*#__PURE__*/__webpack_require__.n(sortBy); // EXTERNAL MODULE: ./node_modules/lodash/throttle.js var throttle = __webpack_require__(7350); var throttle_default = /*#__PURE__*/__webpack_require__.n(throttle); // EXTERNAL MODULE: ./node_modules/recharts/node_modules/clsx/dist/clsx.mjs var clsx = __webpack_require__(8804); // EXTERNAL MODULE: ./node_modules/tiny-invariant/dist/esm/tiny-invariant.js var tiny_invariant = __webpack_require__(1561); // EXTERNAL MODULE: ./node_modules/recharts/es6/container/Surface.js var Surface = __webpack_require__(9303); // EXTERNAL MODULE: ./node_modules/recharts/es6/container/Layer.js var Layer = __webpack_require__(6069); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/DataUtils.js var DataUtils = __webpack_require__(9744); ;// ./node_modules/recharts/es6/component/DefaultTooltipContent.js function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /** * @fileOverview Default Tooltip Content */ function defaultFormatter(value) { return Array.isArray(value) && (0,DataUtils/* isNumOrStr */.vh)(value[0]) && (0,DataUtils/* isNumOrStr */.vh)(value[1]) ? value.join(' ~ ') : value; } var DefaultTooltipContent = function DefaultTooltipContent(props) { var _props$separator = props.separator, separator = _props$separator === void 0 ? ' : ' : _props$separator, _props$contentStyle = props.contentStyle, contentStyle = _props$contentStyle === void 0 ? {} : _props$contentStyle, _props$itemStyle = props.itemStyle, itemStyle = _props$itemStyle === void 0 ? {} : _props$itemStyle, _props$labelStyle = props.labelStyle, labelStyle = _props$labelStyle === void 0 ? {} : _props$labelStyle, payload = props.payload, formatter = props.formatter, itemSorter = props.itemSorter, wrapperClassName = props.wrapperClassName, labelClassName = props.labelClassName, label = props.label, labelFormatter = props.labelFormatter, _props$accessibilityL = props.accessibilityLayer, accessibilityLayer = _props$accessibilityL === void 0 ? false : _props$accessibilityL; var renderContent = function renderContent() { if (payload && payload.length) { var listStyle = { padding: 0, margin: 0 }; var items = (itemSorter ? sortBy_default()(payload, itemSorter) : payload).map(function (entry, i) { if (entry.type === 'none') { return null; } var finalItemStyle = _objectSpread({ display: 'block', paddingTop: 4, paddingBottom: 4, color: entry.color || '#000' }, itemStyle); var finalFormatter = entry.formatter || formatter || defaultFormatter; var value = entry.value, name = entry.name; var finalValue = value; var finalName = name; if (finalFormatter && finalValue != null && finalName != null) { var formatted = finalFormatter(value, name, entry, i, payload); if (Array.isArray(formatted)) { var _formatted = _slicedToArray(formatted, 2); finalValue = _formatted[0]; finalName = _formatted[1]; } else { finalValue = formatted; } } return ( /*#__PURE__*/ // eslint-disable-next-line react/no-array-index-key react.createElement("li", { className: "recharts-tooltip-item", key: "tooltip-item-".concat(i), style: finalItemStyle }, (0,DataUtils/* isNumOrStr */.vh)(finalName) ? /*#__PURE__*/react.createElement("span", { className: "recharts-tooltip-item-name" }, finalName) : null, (0,DataUtils/* isNumOrStr */.vh)(finalName) ? /*#__PURE__*/react.createElement("span", { className: "recharts-tooltip-item-separator" }, separator) : null, /*#__PURE__*/react.createElement("span", { className: "recharts-tooltip-item-value" }, finalValue), /*#__PURE__*/react.createElement("span", { className: "recharts-tooltip-item-unit" }, entry.unit || '')) ); }); return /*#__PURE__*/react.createElement("ul", { className: "recharts-tooltip-item-list", style: listStyle }, items); } return null; }; var finalStyle = _objectSpread({ margin: 0, padding: 10, backgroundColor: '#fff', border: '1px solid #ccc', whiteSpace: 'nowrap' }, contentStyle); var finalLabelStyle = _objectSpread({ margin: 0 }, labelStyle); var hasLabel = !isNil_default()(label); var finalLabel = hasLabel ? label : ''; var wrapperCN = (0,clsx/* default */.A)('recharts-default-tooltip', wrapperClassName); var labelCN = (0,clsx/* default */.A)('recharts-tooltip-label', labelClassName); if (hasLabel && labelFormatter && payload !== undefined && payload !== null) { finalLabel = labelFormatter(label, payload); } var accessibilityAttributes = accessibilityLayer ? { role: 'status', 'aria-live': 'assertive' } : {}; return /*#__PURE__*/react.createElement("div", _extends({ className: wrapperCN, style: finalStyle }, accessibilityAttributes), /*#__PURE__*/react.createElement("p", { className: labelCN, style: finalLabelStyle }, /*#__PURE__*/react.isValidElement(finalLabel) ? finalLabel : "".concat(finalLabel)), renderContent()); }; ;// ./node_modules/recharts/es6/util/tooltip/translate.js function translate_typeof(o) { "@babel/helpers - typeof"; return translate_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, translate_typeof(o); } function translate_defineProperty(obj, key, value) { key = translate_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function translate_toPropertyKey(t) { var i = translate_toPrimitive(t, "string"); return "symbol" == translate_typeof(i) ? i : i + ""; } function translate_toPrimitive(t, r) { if ("object" != translate_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != translate_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } var CSS_CLASS_PREFIX = 'recharts-tooltip-wrapper'; var TOOLTIP_HIDDEN = { visibility: 'hidden' }; function getTooltipCSSClassName(_ref) { var coordinate = _ref.coordinate, translateX = _ref.translateX, translateY = _ref.translateY; return (0,clsx/* default */.A)(CSS_CLASS_PREFIX, translate_defineProperty(translate_defineProperty(translate_defineProperty(translate_defineProperty({}, "".concat(CSS_CLASS_PREFIX, "-right"), (0,DataUtils/* isNumber */.Et)(translateX) && coordinate && (0,DataUtils/* isNumber */.Et)(coordinate.x) && translateX >= coordinate.x), "".concat(CSS_CLASS_PREFIX, "-left"), (0,DataUtils/* isNumber */.Et)(translateX) && coordinate && (0,DataUtils/* isNumber */.Et)(coordinate.x) && translateX < coordinate.x), "".concat(CSS_CLASS_PREFIX, "-bottom"), (0,DataUtils/* isNumber */.Et)(translateY) && coordinate && (0,DataUtils/* isNumber */.Et)(coordinate.y) && translateY >= coordinate.y), "".concat(CSS_CLASS_PREFIX, "-top"), (0,DataUtils/* isNumber */.Et)(translateY) && coordinate && (0,DataUtils/* isNumber */.Et)(coordinate.y) && translateY < coordinate.y)); } function getTooltipTranslateXY(_ref2) { var allowEscapeViewBox = _ref2.allowEscapeViewBox, coordinate = _ref2.coordinate, key = _ref2.key, offsetTopLeft = _ref2.offsetTopLeft, position = _ref2.position, reverseDirection = _ref2.reverseDirection, tooltipDimension = _ref2.tooltipDimension, viewBox = _ref2.viewBox, viewBoxDimension = _ref2.viewBoxDimension; if (position && (0,DataUtils/* isNumber */.Et)(position[key])) { return position[key]; } var negative = coordinate[key] - tooltipDimension - offsetTopLeft; var positive = coordinate[key] + offsetTopLeft; if (allowEscapeViewBox[key]) { return reverseDirection[key] ? negative : positive; } if (reverseDirection[key]) { var _tooltipBoundary = negative; var _viewBoxBoundary = viewBox[key]; if (_tooltipBoundary < _viewBoxBoundary) { return Math.max(positive, viewBox[key]); } return Math.max(negative, viewBox[key]); } var tooltipBoundary = positive + tooltipDimension; var viewBoxBoundary = viewBox[key] + viewBoxDimension; if (tooltipBoundary > viewBoxBoundary) { return Math.max(negative, viewBox[key]); } return Math.max(positive, viewBox[key]); } function getTransformStyle(_ref3) { var translateX = _ref3.translateX, translateY = _ref3.translateY, useTranslate3d = _ref3.useTranslate3d; return { transform: useTranslate3d ? "translate3d(".concat(translateX, "px, ").concat(translateY, "px, 0)") : "translate(".concat(translateX, "px, ").concat(translateY, "px)") }; } function getTooltipTranslate(_ref4) { var allowEscapeViewBox = _ref4.allowEscapeViewBox, coordinate = _ref4.coordinate, offsetTopLeft = _ref4.offsetTopLeft, position = _ref4.position, reverseDirection = _ref4.reverseDirection, tooltipBox = _ref4.tooltipBox, useTranslate3d = _ref4.useTranslate3d, viewBox = _ref4.viewBox; var cssProperties, translateX, translateY; if (tooltipBox.height > 0 && tooltipBox.width > 0 && coordinate) { translateX = getTooltipTranslateXY({ allowEscapeViewBox: allowEscapeViewBox, coordinate: coordinate, key: 'x', offsetTopLeft: offsetTopLeft, position: position, reverseDirection: reverseDirection, tooltipDimension: tooltipBox.width, viewBox: viewBox, viewBoxDimension: viewBox.width }); translateY = getTooltipTranslateXY({ allowEscapeViewBox: allowEscapeViewBox, coordinate: coordinate, key: 'y', offsetTopLeft: offsetTopLeft, position: position, reverseDirection: reverseDirection, tooltipDimension: tooltipBox.height, viewBox: viewBox, viewBoxDimension: viewBox.height }); cssProperties = getTransformStyle({ translateX: translateX, translateY: translateY, useTranslate3d: useTranslate3d }); } else { cssProperties = TOOLTIP_HIDDEN; } return { cssProperties: cssProperties, cssClasses: getTooltipCSSClassName({ translateX: translateX, translateY: translateY, coordinate: coordinate }) }; } ;// ./node_modules/recharts/es6/component/TooltipBoundingBox.js function TooltipBoundingBox_typeof(o) { "@babel/helpers - typeof"; return TooltipBoundingBox_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, TooltipBoundingBox_typeof(o); } function TooltipBoundingBox_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function TooltipBoundingBox_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? TooltipBoundingBox_ownKeys(Object(t), !0).forEach(function (r) { TooltipBoundingBox_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : TooltipBoundingBox_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } 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, TooltipBoundingBox_toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } function _possibleConstructorReturn(self, call) { if (call && (TooltipBoundingBox_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function TooltipBoundingBox_defineProperty(obj, key, value) { key = TooltipBoundingBox_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function TooltipBoundingBox_toPropertyKey(t) { var i = TooltipBoundingBox_toPrimitive(t, "string"); return "symbol" == TooltipBoundingBox_typeof(i) ? i : i + ""; } function TooltipBoundingBox_toPrimitive(t, r) { if ("object" != TooltipBoundingBox_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != TooltipBoundingBox_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } var EPSILON = 1; var TooltipBoundingBox = /*#__PURE__*/function (_PureComponent) { function TooltipBoundingBox() { var _this; _classCallCheck(this, TooltipBoundingBox); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _callSuper(this, TooltipBoundingBox, [].concat(args)); TooltipBoundingBox_defineProperty(_this, "state", { dismissed: false, dismissedAtCoordinate: { x: 0, y: 0 }, lastBoundingBox: { width: -1, height: -1 } }); TooltipBoundingBox_defineProperty(_this, "handleKeyDown", function (event) { if (event.key === 'Escape') { var _this$props$coordinat, _this$props$coordinat2, _this$props$coordinat3, _this$props$coordinat4; _this.setState({ dismissed: true, dismissedAtCoordinate: { x: (_this$props$coordinat = (_this$props$coordinat2 = _this.props.coordinate) === null || _this$props$coordinat2 === void 0 ? void 0 : _this$props$coordinat2.x) !== null && _this$props$coordinat !== void 0 ? _this$props$coordinat : 0, y: (_this$props$coordinat3 = (_this$props$coordinat4 = _this.props.coordinate) === null || _this$props$coordinat4 === void 0 ? void 0 : _this$props$coordinat4.y) !== null && _this$props$coordinat3 !== void 0 ? _this$props$coordinat3 : 0 } }); } }); return _this; } _inherits(TooltipBoundingBox, _PureComponent); return _createClass(TooltipBoundingBox, [{ key: "updateBBox", value: function updateBBox() { if (this.wrapperNode && this.wrapperNode.getBoundingClientRect) { var box = this.wrapperNode.getBoundingClientRect(); if (Math.abs(box.width - this.state.lastBoundingBox.width) > EPSILON || Math.abs(box.height - this.state.lastBoundingBox.height) > EPSILON) { this.setState({ lastBoundingBox: { width: box.width, height: box.height } }); } } else if (this.state.lastBoundingBox.width !== -1 || this.state.lastBoundingBox.height !== -1) { this.setState({ lastBoundingBox: { width: -1, height: -1 } }); } } }, { key: "componentDidMount", value: function componentDidMount() { document.addEventListener('keydown', this.handleKeyDown); this.updateBBox(); } }, { key: "componentWillUnmount", value: function componentWillUnmount() { document.removeEventListener('keydown', this.handleKeyDown); } }, { key: "componentDidUpdate", value: function componentDidUpdate() { var _this$props$coordinat5, _this$props$coordinat6; if (this.props.active) { this.updateBBox(); } if (!this.state.dismissed) { return; } if (((_this$props$coordinat5 = this.props.coordinate) === null || _this$props$coordinat5 === void 0 ? void 0 : _this$props$coordinat5.x) !== this.state.dismissedAtCoordinate.x || ((_this$props$coordinat6 = this.props.coordinate) === null || _this$props$coordinat6 === void 0 ? void 0 : _this$props$coordinat6.y) !== this.state.dismissedAtCoordinate.y) { this.state.dismissed = false; } } }, { key: "render", value: function render() { var _this2 = this; var _this$props = this.props, active = _this$props.active, allowEscapeViewBox = _this$props.allowEscapeViewBox, animationDuration = _this$props.animationDuration, animationEasing = _this$props.animationEasing, children = _this$props.children, coordinate = _this$props.coordinate, hasPayload = _this$props.hasPayload, isAnimationActive = _this$props.isAnimationActive, offset = _this$props.offset, position = _this$props.position, reverseDirection = _this$props.reverseDirection, useTranslate3d = _this$props.useTranslate3d, viewBox = _this$props.viewBox, wrapperStyle = _this$props.wrapperStyle; var _getTooltipTranslate = getTooltipTranslate({ allowEscapeViewBox: allowEscapeViewBox, coordinate: coordinate, offsetTopLeft: offset, position: position, reverseDirection: reverseDirection, tooltipBox: this.state.lastBoundingBox, useTranslate3d: useTranslate3d, viewBox: viewBox }), cssClasses = _getTooltipTranslate.cssClasses, cssProperties = _getTooltipTranslate.cssProperties; var outerStyle = TooltipBoundingBox_objectSpread(TooltipBoundingBox_objectSpread({ transition: isAnimationActive && active ? "transform ".concat(animationDuration, "ms ").concat(animationEasing) : undefined }, cssProperties), {}, { pointerEvents: 'none', visibility: !this.state.dismissed && active && hasPayload ? 'visible' : 'hidden', position: 'absolute', top: 0, left: 0 }, wrapperStyle); return ( /*#__PURE__*/ // This element allow listening to the `Escape` key. // See https://github.com/recharts/recharts/pull/2925 react.createElement("div", { tabIndex: -1, className: cssClasses, style: outerStyle, ref: function ref(node) { _this2.wrapperNode = node; } }, children) ); } }]); }(react.PureComponent); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/Global.js var Global = __webpack_require__(9938); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/payload/getUniqPayload.js var getUniqPayload = __webpack_require__(9799); ;// ./node_modules/recharts/es6/component/Tooltip.js function Tooltip_typeof(o) { "@babel/helpers - typeof"; return Tooltip_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, Tooltip_typeof(o); } function Tooltip_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function Tooltip_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? Tooltip_ownKeys(Object(t), !0).forEach(function (r) { Tooltip_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : Tooltip_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function Tooltip_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function Tooltip_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, Tooltip_toPropertyKey(descriptor.key), descriptor); } } function Tooltip_createClass(Constructor, protoProps, staticProps) { if (protoProps) Tooltip_defineProperties(Constructor.prototype, protoProps); if (staticProps) Tooltip_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function Tooltip_callSuper(t, o, e) { return o = Tooltip_getPrototypeOf(o), Tooltip_possibleConstructorReturn(t, Tooltip_isNativeReflectConstruct() ? Reflect.construct(o, e || [], Tooltip_getPrototypeOf(t).constructor) : o.apply(t, e)); } function Tooltip_possibleConstructorReturn(self, call) { if (call && (Tooltip_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Tooltip_assertThisInitialized(self); } function Tooltip_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function Tooltip_isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (Tooltip_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } function Tooltip_getPrototypeOf(o) { Tooltip_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Tooltip_getPrototypeOf(o); } function Tooltip_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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) Tooltip_setPrototypeOf(subClass, superClass); } function Tooltip_setPrototypeOf(o, p) { Tooltip_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Tooltip_setPrototypeOf(o, p); } function Tooltip_defineProperty(obj, key, value) { key = Tooltip_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function Tooltip_toPropertyKey(t) { var i = Tooltip_toPrimitive(t, "string"); return "symbol" == Tooltip_typeof(i) ? i : i + ""; } function Tooltip_toPrimitive(t, r) { if ("object" != Tooltip_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != Tooltip_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /** * @fileOverview Tooltip */ function defaultUniqBy(entry) { return entry.dataKey; } function renderContent(content, props) { if ( /*#__PURE__*/react.isValidElement(content)) { return /*#__PURE__*/react.cloneElement(content, props); } if (typeof content === 'function') { return /*#__PURE__*/react.createElement(content, props); } return /*#__PURE__*/react.createElement(DefaultTooltipContent, props); } var Tooltip = /*#__PURE__*/function (_PureComponent) { function Tooltip() { Tooltip_classCallCheck(this, Tooltip); return Tooltip_callSuper(this, Tooltip, arguments); } Tooltip_inherits(Tooltip, _PureComponent); return Tooltip_createClass(Tooltip, [{ key: "render", value: function render() { var _this = this; var _this$props = this.props, active = _this$props.active, allowEscapeViewBox = _this$props.allowEscapeViewBox, animationDuration = _this$props.animationDuration, animationEasing = _this$props.animationEasing, content = _this$props.content, coordinate = _this$props.coordinate, filterNull = _this$props.filterNull, isAnimationActive = _this$props.isAnimationActive, offset = _this$props.offset, payload = _this$props.payload, payloadUniqBy = _this$props.payloadUniqBy, position = _this$props.position, reverseDirection = _this$props.reverseDirection, useTranslate3d = _this$props.useTranslate3d, viewBox = _this$props.viewBox, wrapperStyle = _this$props.wrapperStyle; var finalPayload = payload !== null && payload !== void 0 ? payload : []; if (filterNull && finalPayload.length) { finalPayload = (0,getUniqPayload/* getUniqPayload */.s)(payload.filter(function (entry) { return entry.value != null && (entry.hide !== true || _this.props.includeHidden); }), payloadUniqBy, defaultUniqBy); } var hasPayload = finalPayload.length > 0; return /*#__PURE__*/react.createElement(TooltipBoundingBox, { allowEscapeViewBox: allowEscapeViewBox, animationDuration: animationDuration, animationEasing: animationEasing, isAnimationActive: isAnimationActive, active: active, coordinate: coordinate, hasPayload: hasPayload, offset: offset, position: position, reverseDirection: reverseDirection, useTranslate3d: useTranslate3d, viewBox: viewBox, wrapperStyle: wrapperStyle }, renderContent(content, Tooltip_objectSpread(Tooltip_objectSpread({}, this.props), {}, { payload: finalPayload }))); } }]); }(react.PureComponent); Tooltip_defineProperty(Tooltip, "displayName", 'Tooltip'); Tooltip_defineProperty(Tooltip, "defaultProps", { accessibilityLayer: false, allowEscapeViewBox: { x: false, y: false }, animationDuration: 400, animationEasing: 'ease', contentStyle: {}, coordinate: { x: 0, y: 0 }, cursor: true, cursorStyle: {}, filterNull: true, isAnimationActive: !Global/* Global */.m.isSsr, itemStyle: {}, labelStyle: {}, offset: 10, reverseDirection: { x: false, y: false }, separator: ' : ', trigger: 'hover', useTranslate3d: false, viewBox: { x: 0, y: 0, height: 0, width: 0 }, wrapperStyle: {} }); // EXTERNAL MODULE: ./node_modules/recharts/es6/component/Legend.js + 1 modules var Legend = __webpack_require__(4637); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/types.js var types = __webpack_require__(8940); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/ReactUtils.js var ReactUtils = __webpack_require__(4501); ;// ./node_modules/recharts/es6/shape/Dot.js function Dot_extends() { Dot_extends = Object.assign ? Object.assign.bind() : 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; }; return Dot_extends.apply(this, arguments); } /** * @fileOverview Dot */ var Dot = function Dot(props) { var cx = props.cx, cy = props.cy, r = props.r, className = props.className; var layerClass = (0,clsx/* default */.A)('recharts-dot', className); if (cx === +cx && cy === +cy && r === +r) { return /*#__PURE__*/react.createElement("circle", Dot_extends({}, (0,ReactUtils/* filterProps */.J9)(props, false), (0,types/* adaptEventHandlers */._U)(props), { className: layerClass, cx: cx, cy: cy, r: r })); } return null; }; // EXTERNAL MODULE: ./node_modules/recharts/es6/shape/Rectangle.js var Rectangle = __webpack_require__(4723); // EXTERNAL MODULE: ./node_modules/d3-scale/src/band.js + 1 modules var band = __webpack_require__(9072); // EXTERNAL MODULE: ./node_modules/recharts/es6/component/Text.js + 1 modules var Text = __webpack_require__(1174); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/ChartUtils.js + 5 modules var ChartUtils = __webpack_require__(3198); ;// ./node_modules/recharts/es6/util/CssPrefixUtils.js function CssPrefixUtils_typeof(o) { "@babel/helpers - typeof"; return CssPrefixUtils_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, CssPrefixUtils_typeof(o); } function CssPrefixUtils_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function CssPrefixUtils_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? CssPrefixUtils_ownKeys(Object(t), !0).forEach(function (r) { CssPrefixUtils_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : CssPrefixUtils_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function CssPrefixUtils_defineProperty(obj, key, value) { key = CssPrefixUtils_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function CssPrefixUtils_toPropertyKey(t) { var i = CssPrefixUtils_toPrimitive(t, "string"); return "symbol" == CssPrefixUtils_typeof(i) ? i : i + ""; } function CssPrefixUtils_toPrimitive(t, r) { if ("object" != CssPrefixUtils_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != CssPrefixUtils_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } var PREFIX_LIST = ['Webkit', 'Moz', 'O', 'ms']; var generatePrefixStyle = function generatePrefixStyle(name, value) { if (!name) { return null; } var camelName = name.replace(/(\w)/, function (v) { return v.toUpperCase(); }); var result = PREFIX_LIST.reduce(function (res, entry) { return CssPrefixUtils_objectSpread(CssPrefixUtils_objectSpread({}, res), {}, CssPrefixUtils_defineProperty({}, entry + camelName, value)); }, {}); result[name] = value; return result; }; ;// ./node_modules/recharts/es6/cartesian/Brush.js function Brush_typeof(o) { "@babel/helpers - typeof"; return Brush_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, Brush_typeof(o); } function Brush_extends() { Brush_extends = Object.assign ? Object.assign.bind() : 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; }; return Brush_extends.apply(this, arguments); } function Brush_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function Brush_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? Brush_ownKeys(Object(t), !0).forEach(function (r) { Brush_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : Brush_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function Brush_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function Brush_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, Brush_toPropertyKey(descriptor.key), descriptor); } } function Brush_createClass(Constructor, protoProps, staticProps) { if (protoProps) Brush_defineProperties(Constructor.prototype, protoProps); if (staticProps) Brush_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function Brush_callSuper(t, o, e) { return o = Brush_getPrototypeOf(o), Brush_possibleConstructorReturn(t, Brush_isNativeReflectConstruct() ? Reflect.construct(o, e || [], Brush_getPrototypeOf(t).constructor) : o.apply(t, e)); } function Brush_possibleConstructorReturn(self, call) { if (call && (Brush_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Brush_assertThisInitialized(self); } function Brush_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function Brush_isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (Brush_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } function Brush_getPrototypeOf(o) { Brush_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Brush_getPrototypeOf(o); } function Brush_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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) Brush_setPrototypeOf(subClass, superClass); } function Brush_setPrototypeOf(o, p) { Brush_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Brush_setPrototypeOf(o, p); } function Brush_defineProperty(obj, key, value) { key = Brush_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function Brush_toPropertyKey(t) { var i = Brush_toPrimitive(t, "string"); return "symbol" == Brush_typeof(i) ? i : i + ""; } function Brush_toPrimitive(t, r) { if ("object" != Brush_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != Brush_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /** * @fileOverview Brush */ var createScale = function createScale(_ref) { var data = _ref.data, startIndex = _ref.startIndex, endIndex = _ref.endIndex, x = _ref.x, width = _ref.width, travellerWidth = _ref.travellerWidth; if (!data || !data.length) { return {}; } var len = data.length; var scale = (0,band/* point */.z)().domain(range_default()(0, len)).range([x, x + width - travellerWidth]); var scaleValues = scale.domain().map(function (entry) { return scale(entry); }); return { isTextActive: false, isSlideMoving: false, isTravellerMoving: false, isTravellerFocused: false, startX: scale(startIndex), endX: scale(endIndex), scale: scale, scaleValues: scaleValues }; }; var isTouch = function isTouch(e) { return e.changedTouches && !!e.changedTouches.length; }; var Brush = /*#__PURE__*/function (_PureComponent) { function Brush(props) { var _this; Brush_classCallCheck(this, Brush); _this = Brush_callSuper(this, Brush, [props]); Brush_defineProperty(_this, "handleDrag", function (e) { if (_this.leaveTimer) { clearTimeout(_this.leaveTimer); _this.leaveTimer = null; } if (_this.state.isTravellerMoving) { _this.handleTravellerMove(e); } else if (_this.state.isSlideMoving) { _this.handleSlideDrag(e); } }); Brush_defineProperty(_this, "handleTouchMove", function (e) { if (e.changedTouches != null && e.changedTouches.length > 0) { _this.handleDrag(e.changedTouches[0]); } }); Brush_defineProperty(_this, "handleDragEnd", function () { _this.setState({ isTravellerMoving: false, isSlideMoving: false }, function () { var _this$props = _this.props, endIndex = _this$props.endIndex, onDragEnd = _this$props.onDragEnd, startIndex = _this$props.startIndex; onDragEnd === null || onDragEnd === void 0 || onDragEnd({ endIndex: endIndex, startIndex: startIndex }); }); _this.detachDragEndListener(); }); Brush_defineProperty(_this, "handleLeaveWrapper", function () { if (_this.state.isTravellerMoving || _this.state.isSlideMoving) { _this.leaveTimer = window.setTimeout(_this.handleDragEnd, _this.props.leaveTimeOut); } }); Brush_defineProperty(_this, "handleEnterSlideOrTraveller", function () { _this.setState({ isTextActive: true }); }); Brush_defineProperty(_this, "handleLeaveSlideOrTraveller", function () { _this.setState({ isTextActive: false }); }); Brush_defineProperty(_this, "handleSlideDragStart", function (e) { var event = isTouch(e) ? e.changedTouches[0] : e; _this.setState({ isTravellerMoving: false, isSlideMoving: true, slideMoveStartX: event.pageX }); _this.attachDragEndListener(); }); _this.travellerDragStartHandlers = { startX: _this.handleTravellerDragStart.bind(_this, 'startX'), endX: _this.handleTravellerDragStart.bind(_this, 'endX') }; _this.state = {}; return _this; } Brush_inherits(Brush, _PureComponent); return Brush_createClass(Brush, [{ key: "componentWillUnmount", value: function componentWillUnmount() { if (this.leaveTimer) { clearTimeout(this.leaveTimer); this.leaveTimer = null; } this.detachDragEndListener(); } }, { key: "getIndex", value: function getIndex(_ref2) { var startX = _ref2.startX, endX = _ref2.endX; var scaleValues = this.state.scaleValues; var _this$props2 = this.props, gap = _this$props2.gap, data = _this$props2.data; var lastIndex = data.length - 1; var min = Math.min(startX, endX); var max = Math.max(startX, endX); var minIndex = Brush.getIndexInRange(scaleValues, min); var maxIndex = Brush.getIndexInRange(scaleValues, max); return { startIndex: minIndex - minIndex % gap, endIndex: maxIndex === lastIndex ? lastIndex : maxIndex - maxIndex % gap }; } }, { key: "getTextOfTick", value: function getTextOfTick(index) { var _this$props3 = this.props, data = _this$props3.data, tickFormatter = _this$props3.tickFormatter, dataKey = _this$props3.dataKey; var text = (0,ChartUtils/* getValueByDataKey */.kr)(data[index], dataKey, index); return isFunction_default()(tickFormatter) ? tickFormatter(text, index) : text; } }, { key: "attachDragEndListener", value: function attachDragEndListener() { window.addEventListener('mouseup', this.handleDragEnd, true); window.addEventListener('touchend', this.handleDragEnd, true); window.addEventListener('mousemove', this.handleDrag, true); } }, { key: "detachDragEndListener", value: function detachDragEndListener() { window.removeEventListener('mouseup', this.handleDragEnd, true); window.removeEventListener('touchend', this.handleDragEnd, true); window.removeEventListener('mousemove', this.handleDrag, true); } }, { key: "handleSlideDrag", value: function handleSlideDrag(e) { var _this$state = this.state, slideMoveStartX = _this$state.slideMoveStartX, startX = _this$state.startX, endX = _this$state.endX; var _this$props4 = this.props, x = _this$props4.x, width = _this$props4.width, travellerWidth = _this$props4.travellerWidth, startIndex = _this$props4.startIndex, endIndex = _this$props4.endIndex, onChange = _this$props4.onChange; var delta = e.pageX - slideMoveStartX; if (delta > 0) { delta = Math.min(delta, x + width - travellerWidth - endX, x + width - travellerWidth - startX); } else if (delta < 0) { delta = Math.max(delta, x - startX, x - endX); } var newIndex = this.getIndex({ startX: startX + delta, endX: endX + delta }); if ((newIndex.startIndex !== startIndex || newIndex.endIndex !== endIndex) && onChange) { onChange(newIndex); } this.setState({ startX: startX + delta, endX: endX + delta, slideMoveStartX: e.pageX }); } }, { key: "handleTravellerDragStart", value: function handleTravellerDragStart(id, e) { var event = isTouch(e) ? e.changedTouches[0] : e; this.setState({ isSlideMoving: false, isTravellerMoving: true, movingTravellerId: id, brushMoveStartX: event.pageX }); this.attachDragEndListener(); } }, { key: "handleTravellerMove", value: function handleTravellerMove(e) { var _this$state2 = this.state, brushMoveStartX = _this$state2.brushMoveStartX, movingTravellerId = _this$state2.movingTravellerId, endX = _this$state2.endX, startX = _this$state2.startX; var prevValue = this.state[movingTravellerId]; var _this$props5 = this.props, x = _this$props5.x, width = _this$props5.width, travellerWidth = _this$props5.travellerWidth, onChange = _this$props5.onChange, gap = _this$props5.gap, data = _this$props5.data; var params = { startX: this.state.startX, endX: this.state.endX }; var delta = e.pageX - brushMoveStartX; if (delta > 0) { delta = Math.min(delta, x + width - travellerWidth - prevValue); } else if (delta < 0) { delta = Math.max(delta, x - prevValue); } params[movingTravellerId] = prevValue + delta; var newIndex = this.getIndex(params); var startIndex = newIndex.startIndex, endIndex = newIndex.endIndex; var isFullGap = function isFullGap() { var lastIndex = data.length - 1; if (movingTravellerId === 'startX' && (endX > startX ? startIndex % gap === 0 : endIndex % gap === 0) || endX < startX && endIndex === lastIndex || movingTravellerId === 'endX' && (endX > startX ? endIndex % gap === 0 : startIndex % gap === 0) || endX > startX && endIndex === lastIndex) { return true; } return false; }; this.setState(Brush_defineProperty(Brush_defineProperty({}, movingTravellerId, prevValue + delta), "brushMoveStartX", e.pageX), function () { if (onChange) { if (isFullGap()) { onChange(newIndex); } } }); } }, { key: "handleTravellerMoveKeyboard", value: function handleTravellerMoveKeyboard(direction, id) { var _this2 = this; // scaleValues are a list of coordinates. For example: [65, 250, 435, 620, 805, 990]. var _this$state3 = this.state, scaleValues = _this$state3.scaleValues, startX = _this$state3.startX, endX = _this$state3.endX; // currentScaleValue refers to which coordinate the current traveller should be placed at. var currentScaleValue = this.state[id]; var currentIndex = scaleValues.indexOf(currentScaleValue); if (currentIndex === -1) { return; } var newIndex = currentIndex + direction; if (newIndex === -1 || newIndex >= scaleValues.length) { return; } var newScaleValue = scaleValues[newIndex]; // Prevent travellers from being on top of each other or overlapping if (id === 'startX' && newScaleValue >= endX || id === 'endX' && newScaleValue <= startX) { return; } this.setState(Brush_defineProperty({}, id, newScaleValue), function () { _this2.props.onChange(_this2.getIndex({ startX: _this2.state.startX, endX: _this2.state.endX })); }); } }, { key: "renderBackground", value: function renderBackground() { var _this$props6 = this.props, x = _this$props6.x, y = _this$props6.y, width = _this$props6.width, height = _this$props6.height, fill = _this$props6.fill, stroke = _this$props6.stroke; return /*#__PURE__*/react.createElement("rect", { stroke: stroke, fill: fill, x: x, y: y, width: width, height: height }); } }, { key: "renderPanorama", value: function renderPanorama() { var _this$props7 = this.props, x = _this$props7.x, y = _this$props7.y, width = _this$props7.width, height = _this$props7.height, data = _this$props7.data, children = _this$props7.children, padding = _this$props7.padding; var chartElement = react.Children.only(children); if (!chartElement) { return null; } return /*#__PURE__*/react.cloneElement(chartElement, { x: x, y: y, width: width, height: height, margin: padding, compact: true, data: data }); } }, { key: "renderTravellerLayer", value: function renderTravellerLayer(travellerX, id) { var _data$startIndex, _data$endIndex, _this3 = this; var _this$props8 = this.props, y = _this$props8.y, travellerWidth = _this$props8.travellerWidth, height = _this$props8.height, traveller = _this$props8.traveller, ariaLabel = _this$props8.ariaLabel, data = _this$props8.data, startIndex = _this$props8.startIndex, endIndex = _this$props8.endIndex; var x = Math.max(travellerX, this.props.x); var travellerProps = Brush_objectSpread(Brush_objectSpread({}, (0,ReactUtils/* filterProps */.J9)(this.props, false)), {}, { x: x, y: y, width: travellerWidth, height: height }); var ariaLabelBrush = ariaLabel || "Min value: ".concat((_data$startIndex = data[startIndex]) === null || _data$startIndex === void 0 ? void 0 : _data$startIndex.name, ", Max value: ").concat((_data$endIndex = data[endIndex]) === null || _data$endIndex === void 0 ? void 0 : _data$endIndex.name); return /*#__PURE__*/react.createElement(Layer/* Layer */.W, { tabIndex: 0, role: "slider", "aria-label": ariaLabelBrush, "aria-valuenow": travellerX, className: "recharts-brush-traveller", onMouseEnter: this.handleEnterSlideOrTraveller, onMouseLeave: this.handleLeaveSlideOrTraveller, onMouseDown: this.travellerDragStartHandlers[id], onTouchStart: this.travellerDragStartHandlers[id], onKeyDown: function onKeyDown(e) { if (!['ArrowLeft', 'ArrowRight'].includes(e.key)) { return; } e.preventDefault(); e.stopPropagation(); _this3.handleTravellerMoveKeyboard(e.key === 'ArrowRight' ? 1 : -1, id); }, onFocus: function onFocus() { _this3.setState({ isTravellerFocused: true }); }, onBlur: function onBlur() { _this3.setState({ isTravellerFocused: false }); }, style: { cursor: 'col-resize' } }, Brush.renderTraveller(traveller, travellerProps)); } }, { key: "renderSlide", value: function renderSlide(startX, endX) { var _this$props9 = this.props, y = _this$props9.y, height = _this$props9.height, stroke = _this$props9.stroke, travellerWidth = _this$props9.travellerWidth; var x = Math.min(startX, endX) + travellerWidth; var width = Math.max(Math.abs(endX - startX) - travellerWidth, 0); return /*#__PURE__*/react.createElement("rect", { className: "recharts-brush-slide", onMouseEnter: this.handleEnterSlideOrTraveller, onMouseLeave: this.handleLeaveSlideOrTraveller, onMouseDown: this.handleSlideDragStart, onTouchStart: this.handleSlideDragStart, style: { cursor: 'move' }, stroke: "none", fill: stroke, fillOpacity: 0.2, x: x, y: y, width: width, height: height }); } }, { key: "renderText", value: function renderText() { var _this$props10 = this.props, startIndex = _this$props10.startIndex, endIndex = _this$props10.endIndex, y = _this$props10.y, height = _this$props10.height, travellerWidth = _this$props10.travellerWidth, stroke = _this$props10.stroke; var _this$state4 = this.state, startX = _this$state4.startX, endX = _this$state4.endX; var offset = 5; var attrs = { pointerEvents: 'none', fill: stroke }; return /*#__PURE__*/react.createElement(Layer/* Layer */.W, { className: "recharts-brush-texts" }, /*#__PURE__*/react.createElement(Text/* Text */.E, Brush_extends({ textAnchor: "end", verticalAnchor: "middle", x: Math.min(startX, endX) - offset, y: y + height / 2 }, attrs), this.getTextOfTick(startIndex)), /*#__PURE__*/react.createElement(Text/* Text */.E, Brush_extends({ textAnchor: "start", verticalAnchor: "middle", x: Math.max(startX, endX) + travellerWidth + offset, y: y + height / 2 }, attrs), this.getTextOfTick(endIndex))); } }, { key: "render", value: function render() { var _this$props11 = this.props, data = _this$props11.data, className = _this$props11.className, children = _this$props11.children, x = _this$props11.x, y = _this$props11.y, width = _this$props11.width, height = _this$props11.height, alwaysShowText = _this$props11.alwaysShowText; var _this$state5 = this.state, startX = _this$state5.startX, endX = _this$state5.endX, isTextActive = _this$state5.isTextActive, isSlideMoving = _this$state5.isSlideMoving, isTravellerMoving = _this$state5.isTravellerMoving, isTravellerFocused = _this$state5.isTravellerFocused; if (!data || !data.length || !(0,DataUtils/* isNumber */.Et)(x) || !(0,DataUtils/* isNumber */.Et)(y) || !(0,DataUtils/* isNumber */.Et)(width) || !(0,DataUtils/* isNumber */.Et)(height) || width <= 0 || height <= 0) { return null; } var layerClass = (0,clsx/* default */.A)('recharts-brush', className); var isPanoramic = react.Children.count(children) === 1; var style = generatePrefixStyle('userSelect', 'none'); return /*#__PURE__*/react.createElement(Layer/* Layer */.W, { className: layerClass, onMouseLeave: this.handleLeaveWrapper, onTouchMove: this.handleTouchMove, style: style }, this.renderBackground(), isPanoramic && this.renderPanorama(), this.renderSlide(startX, endX), this.renderTravellerLayer(startX, 'startX'), this.renderTravellerLayer(endX, 'endX'), (isTextActive || isSlideMoving || isTravellerMoving || isTravellerFocused || alwaysShowText) && this.renderText()); } }], [{ key: "renderDefaultTraveller", value: function renderDefaultTraveller(props) { var x = props.x, y = props.y, width = props.width, height = props.height, stroke = props.stroke; var lineY = Math.floor(y + height / 2) - 1; return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement("rect", { x: x, y: y, width: width, height: height, fill: stroke, stroke: "none" }), /*#__PURE__*/react.createElement("line", { x1: x + 1, y1: lineY, x2: x + width - 1, y2: lineY, fill: "none", stroke: "#fff" }), /*#__PURE__*/react.createElement("line", { x1: x + 1, y1: lineY + 2, x2: x + width - 1, y2: lineY + 2, fill: "none", stroke: "#fff" })); } }, { key: "renderTraveller", value: function renderTraveller(option, props) { var rectangle; if ( /*#__PURE__*/react.isValidElement(option)) { rectangle = /*#__PURE__*/react.cloneElement(option, props); } else if (isFunction_default()(option)) { rectangle = option(props); } else { rectangle = Brush.renderDefaultTraveller(props); } return rectangle; } }, { key: "getDerivedStateFromProps", value: function getDerivedStateFromProps(nextProps, prevState) { var data = nextProps.data, width = nextProps.width, x = nextProps.x, travellerWidth = nextProps.travellerWidth, updateId = nextProps.updateId, startIndex = nextProps.startIndex, endIndex = nextProps.endIndex; if (data !== prevState.prevData || updateId !== prevState.prevUpdateId) { return Brush_objectSpread({ prevData: data, prevTravellerWidth: travellerWidth, prevUpdateId: updateId, prevX: x, prevWidth: width }, data && data.length ? createScale({ data: data, width: width, x: x, travellerWidth: travellerWidth, startIndex: startIndex, endIndex: endIndex }) : { scale: null, scaleValues: null }); } if (prevState.scale && (width !== prevState.prevWidth || x !== prevState.prevX || travellerWidth !== prevState.prevTravellerWidth)) { prevState.scale.range([x, x + width - travellerWidth]); var scaleValues = prevState.scale.domain().map(function (entry) { return prevState.scale(entry); }); return { prevData: data, prevTravellerWidth: travellerWidth, prevUpdateId: updateId, prevX: x, prevWidth: width, startX: prevState.scale(nextProps.startIndex), endX: prevState.scale(nextProps.endIndex), scaleValues: scaleValues }; } return null; } }, { key: "getIndexInRange", value: function getIndexInRange(valueRange, x) { var len = valueRange.length; var start = 0; var end = len - 1; while (end - start > 1) { var middle = Math.floor((start + end) / 2); if (valueRange[middle] > x) { end = middle; } else { start = middle; } } return x >= valueRange[end] ? end : start; } }]); }(react.PureComponent); Brush_defineProperty(Brush, "displayName", 'Brush'); Brush_defineProperty(Brush, "defaultProps", { height: 40, travellerWidth: 5, gap: 1, fill: '#fff', stroke: '#666', padding: { top: 1, right: 1, bottom: 1, left: 1 }, leaveTimeOut: 1000, alwaysShowText: false }); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/DOMUtils.js var DOMUtils = __webpack_require__(1636); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/getLegendProps.js var getLegendProps = __webpack_require__(2532); // EXTERNAL MODULE: ./node_modules/recharts/es6/component/Label.js var Label = __webpack_require__(1706); ;// ./node_modules/recharts/es6/util/IfOverflowMatches.js var ifOverflowMatches = function ifOverflowMatches(props, value) { var alwaysShow = props.alwaysShow; var ifOverflow = props.ifOverflow; if (alwaysShow) { ifOverflow = 'extendDomain'; } return ifOverflow === value; }; // EXTERNAL MODULE: ./node_modules/lodash/mapValues.js var mapValues = __webpack_require__(3916); var mapValues_default = /*#__PURE__*/__webpack_require__.n(mapValues); // EXTERNAL MODULE: ./node_modules/lodash/every.js var lodash_every = __webpack_require__(9747); var every_default = /*#__PURE__*/__webpack_require__.n(lodash_every); ;// ./node_modules/recharts/es6/util/CartesianUtils.js function CartesianUtils_typeof(o) { "@babel/helpers - typeof"; return CartesianUtils_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, CartesianUtils_typeof(o); } function CartesianUtils_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function CartesianUtils_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, CartesianUtils_toPropertyKey(descriptor.key), descriptor); } } function CartesianUtils_createClass(Constructor, protoProps, staticProps) { if (protoProps) CartesianUtils_defineProperties(Constructor.prototype, protoProps); if (staticProps) CartesianUtils_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function CartesianUtils_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function CartesianUtils_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? CartesianUtils_ownKeys(Object(t), !0).forEach(function (r) { CartesianUtils_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : CartesianUtils_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function CartesianUtils_defineProperty(obj, key, value) { key = CartesianUtils_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function CartesianUtils_toPropertyKey(t) { var i = CartesianUtils_toPrimitive(t, "string"); return "symbol" == CartesianUtils_typeof(i) ? i : i + ""; } function CartesianUtils_toPrimitive(t, r) { if ("object" != CartesianUtils_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != CartesianUtils_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /** * Calculate the scale function, position, width, height of axes * @param {Object} props Latest props * @param {Object} axisMap The configuration of axes * @param {Object} offset The offset of main part in the svg element * @param {String} axisType The type of axes, x-axis or y-axis * @param {String} chartName The name of chart * @return {Object} Configuration */ var formatAxisMap = function formatAxisMap(props, axisMap, offset, axisType, chartName) { var width = props.width, height = props.height, layout = props.layout, children = props.children; var ids = Object.keys(axisMap); var steps = { left: offset.left, leftMirror: offset.left, right: width - offset.right, rightMirror: width - offset.right, top: offset.top, topMirror: offset.top, bottom: height - offset.bottom, bottomMirror: height - offset.bottom }; var hasBar = !!findChildByType(children, Bar); return ids.reduce(function (result, id) { var axis = axisMap[id]; var orientation = axis.orientation, domain = axis.domain, _axis$padding = axis.padding, padding = _axis$padding === void 0 ? {} : _axis$padding, mirror = axis.mirror, reversed = axis.reversed; var offsetKey = "".concat(orientation).concat(mirror ? 'Mirror' : ''); var calculatedPadding, range, x, y, needSpace; if (axis.type === 'number' && (axis.padding === 'gap' || axis.padding === 'no-gap')) { var diff = domain[1] - domain[0]; var smallestDistanceBetweenValues = Infinity; var sortedValues = axis.categoricalDomain.sort(compareValues); sortedValues.forEach(function (value, index) { if (index > 0) { smallestDistanceBetweenValues = Math.min((value || 0) - (sortedValues[index - 1] || 0), smallestDistanceBetweenValues); } }); if (Number.isFinite(smallestDistanceBetweenValues)) { var smallestDistanceInPercent = smallestDistanceBetweenValues / diff; var rangeWidth = axis.layout === 'vertical' ? offset.height : offset.width; if (axis.padding === 'gap') { calculatedPadding = smallestDistanceInPercent * rangeWidth / 2; } if (axis.padding === 'no-gap') { var gap = getPercentValue(props.barCategoryGap, smallestDistanceInPercent * rangeWidth); var halfBand = smallestDistanceInPercent * rangeWidth / 2; calculatedPadding = halfBand - gap - (halfBand - gap) / rangeWidth * gap; } } } if (axisType === 'xAxis') { range = [offset.left + (padding.left || 0) + (calculatedPadding || 0), offset.left + offset.width - (padding.right || 0) - (calculatedPadding || 0)]; } else if (axisType === 'yAxis') { range = layout === 'horizontal' ? [offset.top + offset.height - (padding.bottom || 0), offset.top + (padding.top || 0)] : [offset.top + (padding.top || 0) + (calculatedPadding || 0), offset.top + offset.height - (padding.bottom || 0) - (calculatedPadding || 0)]; } else { range = axis.range; } if (reversed) { range = [range[1], range[0]]; } var _parseScale = parseScale(axis, chartName, hasBar), scale = _parseScale.scale, realScaleType = _parseScale.realScaleType; scale.domain(domain).range(range); checkDomainOfScale(scale); var ticks = getTicksOfScale(scale, CartesianUtils_objectSpread(CartesianUtils_objectSpread({}, axis), {}, { realScaleType: realScaleType })); if (axisType === 'xAxis') { needSpace = orientation === 'top' && !mirror || orientation === 'bottom' && mirror; x = offset.left; y = steps[offsetKey] - needSpace * axis.height; } else if (axisType === 'yAxis') { needSpace = orientation === 'left' && !mirror || orientation === 'right' && mirror; x = steps[offsetKey] - needSpace * axis.width; y = offset.top; } var finalAxis = CartesianUtils_objectSpread(CartesianUtils_objectSpread(CartesianUtils_objectSpread({}, axis), ticks), {}, { realScaleType: realScaleType, x: x, y: y, scale: scale, width: axisType === 'xAxis' ? offset.width : axis.width, height: axisType === 'yAxis' ? offset.height : axis.height }); finalAxis.bandSize = getBandSizeOfAxis(finalAxis, ticks); if (!axis.hide && axisType === 'xAxis') { steps[offsetKey] += (needSpace ? -1 : 1) * finalAxis.height; } else if (!axis.hide) { steps[offsetKey] += (needSpace ? -1 : 1) * finalAxis.width; } return CartesianUtils_objectSpread(CartesianUtils_objectSpread({}, result), {}, CartesianUtils_defineProperty({}, id, finalAxis)); }, {}); }; var rectWithPoints = function rectWithPoints(_ref, _ref2) { var x1 = _ref.x, y1 = _ref.y; var x2 = _ref2.x, y2 = _ref2.y; return { x: Math.min(x1, x2), y: Math.min(y1, y2), width: Math.abs(x2 - x1), height: Math.abs(y2 - y1) }; }; /** * Compute the x, y, width, and height of a box from two reference points. * @param {Object} coords x1, x2, y1, and y2 * @return {Object} object */ var rectWithCoords = function rectWithCoords(_ref3) { var x1 = _ref3.x1, y1 = _ref3.y1, x2 = _ref3.x2, y2 = _ref3.y2; return rectWithPoints({ x: x1, y: y1 }, { x: x2, y: y2 }); }; var ScaleHelper = /*#__PURE__*/function () { function ScaleHelper(scale) { CartesianUtils_classCallCheck(this, ScaleHelper); this.scale = scale; } return CartesianUtils_createClass(ScaleHelper, [{ key: "domain", get: function get() { return this.scale.domain; } }, { key: "range", get: function get() { return this.scale.range; } }, { key: "rangeMin", get: function get() { return this.range()[0]; } }, { key: "rangeMax", get: function get() { return this.range()[1]; } }, { key: "bandwidth", get: function get() { return this.scale.bandwidth; } }, { key: "apply", value: function apply(value) { var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, bandAware = _ref4.bandAware, position = _ref4.position; if (value === undefined) { return undefined; } if (position) { switch (position) { case 'start': { return this.scale(value); } case 'middle': { var offset = this.bandwidth ? this.bandwidth() / 2 : 0; return this.scale(value) + offset; } case 'end': { var _offset = this.bandwidth ? this.bandwidth() : 0; return this.scale(value) + _offset; } default: { return this.scale(value); } } } if (bandAware) { var _offset2 = this.bandwidth ? this.bandwidth() / 2 : 0; return this.scale(value) + _offset2; } return this.scale(value); } }, { key: "isInRange", value: function isInRange(value) { var range = this.range(); var first = range[0]; var last = range[range.length - 1]; return first <= last ? value >= first && value <= last : value >= last && value <= first; } }], [{ key: "create", value: function create(obj) { return new ScaleHelper(obj); } }]); }(); CartesianUtils_defineProperty(ScaleHelper, "EPS", 1e-4); var createLabeledScales = function createLabeledScales(options) { var scales = Object.keys(options).reduce(function (res, key) { return CartesianUtils_objectSpread(CartesianUtils_objectSpread({}, res), {}, CartesianUtils_defineProperty({}, key, ScaleHelper.create(options[key]))); }, {}); return CartesianUtils_objectSpread(CartesianUtils_objectSpread({}, scales), {}, { apply: function apply(coord) { var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, bandAware = _ref5.bandAware, position = _ref5.position; return mapValues_default()(coord, function (value, label) { return scales[label].apply(value, { bandAware: bandAware, position: position }); }); }, isInRange: function isInRange(coord) { return every_default()(coord, function (value, label) { return scales[label].isInRange(value); }); } }); }; /** Normalizes the angle so that 0 <= angle < 180. * @param {number} angle Angle in degrees. * @return {number} the normalized angle with a value of at least 0 and never greater or equal to 180. */ function normalizeAngle(angle) { return (angle % 180 + 180) % 180; } /** Calculates the width of the largest horizontal line that fits inside a rectangle that is displayed at an angle. * @param {Object} size Width and height of the text in a horizontal position. * @param {number} angle Angle in degrees in which the text is displayed. * @return {number} The width of the largest horizontal line that fits inside a rectangle that is displayed at an angle. */ var getAngledRectangleWidth = function getAngledRectangleWidth(_ref6) { var width = _ref6.width, height = _ref6.height; var angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; // Ensure angle is >= 0 && < 180 var normalizedAngle = normalizeAngle(angle); var angleRadians = normalizedAngle * Math.PI / 180; /* Depending on the height and width of the rectangle, we may need to use different formulas to calculate the angled * width. This threshold defines when each formula should kick in. */ var angleThreshold = Math.atan(height / width); var angledWidth = angleRadians > angleThreshold && angleRadians < Math.PI - angleThreshold ? height / Math.sin(angleRadians) : width / Math.cos(angleRadians); return Math.abs(angledWidth); }; // EXTERNAL MODULE: ./node_modules/recharts/es6/util/LogUtils.js var LogUtils = __webpack_require__(6634); ;// ./node_modules/recharts/es6/cartesian/ReferenceDot.js function ReferenceDot_extends() { ReferenceDot_extends = Object.assign ? Object.assign.bind() : 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; }; return ReferenceDot_extends.apply(this, arguments); } function ReferenceDot_typeof(o) { "@babel/helpers - typeof"; return ReferenceDot_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, ReferenceDot_typeof(o); } function ReferenceDot_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function ReferenceDot_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ReferenceDot_ownKeys(Object(t), !0).forEach(function (r) { ReferenceDot_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ReferenceDot_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function ReferenceDot_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function ReferenceDot_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, ReferenceDot_toPropertyKey(descriptor.key), descriptor); } } function ReferenceDot_createClass(Constructor, protoProps, staticProps) { if (protoProps) ReferenceDot_defineProperties(Constructor.prototype, protoProps); if (staticProps) ReferenceDot_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function ReferenceDot_callSuper(t, o, e) { return o = ReferenceDot_getPrototypeOf(o), ReferenceDot_possibleConstructorReturn(t, ReferenceDot_isNativeReflectConstruct() ? Reflect.construct(o, e || [], ReferenceDot_getPrototypeOf(t).constructor) : o.apply(t, e)); } function ReferenceDot_possibleConstructorReturn(self, call) { if (call && (ReferenceDot_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return ReferenceDot_assertThisInitialized(self); } function ReferenceDot_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function ReferenceDot_isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (ReferenceDot_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } function ReferenceDot_getPrototypeOf(o) { ReferenceDot_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ReferenceDot_getPrototypeOf(o); } function ReferenceDot_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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) ReferenceDot_setPrototypeOf(subClass, superClass); } function ReferenceDot_setPrototypeOf(o, p) { ReferenceDot_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ReferenceDot_setPrototypeOf(o, p); } function ReferenceDot_defineProperty(obj, key, value) { key = ReferenceDot_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function ReferenceDot_toPropertyKey(t) { var i = ReferenceDot_toPrimitive(t, "string"); return "symbol" == ReferenceDot_typeof(i) ? i : i + ""; } function ReferenceDot_toPrimitive(t, r) { if ("object" != ReferenceDot_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != ReferenceDot_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /** * @fileOverview Reference Dot */ var getCoordinate = function getCoordinate(props) { var x = props.x, y = props.y, xAxis = props.xAxis, yAxis = props.yAxis; var scales = createLabeledScales({ x: xAxis.scale, y: yAxis.scale }); var result = scales.apply({ x: x, y: y }, { bandAware: true }); if (ifOverflowMatches(props, 'discard') && !scales.isInRange(result)) { return null; } return result; }; // eslint-disable-next-line react/prefer-stateless-function -- requires static defaultProps var ReferenceDot = /*#__PURE__*/function (_React$Component) { function ReferenceDot() { ReferenceDot_classCallCheck(this, ReferenceDot); return ReferenceDot_callSuper(this, ReferenceDot, arguments); } ReferenceDot_inherits(ReferenceDot, _React$Component); return ReferenceDot_createClass(ReferenceDot, [{ key: "render", value: function render() { var _this$props = this.props, x = _this$props.x, y = _this$props.y, r = _this$props.r, alwaysShow = _this$props.alwaysShow, clipPathId = _this$props.clipPathId; var isX = (0,DataUtils/* isNumOrStr */.vh)(x); var isY = (0,DataUtils/* isNumOrStr */.vh)(y); (0,LogUtils/* warn */.R)(alwaysShow === undefined, 'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'); if (!isX || !isY) { return null; } var coordinate = getCoordinate(this.props); if (!coordinate) { return null; } var cx = coordinate.x, cy = coordinate.y; var _this$props2 = this.props, shape = _this$props2.shape, className = _this$props2.className; var clipPath = ifOverflowMatches(this.props, 'hidden') ? "url(#".concat(clipPathId, ")") : undefined; var dotProps = ReferenceDot_objectSpread(ReferenceDot_objectSpread({ clipPath: clipPath }, (0,ReactUtils/* filterProps */.J9)(this.props, true)), {}, { cx: cx, cy: cy }); return /*#__PURE__*/react.createElement(Layer/* Layer */.W, { className: (0,clsx/* default */.A)('recharts-reference-dot', className) }, ReferenceDot.renderDot(shape, dotProps), Label/* Label */.J.renderCallByParent(this.props, { x: cx - r, y: cy - r, width: 2 * r, height: 2 * r })); } }]); }(react.Component); ReferenceDot_defineProperty(ReferenceDot, "displayName", 'ReferenceDot'); ReferenceDot_defineProperty(ReferenceDot, "defaultProps", { isFront: false, ifOverflow: 'discard', xAxisId: 0, yAxisId: 0, r: 10, fill: '#fff', stroke: '#ccc', fillOpacity: 1, strokeWidth: 1 }); ReferenceDot_defineProperty(ReferenceDot, "renderDot", function (option, props) { var dot; if ( /*#__PURE__*/react.isValidElement(option)) { dot = /*#__PURE__*/react.cloneElement(option, props); } else if (isFunction_default()(option)) { dot = option(props); } else { dot = /*#__PURE__*/react.createElement(Dot, ReferenceDot_extends({}, props, { cx: props.cx, cy: props.cy, className: "recharts-reference-dot-dot" })); } return dot; }); // EXTERNAL MODULE: ./node_modules/lodash/some.js var some = __webpack_require__(2426); var some_default = /*#__PURE__*/__webpack_require__.n(some); // EXTERNAL MODULE: ./node_modules/lodash/find.js var lodash_find = __webpack_require__(7309); // EXTERNAL MODULE: ./node_modules/lodash/memoize.js var memoize = __webpack_require__(104); var memoize_default = /*#__PURE__*/__webpack_require__.n(memoize); ;// ./node_modules/recharts/es6/util/calculateViewBox.js /** * This is memoized because the viewBox is unlikely to change often * - but because it is computed from offset, any change to it would re-render all children. * * And because we have many readers of the viewBox, and update it only rarely, * then let's optimize with memoization. */ var calculateViewBox = memoize_default()(function (offset) { return { x: offset.left, y: offset.top, width: offset.width, height: offset.height }; }, function (offset) { return ['l', offset.left, 't', offset.top, 'w', offset.width, 'h', offset.height].join(''); }); ;// ./node_modules/recharts/es6/context/chartLayoutContext.js function chartLayoutContext_typeof(o) { "@babel/helpers - typeof"; return chartLayoutContext_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, chartLayoutContext_typeof(o); } var XAxisContext = /*#__PURE__*/(0,react.createContext)(undefined); var YAxisContext = /*#__PURE__*/(0,react.createContext)(undefined); var ViewBoxContext = /*#__PURE__*/(0,react.createContext)(undefined); var OffsetContext = /*#__PURE__*/(0,react.createContext)({}); var ClipPathIdContext = /*#__PURE__*/(0,react.createContext)(undefined); var ChartHeightContext = /*#__PURE__*/(0,react.createContext)(0); var ChartWidthContext = /*#__PURE__*/(0,react.createContext)(0); /** * Will add all the properties required to render all individual Recharts components into a React Context. * * If you want to read these properties, see the collection of hooks exported from this file. * * @param {object} props CategoricalChartState, plus children * @returns {ReactElement} React Context Provider */ var ChartLayoutContextProvider = function ChartLayoutContextProvider(props) { var _props$state = props.state, xAxisMap = _props$state.xAxisMap, yAxisMap = _props$state.yAxisMap, offset = _props$state.offset, clipPathId = props.clipPathId, children = props.children, width = props.width, height = props.height; /** * Perhaps we should compute this property when reading? Let's see what is more often used */ var viewBox = calculateViewBox(offset); /* * This pretends to be a single context but actually is split into multiple smaller ones. * Why? * Because one React Context only allows to set one value. * But we need to set multiple values. * If we do that with one context, then we force re-render on components that might not even be interested * in the part of the state that has changed. * * By splitting into smaller contexts, we allow each components to be optimized and only re-render when its dependencies change. * * To actually achieve the optimal re-render, it is necessary to use React.memo(). * See the test file for details. */ return /*#__PURE__*/react.createElement(XAxisContext.Provider, { value: xAxisMap }, /*#__PURE__*/react.createElement(YAxisContext.Provider, { value: yAxisMap }, /*#__PURE__*/react.createElement(OffsetContext.Provider, { value: offset }, /*#__PURE__*/react.createElement(ViewBoxContext.Provider, { value: viewBox }, /*#__PURE__*/react.createElement(ClipPathIdContext.Provider, { value: clipPathId }, /*#__PURE__*/react.createElement(ChartHeightContext.Provider, { value: height }, /*#__PURE__*/react.createElement(ChartWidthContext.Provider, { value: width }, children))))))); }; var useClipPathId = function useClipPathId() { return (0,react.useContext)(ClipPathIdContext); }; function getKeysForDebug(object) { var keys = Object.keys(object); if (keys.length === 0) { return 'There are no available ids.'; } return "Available ids are: ".concat(keys, "."); } /** * This either finds and returns Axis by the specified ID, or throws an exception if an axis with this ID does not exist. * * @param xAxisId identifier of the axis - it's either autogenerated ('0'), or passed via `id` prop as * @returns axis configuration object * @throws Error if no axis with this ID exists */ var useXAxisOrThrow = function useXAxisOrThrow(xAxisId) { var xAxisMap = (0,react.useContext)(XAxisContext); !(xAxisMap != null) ? false ? 0 : (0,tiny_invariant/* default */.A)(false) : void 0; var xAxis = xAxisMap[xAxisId]; !(xAxis != null) ? false ? 0 : (0,tiny_invariant/* default */.A)(false) : void 0; return xAxis; }; /** * This will find an arbitrary first XAxis. If there's exactly one it always returns that one * - but if there are multiple then it can return any of those. * * If you want specific XAxis out of multiple then prefer using useXAxisOrThrow * * @returns X axisOptions, or undefined - if there are no X axes */ var useArbitraryXAxis = function useArbitraryXAxis() { var xAxisMap = useContext(XAxisContext); return getAnyElementOfObject(xAxisMap); }; /** * This will find an arbitrary first YAxis. If there's exactly one it always returns that one * - but if there are multiple then it can return any of those. * * If you want specific YAxis out of multiple then prefer using useXAxisOrThrow * * @returns Y axisOptions, or undefined - if there are no Y axes */ var useArbitraryYAxis = function useArbitraryYAxis() { var yAxisMap = useContext(YAxisContext); return getAnyElementOfObject(yAxisMap); }; /** * This hooks will: * 1st attempt to find an YAxis that has all elements in its domain finite * If no such axis exists, it will return an arbitrary YAxis * if there are no Y axes then it returns undefined * * @returns Either Y axisOptions, or undefined if there are no Y axes */ var useYAxisWithFiniteDomainOrRandom = function useYAxisWithFiniteDomainOrRandom() { var yAxisMap = useContext(YAxisContext); var yAxisWithFiniteDomain = find(yAxisMap, function (axis) { return every(axis.domain, Number.isFinite); }); return yAxisWithFiniteDomain || getAnyElementOfObject(yAxisMap); }; /** * This either finds and returns Axis by the specified ID, or throws an exception if an axis with this ID does not exist. * * @param yAxisId identifier of the axis - it's either autogenerated ('0'), or passed via `id` prop as * @returns axis configuration object * @throws Error if no axis with this ID exists */ var useYAxisOrThrow = function useYAxisOrThrow(yAxisId) { var yAxisMap = (0,react.useContext)(YAxisContext); !(yAxisMap != null) ? false ? 0 : (0,tiny_invariant/* default */.A)(false) : void 0; var yAxis = yAxisMap[yAxisId]; !(yAxis != null) ? false ? 0 : (0,tiny_invariant/* default */.A)(false) : void 0; return yAxis; }; var useViewBox = function useViewBox() { var viewBox = (0,react.useContext)(ViewBoxContext); return viewBox; }; var useOffset = function useOffset() { return useContext(OffsetContext); }; var useChartWidth = function useChartWidth() { return useContext(ChartWidthContext); }; var useChartHeight = function useChartHeight() { return useContext(ChartHeightContext); }; ;// ./node_modules/recharts/es6/cartesian/ReferenceLine.js function ReferenceLine_typeof(o) { "@babel/helpers - typeof"; return ReferenceLine_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, ReferenceLine_typeof(o); } function ReferenceLine_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function ReferenceLine_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, ReferenceLine_toPropertyKey(descriptor.key), descriptor); } } function ReferenceLine_createClass(Constructor, protoProps, staticProps) { if (protoProps) ReferenceLine_defineProperties(Constructor.prototype, protoProps); if (staticProps) ReferenceLine_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function ReferenceLine_callSuper(t, o, e) { return o = ReferenceLine_getPrototypeOf(o), ReferenceLine_possibleConstructorReturn(t, ReferenceLine_isNativeReflectConstruct() ? Reflect.construct(o, e || [], ReferenceLine_getPrototypeOf(t).constructor) : o.apply(t, e)); } function ReferenceLine_possibleConstructorReturn(self, call) { if (call && (ReferenceLine_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return ReferenceLine_assertThisInitialized(self); } function ReferenceLine_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function ReferenceLine_isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (ReferenceLine_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } function ReferenceLine_getPrototypeOf(o) { ReferenceLine_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ReferenceLine_getPrototypeOf(o); } function ReferenceLine_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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) ReferenceLine_setPrototypeOf(subClass, superClass); } function ReferenceLine_setPrototypeOf(o, p) { ReferenceLine_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ReferenceLine_setPrototypeOf(o, p); } function ReferenceLine_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function ReferenceLine_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ReferenceLine_ownKeys(Object(t), !0).forEach(function (r) { ReferenceLine_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ReferenceLine_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function ReferenceLine_defineProperty(obj, key, value) { key = ReferenceLine_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function ReferenceLine_toPropertyKey(t) { var i = ReferenceLine_toPrimitive(t, "string"); return "symbol" == ReferenceLine_typeof(i) ? i : i + ""; } function ReferenceLine_toPrimitive(t, r) { if ("object" != ReferenceLine_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != ReferenceLine_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } function ReferenceLine_slicedToArray(arr, i) { return ReferenceLine_arrayWithHoles(arr) || ReferenceLine_iterableToArrayLimit(arr, i) || ReferenceLine_unsupportedIterableToArray(arr, i) || ReferenceLine_nonIterableRest(); } function ReferenceLine_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function ReferenceLine_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return ReferenceLine_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return ReferenceLine_arrayLikeToArray(o, minLen); } function ReferenceLine_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function ReferenceLine_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } function ReferenceLine_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function ReferenceLine_extends() { ReferenceLine_extends = Object.assign ? Object.assign.bind() : 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; }; return ReferenceLine_extends.apply(this, arguments); } /** * @fileOverview Reference Line */ /** * This excludes `viewBox` prop from svg for two reasons: * 1. The components wants viewBox of object type, and svg wants string * - so there's a conflict, and the component will throw if it gets string * 2. Internally the component calls `filterProps` which filters the viewBox away anyway */ var renderLine = function renderLine(option, props) { var line; if ( /*#__PURE__*/react.isValidElement(option)) { line = /*#__PURE__*/react.cloneElement(option, props); } else if (isFunction_default()(option)) { line = option(props); } else { line = /*#__PURE__*/react.createElement("line", ReferenceLine_extends({}, props, { className: "recharts-reference-line-line" })); } return line; }; // TODO: ScaleHelper var getEndPoints = function getEndPoints(scales, isFixedX, isFixedY, isSegment, viewBox, position, xAxisOrientation, yAxisOrientation, props) { var x = viewBox.x, y = viewBox.y, width = viewBox.width, height = viewBox.height; if (isFixedY) { var yCoord = props.y; var coord = scales.y.apply(yCoord, { position: position }); if (ifOverflowMatches(props, 'discard') && !scales.y.isInRange(coord)) { return null; } var points = [{ x: x + width, y: coord }, { x: x, y: coord }]; return yAxisOrientation === 'left' ? points.reverse() : points; } if (isFixedX) { var xCoord = props.x; var _coord = scales.x.apply(xCoord, { position: position }); if (ifOverflowMatches(props, 'discard') && !scales.x.isInRange(_coord)) { return null; } var _points = [{ x: _coord, y: y + height }, { x: _coord, y: y }]; return xAxisOrientation === 'top' ? _points.reverse() : _points; } if (isSegment) { var segment = props.segment; var _points2 = segment.map(function (p) { return scales.apply(p, { position: position }); }); if (ifOverflowMatches(props, 'discard') && some_default()(_points2, function (p) { return !scales.isInRange(p); })) { return null; } return _points2; } return null; }; function ReferenceLineImpl(props) { var fixedX = props.x, fixedY = props.y, segment = props.segment, xAxisId = props.xAxisId, yAxisId = props.yAxisId, shape = props.shape, className = props.className, alwaysShow = props.alwaysShow; var clipPathId = useClipPathId(); var xAxis = useXAxisOrThrow(xAxisId); var yAxis = useYAxisOrThrow(yAxisId); var viewBox = useViewBox(); if (!clipPathId || !viewBox) { return null; } (0,LogUtils/* warn */.R)(alwaysShow === undefined, 'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'); var scales = createLabeledScales({ x: xAxis.scale, y: yAxis.scale }); var isX = (0,DataUtils/* isNumOrStr */.vh)(fixedX); var isY = (0,DataUtils/* isNumOrStr */.vh)(fixedY); var isSegment = segment && segment.length === 2; var endPoints = getEndPoints(scales, isX, isY, isSegment, viewBox, props.position, xAxis.orientation, yAxis.orientation, props); if (!endPoints) { return null; } var _endPoints = ReferenceLine_slicedToArray(endPoints, 2), _endPoints$ = _endPoints[0], x1 = _endPoints$.x, y1 = _endPoints$.y, _endPoints$2 = _endPoints[1], x2 = _endPoints$2.x, y2 = _endPoints$2.y; var clipPath = ifOverflowMatches(props, 'hidden') ? "url(#".concat(clipPathId, ")") : undefined; var lineProps = ReferenceLine_objectSpread(ReferenceLine_objectSpread({ clipPath: clipPath }, (0,ReactUtils/* filterProps */.J9)(props, true)), {}, { x1: x1, y1: y1, x2: x2, y2: y2 }); return /*#__PURE__*/react.createElement(Layer/* Layer */.W, { className: (0,clsx/* default */.A)('recharts-reference-line', className) }, renderLine(shape, lineProps), Label/* Label */.J.renderCallByParent(props, rectWithCoords({ x1: x1, y1: y1, x2: x2, y2: y2 }))); } // eslint-disable-next-line react/prefer-stateless-function -- requires static defaultProps var ReferenceLine = /*#__PURE__*/function (_React$Component) { function ReferenceLine() { ReferenceLine_classCallCheck(this, ReferenceLine); return ReferenceLine_callSuper(this, ReferenceLine, arguments); } ReferenceLine_inherits(ReferenceLine, _React$Component); return ReferenceLine_createClass(ReferenceLine, [{ key: "render", value: function render() { return /*#__PURE__*/react.createElement(ReferenceLineImpl, this.props); } }]); }(react.Component); ReferenceLine_defineProperty(ReferenceLine, "displayName", 'ReferenceLine'); ReferenceLine_defineProperty(ReferenceLine, "defaultProps", { isFront: false, ifOverflow: 'discard', xAxisId: 0, yAxisId: 0, fill: 'none', stroke: '#ccc', fillOpacity: 1, strokeWidth: 1, position: 'middle' }); ;// ./node_modules/recharts/es6/cartesian/ReferenceArea.js function ReferenceArea_extends() { ReferenceArea_extends = Object.assign ? Object.assign.bind() : 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; }; return ReferenceArea_extends.apply(this, arguments); } function ReferenceArea_typeof(o) { "@babel/helpers - typeof"; return ReferenceArea_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, ReferenceArea_typeof(o); } function ReferenceArea_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function ReferenceArea_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ReferenceArea_ownKeys(Object(t), !0).forEach(function (r) { ReferenceArea_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ReferenceArea_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function ReferenceArea_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function ReferenceArea_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, ReferenceArea_toPropertyKey(descriptor.key), descriptor); } } function ReferenceArea_createClass(Constructor, protoProps, staticProps) { if (protoProps) ReferenceArea_defineProperties(Constructor.prototype, protoProps); if (staticProps) ReferenceArea_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function ReferenceArea_callSuper(t, o, e) { return o = ReferenceArea_getPrototypeOf(o), ReferenceArea_possibleConstructorReturn(t, ReferenceArea_isNativeReflectConstruct() ? Reflect.construct(o, e || [], ReferenceArea_getPrototypeOf(t).constructor) : o.apply(t, e)); } function ReferenceArea_possibleConstructorReturn(self, call) { if (call && (ReferenceArea_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return ReferenceArea_assertThisInitialized(self); } function ReferenceArea_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function ReferenceArea_isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (ReferenceArea_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } function ReferenceArea_getPrototypeOf(o) { ReferenceArea_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ReferenceArea_getPrototypeOf(o); } function ReferenceArea_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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) ReferenceArea_setPrototypeOf(subClass, superClass); } function ReferenceArea_setPrototypeOf(o, p) { ReferenceArea_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ReferenceArea_setPrototypeOf(o, p); } function ReferenceArea_defineProperty(obj, key, value) { key = ReferenceArea_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function ReferenceArea_toPropertyKey(t) { var i = ReferenceArea_toPrimitive(t, "string"); return "symbol" == ReferenceArea_typeof(i) ? i : i + ""; } function ReferenceArea_toPrimitive(t, r) { if ("object" != ReferenceArea_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != ReferenceArea_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /** * @fileOverview Reference Line */ var getRect = function getRect(hasX1, hasX2, hasY1, hasY2, props) { var xValue1 = props.x1, xValue2 = props.x2, yValue1 = props.y1, yValue2 = props.y2, xAxis = props.xAxis, yAxis = props.yAxis; if (!xAxis || !yAxis) return null; var scales = createLabeledScales({ x: xAxis.scale, y: yAxis.scale }); var p1 = { x: hasX1 ? scales.x.apply(xValue1, { position: 'start' }) : scales.x.rangeMin, y: hasY1 ? scales.y.apply(yValue1, { position: 'start' }) : scales.y.rangeMin }; var p2 = { x: hasX2 ? scales.x.apply(xValue2, { position: 'end' }) : scales.x.rangeMax, y: hasY2 ? scales.y.apply(yValue2, { position: 'end' }) : scales.y.rangeMax }; if (ifOverflowMatches(props, 'discard') && (!scales.isInRange(p1) || !scales.isInRange(p2))) { return null; } return rectWithPoints(p1, p2); }; // eslint-disable-next-line react/prefer-stateless-function -- requires static defaultProps var ReferenceArea = /*#__PURE__*/function (_React$Component) { function ReferenceArea() { ReferenceArea_classCallCheck(this, ReferenceArea); return ReferenceArea_callSuper(this, ReferenceArea, arguments); } ReferenceArea_inherits(ReferenceArea, _React$Component); return ReferenceArea_createClass(ReferenceArea, [{ key: "render", value: function render() { var _this$props = this.props, x1 = _this$props.x1, x2 = _this$props.x2, y1 = _this$props.y1, y2 = _this$props.y2, className = _this$props.className, alwaysShow = _this$props.alwaysShow, clipPathId = _this$props.clipPathId; (0,LogUtils/* warn */.R)(alwaysShow === undefined, 'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'); var hasX1 = (0,DataUtils/* isNumOrStr */.vh)(x1); var hasX2 = (0,DataUtils/* isNumOrStr */.vh)(x2); var hasY1 = (0,DataUtils/* isNumOrStr */.vh)(y1); var hasY2 = (0,DataUtils/* isNumOrStr */.vh)(y2); var shape = this.props.shape; if (!hasX1 && !hasX2 && !hasY1 && !hasY2 && !shape) { return null; } var rect = getRect(hasX1, hasX2, hasY1, hasY2, this.props); if (!rect && !shape) { return null; } var clipPath = ifOverflowMatches(this.props, 'hidden') ? "url(#".concat(clipPathId, ")") : undefined; return /*#__PURE__*/react.createElement(Layer/* Layer */.W, { className: (0,clsx/* default */.A)('recharts-reference-area', className) }, ReferenceArea.renderRect(shape, ReferenceArea_objectSpread(ReferenceArea_objectSpread({ clipPath: clipPath }, (0,ReactUtils/* filterProps */.J9)(this.props, true)), rect)), Label/* Label */.J.renderCallByParent(this.props, rect)); } }]); }(react.Component); ReferenceArea_defineProperty(ReferenceArea, "displayName", 'ReferenceArea'); ReferenceArea_defineProperty(ReferenceArea, "defaultProps", { isFront: false, ifOverflow: 'discard', xAxisId: 0, yAxisId: 0, r: 10, fill: '#ccc', fillOpacity: 0.5, stroke: 'none', strokeWidth: 1 }); ReferenceArea_defineProperty(ReferenceArea, "renderRect", function (option, props) { var rect; if ( /*#__PURE__*/react.isValidElement(option)) { rect = /*#__PURE__*/react.cloneElement(option, props); } else if (isFunction_default()(option)) { rect = option(props); } else { rect = /*#__PURE__*/react.createElement(Rectangle/* Rectangle */.M, ReferenceArea_extends({}, props, { className: "recharts-reference-area-rect" })); } return rect; }); ;// ./node_modules/recharts/es6/util/DetectReferenceElementsDomain.js function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || DetectReferenceElementsDomain_unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function DetectReferenceElementsDomain_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return DetectReferenceElementsDomain_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return DetectReferenceElementsDomain_arrayLikeToArray(o, minLen); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return DetectReferenceElementsDomain_arrayLikeToArray(arr); } function DetectReferenceElementsDomain_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } var detectReferenceElementsDomain = function detectReferenceElementsDomain(children, domain, axisId, axisType, specifiedTicks) { var lines = (0,ReactUtils/* findAllByType */.aS)(children, ReferenceLine); var dots = (0,ReactUtils/* findAllByType */.aS)(children, ReferenceDot); var elements = [].concat(_toConsumableArray(lines), _toConsumableArray(dots)); var areas = (0,ReactUtils/* findAllByType */.aS)(children, ReferenceArea); var idKey = "".concat(axisType, "Id"); var valueKey = axisType[0]; var finalDomain = domain; if (elements.length) { finalDomain = elements.reduce(function (result, el) { if (el.props[idKey] === axisId && ifOverflowMatches(el.props, 'extendDomain') && (0,DataUtils/* isNumber */.Et)(el.props[valueKey])) { var value = el.props[valueKey]; return [Math.min(result[0], value), Math.max(result[1], value)]; } return result; }, finalDomain); } if (areas.length) { var key1 = "".concat(valueKey, "1"); var key2 = "".concat(valueKey, "2"); finalDomain = areas.reduce(function (result, el) { if (el.props[idKey] === axisId && ifOverflowMatches(el.props, 'extendDomain') && (0,DataUtils/* isNumber */.Et)(el.props[key1]) && (0,DataUtils/* isNumber */.Et)(el.props[key2])) { var value1 = el.props[key1]; var value2 = el.props[key2]; return [Math.min(result[0], value1, value2), Math.max(result[1], value1, value2)]; } return result; }, finalDomain); } if (specifiedTicks && specifiedTicks.length) { finalDomain = specifiedTicks.reduce(function (result, tick) { if ((0,DataUtils/* isNumber */.Et)(tick)) { return [Math.min(result[0], tick), Math.max(result[1], tick)]; } return result; }, finalDomain); } return finalDomain; }; // EXTERNAL MODULE: ./node_modules/recharts/es6/util/PolarUtils.js var PolarUtils = __webpack_require__(4040); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/ShallowEqual.js var ShallowEqual = __webpack_require__(3521); // EXTERNAL MODULE: ./node_modules/eventemitter3/index.js var eventemitter3 = __webpack_require__(228); var eventemitter3_default = /*#__PURE__*/__webpack_require__.n(eventemitter3); ;// ./node_modules/recharts/es6/util/Events.js var eventCenter = new (eventemitter3_default())(); var SYNC_EVENT = 'recharts.syncMouseEvents'; ;// ./node_modules/recharts/es6/chart/AccessibilityManager.js function AccessibilityManager_typeof(o) { "@babel/helpers - typeof"; return AccessibilityManager_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, AccessibilityManager_typeof(o); } function AccessibilityManager_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function AccessibilityManager_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, AccessibilityManager_toPropertyKey(descriptor.key), descriptor); } } function AccessibilityManager_createClass(Constructor, protoProps, staticProps) { if (protoProps) AccessibilityManager_defineProperties(Constructor.prototype, protoProps); if (staticProps) AccessibilityManager_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function AccessibilityManager_defineProperty(obj, key, value) { key = AccessibilityManager_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function AccessibilityManager_toPropertyKey(t) { var i = AccessibilityManager_toPrimitive(t, "string"); return "symbol" == AccessibilityManager_typeof(i) ? i : i + ""; } function AccessibilityManager_toPrimitive(t, r) { if ("object" != AccessibilityManager_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != AccessibilityManager_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } var AccessibilityManager = /*#__PURE__*/function () { function AccessibilityManager() { AccessibilityManager_classCallCheck(this, AccessibilityManager); AccessibilityManager_defineProperty(this, "activeIndex", 0); AccessibilityManager_defineProperty(this, "coordinateList", []); AccessibilityManager_defineProperty(this, "layout", 'horizontal'); } return AccessibilityManager_createClass(AccessibilityManager, [{ key: "setDetails", value: function setDetails(_ref) { var _ref2; var _ref$coordinateList = _ref.coordinateList, coordinateList = _ref$coordinateList === void 0 ? null : _ref$coordinateList, _ref$container = _ref.container, container = _ref$container === void 0 ? null : _ref$container, _ref$layout = _ref.layout, layout = _ref$layout === void 0 ? null : _ref$layout, _ref$offset = _ref.offset, offset = _ref$offset === void 0 ? null : _ref$offset, _ref$mouseHandlerCall = _ref.mouseHandlerCallback, mouseHandlerCallback = _ref$mouseHandlerCall === void 0 ? null : _ref$mouseHandlerCall; this.coordinateList = (_ref2 = coordinateList !== null && coordinateList !== void 0 ? coordinateList : this.coordinateList) !== null && _ref2 !== void 0 ? _ref2 : []; this.container = container !== null && container !== void 0 ? container : this.container; this.layout = layout !== null && layout !== void 0 ? layout : this.layout; this.offset = offset !== null && offset !== void 0 ? offset : this.offset; this.mouseHandlerCallback = mouseHandlerCallback !== null && mouseHandlerCallback !== void 0 ? mouseHandlerCallback : this.mouseHandlerCallback; // Keep activeIndex in the bounds between 0 and the last coordinate index this.activeIndex = Math.min(Math.max(this.activeIndex, 0), this.coordinateList.length - 1); } }, { key: "focus", value: function focus() { this.spoofMouse(); } }, { key: "keyboardEvent", value: function keyboardEvent(e) { // The AccessibilityManager relies on the Tooltip component. When tooltips suddenly stop existing, // it can cause errors. We use this function to check. We don't want arrow keys to be processed // if there are no tooltips, since that will cause unexpected behavior of users. if (this.coordinateList.length === 0) { return; } switch (e.key) { case 'ArrowRight': { if (this.layout !== 'horizontal') { return; } this.activeIndex = Math.min(this.activeIndex + 1, this.coordinateList.length - 1); this.spoofMouse(); break; } case 'ArrowLeft': { if (this.layout !== 'horizontal') { return; } this.activeIndex = Math.max(this.activeIndex - 1, 0); this.spoofMouse(); break; } default: { break; } } } }, { key: "setIndex", value: function setIndex(newIndex) { this.activeIndex = newIndex; } }, { key: "spoofMouse", value: function spoofMouse() { var _window, _window2; if (this.layout !== 'horizontal') { return; } // This can happen when the tooltips suddenly stop existing as children of the component // That update doesn't otherwise fire events, so we have to double check here. if (this.coordinateList.length === 0) { return; } var _this$container$getBo = this.container.getBoundingClientRect(), x = _this$container$getBo.x, y = _this$container$getBo.y, height = _this$container$getBo.height; var coordinate = this.coordinateList[this.activeIndex].coordinate; var scrollOffsetX = ((_window = window) === null || _window === void 0 ? void 0 : _window.scrollX) || 0; var scrollOffsetY = ((_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.scrollY) || 0; var pageX = x + coordinate + scrollOffsetX; var pageY = y + this.offset.top + height / 2 + scrollOffsetY; this.mouseHandlerCallback({ pageX: pageX, pageY: pageY }); } }]); }(); ;// ./node_modules/recharts/es6/util/isDomainSpecifiedByUser.js /** * Takes a domain and user props to determine whether he provided the domain via props or if we need to calculate it. * @param {AxisDomain} domain The potential domain from props * @param {Boolean} allowDataOverflow from props * @param {String} axisType from props * @returns {Boolean} `true` if domain is specified by user */ function isDomainSpecifiedByUser(domain, allowDataOverflow, axisType) { if (axisType === 'number' && allowDataOverflow === true && Array.isArray(domain)) { var domainStart = domain === null || domain === void 0 ? void 0 : domain[0]; var domainEnd = domain === null || domain === void 0 ? void 0 : domain[1]; /* * The `isNumber` check is needed because the user could also provide strings like "dataMin" via the domain props. * In such case, we have to compute the domain from the data. */ if (!!domainStart && !!domainEnd && (0,DataUtils/* isNumber */.Et)(domainStart) && (0,DataUtils/* isNumber */.Et)(domainEnd)) { return true; } } return false; } // EXTERNAL MODULE: ./node_modules/recharts/es6/util/ActiveShapeUtils.js + 1 modules var ActiveShapeUtils = __webpack_require__(5079); // EXTERNAL MODULE: ./node_modules/recharts/es6/shape/Curve.js var Curve = __webpack_require__(5249); ;// ./node_modules/recharts/es6/shape/Cross.js function Cross_typeof(o) { "@babel/helpers - typeof"; return Cross_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, Cross_typeof(o); } var _excluded = ["x", "y", "top", "left", "width", "height", "className"]; function Cross_extends() { Cross_extends = Object.assign ? Object.assign.bind() : 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; }; return Cross_extends.apply(this, arguments); } function Cross_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function Cross_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? Cross_ownKeys(Object(t), !0).forEach(function (r) { Cross_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : Cross_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function Cross_defineProperty(obj, key, value) { key = Cross_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function Cross_toPropertyKey(t) { var i = Cross_toPrimitive(t, "string"); return "symbol" == Cross_typeof(i) ? i : i + ""; } function Cross_toPrimitive(t, r) { if ("object" != Cross_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != Cross_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; } /** * @fileOverview Cross */ var getPath = function getPath(x, y, width, height, top, left) { return "M".concat(x, ",").concat(top, "v").concat(height, "M").concat(left, ",").concat(y, "h").concat(width); }; var Cross = function Cross(_ref) { var _ref$x = _ref.x, x = _ref$x === void 0 ? 0 : _ref$x, _ref$y = _ref.y, y = _ref$y === void 0 ? 0 : _ref$y, _ref$top = _ref.top, top = _ref$top === void 0 ? 0 : _ref$top, _ref$left = _ref.left, left = _ref$left === void 0 ? 0 : _ref$left, _ref$width = _ref.width, width = _ref$width === void 0 ? 0 : _ref$width, _ref$height = _ref.height, height = _ref$height === void 0 ? 0 : _ref$height, className = _ref.className, rest = _objectWithoutProperties(_ref, _excluded); var props = Cross_objectSpread({ x: x, y: y, top: top, left: left, width: width, height: height }, rest); if (!(0,DataUtils/* isNumber */.Et)(x) || !(0,DataUtils/* isNumber */.Et)(y) || !(0,DataUtils/* isNumber */.Et)(width) || !(0,DataUtils/* isNumber */.Et)(height) || !(0,DataUtils/* isNumber */.Et)(top) || !(0,DataUtils/* isNumber */.Et)(left)) { return null; } return /*#__PURE__*/react.createElement("path", Cross_extends({}, (0,ReactUtils/* filterProps */.J9)(props, true), { className: (0,clsx/* default */.A)('recharts-cross', className), d: getPath(x, y, width, height, top, left) })); }; ;// ./node_modules/recharts/es6/util/cursor/getCursorRectangle.js function getCursorRectangle(layout, activeCoordinate, offset, tooltipAxisBandSize) { var halfSize = tooltipAxisBandSize / 2; return { stroke: 'none', fill: '#ccc', x: layout === 'horizontal' ? activeCoordinate.x - halfSize : offset.left + 0.5, y: layout === 'horizontal' ? offset.top + 0.5 : activeCoordinate.y - halfSize, width: layout === 'horizontal' ? tooltipAxisBandSize : offset.width - 1, height: layout === 'horizontal' ? offset.height - 1 : tooltipAxisBandSize }; } ;// ./node_modules/recharts/es6/util/cursor/getRadialCursorPoints.js /** * Only applicable for radial layouts * @param {Object} activeCoordinate ChartCoordinate * @returns {Object} RadialCursorPoints */ function getRadialCursorPoints(activeCoordinate) { var cx = activeCoordinate.cx, cy = activeCoordinate.cy, radius = activeCoordinate.radius, startAngle = activeCoordinate.startAngle, endAngle = activeCoordinate.endAngle; var startPoint = (0,PolarUtils/* polarToCartesian */.IZ)(cx, cy, radius, startAngle); var endPoint = (0,PolarUtils/* polarToCartesian */.IZ)(cx, cy, radius, endAngle); return { points: [startPoint, endPoint], cx: cx, cy: cy, radius: radius, startAngle: startAngle, endAngle: endAngle }; } // EXTERNAL MODULE: ./node_modules/recharts/es6/shape/Sector.js var Sector = __webpack_require__(8522); ;// ./node_modules/recharts/es6/util/cursor/getCursorPoints.js function getCursorPoints(layout, activeCoordinate, offset) { var x1, y1, x2, y2; if (layout === 'horizontal') { x1 = activeCoordinate.x; x2 = x1; y1 = offset.top; y2 = offset.top + offset.height; } else if (layout === 'vertical') { y1 = activeCoordinate.y; y2 = y1; x1 = offset.left; x2 = offset.left + offset.width; } else if (activeCoordinate.cx != null && activeCoordinate.cy != null) { if (layout === 'centric') { var cx = activeCoordinate.cx, cy = activeCoordinate.cy, innerRadius = activeCoordinate.innerRadius, outerRadius = activeCoordinate.outerRadius, angle = activeCoordinate.angle; var innerPoint = (0,PolarUtils/* polarToCartesian */.IZ)(cx, cy, innerRadius, angle); var outerPoint = (0,PolarUtils/* polarToCartesian */.IZ)(cx, cy, outerRadius, angle); x1 = innerPoint.x; y1 = innerPoint.y; x2 = outerPoint.x; y2 = outerPoint.y; } else { return getRadialCursorPoints(activeCoordinate); } } return [{ x: x1, y: y1 }, { x: x2, y: y2 }]; } ;// ./node_modules/recharts/es6/component/Cursor.js function Cursor_typeof(o) { "@babel/helpers - typeof"; return Cursor_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, Cursor_typeof(o); } function Cursor_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function Cursor_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? Cursor_ownKeys(Object(t), !0).forEach(function (r) { Cursor_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : Cursor_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function Cursor_defineProperty(obj, key, value) { key = Cursor_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function Cursor_toPropertyKey(t) { var i = Cursor_toPrimitive(t, "string"); return "symbol" == Cursor_typeof(i) ? i : i + ""; } function Cursor_toPrimitive(t, r) { if ("object" != Cursor_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != Cursor_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* * Cursor is the background, or a highlight, * that shows when user mouses over or activates * an area. * * It usually shows together with a tooltip * to emphasise which part of the chart does the tooltip refer to. */ function Cursor(props) { var _element$props$cursor, _defaultProps; var element = props.element, tooltipEventType = props.tooltipEventType, isActive = props.isActive, activeCoordinate = props.activeCoordinate, activePayload = props.activePayload, offset = props.offset, activeTooltipIndex = props.activeTooltipIndex, tooltipAxisBandSize = props.tooltipAxisBandSize, layout = props.layout, chartName = props.chartName; var elementPropsCursor = (_element$props$cursor = element.props.cursor) !== null && _element$props$cursor !== void 0 ? _element$props$cursor : (_defaultProps = element.type.defaultProps) === null || _defaultProps === void 0 ? void 0 : _defaultProps.cursor; if (!element || !elementPropsCursor || !isActive || !activeCoordinate || chartName !== 'ScatterChart' && tooltipEventType !== 'axis') { return null; } var restProps; var cursorComp = Curve/* Curve */.I; if (chartName === 'ScatterChart') { restProps = activeCoordinate; cursorComp = Cross; } else if (chartName === 'BarChart') { restProps = getCursorRectangle(layout, activeCoordinate, offset, tooltipAxisBandSize); cursorComp = Rectangle/* Rectangle */.M; } else if (layout === 'radial') { var _getRadialCursorPoint = getRadialCursorPoints(activeCoordinate), cx = _getRadialCursorPoint.cx, cy = _getRadialCursorPoint.cy, radius = _getRadialCursorPoint.radius, startAngle = _getRadialCursorPoint.startAngle, endAngle = _getRadialCursorPoint.endAngle; restProps = { cx: cx, cy: cy, startAngle: startAngle, endAngle: endAngle, innerRadius: radius, outerRadius: radius }; cursorComp = Sector/* Sector */.h; } else { restProps = { points: getCursorPoints(layout, activeCoordinate, offset) }; cursorComp = Curve/* Curve */.I; } var cursorProps = Cursor_objectSpread(Cursor_objectSpread(Cursor_objectSpread(Cursor_objectSpread({ stroke: '#ccc', pointerEvents: 'none' }, offset), restProps), (0,ReactUtils/* filterProps */.J9)(elementPropsCursor, false)), {}, { payload: activePayload, payloadIndex: activeTooltipIndex, className: (0,clsx/* default */.A)('recharts-tooltip-cursor', elementPropsCursor.className) }); return /*#__PURE__*/(0,react.isValidElement)(elementPropsCursor) ? /*#__PURE__*/(0,react.cloneElement)(elementPropsCursor, cursorProps) : /*#__PURE__*/(0,react.createElement)(cursorComp, cursorProps); } ;// ./node_modules/recharts/es6/chart/generateCategoricalChart.js var generateCategoricalChart_excluded = ["item"], _excluded2 = ["children", "className", "width", "height", "style", "compact", "title", "desc"]; function generateCategoricalChart_typeof(o) { "@babel/helpers - typeof"; return generateCategoricalChart_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, generateCategoricalChart_typeof(o); } function generateCategoricalChart_extends() { generateCategoricalChart_extends = Object.assign ? Object.assign.bind() : 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; }; return generateCategoricalChart_extends.apply(this, arguments); } function generateCategoricalChart_slicedToArray(arr, i) { return generateCategoricalChart_arrayWithHoles(arr) || generateCategoricalChart_iterableToArrayLimit(arr, i) || generateCategoricalChart_unsupportedIterableToArray(arr, i) || generateCategoricalChart_nonIterableRest(); } function generateCategoricalChart_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function generateCategoricalChart_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } function generateCategoricalChart_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function generateCategoricalChart_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = generateCategoricalChart_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function generateCategoricalChart_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; } function generateCategoricalChart_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function generateCategoricalChart_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, generateCategoricalChart_toPropertyKey(descriptor.key), descriptor); } } function generateCategoricalChart_createClass(Constructor, protoProps, staticProps) { if (protoProps) generateCategoricalChart_defineProperties(Constructor.prototype, protoProps); if (staticProps) generateCategoricalChart_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function generateCategoricalChart_callSuper(t, o, e) { return o = generateCategoricalChart_getPrototypeOf(o), generateCategoricalChart_possibleConstructorReturn(t, generateCategoricalChart_isNativeReflectConstruct() ? Reflect.construct(o, e || [], generateCategoricalChart_getPrototypeOf(t).constructor) : o.apply(t, e)); } function generateCategoricalChart_possibleConstructorReturn(self, call) { if (call && (generateCategoricalChart_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return generateCategoricalChart_assertThisInitialized(self); } function generateCategoricalChart_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function generateCategoricalChart_isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (generateCategoricalChart_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } function generateCategoricalChart_getPrototypeOf(o) { generateCategoricalChart_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return generateCategoricalChart_getPrototypeOf(o); } function generateCategoricalChart_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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) generateCategoricalChart_setPrototypeOf(subClass, superClass); } function generateCategoricalChart_setPrototypeOf(o, p) { generateCategoricalChart_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return generateCategoricalChart_setPrototypeOf(o, p); } function generateCategoricalChart_toConsumableArray(arr) { return generateCategoricalChart_arrayWithoutHoles(arr) || generateCategoricalChart_iterableToArray(arr) || generateCategoricalChart_unsupportedIterableToArray(arr) || generateCategoricalChart_nonIterableSpread(); } function generateCategoricalChart_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function generateCategoricalChart_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return generateCategoricalChart_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return generateCategoricalChart_arrayLikeToArray(o, minLen); } function generateCategoricalChart_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function generateCategoricalChart_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return generateCategoricalChart_arrayLikeToArray(arr); } function generateCategoricalChart_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function generateCategoricalChart_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function generateCategoricalChart_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? generateCategoricalChart_ownKeys(Object(t), !0).forEach(function (r) { generateCategoricalChart_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : generateCategoricalChart_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function generateCategoricalChart_defineProperty(obj, key, value) { key = generateCategoricalChart_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function generateCategoricalChart_toPropertyKey(t) { var i = generateCategoricalChart_toPrimitive(t, "string"); return "symbol" == generateCategoricalChart_typeof(i) ? i : i + ""; } function generateCategoricalChart_toPrimitive(t, r) { if ("object" != generateCategoricalChart_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != generateCategoricalChart_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } // eslint-disable-next-line no-restricted-imports var ORIENT_MAP = { xAxis: ['bottom', 'top'], yAxis: ['left', 'right'] }; var FULL_WIDTH_AND_HEIGHT = { width: '100%', height: '100%' }; var originCoordinate = { x: 0, y: 0 }; /** * This function exists as a temporary workaround. * * Why? generateCategoricalChart does not render `{children}` directly; * instead it passes them through `renderByOrder` function which reads their handlers. * * So, this is a handler that does nothing. * Once we get rid of `renderByOrder` and switch to JSX only, we can get rid of this handler too. * * @param {JSX} element as is in JSX * @returns {JSX} the same element */ function renderAsIs(element) { return element; } var calculateTooltipPos = function calculateTooltipPos(rangeObj, layout) { if (layout === 'horizontal') { return rangeObj.x; } if (layout === 'vertical') { return rangeObj.y; } if (layout === 'centric') { return rangeObj.angle; } return rangeObj.radius; }; var getActiveCoordinate = function getActiveCoordinate(layout, tooltipTicks, activeIndex, rangeObj) { var entry = tooltipTicks.find(function (tick) { return tick && tick.index === activeIndex; }); if (entry) { if (layout === 'horizontal') { return { x: entry.coordinate, y: rangeObj.y }; } if (layout === 'vertical') { return { x: rangeObj.x, y: entry.coordinate }; } if (layout === 'centric') { var _angle = entry.coordinate; var _radius = rangeObj.radius; return generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, rangeObj), (0,PolarUtils/* polarToCartesian */.IZ)(rangeObj.cx, rangeObj.cy, _radius, _angle)), {}, { angle: _angle, radius: _radius }); } var radius = entry.coordinate; var angle = rangeObj.angle; return generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, rangeObj), (0,PolarUtils/* polarToCartesian */.IZ)(rangeObj.cx, rangeObj.cy, radius, angle)), {}, { angle: angle, radius: radius }); } return originCoordinate; }; var getDisplayedData = function getDisplayedData(data, _ref) { var graphicalItems = _ref.graphicalItems, dataStartIndex = _ref.dataStartIndex, dataEndIndex = _ref.dataEndIndex; var itemsData = (graphicalItems !== null && graphicalItems !== void 0 ? graphicalItems : []).reduce(function (result, child) { var itemData = child.props.data; if (itemData && itemData.length) { return [].concat(generateCategoricalChart_toConsumableArray(result), generateCategoricalChart_toConsumableArray(itemData)); } return result; }, []); if (itemsData.length > 0) { return itemsData; } if (data && data.length && (0,DataUtils/* isNumber */.Et)(dataStartIndex) && (0,DataUtils/* isNumber */.Et)(dataEndIndex)) { return data.slice(dataStartIndex, dataEndIndex + 1); } return []; }; function getDefaultDomainByAxisType(axisType) { return axisType === 'number' ? [0, 'auto'] : undefined; } /** * Get the content to be displayed in the tooltip * @param {Object} state Current state * @param {Array} chartData The data defined in chart * @param {Number} activeIndex Active index of data * @param {String} activeLabel Active label of data * @return {Array} The content of tooltip */ var getTooltipContent = function getTooltipContent(state, chartData, activeIndex, activeLabel) { var graphicalItems = state.graphicalItems, tooltipAxis = state.tooltipAxis; var displayedData = getDisplayedData(chartData, state); if (activeIndex < 0 || !graphicalItems || !graphicalItems.length || activeIndex >= displayedData.length) { return null; } // get data by activeIndex when the axis don't allow duplicated category return graphicalItems.reduce(function (result, child) { var _child$props$data; /** * Fixes: https://github.com/recharts/recharts/issues/3669 * Defaulting to chartData below to fix an edge case where the tooltip does not include data from all charts * when a separate dataset is passed to chart prop data and specified on Line/Area/etc prop data */ var data = (_child$props$data = child.props.data) !== null && _child$props$data !== void 0 ? _child$props$data : chartData; if (data && state.dataStartIndex + state.dataEndIndex !== 0 && // https://github.com/recharts/recharts/issues/4717 // The data is sliced only when the active index is within the start/end index range. state.dataEndIndex - state.dataStartIndex >= activeIndex) { data = data.slice(state.dataStartIndex, state.dataEndIndex + 1); } var payload; if (tooltipAxis.dataKey && !tooltipAxis.allowDuplicatedCategory) { // graphic child has data props var entries = data === undefined ? displayedData : data; payload = (0,DataUtils/* findEntryInArray */.eP)(entries, tooltipAxis.dataKey, activeLabel); } else { payload = data && data[activeIndex] || displayedData[activeIndex]; } if (!payload) { return result; } return [].concat(generateCategoricalChart_toConsumableArray(result), [(0,ChartUtils/* getTooltipItem */.zb)(child, payload)]); }, []); }; /** * Returns tooltip data based on a mouse position (as a parameter or in state) * @param {Object} state current state * @param {Array} chartData the data defined in chart * @param {String} layout The layout type of chart * @param {Object} rangeObj { x, y } coordinates * @return {Object} Tooltip data data */ var getTooltipData = function getTooltipData(state, chartData, layout, rangeObj) { var rangeData = rangeObj || { x: state.chartX, y: state.chartY }; var pos = calculateTooltipPos(rangeData, layout); var ticks = state.orderedTooltipTicks, axis = state.tooltipAxis, tooltipTicks = state.tooltipTicks; var activeIndex = (0,ChartUtils/* calculateActiveTickIndex */.gH)(pos, ticks, tooltipTicks, axis); if (activeIndex >= 0 && tooltipTicks) { var activeLabel = tooltipTicks[activeIndex] && tooltipTicks[activeIndex].value; var activePayload = getTooltipContent(state, chartData, activeIndex, activeLabel); var activeCoordinate = getActiveCoordinate(layout, ticks, activeIndex, rangeData); return { activeTooltipIndex: activeIndex, activeLabel: activeLabel, activePayload: activePayload, activeCoordinate: activeCoordinate }; } return null; }; /** * Get the configuration of axis by the options of axis instance * @param {Object} props Latest props * @param {Array} axes The instance of axes * @param {Array} graphicalItems The instances of item * @param {String} axisType The type of axis, xAxis - x-axis, yAxis - y-axis * @param {String} axisIdKey The unique id of an axis * @param {Object} stackGroups The items grouped by axisId and stackId * @param {Number} dataStartIndex The start index of the data series when a brush is applied * @param {Number} dataEndIndex The end index of the data series when a brush is applied * @return {Object} Configuration */ var getAxisMapByAxes = function getAxisMapByAxes(props, _ref2) { var axes = _ref2.axes, graphicalItems = _ref2.graphicalItems, axisType = _ref2.axisType, axisIdKey = _ref2.axisIdKey, stackGroups = _ref2.stackGroups, dataStartIndex = _ref2.dataStartIndex, dataEndIndex = _ref2.dataEndIndex; var layout = props.layout, children = props.children, stackOffset = props.stackOffset; var isCategorical = (0,ChartUtils/* isCategoricalAxis */._L)(layout, axisType); // Eliminate duplicated axes return axes.reduce(function (result, child) { var _childProps$domain2; var childProps = child.type.defaultProps !== undefined ? generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, child.type.defaultProps), child.props) : child.props; var type = childProps.type, dataKey = childProps.dataKey, allowDataOverflow = childProps.allowDataOverflow, allowDuplicatedCategory = childProps.allowDuplicatedCategory, scale = childProps.scale, ticks = childProps.ticks, includeHidden = childProps.includeHidden; var axisId = childProps[axisIdKey]; if (result[axisId]) { return result; } var displayedData = getDisplayedData(props.data, { graphicalItems: graphicalItems.filter(function (item) { var _defaultProps; var itemAxisId = axisIdKey in item.props ? item.props[axisIdKey] : (_defaultProps = item.type.defaultProps) === null || _defaultProps === void 0 ? void 0 : _defaultProps[axisIdKey]; return itemAxisId === axisId; }), dataStartIndex: dataStartIndex, dataEndIndex: dataEndIndex }); var len = displayedData.length; var domain, duplicateDomain, categoricalDomain; /* * This is a hack to short-circuit the domain creation here to enhance performance. * Usually, the data is used to determine the domain, but when the user specifies * a domain upfront (via props), there is no need to calculate the domain start and end, * which is very expensive for a larger amount of data. * The only thing that would prohibit short-circuiting is when the user doesn't allow data overflow, * because the axis is supposed to ignore the specified domain that way. */ if (isDomainSpecifiedByUser(childProps.domain, allowDataOverflow, type)) { domain = (0,ChartUtils/* parseSpecifiedDomain */.AQ)(childProps.domain, null, allowDataOverflow); /* The chart can be categorical and have the domain specified in numbers * we still need to calculate the categorical domain * TODO: refactor this more */ if (isCategorical && (type === 'number' || scale !== 'auto')) { categoricalDomain = (0,ChartUtils/* getDomainOfDataByKey */.Ay)(displayedData, dataKey, 'category'); } } // if the domain is defaulted we need this for `originalDomain` as well var defaultDomain = getDefaultDomainByAxisType(type); // we didn't create the domain from user's props above, so we need to calculate it if (!domain || domain.length === 0) { var _childProps$domain; var childDomain = (_childProps$domain = childProps.domain) !== null && _childProps$domain !== void 0 ? _childProps$domain : defaultDomain; if (dataKey) { // has dataKey in domain = (0,ChartUtils/* getDomainOfDataByKey */.Ay)(displayedData, dataKey, type); if (type === 'category' && isCategorical) { // the field type is category data and this axis is categorical axis var duplicate = (0,DataUtils/* hasDuplicate */.CG)(domain); if (allowDuplicatedCategory && duplicate) { duplicateDomain = domain; // When category axis has duplicated text, serial numbers are used to generate scale domain = range_default()(0, len); } else if (!allowDuplicatedCategory) { // remove duplicated category domain = (0,ChartUtils/* parseDomainOfCategoryAxis */.KC)(childDomain, domain, child).reduce(function (finalDomain, entry) { return finalDomain.indexOf(entry) >= 0 ? finalDomain : [].concat(generateCategoricalChart_toConsumableArray(finalDomain), [entry]); }, []); } } else if (type === 'category') { // the field type is category data and this axis is numerical axis if (!allowDuplicatedCategory) { domain = (0,ChartUtils/* parseDomainOfCategoryAxis */.KC)(childDomain, domain, child).reduce(function (finalDomain, entry) { return finalDomain.indexOf(entry) >= 0 || entry === '' || isNil_default()(entry) ? finalDomain : [].concat(generateCategoricalChart_toConsumableArray(finalDomain), [entry]); }, []); } else { // eliminate undefined or null or empty string domain = domain.filter(function (entry) { return entry !== '' && !isNil_default()(entry); }); } } else if (type === 'number') { // the field type is numerical var errorBarsDomain = (0,ChartUtils/* parseErrorBarsOfAxis */.A1)(displayedData, graphicalItems.filter(function (item) { var _defaultProps2, _defaultProps3; var itemAxisId = axisIdKey in item.props ? item.props[axisIdKey] : (_defaultProps2 = item.type.defaultProps) === null || _defaultProps2 === void 0 ? void 0 : _defaultProps2[axisIdKey]; var itemHide = 'hide' in item.props ? item.props.hide : (_defaultProps3 = item.type.defaultProps) === null || _defaultProps3 === void 0 ? void 0 : _defaultProps3.hide; return itemAxisId === axisId && (includeHidden || !itemHide); }), dataKey, axisType, layout); if (errorBarsDomain) { domain = errorBarsDomain; } } if (isCategorical && (type === 'number' || scale !== 'auto')) { categoricalDomain = (0,ChartUtils/* getDomainOfDataByKey */.Ay)(displayedData, dataKey, 'category'); } } else if (isCategorical) { // the axis is a categorical axis domain = range_default()(0, len); } else if (stackGroups && stackGroups[axisId] && stackGroups[axisId].hasStack && type === 'number') { // when stackOffset is 'expand', the domain may be calculated as [0, 1.000000000002] domain = stackOffset === 'expand' ? [0, 1] : (0,ChartUtils/* getDomainOfStackGroups */.Mk)(stackGroups[axisId].stackGroups, dataStartIndex, dataEndIndex); } else { domain = (0,ChartUtils/* getDomainOfItemsWithSameAxis */.vf)(displayedData, graphicalItems.filter(function (item) { var itemAxisId = axisIdKey in item.props ? item.props[axisIdKey] : item.type.defaultProps[axisIdKey]; var itemHide = 'hide' in item.props ? item.props.hide : item.type.defaultProps.hide; return itemAxisId === axisId && (includeHidden || !itemHide); }), type, layout, true); } if (type === 'number') { // To detect wether there is any reference lines whose props alwaysShow is true domain = detectReferenceElementsDomain(children, domain, axisId, axisType, ticks); if (childDomain) { domain = (0,ChartUtils/* parseSpecifiedDomain */.AQ)(childDomain, domain, allowDataOverflow); } } else if (type === 'category' && childDomain) { var axisDomain = childDomain; var isDomainValid = domain.every(function (entry) { return axisDomain.indexOf(entry) >= 0; }); if (isDomainValid) { domain = axisDomain; } } } return generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, result), {}, generateCategoricalChart_defineProperty({}, axisId, generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, childProps), {}, { axisType: axisType, domain: domain, categoricalDomain: categoricalDomain, duplicateDomain: duplicateDomain, originalDomain: (_childProps$domain2 = childProps.domain) !== null && _childProps$domain2 !== void 0 ? _childProps$domain2 : defaultDomain, isCategorical: isCategorical, layout: layout }))); }, {}); }; /** * Get the configuration of axis by the options of item, * this kind of axis does not display in chart * @param {Object} props Latest props * @param {Array} graphicalItems The instances of item * @param {ReactElement} Axis Axis Component * @param {String} axisType The type of axis, xAxis - x-axis, yAxis - y-axis * @param {String} axisIdKey The unique id of an axis * @param {Object} stackGroups The items grouped by axisId and stackId * @param {Number} dataStartIndex The start index of the data series when a brush is applied * @param {Number} dataEndIndex The end index of the data series when a brush is applied * @return {Object} Configuration */ var getAxisMapByItems = function getAxisMapByItems(props, _ref3) { var graphicalItems = _ref3.graphicalItems, Axis = _ref3.Axis, axisType = _ref3.axisType, axisIdKey = _ref3.axisIdKey, stackGroups = _ref3.stackGroups, dataStartIndex = _ref3.dataStartIndex, dataEndIndex = _ref3.dataEndIndex; var layout = props.layout, children = props.children; var displayedData = getDisplayedData(props.data, { graphicalItems: graphicalItems, dataStartIndex: dataStartIndex, dataEndIndex: dataEndIndex }); var len = displayedData.length; var isCategorical = (0,ChartUtils/* isCategoricalAxis */._L)(layout, axisType); var index = -1; // The default type of x-axis is category axis, // The default contents of x-axis is the serial numbers of data // The default type of y-axis is number axis // The default contents of y-axis is the domain of data return graphicalItems.reduce(function (result, child) { var childProps = child.type.defaultProps !== undefined ? generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, child.type.defaultProps), child.props) : child.props; var axisId = childProps[axisIdKey]; var originalDomain = getDefaultDomainByAxisType('number'); if (!result[axisId]) { index++; var domain; if (isCategorical) { domain = range_default()(0, len); } else if (stackGroups && stackGroups[axisId] && stackGroups[axisId].hasStack) { domain = (0,ChartUtils/* getDomainOfStackGroups */.Mk)(stackGroups[axisId].stackGroups, dataStartIndex, dataEndIndex); domain = detectReferenceElementsDomain(children, domain, axisId, axisType); } else { domain = (0,ChartUtils/* parseSpecifiedDomain */.AQ)(originalDomain, (0,ChartUtils/* getDomainOfItemsWithSameAxis */.vf)(displayedData, graphicalItems.filter(function (item) { var _defaultProps4, _defaultProps5; var itemAxisId = axisIdKey in item.props ? item.props[axisIdKey] : (_defaultProps4 = item.type.defaultProps) === null || _defaultProps4 === void 0 ? void 0 : _defaultProps4[axisIdKey]; var itemHide = 'hide' in item.props ? item.props.hide : (_defaultProps5 = item.type.defaultProps) === null || _defaultProps5 === void 0 ? void 0 : _defaultProps5.hide; return itemAxisId === axisId && !itemHide; }), 'number', layout), Axis.defaultProps.allowDataOverflow); domain = detectReferenceElementsDomain(children, domain, axisId, axisType); } return generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, result), {}, generateCategoricalChart_defineProperty({}, axisId, generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({ axisType: axisType }, Axis.defaultProps), {}, { hide: true, orientation: get_default()(ORIENT_MAP, "".concat(axisType, ".").concat(index % 2), null), domain: domain, originalDomain: originalDomain, isCategorical: isCategorical, layout: layout // specify scale when no Axis // scale: isCategorical ? 'band' : 'linear', }))); } return result; }, {}); }; /** * Get the configuration of all x-axis or y-axis * @param {Object} props Latest props * @param {String} axisType The type of axis * @param {React.ComponentType} [AxisComp] Axis Component * @param {Array} graphicalItems The instances of item * @param {Object} stackGroups The items grouped by axisId and stackId * @param {Number} dataStartIndex The start index of the data series when a brush is applied * @param {Number} dataEndIndex The end index of the data series when a brush is applied * @return {Object} Configuration */ var getAxisMap = function getAxisMap(props, _ref4) { var _ref4$axisType = _ref4.axisType, axisType = _ref4$axisType === void 0 ? 'xAxis' : _ref4$axisType, AxisComp = _ref4.AxisComp, graphicalItems = _ref4.graphicalItems, stackGroups = _ref4.stackGroups, dataStartIndex = _ref4.dataStartIndex, dataEndIndex = _ref4.dataEndIndex; var children = props.children; var axisIdKey = "".concat(axisType, "Id"); // Get all the instance of Axis var axes = (0,ReactUtils/* findAllByType */.aS)(children, AxisComp); var axisMap = {}; if (axes && axes.length) { axisMap = getAxisMapByAxes(props, { axes: axes, graphicalItems: graphicalItems, axisType: axisType, axisIdKey: axisIdKey, stackGroups: stackGroups, dataStartIndex: dataStartIndex, dataEndIndex: dataEndIndex }); } else if (graphicalItems && graphicalItems.length) { axisMap = getAxisMapByItems(props, { Axis: AxisComp, graphicalItems: graphicalItems, axisType: axisType, axisIdKey: axisIdKey, stackGroups: stackGroups, dataStartIndex: dataStartIndex, dataEndIndex: dataEndIndex }); } return axisMap; }; var tooltipTicksGenerator = function tooltipTicksGenerator(axisMap) { var axis = (0,DataUtils/* getAnyElementOfObject */.lX)(axisMap); var tooltipTicks = (0,ChartUtils/* getTicksOfAxis */.Rh)(axis, false, true); return { tooltipTicks: tooltipTicks, orderedTooltipTicks: sortBy_default()(tooltipTicks, function (o) { return o.coordinate; }), tooltipAxis: axis, tooltipAxisBandSize: (0,ChartUtils/* getBandSizeOfAxis */.Hj)(axis, tooltipTicks) }; }; /** * Returns default, reset state for the categorical chart. * @param {Object} props Props object to use when creating the default state * @return {Object} Whole new state */ var createDefaultState = function createDefaultState(props) { var children = props.children, defaultShowTooltip = props.defaultShowTooltip; var brushItem = (0,ReactUtils/* findChildByType */.BU)(children, Brush); var startIndex = 0; var endIndex = 0; if (props.data && props.data.length !== 0) { endIndex = props.data.length - 1; } if (brushItem && brushItem.props) { if (brushItem.props.startIndex >= 0) { startIndex = brushItem.props.startIndex; } if (brushItem.props.endIndex >= 0) { endIndex = brushItem.props.endIndex; } } return { chartX: 0, chartY: 0, dataStartIndex: startIndex, dataEndIndex: endIndex, activeTooltipIndex: -1, isTooltipActive: Boolean(defaultShowTooltip) }; }; var hasGraphicalBarItem = function hasGraphicalBarItem(graphicalItems) { if (!graphicalItems || !graphicalItems.length) { return false; } return graphicalItems.some(function (item) { var name = (0,ReactUtils/* getDisplayName */.Mn)(item && item.type); return name && name.indexOf('Bar') >= 0; }); }; var getAxisNameByLayout = function getAxisNameByLayout(layout) { if (layout === 'horizontal') { return { numericAxisName: 'yAxis', cateAxisName: 'xAxis' }; } if (layout === 'vertical') { return { numericAxisName: 'xAxis', cateAxisName: 'yAxis' }; } if (layout === 'centric') { return { numericAxisName: 'radiusAxis', cateAxisName: 'angleAxis' }; } return { numericAxisName: 'angleAxis', cateAxisName: 'radiusAxis' }; }; /** * Calculate the offset of main part in the svg element * @param {Object} params.props Latest props * @param {Array} params.graphicalItems The instances of item * @param {Object} params.xAxisMap The configuration of x-axis * @param {Object} params.yAxisMap The configuration of y-axis * @param {Object} prevLegendBBox The boundary box of legend * @return {Object} The offset of main part in the svg element */ var calculateOffset = function calculateOffset(_ref5, prevLegendBBox) { var props = _ref5.props, graphicalItems = _ref5.graphicalItems, _ref5$xAxisMap = _ref5.xAxisMap, xAxisMap = _ref5$xAxisMap === void 0 ? {} : _ref5$xAxisMap, _ref5$yAxisMap = _ref5.yAxisMap, yAxisMap = _ref5$yAxisMap === void 0 ? {} : _ref5$yAxisMap; var width = props.width, height = props.height, children = props.children; var margin = props.margin || {}; var brushItem = (0,ReactUtils/* findChildByType */.BU)(children, Brush); var legendItem = (0,ReactUtils/* findChildByType */.BU)(children, Legend/* Legend */.s); var offsetH = Object.keys(yAxisMap).reduce(function (result, id) { var entry = yAxisMap[id]; var orientation = entry.orientation; if (!entry.mirror && !entry.hide) { return generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, result), {}, generateCategoricalChart_defineProperty({}, orientation, result[orientation] + entry.width)); } return result; }, { left: margin.left || 0, right: margin.right || 0 }); var offsetV = Object.keys(xAxisMap).reduce(function (result, id) { var entry = xAxisMap[id]; var orientation = entry.orientation; if (!entry.mirror && !entry.hide) { return generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, result), {}, generateCategoricalChart_defineProperty({}, orientation, get_default()(result, "".concat(orientation)) + entry.height)); } return result; }, { top: margin.top || 0, bottom: margin.bottom || 0 }); var offset = generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, offsetV), offsetH); var brushBottom = offset.bottom; if (brushItem) { offset.bottom += brushItem.props.height || Brush.defaultProps.height; } if (legendItem && prevLegendBBox) { // @ts-expect-error margin is optional in props but required in appendOffsetOfLegend offset = (0,ChartUtils/* appendOffsetOfLegend */.s0)(offset, graphicalItems, props, prevLegendBBox); } var offsetWidth = width - offset.left - offset.right; var offsetHeight = height - offset.top - offset.bottom; return generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({ brushBottom: brushBottom }, offset), {}, { // never return negative values for height and width width: Math.max(offsetWidth, 0), height: Math.max(offsetHeight, 0) }); }; // Determine the size of the axis, used for calculation of relative bar sizes var getCartesianAxisSize = function getCartesianAxisSize(axisObj, axisName) { if (axisName === 'xAxis') { return axisObj[axisName].width; } if (axisName === 'yAxis') { return axisObj[axisName].height; } // This is only supported for Bar charts (i.e. charts with cartesian axes), so we should never get here return undefined; }; var generateCategoricalChart = function generateCategoricalChart(_ref6) { var chartName = _ref6.chartName, GraphicalChild = _ref6.GraphicalChild, _ref6$defaultTooltipE = _ref6.defaultTooltipEventType, defaultTooltipEventType = _ref6$defaultTooltipE === void 0 ? 'axis' : _ref6$defaultTooltipE, _ref6$validateTooltip = _ref6.validateTooltipEventTypes, validateTooltipEventTypes = _ref6$validateTooltip === void 0 ? ['axis'] : _ref6$validateTooltip, axisComponents = _ref6.axisComponents, legendContent = _ref6.legendContent, formatAxisMap = _ref6.formatAxisMap, defaultProps = _ref6.defaultProps; var getFormatItems = function getFormatItems(props, currentState) { var graphicalItems = currentState.graphicalItems, stackGroups = currentState.stackGroups, offset = currentState.offset, updateId = currentState.updateId, dataStartIndex = currentState.dataStartIndex, dataEndIndex = currentState.dataEndIndex; var barSize = props.barSize, layout = props.layout, barGap = props.barGap, barCategoryGap = props.barCategoryGap, globalMaxBarSize = props.maxBarSize; var _getAxisNameByLayout = getAxisNameByLayout(layout), numericAxisName = _getAxisNameByLayout.numericAxisName, cateAxisName = _getAxisNameByLayout.cateAxisName; var hasBar = hasGraphicalBarItem(graphicalItems); var formattedItems = []; graphicalItems.forEach(function (item, index) { var displayedData = getDisplayedData(props.data, { graphicalItems: [item], dataStartIndex: dataStartIndex, dataEndIndex: dataEndIndex }); var itemProps = item.type.defaultProps !== undefined ? generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, item.type.defaultProps), item.props) : item.props; var dataKey = itemProps.dataKey, childMaxBarSize = itemProps.maxBarSize; // axisId of the numerical axis var numericAxisId = itemProps["".concat(numericAxisName, "Id")]; // axisId of the categorical axis var cateAxisId = itemProps["".concat(cateAxisName, "Id")]; var axisObjInitialValue = {}; var axisObj = axisComponents.reduce(function (result, entry) { var _item$type$displayNam, _item$type; // map of axisId to axis for a specific axis type var axisMap = currentState["".concat(entry.axisType, "Map")]; // axisId of axis we are currently computing var id = itemProps["".concat(entry.axisType, "Id")]; /** * tell the user in dev mode that their configuration is incorrect if we cannot find a match between * axisId on the chart and axisId on the axis. zAxis does not get passed in the map for ComposedChart, * leave it out of the check for now. */ !(axisMap && axisMap[id] || entry.axisType === 'zAxis') ? false ? 0 : (0,tiny_invariant/* default */.A)(false) : void 0; // the axis we are currently formatting var axis = axisMap[id]; return generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, result), {}, generateCategoricalChart_defineProperty(generateCategoricalChart_defineProperty({}, entry.axisType, axis), "".concat(entry.axisType, "Ticks"), (0,ChartUtils/* getTicksOfAxis */.Rh)(axis))); }, axisObjInitialValue); var cateAxis = axisObj[cateAxisName]; var cateTicks = axisObj["".concat(cateAxisName, "Ticks")]; var stackedData = stackGroups && stackGroups[numericAxisId] && stackGroups[numericAxisId].hasStack && (0,ChartUtils/* getStackedDataOfItem */.kA)(item, stackGroups[numericAxisId].stackGroups); var itemIsBar = (0,ReactUtils/* getDisplayName */.Mn)(item.type).indexOf('Bar') >= 0; var bandSize = (0,ChartUtils/* getBandSizeOfAxis */.Hj)(cateAxis, cateTicks); var barPosition = []; var sizeList = hasBar && (0,ChartUtils/* getBarSizeList */.tA)({ barSize: barSize, stackGroups: stackGroups, totalSize: getCartesianAxisSize(axisObj, cateAxisName) }); if (itemIsBar) { var _ref7, _getBandSizeOfAxis; // If it is bar, calculate the position of bar var maxBarSize = isNil_default()(childMaxBarSize) ? globalMaxBarSize : childMaxBarSize; var barBandSize = (_ref7 = (_getBandSizeOfAxis = (0,ChartUtils/* getBandSizeOfAxis */.Hj)(cateAxis, cateTicks, true)) !== null && _getBandSizeOfAxis !== void 0 ? _getBandSizeOfAxis : maxBarSize) !== null && _ref7 !== void 0 ? _ref7 : 0; barPosition = (0,ChartUtils/* getBarPosition */.BX)({ barGap: barGap, barCategoryGap: barCategoryGap, bandSize: barBandSize !== bandSize ? barBandSize : bandSize, sizeList: sizeList[cateAxisId], maxBarSize: maxBarSize }); if (barBandSize !== bandSize) { barPosition = barPosition.map(function (pos) { return generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, pos), {}, { position: generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, pos.position), {}, { offset: pos.position.offset - barBandSize / 2 }) }); }); } } // @ts-expect-error we should stop reading data from ReactElements var composedFn = item && item.type && item.type.getComposedData; if (composedFn) { formattedItems.push({ props: generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, composedFn(generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, axisObj), {}, { displayedData: displayedData, props: props, dataKey: dataKey, item: item, bandSize: bandSize, barPosition: barPosition, offset: offset, stackedData: stackedData, layout: layout, dataStartIndex: dataStartIndex, dataEndIndex: dataEndIndex }))), {}, generateCategoricalChart_defineProperty(generateCategoricalChart_defineProperty(generateCategoricalChart_defineProperty({ key: item.key || "item-".concat(index) }, numericAxisName, axisObj[numericAxisName]), cateAxisName, axisObj[cateAxisName]), "animationId", updateId)), childIndex: (0,ReactUtils/* parseChildIndex */.AW)(item, props.children), item: item }); } }); return formattedItems; }; /** * The AxisMaps are expensive to render on large data sets * so provide the ability to store them in state and only update them when necessary * they are dependent upon the start and end index of * the brush so it's important that this method is called _after_ * the state is updated with any new start/end indices * * @param {Object} props The props object to be used for updating the axismaps * dataStartIndex: The start index of the data series when a brush is applied * dataEndIndex: The end index of the data series when a brush is applied * updateId: The update id * @param {Object} prevState Prev state * @return {Object} state New state to set */ var updateStateOfAxisMapsOffsetAndStackGroups = function updateStateOfAxisMapsOffsetAndStackGroups(_ref8, prevState) { var props = _ref8.props, dataStartIndex = _ref8.dataStartIndex, dataEndIndex = _ref8.dataEndIndex, updateId = _ref8.updateId; if (!(0,ReactUtils/* validateWidthHeight */.Me)({ props: props })) { return null; } var children = props.children, layout = props.layout, stackOffset = props.stackOffset, data = props.data, reverseStackOrder = props.reverseStackOrder; var _getAxisNameByLayout2 = getAxisNameByLayout(layout), numericAxisName = _getAxisNameByLayout2.numericAxisName, cateAxisName = _getAxisNameByLayout2.cateAxisName; var graphicalItems = (0,ReactUtils/* findAllByType */.aS)(children, GraphicalChild); var stackGroups = (0,ChartUtils/* getStackGroupsByAxisId */.Mn)(data, graphicalItems, "".concat(numericAxisName, "Id"), "".concat(cateAxisName, "Id"), stackOffset, reverseStackOrder); var axisObj = axisComponents.reduce(function (result, entry) { var name = "".concat(entry.axisType, "Map"); return generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, result), {}, generateCategoricalChart_defineProperty({}, name, getAxisMap(props, generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, entry), {}, { graphicalItems: graphicalItems, stackGroups: entry.axisType === numericAxisName && stackGroups, dataStartIndex: dataStartIndex, dataEndIndex: dataEndIndex })))); }, {}); var offset = calculateOffset(generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, axisObj), {}, { props: props, graphicalItems: graphicalItems }), prevState === null || prevState === void 0 ? void 0 : prevState.legendBBox); Object.keys(axisObj).forEach(function (key) { axisObj[key] = formatAxisMap(props, axisObj[key], offset, key.replace('Map', ''), chartName); }); var cateAxisMap = axisObj["".concat(cateAxisName, "Map")]; var ticksObj = tooltipTicksGenerator(cateAxisMap); var formattedGraphicalItems = getFormatItems(props, generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, axisObj), {}, { dataStartIndex: dataStartIndex, dataEndIndex: dataEndIndex, updateId: updateId, graphicalItems: graphicalItems, stackGroups: stackGroups, offset: offset })); return generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({ formattedGraphicalItems: formattedGraphicalItems, graphicalItems: graphicalItems, offset: offset, stackGroups: stackGroups }, ticksObj), axisObj); }; var CategoricalChartWrapper = /*#__PURE__*/function (_Component) { function CategoricalChartWrapper(_props) { var _props$id, _props$throttleDelay; var _this; generateCategoricalChart_classCallCheck(this, CategoricalChartWrapper); _this = generateCategoricalChart_callSuper(this, CategoricalChartWrapper, [_props]); generateCategoricalChart_defineProperty(_this, "eventEmitterSymbol", Symbol('rechartsEventEmitter')); generateCategoricalChart_defineProperty(_this, "accessibilityManager", new AccessibilityManager()); generateCategoricalChart_defineProperty(_this, "handleLegendBBoxUpdate", function (box) { if (box) { var _this$state = _this.state, dataStartIndex = _this$state.dataStartIndex, dataEndIndex = _this$state.dataEndIndex, updateId = _this$state.updateId; _this.setState(generateCategoricalChart_objectSpread({ legendBBox: box }, updateStateOfAxisMapsOffsetAndStackGroups({ props: _this.props, dataStartIndex: dataStartIndex, dataEndIndex: dataEndIndex, updateId: updateId }, generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, _this.state), {}, { legendBBox: box })))); } }); generateCategoricalChart_defineProperty(_this, "handleReceiveSyncEvent", function (cId, data, emitter) { if (_this.props.syncId === cId) { if (emitter === _this.eventEmitterSymbol && typeof _this.props.syncMethod !== 'function') { return; } _this.applySyncEvent(data); } }); generateCategoricalChart_defineProperty(_this, "handleBrushChange", function (_ref9) { var startIndex = _ref9.startIndex, endIndex = _ref9.endIndex; // Only trigger changes if the extents of the brush have actually changed if (startIndex !== _this.state.dataStartIndex || endIndex !== _this.state.dataEndIndex) { var updateId = _this.state.updateId; _this.setState(function () { return generateCategoricalChart_objectSpread({ dataStartIndex: startIndex, dataEndIndex: endIndex }, updateStateOfAxisMapsOffsetAndStackGroups({ props: _this.props, dataStartIndex: startIndex, dataEndIndex: endIndex, updateId: updateId }, _this.state)); }); _this.triggerSyncEvent({ dataStartIndex: startIndex, dataEndIndex: endIndex }); } }); /** * The handler of mouse entering chart * @param {Object} e Event object * @return {Null} null */ generateCategoricalChart_defineProperty(_this, "handleMouseEnter", function (e) { var mouse = _this.getMouseInfo(e); if (mouse) { var _nextState = generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, mouse), {}, { isTooltipActive: true }); _this.setState(_nextState); _this.triggerSyncEvent(_nextState); var onMouseEnter = _this.props.onMouseEnter; if (isFunction_default()(onMouseEnter)) { onMouseEnter(_nextState, e); } } }); generateCategoricalChart_defineProperty(_this, "triggeredAfterMouseMove", function (e) { var mouse = _this.getMouseInfo(e); var nextState = mouse ? generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, mouse), {}, { isTooltipActive: true }) : { isTooltipActive: false }; _this.setState(nextState); _this.triggerSyncEvent(nextState); var onMouseMove = _this.props.onMouseMove; if (isFunction_default()(onMouseMove)) { onMouseMove(nextState, e); } }); /** * The handler of mouse entering a scatter * @param {Object} el The active scatter * @return {Object} no return */ generateCategoricalChart_defineProperty(_this, "handleItemMouseEnter", function (el) { _this.setState(function () { return { isTooltipActive: true, activeItem: el, activePayload: el.tooltipPayload, activeCoordinate: el.tooltipPosition || { x: el.cx, y: el.cy } }; }); }); /** * The handler of mouse leaving a scatter * @return {Object} no return */ generateCategoricalChart_defineProperty(_this, "handleItemMouseLeave", function () { _this.setState(function () { return { isTooltipActive: false }; }); }); /** * The handler of mouse moving in chart * @param {React.MouseEvent} e Event object * @return {void} no return */ generateCategoricalChart_defineProperty(_this, "handleMouseMove", function (e) { e.persist(); _this.throttleTriggeredAfterMouseMove(e); }); /** * The handler if mouse leaving chart * @param {Object} e Event object * @return {Null} no return */ generateCategoricalChart_defineProperty(_this, "handleMouseLeave", function (e) { _this.throttleTriggeredAfterMouseMove.cancel(); var nextState = { isTooltipActive: false }; _this.setState(nextState); _this.triggerSyncEvent(nextState); var onMouseLeave = _this.props.onMouseLeave; if (isFunction_default()(onMouseLeave)) { onMouseLeave(nextState, e); } }); generateCategoricalChart_defineProperty(_this, "handleOuterEvent", function (e) { var eventName = (0,ReactUtils/* getReactEventByType */.X_)(e); var event = get_default()(_this.props, "".concat(eventName)); if (eventName && isFunction_default()(event)) { var _mouse; var mouse; if (/.*touch.*/i.test(eventName)) { mouse = _this.getMouseInfo(e.changedTouches[0]); } else { mouse = _this.getMouseInfo(e); } event((_mouse = mouse) !== null && _mouse !== void 0 ? _mouse : {}, e); } }); generateCategoricalChart_defineProperty(_this, "handleClick", function (e) { var mouse = _this.getMouseInfo(e); if (mouse) { var _nextState2 = generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, mouse), {}, { isTooltipActive: true }); _this.setState(_nextState2); _this.triggerSyncEvent(_nextState2); var onClick = _this.props.onClick; if (isFunction_default()(onClick)) { onClick(_nextState2, e); } } }); generateCategoricalChart_defineProperty(_this, "handleMouseDown", function (e) { var onMouseDown = _this.props.onMouseDown; if (isFunction_default()(onMouseDown)) { var _nextState3 = _this.getMouseInfo(e); onMouseDown(_nextState3, e); } }); generateCategoricalChart_defineProperty(_this, "handleMouseUp", function (e) { var onMouseUp = _this.props.onMouseUp; if (isFunction_default()(onMouseUp)) { var _nextState4 = _this.getMouseInfo(e); onMouseUp(_nextState4, e); } }); generateCategoricalChart_defineProperty(_this, "handleTouchMove", function (e) { if (e.changedTouches != null && e.changedTouches.length > 0) { _this.throttleTriggeredAfterMouseMove(e.changedTouches[0]); } }); generateCategoricalChart_defineProperty(_this, "handleTouchStart", function (e) { if (e.changedTouches != null && e.changedTouches.length > 0) { _this.handleMouseDown(e.changedTouches[0]); } }); generateCategoricalChart_defineProperty(_this, "handleTouchEnd", function (e) { if (e.changedTouches != null && e.changedTouches.length > 0) { _this.handleMouseUp(e.changedTouches[0]); } }); generateCategoricalChart_defineProperty(_this, "handleDoubleClick", function (e) { var onDoubleClick = _this.props.onDoubleClick; if (isFunction_default()(onDoubleClick)) { var _nextState5 = _this.getMouseInfo(e); onDoubleClick(_nextState5, e); } }); generateCategoricalChart_defineProperty(_this, "handleContextMenu", function (e) { var onContextMenu = _this.props.onContextMenu; if (isFunction_default()(onContextMenu)) { var _nextState6 = _this.getMouseInfo(e); onContextMenu(_nextState6, e); } }); generateCategoricalChart_defineProperty(_this, "triggerSyncEvent", function (data) { if (_this.props.syncId !== undefined) { eventCenter.emit(SYNC_EVENT, _this.props.syncId, data, _this.eventEmitterSymbol); } }); generateCategoricalChart_defineProperty(_this, "applySyncEvent", function (data) { var _this$props = _this.props, layout = _this$props.layout, syncMethod = _this$props.syncMethod; var updateId = _this.state.updateId; var dataStartIndex = data.dataStartIndex, dataEndIndex = data.dataEndIndex; if (data.dataStartIndex !== undefined || data.dataEndIndex !== undefined) { _this.setState(generateCategoricalChart_objectSpread({ dataStartIndex: dataStartIndex, dataEndIndex: dataEndIndex }, updateStateOfAxisMapsOffsetAndStackGroups({ props: _this.props, dataStartIndex: dataStartIndex, dataEndIndex: dataEndIndex, updateId: updateId }, _this.state))); } else if (data.activeTooltipIndex !== undefined) { var chartX = data.chartX, chartY = data.chartY; var activeTooltipIndex = data.activeTooltipIndex; var _this$state2 = _this.state, offset = _this$state2.offset, tooltipTicks = _this$state2.tooltipTicks; if (!offset) { return; } if (typeof syncMethod === 'function') { // Call a callback function. If there is an application specific algorithm activeTooltipIndex = syncMethod(tooltipTicks, data); } else if (syncMethod === 'value') { // Set activeTooltipIndex to the index with the same value as data.activeLabel // For loop instead of findIndex because the latter is very slow in some browsers activeTooltipIndex = -1; // in case we cannot find the element for (var i = 0; i < tooltipTicks.length; i++) { if (tooltipTicks[i].value === data.activeLabel) { activeTooltipIndex = i; break; } } } var viewBox = generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, offset), {}, { x: offset.left, y: offset.top }); // When a categorical chart is combined with another chart, the value of chartX // and chartY may beyond the boundaries. var validateChartX = Math.min(chartX, viewBox.x + viewBox.width); var validateChartY = Math.min(chartY, viewBox.y + viewBox.height); var activeLabel = tooltipTicks[activeTooltipIndex] && tooltipTicks[activeTooltipIndex].value; var activePayload = getTooltipContent(_this.state, _this.props.data, activeTooltipIndex); var activeCoordinate = tooltipTicks[activeTooltipIndex] ? { x: layout === 'horizontal' ? tooltipTicks[activeTooltipIndex].coordinate : validateChartX, y: layout === 'horizontal' ? validateChartY : tooltipTicks[activeTooltipIndex].coordinate } : originCoordinate; _this.setState(generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, data), {}, { activeLabel: activeLabel, activeCoordinate: activeCoordinate, activePayload: activePayload, activeTooltipIndex: activeTooltipIndex })); } else { _this.setState(data); } }); generateCategoricalChart_defineProperty(_this, "renderCursor", function (element) { var _element$props$active; var _this$state3 = _this.state, isTooltipActive = _this$state3.isTooltipActive, activeCoordinate = _this$state3.activeCoordinate, activePayload = _this$state3.activePayload, offset = _this$state3.offset, activeTooltipIndex = _this$state3.activeTooltipIndex, tooltipAxisBandSize = _this$state3.tooltipAxisBandSize; var tooltipEventType = _this.getTooltipEventType(); // The cursor is a part of the Tooltip, and it should be shown (by default) when the Tooltip is active. var isActive = (_element$props$active = element.props.active) !== null && _element$props$active !== void 0 ? _element$props$active : isTooltipActive; var layout = _this.props.layout; var key = element.key || '_recharts-cursor'; return /*#__PURE__*/react.createElement(Cursor, { key: key, activeCoordinate: activeCoordinate, activePayload: activePayload, activeTooltipIndex: activeTooltipIndex, chartName: chartName, element: element, isActive: isActive, layout: layout, offset: offset, tooltipAxisBandSize: tooltipAxisBandSize, tooltipEventType: tooltipEventType }); }); generateCategoricalChart_defineProperty(_this, "renderPolarAxis", function (element, displayName, index) { var axisType = get_default()(element, 'type.axisType'); var axisMap = get_default()(_this.state, "".concat(axisType, "Map")); var elementDefaultProps = element.type.defaultProps; var elementProps = elementDefaultProps !== undefined ? generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, elementDefaultProps), element.props) : element.props; var axisOption = axisMap && axisMap[elementProps["".concat(axisType, "Id")]]; return /*#__PURE__*/(0,react.cloneElement)(element, generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, axisOption), {}, { className: (0,clsx/* default */.A)(axisType, axisOption.className), key: element.key || "".concat(displayName, "-").concat(index), ticks: (0,ChartUtils/* getTicksOfAxis */.Rh)(axisOption, true) })); }); generateCategoricalChart_defineProperty(_this, "renderPolarGrid", function (element) { var _element$props = element.props, radialLines = _element$props.radialLines, polarAngles = _element$props.polarAngles, polarRadius = _element$props.polarRadius; var _this$state4 = _this.state, radiusAxisMap = _this$state4.radiusAxisMap, angleAxisMap = _this$state4.angleAxisMap; var radiusAxis = (0,DataUtils/* getAnyElementOfObject */.lX)(radiusAxisMap); var angleAxis = (0,DataUtils/* getAnyElementOfObject */.lX)(angleAxisMap); var cx = angleAxis.cx, cy = angleAxis.cy, innerRadius = angleAxis.innerRadius, outerRadius = angleAxis.outerRadius; return /*#__PURE__*/(0,react.cloneElement)(element, { polarAngles: Array.isArray(polarAngles) ? polarAngles : (0,ChartUtils/* getTicksOfAxis */.Rh)(angleAxis, true).map(function (entry) { return entry.coordinate; }), polarRadius: Array.isArray(polarRadius) ? polarRadius : (0,ChartUtils/* getTicksOfAxis */.Rh)(radiusAxis, true).map(function (entry) { return entry.coordinate; }), cx: cx, cy: cy, innerRadius: innerRadius, outerRadius: outerRadius, key: element.key || 'polar-grid', radialLines: radialLines }); }); /** * Draw legend * @return {ReactElement} The instance of Legend */ generateCategoricalChart_defineProperty(_this, "renderLegend", function () { var formattedGraphicalItems = _this.state.formattedGraphicalItems; var _this$props2 = _this.props, children = _this$props2.children, width = _this$props2.width, height = _this$props2.height; var margin = _this.props.margin || {}; var legendWidth = width - (margin.left || 0) - (margin.right || 0); var props = (0,getLegendProps/* getLegendProps */.g)({ children: children, formattedGraphicalItems: formattedGraphicalItems, legendWidth: legendWidth, legendContent: legendContent }); if (!props) { return null; } var item = props.item, otherProps = generateCategoricalChart_objectWithoutProperties(props, generateCategoricalChart_excluded); return /*#__PURE__*/(0,react.cloneElement)(item, generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, otherProps), {}, { chartWidth: width, chartHeight: height, margin: margin, onBBoxUpdate: _this.handleLegendBBoxUpdate })); }); /** * Draw Tooltip * @return {ReactElement} The instance of Tooltip */ generateCategoricalChart_defineProperty(_this, "renderTooltip", function () { var _tooltipItem$props$ac; var _this$props3 = _this.props, children = _this$props3.children, accessibilityLayer = _this$props3.accessibilityLayer; var tooltipItem = (0,ReactUtils/* findChildByType */.BU)(children, Tooltip); if (!tooltipItem) { return null; } var _this$state5 = _this.state, isTooltipActive = _this$state5.isTooltipActive, activeCoordinate = _this$state5.activeCoordinate, activePayload = _this$state5.activePayload, activeLabel = _this$state5.activeLabel, offset = _this$state5.offset; // The user can set isActive on the Tooltip, // and we respect the user to enable customisation. // The Tooltip is active if the user has set isActive, or if the tooltip is active due to a mouse event. var isActive = (_tooltipItem$props$ac = tooltipItem.props.active) !== null && _tooltipItem$props$ac !== void 0 ? _tooltipItem$props$ac : isTooltipActive; return /*#__PURE__*/(0,react.cloneElement)(tooltipItem, { viewBox: generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, offset), {}, { x: offset.left, y: offset.top }), active: isActive, label: activeLabel, payload: isActive ? activePayload : [], coordinate: activeCoordinate, accessibilityLayer: accessibilityLayer }); }); generateCategoricalChart_defineProperty(_this, "renderBrush", function (element) { var _this$props4 = _this.props, margin = _this$props4.margin, data = _this$props4.data; var _this$state6 = _this.state, offset = _this$state6.offset, dataStartIndex = _this$state6.dataStartIndex, dataEndIndex = _this$state6.dataEndIndex, updateId = _this$state6.updateId; // TODO: update brush when children update return /*#__PURE__*/(0,react.cloneElement)(element, { key: element.key || '_recharts-brush', onChange: (0,ChartUtils/* combineEventHandlers */.HQ)(_this.handleBrushChange, element.props.onChange), data: data, x: (0,DataUtils/* isNumber */.Et)(element.props.x) ? element.props.x : offset.left, y: (0,DataUtils/* isNumber */.Et)(element.props.y) ? element.props.y : offset.top + offset.height + offset.brushBottom - (margin.bottom || 0), width: (0,DataUtils/* isNumber */.Et)(element.props.width) ? element.props.width : offset.width, startIndex: dataStartIndex, endIndex: dataEndIndex, updateId: "brush-".concat(updateId) }); }); generateCategoricalChart_defineProperty(_this, "renderReferenceElement", function (element, displayName, index) { if (!element) { return null; } var _this2 = _this, clipPathId = _this2.clipPathId; var _this$state7 = _this.state, xAxisMap = _this$state7.xAxisMap, yAxisMap = _this$state7.yAxisMap, offset = _this$state7.offset; var elementDefaultProps = element.type.defaultProps || {}; var _element$props2 = element.props, _element$props2$xAxis = _element$props2.xAxisId, xAxisId = _element$props2$xAxis === void 0 ? elementDefaultProps.xAxisId : _element$props2$xAxis, _element$props2$yAxis = _element$props2.yAxisId, yAxisId = _element$props2$yAxis === void 0 ? elementDefaultProps.yAxisId : _element$props2$yAxis; return /*#__PURE__*/(0,react.cloneElement)(element, { key: element.key || "".concat(displayName, "-").concat(index), xAxis: xAxisMap[xAxisId], yAxis: yAxisMap[yAxisId], viewBox: { x: offset.left, y: offset.top, width: offset.width, height: offset.height }, clipPathId: clipPathId }); }); generateCategoricalChart_defineProperty(_this, "renderActivePoints", function (_ref10) { var item = _ref10.item, activePoint = _ref10.activePoint, basePoint = _ref10.basePoint, childIndex = _ref10.childIndex, isRange = _ref10.isRange; var result = []; // item is not a React Element so we don't need to resolve defaultProps. var key = item.props.key; var itemItemProps = item.item.type.defaultProps !== undefined ? generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, item.item.type.defaultProps), item.item.props) : item.item.props; var activeDot = itemItemProps.activeDot, dataKey = itemItemProps.dataKey; var dotProps = generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({ index: childIndex, dataKey: dataKey, cx: activePoint.x, cy: activePoint.y, r: 4, fill: (0,ChartUtils/* getMainColorOfGraphicItem */.Ps)(item.item), strokeWidth: 2, stroke: '#fff', payload: activePoint.payload, value: activePoint.value }, (0,ReactUtils/* filterProps */.J9)(activeDot, false)), (0,types/* adaptEventHandlers */._U)(activeDot)); result.push(CategoricalChartWrapper.renderActiveDot(activeDot, dotProps, "".concat(key, "-activePoint-").concat(childIndex))); if (basePoint) { result.push(CategoricalChartWrapper.renderActiveDot(activeDot, generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, dotProps), {}, { cx: basePoint.x, cy: basePoint.y }), "".concat(key, "-basePoint-").concat(childIndex))); } else if (isRange) { result.push(null); } return result; }); generateCategoricalChart_defineProperty(_this, "renderGraphicChild", function (element, displayName, index) { var item = _this.filterFormatItem(element, displayName, index); if (!item) { return null; } var tooltipEventType = _this.getTooltipEventType(); var _this$state8 = _this.state, isTooltipActive = _this$state8.isTooltipActive, tooltipAxis = _this$state8.tooltipAxis, activeTooltipIndex = _this$state8.activeTooltipIndex, activeLabel = _this$state8.activeLabel; var children = _this.props.children; var tooltipItem = (0,ReactUtils/* findChildByType */.BU)(children, Tooltip); // item is not a React Element so we don't need to resolve defaultProps var _item$props = item.props, points = _item$props.points, isRange = _item$props.isRange, baseLine = _item$props.baseLine; var itemItemProps = item.item.type.defaultProps !== undefined ? generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, item.item.type.defaultProps), item.item.props) : item.item.props; var activeDot = itemItemProps.activeDot, hide = itemItemProps.hide, activeBar = itemItemProps.activeBar, activeShape = itemItemProps.activeShape; var hasActive = Boolean(!hide && isTooltipActive && tooltipItem && (activeDot || activeBar || activeShape)); var itemEvents = {}; if (tooltipEventType !== 'axis' && tooltipItem && tooltipItem.props.trigger === 'click') { itemEvents = { onClick: (0,ChartUtils/* combineEventHandlers */.HQ)(_this.handleItemMouseEnter, element.props.onClick) }; } else if (tooltipEventType !== 'axis') { itemEvents = { onMouseLeave: (0,ChartUtils/* combineEventHandlers */.HQ)(_this.handleItemMouseLeave, element.props.onMouseLeave), onMouseEnter: (0,ChartUtils/* combineEventHandlers */.HQ)(_this.handleItemMouseEnter, element.props.onMouseEnter) }; } var graphicalItem = /*#__PURE__*/(0,react.cloneElement)(element, generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, item.props), itemEvents)); function findWithPayload(entry) { // TODO needs to verify dataKey is Function return typeof tooltipAxis.dataKey === 'function' ? tooltipAxis.dataKey(entry.payload) : null; } if (hasActive) { if (activeTooltipIndex >= 0) { var activePoint, basePoint; if (tooltipAxis.dataKey && !tooltipAxis.allowDuplicatedCategory) { // number transform to string var specifiedKey = typeof tooltipAxis.dataKey === 'function' ? findWithPayload : 'payload.'.concat(tooltipAxis.dataKey.toString()); activePoint = (0,DataUtils/* findEntryInArray */.eP)(points, specifiedKey, activeLabel); basePoint = isRange && baseLine && (0,DataUtils/* findEntryInArray */.eP)(baseLine, specifiedKey, activeLabel); } else { activePoint = points === null || points === void 0 ? void 0 : points[activeTooltipIndex]; basePoint = isRange && baseLine && baseLine[activeTooltipIndex]; } if (activeShape || activeBar) { var activeIndex = element.props.activeIndex !== undefined ? element.props.activeIndex : activeTooltipIndex; return [/*#__PURE__*/(0,react.cloneElement)(element, generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, item.props), itemEvents), {}, { activeIndex: activeIndex })), null, null]; } if (!isNil_default()(activePoint)) { return [graphicalItem].concat(generateCategoricalChart_toConsumableArray(_this.renderActivePoints({ item: item, activePoint: activePoint, basePoint: basePoint, childIndex: activeTooltipIndex, isRange: isRange }))); } } else { var _this$getItemByXY; /** * We hit this block if consumer uses a Tooltip without XAxis and/or YAxis. * In which case, this.state.activeTooltipIndex never gets set * because the mouse events that trigger that value getting set never get trigged without the axis components. * * An example usage case is a FunnelChart */ var _ref11 = (_this$getItemByXY = _this.getItemByXY(_this.state.activeCoordinate)) !== null && _this$getItemByXY !== void 0 ? _this$getItemByXY : { graphicalItem: graphicalItem }, _ref11$graphicalItem = _ref11.graphicalItem, _ref11$graphicalItem$ = _ref11$graphicalItem.item, xyItem = _ref11$graphicalItem$ === void 0 ? element : _ref11$graphicalItem$, childIndex = _ref11$graphicalItem.childIndex; var elementProps = generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, item.props), itemEvents), {}, { activeIndex: childIndex }); return [/*#__PURE__*/(0,react.cloneElement)(xyItem, elementProps), null, null]; } } if (isRange) { return [graphicalItem, null, null]; } return [graphicalItem, null]; }); generateCategoricalChart_defineProperty(_this, "renderCustomized", function (element, displayName, index) { return /*#__PURE__*/(0,react.cloneElement)(element, generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({ key: "recharts-customized-".concat(index) }, _this.props), _this.state)); }); generateCategoricalChart_defineProperty(_this, "renderMap", { CartesianGrid: { handler: renderAsIs, once: true }, ReferenceArea: { handler: _this.renderReferenceElement }, ReferenceLine: { handler: renderAsIs }, ReferenceDot: { handler: _this.renderReferenceElement }, XAxis: { handler: renderAsIs }, YAxis: { handler: renderAsIs }, Brush: { handler: _this.renderBrush, once: true }, Bar: { handler: _this.renderGraphicChild }, Line: { handler: _this.renderGraphicChild }, Area: { handler: _this.renderGraphicChild }, Radar: { handler: _this.renderGraphicChild }, RadialBar: { handler: _this.renderGraphicChild }, Scatter: { handler: _this.renderGraphicChild }, Pie: { handler: _this.renderGraphicChild }, Funnel: { handler: _this.renderGraphicChild }, Tooltip: { handler: _this.renderCursor, once: true }, PolarGrid: { handler: _this.renderPolarGrid, once: true }, PolarAngleAxis: { handler: _this.renderPolarAxis }, PolarRadiusAxis: { handler: _this.renderPolarAxis }, Customized: { handler: _this.renderCustomized } }); _this.clipPathId = "".concat((_props$id = _props.id) !== null && _props$id !== void 0 ? _props$id : (0,DataUtils/* uniqueId */.NF)('recharts'), "-clip"); // trigger 60fps _this.throttleTriggeredAfterMouseMove = throttle_default()(_this.triggeredAfterMouseMove, (_props$throttleDelay = _props.throttleDelay) !== null && _props$throttleDelay !== void 0 ? _props$throttleDelay : 1000 / 60); _this.state = {}; return _this; } generateCategoricalChart_inherits(CategoricalChartWrapper, _Component); return generateCategoricalChart_createClass(CategoricalChartWrapper, [{ key: "componentDidMount", value: function componentDidMount() { var _this$props$margin$le, _this$props$margin$to; this.addListener(); this.accessibilityManager.setDetails({ container: this.container, offset: { left: (_this$props$margin$le = this.props.margin.left) !== null && _this$props$margin$le !== void 0 ? _this$props$margin$le : 0, top: (_this$props$margin$to = this.props.margin.top) !== null && _this$props$margin$to !== void 0 ? _this$props$margin$to : 0 }, coordinateList: this.state.tooltipTicks, mouseHandlerCallback: this.triggeredAfterMouseMove, layout: this.props.layout }); this.displayDefaultTooltip(); } }, { key: "displayDefaultTooltip", value: function displayDefaultTooltip() { var _this$props5 = this.props, children = _this$props5.children, data = _this$props5.data, height = _this$props5.height, layout = _this$props5.layout; var tooltipElem = (0,ReactUtils/* findChildByType */.BU)(children, Tooltip); // If the chart doesn't include a element, there's no tooltip to display if (!tooltipElem) { return; } var defaultIndex = tooltipElem.props.defaultIndex; // Protect against runtime errors if (typeof defaultIndex !== 'number' || defaultIndex < 0 || defaultIndex > this.state.tooltipTicks.length - 1) { return; } var activeLabel = this.state.tooltipTicks[defaultIndex] && this.state.tooltipTicks[defaultIndex].value; var activePayload = getTooltipContent(this.state, data, defaultIndex, activeLabel); var independentAxisCoord = this.state.tooltipTicks[defaultIndex].coordinate; var dependentAxisCoord = (this.state.offset.top + height) / 2; var isHorizontal = layout === 'horizontal'; var activeCoordinate = isHorizontal ? { x: independentAxisCoord, y: dependentAxisCoord } : { y: independentAxisCoord, x: dependentAxisCoord }; // Unlike other chart types, scatter plot's tooltip positions rely on both X and Y coordinates. Only the scatter plot // element knows its own Y coordinates. // If there's a scatter plot, we'll want to grab that element for an interrogation. var scatterPlotElement = this.state.formattedGraphicalItems.find(function (_ref12) { var item = _ref12.item; return item.type.name === 'Scatter'; }); if (scatterPlotElement) { activeCoordinate = generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, activeCoordinate), scatterPlotElement.props.points[defaultIndex].tooltipPosition); activePayload = scatterPlotElement.props.points[defaultIndex].tooltipPayload; } var nextState = { activeTooltipIndex: defaultIndex, isTooltipActive: true, activeLabel: activeLabel, activePayload: activePayload, activeCoordinate: activeCoordinate }; this.setState(nextState); this.renderCursor(tooltipElem); // Make sure that anyone who keyboard-only users who tab to the chart will start their // cursors at defaultIndex this.accessibilityManager.setIndex(defaultIndex); } }, { key: "getSnapshotBeforeUpdate", value: function getSnapshotBeforeUpdate(prevProps, prevState) { if (!this.props.accessibilityLayer) { return null; } if (this.state.tooltipTicks !== prevState.tooltipTicks) { this.accessibilityManager.setDetails({ coordinateList: this.state.tooltipTicks }); } if (this.props.layout !== prevProps.layout) { this.accessibilityManager.setDetails({ layout: this.props.layout }); } if (this.props.margin !== prevProps.margin) { var _this$props$margin$le2, _this$props$margin$to2; this.accessibilityManager.setDetails({ offset: { left: (_this$props$margin$le2 = this.props.margin.left) !== null && _this$props$margin$le2 !== void 0 ? _this$props$margin$le2 : 0, top: (_this$props$margin$to2 = this.props.margin.top) !== null && _this$props$margin$to2 !== void 0 ? _this$props$margin$to2 : 0 } }); } // Something has to be returned for getSnapshotBeforeUpdate return null; } }, { key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { // Check to see if the Tooltip updated. If so, re-check default tooltip position if (!(0,ReactUtils/* isChildrenEqual */.OV)([(0,ReactUtils/* findChildByType */.BU)(prevProps.children, Tooltip)], [(0,ReactUtils/* findChildByType */.BU)(this.props.children, Tooltip)])) { this.displayDefaultTooltip(); } } }, { key: "componentWillUnmount", value: function componentWillUnmount() { this.removeListener(); this.throttleTriggeredAfterMouseMove.cancel(); } }, { key: "getTooltipEventType", value: function getTooltipEventType() { var tooltipItem = (0,ReactUtils/* findChildByType */.BU)(this.props.children, Tooltip); if (tooltipItem && typeof tooltipItem.props.shared === 'boolean') { var eventType = tooltipItem.props.shared ? 'axis' : 'item'; return validateTooltipEventTypes.indexOf(eventType) >= 0 ? eventType : defaultTooltipEventType; } return defaultTooltipEventType; } /** * Get the information of mouse in chart, return null when the mouse is not in the chart * @param {MousePointer} event The event object * @return {Object} Mouse data */ }, { key: "getMouseInfo", value: function getMouseInfo(event) { if (!this.container) { return null; } var element = this.container; var boundingRect = element.getBoundingClientRect(); var containerOffset = (0,DOMUtils/* getOffset */.A3)(boundingRect); var e = { chartX: Math.round(event.pageX - containerOffset.left), chartY: Math.round(event.pageY - containerOffset.top) }; var scale = boundingRect.width / element.offsetWidth || 1; var rangeObj = this.inRange(e.chartX, e.chartY, scale); if (!rangeObj) { return null; } var _this$state9 = this.state, xAxisMap = _this$state9.xAxisMap, yAxisMap = _this$state9.yAxisMap; var tooltipEventType = this.getTooltipEventType(); var toolTipData = getTooltipData(this.state, this.props.data, this.props.layout, rangeObj); if (tooltipEventType !== 'axis' && xAxisMap && yAxisMap) { var xScale = (0,DataUtils/* getAnyElementOfObject */.lX)(xAxisMap).scale; var yScale = (0,DataUtils/* getAnyElementOfObject */.lX)(yAxisMap).scale; var xValue = xScale && xScale.invert ? xScale.invert(e.chartX) : null; var yValue = yScale && yScale.invert ? yScale.invert(e.chartY) : null; return generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, e), {}, { xValue: xValue, yValue: yValue }, toolTipData); } if (toolTipData) { return generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, e), toolTipData); } return null; } }, { key: "inRange", value: function inRange(x, y) { var scale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; var layout = this.props.layout; var scaledX = x / scale, scaledY = y / scale; if (layout === 'horizontal' || layout === 'vertical') { var offset = this.state.offset; var isInRange = scaledX >= offset.left && scaledX <= offset.left + offset.width && scaledY >= offset.top && scaledY <= offset.top + offset.height; return isInRange ? { x: scaledX, y: scaledY } : null; } var _this$state10 = this.state, angleAxisMap = _this$state10.angleAxisMap, radiusAxisMap = _this$state10.radiusAxisMap; if (angleAxisMap && radiusAxisMap) { var angleAxis = (0,DataUtils/* getAnyElementOfObject */.lX)(angleAxisMap); return (0,PolarUtils/* inRangeOfSector */.yy)({ x: scaledX, y: scaledY }, angleAxis); } return null; } }, { key: "parseEventsOfWrapper", value: function parseEventsOfWrapper() { var children = this.props.children; var tooltipEventType = this.getTooltipEventType(); var tooltipItem = (0,ReactUtils/* findChildByType */.BU)(children, Tooltip); var tooltipEvents = {}; if (tooltipItem && tooltipEventType === 'axis') { if (tooltipItem.props.trigger === 'click') { tooltipEvents = { onClick: this.handleClick }; } else { tooltipEvents = { onMouseEnter: this.handleMouseEnter, onDoubleClick: this.handleDoubleClick, onMouseMove: this.handleMouseMove, onMouseLeave: this.handleMouseLeave, onTouchMove: this.handleTouchMove, onTouchStart: this.handleTouchStart, onTouchEnd: this.handleTouchEnd, onContextMenu: this.handleContextMenu }; } } // @ts-expect-error adaptEventHandlers expects DOM Event but generateCategoricalChart works with React UIEvents var outerEvents = (0,types/* adaptEventHandlers */._U)(this.props, this.handleOuterEvent); return generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, outerEvents), tooltipEvents); } }, { key: "addListener", value: function addListener() { eventCenter.on(SYNC_EVENT, this.handleReceiveSyncEvent); } }, { key: "removeListener", value: function removeListener() { eventCenter.removeListener(SYNC_EVENT, this.handleReceiveSyncEvent); } }, { key: "filterFormatItem", value: function filterFormatItem(item, displayName, childIndex) { var formattedGraphicalItems = this.state.formattedGraphicalItems; for (var i = 0, len = formattedGraphicalItems.length; i < len; i++) { var entry = formattedGraphicalItems[i]; if (entry.item === item || entry.props.key === item.key || displayName === (0,ReactUtils/* getDisplayName */.Mn)(entry.item.type) && childIndex === entry.childIndex) { return entry; } } return null; } }, { key: "renderClipPath", value: function renderClipPath() { var clipPathId = this.clipPathId; var _this$state$offset = this.state.offset, left = _this$state$offset.left, top = _this$state$offset.top, height = _this$state$offset.height, width = _this$state$offset.width; return /*#__PURE__*/react.createElement("defs", null, /*#__PURE__*/react.createElement("clipPath", { id: clipPathId }, /*#__PURE__*/react.createElement("rect", { x: left, y: top, height: height, width: width }))); } }, { key: "getXScales", value: function getXScales() { var xAxisMap = this.state.xAxisMap; return xAxisMap ? Object.entries(xAxisMap).reduce(function (res, _ref13) { var _ref14 = generateCategoricalChart_slicedToArray(_ref13, 2), axisId = _ref14[0], axisProps = _ref14[1]; return generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, res), {}, generateCategoricalChart_defineProperty({}, axisId, axisProps.scale)); }, {}) : null; } }, { key: "getYScales", value: function getYScales() { var yAxisMap = this.state.yAxisMap; return yAxisMap ? Object.entries(yAxisMap).reduce(function (res, _ref15) { var _ref16 = generateCategoricalChart_slicedToArray(_ref15, 2), axisId = _ref16[0], axisProps = _ref16[1]; return generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, res), {}, generateCategoricalChart_defineProperty({}, axisId, axisProps.scale)); }, {}) : null; } }, { key: "getXScaleByAxisId", value: function getXScaleByAxisId(axisId) { var _this$state$xAxisMap; return (_this$state$xAxisMap = this.state.xAxisMap) === null || _this$state$xAxisMap === void 0 || (_this$state$xAxisMap = _this$state$xAxisMap[axisId]) === null || _this$state$xAxisMap === void 0 ? void 0 : _this$state$xAxisMap.scale; } }, { key: "getYScaleByAxisId", value: function getYScaleByAxisId(axisId) { var _this$state$yAxisMap; return (_this$state$yAxisMap = this.state.yAxisMap) === null || _this$state$yAxisMap === void 0 || (_this$state$yAxisMap = _this$state$yAxisMap[axisId]) === null || _this$state$yAxisMap === void 0 ? void 0 : _this$state$yAxisMap.scale; } }, { key: "getItemByXY", value: function getItemByXY(chartXY) { var _this$state11 = this.state, formattedGraphicalItems = _this$state11.formattedGraphicalItems, activeItem = _this$state11.activeItem; if (formattedGraphicalItems && formattedGraphicalItems.length) { for (var i = 0, len = formattedGraphicalItems.length; i < len; i++) { var graphicalItem = formattedGraphicalItems[i]; // graphicalItem is not a React Element so we don't need to resolve defaultProps var props = graphicalItem.props, item = graphicalItem.item; var itemProps = item.type.defaultProps !== undefined ? generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, item.type.defaultProps), item.props) : item.props; var itemDisplayName = (0,ReactUtils/* getDisplayName */.Mn)(item.type); if (itemDisplayName === 'Bar') { var activeBarItem = (props.data || []).find(function (entry) { return (0,Rectangle/* isInRectangle */.J)(chartXY, entry); }); if (activeBarItem) { return { graphicalItem: graphicalItem, payload: activeBarItem }; } } else if (itemDisplayName === 'RadialBar') { var _activeBarItem = (props.data || []).find(function (entry) { return (0,PolarUtils/* inRangeOfSector */.yy)(chartXY, entry); }); if (_activeBarItem) { return { graphicalItem: graphicalItem, payload: _activeBarItem }; } } else if ((0,ActiveShapeUtils/* isFunnel */.NE)(graphicalItem, activeItem) || (0,ActiveShapeUtils/* isPie */.nZ)(graphicalItem, activeItem) || (0,ActiveShapeUtils/* isScatter */.xQ)(graphicalItem, activeItem)) { var activeIndex = (0,ActiveShapeUtils/* getActiveShapeIndexForTooltip */.GG)({ graphicalItem: graphicalItem, activeTooltipItem: activeItem, itemData: itemProps.data }); var childIndex = itemProps.activeIndex === undefined ? activeIndex : itemProps.activeIndex; return { graphicalItem: generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, graphicalItem), {}, { childIndex: childIndex }), payload: (0,ActiveShapeUtils/* isScatter */.xQ)(graphicalItem, activeItem) ? itemProps.data[activeIndex] : graphicalItem.props.data[activeIndex] }; } } } return null; } }, { key: "render", value: function render() { var _this3 = this; if (!(0,ReactUtils/* validateWidthHeight */.Me)(this)) { return null; } var _this$props6 = this.props, children = _this$props6.children, className = _this$props6.className, width = _this$props6.width, height = _this$props6.height, style = _this$props6.style, compact = _this$props6.compact, title = _this$props6.title, desc = _this$props6.desc, others = generateCategoricalChart_objectWithoutProperties(_this$props6, _excluded2); var attrs = (0,ReactUtils/* filterProps */.J9)(others, false); // The "compact" mode is mainly used as the panorama within Brush if (compact) { return /*#__PURE__*/react.createElement(ChartLayoutContextProvider, { state: this.state, width: this.props.width, height: this.props.height, clipPathId: this.clipPathId }, /*#__PURE__*/react.createElement(Surface/* Surface */.u, generateCategoricalChart_extends({}, attrs, { width: width, height: height, title: title, desc: desc }), this.renderClipPath(), (0,ReactUtils/* renderByOrder */.ee)(children, this.renderMap))); } if (this.props.accessibilityLayer) { var _this$props$tabIndex, _this$props$role; // Set tabIndex to 0 by default (can be overwritten) attrs.tabIndex = (_this$props$tabIndex = this.props.tabIndex) !== null && _this$props$tabIndex !== void 0 ? _this$props$tabIndex : 0; // Set role to img by default (can be overwritten) attrs.role = (_this$props$role = this.props.role) !== null && _this$props$role !== void 0 ? _this$props$role : 'application'; attrs.onKeyDown = function (e) { _this3.accessibilityManager.keyboardEvent(e); // 'onKeyDown' is not currently a supported prop that can be passed through // if it's added, this should be added: this.props.onKeyDown(e); }; attrs.onFocus = function () { _this3.accessibilityManager.focus(); // 'onFocus' is not currently a supported prop that can be passed through // if it's added, the focus event should be forwarded to the prop }; } var events = this.parseEventsOfWrapper(); return /*#__PURE__*/react.createElement(ChartLayoutContextProvider, { state: this.state, width: this.props.width, height: this.props.height, clipPathId: this.clipPathId }, /*#__PURE__*/react.createElement("div", generateCategoricalChart_extends({ className: (0,clsx/* default */.A)('recharts-wrapper', className), style: generateCategoricalChart_objectSpread({ position: 'relative', cursor: 'default', width: width, height: height }, style) }, events, { ref: function ref(node) { _this3.container = node; } }), /*#__PURE__*/react.createElement(Surface/* Surface */.u, generateCategoricalChart_extends({}, attrs, { width: width, height: height, title: title, desc: desc, style: FULL_WIDTH_AND_HEIGHT }), this.renderClipPath(), (0,ReactUtils/* renderByOrder */.ee)(children, this.renderMap)), this.renderLegend(), this.renderTooltip())); } }]); }(react.Component); generateCategoricalChart_defineProperty(CategoricalChartWrapper, "displayName", chartName); // todo join specific chart propTypes generateCategoricalChart_defineProperty(CategoricalChartWrapper, "defaultProps", generateCategoricalChart_objectSpread({ layout: 'horizontal', stackOffset: 'none', barCategoryGap: '10%', barGap: 4, margin: { top: 5, right: 5, bottom: 5, left: 5 }, reverseStackOrder: false, syncMethod: 'index' }, defaultProps)); generateCategoricalChart_defineProperty(CategoricalChartWrapper, "getDerivedStateFromProps", function (nextProps, prevState) { var dataKey = nextProps.dataKey, data = nextProps.data, children = nextProps.children, width = nextProps.width, height = nextProps.height, layout = nextProps.layout, stackOffset = nextProps.stackOffset, margin = nextProps.margin; var dataStartIndex = prevState.dataStartIndex, dataEndIndex = prevState.dataEndIndex; if (prevState.updateId === undefined) { var defaultState = createDefaultState(nextProps); return generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, defaultState), {}, { updateId: 0 }, updateStateOfAxisMapsOffsetAndStackGroups(generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({ props: nextProps }, defaultState), {}, { updateId: 0 }), prevState)), {}, { prevDataKey: dataKey, prevData: data, prevWidth: width, prevHeight: height, prevLayout: layout, prevStackOffset: stackOffset, prevMargin: margin, prevChildren: children }); } if (dataKey !== prevState.prevDataKey || data !== prevState.prevData || width !== prevState.prevWidth || height !== prevState.prevHeight || layout !== prevState.prevLayout || stackOffset !== prevState.prevStackOffset || !(0,ShallowEqual/* shallowEqual */.b)(margin, prevState.prevMargin)) { var _defaultState = createDefaultState(nextProps); // Fixes https://github.com/recharts/recharts/issues/2143 var keepFromPrevState = { // (chartX, chartY) are (0,0) in default state, but we want to keep the last mouse position to avoid // any flickering chartX: prevState.chartX, chartY: prevState.chartY, // The tooltip should stay active when it was active in the previous render. If this is not // the case, the tooltip disappears and immediately re-appears, causing a flickering effect isTooltipActive: prevState.isTooltipActive }; var updatesToState = generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, getTooltipData(prevState, data, layout)), {}, { updateId: prevState.updateId + 1 }); var newState = generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, _defaultState), keepFromPrevState), updatesToState); return generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({}, newState), updateStateOfAxisMapsOffsetAndStackGroups(generateCategoricalChart_objectSpread({ props: nextProps }, newState), prevState)), {}, { prevDataKey: dataKey, prevData: data, prevWidth: width, prevHeight: height, prevLayout: layout, prevStackOffset: stackOffset, prevMargin: margin, prevChildren: children }); } if (!(0,ReactUtils/* isChildrenEqual */.OV)(children, prevState.prevChildren)) { var _brush$props$startInd, _brush$props, _brush$props$endIndex, _brush$props2; // specifically check for Brush - if it exists and the start and end indexes are different, re-render with the new ones var brush = (0,ReactUtils/* findChildByType */.BU)(children, Brush); var startIndex = brush ? (_brush$props$startInd = (_brush$props = brush.props) === null || _brush$props === void 0 ? void 0 : _brush$props.startIndex) !== null && _brush$props$startInd !== void 0 ? _brush$props$startInd : dataStartIndex : dataStartIndex; var endIndex = brush ? (_brush$props$endIndex = (_brush$props2 = brush.props) === null || _brush$props2 === void 0 ? void 0 : _brush$props2.endIndex) !== null && _brush$props$endIndex !== void 0 ? _brush$props$endIndex : dataEndIndex : dataEndIndex; var hasDifferentStartOrEndIndex = startIndex !== dataStartIndex || endIndex !== dataEndIndex; // update configuration in children var hasGlobalData = !isNil_default()(data); var newUpdateId = hasGlobalData && !hasDifferentStartOrEndIndex ? prevState.updateId : prevState.updateId + 1; return generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({ updateId: newUpdateId }, updateStateOfAxisMapsOffsetAndStackGroups(generateCategoricalChart_objectSpread(generateCategoricalChart_objectSpread({ props: nextProps }, prevState), {}, { updateId: newUpdateId, dataStartIndex: startIndex, dataEndIndex: endIndex }), prevState)), {}, { prevChildren: children, dataStartIndex: startIndex, dataEndIndex: endIndex }); } return null; }); generateCategoricalChart_defineProperty(CategoricalChartWrapper, "renderActiveDot", function (option, props, key) { var dot; if ( /*#__PURE__*/(0,react.isValidElement)(option)) { dot = /*#__PURE__*/(0,react.cloneElement)(option, props); } else if (isFunction_default()(option)) { dot = option(props); } else { dot = /*#__PURE__*/react.createElement(Dot, props); } return /*#__PURE__*/react.createElement(Layer/* Layer */.W, { className: "recharts-active-dot", key: key }, dot); }); var CategoricalChart = /*#__PURE__*/(0,react.forwardRef)(function CategoricalChart(props, ref) { return /*#__PURE__*/react.createElement(CategoricalChartWrapper, generateCategoricalChart_extends({}, props, { ref: ref })); }); CategoricalChart.displayName = CategoricalChartWrapper.displayName; return CategoricalChart; }; ;// ./node_modules/recharts/es6/shape/Polygon.js var Polygon_excluded = ["points", "className", "baseLinePoints", "connectNulls"]; function Polygon_extends() { Polygon_extends = Object.assign ? Object.assign.bind() : 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; }; return Polygon_extends.apply(this, arguments); } function Polygon_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = Polygon_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function Polygon_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; } function Polygon_toConsumableArray(arr) { return Polygon_arrayWithoutHoles(arr) || Polygon_iterableToArray(arr) || Polygon_unsupportedIterableToArray(arr) || Polygon_nonIterableSpread(); } function Polygon_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function Polygon_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Polygon_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Polygon_arrayLikeToArray(o, minLen); } function Polygon_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function Polygon_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return Polygon_arrayLikeToArray(arr); } function Polygon_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } /** * @fileOverview Polygon */ var isValidatePoint = function isValidatePoint(point) { return point && point.x === +point.x && point.y === +point.y; }; var getParsedPoints = function getParsedPoints() { var points = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var segmentPoints = [[]]; points.forEach(function (entry) { if (isValidatePoint(entry)) { segmentPoints[segmentPoints.length - 1].push(entry); } else if (segmentPoints[segmentPoints.length - 1].length > 0) { // add another path segmentPoints.push([]); } }); if (isValidatePoint(points[0])) { segmentPoints[segmentPoints.length - 1].push(points[0]); } if (segmentPoints[segmentPoints.length - 1].length <= 0) { segmentPoints = segmentPoints.slice(0, -1); } return segmentPoints; }; var getSinglePolygonPath = function getSinglePolygonPath(points, connectNulls) { var segmentPoints = getParsedPoints(points); if (connectNulls) { segmentPoints = [segmentPoints.reduce(function (res, segPoints) { return [].concat(Polygon_toConsumableArray(res), Polygon_toConsumableArray(segPoints)); }, [])]; } var polygonPath = segmentPoints.map(function (segPoints) { return segPoints.reduce(function (path, point, index) { return "".concat(path).concat(index === 0 ? 'M' : 'L').concat(point.x, ",").concat(point.y); }, ''); }).join(''); return segmentPoints.length === 1 ? "".concat(polygonPath, "Z") : polygonPath; }; var getRanglePath = function getRanglePath(points, baseLinePoints, connectNulls) { var outerPath = getSinglePolygonPath(points, connectNulls); return "".concat(outerPath.slice(-1) === 'Z' ? outerPath.slice(0, -1) : outerPath, "L").concat(getSinglePolygonPath(baseLinePoints.reverse(), connectNulls).slice(1)); }; var Polygon = function Polygon(props) { var points = props.points, className = props.className, baseLinePoints = props.baseLinePoints, connectNulls = props.connectNulls, others = Polygon_objectWithoutProperties(props, Polygon_excluded); if (!points || !points.length) { return null; } var layerClass = (0,clsx/* default */.A)('recharts-polygon', className); if (baseLinePoints && baseLinePoints.length) { var hasStroke = others.stroke && others.stroke !== 'none'; var rangePath = getRanglePath(points, baseLinePoints, connectNulls); return /*#__PURE__*/react.createElement("g", { className: layerClass }, /*#__PURE__*/react.createElement("path", Polygon_extends({}, (0,ReactUtils/* filterProps */.J9)(others, true), { fill: rangePath.slice(-1) === 'Z' ? others.fill : 'none', stroke: "none", d: rangePath })), hasStroke ? /*#__PURE__*/react.createElement("path", Polygon_extends({}, (0,ReactUtils/* filterProps */.J9)(others, true), { fill: "none", d: getSinglePolygonPath(points, connectNulls) })) : null, hasStroke ? /*#__PURE__*/react.createElement("path", Polygon_extends({}, (0,ReactUtils/* filterProps */.J9)(others, true), { fill: "none", d: getSinglePolygonPath(baseLinePoints, connectNulls) })) : null); } var singlePath = getSinglePolygonPath(points, connectNulls); return /*#__PURE__*/react.createElement("path", Polygon_extends({}, (0,ReactUtils/* filterProps */.J9)(others, true), { fill: singlePath.slice(-1) === 'Z' ? others.fill : 'none', className: layerClass, d: singlePath })); }; ;// ./node_modules/recharts/es6/polar/PolarAngleAxis.js function PolarAngleAxis_typeof(o) { "@babel/helpers - typeof"; return PolarAngleAxis_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, PolarAngleAxis_typeof(o); } function PolarAngleAxis_extends() { PolarAngleAxis_extends = Object.assign ? Object.assign.bind() : 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; }; return PolarAngleAxis_extends.apply(this, arguments); } function PolarAngleAxis_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function PolarAngleAxis_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? PolarAngleAxis_ownKeys(Object(t), !0).forEach(function (r) { PolarAngleAxis_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : PolarAngleAxis_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function PolarAngleAxis_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function PolarAngleAxis_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, PolarAngleAxis_toPropertyKey(descriptor.key), descriptor); } } function PolarAngleAxis_createClass(Constructor, protoProps, staticProps) { if (protoProps) PolarAngleAxis_defineProperties(Constructor.prototype, protoProps); if (staticProps) PolarAngleAxis_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function PolarAngleAxis_callSuper(t, o, e) { return o = PolarAngleAxis_getPrototypeOf(o), PolarAngleAxis_possibleConstructorReturn(t, PolarAngleAxis_isNativeReflectConstruct() ? Reflect.construct(o, e || [], PolarAngleAxis_getPrototypeOf(t).constructor) : o.apply(t, e)); } function PolarAngleAxis_possibleConstructorReturn(self, call) { if (call && (PolarAngleAxis_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return PolarAngleAxis_assertThisInitialized(self); } function PolarAngleAxis_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function PolarAngleAxis_isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (PolarAngleAxis_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } function PolarAngleAxis_getPrototypeOf(o) { PolarAngleAxis_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return PolarAngleAxis_getPrototypeOf(o); } function PolarAngleAxis_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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) PolarAngleAxis_setPrototypeOf(subClass, superClass); } function PolarAngleAxis_setPrototypeOf(o, p) { PolarAngleAxis_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return PolarAngleAxis_setPrototypeOf(o, p); } function PolarAngleAxis_defineProperty(obj, key, value) { key = PolarAngleAxis_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function PolarAngleAxis_toPropertyKey(t) { var i = PolarAngleAxis_toPrimitive(t, "string"); return "symbol" == PolarAngleAxis_typeof(i) ? i : i + ""; } function PolarAngleAxis_toPrimitive(t, r) { if ("object" != PolarAngleAxis_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != PolarAngleAxis_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /** * @fileOverview Axis of radial direction */ var RADIAN = Math.PI / 180; var eps = 1e-5; var PolarAngleAxis = /*#__PURE__*/function (_PureComponent) { function PolarAngleAxis() { PolarAngleAxis_classCallCheck(this, PolarAngleAxis); return PolarAngleAxis_callSuper(this, PolarAngleAxis, arguments); } PolarAngleAxis_inherits(PolarAngleAxis, _PureComponent); return PolarAngleAxis_createClass(PolarAngleAxis, [{ key: "getTickLineCoord", value: /** * Calculate the coordinate of line endpoint * @param {Object} data The Data if ticks * @return {Object} (x0, y0): The start point of text, * (x1, y1): The end point close to text, * (x2, y2): The end point close to axis */ function getTickLineCoord(data) { var _this$props = this.props, cx = _this$props.cx, cy = _this$props.cy, radius = _this$props.radius, orientation = _this$props.orientation, tickSize = _this$props.tickSize; var tickLineSize = tickSize || 8; var p1 = (0,PolarUtils/* polarToCartesian */.IZ)(cx, cy, radius, data.coordinate); var p2 = (0,PolarUtils/* polarToCartesian */.IZ)(cx, cy, radius + (orientation === 'inner' ? -1 : 1) * tickLineSize, data.coordinate); return { x1: p1.x, y1: p1.y, x2: p2.x, y2: p2.y }; } /** * Get the text-anchor of each tick * @param {Object} data Data of ticks * @return {String} text-anchor */ }, { key: "getTickTextAnchor", value: function getTickTextAnchor(data) { var orientation = this.props.orientation; var cos = Math.cos(-data.coordinate * RADIAN); var textAnchor; if (cos > eps) { textAnchor = orientation === 'outer' ? 'start' : 'end'; } else if (cos < -eps) { textAnchor = orientation === 'outer' ? 'end' : 'start'; } else { textAnchor = 'middle'; } return textAnchor; } }, { key: "renderAxisLine", value: function renderAxisLine() { var _this$props2 = this.props, cx = _this$props2.cx, cy = _this$props2.cy, radius = _this$props2.radius, axisLine = _this$props2.axisLine, axisLineType = _this$props2.axisLineType; var props = PolarAngleAxis_objectSpread(PolarAngleAxis_objectSpread({}, (0,ReactUtils/* filterProps */.J9)(this.props, false)), {}, { fill: 'none' }, (0,ReactUtils/* filterProps */.J9)(axisLine, false)); if (axisLineType === 'circle') { return /*#__PURE__*/react.createElement(Dot, PolarAngleAxis_extends({ className: "recharts-polar-angle-axis-line" }, props, { cx: cx, cy: cy, r: radius })); } var ticks = this.props.ticks; var points = ticks.map(function (entry) { return (0,PolarUtils/* polarToCartesian */.IZ)(cx, cy, radius, entry.coordinate); }); return /*#__PURE__*/react.createElement(Polygon, PolarAngleAxis_extends({ className: "recharts-polar-angle-axis-line" }, props, { points: points })); } }, { key: "renderTicks", value: function renderTicks() { var _this = this; var _this$props3 = this.props, ticks = _this$props3.ticks, tick = _this$props3.tick, tickLine = _this$props3.tickLine, tickFormatter = _this$props3.tickFormatter, stroke = _this$props3.stroke; var axisProps = (0,ReactUtils/* filterProps */.J9)(this.props, false); var customTickProps = (0,ReactUtils/* filterProps */.J9)(tick, false); var tickLineProps = PolarAngleAxis_objectSpread(PolarAngleAxis_objectSpread({}, axisProps), {}, { fill: 'none' }, (0,ReactUtils/* filterProps */.J9)(tickLine, false)); var items = ticks.map(function (entry, i) { var lineCoord = _this.getTickLineCoord(entry); var textAnchor = _this.getTickTextAnchor(entry); var tickProps = PolarAngleAxis_objectSpread(PolarAngleAxis_objectSpread(PolarAngleAxis_objectSpread({ textAnchor: textAnchor }, axisProps), {}, { stroke: 'none', fill: stroke }, customTickProps), {}, { index: i, payload: entry, x: lineCoord.x2, y: lineCoord.y2 }); return /*#__PURE__*/react.createElement(Layer/* Layer */.W, PolarAngleAxis_extends({ className: (0,clsx/* default */.A)('recharts-polar-angle-axis-tick', (0,PolarUtils/* getTickClassName */.Zk)(tick)), key: "tick-".concat(entry.coordinate) }, (0,types/* adaptEventsOfChild */.XC)(_this.props, entry, i)), tickLine && /*#__PURE__*/react.createElement("line", PolarAngleAxis_extends({ className: "recharts-polar-angle-axis-tick-line" }, tickLineProps, lineCoord)), tick && PolarAngleAxis.renderTickItem(tick, tickProps, tickFormatter ? tickFormatter(entry.value, i) : entry.value)); }); return /*#__PURE__*/react.createElement(Layer/* Layer */.W, { className: "recharts-polar-angle-axis-ticks" }, items); } }, { key: "render", value: function render() { var _this$props4 = this.props, ticks = _this$props4.ticks, radius = _this$props4.radius, axisLine = _this$props4.axisLine; if (radius <= 0 || !ticks || !ticks.length) { return null; } return /*#__PURE__*/react.createElement(Layer/* Layer */.W, { className: (0,clsx/* default */.A)('recharts-polar-angle-axis', this.props.className) }, axisLine && this.renderAxisLine(), this.renderTicks()); } }], [{ key: "renderTickItem", value: function renderTickItem(option, props, value) { var tickItem; if ( /*#__PURE__*/react.isValidElement(option)) { tickItem = /*#__PURE__*/react.cloneElement(option, props); } else if (isFunction_default()(option)) { tickItem = option(props); } else { tickItem = /*#__PURE__*/react.createElement(Text/* Text */.E, PolarAngleAxis_extends({}, props, { className: "recharts-polar-angle-axis-tick-value" }), value); } return tickItem; } }]); }(react.PureComponent); PolarAngleAxis_defineProperty(PolarAngleAxis, "displayName", 'PolarAngleAxis'); PolarAngleAxis_defineProperty(PolarAngleAxis, "axisType", 'angleAxis'); PolarAngleAxis_defineProperty(PolarAngleAxis, "defaultProps", { type: 'category', angleAxisId: 0, scale: 'auto', cx: 0, cy: 0, orientation: 'outer', axisLine: true, tickLine: true, tickSize: 8, tick: true, hide: false, allowDuplicatedCategory: true }); // EXTERNAL MODULE: ./node_modules/lodash/maxBy.js var maxBy = __webpack_require__(7551); var maxBy_default = /*#__PURE__*/__webpack_require__.n(maxBy); // EXTERNAL MODULE: ./node_modules/lodash/minBy.js var minBy = __webpack_require__(6533); var minBy_default = /*#__PURE__*/__webpack_require__.n(minBy); ;// ./node_modules/recharts/es6/polar/PolarRadiusAxis.js var PolarRadiusAxis_excluded = ["cx", "cy", "angle", "ticks", "axisLine"], PolarRadiusAxis_excluded2 = ["ticks", "tick", "angle", "tickFormatter", "stroke"]; function PolarRadiusAxis_typeof(o) { "@babel/helpers - typeof"; return PolarRadiusAxis_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, PolarRadiusAxis_typeof(o); } function PolarRadiusAxis_extends() { PolarRadiusAxis_extends = Object.assign ? Object.assign.bind() : 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; }; return PolarRadiusAxis_extends.apply(this, arguments); } function PolarRadiusAxis_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function PolarRadiusAxis_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? PolarRadiusAxis_ownKeys(Object(t), !0).forEach(function (r) { PolarRadiusAxis_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : PolarRadiusAxis_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function PolarRadiusAxis_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = PolarRadiusAxis_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function PolarRadiusAxis_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; } function PolarRadiusAxis_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function PolarRadiusAxis_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, PolarRadiusAxis_toPropertyKey(descriptor.key), descriptor); } } function PolarRadiusAxis_createClass(Constructor, protoProps, staticProps) { if (protoProps) PolarRadiusAxis_defineProperties(Constructor.prototype, protoProps); if (staticProps) PolarRadiusAxis_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function PolarRadiusAxis_callSuper(t, o, e) { return o = PolarRadiusAxis_getPrototypeOf(o), PolarRadiusAxis_possibleConstructorReturn(t, PolarRadiusAxis_isNativeReflectConstruct() ? Reflect.construct(o, e || [], PolarRadiusAxis_getPrototypeOf(t).constructor) : o.apply(t, e)); } function PolarRadiusAxis_possibleConstructorReturn(self, call) { if (call && (PolarRadiusAxis_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return PolarRadiusAxis_assertThisInitialized(self); } function PolarRadiusAxis_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function PolarRadiusAxis_isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (PolarRadiusAxis_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } function PolarRadiusAxis_getPrototypeOf(o) { PolarRadiusAxis_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return PolarRadiusAxis_getPrototypeOf(o); } function PolarRadiusAxis_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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) PolarRadiusAxis_setPrototypeOf(subClass, superClass); } function PolarRadiusAxis_setPrototypeOf(o, p) { PolarRadiusAxis_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return PolarRadiusAxis_setPrototypeOf(o, p); } function PolarRadiusAxis_defineProperty(obj, key, value) { key = PolarRadiusAxis_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function PolarRadiusAxis_toPropertyKey(t) { var i = PolarRadiusAxis_toPrimitive(t, "string"); return "symbol" == PolarRadiusAxis_typeof(i) ? i : i + ""; } function PolarRadiusAxis_toPrimitive(t, r) { if ("object" != PolarRadiusAxis_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != PolarRadiusAxis_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /** * @fileOverview The axis of polar coordinate system */ var PolarRadiusAxis = /*#__PURE__*/function (_PureComponent) { function PolarRadiusAxis() { PolarRadiusAxis_classCallCheck(this, PolarRadiusAxis); return PolarRadiusAxis_callSuper(this, PolarRadiusAxis, arguments); } PolarRadiusAxis_inherits(PolarRadiusAxis, _PureComponent); return PolarRadiusAxis_createClass(PolarRadiusAxis, [{ key: "getTickValueCoord", value: /** * Calculate the coordinate of tick * @param {Number} coordinate The radius of tick * @return {Object} (x, y) */ function getTickValueCoord(_ref) { var coordinate = _ref.coordinate; var _this$props = this.props, angle = _this$props.angle, cx = _this$props.cx, cy = _this$props.cy; return (0,PolarUtils/* polarToCartesian */.IZ)(cx, cy, coordinate, angle); } }, { key: "getTickTextAnchor", value: function getTickTextAnchor() { var orientation = this.props.orientation; var textAnchor; switch (orientation) { case 'left': textAnchor = 'end'; break; case 'right': textAnchor = 'start'; break; default: textAnchor = 'middle'; break; } return textAnchor; } }, { key: "getViewBox", value: function getViewBox() { var _this$props2 = this.props, cx = _this$props2.cx, cy = _this$props2.cy, angle = _this$props2.angle, ticks = _this$props2.ticks; var maxRadiusTick = maxBy_default()(ticks, function (entry) { return entry.coordinate || 0; }); var minRadiusTick = minBy_default()(ticks, function (entry) { return entry.coordinate || 0; }); return { cx: cx, cy: cy, startAngle: angle, endAngle: angle, innerRadius: minRadiusTick.coordinate || 0, outerRadius: maxRadiusTick.coordinate || 0 }; } }, { key: "renderAxisLine", value: function renderAxisLine() { var _this$props3 = this.props, cx = _this$props3.cx, cy = _this$props3.cy, angle = _this$props3.angle, ticks = _this$props3.ticks, axisLine = _this$props3.axisLine, others = PolarRadiusAxis_objectWithoutProperties(_this$props3, PolarRadiusAxis_excluded); var extent = ticks.reduce(function (result, entry) { return [Math.min(result[0], entry.coordinate), Math.max(result[1], entry.coordinate)]; }, [Infinity, -Infinity]); var point0 = (0,PolarUtils/* polarToCartesian */.IZ)(cx, cy, extent[0], angle); var point1 = (0,PolarUtils/* polarToCartesian */.IZ)(cx, cy, extent[1], angle); var props = PolarRadiusAxis_objectSpread(PolarRadiusAxis_objectSpread(PolarRadiusAxis_objectSpread({}, (0,ReactUtils/* filterProps */.J9)(others, false)), {}, { fill: 'none' }, (0,ReactUtils/* filterProps */.J9)(axisLine, false)), {}, { x1: point0.x, y1: point0.y, x2: point1.x, y2: point1.y }); return /*#__PURE__*/react.createElement("line", PolarRadiusAxis_extends({ className: "recharts-polar-radius-axis-line" }, props)); } }, { key: "renderTicks", value: function renderTicks() { var _this = this; var _this$props4 = this.props, ticks = _this$props4.ticks, tick = _this$props4.tick, angle = _this$props4.angle, tickFormatter = _this$props4.tickFormatter, stroke = _this$props4.stroke, others = PolarRadiusAxis_objectWithoutProperties(_this$props4, PolarRadiusAxis_excluded2); var textAnchor = this.getTickTextAnchor(); var axisProps = (0,ReactUtils/* filterProps */.J9)(others, false); var customTickProps = (0,ReactUtils/* filterProps */.J9)(tick, false); var items = ticks.map(function (entry, i) { var coord = _this.getTickValueCoord(entry); var tickProps = PolarRadiusAxis_objectSpread(PolarRadiusAxis_objectSpread(PolarRadiusAxis_objectSpread(PolarRadiusAxis_objectSpread({ textAnchor: textAnchor, transform: "rotate(".concat(90 - angle, ", ").concat(coord.x, ", ").concat(coord.y, ")") }, axisProps), {}, { stroke: 'none', fill: stroke }, customTickProps), {}, { index: i }, coord), {}, { payload: entry }); return /*#__PURE__*/react.createElement(Layer/* Layer */.W, PolarRadiusAxis_extends({ className: (0,clsx/* default */.A)('recharts-polar-radius-axis-tick', (0,PolarUtils/* getTickClassName */.Zk)(tick)), key: "tick-".concat(entry.coordinate) }, (0,types/* adaptEventsOfChild */.XC)(_this.props, entry, i)), PolarRadiusAxis.renderTickItem(tick, tickProps, tickFormatter ? tickFormatter(entry.value, i) : entry.value)); }); return /*#__PURE__*/react.createElement(Layer/* Layer */.W, { className: "recharts-polar-radius-axis-ticks" }, items); } }, { key: "render", value: function render() { var _this$props5 = this.props, ticks = _this$props5.ticks, axisLine = _this$props5.axisLine, tick = _this$props5.tick; if (!ticks || !ticks.length) { return null; } return /*#__PURE__*/react.createElement(Layer/* Layer */.W, { className: (0,clsx/* default */.A)('recharts-polar-radius-axis', this.props.className) }, axisLine && this.renderAxisLine(), tick && this.renderTicks(), Label/* Label */.J.renderCallByParent(this.props, this.getViewBox())); } }], [{ key: "renderTickItem", value: function renderTickItem(option, props, value) { var tickItem; if ( /*#__PURE__*/react.isValidElement(option)) { tickItem = /*#__PURE__*/react.cloneElement(option, props); } else if (isFunction_default()(option)) { tickItem = option(props); } else { tickItem = /*#__PURE__*/react.createElement(Text/* Text */.E, PolarRadiusAxis_extends({}, props, { className: "recharts-polar-radius-axis-tick-value" }), value); } return tickItem; } }]); }(react.PureComponent); PolarRadiusAxis_defineProperty(PolarRadiusAxis, "displayName", 'PolarRadiusAxis'); PolarRadiusAxis_defineProperty(PolarRadiusAxis, "axisType", 'radiusAxis'); PolarRadiusAxis_defineProperty(PolarRadiusAxis, "defaultProps", { type: 'number', radiusAxisId: 0, cx: 0, cy: 0, angle: 0, orientation: 'right', stroke: '#ccc', axisLine: true, tick: true, tickCount: 5, allowDataOverflow: false, scale: 'auto', allowDuplicatedCategory: true }); // EXTERNAL MODULE: ./node_modules/recharts/es6/polar/Pie.js + 1 modules var Pie = __webpack_require__(2954); ;// ./node_modules/recharts/es6/chart/PieChart.js /** * @fileOverview Pie Chart */ var PieChart = generateCategoricalChart({ chartName: 'PieChart', GraphicalChild: Pie/* Pie */.F, validateTooltipEventTypes: ['item'], defaultTooltipEventType: 'item', legendContent: 'children', axisComponents: [{ axisType: 'angleAxis', AxisComp: PolarAngleAxis }, { axisType: 'radiusAxis', AxisComp: PolarRadiusAxis }], formatAxisMap: PolarUtils/* formatAxisMap */.pr, defaultProps: { layout: 'centric', startAngle: 0, endAngle: 360, cx: '50%', cy: '50%', innerRadius: 0, outerRadius: '80%' } }); /***/ }), /***/ 5056: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; /* istanbul ignore next */ function setAttributesWithoutAttributes(styleElement) { var nonce = true ? __webpack_require__.nc : 0; if (nonce) { styleElement.setAttribute("nonce", nonce); } } module.exports = setAttributesWithoutAttributes; /***/ }), /***/ 5072: /***/ ((module) => { "use strict"; var stylesInDOM = []; function getIndexByIdentifier(identifier) { var result = -1; for (var i = 0; i < stylesInDOM.length; i++) { if (stylesInDOM[i].identifier === identifier) { result = i; break; } } return result; } function modulesToDom(list, options) { var idCountMap = {}; var identifiers = []; for (var i = 0; i < list.length; i++) { var item = list[i]; var id = options.base ? item[0] + options.base : item[0]; var count = idCountMap[id] || 0; var identifier = "".concat(id, " ").concat(count); idCountMap[id] = count + 1; var indexByIdentifier = getIndexByIdentifier(identifier); var obj = { css: item[1], media: item[2], sourceMap: item[3], supports: item[4], layer: item[5] }; if (indexByIdentifier !== -1) { stylesInDOM[indexByIdentifier].references++; stylesInDOM[indexByIdentifier].updater(obj); } else { var updater = addElementStyle(obj, options); options.byIndex = i; stylesInDOM.splice(i, 0, { identifier: identifier, updater: updater, references: 1 }); } identifiers.push(identifier); } return identifiers; } function addElementStyle(obj, options) { var api = options.domAPI(options); api.update(obj); var updater = function updater(newObj) { if (newObj) { if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) { return; } api.update(obj = newObj); } else { api.remove(); } }; return updater; } module.exports = function (list, options) { options = options || {}; list = list || []; var lastIdentifiers = modulesToDom(list, options); return function update(newList) { newList = newList || []; for (var i = 0; i < lastIdentifiers.length; i++) { var identifier = lastIdentifiers[i]; var index = getIndexByIdentifier(identifier); stylesInDOM[index].references--; } var newLastIdentifiers = modulesToDom(newList, options); for (var _i = 0; _i < lastIdentifiers.length; _i++) { var _identifier = lastIdentifiers[_i]; var _index = getIndexByIdentifier(_identifier); if (stylesInDOM[_index].references === 0) { stylesInDOM[_index].updater(); stylesInDOM.splice(_index, 1); } } lastIdentifiers = newLastIdentifiers; }; }; /***/ }), /***/ 5079: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { yp: () => (/* binding */ Shape), GG: () => (/* binding */ getActiveShapeIndexForTooltip), NE: () => (/* binding */ isFunnel), nZ: () => (/* binding */ isPie), xQ: () => (/* binding */ isScatter) }); // UNUSED EXPORTS: compareFunnel, comparePie, compareScatter, getPropsFromShapeOption // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(6540); // EXTERNAL MODULE: ./node_modules/lodash/isFunction.js var isFunction = __webpack_require__(1882); var isFunction_default = /*#__PURE__*/__webpack_require__.n(isFunction); // EXTERNAL MODULE: ./node_modules/lodash/isPlainObject.js var isPlainObject = __webpack_require__(1331); var isPlainObject_default = /*#__PURE__*/__webpack_require__.n(isPlainObject); // EXTERNAL MODULE: ./node_modules/lodash/isBoolean.js var isBoolean = __webpack_require__(3812); var isBoolean_default = /*#__PURE__*/__webpack_require__.n(isBoolean); // EXTERNAL MODULE: ./node_modules/lodash/isEqual.js var isEqual = __webpack_require__(2404); var isEqual_default = /*#__PURE__*/__webpack_require__.n(isEqual); // EXTERNAL MODULE: ./node_modules/recharts/es6/shape/Rectangle.js var Rectangle = __webpack_require__(4723); // EXTERNAL MODULE: ./node_modules/recharts/node_modules/clsx/dist/clsx.mjs var clsx = __webpack_require__(8804); // EXTERNAL MODULE: ./node_modules/react-smooth/es6/index.js + 6 modules var es6 = __webpack_require__(7011); // EXTERNAL MODULE: ./node_modules/recharts/es6/util/ReactUtils.js var ReactUtils = __webpack_require__(4501); ;// ./node_modules/recharts/es6/shape/Trapezoid.js function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /** * @fileOverview Rectangle */ var getTrapezoidPath = function getTrapezoidPath(x, y, upperWidth, lowerWidth, height) { var widthGap = upperWidth - lowerWidth; var path; path = "M ".concat(x, ",").concat(y); path += "L ".concat(x + upperWidth, ",").concat(y); path += "L ".concat(x + upperWidth - widthGap / 2, ",").concat(y + height); path += "L ".concat(x + upperWidth - widthGap / 2 - lowerWidth, ",").concat(y + height); path += "L ".concat(x, ",").concat(y, " Z"); return path; }; var defaultProps = { x: 0, y: 0, upperWidth: 0, lowerWidth: 0, height: 0, isUpdateAnimationActive: false, animationBegin: 0, animationDuration: 1500, animationEasing: 'ease' }; var Trapezoid = function Trapezoid(props) { var trapezoidProps = _objectSpread(_objectSpread({}, defaultProps), props); var pathRef = (0,react.useRef)(); var _useState = (0,react.useState)(-1), _useState2 = _slicedToArray(_useState, 2), totalLength = _useState2[0], setTotalLength = _useState2[1]; (0,react.useEffect)(function () { if (pathRef.current && pathRef.current.getTotalLength) { try { var pathTotalLength = pathRef.current.getTotalLength(); if (pathTotalLength) { setTotalLength(pathTotalLength); } } catch (err) { // calculate total length error } } }, []); var x = trapezoidProps.x, y = trapezoidProps.y, upperWidth = trapezoidProps.upperWidth, lowerWidth = trapezoidProps.lowerWidth, height = trapezoidProps.height, className = trapezoidProps.className; var animationEasing = trapezoidProps.animationEasing, animationDuration = trapezoidProps.animationDuration, animationBegin = trapezoidProps.animationBegin, isUpdateAnimationActive = trapezoidProps.isUpdateAnimationActive; if (x !== +x || y !== +y || upperWidth !== +upperWidth || lowerWidth !== +lowerWidth || height !== +height || upperWidth === 0 && lowerWidth === 0 || height === 0) { return null; } var layerClass = (0,clsx/* default */.A)('recharts-trapezoid', className); if (!isUpdateAnimationActive) { return /*#__PURE__*/react.createElement("g", null, /*#__PURE__*/react.createElement("path", _extends({}, (0,ReactUtils/* filterProps */.J9)(trapezoidProps, true), { className: layerClass, d: getTrapezoidPath(x, y, upperWidth, lowerWidth, height) }))); } return /*#__PURE__*/react.createElement(es6/* default */.Ay, { canBegin: totalLength > 0, from: { upperWidth: 0, lowerWidth: 0, height: height, x: x, y: y }, to: { upperWidth: upperWidth, lowerWidth: lowerWidth, height: height, x: x, y: y }, duration: animationDuration, animationEasing: animationEasing, isActive: isUpdateAnimationActive }, function (_ref) { var currUpperWidth = _ref.upperWidth, currLowerWidth = _ref.lowerWidth, currHeight = _ref.height, currX = _ref.x, currY = _ref.y; return /*#__PURE__*/react.createElement(es6/* default */.Ay, { canBegin: totalLength > 0, from: "0px ".concat(totalLength === -1 ? 1 : totalLength, "px"), to: "".concat(totalLength, "px 0px"), attributeName: "strokeDasharray", begin: animationBegin, duration: animationDuration, easing: animationEasing }, /*#__PURE__*/react.createElement("path", _extends({}, (0,ReactUtils/* filterProps */.J9)(trapezoidProps, true), { className: layerClass, d: getTrapezoidPath(currX, currY, currUpperWidth, currLowerWidth, currHeight), ref: pathRef }))); }); }; // EXTERNAL MODULE: ./node_modules/recharts/es6/shape/Sector.js var Sector = __webpack_require__(8522); // EXTERNAL MODULE: ./node_modules/recharts/es6/container/Layer.js var Layer = __webpack_require__(6069); // EXTERNAL MODULE: ./node_modules/recharts/es6/shape/Symbols.js var Symbols = __webpack_require__(5787); ;// ./node_modules/recharts/es6/util/ActiveShapeUtils.js var _excluded = ["option", "shapeType", "propTransformer", "activeClassName", "isActive"]; function ActiveShapeUtils_typeof(o) { "@babel/helpers - typeof"; return ActiveShapeUtils_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, ActiveShapeUtils_typeof(o); } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; } function ActiveShapeUtils_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function ActiveShapeUtils_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ActiveShapeUtils_ownKeys(Object(t), !0).forEach(function (r) { ActiveShapeUtils_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ActiveShapeUtils_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function ActiveShapeUtils_defineProperty(obj, key, value) { key = ActiveShapeUtils_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function ActiveShapeUtils_toPropertyKey(t) { var i = ActiveShapeUtils_toPrimitive(t, "string"); return "symbol" == ActiveShapeUtils_typeof(i) ? i : i + ""; } function ActiveShapeUtils_toPrimitive(t, r) { if ("object" != ActiveShapeUtils_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != ActiveShapeUtils_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /** * This is an abstraction for rendering a user defined prop for a customized shape in several forms. * * is the root and will handle taking in: * - an object of svg properties * - a boolean * - a render prop(inline function that returns jsx) * - a react element * * is a subcomponent of and used to match a component * to the value of props.shapeType that is passed to the root. * */ function defaultPropTransformer(option, props) { return ActiveShapeUtils_objectSpread(ActiveShapeUtils_objectSpread({}, props), option); } function isSymbolsProps(shapeType, _elementProps) { return shapeType === 'symbols'; } function ShapeSelector(_ref) { var shapeType = _ref.shapeType, elementProps = _ref.elementProps; switch (shapeType) { case 'rectangle': return /*#__PURE__*/react.createElement(Rectangle/* Rectangle */.M, elementProps); case 'trapezoid': return /*#__PURE__*/react.createElement(Trapezoid, elementProps); case 'sector': return /*#__PURE__*/react.createElement(Sector/* Sector */.h, elementProps); case 'symbols': if (isSymbolsProps(shapeType, elementProps)) { return /*#__PURE__*/react.createElement(Symbols/* Symbols */.i, elementProps); } break; default: return null; } } function getPropsFromShapeOption(option) { if ( /*#__PURE__*/(0,react.isValidElement)(option)) { return option.props; } return option; } function Shape(_ref2) { var option = _ref2.option, shapeType = _ref2.shapeType, _ref2$propTransformer = _ref2.propTransformer, propTransformer = _ref2$propTransformer === void 0 ? defaultPropTransformer : _ref2$propTransformer, _ref2$activeClassName = _ref2.activeClassName, activeClassName = _ref2$activeClassName === void 0 ? 'recharts-active-shape' : _ref2$activeClassName, isActive = _ref2.isActive, props = _objectWithoutProperties(_ref2, _excluded); var shape; if ( /*#__PURE__*/(0,react.isValidElement)(option)) { shape = /*#__PURE__*/(0,react.cloneElement)(option, ActiveShapeUtils_objectSpread(ActiveShapeUtils_objectSpread({}, props), getPropsFromShapeOption(option))); } else if (isFunction_default()(option)) { shape = option(props); } else if (isPlainObject_default()(option) && !isBoolean_default()(option)) { var nextProps = propTransformer(option, props); shape = /*#__PURE__*/react.createElement(ShapeSelector, { shapeType: shapeType, elementProps: nextProps }); } else { var elementProps = props; shape = /*#__PURE__*/react.createElement(ShapeSelector, { shapeType: shapeType, elementProps: elementProps }); } if (isActive) { return /*#__PURE__*/react.createElement(Layer/* Layer */.W, { className: activeClassName }, shape); } return shape; } /** * This is an abstraction to handle identifying the active index from a tooltip mouse interaction */ function isFunnel(graphicalItem, _item) { return _item != null && 'trapezoids' in graphicalItem.props; } function isPie(graphicalItem, _item) { return _item != null && 'sectors' in graphicalItem.props; } function isScatter(graphicalItem, _item) { return _item != null && 'points' in graphicalItem.props; } function compareFunnel(shapeData, activeTooltipItem) { var _activeTooltipItem$la, _activeTooltipItem$la2; var xMatches = shapeData.x === (activeTooltipItem === null || activeTooltipItem === void 0 || (_activeTooltipItem$la = activeTooltipItem.labelViewBox) === null || _activeTooltipItem$la === void 0 ? void 0 : _activeTooltipItem$la.x) || shapeData.x === activeTooltipItem.x; var yMatches = shapeData.y === (activeTooltipItem === null || activeTooltipItem === void 0 || (_activeTooltipItem$la2 = activeTooltipItem.labelViewBox) === null || _activeTooltipItem$la2 === void 0 ? void 0 : _activeTooltipItem$la2.y) || shapeData.y === activeTooltipItem.y; return xMatches && yMatches; } function comparePie(shapeData, activeTooltipItem) { var startAngleMatches = shapeData.endAngle === activeTooltipItem.endAngle; var endAngleMatches = shapeData.startAngle === activeTooltipItem.startAngle; return startAngleMatches && endAngleMatches; } function compareScatter(shapeData, activeTooltipItem) { var xMatches = shapeData.x === activeTooltipItem.x; var yMatches = shapeData.y === activeTooltipItem.y; var zMatches = shapeData.z === activeTooltipItem.z; return xMatches && yMatches && zMatches; } function getComparisonFn(graphicalItem, activeItem) { var comparison; if (isFunnel(graphicalItem, activeItem)) { comparison = compareFunnel; } else if (isPie(graphicalItem, activeItem)) { comparison = comparePie; } else if (isScatter(graphicalItem, activeItem)) { comparison = compareScatter; } return comparison; } function getShapeDataKey(graphicalItem, activeItem) { var shapeKey; if (isFunnel(graphicalItem, activeItem)) { shapeKey = 'trapezoids'; } else if (isPie(graphicalItem, activeItem)) { shapeKey = 'sectors'; } else if (isScatter(graphicalItem, activeItem)) { shapeKey = 'points'; } return shapeKey; } function getActiveShapeTooltipPayload(graphicalItem, activeItem) { if (isFunnel(graphicalItem, activeItem)) { var _activeItem$tooltipPa; return (_activeItem$tooltipPa = activeItem.tooltipPayload) === null || _activeItem$tooltipPa === void 0 || (_activeItem$tooltipPa = _activeItem$tooltipPa[0]) === null || _activeItem$tooltipPa === void 0 || (_activeItem$tooltipPa = _activeItem$tooltipPa.payload) === null || _activeItem$tooltipPa === void 0 ? void 0 : _activeItem$tooltipPa.payload; } if (isPie(graphicalItem, activeItem)) { var _activeItem$tooltipPa2; return (_activeItem$tooltipPa2 = activeItem.tooltipPayload) === null || _activeItem$tooltipPa2 === void 0 || (_activeItem$tooltipPa2 = _activeItem$tooltipPa2[0]) === null || _activeItem$tooltipPa2 === void 0 || (_activeItem$tooltipPa2 = _activeItem$tooltipPa2.payload) === null || _activeItem$tooltipPa2 === void 0 ? void 0 : _activeItem$tooltipPa2.payload; } if (isScatter(graphicalItem, activeItem)) { return activeItem.payload; } return {}; } /** * * @param {GetActiveShapeIndexForTooltip} arg an object of incoming attributes from Tooltip * @returns {number} * * To handle possible duplicates in the data set, * match both the data value of the active item to a data value on a graph item, * and match the mouse coordinates of the active item to the coordinates of in a particular components shape data. * This assumes equal lengths of shape objects to data items. */ function getActiveShapeIndexForTooltip(_ref3) { var activeTooltipItem = _ref3.activeTooltipItem, graphicalItem = _ref3.graphicalItem, itemData = _ref3.itemData; var shapeKey = getShapeDataKey(graphicalItem, activeTooltipItem); var tooltipPayload = getActiveShapeTooltipPayload(graphicalItem, activeTooltipItem); var activeItemMatches = itemData.filter(function (datum, dataIndex) { var valuesMatch = isEqual_default()(tooltipPayload, datum); var mouseCoordinateMatches = graphicalItem.props[shapeKey].filter(function (shapeData) { var comparison = getComparisonFn(graphicalItem, activeTooltipItem); return comparison(shapeData, activeTooltipItem); }); // get the last index in case of multiple matches var indexOfMouseCoordinates = graphicalItem.props[shapeKey].indexOf(mouseCoordinateMatches[mouseCoordinateMatches.length - 1]); var coordinatesMatch = dataIndex === indexOfMouseCoordinates; return valuesMatch && coordinatesMatch; }); // get the last index in case of multiple matches var activeIndex = itemData.indexOf(activeItemMatches[activeItemMatches.length - 1]); return activeIndex; } /***/ }), /***/ 5249: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ I: () => (/* binding */ Curve) /* harmony export */ }); /* unused harmony export getPath */ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6540); /* harmony import */ var victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6806); /* harmony import */ var victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4621); /* harmony import */ var victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(8134); /* harmony import */ var victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(6422); /* harmony import */ var victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(3895); /* harmony import */ var victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(6343); /* harmony import */ var victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(1253); /* harmony import */ var victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(4537); /* harmony import */ var victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(5836); /* harmony import */ var victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(4439); /* harmony import */ var victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(8640); /* harmony import */ var lodash_upperFirst__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5808); /* harmony import */ var lodash_upperFirst__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_upperFirst__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var lodash_isFunction__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1882); /* harmony import */ var lodash_isFunction__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_isFunction__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(8804); /* harmony import */ var _util_types__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(8940); /* harmony import */ var _util_ReactUtils__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(4501); /* harmony import */ var _util_DataUtils__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(9744); function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); } function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /** * @fileOverview Curve */ var CURVE_FACTORIES = { curveBasisClosed: victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A, curveBasisOpen: victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A, curveBasis: victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Ay, curveBumpX: victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_6__/* .bumpX */ .dJ, curveBumpY: victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_6__/* .bumpY */ .kl, curveLinearClosed: victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .A, curveLinear: victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .A, curveMonotoneX: victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_9__/* .monotoneX */ .G, curveMonotoneY: victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_9__/* .monotoneY */ .N, curveNatural: victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .A, curveStep: victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Ay, curveStepAfter: victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_11__/* .stepAfter */ .Ps, curveStepBefore: victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_11__/* .stepBefore */ .Ko }; var defined = function defined(p) { return p.x === +p.x && p.y === +p.y; }; var getX = function getX(p) { return p.x; }; var getY = function getY(p) { return p.y; }; var getCurveFactory = function getCurveFactory(type, layout) { if (lodash_isFunction__WEBPACK_IMPORTED_MODULE_2___default()(type)) { return type; } var name = "curve".concat(lodash_upperFirst__WEBPACK_IMPORTED_MODULE_1___default()(type)); if ((name === 'curveMonotone' || name === 'curveBump') && layout) { return CURVE_FACTORIES["".concat(name).concat(layout === 'vertical' ? 'Y' : 'X')]; } return CURVE_FACTORIES[name] || victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .A; }; /** * Calculate the path of curve. Returns null if points is an empty array. * @return path or null */ var getPath = function getPath(_ref) { var _ref$type = _ref.type, type = _ref$type === void 0 ? 'linear' : _ref$type, _ref$points = _ref.points, points = _ref$points === void 0 ? [] : _ref$points, baseLine = _ref.baseLine, layout = _ref.layout, _ref$connectNulls = _ref.connectNulls, connectNulls = _ref$connectNulls === void 0 ? false : _ref$connectNulls; var curveFactory = getCurveFactory(type, layout); var formatPoints = connectNulls ? points.filter(function (entry) { return defined(entry); }) : points; var lineFunction; if (Array.isArray(baseLine)) { var formatBaseLine = connectNulls ? baseLine.filter(function (base) { return defined(base); }) : baseLine; var areaPoints = formatPoints.map(function (entry, index) { return _objectSpread(_objectSpread({}, entry), {}, { base: formatBaseLine[index] }); }); if (layout === 'vertical') { lineFunction = (0,victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .A)().y(getY).x1(getX).x0(function (d) { return d.base.x; }); } else { lineFunction = (0,victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .A)().x(getX).y1(getY).y0(function (d) { return d.base.y; }); } lineFunction.defined(defined).curve(curveFactory); return lineFunction(areaPoints); } if (layout === 'vertical' && (0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_13__/* .isNumber */ .Et)(baseLine)) { lineFunction = (0,victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .A)().y(getY).x1(getX).x0(baseLine); } else if ((0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_13__/* .isNumber */ .Et)(baseLine)) { lineFunction = (0,victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .A)().x(getX).y1(getY).y0(baseLine); } else { lineFunction = (0,victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .A)().x(getX).y(getY); } lineFunction.defined(defined).curve(curveFactory); return lineFunction(formatPoints); }; var Curve = function Curve(props) { var className = props.className, points = props.points, path = props.path, pathRef = props.pathRef; if ((!points || !points.length) && !path) { return null; } var realPath = points && points.length ? getPath(props) : path; return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", _extends({}, (0,_util_ReactUtils__WEBPACK_IMPORTED_MODULE_15__/* .filterProps */ .J9)(props, false), (0,_util_types__WEBPACK_IMPORTED_MODULE_16__/* .adaptEventHandlers */ ._U)(props), { className: (0,clsx__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .A)('recharts-curve', className), d: realPath, ref: pathRef })); }; /***/ }), /***/ 5588: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ AO: () => (/* binding */ createPath), /* harmony export */ B6: () => (/* binding */ matchPath), /* harmony export */ Gh: () => (/* binding */ resolveTo), /* harmony export */ HS: () => (/* binding */ joinPaths), /* harmony export */ Oi: () => (/* binding */ invariant), /* harmony export */ Rr: () => (/* binding */ parsePath), /* harmony export */ pX: () => (/* binding */ isRouteErrorResponse), /* harmony export */ pb: () => (/* binding */ stripBasename), /* harmony export */ rc: () => (/* binding */ Action), /* harmony export */ tH: () => (/* binding */ AbortedDeferredError), /* harmony export */ ue: () => (/* binding */ matchRoutes), /* harmony export */ yD: () => (/* binding */ getResolveToMatches), /* harmony export */ zR: () => (/* binding */ createBrowserHistory) /* harmony export */ }); /* unused harmony exports IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, UNSAFE_DEFERRED_SYMBOL, UNSAFE_DeferredData, UNSAFE_ErrorResponseImpl, UNSAFE_convertRouteMatchToUiMatch, UNSAFE_convertRoutesToDataRoutes, UNSAFE_decodePath, UNSAFE_warning, createHashHistory, createMemoryHistory, createRouter, createStaticHandler, data, defer, generatePath, getStaticContextFromError, getToPathname, isDataWithResponseInit, isDeferredData, json, normalizePathname, redirect, redirectDocument, replace, resolvePath */ /** * @remix-run/router v1.23.0 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); } //////////////////////////////////////////////////////////////////////////////// //#region Types and Constants //////////////////////////////////////////////////////////////////////////////// /** * Actions represent the type of change to a location value. */ var Action; (function (Action) { /** * A POP indicates a change to an arbitrary index in the history stack, such * as a back or forward navigation. It does not describe the direction of the * navigation, only that the current index changed. * * Note: This is the default action for newly created history objects. */ Action["Pop"] = "POP"; /** * A PUSH indicates a new entry being added to the history stack, such as when * a link is clicked and a new page loads. When this happens, all subsequent * entries in the stack are lost. */ Action["Push"] = "PUSH"; /** * A REPLACE indicates the entry at the current index in the history stack * being replaced by a new one. */ Action["Replace"] = "REPLACE"; })(Action || (Action = {})); const PopStateEventType = "popstate"; /** * Memory history stores the current location in memory. It is designed for use * in stateful non-browser environments like tests and React Native. */ function createMemoryHistory(options) { if (options === void 0) { options = {}; } let { initialEntries = ["/"], initialIndex, v5Compat = false } = options; let entries; // Declare so we can access from createMemoryLocation entries = initialEntries.map((entry, index) => createMemoryLocation(entry, typeof entry === "string" ? null : entry.state, index === 0 ? "default" : undefined)); let index = clampIndex(initialIndex == null ? entries.length - 1 : initialIndex); let action = Action.Pop; let listener = null; function clampIndex(n) { return Math.min(Math.max(n, 0), entries.length - 1); } function getCurrentLocation() { return entries[index]; } function createMemoryLocation(to, state, key) { if (state === void 0) { state = null; } let location = createLocation(entries ? getCurrentLocation().pathname : "/", to, state, key); warning(location.pathname.charAt(0) === "/", "relative pathnames are not supported in memory history: " + JSON.stringify(to)); return location; } function createHref(to) { return typeof to === "string" ? to : createPath(to); } let history = { get index() { return index; }, get action() { return action; }, get location() { return getCurrentLocation(); }, createHref, createURL(to) { return new URL(createHref(to), "http://localhost"); }, encodeLocation(to) { let path = typeof to === "string" ? parsePath(to) : to; return { pathname: path.pathname || "", search: path.search || "", hash: path.hash || "" }; }, push(to, state) { action = Action.Push; let nextLocation = createMemoryLocation(to, state); index += 1; entries.splice(index, entries.length, nextLocation); if (v5Compat && listener) { listener({ action, location: nextLocation, delta: 1 }); } }, replace(to, state) { action = Action.Replace; let nextLocation = createMemoryLocation(to, state); entries[index] = nextLocation; if (v5Compat && listener) { listener({ action, location: nextLocation, delta: 0 }); } }, go(delta) { action = Action.Pop; let nextIndex = clampIndex(index + delta); let nextLocation = entries[nextIndex]; index = nextIndex; if (listener) { listener({ action, location: nextLocation, delta }); } }, listen(fn) { listener = fn; return () => { listener = null; }; } }; return history; } /** * Browser history stores the location in regular URLs. This is the standard for * most web apps, but it requires some configuration on the server to ensure you * serve the same app at multiple URLs. * * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory */ function createBrowserHistory(options) { if (options === void 0) { options = {}; } function createBrowserLocation(window, globalHistory) { let { pathname, search, hash } = window.location; return createLocation("", { pathname, search, hash }, // state defaults to `null` because `window.history.state` does globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || "default"); } function createBrowserHref(window, to) { return typeof to === "string" ? to : createPath(to); } return getUrlBasedHistory(createBrowserLocation, createBrowserHref, null, options); } /** * Hash history stores the location in window.location.hash. This makes it ideal * for situations where you don't want to send the location to the server for * some reason, either because you do cannot configure it or the URL space is * reserved for something else. * * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory */ function createHashHistory(options) { if (options === void 0) { options = {}; } function createHashLocation(window, globalHistory) { let { pathname = "/", search = "", hash = "" } = parsePath(window.location.hash.substr(1)); // Hash URL should always have a leading / just like window.location.pathname // does, so if an app ends up at a route like /#something then we add a // leading slash so all of our path-matching behaves the same as if it would // in a browser router. This is particularly important when there exists a // root splat route () since that matches internally against // "/*" and we'd expect /#something to 404 in a hash router app. if (!pathname.startsWith("/") && !pathname.startsWith(".")) { pathname = "/" + pathname; } return createLocation("", { pathname, search, hash }, // state defaults to `null` because `window.history.state` does globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || "default"); } function createHashHref(window, to) { let base = window.document.querySelector("base"); let href = ""; if (base && base.getAttribute("href")) { let url = window.location.href; let hashIndex = url.indexOf("#"); href = hashIndex === -1 ? url : url.slice(0, hashIndex); } return href + "#" + (typeof to === "string" ? to : createPath(to)); } function validateHashLocation(location, to) { warning(location.pathname.charAt(0) === "/", "relative pathnames are not supported in hash history.push(" + JSON.stringify(to) + ")"); } return getUrlBasedHistory(createHashLocation, createHashHref, validateHashLocation, options); } function invariant(value, message) { if (value === false || value === null || typeof value === "undefined") { throw new Error(message); } } function warning(cond, message) { if (!cond) { // eslint-disable-next-line no-console if (typeof console !== "undefined") console.warn(message); try { // Welcome to debugging history! // // This error is thrown as a convenience, so you can more easily // find the source for a warning that appears in the console by // enabling "pause on exceptions" in your JavaScript debugger. throw new Error(message); // eslint-disable-next-line no-empty } catch (e) {} } } function createKey() { return Math.random().toString(36).substr(2, 8); } /** * For browser-based histories, we combine the state and key into an object */ function getHistoryState(location, index) { return { usr: location.state, key: location.key, idx: index }; } /** * Creates a Location object with a unique key from the given Path */ function createLocation(current, to, state, key) { if (state === void 0) { state = null; } let location = _extends({ pathname: typeof current === "string" ? current : current.pathname, search: "", hash: "" }, typeof to === "string" ? parsePath(to) : to, { state, // TODO: This could be cleaned up. push/replace should probably just take // full Locations now and avoid the need to run through this flow at all // But that's a pretty big refactor to the current test suite so going to // keep as is for the time being and just let any incoming keys take precedence key: to && to.key || key || createKey() }); return location; } /** * Creates a string URL path from the given pathname, search, and hash components. */ function createPath(_ref) { let { pathname = "/", search = "", hash = "" } = _ref; if (search && search !== "?") pathname += search.charAt(0) === "?" ? search : "?" + search; if (hash && hash !== "#") pathname += hash.charAt(0) === "#" ? hash : "#" + hash; return pathname; } /** * Parses a string URL path into its separate pathname, search, and hash components. */ function parsePath(path) { let parsedPath = {}; if (path) { let hashIndex = path.indexOf("#"); if (hashIndex >= 0) { parsedPath.hash = path.substr(hashIndex); path = path.substr(0, hashIndex); } let searchIndex = path.indexOf("?"); if (searchIndex >= 0) { parsedPath.search = path.substr(searchIndex); path = path.substr(0, searchIndex); } if (path) { parsedPath.pathname = path; } } return parsedPath; } function getUrlBasedHistory(getLocation, createHref, validateLocation, options) { if (options === void 0) { options = {}; } let { window = document.defaultView, v5Compat = false } = options; let globalHistory = window.history; let action = Action.Pop; let listener = null; let index = getIndex(); // Index should only be null when we initialize. If not, it's because the // user called history.pushState or history.replaceState directly, in which // case we should log a warning as it will result in bugs. if (index == null) { index = 0; globalHistory.replaceState(_extends({}, globalHistory.state, { idx: index }), ""); } function getIndex() { let state = globalHistory.state || { idx: null }; return state.idx; } function handlePop() { action = Action.Pop; let nextIndex = getIndex(); let delta = nextIndex == null ? null : nextIndex - index; index = nextIndex; if (listener) { listener({ action, location: history.location, delta }); } } function push(to, state) { action = Action.Push; let location = createLocation(history.location, to, state); if (validateLocation) validateLocation(location, to); index = getIndex() + 1; let historyState = getHistoryState(location, index); let url = history.createHref(location); // try...catch because iOS limits us to 100 pushState calls :/ try { globalHistory.pushState(historyState, "", url); } catch (error) { // If the exception is because `state` can't be serialized, let that throw // outwards just like a replace call would so the dev knows the cause // https://html.spec.whatwg.org/multipage/nav-history-apis.html#shared-history-push/replace-state-steps // https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal if (error instanceof DOMException && error.name === "DataCloneError") { throw error; } // They are going to lose state here, but there is no real // way to warn them about it since the page will refresh... window.location.assign(url); } if (v5Compat && listener) { listener({ action, location: history.location, delta: 1 }); } } function replace(to, state) { action = Action.Replace; let location = createLocation(history.location, to, state); if (validateLocation) validateLocation(location, to); index = getIndex(); let historyState = getHistoryState(location, index); let url = history.createHref(location); globalHistory.replaceState(historyState, "", url); if (v5Compat && listener) { listener({ action, location: history.location, delta: 0 }); } } function createURL(to) { // window.location.origin is "null" (the literal string value) in Firefox // under certain conditions, notably when serving from a local HTML file // See https://bugzilla.mozilla.org/show_bug.cgi?id=878297 let base = window.location.origin !== "null" ? window.location.origin : window.location.href; let href = typeof to === "string" ? to : createPath(to); // Treating this as a full URL will strip any trailing spaces so we need to // pre-encode them since they might be part of a matching splat param from // an ancestor route href = href.replace(/ $/, "%20"); invariant(base, "No window.location.(origin|href) available to create URL for href: " + href); return new URL(href, base); } let history = { get action() { return action; }, get location() { return getLocation(window, globalHistory); }, listen(fn) { if (listener) { throw new Error("A history only accepts one active listener"); } window.addEventListener(PopStateEventType, handlePop); listener = fn; return () => { window.removeEventListener(PopStateEventType, handlePop); listener = null; }; }, createHref(to) { return createHref(window, to); }, createURL, encodeLocation(to) { // Encode a Location the same way window.location would let url = createURL(to); return { pathname: url.pathname, search: url.search, hash: url.hash }; }, push, replace, go(n) { return globalHistory.go(n); } }; return history; } //#endregion var ResultType; (function (ResultType) { ResultType["data"] = "data"; ResultType["deferred"] = "deferred"; ResultType["redirect"] = "redirect"; ResultType["error"] = "error"; })(ResultType || (ResultType = {})); const immutableRouteKeys = new Set(["lazy", "caseSensitive", "path", "id", "index", "children"]); function isIndexRoute(route) { return route.index === true; } // Walk the route tree generating unique IDs where necessary, so we are working // solely with AgnosticDataRouteObject's within the Router function convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath, manifest) { if (parentPath === void 0) { parentPath = []; } if (manifest === void 0) { manifest = {}; } return routes.map((route, index) => { let treePath = [...parentPath, String(index)]; let id = typeof route.id === "string" ? route.id : treePath.join("-"); invariant(route.index !== true || !route.children, "Cannot specify children on an index route"); invariant(!manifest[id], "Found a route id collision on id \"" + id + "\". Route " + "id's must be globally unique within Data Router usages"); if (isIndexRoute(route)) { let indexRoute = _extends({}, route, mapRouteProperties(route), { id }); manifest[id] = indexRoute; return indexRoute; } else { let pathOrLayoutRoute = _extends({}, route, mapRouteProperties(route), { id, children: undefined }); manifest[id] = pathOrLayoutRoute; if (route.children) { pathOrLayoutRoute.children = convertRoutesToDataRoutes(route.children, mapRouteProperties, treePath, manifest); } return pathOrLayoutRoute; } }); } /** * Matches the given routes to a location and returns the match data. * * @see https://reactrouter.com/v6/utils/match-routes */ function matchRoutes(routes, locationArg, basename) { if (basename === void 0) { basename = "/"; } return matchRoutesImpl(routes, locationArg, basename, false); } function matchRoutesImpl(routes, locationArg, basename, allowPartial) { let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg; let pathname = stripBasename(location.pathname || "/", basename); if (pathname == null) { return null; } let branches = flattenRoutes(routes); rankRouteBranches(branches); let matches = null; for (let i = 0; matches == null && i < branches.length; ++i) { // Incoming pathnames are generally encoded from either window.location // or from router.navigate, but we want to match against the unencoded // paths in the route definitions. Memory router locations won't be // encoded here but there also shouldn't be anything to decode so this // should be a safe operation. This avoids needing matchRoutes to be // history-aware. let decoded = decodePath(pathname); matches = matchRouteBranch(branches[i], decoded, allowPartial); } return matches; } function convertRouteMatchToUiMatch(match, loaderData) { let { route, pathname, params } = match; return { id: route.id, pathname, params, data: loaderData[route.id], handle: route.handle }; } function flattenRoutes(routes, branches, parentsMeta, parentPath) { if (branches === void 0) { branches = []; } if (parentsMeta === void 0) { parentsMeta = []; } if (parentPath === void 0) { parentPath = ""; } let flattenRoute = (route, index, relativePath) => { let meta = { relativePath: relativePath === undefined ? route.path || "" : relativePath, caseSensitive: route.caseSensitive === true, childrenIndex: index, route }; if (meta.relativePath.startsWith("/")) { invariant(meta.relativePath.startsWith(parentPath), "Absolute route path \"" + meta.relativePath + "\" nested under path " + ("\"" + parentPath + "\" is not valid. An absolute child route path ") + "must start with the combined path of all its parent routes."); meta.relativePath = meta.relativePath.slice(parentPath.length); } let path = joinPaths([parentPath, meta.relativePath]); let routesMeta = parentsMeta.concat(meta); // Add the children before adding this route to the array, so we traverse the // route tree depth-first and child routes appear before their parents in // the "flattened" version. if (route.children && route.children.length > 0) { invariant( // Our types know better, but runtime JS may not! // @ts-expect-error route.index !== true, "Index routes must not have child routes. Please remove " + ("all child routes from route path \"" + path + "\".")); flattenRoutes(route.children, branches, routesMeta, path); } // Routes without a path shouldn't ever match by themselves unless they are // index routes, so don't add them to the list of possible branches. if (route.path == null && !route.index) { return; } branches.push({ path, score: computeScore(path, route.index), routesMeta }); }; routes.forEach((route, index) => { var _route$path; // coarse-grain check for optional params if (route.path === "" || !((_route$path = route.path) != null && _route$path.includes("?"))) { flattenRoute(route, index); } else { for (let exploded of explodeOptionalSegments(route.path)) { flattenRoute(route, index, exploded); } } }); return branches; } /** * Computes all combinations of optional path segments for a given path, * excluding combinations that are ambiguous and of lower priority. * * For example, `/one/:two?/three/:four?/:five?` explodes to: * - `/one/three` * - `/one/:two/three` * - `/one/three/:four` * - `/one/three/:five` * - `/one/:two/three/:four` * - `/one/:two/three/:five` * - `/one/three/:four/:five` * - `/one/:two/three/:four/:five` */ function explodeOptionalSegments(path) { let segments = path.split("/"); if (segments.length === 0) return []; let [first, ...rest] = segments; // Optional path segments are denoted by a trailing `?` let isOptional = first.endsWith("?"); // Compute the corresponding required segment: `foo?` -> `foo` let required = first.replace(/\?$/, ""); if (rest.length === 0) { // Intepret empty string as omitting an optional segment // `["one", "", "three"]` corresponds to omitting `:two` from `/one/:two?/three` -> `/one/three` return isOptional ? [required, ""] : [required]; } let restExploded = explodeOptionalSegments(rest.join("/")); let result = []; // All child paths with the prefix. Do this for all children before the // optional version for all children, so we get consistent ordering where the // parent optional aspect is preferred as required. Otherwise, we can get // child sections interspersed where deeper optional segments are higher than // parent optional segments, where for example, /:two would explode _earlier_ // then /:one. By always including the parent as required _for all children_ // first, we avoid this issue result.push(...restExploded.map(subpath => subpath === "" ? required : [required, subpath].join("/"))); // Then, if this is an optional value, add all child versions without if (isOptional) { result.push(...restExploded); } // for absolute paths, ensure `/` instead of empty segment return result.map(exploded => path.startsWith("/") && exploded === "" ? "/" : exploded); } function rankRouteBranches(branches) { branches.sort((a, b) => a.score !== b.score ? b.score - a.score // Higher score first : compareIndexes(a.routesMeta.map(meta => meta.childrenIndex), b.routesMeta.map(meta => meta.childrenIndex))); } const paramRe = /^:[\w-]+$/; const dynamicSegmentValue = 3; const indexRouteValue = 2; const emptySegmentValue = 1; const staticSegmentValue = 10; const splatPenalty = -2; const isSplat = s => s === "*"; function computeScore(path, index) { let segments = path.split("/"); let initialScore = segments.length; if (segments.some(isSplat)) { initialScore += splatPenalty; } if (index) { initialScore += indexRouteValue; } return segments.filter(s => !isSplat(s)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue), initialScore); } function compareIndexes(a, b) { let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]); return siblings ? // If two routes are siblings, we should try to match the earlier sibling // first. This allows people to have fine-grained control over the matching // behavior by simply putting routes with identical paths in the order they // want them tried. a[a.length - 1] - b[b.length - 1] : // Otherwise, it doesn't really make sense to rank non-siblings by index, // so they sort equally. 0; } function matchRouteBranch(branch, pathname, allowPartial) { if (allowPartial === void 0) { allowPartial = false; } let { routesMeta } = branch; let matchedParams = {}; let matchedPathname = "/"; let matches = []; for (let i = 0; i < routesMeta.length; ++i) { let meta = routesMeta[i]; let end = i === routesMeta.length - 1; let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/"; let match = matchPath({ path: meta.relativePath, caseSensitive: meta.caseSensitive, end }, remainingPathname); let route = meta.route; if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) { match = matchPath({ path: meta.relativePath, caseSensitive: meta.caseSensitive, end: false }, remainingPathname); } if (!match) { return null; } Object.assign(matchedParams, match.params); matches.push({ // TODO: Can this as be avoided? params: matchedParams, pathname: joinPaths([matchedPathname, match.pathname]), pathnameBase: normalizePathname(joinPaths([matchedPathname, match.pathnameBase])), route }); if (match.pathnameBase !== "/") { matchedPathname = joinPaths([matchedPathname, match.pathnameBase]); } } return matches; } /** * Returns a path with params interpolated. * * @see https://reactrouter.com/v6/utils/generate-path */ function generatePath(originalPath, params) { if (params === void 0) { params = {}; } let path = originalPath; if (path.endsWith("*") && path !== "*" && !path.endsWith("/*")) { warning(false, "Route path \"" + path + "\" will be treated as if it were " + ("\"" + path.replace(/\*$/, "/*") + "\" because the `*` character must ") + "always follow a `/` in the pattern. To get rid of this warning, " + ("please change the route path to \"" + path.replace(/\*$/, "/*") + "\".")); path = path.replace(/\*$/, "/*"); } // ensure `/` is added at the beginning if the path is absolute const prefix = path.startsWith("/") ? "/" : ""; const stringify = p => p == null ? "" : typeof p === "string" ? p : String(p); const segments = path.split(/\/+/).map((segment, index, array) => { const isLastSegment = index === array.length - 1; // only apply the splat if it's the last segment if (isLastSegment && segment === "*") { const star = "*"; // Apply the splat return stringify(params[star]); } const keyMatch = segment.match(/^:([\w-]+)(\??)$/); if (keyMatch) { const [, key, optional] = keyMatch; let param = params[key]; invariant(optional === "?" || param != null, "Missing \":" + key + "\" param"); return stringify(param); } // Remove any optional markers from optional static segments return segment.replace(/\?$/g, ""); }) // Remove empty segments .filter(segment => !!segment); return prefix + segments.join("/"); } /** * Performs pattern matching on a URL pathname and returns information about * the match. * * @see https://reactrouter.com/v6/utils/match-path */ function matchPath(pattern, pathname) { if (typeof pattern === "string") { pattern = { path: pattern, caseSensitive: false, end: true }; } let [matcher, compiledParams] = compilePath(pattern.path, pattern.caseSensitive, pattern.end); let match = pathname.match(matcher); if (!match) return null; let matchedPathname = match[0]; let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1"); let captureGroups = match.slice(1); let params = compiledParams.reduce((memo, _ref, index) => { let { paramName, isOptional } = _ref; // We need to compute the pathnameBase here using the raw splat value // instead of using params["*"] later because it will be decoded then if (paramName === "*") { let splatValue = captureGroups[index] || ""; pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1"); } const value = captureGroups[index]; if (isOptional && !value) { memo[paramName] = undefined; } else { memo[paramName] = (value || "").replace(/%2F/g, "/"); } return memo; }, {}); return { params, pathname: matchedPathname, pathnameBase, pattern }; } function compilePath(path, caseSensitive, end) { if (caseSensitive === void 0) { caseSensitive = false; } if (end === void 0) { end = true; } warning(path === "*" || !path.endsWith("*") || path.endsWith("/*"), "Route path \"" + path + "\" will be treated as if it were " + ("\"" + path.replace(/\*$/, "/*") + "\" because the `*` character must ") + "always follow a `/` in the pattern. To get rid of this warning, " + ("please change the route path to \"" + path.replace(/\*$/, "/*") + "\".")); let params = []; let regexpSource = "^" + path.replace(/\/*\*?$/, "") // Ignore trailing / and /*, we'll handle it below .replace(/^\/*/, "/") // Make sure it has a leading / .replace(/[\\.*+^${}|()[\]]/g, "\\$&") // Escape special regex chars .replace(/\/:([\w-]+)(\?)?/g, (_, paramName, isOptional) => { params.push({ paramName, isOptional: isOptional != null }); return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)"; }); if (path.endsWith("*")) { params.push({ paramName: "*" }); regexpSource += path === "*" || path === "/*" ? "(.*)$" // Already matched the initial /, just match the rest : "(?:\\/(.+)|\\/*)$"; // Don't include the / in params["*"] } else if (end) { // When matching to the end, ignore trailing slashes regexpSource += "\\/*$"; } else if (path !== "" && path !== "/") { // If our path is non-empty and contains anything beyond an initial slash, // then we have _some_ form of path in our regex, so we should expect to // match only if we find the end of this path segment. Look for an optional // non-captured trailing slash (to match a portion of the URL) or the end // of the path (if we've matched to the end). We used to do this with a // word boundary but that gives false positives on routes like // /user-preferences since `-` counts as a word boundary. regexpSource += "(?:(?=\\/|$))"; } else ; let matcher = new RegExp(regexpSource, caseSensitive ? undefined : "i"); return [matcher, params]; } function decodePath(value) { try { return value.split("/").map(v => decodeURIComponent(v).replace(/\//g, "%2F")).join("/"); } catch (error) { warning(false, "The URL path \"" + value + "\" could not be decoded because it is is a " + "malformed URL segment. This is probably due to a bad percent " + ("encoding (" + error + ").")); return value; } } /** * @private */ function stripBasename(pathname, basename) { if (basename === "/") return pathname; if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) { return null; } // We want to leave trailing slash behavior in the user's control, so if they // specify a basename with a trailing slash, we should support it let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length; let nextChar = pathname.charAt(startIndex); if (nextChar && nextChar !== "/") { // pathname does not start with basename/ return null; } return pathname.slice(startIndex) || "/"; } /** * Returns a resolved path object relative to the given pathname. * * @see https://reactrouter.com/v6/utils/resolve-path */ function resolvePath(to, fromPathname) { if (fromPathname === void 0) { fromPathname = "/"; } let { pathname: toPathname, search = "", hash = "" } = typeof to === "string" ? parsePath(to) : to; let pathname = toPathname ? toPathname.startsWith("/") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname; return { pathname, search: normalizeSearch(search), hash: normalizeHash(hash) }; } function resolvePathname(relativePath, fromPathname) { let segments = fromPathname.replace(/\/+$/, "").split("/"); let relativeSegments = relativePath.split("/"); relativeSegments.forEach(segment => { if (segment === "..") { // Keep the root "" segment so the pathname starts at / if (segments.length > 1) segments.pop(); } else if (segment !== ".") { segments.push(segment); } }); return segments.length > 1 ? segments.join("/") : "/"; } function getInvalidPathError(char, field, dest, path) { return "Cannot include a '" + char + "' character in a manually specified " + ("`to." + field + "` field [" + JSON.stringify(path) + "]. Please separate it out to the ") + ("`to." + dest + "` field. Alternatively you may provide the full path as ") + "a string in and the router will parse it for you."; } /** * @private * * When processing relative navigation we want to ignore ancestor routes that * do not contribute to the path, such that index/pathless layout routes don't * interfere. * * For example, when moving a route element into an index route and/or a * pathless layout route, relative link behavior contained within should stay * the same. Both of the following examples should link back to the root: * * * * * * * * }> // <-- Does not contribute * // <-- Does not contribute * * */ function getPathContributingMatches(matches) { return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0); } // Return the array of pathnames for the current route matches - used to // generate the routePathnames input for resolveTo() function getResolveToMatches(matches, v7_relativeSplatPath) { let pathMatches = getPathContributingMatches(matches); // When v7_relativeSplatPath is enabled, use the full pathname for the leaf // match so we include splat values for "." links. See: // https://github.com/remix-run/react-router/issues/11052#issuecomment-1836589329 if (v7_relativeSplatPath) { return pathMatches.map((match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase); } return pathMatches.map(match => match.pathnameBase); } /** * @private */ function resolveTo(toArg, routePathnames, locationPathname, isPathRelative) { if (isPathRelative === void 0) { isPathRelative = false; } let to; if (typeof toArg === "string") { to = parsePath(toArg); } else { to = _extends({}, toArg); invariant(!to.pathname || !to.pathname.includes("?"), getInvalidPathError("?", "pathname", "search", to)); invariant(!to.pathname || !to.pathname.includes("#"), getInvalidPathError("#", "pathname", "hash", to)); invariant(!to.search || !to.search.includes("#"), getInvalidPathError("#", "search", "hash", to)); } let isEmptyPath = toArg === "" || to.pathname === ""; let toPathname = isEmptyPath ? "/" : to.pathname; let from; // Routing is relative to the current pathname if explicitly requested. // // If a pathname is explicitly provided in `to`, it should be relative to the // route context. This is explained in `Note on `` values` in our // migration guide from v5 as a means of disambiguation between `to` values // that begin with `/` and those that do not. However, this is problematic for // `to` values that do not provide a pathname. `to` can simply be a search or // hash string, in which case we should assume that the navigation is relative // to the current location's pathname and *not* the route pathname. if (toPathname == null) { from = locationPathname; } else { let routePathnameIndex = routePathnames.length - 1; // With relative="route" (the default), each leading .. segment means // "go up one route" instead of "go up one URL segment". This is a key // difference from how works and a major reason we call this a // "to" value instead of a "href". if (!isPathRelative && toPathname.startsWith("..")) { let toSegments = toPathname.split("/"); while (toSegments[0] === "..") { toSegments.shift(); routePathnameIndex -= 1; } to.pathname = toSegments.join("/"); } from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/"; } let path = resolvePath(to, from); // Ensure the pathname has a trailing slash if the original "to" had one let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/"); // Or if this was a link to the current path which has a trailing slash let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/"); if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) { path.pathname += "/"; } return path; } /** * @private */ function getToPathname(to) { // Empty strings should be treated the same as / paths return to === "" || to.pathname === "" ? "/" : typeof to === "string" ? parsePath(to).pathname : to.pathname; } /** * @private */ const joinPaths = paths => paths.join("/").replace(/\/\/+/g, "/"); /** * @private */ const normalizePathname = pathname => pathname.replace(/\/+$/, "").replace(/^\/*/, "/"); /** * @private */ const normalizeSearch = search => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search; /** * @private */ const normalizeHash = hash => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash; /** * This is a shortcut for creating `application/json` responses. Converts `data` * to JSON and sets the `Content-Type` header. * * @deprecated The `json` method is deprecated in favor of returning raw objects. * This method will be removed in v7. */ const json = function json(data, init) { if (init === void 0) { init = {}; } let responseInit = typeof init === "number" ? { status: init } : init; let headers = new Headers(responseInit.headers); if (!headers.has("Content-Type")) { headers.set("Content-Type", "application/json; charset=utf-8"); } return new Response(JSON.stringify(data), _extends({}, responseInit, { headers })); }; class DataWithResponseInit { constructor(data, init) { this.type = "DataWithResponseInit"; this.data = data; this.init = init || null; } } /** * Create "responses" that contain `status`/`headers` without forcing * serialization into an actual `Response` - used by Remix single fetch */ function data(data, init) { return new DataWithResponseInit(data, typeof init === "number" ? { status: init } : init); } class AbortedDeferredError extends Error {} class DeferredData { constructor(data, responseInit) { this.pendingKeysSet = new Set(); this.subscribers = new Set(); this.deferredKeys = []; invariant(data && typeof data === "object" && !Array.isArray(data), "defer() only accepts plain objects"); // Set up an AbortController + Promise we can race against to exit early // cancellation let reject; this.abortPromise = new Promise((_, r) => reject = r); this.controller = new AbortController(); let onAbort = () => reject(new AbortedDeferredError("Deferred data aborted")); this.unlistenAbortSignal = () => this.controller.signal.removeEventListener("abort", onAbort); this.controller.signal.addEventListener("abort", onAbort); this.data = Object.entries(data).reduce((acc, _ref2) => { let [key, value] = _ref2; return Object.assign(acc, { [key]: this.trackPromise(key, value) }); }, {}); if (this.done) { // All incoming values were resolved this.unlistenAbortSignal(); } this.init = responseInit; } trackPromise(key, value) { if (!(value instanceof Promise)) { return value; } this.deferredKeys.push(key); this.pendingKeysSet.add(key); // We store a little wrapper promise that will be extended with // _data/_error props upon resolve/reject let promise = Promise.race([value, this.abortPromise]).then(data => this.onSettle(promise, key, undefined, data), error => this.onSettle(promise, key, error)); // Register rejection listeners to avoid uncaught promise rejections on // errors or aborted deferred values promise.catch(() => {}); Object.defineProperty(promise, "_tracked", { get: () => true }); return promise; } onSettle(promise, key, error, data) { if (this.controller.signal.aborted && error instanceof AbortedDeferredError) { this.unlistenAbortSignal(); Object.defineProperty(promise, "_error", { get: () => error }); return Promise.reject(error); } this.pendingKeysSet.delete(key); if (this.done) { // Nothing left to abort! this.unlistenAbortSignal(); } // If the promise was resolved/rejected with undefined, we'll throw an error as you // should always resolve with a value or null if (error === undefined && data === undefined) { let undefinedError = new Error("Deferred data for key \"" + key + "\" resolved/rejected with `undefined`, " + "you must resolve/reject with a value or `null`."); Object.defineProperty(promise, "_error", { get: () => undefinedError }); this.emit(false, key); return Promise.reject(undefinedError); } if (data === undefined) { Object.defineProperty(promise, "_error", { get: () => error }); this.emit(false, key); return Promise.reject(error); } Object.defineProperty(promise, "_data", { get: () => data }); this.emit(false, key); return data; } emit(aborted, settledKey) { this.subscribers.forEach(subscriber => subscriber(aborted, settledKey)); } subscribe(fn) { this.subscribers.add(fn); return () => this.subscribers.delete(fn); } cancel() { this.controller.abort(); this.pendingKeysSet.forEach((v, k) => this.pendingKeysSet.delete(k)); this.emit(true); } async resolveData(signal) { let aborted = false; if (!this.done) { let onAbort = () => this.cancel(); signal.addEventListener("abort", onAbort); aborted = await new Promise(resolve => { this.subscribe(aborted => { signal.removeEventListener("abort", onAbort); if (aborted || this.done) { resolve(aborted); } }); }); } return aborted; } get done() { return this.pendingKeysSet.size === 0; } get unwrappedData() { invariant(this.data !== null && this.done, "Can only unwrap data on initialized and settled deferreds"); return Object.entries(this.data).reduce((acc, _ref3) => { let [key, value] = _ref3; return Object.assign(acc, { [key]: unwrapTrackedPromise(value) }); }, {}); } get pendingKeys() { return Array.from(this.pendingKeysSet); } } function isTrackedPromise(value) { return value instanceof Promise && value._tracked === true; } function unwrapTrackedPromise(value) { if (!isTrackedPromise(value)) { return value; } if (value._error) { throw value._error; } return value._data; } /** * @deprecated The `defer` method is deprecated in favor of returning raw * objects. This method will be removed in v7. */ const defer = function defer(data, init) { if (init === void 0) { init = {}; } let responseInit = typeof init === "number" ? { status: init } : init; return new DeferredData(data, responseInit); }; /** * A redirect response. Sets the status code and the `Location` header. * Defaults to "302 Found". */ const redirect = function redirect(url, init) { if (init === void 0) { init = 302; } let responseInit = init; if (typeof responseInit === "number") { responseInit = { status: responseInit }; } else if (typeof responseInit.status === "undefined") { responseInit.status = 302; } let headers = new Headers(responseInit.headers); headers.set("Location", url); return new Response(null, _extends({}, responseInit, { headers })); }; /** * A redirect response that will force a document reload to the new location. * Sets the status code and the `Location` header. * Defaults to "302 Found". */ const redirectDocument = (url, init) => { let response = redirect(url, init); response.headers.set("X-Remix-Reload-Document", "true"); return response; }; /** * A redirect response that will perform a `history.replaceState` instead of a * `history.pushState` for client-side navigation redirects. * Sets the status code and the `Location` header. * Defaults to "302 Found". */ const replace = (url, init) => { let response = redirect(url, init); response.headers.set("X-Remix-Replace", "true"); return response; }; /** * @private * Utility class we use to hold auto-unwrapped 4xx/5xx Response bodies * * We don't export the class for public use since it's an implementation * detail, but we export the interface above so folks can build their own * abstractions around instances via isRouteErrorResponse() */ class ErrorResponseImpl { constructor(status, statusText, data, internal) { if (internal === void 0) { internal = false; } this.status = status; this.statusText = statusText || ""; this.internal = internal; if (data instanceof Error) { this.data = data.toString(); this.error = data; } else { this.data = data; } } } /** * Check if the given error is an ErrorResponse generated from a 4xx/5xx * Response thrown from an action/loader */ function isRouteErrorResponse(error) { return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error; } const validMutationMethodsArr = ["post", "put", "patch", "delete"]; const validMutationMethods = new Set(validMutationMethodsArr); const validRequestMethodsArr = ["get", ...validMutationMethodsArr]; const validRequestMethods = new Set(validRequestMethodsArr); const redirectStatusCodes = new Set([301, 302, 303, 307, 308]); const redirectPreserveMethodStatusCodes = new Set([307, 308]); const IDLE_NAVIGATION = { state: "idle", location: undefined, formMethod: undefined, formAction: undefined, formEncType: undefined, formData: undefined, json: undefined, text: undefined }; const IDLE_FETCHER = { state: "idle", data: undefined, formMethod: undefined, formAction: undefined, formEncType: undefined, formData: undefined, json: undefined, text: undefined }; const IDLE_BLOCKER = { state: "unblocked", proceed: undefined, reset: undefined, location: undefined }; const ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i; const defaultMapRouteProperties = route => ({ hasErrorBoundary: Boolean(route.hasErrorBoundary) }); const TRANSITIONS_STORAGE_KEY = "remix-router-transitions"; //#endregion //////////////////////////////////////////////////////////////////////////////// //#region createRouter //////////////////////////////////////////////////////////////////////////////// /** * Create a router and listen to history POP navigations */ function createRouter(init) { const routerWindow = init.window ? init.window : typeof window !== "undefined" ? window : undefined; const isBrowser = typeof routerWindow !== "undefined" && typeof routerWindow.document !== "undefined" && typeof routerWindow.document.createElement !== "undefined"; const isServer = !isBrowser; invariant(init.routes.length > 0, "You must provide a non-empty routes array to createRouter"); let mapRouteProperties; if (init.mapRouteProperties) { mapRouteProperties = init.mapRouteProperties; } else if (init.detectErrorBoundary) { // If they are still using the deprecated version, wrap it with the new API let detectErrorBoundary = init.detectErrorBoundary; mapRouteProperties = route => ({ hasErrorBoundary: detectErrorBoundary(route) }); } else { mapRouteProperties = defaultMapRouteProperties; } // Routes keyed by ID let manifest = {}; // Routes in tree format for matching let dataRoutes = convertRoutesToDataRoutes(init.routes, mapRouteProperties, undefined, manifest); let inFlightDataRoutes; let basename = init.basename || "/"; let dataStrategyImpl = init.dataStrategy || defaultDataStrategy; let patchRoutesOnNavigationImpl = init.patchRoutesOnNavigation; // Config driven behavior flags let future = _extends({ v7_fetcherPersist: false, v7_normalizeFormMethod: false, v7_partialHydration: false, v7_prependBasename: false, v7_relativeSplatPath: false, v7_skipActionErrorRevalidation: false }, init.future); // Cleanup function for history let unlistenHistory = null; // Externally-provided functions to call on all state changes let subscribers = new Set(); // Externally-provided object to hold scroll restoration locations during routing let savedScrollPositions = null; // Externally-provided function to get scroll restoration keys let getScrollRestorationKey = null; // Externally-provided function to get current scroll position let getScrollPosition = null; // One-time flag to control the initial hydration scroll restoration. Because // we don't get the saved positions from until _after_ // the initial render, we need to manually trigger a separate updateState to // send along the restoreScrollPosition // Set to true if we have `hydrationData` since we assume we were SSR'd and that // SSR did the initial scroll restoration. let initialScrollRestored = init.hydrationData != null; let initialMatches = matchRoutes(dataRoutes, init.history.location, basename); let initialMatchesIsFOW = false; let initialErrors = null; if (initialMatches == null && !patchRoutesOnNavigationImpl) { // If we do not match a user-provided-route, fall back to the root // to allow the error boundary to take over let error = getInternalRouterError(404, { pathname: init.history.location.pathname }); let { matches, route } = getShortCircuitMatches(dataRoutes); initialMatches = matches; initialErrors = { [route.id]: error }; } // In SPA apps, if the user provided a patchRoutesOnNavigation implementation and // our initial match is a splat route, clear them out so we run through lazy // discovery on hydration in case there's a more accurate lazy route match. // In SSR apps (with `hydrationData`), we expect that the server will send // up the proper matched routes so we don't want to run lazy discovery on // initial hydration and want to hydrate into the splat route. if (initialMatches && !init.hydrationData) { let fogOfWar = checkFogOfWar(initialMatches, dataRoutes, init.history.location.pathname); if (fogOfWar.active) { initialMatches = null; } } let initialized; if (!initialMatches) { initialized = false; initialMatches = []; // If partial hydration and fog of war is enabled, we will be running // `patchRoutesOnNavigation` during hydration so include any partial matches as // the initial matches so we can properly render `HydrateFallback`'s if (future.v7_partialHydration) { let fogOfWar = checkFogOfWar(null, dataRoutes, init.history.location.pathname); if (fogOfWar.active && fogOfWar.matches) { initialMatchesIsFOW = true; initialMatches = fogOfWar.matches; } } } else if (initialMatches.some(m => m.route.lazy)) { // All initialMatches need to be loaded before we're ready. If we have lazy // functions around still then we'll need to run them in initialize() initialized = false; } else if (!initialMatches.some(m => m.route.loader)) { // If we've got no loaders to run, then we're good to go initialized = true; } else if (future.v7_partialHydration) { // If partial hydration is enabled, we're initialized so long as we were // provided with hydrationData for every route with a loader, and no loaders // were marked for explicit hydration let loaderData = init.hydrationData ? init.hydrationData.loaderData : null; let errors = init.hydrationData ? init.hydrationData.errors : null; // If errors exist, don't consider routes below the boundary if (errors) { let idx = initialMatches.findIndex(m => errors[m.route.id] !== undefined); initialized = initialMatches.slice(0, idx + 1).every(m => !shouldLoadRouteOnHydration(m.route, loaderData, errors)); } else { initialized = initialMatches.every(m => !shouldLoadRouteOnHydration(m.route, loaderData, errors)); } } else { // Without partial hydration - we're initialized if we were provided any // hydrationData - which is expected to be complete initialized = init.hydrationData != null; } let router; let state = { historyAction: init.history.action, location: init.history.location, matches: initialMatches, initialized, navigation: IDLE_NAVIGATION, // Don't restore on initial updateState() if we were SSR'd restoreScrollPosition: init.hydrationData != null ? false : null, preventScrollReset: false, revalidation: "idle", loaderData: init.hydrationData && init.hydrationData.loaderData || {}, actionData: init.hydrationData && init.hydrationData.actionData || null, errors: init.hydrationData && init.hydrationData.errors || initialErrors, fetchers: new Map(), blockers: new Map() }; // -- Stateful internal variables to manage navigations -- // Current navigation in progress (to be committed in completeNavigation) let pendingAction = Action.Pop; // Should the current navigation prevent the scroll reset if scroll cannot // be restored? let pendingPreventScrollReset = false; // AbortController for the active navigation let pendingNavigationController; // Should the current navigation enable document.startViewTransition? let pendingViewTransitionEnabled = false; // Store applied view transitions so we can apply them on POP let appliedViewTransitions = new Map(); // Cleanup function for persisting applied transitions to sessionStorage let removePageHideEventListener = null; // We use this to avoid touching history in completeNavigation if a // revalidation is entirely uninterrupted let isUninterruptedRevalidation = false; // Use this internal flag to force revalidation of all loaders: // - submissions (completed or interrupted) // - useRevalidator() // - X-Remix-Revalidate (from redirect) let isRevalidationRequired = false; // Use this internal array to capture routes that require revalidation due // to a cancelled deferred on action submission let cancelledDeferredRoutes = []; // Use this internal array to capture fetcher loads that were cancelled by an // action navigation and require revalidation let cancelledFetcherLoads = new Set(); // AbortControllers for any in-flight fetchers let fetchControllers = new Map(); // Track loads based on the order in which they started let incrementingLoadId = 0; // Track the outstanding pending navigation data load to be compared against // the globally incrementing load when a fetcher load lands after a completed // navigation let pendingNavigationLoadId = -1; // Fetchers that triggered data reloads as a result of their actions let fetchReloadIds = new Map(); // Fetchers that triggered redirect navigations let fetchRedirectIds = new Set(); // Most recent href/match for fetcher.load calls for fetchers let fetchLoadMatches = new Map(); // Ref-count mounted fetchers so we know when it's ok to clean them up let activeFetchers = new Map(); // Fetchers that have requested a delete when using v7_fetcherPersist, // they'll be officially removed after they return to idle let deletedFetchers = new Set(); // Store DeferredData instances for active route matches. When a // route loader returns defer() we stick one in here. Then, when a nested // promise resolves we update loaderData. If a new navigation starts we // cancel active deferreds for eliminated routes. let activeDeferreds = new Map(); // Store blocker functions in a separate Map outside of router state since // we don't need to update UI state if they change let blockerFunctions = new Map(); // Flag to ignore the next history update, so we can revert the URL change on // a POP navigation that was blocked by the user without touching router state let unblockBlockerHistoryUpdate = undefined; // Initialize the router, all side effects should be kicked off from here. // Implemented as a Fluent API for ease of: // let router = createRouter(init).initialize(); function initialize() { // If history informs us of a POP navigation, start the navigation but do not update // state. We'll update our own state once the navigation completes unlistenHistory = init.history.listen(_ref => { let { action: historyAction, location, delta } = _ref; // Ignore this event if it was just us resetting the URL from a // blocked POP navigation if (unblockBlockerHistoryUpdate) { unblockBlockerHistoryUpdate(); unblockBlockerHistoryUpdate = undefined; return; } warning(blockerFunctions.size === 0 || delta != null, "You are trying to use a blocker on a POP navigation to a location " + "that was not created by @remix-run/router. This will fail silently in " + "production. This can happen if you are navigating outside the router " + "via `window.history.pushState`/`window.location.hash` instead of using " + "router navigation APIs. This can also happen if you are using " + "createHashRouter and the user manually changes the URL."); let blockerKey = shouldBlockNavigation({ currentLocation: state.location, nextLocation: location, historyAction }); if (blockerKey && delta != null) { // Restore the URL to match the current UI, but don't update router state let nextHistoryUpdatePromise = new Promise(resolve => { unblockBlockerHistoryUpdate = resolve; }); init.history.go(delta * -1); // Put the blocker into a blocked state updateBlocker(blockerKey, { state: "blocked", location, proceed() { updateBlocker(blockerKey, { state: "proceeding", proceed: undefined, reset: undefined, location }); // Re-do the same POP navigation we just blocked, after the url // restoration is also complete. See: // https://github.com/remix-run/react-router/issues/11613 nextHistoryUpdatePromise.then(() => init.history.go(delta)); }, reset() { let blockers = new Map(state.blockers); blockers.set(blockerKey, IDLE_BLOCKER); updateState({ blockers }); } }); return; } return startNavigation(historyAction, location); }); if (isBrowser) { // FIXME: This feels gross. How can we cleanup the lines between // scrollRestoration/appliedTransitions persistance? restoreAppliedTransitions(routerWindow, appliedViewTransitions); let _saveAppliedTransitions = () => persistAppliedTransitions(routerWindow, appliedViewTransitions); routerWindow.addEventListener("pagehide", _saveAppliedTransitions); removePageHideEventListener = () => routerWindow.removeEventListener("pagehide", _saveAppliedTransitions); } // Kick off initial data load if needed. Use Pop to avoid modifying history // Note we don't do any handling of lazy here. For SPA's it'll get handled // in the normal navigation flow. For SSR it's expected that lazy modules are // resolved prior to router creation since we can't go into a fallbackElement // UI for SSR'd apps if (!state.initialized) { startNavigation(Action.Pop, state.location, { initialHydration: true }); } return router; } // Clean up a router and it's side effects function dispose() { if (unlistenHistory) { unlistenHistory(); } if (removePageHideEventListener) { removePageHideEventListener(); } subscribers.clear(); pendingNavigationController && pendingNavigationController.abort(); state.fetchers.forEach((_, key) => deleteFetcher(key)); state.blockers.forEach((_, key) => deleteBlocker(key)); } // Subscribe to state updates for the router function subscribe(fn) { subscribers.add(fn); return () => subscribers.delete(fn); } // Update our state and notify the calling context of the change function updateState(newState, opts) { if (opts === void 0) { opts = {}; } state = _extends({}, state, newState); // Prep fetcher cleanup so we can tell the UI which fetcher data entries // can be removed let completedFetchers = []; let deletedFetchersKeys = []; if (future.v7_fetcherPersist) { state.fetchers.forEach((fetcher, key) => { if (fetcher.state === "idle") { if (deletedFetchers.has(key)) { // Unmounted from the UI and can be totally removed deletedFetchersKeys.push(key); } else { // Returned to idle but still mounted in the UI, so semi-remains for // revalidations and such completedFetchers.push(key); } } }); } // Remove any lingering deleted fetchers that have already been removed // from state.fetchers deletedFetchers.forEach(key => { if (!state.fetchers.has(key) && !fetchControllers.has(key)) { deletedFetchersKeys.push(key); } }); // Iterate over a local copy so that if flushSync is used and we end up // removing and adding a new subscriber due to the useCallback dependencies, // we don't get ourselves into a loop calling the new subscriber immediately [...subscribers].forEach(subscriber => subscriber(state, { deletedFetchers: deletedFetchersKeys, viewTransitionOpts: opts.viewTransitionOpts, flushSync: opts.flushSync === true })); // Remove idle fetchers from state since we only care about in-flight fetchers. if (future.v7_fetcherPersist) { completedFetchers.forEach(key => state.fetchers.delete(key)); deletedFetchersKeys.forEach(key => deleteFetcher(key)); } else { // We already called deleteFetcher() on these, can remove them from this // Set now that we've handed the keys off to the data layer deletedFetchersKeys.forEach(key => deletedFetchers.delete(key)); } } // Complete a navigation returning the state.navigation back to the IDLE_NAVIGATION // and setting state.[historyAction/location/matches] to the new route. // - Location is a required param // - Navigation will always be set to IDLE_NAVIGATION // - Can pass any other state in newState function completeNavigation(location, newState, _temp) { var _location$state, _location$state2; let { flushSync } = _temp === void 0 ? {} : _temp; // Deduce if we're in a loading/actionReload state: // - We have committed actionData in the store // - The current navigation was a mutation submission // - We're past the submitting state and into the loading state // - The location being loaded is not the result of a redirect let isActionReload = state.actionData != null && state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && state.navigation.state === "loading" && ((_location$state = location.state) == null ? void 0 : _location$state._isRedirect) !== true; let actionData; if (newState.actionData) { if (Object.keys(newState.actionData).length > 0) { actionData = newState.actionData; } else { // Empty actionData -> clear prior actionData due to an action error actionData = null; } } else if (isActionReload) { // Keep the current data if we're wrapping up the action reload actionData = state.actionData; } else { // Clear actionData on any other completed navigations actionData = null; } // Always preserve any existing loaderData from re-used routes let loaderData = newState.loaderData ? mergeLoaderData(state.loaderData, newState.loaderData, newState.matches || [], newState.errors) : state.loaderData; // On a successful navigation we can assume we got through all blockers // so we can start fresh let blockers = state.blockers; if (blockers.size > 0) { blockers = new Map(blockers); blockers.forEach((_, k) => blockers.set(k, IDLE_BLOCKER)); } // Always respect the user flag. Otherwise don't reset on mutation // submission navigations unless they redirect let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && ((_location$state2 = location.state) == null ? void 0 : _location$state2._isRedirect) !== true; // Commit any in-flight routes at the end of the HMR revalidation "navigation" if (inFlightDataRoutes) { dataRoutes = inFlightDataRoutes; inFlightDataRoutes = undefined; } if (isUninterruptedRevalidation) ; else if (pendingAction === Action.Pop) ; else if (pendingAction === Action.Push) { init.history.push(location, location.state); } else if (pendingAction === Action.Replace) { init.history.replace(location, location.state); } let viewTransitionOpts; // On POP, enable transitions if they were enabled on the original navigation if (pendingAction === Action.Pop) { // Forward takes precedence so they behave like the original navigation let priorPaths = appliedViewTransitions.get(state.location.pathname); if (priorPaths && priorPaths.has(location.pathname)) { viewTransitionOpts = { currentLocation: state.location, nextLocation: location }; } else if (appliedViewTransitions.has(location.pathname)) { // If we don't have a previous forward nav, assume we're popping back to // the new location and enable if that location previously enabled viewTransitionOpts = { currentLocation: location, nextLocation: state.location }; } } else if (pendingViewTransitionEnabled) { // Store the applied transition on PUSH/REPLACE let toPaths = appliedViewTransitions.get(state.location.pathname); if (toPaths) { toPaths.add(location.pathname); } else { toPaths = new Set([location.pathname]); appliedViewTransitions.set(state.location.pathname, toPaths); } viewTransitionOpts = { currentLocation: state.location, nextLocation: location }; } updateState(_extends({}, newState, { actionData, loaderData, historyAction: pendingAction, location, initialized: true, navigation: IDLE_NAVIGATION, revalidation: "idle", restoreScrollPosition: getSavedScrollPosition(location, newState.matches || state.matches), preventScrollReset, blockers }), { viewTransitionOpts, flushSync: flushSync === true }); // Reset stateful navigation vars pendingAction = Action.Pop; pendingPreventScrollReset = false; pendingViewTransitionEnabled = false; isUninterruptedRevalidation = false; isRevalidationRequired = false; cancelledDeferredRoutes = []; } // Trigger a navigation event, which can either be a numerical POP or a PUSH // replace with an optional submission async function navigate(to, opts) { if (typeof to === "number") { init.history.go(to); return; } let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, to, future.v7_relativeSplatPath, opts == null ? void 0 : opts.fromRouteId, opts == null ? void 0 : opts.relative); let { path, submission, error } = normalizeNavigateOptions(future.v7_normalizeFormMethod, false, normalizedPath, opts); let currentLocation = state.location; let nextLocation = createLocation(state.location, path, opts && opts.state); // When using navigate as a PUSH/REPLACE we aren't reading an already-encoded // URL from window.location, so we need to encode it here so the behavior // remains the same as POP and non-data-router usages. new URL() does all // the same encoding we'd get from a history.pushState/window.location read // without having to touch history nextLocation = _extends({}, nextLocation, init.history.encodeLocation(nextLocation)); let userReplace = opts && opts.replace != null ? opts.replace : undefined; let historyAction = Action.Push; if (userReplace === true) { historyAction = Action.Replace; } else if (userReplace === false) ; else if (submission != null && isMutationMethod(submission.formMethod) && submission.formAction === state.location.pathname + state.location.search) { // By default on submissions to the current location we REPLACE so that // users don't have to double-click the back button to get to the prior // location. If the user redirects to a different location from the // action/loader this will be ignored and the redirect will be a PUSH historyAction = Action.Replace; } let preventScrollReset = opts && "preventScrollReset" in opts ? opts.preventScrollReset === true : undefined; let flushSync = (opts && opts.flushSync) === true; let blockerKey = shouldBlockNavigation({ currentLocation, nextLocation, historyAction }); if (blockerKey) { // Put the blocker into a blocked state updateBlocker(blockerKey, { state: "blocked", location: nextLocation, proceed() { updateBlocker(blockerKey, { state: "proceeding", proceed: undefined, reset: undefined, location: nextLocation }); // Send the same navigation through navigate(to, opts); }, reset() { let blockers = new Map(state.blockers); blockers.set(blockerKey, IDLE_BLOCKER); updateState({ blockers }); } }); return; } return await startNavigation(historyAction, nextLocation, { submission, // Send through the formData serialization error if we have one so we can // render at the right error boundary after we match routes pendingError: error, preventScrollReset, replace: opts && opts.replace, enableViewTransition: opts && opts.viewTransition, flushSync }); } // Revalidate all current loaders. If a navigation is in progress or if this // is interrupted by a navigation, allow this to "succeed" by calling all // loaders during the next loader round function revalidate() { interruptActiveLoads(); updateState({ revalidation: "loading" }); // If we're currently submitting an action, we don't need to start a new // navigation, we'll just let the follow up loader execution call all loaders if (state.navigation.state === "submitting") { return; } // If we're currently in an idle state, start a new navigation for the current // action/location and mark it as uninterrupted, which will skip the history // update in completeNavigation if (state.navigation.state === "idle") { startNavigation(state.historyAction, state.location, { startUninterruptedRevalidation: true }); return; } // Otherwise, if we're currently in a loading state, just start a new // navigation to the navigation.location but do not trigger an uninterrupted // revalidation so that history correctly updates once the navigation completes startNavigation(pendingAction || state.historyAction, state.navigation.location, { overrideNavigation: state.navigation, // Proxy through any rending view transition enableViewTransition: pendingViewTransitionEnabled === true }); } // Start a navigation to the given action/location. Can optionally provide a // overrideNavigation which will override the normalLoad in the case of a redirect // navigation async function startNavigation(historyAction, location, opts) { // Abort any in-progress navigations and start a new one. Unset any ongoing // uninterrupted revalidations unless told otherwise, since we want this // new navigation to update history normally pendingNavigationController && pendingNavigationController.abort(); pendingNavigationController = null; pendingAction = historyAction; isUninterruptedRevalidation = (opts && opts.startUninterruptedRevalidation) === true; // Save the current scroll position every time we start a new navigation, // and track whether we should reset scroll on completion saveScrollPosition(state.location, state.matches); pendingPreventScrollReset = (opts && opts.preventScrollReset) === true; pendingViewTransitionEnabled = (opts && opts.enableViewTransition) === true; let routesToUse = inFlightDataRoutes || dataRoutes; let loadingNavigation = opts && opts.overrideNavigation; let matches = opts != null && opts.initialHydration && state.matches && state.matches.length > 0 && !initialMatchesIsFOW ? // `matchRoutes()` has already been called if we're in here via `router.initialize()` state.matches : matchRoutes(routesToUse, location, basename); let flushSync = (opts && opts.flushSync) === true; // Short circuit if it's only a hash change and not a revalidation or // mutation submission. // // Ignore on initial page loads because since the initial hydration will always // be "same hash". For example, on /page#hash and submit a
// which will default to a navigation to /page if (matches && state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) { completeNavigation(location, { matches }, { flushSync }); return; } let fogOfWar = checkFogOfWar(matches, routesToUse, location.pathname); if (fogOfWar.active && fogOfWar.matches) { matches = fogOfWar.matches; } // Short circuit with a 404 on the root error boundary if we match nothing if (!matches) { let { error, notFoundMatches, route } = handleNavigational404(location.pathname); completeNavigation(location, { matches: notFoundMatches, loaderData: {}, errors: { [route.id]: error } }, { flushSync }); return; } // Create a controller/Request for this navigation pendingNavigationController = new AbortController(); let request = createClientSideRequest(init.history, location, pendingNavigationController.signal, opts && opts.submission); let pendingActionResult; if (opts && opts.pendingError) { // If we have a pendingError, it means the user attempted a GET submission // with binary FormData so assign here and skip to handleLoaders. That // way we handle calling loaders above the boundary etc. It's not really // different from an actionError in that sense. pendingActionResult = [findNearestBoundary(matches).route.id, { type: ResultType.error, error: opts.pendingError }]; } else if (opts && opts.submission && isMutationMethod(opts.submission.formMethod)) { // Call action if we received an action submission let actionResult = await handleAction(request, location, opts.submission, matches, fogOfWar.active, { replace: opts.replace, flushSync }); if (actionResult.shortCircuited) { return; } // If we received a 404 from handleAction, it's because we couldn't lazily // discover the destination route so we don't want to call loaders if (actionResult.pendingActionResult) { let [routeId, result] = actionResult.pendingActionResult; if (isErrorResult(result) && isRouteErrorResponse(result.error) && result.error.status === 404) { pendingNavigationController = null; completeNavigation(location, { matches: actionResult.matches, loaderData: {}, errors: { [routeId]: result.error } }); return; } } matches = actionResult.matches || matches; pendingActionResult = actionResult.pendingActionResult; loadingNavigation = getLoadingNavigation(location, opts.submission); flushSync = false; // No need to do fog of war matching again on loader execution fogOfWar.active = false; // Create a GET request for the loaders request = createClientSideRequest(init.history, request.url, request.signal); } // Call loaders let { shortCircuited, matches: updatedMatches, loaderData, errors } = await handleLoaders(request, location, matches, fogOfWar.active, loadingNavigation, opts && opts.submission, opts && opts.fetcherSubmission, opts && opts.replace, opts && opts.initialHydration === true, flushSync, pendingActionResult); if (shortCircuited) { return; } // Clean up now that the action/loaders have completed. Don't clean up if // we short circuited because pendingNavigationController will have already // been assigned to a new controller for the next navigation pendingNavigationController = null; completeNavigation(location, _extends({ matches: updatedMatches || matches }, getActionDataForCommit(pendingActionResult), { loaderData, errors })); } // Call the action matched by the leaf route for this navigation and handle // redirects/errors async function handleAction(request, location, submission, matches, isFogOfWar, opts) { if (opts === void 0) { opts = {}; } interruptActiveLoads(); // Put us in a submitting state let navigation = getSubmittingNavigation(location, submission); updateState({ navigation }, { flushSync: opts.flushSync === true }); if (isFogOfWar) { let discoverResult = await discoverRoutes(matches, location.pathname, request.signal); if (discoverResult.type === "aborted") { return { shortCircuited: true }; } else if (discoverResult.type === "error") { let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id; return { matches: discoverResult.partialMatches, pendingActionResult: [boundaryId, { type: ResultType.error, error: discoverResult.error }] }; } else if (!discoverResult.matches) { let { notFoundMatches, error, route } = handleNavigational404(location.pathname); return { matches: notFoundMatches, pendingActionResult: [route.id, { type: ResultType.error, error }] }; } else { matches = discoverResult.matches; } } // Call our action and get the result let result; let actionMatch = getTargetMatch(matches, location); if (!actionMatch.route.action && !actionMatch.route.lazy) { result = { type: ResultType.error, error: getInternalRouterError(405, { method: request.method, pathname: location.pathname, routeId: actionMatch.route.id }) }; } else { let results = await callDataStrategy("action", state, request, [actionMatch], matches, null); result = results[actionMatch.route.id]; if (request.signal.aborted) { return { shortCircuited: true }; } } if (isRedirectResult(result)) { let replace; if (opts && opts.replace != null) { replace = opts.replace; } else { // If the user didn't explicity indicate replace behavior, replace if // we redirected to the exact same location we're currently at to avoid // double back-buttons let location = normalizeRedirectLocation(result.response.headers.get("Location"), new URL(request.url), basename); replace = location === state.location.pathname + state.location.search; } await startRedirectNavigation(request, result, true, { submission, replace }); return { shortCircuited: true }; } if (isDeferredResult(result)) { throw getInternalRouterError(400, { type: "defer-action" }); } if (isErrorResult(result)) { // Store off the pending error - we use it to determine which loaders // to call and will commit it when we complete the navigation let boundaryMatch = findNearestBoundary(matches, actionMatch.route.id); // By default, all submissions to the current location are REPLACE // navigations, but if the action threw an error that'll be rendered in // an errorElement, we fall back to PUSH so that the user can use the // back button to get back to the pre-submission form location to try // again if ((opts && opts.replace) !== true) { pendingAction = Action.Push; } return { matches, pendingActionResult: [boundaryMatch.route.id, result] }; } return { matches, pendingActionResult: [actionMatch.route.id, result] }; } // Call all applicable loaders for the given matches, handling redirects, // errors, etc. async function handleLoaders(request, location, matches, isFogOfWar, overrideNavigation, submission, fetcherSubmission, replace, initialHydration, flushSync, pendingActionResult) { // Figure out the right navigation we want to use for data loading let loadingNavigation = overrideNavigation || getLoadingNavigation(location, submission); // If this was a redirect from an action we don't have a "submission" but // we have it on the loading navigation so use that if available let activeSubmission = submission || fetcherSubmission || getSubmissionFromNavigation(loadingNavigation); // If this is an uninterrupted revalidation, we remain in our current idle // state. If not, we need to switch to our loading state and load data, // preserving any new action data or existing action data (in the case of // a revalidation interrupting an actionReload) // If we have partialHydration enabled, then don't update the state for the // initial data load since it's not a "navigation" let shouldUpdateNavigationState = !isUninterruptedRevalidation && (!future.v7_partialHydration || !initialHydration); // When fog of war is enabled, we enter our `loading` state earlier so we // can discover new routes during the `loading` state. We skip this if // we've already run actions since we would have done our matching already. // If the children() function threw then, we want to proceed with the // partial matches it discovered. if (isFogOfWar) { if (shouldUpdateNavigationState) { let actionData = getUpdatedActionData(pendingActionResult); updateState(_extends({ navigation: loadingNavigation }, actionData !== undefined ? { actionData } : {}), { flushSync }); } let discoverResult = await discoverRoutes(matches, location.pathname, request.signal); if (discoverResult.type === "aborted") { return { shortCircuited: true }; } else if (discoverResult.type === "error") { let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id; return { matches: discoverResult.partialMatches, loaderData: {}, errors: { [boundaryId]: discoverResult.error } }; } else if (!discoverResult.matches) { let { error, notFoundMatches, route } = handleNavigational404(location.pathname); return { matches: notFoundMatches, loaderData: {}, errors: { [route.id]: error } }; } else { matches = discoverResult.matches; } } let routesToUse = inFlightDataRoutes || dataRoutes; let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, activeSubmission, location, future.v7_partialHydration && initialHydration === true, future.v7_skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult); // Cancel pending deferreds for no-longer-matched routes or routes we're // about to reload. Note that if this is an action reload we would have // already cancelled all pending deferreds so this would be a no-op cancelActiveDeferreds(routeId => !(matches && matches.some(m => m.route.id === routeId)) || matchesToLoad && matchesToLoad.some(m => m.route.id === routeId)); pendingNavigationLoadId = ++incrementingLoadId; // Short circuit if we have no loaders to run if (matchesToLoad.length === 0 && revalidatingFetchers.length === 0) { let updatedFetchers = markFetchRedirectsDone(); completeNavigation(location, _extends({ matches, loaderData: {}, // Commit pending error if we're short circuiting errors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? { [pendingActionResult[0]]: pendingActionResult[1].error } : null }, getActionDataForCommit(pendingActionResult), updatedFetchers ? { fetchers: new Map(state.fetchers) } : {}), { flushSync }); return { shortCircuited: true }; } if (shouldUpdateNavigationState) { let updates = {}; if (!isFogOfWar) { // Only update navigation/actionNData if we didn't already do it above updates.navigation = loadingNavigation; let actionData = getUpdatedActionData(pendingActionResult); if (actionData !== undefined) { updates.actionData = actionData; } } if (revalidatingFetchers.length > 0) { updates.fetchers = getUpdatedRevalidatingFetchers(revalidatingFetchers); } updateState(updates, { flushSync }); } revalidatingFetchers.forEach(rf => { abortFetcher(rf.key); if (rf.controller) { // Fetchers use an independent AbortController so that aborting a fetcher // (via deleteFetcher) does not abort the triggering navigation that // triggered the revalidation fetchControllers.set(rf.key, rf.controller); } }); // Proxy navigation abort through to revalidation fetchers let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach(f => abortFetcher(f.key)); if (pendingNavigationController) { pendingNavigationController.signal.addEventListener("abort", abortPendingFetchRevalidations); } let { loaderResults, fetcherResults } = await callLoadersAndMaybeResolveData(state, matches, matchesToLoad, revalidatingFetchers, request); if (request.signal.aborted) { return { shortCircuited: true }; } // Clean up _after_ loaders have completed. Don't clean up if we short // circuited because fetchControllers would have been aborted and // reassigned to new controllers for the next navigation if (pendingNavigationController) { pendingNavigationController.signal.removeEventListener("abort", abortPendingFetchRevalidations); } revalidatingFetchers.forEach(rf => fetchControllers.delete(rf.key)); // If any loaders returned a redirect Response, start a new REPLACE navigation let redirect = findRedirect(loaderResults); if (redirect) { await startRedirectNavigation(request, redirect.result, true, { replace }); return { shortCircuited: true }; } redirect = findRedirect(fetcherResults); if (redirect) { // If this redirect came from a fetcher make sure we mark it in // fetchRedirectIds so it doesn't get revalidated on the next set of // loader executions fetchRedirectIds.add(redirect.key); await startRedirectNavigation(request, redirect.result, true, { replace }); return { shortCircuited: true }; } // Process and commit output from loaders let { loaderData, errors } = processLoaderData(state, matches, loaderResults, pendingActionResult, revalidatingFetchers, fetcherResults, activeDeferreds); // Wire up subscribers to update loaderData as promises settle activeDeferreds.forEach((deferredData, routeId) => { deferredData.subscribe(aborted => { // Note: No need to updateState here since the TrackedPromise on // loaderData is stable across resolve/reject // Remove this instance if we were aborted or if promises have settled if (aborted || deferredData.done) { activeDeferreds.delete(routeId); } }); }); // Preserve SSR errors during partial hydration if (future.v7_partialHydration && initialHydration && state.errors) { errors = _extends({}, state.errors, errors); } let updatedFetchers = markFetchRedirectsDone(); let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId); let shouldUpdateFetchers = updatedFetchers || didAbortFetchLoads || revalidatingFetchers.length > 0; return _extends({ matches, loaderData, errors }, shouldUpdateFetchers ? { fetchers: new Map(state.fetchers) } : {}); } function getUpdatedActionData(pendingActionResult) { if (pendingActionResult && !isErrorResult(pendingActionResult[1])) { // This is cast to `any` currently because `RouteData`uses any and it // would be a breaking change to use any. // TODO: v7 - change `RouteData` to use `unknown` instead of `any` return { [pendingActionResult[0]]: pendingActionResult[1].data }; } else if (state.actionData) { if (Object.keys(state.actionData).length === 0) { return null; } else { return state.actionData; } } } function getUpdatedRevalidatingFetchers(revalidatingFetchers) { revalidatingFetchers.forEach(rf => { let fetcher = state.fetchers.get(rf.key); let revalidatingFetcher = getLoadingFetcher(undefined, fetcher ? fetcher.data : undefined); state.fetchers.set(rf.key, revalidatingFetcher); }); return new Map(state.fetchers); } // Trigger a fetcher load/submit for the given fetcher key function fetch(key, routeId, href, opts) { if (isServer) { throw new Error("router.fetch() was called during the server render, but it shouldn't be. " + "You are likely calling a useFetcher() method in the body of your component. " + "Try moving it to a useEffect or a callback."); } abortFetcher(key); let flushSync = (opts && opts.flushSync) === true; let routesToUse = inFlightDataRoutes || dataRoutes; let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, href, future.v7_relativeSplatPath, routeId, opts == null ? void 0 : opts.relative); let matches = matchRoutes(routesToUse, normalizedPath, basename); let fogOfWar = checkFogOfWar(matches, routesToUse, normalizedPath); if (fogOfWar.active && fogOfWar.matches) { matches = fogOfWar.matches; } if (!matches) { setFetcherError(key, routeId, getInternalRouterError(404, { pathname: normalizedPath }), { flushSync }); return; } let { path, submission, error } = normalizeNavigateOptions(future.v7_normalizeFormMethod, true, normalizedPath, opts); if (error) { setFetcherError(key, routeId, error, { flushSync }); return; } let match = getTargetMatch(matches, path); let preventScrollReset = (opts && opts.preventScrollReset) === true; if (submission && isMutationMethod(submission.formMethod)) { handleFetcherAction(key, routeId, path, match, matches, fogOfWar.active, flushSync, preventScrollReset, submission); return; } // Store off the match so we can call it's shouldRevalidate on subsequent // revalidations fetchLoadMatches.set(key, { routeId, path }); handleFetcherLoader(key, routeId, path, match, matches, fogOfWar.active, flushSync, preventScrollReset, submission); } // Call the action for the matched fetcher.submit(), and then handle redirects, // errors, and revalidation async function handleFetcherAction(key, routeId, path, match, requestMatches, isFogOfWar, flushSync, preventScrollReset, submission) { interruptActiveLoads(); fetchLoadMatches.delete(key); function detectAndHandle405Error(m) { if (!m.route.action && !m.route.lazy) { let error = getInternalRouterError(405, { method: submission.formMethod, pathname: path, routeId: routeId }); setFetcherError(key, routeId, error, { flushSync }); return true; } return false; } if (!isFogOfWar && detectAndHandle405Error(match)) { return; } // Put this fetcher into it's submitting state let existingFetcher = state.fetchers.get(key); updateFetcherState(key, getSubmittingFetcher(submission, existingFetcher), { flushSync }); let abortController = new AbortController(); let fetchRequest = createClientSideRequest(init.history, path, abortController.signal, submission); if (isFogOfWar) { let discoverResult = await discoverRoutes(requestMatches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key); if (discoverResult.type === "aborted") { return; } else if (discoverResult.type === "error") { setFetcherError(key, routeId, discoverResult.error, { flushSync }); return; } else if (!discoverResult.matches) { setFetcherError(key, routeId, getInternalRouterError(404, { pathname: path }), { flushSync }); return; } else { requestMatches = discoverResult.matches; match = getTargetMatch(requestMatches, path); if (detectAndHandle405Error(match)) { return; } } } // Call the action for the fetcher fetchControllers.set(key, abortController); let originatingLoadId = incrementingLoadId; let actionResults = await callDataStrategy("action", state, fetchRequest, [match], requestMatches, key); let actionResult = actionResults[match.route.id]; if (fetchRequest.signal.aborted) { // We can delete this so long as we weren't aborted by our own fetcher // re-submit which would have put _new_ controller is in fetchControllers if (fetchControllers.get(key) === abortController) { fetchControllers.delete(key); } return; } // When using v7_fetcherPersist, we don't want errors bubbling up to the UI // or redirects processed for unmounted fetchers so we just revert them to // idle if (future.v7_fetcherPersist && deletedFetchers.has(key)) { if (isRedirectResult(actionResult) || isErrorResult(actionResult)) { updateFetcherState(key, getDoneFetcher(undefined)); return; } // Let SuccessResult's fall through for revalidation } else { if (isRedirectResult(actionResult)) { fetchControllers.delete(key); if (pendingNavigationLoadId > originatingLoadId) { // A new navigation was kicked off after our action started, so that // should take precedence over this redirect navigation. We already // set isRevalidationRequired so all loaders for the new route should // fire unless opted out via shouldRevalidate updateFetcherState(key, getDoneFetcher(undefined)); return; } else { fetchRedirectIds.add(key); updateFetcherState(key, getLoadingFetcher(submission)); return startRedirectNavigation(fetchRequest, actionResult, false, { fetcherSubmission: submission, preventScrollReset }); } } // Process any non-redirect errors thrown if (isErrorResult(actionResult)) { setFetcherError(key, routeId, actionResult.error); return; } } if (isDeferredResult(actionResult)) { throw getInternalRouterError(400, { type: "defer-action" }); } // Start the data load for current matches, or the next location if we're // in the middle of a navigation let nextLocation = state.navigation.location || state.location; let revalidationRequest = createClientSideRequest(init.history, nextLocation, abortController.signal); let routesToUse = inFlightDataRoutes || dataRoutes; let matches = state.navigation.state !== "idle" ? matchRoutes(routesToUse, state.navigation.location, basename) : state.matches; invariant(matches, "Didn't find any matches after fetcher action"); let loadId = ++incrementingLoadId; fetchReloadIds.set(key, loadId); let loadFetcher = getLoadingFetcher(submission, actionResult.data); state.fetchers.set(key, loadFetcher); let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, submission, nextLocation, false, future.v7_skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, [match.route.id, actionResult]); // Put all revalidating fetchers into the loading state, except for the // current fetcher which we want to keep in it's current loading state which // contains it's action submission info + action data revalidatingFetchers.filter(rf => rf.key !== key).forEach(rf => { let staleKey = rf.key; let existingFetcher = state.fetchers.get(staleKey); let revalidatingFetcher = getLoadingFetcher(undefined, existingFetcher ? existingFetcher.data : undefined); state.fetchers.set(staleKey, revalidatingFetcher); abortFetcher(staleKey); if (rf.controller) { fetchControllers.set(staleKey, rf.controller); } }); updateState({ fetchers: new Map(state.fetchers) }); let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach(rf => abortFetcher(rf.key)); abortController.signal.addEventListener("abort", abortPendingFetchRevalidations); let { loaderResults, fetcherResults } = await callLoadersAndMaybeResolveData(state, matches, matchesToLoad, revalidatingFetchers, revalidationRequest); if (abortController.signal.aborted) { return; } abortController.signal.removeEventListener("abort", abortPendingFetchRevalidations); fetchReloadIds.delete(key); fetchControllers.delete(key); revalidatingFetchers.forEach(r => fetchControllers.delete(r.key)); let redirect = findRedirect(loaderResults); if (redirect) { return startRedirectNavigation(revalidationRequest, redirect.result, false, { preventScrollReset }); } redirect = findRedirect(fetcherResults); if (redirect) { // If this redirect came from a fetcher make sure we mark it in // fetchRedirectIds so it doesn't get revalidated on the next set of // loader executions fetchRedirectIds.add(redirect.key); return startRedirectNavigation(revalidationRequest, redirect.result, false, { preventScrollReset }); } // Process and commit output from loaders let { loaderData, errors } = processLoaderData(state, matches, loaderResults, undefined, revalidatingFetchers, fetcherResults, activeDeferreds); // Since we let revalidations complete even if the submitting fetcher was // deleted, only put it back to idle if it hasn't been deleted if (state.fetchers.has(key)) { let doneFetcher = getDoneFetcher(actionResult.data); state.fetchers.set(key, doneFetcher); } abortStaleFetchLoads(loadId); // If we are currently in a navigation loading state and this fetcher is // more recent than the navigation, we want the newer data so abort the // navigation and complete it with the fetcher data if (state.navigation.state === "loading" && loadId > pendingNavigationLoadId) { invariant(pendingAction, "Expected pending action"); pendingNavigationController && pendingNavigationController.abort(); completeNavigation(state.navigation.location, { matches, loaderData, errors, fetchers: new Map(state.fetchers) }); } else { // otherwise just update with the fetcher data, preserving any existing // loaderData for loaders that did not need to reload. We have to // manually merge here since we aren't going through completeNavigation updateState({ errors, loaderData: mergeLoaderData(state.loaderData, loaderData, matches, errors), fetchers: new Map(state.fetchers) }); isRevalidationRequired = false; } } // Call the matched loader for fetcher.load(), handling redirects, errors, etc. async function handleFetcherLoader(key, routeId, path, match, matches, isFogOfWar, flushSync, preventScrollReset, submission) { let existingFetcher = state.fetchers.get(key); updateFetcherState(key, getLoadingFetcher(submission, existingFetcher ? existingFetcher.data : undefined), { flushSync }); let abortController = new AbortController(); let fetchRequest = createClientSideRequest(init.history, path, abortController.signal); if (isFogOfWar) { let discoverResult = await discoverRoutes(matches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key); if (discoverResult.type === "aborted") { return; } else if (discoverResult.type === "error") { setFetcherError(key, routeId, discoverResult.error, { flushSync }); return; } else if (!discoverResult.matches) { setFetcherError(key, routeId, getInternalRouterError(404, { pathname: path }), { flushSync }); return; } else { matches = discoverResult.matches; match = getTargetMatch(matches, path); } } // Call the loader for this fetcher route match fetchControllers.set(key, abortController); let originatingLoadId = incrementingLoadId; let results = await callDataStrategy("loader", state, fetchRequest, [match], matches, key); let result = results[match.route.id]; // Deferred isn't supported for fetcher loads, await everything and treat it // as a normal load. resolveDeferredData will return undefined if this // fetcher gets aborted, so we just leave result untouched and short circuit // below if that happens if (isDeferredResult(result)) { result = (await resolveDeferredData(result, fetchRequest.signal, true)) || result; } // We can delete this so long as we weren't aborted by our our own fetcher // re-load which would have put _new_ controller is in fetchControllers if (fetchControllers.get(key) === abortController) { fetchControllers.delete(key); } if (fetchRequest.signal.aborted) { return; } // We don't want errors bubbling up or redirects followed for unmounted // fetchers, so short circuit here if it was removed from the UI if (deletedFetchers.has(key)) { updateFetcherState(key, getDoneFetcher(undefined)); return; } // If the loader threw a redirect Response, start a new REPLACE navigation if (isRedirectResult(result)) { if (pendingNavigationLoadId > originatingLoadId) { // A new navigation was kicked off after our loader started, so that // should take precedence over this redirect navigation updateFetcherState(key, getDoneFetcher(undefined)); return; } else { fetchRedirectIds.add(key); await startRedirectNavigation(fetchRequest, result, false, { preventScrollReset }); return; } } // Process any non-redirect errors thrown if (isErrorResult(result)) { setFetcherError(key, routeId, result.error); return; } invariant(!isDeferredResult(result), "Unhandled fetcher deferred data"); // Put the fetcher back into an idle state updateFetcherState(key, getDoneFetcher(result.data)); } /** * Utility function to handle redirects returned from an action or loader. * Normally, a redirect "replaces" the navigation that triggered it. So, for * example: * * - user is on /a * - user clicks a link to /b * - loader for /b redirects to /c * * In a non-JS app the browser would track the in-flight navigation to /b and * then replace it with /c when it encountered the redirect response. In * the end it would only ever update the URL bar with /c. * * In client-side routing using pushState/replaceState, we aim to emulate * this behavior and we also do not update history until the end of the * navigation (including processed redirects). This means that we never * actually touch history until we've processed redirects, so we just use * the history action from the original navigation (PUSH or REPLACE). */ async function startRedirectNavigation(request, redirect, isNavigation, _temp2) { let { submission, fetcherSubmission, preventScrollReset, replace } = _temp2 === void 0 ? {} : _temp2; if (redirect.response.headers.has("X-Remix-Revalidate")) { isRevalidationRequired = true; } let location = redirect.response.headers.get("Location"); invariant(location, "Expected a Location header on the redirect Response"); location = normalizeRedirectLocation(location, new URL(request.url), basename); let redirectLocation = createLocation(state.location, location, { _isRedirect: true }); if (isBrowser) { let isDocumentReload = false; if (redirect.response.headers.has("X-Remix-Reload-Document")) { // Hard reload if the response contained X-Remix-Reload-Document isDocumentReload = true; } else if (ABSOLUTE_URL_REGEX.test(location)) { const url = init.history.createURL(location); isDocumentReload = // Hard reload if it's an absolute URL to a new origin url.origin !== routerWindow.location.origin || // Hard reload if it's an absolute URL that does not match our basename stripBasename(url.pathname, basename) == null; } if (isDocumentReload) { if (replace) { routerWindow.location.replace(location); } else { routerWindow.location.assign(location); } return; } } // There's no need to abort on redirects, since we don't detect the // redirect until the action/loaders have settled pendingNavigationController = null; let redirectHistoryAction = replace === true || redirect.response.headers.has("X-Remix-Replace") ? Action.Replace : Action.Push; // Use the incoming submission if provided, fallback on the active one in // state.navigation let { formMethod, formAction, formEncType } = state.navigation; if (!submission && !fetcherSubmission && formMethod && formAction && formEncType) { submission = getSubmissionFromNavigation(state.navigation); } // If this was a 307/308 submission we want to preserve the HTTP method and // re-submit the GET/POST/PUT/PATCH/DELETE as a submission navigation to the // redirected location let activeSubmission = submission || fetcherSubmission; if (redirectPreserveMethodStatusCodes.has(redirect.response.status) && activeSubmission && isMutationMethod(activeSubmission.formMethod)) { await startNavigation(redirectHistoryAction, redirectLocation, { submission: _extends({}, activeSubmission, { formAction: location }), // Preserve these flags across redirects preventScrollReset: preventScrollReset || pendingPreventScrollReset, enableViewTransition: isNavigation ? pendingViewTransitionEnabled : undefined }); } else { // If we have a navigation submission, we will preserve it through the // redirect navigation let overrideNavigation = getLoadingNavigation(redirectLocation, submission); await startNavigation(redirectHistoryAction, redirectLocation, { overrideNavigation, // Send fetcher submissions through for shouldRevalidate fetcherSubmission, // Preserve these flags across redirects preventScrollReset: preventScrollReset || pendingPreventScrollReset, enableViewTransition: isNavigation ? pendingViewTransitionEnabled : undefined }); } } // Utility wrapper for calling dataStrategy client-side without having to // pass around the manifest, mapRouteProperties, etc. async function callDataStrategy(type, state, request, matchesToLoad, matches, fetcherKey) { let results; let dataResults = {}; try { results = await callDataStrategyImpl(dataStrategyImpl, type, state, request, matchesToLoad, matches, fetcherKey, manifest, mapRouteProperties); } catch (e) { // If the outer dataStrategy method throws, just return the error for all // matches - and it'll naturally bubble to the root matchesToLoad.forEach(m => { dataResults[m.route.id] = { type: ResultType.error, error: e }; }); return dataResults; } for (let [routeId, result] of Object.entries(results)) { if (isRedirectDataStrategyResultResult(result)) { let response = result.result; dataResults[routeId] = { type: ResultType.redirect, response: normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename, future.v7_relativeSplatPath) }; } else { dataResults[routeId] = await convertDataStrategyResultToDataResult(result); } } return dataResults; } async function callLoadersAndMaybeResolveData(state, matches, matchesToLoad, fetchersToLoad, request) { let currentMatches = state.matches; // Kick off loaders and fetchers in parallel let loaderResultsPromise = callDataStrategy("loader", state, request, matchesToLoad, matches, null); let fetcherResultsPromise = Promise.all(fetchersToLoad.map(async f => { if (f.matches && f.match && f.controller) { let results = await callDataStrategy("loader", state, createClientSideRequest(init.history, f.path, f.controller.signal), [f.match], f.matches, f.key); let result = results[f.match.route.id]; // Fetcher results are keyed by fetcher key from here on out, not routeId return { [f.key]: result }; } else { return Promise.resolve({ [f.key]: { type: ResultType.error, error: getInternalRouterError(404, { pathname: f.path }) } }); } })); let loaderResults = await loaderResultsPromise; let fetcherResults = (await fetcherResultsPromise).reduce((acc, r) => Object.assign(acc, r), {}); await Promise.all([resolveNavigationDeferredResults(matches, loaderResults, request.signal, currentMatches, state.loaderData), resolveFetcherDeferredResults(matches, fetcherResults, fetchersToLoad)]); return { loaderResults, fetcherResults }; } function interruptActiveLoads() { // Every interruption triggers a revalidation isRevalidationRequired = true; // Cancel pending route-level deferreds and mark cancelled routes for // revalidation cancelledDeferredRoutes.push(...cancelActiveDeferreds()); // Abort in-flight fetcher loads fetchLoadMatches.forEach((_, key) => { if (fetchControllers.has(key)) { cancelledFetcherLoads.add(key); } abortFetcher(key); }); } function updateFetcherState(key, fetcher, opts) { if (opts === void 0) { opts = {}; } state.fetchers.set(key, fetcher); updateState({ fetchers: new Map(state.fetchers) }, { flushSync: (opts && opts.flushSync) === true }); } function setFetcherError(key, routeId, error, opts) { if (opts === void 0) { opts = {}; } let boundaryMatch = findNearestBoundary(state.matches, routeId); deleteFetcher(key); updateState({ errors: { [boundaryMatch.route.id]: error }, fetchers: new Map(state.fetchers) }, { flushSync: (opts && opts.flushSync) === true }); } function getFetcher(key) { activeFetchers.set(key, (activeFetchers.get(key) || 0) + 1); // If this fetcher was previously marked for deletion, unmark it since we // have a new instance if (deletedFetchers.has(key)) { deletedFetchers.delete(key); } return state.fetchers.get(key) || IDLE_FETCHER; } function deleteFetcher(key) { let fetcher = state.fetchers.get(key); // Don't abort the controller if this is a deletion of a fetcher.submit() // in it's loading phase since - we don't want to abort the corresponding // revalidation and want them to complete and land if (fetchControllers.has(key) && !(fetcher && fetcher.state === "loading" && fetchReloadIds.has(key))) { abortFetcher(key); } fetchLoadMatches.delete(key); fetchReloadIds.delete(key); fetchRedirectIds.delete(key); // If we opted into the flag we can clear this now since we're calling // deleteFetcher() at the end of updateState() and we've already handed the // deleted fetcher keys off to the data layer. // If not, we're eagerly calling deleteFetcher() and we need to keep this // Set populated until the next updateState call, and we'll clear // `deletedFetchers` then if (future.v7_fetcherPersist) { deletedFetchers.delete(key); } cancelledFetcherLoads.delete(key); state.fetchers.delete(key); } function deleteFetcherAndUpdateState(key) { let count = (activeFetchers.get(key) || 0) - 1; if (count <= 0) { activeFetchers.delete(key); deletedFetchers.add(key); if (!future.v7_fetcherPersist) { deleteFetcher(key); } } else { activeFetchers.set(key, count); } updateState({ fetchers: new Map(state.fetchers) }); } function abortFetcher(key) { let controller = fetchControllers.get(key); if (controller) { controller.abort(); fetchControllers.delete(key); } } function markFetchersDone(keys) { for (let key of keys) { let fetcher = getFetcher(key); let doneFetcher = getDoneFetcher(fetcher.data); state.fetchers.set(key, doneFetcher); } } function markFetchRedirectsDone() { let doneKeys = []; let updatedFetchers = false; for (let key of fetchRedirectIds) { let fetcher = state.fetchers.get(key); invariant(fetcher, "Expected fetcher: " + key); if (fetcher.state === "loading") { fetchRedirectIds.delete(key); doneKeys.push(key); updatedFetchers = true; } } markFetchersDone(doneKeys); return updatedFetchers; } function abortStaleFetchLoads(landedId) { let yeetedKeys = []; for (let [key, id] of fetchReloadIds) { if (id < landedId) { let fetcher = state.fetchers.get(key); invariant(fetcher, "Expected fetcher: " + key); if (fetcher.state === "loading") { abortFetcher(key); fetchReloadIds.delete(key); yeetedKeys.push(key); } } } markFetchersDone(yeetedKeys); return yeetedKeys.length > 0; } function getBlocker(key, fn) { let blocker = state.blockers.get(key) || IDLE_BLOCKER; if (blockerFunctions.get(key) !== fn) { blockerFunctions.set(key, fn); } return blocker; } function deleteBlocker(key) { state.blockers.delete(key); blockerFunctions.delete(key); } // Utility function to update blockers, ensuring valid state transitions function updateBlocker(key, newBlocker) { let blocker = state.blockers.get(key) || IDLE_BLOCKER; // Poor mans state machine :) // https://mermaid.live/edit#pako:eNqVkc9OwzAMxl8l8nnjAYrEtDIOHEBIgwvKJTReGy3_lDpIqO27k6awMG0XcrLlnz87nwdonESogKXXBuE79rq75XZO3-yHds0RJVuv70YrPlUrCEe2HfrORS3rubqZfuhtpg5C9wk5tZ4VKcRUq88q9Z8RS0-48cE1iHJkL0ugbHuFLus9L6spZy8nX9MP2CNdomVaposqu3fGayT8T8-jJQwhepo_UtpgBQaDEUom04dZhAN1aJBDlUKJBxE1ceB2Smj0Mln-IBW5AFU2dwUiktt_2Qaq2dBfaKdEup85UV7Yd-dKjlnkabl2Pvr0DTkTreM invariant(blocker.state === "unblocked" && newBlocker.state === "blocked" || blocker.state === "blocked" && newBlocker.state === "blocked" || blocker.state === "blocked" && newBlocker.state === "proceeding" || blocker.state === "blocked" && newBlocker.state === "unblocked" || blocker.state === "proceeding" && newBlocker.state === "unblocked", "Invalid blocker state transition: " + blocker.state + " -> " + newBlocker.state); let blockers = new Map(state.blockers); blockers.set(key, newBlocker); updateState({ blockers }); } function shouldBlockNavigation(_ref2) { let { currentLocation, nextLocation, historyAction } = _ref2; if (blockerFunctions.size === 0) { return; } // We ony support a single active blocker at the moment since we don't have // any compelling use cases for multi-blocker yet if (blockerFunctions.size > 1) { warning(false, "A router only supports one blocker at a time"); } let entries = Array.from(blockerFunctions.entries()); let [blockerKey, blockerFunction] = entries[entries.length - 1]; let blocker = state.blockers.get(blockerKey); if (blocker && blocker.state === "proceeding") { // If the blocker is currently proceeding, we don't need to re-check // it and can let this navigation continue return; } // At this point, we know we're unblocked/blocked so we need to check the // user-provided blocker function if (blockerFunction({ currentLocation, nextLocation, historyAction })) { return blockerKey; } } function handleNavigational404(pathname) { let error = getInternalRouterError(404, { pathname }); let routesToUse = inFlightDataRoutes || dataRoutes; let { matches, route } = getShortCircuitMatches(routesToUse); // Cancel all pending deferred on 404s since we don't keep any routes cancelActiveDeferreds(); return { notFoundMatches: matches, route, error }; } function cancelActiveDeferreds(predicate) { let cancelledRouteIds = []; activeDeferreds.forEach((dfd, routeId) => { if (!predicate || predicate(routeId)) { // Cancel the deferred - but do not remove from activeDeferreds here - // we rely on the subscribers to do that so our tests can assert proper // cleanup via _internalActiveDeferreds dfd.cancel(); cancelledRouteIds.push(routeId); activeDeferreds.delete(routeId); } }); return cancelledRouteIds; } // Opt in to capturing and reporting scroll positions during navigations, // used by the component function enableScrollRestoration(positions, getPosition, getKey) { savedScrollPositions = positions; getScrollPosition = getPosition; getScrollRestorationKey = getKey || null; // Perform initial hydration scroll restoration, since we miss the boat on // the initial updateState() because we've not yet rendered // and therefore have no savedScrollPositions available if (!initialScrollRestored && state.navigation === IDLE_NAVIGATION) { initialScrollRestored = true; let y = getSavedScrollPosition(state.location, state.matches); if (y != null) { updateState({ restoreScrollPosition: y }); } } return () => { savedScrollPositions = null; getScrollPosition = null; getScrollRestorationKey = null; }; } function getScrollKey(location, matches) { if (getScrollRestorationKey) { let key = getScrollRestorationKey(location, matches.map(m => convertRouteMatchToUiMatch(m, state.loaderData))); return key || location.key; } return location.key; } function saveScrollPosition(location, matches) { if (savedScrollPositions && getScrollPosition) { let key = getScrollKey(location, matches); savedScrollPositions[key] = getScrollPosition(); } } function getSavedScrollPosition(location, matches) { if (savedScrollPositions) { let key = getScrollKey(location, matches); let y = savedScrollPositions[key]; if (typeof y === "number") { return y; } } return null; } function checkFogOfWar(matches, routesToUse, pathname) { if (patchRoutesOnNavigationImpl) { if (!matches) { let fogMatches = matchRoutesImpl(routesToUse, pathname, basename, true); return { active: true, matches: fogMatches || [] }; } else { if (Object.keys(matches[0].params).length > 0) { // If we matched a dynamic param or a splat, it might only be because // we haven't yet discovered other routes that would match with a // higher score. Call patchRoutesOnNavigation just to be sure let partialMatches = matchRoutesImpl(routesToUse, pathname, basename, true); return { active: true, matches: partialMatches }; } } } return { active: false, matches: null }; } async function discoverRoutes(matches, pathname, signal, fetcherKey) { if (!patchRoutesOnNavigationImpl) { return { type: "success", matches }; } let partialMatches = matches; while (true) { let isNonHMR = inFlightDataRoutes == null; let routesToUse = inFlightDataRoutes || dataRoutes; let localManifest = manifest; try { await patchRoutesOnNavigationImpl({ signal, path: pathname, matches: partialMatches, fetcherKey, patch: (routeId, children) => { if (signal.aborted) return; patchRoutesImpl(routeId, children, routesToUse, localManifest, mapRouteProperties); } }); } catch (e) { return { type: "error", error: e, partialMatches }; } finally { // If we are not in the middle of an HMR revalidation and we changed the // routes, provide a new identity so when we `updateState` at the end of // this navigation/fetch `router.routes` will be a new identity and // trigger a re-run of memoized `router.routes` dependencies. // HMR will already update the identity and reflow when it lands // `inFlightDataRoutes` in `completeNavigation` if (isNonHMR && !signal.aborted) { dataRoutes = [...dataRoutes]; } } if (signal.aborted) { return { type: "aborted" }; } let newMatches = matchRoutes(routesToUse, pathname, basename); if (newMatches) { return { type: "success", matches: newMatches }; } let newPartialMatches = matchRoutesImpl(routesToUse, pathname, basename, true); // Avoid loops if the second pass results in the same partial matches if (!newPartialMatches || partialMatches.length === newPartialMatches.length && partialMatches.every((m, i) => m.route.id === newPartialMatches[i].route.id)) { return { type: "success", matches: null }; } partialMatches = newPartialMatches; } } function _internalSetRoutes(newRoutes) { manifest = {}; inFlightDataRoutes = convertRoutesToDataRoutes(newRoutes, mapRouteProperties, undefined, manifest); } function patchRoutes(routeId, children) { let isNonHMR = inFlightDataRoutes == null; let routesToUse = inFlightDataRoutes || dataRoutes; patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties); // If we are not in the middle of an HMR revalidation and we changed the // routes, provide a new identity and trigger a reflow via `updateState` // to re-run memoized `router.routes` dependencies. // HMR will already update the identity and reflow when it lands // `inFlightDataRoutes` in `completeNavigation` if (isNonHMR) { dataRoutes = [...dataRoutes]; updateState({}); } } router = { get basename() { return basename; }, get future() { return future; }, get state() { return state; }, get routes() { return dataRoutes; }, get window() { return routerWindow; }, initialize, subscribe, enableScrollRestoration, navigate, fetch, revalidate, // Passthrough to history-aware createHref used by useHref so we get proper // hash-aware URLs in DOM paths createHref: to => init.history.createHref(to), encodeLocation: to => init.history.encodeLocation(to), getFetcher, deleteFetcher: deleteFetcherAndUpdateState, dispose, getBlocker, deleteBlocker, patchRoutes, _internalFetchControllers: fetchControllers, _internalActiveDeferreds: activeDeferreds, // TODO: Remove setRoutes, it's temporary to avoid dealing with // updating the tree while validating the update algorithm. _internalSetRoutes }; return router; } //#endregion //////////////////////////////////////////////////////////////////////////////// //#region createStaticHandler //////////////////////////////////////////////////////////////////////////////// const UNSAFE_DEFERRED_SYMBOL = Symbol("deferred"); function createStaticHandler(routes, opts) { invariant(routes.length > 0, "You must provide a non-empty routes array to createStaticHandler"); let manifest = {}; let basename = (opts ? opts.basename : null) || "/"; let mapRouteProperties; if (opts != null && opts.mapRouteProperties) { mapRouteProperties = opts.mapRouteProperties; } else if (opts != null && opts.detectErrorBoundary) { // If they are still using the deprecated version, wrap it with the new API let detectErrorBoundary = opts.detectErrorBoundary; mapRouteProperties = route => ({ hasErrorBoundary: detectErrorBoundary(route) }); } else { mapRouteProperties = defaultMapRouteProperties; } // Config driven behavior flags let future = _extends({ v7_relativeSplatPath: false, v7_throwAbortReason: false }, opts ? opts.future : null); let dataRoutes = convertRoutesToDataRoutes(routes, mapRouteProperties, undefined, manifest); /** * The query() method is intended for document requests, in which we want to * call an optional action and potentially multiple loaders for all nested * routes. It returns a StaticHandlerContext object, which is very similar * to the router state (location, loaderData, actionData, errors, etc.) and * also adds SSR-specific information such as the statusCode and headers * from action/loaders Responses. * * It _should_ never throw and should report all errors through the * returned context.errors object, properly associating errors to their error * boundary. Additionally, it tracks _deepestRenderedBoundaryId which can be * used to emulate React error boundaries during SSr by performing a second * pass only down to the boundaryId. * * The one exception where we do not return a StaticHandlerContext is when a * redirect response is returned or thrown from any action/loader. We * propagate that out and return the raw Response so the HTTP server can * return it directly. * * - `opts.requestContext` is an optional server context that will be passed * to actions/loaders in the `context` parameter * - `opts.skipLoaderErrorBubbling` is an optional parameter that will prevent * the bubbling of errors which allows single-fetch-type implementations * where the client will handle the bubbling and we may need to return data * for the handling route */ async function query(request, _temp3) { let { requestContext, skipLoaderErrorBubbling, dataStrategy } = _temp3 === void 0 ? {} : _temp3; let url = new URL(request.url); let method = request.method; let location = createLocation("", createPath(url), null, "default"); let matches = matchRoutes(dataRoutes, location, basename); // SSR supports HEAD requests while SPA doesn't if (!isValidMethod(method) && method !== "HEAD") { let error = getInternalRouterError(405, { method }); let { matches: methodNotAllowedMatches, route } = getShortCircuitMatches(dataRoutes); return { basename, location, matches: methodNotAllowedMatches, loaderData: {}, actionData: null, errors: { [route.id]: error }, statusCode: error.status, loaderHeaders: {}, actionHeaders: {}, activeDeferreds: null }; } else if (!matches) { let error = getInternalRouterError(404, { pathname: location.pathname }); let { matches: notFoundMatches, route } = getShortCircuitMatches(dataRoutes); return { basename, location, matches: notFoundMatches, loaderData: {}, actionData: null, errors: { [route.id]: error }, statusCode: error.status, loaderHeaders: {}, actionHeaders: {}, activeDeferreds: null }; } let result = await queryImpl(request, location, matches, requestContext, dataStrategy || null, skipLoaderErrorBubbling === true, null); if (isResponse(result)) { return result; } // When returning StaticHandlerContext, we patch back in the location here // since we need it for React Context. But this helps keep our submit and // loadRouteData operating on a Request instead of a Location return _extends({ location, basename }, result); } /** * The queryRoute() method is intended for targeted route requests, either * for fetch ?_data requests or resource route requests. In this case, we * are only ever calling a single action or loader, and we are returning the * returned value directly. In most cases, this will be a Response returned * from the action/loader, but it may be a primitive or other value as well - * and in such cases the calling context should handle that accordingly. * * We do respect the throw/return differentiation, so if an action/loader * throws, then this method will throw the value. This is important so we * can do proper boundary identification in Remix where a thrown Response * must go to the Catch Boundary but a returned Response is happy-path. * * One thing to note is that any Router-initiated Errors that make sense * to associate with a status code will be thrown as an ErrorResponse * instance which include the raw Error, such that the calling context can * serialize the error as they see fit while including the proper response * code. Examples here are 404 and 405 errors that occur prior to reaching * any user-defined loaders. * * - `opts.routeId` allows you to specify the specific route handler to call. * If not provided the handler will determine the proper route by matching * against `request.url` * - `opts.requestContext` is an optional server context that will be passed * to actions/loaders in the `context` parameter */ async function queryRoute(request, _temp4) { let { routeId, requestContext, dataStrategy } = _temp4 === void 0 ? {} : _temp4; let url = new URL(request.url); let method = request.method; let location = createLocation("", createPath(url), null, "default"); let matches = matchRoutes(dataRoutes, location, basename); // SSR supports HEAD requests while SPA doesn't if (!isValidMethod(method) && method !== "HEAD" && method !== "OPTIONS") { throw getInternalRouterError(405, { method }); } else if (!matches) { throw getInternalRouterError(404, { pathname: location.pathname }); } let match = routeId ? matches.find(m => m.route.id === routeId) : getTargetMatch(matches, location); if (routeId && !match) { throw getInternalRouterError(403, { pathname: location.pathname, routeId }); } else if (!match) { // This should never hit I don't think? throw getInternalRouterError(404, { pathname: location.pathname }); } let result = await queryImpl(request, location, matches, requestContext, dataStrategy || null, false, match); if (isResponse(result)) { return result; } let error = result.errors ? Object.values(result.errors)[0] : undefined; if (error !== undefined) { // If we got back result.errors, that means the loader/action threw // _something_ that wasn't a Response, but it's not guaranteed/required // to be an `instanceof Error` either, so we have to use throw here to // preserve the "error" state outside of queryImpl. throw error; } // Pick off the right state value to return if (result.actionData) { return Object.values(result.actionData)[0]; } if (result.loaderData) { var _result$activeDeferre; let data = Object.values(result.loaderData)[0]; if ((_result$activeDeferre = result.activeDeferreds) != null && _result$activeDeferre[match.route.id]) { data[UNSAFE_DEFERRED_SYMBOL] = result.activeDeferreds[match.route.id]; } return data; } return undefined; } async function queryImpl(request, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch) { invariant(request.signal, "query()/queryRoute() requests must contain an AbortController signal"); try { if (isMutationMethod(request.method.toLowerCase())) { let result = await submit(request, matches, routeMatch || getTargetMatch(matches, location), requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch != null); return result; } let result = await loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch); return isResponse(result) ? result : _extends({}, result, { actionData: null, actionHeaders: {} }); } catch (e) { // If the user threw/returned a Response in callLoaderOrAction for a // `queryRoute` call, we throw the `DataStrategyResult` to bail out early // and then return or throw the raw Response here accordingly if (isDataStrategyResult(e) && isResponse(e.result)) { if (e.type === ResultType.error) { throw e.result; } return e.result; } // Redirects are always returned since they don't propagate to catch // boundaries if (isRedirectResponse(e)) { return e; } throw e; } } async function submit(request, matches, actionMatch, requestContext, dataStrategy, skipLoaderErrorBubbling, isRouteRequest) { let result; if (!actionMatch.route.action && !actionMatch.route.lazy) { let error = getInternalRouterError(405, { method: request.method, pathname: new URL(request.url).pathname, routeId: actionMatch.route.id }); if (isRouteRequest) { throw error; } result = { type: ResultType.error, error }; } else { let results = await callDataStrategy("action", request, [actionMatch], matches, isRouteRequest, requestContext, dataStrategy); result = results[actionMatch.route.id]; if (request.signal.aborted) { throwStaticHandlerAbortedError(request, isRouteRequest, future); } } if (isRedirectResult(result)) { // Uhhhh - this should never happen, we should always throw these from // callLoaderOrAction, but the type narrowing here keeps TS happy and we // can get back on the "throw all redirect responses" train here should // this ever happen :/ throw new Response(null, { status: result.response.status, headers: { Location: result.response.headers.get("Location") } }); } if (isDeferredResult(result)) { let error = getInternalRouterError(400, { type: "defer-action" }); if (isRouteRequest) { throw error; } result = { type: ResultType.error, error }; } if (isRouteRequest) { // Note: This should only be non-Response values if we get here, since // isRouteRequest should throw any Response received in callLoaderOrAction if (isErrorResult(result)) { throw result.error; } return { matches: [actionMatch], loaderData: {}, actionData: { [actionMatch.route.id]: result.data }, errors: null, // Note: statusCode + headers are unused here since queryRoute will // return the raw Response or value statusCode: 200, loaderHeaders: {}, actionHeaders: {}, activeDeferreds: null }; } // Create a GET request for the loaders let loaderRequest = new Request(request.url, { headers: request.headers, redirect: request.redirect, signal: request.signal }); if (isErrorResult(result)) { // Store off the pending error - we use it to determine which loaders // to call and will commit it when we complete the navigation let boundaryMatch = skipLoaderErrorBubbling ? actionMatch : findNearestBoundary(matches, actionMatch.route.id); let context = await loadRouteData(loaderRequest, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, null, [boundaryMatch.route.id, result]); // action status codes take precedence over loader status codes return _extends({}, context, { statusCode: isRouteErrorResponse(result.error) ? result.error.status : result.statusCode != null ? result.statusCode : 500, actionData: null, actionHeaders: _extends({}, result.headers ? { [actionMatch.route.id]: result.headers } : {}) }); } let context = await loadRouteData(loaderRequest, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, null); return _extends({}, context, { actionData: { [actionMatch.route.id]: result.data } }, result.statusCode ? { statusCode: result.statusCode } : {}, { actionHeaders: result.headers ? { [actionMatch.route.id]: result.headers } : {} }); } async function loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, pendingActionResult) { let isRouteRequest = routeMatch != null; // Short circuit if we have no loaders to run (queryRoute()) if (isRouteRequest && !(routeMatch != null && routeMatch.route.loader) && !(routeMatch != null && routeMatch.route.lazy)) { throw getInternalRouterError(400, { method: request.method, pathname: new URL(request.url).pathname, routeId: routeMatch == null ? void 0 : routeMatch.route.id }); } let requestMatches = routeMatch ? [routeMatch] : pendingActionResult && isErrorResult(pendingActionResult[1]) ? getLoaderMatchesUntilBoundary(matches, pendingActionResult[0]) : matches; let matchesToLoad = requestMatches.filter(m => m.route.loader || m.route.lazy); // Short circuit if we have no loaders to run (query()) if (matchesToLoad.length === 0) { return { matches, // Add a null for all matched routes for proper revalidation on the client loaderData: matches.reduce((acc, m) => Object.assign(acc, { [m.route.id]: null }), {}), errors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? { [pendingActionResult[0]]: pendingActionResult[1].error } : null, statusCode: 200, loaderHeaders: {}, activeDeferreds: null }; } let results = await callDataStrategy("loader", request, matchesToLoad, matches, isRouteRequest, requestContext, dataStrategy); if (request.signal.aborted) { throwStaticHandlerAbortedError(request, isRouteRequest, future); } // Process and commit output from loaders let activeDeferreds = new Map(); let context = processRouteLoaderData(matches, results, pendingActionResult, activeDeferreds, skipLoaderErrorBubbling); // Add a null for any non-loader matches for proper revalidation on the client let executedLoaders = new Set(matchesToLoad.map(match => match.route.id)); matches.forEach(match => { if (!executedLoaders.has(match.route.id)) { context.loaderData[match.route.id] = null; } }); return _extends({}, context, { matches, activeDeferreds: activeDeferreds.size > 0 ? Object.fromEntries(activeDeferreds.entries()) : null }); } // Utility wrapper for calling dataStrategy server-side without having to // pass around the manifest, mapRouteProperties, etc. async function callDataStrategy(type, request, matchesToLoad, matches, isRouteRequest, requestContext, dataStrategy) { let results = await callDataStrategyImpl(dataStrategy || defaultDataStrategy, type, null, request, matchesToLoad, matches, null, manifest, mapRouteProperties, requestContext); let dataResults = {}; await Promise.all(matches.map(async match => { if (!(match.route.id in results)) { return; } let result = results[match.route.id]; if (isRedirectDataStrategyResultResult(result)) { let response = result.result; // Throw redirects and let the server handle them with an HTTP redirect throw normalizeRelativeRoutingRedirectResponse(response, request, match.route.id, matches, basename, future.v7_relativeSplatPath); } if (isResponse(result.result) && isRouteRequest) { // For SSR single-route requests, we want to hand Responses back // directly without unwrapping throw result; } dataResults[match.route.id] = await convertDataStrategyResultToDataResult(result); })); return dataResults; } return { dataRoutes, query, queryRoute }; } //#endregion //////////////////////////////////////////////////////////////////////////////// //#region Helpers //////////////////////////////////////////////////////////////////////////////// /** * Given an existing StaticHandlerContext and an error thrown at render time, * provide an updated StaticHandlerContext suitable for a second SSR render */ function getStaticContextFromError(routes, context, error) { let newContext = _extends({}, context, { statusCode: isRouteErrorResponse(error) ? error.status : 500, errors: { [context._deepestRenderedBoundaryId || routes[0].id]: error } }); return newContext; } function throwStaticHandlerAbortedError(request, isRouteRequest, future) { if (future.v7_throwAbortReason && request.signal.reason !== undefined) { throw request.signal.reason; } let method = isRouteRequest ? "queryRoute" : "query"; throw new Error(method + "() call aborted: " + request.method + " " + request.url); } function isSubmissionNavigation(opts) { return opts != null && ("formData" in opts && opts.formData != null || "body" in opts && opts.body !== undefined); } function normalizeTo(location, matches, basename, prependBasename, to, v7_relativeSplatPath, fromRouteId, relative) { let contextualMatches; let activeRouteMatch; if (fromRouteId) { // Grab matches up to the calling route so our route-relative logic is // relative to the correct source route contextualMatches = []; for (let match of matches) { contextualMatches.push(match); if (match.route.id === fromRouteId) { activeRouteMatch = match; break; } } } else { contextualMatches = matches; activeRouteMatch = matches[matches.length - 1]; } // Resolve the relative path let path = resolveTo(to ? to : ".", getResolveToMatches(contextualMatches, v7_relativeSplatPath), stripBasename(location.pathname, basename) || location.pathname, relative === "path"); // When `to` is not specified we inherit search/hash from the current // location, unlike when to="." and we just inherit the path. // See https://github.com/remix-run/remix/issues/927 if (to == null) { path.search = location.search; path.hash = location.hash; } // Account for `?index` params when routing to the current location if ((to == null || to === "" || to === ".") && activeRouteMatch) { let nakedIndex = hasNakedIndexQuery(path.search); if (activeRouteMatch.route.index && !nakedIndex) { // Add one when we're targeting an index route path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index"; } else if (!activeRouteMatch.route.index && nakedIndex) { // Remove existing ones when we're not let params = new URLSearchParams(path.search); let indexValues = params.getAll("index"); params.delete("index"); indexValues.filter(v => v).forEach(v => params.append("index", v)); let qs = params.toString(); path.search = qs ? "?" + qs : ""; } } // If we're operating within a basename, prepend it to the pathname. If // this is a root navigation, then just use the raw basename which allows // the basename to have full control over the presence of a trailing slash // on root actions if (prependBasename && basename !== "/") { path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]); } return createPath(path); } // Normalize navigation options by converting formMethod=GET formData objects to // URLSearchParams so they behave identically to links with query params function normalizeNavigateOptions(normalizeFormMethod, isFetcher, path, opts) { // Return location verbatim on non-submission navigations if (!opts || !isSubmissionNavigation(opts)) { return { path }; } if (opts.formMethod && !isValidMethod(opts.formMethod)) { return { path, error: getInternalRouterError(405, { method: opts.formMethod }) }; } let getInvalidBodyError = () => ({ path, error: getInternalRouterError(400, { type: "invalid-body" }) }); // Create a Submission on non-GET navigations let rawFormMethod = opts.formMethod || "get"; let formMethod = normalizeFormMethod ? rawFormMethod.toUpperCase() : rawFormMethod.toLowerCase(); let formAction = stripHashFromPath(path); if (opts.body !== undefined) { if (opts.formEncType === "text/plain") { // text only support POST/PUT/PATCH/DELETE submissions if (!isMutationMethod(formMethod)) { return getInvalidBodyError(); } let text = typeof opts.body === "string" ? opts.body : opts.body instanceof FormData || opts.body instanceof URLSearchParams ? // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plain-text-form-data Array.from(opts.body.entries()).reduce((acc, _ref3) => { let [name, value] = _ref3; return "" + acc + name + "=" + value + "\n"; }, "") : String(opts.body); return { path, submission: { formMethod, formAction, formEncType: opts.formEncType, formData: undefined, json: undefined, text } }; } else if (opts.formEncType === "application/json") { // json only supports POST/PUT/PATCH/DELETE submissions if (!isMutationMethod(formMethod)) { return getInvalidBodyError(); } try { let json = typeof opts.body === "string" ? JSON.parse(opts.body) : opts.body; return { path, submission: { formMethod, formAction, formEncType: opts.formEncType, formData: undefined, json, text: undefined } }; } catch (e) { return getInvalidBodyError(); } } } invariant(typeof FormData === "function", "FormData is not available in this environment"); let searchParams; let formData; if (opts.formData) { searchParams = convertFormDataToSearchParams(opts.formData); formData = opts.formData; } else if (opts.body instanceof FormData) { searchParams = convertFormDataToSearchParams(opts.body); formData = opts.body; } else if (opts.body instanceof URLSearchParams) { searchParams = opts.body; formData = convertSearchParamsToFormData(searchParams); } else if (opts.body == null) { searchParams = new URLSearchParams(); formData = new FormData(); } else { try { searchParams = new URLSearchParams(opts.body); formData = convertSearchParamsToFormData(searchParams); } catch (e) { return getInvalidBodyError(); } } let submission = { formMethod, formAction, formEncType: opts && opts.formEncType || "application/x-www-form-urlencoded", formData, json: undefined, text: undefined }; if (isMutationMethod(submission.formMethod)) { return { path, submission }; } // Flatten submission onto URLSearchParams for GET submissions let parsedPath = parsePath(path); // On GET navigation submissions we can drop the ?index param from the // resulting location since all loaders will run. But fetcher GET submissions // only run a single loader so we need to preserve any incoming ?index params if (isFetcher && parsedPath.search && hasNakedIndexQuery(parsedPath.search)) { searchParams.append("index", ""); } parsedPath.search = "?" + searchParams; return { path: createPath(parsedPath), submission }; } // Filter out all routes at/below any caught error as they aren't going to // render so we don't need to load them function getLoaderMatchesUntilBoundary(matches, boundaryId, includeBoundary) { if (includeBoundary === void 0) { includeBoundary = false; } let index = matches.findIndex(m => m.route.id === boundaryId); if (index >= 0) { return matches.slice(0, includeBoundary ? index + 1 : index); } return matches; } function getMatchesToLoad(history, state, matches, submission, location, initialHydration, skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult) { let actionResult = pendingActionResult ? isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : pendingActionResult[1].data : undefined; let currentUrl = history.createURL(state.location); let nextUrl = history.createURL(location); // Pick navigation matches that are net-new or qualify for revalidation let boundaryMatches = matches; if (initialHydration && state.errors) { // On initial hydration, only consider matches up to _and including_ the boundary. // This is inclusive to handle cases where a server loader ran successfully, // a child server loader bubbled up to this route, but this route has // `clientLoader.hydrate` so we want to still run the `clientLoader` so that // we have a complete version of `loaderData` boundaryMatches = getLoaderMatchesUntilBoundary(matches, Object.keys(state.errors)[0], true); } else if (pendingActionResult && isErrorResult(pendingActionResult[1])) { // If an action threw an error, we call loaders up to, but not including the // boundary boundaryMatches = getLoaderMatchesUntilBoundary(matches, pendingActionResult[0]); } // Don't revalidate loaders by default after action 4xx/5xx responses // when the flag is enabled. They can still opt-into revalidation via // `shouldRevalidate` via `actionResult` let actionStatus = pendingActionResult ? pendingActionResult[1].statusCode : undefined; let shouldSkipRevalidation = skipActionErrorRevalidation && actionStatus && actionStatus >= 400; let navigationMatches = boundaryMatches.filter((match, index) => { let { route } = match; if (route.lazy) { // We haven't loaded this route yet so we don't know if it's got a loader! return true; } if (route.loader == null) { return false; } if (initialHydration) { return shouldLoadRouteOnHydration(route, state.loaderData, state.errors); } // Always call the loader on new route instances and pending defer cancellations if (isNewLoader(state.loaderData, state.matches[index], match) || cancelledDeferredRoutes.some(id => id === match.route.id)) { return true; } // This is the default implementation for when we revalidate. If the route // provides it's own implementation, then we give them full control but // provide this value so they can leverage it if needed after they check // their own specific use cases let currentRouteMatch = state.matches[index]; let nextRouteMatch = match; return shouldRevalidateLoader(match, _extends({ currentUrl, currentParams: currentRouteMatch.params, nextUrl, nextParams: nextRouteMatch.params }, submission, { actionResult, actionStatus, defaultShouldRevalidate: shouldSkipRevalidation ? false : // Forced revalidation due to submission, useRevalidator, or X-Remix-Revalidate isRevalidationRequired || currentUrl.pathname + currentUrl.search === nextUrl.pathname + nextUrl.search || // Search params affect all loaders currentUrl.search !== nextUrl.search || isNewRouteInstance(currentRouteMatch, nextRouteMatch) })); }); // Pick fetcher.loads that need to be revalidated let revalidatingFetchers = []; fetchLoadMatches.forEach((f, key) => { // Don't revalidate: // - on initial hydration (shouldn't be any fetchers then anyway) // - if fetcher won't be present in the subsequent render // - no longer matches the URL (v7_fetcherPersist=false) // - was unmounted but persisted due to v7_fetcherPersist=true if (initialHydration || !matches.some(m => m.route.id === f.routeId) || deletedFetchers.has(key)) { return; } let fetcherMatches = matchRoutes(routesToUse, f.path, basename); // If the fetcher path no longer matches, push it in with null matches so // we can trigger a 404 in callLoadersAndMaybeResolveData. Note this is // currently only a use-case for Remix HMR where the route tree can change // at runtime and remove a route previously loaded via a fetcher if (!fetcherMatches) { revalidatingFetchers.push({ key, routeId: f.routeId, path: f.path, matches: null, match: null, controller: null }); return; } // Revalidating fetchers are decoupled from the route matches since they // load from a static href. They revalidate based on explicit revalidation // (submission, useRevalidator, or X-Remix-Revalidate) let fetcher = state.fetchers.get(key); let fetcherMatch = getTargetMatch(fetcherMatches, f.path); let shouldRevalidate = false; if (fetchRedirectIds.has(key)) { // Never trigger a revalidation of an actively redirecting fetcher shouldRevalidate = false; } else if (cancelledFetcherLoads.has(key)) { // Always mark for revalidation if the fetcher was cancelled cancelledFetcherLoads.delete(key); shouldRevalidate = true; } else if (fetcher && fetcher.state !== "idle" && fetcher.data === undefined) { // If the fetcher hasn't ever completed loading yet, then this isn't a // revalidation, it would just be a brand new load if an explicit // revalidation is required shouldRevalidate = isRevalidationRequired; } else { // Otherwise fall back on any user-defined shouldRevalidate, defaulting // to explicit revalidations only shouldRevalidate = shouldRevalidateLoader(fetcherMatch, _extends({ currentUrl, currentParams: state.matches[state.matches.length - 1].params, nextUrl, nextParams: matches[matches.length - 1].params }, submission, { actionResult, actionStatus, defaultShouldRevalidate: shouldSkipRevalidation ? false : isRevalidationRequired })); } if (shouldRevalidate) { revalidatingFetchers.push({ key, routeId: f.routeId, path: f.path, matches: fetcherMatches, match: fetcherMatch, controller: new AbortController() }); } }); return [navigationMatches, revalidatingFetchers]; } function shouldLoadRouteOnHydration(route, loaderData, errors) { // We dunno if we have a loader - gotta find out! if (route.lazy) { return true; } // No loader, nothing to initialize if (!route.loader) { return false; } let hasData = loaderData != null && loaderData[route.id] !== undefined; let hasError = errors != null && errors[route.id] !== undefined; // Don't run if we error'd during SSR if (!hasData && hasError) { return false; } // Explicitly opting-in to running on hydration if (typeof route.loader === "function" && route.loader.hydrate === true) { return true; } // Otherwise, run if we're not yet initialized with anything return !hasData && !hasError; } function isNewLoader(currentLoaderData, currentMatch, match) { let isNew = // [a] -> [a, b] !currentMatch || // [a, b] -> [a, c] match.route.id !== currentMatch.route.id; // Handle the case that we don't have data for a re-used route, potentially // from a prior error or from a cancelled pending deferred let isMissingData = currentLoaderData[match.route.id] === undefined; // Always load if this is a net-new route or we don't yet have data return isNew || isMissingData; } function isNewRouteInstance(currentMatch, match) { let currentPath = currentMatch.route.path; return ( // param change for this match, /users/123 -> /users/456 currentMatch.pathname !== match.pathname || // splat param changed, which is not present in match.path // e.g. /files/images/avatar.jpg -> files/finances.xls currentPath != null && currentPath.endsWith("*") && currentMatch.params["*"] !== match.params["*"] ); } function shouldRevalidateLoader(loaderMatch, arg) { if (loaderMatch.route.shouldRevalidate) { let routeChoice = loaderMatch.route.shouldRevalidate(arg); if (typeof routeChoice === "boolean") { return routeChoice; } } return arg.defaultShouldRevalidate; } function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties) { var _childrenToPatch; let childrenToPatch; if (routeId) { let route = manifest[routeId]; invariant(route, "No route found to patch children into: routeId = " + routeId); if (!route.children) { route.children = []; } childrenToPatch = route.children; } else { childrenToPatch = routesToUse; } // Don't patch in routes we already know about so that `patch` is idempotent // to simplify user-land code. This is useful because we re-call the // `patchRoutesOnNavigation` function for matched routes with params. let uniqueChildren = children.filter(newRoute => !childrenToPatch.some(existingRoute => isSameRoute(newRoute, existingRoute))); let newRoutes = convertRoutesToDataRoutes(uniqueChildren, mapRouteProperties, [routeId || "_", "patch", String(((_childrenToPatch = childrenToPatch) == null ? void 0 : _childrenToPatch.length) || "0")], manifest); childrenToPatch.push(...newRoutes); } function isSameRoute(newRoute, existingRoute) { // Most optimal check is by id if ("id" in newRoute && "id" in existingRoute && newRoute.id === existingRoute.id) { return true; } // Second is by pathing differences if (!(newRoute.index === existingRoute.index && newRoute.path === existingRoute.path && newRoute.caseSensitive === existingRoute.caseSensitive)) { return false; } // Pathless layout routes are trickier since we need to check children. // If they have no children then they're the same as far as we can tell if ((!newRoute.children || newRoute.children.length === 0) && (!existingRoute.children || existingRoute.children.length === 0)) { return true; } // Otherwise, we look to see if every child in the new route is already // represented in the existing route's children return newRoute.children.every((aChild, i) => { var _existingRoute$childr; return (_existingRoute$childr = existingRoute.children) == null ? void 0 : _existingRoute$childr.some(bChild => isSameRoute(aChild, bChild)); }); } /** * Execute route.lazy() methods to lazily load route modules (loader, action, * shouldRevalidate) and update the routeManifest in place which shares objects * with dataRoutes so those get updated as well. */ async function loadLazyRouteModule(route, mapRouteProperties, manifest) { if (!route.lazy) { return; } let lazyRoute = await route.lazy(); // If the lazy route function was executed and removed by another parallel // call then we can return - first lazy() to finish wins because the return // value of lazy is expected to be static if (!route.lazy) { return; } let routeToUpdate = manifest[route.id]; invariant(routeToUpdate, "No route found in manifest"); // Update the route in place. This should be safe because there's no way // we could yet be sitting on this route as we can't get there without // resolving lazy() first. // // This is different than the HMR "update" use-case where we may actively be // on the route being updated. The main concern boils down to "does this // mutation affect any ongoing navigations or any current state.matches // values?". If not, it should be safe to update in place. let routeUpdates = {}; for (let lazyRouteProperty in lazyRoute) { let staticRouteValue = routeToUpdate[lazyRouteProperty]; let isPropertyStaticallyDefined = staticRouteValue !== undefined && // This property isn't static since it should always be updated based // on the route updates lazyRouteProperty !== "hasErrorBoundary"; warning(!isPropertyStaticallyDefined, "Route \"" + routeToUpdate.id + "\" has a static property \"" + lazyRouteProperty + "\" " + "defined but its lazy function is also returning a value for this property. " + ("The lazy route property \"" + lazyRouteProperty + "\" will be ignored.")); if (!isPropertyStaticallyDefined && !immutableRouteKeys.has(lazyRouteProperty)) { routeUpdates[lazyRouteProperty] = lazyRoute[lazyRouteProperty]; } } // Mutate the route with the provided updates. Do this first so we pass // the updated version to mapRouteProperties Object.assign(routeToUpdate, routeUpdates); // Mutate the `hasErrorBoundary` property on the route based on the route // updates and remove the `lazy` function so we don't resolve the lazy // route again. Object.assign(routeToUpdate, _extends({}, mapRouteProperties(routeToUpdate), { lazy: undefined })); } // Default implementation of `dataStrategy` which fetches all loaders in parallel async function defaultDataStrategy(_ref4) { let { matches } = _ref4; let matchesToLoad = matches.filter(m => m.shouldLoad); let results = await Promise.all(matchesToLoad.map(m => m.resolve())); return results.reduce((acc, result, i) => Object.assign(acc, { [matchesToLoad[i].route.id]: result }), {}); } async function callDataStrategyImpl(dataStrategyImpl, type, state, request, matchesToLoad, matches, fetcherKey, manifest, mapRouteProperties, requestContext) { let loadRouteDefinitionsPromises = matches.map(m => m.route.lazy ? loadLazyRouteModule(m.route, mapRouteProperties, manifest) : undefined); let dsMatches = matches.map((match, i) => { let loadRoutePromise = loadRouteDefinitionsPromises[i]; let shouldLoad = matchesToLoad.some(m => m.route.id === match.route.id); // `resolve` encapsulates route.lazy(), executing the loader/action, // and mapping return values/thrown errors to a `DataStrategyResult`. Users // can pass a callback to take fine-grained control over the execution // of the loader/action let resolve = async handlerOverride => { if (handlerOverride && request.method === "GET" && (match.route.lazy || match.route.loader)) { shouldLoad = true; } return shouldLoad ? callLoaderOrAction(type, request, match, loadRoutePromise, handlerOverride, requestContext) : Promise.resolve({ type: ResultType.data, result: undefined }); }; return _extends({}, match, { shouldLoad, resolve }); }); // Send all matches here to allow for a middleware-type implementation. // handler will be a no-op for unneeded routes and we filter those results // back out below. let results = await dataStrategyImpl({ matches: dsMatches, request, params: matches[0].params, fetcherKey, context: requestContext }); // Wait for all routes to load here but 'swallow the error since we want // it to bubble up from the `await loadRoutePromise` in `callLoaderOrAction` - // called from `match.resolve()` try { await Promise.all(loadRouteDefinitionsPromises); } catch (e) { // No-op } return results; } // Default logic for calling a loader/action is the user has no specified a dataStrategy async function callLoaderOrAction(type, request, match, loadRoutePromise, handlerOverride, staticContext) { let result; let onReject; let runHandler = handler => { // Setup a promise we can race against so that abort signals short circuit let reject; // This will never resolve so safe to type it as Promise to // satisfy the function return value let abortPromise = new Promise((_, r) => reject = r); onReject = () => reject(); request.signal.addEventListener("abort", onReject); let actualHandler = ctx => { if (typeof handler !== "function") { return Promise.reject(new Error("You cannot call the handler for a route which defines a boolean " + ("\"" + type + "\" [routeId: " + match.route.id + "]"))); } return handler({ request, params: match.params, context: staticContext }, ...(ctx !== undefined ? [ctx] : [])); }; let handlerPromise = (async () => { try { let val = await (handlerOverride ? handlerOverride(ctx => actualHandler(ctx)) : actualHandler()); return { type: "data", result: val }; } catch (e) { return { type: "error", result: e }; } })(); return Promise.race([handlerPromise, abortPromise]); }; try { let handler = match.route[type]; // If we have a route.lazy promise, await that first if (loadRoutePromise) { if (handler) { // Run statically defined handler in parallel with lazy() let handlerError; let [value] = await Promise.all([ // If the handler throws, don't let it immediately bubble out, // since we need to let the lazy() execution finish so we know if this // route has a boundary that can handle the error runHandler(handler).catch(e => { handlerError = e; }), loadRoutePromise]); if (handlerError !== undefined) { throw handlerError; } result = value; } else { // Load lazy route module, then run any returned handler await loadRoutePromise; handler = match.route[type]; if (handler) { // Handler still runs even if we got interrupted to maintain consistency // with un-abortable behavior of handler execution on non-lazy or // previously-lazy-loaded routes result = await runHandler(handler); } else if (type === "action") { let url = new URL(request.url); let pathname = url.pathname + url.search; throw getInternalRouterError(405, { method: request.method, pathname, routeId: match.route.id }); } else { // lazy() route has no loader to run. Short circuit here so we don't // hit the invariant below that errors on returning undefined. return { type: ResultType.data, result: undefined }; } } } else if (!handler) { let url = new URL(request.url); let pathname = url.pathname + url.search; throw getInternalRouterError(404, { pathname }); } else { result = await runHandler(handler); } invariant(result.result !== undefined, "You defined " + (type === "action" ? "an action" : "a loader") + " for route " + ("\"" + match.route.id + "\" but didn't return anything from your `" + type + "` ") + "function. Please return a value or `null`."); } catch (e) { // We should already be catching and converting normal handler executions to // DataStrategyResults and returning them, so anything that throws here is an // unexpected error we still need to wrap return { type: ResultType.error, result: e }; } finally { if (onReject) { request.signal.removeEventListener("abort", onReject); } } return result; } async function convertDataStrategyResultToDataResult(dataStrategyResult) { let { result, type } = dataStrategyResult; if (isResponse(result)) { let data; try { let contentType = result.headers.get("Content-Type"); // Check between word boundaries instead of startsWith() due to the last // paragraph of https://httpwg.org/specs/rfc9110.html#field.content-type if (contentType && /\bapplication\/json\b/.test(contentType)) { if (result.body == null) { data = null; } else { data = await result.json(); } } else { data = await result.text(); } } catch (e) { return { type: ResultType.error, error: e }; } if (type === ResultType.error) { return { type: ResultType.error, error: new ErrorResponseImpl(result.status, result.statusText, data), statusCode: result.status, headers: result.headers }; } return { type: ResultType.data, data, statusCode: result.status, headers: result.headers }; } if (type === ResultType.error) { if (isDataWithResponseInit(result)) { var _result$init3, _result$init4; if (result.data instanceof Error) { var _result$init, _result$init2; return { type: ResultType.error, error: result.data, statusCode: (_result$init = result.init) == null ? void 0 : _result$init.status, headers: (_result$init2 = result.init) != null && _result$init2.headers ? new Headers(result.init.headers) : undefined }; } // Convert thrown data() to ErrorResponse instances return { type: ResultType.error, error: new ErrorResponseImpl(((_result$init3 = result.init) == null ? void 0 : _result$init3.status) || 500, undefined, result.data), statusCode: isRouteErrorResponse(result) ? result.status : undefined, headers: (_result$init4 = result.init) != null && _result$init4.headers ? new Headers(result.init.headers) : undefined }; } return { type: ResultType.error, error: result, statusCode: isRouteErrorResponse(result) ? result.status : undefined }; } if (isDeferredData(result)) { var _result$init5, _result$init6; return { type: ResultType.deferred, deferredData: result, statusCode: (_result$init5 = result.init) == null ? void 0 : _result$init5.status, headers: ((_result$init6 = result.init) == null ? void 0 : _result$init6.headers) && new Headers(result.init.headers) }; } if (isDataWithResponseInit(result)) { var _result$init7, _result$init8; return { type: ResultType.data, data: result.data, statusCode: (_result$init7 = result.init) == null ? void 0 : _result$init7.status, headers: (_result$init8 = result.init) != null && _result$init8.headers ? new Headers(result.init.headers) : undefined }; } return { type: ResultType.data, data: result }; } // Support relative routing in internal redirects function normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename, v7_relativeSplatPath) { let location = response.headers.get("Location"); invariant(location, "Redirects returned/thrown from loaders/actions must have a Location header"); if (!ABSOLUTE_URL_REGEX.test(location)) { let trimmedMatches = matches.slice(0, matches.findIndex(m => m.route.id === routeId) + 1); location = normalizeTo(new URL(request.url), trimmedMatches, basename, true, location, v7_relativeSplatPath); response.headers.set("Location", location); } return response; } function normalizeRedirectLocation(location, currentUrl, basename) { if (ABSOLUTE_URL_REGEX.test(location)) { // Strip off the protocol+origin for same-origin + same-basename absolute redirects let normalizedLocation = location; let url = normalizedLocation.startsWith("//") ? new URL(currentUrl.protocol + normalizedLocation) : new URL(normalizedLocation); let isSameBasename = stripBasename(url.pathname, basename) != null; if (url.origin === currentUrl.origin && isSameBasename) { return url.pathname + url.search + url.hash; } } return location; } // Utility method for creating the Request instances for loaders/actions during // client-side navigations and fetches. During SSR we will always have a // Request instance from the static handler (query/queryRoute) function createClientSideRequest(history, location, signal, submission) { let url = history.createURL(stripHashFromPath(location)).toString(); let init = { signal }; if (submission && isMutationMethod(submission.formMethod)) { let { formMethod, formEncType } = submission; // Didn't think we needed this but it turns out unlike other methods, patch // won't be properly normalized to uppercase and results in a 405 error. // See: https://fetch.spec.whatwg.org/#concept-method init.method = formMethod.toUpperCase(); if (formEncType === "application/json") { init.headers = new Headers({ "Content-Type": formEncType }); init.body = JSON.stringify(submission.json); } else if (formEncType === "text/plain") { // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request) init.body = submission.text; } else if (formEncType === "application/x-www-form-urlencoded" && submission.formData) { // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request) init.body = convertFormDataToSearchParams(submission.formData); } else { // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request) init.body = submission.formData; } } return new Request(url, init); } function convertFormDataToSearchParams(formData) { let searchParams = new URLSearchParams(); for (let [key, value] of formData.entries()) { // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#converting-an-entry-list-to-a-list-of-name-value-pairs searchParams.append(key, typeof value === "string" ? value : value.name); } return searchParams; } function convertSearchParamsToFormData(searchParams) { let formData = new FormData(); for (let [key, value] of searchParams.entries()) { formData.append(key, value); } return formData; } function processRouteLoaderData(matches, results, pendingActionResult, activeDeferreds, skipLoaderErrorBubbling) { // Fill in loaderData/errors from our loaders let loaderData = {}; let errors = null; let statusCode; let foundError = false; let loaderHeaders = {}; let pendingError = pendingActionResult && isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : undefined; // Process loader results into state.loaderData/state.errors matches.forEach(match => { if (!(match.route.id in results)) { return; } let id = match.route.id; let result = results[id]; invariant(!isRedirectResult(result), "Cannot handle redirect results in processLoaderData"); if (isErrorResult(result)) { let error = result.error; // If we have a pending action error, we report it at the highest-route // that throws a loader error, and then clear it out to indicate that // it was consumed if (pendingError !== undefined) { error = pendingError; pendingError = undefined; } errors = errors || {}; if (skipLoaderErrorBubbling) { errors[id] = error; } else { // Look upwards from the matched route for the closest ancestor error // boundary, defaulting to the root match. Prefer higher error values // if lower errors bubble to the same boundary let boundaryMatch = findNearestBoundary(matches, id); if (errors[boundaryMatch.route.id] == null) { errors[boundaryMatch.route.id] = error; } } // Clear our any prior loaderData for the throwing route loaderData[id] = undefined; // Once we find our first (highest) error, we set the status code and // prevent deeper status codes from overriding if (!foundError) { foundError = true; statusCode = isRouteErrorResponse(result.error) ? result.error.status : 500; } if (result.headers) { loaderHeaders[id] = result.headers; } } else { if (isDeferredResult(result)) { activeDeferreds.set(id, result.deferredData); loaderData[id] = result.deferredData.data; // Error status codes always override success status codes, but if all // loaders are successful we take the deepest status code. if (result.statusCode != null && result.statusCode !== 200 && !foundError) { statusCode = result.statusCode; } if (result.headers) { loaderHeaders[id] = result.headers; } } else { loaderData[id] = result.data; // Error status codes always override success status codes, but if all // loaders are successful we take the deepest status code. if (result.statusCode && result.statusCode !== 200 && !foundError) { statusCode = result.statusCode; } if (result.headers) { loaderHeaders[id] = result.headers; } } } }); // If we didn't consume the pending action error (i.e., all loaders // resolved), then consume it here. Also clear out any loaderData for the // throwing route if (pendingError !== undefined && pendingActionResult) { errors = { [pendingActionResult[0]]: pendingError }; loaderData[pendingActionResult[0]] = undefined; } return { loaderData, errors, statusCode: statusCode || 200, loaderHeaders }; } function processLoaderData(state, matches, results, pendingActionResult, revalidatingFetchers, fetcherResults, activeDeferreds) { let { loaderData, errors } = processRouteLoaderData(matches, results, pendingActionResult, activeDeferreds, false // This method is only called client side so we always want to bubble ); // Process results from our revalidating fetchers revalidatingFetchers.forEach(rf => { let { key, match, controller } = rf; let result = fetcherResults[key]; invariant(result, "Did not find corresponding fetcher result"); // Process fetcher non-redirect errors if (controller && controller.signal.aborted) { // Nothing to do for aborted fetchers return; } else if (isErrorResult(result)) { let boundaryMatch = findNearestBoundary(state.matches, match == null ? void 0 : match.route.id); if (!(errors && errors[boundaryMatch.route.id])) { errors = _extends({}, errors, { [boundaryMatch.route.id]: result.error }); } state.fetchers.delete(key); } else if (isRedirectResult(result)) { // Should never get here, redirects should get processed above, but we // keep this to type narrow to a success result in the else invariant(false, "Unhandled fetcher revalidation redirect"); } else if (isDeferredResult(result)) { // Should never get here, deferred data should be awaited for fetchers // in resolveDeferredResults invariant(false, "Unhandled fetcher deferred data"); } else { let doneFetcher = getDoneFetcher(result.data); state.fetchers.set(key, doneFetcher); } }); return { loaderData, errors }; } function mergeLoaderData(loaderData, newLoaderData, matches, errors) { let mergedLoaderData = _extends({}, newLoaderData); for (let match of matches) { let id = match.route.id; if (newLoaderData.hasOwnProperty(id)) { if (newLoaderData[id] !== undefined) { mergedLoaderData[id] = newLoaderData[id]; } } else if (loaderData[id] !== undefined && match.route.loader) { // Preserve existing keys not included in newLoaderData and where a loader // wasn't removed by HMR mergedLoaderData[id] = loaderData[id]; } if (errors && errors.hasOwnProperty(id)) { // Don't keep any loader data below the boundary break; } } return mergedLoaderData; } function getActionDataForCommit(pendingActionResult) { if (!pendingActionResult) { return {}; } return isErrorResult(pendingActionResult[1]) ? { // Clear out prior actionData on errors actionData: {} } : { actionData: { [pendingActionResult[0]]: pendingActionResult[1].data } }; } // Find the nearest error boundary, looking upwards from the leaf route (or the // route specified by routeId) for the closest ancestor error boundary, // defaulting to the root match function findNearestBoundary(matches, routeId) { let eligibleMatches = routeId ? matches.slice(0, matches.findIndex(m => m.route.id === routeId) + 1) : [...matches]; return eligibleMatches.reverse().find(m => m.route.hasErrorBoundary === true) || matches[0]; } function getShortCircuitMatches(routes) { // Prefer a root layout route if present, otherwise shim in a route object let route = routes.length === 1 ? routes[0] : routes.find(r => r.index || !r.path || r.path === "/") || { id: "__shim-error-route__" }; return { matches: [{ params: {}, pathname: "", pathnameBase: "", route }], route }; } function getInternalRouterError(status, _temp5) { let { pathname, routeId, method, type, message } = _temp5 === void 0 ? {} : _temp5; let statusText = "Unknown Server Error"; let errorMessage = "Unknown @remix-run/router error"; if (status === 400) { statusText = "Bad Request"; if (method && pathname && routeId) { errorMessage = "You made a " + method + " request to \"" + pathname + "\" but " + ("did not provide a `loader` for route \"" + routeId + "\", ") + "so there is no way to handle the request."; } else if (type === "defer-action") { errorMessage = "defer() is not supported in actions"; } else if (type === "invalid-body") { errorMessage = "Unable to encode submission body"; } } else if (status === 403) { statusText = "Forbidden"; errorMessage = "Route \"" + routeId + "\" does not match URL \"" + pathname + "\""; } else if (status === 404) { statusText = "Not Found"; errorMessage = "No route matches URL \"" + pathname + "\""; } else if (status === 405) { statusText = "Method Not Allowed"; if (method && pathname && routeId) { errorMessage = "You made a " + method.toUpperCase() + " request to \"" + pathname + "\" but " + ("did not provide an `action` for route \"" + routeId + "\", ") + "so there is no way to handle the request."; } else if (method) { errorMessage = "Invalid request method \"" + method.toUpperCase() + "\""; } } return new ErrorResponseImpl(status || 500, statusText, new Error(errorMessage), true); } // Find any returned redirect errors, starting from the lowest match function findRedirect(results) { let entries = Object.entries(results); for (let i = entries.length - 1; i >= 0; i--) { let [key, result] = entries[i]; if (isRedirectResult(result)) { return { key, result }; } } } function stripHashFromPath(path) { let parsedPath = typeof path === "string" ? parsePath(path) : path; return createPath(_extends({}, parsedPath, { hash: "" })); } function isHashChangeOnly(a, b) { if (a.pathname !== b.pathname || a.search !== b.search) { return false; } if (a.hash === "") { // /page -> /page#hash return b.hash !== ""; } else if (a.hash === b.hash) { // /page#hash -> /page#hash return true; } else if (b.hash !== "") { // /page#hash -> /page#other return true; } // If the hash is removed the browser will re-perform a request to the server // /page#hash -> /page return false; } function isDataStrategyResult(result) { return result != null && typeof result === "object" && "type" in result && "result" in result && (result.type === ResultType.data || result.type === ResultType.error); } function isRedirectDataStrategyResultResult(result) { return isResponse(result.result) && redirectStatusCodes.has(result.result.status); } function isDeferredResult(result) { return result.type === ResultType.deferred; } function isErrorResult(result) { return result.type === ResultType.error; } function isRedirectResult(result) { return (result && result.type) === ResultType.redirect; } function isDataWithResponseInit(value) { return typeof value === "object" && value != null && "type" in value && "data" in value && "init" in value && value.type === "DataWithResponseInit"; } function isDeferredData(value) { let deferred = value; return deferred && typeof deferred === "object" && typeof deferred.data === "object" && typeof deferred.subscribe === "function" && typeof deferred.cancel === "function" && typeof deferred.resolveData === "function"; } function isResponse(value) { return value != null && typeof value.status === "number" && typeof value.statusText === "string" && typeof value.headers === "object" && typeof value.body !== "undefined"; } function isRedirectResponse(result) { if (!isResponse(result)) { return false; } let status = result.status; let location = result.headers.get("Location"); return status >= 300 && status <= 399 && location != null; } function isValidMethod(method) { return validRequestMethods.has(method.toLowerCase()); } function isMutationMethod(method) { return validMutationMethods.has(method.toLowerCase()); } async function resolveNavigationDeferredResults(matches, results, signal, currentMatches, currentLoaderData) { let entries = Object.entries(results); for (let index = 0; index < entries.length; index++) { let [routeId, result] = entries[index]; let match = matches.find(m => (m == null ? void 0 : m.route.id) === routeId); // If we don't have a match, then we can have a deferred result to do // anything with. This is for revalidating fetchers where the route was // removed during HMR if (!match) { continue; } let currentMatch = currentMatches.find(m => m.route.id === match.route.id); let isRevalidatingLoader = currentMatch != null && !isNewRouteInstance(currentMatch, match) && (currentLoaderData && currentLoaderData[match.route.id]) !== undefined; if (isDeferredResult(result) && isRevalidatingLoader) { // Note: we do not have to touch activeDeferreds here since we race them // against the signal in resolveDeferredData and they'll get aborted // there if needed await resolveDeferredData(result, signal, false).then(result => { if (result) { results[routeId] = result; } }); } } } async function resolveFetcherDeferredResults(matches, results, revalidatingFetchers) { for (let index = 0; index < revalidatingFetchers.length; index++) { let { key, routeId, controller } = revalidatingFetchers[index]; let result = results[key]; let match = matches.find(m => (m == null ? void 0 : m.route.id) === routeId); // If we don't have a match, then we can have a deferred result to do // anything with. This is for revalidating fetchers where the route was // removed during HMR if (!match) { continue; } if (isDeferredResult(result)) { // Note: we do not have to touch activeDeferreds here since we race them // against the signal in resolveDeferredData and they'll get aborted // there if needed invariant(controller, "Expected an AbortController for revalidating fetcher deferred result"); await resolveDeferredData(result, controller.signal, true).then(result => { if (result) { results[key] = result; } }); } } } async function resolveDeferredData(result, signal, unwrap) { if (unwrap === void 0) { unwrap = false; } let aborted = await result.deferredData.resolveData(signal); if (aborted) { return; } if (unwrap) { try { return { type: ResultType.data, data: result.deferredData.unwrappedData }; } catch (e) { // Handle any TrackedPromise._error values encountered while unwrapping return { type: ResultType.error, error: e }; } } return { type: ResultType.data, data: result.deferredData.data }; } function hasNakedIndexQuery(search) { return new URLSearchParams(search).getAll("index").some(v => v === ""); } function getTargetMatch(matches, location) { let search = typeof location === "string" ? parsePath(location).search : location.search; if (matches[matches.length - 1].route.index && hasNakedIndexQuery(search || "")) { // Return the leaf index route when index is present return matches[matches.length - 1]; } // Otherwise grab the deepest "path contributing" match (ignoring index and // pathless layout routes) let pathMatches = getPathContributingMatches(matches); return pathMatches[pathMatches.length - 1]; } function getSubmissionFromNavigation(navigation) { let { formMethod, formAction, formEncType, text, formData, json } = navigation; if (!formMethod || !formAction || !formEncType) { return; } if (text != null) { return { formMethod, formAction, formEncType, formData: undefined, json: undefined, text }; } else if (formData != null) { return { formMethod, formAction, formEncType, formData, json: undefined, text: undefined }; } else if (json !== undefined) { return { formMethod, formAction, formEncType, formData: undefined, json, text: undefined }; } } function getLoadingNavigation(location, submission) { if (submission) { let navigation = { state: "loading", location, formMethod: submission.formMethod, formAction: submission.formAction, formEncType: submission.formEncType, formData: submission.formData, json: submission.json, text: submission.text }; return navigation; } else { let navigation = { state: "loading", location, formMethod: undefined, formAction: undefined, formEncType: undefined, formData: undefined, json: undefined, text: undefined }; return navigation; } } function getSubmittingNavigation(location, submission) { let navigation = { state: "submitting", location, formMethod: submission.formMethod, formAction: submission.formAction, formEncType: submission.formEncType, formData: submission.formData, json: submission.json, text: submission.text }; return navigation; } function getLoadingFetcher(submission, data) { if (submission) { let fetcher = { state: "loading", formMethod: submission.formMethod, formAction: submission.formAction, formEncType: submission.formEncType, formData: submission.formData, json: submission.json, text: submission.text, data }; return fetcher; } else { let fetcher = { state: "loading", formMethod: undefined, formAction: undefined, formEncType: undefined, formData: undefined, json: undefined, text: undefined, data }; return fetcher; } } function getSubmittingFetcher(submission, existingFetcher) { let fetcher = { state: "submitting", formMethod: submission.formMethod, formAction: submission.formAction, formEncType: submission.formEncType, formData: submission.formData, json: submission.json, text: submission.text, data: existingFetcher ? existingFetcher.data : undefined }; return fetcher; } function getDoneFetcher(data) { let fetcher = { state: "idle", formMethod: undefined, formAction: undefined, formEncType: undefined, formData: undefined, json: undefined, text: undefined, data }; return fetcher; } function restoreAppliedTransitions(_window, transitions) { try { let sessionPositions = _window.sessionStorage.getItem(TRANSITIONS_STORAGE_KEY); if (sessionPositions) { let json = JSON.parse(sessionPositions); for (let [k, v] of Object.entries(json || {})) { if (v && Array.isArray(v)) { transitions.set(k, new Set(v || [])); } } } } catch (e) { // no-op, use default empty object } } function persistAppliedTransitions(_window, transitions) { if (transitions.size > 0) { let json = {}; for (let [k, v] of transitions) { json[k] = [...v]; } try { _window.sessionStorage.setItem(TRANSITIONS_STORAGE_KEY, JSON.stringify(json)); } catch (error) { warning(false, "Failed to save applied view transitions in sessionStorage (" + error + ")."); } } } //#endregion //# sourceMappingURL=router.js.map /***/ }), /***/ 5787: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ i: () => (/* binding */ Symbols) /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6540); /* harmony import */ var lodash_upperFirst__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5808); /* harmony import */ var lodash_upperFirst__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_upperFirst__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9185); /* harmony import */ var victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8233); /* harmony import */ var victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8361); /* harmony import */ var victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(1838); /* harmony import */ var victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(6657); /* harmony import */ var victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(7233); /* harmony import */ var victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(7002); /* harmony import */ var victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(5545); /* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(8804); /* harmony import */ var _util_ReactUtils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(4501); function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } var _excluded = ["type", "size", "sizeType"]; function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); } function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; } /** * @fileOverview Curve */ var symbolFactories = { symbolCircle: victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A, symbolCross: victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A, symbolDiamond: victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A, symbolSquare: victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A, symbolStar: victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .A, symbolTriangle: victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .A, symbolWye: victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .A }; var RADIAN = Math.PI / 180; var getSymbolFactory = function getSymbolFactory(type) { var name = "symbol".concat(lodash_upperFirst__WEBPACK_IMPORTED_MODULE_1___default()(type)); return symbolFactories[name] || victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A; }; var calculateAreaSize = function calculateAreaSize(size, sizeType, type) { if (sizeType === 'area') { return size; } switch (type) { case 'cross': return 5 * size * size / 9; case 'diamond': return 0.5 * size * size / Math.sqrt(3); case 'square': return size * size; case 'star': { var angle = 18 * RADIAN; return 1.25 * size * size * (Math.tan(angle) - Math.tan(angle * 2) * Math.pow(Math.tan(angle), 2)); } case 'triangle': return Math.sqrt(3) * size * size / 4; case 'wye': return (21 - 10 * Math.sqrt(3)) * size * size / 8; default: return Math.PI * size * size / 4; } }; var registerSymbol = function registerSymbol(key, factory) { symbolFactories["symbol".concat(lodash_upperFirst__WEBPACK_IMPORTED_MODULE_1___default()(key))] = factory; }; var Symbols = function Symbols(_ref) { var _ref$type = _ref.type, type = _ref$type === void 0 ? 'circle' : _ref$type, _ref$size = _ref.size, size = _ref$size === void 0 ? 64 : _ref$size, _ref$sizeType = _ref.sizeType, sizeType = _ref$sizeType === void 0 ? 'area' : _ref$sizeType, rest = _objectWithoutProperties(_ref, _excluded); var props = _objectSpread(_objectSpread({}, rest), {}, { type: type, size: size, sizeType: sizeType }); /** * Calculate the path of curve * @return {String} path */ var getPath = function getPath() { var symbolFactory = getSymbolFactory(type); var symbol = (0,victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Ay)().type(symbolFactory).size(calculateAreaSize(size, sizeType, type)); return symbol(); }; var className = props.className, cx = props.cx, cy = props.cy; var filteredProps = (0,_util_ReactUtils__WEBPACK_IMPORTED_MODULE_10__/* .filterProps */ .J9)(props, true); if (cx === +cx && cy === +cy && size === +size) { return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", _extends({}, filteredProps, { className: (0,clsx__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .A)('recharts-symbols', className), transform: "translate(".concat(cx, ", ").concat(cy, ")"), d: getPath() })); } return null; }; Symbols.registerSymbol = registerSymbol; /***/ }), /***/ 6069: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ W: () => (/* binding */ Layer) /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6540); /* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8804); /* harmony import */ var _util_ReactUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4501); var _excluded = ["children", "className"]; function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; } var Layer = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(function (props, ref) { var children = props.children, className = props.className, others = _objectWithoutProperties(props, _excluded); var layerClass = (0,clsx__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)('recharts-layer', className); return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("g", _extends({ className: layerClass }, (0,_util_ReactUtils__WEBPACK_IMPORTED_MODULE_2__/* .filterProps */ .J9)(others, true), { ref: ref }), children); }); /***/ }), /***/ 6634: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ R: () => (/* binding */ warn) /* harmony export */ }); /* eslint no-console: 0 */ var isDev = "production" !== 'production'; var warn = function warn(condition, format) { for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { args[_key - 2] = arguments[_key]; } if (isDev && typeof console !== 'undefined' && console.warn) { if (format === undefined) { console.warn('LogUtils requires an error message argument'); } if (!condition) { if (format === undefined) { console.warn('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); } else { var argIndex = 0; console.warn(format.replace(/%s/g, function () { return args[argIndex++]; })); } } } }; /***/ }), /***/ 7463: /***/ ((__unused_webpack_module, exports) => { "use strict"; /** * @license React * scheduler.production.min.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. */ function f(a,b){var c=a.length;a.push(b);a:for(;0>>1,e=a[d];if(0>>1;dg(C,c))ng(x,C)?(a[d]=x,a[n]=c,d=n):(a[d]=C,a[m]=c,d=m);else if(ng(x,c))a[d]=x,a[n]=c,d=n;else break a}}return b} function g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if("object"===typeof performance&&"function"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q}}var r=[],t=[],u=1,v=null,y=3,z=!1,A=!1,B=!1,D="function"===typeof setTimeout?setTimeout:null,E="function"===typeof clearTimeout?clearTimeout:null,F="undefined"!==typeof setImmediate?setImmediate:null; "undefined"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(a){for(var b=h(t);null!==b;){if(null===b.callback)k(t);else if(b.startTime<=a)k(t),b.sortIndex=b.expirationTime,f(r,b);else break;b=h(t)}}function H(a){B=!1;G(a);if(!A)if(null!==h(r))A=!0,I(J);else{var b=h(t);null!==b&&K(H,b.startTime-a)}} function J(a,b){A=!1;B&&(B=!1,E(L),L=-1);z=!0;var c=y;try{G(b);for(v=h(r);null!==v&&(!(v.expirationTime>b)||a&&!M());){var d=v.callback;if("function"===typeof d){v.callback=null;y=v.priorityLevel;var e=d(v.expirationTime<=b);b=exports.unstable_now();"function"===typeof e?v.callback=e:v===h(r)&&k(r);G(b)}else k(r);v=h(r)}if(null!==v)var w=!0;else{var m=h(t);null!==m&&K(H,m.startTime-b);w=!1}return w}finally{v=null,y=c,z=!1}}var N=!1,O=null,L=-1,P=5,Q=-1; function M(){return exports.unstable_now()-Qa||125d?(a.sortIndex=c,f(t,a),null===h(r)&&a===h(t)&&(B?(E(L),L=-1):B=!0,K(H,c-d))):(a.sortIndex=e,f(r,a),A||z||(A=!0,I(J)));return a}; exports.unstable_shouldYield=M;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c}}}; /***/ }), /***/ 7659: /***/ ((module) => { "use strict"; var memo = {}; /* istanbul ignore next */ function getTarget(target) { if (typeof memo[target] === "undefined") { var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { try { // This will throw an exception if access to iframe is blocked // due to cross-origin restrictions styleTarget = styleTarget.contentDocument.head; } catch (e) { // istanbul ignore next styleTarget = null; } } memo[target] = styleTarget; } return memo[target]; } /* istanbul ignore next */ function insertBySelector(insert, style) { var target = getTarget(insert); if (!target) { throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."); } target.appendChild(style); } module.exports = insertBySelector; /***/ }), /***/ 7825: /***/ ((module) => { "use strict"; /* istanbul ignore next */ function apply(styleElement, options, obj) { var css = ""; if (obj.supports) { css += "@supports (".concat(obj.supports, ") {"); } if (obj.media) { css += "@media ".concat(obj.media, " {"); } var needLayer = typeof obj.layer !== "undefined"; if (needLayer) { css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {"); } css += obj.css; if (needLayer) { css += "}"; } if (obj.media) { css += "}"; } if (obj.supports) { css += "}"; } var sourceMap = obj.sourceMap; if (sourceMap && typeof btoa !== "undefined") { css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */"); } // For old IE /* istanbul ignore if */ options.styleTagTransform(css, styleElement, options.options); } function removeStyleElement(styleElement) { // istanbul ignore if if (styleElement.parentNode === null) { return false; } styleElement.parentNode.removeChild(styleElement); } /* istanbul ignore next */ function domAPI(options) { if (typeof document === "undefined") { return { update: function update() {}, remove: function remove() {} }; } var styleElement = options.insertStyleElement(options); return { update: function update(obj) { apply(styleElement, options, obj); }, remove: function remove() { removeStyleElement(styleElement); } }; } module.exports = domAPI; /***/ }), /***/ 8131: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Q: () => (/* binding */ PersistGate) /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6540); function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(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 _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _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; } // eslint-disable-line import/no-unresolved var PersistGate = /*#__PURE__*/ function (_PureComponent) { _inherits(PersistGate, _PureComponent); function PersistGate() { var _getPrototypeOf2; var _this; _classCallCheck(this, PersistGate); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(PersistGate)).call.apply(_getPrototypeOf2, [this].concat(args))); _defineProperty(_assertThisInitialized(_this), "state", { bootstrapped: false }); _defineProperty(_assertThisInitialized(_this), "_unsubscribe", void 0); _defineProperty(_assertThisInitialized(_this), "handlePersistorState", function () { var persistor = _this.props.persistor; var _persistor$getState = persistor.getState(), bootstrapped = _persistor$getState.bootstrapped; if (bootstrapped) { if (_this.props.onBeforeLift) { Promise.resolve(_this.props.onBeforeLift()).finally(function () { return _this.setState({ bootstrapped: true }); }); } else { _this.setState({ bootstrapped: true }); } _this._unsubscribe && _this._unsubscribe(); } }); return _this; } _createClass(PersistGate, [{ key: "componentDidMount", value: function componentDidMount() { this._unsubscribe = this.props.persistor.subscribe(this.handlePersistorState); this.handlePersistorState(); } }, { key: "componentWillUnmount", value: function componentWillUnmount() { this._unsubscribe && this._unsubscribe(); } }, { key: "render", value: function render() { if (false) // removed by dead control flow {} if (typeof this.props.children === 'function') { return this.props.children(this.state.bootstrapped); } return this.state.bootstrapped ? this.props.children : this.props.loading; } }]); return PersistGate; }(react__WEBPACK_IMPORTED_MODULE_0__.PureComponent); _defineProperty(PersistGate, "defaultProps", { children: null, loading: null }); /***/ }), /***/ 8522: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ h: () => (/* binding */ Sector) /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6540); /* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8804); /* harmony import */ var _util_ReactUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4501); /* harmony import */ var _util_PolarUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4040); /* harmony import */ var _util_DataUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9744); function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); } function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /** * @fileOverview Sector */ var getDeltaAngle = function getDeltaAngle(startAngle, endAngle) { var sign = (0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_1__/* .mathSign */ .sA)(endAngle - startAngle); var deltaAngle = Math.min(Math.abs(endAngle - startAngle), 359.999); return sign * deltaAngle; }; var getTangentCircle = function getTangentCircle(_ref) { var cx = _ref.cx, cy = _ref.cy, radius = _ref.radius, angle = _ref.angle, sign = _ref.sign, isExternal = _ref.isExternal, cornerRadius = _ref.cornerRadius, cornerIsExternal = _ref.cornerIsExternal; var centerRadius = cornerRadius * (isExternal ? 1 : -1) + radius; var theta = Math.asin(cornerRadius / centerRadius) / _util_PolarUtils__WEBPACK_IMPORTED_MODULE_2__/* .RADIAN */ .Kg; var centerAngle = cornerIsExternal ? angle : angle + sign * theta; var center = (0,_util_PolarUtils__WEBPACK_IMPORTED_MODULE_2__/* .polarToCartesian */ .IZ)(cx, cy, centerRadius, centerAngle); // The coordinate of point which is tangent to the circle var circleTangency = (0,_util_PolarUtils__WEBPACK_IMPORTED_MODULE_2__/* .polarToCartesian */ .IZ)(cx, cy, radius, centerAngle); // The coordinate of point which is tangent to the radius line var lineTangencyAngle = cornerIsExternal ? angle - sign * theta : angle; var lineTangency = (0,_util_PolarUtils__WEBPACK_IMPORTED_MODULE_2__/* .polarToCartesian */ .IZ)(cx, cy, centerRadius * Math.cos(theta * _util_PolarUtils__WEBPACK_IMPORTED_MODULE_2__/* .RADIAN */ .Kg), lineTangencyAngle); return { center: center, circleTangency: circleTangency, lineTangency: lineTangency, theta: theta }; }; var getSectorPath = function getSectorPath(_ref2) { var cx = _ref2.cx, cy = _ref2.cy, innerRadius = _ref2.innerRadius, outerRadius = _ref2.outerRadius, startAngle = _ref2.startAngle, endAngle = _ref2.endAngle; var angle = getDeltaAngle(startAngle, endAngle); // When the angle of sector equals to 360, star point and end point coincide var tempEndAngle = startAngle + angle; var outerStartPoint = (0,_util_PolarUtils__WEBPACK_IMPORTED_MODULE_2__/* .polarToCartesian */ .IZ)(cx, cy, outerRadius, startAngle); var outerEndPoint = (0,_util_PolarUtils__WEBPACK_IMPORTED_MODULE_2__/* .polarToCartesian */ .IZ)(cx, cy, outerRadius, tempEndAngle); var path = "M ".concat(outerStartPoint.x, ",").concat(outerStartPoint.y, "\n A ").concat(outerRadius, ",").concat(outerRadius, ",0,\n ").concat(+(Math.abs(angle) > 180), ",").concat(+(startAngle > tempEndAngle), ",\n ").concat(outerEndPoint.x, ",").concat(outerEndPoint.y, "\n "); if (innerRadius > 0) { var innerStartPoint = (0,_util_PolarUtils__WEBPACK_IMPORTED_MODULE_2__/* .polarToCartesian */ .IZ)(cx, cy, innerRadius, startAngle); var innerEndPoint = (0,_util_PolarUtils__WEBPACK_IMPORTED_MODULE_2__/* .polarToCartesian */ .IZ)(cx, cy, innerRadius, tempEndAngle); path += "L ".concat(innerEndPoint.x, ",").concat(innerEndPoint.y, "\n A ").concat(innerRadius, ",").concat(innerRadius, ",0,\n ").concat(+(Math.abs(angle) > 180), ",").concat(+(startAngle <= tempEndAngle), ",\n ").concat(innerStartPoint.x, ",").concat(innerStartPoint.y, " Z"); } else { path += "L ".concat(cx, ",").concat(cy, " Z"); } return path; }; var getSectorWithCorner = function getSectorWithCorner(_ref3) { var cx = _ref3.cx, cy = _ref3.cy, innerRadius = _ref3.innerRadius, outerRadius = _ref3.outerRadius, cornerRadius = _ref3.cornerRadius, forceCornerRadius = _ref3.forceCornerRadius, cornerIsExternal = _ref3.cornerIsExternal, startAngle = _ref3.startAngle, endAngle = _ref3.endAngle; var sign = (0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_1__/* .mathSign */ .sA)(endAngle - startAngle); var _getTangentCircle = getTangentCircle({ cx: cx, cy: cy, radius: outerRadius, angle: startAngle, sign: sign, cornerRadius: cornerRadius, cornerIsExternal: cornerIsExternal }), soct = _getTangentCircle.circleTangency, solt = _getTangentCircle.lineTangency, sot = _getTangentCircle.theta; var _getTangentCircle2 = getTangentCircle({ cx: cx, cy: cy, radius: outerRadius, angle: endAngle, sign: -sign, cornerRadius: cornerRadius, cornerIsExternal: cornerIsExternal }), eoct = _getTangentCircle2.circleTangency, eolt = _getTangentCircle2.lineTangency, eot = _getTangentCircle2.theta; var outerArcAngle = cornerIsExternal ? Math.abs(startAngle - endAngle) : Math.abs(startAngle - endAngle) - sot - eot; if (outerArcAngle < 0) { if (forceCornerRadius) { return "M ".concat(solt.x, ",").concat(solt.y, "\n a").concat(cornerRadius, ",").concat(cornerRadius, ",0,0,1,").concat(cornerRadius * 2, ",0\n a").concat(cornerRadius, ",").concat(cornerRadius, ",0,0,1,").concat(-cornerRadius * 2, ",0\n "); } return getSectorPath({ cx: cx, cy: cy, innerRadius: innerRadius, outerRadius: outerRadius, startAngle: startAngle, endAngle: endAngle }); } var path = "M ".concat(solt.x, ",").concat(solt.y, "\n A").concat(cornerRadius, ",").concat(cornerRadius, ",0,0,").concat(+(sign < 0), ",").concat(soct.x, ",").concat(soct.y, "\n A").concat(outerRadius, ",").concat(outerRadius, ",0,").concat(+(outerArcAngle > 180), ",").concat(+(sign < 0), ",").concat(eoct.x, ",").concat(eoct.y, "\n A").concat(cornerRadius, ",").concat(cornerRadius, ",0,0,").concat(+(sign < 0), ",").concat(eolt.x, ",").concat(eolt.y, "\n "); if (innerRadius > 0) { var _getTangentCircle3 = getTangentCircle({ cx: cx, cy: cy, radius: innerRadius, angle: startAngle, sign: sign, isExternal: true, cornerRadius: cornerRadius, cornerIsExternal: cornerIsExternal }), sict = _getTangentCircle3.circleTangency, silt = _getTangentCircle3.lineTangency, sit = _getTangentCircle3.theta; var _getTangentCircle4 = getTangentCircle({ cx: cx, cy: cy, radius: innerRadius, angle: endAngle, sign: -sign, isExternal: true, cornerRadius: cornerRadius, cornerIsExternal: cornerIsExternal }), eict = _getTangentCircle4.circleTangency, eilt = _getTangentCircle4.lineTangency, eit = _getTangentCircle4.theta; var innerArcAngle = cornerIsExternal ? Math.abs(startAngle - endAngle) : Math.abs(startAngle - endAngle) - sit - eit; if (innerArcAngle < 0 && cornerRadius === 0) { return "".concat(path, "L").concat(cx, ",").concat(cy, "Z"); } path += "L".concat(eilt.x, ",").concat(eilt.y, "\n A").concat(cornerRadius, ",").concat(cornerRadius, ",0,0,").concat(+(sign < 0), ",").concat(eict.x, ",").concat(eict.y, "\n A").concat(innerRadius, ",").concat(innerRadius, ",0,").concat(+(innerArcAngle > 180), ",").concat(+(sign > 0), ",").concat(sict.x, ",").concat(sict.y, "\n A").concat(cornerRadius, ",").concat(cornerRadius, ",0,0,").concat(+(sign < 0), ",").concat(silt.x, ",").concat(silt.y, "Z"); } else { path += "L".concat(cx, ",").concat(cy, "Z"); } return path; }; var defaultProps = { cx: 0, cy: 0, innerRadius: 0, outerRadius: 0, startAngle: 0, endAngle: 0, cornerRadius: 0, forceCornerRadius: false, cornerIsExternal: false }; var Sector = function Sector(sectorProps) { var props = _objectSpread(_objectSpread({}, defaultProps), sectorProps); var cx = props.cx, cy = props.cy, innerRadius = props.innerRadius, outerRadius = props.outerRadius, cornerRadius = props.cornerRadius, forceCornerRadius = props.forceCornerRadius, cornerIsExternal = props.cornerIsExternal, startAngle = props.startAngle, endAngle = props.endAngle, className = props.className; if (outerRadius < innerRadius || startAngle === endAngle) { return null; } var layerClass = (0,clsx__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A)('recharts-sector', className); var deltaRadius = outerRadius - innerRadius; var cr = (0,_util_DataUtils__WEBPACK_IMPORTED_MODULE_1__/* .getPercentValue */ .F4)(cornerRadius, deltaRadius, 0, true); var path; if (cr > 0 && Math.abs(startAngle - endAngle) < 360) { path = getSectorWithCorner({ cx: cx, cy: cy, innerRadius: innerRadius, outerRadius: outerRadius, cornerRadius: Math.min(cr, deltaRadius / 2), forceCornerRadius: forceCornerRadius, cornerIsExternal: cornerIsExternal, startAngle: startAngle, endAngle: endAngle }); } else { path = getSectorPath({ cx: cx, cy: cy, innerRadius: innerRadius, outerRadius: outerRadius, startAngle: startAngle, endAngle: endAngle }); } return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", _extends({}, (0,_util_ReactUtils__WEBPACK_IMPORTED_MODULE_4__/* .filterProps */ .J9)(props, true), { className: layerClass, d: path, role: "img" })); }; /***/ }), /***/ 8804: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* unused harmony export clsx */ function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ QQ: () => (/* binding */ SVGElementPropKeys), /* harmony export */ VU: () => (/* binding */ FilteredElementKeyMap), /* harmony export */ XC: () => (/* binding */ adaptEventsOfChild), /* harmony export */ _U: () => (/* binding */ adaptEventHandlers), /* harmony export */ j2: () => (/* binding */ EventKeys) /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6540); /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3805); /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_isObject__WEBPACK_IMPORTED_MODULE_1__); function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } /** * Determines how values are stacked: * * - `none` is the default, it adds values on top of each other. No smarts. Negative values will overlap. * - `expand` make it so that the values always add up to 1 - so the chart will look like a rectangle. * - `wiggle` and `silhouette` tries to keep the chart centered. * - `sign` stacks positive values above zero and negative values below zero. Similar to `none` but handles negatives. * - `positive` ignores all negative values, and then behaves like \`none\`. * * Also see https://d3js.org/d3-shape/stack#stack-offsets * (note that the `diverging` offset in d3 is named `sign` in recharts) */ // // Event Handler Types -- Copied from @types/react/index.d.ts and adapted for Props. // var SVGContainerPropKeys = ['viewBox', 'children']; var SVGElementPropKeys = ['aria-activedescendant', 'aria-atomic', 'aria-autocomplete', 'aria-busy', 'aria-checked', 'aria-colcount', 'aria-colindex', 'aria-colspan', 'aria-controls', 'aria-current', 'aria-describedby', 'aria-details', 'aria-disabled', 'aria-errormessage', 'aria-expanded', 'aria-flowto', 'aria-haspopup', 'aria-hidden', 'aria-invalid', 'aria-keyshortcuts', 'aria-label', 'aria-labelledby', 'aria-level', 'aria-live', 'aria-modal', 'aria-multiline', 'aria-multiselectable', 'aria-orientation', 'aria-owns', 'aria-placeholder', 'aria-posinset', 'aria-pressed', 'aria-readonly', 'aria-relevant', 'aria-required', 'aria-roledescription', 'aria-rowcount', 'aria-rowindex', 'aria-rowspan', 'aria-selected', 'aria-setsize', 'aria-sort', 'aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-valuetext', 'className', 'color', 'height', 'id', 'lang', 'max', 'media', 'method', 'min', 'name', 'style', /* * removed 'type' SVGElementPropKey because we do not currently use any SVG elements * that can use it and it conflicts with the recharts prop 'type' * https://github.com/recharts/recharts/pull/3327 * https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/type */ // 'type', 'target', 'width', 'role', 'tabIndex', 'accentHeight', 'accumulate', 'additive', 'alignmentBaseline', 'allowReorder', 'alphabetic', 'amplitude', 'arabicForm', 'ascent', 'attributeName', 'attributeType', 'autoReverse', 'azimuth', 'baseFrequency', 'baselineShift', 'baseProfile', 'bbox', 'begin', 'bias', 'by', 'calcMode', 'capHeight', 'clip', 'clipPath', 'clipPathUnits', 'clipRule', 'colorInterpolation', 'colorInterpolationFilters', 'colorProfile', 'colorRendering', 'contentScriptType', 'contentStyleType', 'cursor', 'cx', 'cy', 'd', 'decelerate', 'descent', 'diffuseConstant', 'direction', 'display', 'divisor', 'dominantBaseline', 'dur', 'dx', 'dy', 'edgeMode', 'elevation', 'enableBackground', 'end', 'exponent', 'externalResourcesRequired', 'fill', 'fillOpacity', 'fillRule', 'filter', 'filterRes', 'filterUnits', 'floodColor', 'floodOpacity', 'focusable', 'fontFamily', 'fontSize', 'fontSizeAdjust', 'fontStretch', 'fontStyle', 'fontVariant', 'fontWeight', 'format', 'from', 'fx', 'fy', 'g1', 'g2', 'glyphName', 'glyphOrientationHorizontal', 'glyphOrientationVertical', 'glyphRef', 'gradientTransform', 'gradientUnits', 'hanging', 'horizAdvX', 'horizOriginX', 'href', 'ideographic', 'imageRendering', 'in2', 'in', 'intercept', 'k1', 'k2', 'k3', 'k4', 'k', 'kernelMatrix', 'kernelUnitLength', 'kerning', 'keyPoints', 'keySplines', 'keyTimes', 'lengthAdjust', 'letterSpacing', 'lightingColor', 'limitingConeAngle', 'local', 'markerEnd', 'markerHeight', 'markerMid', 'markerStart', 'markerUnits', 'markerWidth', 'mask', 'maskContentUnits', 'maskUnits', 'mathematical', 'mode', 'numOctaves', 'offset', 'opacity', 'operator', 'order', 'orient', 'orientation', 'origin', 'overflow', 'overlinePosition', 'overlineThickness', 'paintOrder', 'panose1', 'pathLength', 'patternContentUnits', 'patternTransform', 'patternUnits', 'pointerEvents', 'pointsAtX', 'pointsAtY', 'pointsAtZ', 'preserveAlpha', 'preserveAspectRatio', 'primitiveUnits', 'r', 'radius', 'refX', 'refY', 'renderingIntent', 'repeatCount', 'repeatDur', 'requiredExtensions', 'requiredFeatures', 'restart', 'result', 'rotate', 'rx', 'ry', 'seed', 'shapeRendering', 'slope', 'spacing', 'specularConstant', 'specularExponent', 'speed', 'spreadMethod', 'startOffset', 'stdDeviation', 'stemh', 'stemv', 'stitchTiles', 'stopColor', 'stopOpacity', 'strikethroughPosition', 'strikethroughThickness', 'string', 'stroke', 'strokeDasharray', 'strokeDashoffset', 'strokeLinecap', 'strokeLinejoin', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth', 'surfaceScale', 'systemLanguage', 'tableValues', 'targetX', 'targetY', 'textAnchor', 'textDecoration', 'textLength', 'textRendering', 'to', 'transform', 'u1', 'u2', 'underlinePosition', 'underlineThickness', 'unicode', 'unicodeBidi', 'unicodeRange', 'unitsPerEm', 'vAlphabetic', 'values', 'vectorEffect', 'version', 'vertAdvY', 'vertOriginX', 'vertOriginY', 'vHanging', 'vIdeographic', 'viewTarget', 'visibility', 'vMathematical', 'widths', 'wordSpacing', 'writingMode', 'x1', 'x2', 'x', 'xChannelSelector', 'xHeight', 'xlinkActuate', 'xlinkArcrole', 'xlinkHref', 'xlinkRole', 'xlinkShow', 'xlinkTitle', 'xlinkType', 'xmlBase', 'xmlLang', 'xmlns', 'xmlnsXlink', 'xmlSpace', 'y1', 'y2', 'y', 'yChannelSelector', 'z', 'zoomAndPan', 'ref', 'key', 'angle']; var PolyElementKeys = ['points', 'pathLength']; /** svg element types that have specific attribute filtration requirements */ /** map of svg element types to unique svg attributes that belong to that element */ var FilteredElementKeyMap = { svg: SVGContainerPropKeys, polygon: PolyElementKeys, polyline: PolyElementKeys }; var EventKeys = ['dangerouslySetInnerHTML', 'onCopy', 'onCopyCapture', 'onCut', 'onCutCapture', 'onPaste', 'onPasteCapture', 'onCompositionEnd', 'onCompositionEndCapture', 'onCompositionStart', 'onCompositionStartCapture', 'onCompositionUpdate', 'onCompositionUpdateCapture', 'onFocus', 'onFocusCapture', 'onBlur', 'onBlurCapture', 'onChange', 'onChangeCapture', 'onBeforeInput', 'onBeforeInputCapture', 'onInput', 'onInputCapture', 'onReset', 'onResetCapture', 'onSubmit', 'onSubmitCapture', 'onInvalid', 'onInvalidCapture', 'onLoad', 'onLoadCapture', 'onError', 'onErrorCapture', 'onKeyDown', 'onKeyDownCapture', 'onKeyPress', 'onKeyPressCapture', 'onKeyUp', 'onKeyUpCapture', 'onAbort', 'onAbortCapture', 'onCanPlay', 'onCanPlayCapture', 'onCanPlayThrough', 'onCanPlayThroughCapture', 'onDurationChange', 'onDurationChangeCapture', 'onEmptied', 'onEmptiedCapture', 'onEncrypted', 'onEncryptedCapture', 'onEnded', 'onEndedCapture', 'onLoadedData', 'onLoadedDataCapture', 'onLoadedMetadata', 'onLoadedMetadataCapture', 'onLoadStart', 'onLoadStartCapture', 'onPause', 'onPauseCapture', 'onPlay', 'onPlayCapture', 'onPlaying', 'onPlayingCapture', 'onProgress', 'onProgressCapture', 'onRateChange', 'onRateChangeCapture', 'onSeeked', 'onSeekedCapture', 'onSeeking', 'onSeekingCapture', 'onStalled', 'onStalledCapture', 'onSuspend', 'onSuspendCapture', 'onTimeUpdate', 'onTimeUpdateCapture', 'onVolumeChange', 'onVolumeChangeCapture', 'onWaiting', 'onWaitingCapture', 'onAuxClick', 'onAuxClickCapture', 'onClick', 'onClickCapture', 'onContextMenu', 'onContextMenuCapture', 'onDoubleClick', 'onDoubleClickCapture', 'onDrag', 'onDragCapture', 'onDragEnd', 'onDragEndCapture', 'onDragEnter', 'onDragEnterCapture', 'onDragExit', 'onDragExitCapture', 'onDragLeave', 'onDragLeaveCapture', 'onDragOver', 'onDragOverCapture', 'onDragStart', 'onDragStartCapture', 'onDrop', 'onDropCapture', 'onMouseDown', 'onMouseDownCapture', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseMoveCapture', 'onMouseOut', 'onMouseOutCapture', 'onMouseOver', 'onMouseOverCapture', 'onMouseUp', 'onMouseUpCapture', 'onSelect', 'onSelectCapture', 'onTouchCancel', 'onTouchCancelCapture', 'onTouchEnd', 'onTouchEndCapture', 'onTouchMove', 'onTouchMoveCapture', 'onTouchStart', 'onTouchStartCapture', 'onPointerDown', 'onPointerDownCapture', 'onPointerMove', 'onPointerMoveCapture', 'onPointerUp', 'onPointerUpCapture', 'onPointerCancel', 'onPointerCancelCapture', 'onPointerEnter', 'onPointerEnterCapture', 'onPointerLeave', 'onPointerLeaveCapture', 'onPointerOver', 'onPointerOverCapture', 'onPointerOut', 'onPointerOutCapture', 'onGotPointerCapture', 'onGotPointerCaptureCapture', 'onLostPointerCapture', 'onLostPointerCaptureCapture', 'onScroll', 'onScrollCapture', 'onWheel', 'onWheelCapture', 'onAnimationStart', 'onAnimationStartCapture', 'onAnimationEnd', 'onAnimationEndCapture', 'onAnimationIteration', 'onAnimationIterationCapture', 'onTransitionEnd', 'onTransitionEndCapture']; /** The type of easing function to use for animations */ /** Specifies the duration of animation, the unit of this option is ms. */ /** the offset of a chart, which define the blank space all around */ /** * The domain of axis. * This is the definition * * Numeric domain is always defined by an array of exactly two values, for the min and the max of the axis. * Categorical domain is defined as array of all possible values. * * Can be specified in many ways: * - array of numbers * - with special strings like 'dataMin' and 'dataMax' * - with special string math like 'dataMin - 100' * - with keyword 'auto' * - or a function * - array of functions * - or a combination of the above */ /** * NumberDomain is an evaluated {@link AxisDomain}. * Unlike {@link AxisDomain}, it has no variety - it's a tuple of two number. * This is after all the keywords and functions were evaluated and what is left is [min, max]. * * Know that the min, max values are not guaranteed to be nice numbers - values like -Infinity or NaN are possible. * * There are also `category` axes that have different things than numbers in their domain. */ /** The props definition of base axis */ /** Defines how ticks are placed and whether / how tick collisions are handled. * 'preserveStart' keeps the left tick on collision and ensures that the first tick is always shown. * 'preserveEnd' keeps the right tick on collision and ensures that the last tick is always shown. * 'preserveStartEnd' keeps the left tick on collision and ensures that the first and last ticks are always shown. * 'equidistantPreserveStart' selects a number N such that every nTh tick will be shown without collision. */ var adaptEventHandlers = function adaptEventHandlers(props, newHandler) { if (!props || typeof props === 'function' || typeof props === 'boolean') { return null; } var inputProps = props; if ( /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.isValidElement)(props)) { inputProps = props.props; } if (!lodash_isObject__WEBPACK_IMPORTED_MODULE_1___default()(inputProps)) { return null; } var out = {}; Object.keys(inputProps).forEach(function (key) { if (EventKeys.includes(key)) { out[key] = newHandler || function (e) { return inputProps[key](inputProps, e); }; } }); return out; }; var getEventHandlerOfChild = function getEventHandlerOfChild(originalHandler, data, index) { return function (e) { originalHandler(data, index, e); return null; }; }; var adaptEventsOfChild = function adaptEventsOfChild(props, data, index) { if (!lodash_isObject__WEBPACK_IMPORTED_MODULE_1___default()(props) || _typeof(props) !== 'object') { return null; } var out = null; Object.keys(props).forEach(function (key) { var item = props[key]; if (EventKeys.includes(key) && typeof item === 'function') { if (!out) out = {}; out[key] = getEventHandlerOfChild(item, data, index); } }); return out; }; /***/ }), /***/ 9056: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { NP: () => (/* binding */ Le), AH: () => (/* binding */ Ae), Ay: () => (/* binding */ styled_components_browser_esm) }); // UNUSED EXPORTS: ServerStyleSheet, StyleSheetConsumer, StyleSheetContext, StyleSheetManager, ThemeConsumer, ThemeContext, __PRIVATE__, createGlobalStyle, isStyledComponent, keyframes, useTheme, version, withTheme // EXTERNAL MODULE: ./node_modules/react-is/index.js var react_is = __webpack_require__(4363); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(6540); // EXTERNAL MODULE: ./node_modules/shallowequal/index.js var shallowequal = __webpack_require__(2833); var shallowequal_default = /*#__PURE__*/__webpack_require__.n(shallowequal); // EXTERNAL MODULE: ./node_modules/@emotion/stylis/dist/stylis.browser.esm.js var stylis_browser_esm = __webpack_require__(8887); ;// ./node_modules/styled-components/node_modules/@emotion/unitless/dist/unitless.browser.esm.js var unitlessKeys = { animationIterationCount: 1, borderImageOutset: 1, borderImageSlice: 1, borderImageWidth: 1, boxFlex: 1, boxFlexGroup: 1, boxOrdinalGroup: 1, columnCount: 1, columns: 1, flex: 1, flexGrow: 1, flexPositive: 1, flexShrink: 1, flexNegative: 1, flexOrder: 1, gridRow: 1, gridRowEnd: 1, gridRowSpan: 1, gridRowStart: 1, gridColumn: 1, gridColumnEnd: 1, gridColumnSpan: 1, gridColumnStart: 1, msGridRow: 1, msGridRowSpan: 1, msGridColumn: 1, msGridColumnSpan: 1, fontWeight: 1, lineHeight: 1, opacity: 1, order: 1, orphans: 1, tabSize: 1, widows: 1, zIndex: 1, zoom: 1, WebkitLineClamp: 1, // SVG-related properties fillOpacity: 1, floodOpacity: 1, stopOpacity: 1, strokeDasharray: 1, strokeDashoffset: 1, strokeMiterlimit: 1, strokeOpacity: 1, strokeWidth: 1 }; /* harmony default export */ const unitless_browser_esm = (unitlessKeys); // EXTERNAL MODULE: ./node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js var emotion_is_prop_valid_esm = __webpack_require__(1907); // EXTERNAL MODULE: ./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js var hoist_non_react_statics_cjs = __webpack_require__(4146); var hoist_non_react_statics_cjs_default = /*#__PURE__*/__webpack_require__.n(hoist_non_react_statics_cjs); ;// ./node_modules/styled-components/dist/styled-components.browser.esm.js function y(){return(y=Object.assign||function(e){for(var t=1;t1?t-1:0),r=1;r0?" Args: "+n.join(", "):"")):0}var j=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}var t=e.prototype;return t.indexOfGroup=function(e){for(var t=0,n=0;n=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,o=r;e>=o;)(o<<=1)<0&&D(16,""+e);this.groupSizes=new Uint32Array(o),this.groupSizes.set(n),this.length=o;for(var s=r;s=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),o=r+n,s=r;s=k&&(k=t+1),T.set(e,t),x.set(t,e)},M="style["+N+'][data-styled-version="5.3.11"]',G=new RegExp("^"+N+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),L=function(e,t,n){for(var r,o=n.split(","),s=0,i=o.length;s=0;n--){var r=t[n];if(r&&1===r.nodeType&&r.hasAttribute(N))return r}}(n),s=void 0!==o?o.nextSibling:null;r.setAttribute(N,"active"),r.setAttribute("data-styled-version","5.3.11");var i=Y();return i&&r.setAttribute("nonce",i),n.insertBefore(r,s),r},H=function(){function e(e){var t=this.element=q(e);t.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n=0){var n=document.createTextNode(t),r=this.nodes[e];return this.element.insertBefore(n,r||null),this.length++,!0}return!1},t.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.getRule=function(e){return e0&&(u+=e+",")})),r+=""+a+c+'{content:"'+u+'"}/*!sc*/\n'}}}return r}(this)},e}(),Z=/(a)(d)/gi,K=function(e){return String.fromCharCode(e+(e>25?39:97))};function Q(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=K(t%52)+n;return(K(t%52)+n).replace(Z,"$1-$2")}var ee=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},te=function(e){return ee(5381,e)};function ne(e){for(var t=0;t>>0);if(!t.hasNameForId(r,i)){var a=n(s,"."+i,void 0,r);t.insertRules(r,i,a)}o.push(i),this.staticRulesId=i}else{for(var c=this.rules.length,u=ee(this.baseHash,n.hash),l="",d=0;d>>0);if(!t.hasNameForId(r,m)){var y=n(l,"."+m,void 0,r);t.insertRules(r,m,y)}o.push(m)}}return o.join(" ")},e}(),se=/^\s*\/\/.*$/gm,ie=[":","[",".","#"];function ae(e){var t,n,r,o,s=void 0===e?w:e,i=s.options,a=void 0===i?w:i,c=s.plugins,u=void 0===c?S:c,l=new stylis_browser_esm/* default */.A(a),d=[],p=function(e){function t(t){if(t)try{e(t+"}")}catch(e){}}return function(n,r,o,s,i,a,c,u,l,d){switch(n){case 1:if(0===l&&64===r.charCodeAt(0))return e(r+";"),"";break;case 2:if(0===u)return r+"/*|*/";break;case 3:switch(u){case 102:case 112:return e(o[0]+r),"";default:return r+(0===d?"/*|*/":"")}case-2:r.split("/*|*/}").forEach(t)}}}((function(e){d.push(e)})),f=function(e,r,s){return 0===r&&-1!==ie.indexOf(s[n.length])||s.match(o)?e:"."+t};function m(e,s,i,a){void 0===a&&(a="&");var c=e.replace(se,""),u=s&&i?i+" "+s+" { "+c+" }":c;return t=a,n=s,r=new RegExp("\\"+n+"\\b","g"),o=new RegExp("(\\"+n+"\\b){2,}"),l(i||!s?"":s,u)}return l.use([].concat(u,[function(e,t,o){2===e&&o.length&&o[0].lastIndexOf(n)>0&&(o[0]=o[0].replace(r,f))},p,function(e){if(-2===e){var t=d;return d=[],t}}])),m.hash=u.length?u.reduce((function(e,t){return t.name||D(15),ee(e,t.name)}),5381).toString():"",m}var ce=react.createContext(),ue=ce.Consumer,le=react.createContext(),de=(le.Consumer,new X),he=ae();function pe(){return (0,react.useContext)(ce)||de}function fe(){return (0,react.useContext)(le)||he}function me(e){var t=(0,react.useState)(e.stylisPlugins),n=t[0],s=t[1],c=pe(),u=(0,react.useMemo)((function(){var t=c;return e.sheet?t=e.sheet:e.target&&(t=t.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(t=t.reconstructWithOptions({useCSSOMInjection:!1})),t}),[e.disableCSSOMInjection,e.sheet,e.target]),l=(0,react.useMemo)((function(){return ae({options:{prefix:!e.disableVendorPrefixes},plugins:n})}),[e.disableVendorPrefixes,n]);return (0,react.useEffect)((function(){shallowequal_default()(n,e.stylisPlugins)||s(e.stylisPlugins)}),[e.stylisPlugins]),react.createElement(ce.Provider,{value:u},react.createElement(le.Provider,{value:l}, false?0:e.children))}var ye=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=he);var r=n.name+t.hash;e.hasNameForId(n.id,r)||e.insertRules(n.id,r,t(n.rules,r,"@keyframes"))},this.toString=function(){return D(12,String(n.name))},this.name=e,this.id="sc-keyframes-"+e,this.rules=t}return e.prototype.getName=function(e){return void 0===e&&(e=he),this.name+e.hash},e}(),ve=/([A-Z])/,ge=/([A-Z])/g,Se=/^ms-/,we=function(e){return"-"+e.toLowerCase()};function Ee(e){return ve.test(e)?e.replace(ge,we).replace(Se,"-ms-"):e}var be=function(e){return null==e||!1===e||""===e};function _e(e,n,r,o){if(Array.isArray(e)){for(var s,i=[],a=0,c=e.length;a1?t-1:0),r=1;r?@[\\\]^`{|}~-]+/g,De=/(^-|-$)/g;function je(e){return e.replace(Re,"-").replace(De,"")}var Te=function(e){return Q(te(e)>>>0)};function xe(e){return"string"==typeof e&&( true||0)}var ke=function(e){return"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)},Ve=function(e){return"__proto__"!==e&&"constructor"!==e&&"prototype"!==e};function Be(e,t,n){var r=e[n];ke(t)&&ke(r)?ze(r,t):e[n]=t}function ze(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r=0||(o[n]=e[n]);return o}(t,["componentId"]),s=r&&r+"-"+(xe(e)?e:je(b(e)));return Ye(e,y({},o,{attrs:g,componentId:s}),n)},Object.defineProperty(A,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(t){this._foldedDefaultProps=o?ze({},e.defaultProps,t):t}}), false&&(0),Object.defineProperty(A,"toString",{value:function(){return"."+A.styledComponentId}}),i&&hoist_non_react_statics_cjs_default()(A,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),A}var qe=function(e){return function e(t,r,o){if(void 0===o&&(o=w),!(0,react_is.isValidElementType)(r))return D(1,String(r));var s=function(){return t(r,o,Ae.apply(void 0,arguments))};return s.withConfig=function(n){return e(t,r,y({},o,{},n))},s.attrs=function(n){return e(t,r,y({},o,{attrs:Array.prototype.concat(o.attrs,n).filter(Boolean)}))},s}(Ye,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach((function(e){qe[e]=qe(e)}));var He=function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=ne(e),X.registerId(this.componentId+1)}var t=e.prototype;return t.createStyles=function(e,t,n,r){var o=r(_e(this.rules,t,n,r).join(""),""),s=this.componentId+e;n.insertRules(s,s,o)},t.removeStyles=function(e,t){t.clearRules(this.componentId+e)},t.renderStyles=function(e,t,n,r){e>2&&X.registerId(this.componentId+e),this.removeStyles(e,n),this.createStyles(e,t,n,r)},e}();function $e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o1?t-1:0),r=1;r"+t+""},this.getStyleTags=function(){return e.sealed?D(2):e._emitSheetCSS()},this.getStyleElement=function(){var t;if(e.sealed)return D(2);var n=((t={})[N]="",t["data-styled-version"]="5.3.11",t.dangerouslySetInnerHTML={__html:e.instance.toString()},t),o=Y();return o&&(n.nonce=o),[react.createElement("style",y({},n,{key:"sc-0-0"}))]},this.seal=function(){e.sealed=!0},this.instance=new X({isServer:!0}),this.sealed=!1}var t=e.prototype;return t.collectStyles=function(e){return this.sealed?D(2):react.createElement(me,{sheet:this.instance},e)},t.interleaveWithNodeStream=function(e){return D(3)},e}(),Je=function(e){var t=r.forwardRef((function(t,n){var o=s(Me),i=e.defaultProps,a=Oe(t,o,i);return false&&0,r.createElement(e,y({},t,{theme:a,ref:n}))}));return m(t,e),t.displayName="WithTheme("+b(e)+")",t},Xe=function(){return s(Me)},Ze={StyleSheet:X,masterSheet:de}; false&&0, false&&(0);/* harmony default export */ const styled_components_browser_esm = (qe); //# sourceMappingURL=styled-components.browser.esm.js.map /***/ }), /***/ 9282: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; var __webpack_unused_export__; __webpack_unused_export__ = true; exports.A = void 0; var _createWebStorage = _interopRequireDefault(__webpack_require__(1215)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var _default = (0, _createWebStorage.default)('local'); exports.A = _default; /***/ }), /***/ 9303: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ u: () => (/* binding */ Surface) /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6540); /* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8804); /* harmony import */ var _util_ReactUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4501); var _excluded = ["children", "width", "height", "viewBox", "className", "style", "title", "desc"]; function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; } /** * @fileOverview Surface */ function Surface(props) { var children = props.children, width = props.width, height = props.height, viewBox = props.viewBox, className = props.className, style = props.style, title = props.title, desc = props.desc, others = _objectWithoutProperties(props, _excluded); var svgView = viewBox || { width: width, height: height, x: 0, y: 0 }; var layerClass = (0,clsx__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)('recharts-surface', className); return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg", _extends({}, (0,_util_ReactUtils__WEBPACK_IMPORTED_MODULE_2__/* .filterProps */ .J9)(others, true, 'svg'), { className: layerClass, width: width, height: height, style: style, viewBox: "".concat(svgView.x, " ").concat(svgView.y, " ").concat(svgView.width, " ").concat(svgView.height) }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("title", null, title), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("desc", null, desc), children); } /***/ }), /***/ 9503: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ MY: () => (/* binding */ rulesheet), /* harmony export */ r1: () => (/* binding */ middleware) /* harmony export */ }); /* unused harmony exports prefixer, namespace */ /* harmony import */ var _Utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9735); /** * @param {function[]} collection * @return {function} */ function middleware (collection) { var length = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__/* .sizeof */ .FK)(collection) return function (element, index, children, callback) { var output = '' for (var i = 0; i < length; i++) output += collection[i](element, index, children, callback) || '' return output } } /** * @param {function} callback * @return {function} */ function rulesheet (callback) { return function (element) { if (!element.root) if (element = element.return) callback(element) } } /** * @param {object} element * @param {number} index * @param {object[]} children * @param {function} callback */ function prefixer (element, index, children, callback) { if (element.length > -1) if (!element.return) switch (element.type) { case DECLARATION: element.return = prefix(element.value, element.length, children) return case KEYFRAMES: return serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback) case RULESET: if (element.length) return combine(element.props, function (value) { switch (match(value, /(::plac\w+|:read-\w+)/)) { // :read-(only|write) case ':read-only': case ':read-write': return serialize([copy(element, {props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]})], callback) // :placeholder case '::placeholder': return serialize([ copy(element, {props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]}), copy(element, {props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]}), copy(element, {props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]}) ], callback) } return '' }) } } /** * @param {object} element * @param {number} index * @param {object[]} children */ function namespace (element) { switch (element.type) { case RULESET: element.props = element.props.map(function (value) { return combine(tokenize(value), function (value, index, children) { switch (charat(value, 0)) { // \f case 12: return substr(value, 1, strlen(value)) // \0 ( + > ~ case 0: case 40: case 43: case 62: case 126: return value // : case 58: if (children[++index] === 'global') children[index] = '', children[++index] = '\f' + substr(children[index], index = 1, -1) // \s case 32: return index === 1 ? '' : value default: switch (index) { case 0: element = value return sizeof(children) > 1 ? '' : value case index = sizeof(children) - 1: case 2: return index === 2 ? value + element + element : value + element default: return value } } }) }) } } /***/ }), /***/ 9735: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ BC: () => (/* binding */ append), /* harmony export */ Bq: () => (/* binding */ trim), /* harmony export */ FK: () => (/* binding */ sizeof), /* harmony export */ HC: () => (/* binding */ replace), /* harmony export */ HT: () => (/* binding */ from), /* harmony export */ K5: () => (/* binding */ indexof), /* harmony export */ YW: () => (/* binding */ match), /* harmony export */ b2: () => (/* binding */ strlen), /* harmony export */ c1: () => (/* binding */ substr), /* harmony export */ kg: () => (/* binding */ combine), /* harmony export */ kp: () => (/* binding */ assign), /* harmony export */ tW: () => (/* binding */ hash), /* harmony export */ tn: () => (/* binding */ abs), /* harmony export */ wN: () => (/* binding */ charat) /* harmony export */ }); /** * @param {number} * @return {number} */ var abs = Math.abs /** * @param {number} * @return {string} */ var from = String.fromCharCode /** * @param {object} * @return {object} */ var assign = Object.assign /** * @param {string} value * @param {number} length * @return {number} */ function hash (value, length) { return charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0 } /** * @param {string} value * @return {string} */ function trim (value) { return value.trim() } /** * @param {string} value * @param {RegExp} pattern * @return {string?} */ function match (value, pattern) { return (value = pattern.exec(value)) ? value[0] : value } /** * @param {string} value * @param {(string|RegExp)} pattern * @param {string} replacement * @return {string} */ function replace (value, pattern, replacement) { return value.replace(pattern, replacement) } /** * @param {string} value * @param {string} search * @return {number} */ function indexof (value, search) { return value.indexOf(search) } /** * @param {string} value * @param {number} index * @return {number} */ function charat (value, index) { return value.charCodeAt(index) | 0 } /** * @param {string} value * @param {number} begin * @param {number} end * @return {string} */ function substr (value, begin, end) { return value.slice(begin, end) } /** * @param {string} value * @return {number} */ function strlen (value) { return value.length } /** * @param {any[]} value * @return {number} */ function sizeof (value) { return value.length } /** * @param {any} value * @param {any[]} array * @return {any} */ function append (value, array) { return array.push(value), value } /** * @param {string[]} array * @param {function} callback * @return {string} */ function combine (array, callback) { return array.map(callback).join('') } /***/ }), /***/ 9744: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ CG: () => (/* binding */ hasDuplicate), /* harmony export */ Dj: () => (/* binding */ interpolateNumber), /* harmony export */ Et: () => (/* binding */ isNumber), /* harmony export */ F4: () => (/* binding */ getPercentValue), /* harmony export */ NF: () => (/* binding */ uniqueId), /* harmony export */ _3: () => (/* binding */ isPercent), /* harmony export */ eP: () => (/* binding */ findEntryInArray), /* harmony export */ lX: () => (/* binding */ getAnyElementOfObject), /* harmony export */ sA: () => (/* binding */ mathSign), /* harmony export */ vh: () => (/* binding */ isNumOrStr) /* harmony export */ }); /* unused harmony exports isNullish, getLinearRegression, compareValues */ /* harmony import */ var lodash_isString__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5015); /* harmony import */ var lodash_isString__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_isString__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var lodash_isNaN__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1741); /* harmony import */ var lodash_isNaN__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_isNaN__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8156); /* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_get__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var lodash_isNumber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8023); /* harmony import */ var lodash_isNumber__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_isNumber__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var lodash_isNil__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9843); /* harmony import */ var lodash_isNil__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash_isNil__WEBPACK_IMPORTED_MODULE_4__); var mathSign = function mathSign(value) { if (value === 0) { return 0; } if (value > 0) { return 1; } return -1; }; var isPercent = function isPercent(value) { return lodash_isString__WEBPACK_IMPORTED_MODULE_0___default()(value) && value.indexOf('%') === value.length - 1; }; var isNumber = function isNumber(value) { return lodash_isNumber__WEBPACK_IMPORTED_MODULE_3___default()(value) && !lodash_isNaN__WEBPACK_IMPORTED_MODULE_1___default()(value); }; var isNullish = function isNullish(value) { return isNil(value); }; var isNumOrStr = function isNumOrStr(value) { return isNumber(value) || lodash_isString__WEBPACK_IMPORTED_MODULE_0___default()(value); }; var idCounter = 0; var uniqueId = function uniqueId(prefix) { var id = ++idCounter; return "".concat(prefix || '').concat(id); }; /** * Get percent value of a total value * @param {number|string} percent A percent * @param {number} totalValue Total value * @param {number} defaultValue The value returned when percent is undefined or invalid * @param {boolean} validate If set to be true, the result will be validated * @return {number} value */ var getPercentValue = function getPercentValue(percent, totalValue) { var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; var validate = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; if (!isNumber(percent) && !lodash_isString__WEBPACK_IMPORTED_MODULE_0___default()(percent)) { return defaultValue; } var value; if (isPercent(percent)) { var index = percent.indexOf('%'); value = totalValue * parseFloat(percent.slice(0, index)) / 100; } else { value = +percent; } if (lodash_isNaN__WEBPACK_IMPORTED_MODULE_1___default()(value)) { value = defaultValue; } if (validate && value > totalValue) { value = totalValue; } return value; }; var getAnyElementOfObject = function getAnyElementOfObject(obj) { if (!obj) { return null; } var keys = Object.keys(obj); if (keys && keys.length) { return obj[keys[0]]; } return null; }; var hasDuplicate = function hasDuplicate(ary) { if (!Array.isArray(ary)) { return false; } var len = ary.length; var cache = {}; for (var i = 0; i < len; i++) { if (!cache[ary[i]]) { cache[ary[i]] = true; } else { return true; } } return false; }; /* @todo consider to rename this function into `getInterpolator` */ var interpolateNumber = function interpolateNumber(numberA, numberB) { if (isNumber(numberA) && isNumber(numberB)) { return function (t) { return numberA + t * (numberB - numberA); }; } return function () { return numberB; }; }; function findEntryInArray(ary, specifiedKey, specifiedValue) { if (!ary || !ary.length) { return null; } return ary.find(function (entry) { return entry && (typeof specifiedKey === 'function' ? specifiedKey(entry) : lodash_get__WEBPACK_IMPORTED_MODULE_2___default()(entry, specifiedKey)) === specifiedValue; }); } /** * The least square linear regression * @param {Array} data The array of points * @returns {Object} The domain of x, and the parameter of linear function */ var getLinearRegression = function getLinearRegression(data) { if (!data || !data.length) { return null; } var len = data.length; var xsum = 0; var ysum = 0; var xysum = 0; var xxsum = 0; var xmin = Infinity; var xmax = -Infinity; var xcurrent = 0; var ycurrent = 0; for (var i = 0; i < len; i++) { xcurrent = data[i].cx || 0; ycurrent = data[i].cy || 0; xsum += xcurrent; ysum += ycurrent; xysum += xcurrent * ycurrent; xxsum += xcurrent * xcurrent; xmin = Math.min(xmin, xcurrent); xmax = Math.max(xmax, xcurrent); } var a = len * xxsum !== xsum * xsum ? (len * xysum - xsum * ysum) / (len * xxsum - xsum * xsum) : 0; return { xmin: xmin, xmax: xmax, a: a, b: (ysum - a * xsum) / len }; }; /** * Compare values. * * This function is intended to be passed to `Array.prototype.sort()`. It properly compares generic homogeneous arrays that are either `string[]`, * `number[]`, or `Date[]`. When comparing heterogeneous arrays or homogeneous arrays of other types, it will attempt to compare items properly but * will fall back to string comparison for mismatched or unsupported types. * * For some background, `Array.prototype.sort()`'s default comparator coerces each of the array's items into a string and compares the strings. This * often leads to undesirable behavior, especially with numerical items. * * @param {unknown} a The first item to compare * @param {unknown} b The second item to compare * @return {number} A negative number if a < b, a positive number if a > b, 0 if equal */ var compareValues = function compareValues(a, b) { if (isNumber(a) && isNumber(b)) { return a - b; } if (isString(a) && isString(b)) { return a.localeCompare(b); } if (a instanceof Date && b instanceof Date) { return a.getTime() - b.getTime(); } return String(a).localeCompare(String(b)); }; /***/ }), /***/ 9799: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ s: () => (/* binding */ getUniqPayload) /* harmony export */ }); /* harmony import */ var lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14); /* harmony import */ var lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var lodash_isFunction__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1882); /* harmony import */ var lodash_isFunction__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_isFunction__WEBPACK_IMPORTED_MODULE_1__); /** * This is configuration option that decides how to filter for unique values only: * * - `false` means "no filter" * - `true` means "use recharts default filter" * - function means "use return of this function as the default key" */ function getUniqPayload(payload, option, defaultUniqBy) { if (option === true) { return lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0___default()(payload, defaultUniqBy); } if (lodash_isFunction__WEBPACK_IMPORTED_MODULE_1___default()(option)) { return lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0___default()(payload, option); } return payload; } /***/ }), /***/ 9938: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ m: () => (/* binding */ Global) /* harmony export */ }); var parseIsSsrByDefault = function parseIsSsrByDefault() { return !(typeof window !== 'undefined' && window.document && window.document.createElement && window.setTimeout); }; var Global = { isSsr: parseIsSsrByDefault(), get: function get(key) { return Global[key]; }, set: function set(key, value) { if (typeof key === 'string') { Global[key] = value; } else { var keys = Object.keys(key); if (keys && keys.length) { keys.forEach(function (k) { Global[k] = key[k]; }); } } } }; /***/ }), /***/ 9982: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; if (true) { module.exports = __webpack_require__(7463); } else // removed by dead control flow {} /***/ }) }]);