global["@vtex/micro-plugin-react@1.1.1-alpha.23/components"] =
/******/ (() => { // webpackBootstrap
/******/ 	var __webpack_modules__ = ([
/* 0 */
/***/ ((module, exports, __webpack_require__) => {

var __WEBPACK_AMD_DEFINE_RESULT__;/*!
  Copyright (c) 2015 Jed Watson.
  Based on code that is Copyright 2013-2015, Facebook, Inc.
  All rights reserved.
*/
/* global define */

(function () {
	'use strict';

	var canUseDOM = !!(
		typeof window !== 'undefined' &&
		window.document &&
		window.document.createElement
	);

	var ExecutionEnvironment = {

		canUseDOM: canUseDOM,

		canUseWorkers: typeof Worker !== 'undefined',

		canUseEventListeners:
			canUseDOM && !!(window.addEventListener || window.attachEvent),

		canUseViewport: canUseDOM && !!window.screen

	};

	if (true) {
		!(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
			return ExecutionEnvironment;
		}).call(exports, __webpack_require__, exports, module),
		__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
	} else {}

}());


/***/ }),
/* 1 */
/***/ ((module) => {

"use strict";
(function() { module.exports = global["React"]; }());

/***/ }),
/* 2 */
/***/ ((module) => {

"use strict";
(function() { module.exports = global["LoadableComponent"]; }());

/***/ }),
/* 3 */
/***/ ((module) => {

"use strict";
(function() { module.exports = global["ReactDOM"]; }());

/***/ }),
/* 4 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "OD": () => /* binding */ appContainerId,
/* harmony export */   "Ir": () => /* binding */ getAppContainer,
/* harmony export */   "sz": () => /* binding */ withAppContainerTags
/* harmony export */ });
const appContainerId = 'root';

const getAppContainer = () => {
  const container = document.getElementById(appContainerId);
  if (!container) {
    throw new Error(
    '💣 This is embarrassing, the App couldnt find a container to fit it');

  }
  return container;
};

const withAppContainerTags = (ssr) =>
`<div id="${appContainerId}">${ssr}</div>`;

/***/ }),
/* 5 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "H": () => /* binding */ withRuntimeTags,
/* harmony export */   "W": () => /* binding */ getRuntimeData
/* harmony export */ });
/* harmony import */ var exenv__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
/* harmony import */ var exenv__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(exenv__WEBPACK_IMPORTED_MODULE_0__);











const runtimeContainerId = '__MICRO_REACT_RUNTIME__';

const withRuntimeTags = ({ publicPaths, page: { name } }) =>
`<script id="${runtimeContainerId}" type="application/json">${JSON.stringify({
  publicPaths,
  page: { name } })
}</script>`;

const isRuntimeData = obj => {var _obj$page;
  const paths = obj === null || obj === void 0 ? void 0 : obj.publicPaths;
  return (
    typeof (paths === null || paths === void 0 ? void 0 : paths.assets) === 'string' &&
    typeof (paths === null || paths === void 0 ? void 0 : paths.data) === 'string' &&
    typeof (obj === null || obj === void 0 ? void 0 : (_obj$page = obj.page) === null || _obj$page === void 0 ? void 0 : _obj$page.name) === 'string');

};

const ensureRuntime = obj => {
  if (!isRuntimeData(obj)) {
    throw new Error(
    `💣 Error while validating runtime data ${JSON.stringify(obj)}`);

  }
  return obj;
};

const getRuntimeData = () => {var _dataElement$textCont;
  console.assert(
  exenv__WEBPACK_IMPORTED_MODULE_0__.canUseDOM,
  '💣 Runtime hydration can only be run on the browser');

  const dataElement = document.getElementById(runtimeContainerId);
  const maybeRuntime = JSON.parse((_dataElement$textCont = dataElement === null || dataElement === void 0 ? void 0 : dataElement.textContent) !== null && _dataElement$textCont !== void 0 ? _dataElement$textCont : '{}');
  return ensureRuntime(maybeRuntime);
};

/***/ }),
/* 6 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "r": () => /* binding */ Runtime
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);




const Runtime = react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});

