@dr.pogodin/react-utils 1.33.2 → 1.33.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -218,4 +218,6 @@ async function launchServer(webpackConfig, options) {
218
218
  };
219
219
  }
220
220
  launchServer.SCRIPT_LOCATIONS = _renderer.SCRIPT_LOCATIONS;
221
+ launchServer.getDefaultCspSettings = _server.getDefaultCspSettings;
222
+ launchServer.errors = _utils.errors;
221
223
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["require","_http","_interopRequireDefault","_https","_lodash","_server","_interopRequireWildcard","_renderer","_utils","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","normalizePort","value","port","toNumber","isFinite","isNumber","launchServer","webpackConfig","options","ops","cloneDeep","process","env","PORT","defaults","httpsRedirect","logger","undefined","newDefaultLogger","defaultLogLevel","defaultLoggerLogLevel","expressServer","serverFactory","httpServer","https","createServer","cert","key","http","on","error","syscall","bind","isString","code","exit","addr","address","info","NODE_ENV","listen","SCRIPT_LOCATIONS"],"sources":["../../../src/server/index.ts"],"sourcesContent":["import 'source-map-support/register';\n\nimport http from 'http';\nimport https from 'https';\n\nimport {\n cloneDeep,\n defaults,\n isFinite,\n isNumber,\n isString,\n toNumber,\n} from 'lodash';\n\n/* Polyfill required by ReactJS. */\nimport 'raf/polyfill';\n\nimport { type Configuration } from 'webpack';\n\nimport serverFactory, { type OptionsT as ServerOptionsT } from './server';\nimport { SCRIPT_LOCATIONS, newDefaultLogger } from './renderer';\n\nexport {\n getDefaultCspSettings,\n} from './server';\n\nexport { errors } from './utils';\n\n/**\n * Normalizes a port into a number, string, or false.\n * TODO: Drop this function?\n * @param value Port name or number.\n * @return Port number (Number), name (String), or false.\n */\nfunction normalizePort(value: number | string) {\n const port = toNumber(value);\n if (isFinite(port)) return port; /* port number */\n if (!isNumber(port)) return value; /* named pipe */\n return false;\n}\n\ntype OptionsT = ServerOptionsT & {\n https?: {\n cert: string;\n key: string;\n },\n\n // TODO: Should we limit it to number | string, and throw if it is different value?\n port?: false | number | string;\n};\n\n/**\n * Creates and launches web-server for ReactJS application. Allows zero\n * or detailed configuration, supports server-side rendering,\n * and development tools, including Hot Module Reloading (HMR).\n *\n * NOTE: Many of options defined below are passed down to the server and\n * renderer factories, and their declared default values are set in those\n * factories, rather than here.\n *\n * @param {object} webpackConfig Webpack configuration used to build\n * the frontend bundle. In production mode the server will read out of it\n * `context`, `publicPath`, and a few other parameters, necessary to locate\n * and serve the app bundle. In development mode the server will use entire\n * provided config to build the app bundle in memory, and further watch and\n * update it via HMR.\n * @param {object} [options] Additional parameters.\n * @param {Component} [options.Application] The root ReactJS component of\n * the app to use for the server-side rendering. When not provided\n * the server-side rendering is disabled.\n * @param {function} [options.beforeExpressJsError] Asynchronous callback\n * (`(server) => Promise<boolean>`) to be executed just before the default error\n * handler is added to ExpressJS server. If the callback is provided and its\n * result resolves to a truthy value, `react-utils` won't attach the default\n * error handler.\n * @param {function} [options.beforeExpressJsSetup] Asynchronous callback\n * (`(server) => Promise) to be executed right after ExpressJS server creation,\n * before any configuration is performed.\n * @param {BeforeRenderHook} [options.beforeRender] The hook to run just before\n * the server-side rendering. For each incoming request, it will be executed\n * just before the HTML markup is generated at the server. It allows to load\n * and provide the data necessary for server-side rendering, and also to inject\n * additional configuration and scripts into the generated HTML code.\n * @param {boolean} [options.noCsp] Set `true` to disable\n * Content-Security-Policy (CSP) headers altogether.\n * @param {function} [options.cspSettingsHook] A hook allowing\n * to customize [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP)\n * settings for [helmet](https://github.com/helmetjs/helmet)'s\n * `contentSecurityPolicy` middleware on per-request basis.\n *\n * If provided it should be a with signature: \\\n * `(defaultSettings: object, req: object)` &rArr; `object` \\\n * which gets the default settings (also used without the hook),\n * and the incoming request object. The hook response will be passed\n * as options to the helmet `contentSecurityPolicy` middleware.\n *\n * Currently, the default settings is the following object in production\n * environment:\n * ```js\n * {\n * directives: {\n * defaultSrc: [\"'self'\"],\n * baseUri: [\"'self'\"],\n * blockAllMixedContent: [],\n * fontSrc: [\"'self'\", 'https:', 'data:'],\n * frameAncestors: [\"'self'\"],\n * frameSrc: [\"'self'\", 'https://*.youtube.com'],\n * imgSrc: [\"'self'\", 'data:'],\n * objectSrc: [\"'none'\"],\n * scriptSrc: [\"'self'\", \"'unsafe-eval'\", `'nonce-UNIQUE_NONCE_VALUE'`],\n * scriptSrcAttr: [\"'none'\"],\n * styleSrc: [\"'self'\", 'https:', \"'unsafe-inline'\"],\n * upgradeInsecureRequests: [] // Removed in dev mode.\n * }\n * }\n * ```\n * It matches the default value used by Helmet with a few updates:\n * - YouTube host is whitelisted in the `frameSrc` directive to ensure\n * the {@link YouTubeVideo} component works.\n * - An unique per-request nonce is added to `scriptSrc` directive to\n * whitelist auxiliary scripts injected by react-utils. The actual nonce\n * value can be fetched by host code via `.nonce` field of `req` argument\n * of `.beforeRender` hook.\n * - `upgradeInsecureRequests` directive is removed in development mode,\n * to simplify local testing with http requests.\n * @param {string} [options.defaultLoggerLogLevel='info'] Log level for\n * the default logger, which is created if no `logger` option provided.\n * @param {boolean} [options.devMode] Pass in `true` to start the server in\n * development mode.\n * @param {string} [options.favicon] Path to the favicon to use by the server.\n * By default no favicon is used.\n * @param {object} [options.https] If provided, HTTPS server will be started,\n * instead of HTTP otherwise. The object should provide SSL certificate and key\n * via two string fields: `cert`, and `key`.\n * @param {string} [options.https.cert] SSL Certificate.\n * @param {string} [options.https.key] SSL key.\n * @param {boolean} [options.httpsRedirect=true] Pass in `true` to enable\n * automatic redirection of all incoming HTTP requests to HTTPS.\n *\n * To smoothly use it at `localhost` you need to run the server in HTTPS mode,\n * and also properly create and install a self-signed SSL sertificate on your\n * system. This article is helpful:\n * [How to get HTTPS working on your local development environment in 5 minutes](https://medium.freecodecamp.org/how-to-get-https-working-on-your-local-development-environment-in-5-minutes-7af615770eec)\n * @param {Logger} [options.logger] The logger to use at server side.\n * By default [`winston`](https://www.npmjs.com/package/winston) logger\n * with console transport is used. The logger you provide, or the default\n * `winston` logger otherwise, will be attached to the created ExpressJS server\n * object.\n * @param {function} [options.onExpressJsSetup] An async callback\n * (`(server) => Promise`) to be triggered when most of the server\n * configuration is completed, just before the server-side renderer,\n * and the default error handler are attached. You can use it to mount\n * custom API routes. The server-side logger can be accessed as `server.logger`.\n * @param {number|string} [options.port=3000] The port to start the server on.\n * @param {number} [options.staticCacheSize=1.e7] The maximum\n * static cache size in bytes. Defaults to ~10 MB.\n * @param {function} [options.staticCacheController] When given, it activates,\n * and controls the static caching of generated HTML markup. When this function\n * is provided, on each incoming request it is triggered with the request\n * passed in as the argument. To attempt to serve the response from the cache\n * it should return the object with the following fields:\n * - `key: string` &ndash; the cache key for the response;\n * - `maxage?: number` &ndash; the maximum age of cached result in ms.\n * If undefined - infinite age is assumed.\n * @param {number} [options.maxSsrRounds=10] Maximum number of SSR rounds.\n * @param {number} [options.ssrTimeout=1000] SSR timeout in milliseconds,\n * defaults to 1 second.\n * @return {Promise<{ expressServer: object, httpServer: object }>} Resolves to\n * an object with created Express and HTTP servers.\n */\nexport default async function launchServer(webpackConfig: Configuration, options: OptionsT) {\n /* Options normalization. */\n const ops = options ? cloneDeep(options) : {};\n ops.port = normalizePort(ops.port || process.env.PORT || 3000);\n defaults(ops, { httpsRedirect: true });\n\n // TODO: Need a separate type for normalized options, which guarantees\n // the logger is set!\n if (ops.logger === undefined) {\n ops.logger = newDefaultLogger({\n defaultLogLevel: ops.defaultLoggerLogLevel,\n });\n }\n\n /* Creates servers, resolves and sets the port. */\n const expressServer = await serverFactory(webpackConfig, ops);\n\n let httpServer: http.Server;\n if (ops.https) {\n httpServer = https.createServer({\n cert: ops.https.cert,\n key: ops.https.key,\n }, expressServer);\n } else httpServer = http.createServer(expressServer);\n\n /* Sets error handler for HTTP(S) server. */\n httpServer.on('error', (error: Error) => {\n if ((error as any).syscall !== 'listen') throw error;\n const bind = isString(ops.port) ? `Pipe ${ops.port}` : `Port ${ops.port}`;\n\n /* Human-readable message for some specific listen errors. */\n switch ((error as any).code) {\n case 'EACCES':\n ops.logger!.error(`${bind} requires elevated privileges`);\n return process.exit(1);\n case 'EADDRINUSE':\n ops.logger!.error(`${bind} is already in use`);\n return process.exit(1);\n default:\n throw error;\n }\n });\n\n /* Listening event handler for HTTP(S) server. */\n httpServer.on('listening', () => {\n const addr = httpServer.address()!;\n const bind = isString(addr) ? `pipe ${addr}` : `port ${addr.port}`;\n ops.logger!.info(`Server listening on ${bind} in ${\n process.env.NODE_ENV} mode`);\n });\n\n httpServer.listen(ops.port);\n\n return {\n expressServer,\n httpServer,\n };\n}\n\nlaunchServer.SCRIPT_LOCATIONS = SCRIPT_LOCATIONS;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAAA,OAAA;AAEA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AAUAA,OAAA;AAEAA,OAAA;AAEA,IAAAK,OAAA,GAAAC,uBAAA,CAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAMA,IAAAQ,MAAA,GAAAR,OAAA;AAAiC,SAAAS,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAZjC;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA,SAASW,aAAaA,CAACC,KAAsB,EAAE;EAC7C,MAAMC,IAAI,GAAG,IAAAC,gBAAQ,EAACF,KAAK,CAAC;EAC5B,IAAI,IAAAG,gBAAQ,EAACF,IAAI,CAAC,EAAE,OAAOA,IAAI,CAAC,CAAC;EACjC,IAAI,CAAC,IAAAG,gBAAQ,EAACH,IAAI,CAAC,EAAE,OAAOD,KAAK,CAAC,CAAC;EACnC,OAAO,KAAK;AACd;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,eAAeK,YAAYA,CAACC,aAA4B,EAAEC,OAAiB,EAAE;EAC1F;EACA,MAAMC,GAAG,GAAGD,OAAO,GAAG,IAAAE,iBAAS,EAACF,OAAO,CAAC,GAAG,CAAC,CAAC;EAC7CC,GAAG,CAACP,IAAI,GAAGF,aAAa,CAACS,GAAG,CAACP,IAAI,IAAIS,OAAO,CAACC,GAAG,CAACC,IAAI,IAAI,IAAI,CAAC;EAC9D,IAAAC,gBAAQ,EAACL,GAAG,EAAE;IAAEM,aAAa,EAAE;EAAK,CAAC,CAAC;;EAEtC;EACA;EACA,IAAIN,GAAG,CAACO,MAAM,KAAKC,SAAS,EAAE;IAC5BR,GAAG,CAACO,MAAM,GAAG,IAAAE,0BAAgB,EAAC;MAC5BC,eAAe,EAAEV,GAAG,CAACW;IACvB,CAAC,CAAC;EACJ;;EAEA;EACA,MAAMC,aAAa,GAAG,MAAM,IAAAC,eAAa,EAACf,aAAa,EAAEE,GAAG,CAAC;EAE7D,IAAIc,UAAuB;EAC3B,IAAId,GAAG,CAACe,KAAK,EAAE;IACbD,UAAU,GAAGC,cAAK,CAACC,YAAY,CAAC;MAC9BC,IAAI,EAAEjB,GAAG,CAACe,KAAK,CAACE,IAAI;MACpBC,GAAG,EAAElB,GAAG,CAACe,KAAK,CAACG;IACjB,CAAC,EAAEN,aAAa,CAAC;EACnB,CAAC,MAAME,UAAU,GAAGK,aAAI,CAACH,YAAY,CAACJ,aAAa,CAAC;;EAEpD;EACAE,UAAU,CAACM,EAAE,CAAC,OAAO,EAAGC,KAAY,IAAK;IACvC,IAAKA,KAAK,CAASC,OAAO,KAAK,QAAQ,EAAE,MAAMD,KAAK;IACpD,MAAME,IAAI,GAAG,IAAAC,gBAAQ,EAACxB,GAAG,CAACP,IAAI,CAAC,GAAI,QAAOO,GAAG,CAACP,IAAK,EAAC,GAAI,QAAOO,GAAG,CAACP,IAAK,EAAC;;IAEzE;IACA,QAAS4B,KAAK,CAASI,IAAI;MACzB,KAAK,QAAQ;QACXzB,GAAG,CAACO,MAAM,CAAEc,KAAK,CAAE,GAAEE,IAAK,+BAA8B,CAAC;QACzD,OAAOrB,OAAO,CAACwB,IAAI,CAAC,CAAC,CAAC;MACxB,KAAK,YAAY;QACf1B,GAAG,CAACO,MAAM,CAAEc,KAAK,CAAE,GAAEE,IAAK,oBAAmB,CAAC;QAC9C,OAAOrB,OAAO,CAACwB,IAAI,CAAC,CAAC,CAAC;MACxB;QACE,MAAML,KAAK;IACf;EACF,CAAC,CAAC;;EAEF;EACAP,UAAU,CAACM,EAAE,CAAC,WAAW,EAAE,MAAM;IAC/B,MAAMO,IAAI,GAAGb,UAAU,CAACc,OAAO,CAAC,CAAE;IAClC,MAAML,IAAI,GAAG,IAAAC,gBAAQ,EAACG,IAAI,CAAC,GAAI,QAAOA,IAAK,EAAC,GAAI,QAAOA,IAAI,CAAClC,IAAK,EAAC;IAClEO,GAAG,CAACO,MAAM,CAAEsB,IAAI,CAAE,uBAAsBN,IAAK,OAC3CrB,OAAO,CAACC,GAAG,CAAC2B,QAAS,OAAM,CAAC;EAChC,CAAC,CAAC;EAEFhB,UAAU,CAACiB,MAAM,CAAC/B,GAAG,CAACP,IAAI,CAAC;EAE3B,OAAO;IACLmB,aAAa;IACbE;EACF,CAAC;AACH;AAEAjB,YAAY,CAACmC,gBAAgB,GAAGA,0BAAgB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["require","_http","_interopRequireDefault","_https","_lodash","_server","_interopRequireWildcard","_renderer","_utils","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","normalizePort","value","port","toNumber","isFinite","isNumber","launchServer","webpackConfig","options","ops","cloneDeep","process","env","PORT","defaults","httpsRedirect","logger","undefined","newDefaultLogger","defaultLogLevel","defaultLoggerLogLevel","expressServer","serverFactory","httpServer","https","createServer","cert","key","http","on","error","syscall","bind","isString","code","exit","addr","address","info","NODE_ENV","listen","SCRIPT_LOCATIONS","getDefaultCspSettings","errors"],"sources":["../../../src/server/index.ts"],"sourcesContent":["import 'source-map-support/register';\n\nimport http from 'http';\nimport https from 'https';\n\nimport {\n cloneDeep,\n defaults,\n isFinite,\n isNumber,\n isString,\n toNumber,\n} from 'lodash';\n\n/* Polyfill required by ReactJS. */\nimport 'raf/polyfill';\n\nimport { type Configuration } from 'webpack';\n\nimport serverFactory, {\n type OptionsT as ServerOptionsT,\n getDefaultCspSettings,\n} from './server';\n\nimport { SCRIPT_LOCATIONS, newDefaultLogger } from './renderer';\n\nimport { errors } from './utils';\n\nexport { errors, getDefaultCspSettings };\n\n/**\n * Normalizes a port into a number, string, or false.\n * TODO: Drop this function?\n * @param value Port name or number.\n * @return Port number (Number), name (String), or false.\n */\nfunction normalizePort(value: number | string) {\n const port = toNumber(value);\n if (isFinite(port)) return port; /* port number */\n if (!isNumber(port)) return value; /* named pipe */\n return false;\n}\n\ntype OptionsT = ServerOptionsT & {\n https?: {\n cert: string;\n key: string;\n },\n\n // TODO: Should we limit it to number | string, and throw if it is different value?\n port?: false | number | string;\n};\n\n/**\n * Creates and launches web-server for ReactJS application. Allows zero\n * or detailed configuration, supports server-side rendering,\n * and development tools, including Hot Module Reloading (HMR).\n *\n * NOTE: Many of options defined below are passed down to the server and\n * renderer factories, and their declared default values are set in those\n * factories, rather than here.\n *\n * @param {object} webpackConfig Webpack configuration used to build\n * the frontend bundle. In production mode the server will read out of it\n * `context`, `publicPath`, and a few other parameters, necessary to locate\n * and serve the app bundle. In development mode the server will use entire\n * provided config to build the app bundle in memory, and further watch and\n * update it via HMR.\n * @param {object} [options] Additional parameters.\n * @param {Component} [options.Application] The root ReactJS component of\n * the app to use for the server-side rendering. When not provided\n * the server-side rendering is disabled.\n * @param {function} [options.beforeExpressJsError] Asynchronous callback\n * (`(server) => Promise<boolean>`) to be executed just before the default error\n * handler is added to ExpressJS server. If the callback is provided and its\n * result resolves to a truthy value, `react-utils` won't attach the default\n * error handler.\n * @param {function} [options.beforeExpressJsSetup] Asynchronous callback\n * (`(server) => Promise) to be executed right after ExpressJS server creation,\n * before any configuration is performed.\n * @param {BeforeRenderHook} [options.beforeRender] The hook to run just before\n * the server-side rendering. For each incoming request, it will be executed\n * just before the HTML markup is generated at the server. It allows to load\n * and provide the data necessary for server-side rendering, and also to inject\n * additional configuration and scripts into the generated HTML code.\n * @param {boolean} [options.noCsp] Set `true` to disable\n * Content-Security-Policy (CSP) headers altogether.\n * @param {function} [options.cspSettingsHook] A hook allowing\n * to customize [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP)\n * settings for [helmet](https://github.com/helmetjs/helmet)'s\n * `contentSecurityPolicy` middleware on per-request basis.\n *\n * If provided it should be a with signature: \\\n * `(defaultSettings: object, req: object)` &rArr; `object` \\\n * which gets the default settings (also used without the hook),\n * and the incoming request object. The hook response will be passed\n * as options to the helmet `contentSecurityPolicy` middleware.\n *\n * Currently, the default settings is the following object in production\n * environment:\n * ```js\n * {\n * directives: {\n * defaultSrc: [\"'self'\"],\n * baseUri: [\"'self'\"],\n * blockAllMixedContent: [],\n * fontSrc: [\"'self'\", 'https:', 'data:'],\n * frameAncestors: [\"'self'\"],\n * frameSrc: [\"'self'\", 'https://*.youtube.com'],\n * imgSrc: [\"'self'\", 'data:'],\n * objectSrc: [\"'none'\"],\n * scriptSrc: [\"'self'\", \"'unsafe-eval'\", `'nonce-UNIQUE_NONCE_VALUE'`],\n * scriptSrcAttr: [\"'none'\"],\n * styleSrc: [\"'self'\", 'https:', \"'unsafe-inline'\"],\n * upgradeInsecureRequests: [] // Removed in dev mode.\n * }\n * }\n * ```\n * It matches the default value used by Helmet with a few updates:\n * - YouTube host is whitelisted in the `frameSrc` directive to ensure\n * the {@link YouTubeVideo} component works.\n * - An unique per-request nonce is added to `scriptSrc` directive to\n * whitelist auxiliary scripts injected by react-utils. The actual nonce\n * value can be fetched by host code via `.nonce` field of `req` argument\n * of `.beforeRender` hook.\n * - `upgradeInsecureRequests` directive is removed in development mode,\n * to simplify local testing with http requests.\n * @param {string} [options.defaultLoggerLogLevel='info'] Log level for\n * the default logger, which is created if no `logger` option provided.\n * @param {boolean} [options.devMode] Pass in `true` to start the server in\n * development mode.\n * @param {string} [options.favicon] Path to the favicon to use by the server.\n * By default no favicon is used.\n * @param {object} [options.https] If provided, HTTPS server will be started,\n * instead of HTTP otherwise. The object should provide SSL certificate and key\n * via two string fields: `cert`, and `key`.\n * @param {string} [options.https.cert] SSL Certificate.\n * @param {string} [options.https.key] SSL key.\n * @param {boolean} [options.httpsRedirect=true] Pass in `true` to enable\n * automatic redirection of all incoming HTTP requests to HTTPS.\n *\n * To smoothly use it at `localhost` you need to run the server in HTTPS mode,\n * and also properly create and install a self-signed SSL sertificate on your\n * system. This article is helpful:\n * [How to get HTTPS working on your local development environment in 5 minutes](https://medium.freecodecamp.org/how-to-get-https-working-on-your-local-development-environment-in-5-minutes-7af615770eec)\n * @param {Logger} [options.logger] The logger to use at server side.\n * By default [`winston`](https://www.npmjs.com/package/winston) logger\n * with console transport is used. The logger you provide, or the default\n * `winston` logger otherwise, will be attached to the created ExpressJS server\n * object.\n * @param {function} [options.onExpressJsSetup] An async callback\n * (`(server) => Promise`) to be triggered when most of the server\n * configuration is completed, just before the server-side renderer,\n * and the default error handler are attached. You can use it to mount\n * custom API routes. The server-side logger can be accessed as `server.logger`.\n * @param {number|string} [options.port=3000] The port to start the server on.\n * @param {number} [options.staticCacheSize=1.e7] The maximum\n * static cache size in bytes. Defaults to ~10 MB.\n * @param {function} [options.staticCacheController] When given, it activates,\n * and controls the static caching of generated HTML markup. When this function\n * is provided, on each incoming request it is triggered with the request\n * passed in as the argument. To attempt to serve the response from the cache\n * it should return the object with the following fields:\n * - `key: string` &ndash; the cache key for the response;\n * - `maxage?: number` &ndash; the maximum age of cached result in ms.\n * If undefined - infinite age is assumed.\n * @param {number} [options.maxSsrRounds=10] Maximum number of SSR rounds.\n * @param {number} [options.ssrTimeout=1000] SSR timeout in milliseconds,\n * defaults to 1 second.\n * @return {Promise<{ expressServer: object, httpServer: object }>} Resolves to\n * an object with created Express and HTTP servers.\n */\nexport default async function launchServer(webpackConfig: Configuration, options: OptionsT) {\n /* Options normalization. */\n const ops = options ? cloneDeep(options) : {};\n ops.port = normalizePort(ops.port || process.env.PORT || 3000);\n defaults(ops, { httpsRedirect: true });\n\n // TODO: Need a separate type for normalized options, which guarantees\n // the logger is set!\n if (ops.logger === undefined) {\n ops.logger = newDefaultLogger({\n defaultLogLevel: ops.defaultLoggerLogLevel,\n });\n }\n\n /* Creates servers, resolves and sets the port. */\n const expressServer = await serverFactory(webpackConfig, ops);\n\n let httpServer: http.Server;\n if (ops.https) {\n httpServer = https.createServer({\n cert: ops.https.cert,\n key: ops.https.key,\n }, expressServer);\n } else httpServer = http.createServer(expressServer);\n\n /* Sets error handler for HTTP(S) server. */\n httpServer.on('error', (error: Error) => {\n if ((error as any).syscall !== 'listen') throw error;\n const bind = isString(ops.port) ? `Pipe ${ops.port}` : `Port ${ops.port}`;\n\n /* Human-readable message for some specific listen errors. */\n switch ((error as any).code) {\n case 'EACCES':\n ops.logger!.error(`${bind} requires elevated privileges`);\n return process.exit(1);\n case 'EADDRINUSE':\n ops.logger!.error(`${bind} is already in use`);\n return process.exit(1);\n default:\n throw error;\n }\n });\n\n /* Listening event handler for HTTP(S) server. */\n httpServer.on('listening', () => {\n const addr = httpServer.address()!;\n const bind = isString(addr) ? `pipe ${addr}` : `port ${addr.port}`;\n ops.logger!.info(`Server listening on ${bind} in ${\n process.env.NODE_ENV} mode`);\n });\n\n httpServer.listen(ops.port);\n\n return {\n expressServer,\n httpServer,\n };\n}\n\nlaunchServer.SCRIPT_LOCATIONS = SCRIPT_LOCATIONS;\nlaunchServer.getDefaultCspSettings = getDefaultCspSettings;\nlaunchServer.errors = errors;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAAA,OAAA;AAEA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AAUAA,OAAA;AAEAA,OAAA;AAEA,IAAAK,OAAA,GAAAC,uBAAA,CAAAN,OAAA;AAKA,IAAAO,SAAA,GAAAP,OAAA;AAEA,IAAAQ,MAAA,GAAAR,OAAA;AAAiC,SAAAS,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAZjC;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA,SAASW,aAAaA,CAACC,KAAsB,EAAE;EAC7C,MAAMC,IAAI,GAAG,IAAAC,gBAAQ,EAACF,KAAK,CAAC;EAC5B,IAAI,IAAAG,gBAAQ,EAACF,IAAI,CAAC,EAAE,OAAOA,IAAI,CAAC,CAAC;EACjC,IAAI,CAAC,IAAAG,gBAAQ,EAACH,IAAI,CAAC,EAAE,OAAOD,KAAK,CAAC,CAAC;EACnC,OAAO,KAAK;AACd;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,eAAeK,YAAYA,CAACC,aAA4B,EAAEC,OAAiB,EAAE;EAC1F;EACA,MAAMC,GAAG,GAAGD,OAAO,GAAG,IAAAE,iBAAS,EAACF,OAAO,CAAC,GAAG,CAAC,CAAC;EAC7CC,GAAG,CAACP,IAAI,GAAGF,aAAa,CAACS,GAAG,CAACP,IAAI,IAAIS,OAAO,CAACC,GAAG,CAACC,IAAI,IAAI,IAAI,CAAC;EAC9D,IAAAC,gBAAQ,EAACL,GAAG,EAAE;IAAEM,aAAa,EAAE;EAAK,CAAC,CAAC;;EAEtC;EACA;EACA,IAAIN,GAAG,CAACO,MAAM,KAAKC,SAAS,EAAE;IAC5BR,GAAG,CAACO,MAAM,GAAG,IAAAE,0BAAgB,EAAC;MAC5BC,eAAe,EAAEV,GAAG,CAACW;IACvB,CAAC,CAAC;EACJ;;EAEA;EACA,MAAMC,aAAa,GAAG,MAAM,IAAAC,eAAa,EAACf,aAAa,EAAEE,GAAG,CAAC;EAE7D,IAAIc,UAAuB;EAC3B,IAAId,GAAG,CAACe,KAAK,EAAE;IACbD,UAAU,GAAGC,cAAK,CAACC,YAAY,CAAC;MAC9BC,IAAI,EAAEjB,GAAG,CAACe,KAAK,CAACE,IAAI;MACpBC,GAAG,EAAElB,GAAG,CAACe,KAAK,CAACG;IACjB,CAAC,EAAEN,aAAa,CAAC;EACnB,CAAC,MAAME,UAAU,GAAGK,aAAI,CAACH,YAAY,CAACJ,aAAa,CAAC;;EAEpD;EACAE,UAAU,CAACM,EAAE,CAAC,OAAO,EAAGC,KAAY,IAAK;IACvC,IAAKA,KAAK,CAASC,OAAO,KAAK,QAAQ,EAAE,MAAMD,KAAK;IACpD,MAAME,IAAI,GAAG,IAAAC,gBAAQ,EAACxB,GAAG,CAACP,IAAI,CAAC,GAAI,QAAOO,GAAG,CAACP,IAAK,EAAC,GAAI,QAAOO,GAAG,CAACP,IAAK,EAAC;;IAEzE;IACA,QAAS4B,KAAK,CAASI,IAAI;MACzB,KAAK,QAAQ;QACXzB,GAAG,CAACO,MAAM,CAAEc,KAAK,CAAE,GAAEE,IAAK,+BAA8B,CAAC;QACzD,OAAOrB,OAAO,CAACwB,IAAI,CAAC,CAAC,CAAC;MACxB,KAAK,YAAY;QACf1B,GAAG,CAACO,MAAM,CAAEc,KAAK,CAAE,GAAEE,IAAK,oBAAmB,CAAC;QAC9C,OAAOrB,OAAO,CAACwB,IAAI,CAAC,CAAC,CAAC;MACxB;QACE,MAAML,KAAK;IACf;EACF,CAAC,CAAC;;EAEF;EACAP,UAAU,CAACM,EAAE,CAAC,WAAW,EAAE,MAAM;IAC/B,MAAMO,IAAI,GAAGb,UAAU,CAACc,OAAO,CAAC,CAAE;IAClC,MAAML,IAAI,GAAG,IAAAC,gBAAQ,EAACG,IAAI,CAAC,GAAI,QAAOA,IAAK,EAAC,GAAI,QAAOA,IAAI,CAAClC,IAAK,EAAC;IAClEO,GAAG,CAACO,MAAM,CAAEsB,IAAI,CAAE,uBAAsBN,IAAK,OAC3CrB,OAAO,CAACC,GAAG,CAAC2B,QAAS,OAAM,CAAC;EAChC,CAAC,CAAC;EAEFhB,UAAU,CAACiB,MAAM,CAAC/B,GAAG,CAACP,IAAI,CAAC;EAE3B,OAAO;IACLmB,aAAa;IACbE;EACF,CAAC;AACH;AAEAjB,YAAY,CAACmC,gBAAgB,GAAGA,0BAAgB;AAChDnC,YAAY,CAACoC,qBAAqB,GAAGA,6BAAqB;AAC1DpC,YAAY,CAACqC,MAAM,GAAGA,aAAM","ignoreList":[]}
@@ -29,8 +29,11 @@ function requireWeak(modulePath, basePath) {
29
29
 
30
30
  if (!def) return named;
31
31
  Object.entries(named).forEach(([key, value]) => {
32
- if (def[key]) throw Error('Conflict between default and named exports');
33
- def[key] = value;
32
+ if (def[key]) {
33
+ if (def[key] !== value) {
34
+ throw Error('Conflict between default and named exports');
35
+ }
36
+ } else def[key] = value;
34
37
  });
35
38
  return def;
36
39
  } catch {
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.js","names":["_isomorphy","require","requireWeak","modulePath","basePath","IS_CLIENT_SIDE","resolve","eval","path","default","def","named","Object","entries","forEach","key","value","Error","resolveWeak"],"sources":["../../../../src/shared/utils/webpack.ts"],"sourcesContent":["import { IS_CLIENT_SIDE } from './isomorphy';\n\n/**\n * Requires the specified module without including it into the bundle during\n * Webpack build.\n * @param modulePath\n * @param [basePath]\n * @return Required module.\n */\nexport function requireWeak(\n modulePath: string,\n basePath?: string,\n): NodeJS.Module | null {\n if (IS_CLIENT_SIDE) return null;\n\n try {\n /* eslint-disable no-eval */\n const { resolve } = eval('require')('path');\n const path = basePath ? resolve(basePath, modulePath) : modulePath;\n const { default: def, ...named } = eval('require')(path);\n /* eslint-enable no-eval */\n\n if (!def) return named;\n\n Object.entries(named).forEach(([key, value]) => {\n if (def[key]) throw Error('Conflict between default and named exports');\n def[key] = value;\n });\n return def;\n } catch {\n return null;\n }\n}\n\n/**\n * Resolves specified module path with help of Babel's module resolver.\n * Yes, the function itself just returns its argument to the caller, but Babel\n * is configured to resolve the first argument of resolveWeak(..) function, thus\n * the result will be the resolved path.\n * @param {string} modulePath\n * @return {string} Absolute or relative path to the module.\n */\nexport function resolveWeak(modulePath: string): string {\n return modulePath;\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CACzBC,UAAkB,EAClBC,QAAiB,EACK;EACtB,IAAIC,yBAAc,EAAE,OAAO,IAAI;EAE/B,IAAI;IACF;IACA,MAAM;MAAEC;IAAQ,CAAC,GAAGC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;IAC3C,MAAMC,IAAI,GAAGJ,QAAQ,GAAGE,OAAO,CAACF,QAAQ,EAAED,UAAU,CAAC,GAAGA,UAAU;IAClE,MAAM;MAAEM,OAAO,EAAEC,GAAG;MAAE,GAAGC;IAAM,CAAC,GAAGJ,IAAI,CAAC,SAAS,CAAC,CAACC,IAAI,CAAC;IACxD;;IAEA,IAAI,CAACE,GAAG,EAAE,OAAOC,KAAK;IAEtBC,MAAM,CAACC,OAAO,CAACF,KAAK,CAAC,CAACG,OAAO,CAAC,CAAC,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK;MAC9C,IAAIN,GAAG,CAACK,GAAG,CAAC,EAAE,MAAME,KAAK,CAAC,4CAA4C,CAAC;MACvEP,GAAG,CAACK,GAAG,CAAC,GAAGC,KAAK;IAClB,CAAC,CAAC;IACF,OAAON,GAAG;EACZ,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASQ,WAAWA,CAACf,UAAkB,EAAU;EACtD,OAAOA,UAAU;AACnB","ignoreList":[]}
1
+ {"version":3,"file":"webpack.js","names":["_isomorphy","require","requireWeak","modulePath","basePath","IS_CLIENT_SIDE","resolve","eval","path","default","def","named","Object","entries","forEach","key","value","Error","resolveWeak"],"sources":["../../../../src/shared/utils/webpack.ts"],"sourcesContent":["import { IS_CLIENT_SIDE } from './isomorphy';\n\n/**\n * Requires the specified module without including it into the bundle during\n * Webpack build.\n * @param modulePath\n * @param [basePath]\n * @return Required module.\n */\nexport function requireWeak(\n modulePath: string,\n basePath?: string,\n): NodeJS.Module | null {\n if (IS_CLIENT_SIDE) return null;\n\n try {\n /* eslint-disable no-eval */\n const { resolve } = eval('require')('path');\n const path = basePath ? resolve(basePath, modulePath) : modulePath;\n const { default: def, ...named } = eval('require')(path);\n /* eslint-enable no-eval */\n\n if (!def) return named;\n\n Object.entries(named).forEach(([key, value]) => {\n if (def[key]) {\n if (def[key] !== value) {\n throw Error('Conflict between default and named exports');\n }\n } else def[key] = value;\n });\n return def;\n } catch {\n return null;\n }\n}\n\n/**\n * Resolves specified module path with help of Babel's module resolver.\n * Yes, the function itself just returns its argument to the caller, but Babel\n * is configured to resolve the first argument of resolveWeak(..) function, thus\n * the result will be the resolved path.\n * @param {string} modulePath\n * @return {string} Absolute or relative path to the module.\n */\nexport function resolveWeak(modulePath: string): string {\n return modulePath;\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CACzBC,UAAkB,EAClBC,QAAiB,EACK;EACtB,IAAIC,yBAAc,EAAE,OAAO,IAAI;EAE/B,IAAI;IACF;IACA,MAAM;MAAEC;IAAQ,CAAC,GAAGC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;IAC3C,MAAMC,IAAI,GAAGJ,QAAQ,GAAGE,OAAO,CAACF,QAAQ,EAAED,UAAU,CAAC,GAAGA,UAAU;IAClE,MAAM;MAAEM,OAAO,EAAEC,GAAG;MAAE,GAAGC;IAAM,CAAC,GAAGJ,IAAI,CAAC,SAAS,CAAC,CAACC,IAAI,CAAC;IACxD;;IAEA,IAAI,CAACE,GAAG,EAAE,OAAOC,KAAK;IAEtBC,MAAM,CAACC,OAAO,CAACF,KAAK,CAAC,CAACG,OAAO,CAAC,CAAC,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK;MAC9C,IAAIN,GAAG,CAACK,GAAG,CAAC,EAAE;QACZ,IAAIL,GAAG,CAACK,GAAG,CAAC,KAAKC,KAAK,EAAE;UACtB,MAAMC,KAAK,CAAC,4CAA4C,CAAC;QAC3D;MACF,CAAC,MAAMP,GAAG,CAACK,GAAG,CAAC,GAAGC,KAAK;IACzB,CAAC,CAAC;IACF,OAAON,GAAG;EACZ,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASQ,WAAWA,CAACf,UAAkB,EAAU;EACtD,OAAOA,UAAU;AACnB","ignoreList":[]}
@@ -346,7 +346,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
346
346
  \*************************************/
347
347
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
348
348
 
349
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ requireWeak: function() { return /* binding */ requireWeak; },\n/* harmony export */ resolveWeak: function() { return /* binding */ resolveWeak; }\n/* harmony export */ });\n/* harmony import */ var _isomorphy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isomorphy */ \"./src/shared/utils/isomorphy/index.ts\");\n\n\n/**\n * Requires the specified module without including it into the bundle during\n * Webpack build.\n * @param modulePath\n * @param [basePath]\n * @return Required module.\n */\nfunction requireWeak(modulePath, basePath) {\n if (_isomorphy__WEBPACK_IMPORTED_MODULE_0__.IS_CLIENT_SIDE) return null;\n try {\n /* eslint-disable no-eval */\n const {\n resolve\n } = eval('require')('path');\n const path = basePath ? resolve(basePath, modulePath) : modulePath;\n const {\n default: def,\n ...named\n } = eval('require')(path);\n /* eslint-enable no-eval */\n\n if (!def) return named;\n Object.entries(named).forEach(_ref => {\n let [key, value] = _ref;\n if (def[key]) throw Error('Conflict between default and named exports');\n def[key] = value;\n });\n return def;\n } catch {\n return null;\n }\n}\n\n/**\n * Resolves specified module path with help of Babel's module resolver.\n * Yes, the function itself just returns its argument to the caller, but Babel\n * is configured to resolve the first argument of resolveWeak(..) function, thus\n * the result will be the resolved path.\n * @param {string} modulePath\n * @return {string} Absolute or relative path to the module.\n */\nfunction resolveWeak(modulePath) {\n return modulePath;\n}\n\n//# sourceURL=webpack://@dr.pogodin/react-utils/./src/shared/utils/webpack.ts?");
349
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ requireWeak: function() { return /* binding */ requireWeak; },\n/* harmony export */ resolveWeak: function() { return /* binding */ resolveWeak; }\n/* harmony export */ });\n/* harmony import */ var _isomorphy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isomorphy */ \"./src/shared/utils/isomorphy/index.ts\");\n\n\n/**\n * Requires the specified module without including it into the bundle during\n * Webpack build.\n * @param modulePath\n * @param [basePath]\n * @return Required module.\n */\nfunction requireWeak(modulePath, basePath) {\n if (_isomorphy__WEBPACK_IMPORTED_MODULE_0__.IS_CLIENT_SIDE) return null;\n try {\n /* eslint-disable no-eval */\n const {\n resolve\n } = eval('require')('path');\n const path = basePath ? resolve(basePath, modulePath) : modulePath;\n const {\n default: def,\n ...named\n } = eval('require')(path);\n /* eslint-enable no-eval */\n\n if (!def) return named;\n Object.entries(named).forEach(_ref => {\n let [key, value] = _ref;\n if (def[key]) {\n if (def[key] !== value) {\n throw Error('Conflict between default and named exports');\n }\n } else def[key] = value;\n });\n return def;\n } catch {\n return null;\n }\n}\n\n/**\n * Resolves specified module path with help of Babel's module resolver.\n * Yes, the function itself just returns its argument to the caller, but Babel\n * is configured to resolve the first argument of resolveWeak(..) function, thus\n * the result will be the resolved path.\n * @param {string} modulePath\n * @return {string} Absolute or relative path to the module.\n */\nfunction resolveWeak(modulePath) {\n return modulePath;\n}\n\n//# sourceURL=webpack://@dr.pogodin/react-utils/./src/shared/utils/webpack.ts?");
350
350
 
