): string {\n const { __NEXT_DATA__, largePageDataBytes } = context\n try {\n const data = JSON.stringify(__NEXT_DATA__)\n\n if (largePageDataWarnings.has(__NEXT_DATA__.page)) {\n return htmlEscapeJsonString(data)\n }\n\n const bytes =\n process.env.NEXT_RUNTIME === 'edge'\n ? new TextEncoder().encode(data).buffer.byteLength\n : Buffer.from(data).byteLength\n const prettyBytes = (\n require('../lib/pretty-bytes') as typeof import('../lib/pretty-bytes')\n ).default\n\n if (largePageDataBytes && bytes > largePageDataBytes) {\n if (process.env.NODE_ENV === 'production') {\n largePageDataWarnings.add(__NEXT_DATA__.page)\n }\n\n console.warn(\n `Warning: data for page \"${__NEXT_DATA__.page}\"${\n __NEXT_DATA__.page === context.dangerousAsPath\n ? ''\n : ` (path \"${context.dangerousAsPath}\")`\n } is ${prettyBytes(\n bytes\n )} which exceeds the threshold of ${prettyBytes(\n largePageDataBytes\n )}, this amount of data can reduce performance.\\nSee more info here: https://nextjs.org/docs/messages/large-page-data`\n )\n }\n\n return htmlEscapeJsonString(data)\n } catch (err) {\n if (isError(err) && err.message.indexOf('circular structure') !== -1) {\n throw new Error(\n `Circular structure in \"getInitialProps\" result of page \"${__NEXT_DATA__.page}\". https://nextjs.org/docs/messages/circular-structure`\n )\n }\n throw err\n }\n }\n\n render() {\n const {\n assetPrefix,\n buildManifest,\n unstable_runtimeJS,\n docComponentsRendered,\n assetQueryString,\n disableOptimizedLoading,\n crossOrigin,\n } = this.context\n const disableRuntimeJS = unstable_runtimeJS === false\n\n docComponentsRendered.NextScript = true\n\n if (process.env.NODE_ENV !== 'production') {\n if (this.props.crossOrigin)\n console.warn(\n 'Warning: `NextScript` attribute `crossOrigin` is deprecated. https://nextjs.org/docs/messages/doc-crossorigin-deprecated'\n )\n }\n\n const files: DocumentFiles = getDocumentFiles(\n this.context.buildManifest,\n this.context.__NEXT_DATA__.page\n )\n\n return (\n <>\n {!disableRuntimeJS && buildManifest.devFiles\n ? buildManifest.devFiles.map((file: string) => (\n \n ))\n : null}\n {disableRuntimeJS ? null : (\n \n )}\n {disableOptimizedLoading &&\n !disableRuntimeJS &&\n this.getPolyfillScripts()}\n {disableOptimizedLoading &&\n !disableRuntimeJS &&\n this.getPreNextScripts()}\n {disableOptimizedLoading &&\n !disableRuntimeJS &&\n this.getDynamicChunks(files)}\n {disableOptimizedLoading && !disableRuntimeJS && this.getScripts(files)}\n >\n )\n }\n}\n\nexport function Html(\n props: React.DetailedHTMLProps<\n React.HtmlHTMLAttributes,\n HTMLHtmlElement\n >\n) {\n const { docComponentsRendered, locale, scriptLoader, __NEXT_DATA__ } =\n useHtmlContext()\n\n docComponentsRendered.Html = true\n handleDocumentScriptLoaderItems(scriptLoader, __NEXT_DATA__, props)\n\n return \n}\n\nexport function Main() {\n const { docComponentsRendered } = useHtmlContext()\n docComponentsRendered.Main = true\n // @ts-ignore\n return \n}\n\n/**\n * `Document` component handles the initial `document` markup and renders only on the server side.\n * Commonly used for implementing server side rendering for `css-in-js` libraries.\n */\nexport default class Document extends React.Component<\n DocumentProps & P\n> {\n /**\n * `getInitialProps` hook returns the context object with the addition of `renderPage`.\n * `renderPage` callback executes `React` rendering logic synchronously to support server-rendering wrappers\n */\n static getInitialProps(ctx: DocumentContext): Promise {\n return ctx.defaultGetInitialProps(ctx)\n }\n\n render() {\n return (\n \n \n
\n \n \n \n \n )\n }\n}\n\n// Add a special property to the built-in `Document` component so later we can\n// identify if a user customized `Document` is used or not.\nconst InternalFunctionDocument: DocumentType =\n function InternalFunctionDocument() {\n return (\n \n \n \n