@dr.pogodin/react-utils 1.25.5 → 1.25.6
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.
- package/bin/build.js +7 -1
- package/build/development/index.js +2 -4
- package/build/development/index.js.map +1 -1
- package/build/development/server/index.js +1 -2
- package/build/development/server/index.js.map +1 -1
- package/build/development/server/renderer.js +1 -2
- package/build/development/server/renderer.js.map +1 -1
- package/build/development/shared/components/Button/index.js +1 -2
- package/build/development/shared/components/Button/index.js.map +1 -1
- package/build/development/shared/components/Checkbox/index.js +1 -2
- package/build/development/shared/components/Checkbox/index.js.map +1 -1
- package/build/development/shared/components/Dropdown/index.js +1 -2
- package/build/development/shared/components/Dropdown/index.js.map +1 -1
- package/build/development/shared/components/Input/index.js +1 -2
- package/build/development/shared/components/Input/index.js.map +1 -1
- package/build/development/shared/components/Modal/index.js +1 -2
- package/build/development/shared/components/Modal/index.js.map +1 -1
- package/build/development/shared/components/PageLayout/index.js +1 -2
- package/build/development/shared/components/PageLayout/index.js.map +1 -1
- package/build/development/shared/components/Throbber/index.js +1 -2
- package/build/development/shared/components/Throbber/index.js.map +1 -1
- package/build/development/shared/components/WithTooltip/Tooltip.js +2 -4
- package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
- package/build/development/shared/components/WithTooltip/index.js +1 -2
- package/build/development/shared/components/WithTooltip/index.js.map +1 -1
- package/build/development/shared/components/YouTubeVideo/index.js +1 -2
- package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/development/shared/utils/config.js +1 -2
- package/build/development/shared/utils/config.js.map +1 -1
- package/build/development/shared/utils/index.js +1 -2
- package/build/development/shared/utils/index.js.map +1 -1
- package/build/development/shared/utils/isomorphy/environment-check.js +2 -4
- package/build/development/shared/utils/isomorphy/environment-check.js.map +1 -1
- package/build/development/shared/utils/jest/index.js +1 -2
- package/build/development/shared/utils/jest/index.js.map +1 -1
- package/build/development/shared/utils/time.js +1 -2
- package/build/development/shared/utils/time.js.map +1 -1
- package/build/development/web.bundle.js +2 -2
- package/build/production/index.js +1 -1
- package/build/production/index.js.map +1 -1
- package/build/production/server/index.js +1 -1
- package/build/production/server/index.js.map +1 -1
- package/build/production/server/renderer.js +2 -2
- package/build/production/server/renderer.js.map +1 -1
- package/build/production/shared/components/Button/index.js +1 -1
- package/build/production/shared/components/Button/index.js.map +1 -1
- package/build/production/shared/components/Checkbox/index.js +1 -1
- package/build/production/shared/components/Checkbox/index.js.map +1 -1
- package/build/production/shared/components/Dropdown/index.js +1 -1
- package/build/production/shared/components/Dropdown/index.js.map +1 -1
- package/build/production/shared/components/Input/index.js +1 -1
- package/build/production/shared/components/Input/index.js.map +1 -1
- package/build/production/shared/components/Modal/index.js +1 -1
- package/build/production/shared/components/Modal/index.js.map +1 -1
- package/build/production/shared/components/PageLayout/index.js +1 -1
- package/build/production/shared/components/PageLayout/index.js.map +1 -1
- package/build/production/shared/components/Throbber/index.js +1 -1
- package/build/production/shared/components/Throbber/index.js.map +1 -1
- package/build/production/shared/components/WithTooltip/Tooltip.js +2 -2
- package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
- package/build/production/shared/components/WithTooltip/index.js +1 -1
- package/build/production/shared/components/WithTooltip/index.js.map +1 -1
- package/build/production/shared/components/YouTubeVideo/index.js +1 -1
- package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/production/shared/utils/config.js +1 -1
- package/build/production/shared/utils/config.js.map +1 -1
- package/build/production/shared/utils/index.js +2 -2
- package/build/production/shared/utils/index.js.map +1 -1
- package/build/production/shared/utils/isomorphy/environment-check.js +2 -2
- package/build/production/shared/utils/isomorphy/environment-check.js.map +1 -1
- package/build/production/shared/utils/jest/index.js +1 -1
- package/build/production/shared/utils/jest/index.js.map +1 -1
- package/build/production/shared/utils/time.js +1 -1
- package/build/production/shared/utils/time.js.map +1 -1
- package/build/production/web.bundle.js +1 -1
- package/build/production/web.bundle.js.map +1 -1
- package/config/babel/webpack.js +2 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","names":["_react","require","_reactDom","_propTypes","_interopRequireDefault","PLACEMENTS","ABOVE_CURSOR","ABOVE_ELEMENT","BELOW_CURSOR","BELOW_ELEMENT","exports","ARROW_STYLE_DOWN","join","ARROW_STYLE_UP","createTooltipComponents","theme","arrow","document","createElement","setAttribute","content","container","appendChild","body","calcTooltipRects","tooltip","getBoundingClientRect","calcViewportRect","scrollX","scrollY","window","documentElement","clientHeight","clientWidth","left","right","top","bottom","calcPositionAboveXY","x","y","tooltipRects","arrowX","width","arrowY","height","containerX","containerY","baseArrowStyle","setComponentPositions","pageX","pageY","placement","element","viewportRect","pos","Math","max","maxX","min","containerStyle","arrowStyle","Tooltip","forwardRef","children","ref","current","heap","useRef","lastElement","undefined","lastPageX","lastPageY","lastPlacement","components","setComponents","useState","pointTo","useImperativeHandle","useEffect","removeChild","createPortal","propTypes","PT","node","shape","isRequired","defaultProps","_default","default"],"sources":["../../../../../src/shared/components/WithTooltip/Tooltip.jsx"],"sourcesContent":["/**\n * The actual tooltip component. It is rendered outside the regular document\n * hierarchy, and with sub-components managed without React to achieve the best\n * performance during animation.\n */\n/* global document, window */\n\nimport {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\n\nimport { createPortal } from 'react-dom';\n\nimport PT from 'prop-types';\n\n/* Valid placements of the rendered tooltip. They will be overriden when\n * necessary to fit the tooltip within the viewport. */\nexport const PLACEMENTS = {\n ABOVE_CURSOR: 'ABOVE_CURSOR',\n ABOVE_ELEMENT: 'ABOVE_ELEMENT',\n BELOW_CURSOR: 'BELOW_CURSOR',\n BELOW_ELEMENT: 'BELOW_ELEMENT',\n};\n\nconst ARROW_STYLE_DOWN = [\n 'border-bottom-color:transparent',\n 'border-left-color:transparent',\n 'border-right-color:transparent',\n].join(';');\n\nconst ARROW_STYLE_UP = [\n 'border-top-color:transparent',\n 'border-left-color:transparent',\n 'border-right-color:transparent',\n].join(';');\n\n/**\n * Creates tooltip components.\n * @ignore\n * @param {object} theme Themes to use for tooltip container, arrow,\n * and content.\n * @return {object} Object with DOM references to the container components:\n * container, arrow, content.\n */\nfunction createTooltipComponents(theme) {\n const arrow = document.createElement('div');\n if (theme.arrow) arrow.setAttribute('class', theme.arrow);\n\n const content = document.createElement('div');\n if (theme.content) content.setAttribute('class', theme.content);\n\n const container = document.createElement('div');\n if (theme.container) container.setAttribute('class', theme.container);\n\n container.appendChild(arrow);\n container.appendChild(content);\n document.body.appendChild(container);\n\n return { container, arrow, content };\n}\n\n/**\n * Generates bounding client rectangles for tooltip components.\n * @ignore\n * @param {object} tooltip DOM references to the tooltip components.\n * @param {object} tooltip.arrow\n * @param {object} tooltip.container\n * @return {{ arrow: object, container}} Object holding tooltip rectangles in\n * two fields.\n */\nfunction calcTooltipRects(tooltip) {\n return {\n arrow: tooltip.arrow.getBoundingClientRect(),\n container: tooltip.container.getBoundingClientRect(),\n };\n}\n\n/**\n * Calculates the document viewport size.\n * @ignore\n * @return {{x, y, width, height}}\n */\nfunction calcViewportRect() {\n const { scrollX, scrollY } = window;\n const { documentElement: { clientHeight, clientWidth } } = document;\n return {\n left: scrollX,\n right: scrollX + clientWidth,\n top: scrollY,\n bottom: scrollY + clientHeight,\n };\n}\n\n/**\n * Calculates tooltip and arrow positions for the placement just above\n * the cursor.\n * @ignore\n * @param {number} x Cursor page-x position.\n * @param {number} y Cursor page-y position.\n * @param {object} tooltipRects Bounding client rectangles of tooltip parts.\n * @param {object} tooltipRects.arrow\n * @param {object} tooltipRects.container\n * @return {object} Contains the following fields:\n * - {number} arrowX\n * - {number} arrowY\n * - {number} containerX\n * - {number} containerY\n * - {string} baseArrowStyle\n */\nfunction calcPositionAboveXY(x, y, tooltipRects) {\n const { arrow, container } = tooltipRects;\n return {\n arrowX: 0.5 * (container.width - arrow.width),\n arrowY: container.height,\n containerX: x - container.width / 2,\n containerY: y - container.height - arrow.height / 1.5,\n\n // TODO: Instead of already setting the base style here, we should\n // introduce a set of constants for arrow directions, which will help\n // to do checks dependant on the arrow direction.\n baseArrowStyle: ARROW_STYLE_DOWN,\n };\n}\n\n/*\nconst HIT = {\n NONE: false,\n LEFT: 'LEFT',\n RIGHT: 'RIGHT',\n TOP: 'TOP',\n BOTTOM: 'BOTTOM',\n};\n*/\n\n/**\n * Checks whether\n * @param {object} pos\n * @param {object} tooltipRects\n * @param {object} viewportRect\n * @return {HIT}\n */\n/*\nfunction checkViewportFit(pos, tooltipRects, viewportRect) {\n const { containerX, containerY } = pos;\n if (containerX < viewportRect.left + 6) return HIT.LEFT;\n if (containerX > viewportRect.right - 6) return HIT.RIGHT;\n return HIT.NONE;\n}\n*/\n\n/**\n * Shifts tooltip horizontally to fit into the viewport, while keeping\n * the arrow pointed to the XY point.\n * @param {number} x\n * @param {number} y\n * @param {object} pos\n * @param {number} pageXOffset\n * @param {number} pageXWidth\n */\n/*\nfunction xPageFitCorrection(x, y, pos, pageXOffset, pageXWidth) {\n if (pos.containerX < pageXOffset + 6) {\n pos.containerX = pageXOffset + 6;\n pos.arrowX = Math.max(6, pageX - containerX - arrowRect.width / 2);\n } else {\n const maxX = pageXOffset + docRect.width - containerRect.width - 6;\n if (containerX > maxX) {\n containerX = maxX;\n arrowX = Math.min(\n containerRect.width - 6,\n pageX - containerX - arrowRect.width / 2,\n );\n }\n }\n}\n*/\n\n/**\n * Sets positions of tooltip components to point the tooltip to the specified\n * page point.\n * @ignore\n * @param {number} pageX\n * @param {number} pageY\n * @param {PLACEMENTS} placement\n * @param {object} element DOM reference to the element wrapped by the tooltip.\n * @param {object} tooltip\n * @param {object} tooltip.arrow DOM reference to the tooltip arrow.\n * @param {object} tooltip.container DOM reference to the tooltip container.\n */\nfunction setComponentPositions(\n pageX,\n pageY,\n placement,\n element,\n tooltip,\n) {\n const tooltipRects = calcTooltipRects(tooltip);\n const viewportRect = calcViewportRect();\n\n /* Default container coords: tooltip at the top. */\n const pos = calcPositionAboveXY(pageX, pageY, tooltipRects);\n\n if (pos.containerX < viewportRect.left + 6) {\n pos.containerX = viewportRect.left + 6;\n pos.arrowX = Math.max(\n 6,\n pageX - pos.containerX - tooltipRects.arrow.width / 2,\n );\n } else {\n const maxX = viewportRect.right - 6 - tooltipRects.container.width;\n if (pos.containerX > maxX) {\n pos.containerX = maxX;\n pos.arrowX = Math.min(\n tooltipRects.container.width - 6,\n pageX - pos.containerX - tooltipRects.arrow.width / 2,\n );\n }\n }\n\n /* If tooltip has not enough space on top - make it bottom tooltip. */\n if (pos.containerY < viewportRect.top + 6) {\n pos.containerY += tooltipRects.container.height\n + 2 * tooltipRects.arrow.height;\n pos.arrowY -= tooltipRects.container.height\n + tooltipRects.arrow.height;\n pos.baseArrowStyle = ARROW_STYLE_UP;\n }\n\n const containerStyle = `left:${pos.containerX}px;top:${pos.containerY}px`;\n tooltip.container.setAttribute('style', containerStyle);\n\n const arrowStyle = `${pos.baseArrowStyle};left:${pos.arrowX}px;top:${pos.arrowY}px`;\n tooltip.arrow.setAttribute('style', arrowStyle);\n}\n\n/* The Tooltip component itself. */\nconst Tooltip = forwardRef(({ children, theme }, ref) => {\n // NOTE: The way it has to be implemented, for clean mounting and unmounting\n // at the client side, the <Tooltip> is fully mounted into DOM in the next\n // rendering cycles, and only then it can be correctly measured and positioned.\n // Thus, when we create the <Tooltip> we have to record its target positioning\n // details, and then apply them when it is created.\n\n const { current: heap } = useRef({\n lastElement: undefined,\n lastPageX: 0,\n lastPageY: 0,\n lastPlacement: undefined,\n });\n\n const [components, setComponents] = useState(null);\n\n const pointTo = (pageX, pageY, placement, element) => {\n heap.lastElement = element;\n heap.lastPageX = pageX;\n heap.lastPageY = pageY;\n heap.lastPlacement = placement;\n\n if (components) {\n setComponentPositions(pageX, pageY, placement, element, components);\n }\n };\n useImperativeHandle(ref, () => ({ pointTo }));\n\n /* Inits and destroys tooltip components. */\n useEffect(() => {\n const x = createTooltipComponents(theme);\n setComponents(x);\n return () => {\n document.body.removeChild(x.container);\n setComponents(null);\n };\n }, [theme]);\n\n useEffect(() => {\n if (components) {\n setComponentPositions(\n heap.lastPageX,\n heap.lastPageY,\n heap.lastPlacement,\n heap.lastElement,\n components,\n );\n }\n }, [\n components,\n // BEWARE: Careful about these dependencies - they are updated when mouse\n // is moved over the tool-tipped element, thus potentially may cause\n // unnecessary firing of this effect on each mouse event. It does not\n // happen now just because the mouse movements themselves are not causing\n // the component re-rendering, thus dependencies of this effect are not\n // really re-evaluated.\n heap.lastPageX,\n heap.lastPageY,\n heap.lastPlacement,\n heap.lastElement,\n ]);\n\n return components ? createPortal(children, components.content) : null;\n});\n\nTooltip.propTypes = {\n children: PT.node,\n theme: PT.shape().isRequired,\n};\n\nTooltip.defaultProps = {\n children: null,\n};\n\nexport default Tooltip;\n"],"mappings":"mMAOA,IAAAA,MAAA,CAAAC,OAAA,UAQA,IAAAC,SAAA,CAAAD,OAAA,cAEA,IAAAE,UAAA,CAAAC,sBAAA,CAAAH,OAAA,gBAjBA;AACA;AACA;AACA;AACA,GAJA,CAKA,8BAcA;AACA,uDACO,KAAM,CAAAI,UAAU,CAAG,CACxBC,YAAY,CAAE,cAAc,CAC5BC,aAAa,CAAE,eAAe,CAC9BC,YAAY,CAAE,cAAc,CAC5BC,aAAa,CAAE,eACjB,CAAC,CAACC,OAAA,CAAAL,UAAA,CAAAA,UAAA,CAEF,KAAM,CAAAM,gBAAgB,CAAG,CACvB,iCAAiC,CACjC,+BAA+B,CAC/B,gCAAgC,CACjC,CAACC,IAAI,CAAC,GAAG,CAAC,CAEX,KAAM,CAAAC,cAAc,CAAG,CACrB,8BAA8B,CAC9B,+BAA+B,CAC/B,gCAAgC,CACjC,CAACD,IAAI,CAAC,GAAG,CAAC,CAEX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAAS,CAAAE,uBAAuBA,CAACC,KAAK,CAAE,CACtC,KAAM,CAAAC,KAAK,CAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC,CAC3C,GAA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pB,CACF,CAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAAS,CAAAM,mBAAmBA,CAACC,CAAC,CAAEC,CAAC,CAAEC,YAAY,CAAE,CAC/C,KAAM,CAAEzB,KAAK,CAAEK,SAAU,CAAC,CAAGoB,YAAY,CACzC,MAAO,CACLC,MAAM,CAAE,GAAG,EAAIrB,SAAS,CAACsB,KAAK,CAAG3B,KAAK,CAAC2B,KAAK,CAAC,CAC7CC,MAAM,CAAEvB,SAAS,CAACwB,MAAM,CACxBC,UAAU,CAAEP,CAAC,CAAGlB,SAAS,CAACsB,KAAK,CAAG,CAAC,CACnCI,UAAU,CAAEP,CAAC,CAAGnB,SAAS,CAACwB,MAAM,CAAG7B,KAAK,CAAC6B,MAAM,CAAG,GAAG,CAErD;AACA;AACA;AACAG,cAAc,CAAErC,gBAClB,CACF,CAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EARA,CAUA;AACA;AACA;AACA;AACA;AACA;AACA,GANA,CAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAPA,CASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GARA,CASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAhBA,CAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAAS,CAAAsC,qBAAqBA,CAC5BC,KAAK,CACLC,KAAK,CACLC,SAAS,CACTC,OAAO,CACP5B,OAAO,CACP,CACA,KAAM,CAAAgB,YAAY,CAAGjB,gBAAgB,CAACC,OAAO,CAAC,CAC9C,KAAM,CAAA6B,YAAY,CAAG3B,gBAAgB,CAAC,CAAC,CAEvC,mDACA,KAAM,CAAA4B,GAAG,CAAGjB,mBAAmB,CAACY,KAAK,CAAEC,KAAK,CAAEV,YAAY,CAAC,CAE3D,GAAIc,GAAG,C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AClB,SAAS,CAAC,CACtCsD,aAAa,CAAC,IAAI,CACpB,CACF,CAAC,CAAE,CAAC5D,KAAK,CAAC,CAAC,CAEX,GAAAgE,gBAAS,EAAC,IAAM,CACd,GAAIL,UAAU,CAAE,CACdzB,qBAAqB,CACnBkB,IAAI,CAACI,SAAS,CACdJ,IAAI,CAACK,SAAS,CACdL,IAAI,CAACM,aAAa,CAClBN,IAAI,CAACE,WAAW,CAChBK,UACF,CACF,CACF,CAAC,CAAE,CACDA,UAAU,CACV;AACA;AACA;AACA;AACA;AACA;AACAP,IAAI,CAACI,SAAS,CACdJ,IAAI,CAACK,SAAS,CACdL,IAAI,CAACM,aAAa,CAClBN,IAAI,CAACE,WAAW,CACjB,CAAC,CAEF,MAAO,CAAAK,UAAU,cAAG,GAAAO,sBAAY,EAACjB,QAAQ,CAAEU,UAAU,CAACtD,OAAO,CAAC,CAAG,IACnE,CAAC,CAAC,CAEF0C,OAAO,CAACoB,SAAS,CAAG,CAClBlB,QAAQ,CAAEmB,kBAAE,CAACC,IAAI,CACjBrE,KAAK,CAAEoE,kBAAE,CAACE,KAAK,CAAC,CAAC,CAACC,UACpB,CAAC,CAEDxB,OAAO,CAACyB,YAAY,CAAG,CACrBvB,QAAQ,CAAE,IACZ,CAAC,CAAC,IAAAwB,QAAA,CAEa1B,OAAO,CAAApD,OAAA,CAAA+E,OAAA,CAAAD,QAAA"}
|
|
1
|
+
{"version":3,"file":"Tooltip.js","names":["_react","require","_reactDom","_propTypes","_interopRequireDefault","PLACEMENTS","exports","ABOVE_CURSOR","ABOVE_ELEMENT","BELOW_CURSOR","BELOW_ELEMENT","ARROW_STYLE_DOWN","join","ARROW_STYLE_UP","createTooltipComponents","theme","arrow","document","createElement","setAttribute","content","container","appendChild","body","calcTooltipRects","tooltip","getBoundingClientRect","calcViewportRect","scrollX","scrollY","window","documentElement","clientHeight","clientWidth","left","right","top","bottom","calcPositionAboveXY","x","y","tooltipRects","arrowX","width","arrowY","height","containerX","containerY","baseArrowStyle","setComponentPositions","pageX","pageY","placement","element","viewportRect","pos","Math","max","maxX","min","containerStyle","arrowStyle","Tooltip","forwardRef","children","ref","current","heap","useRef","lastElement","undefined","lastPageX","lastPageY","lastPlacement","components","setComponents","useState","pointTo","useImperativeHandle","useEffect","removeChild","createPortal","propTypes","PT","node","shape","isRequired","defaultProps","_default","default"],"sources":["../../../../../src/shared/components/WithTooltip/Tooltip.jsx"],"sourcesContent":["/**\n * The actual tooltip component. It is rendered outside the regular document\n * hierarchy, and with sub-components managed without React to achieve the best\n * performance during animation.\n */\n/* global document, window */\n\nimport {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\n\nimport { createPortal } from 'react-dom';\n\nimport PT from 'prop-types';\n\n/* Valid placements of the rendered tooltip. They will be overriden when\n * necessary to fit the tooltip within the viewport. */\nexport const PLACEMENTS = {\n ABOVE_CURSOR: 'ABOVE_CURSOR',\n ABOVE_ELEMENT: 'ABOVE_ELEMENT',\n BELOW_CURSOR: 'BELOW_CURSOR',\n BELOW_ELEMENT: 'BELOW_ELEMENT',\n};\n\nconst ARROW_STYLE_DOWN = [\n 'border-bottom-color:transparent',\n 'border-left-color:transparent',\n 'border-right-color:transparent',\n].join(';');\n\nconst ARROW_STYLE_UP = [\n 'border-top-color:transparent',\n 'border-left-color:transparent',\n 'border-right-color:transparent',\n].join(';');\n\n/**\n * Creates tooltip components.\n * @ignore\n * @param {object} theme Themes to use for tooltip container, arrow,\n * and content.\n * @return {object} Object with DOM references to the container components:\n * container, arrow, content.\n */\nfunction createTooltipComponents(theme) {\n const arrow = document.createElement('div');\n if (theme.arrow) arrow.setAttribute('class', theme.arrow);\n\n const content = document.createElement('div');\n if (theme.content) content.setAttribute('class', theme.content);\n\n const container = document.createElement('div');\n if (theme.container) container.setAttribute('class', theme.container);\n\n container.appendChild(arrow);\n container.appendChild(content);\n document.body.appendChild(container);\n\n return { container, arrow, content };\n}\n\n/**\n * Generates bounding client rectangles for tooltip components.\n * @ignore\n * @param {object} tooltip DOM references to the tooltip components.\n * @param {object} tooltip.arrow\n * @param {object} tooltip.container\n * @return {{ arrow: object, container}} Object holding tooltip rectangles in\n * two fields.\n */\nfunction calcTooltipRects(tooltip) {\n return {\n arrow: tooltip.arrow.getBoundingClientRect(),\n container: tooltip.container.getBoundingClientRect(),\n };\n}\n\n/**\n * Calculates the document viewport size.\n * @ignore\n * @return {{x, y, width, height}}\n */\nfunction calcViewportRect() {\n const { scrollX, scrollY } = window;\n const { documentElement: { clientHeight, clientWidth } } = document;\n return {\n left: scrollX,\n right: scrollX + clientWidth,\n top: scrollY,\n bottom: scrollY + clientHeight,\n };\n}\n\n/**\n * Calculates tooltip and arrow positions for the placement just above\n * the cursor.\n * @ignore\n * @param {number} x Cursor page-x position.\n * @param {number} y Cursor page-y position.\n * @param {object} tooltipRects Bounding client rectangles of tooltip parts.\n * @param {object} tooltipRects.arrow\n * @param {object} tooltipRects.container\n * @return {object} Contains the following fields:\n * - {number} arrowX\n * - {number} arrowY\n * - {number} containerX\n * - {number} containerY\n * - {string} baseArrowStyle\n */\nfunction calcPositionAboveXY(x, y, tooltipRects) {\n const { arrow, container } = tooltipRects;\n return {\n arrowX: 0.5 * (container.width - arrow.width),\n arrowY: container.height,\n containerX: x - container.width / 2,\n containerY: y - container.height - arrow.height / 1.5,\n\n // TODO: Instead of already setting the base style here, we should\n // introduce a set of constants for arrow directions, which will help\n // to do checks dependant on the arrow direction.\n baseArrowStyle: ARROW_STYLE_DOWN,\n };\n}\n\n/*\nconst HIT = {\n NONE: false,\n LEFT: 'LEFT',\n RIGHT: 'RIGHT',\n TOP: 'TOP',\n BOTTOM: 'BOTTOM',\n};\n*/\n\n/**\n * Checks whether\n * @param {object} pos\n * @param {object} tooltipRects\n * @param {object} viewportRect\n * @return {HIT}\n */\n/*\nfunction checkViewportFit(pos, tooltipRects, viewportRect) {\n const { containerX, containerY } = pos;\n if (containerX < viewportRect.left + 6) return HIT.LEFT;\n if (containerX > viewportRect.right - 6) return HIT.RIGHT;\n return HIT.NONE;\n}\n*/\n\n/**\n * Shifts tooltip horizontally to fit into the viewport, while keeping\n * the arrow pointed to the XY point.\n * @param {number} x\n * @param {number} y\n * @param {object} pos\n * @param {number} pageXOffset\n * @param {number} pageXWidth\n */\n/*\nfunction xPageFitCorrection(x, y, pos, pageXOffset, pageXWidth) {\n if (pos.containerX < pageXOffset + 6) {\n pos.containerX = pageXOffset + 6;\n pos.arrowX = Math.max(6, pageX - containerX - arrowRect.width / 2);\n } else {\n const maxX = pageXOffset + docRect.width - containerRect.width - 6;\n if (containerX > maxX) {\n containerX = maxX;\n arrowX = Math.min(\n containerRect.width - 6,\n pageX - containerX - arrowRect.width / 2,\n );\n }\n }\n}\n*/\n\n/**\n * Sets positions of tooltip components to point the tooltip to the specified\n * page point.\n * @ignore\n * @param {number} pageX\n * @param {number} pageY\n * @param {PLACEMENTS} placement\n * @param {object} element DOM reference to the element wrapped by the tooltip.\n * @param {object} tooltip\n * @param {object} tooltip.arrow DOM reference to the tooltip arrow.\n * @param {object} tooltip.container DOM reference to the tooltip container.\n */\nfunction setComponentPositions(\n pageX,\n pageY,\n placement,\n element,\n tooltip,\n) {\n const tooltipRects = calcTooltipRects(tooltip);\n const viewportRect = calcViewportRect();\n\n /* Default container coords: tooltip at the top. */\n const pos = calcPositionAboveXY(pageX, pageY, tooltipRects);\n\n if (pos.containerX < viewportRect.left + 6) {\n pos.containerX = viewportRect.left + 6;\n pos.arrowX = Math.max(\n 6,\n pageX - pos.containerX - tooltipRects.arrow.width / 2,\n );\n } else {\n const maxX = viewportRect.right - 6 - tooltipRects.container.width;\n if (pos.containerX > maxX) {\n pos.containerX = maxX;\n pos.arrowX = Math.min(\n tooltipRects.container.width - 6,\n pageX - pos.containerX - tooltipRects.arrow.width / 2,\n );\n }\n }\n\n /* If tooltip has not enough space on top - make it bottom tooltip. */\n if (pos.containerY < viewportRect.top + 6) {\n pos.containerY += tooltipRects.container.height\n + 2 * tooltipRects.arrow.height;\n pos.arrowY -= tooltipRects.container.height\n + tooltipRects.arrow.height;\n pos.baseArrowStyle = ARROW_STYLE_UP;\n }\n\n const containerStyle = `left:${pos.containerX}px;top:${pos.containerY}px`;\n tooltip.container.setAttribute('style', containerStyle);\n\n const arrowStyle = `${pos.baseArrowStyle};left:${pos.arrowX}px;top:${pos.arrowY}px`;\n tooltip.arrow.setAttribute('style', arrowStyle);\n}\n\n/* The Tooltip component itself. */\nconst Tooltip = forwardRef(({ children, theme }, ref) => {\n // NOTE: The way it has to be implemented, for clean mounting and unmounting\n // at the client side, the <Tooltip> is fully mounted into DOM in the next\n // rendering cycles, and only then it can be correctly measured and positioned.\n // Thus, when we create the <Tooltip> we have to record its target positioning\n // details, and then apply them when it is created.\n\n const { current: heap } = useRef({\n lastElement: undefined,\n lastPageX: 0,\n lastPageY: 0,\n lastPlacement: undefined,\n });\n\n const [components, setComponents] = useState(null);\n\n const pointTo = (pageX, pageY, placement, element) => {\n heap.lastElement = element;\n heap.lastPageX = pageX;\n heap.lastPageY = pageY;\n heap.lastPlacement = placement;\n\n if (components) {\n setComponentPositions(pageX, pageY, placement, element, components);\n }\n };\n useImperativeHandle(ref, () => ({ pointTo }));\n\n /* Inits and destroys tooltip components. */\n useEffect(() => {\n const x = createTooltipComponents(theme);\n setComponents(x);\n return () => {\n document.body.removeChild(x.container);\n setComponents(null);\n };\n }, [theme]);\n\n useEffect(() => {\n if (components) {\n setComponentPositions(\n heap.lastPageX,\n heap.lastPageY,\n heap.lastPlacement,\n heap.lastElement,\n components,\n );\n }\n }, [\n components,\n // BEWARE: Careful about these dependencies - they are updated when mouse\n // is moved over the tool-tipped element, thus potentially may cause\n // unnecessary firing of this effect on each mouse event. It does not\n // happen now just because the mouse movements themselves are not causing\n // the component re-rendering, thus dependencies of this effect are not\n // really re-evaluated.\n heap.lastPageX,\n heap.lastPageY,\n heap.lastPlacement,\n heap.lastElement,\n ]);\n\n return components ? createPortal(children, components.content) : null;\n});\n\nTooltip.propTypes = {\n children: PT.node,\n theme: PT.shape().isRequired,\n};\n\nTooltip.defaultProps = {\n children: null,\n};\n\nexport default Tooltip;\n"],"mappings":"mMAOA,IAAAA,MAAA,CAAAC,OAAA,UAQA,IAAAC,SAAA,CAAAD,OAAA,cAEA,IAAAE,UAAA,CAAAC,sBAAA,CAAAH,OAAA,gBAjBA;AACA;AACA;AACA;AACA,GAJA,CAKA,8BAcA;AACA,uDACO,KAAM,CAAAI,UAAU,CAAAC,OAAA,CAAAD,UAAA,CAAG,CACxBE,YAAY,CAAE,cAAc,CAC5BC,aAAa,CAAE,eAAe,CAC9BC,YAAY,CAAE,cAAc,CAC5BC,aAAa,CAAE,eACjB,CAAC,CAED,KAAM,CAAAC,gBAAgB,CAAG,CACvB,iCAAiC,CACjC,+BAA+B,CAC/B,gCAAgC,CACjC,CAACC,IAAI,CAAC,GAAG,CAAC,CAEX,KAAM,CAAAC,cAAc,CAAG,CACrB,8BAA8B,CAC9B,+BAA+B,CAC/B,gCAAgC,CACjC,CAACD,IAAI,CAAC,GAAG,CAAC,CAEX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAAS,CAAAE,uBAAuBA,CAACC,KAAK,CAAE,CACtC,KAAM,CAAAC,KAAK,CAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC,CAC3C,GAAIH,KAAK,CAACC,KAAK,CAAEA,KAAK,CAACG,YAAY,CAAC,OAAO,CAAEJ,KAAK,CAACC,KAAK,CAAC,CAEzD,KAAM,CAAAI,OAAO,CAAGH,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC,CAC7C,GAAIH,KAAK,CAACK,OAAO,CAAEA,OAAO,CAACD,YAAY,CAAC,OAAO,CAAEJ,KAAK,CAACK,OAAO,CAAC,CAE/D,KAAM,CAAAC,SAAS,CAAGJ,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC,CAC/C,GAAIH,KAAK,CAACM,SAAS,CAAEA,SAAS,CAACF,YAAY,CAAC,OAAO,CAAEJ,K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AClBN,IAAI,CAACE,WAAW,CACjB,CAAC,CAEF,MAAO,CAAAK,UAAU,cAAG,GAAAO,sBAAY,EAACjB,QAAQ,CAAEU,UAAU,CAACtD,OAAO,CAAC,CAAG,IACnE,CAAC,CAAC,CAEF0C,OAAO,CAACoB,SAAS,CAAG,CAClBlB,QAAQ,CAAEmB,kBAAE,CAACC,IAAI,CACjBrE,KAAK,CAAEoE,kBAAE,CAACE,KAAK,CAAC,CAAC,CAACC,UACpB,CAAC,CAEDxB,OAAO,CAACyB,YAAY,CAAG,CACrBvB,QAAQ,CAAE,IACZ,CAAC,CAAC,IAAAwB,QAAA,CAAAlF,OAAA,CAAAmF,OAAA,CAEa3B,OAAO"}
|
|
@@ -22,5 +22,5 @@ if(heap.triggeredByTouch){if(!heap.timerId){heap.timerId=setTimeout(()=>{heap.tr
|
|
|
22
22
|
// once opened (because similar call above does not have effect until
|
|
23
23
|
// the tooltip is fully mounted, and that is delayed to future rendering
|
|
24
24
|
// cycle due to the implementation).
|
|
25
|
-
if(tooltipRef.current){tooltipRef.current.pointTo(heap.lastCursorX+window.scrollX,heap.lastCursorY+window.scrollY,placement,wrapperRef.current)}const listener=()=>setShowTooltip(false);window.addEventListener("scroll",listener);return()=>window.removeEventListener("scroll",listener)}return undefined},[heap.lastCursorX,heap.lastCursorY,placement,showTooltip,tip]);return/*#__PURE__*/(0,_jsxRuntime.jsxs)("div",{className:theme.wrapper,onMouseLeave:()=>setShowTooltip(false),onMouseMove:e=>updatePortalPosition(e.clientX,e.clientY),onClick:()=>{if(heap.timerId){clearTimeout(heap.timerId);heap.timerId=undefined;heap.triggeredByTouch=false}},onTouchStart:()=>{heap.triggeredByTouch=true},ref:wrapperRef,role:"presentation",children:[showTooltip&&tip!==null?/*#__PURE__*/(0,_jsxRuntime.jsx)(_Tooltip.default,{ref:tooltipRef,theme:theme,children:tip}):null,children]})}const ThemedWrapper=(0,_utils.themed)("WithTooltip",["appearance","arrow","container","content","wrapper"],defaultTheme)(Wrapper);ThemedWrapper.PLACEMENTS=_Tooltip.PLACEMENTS;Wrapper.propTypes={children:_propTypes.default.node,placement:_propTypes.default.oneOf(Object.values(_Tooltip.PLACEMENTS)),theme:ThemedWrapper.themeType.isRequired,tip:_propTypes.default.node};Wrapper.defaultProps={children:null,placement:_Tooltip.PLACEMENTS.ABOVE_CURSOR,tip:null};var _default=
|
|
25
|
+
if(tooltipRef.current){tooltipRef.current.pointTo(heap.lastCursorX+window.scrollX,heap.lastCursorY+window.scrollY,placement,wrapperRef.current)}const listener=()=>setShowTooltip(false);window.addEventListener("scroll",listener);return()=>window.removeEventListener("scroll",listener)}return undefined},[heap.lastCursorX,heap.lastCursorY,placement,showTooltip,tip]);return/*#__PURE__*/(0,_jsxRuntime.jsxs)("div",{className:theme.wrapper,onMouseLeave:()=>setShowTooltip(false),onMouseMove:e=>updatePortalPosition(e.clientX,e.clientY),onClick:()=>{if(heap.timerId){clearTimeout(heap.timerId);heap.timerId=undefined;heap.triggeredByTouch=false}},onTouchStart:()=>{heap.triggeredByTouch=true},ref:wrapperRef,role:"presentation",children:[showTooltip&&tip!==null?/*#__PURE__*/(0,_jsxRuntime.jsx)(_Tooltip.default,{ref:tooltipRef,theme:theme,children:tip}):null,children]})}const ThemedWrapper=(0,_utils.themed)("WithTooltip",["appearance","arrow","container","content","wrapper"],defaultTheme)(Wrapper);ThemedWrapper.PLACEMENTS=_Tooltip.PLACEMENTS;Wrapper.propTypes={children:_propTypes.default.node,placement:_propTypes.default.oneOf(Object.values(_Tooltip.PLACEMENTS)),theme:ThemedWrapper.themeType.isRequired,tip:_propTypes.default.node};Wrapper.defaultProps={children:null,placement:_Tooltip.PLACEMENTS.ABOVE_CURSOR,tip:null};var _default=exports.default=ThemedWrapper;
|
|
26
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_react","_utils","_Tooltip","_interopRequireWildcard","_jsxRuntime","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","defaultTheme","Wrapper","children","placement","tip","theme","current","heap","useRef","lastCursorX","lastCursorY","triggeredByTouch","timerId","undefined","tooltipRef","wrapperRef","showTooltip","setShowTooltip","useState","updatePortalPosition","cursorX","cursorY","setTimeout","wrapperRect","getBoundingClientRect","left","right","top","bottom","pointTo","window","scrollX","scrollY","useEffect","listener","addEventListener","removeEventListener","jsxs","className","wrapper","onMouseLeave","onMouseMove","e","clientX","clientY","onClick","clearTimeout","onTouchStart","ref","role","jsx","ThemedWrapper","themed","PLACEMENTS","propTypes","PT","node","oneOf","values","themeType","isRequired","defaultProps","ABOVE_CURSOR","_default","exports"],"sources":["../../../../../src/shared/components/WithTooltip/index.jsx"],"sourcesContent":["/* global window */\n\nimport PT from 'prop-types';\nimport { useEffect, useRef, useState } from 'react';\n\nimport { themed } from 'utils';\n\nimport Tooltip, { PLACEMENTS } from './Tooltip';\n\nimport defaultTheme from './default-theme.scss';\n\n/**\n * Implements a simple to use and themeable tooltip component, _e.g._\n * ```js\n * <WithTooltip tip=\"This is example tooltip.\">\n * <p>Hover to see the tooltip.</p>\n * </WithTooltip>\n * ```\n * **Children:** Children are rendered in the place of `<WithTooltip>`,\n * and when hovered the tooltip is shown. By default the wrapper itself is\n * `<div>` block with `display: inline-block`.\n * @param {object} props Component properties.\n * @param {React.node} props.tip – Anything React is able to render,\n * _e.g._ a tooltip text. This will be the tooltip content.\n * @param {WithTooltipTheme} props.theme _Ad hoc_ theme.\n */\nfunction Wrapper({\n children,\n placement,\n tip,\n theme,\n}) {\n const { current: heap } = useRef({\n lastCursorX: 0,\n lastCursorY: 0,\n triggeredByTouch: false,\n timerId: undefined,\n });\n const tooltipRef = useRef();\n const wrapperRef = useRef();\n const [showTooltip, setShowTooltip] = useState(false);\n\n const updatePortalPosition = (cursorX, cursorY) => {\n if (!showTooltip) {\n heap.lastCursorX = cursorX;\n heap.lastCursorY = cursorY;\n\n // If tooltip was triggered by a touch, we delay its opening by a bit,\n // to ensure it was not a touch-click - in the case of touch click we\n // want to do the click, rather than show the tooltip, and the delay\n // gives click handler a chance to abort the tooltip openning.\n if (heap.triggeredByTouch) {\n if (!heap.timerId) {\n heap.timerId = setTimeout(() => {\n heap.triggeredByTouch = false;\n heap.timerId = undefined;\n setShowTooltip(true);\n }, 300);\n }\n\n // Otherwise we can just open the tooltip right away.\n } else setShowTooltip(true);\n } else {\n const wrapperRect = wrapperRef.current.getBoundingClientRect();\n if (\n cursorX < wrapperRect.left\n || cursorX > wrapperRect.right\n || cursorY < wrapperRect.top\n || cursorY > wrapperRect.bottom\n ) {\n setShowTooltip(false);\n } else if (tooltipRef.current) {\n tooltipRef.current.pointTo(\n cursorX + window.scrollX,\n cursorY + window.scrollY,\n placement,\n wrapperRef.current,\n );\n }\n }\n };\n\n useEffect(() => {\n if (showTooltip && tip !== null) {\n // This is necessary to ensure that even when a single mouse event\n // arrives to a tool-tipped component, the tooltip is correctly positioned\n // once opened (because similar call above does not have effect until\n // the tooltip is fully mounted, and that is delayed to future rendering\n // cycle due to the implementation).\n if (tooltipRef.current) {\n tooltipRef.current.pointTo(\n heap.lastCursorX + window.scrollX,\n heap.lastCursorY + window.scrollY,\n placement,\n wrapperRef.current,\n );\n }\n\n const listener = () => setShowTooltip(false);\n window.addEventListener('scroll', listener);\n return () => window.removeEventListener('scroll', listener);\n }\n return undefined;\n }, [\n heap.lastCursorX,\n heap.lastCursorY,\n placement,\n showTooltip,\n tip,\n ]);\n\n return (\n <div\n className={theme.wrapper}\n onMouseLeave={() => setShowTooltip(false)}\n onMouseMove={(e) => updatePortalPosition(e.clientX, e.clientY)}\n onClick={() => {\n if (heap.timerId) {\n clearTimeout(heap.timerId);\n heap.timerId = undefined;\n heap.triggeredByTouch = false;\n }\n }}\n onTouchStart={() => {\n heap.triggeredByTouch = true;\n }}\n ref={wrapperRef}\n role=\"presentation\"\n >\n {\n showTooltip && tip !== null ? (\n <Tooltip ref={tooltipRef} theme={theme}>{tip}</Tooltip>\n ) : null\n }\n {children}\n </div>\n );\n}\n\nconst ThemedWrapper = themed(\n 'WithTooltip',\n [\n 'appearance',\n 'arrow',\n 'container',\n 'content',\n 'wrapper',\n ],\n defaultTheme,\n)(Wrapper);\n\nThemedWrapper.PLACEMENTS = PLACEMENTS;\n\nWrapper.propTypes = {\n children: PT.node,\n placement: PT.oneOf(Object.values(PLACEMENTS)),\n theme: ThemedWrapper.themeType.isRequired,\n tip: PT.node,\n};\n\nWrapper.defaultProps = {\n children: null,\n placement: PLACEMENTS.ABOVE_CURSOR,\n tip: null,\n};\n\nexport default ThemedWrapper;\n"],"mappings":"gLAEA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,MAAA,CAAAD,OAAA,UAEA,IAAAE,MAAA,CAAAF,OAAA,gBAEA,IAAAG,QAAA,CAAAC,uBAAA,CAAAJ,OAAA,eAAgD,IAAAK,WAAA,CAAAL,OAAA,+BAAAM,yBAAAC,WAAA,YAAAC,OAAA,8BAAAC,iBAAA,KAAAD,OAAA,KAAAE,gBAAA,KAAAF,OAAA,QAAAF,wBAAA,SAAAA,CAAAC,WAAA,SAAAA,WAAA,CAAAG,gBAAA,CAAAD,iBAAA,GAAAF,WAAA,WAAAH,wBAAAO,GAAA,CAAAJ,WAAA,MAAAA,WAAA,EAAAI,GAAA,EAAAA,GAAA,CAAAC,UAAA,SAAAD,GAAA,IAAAA,GAAA,gBAAAA,GAAA,oBAAAA,GAAA,sBAAAE,OAAA,CAAAF,GAAA,MAAAG,KAAA,CAAAR,wBAAA,CAAAC,WAAA,KAAAO,KAAA,EAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,UAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,MAAAM,MAAA,QAAAC,qBAAA,CAAAC,MAAA,CAAAC,cAA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,aAAa,CACb,CACE,YAAY,CACZ,OAAO,CACP,WAAW,CACX,SAAS,CACT,SAAS,CACV,CACDpD,YACF,CAAC,CAACC,OAAO,CAAC,CAEVkD,aAAa,CAACE,UAAU,CAAGA,mBAAU,CAErCpD,OAAO,CAACqD,SAAS,CAAG,CAClBpD,QAAQ,CAAEqD,kBAAE,CAACC,IAAI,CACjBrD,SAAS,CAAEoD,kBAAE,CAACE,KAAK,CAAClE,MAAM,CAACmE,MAAM,CAACL,mBAAU,CAAC,CAAC,CAC9ChD,KAAK,CAAE8C,aAAa,CAACQ,SAAS,CAACC,UAAU,CACzCxD,GAAG,CAAEmD,kBAAE,CAACC,IACV,CAAC,CAEDvD,OAAO,CAAC4D,YAAY,CAAG,CACrB3D,QAAQ,CAAE,IAAI,CACdC,SAAS,CAAEkD,mBAAU,CAACS,YAAY,CAClC1D,GAAG,CAAE,IACP,CAAC,CAAC,IAAA2D,QAAA,CAEaZ,aAAa,CAAAa,OAAA,CAAA/E,OAAA,CAAA8E,QAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_react","_utils","_Tooltip","_interopRequireWildcard","_jsxRuntime","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","defaultTheme","Wrapper","children","placement","tip","theme","current","heap","useRef","lastCursorX","lastCursorY","triggeredByTouch","timerId","undefined","tooltipRef","wrapperRef","showTooltip","setShowTooltip","useState","updatePortalPosition","cursorX","cursorY","setTimeout","wrapperRect","getBoundingClientRect","left","right","top","bottom","pointTo","window","scrollX","scrollY","useEffect","listener","addEventListener","removeEventListener","jsxs","className","wrapper","onMouseLeave","onMouseMove","e","clientX","clientY","onClick","clearTimeout","onTouchStart","ref","role","jsx","ThemedWrapper","themed","PLACEMENTS","propTypes","PT","node","oneOf","values","themeType","isRequired","defaultProps","ABOVE_CURSOR","_default","exports"],"sources":["../../../../../src/shared/components/WithTooltip/index.jsx"],"sourcesContent":["/* global window */\n\nimport PT from 'prop-types';\nimport { useEffect, useRef, useState } from 'react';\n\nimport { themed } from 'utils';\n\nimport Tooltip, { PLACEMENTS } from './Tooltip';\n\nimport defaultTheme from './default-theme.scss';\n\n/**\n * Implements a simple to use and themeable tooltip component, _e.g._\n * ```js\n * <WithTooltip tip=\"This is example tooltip.\">\n * <p>Hover to see the tooltip.</p>\n * </WithTooltip>\n * ```\n * **Children:** Children are rendered in the place of `<WithTooltip>`,\n * and when hovered the tooltip is shown. By default the wrapper itself is\n * `<div>` block with `display: inline-block`.\n * @param {object} props Component properties.\n * @param {React.node} props.tip – Anything React is able to render,\n * _e.g._ a tooltip text. This will be the tooltip content.\n * @param {WithTooltipTheme} props.theme _Ad hoc_ theme.\n */\nfunction Wrapper({\n children,\n placement,\n tip,\n theme,\n}) {\n const { current: heap } = useRef({\n lastCursorX: 0,\n lastCursorY: 0,\n triggeredByTouch: false,\n timerId: undefined,\n });\n const tooltipRef = useRef();\n const wrapperRef = useRef();\n const [showTooltip, setShowTooltip] = useState(false);\n\n const updatePortalPosition = (cursorX, cursorY) => {\n if (!showTooltip) {\n heap.lastCursorX = cursorX;\n heap.lastCursorY = cursorY;\n\n // If tooltip was triggered by a touch, we delay its opening by a bit,\n // to ensure it was not a touch-click - in the case of touch click we\n // want to do the click, rather than show the tooltip, and the delay\n // gives click handler a chance to abort the tooltip openning.\n if (heap.triggeredByTouch) {\n if (!heap.timerId) {\n heap.timerId = setTimeout(() => {\n heap.triggeredByTouch = false;\n heap.timerId = undefined;\n setShowTooltip(true);\n }, 300);\n }\n\n // Otherwise we can just open the tooltip right away.\n } else setShowTooltip(true);\n } else {\n const wrapperRect = wrapperRef.current.getBoundingClientRect();\n if (\n cursorX < wrapperRect.left\n || cursorX > wrapperRect.right\n || cursorY < wrapperRect.top\n || cursorY > wrapperRect.bottom\n ) {\n setShowTooltip(false);\n } else if (tooltipRef.current) {\n tooltipRef.current.pointTo(\n cursorX + window.scrollX,\n cursorY + window.scrollY,\n placement,\n wrapperRef.current,\n );\n }\n }\n };\n\n useEffect(() => {\n if (showTooltip && tip !== null) {\n // This is necessary to ensure that even when a single mouse event\n // arrives to a tool-tipped component, the tooltip is correctly positioned\n // once opened (because similar call above does not have effect until\n // the tooltip is fully mounted, and that is delayed to future rendering\n // cycle due to the implementation).\n if (tooltipRef.current) {\n tooltipRef.current.pointTo(\n heap.lastCursorX + window.scrollX,\n heap.lastCursorY + window.scrollY,\n placement,\n wrapperRef.current,\n );\n }\n\n const listener = () => setShowTooltip(false);\n window.addEventListener('scroll', listener);\n return () => window.removeEventListener('scroll', listener);\n }\n return undefined;\n }, [\n heap.lastCursorX,\n heap.lastCursorY,\n placement,\n showTooltip,\n tip,\n ]);\n\n return (\n <div\n className={theme.wrapper}\n onMouseLeave={() => setShowTooltip(false)}\n onMouseMove={(e) => updatePortalPosition(e.clientX, e.clientY)}\n onClick={() => {\n if (heap.timerId) {\n clearTimeout(heap.timerId);\n heap.timerId = undefined;\n heap.triggeredByTouch = false;\n }\n }}\n onTouchStart={() => {\n heap.triggeredByTouch = true;\n }}\n ref={wrapperRef}\n role=\"presentation\"\n >\n {\n showTooltip && tip !== null ? (\n <Tooltip ref={tooltipRef} theme={theme}>{tip}</Tooltip>\n ) : null\n }\n {children}\n </div>\n );\n}\n\nconst ThemedWrapper = themed(\n 'WithTooltip',\n [\n 'appearance',\n 'arrow',\n 'container',\n 'content',\n 'wrapper',\n ],\n defaultTheme,\n)(Wrapper);\n\nThemedWrapper.PLACEMENTS = PLACEMENTS;\n\nWrapper.propTypes = {\n children: PT.node,\n placement: PT.oneOf(Object.values(PLACEMENTS)),\n theme: ThemedWrapper.themeType.isRequired,\n tip: PT.node,\n};\n\nWrapper.defaultProps = {\n children: null,\n placement: PLACEMENTS.ABOVE_CURSOR,\n tip: null,\n};\n\nexport default ThemedWrapper;\n"],"mappings":"g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,CAAEkD,mBAAU,CAACS,YAAY,CAClC1D,GAAG,CAAE,IACP,CAAC,CAAC,IAAA2D,QAAA,CAAAC,OAAA,CAAA/E,OAAA,CAEakE,aAAa"}
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* IFrame.
|
|
15
15
|
*/function YouTubeVideo({autoplay,src,theme,title}){let[url,query]=src.split("?");query=query?_qs.default.parse(query):{};const videoId=query.v||url.match(/\/([a-zA-Z0-9-_]*)$/)[1];url=`https://www.youtube.com/embed/${videoId}`;delete query.v;query.autoplay=autoplay?1:0;url+=`?${_qs.default.stringify(query)}`;// TODO: https://developers.google.com/youtube/player_parameters
|
|
16
16
|
// More query parameters can be exposed via the component props.
|
|
17
|
-
return/*#__PURE__*/(0,_jsxRuntime.jsxs)(_ScalableRect.default,{className:theme.container,ratio:"16:9",children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_Throbber.default,{theme:throbberTheme}),/*#__PURE__*/(0,_jsxRuntime.jsx)("iframe",{allow:"autoplay",allowFullScreen:true,className:theme.video,src:url,title:title})]})}const ThemedYouTubeVideo=(0,_reactThemes.default)("YouTubeVideo",["container","video"],baseTheme)(YouTubeVideo);YouTubeVideo.propTypes={autoplay:_propTypes.default.bool,src:_propTypes.default.string.isRequired,theme:ThemedYouTubeVideo.themeType.isRequired,title:_propTypes.default.string};YouTubeVideo.defaultProps={autoplay:false,title:""};var _default=
|
|
17
|
+
return/*#__PURE__*/(0,_jsxRuntime.jsxs)(_ScalableRect.default,{className:theme.container,ratio:"16:9",children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_Throbber.default,{theme:throbberTheme}),/*#__PURE__*/(0,_jsxRuntime.jsx)("iframe",{allow:"autoplay",allowFullScreen:true,className:theme.video,src:url,title:title})]})}const ThemedYouTubeVideo=(0,_reactThemes.default)("YouTubeVideo",["container","video"],baseTheme)(YouTubeVideo);YouTubeVideo.propTypes={autoplay:_propTypes.default.bool,src:_propTypes.default.string.isRequired,theme:ThemedYouTubeVideo.themeType.isRequired,title:_propTypes.default.string};YouTubeVideo.defaultProps={autoplay:false,title:""};var _default=exports.default=ThemedYouTubeVideo;
|
|
18
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_qs","_reactThemes","_ScalableRect","_Throbber","_jsxRuntime","baseTheme","throbberTheme","YouTubeVideo","autoplay","src","theme","title","url","query","split","qs","parse","videoId","v","match","stringify","jsxs","default","className","container","ratio","children","jsx","allow","allowFullScreen","video","ThemedYouTubeVideo","themed","propTypes","PT","bool","string","isRequired","themeType","defaultProps","_default","exports"],"sources":["../../../../../src/shared/components/YouTubeVideo/index.jsx"],"sourcesContent":["import PT from 'prop-types';\nimport qs from 'qs';\nimport themed from '@dr.pogodin/react-themes';\n\nimport ScalableRect from 'components/ScalableRect';\nimport Throbber from 'components/Throbber';\n\nimport baseTheme from './base.scss';\nimport throbberTheme from './throbber.scss';\n\n/**\n * A component for embeding a YouTube video.\n * @param {object} [props] Component properties.\n * @param {boolean} [props.autoplay] If `true` the video will start to play\n * automatically once loaded.\n * @param {string} [props.src] URL of the video to play. Can be in any of\n * the following formats, and keeps any additional query parameters understood\n * by the YouTube IFrame player:\n * - `https://www.youtube.com/watch?v=NdF6Rmt6Ado`\n * - `https://youtu.be/NdF6Rmt6Ado`\n * - `https://www.youtube.com/embed/NdF6Rmt6Ado`\n * @param {YouTubeVideoTheme} [props.theme] _Ad hoc_ theme.\n * @param {string} [props.title] The `title` attribute to add to the player\n * IFrame.\n */\nfunction YouTubeVideo({\n autoplay,\n src,\n theme,\n title,\n}) {\n let [url, query] = src.split('?');\n query = query ? qs.parse(query) : {};\n\n const videoId = query.v || url.match(/\\/([a-zA-Z0-9-_]*)$/)[1];\n url = `https://www.youtube.com/embed/${videoId}`;\n\n delete query.v;\n query.autoplay = autoplay ? 1 : 0;\n url += `?${qs.stringify(query)}`;\n\n // TODO: https://developers.google.com/youtube/player_parameters\n // More query parameters can be exposed via the component props.\n\n return (\n <ScalableRect className={theme.container} ratio=\"16:9\">\n <Throbber theme={throbberTheme} />\n <iframe\n allow=\"autoplay\"\n allowFullScreen\n className={theme.video}\n src={url}\n title={title}\n />\n </ScalableRect>\n );\n}\n\nconst ThemedYouTubeVideo = themed(\n 'YouTubeVideo',\n [\n 'container',\n 'video',\n ],\n baseTheme,\n)(YouTubeVideo);\n\nYouTubeVideo.propTypes = {\n autoplay: PT.bool,\n src: PT.string.isRequired,\n theme: ThemedYouTubeVideo.themeType.isRequired,\n title: PT.string,\n};\n\nYouTubeVideo.defaultProps = {\n autoplay: false,\n title: '',\n};\n\nexport default ThemedYouTubeVideo;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,GAAA,CAAAF,sBAAA,CAAAC,OAAA,QACA,IAAAE,YAAA,CAAAH,sBAAA,CAAAC,OAAA,8BAEA,IAAAG,aAAA,CAAAJ,sBAAA,CAAAC,OAAA,qBACA,IAAAI,SAAA,CAAAL,sBAAA,CAAAC,OAAA,iBAA2C,IAAAK,WAAA,CAAAL,OAAA,4BAAAM,SAAA,+FAAAC,aAAA,0EAK3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAAS,CAAAC,YAAYA,CAAC,CACpBC,QAAQ,CACRC,GAAG,CACHC,KAAK,CACLC,KACF,CAAC,CAAE,CACD,GAAI,CAACC,GAAG,CAAEC,KAAK,CAAC,CAAGJ,GAAG,CAACK,KAAK,CAAC,GAAG,CAAC,CACjCD,KAAK,CAAGA,KAAK,CAAGE,WAAE,CAACC,KAAK,CAACH,KAAK,CAAC,CAAG,CAAC,CAAC,CAEpC,KAAM,CAAAI,OAAO,CAAGJ,KAAK,CAACK,CAAC,EAAIN,GAAG,CAACO,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAC9DP,GAAG,CAAI,iCAAgCK,OAAQ,EAAC,CAEhD,MAAO,CAAAJ,KAAK,CAACK,CAAC,CACdL,KAAK,CAACL,QAAQ,CAAGA,QAAQ,CAAG,CAAC,CAAG,CAAC,CACjCI,GAAG,EAAK,IAAGG,WAAE,CAACK,SAAS,CAACP,KAAK,CAAE,EAAC,CAEhC;AACA;AAEA,mBACE,GAAAT,WAAA,CAAAiB,IAAA,EAACnB,aAAA,CAAAoB,OAAY,EAACC,SAAS,CAAEb,KAAK,CAACc,SAAU,CAACC,KAAK,CAAC,MAAM,CAAAC,QAAA,eACpD,GAAAtB,WAAA,CAAAuB,GAAA,EAACxB,SAAA,CAAAmB,OAAQ,EAACZ,KAAK,CAAEJ,aAAc,CAAE,CAAC,cAClC,GAAAF,WAAA,CAAAuB,GAAA,YACEC,KAAK,CAAC,UAAU,CAChBC,eAAe,MACfN,SAAS,CAAEb,KAAK,CAACoB,KAAM,CACvBrB,GAAG,CAAEG,GAAI,CACTD,KAAK,CAAEA,KAAM,CACd,CAAC,EACU,CAElB,CAEA,KAAM,CAAAoB,kBAAkB,CAAG,GAAAC,oBAAM,EAC/B,cAAc,CACd,CACE,WAAW,CACX,OAAO,CACR,CACD3B,SACF,CAAC,CAACE,YAAY,CAAC,CAEfA,YAAY,CAAC0B,SAAS,CAAG,CACvBzB,QAAQ,CAAE0B,kBAAE,CAACC,IAAI,CACjB1B,GAAG,CAAEyB,kBAAE,CAACE,MAAM,CAACC,UAAU,CACzB3B,KAAK,CAAEqB,kBAAkB,CAACO,SAAS,CAACD,UAAU,CAC9C1B,KAAK,CAAEuB,kBAAE,CAACE,MACZ,CAAC,CAED7B,YAAY,CAACgC,YAAY,CAAG,CAC1B/B,QAAQ,CAAE,KAAK,CACfG,KAAK,CAAE,EACT,CAAC,CAAC,IAAA6B,QAAA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_qs","_reactThemes","_ScalableRect","_Throbber","_jsxRuntime","baseTheme","throbberTheme","YouTubeVideo","autoplay","src","theme","title","url","query","split","qs","parse","videoId","v","match","stringify","jsxs","default","className","container","ratio","children","jsx","allow","allowFullScreen","video","ThemedYouTubeVideo","themed","propTypes","PT","bool","string","isRequired","themeType","defaultProps","_default","exports"],"sources":["../../../../../src/shared/components/YouTubeVideo/index.jsx"],"sourcesContent":["import PT from 'prop-types';\nimport qs from 'qs';\nimport themed from '@dr.pogodin/react-themes';\n\nimport ScalableRect from 'components/ScalableRect';\nimport Throbber from 'components/Throbber';\n\nimport baseTheme from './base.scss';\nimport throbberTheme from './throbber.scss';\n\n/**\n * A component for embeding a YouTube video.\n * @param {object} [props] Component properties.\n * @param {boolean} [props.autoplay] If `true` the video will start to play\n * automatically once loaded.\n * @param {string} [props.src] URL of the video to play. Can be in any of\n * the following formats, and keeps any additional query parameters understood\n * by the YouTube IFrame player:\n * - `https://www.youtube.com/watch?v=NdF6Rmt6Ado`\n * - `https://youtu.be/NdF6Rmt6Ado`\n * - `https://www.youtube.com/embed/NdF6Rmt6Ado`\n * @param {YouTubeVideoTheme} [props.theme] _Ad hoc_ theme.\n * @param {string} [props.title] The `title` attribute to add to the player\n * IFrame.\n */\nfunction YouTubeVideo({\n autoplay,\n src,\n theme,\n title,\n}) {\n let [url, query] = src.split('?');\n query = query ? qs.parse(query) : {};\n\n const videoId = query.v || url.match(/\\/([a-zA-Z0-9-_]*)$/)[1];\n url = `https://www.youtube.com/embed/${videoId}`;\n\n delete query.v;\n query.autoplay = autoplay ? 1 : 0;\n url += `?${qs.stringify(query)}`;\n\n // TODO: https://developers.google.com/youtube/player_parameters\n // More query parameters can be exposed via the component props.\n\n return (\n <ScalableRect className={theme.container} ratio=\"16:9\">\n <Throbber theme={throbberTheme} />\n <iframe\n allow=\"autoplay\"\n allowFullScreen\n className={theme.video}\n src={url}\n title={title}\n />\n </ScalableRect>\n );\n}\n\nconst ThemedYouTubeVideo = themed(\n 'YouTubeVideo',\n [\n 'container',\n 'video',\n ],\n baseTheme,\n)(YouTubeVideo);\n\nYouTubeVideo.propTypes = {\n autoplay: PT.bool,\n src: PT.string.isRequired,\n theme: ThemedYouTubeVideo.themeType.isRequired,\n title: PT.string,\n};\n\nYouTubeVideo.defaultProps = {\n autoplay: false,\n title: '',\n};\n\nexport default ThemedYouTubeVideo;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,GAAA,CAAAF,sBAAA,CAAAC,OAAA,QACA,IAAAE,YAAA,CAAAH,sBAAA,CAAAC,OAAA,8BAEA,IAAAG,aAAA,CAAAJ,sBAAA,CAAAC,OAAA,qBACA,IAAAI,SAAA,CAAAL,sBAAA,CAAAC,OAAA,iBAA2C,IAAAK,WAAA,CAAAL,OAAA,4BAAAM,SAAA,+FAAAC,aAAA,0EAK3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAAS,CAAAC,YAAYA,CAAC,CACpBC,QAAQ,CACRC,GAAG,CACHC,KAAK,CACLC,KACF,CAAC,CAAE,CACD,GAAI,CAACC,GAAG,CAAEC,KAAK,CAAC,CAAGJ,GAAG,CAACK,KAAK,CAAC,GAAG,CAAC,CACjCD,KAAK,CAAGA,KAAK,CAAGE,WAAE,CAACC,KAAK,CAACH,KAAK,CAAC,CAAG,CAAC,CAAC,CAEpC,KAAM,CAAAI,OAAO,CAAGJ,KAAK,CAACK,CAAC,EAAIN,GAAG,CAACO,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAC9DP,GAAG,CAAI,iCAAgCK,OAAQ,EAAC,CAEhD,MAAO,CAAAJ,KAAK,CAACK,CAAC,CACdL,KAAK,CAACL,QAAQ,CAAGA,QAAQ,CAAG,CAAC,CAAG,CAAC,CACjCI,GAAG,EAAK,IAAGG,WAAE,CAACK,SAAS,CAACP,KAAK,CAAE,EAAC,CAEhC;AACA;AAEA,mBACE,GAAAT,WAAA,CAAAiB,IAAA,EAACnB,aAAA,CAAAoB,OAAY,EAACC,SAAS,CAAEb,KAAK,CAACc,SAAU,CAACC,KAAK,CAAC,MAAM,CAAAC,QAAA,eACpD,GAAAtB,WAAA,CAAAuB,GAAA,EAACxB,SAAA,CAAAmB,OAAQ,EAACZ,KAAK,CAAEJ,aAAc,CAAE,CAAC,cAClC,GAAAF,WAAA,CAAAuB,GAAA,YACEC,KAAK,CAAC,UAAU,CAChBC,eAAe,MACfN,SAAS,CAAEb,KAAK,CAACoB,KAAM,CACvBrB,GAAG,CAAEG,GAAI,CACTD,KAAK,CAAEA,KAAM,CACd,CAAC,EACU,CAElB,CAEA,KAAM,CAAAoB,kBAAkB,CAAG,GAAAC,oBAAM,EAC/B,cAAc,CACd,CACE,WAAW,CACX,OAAO,CACR,CACD3B,SACF,CAAC,CAACE,YAAY,CAAC,CAEfA,YAAY,CAAC0B,SAAS,CAAG,CACvBzB,QAAQ,CAAE0B,kBAAE,CAACC,IAAI,CACjB1B,GAAG,CAAEyB,kBAAE,CAACE,MAAM,CAACC,UAAU,CACzB3B,KAAK,CAAEqB,kBAAkB,CAACO,SAAS,CAACD,UAAU,CAC9C1B,KAAK,CAAEuB,kBAAE,CAACE,MACZ,CAAC,CAED7B,YAAY,CAACgC,YAAY,CAAG,CAC1B/B,QAAQ,CAAE,KAAK,CACfG,KAAK,CAAE,EACT,CAAC,CAAC,IAAA6B,QAAA,CAAAC,OAAA,CAAAnB,OAAA,CAEaS,kBAAkB"}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
// like React Native, IS_CLIENT_SIDE is "true", however "document" and a bunch
|
|
4
4
|
// of other browser-world features are not available.
|
|
5
5
|
if(_environmentCheck.IS_CLIENT_SIDE&&typeof document!=="undefined"){const cookie=require("cookie");// eslint-disable-line global-require
|
|
6
|
-
config.CSRF=cookie.parse(document.cookie).csrfToken}var _default=
|
|
6
|
+
config.CSRF=cookie.parse(document.cookie).csrfToken}var _default=exports.default=config;
|
|
7
7
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":["_environmentCheck","require","_webpack","config","IS_CLIENT_SIDE","default","CONFIG","requireWeak","document","cookie","CSRF","parse","csrfToken","_default","exports"],"sources":["../../../../src/shared/utils/config.js"],"sourcesContent":["/* global document */\n\nimport { IS_CLIENT_SIDE } from './isomorphy/environment-check';\nimport { requireWeak } from './webpack';\n\nconst config = (\n IS_CLIENT_SIDE\n // eslint-disable-next-line global-require\n ? require('client/getInj').default().CONFIG\n : requireWeak('config')\n) || {};\n\n// The safeguard for \"document\" is necessary because in non-Node environments,\n// like React Native, IS_CLIENT_SIDE is \"true\", however \"document\" and a bunch\n// of other browser-world features are not available.\nif (IS_CLIENT_SIDE && typeof document !== 'undefined') {\n const cookie = require('cookie'); // eslint-disable-line global-require\n config.CSRF = cookie.parse(document.cookie).csrfToken;\n}\n\nexport default config;\n"],"mappings":"6FAEA,IAAAA,iBAAA,CAAAC,OAAA,kCACA,IAAAC,QAAA,CAAAD,OAAA,cAHA,qBAKA,KAAM,CAAAE,MAAM,CAAG,CACbC,gCACE;AAAA,CACEH,OAAO,sBAAgB,CAAC,CAACI,OAAO,CAAC,CAAC,CAACC,MAAM,CACzC,GAAAC,oBAAW,EAAC,QAAQ,CAAC,GACtB,CAAC,CAAC,CAEP;AACA;AACA;AACA,GAAIH,gCAAc,EAAI,MAAO,CAAAI,QAAQ,GAAK,WAAW,CAAE,CACrD,KAAM,CAAAC,MAAM,CAAGR,OAAO,CAAC,QAAQ,CAAC,CAAE;AAClCE,MAAM,CAACO,IAAI,CAAGD,MAAM,CAACE,KAAK,CAACH,QAAQ,CAACC,MAAM,CAAC,CAACG,SAC9C,CAAC,IAAAC,QAAA,
|
|
1
|
+
{"version":3,"file":"config.js","names":["_environmentCheck","require","_webpack","config","IS_CLIENT_SIDE","default","CONFIG","requireWeak","document","cookie","CSRF","parse","csrfToken","_default","exports"],"sources":["../../../../src/shared/utils/config.js"],"sourcesContent":["/* global document */\n\nimport { IS_CLIENT_SIDE } from './isomorphy/environment-check';\nimport { requireWeak } from './webpack';\n\nconst config = (\n IS_CLIENT_SIDE\n // eslint-disable-next-line global-require\n ? require('client/getInj').default().CONFIG\n : requireWeak('config')\n) || {};\n\n// The safeguard for \"document\" is necessary because in non-Node environments,\n// like React Native, IS_CLIENT_SIDE is \"true\", however \"document\" and a bunch\n// of other browser-world features are not available.\nif (IS_CLIENT_SIDE && typeof document !== 'undefined') {\n const cookie = require('cookie'); // eslint-disable-line global-require\n config.CSRF = cookie.parse(document.cookie).csrfToken;\n}\n\nexport default config;\n"],"mappings":"6FAEA,IAAAA,iBAAA,CAAAC,OAAA,kCACA,IAAAC,QAAA,CAAAD,OAAA,cAHA,qBAKA,KAAM,CAAAE,MAAM,CAAG,CACbC,gCACE;AAAA,CACEH,OAAO,sBAAgB,CAAC,CAACI,OAAO,CAAC,CAAC,CAACC,MAAM,CACzC,GAAAC,oBAAW,EAAC,QAAQ,CAAC,GACtB,CAAC,CAAC,CAEP;AACA;AACA;AACA,GAAIH,gCAAc,EAAI,MAAO,CAAAI,QAAQ,GAAK,WAAW,CAAE,CACrD,KAAM,CAAAC,MAAM,CAAGR,OAAO,CAAC,QAAQ,CAAC,CAAE;AAClCE,MAAM,CAACO,IAAI,CAAGD,MAAM,CAACE,KAAK,CAACH,QAAQ,CAACC,MAAM,CAAC,CAACG,SAC9C,CAAC,IAAAC,QAAA,CAAAC,OAAA,CAAAT,OAAA,CAEcF,MAAM"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Barrier",{enumerable:true,get:function(){return _jsUtils.Barrier}});Object.defineProperty(exports,"Emitter",{enumerable:true,get:function(){return _jsUtils.Emitter}});exports.JU=void 0;Object.defineProperty(exports,"Semaphore",{enumerable:true,get:function(){return _jsUtils.Semaphore}});Object.defineProperty(exports,"ThemeProvider",{enumerable:true,get:function(){return _reactThemes.ThemeProvider}});Object.defineProperty(exports,"config",{enumerable:true,get:function(){return _config.default}});exports.isomorphy=void 0;Object.defineProperty(exports,"splitComponent",{enumerable:true,get:function(){return _splitComponent.default}});Object.defineProperty(exports,"themed",{enumerable:true,get:function(){return _reactThemes.default}});Object.defineProperty(exports,"time",{enumerable:true,get:function(){return _time.default}});exports.webpack=void 0;exports.withRetries=withRetries;var _reactThemes=_interopRequireWildcard(require("@dr.pogodin/react-themes"));var _config=_interopRequireDefault(require("./config"));var isomorphy=_interopRequireWildcard(require("./isomorphy"));exports.isomorphy=isomorphy;var _time=_interopRequireDefault(require("./time"));var webpack=_interopRequireWildcard(require("./webpack"));exports.webpack=webpack;var _jsUtils=require("@dr.pogodin/js-utils");var _splitComponent=_interopRequireDefault(require("./splitComponent"));function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}_reactThemes.default.COMPOSE=_reactThemes.COMPOSE;_reactThemes.default.PRIORITY=_reactThemes.PRIORITY;// Note: it should be done this way, as in some environments
|
|
2
2
|
// "process" might not exist, and process.env.NODE_CONFIG_ENV
|
|
3
3
|
// not injected by Webpack.
|
|
4
|
-
let NODE_CONFIG_ENV;try{NODE_CONFIG_ENV=process.env.NODE_CONFIG_ENV}catch{/* noop */}const env=NODE_CONFIG_ENV||process.env.NODE_ENV;const JU=env!=="production"&&webpack.requireWeak("./jest",__dirname);/**
|
|
4
|
+
let NODE_CONFIG_ENV;try{NODE_CONFIG_ENV=process.env.NODE_CONFIG_ENV}catch{/* noop */}const env=NODE_CONFIG_ENV||process.env.NODE_ENV;const JU=exports.JU=env!=="production"&&webpack.requireWeak("./jest",__dirname);/**
|
|
5
5
|
* @category Utilities
|
|
6
6
|
* @global
|
|
7
7
|
* @func withRetries
|
|
@@ -35,5 +35,5 @@ let NODE_CONFIG_ENV;try{NODE_CONFIG_ENV=process.env.NODE_CONFIG_ENV}catch{/* noo
|
|
|
35
35
|
* withRetries(sampleAction).then(console.log);
|
|
36
36
|
* // It will print 'success' after one second, once the second attempt
|
|
37
37
|
* // is performed.
|
|
38
|
-
*/
|
|
38
|
+
*/async function withRetries(action,maxRetries=5,interval=1000){/* eslint-disable no-await-in-loop */for(let n=1;;++n){try{return await action()}catch(error){if(n<maxRetries)await _time.default.timer(interval);else throw error}}/* eslint-enable no-await-in-loop */}
|
|
39
39
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_reactThemes","_interopRequireWildcard","require","_config","_interopRequireDefault","isomorphy","exports","_time","webpack","_jsUtils","_splitComponent","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","themed","COMPOSE","PRIORITY","NODE_CONFIG_ENV","process","env","NODE_ENV","JU","requireWeak","__dirname","withRetries","action","maxRetries","interval","n","error","time","timer"],"sources":["../../../../src/shared/utils/index.js"],"sourcesContent":["import themed, {\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 { Barrier, Emitter, Semaphore } from '@dr.pogodin/js-utils';\n\nexport { default as splitComponent } from './splitComponent';\n\nthemed.COMPOSE = COMPOSE;\nthemed.PRIORITY = PRIORITY;\n\n// Note: it should be done this way, as in some environments\n// \"process\" might not exist, and process.env.NODE_CONFIG_ENV\n// not injected by Webpack.\nlet NODE_CONFIG_ENV;\ntry {\n NODE_CONFIG_ENV = process.env.NODE_CONFIG_ENV;\n} catch { /* noop */ }\n\nconst env = NODE_CONFIG_ENV || process.env.NODE_ENV;\nconst JU = env !== 'production' && webpack.requireWeak('./jest', __dirname);\n\n/**\n * @category Utilities\n * @global\n * @func withRetries\n * @desc\n * ```js\n * import { withRetries } from '@dr.pogodin/react-utils';\n * ```\n * Attempts to perform given asynchronous `action` up to `maxRetries` times,\n * with the given `interval` between attempts. If any attempt is successful,\n * the result is returned immediately, with no further attempts done;\n * otherwise, if all attempts fail, the result Promise rejects after the last\n * attempt.\n * @param {function} action\n * @param {number} [maxRetries=5] Optional. Maximum number of retries. Defaults\n * to 5 attempts.\n * @param {number} [interval=1000] Optional. Interval between retries [ms].\n * Defaults to 1 second.\n * @return {Promise} Resolves to the result of successful operation, or\n * rejects with the error from the latst failed attempt.\n * @example\n * import { withRetries } from '@dr.pogodin/react-utils';\n *\n * let firstCall = true;\n *\n * function sampleAction() {\n * if (!firstCall) return 'success';\n * firstCall = false;\n * throw Error('The first call to this method fails');\n * }\n *\n * withRetries(sampleAction).then(console.log);\n * // It will print 'success' after one second, once the second attempt\n * // is performed.\n */\nexport async function withRetries(action, maxRetries = 5, interval = 1000) {\n /* eslint-disable no-await-in-loop */\n for (let n = 1; ; ++n) {\n try {\n return await action();\n } catch (error) {\n if (n < maxRetries) await time.timer(interval);\n else throw error;\n }\n }\n /* eslint-enable no-await-in-loop */\n}\n\nexport {\n config,\n isomorphy,\n JU,\n themed,\n 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AAAA,IAAA,CAAAV,GAAA,EAAAU,IAAA,CAAAC,GAAA,GAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,CAAAK,GAAA,CAAAI,IAAA,OAAAT,MAAA,CAAAK,GAAA,EAAAX,GAAA,CAAAW,GAAA,IAAAL,MAAA,CAAAJ,OAAA,CAAAF,GAAA,IAAAG,KAAA,EAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,CAAAM,MAAA,SAAAA,MAAA,CAE7DW,oBAAM,CAACC,OAAO,CAAGA,oBAAO,CACxBD,oBAAM,CAACE,QAAQ,CAAGA,qBAAQ,CAE1B;AACA;AACA;AACA,GAAI,CAAAC,eAAe,CACnB,GAAI,CACFA,eAAe,CAAGC,OAAO,CAACC,GAAG,CAACF,eAChC,CAAE,KAAM,CAAE,WAEV,KAAM,CAAAE,GAAG,CAAGF,eAAe,EAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,CACnD,KAAM,CAAAC,EAAE,CAAGF,GAAG,GAAK,YAAY,EAAI9B,OAAO,CAACiC,WAAW,UAAWC,SAAS,CAAC,CAE3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["_reactThemes","_interopRequireWildcard","require","_config","_interopRequireDefault","isomorphy","exports","_time","webpack","_jsUtils","_splitComponent","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","themed","COMPOSE","PRIORITY","NODE_CONFIG_ENV","process","env","NODE_ENV","JU","requireWeak","__dirname","withRetries","action","maxRetries","interval","n","error","time","timer"],"sources":["../../../../src/shared/utils/index.js"],"sourcesContent":["import themed, {\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 { Barrier, Emitter, Semaphore } from '@dr.pogodin/js-utils';\n\nexport { default as splitComponent } from './splitComponent';\n\nthemed.COMPOSE = COMPOSE;\nthemed.PRIORITY = PRIORITY;\n\n// Note: it should be done this way, as in some environments\n// \"process\" might not exist, and process.env.NODE_CONFIG_ENV\n// not injected by Webpack.\nlet NODE_CONFIG_ENV;\ntry {\n NODE_CONFIG_ENV = process.env.NODE_CONFIG_ENV;\n} catch { /* noop */ }\n\nconst env = NODE_CONFIG_ENV || process.env.NODE_ENV;\nconst JU = env !== 'production' && webpack.requireWeak('./jest', __dirname);\n\n/**\n * @category Utilities\n * @global\n * @func withRetries\n * @desc\n * ```js\n * import { withRetries } from '@dr.pogodin/react-utils';\n * ```\n * Attempts to perform given asynchronous `action` up to `maxRetries` times,\n * with the given `interval` between attempts. If any attempt is successful,\n * the result is returned immediately, with no further attempts done;\n * otherwise, if all attempts fail, the result Promise rejects after the last\n * attempt.\n * @param {function} action\n * @param {number} [maxRetries=5] Optional. Maximum number of retries. Defaults\n * to 5 attempts.\n * @param {number} [interval=1000] Optional. Interval between retries [ms].\n * Defaults to 1 second.\n * @return {Promise} Resolves to the result of successful operation, or\n * rejects with the error from the latst failed attempt.\n * @example\n * import { withRetries } from '@dr.pogodin/react-utils';\n *\n * let firstCall = true;\n *\n * function sampleAction() {\n * if (!firstCall) return 'success';\n * firstCall = false;\n * throw Error('The first call to this method fails');\n * }\n *\n * withRetries(sampleAction).then(console.log);\n * // It will print 'success' after one second, once the second attempt\n * // is performed.\n */\nexport async function withRetries(action, maxRetries = 5, interval = 1000) {\n /* eslint-disable no-await-in-loop */\n for (let n = 1; ; ++n) {\n try {\n return await action();\n } catch (error) {\n if (n < maxRetries) await time.timer(interval);\n else throw error;\n }\n }\n /* eslint-en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AACC,KAAK,CAACJ,QAAQ,CAAC,CAAC,IAC1C,MAAM,CAAAE,KACb,CACF,CACA,oCACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.IS_SERVER_SIDE=exports.IS_CLIENT_SIDE=void 0;// Checks for client- vs. server-side environment detection.
|
|
2
2
|
/**
|
|
3
3
|
* `true` within client-side environment (browser), `false` at server-side.
|
|
4
|
-
*/const IS_CLIENT_SIDE=typeof process!=="object"||!process.versions||!process.versions.node||!!global.REACT_UTILS_FORCE_CLIENT_SIDE;/**
|
|
4
|
+
*/const IS_CLIENT_SIDE=exports.IS_CLIENT_SIDE=typeof process!=="object"||!process.versions||!process.versions.node||!!global.REACT_UTILS_FORCE_CLIENT_SIDE;/**
|
|
5
5
|
* `true` within the server-side environment (node), `false` at client-side.
|
|
6
|
-
*/
|
|
6
|
+
*/const IS_SERVER_SIDE=exports.IS_SERVER_SIDE=!IS_CLIENT_SIDE;
|
|
7
7
|
//# sourceMappingURL=environment-check.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment-check.js","names":["IS_CLIENT_SIDE","process","versions","node","global","REACT_UTILS_FORCE_CLIENT_SIDE","
|
|
1
|
+
{"version":3,"file":"environment-check.js","names":["IS_CLIENT_SIDE","exports","process","versions","node","global","REACT_UTILS_FORCE_CLIENT_SIDE","IS_SERVER_SIDE"],"sources":["../../../../../src/shared/utils/isomorphy/environment-check.js"],"sourcesContent":["// Checks for client- vs. server-side environment detection.\n\n/**\n * `true` within client-side environment (browser), `false` at server-side.\n */\nexport const IS_CLIENT_SIDE = typeof process !== 'object'\n || !process.versions || !process.versions.node\n || !!global.REACT_UTILS_FORCE_CLIENT_SIDE;\n\n/**\n * `true` within the server-side environment (node), `false` at client-side.\n */\nexport const IS_SERVER_SIDE = !IS_CLIENT_SIDE;\n"],"mappings":"2HAAA;AAEA;AACA;AACA,GACO,KAAM,CAAAA,cAAc,CAAAC,OAAA,CAAAD,cAAA,CAAG,MAAO,CAAAE,OAAO,GAAK,QAAQ,EACpD,CAACA,OAAO,CAACC,QAAQ,EAAI,CAACD,OAAO,CAACC,QAAQ,CAACC,IAAI,EAC3C,CAAC,CAACC,MAAM,CAACC,6BAA6B,CAE3C;AACA;AACA,GACO,KAAM,CAAAC,cAAc,CAAAN,OAAA,CAAAM,cAAA,CAAG,CAACP,cAAc"}
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
* `expect(RENDER_RESULT).toMatchSnapshot()`, and then returns `RENDER_RESULT`.
|
|
52
52
|
* @param {object} component ReactJS component to render.
|
|
53
53
|
* @return {object} JSON render of the component.
|
|
54
|
-
*/function snapshot(component){const res=render(component);expect(res).toMatchSnapshot();return res}const simulate=_testUtils.default.Simulate;
|
|
54
|
+
*/function snapshot(component){const res=render(component);expect(res).toMatchSnapshot();return res}const simulate=exports.simulate=_testUtils.default.Simulate;
|
|
55
55
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_mockdate","_interopRequireDefault","require","_client","_testUtils","_interopRequireWildcard","_reactTestRenderer","_shallow","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","global","IS_REACT_ACT_ENVIRONMENT","originalProcessVersions","process","versions","mockClientSide","value","unmockClientSide","writable","getMockUuid","seed","x","toString","padStart","slice","mockTimer","time","mockdate","Date","now","jest","advanceTimersByTime","mount","scene","root","res","document","createElement","body","appendChild","destroy","act","unmount","remove","createRoot","render","component","Renderer","create","toJSON","shallowRender","renderer","ShallowRenderer","getRenderOutput","shallowSnapshot","expect","toMatchSnapshot","snapshot","simulate","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_mockdate","_interopRequireDefault","require","_client","_testUtils","_interopRequireWildcard","_reactTestRenderer","_shallow","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","global","IS_REACT_ACT_ENVIRONMENT","originalProcessVersions","process","versions","mockClientSide","value","unmockClientSide","writable","getMockUuid","seed","x","toString","padStart","slice","mockTimer","time","mockdate","Date","now","jest","advanceTimersByTime","mount","scene","root","res","document","createElement","body","appendChild","destroy","act","unmount","remove","createRoot","render","component","Renderer","create","toJSON","shallowRender","renderer","ShallowRenderer","getRenderOutput","shallowSnapshot","expect","toMatchSnapshot","snapshot","simulate","exports","TU","Simulate"],"sources":["../../../../../src/shared/utils/jest/index.jsx"],"sourcesContent":["/* global expect, jest, document */\n/* eslint-disable import/no-extraneous-dependencies */\n\nimport mockdate from 'mockdate';\nimport { createRoot } from 'react-dom/client';\nimport TU, { act } from 'react-dom/test-utils';\n\n/* eslint-disable import/no-extraneous-dependencies */\nimport Renderer from 'react-test-renderer';\nimport ShallowRenderer from 'react-test-renderer/shallow';\n/* eslint-enable import/no-extraneous-dependencies */\n\n/**\n * An alias for [act(..)](https://reactjs.org/docs/test-utils.html#act)\n * from `react-dom/test-utils`.\n * @param {function} action\n */\nexport { act };\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) {\n mockdate.set(time + Date.now());\n jest.advanceTimersByTime(time);\n}\n\n/**\n * Mounts `scene` to the DOM, and returns the root scene element.\n * @param {React.ReactNode} scene\n * @return {HTMLElement} Created container DOM element with destroy() function\n * attached.\n */\nexport function mount(scene) {\n let root;\n const res = document.createElement('div');\n document.body.appendChild(res);\n res.destroy = () => {\n act(() => root.unmount());\n res.remove();\n };\n act(() => {\n root = createRoot(res);\n root.render(scene);\n });\n return res;\n}\n\n/* OLD STUFF BELOW THIS MARK */\n\n/**\n * Renders provided ReactJS component into JSON representation of the component\n * tree, using [`react-test-renderer`](https://www.npmjs.com/package/react-test-renderer).\n * @param {object} component ReactJS component to render.\n * @return {object} JSON representation of the rendered tree.\n * @example\n * import { JU } from '@dr.pogodin/react-utils';\n * console.log(JU.render(<div>Example</div>));\n */\nexport function render(component) {\n return Renderer.create(component).toJSON();\n}\n\n/**\n * Generates a shallow render of given ReactJS component, using\n * [react-test-renderer/shallow](https://reactjs.org/docs/shallow-renderer.html)\n * and returns the result.\n * @param {object} component ReactJS component to render.\n * @return {object} JSON representation of the shallow component's render tree.\n */\nexport function shallowRender(component) {\n const renderer = new ShallowRenderer();\n renderer.render(component);\n return renderer.getRenderOutput();\n}\n\n/**\n * Makes a shallow snapshot test of the given ReactJS component, and also\n * returns JSON representation of the rendered component tree. Under the hood\n * it uses {@link module:JU.shallowRender shallowRender(..)} to generate\n * the render, then executes `expect(RENDER_RESULT).toMatchSnapshot()`,\n * and finally returns the `RENDER_RESULT` to the caller.\n * @param {object} component ReactJS component to render.\n * @return {object} JSON representation of shallow render.\n */\nexport function shallowSnapshot(component) {\n const res = shallowRender(component);\n expect(res).toMatchSnapshot();\n return res;\n}\n\n/**\n * Makes snapshot test of the given ReactJS component, and also returns JSON\n * representation of the rendered component tree. Under the hood, it uses\n * {@link module:JU.render render(..)} to render it, then executes\n * `expect(RENDER_RESULT).toMatchSnapshot()`, and then returns `RENDER_RESULT`.\n * @param {object} component ReactJS component to render.\n * @return {object} JSON render of the component.\n */\nexport function snapshot(component) {\n const res = render(component);\n expect(res).toMatchSnapshot();\n return res;\n}\n\nexport const simulate = TU.Simulate;\n"],"mappings":"0iBAGA,IAAAA,SAAA,CAAAC,sBAAA,CAAAC,OAAA,cACA,IAAAC,OAAA,CAAAD,OAAA,qBACA,IAAAE,UAAA,CAAAC,uBAAA,CAAAH,OAAA,0BAGA,IAAAI,kBAAA,CAAAL,sBAAA,CAAAC,OAAA,yBACA,IAAAK,QAAA,CAAAN,sBAAA,CAAAC,OAAA,iCAA0D,SAAAM,yBAAAC,WAAA,YAAAC,OAAA,8BAAAC,iBAAA,KAAAD,OAAA,KAAAE,gBAAA,KAAAF,OAAA,QAAAF,wBAAA,SAAAA,CAAAC,WAAA,SAAAA,WAAA,CAAAG,gBAAA,CAAAD,iBAAA,GAAAF,WAAA,WAAAJ,wBAAAQ,GAAA,CAAAJ,WAAA,MAAAA,WAAA,EAAAI,GAAA,EAAAA,GAAA,CAAAC,UAAA,SAAAD,GAAA,IAAAA,GAAA,gBAAAA,GAAA,oBAAAA,GAAA,sBAAAE,OAAA,CAAAF,GAAA,MAAAG,KAAA,CAAAR,wBAAA,CAAAC,WAAA,KAAAO,KAAA,EAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,UAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,MAAAM,MAAA,QAAAC,qBAAA,CAAAC,MAAA,CAAAC,cAAA,EAAAD,MAAA,CAAAE,wBAAA,SAAAC,GAAA,IAAAX,GAAA,KAAAW,GAAA,cAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,CAAAW,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C1B,MAAO,CAAAK,QAAQ,CAACE,eAAe,CAAC,CAClC,CAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACO,QAAS,CAAAC,eAAeA,CAACR,SAAS,CAAE,CACzC,KAAM,CAAAX,GAAG,CAAGe,aAAa,CAACJ,SAAS,CAAC,CACpCS,MAAM,CAACpB,GAAG,CAAC,CAACqB,eAAe,CAAC,CAAC,CAC7B,MAAO,CAAArB,GACT,CAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACO,QAAS,CAAAsB,QAAQA,CAACX,SAAS,CAAE,CAClC,KAAM,CAAAX,GAAG,CAAGU,MAAM,CAACC,SAAS,CAAC,CAC7BS,MAAM,CAACpB,GAAG,CAAC,CAACqB,eAAe,CAAC,CAAC,CAC7B,MAAO,CAAArB,GACT,CAEO,KAAM,CAAAuB,QAAQ,CAAAC,OAAA,CAAAD,QAAA,CAAGE,kBAAE,CAACC,QAAQ"}
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
* @param {string} [options.timezoneOffset="timezoneOffset"] Optional.
|
|
36
36
|
* The global state path to store the offset. Defaults "timezoneOffset".
|
|
37
37
|
* @return {number} Timezone offset.
|
|
38
|
-
*/function useTimezoneOffset({cookieName="timezoneOffset",globalStatePath="timezoneOffset"}={}){const ssrContext=(0,_reactGlobalState.getSsrContext)(false);const[offset,setOffset]=(0,_reactGlobalState.useGlobalState)(globalStatePath,()=>{const value=cookieName&&ssrContext?.req?.cookies?.[cookieName];return value?parseInt(value,10):0});(0,_react.useEffect)(()=>{const date=new Date;const value=date.getTimezoneOffset();setOffset(value);if(cookieName){document.cookie=_cookie.default.serialize(cookieName,value,{path:"/"})}},[cookieName,setOffset]);return offset}(0,_lodash.assign)(_dayjs.default,{DAY_MS:_jsUtils.DAY_MS,HOUR_MS:_jsUtils.HOUR_MS,MIN_MS:_jsUtils.MIN_MS,SEC_MS:_jsUtils.SEC_MS,YEAR_MS:_jsUtils.YEAR_MS,now:Date.now,timer:_jsUtils.timer,useCurrent,useTimezoneOffset});var _default=
|
|
38
|
+
*/function useTimezoneOffset({cookieName="timezoneOffset",globalStatePath="timezoneOffset"}={}){const ssrContext=(0,_reactGlobalState.getSsrContext)(false);const[offset,setOffset]=(0,_reactGlobalState.useGlobalState)(globalStatePath,()=>{const value=cookieName&&ssrContext?.req?.cookies?.[cookieName];return value?parseInt(value,10):0});(0,_react.useEffect)(()=>{const date=new Date;const value=date.getTimezoneOffset();setOffset(value);if(cookieName){document.cookie=_cookie.default.serialize(cookieName,value,{path:"/"})}},[cookieName,setOffset]);return offset}(0,_lodash.assign)(_dayjs.default,{DAY_MS:_jsUtils.DAY_MS,HOUR_MS:_jsUtils.HOUR_MS,MIN_MS:_jsUtils.MIN_MS,SEC_MS:_jsUtils.SEC_MS,YEAR_MS:_jsUtils.YEAR_MS,now:Date.now,timer:_jsUtils.timer,useCurrent,useTimezoneOffset});var _default=exports.default=_dayjs.default;
|
|
39
39
|
//# sourceMappingURL=time.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time.js","names":["_cookie","_interopRequireDefault","require","_dayjs","_lodash","_react","_jsUtils","_reactGlobalState","useCurrent","autorefresh","globalStatePath","precision","dayjs","SEC_MS","now","setter","useGlobalState","Date","useEffect","timerId","update","old","neu","Math","abs","setTimeout","clearTimeout","useTimezoneOffset","cookieName","ssrContext","getSsrContext","offset","setOffset","value","req","cookies","parseInt","date","getTimezoneOffset","document","cookie","Cookie","serialize","path","assign","DAY_MS","HOUR_MS","MIN_MS","YEAR_MS","timer","_default","exports","default"],"sources":["../../../../src/shared/utils/time.js"],"sourcesContent":["/* global document */\n\nimport Cookie from 'cookie';\nimport dayjs from 'dayjs';\nimport { assign } from 'lodash';\nimport { useEffect } from 'react';\n\nimport {\n DAY_MS,\n HOUR_MS,\n MIN_MS,\n SEC_MS,\n YEAR_MS,\n timer,\n} from '@dr.pogodin/js-utils';\n\nimport { getSsrContext, useGlobalState } from '@dr.pogodin/react-global-state';\n\n/**\n * This react hook wraps Date.now() function in a SSR friendly way,\n * ensuring that all calls to useCurrent() within the same render return\n * exactly the same time (which is retrieved from Date.now() first, and\n * then stored in the global state to be reused in all other calls), which\n * is also passed and used in the first client side render, and then updated\n * with a finite precision to avoid infinite re-rendering loops.\n * @param {object} [options] Optional settings.\n * @param {string} [options.globalStatePath=\"currentTime\"] Global state path\n * to keep the current time value.\n * @param {number} [options.precision= 5 * time.SEC_MS] Current time precision.\n * The hook won't update the current time stored in the global state unless it\n * is different from Date.now() result by this number (in milliseconds).\n * Default to 5 seconds.\n * @param {boolean} [options.autorefresh=false] Set `true` to automatically\n * refresh time stored in the global state with the given `precision` (and\n * thus automatically re-rendering components dependent on this hook, or\n * the global state with the period equal to the `precision`.\n * @return {number} Unix timestamp in milliseconds.\n */\nexport function useCurrent({\n autorefresh = false,\n globalStatePath = 'currentTime',\n precision = 5 * dayjs.SEC_MS,\n} = {}) {\n const [now, setter] = useGlobalState(globalStatePath, Date.now);\n useEffect(() => {\n let timerId;\n const update = () => {\n setter((old) => {\n const neu = Date.now();\n return Math.abs(neu - old) > precision ? neu : old;\n });\n if (autorefresh) timerId = setTimeout(update, precision);\n };\n update();\n return () => {\n if (timerId) clearTimeout(timerId);\n };\n }, [autorefresh, precision, setter]);\n return now;\n}\n\n/**\n * Wraps the standard Date.getTimezoneOffset() method in a SSR-friendly way.\n * This hook retrieves the offset value at the client side and uses a cookie\n * to pass it to the server in subsequent requests from that user. At the server\n * side the value from cookie is used in renders and passed back to the client\n * via the global state. Prior to the value being known (in the very first\n * request from the user, when the cookie is still missing), zero value is used\n * as the default value.\n *\n * @param {object} [options] Optional settings.\n * @param {string} [options.cookieName=\"timezoneOffset\"] Optional. The name of\n * cookie to use to store the timezone offset. Defaults \"timezoneOffset\". Set\n * to a falsy value to forbid using cookies altogether (in that case the hook\n * will always return zero value at the server-side, and in the first render\n * at the client-side).\n * @param {string} [options.timezoneOffset=\"timezoneOffset\"] Optional.\n * The global state path to store the offset. Defaults \"timezoneOffset\".\n * @return {number} Timezone offset.\n */\nexport function useTimezoneOffset({\n cookieName = 'timezoneOffset',\n globalStatePath = 'timezoneOffset',\n} = {}) {\n const ssrContext = getSsrContext(false);\n const [offset, setOffset] = useGlobalState(globalStatePath, () => {\n const value = cookieName && ssrContext?.req?.cookies?.[cookieName];\n return value ? parseInt(value, 10) : 0;\n });\n useEffect(() => {\n const date = new Date();\n const value = date.getTimezoneOffset();\n setOffset(value);\n if (cookieName) {\n document.cookie = Cookie.serialize(cookieName, value, { path: '/' });\n }\n }, [cookieName, setOffset]);\n return offset;\n}\n\nassign(dayjs, {\n DAY_MS,\n HOUR_MS,\n MIN_MS,\n SEC_MS,\n YEAR_MS,\n now: Date.now,\n timer,\n useCurrent,\n useTimezoneOffset,\n});\n\nexport default dayjs;\n"],"mappings":"0PAEA,IAAAA,OAAA,CAAAC,sBAAA,CAAAC,OAAA,YACA,IAAAC,MAAA,CAAAF,sBAAA,CAAAC,OAAA,WACA,IAAAE,OAAA,CAAAF,OAAA,WACA,IAAAG,MAAA,CAAAH,OAAA,UAEA,IAAAI,QAAA,CAAAJ,OAAA,yBASA,IAAAK,iBAAA,CAAAL,OAAA,mCAhBA,sBAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACO,QAAS,CAAAM,UAAUA,CAAC,CACzBC,WAAW,CAAG,KAAK,CACnBC,eAAe,CAAG,aAAa,CAC/BC,SAAS,CAAG,CAAC,CAAGC,cAAK,CAACC,MACxB,CAAC,CAAG,CAAC,CAAC,CAAE,CACN,KAAM,CAACC,GAAG,CAAEC,MAAM,CAAC,CAAG,GAAAC,gCAAc,EAACN,eAAe,CAAEO,IAAI,CAACH,GAAG,CAAC,CAC/D,GAAAI,gBAAS,EAAC,IAAM,CACd,GAAI,CAAAC,OAAO,CACX,KAAM,CAAAC,MAAM,CAAGA,CAAA,GAAM,CACnBL,MAAM,CAAE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,CAACC,MAAM,CAAGC,eAAM,CAACC,SAAS,CAACd,UAAU,CAAEK,KAAK,CAAE,CAAEU,IAAI,CAAE,GAAI,CAAC,CACrE,CACF,CAAC,CAAE,CAACf,UAAU,CAAEI,SAAS,CAAC,CAAC,CAC3B,MAAO,CAAAD,MACT,CAEA,GAAAa,cAAM,EAAChC,cAAK,CAAE,CACZiC,MAAM,CAANA,eAAM,CACNC,OAAO,CAAPA,gBAAO,CACPC,MAAM,CAANA,eAAM,CACNlC,MAAM,CAANA,eAAM,CACNmC,OAAO,CAAPA,gBAAO,CACPlC,GAAG,CAAEG,IAAI,CAACH,GAAG,CACbmC,KAAK,CAALA,cAAK,CACLzC,UAAU,CACVmB,iBACF,CAAC,CAAC,CAAC,IAAAuB,QAAA,
|
|
1
|
+
{"version":3,"file":"time.js","names":["_cookie","_interopRequireDefault","require","_dayjs","_lodash","_react","_jsUtils","_reactGlobalState","useCurrent","autorefresh","globalStatePath","precision","dayjs","SEC_MS","now","setter","useGlobalState","Date","useEffect","timerId","update","old","neu","Math","abs","setTimeout","clearTimeout","useTimezoneOffset","cookieName","ssrContext","getSsrContext","offset","setOffset","value","req","cookies","parseInt","date","getTimezoneOffset","document","cookie","Cookie","serialize","path","assign","DAY_MS","HOUR_MS","MIN_MS","YEAR_MS","timer","_default","exports","default"],"sources":["../../../../src/shared/utils/time.js"],"sourcesContent":["/* global document */\n\nimport Cookie from 'cookie';\nimport dayjs from 'dayjs';\nimport { assign } from 'lodash';\nimport { useEffect } from 'react';\n\nimport {\n DAY_MS,\n HOUR_MS,\n MIN_MS,\n SEC_MS,\n YEAR_MS,\n timer,\n} from '@dr.pogodin/js-utils';\n\nimport { getSsrContext, useGlobalState } from '@dr.pogodin/react-global-state';\n\n/**\n * This react hook wraps Date.now() function in a SSR friendly way,\n * ensuring that all calls to useCurrent() within the same render return\n * exactly the same time (which is retrieved from Date.now() first, and\n * then stored in the global state to be reused in all other calls), which\n * is also passed and used in the first client side render, and then updated\n * with a finite precision to avoid infinite re-rendering loops.\n * @param {object} [options] Optional settings.\n * @param {string} [options.globalStatePath=\"currentTime\"] Global state path\n * to keep the current time value.\n * @param {number} [options.precision= 5 * time.SEC_MS] Current time precision.\n * The hook won't update the current time stored in the global state unless it\n * is different from Date.now() result by this number (in milliseconds).\n * Default to 5 seconds.\n * @param {boolean} [options.autorefresh=false] Set `true` to automatically\n * refresh time stored in the global state with the given `precision` (and\n * thus automatically re-rendering components dependent on this hook, or\n * the global state with the period equal to the `precision`.\n * @return {number} Unix timestamp in milliseconds.\n */\nexport function useCurrent({\n autorefresh = false,\n globalStatePath = 'currentTime',\n precision = 5 * dayjs.SEC_MS,\n} = {}) {\n const [now, setter] = useGlobalState(globalStatePath, Date.now);\n useEffect(() => {\n let timerId;\n const update = () => {\n setter((old) => {\n const neu = Date.now();\n return Math.abs(neu - old) > precision ? neu : old;\n });\n if (autorefresh) timerId = setTimeout(update, precision);\n };\n update();\n return () => {\n if (timerId) clearTimeout(timerId);\n };\n }, [autorefresh, precision, setter]);\n return now;\n}\n\n/**\n * Wraps the standard Date.getTimezoneOffset() method in a SSR-friendly way.\n * This hook retrieves the offset value at the client side and uses a cookie\n * to pass it to the server in subsequent requests from that user. At the server\n * side the value from cookie is used in renders and passed back to the client\n * via the global state. Prior to the value being known (in the very first\n * request from the user, when the cookie is still missing), zero value is used\n * as the default value.\n *\n * @param {object} [options] Optional settings.\n * @param {string} [options.cookieName=\"timezoneOffset\"] Optional. The name of\n * cookie to use to store the timezone offset. Defaults \"timezoneOffset\". Set\n * to a falsy value to forbid using cookies altogether (in that case the hook\n * will always return zero value at the server-side, and in the first render\n * at the client-side).\n * @param {string} [options.timezoneOffset=\"timezoneOffset\"] Optional.\n * The global state path to store the offset. Defaults \"timezoneOffset\".\n * @return {number} Timezone offset.\n */\nexport function useTimezoneOffset({\n cookieName = 'timezoneOffset',\n globalStatePath = 'timezoneOffset',\n} = {}) {\n const ssrContext = getSsrContext(false);\n const [offset, setOffset] = useGlobalState(globalStatePath, () => {\n const value = cookieName && ssrContext?.req?.cookies?.[cookieName];\n return value ? parseInt(value, 10) : 0;\n });\n useEffect(() => {\n const date = new Date();\n const value = date.getTimezoneOffset();\n setOffset(value);\n if (cookieName) {\n document.cookie = Cookie.serialize(cookieName, value, { path: '/' });\n }\n }, [cookieName, setOffset]);\n return offset;\n}\n\nassign(dayjs, {\n DAY_MS,\n HOUR_MS,\n MIN_MS,\n SEC_MS,\n YEAR_MS,\n now: Date.now,\n timer,\n useCurrent,\n useTimezoneOffset,\n});\n\nexport default dayjs;\n"],"mappings":"0PAEA,IAAAA,OAAA,CAAAC,sBAAA,CAAAC,OAAA,YACA,IAAAC,MAAA,CAAAF,sBAAA,CAAAC,OAAA,WACA,IAAAE,OAAA,CAAAF,OAAA,WACA,IAAAG,MAAA,CAAAH,OAAA,UAEA,IAAAI,QAAA,CAAAJ,OAAA,yBASA,IAAAK,iBAAA,CAAAL,OAAA,mCAhBA,sBAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACO,QAAS,CAAAM,UAAUA,CAAC,CACzBC,WAAW,CAAG,KAAK,CACnBC,eAAe,CAAG,aAAa,CAC/BC,SAAS,CAAG,CAAC,CAAGC,cAAK,CAACC,MACxB,CAAC,CAAG,CAAC,CAAC,CAAE,CACN,KAAM,CAACC,GAAG,CAAEC,MAAM,CAAC,CAAG,GAAAC,gCAAc,EAACN,eAAe,CAAEO,IAAI,CAACH,GAAG,CAAC,CAC/D,GAAAI,gBAAS,EAAC,IAAM,CACd,GAAI,CAAAC,OAAO,CACX,KAAM,CAAAC,MAAM,CAAGA,CAAA,GAAM,CACnBL,MAAM,CAAEM,GAAG,EAAK,CACd,KAAM,CAAAC,GAAG,CAAGL,IAAI,CAACH,GAAG,CAAC,CAAC,CACtB,MAAO,CAAAS,IAAI,CAACC,GAAG,CAACF,GAAG,CAAGD,GAAG,CAAC,CAAGV,SAAS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CAAC,CAC3B,MAAO,CAAAD,MACT,CAEA,GAAAa,cAAM,EAAChC,cAAK,CAAE,CACZiC,MAAM,CAANA,eAAM,CACNC,OAAO,CAAPA,gBAAO,CACPC,MAAM,CAANA,eAAM,CACNlC,MAAM,CAANA,eAAM,CACNmC,OAAO,CAAPA,gBAAO,CACPlC,GAAG,CAAEG,IAAI,CAACH,GAAG,CACbmC,KAAK,CAALA,cAAK,CACLzC,UAAU,CACVmB,iBACF,CAAC,CAAC,CAAC,IAAAuB,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEYxC,cAAK"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see web.bundle.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@dr.pogodin/js-utils"),require("@dr.pogodin/react-global-state"),require("@dr.pogodin/react-themes"),require("axios"),require("dayjs"),require("lodash"),require("node-forge/lib/aes"),require("node-forge/lib/forge"),require("prop-types"),require("qs"),require("react"),require("react-dom"),require("react-dom/client"),require("react-helmet"),require("react-router-dom")):"function"==typeof define&&define.amd?define(["@dr.pogodin/js-utils","@dr.pogodin/react-global-state","@dr.pogodin/react-themes","axios","dayjs","lodash","node-forge/lib/aes","node-forge/lib/forge","prop-types","qs","react","react-dom","react-dom/client","react-helmet","react-router-dom"],t):"object"==typeof exports?exports["@dr.pogodin/react-utils"]=t(require("@dr.pogodin/js-utils"),require("@dr.pogodin/react-global-state"),require("@dr.pogodin/react-themes"),require("axios"),require("dayjs"),require("lodash"),require("node-forge/lib/aes"),require("node-forge/lib/forge"),require("prop-types"),require("qs"),require("react"),require("react-dom"),require("react-dom/client"),require("react-helmet"),require("react-router-dom")):e["@dr.pogodin/react-utils"]=t(e["@dr.pogodin/js-utils"],e["@dr.pogodin/react-global-state"],e["@dr.pogodin/react-themes"],e.axios,e.dayjs,e.lodash,e["node-forge/lib/aes"],e["node-forge/lib/forge"],e["prop-types"],e.qs,e.react,e["react-dom"],e["react-dom/client"],e["react-helmet"],e["react-router-dom"])}("undefined"!=typeof self?self:this,(function(__WEBPACK_EXTERNAL_MODULE__269__,__WEBPACK_EXTERNAL_MODULE__899__,__WEBPACK_EXTERNAL_MODULE__198__,__WEBPACK_EXTERNAL_MODULE__300__,__WEBPACK_EXTERNAL_MODULE__760__,__WEBPACK_EXTERNAL_MODULE__467__,__WEBPACK_EXTERNAL_MODULE__0__,__WEBPACK_EXTERNAL_MODULE__654__,__WEBPACK_EXTERNAL_MODULE__99__,__WEBPACK_EXTERNAL_MODULE__656__,__WEBPACK_EXTERNAL_MODULE__156__,__WEBPACK_EXTERNAL_MODULE__111__,__WEBPACK_EXTERNAL_MODULE__715__,__WEBPACK_EXTERNAL_MODULE__383__,__WEBPACK_EXTERNAL_MODULE__128__){return function(){"use strict";var __webpack_modules__={144:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{Z:function(){return getInj}});var node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(654),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__(0),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__(971);let inj="undefined"!=typeof document&&document.querySelector('meta[itemprop="drpruinj"]');if(inj){inj.remove();const{key:key}=(0,_shared_utils_isomorphy_buildInfo__WEBPACK_IMPORTED_MODULE_2__.J)();inj=node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().util.decode64(inj.content);const d=node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().cipher.createDecipher("AES-CBC",key);d.start({iv:inj.slice(0,key.length)}),d.update(node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().util.createBuffer(inj.slice(key.length))),d.finish(),inj=node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().util.decodeUtf8(d.output.data),inj=eval(`(${inj})`)}else inj={};function getInj(){return inj}},190:function(e,t,r){r.d(t,{Z:function(){return _}});var n=r(899),o=r(715),i=r(128),a=r(144),c=r(893);function _(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=document.getElementById("react-view"),_=(0,c.jsx)(n.GlobalStateProvider,{initialState:(0,a.Z)().ISTATE,children:(0,c.jsx)(i.BrowserRouter,{children:(0,c.jsx)(e,{})})});t.dontHydrate?(0,o.createRoot)(r).render(_):(0,o.hydrateRoot)(r,_)}},971:function(e,t,r){let n;function o(){if(void 0===n)throw Error('"Build Info" has not been initialized yet');return n}r.d(t,{J:function(){return o}}),"undefined"!=typeof BUILD_INFO&&(n=BUILD_INFO)},794:function(e,t,r){r.d(t,{b:function(){return n},x:function(){return o}});const n="object"!=typeof process||!process.versions||!process.versions.node||!!r.g.REACT_UTILS_FORCE_CLIENT_SIDE,o=!n},145:function(e,t,r){r.r(t),r.d(t,{IS_CLIENT_SIDE:function(){return o.b},IS_SERVER_SIDE:function(){return o.x},buildTimestamp:function(){return c},getBuildInfo:function(){return n.J},isDevBuild:function(){return i},isProdBuild:function(){return a}});var n=r(971),o=r(794);function i(){return!1}function a(){return!0}function c(){return(0,n.J)().timestamp}},869: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__(145);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,r]=e;if(def[t])throw Error("Conflict between default and named exports");def[t]=r})),def):named}catch{return null}}function resolveWeak(e){return e}},489:function(e,t){t.parse=function(e,t){if("string"!=typeof e)throw new TypeError("argument str must be a string");for(var r={},n=(t||{}).decode||o,i=0;i<e.length;){var c=e.indexOf("=",i);if(-1===c)break;var _=e.indexOf(";",i);if(-1===_)_=e.length;else if(_<c){i=e.lastIndexOf(";",c-1)+1;continue}var l=e.slice(i,c).trim();if(void 0===r[l]){var s=e.slice(c+1,_).trim();34===s.charCodeAt(0)&&(s=s.slice(1,-1)),r[l]=a(s,n)}i=_+1}return r},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(!n.test(e))throw new TypeError("argument name is invalid");var _=c(t);if(_&&!n.test(_))throw new TypeError("argument val is invalid");var l=e+"="+_;if(null!=a.maxAge){var s=a.maxAge-0;if(isNaN(s)||!isFinite(s))throw new TypeError("option maxAge is invalid");l+="; Max-Age="+Math.floor(s)}if(a.domain){if(!n.test(a.domain))throw new TypeError("option domain is invalid");l+="; Domain="+a.domain}if(a.path){if(!n.test(a.path))throw new TypeError("option path is invalid");l+="; Path="+a.path}if(a.expires){var u=a.expires;if(!function(e){return"[object Date]"===r.call(e)||e instanceof Date}(u)||isNaN(u.valueOf()))throw new TypeError("option expires is invalid");l+="; Expires="+u.toUTCString()}if(a.httpOnly&&(l+="; HttpOnly"),a.secure&&(l+="; Secure"),a.priority)switch("string"==typeof a.priority?a.priority.toLowerCase():a.priority){case"low":l+="; Priority=Low";break;case"medium":l+="; Priority=Medium";break;case"high":l+="; 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:l+="; SameSite=Strict";break;case"lax":l+="; SameSite=Lax";break;case"strict":l+="; SameSite=Strict";break;case"none":l+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return l};var r=Object.prototype.toString,n=/^[\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}}},251:function(e,t,r){var n=r(156),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,c=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,_={key:!0,ref:!0,__self:!0,__source:!0};function l(e,t,r){var n,i={},l=null,s=null;for(n in void 0!==r&&(l=""+r),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(s=t.ref),t)a.call(t,n)&&!_.hasOwnProperty(n)&&(i[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===i[n]&&(i[n]=t[n]);return{$$typeof:o,type:e,key:l,ref:s,props:i,_owner:c.current}}t.Fragment=i,t.jsx=l,t.jsxs=l},893:function(e,t,r){e.exports=r(251)},269:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__269__},899:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__899__},198:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__198__},300:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__300__},760:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__760__},467:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__467__},0:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__0__},654:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__654__},99:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__99__},656:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__656__},156:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__156__},111:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__111__},715:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__715__},383:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__383__},128:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__128__}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](r,r.exports,__webpack_require__),r.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 r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__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 d.Barrier},BaseModal:function(){return ee},Button:function(){return j},Checkbox:function(){return I},Dropdown:function(){return X},Emitter:function(){return d.Emitter},GlobalStateProvider:function(){return p.GlobalStateProvider},Input:function(){return $},JU:function(){return C},Link:function(){return N},MetaTags:function(){return Z},Modal:function(){return re},NavLink:function(){return ne},PT:function(){return h},PageLayout:function(){return G},ScalableRect:function(){return oe},Semaphore:function(){return d.Semaphore},ThemeProvider:function(){return e.ThemeProvider},Throbber:function(){return ae},WithTooltip:function(){return he},YouTubeVideo:function(){return ve},api:function(){return S()},client:function(){return Te},config:function(){return i},getGlobalState:function(){return p.getGlobalState},getSsrContext:function(){return p.getSsrContext},isomorphy:function(){return a},server:function(){return ye},splitComponent:function(){return P},themed:function(){return t()},time:function(){return f},useAsyncCollection:function(){return p.useAsyncCollection},useAsyncData:function(){return p.useAsyncData},useGlobalState:function(){return p.useGlobalState},webpack:function(){return n},withRetries:function(){return O}});var e=__webpack_require__(198),t=__webpack_require__.n(e),r=__webpack_require__(794),n=__webpack_require__(869);const o=(r.b?__webpack_require__(144).Z().CONFIG:(0,n.requireWeak)("config"))||{};if(r.b&&"undefined"!=typeof document){const e=__webpack_require__(489);o.CSRF=e.parse(document.cookie).csrfToken}var i=o,a=__webpack_require__(145),c=__webpack_require__(489),_=__webpack_require__(760),l=__webpack_require__.n(_),s=__webpack_require__(467),u=__webpack_require__(156),d=__webpack_require__(269),p=__webpack_require__(899);(0,s.assign)(l(),{DAY_MS:d.DAY_MS,HOUR_MS:d.HOUR_MS,MIN_MS:d.MIN_MS,SEC_MS:d.SEC_MS,YEAR_MS:d.YEAR_MS,now:Date.now,timer:d.timer,useCurrent:function(){let{autorefresh:e=!1,globalStatePath:t="currentTime",precision:r=5*l().SEC_MS}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[n,o]=(0,p.useGlobalState)(t,Date.now);return(0,u.useEffect)((()=>{let t;const n=()=>{o((e=>{const t=Date.now();return Math.abs(t-e)>r?t:e})),e&&(t=setTimeout(n,r))};return n(),()=>{t&&clearTimeout(t)}}),[e,r,o]),n},useTimezoneOffset:function(){let{cookieName:e="timezoneOffset",globalStatePath:t="timezoneOffset"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const r=(0,p.getSsrContext)(!1),[n,o]=(0,p.useGlobalState)(t,(()=>{const t=e&&r?.req?.cookies?.[e];return t?parseInt(t,10):0}));return(0,u.useEffect)((()=>{const t=(new Date).getTimezoneOffset();o(t),e&&(document.cookie=c.serialize(e,t,{path:"/"}))}),[e,o]),n}});var f=l(),h=__webpack_require__(99),m=__webpack_require__.n(h),E=__webpack_require__(893);let b;a.IS_CLIENT_SIDE&&(b=__webpack_require__(144).Z().CHUNK_GROUPS||{});const g={};function w(){return(0,a.getBuildInfo)().publicPath}function v(e,t,r){let n;const o=`${w()}/${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)),n=new d.Barrier,e.addEventListener("load",n.resolve),e.addEventListener("error",n.resolve)}if(r){const e=g[o]||0;g[o]=1+e}return n}function y(e,t){if(!t[e])throw Error(`Unknown chunk name "${e}"`)}function T(e,t,r){const n=[],o=t[e],i=function(){const e=new Set,{styleSheets:t}=document;for(let r=0;r<t.length;++r){const{href:n}=t[r];n&&e.add(n)}return e}();for(let e=0;e<o.length;++e){const t=o[e];if(t.endsWith(".css")){const e=v(t,i,r);e&&n.push(e)}}return n.length?Promise.allSettled(n):Promise.resolve()}const x=new Set;function P(e){let{chunkName:t,getComponent:r,placeholder:n}=e;if(a.IS_CLIENT_SIDE&&y(t,b),x.has(t))throw Error(`Repeated splitComponent() call for the chunk "${t}"`);x.add(t);const o=(0,u.lazy)((async()=>{let e=await r();e.default&&(e=e.default),a.IS_CLIENT_SIDE&&await T(t,b,!1);const n=(0,u.forwardRef)(((r,n)=>{let{children:o,...i}=r;if(a.IS_SERVER_SIDE){const{chunkGroups:e,chunks:r}=(0,p.getSsrContext)();y(t,e),r.includes(t)||r.push(t)}return(0,u.useInsertionEffect)((()=>(T(t,b,!0),()=>function(e,t){const r=t[e];for(let e=0;e<r.length;++e){const t=r[e];if(t.endsWith(".css")){const e=`${w()}/${t}`;--g[e]<=0&&document.head.querySelector(`link[href="${e}"]`).remove()}}}(t,b))),[]),(0,E.jsx)(e,{ref:n,...i,children:o})}));return n.propTypes={children:m().node},n.defaultProps={children:void 0},{default:n}}));function i(e){let{children:t,...r}=e;return(0,E.jsx)(u.Suspense,{fallback:n,children:(0,E.jsx)(o,{...r,children:t})})}return i.propTypes={children:m().node},i.defaultProps={children:void 0},i}let k;t().COMPOSE=e.COMPOSE,t().PRIORITY=e.PRIORITY;try{k=process.env.NODE_CONFIG_ENV}catch{}const C="production"!==(k||"production")&&n.requireWeak("./jest","/");async function O(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;for(let n=1;;++n)try{return await e()}catch(e){if(!(n<t))throw e;await f.timer(r)}}var A=__webpack_require__(300),S=__webpack_require__.n(A),L=__webpack_require__(128);function q(e){let{children:t,className:r,disabled:n,enforceA:o,keepScrollPosition:i,onClick:a,onMouseDown:c,openNewTab:_,replace:l,routerLinkType:s,to:d,...p}=e;return n||o||_||d.match(/^(#|(https?|mailto):)/)?(0,E.jsx)("a",{className:(r?r+" ":"")+"zH52sA",disabled:n,href:d,onClick:n?e=>e.preventDefault():a,onMouseDown:n?e=>e.preventDefault():c,rel:"noopener noreferrer",target:_?"_blank":"",children:t}):(0,u.createElement)(s,{className:r,disabled:n,onMouseDown:c,replace:l,to:d,onClick:e=>{a&&a(e),i||window.scroll(0,0)},...p},t)}function N(e){return(0,E.jsx)(q,{...e,routerLinkType:L.Link})}function R(e){let{active:t,children:r,disabled:n,enforceA:o,onClick:i,onMouseDown:a,openNewTab:c,replace:_,theme:l,to:s}=e,u=l.button;return t&&l.active&&(u+=` ${l.active}`),n?(l.disabled&&(u+=` ${l.disabled}`),(0,E.jsx)("div",{className:u,children:r})):s?(0,E.jsx)(N,{className:u,enforceA:o,onClick:i,onMouseDown:a,openNewTab:c,replace:_,to:s,children:r}):(0,E.jsx)("div",{className:u,onClick:i,onKeyDown:i,onMouseDown:a,role:"button",tabIndex:0,children:r})}q.defaultProps={children:null,className:null,disabled:!1,enforceA:!1,keepScrollPosition:!1,onClick:null,onMouseDown:null,openNewTab:!1,replace:!1,to:""},q.propTypes={children:m().node,className:m().string,disabled:m().bool,enforceA:m().bool,keepScrollPosition:m().bool,onClick:m().func,onMouseDown:m().func,openNewTab:m().bool,replace:m().bool,routerLinkType:m().elementType.isRequired,to:m().oneOfType([m().object,m().string])};const M=t()("Button",["active","button","disabled"],{button:"E1FNQT",context:"KM0v4f",ad:"_3jm1-Q",hoc:"_0plpDL",active:"MAe9O6",disabled:"Br9IWV"})(R);R.defaultProps={active:!1,children:void 0,disabled:!1,enforceA:!1,onClick:void 0,onMouseDown:void 0,openNewTab:!1,replace:!1,to:void 0},R.propTypes={active:m().bool,children:m().node,disabled:m().bool,enforceA:m().bool,onClick:m().func,onMouseDown:m().func,openNewTab:m().bool,replace:m().bool,theme:M.themeType.isRequired,to:m().oneOfType([m().object,m().string])};var j=M;function D(e){let{checked:t,label:r,onChange:n,theme:o}=e;return(0,E.jsxs)("div",{className:o.container,children:[void 0===r?null:(0,E.jsx)("p",{className:o.label,children:r}),(0,E.jsx)("input",{checked:t,className:o.checkbox,onChange:n,type:"checkbox"})]})}const B=t()("Checkbox",["checkbox","container","label"],{checkbox:"A-f8qJ",context:"dNQcC6",ad:"earXxa",hoc:"qAPfQ6",container:"Kr0g3M",label:"_3dML-O"})(D);D.propTypes={checked:m().bool,label:m().string,onChange:m().func,theme:B.themeType.isRequired},D.defaultProps={checked:void 0,label:void 0,onChange:void 0};var I=B;function W(e){let{filter:t,label:r,onChange:n,options:o,theme:i,value:a}=e,c=!1;const _=[];for(let e=0;e<o.length;++e){const r=o[e];if(!t||t(r)){const e="string"==typeof r?r:r.value,t=void 0===r.name?e:r.name;c||=e===a,_.push((0,E.jsx)("option",{className:i.option,value:e,children:t},e))}}const l=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===r?null:(0,E.jsx)("p",{className:i.label,children:r}),(0,E.jsxs)("select",{className:i.select,onChange:n,value:a,children:[l,_]}),(0,E.jsx)("div",{className:i.arrow,children:"▼"})]})}const U=t()("Dropdown",["arrow","container","hiddenOption","label","option","select"],{arrow:"-zPK7Y",context:"haRIry",ad:"D4XHG2",hoc:"N3nd34",container:"_9CQpeA",label:"Gv0kyu",hiddenOption:"RdW3yR",select:"JXK1uw"})(W);W.propTypes={filter:m().func,label:m().string,onChange:m().func,options:m().arrayOf(m().oneOfType([m().shape({name:m().node,value:m().string.isRequired}),m().string]).isRequired),theme:U.themeType.isRequired,value:m().string},W.defaultProps={filter:void 0,label:void 0,onChange:void 0,options:[],value:""};var X=U;const K=(0,u.forwardRef)(((e,t)=>{let{label:r,theme:n,...o}=e;return(0,E.jsxs)("span",{className:n.container,children:[void 0===r?null:(0,E.jsx)("p",{className:n.label,children:r}),(0,E.jsx)("input",{className:n.input,ref:t,...o})]})})),Y=t()("Input",["container","input","label"],{container:"Cxx397",context:"X5WszA",ad:"_8s7GCr",hoc:"TVlBYc",input:"M07d4s",label:"gfbdq-"})(K);K.propTypes={label:m().string,theme:Y.themeType.isRequired},K.defaultProps={label:void 0};var $=Y;function z(e){let{children:t,leftSidePanelContent:r,rightSidePanelContent:n,theme:o}=e;return(0,E.jsxs)("div",{className:o.container,children:[(0,E.jsx)("div",{className:[o.sidePanel,o.leftSidePanel].join(" "),children:r}),(0,E.jsx)("div",{className:o.mainPanel,children:t}),(0,E.jsx)("div",{className:[o.sidePanel,o.rightSidePanel].join(" "),children:n})]})}const F=t()("PageLayout",["container","leftSidePanel","mainPanel","rightSidePanel","sidePanel"],{container:"T3cuHB",context:"m4mL-M",ad:"m3-mdC",hoc:"J15Z4H",mainPanel:"pPlQO2",sidePanel:"lqNh4h"})(z);z.propTypes={children:m().node,leftSidePanelContent:m().node,rightSidePanelContent:m().node,theme:F.themeType.isRequired},z.defaultProps={children:null,leftSidePanelContent:null,rightSidePanelContent:null};var G=F,H=__webpack_require__(383);const V=(0,u.createContext)();function Z(e){let{children:t,description:r,image:n,siteName:o,socialDescription:i,socialTitle:a,title:c,url:_}=e;const l=a||c,s=i||r,d=(0,u.useMemo)((()=>({description:r,image:n,siteName:o,socialDescription:i,socialTitle:a,title:c,url:_})),[r,n,o,i,a,c,_]);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(H.Helmet,{children:[(0,E.jsx)("title",{children:c}),(0,E.jsx)("meta",{name:"description",content:r}),(0,E.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,E.jsx)("meta",{name:"twitter:title",content:l}),(0,E.jsx)("meta",{name:"twitter:description",content:s}),n?(0,E.jsx)("meta",{name:"twitter:image",content:n}):null,o?(0,E.jsx)("meta",{name:"twitter:site",content:`@${o}`}):null,(0,E.jsx)("meta",{name:"og:title",content:l}),n?(0,E.jsx)("meta",{name:"og:image",content:n}):null,n?(0,E.jsx)("meta",{name:"og:image:alt",content:l}):null,(0,E.jsx)("meta",{name:"og:description",content:s}),o?(0,E.jsx)("meta",{name:"og:sitename",content:o}):null,_?(0,E.jsx)("meta",{name:"og:url",content:_}):null]}),t?(0,E.jsx)(V.Provider,{value:d,children:t}):null]})}Z.Context=V,Z.defaultProps={children:null,image:null,siteName:null,socialDescription:null,socialTitle:null,url:null},Z.propTypes={children:m().node,description:m().string.isRequired,image:m().string,siteName:m().string,socialDescription:m().string,socialTitle:m().string,title:m().string.isRequired,url:m().string};var J=__webpack_require__(111),Q=__webpack_require__.n(J);function ee(e){let{children:t,onCancel:r,theme:n}=e;const o=(0,u.useRef)(),i=(0,u.useRef)(),[a,c]=(0,u.useState)();(0,u.useEffect)((()=>{const e=document.createElement("div");return document.body.classList.add("scrolling-disabled-by-modal"),document.body.appendChild(e),c(e),()=>{document.body.classList.remove("scrolling-disabled-by-modal"),document.body.removeChild(e)}}),[]);const _=(0,u.useMemo)((()=>(0,E.jsx)("div",{onFocus:()=>{const e=o.current.querySelectorAll("*");for(let t=e.length-1;t>=0;--t)if(e[t].focus(),document.activeElement===e[t])return;i.current.focus()},tabIndex:"0"})),[]);return a?Q().createPortal((0,E.jsxs)(E.Fragment,{children:[_,(0,E.jsx)("div",{"aria-label":"Cancel",className:n.overlay,onClick:()=>r(),onKeyDown:e=>{"Escape"===e.key&&r()},ref:e=>{e&&e!==i.current&&(i.current=e,e.focus())},role:"button",tabIndex:"0"}),(0,E.jsx)("div",{"aria-modal":"true",className:n.container,onWheel:e=>e.stopPropagation(),ref:o,role:"dialog",children:t}),(0,E.jsx)("div",{onFocus:()=>{i.current.focus()},tabIndex:"0"}),_]}),a):null}const te=t()("Modal",["container","overlay"],{overlay:"ye2BZo",context:"Szmbbz",ad:"Ah-Nsc",hoc:"Wki41G",container:"gyZ4rc"})(ee);ee.propTypes={onCancel:m().func,children:m().node,theme:te.themeType.isRequired},ee.defaultProps={onCancel:s.noop,children:null};var re=te;function ne(e){return(0,E.jsx)(q,{...e,routerLinkType:L.NavLink})}function oe(e){let{children:t,className:r,ratio:n}=e;const o=n.split(":"),i=100*o[1]/o[0]+"%",a=(0,E.jsx)("div",{style:{paddingBottom:i},className:"EznFz3",children:(0,E.jsx)("div",{className:"_0vb7tq",children:t})});return r?(0,E.jsx)("div",{className:r,children:a}):a}function ie(e){let{theme:t}=e;return(0,E.jsxs)("span",{className:(t.container?t.container+" ":"")+"_7zdld4",children:[(0,E.jsx)("span",{className:(t.circle?t.circle+" ":"")+"dBrB4g"}),(0,E.jsx)("span",{className:(t.circle?t.circle+" ":"")+"dBrB4g"}),(0,E.jsx)("span",{className:(t.circle?t.circle+" ":"")+"dBrB4g"})]})}oe.defaultProps={children:null,className:null,ratio:"1:1"},oe.propTypes={children:m().node,className:m().string,ratio:m().string},ie.defaultProps={theme:{}},ie.propTypes={theme:m().shape({container:m().string,circle:m().string})};var ae=t()("Throbber",["circle","container"],{container:"_7zdld4",context:"uIObt7",ad:"XIxe9o",hoc:"YOyORH",circle:"dBrB4g",bouncing:"TJe-6j"})(ie);const ce={ABOVE_CURSOR:"ABOVE_CURSOR",ABOVE_ELEMENT:"ABOVE_ELEMENT",BELOW_CURSOR:"BELOW_CURSOR",BELOW_ELEMENT:"BELOW_ELEMENT"},_e=["border-bottom-color:transparent","border-left-color:transparent","border-right-color:transparent"].join(";"),le=["border-top-color:transparent","border-left-color:transparent","border-right-color:transparent"].join(";");function se(e,t,r,n,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:r,clientWidth:n}}=document;return{left:e,right:e+n,top:t,bottom:t+r}}(),c=function(e,t,r){const{arrow:n,container:o}=r;return{arrowX:.5*(o.width-n.width),arrowY:o.height,containerX:e-o.width/2,containerY:t-o.height-n.height/1.5,baseArrowStyle:_e}}(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=le);const _=`left:${c.containerX}px;top:${c.containerY}px`;o.container.setAttribute("style",_);const l=`${c.baseArrowStyle};left:${c.arrowX}px;top:${c.arrowY}px`;o.arrow.setAttribute("style",l)}const ue=(0,u.forwardRef)(((e,t)=>{let{children:r,theme:n}=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,r,n)=>{o.lastElement=n,o.lastPageX=e,o.lastPageY=t,o.lastPlacement=r,i&&se(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 r=document.createElement("div");e.content&&r.setAttribute("class",e.content);const n=document.createElement("div");return e.container&&n.setAttribute("class",e.container),n.appendChild(t),n.appendChild(r),document.body.appendChild(n),{container:n,arrow:t,content:r}}(n);return a(e),()=>{document.body.removeChild(e.container),a(null)}}),[n]),(0,u.useEffect)((()=>{i&&se(o.lastPageX,o.lastPageY,o.lastPlacement,o.lastElement,i)}),[i,o.lastPageX,o.lastPageY,o.lastPlacement,o.lastElement]),i?(0,J.createPortal)(r,i.content):null}));ue.propTypes={children:m().node,theme:m().shape().isRequired},ue.defaultProps={children:null};var de=ue;function pe(e){let{children:t,placement:r,tip:n,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)(),[_,l]=(0,u.useState)(!1);return(0,u.useEffect)((()=>{if(_&&null!==n){a.current&&a.current.pointTo(i.lastCursorX+window.scrollX,i.lastCursorY+window.scrollY,r,c.current);const e=()=>l(!1);return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)}}),[i.lastCursorX,i.lastCursorY,r,_,n]),(0,E.jsxs)("div",{className:o.wrapper,onMouseLeave:()=>l(!1),onMouseMove:e=>((e,t)=>{if(_){const n=c.current.getBoundingClientRect();e<n.left||e>n.right||t<n.top||t>n.bottom?l(!1):a.current&&a.current.pointTo(e+window.scrollX,t+window.scrollY,r,c.current)}else i.lastCursorX=e,i.lastCursorY=t,i.triggeredByTouch?i.timerId||(i.timerId=setTimeout((()=>{i.triggeredByTouch=!1,i.timerId=void 0,l(!0)}),300)):l(!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:[_&&null!==n?(0,E.jsx)(de,{ref:a,theme:o,children:n}):null,t]})}const fe=t()("WithTooltip",["appearance","arrow","container","content","wrapper"],{arrow:"M9gywF",ad:"_4xT7zE",hoc:"zd-vnH",context:"GdZucr",container:"f9gY8K",appearance:"L4ubm-",wrapper:"_4qDBRM"})(pe);fe.PLACEMENTS=ce,pe.propTypes={children:m().node,placement:m().oneOf(Object.values(ce)),theme:fe.themeType.isRequired,tip:m().node},pe.defaultProps={children:null,placement:ce.ABOVE_CURSOR,tip:null};var he=fe,me=__webpack_require__(656),Ee=__webpack_require__.n(me),be={container:"jTxmOX",context:"dzIcLh",ad:"_5a9XX1",hoc:"_7sH52O"};function ge(e){let{autoplay:t,src:r,theme:n,title:o}=e,[i,a]=r.split("?");a=a?Ee().parse(a):{};const c=a.v||i.match(/\/([a-zA-Z0-9-_]*)$/)[1];return i=`https://www.youtube.com/embed/${c}`,delete a.v,a.autoplay=t?1:0,i+=`?${Ee().stringify(a)}`,(0,E.jsxs)(oe,{className:n.container,ratio:"16:9",children:[(0,E.jsx)(ae,{theme:be}),(0,E.jsx)("iframe",{allow:"autoplay",allowFullScreen:!0,className:n.video,src:i,title:o})]})}const we=t()("YouTubeVideo",["container","video"],{container:"sXHM81",context:"veKyYi",ad:"r3ABzd",hoc:"YKcPnR",video:"SlV2zw"})(ge);ge.propTypes={autoplay:m().bool,src:m().string.isRequired,theme:we.themeType.isRequired,title:m().string},ge.defaultProps={autoplay:!1,title:""};var ve=we;const ye=n.requireWeak("./server","/"),Te=ye?void 0:__webpack_require__(190).Z}(),__webpack_exports__}()}));
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@dr.pogodin/js-utils"),require("@dr.pogodin/react-global-state"),require("@dr.pogodin/react-themes"),require("axios"),require("dayjs"),require("lodash"),require("node-forge/lib/aes"),require("node-forge/lib/forge"),require("prop-types"),require("qs"),require("react"),require("react-dom"),require("react-dom/client"),require("react-helmet"),require("react-router-dom")):"function"==typeof define&&define.amd?define(["@dr.pogodin/js-utils","@dr.pogodin/react-global-state","@dr.pogodin/react-themes","axios","dayjs","lodash","node-forge/lib/aes","node-forge/lib/forge","prop-types","qs","react","react-dom","react-dom/client","react-helmet","react-router-dom"],t):"object"==typeof exports?exports["@dr.pogodin/react-utils"]=t(require("@dr.pogodin/js-utils"),require("@dr.pogodin/react-global-state"),require("@dr.pogodin/react-themes"),require("axios"),require("dayjs"),require("lodash"),require("node-forge/lib/aes"),require("node-forge/lib/forge"),require("prop-types"),require("qs"),require("react"),require("react-dom"),require("react-dom/client"),require("react-helmet"),require("react-router-dom")):e["@dr.pogodin/react-utils"]=t(e["@dr.pogodin/js-utils"],e["@dr.pogodin/react-global-state"],e["@dr.pogodin/react-themes"],e.axios,e.dayjs,e.lodash,e["node-forge/lib/aes"],e["node-forge/lib/forge"],e["prop-types"],e.qs,e.react,e["react-dom"],e["react-dom/client"],e["react-helmet"],e["react-router-dom"])}("undefined"!=typeof self?self:this,(function(__WEBPACK_EXTERNAL_MODULE__269__,__WEBPACK_EXTERNAL_MODULE__899__,__WEBPACK_EXTERNAL_MODULE__198__,__WEBPACK_EXTERNAL_MODULE__300__,__WEBPACK_EXTERNAL_MODULE__760__,__WEBPACK_EXTERNAL_MODULE__467__,__WEBPACK_EXTERNAL_MODULE__0__,__WEBPACK_EXTERNAL_MODULE__654__,__WEBPACK_EXTERNAL_MODULE__99__,__WEBPACK_EXTERNAL_MODULE__656__,__WEBPACK_EXTERNAL_MODULE__156__,__WEBPACK_EXTERNAL_MODULE__111__,__WEBPACK_EXTERNAL_MODULE__715__,__WEBPACK_EXTERNAL_MODULE__383__,__WEBPACK_EXTERNAL_MODULE__128__){return function(){"use strict";var __webpack_modules__={144:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{Z:function(){return getInj}});var node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(654),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__(0),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__(971);let inj="undefined"!=typeof document&&document.querySelector('meta[itemprop="drpruinj"]');if(inj){inj.remove();const{key:key}=(0,_shared_utils_isomorphy_buildInfo__WEBPACK_IMPORTED_MODULE_2__.J)();inj=node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().util.decode64(inj.content);const d=node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().cipher.createDecipher("AES-CBC",key);d.start({iv:inj.slice(0,key.length)}),d.update(node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().util.createBuffer(inj.slice(key.length))),d.finish(),inj=node_forge_lib_forge__WEBPACK_IMPORTED_MODULE_0___default().util.decodeUtf8(d.output.data),inj=eval(`(${inj})`)}else inj={};function getInj(){return inj}},190:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(899),o=r(715),i=r(128),a=r(144),c=r(893);function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=document.getElementById("react-view"),l=(0,c.jsx)(n.GlobalStateProvider,{initialState:(0,a.Z)().ISTATE,children:(0,c.jsx)(i.BrowserRouter,{children:(0,c.jsx)(e,{})})});t.dontHydrate?(0,o.createRoot)(r).render(l):(0,o.hydrateRoot)(r,l)}},971:function(e,t,r){let n;function o(){if(void 0===n)throw Error('"Build Info" has not been initialized yet');return n}r.d(t,{J:function(){return o}}),"undefined"!=typeof BUILD_INFO&&(n=BUILD_INFO)},794:function(e,t,r){r.d(t,{b:function(){return n},x:function(){return o}});const n="object"!=typeof process||!process.versions||!process.versions.node||!!r.g.REACT_UTILS_FORCE_CLIENT_SIDE,o=!n},145:function(e,t,r){r.r(t),r.d(t,{IS_CLIENT_SIDE:function(){return o.b},IS_SERVER_SIDE:function(){return o.x},buildTimestamp:function(){return c},getBuildInfo:function(){return n.J},isDevBuild:function(){return i},isProdBuild:function(){return a}});var n=r(971),o=r(794);function i(){return!1}function a(){return!0}function c(){return(0,n.J)().timestamp}},869: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__(145);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,r]=e;if(def[t])throw Error("Conflict between default and named exports");def[t]=r})),def):named}catch{return null}}function resolveWeak(e){return e}},489:function(e,t){t.parse=function(e,t){if("string"!=typeof e)throw new TypeError("argument str must be a string");for(var r={},n=(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 _=e.slice(i,c).trim();if(void 0===r[_]){var s=e.slice(c+1,l).trim();34===s.charCodeAt(0)&&(s=s.slice(1,-1)),r[_]=a(s,n)}i=l+1}return r},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(!n.test(e))throw new TypeError("argument name is invalid");var l=c(t);if(l&&!n.test(l))throw new TypeError("argument val is invalid");var _=e+"="+l;if(null!=a.maxAge){var s=a.maxAge-0;if(isNaN(s)||!isFinite(s))throw new TypeError("option maxAge is invalid");_+="; Max-Age="+Math.floor(s)}if(a.domain){if(!n.test(a.domain))throw new TypeError("option domain is invalid");_+="; Domain="+a.domain}if(a.path){if(!n.test(a.path))throw new TypeError("option path is invalid");_+="; Path="+a.path}if(a.expires){var u=a.expires;if(!function(e){return"[object Date]"===r.call(e)||e instanceof Date}(u)||isNaN(u.valueOf()))throw new TypeError("option expires is invalid");_+="; Expires="+u.toUTCString()}if(a.httpOnly&&(_+="; HttpOnly"),a.secure&&(_+="; Secure"),a.priority)switch("string"==typeof a.priority?a.priority.toLowerCase():a.priority){case"low":_+="; Priority=Low";break;case"medium":_+="; Priority=Medium";break;case"high":_+="; 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:_+="; SameSite=Strict";break;case"lax":_+="; SameSite=Lax";break;case"strict":_+="; SameSite=Strict";break;case"none":_+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return _};var r=Object.prototype.toString,n=/^[\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}}},251:function(e,t,r){var n=r(156),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,c=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function _(e,t,r){var n,i={},_=null,s=null;for(n in void 0!==r&&(_=""+r),void 0!==t.key&&(_=""+t.key),void 0!==t.ref&&(s=t.ref),t)a.call(t,n)&&!l.hasOwnProperty(n)&&(i[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===i[n]&&(i[n]=t[n]);return{$$typeof:o,type:e,key:_,ref:s,props:i,_owner:c.current}}t.Fragment=i,t.jsx=_,t.jsxs=_},893:function(e,t,r){e.exports=r(251)},269:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__269__},899:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__899__},198:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__198__},300:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__300__},760:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__760__},467:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__467__},0:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__0__},654:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__654__},99:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__99__},656:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__656__},156:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__156__},111:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__111__},715:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__715__},383:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__383__},128:function(e){e.exports=__WEBPACK_EXTERNAL_MODULE__128__}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](r,r.exports,__webpack_require__),r.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 r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__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 d.Barrier},BaseModal:function(){return ee},Button:function(){return j},Checkbox:function(){return I},Dropdown:function(){return X},Emitter:function(){return d.Emitter},GlobalStateProvider:function(){return p.GlobalStateProvider},Input:function(){return $},JU:function(){return C},Link:function(){return N},MetaTags:function(){return Z},Modal:function(){return re},NavLink:function(){return ne},PT:function(){return h},PageLayout:function(){return G},ScalableRect:function(){return oe},Semaphore:function(){return d.Semaphore},ThemeProvider:function(){return e.ThemeProvider},Throbber:function(){return ae},WithTooltip:function(){return he},YouTubeVideo:function(){return ve},api:function(){return S()},client:function(){return Te},config:function(){return i},getGlobalState:function(){return p.getGlobalState},getSsrContext:function(){return p.getSsrContext},isomorphy:function(){return a},server:function(){return ye},splitComponent:function(){return P},themed:function(){return t()},time:function(){return f},useAsyncCollection:function(){return p.useAsyncCollection},useAsyncData:function(){return p.useAsyncData},useGlobalState:function(){return p.useGlobalState},webpack:function(){return n},withRetries:function(){return O}});var e=__webpack_require__(198),t=__webpack_require__.n(e),r=__webpack_require__(794),n=__webpack_require__(869);const o=(r.b?__webpack_require__(144).Z().CONFIG:(0,n.requireWeak)("config"))||{};if(r.b&&"undefined"!=typeof document){const e=__webpack_require__(489);o.CSRF=e.parse(document.cookie).csrfToken}var i=o,a=__webpack_require__(145),c=__webpack_require__(489),l=__webpack_require__(760),_=__webpack_require__.n(l),s=__webpack_require__(467),u=__webpack_require__(156),d=__webpack_require__(269),p=__webpack_require__(899);(0,s.assign)(_(),{DAY_MS:d.DAY_MS,HOUR_MS:d.HOUR_MS,MIN_MS:d.MIN_MS,SEC_MS:d.SEC_MS,YEAR_MS:d.YEAR_MS,now:Date.now,timer:d.timer,useCurrent:function(){let{autorefresh:e=!1,globalStatePath:t="currentTime",precision:r=5*_().SEC_MS}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[n,o]=(0,p.useGlobalState)(t,Date.now);return(0,u.useEffect)((()=>{let t;const n=()=>{o((e=>{const t=Date.now();return Math.abs(t-e)>r?t:e})),e&&(t=setTimeout(n,r))};return n(),()=>{t&&clearTimeout(t)}}),[e,r,o]),n},useTimezoneOffset:function(){let{cookieName:e="timezoneOffset",globalStatePath:t="timezoneOffset"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const r=(0,p.getSsrContext)(!1),[n,o]=(0,p.useGlobalState)(t,(()=>{var t;const n=e&&(null==r||null===(t=r.req)||void 0===t||null===(t=t.cookies)||void 0===t?void 0:t[e]);return n?parseInt(n,10):0}));return(0,u.useEffect)((()=>{const t=(new Date).getTimezoneOffset();o(t),e&&(document.cookie=c.serialize(e,t,{path:"/"}))}),[e,o]),n}});var f=_(),h=__webpack_require__(99),m=__webpack_require__.n(h),E=__webpack_require__(893);let b;a.IS_CLIENT_SIDE&&(b=__webpack_require__(144).Z().CHUNK_GROUPS||{});const g={};function w(){return(0,a.getBuildInfo)().publicPath}function v(e,t,r){let n;const o=`${w()}/${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)),n=new d.Barrier,e.addEventListener("load",n.resolve),e.addEventListener("error",n.resolve)}if(r){const e=g[o]||0;g[o]=1+e}return n}function y(e,t){if(!t[e])throw Error(`Unknown chunk name "${e}"`)}function T(e,t,r){const n=[],o=t[e],i=function(){const e=new Set,{styleSheets:t}=document;for(let r=0;r<t.length;++r){const{href:n}=t[r];n&&e.add(n)}return e}();for(let e=0;e<o.length;++e){const t=o[e];if(t.endsWith(".css")){const e=v(t,i,r);e&&n.push(e)}}return n.length?Promise.allSettled(n):Promise.resolve()}const x=new Set;function P(e){let{chunkName:t,getComponent:r,placeholder:n}=e;if(a.IS_CLIENT_SIDE&&y(t,b),x.has(t))throw Error(`Repeated splitComponent() call for the chunk "${t}"`);x.add(t);const o=(0,u.lazy)((async()=>{let e=await r();e.default&&(e=e.default),a.IS_CLIENT_SIDE&&await T(t,b,!1);const n=(0,u.forwardRef)(((r,n)=>{let{children:o,...i}=r;if(a.IS_SERVER_SIDE){const{chunkGroups:e,chunks:r}=(0,p.getSsrContext)();y(t,e),r.includes(t)||r.push(t)}return(0,u.useInsertionEffect)((()=>(T(t,b,!0),()=>function(e,t){const r=t[e];for(let e=0;e<r.length;++e){const t=r[e];if(t.endsWith(".css")){const e=`${w()}/${t}`;--g[e]<=0&&document.head.querySelector(`link[href="${e}"]`).remove()}}}(t,b))),[]),(0,E.jsx)(e,{ref:n,...i,children:o})}));return n.propTypes={children:m().node},n.defaultProps={children:void 0},{default:n}}));function i(e){let{children:t,...r}=e;return(0,E.jsx)(u.Suspense,{fallback:n,children:(0,E.jsx)(o,{...r,children:t})})}return i.propTypes={children:m().node},i.defaultProps={children:void 0},i}let k;t().COMPOSE=e.COMPOSE,t().PRIORITY=e.PRIORITY;try{k=process.env.NODE_CONFIG_ENV}catch{}const C="production"!==(k||"production")&&n.requireWeak("./jest","/");async function O(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;for(let n=1;;++n)try{return await e()}catch(e){if(!(n<t))throw e;await f.timer(r)}}var A=__webpack_require__(300),S=__webpack_require__.n(A),L=__webpack_require__(128);function q(e){let{children:t,className:r,disabled:n,enforceA:o,keepScrollPosition:i,onClick:a,onMouseDown:c,openNewTab:l,replace:_,routerLinkType:s,to:d,...p}=e;return n||o||l||d.match(/^(#|(https?|mailto):)/)?(0,E.jsx)("a",{className:(r?r+" ":"")+"zH52sA",disabled:n,href:d,onClick:n?e=>e.preventDefault():a,onMouseDown:n?e=>e.preventDefault():c,rel:"noopener noreferrer",target:l?"_blank":"",children:t}):(0,u.createElement)(s,{className:r,disabled:n,onMouseDown:c,replace:_,to:d,onClick:e=>{a&&a(e),i||window.scroll(0,0)},...p},t)}function N(e){return(0,E.jsx)(q,{...e,routerLinkType:L.Link})}function R(e){let{active:t,children:r,disabled:n,enforceA:o,onClick:i,onMouseDown:a,openNewTab:c,replace:l,theme:_,to:s}=e,u=_.button;return t&&_.active&&(u+=` ${_.active}`),n?(_.disabled&&(u+=` ${_.disabled}`),(0,E.jsx)("div",{className:u,children:r})):s?(0,E.jsx)(N,{className:u,enforceA:o,onClick:i,onMouseDown:a,openNewTab:c,replace:l,to:s,children:r}):(0,E.jsx)("div",{className:u,onClick:i,onKeyDown:i,onMouseDown:a,role:"button",tabIndex:0,children:r})}q.defaultProps={children:null,className:null,disabled:!1,enforceA:!1,keepScrollPosition:!1,onClick:null,onMouseDown:null,openNewTab:!1,replace:!1,to:""},q.propTypes={children:m().node,className:m().string,disabled:m().bool,enforceA:m().bool,keepScrollPosition:m().bool,onClick:m().func,onMouseDown:m().func,openNewTab:m().bool,replace:m().bool,routerLinkType:m().elementType.isRequired,to:m().oneOfType([m().object,m().string])};const M=t()("Button",["active","button","disabled"],{button:"E1FNQT",context:"KM0v4f",ad:"_3jm1-Q",hoc:"_0plpDL",active:"MAe9O6",disabled:"Br9IWV"})(R);R.defaultProps={active:!1,children:void 0,disabled:!1,enforceA:!1,onClick:void 0,onMouseDown:void 0,openNewTab:!1,replace:!1,to:void 0},R.propTypes={active:m().bool,children:m().node,disabled:m().bool,enforceA:m().bool,onClick:m().func,onMouseDown:m().func,openNewTab:m().bool,replace:m().bool,theme:M.themeType.isRequired,to:m().oneOfType([m().object,m().string])};var j=M;function D(e){let{checked:t,label:r,onChange:n,theme:o}=e;return(0,E.jsxs)("div",{className:o.container,children:[void 0===r?null:(0,E.jsx)("p",{className:o.label,children:r}),(0,E.jsx)("input",{checked:t,className:o.checkbox,onChange:n,type:"checkbox"})]})}const B=t()("Checkbox",["checkbox","container","label"],{checkbox:"A-f8qJ",context:"dNQcC6",ad:"earXxa",hoc:"qAPfQ6",container:"Kr0g3M",label:"_3dML-O"})(D);D.propTypes={checked:m().bool,label:m().string,onChange:m().func,theme:B.themeType.isRequired},D.defaultProps={checked:void 0,label:void 0,onChange:void 0};var I=B;function W(e){let{filter:t,label:r,onChange:n,options:o,theme:i,value:a}=e,c=!1;const l=[];for(let e=0;e<o.length;++e){const r=o[e];if(!t||t(r)){const e="string"==typeof r?r:r.value,t=void 0===r.name?e:r.name;c||(c=e===a),l.push((0,E.jsx)("option",{className:i.option,value:e,children:t},e))}}const _=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===r?null:(0,E.jsx)("p",{className:i.label,children:r}),(0,E.jsxs)("select",{className:i.select,onChange:n,value:a,children:[_,l]}),(0,E.jsx)("div",{className:i.arrow,children:"▼"})]})}const U=t()("Dropdown",["arrow","container","hiddenOption","label","option","select"],{arrow:"-zPK7Y",context:"haRIry",ad:"D4XHG2",hoc:"N3nd34",container:"_9CQpeA",label:"Gv0kyu",hiddenOption:"RdW3yR",select:"JXK1uw"})(W);W.propTypes={filter:m().func,label:m().string,onChange:m().func,options:m().arrayOf(m().oneOfType([m().shape({name:m().node,value:m().string.isRequired}),m().string]).isRequired),theme:U.themeType.isRequired,value:m().string},W.defaultProps={filter:void 0,label:void 0,onChange:void 0,options:[],value:""};var X=U;const K=(0,u.forwardRef)(((e,t)=>{let{label:r,theme:n,...o}=e;return(0,E.jsxs)("span",{className:n.container,children:[void 0===r?null:(0,E.jsx)("p",{className:n.label,children:r}),(0,E.jsx)("input",{className:n.input,ref:t,...o})]})})),Y=t()("Input",["container","input","label"],{container:"Cxx397",context:"X5WszA",ad:"_8s7GCr",hoc:"TVlBYc",input:"M07d4s",label:"gfbdq-"})(K);K.propTypes={label:m().string,theme:Y.themeType.isRequired},K.defaultProps={label:void 0};var $=Y;function z(e){let{children:t,leftSidePanelContent:r,rightSidePanelContent:n,theme:o}=e;return(0,E.jsxs)("div",{className:o.container,children:[(0,E.jsx)("div",{className:[o.sidePanel,o.leftSidePanel].join(" "),children:r}),(0,E.jsx)("div",{className:o.mainPanel,children:t}),(0,E.jsx)("div",{className:[o.sidePanel,o.rightSidePanel].join(" "),children:n})]})}const F=t()("PageLayout",["container","leftSidePanel","mainPanel","rightSidePanel","sidePanel"],{container:"T3cuHB",context:"m4mL-M",ad:"m3-mdC",hoc:"J15Z4H",mainPanel:"pPlQO2",sidePanel:"lqNh4h"})(z);z.propTypes={children:m().node,leftSidePanelContent:m().node,rightSidePanelContent:m().node,theme:F.themeType.isRequired},z.defaultProps={children:null,leftSidePanelContent:null,rightSidePanelContent:null};var G=F,H=__webpack_require__(383);const V=(0,u.createContext)();function Z(e){let{children:t,description:r,image:n,siteName:o,socialDescription:i,socialTitle:a,title:c,url:l}=e;const _=a||c,s=i||r,d=(0,u.useMemo)((()=>({description:r,image:n,siteName:o,socialDescription:i,socialTitle:a,title:c,url:l})),[r,n,o,i,a,c,l]);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(H.Helmet,{children:[(0,E.jsx)("title",{children:c}),(0,E.jsx)("meta",{name:"description",content:r}),(0,E.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,E.jsx)("meta",{name:"twitter:title",content:_}),(0,E.jsx)("meta",{name:"twitter:description",content:s}),n?(0,E.jsx)("meta",{name:"twitter:image",content:n}):null,o?(0,E.jsx)("meta",{name:"twitter:site",content:`@${o}`}):null,(0,E.jsx)("meta",{name:"og:title",content:_}),n?(0,E.jsx)("meta",{name:"og:image",content:n}):null,n?(0,E.jsx)("meta",{name:"og:image:alt",content:_}):null,(0,E.jsx)("meta",{name:"og:description",content:s}),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)(V.Provider,{value:d,children:t}):null]})}Z.Context=V,Z.defaultProps={children:null,image:null,siteName:null,socialDescription:null,socialTitle:null,url:null},Z.propTypes={children:m().node,description:m().string.isRequired,image:m().string,siteName:m().string,socialDescription:m().string,socialTitle:m().string,title:m().string.isRequired,url:m().string};var J=__webpack_require__(111),Q=__webpack_require__.n(J);function ee(e){let{children:t,onCancel:r,theme:n}=e;const o=(0,u.useRef)(),i=(0,u.useRef)(),[a,c]=(0,u.useState)();(0,u.useEffect)((()=>{const e=document.createElement("div");return document.body.classList.add("scrolling-disabled-by-modal"),document.body.appendChild(e),c(e),()=>{document.body.classList.remove("scrolling-disabled-by-modal"),document.body.removeChild(e)}}),[]);const l=(0,u.useMemo)((()=>(0,E.jsx)("div",{onFocus:()=>{const e=o.current.querySelectorAll("*");for(let t=e.length-1;t>=0;--t)if(e[t].focus(),document.activeElement===e[t])return;i.current.focus()},tabIndex:"0"})),[]);return a?Q().createPortal((0,E.jsxs)(E.Fragment,{children:[l,(0,E.jsx)("div",{"aria-label":"Cancel",className:n.overlay,onClick:()=>r(),onKeyDown:e=>{"Escape"===e.key&&r()},ref:e=>{e&&e!==i.current&&(i.current=e,e.focus())},role:"button",tabIndex:"0"}),(0,E.jsx)("div",{"aria-modal":"true",className:n.container,onWheel:e=>e.stopPropagation(),ref:o,role:"dialog",children:t}),(0,E.jsx)("div",{onFocus:()=>{i.current.focus()},tabIndex:"0"}),l]}),a):null}const te=t()("Modal",["container","overlay"],{overlay:"ye2BZo",context:"Szmbbz",ad:"Ah-Nsc",hoc:"Wki41G",container:"gyZ4rc"})(ee);ee.propTypes={onCancel:m().func,children:m().node,theme:te.themeType.isRequired},ee.defaultProps={onCancel:s.noop,children:null};var re=te;function ne(e){return(0,E.jsx)(q,{...e,routerLinkType:L.NavLink})}function oe(e){let{children:t,className:r,ratio:n}=e;const o=n.split(":"),i=100*o[1]/o[0]+"%",a=(0,E.jsx)("div",{style:{paddingBottom:i},className:"EznFz3",children:(0,E.jsx)("div",{className:"_0vb7tq",children:t})});return r?(0,E.jsx)("div",{className:r,children:a}):a}function ie(e){let{theme:t}=e;return(0,E.jsxs)("span",{className:(t.container?t.container+" ":"")+"_7zdld4",children:[(0,E.jsx)("span",{className:(t.circle?t.circle+" ":"")+"dBrB4g"}),(0,E.jsx)("span",{className:(t.circle?t.circle+" ":"")+"dBrB4g"}),(0,E.jsx)("span",{className:(t.circle?t.circle+" ":"")+"dBrB4g"})]})}oe.defaultProps={children:null,className:null,ratio:"1:1"},oe.propTypes={children:m().node,className:m().string,ratio:m().string},ie.defaultProps={theme:{}},ie.propTypes={theme:m().shape({container:m().string,circle:m().string})};var ae=t()("Throbber",["circle","container"],{container:"_7zdld4",context:"uIObt7",ad:"XIxe9o",hoc:"YOyORH",circle:"dBrB4g",bouncing:"TJe-6j"})(ie);const ce={ABOVE_CURSOR:"ABOVE_CURSOR",ABOVE_ELEMENT:"ABOVE_ELEMENT",BELOW_CURSOR:"BELOW_CURSOR",BELOW_ELEMENT:"BELOW_ELEMENT"},le=["border-bottom-color:transparent","border-left-color:transparent","border-right-color:transparent"].join(";"),_e=["border-top-color:transparent","border-left-color:transparent","border-right-color:transparent"].join(";");function se(e,t,r,n,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:r,clientWidth:n}}=document;return{left:e,right:e+n,top:t,bottom:t+r}}(),c=function(e,t,r){const{arrow:n,container:o}=r;return{arrowX:.5*(o.width-n.width),arrowY:o.height,containerX:e-o.width/2,containerY:t-o.height-n.height/1.5,baseArrowStyle:le}}(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=_e);const l=`left:${c.containerX}px;top:${c.containerY}px`;o.container.setAttribute("style",l);const _=`${c.baseArrowStyle};left:${c.arrowX}px;top:${c.arrowY}px`;o.arrow.setAttribute("style",_)}const ue=(0,u.forwardRef)(((e,t)=>{let{children:r,theme:n}=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,r,n)=>{o.lastElement=n,o.lastPageX=e,o.lastPageY=t,o.lastPlacement=r,i&&se(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 r=document.createElement("div");e.content&&r.setAttribute("class",e.content);const n=document.createElement("div");return e.container&&n.setAttribute("class",e.container),n.appendChild(t),n.appendChild(r),document.body.appendChild(n),{container:n,arrow:t,content:r}}(n);return a(e),()=>{document.body.removeChild(e.container),a(null)}}),[n]),(0,u.useEffect)((()=>{i&&se(o.lastPageX,o.lastPageY,o.lastPlacement,o.lastElement,i)}),[i,o.lastPageX,o.lastPageY,o.lastPlacement,o.lastElement]),i?(0,J.createPortal)(r,i.content):null}));ue.propTypes={children:m().node,theme:m().shape().isRequired},ue.defaultProps={children:null};var de=ue;function pe(e){let{children:t,placement:r,tip:n,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)(),[l,_]=(0,u.useState)(!1);return(0,u.useEffect)((()=>{if(l&&null!==n){a.current&&a.current.pointTo(i.lastCursorX+window.scrollX,i.lastCursorY+window.scrollY,r,c.current);const e=()=>_(!1);return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)}}),[i.lastCursorX,i.lastCursorY,r,l,n]),(0,E.jsxs)("div",{className:o.wrapper,onMouseLeave:()=>_(!1),onMouseMove:e=>((e,t)=>{if(l){const n=c.current.getBoundingClientRect();e<n.left||e>n.right||t<n.top||t>n.bottom?_(!1):a.current&&a.current.pointTo(e+window.scrollX,t+window.scrollY,r,c.current)}else i.lastCursorX=e,i.lastCursorY=t,i.triggeredByTouch?i.timerId||(i.timerId=setTimeout((()=>{i.triggeredByTouch=!1,i.timerId=void 0,_(!0)}),300)):_(!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!==n?(0,E.jsx)(de,{ref:a,theme:o,children:n}):null,t]})}const fe=t()("WithTooltip",["appearance","arrow","container","content","wrapper"],{arrow:"M9gywF",ad:"_4xT7zE",hoc:"zd-vnH",context:"GdZucr",container:"f9gY8K",appearance:"L4ubm-",wrapper:"_4qDBRM"})(pe);fe.PLACEMENTS=ce,pe.propTypes={children:m().node,placement:m().oneOf(Object.values(ce)),theme:fe.themeType.isRequired,tip:m().node},pe.defaultProps={children:null,placement:ce.ABOVE_CURSOR,tip:null};var he=fe,me=__webpack_require__(656),Ee=__webpack_require__.n(me),be={container:"jTxmOX",context:"dzIcLh",ad:"_5a9XX1",hoc:"_7sH52O"};function ge(e){let{autoplay:t,src:r,theme:n,title:o}=e,[i,a]=r.split("?");a=a?Ee().parse(a):{};const c=a.v||i.match(/\/([a-zA-Z0-9-_]*)$/)[1];return i=`https://www.youtube.com/embed/${c}`,delete a.v,a.autoplay=t?1:0,i+=`?${Ee().stringify(a)}`,(0,E.jsxs)(oe,{className:n.container,ratio:"16:9",children:[(0,E.jsx)(ae,{theme:be}),(0,E.jsx)("iframe",{allow:"autoplay",allowFullScreen:!0,className:n.video,src:i,title:o})]})}const we=t()("YouTubeVideo",["container","video"],{container:"sXHM81",context:"veKyYi",ad:"r3ABzd",hoc:"YKcPnR",video:"SlV2zw"})(ge);ge.propTypes={autoplay:m().bool,src:m().string.isRequired,theme:we.themeType.isRequired,title:m().string},ge.defaultProps={autoplay:!1,title:""};var ve=we;const ye=n.requireWeak("./server","/"),Te=ye?void 0:__webpack_require__(190).Z}(),__webpack_exports__}()}));
|
|
3
3
|
//# sourceMappingURL=web.bundle.js.map
|