351
351
  /***/ }),
352
352
 
@@ -123,5 +123,5 @@
123
123
  * an object with created Express and HTTP servers.
124
124
  */async function launchServer(webpackConfig,options){/* Options normalization. */const ops=options?(0,_lodash.cloneDeep)(options):{};ops.port=normalizePort(ops.port||process.env.PORT||3000);(0,_lodash.defaults)(ops,{httpsRedirect:true});// TODO: Need a separate type for normalized options, which guarantees
125
125
  // the logger is set!
126
- if(ops.logger===undefined){ops.logger=(0,_renderer.newDefaultLogger)({defaultLogLevel:ops.defaultLoggerLogLevel})}/* Creates servers, resolves and sets the port. */const expressServer=await(0,_server.default)(webpackConfig,ops);let httpServer;if(ops.https){httpServer=_https.default.createServer({cert:ops.https.cert,key:ops.https.key},expressServer)}else httpServer=_http.default.createServer(expressServer);/* Sets error handler for HTTP(S) server. */httpServer.on("error",error=>{if(error.syscall!=="listen")throw error;const bind=(0,_lodash.isString)(ops.port)?`Pipe ${ops.port}`:`Port ${ops.port}`;/* Human-readable message for some specific listen errors. */switch(error.code){case"EACCES":ops.logger.error(`${bind} requires elevated privileges`);return process.exit(1);case"EADDRINUSE":ops.logger.error(`${bind} is already in use`);return process.exit(1);default:throw error}});/* Listening event handler for HTTP(S) server. */httpServer.on("listening",()=>{const addr=httpServer.address();const bind=(0,_lodash.isString)(addr)?`pipe ${addr}`:`port ${addr.port}`;ops.logger.info(`Server listening on ${bind} in ${process.env.NODE_ENV} mode`)});httpServer.listen(ops.port);return{expressServer,httpServer}}launchServer.SCRIPT_LOCATIONS=_renderer.SCRIPT_LOCATIONS;
126
+ if(ops.logger===undefined){ops.logger=(0,_renderer.newDefaultLogger)({defaultLogLevel:ops.defaultLoggerLogLevel})}/* Creates servers, resolves and sets the port. */const expressServer=await(0,_server.default)(webpackConfig,ops);let httpServer;if(ops.https){httpServer=_https.default.createServer({cert:ops.https.cert,key:ops.https.key},expressServer)}else httpServer=_http.default.createServer(expressServer);/* Sets error handler for HTTP(S) server. */httpServer.on("error",error=>{if(error.syscall!=="listen")throw error;const bind=(0,_lodash.isString)(ops.port)?`Pipe ${ops.port}`:`Port ${ops.port}`;/* Human-readable message for some specific listen errors. */switch(error.code){case"EACCES":ops.logger.error(`${bind} requires elevated privileges`);return process.exit(1);case"EADDRINUSE":ops.logger.error(`${bind} is already in use`);return process.exit(1);default:throw error}});/* Listening event handler for HTTP(S) server. */httpServer.on("listening",()=>{const addr=httpServer.address();const bind=(0,_lodash.isString)(addr)?`pipe ${addr}`:`port ${addr.port}`;ops.logger.info(`Server listening on ${bind} in ${process.env.NODE_ENV} mode`)});httpServer.listen(ops.port);return{expressServer,httpServer}}launchServer.SCRIPT_LOCATIONS=_renderer.SCRIPT_LOCATIONS;launchServer.getDefaultCspSettings=_server.getDefaultCspSettings;launchServer.errors=_utils.errors;
127
127
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["require","_http","_interopRequireDefault","_https","_lodash","_server","_interopRequireWildcard","_renderer","_utils","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","normalizePort","value","port","toNumber","isFinite","isNumber","launchServer","webpackConfig","options","ops","cloneDeep","process","env","PORT","defaults","httpsRedirect","logger","undefined","newDefaultLogger","defaultLogLevel","defaultLoggerLogLevel","expressServer","serverFactory","httpServer","https","createServer","cert","key","http","on","error","syscall","bind","isString","code","exit","addr","address","info","NODE_ENV","listen","SCRIPT_LOCATIONS"],"sources":["../../../src/server/index.ts"],"sourcesContent":["import 'source-map-support/register';\n\nimport http from 'http';\nimport https from 'https';\n\nimport {\n cloneDeep,\n defaults,\n isFinite,\n isNumber,\n isString,\n toNumber,\n} from 'lodash';\n\n/* Polyfill required by ReactJS. */\nimport 'raf/polyfill';\n\nimport { type Configuration } from 'webpack';\n\nimport serverFactory, { type OptionsT as ServerOptionsT } from './server';\nimport { SCRIPT_LOCATIONS, newDefaultLogger } from './renderer';\n\nexport {\n getDefaultCspSettings,\n} from './server';\n\nexport { errors } from './utils';\n\n/**\n * Normalizes a port into a number, string, or false.\n * TODO: Drop this function?\n * @param value Port name or number.\n * @return Port number (Number), name (String), or false.\n */\nfunction normalizePort(value: number | string) {\n const port = toNumber(value);\n if (isFinite(port)) return port; /* port number */\n if (!isNumber(port)) return value; /* named pipe */\n return false;\n}\n\ntype OptionsT = ServerOptionsT & {\n https?: {\n cert: string;\n key: string;\n },\n\n // TODO: Should we limit it to number | string, and throw if it is different value?\n port?: false | number | string;\n};\n\n/**\n * Creates and launches web-server for ReactJS application. Allows zero\n * or detailed configuration, supports server-side rendering,\n * and development tools, including Hot Module Reloading (HMR).\n *\n * NOTE: Many of options defined below are passed down to the server and\n * renderer factories, and their declared default values are set in those\n * factories, rather than here.\n *\n * @param {object} webpackConfig Webpack configuration used to build\n * the frontend bundle. In production mode the server will read out of it\n * `context`, `publicPath`, and a few other parameters, necessary to locate\n * and serve the app bundle. In development mode the server will use entire\n * provided config to build the app bundle in memory, and further watch and\n * update it via HMR.\n * @param {object} [options] Additional parameters.\n * @param {Component} [options.Application] The root ReactJS component of\n * the app to use for the server-side rendering. When not provided\n * the server-side rendering is disabled.\n * @param {function} [options.beforeExpressJsError] Asynchronous callback\n * (`(server) => Promise<boolean>`) to be executed just before the default error\n * handler is added to ExpressJS server. If the callback is provided and its\n * result resolves to a truthy value, `react-utils` won't attach the default\n * error handler.\n * @param {function} [options.beforeExpressJsSetup] Asynchronous callback\n * (`(server) => Promise) to be executed right after ExpressJS server creation,\n * before any configuration is performed.\n * @param {BeforeRenderHook} [options.beforeRender] The hook to run just before\n * the server-side rendering. For each incoming request, it will be executed\n * just before the HTML markup is generated at the server. It allows to load\n * and provide the data necessary for server-side rendering, and also to inject\n * additional configuration and scripts into the generated HTML code.\n * @param {boolean} [options.noCsp] Set `true` to disable\n * Content-Security-Policy (CSP) headers altogether.\n * @param {function} [options.cspSettingsHook] A hook allowing\n * to customize [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP)\n * settings for [helmet](https://github.com/helmetjs/helmet)'s\n * `contentSecurityPolicy` middleware on per-request basis.\n *\n * If provided it should be a with signature: \\\n * `(defaultSettings: object, req: object)` &rArr; `object` \\\n * which gets the default settings (also used without the hook),\n * and the incoming request object. The hook response will be passed\n * as options to the helmet `contentSecurityPolicy` middleware.\n *\n * Currently, the default settings is the following object in production\n * environment:\n * ```js\n * {\n * directives: {\n * defaultSrc: [\"'self'\"],\n * baseUri: [\"'self'\"],\n * blockAllMixedContent: [],\n * fontSrc: [\"'self'\", 'https:', 'data:'],\n * frameAncestors: [\"'self'\"],\n * frameSrc: [\"'self'\", 'https://*.youtube.com'],\n * imgSrc: [\"'self'\", 'data:'],\n * objectSrc: [\"'none'\"],\n * scriptSrc: [\"'self'\", \"'unsafe-eval'\", `'nonce-UNIQUE_NONCE_VALUE'`],\n * scriptSrcAttr: [\"'none'\"],\n * styleSrc: [\"'self'\", 'https:', \"'unsafe-inline'\"],\n * upgradeInsecureRequests: [] // Removed in dev mode.\n * }\n * }\n * ```\n * It matches the default value used by Helmet with a few updates:\n * - YouTube host is whitelisted in the `frameSrc` directive to ensure\n * the {@link YouTubeVideo} component works.\n * - An unique per-request nonce is added to `scriptSrc` directive to\n * whitelist auxiliary scripts injected by react-utils. The actual nonce\n * value can be fetched by host code via `.nonce` field of `req` argument\n * of `.beforeRender` hook.\n * - `upgradeInsecureRequests` directive is removed in development mode,\n * to simplify local testing with http requests.\n * @param {string} [options.defaultLoggerLogLevel='info'] Log level for\n * the default logger, which is created if no `logger` option provided.\n * @param {boolean} [options.devMode] Pass in `true` to start the server in\n * development mode.\n * @param {string} [options.favicon] Path to the favicon to use by the server.\n * By default no favicon is used.\n * @param {object} [options.https] If provided, HTTPS server will be started,\n * instead of HTTP otherwise. The object should provide SSL certificate and key\n * via two string fields: `cert`, and `key`.\n * @param {string} [options.https.cert] SSL Certificate.\n * @param {string} [options.https.key] SSL key.\n * @param {boolean} [options.httpsRedirect=true] Pass in `true` to enable\n * automatic redirection of all incoming HTTP requests to HTTPS.\n *\n * To smoothly use it at `localhost` you need to run the server in HTTPS mode,\n * and also properly create and install a self-signed SSL sertificate on your\n * system. This article is helpful:\n * [How to get HTTPS working on your local development environment in 5 minutes](https://medium.freecodecamp.org/how-to-get-https-working-on-your-local-development-environment-in-5-minutes-7af615770eec)\n * @param {Logger} [options.logger] The logger to use at server side.\n * By default [`winston`](https://www.npmjs.com/package/winston) logger\n * with console transport is used. The logger you provide, or the default\n * `winston` logger otherwise, will be attached to the created ExpressJS server\n * object.\n * @param {function} [options.onExpressJsSetup] An async callback\n * (`(server) => Promise`) to be triggered when most of the server\n * configuration is completed, just before the server-side renderer,\n * and the default error handler are attached. You can use it to mount\n * custom API routes. The server-side logger can be accessed as `server.logger`.\n * @param {number|string} [options.port=3000] The port to start the server on.\n * @param {number} [options.staticCacheSize=1.e7] The maximum\n * static cache size in bytes. Defaults to ~10 MB.\n * @param {function} [options.staticCacheController] When given, it activates,\n * and controls the static caching of generated HTML markup. When this function\n * is provided, on each incoming request it is triggered with the request\n * passed in as the argument. To attempt to serve the response from the cache\n * it should return the object with the following fields:\n * - `key: string` &ndash; the cache key for the response;\n * - `maxage?: number` &ndash; the maximum age of cached result in ms.\n * If undefined - infinite age is assumed.\n * @param {number} [options.maxSsrRounds=10] Maximum number of SSR rounds.\n * @param {number} [options.ssrTimeout=1000] SSR timeout in milliseconds,\n * defaults to 1 second.\n * @return {Promise<{ expressServer: object, httpServer: object }>} Resolves to\n * an object with created Express and HTTP servers.\n */\nexport default async function launchServer(webpackConfig: Configuration, options: OptionsT) {\n /* Options normalization. */\n const ops = options ? cloneDeep(options) : {};\n ops.port = normalizePort(ops.port || process.env.PORT || 3000);\n defaults(ops, { httpsRedirect: true });\n\n // TODO: Need a separate type for normalized options, which guarantees\n // the logger is set!\n if (ops.logger === undefined) {\n ops.logger = newDefaultLogger({\n defaultLogLevel: ops.defaultLoggerLogLevel,\n });\n }\n\n /* Creates servers, resolves and sets the port. */\n const expressServer = await serverFactory(webpackConfig, ops);\n\n let httpServer: http.Server;\n if (ops.https) {\n httpServer = https.createServer({\n cert: ops.https.cert,\n key: ops.https.key,\n }, expressServer);\n } else httpServer = http.createServer(expressServer);\n\n /* Sets error handler for HTTP(S) server. */\n httpServer.on('error', (error: Error) => {\n if ((error as any).syscall !== 'listen') throw error;\n const bind = isString(ops.port) ? `Pipe ${ops.port}` : `Port ${ops.port}`;\n\n /* Human-readable message for some specific listen errors. */\n switch ((error as any).code) {\n case 'EACCES':\n ops.logger!.error(`${bind} requires elevated privileges`);\n return process.exit(1);\n case 'EADDRINUSE':\n ops.logger!.error(`${bind} is already in use`);\n return process.exit(1);\n default:\n throw error;\n }\n });\n\n /* Listening event handler for HTTP(S) server. */\n httpServer.on('listening', () => {\n const addr = httpServer.address()!;\n const bind = isString(addr) ? `pipe ${addr}` : `port ${addr.port}`;\n ops.logger!.info(`Server listening on ${bind} in ${\n process.env.NODE_ENV} mode`);\n });\n\n httpServer.listen(ops.port);\n\n return {\n expressServer,\n httpServer,\n };\n}\n\nlaunchServer.SCRIPT_LOCATIONS = SCRIPT_LOCATIONS;\n"],"mappings":"mZAAAA,OAAA,gCAEA,IAAAC,KAAA,CAAAC,sBAAA,CAAAF,OAAA,UACA,IAAAG,MAAA,CAAAD,sBAAA,CAAAF,OAAA,WAEA,IAAAI,OAAA,CAAAJ,OAAA,WAUAA,OAAA,iBAEAA,OAAA,YAEA,IAAAK,OAAA,CAAAC,uBAAA,CAAAN,OAAA,cACA,IAAAO,SAAA,CAAAP,OAAA,eAMA,IAAAQ,MAAA,CAAAR,OAAA,YAAiC,SAAAS,yBAAAC,CAAA,wBAAAC,OAAA,iBAAAC,CAAA,KAAAD,OAAA,CAAAE,CAAA,KAAAF,OAAA,QAAAF,wBAAA,SAAAA,CAAAC,CAAA,SAAAA,CAAA,CAAAG,CAAA,CAAAD,CAAA,GAAAF,CAAA,WAAAJ,wBAAAI,CAAA,CAAAE,CAAA,MAAAA,CAAA,EAAAF,CAAA,EAAAA,CAAA,CAAAI,UAAA,QAAAJ,CAAA,WAAAA,CAAA,mBAAAA,CAAA,qBAAAA,CAAA,QAAAK,OAAA,CAAAL,CAAA,MAAAG,CAAA,CAAAJ,wBAAA,CAAAG,CAAA,KAAAC,CAAA,EAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,SAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,MAAAQ,CAAA,EAAAC,SAAA,OAAAC,CAAA,CAAAC,MAAA,CAAAC,cAAA,EAAAD,MAAA,CAAAE,wBAAA,SAAAC,CAAA,IAAAd,CAAA,gBAAAc,CAAA,KAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,CAAAc,CAAA,OAAAG,CAAA,CAAAP,CAAA,CAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,CAAAc,CAAA,OAAAG,CAAA,GAAAA,CAAA,CAAAV,GAAA,EAAAU,CAAA,CAAAC,GAAA,EAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,CAAAM,CAAA,CAAAG,CAAA,EAAAT,CAAA,CAAAM,CAAA,EAAAd,CAAA,CAAAc,CAAA,SAAAN,CAAA,CAAAH,OAAA,CAAAL,CAAA,CAAAG,CAAA,EAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,CAAAQ,CAAA,EAAAA,CAAA,CAZjC,oCAcA;AACA;AACA;AACA;AACA;AACA,GACA,QAAS,CAAAW,aAAaA,CAACC,KAAsB,CAAE,CAC7C,KAAM,CAAAC,IAAI,CAAG,GAAAC,gBAAQ,EAACF,KAAK,CAAC,CAC5B,GAAI,GAAAG,gBAAQ,EAACF,IAAI,CAAC,CAAE,MAAO,CAAAA,IAAI,CAAE,iBACjC,GAAI,CAAC,GAAAG,gBAAQ,EAACH,IAAI,CAAC,CAAE,MAAO,CAAAD,KAAK,CAAE,gBACnC,MAAO,MACT,CAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,cAAe,CAAAK,YAAYA,CAACC,aAA4B,CAAEC,OAAiB,CAAE,CAC1F,4BACA,KAAM,CAAAC,GAAG,CAAGD,OAAO,CAAG,GAAAE,iBAAS,EAACF,OAAO,CAAC,CAAG,CAAC,CAAC,CAC7CC,GAAG,CAACP,IAAI,CAAGF,aAAa,CAACS,GAAG,CAACP,IAAI,EAAIS,OAAO,CAACC,GAAG,CAACC,IAAI,EAAI,IAAI,CAAC,CAC9D,GAAAC,gBAAQ,EAACL,GAAG,CAAE,CAAEM,aAAa,CAAE,IAAK,CAAC,CAAC,CAEtC;AACA;AACA,GAAIN,GAAG,CAACO,MAAM,GAAKC,SAAS,CAAE,CAC5BR,GAAG,CAACO,MAAM,CAAG,GAAAE,0BAAgB,EAAC,CAC5BC,eAAe,CAAEV,GAAG,CAACW,qBACvB,CAAC,CACH,CAEA,kDACA,KAAM,CAAAC,aAAa,CAAG,KAAM,GAAAC,eAAa,EAACf,aAAa,CAAEE,GAAG,CAAC,CAE7D,GAAI,CAAAc,UAAuB,CAC3B,GAAId,GAAG,CAACe,KAAK,CAAE,CACbD,UAAU,CAAGC,cAAK,CAACC,YAAY,CAAC,CAC9BC,IAAI,CAAEjB,GAAG,CAACe,KAAK,CAACE,IAAI,CACpBC,GAAG,CAAElB,GAAG,CAACe,KAAK,CAACG,GACjB,CAAC,CAAEN,aAAa,CAClB,CAAC,IAAM,CAAAE,UAAU,CAAGK,aAAI,CAACH,YAAY,CAACJ,aAAa,CAAC,CAEpD,4CACAE,UAAU,CAACM,EAAE,CAAC,OAAO,CAAGC,KAAY,EAAK,CACvC,GAAKA,KAAK,CAASC,OAAO,GAAK,QAAQ,CAAE,KAAM,CAAAD,KAAK,CACpD,KAAM,CAAAE,IAAI,CAAG,GAAAC,gBAAQ,EAACxB,GAAG,CAACP,IAAI,CAAC,CAAI,QAAOO,GAAG,CAACP,IAAK,EAAC,CAAI,QAAOO,GAAG,CAACP,IAAK,EAAC,CAEzE,6DACA,OAAS4B,KAAK,CAASI,IAAI,EACzB,IAAK,QAAQ,CACXzB,GAAG,CAACO,MAAM,CAAEc,KAAK,CAAE,GAAEE,IAAK,+BAA8B,CAAC,CACzD,MAAO,CAAArB,OAAO,CAACwB,IAAI,CAAC,CAAC,CAAC,CACxB,IAAK,YAAY,CACf1B,GAAG,CAACO,MAAM,CAAEc,KAAK,CAAE,GAAEE,IAAK,oBAAmB,CAAC,CAC9C,MAAO,CAAArB,OAAO,CAACwB,IAAI,CAAC,CAAC,CAAC,CACxB,QACE,KAAM,CAAAL,KACV,CACF,CAAC,CAAC,CAEF,iDACAP,UAAU,CAACM,EAAE,CAAC,WAAW,CAAE,IAAM,CAC/B,KAAM,CAAAO,IAAI,CAAGb,UAAU,CAACc,OAAO,CAAC,CAAE,CAClC,KAAM,CAAAL,IAAI,CAAG,GAAAC,gBAAQ,EAACG,IAAI,CAAC,CAAI,QAAOA,IAAK,EAAC,CAAI,QAAOA,IAAI,CAAClC,IAAK,EAAC,CAClEO,GAAG,CAACO,MAAM,CAAEsB,IAAI,CAAE,uBAAsBN,IAAK,OAC3CrB,OAAO,CAACC,GAAG,CAAC2B,QAAS,OAAM,CAC/B,CAAC,CAAC,CAEFhB,UAAU,CAACiB,MAAM,CAAC/B,GAAG,CAACP,IAAI,CAAC,CAE3B,MAAO,CACLmB,aAAa,CACbE,UACF,CACF,CAEAjB,YAAY,CAACmC,gBAAgB,CAAGA,0BAAgB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["require","_http","_interopRequireDefault","_https","_lodash","_server","_interopRequireWildcard","_renderer","_utils","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","normalizePort","value","port","toNumber","isFinite","isNumber","launchServer","webpackConfig","options","ops","cloneDeep","process","env","PORT","defaults","httpsRedirect","logger","undefined","newDefaultLogger","defaultLogLevel","defaultLoggerLogLevel","expressServer","serverFactory","httpServer","https","createServer","cert","key","http","on","error","syscall","bind","isString","code","exit","addr","address","info","NODE_ENV","listen","SCRIPT_LOCATIONS","getDefaultCspSettings","errors"],"sources":["../../../src/server/index.ts"],"sourcesContent":["import 'source-map-support/register';\n\nimport http from 'http';\nimport https from 'https';\n\nimport {\n cloneDeep,\n defaults,\n isFinite,\n isNumber,\n isString,\n toNumber,\n} from 'lodash';\n\n/* Polyfill required by ReactJS. */\nimport 'raf/polyfill';\n\nimport { type Configuration } from 'webpack';\n\nimport serverFactory, {\n type OptionsT as ServerOptionsT,\n getDefaultCspSettings,\n} from './server';\n\nimport { SCRIPT_LOCATIONS, newDefaultLogger } from './renderer';\n\nimport { errors } from './utils';\n\nexport { errors, getDefaultCspSettings };\n\n/**\n * Normalizes a port into a number, string, or false.\n * TODO: Drop this function?\n * @param value Port name or number.\n * @return Port number (Number), name (String), or false.\n */\nfunction normalizePort(value: number | string) {\n const port = toNumber(value);\n if (isFinite(port)) return port; /* port number */\n if (!isNumber(port)) return value; /* named pipe */\n return false;\n}\n\ntype OptionsT = ServerOptionsT & {\n https?: {\n cert: string;\n key: string;\n },\n\n // TODO: Should we limit it to number | string, and throw if it is different value?\n port?: false | number | string;\n};\n\n/**\n * Creates and launches web-server for ReactJS application. Allows zero\n * or detailed configuration, supports server-side rendering,\n * and development tools, including Hot Module Reloading (HMR).\n *\n * NOTE: Many of options defined below are passed down to the server and\n * renderer factories, and their declared default values are set in those\n * factories, rather than here.\n *\n * @param {object} webpackConfig Webpack configuration used to build\n * the frontend bundle. In production mode the server will read out of it\n * `context`, `publicPath`, and a few other parameters, necessary to locate\n * and serve the app bundle. In development mode the server will use entire\n * provided config to build the app bundle in memory, and further watch and\n * update it via HMR.\n * @param {object} [options] Additional parameters.\n * @param {Component} [options.Application] The root ReactJS component of\n * the app to use for the server-side rendering. When not provided\n * the server-side rendering is disabled.\n * @param {function} [options.beforeExpressJsError] Asynchronous callback\n * (`(server) => Promise<boolean>`) to be executed just before the default error\n * handler is added to ExpressJS server. If the callback is provided and its\n * result resolves to a truthy value, `react-utils` won't attach the default\n * error handler.\n * @param {function} [options.beforeExpressJsSetup] Asynchronous callback\n * (`(server) => Promise) to be executed right after ExpressJS server creation,\n * before any configuration is performed.\n * @param {BeforeRenderHook} [options.beforeRender] The hook to run just before\n * the server-side rendering. For each incoming request, it will be executed\n * just before the HTML markup is generated at the server. It allows to load\n * and provide the data necessary for server-side rendering, and also to inject\n * additional configuration and scripts into the generated HTML code.\n * @param {boolean} [options.noCsp] Set `true` to disable\n * Content-Security-Policy (CSP) headers altogether.\n * @param {function} [options.cspSettingsHook] A hook allowing\n * to customize [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP)\n * settings for [helmet](https://github.com/helmetjs/helmet)'s\n * `contentSecurityPolicy` middleware on per-request basis.\n *\n * If provided it should be a with signature: \\\n * `(defaultSettings: object, req: object)` &rArr; `object` \\\n * which gets the default settings (also used without the hook),\n * and the incoming request object. The hook response will be passed\n * as options to the helmet `contentSecurityPolicy` middleware.\n *\n * Currently, the default settings is the following object in production\n * environment:\n * ```js\n * {\n * directives: {\n * defaultSrc: [\"'self'\"],\n * baseUri: [\"'self'\"],\n * blockAllMixedContent: [],\n * fontSrc: [\"'self'\", 'https:', 'data:'],\n * frameAncestors: [\"'self'\"],\n * frameSrc: [\"'self'\", 'https://*.youtube.com'],\n * imgSrc: [\"'self'\", 'data:'],\n * objectSrc: [\"'none'\"],\n * scriptSrc: [\"'self'\", \"'unsafe-eval'\", `'nonce-UNIQUE_NONCE_VALUE'`],\n * scriptSrcAttr: [\"'none'\"],\n * styleSrc: [\"'self'\", 'https:', \"'unsafe-inline'\"],\n * upgradeInsecureRequests: [] // Removed in dev mode.\n * }\n * }\n * ```\n * It matches the default value used by Helmet with a few updates:\n * - YouTube host is whitelisted in the `frameSrc` directive to ensure\n * the {@link YouTubeVideo} component works.\n * - An unique per-request nonce is added to `scriptSrc` directive to\n * whitelist auxiliary scripts injected by react-utils. The actual nonce\n * value can be fetched by host code via `.nonce` field of `req` argument\n * of `.beforeRender` hook.\n * - `upgradeInsecureRequests` directive is removed in development mode,\n * to simplify local testing with http requests.\n * @param {string} [options.defaultLoggerLogLevel='info'] Log level for\n * the default logger, which is created if no `logger` option provided.\n * @param {boolean} [options.devMode] Pass in `true` to start the server in\n * development mode.\n * @param {string} [options.favicon] Path to the favicon to use by the server.\n * By default no favicon is used.\n * @param {object} [options.https] If provided, HTTPS server will be started,\n * instead of HTTP otherwise. The object should provide SSL certificate and key\n * via two string fields: `cert`, and `key`.\n * @param {string} [options.https.cert] SSL Certificate.\n * @param {string} [options.https.key] SSL key.\n * @param {boolean} [options.httpsRedirect=true] Pass in `true` to enable\n * automatic redirection of all incoming HTTP requests to HTTPS.\n *\n * To smoothly use it at `localhost` you need to run the server in HTTPS mode,\n * and also properly create and install a self-signed SSL sertificate on your\n * system. This article is helpful:\n * [How to get HTTPS working on your local development environment in 5 minutes](https://medium.freecodecamp.org/how-to-get-https-working-on-your-local-development-environment-in-5-minutes-7af615770eec)\n * @param {Logger} [options.logger] The logger to use at server side.\n * By default [`winston`](https://www.npmjs.com/package/winston) logger\n * with console transport is used. The logger you provide, or the default\n * `winston` logger otherwise, will be attached to the created ExpressJS server\n * object.\n * @param {function} [options.onExpressJsSetup] An async callback\n * (`(server) => Promise`) to be triggered when most of the server\n * configuration is completed, just before the server-side renderer,\n * and the default error handler are attached. You can use it to mount\n * custom API routes. The server-side logger can be accessed as `server.logger`.\n * @param {number|string} [options.port=3000] The port to start the server on.\n * @param {number} [options.staticCacheSize=1.e7] The maximum\n * static cache size in bytes. Defaults to ~10 MB.\n * @param {function} [options.staticCacheController] When given, it activates,\n * and controls the static caching of generated HTML markup. When this function\n * is provided, on each incoming request it is triggered with the request\n * passed in as the argument. To attempt to serve the response from the cache\n * it should return the object with the following fields:\n * - `key: string` &ndash; the cache key for the response;\n * - `maxage?: number` &ndash; the maximum age of cached result in ms.\n * If undefined - infinite age is assumed.\n * @param {number} [options.maxSsrRounds=10] Maximum number of SSR rounds.\n * @param {number} [options.ssrTimeout=1000] SSR timeout in milliseconds,\n * defaults to 1 second.\n * @return {Promise<{ expressServer: object, httpServer: object }>} Resolves to\n * an object with created Express and HTTP servers.\n */\nexport default async function launchServer(webpackConfig: Configuration, options: OptionsT) {\n /* Options normalization. */\n const ops = options ? cloneDeep(options) : {};\n ops.port = normalizePort(ops.port || process.env.PORT || 3000);\n defaults(ops, { httpsRedirect: true });\n\n // TODO: Need a separate type for normalized options, which guarantees\n // the logger is set!\n if (ops.logger === undefined) {\n ops.logger = newDefaultLogger({\n defaultLogLevel: ops.defaultLoggerLogLevel,\n });\n }\n\n /* Creates servers, resolves and sets the port. */\n const expressServer = await serverFactory(webpackConfig, ops);\n\n let httpServer: http.Server;\n if (ops.https) {\n httpServer = https.createServer({\n cert: ops.https.cert,\n key: ops.https.key,\n }, expressServer);\n } else httpServer = http.createServer(expressServer);\n\n /* Sets error handler for HTTP(S) server. */\n httpServer.on('error', (error: Error) => {\n if ((error as any).syscall !== 'listen') throw error;\n const bind = isString(ops.port) ? `Pipe ${ops.port}` : `Port ${ops.port}`;\n\n /* Human-readable message for some specific listen errors. */\n switch ((error as any).code) {\n case 'EACCES':\n ops.logger!.error(`${bind} requires elevated privileges`);\n return process.exit(1);\n case 'EADDRINUSE':\n ops.logger!.error(`${bind} is already in use`);\n return process.exit(1);\n default:\n throw error;\n }\n });\n\n /* Listening event handler for HTTP(S) server. */\n httpServer.on('listening', () => {\n const addr = httpServer.address()!;\n const bind = isString(addr) ? `pipe ${addr}` : `port ${addr.port}`;\n ops.logger!.info(`Server listening on ${bind} in ${\n process.env.NODE_ENV} mode`);\n });\n\n httpServer.listen(ops.port);\n\n return {\n expressServer,\n httpServer,\n };\n}\n\nlaunchServer.SCRIPT_LOCATIONS = SCRIPT_LOCATIONS;\nlaunchServer.getDefaultCspSettings = getDefaultCspSettings;\nlaunchServer.errors = errors;\n"],"mappings":"mZAAAA,OAAA,gCAEA,IAAAC,KAAA,CAAAC,sBAAA,CAAAF,OAAA,UACA,IAAAG,MAAA,CAAAD,sBAAA,CAAAF,OAAA,WAEA,IAAAI,OAAA,CAAAJ,OAAA,WAUAA,OAAA,iBAEAA,OAAA,YAEA,IAAAK,OAAA,CAAAC,uBAAA,CAAAN,OAAA,cAKA,IAAAO,SAAA,CAAAP,OAAA,eAEA,IAAAQ,MAAA,CAAAR,OAAA,YAAiC,SAAAS,yBAAAC,CAAA,wBAAAC,OAAA,iBAAAC,CAAA,KAAAD,OAAA,CAAAE,CAAA,KAAAF,OAAA,QAAAF,wBAAA,SAAAA,CAAAC,CAAA,SAAAA,CAAA,CAAAG,CAAA,CAAAD,CAAA,GAAAF,CAAA,WAAAJ,wBAAAI,CAAA,CAAAE,CAAA,MAAAA,CAAA,EAAAF,CAAA,EAAAA,CAAA,CAAAI,UAAA,QAAAJ,CAAA,WAAAA,CAAA,mBAAAA,CAAA,qBAAAA,CAAA,QAAAK,OAAA,CAAAL,CAAA,MAAAG,CAAA,CAAAJ,wBAAA,CAAAG,CAAA,KAAAC,CAAA,EAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,SAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,MAAAQ,CAAA,EAAAC,SAAA,OAAAC,CAAA,CAAAC,MAAA,CAAAC,cAAA,EAAAD,MAAA,CAAAE,wBAAA,SAAAC,CAAA,IAAAd,CAAA,gBAAAc,CAAA,KAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,CAAAc,CAAA,OAAAG,CAAA,CAAAP,CAAA,CAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,CAAAc,CAAA,OAAAG,CAAA,GAAAA,CAAA,CAAAV,GAAA,EAAAU,CAAA,CAAAC,GAAA,EAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,CAAAM,CAAA,CAAAG,CAAA,EAAAT,CAAA,CAAAM,CAAA,EAAAd,CAAA,CAAAc,CAAA,SAAAN,CAAA,CAAAH,OAAA,CAAAL,CAAA,CAAAG,CAAA,EAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,CAAAQ,CAAA,EAAAA,CAAA,CAZjC,oCAgBA;AACA;AACA;AACA;AACA;AACA,GACA,QAAS,CAAAW,aAAaA,CAACC,KAAsB,CAAE,CAC7C,KAAM,CAAAC,IAAI,CAAG,GAAAC,gBAAQ,EAACF,KAAK,CAAC,CAC5B,GAAI,GAAAG,gBAAQ,EAACF,IAAI,CAAC,CAAE,MAAO,CAAAA,IAAI,CAAE,iBACjC,GAAI,CAAC,GAAAG,gBAAQ,EAACH,IAAI,CAAC,CAAE,MAAO,CAAAD,KAAK,CAAE,gBACnC,MAAO,MACT,CAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,cAAe,CAAAK,YAAYA,CAACC,aAA4B,CAAEC,OAAiB,CAAE,CAC1F,4BACA,KAAM,CAAAC,GAAG,CAAGD,OAAO,CAAG,GAAAE,iBAAS,EAACF,OAAO,CAAC,CAAG,CAAC,CAAC,CAC7CC,GAAG,CAACP,IAAI,CAAGF,aAAa,CAACS,GAAG,CAACP,IAAI,EAAIS,OAAO,CAACC,GAAG,CAACC,IAAI,EAAI,IAAI,CAAC,CAC9D,GAAAC,gBAAQ,EAACL,GAAG,CAAE,CAAEM,aAAa,CAAE,IAAK,CAAC,CAAC,CAEtC;AACA;AACA,GAAIN,GAAG,CAACO,MAAM,GAAKC,SAAS,CAAE,CAC5BR,GAAG,CAACO,MAAM,CAAG,GAAAE,0BAAgB,EAAC,CAC5BC,eAAe,CAAEV,GAAG,CAACW,qBACvB,CAAC,CACH,CAEA,kDACA,KAAM,CAAAC,aAAa,CAAG,KAAM,GAAAC,eAAa,EAACf,aAAa,CAAEE,GAAG,CAAC,CAE7D,GAAI,CAAAc,UAAuB,CAC3B,GAAId,GAAG,CAACe,KAAK,CAAE,CACbD,UAAU,CAAGC,cAAK,CAACC,YAAY,CAAC,CAC9BC,IAAI,CAAEjB,GAAG,CAACe,KAAK,CAACE,IAAI,CACpBC,GAAG,CAAElB,GAAG,CAACe,KAAK,CAACG,GACjB,CAAC,CAAEN,aAAa,CAClB,CAAC,IAAM,CAAAE,UAAU,CAAGK,aAAI,CAACH,YAAY,CAACJ,aAAa,CAAC,CAEpD,4CACAE,UAAU,CAACM,EAAE,CAAC,OAAO,CAAGC,KAAY,EAAK,CACvC,GAAKA,KAAK,CAASC,OAAO,GAAK,QAAQ,CAAE,KAAM,CAAAD,KAAK,CACpD,KAAM,CAAAE,IAAI,CAAG,GAAAC,gBAAQ,EAACxB,GAAG,CAACP,IAAI,CAAC,CAAI,QAAOO,GAAG,CAACP,IAAK,EAAC,CAAI,QAAOO,GAAG,CAACP,IAAK,EAAC,CAEzE,6DACA,OAAS4B,KAAK,CAASI,IAAI,EACzB,IAAK,QAAQ,CACXzB,GAAG,CAACO,MAAM,CAAEc,KAAK,CAAE,GAAEE,IAAK,+BAA8B,CAAC,CACzD,MAAO,CAAArB,OAAO,CAACwB,IAAI,CAAC,CAAC,CAAC,CACxB,IAAK,YAAY,CACf1B,GAAG,CAACO,MAAM,CAAEc,KAAK,CAAE,GAAEE,IAAK,oBAAmB,CAAC,CAC9C,MAAO,CAAArB,OAAO,CAACwB,IAAI,CAAC,CAAC,CAAC,CACxB,QACE,KAAM,CAAAL,KACV,CACF,CAAC,CAAC,CAEF,iDACAP,UAAU,CAACM,EAAE,CAAC,WAAW,CAAE,IAAM,CAC/B,KAAM,CAAAO,IAAI,CAAGb,UAAU,CAACc,OAAO,CAAC,CAAE,CAClC,KAAM,CAAAL,IAAI,CAAG,GAAAC,gBAAQ,EAACG,IAAI,CAAC,CAAI,QAAOA,IAAK,EAAC,CAAI,QAAOA,IAAI,CAAClC,IAAK,EAAC,CAClEO,GAAG,CAACO,MAAM,CAAEsB,IAAI,CAAE,uBAAsBN,IAAK,OAC3CrB,OAAO,CAACC,GAAG,CAAC2B,QAAS,OAAM,CAC/B,CAAC,CAAC,CAEFhB,UAAU,CAACiB,MAAM,CAAC/B,GAAG,CAACP,IAAI,CAAC,CAE3B,MAAO,CACLmB,aAAa,CACbE,UACF,CACF,CAEAjB,YAAY,CAACmC,gBAAgB,CAAGA,0BAAgB,CAChDnC,YAAY,CAACoC,qBAAqB,CAAGA,6BAAqB,CAC1DpC,YAAY,CAACqC,MAAM,CAAGA,aAAM","ignoreList":[]}
@@ -4,7 +4,7 @@
4
4
  * @param modulePath
5
5
  * @param [basePath]
6
6
  * @return Required module.
7
- */function requireWeak(modulePath,basePath){if(_isomorphy.IS_CLIENT_SIDE)return null;try{/* eslint-disable no-eval */const{resolve}=eval("require")("path");const path=basePath?resolve(basePath,modulePath):modulePath;const{default:def,...named}=eval("require")(path);/* eslint-enable no-eval */if(!def)return named;Object.entries(named).forEach(([key,value])=>{if(def[key])throw Error("Conflict between default and named exports");def[key]=value});return def}catch{return null}}/**
7
+ */function requireWeak(modulePath,basePath){if(_isomorphy.IS_CLIENT_SIDE)return null;try{/* eslint-disable no-eval */const{resolve}=eval("require")("path");const path=basePath?resolve(basePath,modulePath):modulePath;const{default:def,...named}=eval("require")(path);/* eslint-enable no-eval */if(!def)return named;Object.entries(named).forEach(([key,value])=>{if(def[key]){if(def[key]!==value){throw Error("Conflict between default and named exports")}}else def[key]=value});return def}catch{return null}}/**
8
8
  * Resolves specified module path with help of Babel's module resolver.
9
9
  * Yes, the function itself just returns its argument to the caller, but Babel
10
10
  * is configured to resolve the first argument of resolveWeak(..) function, thus
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.js","names":["_isomorphy","require","requireWeak","modulePath","basePath","IS_CLIENT_SIDE","resolve","eval","path","default","def","named","Object","entries","forEach","key","value","Error","resolveWeak"],"sources":["../../../../src/shared/utils/webpack.ts"],"sourcesContent":["import { IS_CLIENT_SIDE } from './isomorphy';\n\n/**\n * Requires the specified module without including it into the bundle during\n * Webpack build.\n * @param modulePath\n * @param [basePath]\n * @return Required module.\n */\nexport function requireWeak(\n modulePath: string,\n basePath?: string,\n): NodeJS.Module | null {\n if (IS_CLIENT_SIDE) return null;\n\n try {\n /* eslint-disable no-eval */\n const { resolve } = eval('require')('path');\n const path = basePath ? resolve(basePath, modulePath) : modulePath;\n const { default: def, ...named } = eval('require')(path);\n /* eslint-enable no-eval */\n\n if (!def) return named;\n\n Object.entries(named).forEach(([key, value]) => {\n if (def[key]) throw Error('Conflict between default and named exports');\n def[key] = value;\n });\n return def;\n } catch {\n return null;\n }\n}\n\n/**\n * Resolves specified module path with help of Babel's module resolver.\n * Yes, the function itself just returns its argument to the caller, but Babel\n * is configured to resolve the first argument of resolveWeak(..) function, thus\n * the result will be the resolved path.\n * @param {string} modulePath\n * @return {string} Absolute or relative path to the module.\n */\nexport function resolveWeak(modulePath: string): string {\n return modulePath;\n}\n"],"mappings":"sIAAA,IAAAA,UAAA,CAAAC,OAAA,gBAEA;AACA;AACA;AACA;AACA;AACA;AACA,GACO,QAAS,CAAAC,WAAWA,CACzBC,UAAkB,CAClBC,QAAiB,CACK,CACtB,GAAIC,yBAAc,CAAE,MAAO,KAAI,CAE/B,GAAI,CACF,4BACA,KAAM,CAAEC,OAAQ,CAAC,CAAGC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAC3C,KAAM,CAAAC,IAAI,CAAGJ,QAAQ,CAAGE,OAAO,CAACF,QAAQ,CAAED,UAAU,CAAC,CAAGA,UAAU,CAClE,KAAM,CAAEM,OAAO,CAAEC,GAAG,CAAE,GAAGC,KAAM,CAAC,CAAGJ,IAAI,CAAC,SAAS,CAAC,CAACC,IAAI,CAAC,CACxD,2BAEA,GAAI,CAACE,GAAG,CAAE,MAAO,CAAAC,KAAK,CAEtBC,MAAM,CAACC,OAAO,CAACF,KAAK,CAAC,CAACG,OAAO,CAAC,CAAC,CAACC,GAAG,CAAEC,KAAK,CAAC,GAAK,CAC9C,GAAIN,GAAG,CAACK,GAAG,CAAC,CAAE,KAAM,CAAAE,KAAK,CAAC,4CAA4C,CAAC,CACvEP,GAAG,CAACK,GAAG,CAAC,CAAGC,KACb,CAAC,CAAC,CACF,MAAO,CAAAN,GACT,CAAE,KAAM,CACN,MAAO,KACT,CACF,CAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACO,QAAS,CAAAQ,WAAWA,CAACf,UAAkB,CAAU,CACtD,MAAO,CAAAA,UACT","ignoreList":[]}
1
+ {"version":3,"file":"webpack.js","names":["_isomorphy","require","requireWeak","modulePath","basePath","IS_CLIENT_SIDE","resolve","eval","path","default","def","named","Object","entries","forEach","key","value","Error","resolveWeak"],"sources":["../../../../src/shared/utils/webpack.ts"],"sourcesContent":["import { IS_CLIENT_SIDE } from './isomorphy';\n\n/**\n * Requires the specified module without including it into the bundle during\n * Webpack build.\n * @param modulePath\n * @param [basePath]\n * @return Required module.\n */\nexport function requireWeak(\n modulePath: string,\n basePath?: string,\n): NodeJS.Module | null {\n if (IS_CLIENT_SIDE) return null;\n\n try {\n /* eslint-disable no-eval */\n const { resolve } = eval('require')('path');\n const path = basePath ? resolve(basePath, modulePath) : modulePath;\n const { default: def, ...named } = eval('require')(path);\n /* eslint-enable no-eval */\n\n if (!def) return named;\n\n Object.entries(named).forEach(([key, value]) => {\n if (def[key]) {\n if (def[key] !== value) {\n throw Error('Conflict between default and named exports');\n }\n } else def[key] = value;\n });\n return def;\n } catch {\n return null;\n }\n}\n\n/**\n * Resolves specified module path with help of Babel's module resolver.\n * Yes, the function itself just returns its argument to the caller, but Babel\n * is configured to resolve the first argument of resolveWeak(..) function, thus\n * the result will be the resolved path.\n * @param {string} modulePath\n * @return {string} Absolute or relative path to the module.\n */\nexport function resolveWeak(modulePath: string): string {\n return modulePath;\n}\n"],"mappings":"sIAAA,IAAAA,UAAA,CAAAC,OAAA,gBAEA;AACA;AACA;AACA;AACA;AACA;AACA,GACO,QAAS,CAAAC,WAAWA,CACzBC,UAAkB,CAClBC,QAAiB,CACK,CACtB,GAAIC,yBAAc,CAAE,MAAO,KAAI,CAE/B,GAAI,CACF,4BACA,KAAM,CAAEC,OAAQ,CAAC,CAAGC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAC3C,KAAM,CAAAC,IAAI,CAAGJ,QAAQ,CAAGE,OAAO,CAACF,QAAQ,CAAED,UAAU,CAAC,CAAGA,UAAU,CAClE,KAAM,CAAEM,OAAO,CAAEC,GAAG,CAAE,GAAGC,KAAM,CAAC,CAAGJ,IAAI,CAAC,SAAS,CAAC,CAACC,IAAI,CAAC,CACxD,2BAEA,GAAI,CAACE,GAAG,CAAE,MAAO,CAAAC,KAAK,CAEtBC,MAAM,CAACC,OAAO,CAACF,KAAK,CAAC,CAACG,OAAO,CAAC,CAAC,CAACC,GAAG,CAAEC,KAAK,CAAC,GAAK,CAC9C,GAAIN,GAAG,CAACK,GAAG,CAAC,CAAE,CACZ,GAAIL,GAAG,CAACK,GAAG,CAAC,GAAKC,KAAK,CAAE,CACtB,KAAM,CAAAC,KAAK,CAAC,4CAA4C,CAC1D,CACF,CAAC,IAAM,CAAAP,GAAG,CAACK,GAAG,CAAC,CAAGC,KACpB,CAAC,CAAC,CACF,MAAO,CAAAN,GACT,CAAE,KAAM,CACN,MAAO,KACT,CACF,CAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACO,QAAS,CAAAQ,WAAWA,CAACf,UAAkB,CAAU,CACtD,MAAO,CAAAA,UACT","ignoreList":[]}
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see web.bundle.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@dr.pogodin/js-utils"),require("@dr.pogodin/react-global-state"),require("@dr.pogodin/react-themes"),require("axios"),require("dayjs"),require("lodash"),require("node-forge/lib/aes"),require("node-forge/lib/forge"),require("prop-types"),require("qs"),require("react"),require("react-dom"),require("react-dom/client"),require("react-helmet"),require("react-router-dom")):"function"==typeof define&&define.amd?define(["@dr.pogodin/js-utils","@dr.pogodin/react-global-state","@dr.pogodin/react-themes","axios","dayjs","lodash","node-forge/lib/aes","node-forge/lib/forge","prop-types","qs","react","react-dom","react-dom/client","react-helmet","react-router-dom"],t):"object"==typeof exports?exports["@dr.pogodin/react-utils"]=t(require("@dr.pogodin/js-utils"),require("@dr.pogodin/react-global-state"),require("@dr.pogodin/react-themes"),require("axios"),require("dayjs"),require("lodash"),require("node-forge/lib/aes"),require("node-forge/lib/forge"),require("prop-types"),require("qs"),require("react"),require("react-dom"),require("react-dom/client"),require("react-helmet"),require("react-router-dom")):e["@dr.pogodin/react-utils"]=t(e["@dr.pogodin/js-utils"],e["@dr.pogodin/react-global-state"],e["@dr.pogodin/react-themes"],e.axios,e.dayjs,e.lodash,e["node-forge/lib/aes"],e["node-forge/lib/forge"],e["prop-types"],e.qs,e.react,e["react-dom"],e["react-dom/client"],e["react-helmet"],e["react-router-dom"])}("undefined"!=typeof self?self:this,(function(__WEBPACK_EXTERNAL_MODULE__864__,__WEBPACK_EXTERNAL_MODULE__126__,__WEBPACK_EXTERNAL_MODULE__859__,__WEBPACK_EXTERNAL_MODULE__742__,__WEBPACK_EXTERNAL_MODULE__185__,__WEBPACK_EXTERNAL_MODULE__773__,__WEBPACK_EXTERNAL_MODULE__958__,__WEBPACK_EXTERNAL_MODULE__814__,__WEBPACK_EXTERNAL_MODULE__949__,__WEBPACK_EXTERNAL_MODULE__360__,__WEBPACK_EXTERNAL_MODULE__155__,__WEBPACK_EXTERNAL_MODULE__514__,__WEBPACK_EXTERNAL_MODULE__236__,__WEBPACK_EXTERNAL_MODULE__883__,__WEBPACK_EXTERNAL_MODULE__442__){return function(){"use strict";var __webpack_modules__={227:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{A:function(){return getInj}});var node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(814),node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0__),node_forge_lib_aes__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(958),node_forge_lib_aes__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(node_forge_lib_aes__WEBPACK_IMPORTED_MODULE_1__),_shared_utils_isomorphy_buildInfo__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(445);let inj={};const metaElement="undefined"!=typeof document?document.querySelector('meta[itemprop="drpruinj"]'):null;if(metaElement){metaElement.remove();let data=node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().util.decode64(metaElement.content);const{key:key}=(0,_shared_utils_isomorphy_buildInfo__WEBPACK_IMPORTED_MODULE_2__.F)(),d=node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().cipher.createDecipher("AES-CBC",key);d.start({iv:data.slice(0,key.length)}),d.update(node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().util.createBuffer(data.slice(key.length))),d.finish(),data=node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().util.decodeUtf8(d.output.data),inj=eval(`(${data})`)}else inj={};function getInj(){return inj}},662:function(e,t,n){n.d(t,{A:function(){return c}}),n(155);var r=n(126),o=n(236),i=n(442),a=n(227),l=n(848);function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=document.getElementById("react-view");if(!n)throw Error("Failed to find container for React app");const c=(0,l.jsx)(r.GlobalStateProvider,{initialState:(0,a.A)().ISTATE||t.initialState,children:(0,l.jsx)(i.BrowserRouter,{future:{v7_relativeSplatPath:!0},children:(0,l.jsx)(e,{})})});t.dontHydrate?(0,o.createRoot)(n).render(c):(0,o.hydrateRoot)(n,c)}},445:function(e,t,n){let r;function o(){if(void 0===r)throw Error('"Build Info" has not been initialized yet');return r}n.d(t,{F:function(){return o}}),"undefined"!=typeof BUILD_INFO&&(r=BUILD_INFO)},965:function(e,t,n){n.d(t,{B:function(){return r},p:function(){return o}});const r="object"!=typeof process||!process.versions||!process.versions.node||!!n.g.REACT_UTILS_FORCE_CLIENT_SIDE,o=!r},333:function(e,t,n){n.r(t),n.d(t,{IS_CLIENT_SIDE:function(){return o.B},IS_SERVER_SIDE:function(){return o.p},buildTimestamp:function(){return l},getBuildInfo:function(){return r.F},isDevBuild:function(){return i},isProdBuild:function(){return a}});var r=n(445),o=n(965);function i(){return!1}function a(){return!0}function l(){return(0,r.F)().timestamp}},969:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{requireWeak:function(){return requireWeak},resolveWeak:function(){return resolveWeak}});var _isomorphy__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(333);function requireWeak(modulePath,basePath){if(_isomorphy__WEBPACK_IMPORTED_MODULE_0__.IS_CLIENT_SIDE)return null;try{const{resolve:resolve}=eval("require")("path"),path=basePath?resolve(basePath,modulePath):modulePath,{default:def,...named}=eval("require")(path);return def?(Object.entries(named).forEach((e=>{let[t,n]=e;if(def[t])throw Error("Conflict between default and named exports");def[t]=n})),def):named}catch{return null}}function resolveWeak(e){return e}},427:function(e,t){t.parse=function(e,t){if("string"!=typeof e)throw new TypeError("argument str must be a string");for(var n={},r=(t||{}).decode||o,i=0;i<e.length;){var l=e.indexOf("=",i);if(-1===l)break;var c=e.indexOf(";",i);if(-1===c)c=e.length;else if(c<l){i=e.lastIndexOf(";",l-1)+1;continue}var s=e.slice(i,l).trim();if(void 0===n[s]){var u=e.slice(l+1,c).trim();34===u.charCodeAt(0)&&(u=u.slice(1,-1)),n[s]=a(u,r)}i=c+1}return n},t.serialize=function(e,t,o){var a=o||{},l=a.encode||i;if("function"!=typeof l)throw new TypeError("option encode is invalid");if(!r.test(e))throw new TypeError("argument name is invalid");var c=l(t);if(c&&!r.test(c))throw new TypeError("argument val is invalid");var s=e+"="+c;if(null!=a.maxAge){var u=a.maxAge-0;if(isNaN(u)||!isFinite(u))throw new TypeError("option maxAge is invalid");s+="; Max-Age="+Math.floor(u)}if(a.domain){if(!r.test(a.domain))throw new TypeError("option domain is invalid");s+="; Domain="+a.domain}if(a.path){if(!r.test(a.path))throw new TypeError("option path is invalid");s+="; Path="+a.path}if(a.expires){var _=a.expires;if(!function(e){return"[object Date]"===n.call(e)||e instanceof Date}(_)||isNaN(_.valueOf()))throw new TypeError("option expires is invalid");s+="; Expires="+_.toUTCString()}if(a.httpOnly&&(s+="; HttpOnly"),a.secure&&(s+="; Secure"),a.partitioned&&(s+="; Partitioned"),a.priority)switch("string"==typeof a.priority?a.priority.toLowerCase():a.priority){case"low":s+="; Priority=Low";break;case"medium":s+="; Priority=Medium";break;case"high":s+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}if(a.sameSite)switch("string"==typeof a.sameSite?a.sameSite.toLowerCase():a.sameSite){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return s};var n=Object.prototype.toString,r=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function o(e){return-1!==e.indexOf("%")?decodeURIComponent(e):e}function i(e){return encodeURIComponent(e)}function a(e,t){try{return t(e)}catch(t){return e}}},20:function(e,t,n){var r=n(155),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,l=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,n){var r,i={},s=null,u=null;for(r in void 0!==n&&(s=""+n),void 0!==t.key&&(s=""+t.key),void 0!==t.ref&&(u=t.ref),t)a.call(t,r)&&!c.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===i[r]&&(i[r]=t[r]);return{$$typeof:o,type:e,key:s,ref:u,props:i,_owner:l.current}}t.Fragment=i,t.jsx=s,t.jsxs=s},848:function(e,t,n){e.exports=n(20)},864:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__864__},126:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__126__},859:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__859__},742:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__742__},185:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__185__},773:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__773__},958:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__958__},814:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__814__},949:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__949__},360:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__360__},155:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__155__},514:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__514__},236:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__236__},883:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__883__},442:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__442__}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__webpack_require__),n.exports}__webpack_require__.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=function(e,t){for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};return function(){__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Barrier:function(){return _.Barrier},BaseModal:function(){return j},Button:function(){return ce},Checkbox:function(){return _e},CustomDropdown:function(){return G},Dropdown:function(){return Q},Emitter:function(){return _.Emitter},GlobalStateProvider:function(){return d.GlobalStateProvider},Input:function(){return fe},JU:function(){return R},Link:function(){return ie},MetaTags:function(){return ge},Modal:function(){return B},NavLink:function(){return ye},PT:function(){return m},PageLayout:function(){return be},Semaphore:function(){return _.Semaphore},Switch:function(){return te},TextArea:function(){return Ye},ThemeProvider:function(){return e.ThemeProvider},Throbber:function(){return Te},WithTooltip:function(){return De},YouTubeVideo:function(){return We},api:function(){return A()},client:function(){return $e},config:function(){return i},getGlobalState:function(){return d.getGlobalState},getSsrContext:function(){return p},isomorphy:function(){return a},newAsyncDataEnvelope:function(){return d.newAsyncDataEnvelope},optionValidator:function(){return U},optionsValidator:function(){return W},server:function(){return Fe},splitComponent:function(){return P},themed:function(){return k},time:function(){return h},useAsyncCollection:function(){return d.useAsyncCollection},useAsyncData:function(){return d.useAsyncData},useGlobalState:function(){return d.useGlobalState},webpack:function(){return r},withGlobalStateType:function(){return d.withGlobalStateType},withRetries:function(){return _.withRetries}});var e=__webpack_require__(859),t=__webpack_require__.n(e),n=__webpack_require__(965),r=__webpack_require__(969);const o=(n.B?__webpack_require__(227).A().CONFIG:(0,r.requireWeak)("config"))||{};if(n.B&&"undefined"!=typeof document){const e=__webpack_require__(427);o.CSRF=e.parse(document.cookie).csrfToken}var i=o,a=__webpack_require__(333),l=__webpack_require__(427),c=__webpack_require__(185),s=__webpack_require__.n(c),u=__webpack_require__(155),_=__webpack_require__(864),d=__webpack_require__(126);const{getSsrContext:p}=(0,d.withGlobalStateType)(),f={DAY_MS:_.DAY_MS,HOUR_MS:_.HOUR_MS,MIN_MS:_.MIN_MS,SEC_MS:_.SEC_MS,YEAR_MS:_.YEAR_MS,now:Date.now,timer:_.timer,useCurrent:function(){let{autorefresh:e=!1,globalStatePath:t="currentTime",precision:n=5*_.SEC_MS}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[r,o]=(0,d.useGlobalState)(t,Date.now);return(0,u.useEffect)((()=>{let t;const r=()=>{o((e=>{const t=Date.now();return Math.abs(t-e)>n?t:e})),e&&(t=setTimeout(r,n))};return r(),()=>{t&&clearTimeout(t)}}),[e,n,o]),r},useTimezoneOffset:function(){let{cookieName:e="timezoneOffset",globalStatePath:t="timezoneOffset"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=p(!1),[r,o]=(0,d.useGlobalState)(t,(()=>{var t;const r=e&&(null==n||null===(t=n.req)||void 0===t||null===(t=t.cookies)||void 0===t?void 0:t[e]);return r?parseInt(r,10):0}));return(0,u.useEffect)((()=>{const t=(new Date).getTimezoneOffset();o(t),e&&(document.cookie=l.serialize(e,t.toString(),{path:"/"}))}),[e,o]),r}};var h=Object.assign(s(),f),m=__webpack_require__(949),b=__webpack_require__.n(m),E=__webpack_require__(848);let v;a.IS_CLIENT_SIDE&&(v=__webpack_require__(227).A().CHUNK_GROUPS||{});const w={};function g(){return(0,a.getBuildInfo)().publicPath}function y(e,t,n){let r;const o=`${g()}/${e}`,i=`${document.location.origin}${o}`;if(!t.has(i)){let e=document.querySelector(`link[href="${o}"]`);e||(e=document.createElement("link"),e.setAttribute("rel","stylesheet"),e.setAttribute("href",o),document.head.appendChild(e)),r=new _.Barrier,e.addEventListener("load",(()=>r.resolve())),e.addEventListener("error",(()=>r.resolve()))}if(n){const e=w[o]||0;w[o]=1+e}return r}function x(e,t){if(!t[e])throw Error(`Unknown chunk name "${e}"`)}function C(e,t,n){const r=[],o=t[e],i=function(){const e=new Set,{styleSheets:t}=document;for(let n=0;n<t.length;++n){const{href:r}=t[n];r&&e.add(r)}return e}();for(let e=0;e<o.length;++e){const t=o[e];if(t.endsWith(".css")){const e=y(t,i,n);e&&r.push(e)}}return r.length?Promise.allSettled(r).then():Promise.resolve()}const T=new Set;function P(e){let{chunkName:t,getComponent:n,placeholder:r}=e;if(a.IS_CLIENT_SIDE&&x(t,v),T.has(t))throw Error(`Repeated splitComponent() call for the chunk "${t}"`);T.add(t);const o=(0,u.lazy)((async()=>{const e=await n(),r="default"in e?e.default:e;a.IS_CLIENT_SIDE&&await C(t,v,!1);const o=(0,u.forwardRef)(((e,n)=>{let{children:o,...i}=e;if(a.IS_SERVER_SIDE){const{chunkGroups:e,chunks:n}=p();x(t,e),n.includes(t)||n.push(t)}return(0,u.useInsertionEffect)((()=>(C(t,v,!0),()=>function(e,t){const n=t[e];for(let e=0;e<n.length;++e){const t=n[e];if(t.endsWith(".css")){const e=`${g()}/${t}`;--w[e]<=0&&document.head.querySelector(`link[href="${e}"]`).remove()}}}(t,v))),[]),(0,E.jsx)(r,{ref:n,...i,children:o})}));return{default:o}})),i=e=>{let{children:t,...n}=e;return(0,E.jsx)(u.Suspense,{fallback:r,children:(0,E.jsx)(o,{...n,children:t})})};return i.propTypes={children:b().node},i.defaultProps={children:void 0},i}const k=t();let S;k.COMPOSE=e.COMPOSE,k.PRIORITY=e.PRIORITY;try{S=process.env.NODE_CONFIG_ENV}catch{}const R="production"!==(S||"production")?r.requireWeak("./jest","/"):null;var O=__webpack_require__(742),A=__webpack_require__.n(O),q=__webpack_require__(773),N=__webpack_require__(514),L=__webpack_require__.n(N),D="_5fRFtF";const j=e=>{let{cancelOnScrolling:t,children:n,containerStyle:r,dontDisableScrolling:o,onCancel:i,theme:a}=e;const l=(0,u.useRef)(null),c=(0,u.useRef)(null),[s,_]=(0,u.useState)();(0,u.useEffect)((()=>{const e=document.createElement("div");return document.body.appendChild(e),_(e),()=>{document.body.removeChild(e)}}),[]),(0,u.useEffect)((()=>(t&&i&&(window.addEventListener("scroll",i),window.addEventListener("wheel",i)),()=>{t&&i&&(window.removeEventListener("scroll",i),window.removeEventListener("wheel",i))})),[t,i]),(0,u.useEffect)((()=>(o||document.body.classList.add(D),()=>{o||document.body.classList.remove(D)})),[o]);const d=(0,u.useMemo)((()=>(0,E.jsx)("div",{onFocus:()=>{var e,t;const n=null===(e=l.current)||void 0===e?void 0:e.querySelectorAll("*");for(let e=n.length-1;e>=0;--e)if(n[e].focus(),document.activeElement===n[e])return;null===(t=c.current)||void 0===t||t.focus()},tabIndex:0})),[]);return s?L().createPortal((0,E.jsxs)(E.Fragment,{children:[d,(0,E.jsx)("div",{"aria-label":"Cancel",className:a.overlay,onClick:e=>{i&&(i(),e.stopPropagation())},onKeyDown:e=>{"Escape"===e.key&&i&&(i(),e.stopPropagation())},ref:e=>{e&&e!==c.current&&(c.current=e,e.focus())},role:"button",tabIndex:0}),(0,E.jsx)("div",{"aria-modal":"true",className:a.container,onClick:e=>e.stopPropagation(),onWheel:e=>e.stopPropagation(),ref:l,role:"dialog",style:r,children:n}),(0,E.jsx)("div",{onFocus:()=>{var e;null===(e=c.current)||void 0===e||e.focus()},tabIndex:0}),d]}),s):null},M=t()(j,"Modal",["container","overlay"],{overlay:"ye2BZo",context:"Szmbbz",ad:"Ah-Nsc",hoc:"Wki41G",container:"gyZ4rc"});j.propTypes={cancelOnScrolling:b().bool,children:b().node,containerStyle:b().shape({}),dontDisableScrolling:b().bool,onCancel:b().func,theme:M.themeType.isRequired},j.defaultProps={cancelOnScrolling:!1,children:null,containerStyle:void 0,dontDisableScrolling:!1,onCancel:q.noop};var B=M;const I=["active","arrow","container","dropdown","hiddenOption","label","option","select","upward"],U=b().oneOfType([b().shape({name:b().node,value:b().string.isRequired}).isRequired,b().string.isRequired]),W=b().arrayOf(U.isRequired),K=b().oneOfType([b().shape({name:b().string,value:b().string.isRequired}).isRequired,b().string.isRequired]),X=b().arrayOf(K.isRequired);function Y(e){var t;return"string"==typeof e?[e,e]:[e.value,null!==(t=e.name)&&void 0!==t?t:e.value]}const F=(0,u.forwardRef)(((e,t)=>{let{containerClass:n,containerStyle:r,filter:o,onCancel:i,onChange:a,optionClass:l,options:c}=e;const s=(0,u.useRef)(null);(0,u.useImperativeHandle)(t,(()=>({measure:()=>{var e,t;const n=null===(e=s.current)||void 0===e?void 0:e.parentElement;if(!n)return;const r=null===(t=s.current)||void 0===t?void 0:t.getBoundingClientRect(),o=window.getComputedStyle(n),i=parseFloat(o.marginBottom),a=parseFloat(o.marginTop);return r.height+=i+a,r}})),[]);const _=[];for(let e=0;e<c.length;++e){const t=c[e];if(!o||o(t)){const[e,n]=Y(t);_.push((0,E.jsx)("div",{className:l,onClick:t=>{a(e),t.stopPropagation()},onKeyDown:t=>{"Enter"===t.key&&(a(e),t.stopPropagation())},role:"button",tabIndex:0,children:n},e))}}return(0,E.jsx)(j,{cancelOnScrolling:!0,containerStyle:r,dontDisableScrolling:!0,onCancel:i,theme:{ad:"",hoc:"",container:n,context:"",overlay:"jKsMKG"},children:(0,E.jsx)("div",{ref:s,children:_})})}));F.propTypes={containerClass:b().string.isRequired,containerStyle:b().shape({left:b().number.isRequired,top:b().number.isRequired,width:b().number.isRequired}),filter:b().func,onCancel:b().func.isRequired,onChange:b().func.isRequired,optionClass:b().string.isRequired,options:W.isRequired},F.defaultProps={containerStyle:void 0,filter:void 0};var $=F;const z=e=>{let{filter:t,label:n,onChange:r,options:o,theme:i,value:a}=e;if(!o)throw Error("Internal error");const[l,c]=(0,u.useState)(!1),s=(0,u.useRef)(null),_=(0,u.useRef)(null),[d,p]=(0,u.useState)(),[f,h]=(0,u.useState)(!1);(0,u.useEffect)((()=>{if(!l)return;let e;const t=()=>{var n,r;const o=null===(n=s.current)||void 0===n?void 0:n.getBoundingClientRect(),i=null===(r=_.current)||void 0===r?void 0:r.measure();if(o&&i){var a,l;const e=o.bottom+i.height<(null!==(a=null===(l=window.visualViewport)||void 0===l?void 0:l.height)&&void 0!==a?a:0),t=o.top-i.height>0,n=!e&&t;h(n);const r=n?{top:o.top-i.height-1,left:o.left,width:o.width}:{left:o.left,top:o.bottom,width:o.width};p((e=>{return n=r,(null==(t=e)?void 0:t.left)===(null==n?void 0:n.left)&&(null==t?void 0:t.top)===(null==n?void 0:n.top)&&(null==t?void 0:t.width)===(null==n?void 0:n.width)?e:r;var t,n}))}e=requestAnimationFrame(t)};return requestAnimationFrame(t),()=>{cancelAnimationFrame(e)}}),[l]);const m=e=>{const t=window.visualViewport,n=s.current.getBoundingClientRect();c(!0),p({left:(null==t?void 0:t.width)||0,top:(null==t?void 0:t.height)||0,width:n.width}),e.stopPropagation()};let b=(0,E.jsx)(E.Fragment,{children:"‌"});for(let e=0;e<o.length;++e){const n=o[e];if(!t||t(n)){const[e,t]=Y(n);if(e===a){b=t;break}}}let v=i.container;l&&(v+=` ${i.active}`);let w=i.select||"";return f&&(v+=` ${i.upward}`,w+=` ${i.upward}`),(0,E.jsxs)("div",{className:v,children:[void 0===n?null:(0,E.jsx)("div",{className:i.label,children:n}),(0,E.jsxs)("div",{className:i.dropdown,onClick:m,onKeyDown:e=>{"Enter"===e.key&&m(e)},ref:s,role:"listbox",tabIndex:0,children:[b,(0,E.jsx)("div",{className:i.arrow})]}),l?(0,E.jsx)($,{containerClass:w,containerStyle:d,onCancel:()=>{c(!1)},onChange:e=>{c(!1),r&&r(e)},optionClass:i.option||"",options:o,ref:_}):null]})},H=t()(z,"CustomDropdown",I,{container:"oQKv0Y",context:"_9Tod5r",ad:"R58zIg",hoc:"O-Tp1i",label:"YUPUNs",dropdown:"pNEyAA",option:"LD2Kzy",select:"LP5azC",arrow:"-wscve",active:"k2UDsV",upward:"HWRvu4"});z.propTypes={filter:b().func,label:b().node,onChange:b().func,options:b().arrayOf(U.isRequired),theme:H.themeType.isRequired,value:b().string},z.defaultProps={filter:void 0,label:void 0,onChange:void 0,options:[],value:void 0};var G=H;const V=e=>{let{filter:t,label:n,onChange:r,options:o,theme:i,value:a}=e;if(!o)throw Error("Internal error");let l=!1;const c=[];for(let e=0;e<o.length;++e){const n=o[e];if(!t||t(n)){const[e,t]=Y(n);l||(l=e===a),c.push((0,E.jsx)("option",{className:i.option,value:e,children:t},e))}}const s=l?null:(0,E.jsx)("option",{disabled:!0,className:i.hiddenOption,value:a,children:a},"__reactUtilsHiddenOption");return(0,E.jsxs)("div",{className:i.container,children:[void 0===n?null:(0,E.jsx)("div",{className:i.label,children:n}),(0,E.jsxs)("div",{className:i.dropdown,children:[(0,E.jsxs)("select",{className:i.select,onChange:r,value:a,children:[s,c]}),(0,E.jsx)("div",{className:i.arrow})]})]})},Z=t()(V,"Dropdown",I,{dropdown:"kI9A9U",context:"xHyZo4",ad:"ADu59e",hoc:"FTP2bb",arrow:"DubGkT",container:"WtSZPd",active:"ayMn7O",label:"K7JYKw",hiddenOption:"clAKFJ",select:"N0Fc14"});V.propTypes={filter:b().func,label:b().node,onChange:b().func,options:X,theme:Z.themeType.isRequired,value:b().string},V.defaultProps={filter:void 0,label:void 0,onChange:void 0,options:[],value:""};var Q=Z;const J=e=>{let{label:t,onChange:n,options:r,theme:o,value:i}=e;if(!r||!o.option)throw Error("Internal error");const a=[];for(let e=0;e<(null==r?void 0:r.length);++e){const[t,l]=Y(r[e]);let c,s=o.option;t===i?s+=` ${o.selected}`:n&&(c=()=>n(t)),a.push(c?(0,E.jsx)("div",{className:s,onClick:c,onKeyDown:e=>{c&&"Enter"===e.key&&c()},role:"button",tabIndex:0,children:l},t):(0,E.jsx)("div",{className:s,children:l},t))}return(0,E.jsxs)("div",{className:o.container,children:[t?(0,E.jsx)("div",{className:o.label,children:t}):null,(0,E.jsx)("div",{className:o.options,children:a})]})},ee=t()(J,"Switch",["container","label","option","options","selected"],{container:"AWNvRj",context:"VMHfnP",ad:"HNliRC",hoc:"_2Ue-db",option:"fUfIAd",selected:"Wco-qk",options:"CZYtcC"});J.propTypes={label:b().node,onChange:b().func,options:W,theme:ee.themeType.isRequired,value:b().string},J.defaultProps={label:void 0,onChange:void 0,options:[],value:void 0};var te=ee,ne=__webpack_require__(442);const re=e=>{let{children:t,className:n,disabled:r,enforceA:o,keepScrollPosition:i,onClick:a,onMouseDown:l,openNewTab:c,replace:s,routerLinkType:u,to:_,...d}=e;if(r||o||c||null!=_&&_.match(/^(#|(https?|mailto):)/))return(0,E.jsx)("a",{className:(n?n+" ":"")+"zH52sA",href:_,onClick:r?e=>e.preventDefault():a,onMouseDown:r?e=>e.preventDefault():l,rel:"noopener noreferrer",target:c?"_blank":"",children:t});const p=u;return(0,E.jsx)(p,{className:n,onMouseDown:l,replace:s,to:_,onClick:e=>{a&&a(e),i||window.scroll(0,0)},...d,children:t})};re.defaultProps={children:null,className:"",disabled:!1,enforceA:!1,keepScrollPosition:!1,onClick:void 0,onMouseDown:void 0,openNewTab:!1,replace:!1,to:""},re.propTypes={children:b().node,className:b().string,disabled:b().bool,enforceA:b().bool,keepScrollPosition:b().bool,onClick:b().func,onMouseDown:b().func,openNewTab:b().bool,replace:b().bool,routerLinkType:b().elementType.isRequired,to:b().oneOfType([b().object,b().string])};var oe=re,ie=e=>(0,E.jsx)(oe,{...e,routerLinkType:ne.Link});const ae=e=>{let{active:t,children:n,disabled:r,enforceA:o,onClick:i,onMouseDown:a,openNewTab:l,replace:c,theme:s,to:u}=e,_=s.button;return t&&s.active&&(_+=` ${s.active}`),r?(s.disabled&&(_+=` ${s.disabled}`),(0,E.jsx)("div",{className:_,children:n})):u?(0,E.jsx)(ie,{className:_,enforceA:o,onClick:i,onMouseDown:a,openNewTab:l,replace:c,to:u,children:n}):(0,E.jsx)("div",{className:_,onClick:i,onKeyDown:i&&(e=>{"Enter"===e.key&&i(e)}),onMouseDown:a,role:"button",tabIndex:0,children:n})},le=t()(ae,"Button",["active","button","disabled"],{button:"E1FNQT",context:"KM0v4f",ad:"_3jm1-Q",hoc:"_0plpDL",active:"MAe9O6",disabled:"Br9IWV"});ae.defaultProps={active:!1,children:void 0,disabled:!1,enforceA:!1,onClick:void 0,onMouseDown:void 0,openNewTab:!1,replace:!1,to:void 0},ae.propTypes={active:b().bool,children:b().node,disabled:b().bool,enforceA:b().bool,onClick:b().func,onMouseDown:b().func,openNewTab:b().bool,replace:b().bool,theme:le.themeType.isRequired,to:b().oneOfType([b().object,b().string])};var ce=le;const se=e=>{let{checked:t,label:n,onChange:r,theme:o}=e;return(0,E.jsxs)("div",{className:o.container,children:[void 0===n?null:(0,E.jsx)("div",{className:o.label,children:n}),(0,E.jsx)("input",{checked:t,className:o.checkbox,onChange:r,onClick:e=>e.stopPropagation(),type:"checkbox"})]})},ue=t()(se,"Checkbox",["checkbox","container","label"],{checkbox:"A-f8qJ",context:"dNQcC6",ad:"earXxa",hoc:"qAPfQ6",container:"Kr0g3M",label:"_3dML-O"});se.propTypes={checked:b().bool,label:b().node,onChange:b().func,theme:ue.themeType.isRequired},se.defaultProps={checked:void 0,label:void 0,onChange:void 0};var _e=ue;const de=(0,u.forwardRef)(((e,t)=>{let{label:n,theme:r,...o}=e;return(0,E.jsxs)("span",{className:r.container,children:[void 0===n?null:(0,E.jsx)("div",{className:r.label,children:n}),(0,E.jsx)("input",{className:r.input,ref:t,...o})]})})),pe=t()(de,"Input",["container","input","label"],{container:"Cxx397",context:"X5WszA",ad:"_8s7GCr",hoc:"TVlBYc",input:"M07d4s",label:"gfbdq-"});de.propTypes={label:b().node,theme:pe.themeType.isRequired},de.defaultProps={label:void 0};var fe=pe;const he=e=>{let{children:t,leftSidePanelContent:n,rightSidePanelContent:r,theme:o}=e;return(0,E.jsxs)("div",{className:o.container,children:[(0,E.jsx)("div",{className:[o.sidePanel,o.leftSidePanel].join(" "),children:n}),(0,E.jsx)("div",{className:o.mainPanel,children:t}),(0,E.jsx)("div",{className:[o.sidePanel,o.rightSidePanel].join(" "),children:r})]})},me=t()(he,"PageLayout",["container","leftSidePanel","mainPanel","rightSidePanel","sidePanel"],{container:"T3cuHB",context:"m4mL-M",ad:"m3-mdC",hoc:"J15Z4H",mainPanel:"pPlQO2",sidePanel:"lqNh4h"});he.propTypes={children:b().node,leftSidePanelContent:b().node,rightSidePanelContent:b().node,theme:me.themeType.isRequired},he.defaultProps={children:null,leftSidePanelContent:null,rightSidePanelContent:null};var be=me,Ee=__webpack_require__(883);const ve=(0,u.createContext)({description:"",title:""}),we=e=>{let{children:t,description:n,image:r,siteName:o,socialDescription:i,socialTitle:a,title:l,url:c}=e;const s=a||l,_=i||n,d=(0,u.useMemo)((()=>({description:n,image:r,siteName:o,socialDescription:i,socialTitle:a,title:l,url:c})),[n,r,o,i,a,l,c]);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(Ee.Helmet,{children:[(0,E.jsx)("title",{children:l}),(0,E.jsx)("meta",{name:"description",content:n}),(0,E.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,E.jsx)("meta",{name:"twitter:title",content:s}),(0,E.jsx)("meta",{name:"twitter:description",content:_}),r?(0,E.jsx)("meta",{name:"twitter:image",content:r}):null,o?(0,E.jsx)("meta",{name:"twitter:site",content:`@${o}`}):null,(0,E.jsx)("meta",{name:"og:title",content:s}),r?(0,E.jsx)("meta",{name:"og:image",content:r}):null,r?(0,E.jsx)("meta",{name:"og:image:alt",content:s}):null,(0,E.jsx)("meta",{name:"og:description",content:_}),o?(0,E.jsx)("meta",{name:"og:sitename",content:o}):null,c?(0,E.jsx)("meta",{name:"og:url",content:c}):null]}),t?(0,E.jsx)(ve.Provider,{value:d,children:t}):null]})};we.Context=ve,we.defaultProps={children:null,image:"",siteName:"",socialDescription:"",socialTitle:"",url:""},we.propTypes={children:b().node,description:b().string.isRequired,image:b().string,siteName:b().string,socialDescription:b().string,socialTitle:b().string,title:b().string.isRequired,url:b().string};var ge=we,ye=e=>(0,E.jsx)(oe,{...e,routerLinkType:ne.NavLink});const xe=e=>{let{theme:t}=e;return(0,E.jsxs)("span",{className:t.container,children:[(0,E.jsx)("span",{className:t.circle}),(0,E.jsx)("span",{className:t.circle}),(0,E.jsx)("span",{className:t.circle})]})},Ce=t()(xe,"Throbber",["bouncing","circle","container"],{container:"_7zdld4",context:"uIObt7",ad:"XIxe9o",hoc:"YOyORH",circle:"dBrB4g",bouncing:"TJe-6j"});xe.propTypes={theme:Ce.themeType.isRequired};var Te=Ce;let Pe=function(e){return e.ABOVE_CURSOR="ABOVE_CURSOR",e.ABOVE_ELEMENT="ABOVE_ELEMENT",e.BELOW_CURSOR="BELOW_CURSOR",e.BELOW_ELEMENT="BELOW_ELEMENT",e}({});const ke=["border-bottom-color:transparent","border-left-color:transparent","border-right-color:transparent"].join(";"),Se=["border-top-color:transparent","border-left-color:transparent","border-right-color:transparent"].join(";");function Re(e,t,n,r,o){const i=function(e){return{arrow:e.arrow.getBoundingClientRect(),container:e.container.getBoundingClientRect()}}(o),a=function(){const{scrollX:e,scrollY:t}=window,{documentElement:{clientHeight:n,clientWidth:r}}=document;return{left:e,right:e+r,top:t,bottom:t+n}}(),l=function(e,t,n){const{arrow:r,container:o}=n;return{arrowX:.5*(o.width-r.width),arrowY:o.height,containerX:e-o.width/2,containerY:t-o.height-r.height/1.5,baseArrowStyle:ke}}(e,t,i);if(l.containerX<a.left+6)l.containerX=a.left+6,l.arrowX=Math.max(6,e-l.containerX-i.arrow.width/2);else{const t=a.right-6-i.container.width;l.containerX>t&&(l.containerX=t,l.arrowX=Math.min(i.container.width-6,e-l.containerX-i.arrow.width/2))}l.containerY<a.top+6&&(l.containerY+=i.container.height+2*i.arrow.height,l.arrowY-=i.container.height+i.arrow.height,l.baseArrowStyle=Se);const c=`left:${l.containerX}px;top:${l.containerY}px`;o.container.setAttribute("style",c);const s=`${l.baseArrowStyle};left:${l.arrowX}px;top:${l.arrowY}px`;o.arrow.setAttribute("style",s)}const Oe=(0,u.forwardRef)(((e,t)=>{let{children:n,theme:r}=e;const{current:o}=(0,u.useRef)({lastElement:void 0,lastPageX:0,lastPageY:0,lastPlacement:void 0}),[i,a]=(0,u.useState)(null),l=(e,t,n,r)=>{o.lastElement=r,o.lastPageX=e,o.lastPageY=t,o.lastPlacement=n,i&&Re(e,t,0,0,i)};return(0,u.useImperativeHandle)(t,(()=>({pointTo:l}))),(0,u.useEffect)((()=>{const e=function(e){const t=document.createElement("div");e.arrow&&t.setAttribute("class",e.arrow);const n=document.createElement("div");e.content&&n.setAttribute("class",e.content);const r=document.createElement("div");return e.container&&r.setAttribute("class",e.container),r.appendChild(t),r.appendChild(n),document.body.appendChild(r),{container:r,arrow:t,content:n}}(r);return a(e),()=>{document.body.removeChild(e.container),a(null)}}),[r]),(0,u.useEffect)((()=>{i&&Re(o.lastPageX,o.lastPageY,o.lastPlacement,o.lastElement,i)}),[i,o.lastPageX,o.lastPageY,o.lastPlacement,o.lastElement]),i?(0,N.createPortal)(n,i.content):null}));Oe.propTypes={children:b().node,theme:b().shape({}).isRequired},Oe.defaultProps={children:null};var Ae=Oe;const qe=e=>{let{children:t,placement:n,tip:r,theme:o}=e;const{current:i}=(0,u.useRef)({lastCursorX:0,lastCursorY:0,triggeredByTouch:!1,timerId:void 0}),a=(0,u.useRef)(),l=(0,u.useRef)(null),[c,s]=(0,u.useState)(!1);return(0,u.useEffect)((()=>{if(c&&null!==r){a.current&&a.current.pointTo(i.lastCursorX+window.scrollX,i.lastCursorY+window.scrollY,n,l.current);const e=()=>s(!1);return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)}}),[i.lastCursorX,i.lastCursorY,n,c,r]),(0,E.jsxs)("div",{className:o.wrapper,onMouseLeave:()=>s(!1),onMouseMove:e=>((e,t)=>{if(c){const r=l.current.getBoundingClientRect();e<r.left||e>r.right||t<r.top||t>r.bottom?s(!1):a.current&&a.current.pointTo(e+window.scrollX,t+window.scrollY,n,l.current)}else i.lastCursorX=e,i.lastCursorY=t,i.triggeredByTouch?i.timerId||(i.timerId=setTimeout((()=>{i.triggeredByTouch=!1,i.timerId=void 0,s(!0)}),300)):s(!0)})(e.clientX,e.clientY),onClick:()=>{i.timerId&&(clearTimeout(i.timerId),i.timerId=void 0,i.triggeredByTouch=!1)},onTouchStart:()=>{i.triggeredByTouch=!0},ref:l,role:"presentation",children:[c&&null!==r?(0,E.jsx)(Ae,{ref:a,theme:o,children:r}):null,t]})},Ne=t()(qe,"WithTooltip",["appearance","arrow","container","content","wrapper"],{arrow:"M9gywF",ad:"_4xT7zE",hoc:"zd-vnH",context:"GdZucr",container:"f9gY8K",appearance:"L4ubm-",wrapper:"_4qDBRM"}),Le=Ne;Le.PLACEMENTS=Pe,qe.propTypes={children:b().node,placement:b().oneOf(Object.values(Pe)),theme:Ne.themeType.isRequired,tip:b().node},qe.defaultProps={children:null,placement:Pe.ABOVE_CURSOR,tip:null};var De=Le,je=__webpack_require__(360),Me=__webpack_require__.n(je),Be={container:"jTxmOX",context:"dzIcLh",ad:"_5a9XX1",hoc:"_7sH52O"};const Ie=e=>{var t;let{autoplay:n,src:r,theme:o,title:i}=e;const a=r.split("?");let l=a[0];const c=a[1],s=c?Me().parse(c):{},u=s.v||(null===(t=l.match(/\/([a-zA-Z0-9-_]*)$/))||void 0===t?void 0:t[1]);return l=`https://www.youtube.com/embed/${u}`,delete s.v,s.autoplay=n?"1":"0",l+=`?${Me().stringify(s)}`,(0,E.jsxs)("div",{className:o.container,children:[(0,E.jsx)(Te,{theme:Be}),(0,E.jsx)("iframe",{allow:"autoplay",allowFullScreen:!0,className:o.video,src:l,title:i})]})},Ue=t()(Ie,"YouTubeVideo",["container","video"],{container:"sXHM81",context:"veKyYi",ad:"r3ABzd",hoc:"YKcPnR",video:"SlV2zw"});Ie.propTypes={autoplay:b().bool,src:b().string.isRequired,theme:Ue.themeType.isRequired,title:b().string},Ie.defaultProps={autoplay:!1,title:""};var We=Ue;const Ke=e=>{let{disabled:t,onChange:n,onKeyDown:r,placeholder:o,theme:i,value:a}=e;const l=(0,u.useRef)(null),[c,s]=(0,u.useState)(),[_,d]=(0,u.useState)(a||"");return void 0!==a&&_!==a&&d(a),(0,u.useEffect)((()=>{const e=l.current;if(!e)return;const t=new ResizeObserver((()=>{s(e.scrollHeight)}));return t.observe(e),()=>{t.disconnect()}}),[]),(0,u.useEffect)((()=>{const e=l.current;e&&s(e.scrollHeight)}),[_]),(0,E.jsxs)("div",{className:i.container,children:[(0,E.jsx)("textarea",{readOnly:!0,ref:l,className:`${i.textarea} ${i.hidden}`,value:_}),(0,E.jsx)("textarea",{disabled:t,onChange:void 0===a?e=>{d(e.target.value)}:n,onKeyDown:r,placeholder:o,style:{height:c},className:i.textarea,value:_})]})},Xe=t()(Ke,"TextArea",["container","hidden","textarea"],{container:"dzMVIB",context:"KVPc7g",ad:"z2GQ0Z",hoc:"_8R1Qdj",textarea:"zd-OFg",hidden:"GiHBXI"});Ke.propTypes={disabled:b().bool,onChange:b().func,onKeyDown:b().func,placeholder:b().string,theme:Xe.themeType.isRequired,value:b().string},Ke.defaultProps={disabled:!1,onChange:void 0,onKeyDown:void 0,placeholder:"",value:void 0};var Ye=Xe;const Fe=r.requireWeak("./server","/"),$e=Fe?void 0:__webpack_require__(662).A}(),__webpack_exports__}()}));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@dr.pogodin/js-utils"),require("@dr.pogodin/react-global-state"),require("@dr.pogodin/react-themes"),require("axios"),require("dayjs"),require("lodash"),require("node-forge/lib/aes"),require("node-forge/lib/forge"),require("prop-types"),require("qs"),require("react"),require("react-dom"),require("react-dom/client"),require("react-helmet"),require("react-router-dom")):"function"==typeof define&&define.amd?define(["@dr.pogodin/js-utils","@dr.pogodin/react-global-state","@dr.pogodin/react-themes","axios","dayjs","lodash","node-forge/lib/aes","node-forge/lib/forge","prop-types","qs","react","react-dom","react-dom/client","react-helmet","react-router-dom"],t):"object"==typeof exports?exports["@dr.pogodin/react-utils"]=t(require("@dr.pogodin/js-utils"),require("@dr.pogodin/react-global-state"),require("@dr.pogodin/react-themes"),require("axios"),require("dayjs"),require("lodash"),require("node-forge/lib/aes"),require("node-forge/lib/forge"),require("prop-types"),require("qs"),require("react"),require("react-dom"),require("react-dom/client"),require("react-helmet"),require("react-router-dom")):e["@dr.pogodin/react-utils"]=t(e["@dr.pogodin/js-utils"],e["@dr.pogodin/react-global-state"],e["@dr.pogodin/react-themes"],e.axios,e.dayjs,e.lodash,e["node-forge/lib/aes"],e["node-forge/lib/forge"],e["prop-types"],e.qs,e.react,e["react-dom"],e["react-dom/client"],e["react-helmet"],e["react-router-dom"])}("undefined"!=typeof self?self:this,(function(__WEBPACK_EXTERNAL_MODULE__864__,__WEBPACK_EXTERNAL_MODULE__126__,__WEBPACK_EXTERNAL_MODULE__859__,__WEBPACK_EXTERNAL_MODULE__742__,__WEBPACK_EXTERNAL_MODULE__185__,__WEBPACK_EXTERNAL_MODULE__773__,__WEBPACK_EXTERNAL_MODULE__958__,__WEBPACK_EXTERNAL_MODULE__814__,__WEBPACK_EXTERNAL_MODULE__949__,__WEBPACK_EXTERNAL_MODULE__360__,__WEBPACK_EXTERNAL_MODULE__155__,__WEBPACK_EXTERNAL_MODULE__514__,__WEBPACK_EXTERNAL_MODULE__236__,__WEBPACK_EXTERNAL_MODULE__883__,__WEBPACK_EXTERNAL_MODULE__442__){return function(){"use strict";var __webpack_modules__={227:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{A:function(){return getInj}});var node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(814),node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0__),node_forge_lib_aes__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(958),node_forge_lib_aes__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(node_forge_lib_aes__WEBPACK_IMPORTED_MODULE_1__),_shared_utils_isomorphy_buildInfo__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(445);let inj={};const metaElement="undefined"!=typeof document?document.querySelector('meta[itemprop="drpruinj"]'):null;if(metaElement){metaElement.remove();let data=node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().util.decode64(metaElement.content);const{key:key}=(0,_shared_utils_isomorphy_buildInfo__WEBPACK_IMPORTED_MODULE_2__.F)(),d=node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().cipher.createDecipher("AES-CBC",key);d.start({iv:data.slice(0,key.length)}),d.update(node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().util.createBuffer(data.slice(key.length))),d.finish(),data=node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().util.decodeUtf8(d.output.data),inj=eval(`(${data})`)}else inj={};function getInj(){return inj}},662:function(e,t,n){n.d(t,{A:function(){return c}}),n(155);var r=n(126),o=n(236),i=n(442),a=n(227),l=n(848);function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=document.getElementById("react-view");if(!n)throw Error("Failed to find container for React app");const c=(0,l.jsx)(r.GlobalStateProvider,{initialState:(0,a.A)().ISTATE||t.initialState,children:(0,l.jsx)(i.BrowserRouter,{future:{v7_relativeSplatPath:!0},children:(0,l.jsx)(e,{})})});t.dontHydrate?(0,o.createRoot)(n).render(c):(0,o.hydrateRoot)(n,c)}},445:function(e,t,n){let r;function o(){if(void 0===r)throw Error('"Build Info" has not been initialized yet');return r}n.d(t,{F:function(){return o}}),"undefined"!=typeof BUILD_INFO&&(r=BUILD_INFO)},965:function(e,t,n){n.d(t,{B:function(){return r},p:function(){return o}});const r="object"!=typeof process||!process.versions||!process.versions.node||!!n.g.REACT_UTILS_FORCE_CLIENT_SIDE,o=!r},333:function(e,t,n){n.r(t),n.d(t,{IS_CLIENT_SIDE:function(){return o.B},IS_SERVER_SIDE:function(){return o.p},buildTimestamp:function(){return l},getBuildInfo:function(){return r.F},isDevBuild:function(){return i},isProdBuild:function(){return a}});var r=n(445),o=n(965);function i(){return!1}function a(){return!0}function l(){return(0,r.F)().timestamp}},969:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{requireWeak:function(){return requireWeak},resolveWeak:function(){return resolveWeak}});var _isomorphy__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(333);function requireWeak(modulePath,basePath){if(_isomorphy__WEBPACK_IMPORTED_MODULE_0__.IS_CLIENT_SIDE)return null;try{const{resolve:resolve}=eval("require")("path"),path=basePath?resolve(basePath,modulePath):modulePath,{default:def,...named}=eval("require")(path);return def?(Object.entries(named).forEach((e=>{let[t,n]=e;if(def[t]){if(def[t]!==n)throw Error("Conflict between default and named exports")}else def[t]=n})),def):named}catch{return null}}function resolveWeak(e){return e}},427:function(e,t){t.parse=function(e,t){if("string"!=typeof e)throw new TypeError("argument str must be a string");for(var n={},r=(t||{}).decode||o,i=0;i<e.length;){var l=e.indexOf("=",i);if(-1===l)break;var c=e.indexOf(";",i);if(-1===c)c=e.length;else if(c<l){i=e.lastIndexOf(";",l-1)+1;continue}var s=e.slice(i,l).trim();if(void 0===n[s]){var u=e.slice(l+1,c).trim();34===u.charCodeAt(0)&&(u=u.slice(1,-1)),n[s]=a(u,r)}i=c+1}return n},t.serialize=function(e,t,o){var a=o||{},l=a.encode||i;if("function"!=typeof l)throw new TypeError("option encode is invalid");if(!r.test(e))throw new TypeError("argument name is invalid");var c=l(t);if(c&&!r.test(c))throw new TypeError("argument val is invalid");var s=e+"="+c;if(null!=a.maxAge){var u=a.maxAge-0;if(isNaN(u)||!isFinite(u))throw new TypeError("option maxAge is invalid");s+="; Max-Age="+Math.floor(u)}if(a.domain){if(!r.test(a.domain))throw new TypeError("option domain is invalid");s+="; Domain="+a.domain}if(a.path){if(!r.test(a.path))throw new TypeError("option path is invalid");s+="; Path="+a.path}if(a.expires){var _=a.expires;if(!function(e){return"[object Date]"===n.call(e)||e instanceof Date}(_)||isNaN(_.valueOf()))throw new TypeError("option expires is invalid");s+="; Expires="+_.toUTCString()}if(a.httpOnly&&(s+="; HttpOnly"),a.secure&&(s+="; Secure"),a.partitioned&&(s+="; Partitioned"),a.priority)switch("string"==typeof a.priority?a.priority.toLowerCase():a.priority){case"low":s+="; Priority=Low";break;case"medium":s+="; Priority=Medium";break;case"high":s+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}if(a.sameSite)switch("string"==typeof a.sameSite?a.sameSite.toLowerCase():a.sameSite){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return s};var n=Object.prototype.toString,r=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function o(e){return-1!==e.indexOf("%")?decodeURIComponent(e):e}function i(e){return encodeURIComponent(e)}function a(e,t){try{return t(e)}catch(t){return e}}},20:function(e,t,n){var r=n(155),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,l=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,n){var r,i={},s=null,u=null;for(r in void 0!==n&&(s=""+n),void 0!==t.key&&(s=""+t.key),void 0!==t.ref&&(u=t.ref),t)a.call(t,r)&&!c.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===i[r]&&(i[r]=t[r]);return{$$typeof:o,type:e,key:s,ref:u,props:i,_owner:l.current}}t.Fragment=i,t.jsx=s,t.jsxs=s},848:function(e,t,n){e.exports=n(20)},864:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__864__},126:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__126__},859:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__859__},742:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__742__},185:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__185__},773:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__773__},958:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__958__},814:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__814__},949:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__949__},360:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__360__},155:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__155__},514:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__514__},236:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__236__},883:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__883__},442:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__442__}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__webpack_require__),n.exports}__webpack_require__.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=function(e,t){for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};return function(){__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Barrier:function(){return _.Barrier},BaseModal:function(){return j},Button:function(){return ce},Checkbox:function(){return _e},CustomDropdown:function(){return G},Dropdown:function(){return Q},Emitter:function(){return _.Emitter},GlobalStateProvider:function(){return d.GlobalStateProvider},Input:function(){return fe},JU:function(){return R},Link:function(){return ie},MetaTags:function(){return ge},Modal:function(){return B},NavLink:function(){return ye},PT:function(){return m},PageLayout:function(){return be},Semaphore:function(){return _.Semaphore},Switch:function(){return te},TextArea:function(){return Ye},ThemeProvider:function(){return e.ThemeProvider},Throbber:function(){return Te},WithTooltip:function(){return De},YouTubeVideo:function(){return We},api:function(){return A()},client:function(){return $e},config:function(){return i},getGlobalState:function(){return d.getGlobalState},getSsrContext:function(){return p},isomorphy:function(){return a},newAsyncDataEnvelope:function(){return d.newAsyncDataEnvelope},optionValidator:function(){return U},optionsValidator:function(){return W},server:function(){return Fe},splitComponent:function(){return P},themed:function(){return k},time:function(){return h},useAsyncCollection:function(){return d.useAsyncCollection},useAsyncData:function(){return d.useAsyncData},useGlobalState:function(){return d.useGlobalState},webpack:function(){return r},withGlobalStateType:function(){return d.withGlobalStateType},withRetries:function(){return _.withRetries}});var e=__webpack_require__(859),t=__webpack_require__.n(e),n=__webpack_require__(965),r=__webpack_require__(969);const o=(n.B?__webpack_require__(227).A().CONFIG:(0,r.requireWeak)("config"))||{};if(n.B&&"undefined"!=typeof document){const e=__webpack_require__(427);o.CSRF=e.parse(document.cookie).csrfToken}var i=o,a=__webpack_require__(333),l=__webpack_require__(427),c=__webpack_require__(185),s=__webpack_require__.n(c),u=__webpack_require__(155),_=__webpack_require__(864),d=__webpack_require__(126);const{getSsrContext:p}=(0,d.withGlobalStateType)(),f={DAY_MS:_.DAY_MS,HOUR_MS:_.HOUR_MS,MIN_MS:_.MIN_MS,SEC_MS:_.SEC_MS,YEAR_MS:_.YEAR_MS,now:Date.now,timer:_.timer,useCurrent:function(){let{autorefresh:e=!1,globalStatePath:t="currentTime",precision:n=5*_.SEC_MS}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[r,o]=(0,d.useGlobalState)(t,Date.now);return(0,u.useEffect)((()=>{let t;const r=()=>{o((e=>{const t=Date.now();return Math.abs(t-e)>n?t:e})),e&&(t=setTimeout(r,n))};return r(),()=>{t&&clearTimeout(t)}}),[e,n,o]),r},useTimezoneOffset:function(){let{cookieName:e="timezoneOffset",globalStatePath:t="timezoneOffset"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=p(!1),[r,o]=(0,d.useGlobalState)(t,(()=>{var t;const r=e&&(null==n||null===(t=n.req)||void 0===t||null===(t=t.cookies)||void 0===t?void 0:t[e]);return r?parseInt(r,10):0}));return(0,u.useEffect)((()=>{const t=(new Date).getTimezoneOffset();o(t),e&&(document.cookie=l.serialize(e,t.toString(),{path:"/"}))}),[e,o]),r}};var h=Object.assign(s(),f),m=__webpack_require__(949),b=__webpack_require__.n(m),E=__webpack_require__(848);let v;a.IS_CLIENT_SIDE&&(v=__webpack_require__(227).A().CHUNK_GROUPS||{});const w={};function g(){return(0,a.getBuildInfo)().publicPath}function y(e,t,n){let r;const o=`${g()}/${e}`,i=`${document.location.origin}${o}`;if(!t.has(i)){let e=document.querySelector(`link[href="${o}"]`);e||(e=document.createElement("link"),e.setAttribute("rel","stylesheet"),e.setAttribute("href",o),document.head.appendChild(e)),r=new _.Barrier,e.addEventListener("load",(()=>r.resolve())),e.addEventListener("error",(()=>r.resolve()))}if(n){const e=w[o]||0;w[o]=1+e}return r}function x(e,t){if(!t[e])throw Error(`Unknown chunk name "${e}"`)}function C(e,t,n){const r=[],o=t[e],i=function(){const e=new Set,{styleSheets:t}=document;for(let n=0;n<t.length;++n){const{href:r}=t[n];r&&e.add(r)}return e}();for(let e=0;e<o.length;++e){const t=o[e];if(t.endsWith(".css")){const e=y(t,i,n);e&&r.push(e)}}return r.length?Promise.allSettled(r).then():Promise.resolve()}const T=new Set;function P(e){let{chunkName:t,getComponent:n,placeholder:r}=e;if(a.IS_CLIENT_SIDE&&x(t,v),T.has(t))throw Error(`Repeated splitComponent() call for the chunk "${t}"`);T.add(t);const o=(0,u.lazy)((async()=>{const e=await n(),r="default"in e?e.default:e;a.IS_CLIENT_SIDE&&await C(t,v,!1);const o=(0,u.forwardRef)(((e,n)=>{let{children:o,...i}=e;if(a.IS_SERVER_SIDE){const{chunkGroups:e,chunks:n}=p();x(t,e),n.includes(t)||n.push(t)}return(0,u.useInsertionEffect)((()=>(C(t,v,!0),()=>function(e,t){const n=t[e];for(let e=0;e<n.length;++e){const t=n[e];if(t.endsWith(".css")){const e=`${g()}/${t}`;--w[e]<=0&&document.head.querySelector(`link[href="${e}"]`).remove()}}}(t,v))),[]),(0,E.jsx)(r,{ref:n,...i,children:o})}));return{default:o}})),i=e=>{let{children:t,...n}=e;return(0,E.jsx)(u.Suspense,{fallback:r,children:(0,E.jsx)(o,{...n,children:t})})};return i.propTypes={children:b().node},i.defaultProps={children:void 0},i}const k=t();let S;k.COMPOSE=e.COMPOSE,k.PRIORITY=e.PRIORITY;try{S=process.env.NODE_CONFIG_ENV}catch{}const R="production"!==(S||"production")?r.requireWeak("./jest","/"):null;var O=__webpack_require__(742),A=__webpack_require__.n(O),q=__webpack_require__(773),N=__webpack_require__(514),L=__webpack_require__.n(N),D="_5fRFtF";const j=e=>{let{cancelOnScrolling:t,children:n,containerStyle:r,dontDisableScrolling:o,onCancel:i,theme:a}=e;const l=(0,u.useRef)(null),c=(0,u.useRef)(null),[s,_]=(0,u.useState)();(0,u.useEffect)((()=>{const e=document.createElement("div");return document.body.appendChild(e),_(e),()=>{document.body.removeChild(e)}}),[]),(0,u.useEffect)((()=>(t&&i&&(window.addEventListener("scroll",i),window.addEventListener("wheel",i)),()=>{t&&i&&(window.removeEventListener("scroll",i),window.removeEventListener("wheel",i))})),[t,i]),(0,u.useEffect)((()=>(o||document.body.classList.add(D),()=>{o||document.body.classList.remove(D)})),[o]);const d=(0,u.useMemo)((()=>(0,E.jsx)("div",{onFocus:()=>{var e,t;const n=null===(e=l.current)||void 0===e?void 0:e.querySelectorAll("*");for(let e=n.length-1;e>=0;--e)if(n[e].focus(),document.activeElement===n[e])return;null===(t=c.current)||void 0===t||t.focus()},tabIndex:0})),[]);return s?L().createPortal((0,E.jsxs)(E.Fragment,{children:[d,(0,E.jsx)("div",{"aria-label":"Cancel",className:a.overlay,onClick:e=>{i&&(i(),e.stopPropagation())},onKeyDown:e=>{"Escape"===e.key&&i&&(i(),e.stopPropagation())},ref:e=>{e&&e!==c.current&&(c.current=e,e.focus())},role:"button",tabIndex:0}),(0,E.jsx)("div",{"aria-modal":"true",className:a.container,onClick:e=>e.stopPropagation(),onWheel:e=>e.stopPropagation(),ref:l,role:"dialog",style:r,children:n}),(0,E.jsx)("div",{onFocus:()=>{var e;null===(e=c.current)||void 0===e||e.focus()},tabIndex:0}),d]}),s):null},M=t()(j,"Modal",["container","overlay"],{overlay:"ye2BZo",context:"Szmbbz",ad:"Ah-Nsc",hoc:"Wki41G",container:"gyZ4rc"});j.propTypes={cancelOnScrolling:b().bool,children:b().node,containerStyle:b().shape({}),dontDisableScrolling:b().bool,onCancel:b().func,theme:M.themeType.isRequired},j.defaultProps={cancelOnScrolling:!1,children:null,containerStyle:void 0,dontDisableScrolling:!1,onCancel:q.noop};var B=M;const I=["active","arrow","container","dropdown","hiddenOption","label","option","select","upward"],U=b().oneOfType([b().shape({name:b().node,value:b().string.isRequired}).isRequired,b().string.isRequired]),W=b().arrayOf(U.isRequired),K=b().oneOfType([b().shape({name:b().string,value:b().string.isRequired}).isRequired,b().string.isRequired]),X=b().arrayOf(K.isRequired);function Y(e){var t;return"string"==typeof e?[e,e]:[e.value,null!==(t=e.name)&&void 0!==t?t:e.value]}const F=(0,u.forwardRef)(((e,t)=>{let{containerClass:n,containerStyle:r,filter:o,onCancel:i,onChange:a,optionClass:l,options:c}=e;const s=(0,u.useRef)(null);(0,u.useImperativeHandle)(t,(()=>({measure:()=>{var e,t;const n=null===(e=s.current)||void 0===e?void 0:e.parentElement;if(!n)return;const r=null===(t=s.current)||void 0===t?void 0:t.getBoundingClientRect(),o=window.getComputedStyle(n),i=parseFloat(o.marginBottom),a=parseFloat(o.marginTop);return r.height+=i+a,r}})),[]);const _=[];for(let e=0;e<c.length;++e){const t=c[e];if(!o||o(t)){const[e,n]=Y(t);_.push((0,E.jsx)("div",{className:l,onClick:t=>{a(e),t.stopPropagation()},onKeyDown:t=>{"Enter"===t.key&&(a(e),t.stopPropagation())},role:"button",tabIndex:0,children:n},e))}}return(0,E.jsx)(j,{cancelOnScrolling:!0,containerStyle:r,dontDisableScrolling:!0,onCancel:i,theme:{ad:"",hoc:"",container:n,context:"",overlay:"jKsMKG"},children:(0,E.jsx)("div",{ref:s,children:_})})}));F.propTypes={containerClass:b().string.isRequired,containerStyle:b().shape({left:b().number.isRequired,top:b().number.isRequired,width:b().number.isRequired}),filter:b().func,onCancel:b().func.isRequired,onChange:b().func.isRequired,optionClass:b().string.isRequired,options:W.isRequired},F.defaultProps={containerStyle:void 0,filter:void 0};var $=F;const z=e=>{let{filter:t,label:n,onChange:r,options:o,theme:i,value:a}=e;if(!o)throw Error("Internal error");const[l,c]=(0,u.useState)(!1),s=(0,u.useRef)(null),_=(0,u.useRef)(null),[d,p]=(0,u.useState)(),[f,h]=(0,u.useState)(!1);(0,u.useEffect)((()=>{if(!l)return;let e;const t=()=>{var n,r;const o=null===(n=s.current)||void 0===n?void 0:n.getBoundingClientRect(),i=null===(r=_.current)||void 0===r?void 0:r.measure();if(o&&i){var a,l;const e=o.bottom+i.height<(null!==(a=null===(l=window.visualViewport)||void 0===l?void 0:l.height)&&void 0!==a?a:0),t=o.top-i.height>0,n=!e&&t;h(n);const r=n?{top:o.top-i.height-1,left:o.left,width:o.width}:{left:o.left,top:o.bottom,width:o.width};p((e=>{return n=r,(null==(t=e)?void 0:t.left)===(null==n?void 0:n.left)&&(null==t?void 0:t.top)===(null==n?void 0:n.top)&&(null==t?void 0:t.width)===(null==n?void 0:n.width)?e:r;var t,n}))}e=requestAnimationFrame(t)};return requestAnimationFrame(t),()=>{cancelAnimationFrame(e)}}),[l]);const m=e=>{const t=window.visualViewport,n=s.current.getBoundingClientRect();c(!0),p({left:(null==t?void 0:t.width)||0,top:(null==t?void 0:t.height)||0,width:n.width}),e.stopPropagation()};let b=(0,E.jsx)(E.Fragment,{children:"‌"});for(let e=0;e<o.length;++e){const n=o[e];if(!t||t(n)){const[e,t]=Y(n);if(e===a){b=t;break}}}let v=i.container;l&&(v+=` ${i.active}`);let w=i.select||"";return f&&(v+=` ${i.upward}`,w+=` ${i.upward}`),(0,E.jsxs)("div",{className:v,children:[void 0===n?null:(0,E.jsx)("div",{className:i.label,children:n}),(0,E.jsxs)("div",{className:i.dropdown,onClick:m,onKeyDown:e=>{"Enter"===e.key&&m(e)},ref:s,role:"listbox",tabIndex:0,children:[b,(0,E.jsx)("div",{className:i.arrow})]}),l?(0,E.jsx)($,{containerClass:w,containerStyle:d,onCancel:()=>{c(!1)},onChange:e=>{c(!1),r&&r(e)},optionClass:i.option||"",options:o,ref:_}):null]})},H=t()(z,"CustomDropdown",I,{container:"oQKv0Y",context:"_9Tod5r",ad:"R58zIg",hoc:"O-Tp1i",label:"YUPUNs",dropdown:"pNEyAA",option:"LD2Kzy",select:"LP5azC",arrow:"-wscve",active:"k2UDsV",upward:"HWRvu4"});z.propTypes={filter:b().func,label:b().node,onChange:b().func,options:b().arrayOf(U.isRequired),theme:H.themeType.isRequired,value:b().string},z.defaultProps={filter:void 0,label:void 0,onChange:void 0,options:[],value:void 0};var G=H;const V=e=>{let{filter:t,label:n,onChange:r,options:o,theme:i,value:a}=e;if(!o)throw Error("Internal error");let l=!1;const c=[];for(let e=0;e<o.length;++e){const n=o[e];if(!t||t(n)){const[e,t]=Y(n);l||(l=e===a),c.push((0,E.jsx)("option",{className:i.option,value:e,children:t},e))}}const s=l?null:(0,E.jsx)("option",{disabled:!0,className:i.hiddenOption,value:a,children:a},"__reactUtilsHiddenOption");return(0,E.jsxs)("div",{className:i.container,children:[void 0===n?null:(0,E.jsx)("div",{className:i.label,children:n}),(0,E.jsxs)("div",{className:i.dropdown,children:[(0,E.jsxs)("select",{className:i.select,onChange:r,value:a,children:[s,c]}),(0,E.jsx)("div",{className:i.arrow})]})]})},Z=t()(V,"Dropdown",I,{dropdown:"kI9A9U",context:"xHyZo4",ad:"ADu59e",hoc:"FTP2bb",arrow:"DubGkT",container:"WtSZPd",active:"ayMn7O",label:"K7JYKw",hiddenOption:"clAKFJ",select:"N0Fc14"});V.propTypes={filter:b().func,label:b().node,onChange:b().func,options:X,theme:Z.themeType.isRequired,value:b().string},V.defaultProps={filter:void 0,label:void 0,onChange:void 0,options:[],value:""};var Q=Z;const J=e=>{let{label:t,onChange:n,options:r,theme:o,value:i}=e;if(!r||!o.option)throw Error("Internal error");const a=[];for(let e=0;e<(null==r?void 0:r.length);++e){const[t,l]=Y(r[e]);let c,s=o.option;t===i?s+=` ${o.selected}`:n&&(c=()=>n(t)),a.push(c?(0,E.jsx)("div",{className:s,onClick:c,onKeyDown:e=>{c&&"Enter"===e.key&&c()},role:"button",tabIndex:0,children:l},t):(0,E.jsx)("div",{className:s,children:l},t))}return(0,E.jsxs)("div",{className:o.container,children:[t?(0,E.jsx)("div",{className:o.label,children:t}):null,(0,E.jsx)("div",{className:o.options,children:a})]})},ee=t()(J,"Switch",["container","label","option","options","selected"],{container:"AWNvRj",context:"VMHfnP",ad:"HNliRC",hoc:"_2Ue-db",option:"fUfIAd",selected:"Wco-qk",options:"CZYtcC"});J.propTypes={label:b().node,onChange:b().func,options:W,theme:ee.themeType.isRequired,value:b().string},J.defaultProps={label:void 0,onChange:void 0,options:[],value:void 0};var te=ee,ne=__webpack_require__(442);const re=e=>{let{children:t,className:n,disabled:r,enforceA:o,keepScrollPosition:i,onClick:a,onMouseDown:l,openNewTab:c,replace:s,routerLinkType:u,to:_,...d}=e;if(r||o||c||null!=_&&_.match(/^(#|(https?|mailto):)/))return(0,E.jsx)("a",{className:(n?n+" ":"")+"zH52sA",href:_,onClick:r?e=>e.preventDefault():a,onMouseDown:r?e=>e.preventDefault():l,rel:"noopener noreferrer",target:c?"_blank":"",children:t});const p=u;return(0,E.jsx)(p,{className:n,onMouseDown:l,replace:s,to:_,onClick:e=>{a&&a(e),i||window.scroll(0,0)},...d,children:t})};re.defaultProps={children:null,className:"",disabled:!1,enforceA:!1,keepScrollPosition:!1,onClick:void 0,onMouseDown:void 0,openNewTab:!1,replace:!1,to:""},re.propTypes={children:b().node,className:b().string,disabled:b().bool,enforceA:b().bool,keepScrollPosition:b().bool,onClick:b().func,onMouseDown:b().func,openNewTab:b().bool,replace:b().bool,routerLinkType:b().elementType.isRequired,to:b().oneOfType([b().object,b().string])};var oe=re,ie=e=>(0,E.jsx)(oe,{...e,routerLinkType:ne.Link});const ae=e=>{let{active:t,children:n,disabled:r,enforceA:o,onClick:i,onMouseDown:a,openNewTab:l,replace:c,theme:s,to:u}=e,_=s.button;return t&&s.active&&(_+=` ${s.active}`),r?(s.disabled&&(_+=` ${s.disabled}`),(0,E.jsx)("div",{className:_,children:n})):u?(0,E.jsx)(ie,{className:_,enforceA:o,onClick:i,onMouseDown:a,openNewTab:l,replace:c,to:u,children:n}):(0,E.jsx)("div",{className:_,onClick:i,onKeyDown:i&&(e=>{"Enter"===e.key&&i(e)}),onMouseDown:a,role:"button",tabIndex:0,children:n})},le=t()(ae,"Button",["active","button","disabled"],{button:"E1FNQT",context:"KM0v4f",ad:"_3jm1-Q",hoc:"_0plpDL",active:"MAe9O6",disabled:"Br9IWV"});ae.defaultProps={active:!1,children:void 0,disabled:!1,enforceA:!1,onClick:void 0,onMouseDown:void 0,openNewTab:!1,replace:!1,to:void 0},ae.propTypes={active:b().bool,children:b().node,disabled:b().bool,enforceA:b().bool,onClick:b().func,onMouseDown:b().func,openNewTab:b().bool,replace:b().bool,theme:le.themeType.isRequired,to:b().oneOfType([b().object,b().string])};var ce=le;const se=e=>{let{checked:t,label:n,onChange:r,theme:o}=e;return(0,E.jsxs)("div",{className:o.container,children:[void 0===n?null:(0,E.jsx)("div",{className:o.label,children:n}),(0,E.jsx)("input",{checked:t,className:o.checkbox,onChange:r,onClick:e=>e.stopPropagation(),type:"checkbox"})]})},ue=t()(se,"Checkbox",["checkbox","container","label"],{checkbox:"A-f8qJ",context:"dNQcC6",ad:"earXxa",hoc:"qAPfQ6",container:"Kr0g3M",label:"_3dML-O"});se.propTypes={checked:b().bool,label:b().node,onChange:b().func,theme:ue.themeType.isRequired},se.defaultProps={checked:void 0,label:void 0,onChange:void 0};var _e=ue;const de=(0,u.forwardRef)(((e,t)=>{let{label:n,theme:r,...o}=e;return(0,E.jsxs)("span",{className:r.container,children:[void 0===n?null:(0,E.jsx)("div",{className:r.label,children:n}),(0,E.jsx)("input",{className:r.input,ref:t,...o})]})})),pe=t()(de,"Input",["container","input","label"],{container:"Cxx397",context:"X5WszA",ad:"_8s7GCr",hoc:"TVlBYc",input:"M07d4s",label:"gfbdq-"});de.propTypes={label:b().node,theme:pe.themeType.isRequired},de.defaultProps={label:void 0};var fe=pe;const he=e=>{let{children:t,leftSidePanelContent:n,rightSidePanelContent:r,theme:o}=e;return(0,E.jsxs)("div",{className:o.container,children:[(0,E.jsx)("div",{className:[o.sidePanel,o.leftSidePanel].join(" "),children:n}),(0,E.jsx)("div",{className:o.mainPanel,children:t}),(0,E.jsx)("div",{className:[o.sidePanel,o.rightSidePanel].join(" "),children:r})]})},me=t()(he,"PageLayout",["container","leftSidePanel","mainPanel","rightSidePanel","sidePanel"],{container:"T3cuHB",context:"m4mL-M",ad:"m3-mdC",hoc:"J15Z4H",mainPanel:"pPlQO2",sidePanel:"lqNh4h"});he.propTypes={children:b().node,leftSidePanelContent:b().node,rightSidePanelContent:b().node,theme:me.themeType.isRequired},he.defaultProps={children:null,leftSidePanelContent:null,rightSidePanelContent:null};var be=me,Ee=__webpack_require__(883);const ve=(0,u.createContext)({description:"",title:""}),we=e=>{let{children:t,description:n,image:r,siteName:o,socialDescription:i,socialTitle:a,title:l,url:c}=e;const s=a||l,_=i||n,d=(0,u.useMemo)((()=>({description:n,image:r,siteName:o,socialDescription:i,socialTitle:a,title:l,url:c})),[n,r,o,i,a,l,c]);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(Ee.Helmet,{children:[(0,E.jsx)("title",{children:l}),(0,E.jsx)("meta",{name:"description",content:n}),(0,E.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,E.jsx)("meta",{name:"twitter:title",content:s}),(0,E.jsx)("meta",{name:"twitter:description",content:_}),r?(0,E.jsx)("meta",{name:"twitter:image",content:r}):null,o?(0,E.jsx)("meta",{name:"twitter:site",content:`@${o}`}):null,(0,E.jsx)("meta",{name:"og:title",content:s}),r?(0,E.jsx)("meta",{name:"og:image",content:r}):null,r?(0,E.jsx)("meta",{name:"og:image:alt",content:s}):null,(0,E.jsx)("meta",{name:"og:description",content:_}),o?(0,E.jsx)("meta",{name:"og:sitename",content:o}):null,c?(0,E.jsx)("meta",{name:"og:url",content:c}):null]}),t?(0,E.jsx)(ve.Provider,{value:d,children:t}):null]})};we.Context=ve,we.defaultProps={children:null,image:"",siteName:"",socialDescription:"",socialTitle:"",url:""},we.propTypes={children:b().node,description:b().string.isRequired,image:b().string,siteName:b().string,socialDescription:b().string,socialTitle:b().string,title:b().string.isRequired,url:b().string};var ge=we,ye=e=>(0,E.jsx)(oe,{...e,routerLinkType:ne.NavLink});const xe=e=>{let{theme:t}=e;return(0,E.jsxs)("span",{className:t.container,children:[(0,E.jsx)("span",{className:t.circle}),(0,E.jsx)("span",{className:t.circle}),(0,E.jsx)("span",{className:t.circle})]})},Ce=t()(xe,"Throbber",["bouncing","circle","container"],{container:"_7zdld4",context:"uIObt7",ad:"XIxe9o",hoc:"YOyORH",circle:"dBrB4g",bouncing:"TJe-6j"});xe.propTypes={theme:Ce.themeType.isRequired};var Te=Ce;let Pe=function(e){return e.ABOVE_CURSOR="ABOVE_CURSOR",e.ABOVE_ELEMENT="ABOVE_ELEMENT",e.BELOW_CURSOR="BELOW_CURSOR",e.BELOW_ELEMENT="BELOW_ELEMENT",e}({});const ke=["border-bottom-color:transparent","border-left-color:transparent","border-right-color:transparent"].join(";"),Se=["border-top-color:transparent","border-left-color:transparent","border-right-color:transparent"].join(";");function Re(e,t,n,r,o){const i=function(e){return{arrow:e.arrow.getBoundingClientRect(),container:e.container.getBoundingClientRect()}}(o),a=function(){const{scrollX:e,scrollY:t}=window,{documentElement:{clientHeight:n,clientWidth:r}}=document;return{left:e,right:e+r,top:t,bottom:t+n}}(),l=function(e,t,n){const{arrow:r,container:o}=n;return{arrowX:.5*(o.width-r.width),arrowY:o.height,containerX:e-o.width/2,containerY:t-o.height-r.height/1.5,baseArrowStyle:ke}}(e,t,i);if(l.containerX<a.left+6)l.containerX=a.left+6,l.arrowX=Math.max(6,e-l.containerX-i.arrow.width/2);else{const t=a.right-6-i.container.width;l.containerX>t&&(l.containerX=t,l.arrowX=Math.min(i.container.width-6,e-l.containerX-i.arrow.width/2))}l.containerY<a.top+6&&(l.containerY+=i.container.height+2*i.arrow.height,l.arrowY-=i.container.height+i.arrow.height,l.baseArrowStyle=Se);const c=`left:${l.containerX}px;top:${l.containerY}px`;o.container.setAttribute("style",c);const s=`${l.baseArrowStyle};left:${l.arrowX}px;top:${l.arrowY}px`;o.arrow.setAttribute("style",s)}const Oe=(0,u.forwardRef)(((e,t)=>{let{children:n,theme:r}=e;const{current:o}=(0,u.useRef)({lastElement:void 0,lastPageX:0,lastPageY:0,lastPlacement:void 0}),[i,a]=(0,u.useState)(null),l=(e,t,n,r)=>{o.lastElement=r,o.lastPageX=e,o.lastPageY=t,o.lastPlacement=n,i&&Re(e,t,0,0,i)};return(0,u.useImperativeHandle)(t,(()=>({pointTo:l}))),(0,u.useEffect)((()=>{const e=function(e){const t=document.createElement("div");e.arrow&&t.setAttribute("class",e.arrow);const n=document.createElement("div");e.content&&n.setAttribute("class",e.content);const r=document.createElement("div");return e.container&&r.setAttribute("class",e.container),r.appendChild(t),r.appendChild(n),document.body.appendChild(r),{container:r,arrow:t,content:n}}(r);return a(e),()=>{document.body.removeChild(e.container),a(null)}}),[r]),(0,u.useEffect)((()=>{i&&Re(o.lastPageX,o.lastPageY,o.lastPlacement,o.lastElement,i)}),[i,o.lastPageX,o.lastPageY,o.lastPlacement,o.lastElement]),i?(0,N.createPortal)(n,i.content):null}));Oe.propTypes={children:b().node,theme:b().shape({}).isRequired},Oe.defaultProps={children:null};var Ae=Oe;const qe=e=>{let{children:t,placement:n,tip:r,theme:o}=e;const{current:i}=(0,u.useRef)({lastCursorX:0,lastCursorY:0,triggeredByTouch:!1,timerId:void 0}),a=(0,u.useRef)(),l=(0,u.useRef)(null),[c,s]=(0,u.useState)(!1);return(0,u.useEffect)((()=>{if(c&&null!==r){a.current&&a.current.pointTo(i.lastCursorX+window.scrollX,i.lastCursorY+window.scrollY,n,l.current);const e=()=>s(!1);return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)}}),[i.lastCursorX,i.lastCursorY,n,c,r]),(0,E.jsxs)("div",{className:o.wrapper,onMouseLeave:()=>s(!1),onMouseMove:e=>((e,t)=>{if(c){const r=l.current.getBoundingClientRect();e<r.left||e>r.right||t<r.top||t>r.bottom?s(!1):a.current&&a.current.pointTo(e+window.scrollX,t+window.scrollY,n,l.current)}else i.lastCursorX=e,i.lastCursorY=t,i.triggeredByTouch?i.timerId||(i.timerId=setTimeout((()=>{i.triggeredByTouch=!1,i.timerId=void 0,s(!0)}),300)):s(!0)})(e.clientX,e.clientY),onClick:()=>{i.timerId&&(clearTimeout(i.timerId),i.timerId=void 0,i.triggeredByTouch=!1)},onTouchStart:()=>{i.triggeredByTouch=!0},ref:l,role:"presentation",children:[c&&null!==r?(0,E.jsx)(Ae,{ref:a,theme:o,children:r}):null,t]})},Ne=t()(qe,"WithTooltip",["appearance","arrow","container","content","wrapper"],{arrow:"M9gywF",ad:"_4xT7zE",hoc:"zd-vnH",context:"GdZucr",container:"f9gY8K",appearance:"L4ubm-",wrapper:"_4qDBRM"}),Le=Ne;Le.PLACEMENTS=Pe,qe.propTypes={children:b().node,placement:b().oneOf(Object.values(Pe)),theme:Ne.themeType.isRequired,tip:b().node},qe.defaultProps={children:null,placement:Pe.ABOVE_CURSOR,tip:null};var De=Le,je=__webpack_require__(360),Me=__webpack_require__.n(je),Be={container:"jTxmOX",context:"dzIcLh",ad:"_5a9XX1",hoc:"_7sH52O"};const Ie=e=>{var t;let{autoplay:n,src:r,theme:o,title:i}=e;const a=r.split("?");let l=a[0];const c=a[1],s=c?Me().parse(c):{},u=s.v||(null===(t=l.match(/\/([a-zA-Z0-9-_]*)$/))||void 0===t?void 0:t[1]);return l=`https://www.youtube.com/embed/${u}`,delete s.v,s.autoplay=n?"1":"0",l+=`?${Me().stringify(s)}`,(0,E.jsxs)("div",{className:o.container,children:[(0,E.jsx)(Te,{theme:Be}),(0,E.jsx)("iframe",{allow:"autoplay",allowFullScreen:!0,className:o.video,src:l,title:i})]})},Ue=t()(Ie,"YouTubeVideo",["container","video"],{container:"sXHM81",context:"veKyYi",ad:"r3ABzd",hoc:"YKcPnR",video:"SlV2zw"});Ie.propTypes={autoplay:b().bool,src:b().string.isRequired,theme:Ue.themeType.isRequired,title:b().string},Ie.defaultProps={autoplay:!1,title:""};var We=Ue;const Ke=e=>{let{disabled:t,onChange:n,onKeyDown:r,placeholder:o,theme:i,value:a}=e;const l=(0,u.useRef)(null),[c,s]=(0,u.useState)(),[_,d]=(0,u.useState)(a||"");return void 0!==a&&_!==a&&d(a),(0,u.useEffect)((()=>{const e=l.current;if(!e)return;const t=new ResizeObserver((()=>{s(e.scrollHeight)}));return t.observe(e),()=>{t.disconnect()}}),[]),(0,u.useEffect)((()=>{const e=l.current;e&&s(e.scrollHeight)}),[_]),(0,E.jsxs)("div",{className:i.container,children:[(0,E.jsx)("textarea",{readOnly:!0,ref:l,className:`${i.textarea} ${i.hidden}`,value:_}),(0,E.jsx)("textarea",{disabled:t,onChange:void 0===a?e=>{d(e.target.value)}:n,onKeyDown:r,placeholder:o,style:{height:c},className:i.textarea,value:_})]})},Xe=t()(Ke,"TextArea",["container","hidden","textarea"],{container:"dzMVIB",context:"KVPc7g",ad:"z2GQ0Z",hoc:"_8R1Qdj",textarea:"zd-OFg",hidden:"GiHBXI"});Ke.propTypes={disabled:b().bool,onChange:b().func,onKeyDown:b().func,placeholder:b().string,theme:Xe.themeType.isRequired,value:b().string},Ke.defaultProps={disabled:!1,onChange:void 0,onKeyDown:void 0,placeholder:"",value:void 0};var Ye=Xe;const Fe=r.requireWeak("./server","/"),$e=Fe?void 0:__webpack_require__(662).A}(),__webpack_exports__}()}));
3
3
  //# sourceMappingURL=web.bundle.js.map