You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1136 lines
36 KiB

  1. exports.id = 6859;
  2. exports.ids = [6859];
  3. exports.modules = {
  4. /***/ 1297:
  5. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  6. "use strict";
  7. var _interopRequireDefault = __webpack_require__(2426);
  8. exports.__esModule = true;
  9. exports.initScriptLoader = initScriptLoader;
  10. exports.default = void 0;
  11. var _extends2 = _interopRequireDefault(__webpack_require__(9566));
  12. var _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(6169));
  13. var _react = __webpack_require__(9297);
  14. var _headManagerContext = __webpack_require__(816);
  15. var _headManager = __webpack_require__(2771);
  16. var _requestIdleCallback = __webpack_require__(8391);
  17. const ScriptCache = new Map();
  18. const LoadCache = new Set();
  19. const ignoreProps = ['onLoad', 'dangerouslySetInnerHTML', 'children', 'onError', 'strategy'];
  20. const loadScript = props => {
  21. const {
  22. src,
  23. id,
  24. onLoad = () => {},
  25. dangerouslySetInnerHTML,
  26. children = '',
  27. onError
  28. } = props;
  29. const cacheKey = id || src;
  30. if (ScriptCache.has(src)) {
  31. if (!LoadCache.has(cacheKey)) {
  32. LoadCache.add(cacheKey); // Execute onLoad since the script loading has begun
  33. ScriptCache.get(src).then(onLoad, onError);
  34. }
  35. return;
  36. }
  37. const el = document.createElement('script');
  38. const loadPromise = new Promise((resolve, reject) => {
  39. el.addEventListener('load', function () {
  40. resolve();
  41. if (onLoad) {
  42. onLoad.call(this);
  43. }
  44. });
  45. el.addEventListener('error', function () {
  46. reject();
  47. if (onError) {
  48. onError();
  49. }
  50. });
  51. });
  52. if (src) {
  53. ScriptCache.set(src, loadPromise);
  54. LoadCache.add(cacheKey);
  55. }
  56. if (dangerouslySetInnerHTML) {
  57. el.innerHTML = dangerouslySetInnerHTML.__html || '';
  58. } else if (children) {
  59. el.textContent = typeof children === 'string' ? children : Array.isArray(children) ? children.join('') : '';
  60. } else if (src) {
  61. el.src = src;
  62. }
  63. for (const [k, value] of Object.entries(props)) {
  64. if (value === undefined || ignoreProps.includes(k)) {
  65. continue;
  66. }
  67. const attr = _headManager.DOMAttributeNames[k] || k.toLowerCase();
  68. el.setAttribute(attr, value);
  69. }
  70. document.body.appendChild(el);
  71. };
  72. function handleClientScriptLoad(props) {
  73. const {
  74. strategy = 'afterInteractive'
  75. } = props;
  76. if (strategy === 'afterInteractive') {
  77. loadScript(props);
  78. } else if (strategy === 'lazyOnload') {
  79. window.addEventListener('load', () => {
  80. (0, _requestIdleCallback.requestIdleCallback)(() => loadScript(props));
  81. });
  82. }
  83. }
  84. function loadLazyScript(props) {
  85. if (document.readyState === 'complete') {
  86. (0, _requestIdleCallback.requestIdleCallback)(() => loadScript(props));
  87. } else {
  88. window.addEventListener('load', () => {
  89. (0, _requestIdleCallback.requestIdleCallback)(() => loadScript(props));
  90. });
  91. }
  92. }
  93. function initScriptLoader(scriptLoaderItems) {
  94. scriptLoaderItems.forEach(handleClientScriptLoad);
  95. }
  96. function Script(props) {
  97. const {
  98. src = '',
  99. onLoad = () => {},
  100. strategy = 'afterInteractive',
  101. onError
  102. } = props,
  103. restProps = (0, _objectWithoutPropertiesLoose2.default)(props, ["src", "onLoad", "dangerouslySetInnerHTML", "strategy", "onError"]); // Context is available only during SSR
  104. const {
  105. updateScripts,
  106. scripts
  107. } = (0, _react.useContext)(_headManagerContext.HeadManagerContext);
  108. (0, _react.useEffect)(() => {
  109. if (strategy === 'afterInteractive') {
  110. loadScript(props);
  111. } else if (strategy === 'lazyOnload') {
  112. loadLazyScript(props);
  113. }
  114. }, [props, strategy]);
  115. if (true) {
  116. return null;
  117. }
  118. if (strategy === 'beforeInteractive') {
  119. if (updateScripts) {
  120. scripts.beforeInteractive = (scripts.beforeInteractive || []).concat([(0, _extends2.default)({
  121. src,
  122. onLoad,
  123. onError
  124. }, restProps)]);
  125. updateScripts(scripts);
  126. }
  127. }
  128. return null;
  129. }
  130. var _default = Script;
  131. exports.default = _default;
  132. /***/ }),
  133. /***/ 2771:
  134. /***/ (function(__unused_webpack_module, exports) {
  135. "use strict";
  136. exports.__esModule = true;
  137. exports.default = initHeadManager;
  138. exports.DOMAttributeNames = void 0;
  139. const DOMAttributeNames = {
  140. acceptCharset: 'accept-charset',
  141. className: 'class',
  142. htmlFor: 'for',
  143. httpEquiv: 'http-equiv',
  144. noModule: 'noModule'
  145. };
  146. exports.DOMAttributeNames = DOMAttributeNames;
  147. function reactElementToDOM({
  148. type,
  149. props
  150. }) {
  151. const el = document.createElement(type);
  152. for (const p in props) {
  153. if (!props.hasOwnProperty(p)) continue;
  154. if (p === 'children' || p === 'dangerouslySetInnerHTML') continue; // we don't render undefined props to the DOM
  155. if (props[p] === undefined) continue;
  156. const attr = DOMAttributeNames[p] || p.toLowerCase();
  157. if (type === 'script' && (attr === 'async' || attr === 'defer' || attr === 'noModule')) {
  158. ;
  159. el[attr] = !!props[p];
  160. } else {
  161. el.setAttribute(attr, props[p]);
  162. }
  163. }
  164. const {
  165. children,
  166. dangerouslySetInnerHTML
  167. } = props;
  168. if (dangerouslySetInnerHTML) {
  169. el.innerHTML = dangerouslySetInnerHTML.__html || '';
  170. } else if (children) {
  171. el.textContent = typeof children === 'string' ? children : Array.isArray(children) ? children.join('') : '';
  172. }
  173. return el;
  174. }
  175. function updateElements(type, components) {
  176. const headEl = document.getElementsByTagName('head')[0];
  177. const headCountEl = headEl.querySelector('meta[name=next-head-count]');
  178. if (false) {}
  179. const headCount = Number(headCountEl.content);
  180. const oldTags = [];
  181. for (let i = 0, j = headCountEl.previousElementSibling; i < headCount; i++, j = j.previousElementSibling) {
  182. if (j.tagName.toLowerCase() === type) {
  183. oldTags.push(j);
  184. }
  185. }
  186. const newTags = components.map(reactElementToDOM).filter(newTag => {
  187. for (let k = 0, len = oldTags.length; k < len; k++) {
  188. const oldTag = oldTags[k];
  189. if (oldTag.isEqualNode(newTag)) {
  190. oldTags.splice(k, 1);
  191. return false;
  192. }
  193. }
  194. return true;
  195. });
  196. oldTags.forEach(t => t.parentNode.removeChild(t));
  197. newTags.forEach(t => headEl.insertBefore(t, headCountEl));
  198. headCountEl.content = (headCount - oldTags.length + newTags.length).toString();
  199. }
  200. function initHeadManager() {
  201. let updatePromise = null;
  202. return {
  203. mountedInstances: new Set(),
  204. updateHead: head => {
  205. const promise = updatePromise = Promise.resolve().then(() => {
  206. if (promise !== updatePromise) return;
  207. updatePromise = null;
  208. const tags = {};
  209. head.forEach(h => {
  210. if ( // If the font tag is loaded only on client navigation
  211. // it won't be inlined. In this case revert to the original behavior
  212. h.type === 'link' && h.props['data-optimized-fonts'] && !document.querySelector(`style[data-href="${h.props['data-href']}"]`)) {
  213. h.props.href = h.props['data-href'];
  214. h.props['data-href'] = undefined;
  215. }
  216. const components = tags[h.type] || [];
  217. components.push(h);
  218. tags[h.type] = components;
  219. });
  220. const titleComponent = tags.title ? tags.title[0] : null;
  221. let title = '';
  222. if (titleComponent) {
  223. const {
  224. children
  225. } = titleComponent.props;
  226. title = typeof children === 'string' ? children : Array.isArray(children) ? children.join('') : '';
  227. }
  228. if (title !== document.title) document.title = title;
  229. ['meta', 'base', 'link', 'style', 'script'].forEach(type => {
  230. updateElements(type, tags[type] || []);
  231. });
  232. });
  233. }
  234. };
  235. }
  236. /***/ }),
  237. /***/ 8391:
  238. /***/ (function(__unused_webpack_module, exports) {
  239. "use strict";
  240. exports.__esModule = true;
  241. exports.cancelIdleCallback = exports.requestIdleCallback = void 0;
  242. const requestIdleCallback = typeof self !== 'undefined' && self.requestIdleCallback || function (cb) {
  243. let start = Date.now();
  244. return setTimeout(function () {
  245. cb({
  246. didTimeout: false,
  247. timeRemaining: function () {
  248. return Math.max(0, 50 - (Date.now() - start));
  249. }
  250. });
  251. }, 1);
  252. };
  253. exports.requestIdleCallback = requestIdleCallback;
  254. const cancelIdleCallback = typeof self !== 'undefined' && self.cancelIdleCallback || function (id) {
  255. return clearTimeout(id);
  256. };
  257. exports.cancelIdleCallback = cancelIdleCallback;
  258. /***/ }),
  259. /***/ 2400:
  260. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  261. "use strict";
  262. var __webpack_unused_export__;
  263. 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; }
  264. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  265. 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; }
  266. 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; }
  267. 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; }
  268. __webpack_unused_export__ = true;
  269. exports.Html = Html;
  270. exports.Main = Main;
  271. exports.NextScript = exports.Head = exports.default = void 0;
  272. var _propTypes = _interopRequireDefault(__webpack_require__(4229));
  273. var _react = _interopRequireWildcard(__webpack_require__(9297));
  274. var _server = _interopRequireDefault(__webpack_require__(1168));
  275. var _constants = __webpack_require__(227);
  276. var _documentContext = __webpack_require__(3932);
  277. var _utils = __webpack_require__(7579);
  278. __webpack_unused_export__ = _utils.DocumentContext;
  279. __webpack_unused_export__ = _utils.DocumentInitialProps;
  280. __webpack_unused_export__ = _utils.DocumentProps;
  281. var _getPageFiles = __webpack_require__(6171);
  282. var _utils2 = __webpack_require__(5105);
  283. var _htmlescape = __webpack_require__(9630);
  284. var _experimentalScript = _interopRequireDefault(__webpack_require__(1297));
  285. function _getRequireWildcardCache() {
  286. if (typeof WeakMap !== "function") return null;
  287. var cache = new WeakMap();
  288. _getRequireWildcardCache = function () {
  289. return cache;
  290. };
  291. return cache;
  292. }
  293. function _interopRequireWildcard(obj) {
  294. if (obj && obj.__esModule) {
  295. return obj;
  296. }
  297. if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
  298. return {
  299. default: obj
  300. };
  301. }
  302. var cache = _getRequireWildcardCache();
  303. if (cache && cache.has(obj)) {
  304. return cache.get(obj);
  305. }
  306. var newObj = {};
  307. var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
  308. for (var key in obj) {
  309. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  310. var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
  311. if (desc && (desc.get || desc.set)) {
  312. Object.defineProperty(newObj, key, desc);
  313. } else {
  314. newObj[key] = obj[key];
  315. }
  316. }
  317. }
  318. newObj.default = obj;
  319. if (cache) {
  320. cache.set(obj, newObj);
  321. }
  322. return newObj;
  323. }
  324. function _interopRequireDefault(obj) {
  325. return obj && obj.__esModule ? obj : {
  326. default: obj
  327. };
  328. }
  329. function getDocumentFiles(buildManifest, pathname, inAmpMode) {
  330. const sharedFiles = (0, _getPageFiles.getPageFiles)(buildManifest, '/_app');
  331. const pageFiles = inAmpMode ? [] : (0, _getPageFiles.getPageFiles)(buildManifest, pathname);
  332. return {
  333. sharedFiles,
  334. pageFiles,
  335. allFiles: [...new Set([...sharedFiles, ...pageFiles])]
  336. };
  337. }
  338. function getPolyfillScripts(context, props) {
  339. // polyfills.js has to be rendered as nomodule without async
  340. // It also has to be the first script to load
  341. const {
  342. assetPrefix,
  343. buildManifest,
  344. devOnlyCacheBusterQueryString,
  345. disableOptimizedLoading
  346. } = context;
  347. return buildManifest.polyfillFiles.filter(polyfill => polyfill.endsWith('.js') && !polyfill.endsWith('.module.js')).map(polyfill => /*#__PURE__*/_react.default.createElement("script", {
  348. key: polyfill,
  349. defer: !disableOptimizedLoading,
  350. nonce: props.nonce,
  351. crossOrigin: props.crossOrigin || undefined,
  352. noModule: true,
  353. src: `${assetPrefix}/_next/${polyfill}${devOnlyCacheBusterQueryString}`
  354. }));
  355. }
  356. function getPreNextScripts(context, props) {
  357. const {
  358. scriptLoader,
  359. disableOptimizedLoading
  360. } = context;
  361. return (scriptLoader.beforeInteractive || []).map(file => {
  362. const {
  363. strategy
  364. } = file,
  365. scriptProps = _objectWithoutProperties(file, ["strategy"]);
  366. return /*#__PURE__*/_react.default.createElement("script", Object.assign({}, scriptProps, {
  367. defer: !disableOptimizedLoading,
  368. nonce: props.nonce,
  369. crossOrigin: props.crossOrigin || undefined
  370. }));
  371. });
  372. }
  373. function getDynamicChunks(context, props, files) {
  374. const {
  375. dynamicImports,
  376. assetPrefix,
  377. isDevelopment,
  378. devOnlyCacheBusterQueryString,
  379. disableOptimizedLoading
  380. } = context;
  381. return dynamicImports.map(file => {
  382. if (!file.endsWith('.js') || files.allFiles.includes(file)) return null;
  383. return /*#__PURE__*/_react.default.createElement("script", {
  384. async: !isDevelopment && disableOptimizedLoading,
  385. defer: !disableOptimizedLoading,
  386. key: file,
  387. src: `${assetPrefix}/_next/${encodeURI(file)}${devOnlyCacheBusterQueryString}`,
  388. nonce: props.nonce,
  389. crossOrigin: props.crossOrigin || undefined
  390. });
  391. });
  392. }
  393. function getScripts(context, props, files) {
  394. var _buildManifest$lowPri;
  395. const {
  396. assetPrefix,
  397. buildManifest,
  398. isDevelopment,
  399. devOnlyCacheBusterQueryString,
  400. disableOptimizedLoading
  401. } = context;
  402. const normalScripts = files.allFiles.filter(file => file.endsWith('.js'));
  403. const lowPriorityScripts = (_buildManifest$lowPri = buildManifest.lowPriorityFiles) == null ? void 0 : _buildManifest$lowPri.filter(file => file.endsWith('.js'));
  404. return [...normalScripts, ...lowPriorityScripts].map(file => {
  405. return /*#__PURE__*/_react.default.createElement("script", {
  406. key: file,
  407. src: `${assetPrefix}/_next/${encodeURI(file)}${devOnlyCacheBusterQueryString}`,
  408. nonce: props.nonce,
  409. async: !isDevelopment && disableOptimizedLoading,
  410. defer: !disableOptimizedLoading,
  411. crossOrigin: props.crossOrigin || undefined
  412. });
  413. });
  414. }
  415. /**
  416. * `Document` component handles the initial `document` markup and renders only on the server side.
  417. * Commonly used for implementing server side rendering for `css-in-js` libraries.
  418. */
  419. class Document extends _react.Component {
  420. /**
  421. * `getInitialProps` hook returns the context object with the addition of `renderPage`.
  422. * `renderPage` callback executes `React` rendering logic synchronously to support server-rendering wrappers
  423. */
  424. static async getInitialProps(ctx) {
  425. const enhanceApp = App => {
  426. return props => /*#__PURE__*/_react.default.createElement(App, props);
  427. };
  428. const {
  429. html,
  430. head
  431. } = await ctx.renderPage({
  432. enhanceApp
  433. });
  434. const styles = [...(0, _server.default)()];
  435. return {
  436. html,
  437. head,
  438. styles
  439. };
  440. }
  441. static renderDocument(DocumentComponent, props) {
  442. return /*#__PURE__*/_react.default.createElement(_documentContext.DocumentContext.Provider, {
  443. value: props
  444. }, /*#__PURE__*/_react.default.createElement(DocumentComponent, props));
  445. }
  446. render() {
  447. return /*#__PURE__*/_react.default.createElement(Html, null, /*#__PURE__*/_react.default.createElement(Head, null), /*#__PURE__*/_react.default.createElement("body", null, /*#__PURE__*/_react.default.createElement(Main, null), /*#__PURE__*/_react.default.createElement(NextScript, null)));
  448. }
  449. }
  450. exports.default = Document;
  451. function Html(props) {
  452. const {
  453. inAmpMode,
  454. docComponentsRendered,
  455. locale
  456. } = (0, _react.useContext)(_documentContext.DocumentContext);
  457. docComponentsRendered.Html = true;
  458. return /*#__PURE__*/_react.default.createElement("html", Object.assign({}, props, {
  459. lang: props.lang || locale || undefined,
  460. amp: inAmpMode ? '' : undefined,
  461. "data-ampdevmode": inAmpMode && false ? '' : undefined
  462. }));
  463. }
  464. class Head extends _react.Component {
  465. constructor(...args) {
  466. super(...args);
  467. this.context = void 0;
  468. }
  469. getCssLinks(files) {
  470. const {
  471. assetPrefix,
  472. devOnlyCacheBusterQueryString,
  473. dynamicImports
  474. } = this.context;
  475. const cssFiles = files.allFiles.filter(f => f.endsWith('.css'));
  476. const sharedFiles = new Set(files.sharedFiles); // Unmanaged files are CSS files that will be handled directly by the
  477. // webpack runtime (`mini-css-extract-plugin`).
  478. let unmangedFiles = new Set([]);
  479. let dynamicCssFiles = Array.from(new Set(dynamicImports.filter(file => file.endsWith('.css'))));
  480. if (dynamicCssFiles.length) {
  481. const existing = new Set(cssFiles);
  482. dynamicCssFiles = dynamicCssFiles.filter(f => !(existing.has(f) || sharedFiles.has(f)));
  483. unmangedFiles = new Set(dynamicCssFiles);
  484. cssFiles.push(...dynamicCssFiles);
  485. }
  486. let cssLinkElements = [];
  487. cssFiles.forEach(file => {
  488. const isSharedFile = sharedFiles.has(file);
  489. if (true) {
  490. cssLinkElements.push( /*#__PURE__*/_react.default.createElement("link", {
  491. key: `${file}-preload`,
  492. nonce: this.props.nonce,
  493. rel: "preload",
  494. href: `${assetPrefix}/_next/${encodeURI(file)}${devOnlyCacheBusterQueryString}`,
  495. as: "style",
  496. crossOrigin: this.props.crossOrigin || undefined
  497. }));
  498. }
  499. const isUnmanagedFile = unmangedFiles.has(file);
  500. cssLinkElements.push( /*#__PURE__*/_react.default.createElement("link", {
  501. key: file,
  502. nonce: this.props.nonce,
  503. rel: "stylesheet",
  504. href: `${assetPrefix}/_next/${encodeURI(file)}${devOnlyCacheBusterQueryString}`,
  505. crossOrigin: this.props.crossOrigin || undefined,
  506. "data-n-g": isUnmanagedFile ? undefined : isSharedFile ? '' : undefined,
  507. "data-n-p": isUnmanagedFile ? undefined : isSharedFile ? undefined : ''
  508. }));
  509. });
  510. if (true) {
  511. cssLinkElements = this.makeStylesheetInert(cssLinkElements);
  512. }
  513. return cssLinkElements.length === 0 ? null : cssLinkElements;
  514. }
  515. getPreloadDynamicChunks() {
  516. const {
  517. dynamicImports,
  518. assetPrefix,
  519. devOnlyCacheBusterQueryString
  520. } = this.context;
  521. return dynamicImports.map(file => {
  522. if (!file.endsWith('.js')) {
  523. return null;
  524. }
  525. return /*#__PURE__*/_react.default.createElement("link", {
  526. rel: "preload",
  527. key: file,
  528. href: `${assetPrefix}/_next/${encodeURI(file)}${devOnlyCacheBusterQueryString}`,
  529. as: "script",
  530. nonce: this.props.nonce,
  531. crossOrigin: this.props.crossOrigin || undefined
  532. });
  533. }) // Filter out nulled scripts
  534. .filter(Boolean);
  535. }
  536. getPreloadMainLinks(files) {
  537. const {
  538. assetPrefix,
  539. devOnlyCacheBusterQueryString,
  540. scriptLoader
  541. } = this.context;
  542. const preloadFiles = files.allFiles.filter(file => {
  543. return file.endsWith('.js');
  544. });
  545. return [...(scriptLoader.beforeInteractive || []).map(file => /*#__PURE__*/_react.default.createElement("link", {
  546. key: file.src,
  547. nonce: this.props.nonce,
  548. rel: "preload",
  549. href: file.src,
  550. as: "script",
  551. crossOrigin: this.props.crossOrigin || undefined
  552. })), ...preloadFiles.map(file => /*#__PURE__*/_react.default.createElement("link", {
  553. key: file,
  554. nonce: this.props.nonce,
  555. rel: "preload",
  556. href: `${assetPrefix}/_next/${encodeURI(file)}${devOnlyCacheBusterQueryString}`,
  557. as: "script",
  558. crossOrigin: this.props.crossOrigin || undefined
  559. }))];
  560. }
  561. getDynamicChunks(files) {
  562. return getDynamicChunks(this.context, this.props, files);
  563. }
  564. getPreNextScripts() {
  565. return getPreNextScripts(this.context, this.props);
  566. }
  567. getScripts(files) {
  568. return getScripts(this.context, this.props, files);
  569. }
  570. getPolyfillScripts() {
  571. return getPolyfillScripts(this.context, this.props);
  572. }
  573. handleDocumentScriptLoaderItems(children) {
  574. const {
  575. scriptLoader
  576. } = this.context;
  577. const scriptLoaderItems = [];
  578. const filteredChildren = [];
  579. _react.default.Children.forEach(children, child => {
  580. if (child.type === _experimentalScript.default) {
  581. if (child.props.strategy === 'beforeInteractive') {
  582. scriptLoader.beforeInteractive = (scriptLoader.beforeInteractive || []).concat([_objectSpread({}, child.props)]);
  583. return;
  584. } else if (['lazyOnload', 'afterInteractive'].includes(child.props.strategy)) {
  585. scriptLoaderItems.push(child.props);
  586. return;
  587. }
  588. }
  589. filteredChildren.push(child);
  590. });
  591. this.context.__NEXT_DATA__.scriptLoader = scriptLoaderItems;
  592. return filteredChildren;
  593. }
  594. makeStylesheetInert(node) {
  595. return _react.default.Children.map(node, c => {
  596. if (c.type === 'link' && c.props['href'] && _constants.OPTIMIZED_FONT_PROVIDERS.some(url => c.props['href'].startsWith(url))) {
  597. const newProps = _objectSpread({}, c.props || {});
  598. newProps['data-href'] = newProps['href'];
  599. newProps['href'] = undefined;
  600. return /*#__PURE__*/_react.default.cloneElement(c, newProps);
  601. } else if (c.props && c.props['children']) {
  602. c.props['children'] = this.makeStylesheetInert(c.props['children']);
  603. }
  604. return c;
  605. });
  606. }
  607. render() {
  608. var _this$props$nonce, _this$props$nonce2;
  609. const {
  610. styles,
  611. ampPath,
  612. inAmpMode,
  613. hybridAmp,
  614. canonicalBase,
  615. __NEXT_DATA__,
  616. dangerousAsPath,
  617. headTags,
  618. unstable_runtimeJS,
  619. unstable_JsPreload,
  620. disableOptimizedLoading
  621. } = this.context;
  622. const disableRuntimeJS = unstable_runtimeJS === false;
  623. const disableJsPreload = unstable_JsPreload === false || !disableOptimizedLoading;
  624. this.context.docComponentsRendered.Head = true;
  625. let {
  626. head
  627. } = this.context;
  628. let cssPreloads = [];
  629. let otherHeadElements = [];
  630. if (head) {
  631. head.forEach(c => {
  632. if (c && c.type === 'link' && c.props['rel'] === 'preload' && c.props['as'] === 'style') {
  633. cssPreloads.push(c);
  634. } else {
  635. c && otherHeadElements.push(c);
  636. }
  637. });
  638. head = cssPreloads.concat(otherHeadElements);
  639. }
  640. let children = _react.default.Children.toArray(this.props.children).filter(Boolean); // show a warning if Head contains <title> (only in development)
  641. if (false) {}
  642. if ( true && !inAmpMode) {
  643. children = this.makeStylesheetInert(children);
  644. }
  645. if (false) {}
  646. let hasAmphtmlRel = false;
  647. let hasCanonicalRel = false; // show warning and remove conflicting amp head tags
  648. head = _react.default.Children.map(head || [], child => {
  649. if (!child) return child;
  650. const {
  651. type,
  652. props
  653. } = child;
  654. if (inAmpMode) {
  655. let badProp = '';
  656. if (type === 'meta' && props.name === 'viewport') {
  657. badProp = 'name="viewport"';
  658. } else if (type === 'link' && props.rel === 'canonical') {
  659. hasCanonicalRel = true;
  660. } else if (type === 'script') {
  661. // only block if
  662. // 1. it has a src and isn't pointing to ampproject's CDN
  663. // 2. it is using dangerouslySetInnerHTML without a type or
  664. // a type of text/javascript
  665. if (props.src && props.src.indexOf('ampproject') < -1 || props.dangerouslySetInnerHTML && (!props.type || props.type === 'text/javascript')) {
  666. badProp = '<script';
  667. Object.keys(props).forEach(prop => {
  668. badProp += ` ${prop}="${props[prop]}"`;
  669. });
  670. badProp += '/>';
  671. }
  672. }
  673. if (badProp) {
  674. console.warn(`Found conflicting amp tag "${child.type}" with conflicting prop ${badProp} in ${__NEXT_DATA__.page}. https://nextjs.org/docs/messages/conflicting-amp-tag`);
  675. return null;
  676. }
  677. } else {
  678. // non-amp mode
  679. if (type === 'link' && props.rel === 'amphtml') {
  680. hasAmphtmlRel = true;
  681. }
  682. }
  683. return child;
  684. }); // try to parse styles from fragment for backwards compat
  685. const curStyles = Array.isArray(styles) ? styles : [];
  686. if (inAmpMode && styles && // @ts-ignore Property 'props' does not exist on type ReactElement
  687. styles.props && // @ts-ignore Property 'props' does not exist on type ReactElement
  688. Array.isArray(styles.props.children)) {
  689. const hasStyles = el => {
  690. var _el$props, _el$props$dangerously;
  691. return el == null ? void 0 : (_el$props = el.props) == null ? void 0 : (_el$props$dangerously = _el$props.dangerouslySetInnerHTML) == null ? void 0 : _el$props$dangerously.__html;
  692. }; // @ts-ignore Property 'props' does not exist on type ReactElement
  693. styles.props.children.forEach(child => {
  694. if (Array.isArray(child)) {
  695. child.forEach(el => hasStyles(el) && curStyles.push(el));
  696. } else if (hasStyles(child)) {
  697. curStyles.push(child);
  698. }
  699. });
  700. }
  701. const files = getDocumentFiles(this.context.buildManifest, this.context.__NEXT_DATA__.page, inAmpMode);
  702. return /*#__PURE__*/_react.default.createElement("head", this.props, this.context.isDevelopment && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("style", {
  703. "data-next-hide-fouc": true,
  704. "data-ampdevmode": inAmpMode ? 'true' : undefined,
  705. dangerouslySetInnerHTML: {
  706. __html: `body{display:none}`
  707. }
  708. }), /*#__PURE__*/_react.default.createElement("noscript", {
  709. "data-next-hide-fouc": true,
  710. "data-ampdevmode": inAmpMode ? 'true' : undefined
  711. }, /*#__PURE__*/_react.default.createElement("style", {
  712. dangerouslySetInnerHTML: {
  713. __html: `body{display:block}`
  714. }
  715. }))), children, head, /*#__PURE__*/_react.default.createElement("meta", {
  716. name: "next-head-count",
  717. content: _react.default.Children.count(head || []).toString()
  718. }), inAmpMode && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("meta", {
  719. name: "viewport",
  720. content: "width=device-width,minimum-scale=1,initial-scale=1"
  721. }), !hasCanonicalRel && /*#__PURE__*/_react.default.createElement("link", {
  722. rel: "canonical",
  723. href: canonicalBase + (0, _utils2.cleanAmpPath)(dangerousAsPath)
  724. }), /*#__PURE__*/_react.default.createElement("link", {
  725. rel: "preload",
  726. as: "script",
  727. href: "https://cdn.ampproject.org/v0.js"
  728. }), styles && /*#__PURE__*/_react.default.createElement("style", {
  729. "amp-custom": "",
  730. dangerouslySetInnerHTML: {
  731. __html: curStyles.map(style => style.props.dangerouslySetInnerHTML.__html).join('').replace(/\/\*# sourceMappingURL=.*\*\//g, '').replace(/\/\*@ sourceURL=.*?\*\//g, '')
  732. }
  733. }), /*#__PURE__*/_react.default.createElement("style", {
  734. "amp-boilerplate": "",
  735. dangerouslySetInnerHTML: {
  736. __html: `body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}`
  737. }
  738. }), /*#__PURE__*/_react.default.createElement("noscript", null, /*#__PURE__*/_react.default.createElement("style", {
  739. "amp-boilerplate": "",
  740. dangerouslySetInnerHTML: {
  741. __html: `body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}`
  742. }
  743. })), /*#__PURE__*/_react.default.createElement("script", {
  744. async: true,
  745. src: "https://cdn.ampproject.org/v0.js"
  746. })), !inAmpMode && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !hasAmphtmlRel && hybridAmp && /*#__PURE__*/_react.default.createElement("link", {
  747. rel: "amphtml",
  748. href: canonicalBase + getAmpPath(ampPath, dangerousAsPath)
  749. }), true && this.getCssLinks(files), true && /*#__PURE__*/_react.default.createElement("noscript", {
  750. "data-n-css": (_this$props$nonce = this.props.nonce) != null ? _this$props$nonce : ''
  751. }), !disableRuntimeJS && !disableJsPreload && this.getPreloadDynamicChunks(), !disableRuntimeJS && !disableJsPreload && this.getPreloadMainLinks(files), !disableOptimizedLoading && !disableRuntimeJS && this.getPolyfillScripts(), !disableOptimizedLoading && !disableRuntimeJS && this.getPreNextScripts(), !disableOptimizedLoading && !disableRuntimeJS && this.getDynamicChunks(files), !disableOptimizedLoading && !disableRuntimeJS && this.getScripts(files), false && 0, false && /*#__PURE__*/0, this.context.isDevelopment &&
  752. /*#__PURE__*/
  753. // this element is used to mount development styles so the
  754. // ordering matches production
  755. // (by default, style-loader injects at the bottom of <head />)
  756. _react.default.createElement("noscript", {
  757. id: "__next_css__DO_NOT_USE__"
  758. }), styles || null), /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {}, ...(headTags || [])));
  759. }
  760. }
  761. exports.Head = Head;
  762. Head.contextType = _documentContext.DocumentContext;
  763. Head.propTypes = {
  764. nonce: _propTypes.default.string,
  765. crossOrigin: _propTypes.default.string
  766. };
  767. function Main() {
  768. const {
  769. inAmpMode,
  770. html,
  771. docComponentsRendered
  772. } = (0, _react.useContext)(_documentContext.DocumentContext);
  773. docComponentsRendered.Main = true;
  774. if (inAmpMode) return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, _constants.AMP_RENDER_TARGET);
  775. return /*#__PURE__*/_react.default.createElement("div", {
  776. id: "__next",
  777. dangerouslySetInnerHTML: {
  778. __html: html
  779. }
  780. });
  781. }
  782. class NextScript extends _react.Component {
  783. constructor(...args) {
  784. super(...args);
  785. this.context = void 0;
  786. }
  787. getDynamicChunks(files) {
  788. return getDynamicChunks(this.context, this.props, files);
  789. }
  790. getPreNextScripts() {
  791. return getPreNextScripts(this.context, this.props);
  792. }
  793. getScripts(files) {
  794. return getScripts(this.context, this.props, files);
  795. }
  796. getPolyfillScripts() {
  797. return getPolyfillScripts(this.context, this.props);
  798. }
  799. static getInlineScriptSource(documentProps) {
  800. const {
  801. __NEXT_DATA__
  802. } = documentProps;
  803. try {
  804. const data = JSON.stringify(__NEXT_DATA__);
  805. return (0, _htmlescape.htmlEscapeJsonString)(data);
  806. } catch (err) {
  807. if (err.message.indexOf('circular structure')) {
  808. throw new Error(`Circular structure in "getInitialProps" result of page "${__NEXT_DATA__.page}". https://nextjs.org/docs/messages/circular-structure`);
  809. }
  810. throw err;
  811. }
  812. }
  813. render() {
  814. const {
  815. assetPrefix,
  816. inAmpMode,
  817. buildManifest,
  818. unstable_runtimeJS,
  819. docComponentsRendered,
  820. devOnlyCacheBusterQueryString,
  821. disableOptimizedLoading
  822. } = this.context;
  823. const disableRuntimeJS = unstable_runtimeJS === false;
  824. docComponentsRendered.NextScript = true;
  825. if (inAmpMode) {
  826. if (true) {
  827. return null;
  828. }
  829. const ampDevFiles = [...buildManifest.devFiles, ...buildManifest.polyfillFiles, ...buildManifest.ampDevFiles];
  830. return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, disableRuntimeJS ? null : /*#__PURE__*/_react.default.createElement("script", {
  831. id: "__NEXT_DATA__",
  832. type: "application/json",
  833. nonce: this.props.nonce,
  834. crossOrigin: this.props.crossOrigin || undefined,
  835. dangerouslySetInnerHTML: {
  836. __html: NextScript.getInlineScriptSource(this.context)
  837. },
  838. "data-ampdevmode": true
  839. }), ampDevFiles.map(file => /*#__PURE__*/_react.default.createElement("script", {
  840. key: file,
  841. src: `${assetPrefix}/_next/${file}${devOnlyCacheBusterQueryString}`,
  842. nonce: this.props.nonce,
  843. crossOrigin: this.props.crossOrigin || undefined,
  844. "data-ampdevmode": true
  845. })));
  846. }
  847. if (false) {}
  848. const files = getDocumentFiles(this.context.buildManifest, this.context.__NEXT_DATA__.page, inAmpMode);
  849. return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !disableRuntimeJS && buildManifest.devFiles ? buildManifest.devFiles.map(file => /*#__PURE__*/_react.default.createElement("script", {
  850. key: file,
  851. src: `${assetPrefix}/_next/${encodeURI(file)}${devOnlyCacheBusterQueryString}`,
  852. nonce: this.props.nonce,
  853. crossOrigin: this.props.crossOrigin || undefined
  854. })) : null, disableRuntimeJS ? null : /*#__PURE__*/_react.default.createElement("script", {
  855. id: "__NEXT_DATA__",
  856. type: "application/json",
  857. nonce: this.props.nonce,
  858. crossOrigin: this.props.crossOrigin || undefined,
  859. dangerouslySetInnerHTML: {
  860. __html: NextScript.getInlineScriptSource(this.context)
  861. }
  862. }), disableOptimizedLoading && !disableRuntimeJS && this.getPolyfillScripts(), disableOptimizedLoading && !disableRuntimeJS && this.getPreNextScripts(), disableOptimizedLoading && !disableRuntimeJS && this.getDynamicChunks(files), disableOptimizedLoading && !disableRuntimeJS && this.getScripts(files));
  863. }
  864. }
  865. exports.NextScript = NextScript;
  866. NextScript.contextType = _documentContext.DocumentContext;
  867. NextScript.propTypes = {
  868. nonce: _propTypes.default.string,
  869. crossOrigin: _propTypes.default.string
  870. };
  871. NextScript.safariNomoduleFix = '!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();';
  872. function getAmpPath(ampPath, asPath) {
  873. return ampPath || `${asPath}${asPath.includes('?') ? '&' : '?'}amp=1`;
  874. }
  875. /***/ }),
  876. /***/ 9630:
  877. /***/ (function(__unused_webpack_module, exports) {
  878. "use strict";
  879. exports.__esModule=true;exports.htmlEscapeJsonString=htmlEscapeJsonString;// This utility is based on https://github.com/zertosh/htmlescape
  880. // License: https://github.com/zertosh/htmlescape/blob/0527ca7156a524d256101bb310a9f970f63078ad/LICENSE
  881. const ESCAPE_LOOKUP={'&':'\\u0026','>':'\\u003e','<':'\\u003c','\u2028':'\\u2028','\u2029':'\\u2029'};const ESCAPE_REGEX=/[&><\u2028\u2029]/g;function htmlEscapeJsonString(str){return str.replace(ESCAPE_REGEX,match=>ESCAPE_LOOKUP[match]);}
  882. //# sourceMappingURL=htmlescape.js.map
  883. /***/ }),
  884. /***/ 6859:
  885. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  886. module.exports = __webpack_require__(2400)
  887. /***/ }),
  888. /***/ 9566:
  889. /***/ (function(module) {
  890. function _extends() {
  891. module.exports = _extends = Object.assign || function (target) {
  892. for (var i = 1; i < arguments.length; i++) {
  893. var source = arguments[i];
  894. for (var key in source) {
  895. if (Object.prototype.hasOwnProperty.call(source, key)) {
  896. target[key] = source[key];
  897. }
  898. }
  899. }
  900. return target;
  901. };
  902. return _extends.apply(this, arguments);
  903. }
  904. module.exports = _extends;
  905. /***/ }),
  906. /***/ 2426:
  907. /***/ (function(module) {
  908. function _interopRequireDefault(obj) {
  909. return obj && obj.__esModule ? obj : {
  910. "default": obj
  911. };
  912. }
  913. module.exports = _interopRequireDefault;
  914. /***/ }),
  915. /***/ 6169:
  916. /***/ (function(module) {
  917. function _objectWithoutPropertiesLoose(source, excluded) {
  918. if (source == null) return {};
  919. var target = {};
  920. var sourceKeys = Object.keys(source);
  921. var key, i;
  922. for (i = 0; i < sourceKeys.length; i++) {
  923. key = sourceKeys[i];
  924. if (excluded.indexOf(key) >= 0) continue;
  925. target[key] = source[key];
  926. }
  927. return target;
  928. }
  929. module.exports = _objectWithoutPropertiesLoose;
  930. /***/ })
  931. };
  932. ;