{"ast":null,"code":"function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _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; }\n\nvar React = require('react');\n\nvar cache = {};\n\nfunction asyncComponentFactory(route, pageData) {\n  var Component = pageData.Component;\n\n  var AsyncComponent = /*#__PURE__*/function (_React$Component) {\n    _inheritsLoose(AsyncComponent, _React$Component);\n\n    function AsyncComponent() {\n      var _this;\n\n      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n        args[_key] = arguments[_key];\n      }\n\n      _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;\n\n      _defineProperty(_assertThisInitialized(_this), \"state\", {\n        isLoaded: false\n      });\n\n      return _this;\n    }\n\n    AsyncComponent.preload = function preload() {\n      return Component().then(function (res) {\n        cache[route] = res.default;\n        return res.default;\n      });\n    };\n\n    AsyncComponent.getPageData = function getPageData() {\n      return cache[route] ? cache[route].pageData : {};\n    };\n\n    var _proto = AsyncComponent.prototype;\n\n    _proto.render = function render() {\n      var _this2 = this;\n\n      if (cache[route]) {\n        return React.createElement(cache[route]);\n      }\n\n      AsyncComponent.preload().then(function () {\n        return _this2.setState({\n          isLoaded: true\n        });\n      }); // Simple loading state\n\n      return React.createElement('div', {\n        style: {\n          height: '100vh'\n        }\n      }, 'Loading...');\n    };\n\n    return AsyncComponent;\n  }(React.Component);\n\n  AsyncComponent.displayName = route.replace(/\\//g, '.');\n  return AsyncComponent;\n}\n\nmodule.exports = {\n  asyncComponentFactory: asyncComponentFactory\n};","map":{"version":3,"names":["React","require","cache","asyncComponentFactory","route","pageData","Component","AsyncComponent","isLoaded","preload","then","res","default","getPageData","render","createElement","setState","style","height","displayName","replace","module","exports"],"sources":["/Users/ausulliv/repos/temp/patternfly-react/node_modules/@patternfly/documentation-framework/helpers/asyncComponentFactory.js"],"sourcesContent":["const React = require('react');\n\nconst cache = {};\n\nfunction asyncComponentFactory(route, pageData) {\n  const { Component } = pageData;\n\n  class AsyncComponent extends React.Component {\n    state = {\n      isLoaded: false\n    };\n    static preload() {\n      return Component().then(res => {\n        cache[route] = res.default;\n        return res.default;\n      });\n    }\n    static getPageData() {\n      return cache[route] ? cache[route].pageData : {};\n    }\n    render() {\n      if (cache[route]) {\n        return React.createElement(cache[route]);\n      }\n      AsyncComponent.preload().then(() => this.setState({ isLoaded: true }));\n\n      // Simple loading state\n      return React.createElement('div',\n        { style: { height: '100vh' } },\n        'Loading...'\n      );\n    }\n  }\n  AsyncComponent.displayName = route.replace(/\\//g, '.');\n\n  return AsyncComponent;\n}\n\nmodule.exports = {\n  asyncComponentFactory\n};"],"mappings":";;;;;;;;AAAA,IAAMA,KAAK,GAAGC,OAAO,CAAC,OAAD,CAArB;;AAEA,IAAMC,KAAK,GAAG,EAAd;;AAEA,SAASC,qBAAT,CAA+BC,KAA/B,EAAsCC,QAAtC,EAAgD;EAAA,IACtCC,SADsC,GACxBD,QADwB,CACtCC,SADsC;;EAAA,IAGxCC,cAHwC;IAAA;;IAAA;MAAA;;MAAA;QAAA;MAAA;;MAAA;;MAAA,wDAIpC;QACNC,QAAQ,EAAE;MADJ,CAJoC;;MAAA;IAAA;;IAAA,eAOrCC,OAPqC,GAO5C,mBAAiB;MACf,OAAOH,SAAS,GAAGI,IAAZ,CAAiB,UAAAC,GAAG,EAAI;QAC7BT,KAAK,CAACE,KAAD,CAAL,GAAeO,GAAG,CAACC,OAAnB;QACA,OAAOD,GAAG,CAACC,OAAX;MACD,C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