/***/ }),
/* 7 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "load": () => /* reexport safe */ _loader__WEBPACK_IMPORTED_MODULE_0__.z,
/* harmony export */   "Runtime": () => /* reexport safe */ _context_Runtime__WEBPACK_IMPORTED_MODULE_1__.r,
/* harmony export */   "getRuntimeData": () => /* reexport safe */ _runtime__WEBPACK_IMPORTED_MODULE_2__.W,
/* harmony export */   "withRuntimeTags": () => /* reexport safe */ _runtime__WEBPACK_IMPORTED_MODULE_2__.H,
/* harmony export */   "appContainerId": () => /* reexport safe */ _container__WEBPACK_IMPORTED_MODULE_3__.OD,
/* harmony export */   "getAppContainer": () => /* reexport safe */ _container__WEBPACK_IMPORTED_MODULE_3__.Ir,
/* harmony export */   "withAppContainerTags": () => /* reexport safe */ _container__WEBPACK_IMPORTED_MODULE_3__.sz,
/* harmony export */   "inflight": () => /* reexport safe */ _inflight__WEBPACK_IMPORTED_MODULE_4__.t,
/* harmony export */   "join": () => /* reexport safe */ _path__WEBPACK_IMPORTED_MODULE_5__.v
/* harmony export */ });
/* harmony import */ var _loader__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8);
/* harmony import */ var _context_Runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
/* harmony import */ var _runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5);
/* harmony import */ var _container__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
/* harmony import */ var _inflight__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9);
/* harmony import */ var _path__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(10);
/* harmony import */ var exenv__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(0);
/* harmony import */ var exenv__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(exenv__WEBPACK_IMPORTED_MODULE_6__);
/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in exenv__WEBPACK_IMPORTED_MODULE_6__) if(["default","load","Runtime","getRuntimeData","withRuntimeTags","appContainerId","getAppContainer","withAppContainerTags","inflight","join"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => exenv__WEBPACK_IMPORTED_MODULE_6__[__WEBPACK_IMPORT_KEY__]
/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);









/***/ }),
/* 8 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  "z": () => /* binding */ load
});

// EXTERNAL MODULE: external "LoadableComponent"
var external_LoadableComponent_ = __webpack_require__(2);

// EXTERNAL MODULE: ../../.yarn/cache/exenv-npm-1.2.2-eeb9069149-09fd080c04.zip/node_modules/exenv/index.js
var exenv = __webpack_require__(0);

// EXTERNAL MODULE: external "React"
var external_React_ = __webpack_require__(1);
var external_React_default = /*#__PURE__*/__webpack_require__.n(external_React_);

// EXTERNAL MODULE: external "ReactDOM"
var external_ReactDOM_ = __webpack_require__(3);

// EXTERNAL MODULE: ./components/container.ts
var components_container = __webpack_require__(4);

// EXTERNAL MODULE: ./components/context/Runtime.tsx
var Runtime = __webpack_require__(6);

// CONCATENATED MODULE: ./components/data.ts




const id = '__MICRO_PAGE_DATA__';

const getPageData = async () => {var _ref;
  if (!exenv.canUseDOM) {
    throw new Error('💣 PageData fetch can only be run on the browser');
  }

  const dataElement = document.getElementById(id);
  if (typeof ((_ref = dataElement) === null || _ref === void 0 ? void 0 : _ref.href) === 'string') {var _ref2;
    const maybeDataPath = (_ref2 = dataElement) === null || _ref2 === void 0 ? void 0 : _ref2.href;
    const response = await fetch(maybeDataPath);
    return response.json();
  }

  return null;
};

const withPageDataTags = ({
  name,
  data,
  rootPath,
  path }) =>





{
  if (data === undefined) {
    return '';
  }
  const href = join(rootPath, path);
  return `<link id="${id}" data-chunk="${name}" rel="preload" as="fetch" href="${href}" crossorigin="anonymous">`;
};
// CONCATENATED MODULE: ./components/once.ts
const once = fn => {
  let called = false;
  let ret = null;

  return (...args) => {
    if (called) {
      return ret;
    }
    called = true;
    ret = fn(...args);
    return ret;
  };
};
// EXTERNAL MODULE: ./components/runtime.ts
var runtime = __webpack_require__(5);

// CONCATENATED MODULE: ./components/loader.tsx











