@dr.pogodin/react-utils 1.35.1 → 1.35.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.
Files changed (69) hide show
  1. package/build/development/client/getInj.js +10 -0
  2. package/build/development/client/getInj.js.map +1 -1
  3. package/build/development/client/index.js +9 -2
  4. package/build/development/client/index.js.map +1 -1
  5. package/build/development/index.js +9 -1
  6. package/build/development/index.js.map +1 -1
  7. package/build/development/server/index.js.map +1 -1
  8. package/build/development/server/renderer.js.map +1 -1
  9. package/build/development/server/server.js.map +1 -1
  10. package/build/development/shared/components/Button/index.js +2 -1
  11. package/build/development/shared/components/Button/index.js.map +1 -1
  12. package/build/development/shared/components/MetaTags.js.map +1 -1
  13. package/build/development/shared/components/TextArea/index.js.map +1 -1
  14. package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
  15. package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
  16. package/build/development/shared/components/index.js +8 -1
  17. package/build/development/shared/components/index.js.map +1 -1
  18. package/build/development/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  19. package/build/development/shared/components/selectors/Switch/index.js.map +1 -1
  20. package/build/development/shared/utils/index.js.map +1 -1
  21. package/build/development/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  22. package/build/development/shared/utils/jest/index.js +2 -1
  23. package/build/development/shared/utils/jest/index.js.map +1 -1
  24. package/build/development/shared/utils/splitComponent.js +16 -10
  25. package/build/development/shared/utils/splitComponent.js.map +1 -1
  26. package/build/development/web.bundle.js +6 -6
  27. package/build/production/client/getInj.js +6 -2
  28. package/build/production/client/getInj.js.map +1 -1
  29. package/build/production/client/index.js +1 -1
  30. package/build/production/client/index.js.map +1 -1
  31. package/build/production/index.js +4 -1
  32. package/build/production/index.js.map +1 -1
  33. package/build/production/server/index.js.map +1 -1
  34. package/build/production/server/renderer.js.map +1 -1
  35. package/build/production/server/server.js.map +1 -1
  36. package/build/production/shared/components/Button/index.js +2 -2
  37. package/build/production/shared/components/Button/index.js.map +1 -1
  38. package/build/production/shared/components/MetaTags.js.map +1 -1
  39. package/build/production/shared/components/TextArea/index.js.map +1 -1
  40. package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
  41. package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
  42. package/build/production/shared/components/index.js +1 -1
  43. package/build/production/shared/components/index.js.map +1 -1
  44. package/build/production/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  45. package/build/production/shared/components/selectors/Switch/index.js.map +1 -1
  46. package/build/production/shared/utils/index.js.map +1 -1
  47. package/build/production/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  48. package/build/production/shared/utils/jest/index.js +1 -1
  49. package/build/production/shared/utils/jest/index.js.map +1 -1
  50. package/build/production/shared/utils/splitComponent.js +9 -7
  51. package/build/production/shared/utils/splitComponent.js.map +1 -1
  52. package/build/production/web.bundle.js +1 -1
  53. package/build/production/web.bundle.js.map +1 -1
  54. package/build/types-code/client/getInj.d.ts +6 -0
  55. package/build/types-code/client/index.d.ts +2 -1
  56. package/build/types-code/index.d.ts +2 -2
  57. package/build/types-code/shared/components/Button/index.d.ts +1 -0
  58. package/build/types-code/shared/components/index.d.ts +1 -1
  59. package/build/types-code/shared/utils/index.d.ts +1 -1
  60. package/package.json +27 -28
  61. package/src/client/getInj.ts +9 -0
  62. package/src/client/index.tsx +3 -1
  63. package/src/index.ts +10 -1
  64. package/src/shared/components/Button/index.tsx +1 -1
  65. package/src/shared/components/index.ts +1 -1
  66. package/src/shared/utils/index.ts +1 -0
  67. package/src/shared/utils/jest/index.tsx +2 -1
  68. package/src/shared/utils/splitComponent.tsx +18 -10
  69. package/tsconfig.types.json +1 -3
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_react","_reactThemes","_Options","_interopRequireWildcard","_common","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","defaultTheme","BaseCustomDropdown","filter","label","onChange","options","theme","value","Error","active","setActive","useState","dropdownRef","useRef","opsRef","opsPos","setOpsPos","upward","setUpward","useEffect","undefined","id","cb","anchor","current","getBoundingClientRect","opsRect","measure","fitsDown","bottom","height","window","visualViewport","fitsUp","top","up","pos","left","width","now","areEqual","requestAnimationFrame","cancelAnimationFrame","openList","view","rect","stopPropagation","selected","jsx","Fragment","children","length","option","iValue","iName","optionValueName","containerClassName","container","opsContainerClass","select","jsxs","className","dropdown","onClick","onKeyDown","key","ref","role","tabIndex","arrow","containerClass","containerStyle","onCancel","newValue","optionClass","ThemedCustomDropdown","themed","validThemeKeys","propTypes","PT","func","node","arrayOf","optionValidator","isRequired","themeType","valueValidator","_default","exports"],"sources":["../../../../../../src/shared/components/selectors/CustomDropdown/index.tsx"],"sourcesContent":["import PT from 'prop-types';\nimport { useEffect, useRef, useState } from 'react';\n\nimport themed from '@dr.pogodin/react-themes';\n\nimport Options, { type ContainerPosT, type RefT, areEqual } from './Options';\n\nimport defaultTheme from './theme.scss';\n\nimport {\n type PropsT,\n type ValueT,\n optionValidator,\n optionValueName,\n validThemeKeys,\n valueValidator,\n} from '../common';\n\nconst BaseCustomDropdown: React.FunctionComponent<\nPropsT<React.ReactNode, (value: ValueT) => void>\n> = ({\n filter,\n label,\n onChange,\n options,\n theme,\n value,\n}) => {\n if (!options) throw Error('Internal error');\n\n const [active, setActive] = useState(false);\n\n const dropdownRef = useRef<HTMLDivElement>(null);\n const opsRef = useRef<RefT>(null);\n\n const [opsPos, setOpsPos] = useState<ContainerPosT>();\n const [upward, setUpward] = useState(false);\n\n useEffect(() => {\n if (!active) return undefined;\n\n let id: number;\n const cb = () => {\n const anchor = dropdownRef.current?.getBoundingClientRect();\n const opsRect = opsRef.current?.measure();\n if (anchor && opsRect) {\n const fitsDown = anchor.bottom + opsRect.height\n < (window.visualViewport?.height ?? 0);\n const fitsUp = anchor.top - opsRect.height > 0;\n\n const up = !fitsDown && fitsUp;\n setUpward(up);\n\n const pos = up ? {\n top: anchor.top - opsRect.height - 1,\n left: anchor.left,\n width: anchor.width,\n } : {\n left: anchor.left,\n top: anchor.bottom,\n width: anchor.width,\n };\n\n setOpsPos((now) => (areEqual(now, pos) ? now : pos));\n }\n id = requestAnimationFrame(cb);\n };\n requestAnimationFrame(cb);\n\n return () => {\n cancelAnimationFrame(id);\n };\n }, [active]);\n\n const openList = (\n e: React.KeyboardEvent<HTMLDivElement> | React.MouseEvent<HTMLDivElement>,\n ) => {\n const view = window.visualViewport;\n const rect = dropdownRef.current!.getBoundingClientRect();\n setActive(true);\n\n // NOTE: This first opens the dropdown off-screen, where it is measured\n // by an effect declared above, and then positioned below, or above\n // the original dropdown element, depending where it fits best\n // (if we first open it downward, it would flick if we immediately\n // move it above, at least with the current position update via local\n // react state, and not imperatively).\n setOpsPos({\n left: view?.width || 0,\n top: view?.height || 0,\n width: rect.width,\n });\n\n e.stopPropagation();\n };\n\n let selected: React.ReactNode = <>&zwnj;</>;\n for (let i = 0; i < options.length; ++i) {\n const option = options[i];\n if (!filter || filter(option)) {\n const [iValue, iName] = optionValueName(option);\n if (iValue === value) {\n selected = iName;\n break;\n }\n }\n }\n\n let containerClassName = theme.container;\n if (active) containerClassName += ` ${theme.active}`;\n\n let opsContainerClass = theme.select || '';\n if (upward) {\n containerClassName += ` ${theme.upward}`;\n opsContainerClass += ` ${theme.upward}`;\n }\n\n return (\n <div className={containerClassName}>\n {label === undefined ? null : (\n <div className={theme.label}>{label}</div>\n )}\n <div\n className={theme.dropdown}\n onClick={openList}\n onKeyDown={(e) => {\n if (e.key === 'Enter') openList(e);\n }}\n ref={dropdownRef}\n role=\"listbox\"\n tabIndex={0}\n >\n {selected}\n <div className={theme.arrow} />\n </div>\n {\n active ? (\n <Options\n containerClass={opsContainerClass}\n containerStyle={opsPos}\n onCancel={() => {\n setActive(false);\n }}\n onChange={(newValue) => {\n setActive(false);\n if (onChange) onChange(newValue);\n }}\n optionClass={theme.option || ''}\n options={options}\n ref={opsRef}\n />\n ) : null\n }\n </div>\n );\n};\n\nconst ThemedCustomDropdown = themed(\n BaseCustomDropdown,\n 'CustomDropdown',\n validThemeKeys,\n defaultTheme,\n);\n\nBaseCustomDropdown.propTypes = {\n filter: PT.func,\n label: PT.node,\n onChange: PT.func,\n options: PT.arrayOf(optionValidator.isRequired),\n theme: ThemedCustomDropdown.themeType.isRequired,\n value: valueValidator,\n};\n\nexport default ThemedCustomDropdown;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,MAAA,CAAAD,OAAA,UAEA,IAAAE,YAAA,CAAAH,sBAAA,CAAAC,OAAA,8BAEA,IAAAG,QAAA,CAAAC,uBAAA,CAAAJ,OAAA,eAIA,IAAAK,OAAA,CAAAL,OAAA,cAOmB,IAAAM,WAAA,CAAAN,OAAA,+BAAAO,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,CAAA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BAAE,CAACC,IAAI,CACf7E,KAAK,CAAE4E,kBAAE,CAACE,IAAI,CACd7E,QAAQ,CAAE2E,kBAAE,CAACC,IAAI,CACjB3E,OAAO,CAAE0E,kBAAE,CAACG,OAAO,CAACC,uBAAe,CAACC,UAAU,CAAC,CAC/C9E,KAAK,CAAEqE,oBAAoB,CAACU,SAAS,CAACD,UAAU,CAChD7E,KAAK,CAAE+E,sBACT,CAAC,CAAC,IAAAC,QAAA,CAAAC,OAAA,CAAAtG,OAAA,CAEayF,oBAAoB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_react","_reactThemes","_Options","_interopRequireWildcard","_common","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","defaultTheme","BaseCustomDropdown","filter","label","onChange","options","theme","value","Error","active","setActive","useState","dropdownRef","useRef","opsRef","opsPos","setOpsPos","upward","setUpward","useEffect","undefined","id","cb","anchor","current","getBoundingClientRect","opsRect","measure","fitsDown","bottom","height","window","visualViewport","fitsUp","top","up","pos","left","width","now","areEqual","requestAnimationFrame","cancelAnimationFrame","openList","view","rect","stopPropagation","selected","jsx","Fragment","children","length","option","iValue","iName","optionValueName","containerClassName","container","opsContainerClass","select","jsxs","className","dropdown","onClick","onKeyDown","key","ref","role","tabIndex","arrow","containerClass","containerStyle","onCancel","newValue","optionClass","ThemedCustomDropdown","themed","validThemeKeys","propTypes","PT","func","node","arrayOf","optionValidator","isRequired","themeType","valueValidator","_default","exports"],"sources":["../../../../../../src/shared/components/selectors/CustomDropdown/index.tsx"],"sourcesContent":["import PT from 'prop-types';\nimport { useEffect, useRef, useState } from 'react';\n\nimport themed from '@dr.pogodin/react-themes';\n\nimport Options, { type ContainerPosT, type RefT, areEqual } from './Options';\n\nimport defaultTheme from './theme.scss';\n\nimport {\n type PropsT,\n type ValueT,\n optionValidator,\n optionValueName,\n validThemeKeys,\n valueValidator,\n} from '../common';\n\nconst BaseCustomDropdown: React.FunctionComponent<\nPropsT<React.ReactNode, (value: ValueT) => void>\n> = ({\n filter,\n label,\n onChange,\n options,\n theme,\n value,\n}) => {\n if (!options) throw Error('Internal error');\n\n const [active, setActive] = useState(false);\n\n const dropdownRef = useRef<HTMLDivElement>(null);\n const opsRef = useRef<RefT>(null);\n\n const [opsPos, setOpsPos] = useState<ContainerPosT>();\n const [upward, setUpward] = useState(false);\n\n useEffect(() => {\n if (!active) return undefined;\n\n let id: number;\n const cb = () => {\n const anchor = dropdownRef.current?.getBoundingClientRect();\n const opsRect = opsRef.current?.measure();\n if (anchor && opsRect) {\n const fitsDown = anchor.bottom + opsRect.height\n < (window.visualViewport?.height ?? 0);\n const fitsUp = anchor.top - opsRect.height > 0;\n\n const up = !fitsDown && fitsUp;\n setUpward(up);\n\n const pos = up ? {\n top: anchor.top - opsRect.height - 1,\n left: anchor.left,\n width: anchor.width,\n } : {\n left: anchor.left,\n top: anchor.bottom,\n width: anchor.width,\n };\n\n setOpsPos((now) => (areEqual(now, pos) ? now : pos));\n }\n id = requestAnimationFrame(cb);\n };\n requestAnimationFrame(cb);\n\n return () => {\n cancelAnimationFrame(id);\n };\n }, [active]);\n\n const openList = (\n e: React.KeyboardEvent<HTMLDivElement> | React.MouseEvent<HTMLDivElement>,\n ) => {\n const view = window.visualViewport;\n const rect = dropdownRef.current!.getBoundingClientRect();\n setActive(true);\n\n // NOTE: This first opens the dropdown off-screen, where it is measured\n // by an effect declared above, and then positioned below, or above\n // the original dropdown element, depending where it fits best\n // (if we first open it downward, it would flick if we immediately\n // move it above, at least with the current position update via local\n // react state, and not imperatively).\n setOpsPos({\n left: view?.width || 0,\n top: view?.height || 0,\n width: rect.width,\n });\n\n e.stopPropagation();\n };\n\n let selected: React.ReactNode = <>&zwnj;</>;\n for (let i = 0; i < options.length; ++i) {\n const option = options[i];\n if (!filter || filter(option)) {\n const [iValue, iName] = optionValueName(option);\n if (iValue === value) {\n selected = iName;\n break;\n }\n }\n }\n\n let containerClassName = theme.container;\n if (active) containerClassName += ` ${theme.active}`;\n\n let opsContainerClass = theme.select || '';\n if (upward) {\n containerClassName += ` ${theme.upward}`;\n opsContainerClass += ` ${theme.upward}`;\n }\n\n return (\n <div className={containerClassName}>\n {label === undefined ? null : (\n <div className={theme.label}>{label}</div>\n )}\n <div\n className={theme.dropdown}\n onClick={openList}\n onKeyDown={(e) => {\n if (e.key === 'Enter') openList(e);\n }}\n ref={dropdownRef}\n role=\"listbox\"\n tabIndex={0}\n >\n {selected}\n <div className={theme.arrow} />\n </div>\n {\n active ? (\n <Options\n containerClass={opsContainerClass}\n containerStyle={opsPos}\n onCancel={() => {\n setActive(false);\n }}\n onChange={(newValue) => {\n setActive(false);\n if (onChange) onChange(newValue);\n }}\n optionClass={theme.option || ''}\n options={options}\n ref={opsRef}\n />\n ) : null\n }\n </div>\n );\n};\n\nconst ThemedCustomDropdown = themed(\n BaseCustomDropdown,\n 'CustomDropdown',\n validThemeKeys,\n defaultTheme,\n);\n\nBaseCustomDropdown.propTypes = {\n filter: PT.func,\n label: PT.node,\n onChange: PT.func,\n options: PT.arrayOf(optionValidator.isRequired),\n theme: ThemedCustomDropdown.themeType.isRequired,\n value: valueValidator,\n};\n\nexport default ThemedCustomDropdown;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,MAAA,CAAAD,OAAA,UAEA,IAAAE,YAAA,CAAAH,sBAAA,CAAAC,OAAA,8BAEA,IAAAG,QAAA,CAAAC,uBAAA,CAAAJ,OAAA,eAIA,IAAAK,OAAA,CAAAL,OAAA,cAOmB,IAAAM,WAAA,CAAAN,OAAA,+BAAAO,yBAAAC,CAAA,wBAAAC,OAAA,iBAAAC,CAAA,KAAAD,OAAA,CAAAE,CAAA,KAAAF,OAAA,QAAAF,wBAAA,SAAAA,CAAAC,CAAA,SAAAA,CAAA,CAAAG,CAAA,CAAAD,CAA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A,CAAA,GAAM,CACd9D,SAAS,CAAC,KAAK,CACjB,CAAE,CACFN,QAAQ,CAAGqE,QAAQ,EAAK,CACtB/D,SAAS,CAAC,KAAK,CAAC,CAChB,GAAIN,QAAQ,CAAEA,QAAQ,CAACqE,QAAQ,CACjC,CAAE,CACFC,WAAW,CAAEpE,KAAK,CAAC8C,MAAM,EAAI,EAAG,CAChC/C,OAAO,CAAEA,OAAQ,CACjB6D,GAAG,CAAEpD,MAAO,CACb,CAAC,CACA,IAAI,EAEP,CAET,CAAC,CAED,KAAM,CAAA6D,oBAAoB,CAAG,GAAAC,oBAAM,EACjC3E,kBAAkB,CAClB,gBAAgB,CAChB4E,sBAAc,CACd7E,YACF,CAAC,CAEDC,kBAAkB,CAAC6E,SAAS,CAAG,CAC7B5E,MAAM,CAAE6E,kBAAE,CAACC,IAAI,CACf7E,KAAK,CAAE4E,kBAAE,CAACE,IAAI,CACd7E,QAAQ,CAAE2E,kBAAE,CAACC,IAAI,CACjB3E,OAAO,CAAE0E,kBAAE,CAACG,OAAO,CAACC,uBAAe,CAACC,UAAU,CAAC,CAC/C9E,KAAK,CAAEqE,oBAAoB,CAACU,SAAS,CAACD,UAAU,CAChD7E,KAAK,CAAE+E,sBACT,CAAC,CAAC,IAAAC,QAAA,CAAAC,OAAA,CAAAtG,OAAA,CAEayF,oBAAoB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_reactThemes","_common","_jsxRuntime","defaultTheme","validThemeKeys","BaseSwitch","label","onChange","options","theme","value","option","Error","optionNodes","i","length","iValue","iName","optionValueName","className","onPress","selected","push","jsx","onClick","onKeyDown","e","key","role","tabIndex","children","jsxs","container","ThemedSwitch","themed","propTypes","PT","node","func","optionsValidator","themeType","isRequired","valueValidator","_default","exports","default"],"sources":["../../../../../../src/shared/components/selectors/Switch/index.tsx"],"sourcesContent":["import PT from 'prop-types';\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport {\n type OptionsT,\n type ValueT,\n optionsValidator,\n optionValueName,\n valueValidator,\n} from '../common';\n\nimport defaultTheme from './theme.scss';\n\nconst validThemeKeys = [\n 'container',\n 'label',\n 'option',\n 'options',\n 'selected',\n] as const;\n\ntype PropsT = {\n label?: React.ReactNode;\n onChange?: (value: ValueT) => void;\n options?: Readonly<OptionsT<React.ReactNode>>;\n theme: Theme<typeof validThemeKeys>;\n value?: ValueT;\n};\n\nconst BaseSwitch: React.FunctionComponent<PropsT> = ({\n label,\n onChange,\n options,\n theme,\n value,\n}) => {\n if (!options || !theme.option) throw Error('Internal error');\n\n const optionNodes: React.ReactNode[] = [];\n for (let i = 0; i < options?.length; ++i) {\n const [iValue, iName] = optionValueName(options[i]);\n\n let className: string = theme.option;\n let onPress: (() => void) | undefined;\n if (iValue === value) className += ` ${theme.selected}`;\n else if (onChange) onPress = () => onChange(iValue);\n\n optionNodes.push(\n onPress ? (\n <div\n className={className}\n onClick={onPress}\n onKeyDown={(e) => {\n if (onPress && e.key === 'Enter') onPress();\n }}\n key={iValue}\n role=\"button\"\n tabIndex={0}\n >\n {iName}\n </div>\n ) : (\n <div className={className} key={iValue}>{iName}</div>\n ),\n );\n }\n\n return (\n <div className={theme.container}>\n {label ? <div className={theme.label}>{label}</div> : null}\n <div className={theme.options}>\n {optionNodes}\n </div>\n </div>\n );\n};\n\nconst ThemedSwitch = themed(\n BaseSwitch,\n 'Switch',\n validThemeKeys,\n defaultTheme,\n);\n\nBaseSwitch.propTypes = {\n label: PT.node,\n onChange: PT.func,\n options: optionsValidator,\n theme: ThemedSwitch.themeType.isRequired,\n value: valueValidator,\n};\n\nexport default ThemedSwitch;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,YAAA,CAAAF,sBAAA,CAAAC,OAAA,8BAEA,IAAAE,OAAA,CAAAF,OAAA,cAMmB,IAAAG,WAAA,CAAAH,OAAA,4BAAAI,YAAA,kIAInB,KAAM,C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oB,CAExD,CACF,CAEA,mBACE,GAAAd,WAAA,CAAA6B,IAAA,SAAKZ,SAAS,CAAEV,KAAK,CAACuB,SAAU,CAAAF,QAAA,EAC7BxB,KAAK,cAAG,GAAAJ,WAAA,CAAAqB,GAAA,SAAKJ,SAAS,CAAEV,KAAK,CAACH,KAAM,CAAAwB,QAAA,CAAExB,KAAK,CAAM,CAAC,CAAG,IAAI,cAC1D,GAAAJ,WAAA,CAAAqB,GAAA,SAAKJ,SAAS,CAAEV,KAAK,CAACD,OAAQ,CAAAsB,QAAA,CAC3BjB,WAAW,CACT,CAAC,EACH,CAET,CAAC,CAED,KAAM,CAAAoB,YAAY,CAAG,GAAAC,oBAAM,EACzB7B,UAAU,CACV,QAAQ,CACRD,cAAc,CACdD,YACF,CAAC,CAEDE,UAAU,CAAC8B,SAAS,CAAG,CACrB7B,KAAK,CAAE8B,kBAAE,CAACC,IAAI,CACd9B,QAAQ,CAAE6B,kBAAE,CAACE,IAAI,CACjB9B,OAAO,CAAE+B,wBAAgB,CACzB9B,KAAK,CAAEwB,YAAY,CAACO,SAAS,CAACC,UAAU,CACxC/B,KAAK,CAAEgC,sBACT,CAAC,CAAC,IAAAC,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEaZ,YAAY","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_reactThemes","_common","_jsxRuntime","defaultTheme","validThemeKeys","BaseSwitch","label","onChange","options","theme","value","option","Error","optionNodes","i","length","iValue","iName","optionValueName","className","onPress","selected","push","jsx","onClick","onKeyDown","e","key","role","tabIndex","children","jsxs","container","ThemedSwitch","themed","propTypes","PT","node","func","optionsValidator","themeType","isRequired","valueValidator","_default","exports","default"],"sources":["../../../../../../src/shared/components/selectors/Switch/index.tsx"],"sourcesContent":["import PT from 'prop-types';\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport {\n type OptionsT,\n type ValueT,\n optionsValidator,\n optionValueName,\n valueValidator,\n} from '../common';\n\nimport defaultTheme from './theme.scss';\n\nconst validThemeKeys = [\n 'container',\n 'label',\n 'option',\n 'options',\n 'selected',\n] as const;\n\ntype PropsT = {\n label?: React.ReactNode;\n onChange?: (value: ValueT) => void;\n options?: Readonly<OptionsT<React.ReactNode>>;\n theme: Theme<typeof validThemeKeys>;\n value?: ValueT;\n};\n\nconst BaseSwitch: React.FunctionComponent<PropsT> = ({\n label,\n onChange,\n options,\n theme,\n value,\n}) => {\n if (!options || !theme.option) throw Error('Internal error');\n\n const optionNodes: React.ReactNode[] = [];\n for (let i = 0; i < options?.length; ++i) {\n const [iValue, iName] = optionValueName(options[i]);\n\n let className: string = theme.option;\n let onPress: (() => void) | undefined;\n if (iValue === value) className += ` ${theme.selected}`;\n else if (onChange) onPress = () => onChange(iValue);\n\n optionNodes.push(\n onPress ? (\n <div\n className={className}\n onClick={onPress}\n onKeyDown={(e) => {\n if (onPress && e.key === 'Enter') onPress();\n }}\n key={iValue}\n role=\"button\"\n tabIndex={0}\n >\n {iName}\n </div>\n ) : (\n <div className={className} key={iValue}>{iName}</div>\n ),\n );\n }\n\n return (\n <div className={theme.container}>\n {label ? <div className={theme.label}>{label}</div> : null}\n <div className={theme.options}>\n {optionNodes}\n </div>\n </div>\n );\n};\n\nconst ThemedSwitch = themed(\n BaseSwitch,\n 'Switch',\n validThemeKeys,\n defaultTheme,\n);\n\nBaseSwitch.propTypes = {\n label: PT.node,\n onChange: PT.func,\n options: optionsValidator,\n theme: ThemedSwitch.themeType.isRequired,\n value: valueValidator,\n};\n\nexport default ThemedSwitch;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,YAAA,CAAAF,sBAAA,CAAAC,OAAA,8BAEA,IAAAE,OAAA,CAAAF,OAAA,cAMmB,IAAAG,WAAA,CAAAH,OAAA,4BAAAI,YAAA,kIAInB,KAAM,CAAAC,cAAc,CAAG,CACrB,WAAW,CACX,OAAO,CACP,QAAQ,CACR,SAAS,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SAAS,CAAEV,KAAK,CAACuB,SAAU,CAAAF,QAAA,EAC7BxB,KAAK,cAAG,GAAAJ,WAAA,CAAAqB,GAAA,SAAKJ,SAAS,CAAEV,KAAK,CAACH,KAAM,CAAAwB,QAAA,CAAExB,KAAK,CAAM,CAAC,CAAG,IAAI,cAC1D,GAAAJ,WAAA,CAAAqB,GAAA,SAAKJ,SAAS,CAAEV,KAAK,CAACD,OAAQ,CAAAsB,QAAA,CAC3BjB,WAAW,CACT,CAAC,EACH,CAET,CAAC,CAED,KAAM,CAAAoB,YAAY,CAAG,GAAAC,oBAAM,EACzB7B,UAAU,CACV,QAAQ,CACRD,cAAc,CACdD,YACF,CAAC,CAEDE,UAAU,CAAC8B,SAAS,CAAG,CACrB7B,KAAK,CAAE8B,kBAAE,CAACC,IAAI,CACd9B,QAAQ,CAAE6B,kBAAE,CAACE,IAAI,CACjB9B,OAAO,CAAE+B,wBAAgB,CACzB9B,KAAK,CAAEwB,YAAY,CAACO,SAAS,CAACC,UAAU,CACxC/B,KAAK,CAAEgC,sBACT,CAAC,CAAC,IAAAC,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEaZ,YAAY","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_reactThemes","_interopRequireWildcard","require","_config","_interopRequireDefault","isomorphy","exports","_time","webpack","_jsUtils","_globalState","_splitComponent","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","themed","themedImpl","COMPOSE","PRIORITY"],"sources":["../../../../src/shared/utils/index.ts"],"sourcesContent":["import themedImpl, {\n type Theme,\n COMPOSE,\n PRIORITY,\n ThemeProvider,\n} from '@dr.pogodin/react-themes';\n\nimport config from './config';\nimport * as isomorphy from './isomorphy';\nimport time from './time';\nimport * as webpack from './webpack';\n\nexport {\n Barrier,\n Emitter,\n Semaphore,\n withRetries,\n} from '@dr.pogodin/js-utils';\n\nexport { getSsrContext } from './globalState';\nexport { default as splitComponent } from './splitComponent';\n\ntype ThemedT = typeof themedImpl & {\n COMPOSE: typeof COMPOSE;\n PRIORITY: typeof PRIORITY;\n};\n\nconst themed: ThemedT = themedImpl as ThemedT;\n\nthemed.COMPOSE = COMPOSE;\nthemed.PRIORITY = PRIORITY;\n\nexport {\n type Theme,\n config,\n isomorphy,\n themed,\n ThemeProvider,\n time,\n webpack,\n};\n"],"mappings":"4oCAAA,IAAAA,YAAA,CAAAC,uBAAA,CAAAC,OAAA,8BAOA,IAAAC,OAAA,CAAAC,sBAAA,CAAAF,OAAA,cACA,IAAAG,SAAA,CAAAJ,uBAAA,CAAAC,OAAA,iBAAyCI,OAAA,CAAAD,SAAA,CAAAA,SAAA,CACzC,IAAAE,KAAA,CAAAH,sBAAA,CAAAF,OAAA,YACA,IAAAM,OAAA,CAAAP,uBAAA,CAAAC,OAAA,eAAqCI,OAAA,CAAAE,OAAA,CAAAA,OAAA,CAErC,IAAAC,QAAA,CAAAP,OAAA,yBAOA,IAAAQ,YAAA,CAAAR,OAAA,kBACA,IAAAS,eAAA,CAAAP,sBAAA,CAAAF,OAAA,sBAA6D,SAAAU,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,WAAAZ,wBAAAY,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,CAO7D,KAAM,CAAAW,MAAe,CAAA1B,OAAA,CAAA0B,MAAA,CAAGC,oBAAqB,CAE7CD,MAAM,CAACE,OAAO,CAAGA,oBAAO,CACxBF,MAAM,CAACG,QAAQ,CAAGA,qBAAQ","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_reactThemes","_interopRequireWildcard","require","_config","_interopRequireDefault","isomorphy","exports","_time","webpack","_jsUtils","_globalState","_splitComponent","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","themed","themedImpl","COMPOSE","PRIORITY"],"sources":["../../../../src/shared/utils/index.ts"],"sourcesContent":["import themedImpl, {\n type Theme,\n COMPOSE,\n PRIORITY,\n ThemeProvider,\n} from '@dr.pogodin/react-themes';\n\nimport config from './config';\nimport * as isomorphy from './isomorphy';\nimport time from './time';\nimport * as webpack from './webpack';\n\nexport {\n type Listener,\n Barrier,\n Emitter,\n Semaphore,\n withRetries,\n} from '@dr.pogodin/js-utils';\n\nexport { getSsrContext } from './globalState';\nexport { default as splitComponent } from './splitComponent';\n\ntype ThemedT = typeof themedImpl & {\n COMPOSE: typeof COMPOSE;\n PRIORITY: typeof PRIORITY;\n};\n\nconst themed: ThemedT = themedImpl as ThemedT;\n\nthemed.COMPOSE = COMPOSE;\nthemed.PRIORITY = PRIORITY;\n\nexport {\n type Theme,\n config,\n isomorphy,\n themed,\n ThemeProvider,\n time,\n webpack,\n};\n"],"mappings":"4oCAAA,IAAAA,YAAA,CAAAC,uBAAA,CAAAC,OAAA,8BAOA,IAAAC,OAAA,CAAAC,sBAAA,CAAAF,OAAA,cACA,IAAAG,SAAA,CAAAJ,uBAAA,CAAAC,OAAA,iBAAyCI,OAAA,CAAAD,SAAA,CAAAA,SAAA,CACzC,IAAAE,KAAA,CAAAH,sBAAA,CAAAF,OAAA,YACA,IAAAM,OAAA,CAAAP,uBAAA,CAAAC,OAAA,eAAqCI,OAAA,CAAAE,OAAA,CAAAA,OAAA,CAErC,IAAAC,QAAA,CAAAP,OAAA,yBAQA,IAAAQ,YAAA,CAAAR,OAAA,kBACA,IAAAS,eAAA,CAAAP,sBAAA,CAAAF,OAAA,sBAA6D,SAAAU,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,WAAAZ,wBAAAY,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,CAO7D,KAAM,CAAAW,MAAe,CAAA1B,OAAA,CAAA0B,MAAA,CAAGC,oBAAqB,CAE7CD,MAAM,CAACE,OAAO,CAAGA,oBAAO,CACxBF,MAAM,CAACG,QAAQ,CAAGA,qBAAQ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"E2eSsrEnv.js","names":["_path","_interopRequireDefault","require","_lodash","_experimentalWorker","_jestEnvironmentJsdom","_memfs","_webpack","_renderer","E2eSsrEnv","JsdomEnv","loadWebpackConfig","optionsString","pragmas","options","JSON","parse","defaults","context","testFolder","fs","global","webpackOutputFs","factoryPath","factory","path","resolve","rootDir","default","webpackConfig","buildInfo","existsSync","readFileSync","runWebpack","compiler","webpack","outputFileSystem","Promise","done","fail","run","err","stats","hasErrors","console","error","toJson","errors","Error","webpackStats","runSsr","logger","undefined","debug","noop","info","log","warn","cleanup","entry","p","module","Application","entryExportName","renderer","ssrFactory","status","markup","ssrRequest","cookie","send","set","value","locals","devMiddleware","ssrMarkup","ssrOptions","ssrStatus","constructor","config","docblockPragmas","requestString","request","url","csrfToken","projectConfig","dom","createFsFromVolume","Volume","dirname","testPath","withSsr","root","process","cwd","register","envName","babelEnv","extensions","setup","REACT_UTILS_FORCE_CLIENT_SIDE","teardown","Object","keys","cache","forEach","key","revert","exports"],"sources":["../../../../../src/shared/utils/jest/E2eSsrEnv.ts"],"sourcesContent":["/**\n * Jest environment for end-to-end SSR and client-side testing. It relies on\n * the standard react-utils mechanics to execute SSR of given scene, and also\n * Webpack build of the code for client-side execution, it further exposes\n * Jsdom environment for the client-side testing of the outcomes.\n */\n/* eslint-disable global-require, import/no-dynamic-require */\n\n// BEWARE: The module is not imported into the JU module / the main assembly of\n// the library, because doing so easily breaks stuff:\n// 1) This module depends on Node-specific modules, which would make JU\n// incompatible with JsDom if included into JU.\n// 2) If this module is weakly imported from somewhere else in the lib,\n// it seems to randomly break tests using it for a different reason,\n// probably some sort of a require-loop, or some issues with weak\n// require in that scenario.\n\nimport path from 'path';\n\nimport type { Request, Response } from 'express';\nimport { defaults, noop, set } from 'lodash';\n\n// As this environment is a part of the Jest testing utils,\n// we assume development dependencies are available when it is used.\n/* eslint-disable import/no-extraneous-dependencies */\nimport register from '@babel/register/experimental-worker';\n\nimport JsdomEnv from 'jest-environment-jsdom';\nimport { type IFs, createFsFromVolume, Volume } from 'memfs';\nimport webpack from 'webpack';\n/* eslint-enable import/no-extraneous-dependencies */\n\nimport ssrFactory from 'server/renderer';\n\nimport type {\n EnvironmentContext,\n JestEnvironmentConfig,\n} from '@jest/environment';\n\nexport default class E2eSsrEnv extends JsdomEnv {\n pragmas: Record<string, string | string[]>;\n\n ssrRequest: object;\n\n rootDir: string;\n\n testFolder: string;\n\n withSsr: boolean;\n\n webpackStats?: webpack.StatsCompilation;\n\n /**\n * Loads Webpack config, and exposes it to the environment via global\n * webpackConfig object.\n */\n loadWebpackConfig() {\n const optionsString = this.pragmas['webpack-config-options'] as string;\n\n const options = (optionsString\n ? JSON.parse(optionsString) : {}) as webpack.Configuration;\n\n defaults(options, {\n context: this.testFolder,\n fs: this.global.webpackOutputFs,\n });\n\n const factoryPath = this.pragmas['webpack-config-factory'] as string;\n let factory = require(path.resolve(this.rootDir, factoryPath));\n factory = 'default' in factory ? factory.default : factory;\n\n this.global.webpackConfig = factory(options);\n\n const fs = this.global.webpackOutputFs as IFs;\n let buildInfo = `${options.context}/.build-info`;\n if (fs.existsSync(buildInfo)) {\n buildInfo = fs.readFileSync(buildInfo, 'utf8') as string;\n this.global.buildInfo = JSON.parse(buildInfo);\n }\n }\n\n /**\n * Executes Webpack build.\n * @return {Promise}\n */\n async runWebpack() {\n this.loadWebpackConfig();\n\n const compiler = webpack(this.global.webpackConfig as webpack.Configuration);\n\n // TODO: The \"as typeof compiler.outputFileSystem\" piece below is a workaround\n // for the Webpack regression: https://github.com/webpack/webpack/issues/18242\n compiler.outputFileSystem = this.global.webpackOutputFs as typeof compiler.outputFileSystem;\n\n return new Promise<void>((done, fail) => {\n compiler.run((err, stats) => {\n if (err) fail(err);\n if (stats?.hasErrors()) {\n // eslint-disable-next-line no-console\n console.error(stats.toJson().errors);\n fail(Error('Webpack compilation failed'));\n }\n\n this.global.webpackStats = stats?.toJson();\n\n // Keeps reference to the raw Webpack stats object, which should be\n // explicitly passed to the server-side renderer alongside the request,\n // so that it can to pick up asset paths for different named chunks.\n this.webpackStats = stats;\n\n done();\n });\n });\n }\n\n async runSsr() {\n const optionsString = this.pragmas['ssr-options'] as string;\n const options = optionsString ? JSON.parse(optionsString) : {};\n\n // TODO: This is temporary to shortcut the logging added to SSR.\n if (options.logger === undefined) {\n options.logger = {\n debug: noop,\n info: noop,\n log: noop,\n warn: noop,\n };\n }\n\n if (!options.buildInfo) options.buildInfo = this.global.buildInfo;\n\n let cleanup: (() => void) | undefined;\n\n if (options.entry) {\n const p = path.resolve(this.testFolder, options.entry);\n const module = require(p);\n cleanup = module.cleanup;\n options.Application = module[options.entryExportName || 'default'];\n }\n\n const renderer = ssrFactory(this.global.webpackConfig!, options);\n let status = 200; // OK\n const markup = await new Promise<string>((done, fail) => {\n renderer(\n this.ssrRequest as Request,\n\n // TODO: This will do for now, with the current implementation of\n // the renderer, but it will require a rework once the renderer is\n // updated to do streaming.\n ({\n cookie: noop,\n send: done,\n set: noop,\n status: (value: number) => {\n status = value;\n },\n\n // This is how up-to-date Webpack stats are passed to the server in\n // development mode, and we use this here always, instead of having\n // to pass some information via filesystem.\n locals: {\n webpack: {\n devMiddleware: {\n stats: this.webpackStats,\n },\n },\n },\n } as unknown) as Response,\n\n (error) => {\n if (error) fail(error);\n else done('');\n },\n );\n });\n\n this.global.ssrMarkup = markup;\n this.global.ssrOptions = options;\n this.global.ssrStatus = status;\n\n if (cleanup) cleanup();\n }\n\n constructor(\n config: JestEnvironmentConfig,\n context: EnvironmentContext,\n ) {\n const pragmas = context.docblockPragmas;\n\n const requestString = pragmas['ssr-request'] as string;\n const request = requestString ? JSON.parse(requestString) : {};\n\n if (!request.url) request.url = '/';\n request.csrfToken = noop;\n\n // This ensures the initial JsDom URL matches the value we use for SSR.\n set(\n config.projectConfig,\n 'testEnvironmentOptions.url',\n `http://localhost${request.url}`,\n );\n\n super(config, context);\n\n this.global.dom = this.dom;\n this.global.webpackOutputFs = createFsFromVolume(new Volume());\n\n // Extracts necessary settings from config and context.\n const { projectConfig } = config;\n this.rootDir = projectConfig.rootDir;\n this.testFolder = path.dirname(context.testPath);\n this.withSsr = !pragmas['no-ssr'];\n this.ssrRequest = request;\n this.pragmas = pragmas;\n\n // The usual \"babel-jest\" transformation setup does not apply to\n // the environment code and imports from it, this workaround enables it.\n const optionsString = this.pragmas['ssr-options'] as string;\n const options = optionsString ? JSON.parse(optionsString) : {};\n let root;\n switch (options.root) {\n case 'TEST': root = this.testFolder; break;\n default: root = process.cwd();\n }\n register({\n envName: options.babelEnv,\n extensions: ['.js', '.jsx', '.ts', '.tsx', '.svg'],\n root,\n });\n }\n\n async setup() {\n await super.setup();\n await this.runWebpack();\n if (this.withSsr) await this.runSsr();\n this.global.REACT_UTILS_FORCE_CLIENT_SIDE = true;\n }\n\n async teardown() {\n delete this.global.REACT_UTILS_FORCE_CLIENT_SIDE;\n\n // Resets module cache and @babel/register. Effectively this ensures that\n // the next time an instance of this environment is set up, all modules are\n // transformed by Babel from scratch, thus taking into account the latest\n // Babel config (which may change between different environment instances,\n // which does not seem to be taken into account by Babel / Node caches\n // automatically).\n Object.keys(require.cache).forEach((key) => {\n delete require.cache[key];\n });\n register.revert();\n super.teardown();\n }\n}\n"],"mappings":"gLAiBA,IAAAA,KAAA,CAAAC,sBAAA,CAAAC,OAAA,UAGA,IAAAC,OAAA,CAAAD,OAAA,WAKA,IAAAE,mBAAA,CAAAH,sBAAA,CAAAC,OAAA,yCAEA,IAAAG,qBAAA,CAAAJ,sBAAA,CAAAC,OAAA,4BACA,IAAAI,MAAA,CAAAJ,OAAA,UACA,IAAAK,QAAA,CAAAN,sBAAA,CAAAC,OAAA,aAGA,IAAAM,SAAA,CAAAP,sBAAA,CAAAC,OAAA,8BAhCA;AACA;AACA;AACA;AACA;AACA,GALA,CAMA,+DAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA,uDAMA,qDASe,KAAM,CAAAO,SAAS,QAAS,CAAAC,6BAAS,CAa9C;AACF;AACA;AACA,KACEC,iBAAiBA,CAAA,CAAG,CAClB,KAAM,CAAAC,aAAa,CAAG,IAAI,CAACC,OAAO,CAAC,wBAAwB,CAAW,CAEtE,KAAM,CAAAC,OAAO,CAAIF,aAAa,CAC1BG,IAAI,CAACC,KAAK,CAACJ,aAAa,CAAC,CAAG,CAAC,CAA2B,CAE5D,GAAAK,gBAAQ,EAACH,OAAO,CAAE,CAChBI,OAAO,CAAE,IAAI,CAACC,UAAU,CACxBC,EAAE,CAAE,IAAI,CAACC,MAAM,CAACC,eAClB,CAAC,CAAC,CAEF,KAAM,CAAAC,WAAW,CAAG,IAAI,CAACV,OAAO,CAAC,wBAAwB,CAAW,CACpE,GAAI,CAAAW,OAAO,CAAGtB,OAAO,CAACuB,aAAI,CAACC,OAAO,CAAC,IAAI,CAACC,O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6B,CAAG,IAC9C,CAEA,KAAM,CAAAC,QAAQA,CAAA,CAAG,CACf,MAAO,KAAI,CAAChF,MAAM,CAAC+E,6BAA6B,CAEhD;AACA;AACA;AACA;AACA;AACA;AACAE,MAAM,CAACC,IAAI,CAACrG,OAAO,CAACsG,KAAK,CAAC,CAACC,OAAO,CAAEC,GAAG,EAAK,CAC1C,MAAO,CAAAxG,OAAO,CAACsG,KAAK,CAACE,GAAG,CAC1B,CAAC,CAAC,CACFX,2BAAQ,CAACY,MAAM,CAAC,CAAC,CACjB,KAAK,CAACN,QAAQ,CAAC,CACjB,CACF,CAACO,OAAA,CAAAhF,OAAA,CAAAnB,SAAA","ignoreList":[]}
1
+ {"version":3,"file":"E2eSsrEnv.js","names":["_path","_interopRequireDefault","require","_lodash","_experimentalWorker","_jestEnvironmentJsdom","_memfs","_webpack","_renderer","E2eSsrEnv","JsdomEnv","loadWebpackConfig","optionsString","pragmas","options","JSON","parse","defaults","context","testFolder","fs","global","webpackOutputFs","factoryPath","factory","path","resolve","rootDir","default","webpackConfig","buildInfo","existsSync","readFileSync","runWebpack","compiler","webpack","outputFileSystem","Promise","done","fail","run","err","stats","hasErrors","console","error","toJson","errors","Error","webpackStats","runSsr","logger","undefined","debug","noop","info","log","warn","cleanup","entry","p","module","Application","entryExportName","renderer","ssrFactory","status","markup","ssrRequest","cookie","send","set","value","locals","devMiddleware","ssrMarkup","ssrOptions","ssrStatus","constructor","config","docblockPragmas","requestString","request","url","csrfToken","projectConfig","dom","createFsFromVolume","Volume","dirname","testPath","withSsr","root","process","cwd","register","envName","babelEnv","extensions","setup","REACT_UTILS_FORCE_CLIENT_SIDE","teardown","Object","keys","cache","forEach","key","revert","exports"],"sources":["../../../../../src/shared/utils/jest/E2eSsrEnv.ts"],"sourcesContent":["/**\n * Jest environment for end-to-end SSR and client-side testing. It relies on\n * the standard react-utils mechanics to execute SSR of given scene, and also\n * Webpack build of the code for client-side execution, it further exposes\n * Jsdom environment for the client-side testing of the outcomes.\n */\n/* eslint-disable global-require, import/no-dynamic-require */\n\n// BEWARE: The module is not imported into the JU module / the main assembly of\n// the library, because doing so easily breaks stuff:\n// 1) This module depends on Node-specific modules, which would make JU\n// incompatible with JsDom if included into JU.\n// 2) If this module is weakly imported from somewhere else in the lib,\n// it seems to randomly break tests using it for a different reason,\n// probably some sort of a require-loop, or some issues with weak\n// require in that scenario.\n\nimport path from 'path';\n\nimport type { Request, Response } from 'express';\nimport { defaults, noop, set } from 'lodash';\n\n// As this environment is a part of the Jest testing utils,\n// we assume development dependencies are available when it is used.\n/* eslint-disable import/no-extraneous-dependencies */\nimport register from '@babel/register/experimental-worker';\n\nimport JsdomEnv from 'jest-environment-jsdom';\nimport { type IFs, createFsFromVolume, Volume } from 'memfs';\nimport webpack from 'webpack';\n/* eslint-enable import/no-extraneous-dependencies */\n\nimport ssrFactory from 'server/renderer';\n\nimport type {\n EnvironmentContext,\n JestEnvironmentConfig,\n} from '@jest/environment';\n\nexport default class E2eSsrEnv extends JsdomEnv {\n pragmas: Record<string, string | string[]>;\n\n ssrRequest: object;\n\n rootDir: string;\n\n testFolder: string;\n\n withSsr: boolean;\n\n webpackStats?: webpack.StatsCompilation;\n\n /**\n * Loads Webpack config, and exposes it to the environment via global\n * webpackConfig object.\n */\n loadWebpackConfig() {\n const optionsString = this.pragmas['webpack-config-options'] as string;\n\n const options = (optionsString\n ? JSON.parse(optionsString) : {}) as webpack.Configuration;\n\n defaults(options, {\n context: this.testFolder,\n fs: this.global.webpackOutputFs,\n });\n\n const factoryPath = this.pragmas['webpack-config-factory'] as string;\n let factory = require(path.resolve(this.rootDir, factoryPath));\n factory = 'default' in factory ? factory.default : factory;\n\n this.global.webpackConfig = factory(options);\n\n const fs = this.global.webpackOutputFs as IFs;\n let buildInfo = `${options.context}/.build-info`;\n if (fs.existsSync(buildInfo)) {\n buildInfo = fs.readFileSync(buildInfo, 'utf8') as string;\n this.global.buildInfo = JSON.parse(buildInfo);\n }\n }\n\n /**\n * Executes Webpack build.\n * @return {Promise}\n */\n async runWebpack() {\n this.loadWebpackConfig();\n\n const compiler = webpack(this.global.webpackConfig as webpack.Configuration);\n\n // TODO: The \"as typeof compiler.outputFileSystem\" piece below is a workaround\n // for the Webpack regression: https://github.com/webpack/webpack/issues/18242\n compiler.outputFileSystem = this.global.webpackOutputFs as typeof compiler.outputFileSystem;\n\n return new Promise<void>((done, fail) => {\n compiler.run((err, stats) => {\n if (err) fail(err);\n if (stats?.hasErrors()) {\n // eslint-disable-next-line no-console\n console.error(stats.toJson().errors);\n fail(Error('Webpack compilation failed'));\n }\n\n this.global.webpackStats = stats?.toJson();\n\n // Keeps reference to the raw Webpack stats object, which should be\n // explicitly passed to the server-side renderer alongside the request,\n // so that it can to pick up asset paths for different named chunks.\n this.webpackStats = stats;\n\n done();\n });\n });\n }\n\n async runSsr() {\n const optionsString = this.pragmas['ssr-options'] as string;\n const options = optionsString ? JSON.parse(optionsString) : {};\n\n // TODO: This is temporary to shortcut the logging added to SSR.\n if (options.logger === undefined) {\n options.logger = {\n debug: noop,\n info: noop,\n log: noop,\n warn: noop,\n };\n }\n\n if (!options.buildInfo) options.buildInfo = this.global.buildInfo;\n\n let cleanup: (() => void) | undefined;\n\n if (options.entry) {\n const p = path.resolve(this.testFolder, options.entry);\n const module = require(p);\n cleanup = module.cleanup;\n options.Application = module[options.entryExportName || 'default'];\n }\n\n const renderer = ssrFactory(this.global.webpackConfig!, options);\n let status = 200; // OK\n const markup = await new Promise<string>((done, fail) => {\n renderer(\n this.ssrRequest as Request,\n\n // TODO: This will do for now, with the current implementation of\n // the renderer, but it will require a rework once the renderer is\n // updated to do streaming.\n ({\n cookie: noop,\n send: done,\n set: noop,\n status: (value: number) => {\n status = value;\n },\n\n // This is how up-to-date Webpack stats are passed to the server in\n // development mode, and we use this here always, instead of having\n // to pass some information via filesystem.\n locals: {\n webpack: {\n devMiddleware: {\n stats: this.webpackStats,\n },\n },\n },\n } as unknown) as Response,\n\n (error) => {\n if (error) fail(error);\n else done('');\n },\n );\n });\n\n this.global.ssrMarkup = markup;\n this.global.ssrOptions = options;\n this.global.ssrStatus = status;\n\n if (cleanup) cleanup();\n }\n\n constructor(\n config: JestEnvironmentConfig,\n context: EnvironmentContext,\n ) {\n const pragmas = context.docblockPragmas;\n\n const requestString = pragmas['ssr-request'] as string;\n const request = requestString ? JSON.parse(requestString) : {};\n\n if (!request.url) request.url = '/';\n request.csrfToken = noop;\n\n // This ensures the initial JsDom URL matches the value we use for SSR.\n set(\n config.projectConfig,\n 'testEnvironmentOptions.url',\n `http://localhost${request.url}`,\n );\n\n super(config, context);\n\n this.global.dom = this.dom;\n this.global.webpackOutputFs = createFsFromVolume(new Volume());\n\n // Extracts necessary settings from config and context.\n const { projectConfig } = config;\n this.rootDir = projectConfig.rootDir;\n this.testFolder = path.dirname(context.testPath);\n this.withSsr = !pragmas['no-ssr'];\n this.ssrRequest = request;\n this.pragmas = pragmas;\n\n // The usual \"babel-jest\" transformation setup does not apply to\n // the environment code and imports from it, this workaround enables it.\n const optionsString = this.pragmas['ssr-options'] as string;\n const options = optionsString ? JSON.parse(optionsString) : {};\n let root;\n switch (options.root) {\n case 'TEST': root = this.testFolder; break;\n default: root = process.cwd();\n }\n register({\n envName: options.babelEnv,\n extensions: ['.js', '.jsx', '.ts', '.tsx', '.svg'],\n root,\n });\n }\n\n async setup() {\n await super.setup();\n await this.runWebpack();\n if (this.withSsr) await this.runSsr();\n this.global.REACT_UTILS_FORCE_CLIENT_SIDE = true;\n }\n\n async teardown() {\n delete this.global.REACT_UTILS_FORCE_CLIENT_SIDE;\n\n // Resets module cache and @babel/register. Effectively this ensures that\n // the next time an instance of this environment is set up, all modules are\n // transformed by Babel from scratch, thus taking into account the latest\n // Babel config (which may change between different environment instances,\n // which does not seem to be taken into account by Babel / Node caches\n // automatically).\n Object.keys(require.cache).forEach((key) => {\n delete require.cache[key];\n });\n register.revert();\n super.teardown();\n }\n}\n"],"mappings":"gLAiBA,IAAAA,KAAA,CAAAC,sBAA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AC,CACFX,2BAAQ,CAACY,MAAM,CAAC,CAAC,CACjB,KAAK,CAACN,QAAQ,CAAC,CACjB,CACF,CAACO,OAAA,CAAAhF,OAAA,CAAAnB,SAAA","ignoreList":[]}
@@ -25,5 +25,5 @@
25
25
  // when it is simulating user events.
26
26
  global.IS_REACT_ACT_ENVIRONMENT=true;(0,_react.act)(()=>root.unmount());res.remove()};// NOTE: As it seems @testing-library may reset this flag to false
27
27
  // when it is simulating user events.
28
- global.IS_REACT_ACT_ENVIRONMENT=true;(0,_react.act)(()=>{root=(0,_client.createRoot)(res);root.render(scene)});return res}function snapshot(element){let res;(0,_react.act)(()=>{res=(0,_react2.render)(element)});if(res===undefined)throw Error("Render failed");expect(res.asFragment().firstChild).toMatchSnapshot();return res}
28
+ global.IS_REACT_ACT_ENVIRONMENT=true;(0,_react.act)(()=>{root=(0,_client.createRoot)(res);root.render(scene)});return res}function snapshot(element){let res;(0,_react.act)(()=>{res=(0,_react2.render)(element)});if(res===undefined)throw Error("Render failed");const nodes=res.asFragment().childNodes;expect(nodes.length>1?[...nodes]:nodes[0]).toMatchSnapshot();return res}
29
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_mockdate","_interopRequireDefault","require","_react","_client","_react2","_global","global","IS_REACT_ACT_ENVIRONMENT","originalProcessVersions","process","versions","mockClientSide","Object","defineProperty","value","unmockClientSide","writable","getMockUuid","seed","x","toString","padStart","slice","mockTimer","time","mockdate","set","Date","now","jest","advanceTimersByTime","mount","scene","root","element","document","createElement","body","appendChild","res","destroy","act","unmount","remove","createRoot","render","snapshot","undefined","Error","expect","asFragment","firstChild","toMatchSnapshot"],"sources":["../../../../../src/shared/utils/jest/index.tsx"],"sourcesContent":["/* global jest, document */\n/* eslint-disable import/no-extraneous-dependencies */\n\nimport mockdate from 'mockdate';\nimport { type ReactNode, act } from 'react';\nimport { type Root, createRoot } from 'react-dom/client';\n\nimport { type RenderResult, render } from '@testing-library/react';\n\n/**\n * An alias for [act(..)](https://reactjs.org/docs/test-utils.html#act)\n * from `react`.\n */\nexport { act };\n\nexport { default as getGlobal } from './global';\n\ndeclare global {\n // eslint-disable-next-line no-var, vars-on-top\n var IS_REACT_ACT_ENVIRONMENT: boolean | undefined;\n}\n\nglobal.IS_REACT_ACT_ENVIRONMENT = true;\n\nconst originalProcessVersions = process.versions;\n\n/**\n * Tricks **react-utils** into thinking the test is running within client-side\n * (browser) environment.\n */\nexport function mockClientSide() {\n Object.defineProperty(process, 'versions', { value: null });\n}\n\n/**\n * Reverts the effect of {@link module:JU.mockClientSide mockClientSide(..)}.\n */\nexport function unmockClientSide() {\n Object.defineProperty(process, 'versions', {\n value: originalProcessVersions,\n writable: false,\n });\n}\n\n/**\n * Generates a mock UUID, or better said it determenistically transforms given\n * `seed` number into a UUID-formatted string.\n * @param {number} seed\n * @return {string}\n */\nexport function getMockUuid(seed = 0) {\n const x = seed.toString(16).padStart(32, '0');\n return `${x.slice(0, 8)}-${x.slice(8, 12)}-${x.slice(12, 16)}-${x.slice(16, 20)}-${x.slice(20)}`;\n}\n\n/**\n * Advances mock timers, and mock date by the specified time.\n * @param {number} time Time step [ms].\n * @returns {Promise} Wait for this to \"jump after\" any async code which should\n * be executed because of the mock time movement.\n */\nexport async function mockTimer(time: number) {\n mockdate.set(time + Date.now());\n jest.advanceTimersByTime(time);\n}\n\nexport type MountedSceneT = HTMLElement & {\n destroy: () => void;\n};\n\n/**\n * Mounts `scene` to the DOM, and returns the root scene element.\n * @param scene\n * @return Created container DOM element with destroy() function\n * attached.\n */\nexport function mount(scene: ReactNode): MountedSceneT {\n let root: Root;\n const element = document.createElement('div');\n document.body.appendChild(element);\n\n const res: MountedSceneT = (element as unknown) as MountedSceneT;\n res.destroy = () => {\n // NOTE: As it seems @testing-library may reset this flag to false\n // when it is simulating user events.\n global.IS_REACT_ACT_ENVIRONMENT = true;\n\n act(() => root.unmount());\n res.remove();\n };\n\n // NOTE: As it seems @testing-library may reset this flag to false\n // when it is simulating user events.\n global.IS_REACT_ACT_ENVIRONMENT = true;\n\n act(() => {\n root = createRoot(res);\n root.render(scene);\n });\n return res;\n}\n\nexport function snapshot(element: React.ReactElement) {\n let res: RenderResult | undefined;\n act(() => {\n res = render(element);\n });\n if (res === undefined) throw Error('Render failed');\n\n expect(res.asFragment().firstChild).toMatchSnapshot();\n return res;\n}\n"],"mappings":"ghBAGA,IAAAA,SAAA,CAAAC,sBAAA,CAAAC,OAAA,cACA,IAAAC,MAAA,CAAAD,OAAA,UACA,IAAAE,OAAA,CAAAF,OAAA,qBAEA,IAAAG,OAAA,CAAAH,OAAA,2BAQA,IAAAI,OAAA,CAAAL,sBAAA,CAAAC,OAAA,cAfA,4BACA,uDAQA;AACA;AACA;AACA,GAUAK,MAAM,CAACC,wBAAwB,CAAG,IAAI,CAEtC,KAAM,CAAAC,uBAAuB,CAAGC,OAAO,CAACC,QAAQ,CAEhD;AACA;AACA;AACA,GACO,QAAS,CAAAC,cAAcA,CAAA,CAAG,CAC/BC,MAAM,CAACC,cAAc,CAACJ,OAAO,CAAE,UAAU,CAAE,CAAEK,KAAK,CAAE,IAAK,CAAC,CAC5D,CAEA;AACA;AACA,GACO,QAAS,CAAAC,gBAAgBA,CAAA,CAAG,CACjCH,MAAM,CAACC,cAAc,CAACJ,OAAO,CAAE,UAAU,CAAE,CACzCK,KAAK,CAAEN,uBAAuB,CAC9BQ,QAAQ,CAAE,KACZ,CAAC,CACH,CAEA;AACA;AACA;AACA;AACA;AACA,GACO,QAAS,CAAAC,WAAWA,CAACC,IAAI,CAAG,CAAC,CAAE,CACpC,KAAM,CAAAC,CAAC,CAAGD,IAAI,CAACE,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAE,GAAG,CAAC,CAC7C,MAAQ,GAAEF,CAAC,CAACG,KAAK,CAAC,CAAC,CAAE,CAAC,CAAE,IAAGH,CAAC,CAACG,KAAK,CAAC,CAAC,CAAE,EAAE,CAAE,IAAGH,CAA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,CAAE,KAAM,CAAAC,KAAK,CAAC,eAAe,CAAC,CAEnDC,MAAM,CAACV,GAAG,CAACW,UAAU,CAAC,CAAC,CAACC,UAAU,CAAC,CAACC,eAAe,CAAC,CAAC,CACrD,MAAO,CAAAb,GACT","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_mockdate","_interopRequireDefault","require","_react","_client","_react2","_global","global","IS_REACT_ACT_ENVIRONMENT","originalProcessVersions","process","versions","mockClientSide","Object","defineProperty","value","unmockClientSide","writable","getMockUuid","seed","x","toString","padStart","slice","mockTimer","time","mockdate","set","Date","now","jest","advanceTimersByTime","mount","scene","root","element","document","createElement","body","appendChild","res","destroy","act","unmount","remove","createRoot","render","snapshot","undefined","Error","nodes","asFragment","childNodes","expect","length","toMatchSnapshot"],"sources":["../../../../../src/shared/utils/jest/index.tsx"],"sourcesContent":["/* global jest, document */\n/* eslint-disable import/no-extraneous-dependencies */\n\nimport mockdate from 'mockdate';\nimport { type ReactNode, act } from 'react';\nimport { type Root, createRoot } from 'react-dom/client';\n\nimport { type RenderResult, render } from '@testing-library/react';\n\n/**\n * An alias for [act(..)](https://reactjs.org/docs/test-utils.html#act)\n * from `react`.\n */\nexport { act };\n\nexport { default as getGlobal } from './global';\n\ndeclare global {\n // eslint-disable-next-line no-var, vars-on-top\n var IS_REACT_ACT_ENVIRONMENT: boolean | undefined;\n}\n\nglobal.IS_REACT_ACT_ENVIRONMENT = true;\n\nconst originalProcessVersions = process.versions;\n\n/**\n * Tricks **react-utils** into thinking the test is running within client-side\n * (browser) environment.\n */\nexport function mockClientSide() {\n Object.defineProperty(process, 'versions', { value: null });\n}\n\n/**\n * Reverts the effect of {@link module:JU.mockClientSide mockClientSide(..)}.\n */\nexport function unmockClientSide() {\n Object.defineProperty(process, 'versions', {\n value: originalProcessVersions,\n writable: false,\n });\n}\n\n/**\n * Generates a mock UUID, or better said it determenistically transforms given\n * `seed` number into a UUID-formatted string.\n * @param {number} seed\n * @return {string}\n */\nexport function getMockUuid(seed = 0) {\n const x = seed.toString(16).padStart(32, '0');\n return `${x.slice(0, 8)}-${x.slice(8, 12)}-${x.slice(12, 16)}-${x.slice(16, 20)}-${x.slice(20)}`;\n}\n\n/**\n * Advances mock timers, and mock date by the specified time.\n * @param {number} time Time step [ms].\n * @returns {Promise} Wait for this to \"jump after\" any async code which should\n * be executed because of the mock time movement.\n */\nexport async function mockTimer(time: number) {\n mockdate.set(time + Date.now());\n jest.advanceTimersByTime(time);\n}\n\nexport type MountedSceneT = HTMLElement & {\n destroy: () => void;\n};\n\n/**\n * Mounts `scene` to the DOM, and returns the root scene element.\n * @param scene\n * @return Created container DOM element with destroy() function\n * attached.\n */\nexport function mount(scene: ReactNode): MountedSceneT {\n let root: Root;\n const element = document.createElement('div');\n document.body.appendChild(element);\n\n const res: MountedSceneT = (element as unknown) as MountedSceneT;\n res.destroy = () => {\n // NOTE: As it seems @testing-library may reset this flag to false\n // when it is simulating user events.\n global.IS_REACT_ACT_ENVIRONMENT = true;\n\n act(() => root.unmount());\n res.remove();\n };\n\n // NOTE: As it seems @testing-library may reset this flag to false\n // when it is simulating user events.\n global.IS_REACT_ACT_ENVIRONMENT = true;\n\n act(() => {\n root = createRoot(res);\n root.render(scene);\n });\n return res;\n}\n\nexport function snapshot(element: React.ReactElement) {\n let res: RenderResult | undefined;\n act(() => {\n res = render(element);\n });\n if (res === undefined) throw Error('Render failed');\n\n const nodes = res.asFragment().childNodes;\n expect(nodes.length > 1 ? [...nodes] : nodes[0]).toMatchSnapshot();\n return res;\n}\n"],"mappings":"ghBAGA,IAAAA,SAAA,CAAAC,sBAAA,CAAAC,OAAA,cACA,IAAAC,MAAA,CAAAD,OAAA,UACA,IAAAE,OAAA,CAAAF,OAAA,qBAEA,IAAAG,OAAA,CAAAH,OAAA,2BAQA,IAAAI,OAAA,CAAAL,sBAAA,CAAAC,OAAA,cAfA,4BACA,uDAQA;AACA;AACA;AACA,GAUAK,MAAM,CAACC,wBAAwB,CAAG,IAAI,CAEtC,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K,CAAC,CAC7CD,QAAQ,CAACE,IAAI,CAACC,WAAW,CAACJ,OAAO,CAAC,CAElC,KAAM,CAAAK,GAAkB,CAAIL,OAAoC,CAChEK,GAAG,CAACC,OAAO,CAAG,IAAM,CAClB;AACA;AACAlC,MAAM,CAACC,wBAAwB,CAAG,IAAI,CAEtC,GAAAkC,UAAG,EAAC,IAAMR,IAAI,CAACS,OAAO,CAAC,CAAC,CAAC,CACzBH,GAAG,CAACI,MAAM,CAAC,CACb,CAAC,CAED;AACA;AACArC,MAAM,CAACC,wBAAwB,CAAG,IAAI,CAEtC,GAAAkC,UAAG,EAAC,IAAM,CACRR,IAAI,CAAG,GAAAW,kBAAU,EAACL,GAAG,CAAC,CACtBN,IAAI,CAACY,MAAM,CAACb,KAAK,CACnB,CAAC,CAAC,CACF,MAAO,CAAAO,GACT,CAEO,QAAS,CAAAO,QAAQA,CAACZ,OAA2B,CAAE,CACpD,GAAI,CAAAK,GAA6B,CACjC,GAAAE,UAAG,EAAC,IAAM,CACRF,GAAG,CAAG,GAAAM,cAAM,EAACX,OAAO,CACtB,CAAC,CAAC,CACF,GAAIK,GAAG,GAAKQ,SAAS,CAAE,KAAM,CAAAC,KAAK,CAAC,eAAe,CAAC,CAEnD,KAAM,CAAAC,KAAK,CAAGV,GAAG,CAACW,UAAU,CAAC,CAAC,CAACC,UAAU,CACzCC,MAAM,CAACH,KAAK,CAACI,MAAM,CAAG,CAAC,CAAG,CAAC,GAAGJ,KAAK,CAAC,CAAGA,KAAK,CAAC,CAAC,CAAC,CAAC,CAACK,eAAe,CAAC,CAAC,CAClE,MAAO,CAAAf,GACT","ignoreList":[]}
@@ -1,9 +1,11 @@
1
- "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.bookStyleSheets=bookStyleSheets;exports.default=splitComponent;exports.freeStyleSheets=freeStyleSheets;var _propTypes=_interopRequireDefault(require("prop-types"));var _react=require("react");var _jsUtils=require("@dr.pogodin/js-utils");var _globalState=require("./globalState");var _isomorphy=require("./isomorphy");var _jsxRuntime=require("react/jsx-runtime");/* eslint-disable react/jsx-props-no-spreading */ /* global document */ // Note: At the client side we can get chunk groups immediately when loading
2
- // the module; at the server-side we only can get them within React render flow.
1
+ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.bookStyleSheets=bookStyleSheets;exports.default=splitComponent;exports.freeStyleSheets=freeStyleSheets;var _propTypes=_interopRequireDefault(require("prop-types"));var _react=require("react");var _jsUtils=require("@dr.pogodin/js-utils");var _globalState=require("./globalState");var _isomorphy=require("./isomorphy");var _jsxRuntime=require("react/jsx-runtime");/* eslint-disable react/jsx-props-no-spreading */ /* global document */ // NOTE: At the client-side we get chunk groups the first time they are needed
2
+ // (we used to get them eagerly when this module loaded, but it did not work well
3
+ // alongside custom chunk info injection in server-less scenario);
4
+ // at the server-side we only can get them within React render flow.
3
5
  // Thus, we set and use the following variable at the client-side, and then when
4
6
  // needed on the server side, we'll fetch it differently.
5
- let clientChunkGroups;if(_isomorphy.IS_CLIENT_SIDE){// eslint-disable-next-line global-require
6
- clientChunkGroups=require("../../client/getInj").default().CHUNK_GROUPS||{}}const refCounts={};function getPublicPath(){return(0,_isomorphy.getBuildInfo)().publicPath}/**
7
+ let cachedClientChunkGroups;function getClientChunkGroups(){if(_isomorphy.IS_CLIENT_SIDE&&!cachedClientChunkGroups){// eslint-disable-next-line global-require
8
+ cachedClientChunkGroups=require("../../client/getInj").default().CHUNK_GROUPS||{}}if(!cachedClientChunkGroups)throw Error("Internal error");return cachedClientChunkGroups}const refCounts={};function getPublicPath(){return(0,_isomorphy.getBuildInfo)().publicPath}/**
7
9
  * Client-side only! Ensures the specified CSS stylesheet is loaded into
8
10
  * the document; loads if it is missing; and does simple reference counting
9
11
  * to facilitate future clean-up.
@@ -39,13 +41,13 @@ const usedChunkNames=new Set;/**
39
41
  * @param {React.Element} [options.placeholder]
40
42
  * @return {React.ElementType}
41
43
  */function splitComponent({chunkName,getComponent,placeholder}){// On the client side we can check right away if the chunk name is known.
42
- if(_isomorphy.IS_CLIENT_SIDE)assertChunkName(chunkName,clientChunkGroups);// The correct usage of splitComponent() assumes a single call per chunk.
44
+ if(_isomorphy.IS_CLIENT_SIDE)assertChunkName(chunkName,getClientChunkGroups());// The correct usage of splitComponent() assumes a single call per chunk.
43
45
  if(usedChunkNames.has(chunkName)){throw Error(`Repeated splitComponent() call for the chunk "${chunkName}"`)}else usedChunkNames.add(chunkName);const LazyComponent=/*#__PURE__*/(0,_react.lazy)(async()=>{const resolved=await getComponent();const Component="default"in resolved?resolved.default:resolved;// This pre-loads necessary stylesheets prior to the first mount of
44
46
  // the component (the lazy load function is executed by React one at
45
47
  // the frist mount).
46
- if(_isomorphy.IS_CLIENT_SIDE){await bookStyleSheets(chunkName,clientChunkGroups,false)}const Wrapper=/*#__PURE__*/(0,_react.forwardRef)(({children,...rest},ref)=>{// On the server side we'll assert the chunk name here,
48
+ if(_isomorphy.IS_CLIENT_SIDE){await bookStyleSheets(chunkName,getClientChunkGroups(),false)}const Wrapper=/*#__PURE__*/(0,_react.forwardRef)(({children,...rest},ref)=>{// On the server side we'll assert the chunk name here,
47
49
  // and also push it to the SSR chunks array.
48
50
  if(_isomorphy.IS_SERVER_SIDE){const{chunkGroups,chunks}=(0,_globalState.getSsrContext)();assertChunkName(chunkName,chunkGroups);if(!chunks.includes(chunkName))chunks.push(chunkName)}// This takes care about stylesheets management every time an instance of
49
51
  // this component is mounted / unmounted.
50
- (0,_react.useInsertionEffect)(()=>{bookStyleSheets(chunkName,clientChunkGroups,true);return()=>freeStyleSheets(chunkName,clientChunkGroups)},[]);return/*#__PURE__*/(0,_jsxRuntime.jsx)(Component,{ref:ref,...rest,children:children})});return{default:Wrapper}});const CodeSplit=({children,...rest})=>/*#__PURE__*/(0,_jsxRuntime.jsx)(_react.Suspense,{fallback:placeholder,children:/*#__PURE__*/(0,_jsxRuntime.jsx)(LazyComponent,{...rest,children:children})});CodeSplit.propTypes={children:_propTypes.default.node};return CodeSplit}
52
+ (0,_react.useInsertionEffect)(()=>{bookStyleSheets(chunkName,getClientChunkGroups(),true);return()=>freeStyleSheets(chunkName,getClientChunkGroups())},[]);return/*#__PURE__*/(0,_jsxRuntime.jsx)(Component,{ref:ref,...rest,children:children})});return{default:Wrapper}});const CodeSplit=({children,...rest})=>/*#__PURE__*/(0,_jsxRuntime.jsx)(_react.Suspense,{fallback:placeholder,children:/*#__PURE__*/(0,_jsxRuntime.jsx)(LazyComponent,{...rest,children:children})});CodeSplit.propTypes={children:_propTypes.default.node};return CodeSplit}
51
53
  //# sourceMappingURL=splitComponent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"splitComponent.js","names":["_propTypes","_interopRequireDefault","require","_react","_jsUtils","_globalState","_isomorphy","_jsxRuntime","clientChunkGroups","IS_CLIENT_SIDE","default","CHUNK_GROUPS","refCounts","getPublicPath","getBuildInfo","publicPath","bookStyleSheet","name","loadedSheets","refCount","res","path","fullPath","document","location","origin","has","link","querySelector","createElement","setAttribute","head","appendChild","Barrier","addEventListener","resolve","current","getLoadedStyleSheets","Set","styleSheets","i","length","href","add","assertChunkName","chunkName","chunkGroups","Error","bookStyleSheets","promises","assets","asset","endsWith","promise","push","Promise","allSettled","then","freeStyleSheets","remove","usedChunkNames","splitComponent","getComponent","placeholder","LazyComponent","lazy","resolved","Component","Wrapper","forwardRef","children","rest","ref","IS_SERVER_SIDE","chunks","getSsrContext","includes","useInsertionEffect","jsx","CodeSplit","Suspense","fallback","propTypes","PT","node"],"sources":["../../../../src/shared/utils/splitComponent.tsx"],"sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\n/* global document */\n\nimport PT from 'prop-types';\n\nimport {\n type ComponentType,\n type ReactNode,\n forwardRef,\n lazy,\n Suspense,\n useInsertionEffect,\n} from 'react';\n\nimport { Barrier } from '@dr.pogodin/js-utils';\n\nimport { type ChunkGroupsT, getSsrContext } from './globalState';\n\nimport {\n IS_CLIENT_SIDE,\n IS_SERVER_SIDE,\n getBuildInfo,\n} from './isomorphy';\n\n// Note: At the client side we can get chunk groups immediately when loading\n// the module; at the server-side we only can get them within React render flow.\n// Thus, we set and use the following variable at the client-side, and then when\n// needed on the server side, we'll fetch it differently.\nlet clientChunkGroups: ChunkGroupsT;\n\nif (IS_CLIENT_SIDE) {\n // eslint-disable-next-line global-require\n clientChunkGroups = require('client/getInj').default().CHUNK_GROUPS || {};\n}\n\nconst refCounts: { [path: string]: number } = {};\n\nfunction getPublicPath() {\n return getBuildInfo().publicPath;\n}\n\n/**\n * Client-side only! Ensures the specified CSS stylesheet is loaded into\n * the document; loads if it is missing; and does simple reference counting\n * to facilitate future clean-up.\n * @param name\n * @param loadedSheets\n * @param refCount\n * @return\n */\nfunction bookStyleSheet(\n name: string,\n loadedSheets: Set<string>,\n refCount: boolean,\n): Promise<void> | undefined {\n let res: Barrier<void> | undefined;\n const path = `${getPublicPath()}/${name}`;\n const fullPath = `${document.location.origin}${path}`;\n\n if (!loadedSheets.has(fullPath)) {\n let link = document.querySelector(`link[href=\"${path}\"]`);\n\n if (!link) {\n link = document.createElement('link');\n link.setAttribute('rel', 'stylesheet');\n link.setAttribute('href', path);\n document.head.appendChild(link);\n }\n\n res = new Barrier<void>();\n link.addEventListener('load', () => res!.resolve());\n link.addEventListener('error', () => res!.resolve());\n }\n\n if (refCount) {\n const current = refCounts[path] || 0;\n refCounts[path] = 1 + current;\n }\n\n return res;\n}\n\n/**\n * Generates the set of URLs for currently loaded, linked stylesheets.\n * @return\n */\nfunction getLoadedStyleSheets(): Set<string> {\n const res = new Set<string>();\n const { styleSheets } = document;\n for (let i = 0; i < styleSheets.length; ++i) {\n const { href } = styleSheets[i];\n if (href) res.add(href);\n }\n return res;\n}\n\nfunction assertChunkName(\n chunkName: string,\n chunkGroups: ChunkGroupsT,\n) {\n if (chunkGroups[chunkName]) return;\n throw Error(`Unknown chunk name \"${chunkName}\"`);\n}\n\n/**\n * Client-side only! Ensures all CSS stylesheets required for the specified\n * code chunk are loaded into the document; loads the missing ones; and does\n * simple reference counting to facilitate future clean-up.\n * @param chunkName Chunk name.\n * @param refCount\n * @return Resolves once all pending stylesheets, necessary for\n * the chunk, are either loaded, or failed to load.\n */\nexport function bookStyleSheets(\n chunkName: string,\n chunkGroups: ChunkGroupsT,\n refCount: boolean,\n): Promise<void> {\n const promises = [];\n const assets = chunkGroups[chunkName];\n const loadedSheets = getLoadedStyleSheets();\n\n for (let i = 0; i < assets.length; ++i) {\n const asset = assets[i];\n if (asset.endsWith('.css')) {\n const promise = bookStyleSheet(asset, loadedSheets, refCount);\n if (promise) promises.push(promise);\n }\n }\n\n return promises.length\n ? Promise.allSettled(promises).then()\n : Promise.resolve();\n}\n\n/**\n * Client-side only! Frees from the document all CSS stylesheets that are\n * required by the specified chunk, and have reference counter equal to one\n * (for chunks with larger reference counter values, it just decrements\n * the reference counter).\n * @param {string} chunkName\n */\nexport function freeStyleSheets(\n chunkName: string,\n chunkGroups: ChunkGroupsT,\n) {\n const assets = chunkGroups[chunkName];\n for (let i = 0; i < assets.length; ++i) {\n const asset = assets[i];\n if (asset.endsWith('.css')) {\n const path = `${getPublicPath()}/${asset}`;\n if (--refCounts[path] <= 0) {\n document.head.querySelector(`link[href=\"${path}\"]`)!.remove();\n }\n }\n }\n}\n\n// Holds the set of chunk names already used for splitComponent() calls.\nconst usedChunkNames = new Set();\n\ntype ComponentOrModule<PropsT> = ComponentType<PropsT> | {\n default: ComponentType<PropsT>,\n};\n\n/**\n * Given an async component retrieval function `getComponent()` it creates\n * a special \"code split\" component, which uses <Suspense> to asynchronously\n * load on demand the code required by `getComponent()`.\n * @param options\n * @param options.chunkName\n * @param {function} options.getComponent\n * @param {React.Element} [options.placeholder]\n * @return {React.ElementType}\n */\nexport default function splitComponent<\n ComponentPropsT extends { children?: ReactNode },\n>({\n chunkName,\n getComponent,\n placeholder,\n}: {\n chunkName: string;\n getComponent: () => Promise<ComponentOrModule<ComponentPropsT>>,\n placeholder?: ReactNode,\n}) {\n // On the client side we can check right away if the chunk name is known.\n if (IS_CLIENT_SIDE) assertChunkName(chunkName, clientChunkGroups);\n\n // The correct usage of splitComponent() assumes a single call per chunk.\n if (usedChunkNames.has(chunkName)) {\n throw Error(`Repeated splitComponent() call for the chunk \"${chunkName}\"`);\n } else usedChunkNames.add(chunkName);\n\n const LazyComponent = lazy(async () => {\n const resolved = await getComponent();\n const Component = 'default' in resolved ? resolved.default : resolved;\n\n // This pre-loads necessary stylesheets prior to the first mount of\n // the component (the lazy load function is executed by React one at\n // the frist mount).\n if (IS_CLIENT_SIDE) {\n await bookStyleSheets(chunkName, clientChunkGroups, false);\n }\n\n const Wrapper = forwardRef((\n { children, ...rest }: ComponentPropsT,\n ref,\n ) => {\n // On the server side we'll assert the chunk name here,\n // and also push it to the SSR chunks array.\n if (IS_SERVER_SIDE) {\n const { chunkGroups, chunks } = getSsrContext()!;\n assertChunkName(chunkName, chunkGroups);\n if (!chunks.includes(chunkName)) chunks.push(chunkName);\n }\n\n // This takes care about stylesheets management every time an instance of\n // this component is mounted / unmounted.\n useInsertionEffect(() => {\n bookStyleSheets(chunkName, clientChunkGroups, true);\n return () => freeStyleSheets(chunkName, clientChunkGroups);\n }, []);\n\n return (\n <Component ref={ref} {...rest as ComponentPropsT}>\n {children}\n </Component>\n );\n });\n\n return { default: Wrapper };\n });\n\n const CodeSplit: React.FunctionComponent<ComponentPropsT> = ({\n children,\n ...rest\n }: ComponentPropsT) => (\n <Suspense fallback={placeholder}>\n <LazyComponent {...rest as Parameters<typeof LazyComponent>[0]}>\n {children}\n </LazyComponent>\n </Suspense>\n );\n\n CodeSplit.propTypes = {\n children: PT.node,\n } as PT.WeakValidationMap<ComponentPropsT>;\n\n return CodeSplit;\n}\n"],"mappings":"wQAGA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBAEA,IAAAC,MAAA,CAAAD,OAAA,UASA,IAAAE,QAAA,CAAAF,OA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EAAE,CAAC,CAEN,mBACE,GAAAD,WAAA,CAAAuE,GAAA,EAACX,SAAS,EAACK,GAAG,CAAEA,GAAI,IAAKD,IAAI,CAAAD,QAAA,CAC1BA,QAAQ,CACA,CAEf,CAAC,CAAC,CAEF,MAAO,CAAE5D,OAAO,CAAE0D,OAAQ,CAC5B,CAAC,CAAC,CAEF,KAAM,CAAAW,SAAmD,CAAGA,CAAC,CAC3DT,QAAQ,CACR,GAAGC,IACY,CAAC,gBAChB,GAAAhE,WAAA,CAAAuE,GAAA,EAAC3E,MAAA,CAAA6E,QAAQ,EAACC,QAAQ,CAAElB,WAAY,CAAAO,QAAA,cAC9B,GAAA/D,WAAA,CAAAuE,GAAA,EAACd,aAAa,KAAKO,IAAI,CAAAD,QAAA,CACpBA,QAAQ,CACI,CAAC,CACR,CACX,CAEDS,SAAS,CAACG,SAAS,CAAG,CACpBZ,QAAQ,CAAEa,kBAAE,CAACC,IACf,CAA0C,CAE1C,MAAO,CAAAL,SACT","ignoreList":[]}
