{"version":3,"sources":["jsdelivr-header.js","webpack:///webpack/universalModuleDefinition","webpack:///index.js","webpack:///webpack/bootstrap","webpack:///src/index.js","/npm/react-memo-router@0.0.4/lib/webpack:/external \"@babel/runtime/helpers/interopRequireDefault\"","/npm/react-memo-router@0.0.4/lib/webpack:/external \"@babel/runtime/helpers/objectWithoutProperties\"","/npm/react-memo-router@0.0.4/lib/webpack:/external \"@babel/runtime/helpers/extends\"","/npm/react-memo-router@0.0.4/lib/webpack:/external \"@babel/runtime/helpers/slicedToArray\"","/npm/react-memo-router@0.0.4/lib/webpack:/external \"@babel/runtime/helpers/defineProperty\"","/npm/react-memo-router@0.0.4/lib/webpack:/external \"@babel/runtime/helpers/objectSpread\"","/npm/react-memo-router@0.0.4/lib/webpack:/external \"react\""],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,UCNA,EAAA,GACA,oBAAA,SAAA,iBAAA,OACA,OAAA,QAAA,SACA,sBAAA,eAAA,IACA,UAAA,OACA,CACA,IAAA,EAAA,IACA,QAAA,KAAA,GAAA,iBAAA,gBAAA,GAAA,GAAA,EAAA,I,CAEC,QAAA,WACD,OCAgB,SAAU,GCT1B,IAAA,KAGA,SAAA,EAAA,GAGA,GAAA,EAAA,GACA,OAAA,EAAA,GAAA,QAGA,IAAA,EAAA,EAAA,IACA,EAAA,EACA,KACA,YAUA,OANA,EAAA,GAAA,KAAA,EAAA,QAAA,IAAA,QAAA,GAGA,EAAA,KAGA,EAAA,QA0DA,OArDA,EAAA,EAAA,EAGA,EAAA,EAAA,EAGA,EAAA,EAAA,SAAA,EAAA,EAAA,GACA,EAAA,EAAA,EAAA,IACA,OAAA,eAAA,EAAA,GAA0C,cAAA,IAAA,KAK1C,EAAA,EAAA,SAAA,GACA,oBAAA,eAAA,aACA,OAAA,eAAA,EAAA,OAAA,aAAwD,MAAA,WAExD,OAAA,eAAA,EAAA,cAAiD,UAAA,EAQjD,EAAA,EAAA,SAAA,EAAA,GAEA,GADA,EAAA,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QAAA,cAAA,SAAA,EAAA,UAAK,SAAK,EAAA,UACf,QAAS,EAAY,SAAW,OAChC,YAAa,EAAY,OAAS,QAC/B,IACE,KAIG,WACV,MAAM,IAAI,MAAJ,YAAA,OA5LU,cA4LV,mMAaN,GAA6C,MAA7B,OAAO,SAAS,SAAkB,CACpD,IAAM,EAAS,OAAO,SAAS,OACzB,EAAW,OAAO,SAAS,SAC3B,KACN,GAA4B,IAAxB,EAAO,QAAQ,KAIjB,IAFA,IACM,EADO,EAAO,MAAM,KAAK,GACT,MAAM,KACnB,EAAI,EAAG,EAAI,EAAS,OAAQ,IAAK,CACxC,IADwC,EAC5B,EAAS,GACF,MAAM,KAFe,KAAA,EAAA,SAAA,EAAA,GAEjC,EAFiC,EAAA,GAE9B,EAF8B,EAAA,GAGxC,EAAO,GAAK,EAGhB,EAAQ,MAAO,KAAM,EAAU;;;;;;;AF+M3B,SAAU,EAAQ,GGzaxB,EAAA,QAAA,QAAA;;;;;;;AHqbM,SAAU,EAAQ,GIrbxB,EAAA,QAAA,QAAA;;;;;;;AJicM,SAAU,EAAQ,GKjcxB,EAAA,QAAA,QAAA;;;;;;;AL6cM,SAAU,EAAQ,GM7cxB,EAAA,QAAA,QAAA;;;;;;;ANydM,SAAU,EAAQ,GOzdxB,EAAA,QAAA,QAAA;;;;;;;APqeM,SAAU,EAAQ,GQrexB,EAAA,QAAA,QAAA;;;;;;;ARifM,SAAU,EAAQ,GSjfxB,EAAA,QAAA,QAAA","file":"/npm/react-memo-router@0.0.4/lib/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/react-memo-router@0.0.4/lib/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(window, function() {\nreturn ","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(window, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__webpack_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __webpack_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__webpack_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/*!**********************!*\\\n  !*** ./src/index.js ***!\n  \\**********************/\n/*! no static exports found */\n/*! all exports used */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 1);\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.setSpace = setSpace;\nexports.setHash = setHash;\nexports.Routers = Routers;\nexports.Route = Route;\nexports.setContainer = setContainer;\nexports.history = void 0;\n\nvar _objectWithoutProperties2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutProperties */ 2));\n\nvar _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ 3));\n\nvar _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 4));\n\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 5));\n\nvar _objectSpread3 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectSpread */ 6));\n\nvar _react = _interopRequireDefault(__webpack_require__(/*! react */ 7));\n\n// 库名\nvar packageName = 'memo-router';\n\nvar RouteContext = _react.default.createContext();\n\nvar isHaveWindow = typeof window !== 'undefined'; // 基础state结构\n\nvar baseState = {\n  path: undefined,\n  lastPath: undefined,\n  params: {},\n  needRemove: false,\n  animate: true,\n  isDoingGoback: false\n}; // 多组件同渲染时的连接符\n\nvar SPACE = '&&';\n\nfunction setSpace(str) {\n  SPACE = str;\n} // hash定位符，默认为空\n\n\nvar HASH = '';\n\nfunction setHash(str) {\n  HASH = str;\n} // 导航器是否已经绑定dispatch\n\n\nvar isHistoryBindDispatch = false; // 导航器\n\nvar history = {\n  useContext: function useContext() {\n    return _react.default.useContext(RouteContext);\n  },\n  // 前往一个路径，如果曾经去过，则跳转到去过的路径\n  push: function push(action) {\n    reducer(history, action);\n  },\n  setDefaultPath: function setDefaultPath(uri, focus) {\n    if (isHaveWindow && (focus || window.location.pathname === '/')) {\n      history.push(uri);\n    }\n  },\n  canGoback: function canGoback(path) {\n    path = path || history.state.lastPath;\n\n    if (!path) {\n      return false;\n    }\n\n    return history.stateMap[path];\n  },\n  isPathAtTop: function isPathAtTop(path, checkPath) {\n    var topPath = checkPath || history.state.path;\n\n    if (!topPath) {\n      return false;\n    }\n\n    if (topPath.indexOf(SPACE) > -1) {\n      var paths = topPath.split(SPACE);\n\n      for (var i = 0; i < paths.length; i++) {\n        if (path === paths[i]) {\n          return true;\n        }\n      }\n\n      return false;\n    }\n\n    return topPath === path;\n  },\n  isPathInStateMap: function isPathInStateMap(path) {\n    for (var k in history.stateMap) {\n      var list = k.split(SPACE);\n\n      for (var i = 0; i < list.length; i++) {\n        if (path === list[i]) {\n          return true;\n        }\n      }\n    }\n\n    return false;\n  },\n  goback: function goback(path) {\n    var needRemove = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n    var gobackPath = path || history.state.lastPath;\n    var isCanGoback = history.canGoback(gobackPath);\n\n    if (isCanGoback) {\n      // 计算goback, 如果goback指定路径，会清理中间的历史\n      var getNextState = function getNextState(dState, dStateMap) {\n        if (dState.needRemove && dStateMap[dState.path]) {\n          delete dStateMap[dState.path];\n        }\n\n        if (!dState.lastPath) {\n          nextState = dState;\n          return;\n        }\n\n        var lastState = dStateMap[dState.lastPath];\n\n        if (lastState && lastState.path !== gobackPath) {\n          getNextState(lastState, dStateMap);\n        }\n\n        nextState = lastState;\n      };\n\n      history.state.needRemove = needRemove;\n      var nextState = (0, _objectSpread3.default)({}, history.state);\n      getNextState(nextState, history.stateMap);\n      nextState.isDoingGoback = true;\n      history.push(nextState);\n    } else {\n      console.error(\"[Error-Route] is can't goback\");\n    }\n  },\n  state: (0, _objectSpread3.default)({}, baseState, {\n    path: '/'\n  }),\n  stateMap: {\n    '/': (0, _objectSpread3.default)({}, baseState, {\n      path: '/'\n    })\n  }\n}; // 当push执行时的减速器\n\nexports.history = history;\n\nfunction reducer(data, action) {\n  if (typeof action === 'string') {\n    action = (0, _objectSpread3.default)({}, baseState, {\n      path: action\n    });\n  } else {\n    action = (0, _objectSpread3.default)({}, baseState, action);\n  }\n\n  if (action.path) {\n    if (!action.isDoingGoback) {\n      action.lastPath = history.state.path;\n    }\n\n    var state = (0, _objectSpread3.default)({}, action);\n    var stateMap = (0, _objectSpread3.default)({}, history.stateMap, (0, _defineProperty2.default)({}, action.path, state));\n    data = {\n      stateMap: stateMap,\n      state: state\n    };\n  }\n\n  history.state = (0, _objectSpread3.default)({}, data.state);\n  history.stateMap = (0, _objectSpread3.default)({}, data.stateMap);\n\n  if (isHaveWindow) {\n    window.history.pushState({}, document.title, HASH + data.state.path);\n  }\n\n  console.log(data);\n  return data;\n}\n\nfunction Routers(props) {\n  var _React$useReducer = _react.default.useReducer(reducer, {\n    state: history.state,\n    stateMap: history.stateMap\n  }),\n      _React$useReducer2 = (0, _slicedToArray2.default)(_React$useReducer, 2),\n      state = _React$useReducer2[0],\n      dispatch = _React$useReducer2[1];\n\n  if (!isHistoryBindDispatch) {\n    isHistoryBindDispatch = true;\n    history.push = dispatch;\n  }\n\n  return _react.default.useCallback(_react.default.createElement(RouteContext.Provider, (0, _extends2.default)({}, props, {\n    value: state\n  })), [state]);\n}\n\nfunction Route(props) {\n  var style = props.style,\n      rest = (0, _objectWithoutProperties2.default)(props, [\"style\"]);\n\n  var _React$useState = _react.default.useState(0),\n      _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),\n      isRenderChildren = _React$useState2[0],\n      setIsRenderChildren = _React$useState2[1];\n\n  var context = _react.default.useContext(RouteContext);\n\n  var isDisplay = history.isPathAtTop(props.path);\n\n  _react.default.useEffect(function () {\n    if (isDisplay && !isRenderChildren) {\n      setIsRenderChildren(isRenderChildren + 1);\n    } else if (!history.isPathInStateMap(props.path)) {\n      if (props.delayRemove) {\n        setTimeout(function () {\n          setIsRenderChildren(0);\n        }, props.delayRemove);\n      } else {\n        setIsRenderChildren(0);\n      }\n    }\n  }, [isDisplay]);\n\n  function render() {\n    if (!isRenderChildren) {\n      return null;\n    }\n\n    return _react.default.createElement(Container, (0, _extends2.default)({\n      isDisplay: isDisplay,\n      style: style\n    }, rest));\n  }\n\n  return _react.default.useMemo(render, [isRenderChildren, isDisplay]);\n} // 设置默认容器，以实现切换路由时的组件显示\n\n\nvar Container;\n\nif (isHaveWindow) {\n  Container = function Container(_ref) {\n    var path = _ref.path,\n        isDisplay = _ref.isDisplay,\n        style = _ref.style,\n        rest = (0, _objectWithoutProperties2.default)(_ref, [\"path\", \"isDisplay\", \"style\"]);\n    return _react.default.createElement(\"div\", (0, _extends2.default)({\n      style: (0, _objectSpread3.default)({\n        display: isDisplay ? 'inline' : 'none',\n        pointEvents: isDisplay ? 'auto' : 'none'\n      }, style)\n    }, rest));\n  };\n} else {\n  // 如果在ReactNative等非浏览器的环境, 需要用户主动设定一个容器组件\n  Container = function Container() {\n    throw new Error(\"\\n      [\".concat(packageName, \"] If not in Browser, You need set default containner:\\n      setContainner(({isDisplay, ...rest})=>{\\n        return <YourComponent isShowComponent={isDisplay} {...rest} ...\\n      })\\n    \"));\n  };\n}\n\nfunction setContainer(fn) {\n  Container = fn;\n} // 根据路径初始化默认路由\n\n\nif (isHaveWindow && window.location.pathname !== '/') {\n  var search = window.location.search;\n  var pathname = window.location.pathname;\n  var params = {};\n\n  if (search.indexOf('?') === 0) {\n    // 解析params\n    var data = search.split('?')[1];\n    var dataList = data.split('&');\n\n    for (var i = 0; i < dataList.length; i++) {\n      var ele = dataList[i];\n\n      var _ele$split = ele.split('='),\n          _ele$split2 = (0, _slicedToArray2.default)(_ele$split, 2),\n          k = _ele$split2[0],\n          v = _ele$split2[1];\n\n      params[k] = v;\n    }\n  }\n\n  history.push({\n    path: pathname,\n    params: params\n  });\n}\n\n/***/ }),\n/* 1 */\n/*!***************************************************************!*\\\n  !*** external \"@babel/runtime/helpers/interopRequireDefault\" ***!\n  \\***************************************************************/\n/*! no static exports found */\n/*! all exports used */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\n/***/ }),\n/* 2 */\n/*!*****************************************************************!*\\\n  !*** external \"@babel/runtime/helpers/objectWithoutProperties\" ***!\n  \\*****************************************************************/\n/*! no static exports found */\n/*! all exports used */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"@babel/runtime/helpers/objectWithoutProperties\");\n\n/***/ }),\n/* 3 */\n/*!*************************************************!*\\\n  !*** external \"@babel/runtime/helpers/extends\" ***!\n  \\*************************************************/\n/*! no static exports found */\n/*! all exports used */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"@babel/runtime/helpers/extends\");\n\n/***/ }),\n/* 4 */\n/*!*******************************************************!*\\\n  !*** external \"@babel/runtime/helpers/slicedToArray\" ***!\n  \\*******************************************************/\n/*! no static exports found */\n/*! all exports used */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"@babel/runtime/helpers/slicedToArray\");\n\n/***/ }),\n/* 5 */\n/*!********************************************************!*\\\n  !*** external \"@babel/runtime/helpers/defineProperty\" ***!\n  \\********************************************************/\n/*! no static exports found */\n/*! all exports used */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"@babel/runtime/helpers/defineProperty\");\n\n/***/ }),\n/* 6 */\n/*!******************************************************!*\\\n  !*** external \"@babel/runtime/helpers/objectSpread\" ***!\n  \\******************************************************/\n/*! no static exports found */\n/*! all exports used */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"@babel/runtime/helpers/objectSpread\");\n\n/***/ }),\n/* 7 */\n/*!************************!*\\\n  !*** external \"react\" ***!\n  \\************************/\n/*! no static exports found */\n/*! all exports used */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"react\");\n\n/***/ })\n/******/ ]);\n});"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","import React from 'react';\n\n// 库名\nconst packageName = 'memo-router';\nconst RouteContext = React.createContext();\nconst isHaveWindow = typeof window !== 'undefined';\n\n// 基础state结构\nconst baseState = {\n  path: undefined,\n  lastPath: undefined,\n  params: {},\n  needRemove: false,\n  animate: true,\n  isDoingGoback: false,\n};\n\n// 多组件同渲染时的连接符\nlet SPACE = '&&';\nexport function setSpace(str) {\n  SPACE = str;\n}\n\n// hash定位符，默认为空\nlet HASH = '';\nexport function setHash(str) {\n  HASH = str;\n}\n\n// 导航器是否已经绑定dispatch\nlet isHistoryBindDispatch = false;\n\n// 导航器\nexport const history = {\n  useContext: () => {\n    return React.useContext(RouteContext);\n  },\n  // 前往一个路径，如果曾经去过，则跳转到去过的路径\n  push: action => {\n    reducer(history, action);\n  },\n  setDefaultPath: (uri, focus) => {\n    if (isHaveWindow && (focus || window.location.pathname === '/')) {\n      history.push(uri);\n    }\n  },\n  canGoback: path => {\n    path = path || history.state.lastPath;\n    if (!path) {\n      return false;\n    }\n    return history.stateMap[path];\n  },\n  isPathAtTop: (path, checkPath) => {\n    const topPath = checkPath || history.state.path;\n    if (!topPath) {\n      return false;\n    }\n    if (topPath.indexOf(SPACE) > -1) {\n      const paths = topPath.split(SPACE);\n      for (let i = 0; i < paths.length; i++) {\n        if (path === paths[i]) {\n          return true;\n        }\n      }\n      return false;\n    }\n    return topPath === path;\n  },\n  isPathInStateMap: path => {\n    for (const k in history.stateMap) {\n      const list = k.split(SPACE);\n      for (let i = 0; i < list.length; i++) {\n        if (path === list[i]) {\n          return true;\n        }\n      }\n    }\n    return false;\n  },\n  goback: (path, needRemove = true) => {\n    const gobackPath = path || history.state.lastPath;\n    const isCanGoback = history.canGoback(gobackPath);\n    if (isCanGoback) {\n      history.state.needRemove = needRemove;\n      let nextState = { ...history.state };\n      // 计算goback, 如果goback指定路径，会清理中间的历史\n      function getNextState(dState, dStateMap) {\n        if (dState.needRemove && dStateMap[dState.path]) {\n          delete dStateMap[dState.path];\n        }\n        if (!dState.lastPath) {\n          nextState = dState;\n          return;\n        }\n        const lastState = dStateMap[dState.lastPath];\n        if (lastState && lastState.path !== gobackPath) {\n          getNextState(lastState, dStateMap);\n        }\n        nextState = lastState;\n      }\n      getNextState(nextState, history.stateMap);\n      nextState.isDoingGoback = true;\n      history.push(nextState);\n    } else {\n      console.error(\"[Error-Route] is can't goback\");\n    }\n  },\n  state: { ...baseState, path: '/' },\n  stateMap: { '/': { ...baseState, path: '/' } },\n};\n\n// 当push执行时的减速器\nfunction reducer(data, action) {\n  if (typeof action === 'string') {\n    action = { ...baseState, path: action };\n  } else {\n    action = { ...baseState, ...action };\n  }\n  if (action.path) {\n    if (!action.isDoingGoback) {\n      action.lastPath = history.state.path;\n    }\n    const state = { ...action };\n    const stateMap = { ...history.stateMap, [action.path]: state };\n    data = { stateMap, state };\n  }\n  history.state = { ...data.state };\n  history.stateMap = { ...data.stateMap };\n  if (isHaveWindow) {\n    window.history.pushState({}, document.title, HASH + data.state.path);\n  }\n  console.log(data);\n  return data;\n}\n\nexport function Routers(props) {\n  const [state, dispatch] = React.useReducer(reducer, {\n    state: history.state,\n    stateMap: history.stateMap,\n  });\n  if (!isHistoryBindDispatch) {\n    isHistoryBindDispatch = true;\n    history.push = dispatch;\n  }\n  return React.useCallback(<RouteContext.Provider {...props} value={state} />, [state]);\n}\n\nexport function Route(props) {\n  const { style, ...rest } = props;\n  const [isRenderChildren, setIsRenderChildren] = React.useState(0);\n  const context = React.useContext(RouteContext);\n  const isDisplay = history.isPathAtTop(props.path);\n  React.useEffect(\n    () => {\n      if (isDisplay && !isRenderChildren) {\n        setIsRenderChildren(isRenderChildren + 1);\n      } else if (!history.isPathInStateMap(props.path)) {\n        if (props.delayRemove) {\n          setTimeout(() => {\n            setIsRenderChildren(0);\n          }, props.delayRemove);\n        } else {\n          setIsRenderChildren(0);\n        }\n      }\n    },\n    [isDisplay]\n  );\n  function render() {\n    if (!isRenderChildren) {\n      return null;\n    }\n    return <Container isDisplay={isDisplay} style={style} {...rest} />;\n  }\n  return React.useMemo(render, [isRenderChildren, isDisplay]);\n}\n\n// 设置默认容器，以实现切换路由时的组件显示\nlet Container;\nif (isHaveWindow) {\n  Container = function({ path, isDisplay, style, ...rest }) {\n    return <div style={{\n      display: isDisplay ? 'inline' : 'none',\n      pointEvents: isDisplay ? 'auto' : 'none',\n      ...style,\n    }} {...rest} />;\n  };\n} else {\n  // 如果在ReactNative等非浏览器的环境, 需要用户主动设定一个容器组件\n  Container = function() {\n    throw new Error(`\n      [${packageName}] If not in Browser, You need set default containner:\n      setContainner(({isDisplay, ...rest})=>{\n        return <YourComponent isShowComponent={isDisplay} {...rest} ...\n      })\n    `);\n  };\n}\nexport function setContainer(fn) {\n  Container = fn;\n}\n\n// 根据路径初始化默认路由\nif (isHaveWindow && window.location.pathname !== '/') {\n  const search = window.location.search;\n  const pathname = window.location.pathname;\n  const params = {};\n  if (search.indexOf('?') === 0) {\n    // 解析params\n    const data = search.split('?')[1];\n    const dataList = data.split('&');\n    for (let i = 0; i < dataList.length; i++) {\n      const ele = dataList[i];\n      const [k, v] = ele.split('=');\n      params[k] = v;\n    }\n  }\n  history.push({ path: pathname, params });\n}\n",null,null,null,null,null,null,null]}