const printPerformance = () => {var _window$performance;
  const timing = (_window$performance = window.performance) === null || _window$performance === void 0 ? void 0 : _window$performance.timing;
  if (!timing) {
    return;
  }
  const domContentLoaded =
  timing.domContentLoadedEventEnd - timing.navigationStart;
  const loaded = timing.loadEventEnd - timing.navigationStart;
  console.log(
  `[micro-react]: ⚡⚡ DomContentLoaded ${domContentLoaded / 1e3}ms`);

  console.log(`[micro-react]: ⚡⚡ Load ${loaded / 1e3}ms`);
};

const renderOrHydrate = App => async () => {
  const container = (0,components_container/* getAppContainer */.Ir)();
  const runtimeData = (0,runtime/* getRuntimeData */.W)();

  // This should be preloaded by now
  let error = null;
  const data = await getPageData().catch(err => {
    error = err;
  });

  const AppWithContext = /*#__PURE__*/
  external_React_default().createElement(external_React_.StrictMode, null, /*#__PURE__*/
  external_React_default().createElement(Runtime/* Runtime.Provider */.r.Provider, { value: runtimeData }, /*#__PURE__*/
  external_React_default().createElement(App, { name: runtimeData.page.name, data: data, error: error })));




  if (container.children.length > 0) {
    const msg = '[micro-react]: ⚡⚡ Hydration took';
    console.time(msg);
    console.log(
    'hydrationStart',
    (Date.now() - window.performance.timing.navigationStart) / 1e3);

    (0,external_ReactDOM_.hydrate)(AppWithContext, container);
    console.timeEnd(msg);
  } else {
    const msg = '[micro-react]: ⚡ Rendering took';
    console.time(msg);
    console.log(
    'renderStart',
    (Date.now() - window.performance.timing.navigationStart) / 1e3);

    (0,external_ReactDOM_.render)(AppWithContext, container);
    console.timeEnd(msg);
  }

  printPerformance();
};

const load = App => {
  if (exenv.canUseDOM) {
    const renderOnce = once(renderOrHydrate(App));
    setTimeout(renderOnce, 6e3);

    if (document.readyState !== 'complete') {
      window.onload = () => (0,external_LoadableComponent_.loadableReady)(renderOnce);
    } else {
      (0,external_LoadableComponent_.loadableReady)(renderOnce);
    }
  }
  return App;
};

/***/ }),
/* 9 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "t": () => /* binding */ inflight
/* harmony export */ });
const active = {};

const cleanUp = key => result => {
  delete active[key];
  return result;
};

const inflight = (
key,
doFly) =>
{
  if (!active[key]) {
    const clean = cleanUp(key);
    active[key] = doFly().
    then(clean).
    catch(e => {
      clean(e);
      throw e;
    });
  }
  return active[key];
};

/***/ }),
/* 10 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "v": () => /* binding */ join
/* harmony export */ });
const removeEndingSlash = (x) =>
x.endsWith('/') ? x.slice(0, x.length - 1) : x;

const ensureStartingSlash = (x) =>
x.startsWith('/') || x === '' ? x : `/${x}`;

const join = (...args) =>
args.reduce(
(acc, cur) => `${removeEndingSlash(acc)}${ensureStartingSlash(cur)}`,
'');

/***/ })
/******/ 	]);
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		if(__webpack_module_cache__[moduleId]) {
/******/ 			return __webpack_module_cache__[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/compat get default export */
/******/ 	(() => {
/******/ 		// getDefaultExport function for compatibility with non-harmony modules
/******/ 		__webpack_require__.n = (module) => {
/******/ 			var getter = module && module.__esModule ?
/******/ 				() => module['default'] :
/******/ 				() => module;
/******/ 			__webpack_require__.d(getter, { a: getter });
/******/ 			return getter;
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/define property getters */
/******/ 	(() => {
/******/ 		// define getter functions for harmony exports
/******/ 		__webpack_require__.d = (exports, definition) => {
/******/ 			for(var key in definition) {
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
/******/ 	(() => {
/******/ 		__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/make namespace object */
/******/ 	(() => {
/******/ 		// define __esModule on exports
/******/ 		__webpack_require__.r = (exports) => {
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 			}
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
/******/ 		};
/******/ 	})();
/******/ 	
/************************************************************************/
/******/ 	// module exports must be returned from runtime so entry inlining is disabled
/******/ 	// startup
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(7);
/******/ })()
;