1
+ {"version":3,"file":"splitComponent.js","names":["_propTypes","_interopRequireDefault","require","_react","_jsUtils","_globalState","_isomorphy","_jsxRuntime","cachedClientChunkGroups","getClientChunkGroups","IS_CLIENT_SIDE","default","CHUNK_GROUPS","Error","refCounts","getPublicPath","getBuildInfo","publicPath","bookStyleSheet","name","loadedSheets","refCount","res","path","fullPath","document","location","origin","has","link","querySelector","createElement","setAttribute","head","appendChild","Barrier","addEventListener","resolve","current","getLoadedStyleSheets","Set","styleSheets","i","length","href","add","assertChunkName","chunkName","chunkGroups","bookStyleSheets","promises","assets","asset","endsWith","promise","push","Promise","allSettled","then","freeStyleSheets","remove","usedChunkNames","splitComponent","getComponent","placeholder","LazyComponent","lazy","resolved","Component","Wrapper","forwardRef","children","rest","ref","IS_SERVER_SIDE","chunks","getSsrContext","includes","useInsertionEffect","jsx","CodeSplit","Suspense","fallback","propTypes","PT","node"],"sources":["../../../../src/shared/utils/splitComponent.tsx"],"sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\n/* global document */\n\nimport PT from 'prop-types';\n\nimport {\n type ComponentType,\n type ReactNode,\n forwardRef,\n lazy,\n Suspense,\n useInsertionEffect,\n} from 'react';\n\nimport { Barrier } from '@dr.pogodin/js-utils';\n\nimport { type ChunkGroupsT, getSsrContext } from './globalState';\n\nimport {\n IS_CLIENT_SIDE,\n IS_SERVER_SIDE,\n getBuildInfo,\n} from './isomorphy';\n\n// NOTE: At the client-side we get chunk groups the first time they are needed\n// (we used to get them eagerly when this module loaded, but it did not work well\n// alongside custom chunk info injection in server-less scenario);\n// at the server-side we only can get them within React render flow.\n// Thus, we set and use the following variable at the client-side, and then when\n// needed on the server side, we'll fetch it differently.\nlet cachedClientChunkGroups: ChunkGroupsT | undefined;\n\nfunction getClientChunkGroups(): ChunkGroupsT {\n if (IS_CLIENT_SIDE && !cachedClientChunkGroups) {\n // eslint-disable-next-line global-require\n cachedClientChunkGroups = require('client/getInj').default().CHUNK_GROUPS || {};\n }\n\n if (!cachedClientChunkGroups) throw Error('Internal error');\n\n return cachedClientChunkGroups;\n}\n\nconst refCounts: { [path: string]: number } = {};\n\nfunction getPublicPath() {\n return getBuildInfo().publicPath;\n}\n\n/**\n * Client-side only! Ensures the specified CSS stylesheet is loaded into\n * the document; loads if it is missing; and does simple reference counting\n * to facilitate future clean-up.\n * @param name\n * @param loadedSheets\n * @param refCount\n * @return\n */\nfunction bookStyleSheet(\n name: string,\n loadedSheets: Set<string>,\n refCount: boolean,\n): Promise<void> | undefined {\n let res: Barrier<void> | undefined;\n const path = `${getPublicPath()}/${name}`;\n const fullPath = `${document.location.origin}${path}`;\n\n if (!loadedSheets.has(fullPath)) {\n let link = document.querySelector(`link[href=\"${path}\"]`);\n\n if (!link) {\n link = document.createElement('link');\n link.setAttribute('rel', 'stylesheet');\n link.setAttribute('href', path);\n document.head.appendChild(link);\n }\n\n res = new Barrier<void>();\n link.addEventListener('load', () => res!.resolve());\n link.addEventListener('error', () => res!.resolve());\n }\n\n if (refCount) {\n const current = refCounts[path] || 0;\n refCounts[path] = 1 + current;\n }\n\n return res;\n}\n\n/**\n * Generates the set of URLs for currently loaded, linked stylesheets.\n * @return\n */\nfunction getLoadedStyleSheets(): Set<string> {\n const res = new Set<string>();\n const { styleSheets } = document;\n for (let i = 0; i < styleSheets.length; ++i) {\n const { href } = styleSheets[i];\n if (href) res.add(href);\n }\n return res;\n}\n\nfunction assertChunkName(\n chunkName: string,\n chunkGroups: ChunkGroupsT,\n) {\n if (chunkGroups[chunkName]) return;\n throw Error(`Unknown chunk name \"${chunkName}\"`);\n}\n\n/**\n * Client-side only! Ensures all CSS stylesheets required for the specified\n * code chunk are loaded into the document; loads the missing ones; and does\n * simple reference counting to facilitate future clean-up.\n * @param chunkName Chunk name.\n * @param refCount\n * @return Resolves once all pending stylesheets, necessary for\n * the chunk, are either loaded, or failed to load.\n */\nexport function bookStyleSheets(\n chunkName: string,\n chunkGroups: ChunkGroupsT,\n refCount: boolean,\n): Promise<void> {\n const promises = [];\n const assets = chunkGroups[chunkName];\n const loadedSheets = getLoadedStyleSheets();\n\n for (let i = 0; i < assets.length; ++i) {\n const asset = assets[i];\n if (asset.endsWith('.css')) {\n const promise = bookStyleSheet(asset, loadedSheets, refCount);\n if (promise) promises.push(promise);\n }\n }\n\n return promises.length\n ? Promise.allSettled(promises).then()\n : Promise.resolve();\n}\n\n/**\n * Client-side only! Frees from the document all CSS stylesheets that are\n * required by the specified chunk, and have reference counter equal to one\n * (for chunks with larger reference counter values, it just decrements\n * the reference counter).\n * @param {string} chunkName\n */\nexport function freeStyleSheets(\n chunkName: string,\n chunkGroups: ChunkGroupsT,\n) {\n const assets = chunkGroups[chunkName];\n for (let i = 0; i < assets.length; ++i) {\n const asset = assets[i];\n if (asset.endsWith('.css')) {\n const path = `${getPublicPath()}/${asset}`;\n if (--refCounts[path] <= 0) {\n document.head.querySelector(`link[href=\"${path}\"]`)!.remove();\n }\n }\n }\n}\n\n// Holds the set of chunk names already used for splitComponent() calls.\nconst usedChunkNames = new Set();\n\ntype ComponentOrModule<PropsT> = ComponentType<PropsT> | {\n default: ComponentType<PropsT>,\n};\n\n/**\n * Given an async component retrieval function `getComponent()` it creates\n * a special \"code split\" component, which uses <Suspense> to asynchronously\n * load on demand the code required by `getComponent()`.\n * @param options\n * @param options.chunkName\n * @param {function} options.getComponent\n * @param {React.Element} [options.placeholder]\n * @return {React.ElementType}\n */\nexport default function splitComponent<\n ComponentPropsT extends { children?: ReactNode },\n>({\n chunkName,\n getComponent,\n placeholder,\n}: {\n chunkName: string;\n getComponent: () => Promise<ComponentOrModule<ComponentPropsT>>,\n placeholder?: ReactNode,\n}) {\n // On the client side we can check right away if the chunk name is known.\n if (IS_CLIENT_SIDE) assertChunkName(chunkName, getClientChunkGroups());\n\n // The correct usage of splitComponent() assumes a single call per chunk.\n if (usedChunkNames.has(chunkName)) {\n throw Error(`Repeated splitComponent() call for the chunk \"${chunkName}\"`);\n } else usedChunkNames.add(chunkName);\n\n const LazyComponent = lazy(async () => {\n const resolved = await getComponent();\n const Component = 'default' in resolved ? resolved.default : resolved;\n\n // This pre-loads necessary stylesheets prior to the first mount of\n // the component (the lazy load function is executed by React one at\n // the frist mount).\n if (IS_CLIENT_SIDE) {\n await bookStyleSheets(chunkName, getClientChunkGroups(), false);\n }\n\n const Wrapper = forwardRef((\n { children, ...rest }: ComponentPropsT,\n ref,\n ) => {\n // On the server side we'll assert the chunk name here,\n // and also push it to the SSR chunks array.\n if (IS_SERVER_SIDE) {\n const { chunkGroups, chunks } = getSsrContext()!;\n assertChunkName(chunkName, chunkGroups);\n if (!chunks.includes(chunkName)) chunks.push(chunkName);\n }\n\n // This takes care about stylesheets management every time an instance of\n // this component is mounted / unmounted.\n useInsertionEffect(() => {\n bookStyleSheets(chunkName, getClientChunkGroups(), true);\n return () => freeStyleSheets(chunkName, getClientChunkGroups());\n }, []);\n\n return (\n <Component ref={ref} {...rest as ComponentPropsT}>\n {children}\n </Component>\n );\n });\n\n return { default: Wrapper };\n });\n\n const CodeSplit: React.FunctionComponent<ComponentPropsT> = ({\n children,\n ...rest\n }: ComponentPropsT) => (\n <Suspense fallback={placeholder}>\n <LazyComponent {...rest as Parameters<typeof LazyComponent>[0]}>\n {children}\n </LazyComponent>\n </Suspense>\n );\n\n CodeSplit.propTypes = {\n children: PT.node,\n } as PT.WeakValidationMap<ComponentPropsT>;\n\n return CodeSplit;\n}\n"],"mappings":"wQAGA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBAEA,IAAAC,MAAA,CAAAD,OAAA,UASA,IAAAE,QAAA,CAAAF,OAAA,yBAEA,IAAAG,YAAA,CAAAH,OAAA,kBAEA,IAAAI,UAAA,CAAAJ,OAAA,gBAIqB,IAAAK,WAAA,CAAAL,OAAA,sBAtBrB,kDACA,sBAuBA;AACA;AACA;AACA;AACA;AACA;AACA,GAAI,CAAAM,uBAAiD,CAErD,QAAS,CAAAC,oBAAoBA,CAAA,CAAiB,CAC5C,GAAIC,yBAAc,EAAI,CAACF,uBAAuB,CAAE,CAC9C;AACAA,uBAAuB,CAAGN,OAAO,sBAAgB,CAAC,CAACS,OAAO,CAAC,CAAC,CAACC,YAAY,EAAI,CAAC,CAChF,CAEA,GAAI,CAACJ,uBAAuB,CAAE,KAAM,CAAAK,KAAK,CAAC,gBAAgB,CAAC,CAE3D,MAAO,CAAAL,uBACT,CAEA,KAAM,CAAAM,SAAqC,CAAG,CAAC,CAAC,CAEhD,QAAS,CAAAC,aAAaA,CAAA,CAAG,CACvB,MAAO,GAAAC,uBAAY,EAAC,CAAC,CAACC,UACxB,CAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAAS,CAAAC,cAAcA,CACrBC,IAAY,CACZC,YAAyB,CACzBC,QAAiB,CACU,CAC3B,GAAI,CAAAC,GAA8B,CAClC,KAAM,CAAAC,IAAI,CAAG,GAAGR,aAAa,CAAC,CAAC,IAAII,IAAI,EAAE,CACzC,KAAM,CAAAK,QAAQ,CAAG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+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("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","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("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["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__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 l}}),n(155);var r=n(126),o=n(236),i=n(442),a=n(227),c=n(848);function l(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 l=(0,c.jsx)(r.GlobalStateProvider,{initialState:(0,a.A)().ISTATE||t.initialState,children:(0,c.jsx)(i.BrowserRouter,{future:{v7_relativeSplatPath:!0},children:(0,c.jsx)(e,{})})});t.dontHydrate?(0,o.createRoot)(n).render(l):(0,o.hydrateRoot)(n,l)}},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 c},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 c(){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 c=e.indexOf("=",i);if(-1===c)break;var l=e.indexOf(";",i);if(-1===l)l=e.length;else if(l<c){i=e.lastIndexOf(";",c-1)+1;continue}var s=e.slice(i,c).trim();if(void 0===n[s]){var u=e.slice(c+1,l).trim();34===u.charCodeAt(0)&&(u=u.slice(1,-1)),n[s]=a(u,r)}i=l+1}return n},t.serialize=function(e,t,o){var a=o||{},c=a.encode||i;if("function"!=typeof c)throw new TypeError("option encode is invalid");if(!r.test(e))throw new TypeError("argument name is invalid");var l=c(t);if(l&&!r.test(l))throw new TypeError("argument val is invalid");var s=e+"="+l;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,c=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={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)&&!l.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:c.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__},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 L},Button:function(){return ae},Checkbox:function(){return se},CustomDropdown:function(){return z},Dropdown:function(){return V},Emitter:function(){return _.Emitter},GlobalStateProvider:function(){return d.GlobalStateProvider},Input:function(){return de},Link:function(){return re},MetaTags:function(){return we},Modal:function(){return N},NavLink:function(){return ve},PT:function(){return m},PageLayout:function(){return he},Semaphore:function(){return _.Semaphore},Switch:function(){return J},TextArea:function(){return Ke},ThemeProvider:function(){return e.ThemeProvider},Throbber:function(){return xe},WithTooltip:function(){return Le},YouTubeVideo:function(){return Ie},api:function(){return S()},client:function(){return Ye},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 B},optionsValidator:function(){return I},server:function(){return Xe},splitComponent:function(){return k},themed:function(){return R},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),c=__webpack_require__(427),l=__webpack_require__(185),s=__webpack_require__.n(l),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=c.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 w;a.IS_CLIENT_SIDE&&(w=__webpack_require__(227).A().CHUNK_GROUPS||{});const v={};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=v[o]||0;v[o]=1+e}return r}function x(e,t){if(!t[e])throw Error(`Unknown chunk name "${e}"`)}function T(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 C=new Set;function k(e){let{chunkName:t,getComponent:n,placeholder:r}=e;if(a.IS_CLIENT_SIDE&&x(t,w),C.has(t))throw Error(`Repeated splitComponent() call for the chunk "${t}"`);C.add(t);const o=(0,u.lazy)((async()=>{const e=await n(),r="default"in e?e.default:e;a.IS_CLIENT_SIDE&&await T(t,w,!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)((()=>(T(t,w,!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}`;--v[e]<=0&&document.head.querySelector(`link[href="${e}"]`).remove()}}}(t,w))),[]),(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}const R=t();R.COMPOSE=e.COMPOSE,R.PRIORITY=e.PRIORITY;var P=__webpack_require__(742),S=__webpack_require__.n(P),O=__webpack_require__(514),q=__webpack_require__.n(O),A="_5fRFtF";const L=e=>{let{cancelOnScrolling:t,children:n,containerStyle:r,dontDisableScrolling:o,onCancel:i,theme:a}=e;const c=(0,u.useRef)(null),l=(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(A),()=>{o||document.body.classList.remove(A)})),[o]);const d=(0,u.useMemo)((()=>(0,E.jsx)("div",{onFocus:()=>{var e,t;const n=null===(e=c.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=l.current)||void 0===t||t.focus()},tabIndex:0})),[]);return s?q().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!==l.current&&(l.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:c,role:"dialog",style:r,children:n}),(0,E.jsx)("div",{onFocus:()=>{var e;null===(e=l.current)||void 0===e||e.focus()},tabIndex:0}),d]}),s):null},j=t()(L,"Modal",["container","overlay"],{overlay:"ye2BZo",context:"Szmbbz",ad:"Ah-Nsc",hoc:"Wki41G",container:"gyZ4rc"});L.propTypes={cancelOnScrolling:b().bool,children:b().node,containerStyle:b().shape({}),dontDisableScrolling:b().bool,onCancel:b().func,theme:j.themeType.isRequired};var N=j;const D=["active","arrow","container","dropdown","hiddenOption","label","option","select","upward"],M=b().oneOfType([b().number.isRequired,b().string.isRequired]),B=b().oneOfType([b().shape({name:b().node,value:M.isRequired}).isRequired,b().number.isRequired,b().string.isRequired]),I=b().arrayOf(B.isRequired),U=b().oneOfType([b().shape({name:b().string,value:M.isRequired}).isRequired,b().number.isRequired,b().string.isRequired]),W=b().arrayOf(U.isRequired);function K(e){var t;return function(e){const t=typeof e;return"number"===t||"string"===t}(e)?[e,e]:[e.value,null!==(t=e.name)&&void 0!==t?t:e.value]}const X=(0,u.forwardRef)(((e,t)=>{let{containerClass:n,containerStyle:r,filter:o,onCancel:i,onChange:a,optionClass:c,options:l}=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<l.length;++e){const t=l[e];if(!o||o(t)){const[e,n]=K(t);_.push((0,E.jsx)("div",{className:c,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)(L,{cancelOnScrolling:!0,containerStyle:r,dontDisableScrolling:!0,onCancel:i,theme:{ad:"",hoc:"",container:n,context:"",overlay:"jKsMKG"},children:(0,E.jsx)("div",{ref:s,children:_})})}));X.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:I.isRequired};var Y=X;const F=e=>{let{filter:t,label:n,onChange:r,options:o,theme:i,value:a}=e;if(!o)throw Error("Internal error");const[c,l]=(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(!c)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,c;const e=o.bottom+i.height<(null!==(a=null===(c=window.visualViewport)||void 0===c?void 0:c.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)}}),[c]);const m=e=>{const t=window.visualViewport,n=s.current.getBoundingClientRect();l(!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]=K(n);if(e===a){b=t;break}}}let w=i.container;c&&(w+=` ${i.active}`);let v=i.select||"";return f&&(w+=` ${i.upward}`,v+=` ${i.upward}`),(0,E.jsxs)("div",{className:w,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})]}),c?(0,E.jsx)(Y,{containerClass:v,containerStyle:d,onCancel:()=>{l(!1)},onChange:e=>{l(!1),r&&r(e)},optionClass:i.option||"",options:o,ref:_}):null]})},$=t()(F,"CustomDropdown",D,{container:"oQKv0Y",context:"_9Tod5r",ad:"R58zIg",hoc:"O-Tp1i",label:"YUPUNs",dropdown:"pNEyAA",option:"LD2Kzy",select:"LP5azC",arrow:"-wscve",active:"k2UDsV",upward:"HWRvu4"});F.propTypes={filter:b().func,label:b().node,onChange:b().func,options:b().arrayOf(B.isRequired),theme:$.themeType.isRequired,value:M};var z=$;const H=e=>{let{filter:t,label:n,onChange:r,options:o,theme:i,value:a}=e;if(!o)throw Error("Internal error");let c=!1;const l=[];for(let e=0;e<o.length;++e){const n=o[e];if(!t||t(n)){const[e,t]=K(n);c||(c=e===a),l.push((0,E.jsx)("option",{className:i.option,value:e,children:t},e))}}const s=c?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,l]}),(0,E.jsx)("div",{className:i.arrow})]})]})},G=t()(H,"Dropdown",D,{dropdown:"kI9A9U",context:"xHyZo4",ad:"ADu59e",hoc:"FTP2bb",arrow:"DubGkT",container:"WtSZPd",active:"ayMn7O",label:"K7JYKw",hiddenOption:"clAKFJ",select:"N0Fc14"});H.propTypes={filter:b().func,label:b().node,onChange:b().func,options:W,theme:G.themeType.isRequired,value:M};var V=G;const Z=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,c]=K(r[e]);let l,s=o.option;t===i?s+=` ${o.selected}`:n&&(l=()=>n(t)),a.push(l?(0,E.jsx)("div",{className:s,onClick:l,onKeyDown:e=>{l&&"Enter"===e.key&&l()},role:"button",tabIndex:0,children:c},t):(0,E.jsx)("div",{className:s,children:c},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})]})},Q=t()(Z,"Switch",["container","label","option","options","selected"],{container:"AWNvRj",context:"VMHfnP",ad:"HNliRC",hoc:"_2Ue-db",option:"fUfIAd",selected:"Wco-qk",options:"CZYtcC"});Z.propTypes={label:b().node,onChange:b().func,options:I,theme:Q.themeType.isRequired,value:M};var J=Q,ee=__webpack_require__(442);const te=e=>{let{children:t,className:n,disabled:r,enforceA:o,keepScrollPosition:i,onClick:a,onMouseDown:c,openNewTab:l,replace:s,routerLinkType:u,to:_,...d}=e;if(r||o||l||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():c,rel:"noopener noreferrer",target:l?"_blank":"",children:t});const p=u;return(0,E.jsx)(p,{className:n,onMouseDown:c,replace:s,to:_,onClick:e=>{a&&a(e),i||window.scroll(0,0)},...d,children:t})};te.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 ne=te,re=e=>(0,E.jsx)(ne,{...e,routerLinkType:ee.Link});const oe=e=>{let{active:t,children:n,disabled:r,enforceA:o,onClick:i,onMouseDown:a,openNewTab:c,replace:l,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)(re,{className:_,enforceA:o,onClick:i,onMouseDown:a,openNewTab:c,replace:l,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})},ie=t()(oe,"Button",["active","button","disabled"],{button:"E1FNQT",context:"KM0v4f",ad:"_3jm1-Q",hoc:"_0plpDL",active:"MAe9O6",disabled:"Br9IWV"});oe.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:ie.themeType.isRequired,to:b().oneOfType([b().object,b().string])};var ae=ie;const ce=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"})]})},le=t()(ce,"Checkbox",["checkbox","container","label"],{checkbox:"A-f8qJ",context:"dNQcC6",ad:"earXxa",hoc:"qAPfQ6",container:"Kr0g3M",label:"_3dML-O"});ce.propTypes={checked:b().bool,label:b().node,onChange:b().func,theme:le.themeType.isRequired};var se=le;const ue=(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})]})})),_e=t()(ue,"Input",["container","input","label"],{container:"Cxx397",context:"X5WszA",ad:"_8s7GCr",hoc:"TVlBYc",input:"M07d4s",label:"gfbdq-"});ue.propTypes={label:b().node,theme:_e.themeType.isRequired};var de=_e;const pe=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})]})},fe=t()(pe,"PageLayout",["container","leftSidePanel","mainPanel","rightSidePanel","sidePanel"],{container:"T3cuHB",context:"m4mL-M",ad:"m3-mdC",hoc:"J15Z4H",mainPanel:"pPlQO2",sidePanel:"lqNh4h"});pe.propTypes={children:b().node,leftSidePanelContent:b().node,rightSidePanelContent:b().node,theme:fe.themeType.isRequired};var he=fe,me=__webpack_require__(883);const be=(0,u.createContext)({description:"",title:""}),Ee=e=>{let{children:t,description:n,image:r,siteName:o,socialDescription:i,socialTitle:a,title:c,url:l}=e;const s=a||c,_=i||n,d=(0,u.useMemo)((()=>({description:n,image:r,siteName:o,socialDescription:i,socialTitle:a,title:c,url:l})),[n,r,o,i,a,c,l]);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(me.Helmet,{children:[(0,E.jsx)("title",{children:c}),(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,l?(0,E.jsx)("meta",{name:"og:url",content:l}):null]}),t?(0,E.jsx)(be.Provider,{value:d,children:t}):null]})};Ee.Context=be,Ee.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 we=Ee,ve=e=>(0,E.jsx)(ne,{...e,routerLinkType:ee.NavLink});const ge=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})]})},ye=t()(ge,"Throbber",["bouncing","circle","container"],{container:"_7zdld4",context:"uIObt7",ad:"XIxe9o",hoc:"YOyORH",circle:"dBrB4g",bouncing:"TJe-6j"});ge.propTypes={theme:ye.themeType.isRequired};var xe=ye;let Te=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 Ce=["border-bottom-color:transparent","border-left-color:transparent","border-right-color:transparent"].join(";"),ke=["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}}(),c=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:Ce}}(e,t,i);if(c.containerX<a.left+6)c.containerX=a.left+6,c.arrowX=Math.max(6,e-c.containerX-i.arrow.width/2);else{const t=a.right-6-i.container.width;c.containerX>t&&(c.containerX=t,c.arrowX=Math.min(i.container.width-6,e-c.containerX-i.arrow.width/2))}c.containerY<a.top+6&&(c.containerY+=i.container.height+2*i.arrow.height,c.arrowY-=i.container.height+i.arrow.height,c.baseArrowStyle=ke);const l=`left:${c.containerX}px;top:${c.containerY}px`;o.container.setAttribute("style",l);const s=`${c.baseArrowStyle};left:${c.arrowX}px;top:${c.arrowY}px`;o.arrow.setAttribute("style",s)}const Pe=(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),c=(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:c}))),(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,O.createPortal)(n,i.content):null}));Pe.propTypes={children:b().node,theme:b().shape({}).isRequired};var Se=Pe;const Oe=e=>{let{children:t,placement:n=Te.ABOVE_CURSOR,tip:r,theme:o}=e;const{current:i}=(0,u.useRef)({lastCursorX:0,lastCursorY:0,triggeredByTouch:!1,timerId:void 0}),a=(0,u.useRef)(),c=(0,u.useRef)(null),[l,s]=(0,u.useState)(!1);return(0,u.useEffect)((()=>{if(l&&null!==r){a.current&&a.current.pointTo(i.lastCursorX+window.scrollX,i.lastCursorY+window.scrollY,n,c.current);const e=()=>s(!1);return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)}}),[i.lastCursorX,i.lastCursorY,n,l,r]),(0,E.jsxs)("div",{className:o.wrapper,onMouseLeave:()=>s(!1),onMouseMove:e=>((e,t)=>{if(l){const r=c.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,c.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:c,role:"presentation",children:[l&&null!==r?(0,E.jsx)(Se,{ref:a,theme:o,children:r}):null,t]})},qe=t()(Oe,"WithTooltip",["appearance","arrow","container","content","wrapper"],{arrow:"M9gywF",ad:"_4xT7zE",hoc:"zd-vnH",context:"GdZucr",container:"f9gY8K",appearance:"L4ubm-",wrapper:"_4qDBRM"}),Ae=qe;Ae.PLACEMENTS=Te,Oe.propTypes={children:b().node,placement:b().oneOf(Object.values(Te)),theme:qe.themeType.isRequired,tip:b().node};var Le=Ae,je=__webpack_require__(360),Ne=__webpack_require__.n(je),De={container:"jTxmOX",context:"dzIcLh",ad:"_5a9XX1",hoc:"_7sH52O"};const Me=e=>{var t;let{autoplay:n,src:r,theme:o,title:i}=e;const a=r.split("?");let c=a[0];const l=a[1],s=l?Ne().parse(l):{},u=s.v||(null===(t=c.match(/\/([a-zA-Z0-9-_]*)$/))||void 0===t?void 0:t[1]);return c=`https://www.youtube.com/embed/${u}`,delete s.v,s.autoplay=n?"1":"0",c+=`?${Ne().stringify(s)}`,(0,E.jsxs)("div",{className:o.container,children:[(0,E.jsx)(xe,{theme:De}),(0,E.jsx)("iframe",{allow:"autoplay",allowFullScreen:!0,className:o.video,src:c,title:i})]})},Be=t()(Me,"YouTubeVideo",["container","video"],{container:"sXHM81",context:"veKyYi",ad:"r3ABzd",hoc:"YKcPnR",video:"SlV2zw"});Me.propTypes={autoplay:b().bool,src:b().string.isRequired,theme:Be.themeType.isRequired,title:b().string};var Ie=Be;const Ue=e=>{let{disabled:t,onChange:n,onKeyDown:r,placeholder:o,theme:i,value:a}=e;const c=(0,u.useRef)(null),[l,s]=(0,u.useState)(),[_,d]=(0,u.useState)(a||"");return void 0!==a&&_!==a&&d(a),(0,u.useEffect)((()=>{const e=c.current;if(!e)return;const t=new ResizeObserver((()=>{s(e.scrollHeight)}));return t.observe(e),()=>{t.disconnect()}}),[]),(0,u.useEffect)((()=>{const e=c.current;e&&s(e.scrollHeight)}),[_]),(0,E.jsxs)("div",{className:i.container,children:[(0,E.jsx)("textarea",{readOnly:!0,ref:c,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:l},className:i.textarea,value:_})]})},We=t()(Ue,"TextArea",["container","hidden","textarea"],{container:"dzMVIB",context:"KVPc7g",ad:"z2GQ0Z",hoc:"_8R1Qdj",textarea:"zd-OFg",hidden:"GiHBXI"});Ue.propTypes={disabled:b().bool,onChange:b().func,onKeyDown:b().func,placeholder:b().string,theme:We.themeType.isRequired,value:b().string};var Ke=We;const Xe=r.requireWeak("./server","/"),Ye=Xe?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("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","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("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["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__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},Q:function(){return setInj}});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}function setInj(e){inj=e}},662:function(e,t,n){n.r(t),n.d(t,{default:function(){return l},setInj:function(){return a.Q}}),n(155);var r=n(126),o=n(236),i=n(442),a=n(227),c=n(848);function l(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 l=(0,c.jsx)(r.GlobalStateProvider,{initialState:(0,a.A)().ISTATE||t.initialState,children:(0,c.jsx)(i.BrowserRouter,{future:{v7_relativeSplatPath:!0},children:(0,c.jsx)(e,{})})});t.dontHydrate?(0,o.createRoot)(n).render(l):(0,o.hydrateRoot)(n,l)}},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 c},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 c(){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 c=e.indexOf("=",i);if(-1===c)break;var l=e.indexOf(";",i);if(-1===l)l=e.length;else if(l<c){i=e.lastIndexOf(";",c-1)+1;continue}var s=e.slice(i,c).trim();if(void 0===n[s]){var u=e.slice(c+1,l).trim();34===u.charCodeAt(0)&&(u=u.slice(1,-1)),n[s]=a(u,r)}i=l+1}return n},t.serialize=function(e,t,o){var a=o||{},c=a.encode||i;if("function"!=typeof c)throw new TypeError("option encode is invalid");if(!r.test(e))throw new TypeError("argument name is invalid");var l=c(t);if(l&&!r.test(l))throw new TypeError("argument val is invalid");var s=e+"="+l;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,c=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={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)&&!l.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:c.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__},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},BaseButton:function(){return ie},BaseModal:function(){return L},Button:function(){return ce},Checkbox:function(){return ue},CustomDropdown:function(){return H},Dropdown:function(){return Q},Emitter:function(){return _.Emitter},GlobalStateProvider:function(){return d.GlobalStateProvider},Input:function(){return pe},Link:function(){return oe},MetaTags:function(){return ve},Modal:function(){return D},NavLink:function(){return ge},PT:function(){return m},PageLayout:function(){return me},Semaphore:function(){return _.Semaphore},Switch:function(){return ee},TextArea:function(){return Xe},ThemeProvider:function(){return e.ThemeProvider},Throbber:function(){return Te},WithTooltip:function(){return Le},YouTubeVideo:function(){return Ue},api:function(){return O()},client:function(){return Fe},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 B},optionsValidator:function(){return U},server:function(){return Ye},splitComponent:function(){return R},themed:function(){return P},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),c=__webpack_require__(427),l=__webpack_require__(185),s=__webpack_require__.n(l),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=c.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 w;function v(){if(a.IS_CLIENT_SIDE&&!w&&(w=__webpack_require__(227).A().CHUNK_GROUPS||{}),!w)throw Error("Internal error");return w}const g={};function y(){return(0,a.getBuildInfo)().publicPath}function x(e,t,n){let r;const o=`${y()}/${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=g[o]||0;g[o]=1+e}return r}function T(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=x(t,i,n);e&&r.push(e)}}return r.length?Promise.allSettled(r).then():Promise.resolve()}const k=new Set;function R(e){let{chunkName:t,getComponent:n,placeholder:r}=e;if(a.IS_CLIENT_SIDE&&T(t,v()),k.has(t))throw Error(`Repeated splitComponent() call for the chunk "${t}"`);k.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();T(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=`${y()}/${t}`;--g[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}const P=t();P.COMPOSE=e.COMPOSE,P.PRIORITY=e.PRIORITY;var S=__webpack_require__(742),O=__webpack_require__.n(S),q=__webpack_require__(514),A=__webpack_require__.n(q),j="_5fRFtF";const L=e=>{let{cancelOnScrolling:t,children:n,containerStyle:r,dontDisableScrolling:o,onCancel:i,theme:a}=e;const c=(0,u.useRef)(null),l=(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(j),()=>{o||document.body.classList.remove(j)})),[o]);const d=(0,u.useMemo)((()=>(0,E.jsx)("div",{onFocus:()=>{var e,t;const n=null===(e=c.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=l.current)||void 0===t||t.focus()},tabIndex:0})),[]);return s?A().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!==l.current&&(l.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:c,role:"dialog",style:r,children:n}),(0,E.jsx)("div",{onFocus:()=>{var e;null===(e=l.current)||void 0===e||e.focus()},tabIndex:0}),d]}),s):null},N=t()(L,"Modal",["container","overlay"],{overlay:"ye2BZo",context:"Szmbbz",ad:"Ah-Nsc",hoc:"Wki41G",container:"gyZ4rc"});L.propTypes={cancelOnScrolling:b().bool,children:b().node,containerStyle:b().shape({}),dontDisableScrolling:b().bool,onCancel:b().func,theme:N.themeType.isRequired};var D=N;const M=["active","arrow","container","dropdown","hiddenOption","label","option","select","upward"],I=b().oneOfType([b().number.isRequired,b().string.isRequired]),B=b().oneOfType([b().shape({name:b().node,value:I.isRequired}).isRequired,b().number.isRequired,b().string.isRequired]),U=b().arrayOf(B.isRequired),W=b().oneOfType([b().shape({name:b().string,value:I.isRequired}).isRequired,b().number.isRequired,b().string.isRequired]),K=b().arrayOf(W.isRequired);function X(e){var t;return function(e){const t=typeof e;return"number"===t||"string"===t}(e)?[e,e]:[e.value,null!==(t=e.name)&&void 0!==t?t:e.value]}const Y=(0,u.forwardRef)(((e,t)=>{let{containerClass:n,containerStyle:r,filter:o,onCancel:i,onChange:a,optionClass:c,options:l}=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<l.length;++e){const t=l[e];if(!o||o(t)){const[e,n]=X(t);_.push((0,E.jsx)("div",{className:c,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)(L,{cancelOnScrolling:!0,containerStyle:r,dontDisableScrolling:!0,onCancel:i,theme:{ad:"",hoc:"",container:n,context:"",overlay:"jKsMKG"},children:(0,E.jsx)("div",{ref:s,children:_})})}));Y.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:U.isRequired};var F=Y;const $=e=>{let{filter:t,label:n,onChange:r,options:o,theme:i,value:a}=e;if(!o)throw Error("Internal error");const[c,l]=(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(!c)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,c;const e=o.bottom+i.height<(null!==(a=null===(c=window.visualViewport)||void 0===c?void 0:c.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)}}),[c]);const m=e=>{const t=window.visualViewport,n=s.current.getBoundingClientRect();l(!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]=X(n);if(e===a){b=t;break}}}let w=i.container;c&&(w+=` ${i.active}`);let v=i.select||"";return f&&(w+=` ${i.upward}`,v+=` ${i.upward}`),(0,E.jsxs)("div",{className:w,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})]}),c?(0,E.jsx)(F,{containerClass:v,containerStyle:d,onCancel:()=>{l(!1)},onChange:e=>{l(!1),r&&r(e)},optionClass:i.option||"",options:o,ref:_}):null]})},z=t()($,"CustomDropdown",M,{container:"oQKv0Y",context:"_9Tod5r",ad:"R58zIg",hoc:"O-Tp1i",label:"YUPUNs",dropdown:"pNEyAA",option:"LD2Kzy",select:"LP5azC",arrow:"-wscve",active:"k2UDsV",upward:"HWRvu4"});$.propTypes={filter:b().func,label:b().node,onChange:b().func,options:b().arrayOf(B.isRequired),theme:z.themeType.isRequired,value:I};var H=z;const G=e=>{let{filter:t,label:n,onChange:r,options:o,theme:i,value:a}=e;if(!o)throw Error("Internal error");let c=!1;const l=[];for(let e=0;e<o.length;++e){const n=o[e];if(!t||t(n)){const[e,t]=X(n);c||(c=e===a),l.push((0,E.jsx)("option",{className:i.option,value:e,children:t},e))}}const s=c?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,l]}),(0,E.jsx)("div",{className:i.arrow})]})]})},V=t()(G,"Dropdown",M,{dropdown:"kI9A9U",context:"xHyZo4",ad:"ADu59e",hoc:"FTP2bb",arrow:"DubGkT",container:"WtSZPd",active:"ayMn7O",label:"K7JYKw",hiddenOption:"clAKFJ",select:"N0Fc14"});G.propTypes={filter:b().func,label:b().node,onChange:b().func,options:K,theme:V.themeType.isRequired,value:I};var Q=V;const Z=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,c]=X(r[e]);let l,s=o.option;t===i?s+=` ${o.selected}`:n&&(l=()=>n(t)),a.push(l?(0,E.jsx)("div",{className:s,onClick:l,onKeyDown:e=>{l&&"Enter"===e.key&&l()},role:"button",tabIndex:0,children:c},t):(0,E.jsx)("div",{className:s,children:c},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})]})},J=t()(Z,"Switch",["container","label","option","options","selected"],{container:"AWNvRj",context:"VMHfnP",ad:"HNliRC",hoc:"_2Ue-db",option:"fUfIAd",selected:"Wco-qk",options:"CZYtcC"});Z.propTypes={label:b().node,onChange:b().func,options:U,theme:J.themeType.isRequired,value:I};var ee=J,te=__webpack_require__(442);const ne=e=>{let{children:t,className:n,disabled:r,enforceA:o,keepScrollPosition:i,onClick:a,onMouseDown:c,openNewTab:l,replace:s,routerLinkType:u,to:_,...d}=e;if(r||o||l||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():c,rel:"noopener noreferrer",target:l?"_blank":"",children:t});const p=u;return(0,E.jsx)(p,{className:n,onMouseDown:c,replace:s,to:_,onClick:e=>{a&&a(e),i||window.scroll(0,0)},...d,children:t})};ne.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 re=ne,oe=e=>(0,E.jsx)(re,{...e,routerLinkType:te.Link});const ie=e=>{let{active:t,children:n,disabled:r,enforceA:o,onClick:i,onMouseDown:a,openNewTab:c,replace:l,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)(oe,{className:_,enforceA:o,onClick:i,onMouseDown:a,openNewTab:c,replace:l,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})},ae=t()(ie,"Button",["active","button","disabled"],{button:"E1FNQT",context:"KM0v4f",ad:"_3jm1-Q",hoc:"_0plpDL",active:"MAe9O6",disabled:"Br9IWV"});ie.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:ae.themeType.isRequired,to:b().oneOfType([b().object,b().string])};var ce=ae;const le=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"})]})},se=t()(le,"Checkbox",["checkbox","container","label"],{checkbox:"A-f8qJ",context:"dNQcC6",ad:"earXxa",hoc:"qAPfQ6",container:"Kr0g3M",label:"_3dML-O"});le.propTypes={checked:b().bool,label:b().node,onChange:b().func,theme:se.themeType.isRequired};var ue=se;const _e=(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})]})})),de=t()(_e,"Input",["container","input","label"],{container:"Cxx397",context:"X5WszA",ad:"_8s7GCr",hoc:"TVlBYc",input:"M07d4s",label:"gfbdq-"});_e.propTypes={label:b().node,theme:de.themeType.isRequired};var pe=de;const fe=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})]})},he=t()(fe,"PageLayout",["container","leftSidePanel","mainPanel","rightSidePanel","sidePanel"],{container:"T3cuHB",context:"m4mL-M",ad:"m3-mdC",hoc:"J15Z4H",mainPanel:"pPlQO2",sidePanel:"lqNh4h"});fe.propTypes={children:b().node,leftSidePanelContent:b().node,rightSidePanelContent:b().node,theme:he.themeType.isRequired};var me=he,be=__webpack_require__(883);const Ee=(0,u.createContext)({description:"",title:""}),we=e=>{let{children:t,description:n,image:r,siteName:o,socialDescription:i,socialTitle:a,title:c,url:l}=e;const s=a||c,_=i||n,d=(0,u.useMemo)((()=>({description:n,image:r,siteName:o,socialDescription:i,socialTitle:a,title:c,url:l})),[n,r,o,i,a,c,l]);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(be.Helmet,{children:[(0,E.jsx)("title",{children:c}),(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,l?(0,E.jsx)("meta",{name:"og:url",content:l}):null]}),t?(0,E.jsx)(Ee.Provider,{value:d,children:t}):null]})};we.Context=Ee,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 ve=we,ge=e=>(0,E.jsx)(re,{...e,routerLinkType:te.NavLink});const ye=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})]})},xe=t()(ye,"Throbber",["bouncing","circle","container"],{container:"_7zdld4",context:"uIObt7",ad:"XIxe9o",hoc:"YOyORH",circle:"dBrB4g",bouncing:"TJe-6j"});ye.propTypes={theme:xe.themeType.isRequired};var Te=xe;let Ce=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(";"),Re=["border-top-color:transparent","border-left-color:transparent","border-right-color:transparent"].join(";");function Pe(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}}(),c=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(c.containerX<a.left+6)c.containerX=a.left+6,c.arrowX=Math.max(6,e-c.containerX-i.arrow.width/2);else{const t=a.right-6-i.container.width;c.containerX>t&&(c.containerX=t,c.arrowX=Math.min(i.container.width-6,e-c.containerX-i.arrow.width/2))}c.containerY<a.top+6&&(c.containerY+=i.container.height+2*i.arrow.height,c.arrowY-=i.container.height+i.arrow.height,c.baseArrowStyle=Re);const l=`left:${c.containerX}px;top:${c.containerY}px`;o.container.setAttribute("style",l);const s=`${c.baseArrowStyle};left:${c.arrowX}px;top:${c.arrowY}px`;o.arrow.setAttribute("style",s)}const Se=(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),c=(e,t,n,r)=>{o.lastElement=r,o.lastPageX=e,o.lastPageY=t,o.lastPlacement=n,i&&Pe(e,t,0,0,i)};return(0,u.useImperativeHandle)(t,(()=>({pointTo:c}))),(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&&Pe(o.lastPageX,o.lastPageY,o.lastPlacement,o.lastElement,i)}),[i,o.lastPageX,o.lastPageY,o.lastPlacement,o.lastElement]),i?(0,q.createPortal)(n,i.content):null}));Se.propTypes={children:b().node,theme:b().shape({}).isRequired};var Oe=Se;const qe=e=>{let{children:t,placement:n=Ce.ABOVE_CURSOR,tip:r,theme:o}=e;const{current:i}=(0,u.useRef)({lastCursorX:0,lastCursorY:0,triggeredByTouch:!1,timerId:void 0}),a=(0,u.useRef)(),c=(0,u.useRef)(null),[l,s]=(0,u.useState)(!1);return(0,u.useEffect)((()=>{if(l&&null!==r){a.current&&a.current.pointTo(i.lastCursorX+window.scrollX,i.lastCursorY+window.scrollY,n,c.current);const e=()=>s(!1);return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)}}),[i.lastCursorX,i.lastCursorY,n,l,r]),(0,E.jsxs)("div",{className:o.wrapper,onMouseLeave:()=>s(!1),onMouseMove:e=>((e,t)=>{if(l){const r=c.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,c.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:c,role:"presentation",children:[l&&null!==r?(0,E.jsx)(Oe,{ref:a,theme:o,children:r}):null,t]})},Ae=t()(qe,"WithTooltip",["appearance","arrow","container","content","wrapper"],{arrow:"M9gywF",ad:"_4xT7zE",hoc:"zd-vnH",context:"GdZucr",container:"f9gY8K",appearance:"L4ubm-",wrapper:"_4qDBRM"}),je=Ae;je.PLACEMENTS=Ce,qe.propTypes={children:b().node,placement:b().oneOf(Object.values(Ce)),theme:Ae.themeType.isRequired,tip:b().node};var Le=je,Ne=__webpack_require__(360),De=__webpack_require__.n(Ne),Me={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 c=a[0];const l=a[1],s=l?De().parse(l):{},u=s.v||(null===(t=c.match(/\/([a-zA-Z0-9-_]*)$/))||void 0===t?void 0:t[1]);return c=`https://www.youtube.com/embed/${u}`,delete s.v,s.autoplay=n?"1":"0",c+=`?${De().stringify(s)}`,(0,E.jsxs)("div",{className:o.container,children:[(0,E.jsx)(Te,{theme:Me}),(0,E.jsx)("iframe",{allow:"autoplay",allowFullScreen:!0,className:o.video,src:c,title:i})]})},Be=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:Be.themeType.isRequired,title:b().string};var Ue=Be;const We=e=>{let{disabled:t,onChange:n,onKeyDown:r,placeholder:o,theme:i,value:a}=e;const c=(0,u.useRef)(null),[l,s]=(0,u.useState)(),[_,d]=(0,u.useState)(a||"");return void 0!==a&&_!==a&&d(a),(0,u.useEffect)((()=>{const e=c.current;if(!e)return;const t=new ResizeObserver((()=>{s(e.scrollHeight)}));return t.observe(e),()=>{t.disconnect()}}),[]),(0,u.useEffect)((()=>{const e=c.current;e&&s(e.scrollHeight)}),[_]),(0,E.jsxs)("div",{className:i.container,children:[(0,E.jsx)("textarea",{readOnly:!0,ref:c,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:l},className:i.textarea,value:_})]})},Ke=t()(We,"TextArea",["container","hidden","textarea"],{container:"dzMVIB",context:"KVPc7g",ad:"z2GQ0Z",hoc:"_8R1Qdj",textarea:"zd-OFg",hidden:"GiHBXI"});We.propTypes={disabled:b().bool,onChange:b().func,onKeyDown:b().func,placeholder:b().string,theme:Ke.themeType.isRequired,value:b().string};var Xe=Ke;const Ye=r.requireWeak("./server","/");let Fe=Ye?void 0:__webpack_require__(662);Fe&&(Fe.default.setInj=Fe.setInj,Fe=Fe.default)}(),__webpack_exports__}()}));
3
3
  //# sourceMappingURL=web.bundle.js.map