4165 lines
No EOL
125 KiB
JavaScript
4165 lines
No EOL
125 KiB
JavaScript
exports.id = 893;
|
||
exports.ids = [893];
|
||
exports.modules = {
|
||
|
||
/***/ 282:
|
||
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
/* unused harmony export styles */
|
||
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7375);
|
||
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2122);
|
||
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9297);
|
||
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
||
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4229);
|
||
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
|
||
/* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3536);
|
||
/* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(clsx__WEBPACK_IMPORTED_MODULE_2__);
|
||
/* harmony import */ var _styles_withStyles__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(2543);
|
||
/* harmony import */ var _styles_colorManipulator__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9693);
|
||
/* harmony import */ var _ButtonBase__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(8491);
|
||
/* harmony import */ var _utils_capitalize__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(3871);
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
var styles = function styles(theme) {
|
||
return {
|
||
/* Styles applied to the root element. */
|
||
root: (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_3__/* .default */ .Z)({}, theme.typography.button, {
|
||
boxSizing: 'border-box',
|
||
minWidth: 64,
|
||
padding: '6px 16px',
|
||
borderRadius: theme.shape.borderRadius,
|
||
color: theme.palette.text.primary,
|
||
transition: theme.transitions.create(['background-color', 'box-shadow', 'border'], {
|
||
duration: theme.transitions.duration.short
|
||
}),
|
||
'&:hover': {
|
||
textDecoration: 'none',
|
||
backgroundColor: (0,_styles_colorManipulator__WEBPACK_IMPORTED_MODULE_4__/* .fade */ .U1)(theme.palette.text.primary, theme.palette.action.hoverOpacity),
|
||
// Reset on touch devices, it doesn't add specificity
|
||
'@media (hover: none)': {
|
||
backgroundColor: 'transparent'
|
||
},
|
||
'&$disabled': {
|
||
backgroundColor: 'transparent'
|
||
}
|
||
},
|
||
'&$disabled': {
|
||
color: theme.palette.action.disabled
|
||
}
|
||
}),
|
||
|
||
/* Styles applied to the span element that wraps the children. */
|
||
label: {
|
||
width: '100%',
|
||
// Ensure the correct width for iOS Safari
|
||
display: 'inherit',
|
||
alignItems: 'inherit',
|
||
justifyContent: 'inherit'
|
||
},
|
||
|
||
/* Styles applied to the root element if `variant="text"`. */
|
||
text: {
|
||
padding: '6px 8px'
|
||
},
|
||
|
||
/* Styles applied to the root element if `variant="text"` and `color="primary"`. */
|
||
textPrimary: {
|
||
color: theme.palette.primary.main,
|
||
'&:hover': {
|
||
backgroundColor: (0,_styles_colorManipulator__WEBPACK_IMPORTED_MODULE_4__/* .fade */ .U1)(theme.palette.primary.main, theme.palette.action.hoverOpacity),
|
||
// Reset on touch devices, it doesn't add specificity
|
||
'@media (hover: none)': {
|
||
backgroundColor: 'transparent'
|
||
}
|
||
}
|
||
},
|
||
|
||
/* Styles applied to the root element if `variant="text"` and `color="secondary"`. */
|
||
textSecondary: {
|
||
color: theme.palette.secondary.main,
|
||
'&:hover': {
|
||
backgroundColor: (0,_styles_colorManipulator__WEBPACK_IMPORTED_MODULE_4__/* .fade */ .U1)(theme.palette.secondary.main, theme.palette.action.hoverOpacity),
|
||
// Reset on touch devices, it doesn't add specificity
|
||
'@media (hover: none)': {
|
||
backgroundColor: 'transparent'
|
||
}
|
||
}
|
||
},
|
||
|
||
/* Styles applied to the root element if `variant="outlined"`. */
|
||
outlined: {
|
||
padding: '5px 15px',
|
||
border: "1px solid ".concat(theme.palette.type === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)'),
|
||
'&$disabled': {
|
||
border: "1px solid ".concat(theme.palette.action.disabledBackground)
|
||
}
|
||
},
|
||
|
||
/* Styles applied to the root element if `variant="outlined"` and `color="primary"`. */
|
||
outlinedPrimary: {
|
||
color: theme.palette.primary.main,
|
||
border: "1px solid ".concat((0,_styles_colorManipulator__WEBPACK_IMPORTED_MODULE_4__/* .fade */ .U1)(theme.palette.primary.main, 0.5)),
|
||
'&:hover': {
|
||
border: "1px solid ".concat(theme.palette.primary.main),
|
||
backgroundColor: (0,_styles_colorManipulator__WEBPACK_IMPORTED_MODULE_4__/* .fade */ .U1)(theme.palette.primary.main, theme.palette.action.hoverOpacity),
|
||
// Reset on touch devices, it doesn't add specificity
|
||
'@media (hover: none)': {
|
||
backgroundColor: 'transparent'
|
||
}
|
||
}
|
||
},
|
||
|
||
/* Styles applied to the root element if `variant="outlined"` and `color="secondary"`. */
|
||
outlinedSecondary: {
|
||
color: theme.palette.secondary.main,
|
||
border: "1px solid ".concat((0,_styles_colorManipulator__WEBPACK_IMPORTED_MODULE_4__/* .fade */ .U1)(theme.palette.secondary.main, 0.5)),
|
||
'&:hover': {
|
||
border: "1px solid ".concat(theme.palette.secondary.main),
|
||
backgroundColor: (0,_styles_colorManipulator__WEBPACK_IMPORTED_MODULE_4__/* .fade */ .U1)(theme.palette.secondary.main, theme.palette.action.hoverOpacity),
|
||
// Reset on touch devices, it doesn't add specificity
|
||
'@media (hover: none)': {
|
||
backgroundColor: 'transparent'
|
||
}
|
||
},
|
||
'&$disabled': {
|
||
border: "1px solid ".concat(theme.palette.action.disabled)
|
||
}
|
||
},
|
||
|
||
/* Styles applied to the root element if `variant="contained"`. */
|
||
contained: {
|
||
color: theme.palette.getContrastText(theme.palette.grey[300]),
|
||
backgroundColor: theme.palette.grey[300],
|
||
boxShadow: theme.shadows[2],
|
||
'&:hover': {
|
||
backgroundColor: theme.palette.grey.A100,
|
||
boxShadow: theme.shadows[4],
|
||
// Reset on touch devices, it doesn't add specificity
|
||
'@media (hover: none)': {
|
||
boxShadow: theme.shadows[2],
|
||
backgroundColor: theme.palette.grey[300]
|
||
},
|
||
'&$disabled': {
|
||
backgroundColor: theme.palette.action.disabledBackground
|
||
}
|
||
},
|
||
'&$focusVisible': {
|
||
boxShadow: theme.shadows[6]
|
||
},
|
||
'&:active': {
|
||
boxShadow: theme.shadows[8]
|
||
},
|
||
'&$disabled': {
|
||
color: theme.palette.action.disabled,
|
||
boxShadow: theme.shadows[0],
|
||
backgroundColor: theme.palette.action.disabledBackground
|
||
}
|
||
},
|
||
|
||
/* Styles applied to the root element if `variant="contained"` and `color="primary"`. */
|
||
containedPrimary: {
|
||
color: theme.palette.primary.contrastText,
|
||
backgroundColor: theme.palette.primary.main,
|
||
'&:hover': {
|
||
backgroundColor: theme.palette.primary.dark,
|
||
// Reset on touch devices, it doesn't add specificity
|
||
'@media (hover: none)': {
|
||
backgroundColor: theme.palette.primary.main
|
||
}
|
||
}
|
||
},
|
||
|
||
/* Styles applied to the root element if `variant="contained"` and `color="secondary"`. */
|
||
containedSecondary: {
|
||
color: theme.palette.secondary.contrastText,
|
||
backgroundColor: theme.palette.secondary.main,
|
||
'&:hover': {
|
||
backgroundColor: theme.palette.secondary.dark,
|
||
// Reset on touch devices, it doesn't add specificity
|
||
'@media (hover: none)': {
|
||
backgroundColor: theme.palette.secondary.main
|
||
}
|
||
}
|
||
},
|
||
|
||
/* Styles applied to the root element if `disableElevation={true}`. */
|
||
disableElevation: {
|
||
boxShadow: 'none',
|
||
'&:hover': {
|
||
boxShadow: 'none'
|
||
},
|
||
'&$focusVisible': {
|
||
boxShadow: 'none'
|
||
},
|
||
'&:active': {
|
||
boxShadow: 'none'
|
||
},
|
||
'&$disabled': {
|
||
boxShadow: 'none'
|
||
}
|
||
},
|
||
|
||
/* Pseudo-class applied to the ButtonBase root element if the button is keyboard focused. */
|
||
focusVisible: {},
|
||
|
||
/* Pseudo-class applied to the root element if `disabled={true}`. */
|
||
disabled: {},
|
||
|
||
/* Styles applied to the root element if `color="inherit"`. */
|
||
colorInherit: {
|
||
color: 'inherit',
|
||
borderColor: 'currentColor'
|
||
},
|
||
|
||
/* Styles applied to the root element if `size="small"` and `variant="text"`. */
|
||
textSizeSmall: {
|
||
padding: '4px 5px',
|
||
fontSize: theme.typography.pxToRem(13)
|
||
},
|
||
|
||
/* Styles applied to the root element if `size="large"` and `variant="text"`. */
|
||
textSizeLarge: {
|
||
padding: '8px 11px',
|
||
fontSize: theme.typography.pxToRem(15)
|
||
},
|
||
|
||
/* Styles applied to the root element if `size="small"` and `variant="outlined"`. */
|
||
outlinedSizeSmall: {
|
||
padding: '3px 9px',
|
||
fontSize: theme.typography.pxToRem(13)
|
||
},
|
||
|
||
/* Styles applied to the root element if `size="large"` and `variant="outlined"`. */
|
||
outlinedSizeLarge: {
|
||
padding: '7px 21px',
|
||
fontSize: theme.typography.pxToRem(15)
|
||
},
|
||
|
||
/* Styles applied to the root element if `size="small"` and `variant="contained"`. */
|
||
containedSizeSmall: {
|
||
padding: '4px 10px',
|
||
fontSize: theme.typography.pxToRem(13)
|
||
},
|
||
|
||
/* Styles applied to the root element if `size="large"` and `variant="contained"`. */
|
||
containedSizeLarge: {
|
||
padding: '8px 22px',
|
||
fontSize: theme.typography.pxToRem(15)
|
||
},
|
||
|
||
/* Styles applied to the root element if `size="small"`. */
|
||
sizeSmall: {},
|
||
|
||
/* Styles applied to the root element if `size="large"`. */
|
||
sizeLarge: {},
|
||
|
||
/* Styles applied to the root element if `fullWidth={true}`. */
|
||
fullWidth: {
|
||
width: '100%'
|
||
},
|
||
|
||
/* Styles applied to the startIcon element if supplied. */
|
||
startIcon: {
|
||
display: 'inherit',
|
||
marginRight: 8,
|
||
marginLeft: -4,
|
||
'&$iconSizeSmall': {
|
||
marginLeft: -2
|
||
}
|
||
},
|
||
|
||
/* Styles applied to the endIcon element if supplied. */
|
||
endIcon: {
|
||
display: 'inherit',
|
||
marginRight: -4,
|
||
marginLeft: 8,
|
||
'&$iconSizeSmall': {
|
||
marginRight: -2
|
||
}
|
||
},
|
||
|
||
/* Styles applied to the icon element if supplied and `size="small"`. */
|
||
iconSizeSmall: {
|
||
'& > *:first-child': {
|
||
fontSize: 18
|
||
}
|
||
},
|
||
|
||
/* Styles applied to the icon element if supplied and `size="medium"`. */
|
||
iconSizeMedium: {
|
||
'& > *:first-child': {
|
||
fontSize: 20
|
||
}
|
||
},
|
||
|
||
/* Styles applied to the icon element if supplied and `size="large"`. */
|
||
iconSizeLarge: {
|
||
'& > *:first-child': {
|
||
fontSize: 22
|
||
}
|
||
}
|
||
};
|
||
};
|
||
var Button = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(function Button(props, ref) {
|
||
var children = props.children,
|
||
classes = props.classes,
|
||
className = props.className,
|
||
_props$color = props.color,
|
||
color = _props$color === void 0 ? 'default' : _props$color,
|
||
_props$component = props.component,
|
||
component = _props$component === void 0 ? 'button' : _props$component,
|
||
_props$disabled = props.disabled,
|
||
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
||
_props$disableElevati = props.disableElevation,
|
||
disableElevation = _props$disableElevati === void 0 ? false : _props$disableElevati,
|
||
_props$disableFocusRi = props.disableFocusRipple,
|
||
disableFocusRipple = _props$disableFocusRi === void 0 ? false : _props$disableFocusRi,
|
||
endIconProp = props.endIcon,
|
||
focusVisibleClassName = props.focusVisibleClassName,
|
||
_props$fullWidth = props.fullWidth,
|
||
fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,
|
||
_props$size = props.size,
|
||
size = _props$size === void 0 ? 'medium' : _props$size,
|
||
startIconProp = props.startIcon,
|
||
_props$type = props.type,
|
||
type = _props$type === void 0 ? 'button' : _props$type,
|
||
_props$variant = props.variant,
|
||
variant = _props$variant === void 0 ? 'text' : _props$variant,
|
||
other = (0,_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_5__/* .default */ .Z)(props, ["children", "classes", "className", "color", "component", "disabled", "disableElevation", "disableFocusRipple", "endIcon", "focusVisibleClassName", "fullWidth", "size", "startIcon", "type", "variant"]);
|
||
|
||
var startIcon = startIconProp && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", {
|
||
className: clsx__WEBPACK_IMPORTED_MODULE_2___default()(classes.startIcon, classes["iconSize".concat((0,_utils_capitalize__WEBPACK_IMPORTED_MODULE_6__/* .default */ .Z)(size))])
|
||
}, startIconProp);
|
||
var endIcon = endIconProp && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", {
|
||
className: clsx__WEBPACK_IMPORTED_MODULE_2___default()(classes.endIcon, classes["iconSize".concat((0,_utils_capitalize__WEBPACK_IMPORTED_MODULE_6__/* .default */ .Z)(size))])
|
||
}, endIconProp);
|
||
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_ButtonBase__WEBPACK_IMPORTED_MODULE_7__/* .default */ .Z, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_3__/* .default */ .Z)({
|
||
className: clsx__WEBPACK_IMPORTED_MODULE_2___default()(classes.root, classes[variant], className, color === 'inherit' ? classes.colorInherit : color !== 'default' && classes["".concat(variant).concat((0,_utils_capitalize__WEBPACK_IMPORTED_MODULE_6__/* .default */ .Z)(color))], size !== 'medium' && [classes["".concat(variant, "Size").concat((0,_utils_capitalize__WEBPACK_IMPORTED_MODULE_6__/* .default */ .Z)(size))], classes["size".concat((0,_utils_capitalize__WEBPACK_IMPORTED_MODULE_6__/* .default */ .Z)(size))]], disableElevation && classes.disableElevation, disabled && classes.disabled, fullWidth && classes.fullWidth),
|
||
component: component,
|
||
disabled: disabled,
|
||
focusRipple: !disableFocusRipple,
|
||
focusVisibleClassName: clsx__WEBPACK_IMPORTED_MODULE_2___default()(classes.focusVisible, focusVisibleClassName),
|
||
ref: ref,
|
||
type: type
|
||
}, other), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", {
|
||
className: classes.label
|
||
}, startIcon, children, endIcon));
|
||
});
|
||
false ? 0 : void 0;
|
||
/* harmony default export */ __webpack_exports__["Z"] = ((0,_styles_withStyles__WEBPACK_IMPORTED_MODULE_8__/* .default */ .Z)(styles, {
|
||
name: 'MuiButton'
|
||
})(Button));
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8491:
|
||
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
// EXPORTS
|
||
__webpack_require__.d(__webpack_exports__, {
|
||
"Z": function() { return /* binding */ ButtonBase_ButtonBase; }
|
||
});
|
||
|
||
// UNUSED EXPORTS: styles
|
||
|
||
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
||
var esm_extends = __webpack_require__(2122);
|
||
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js + 1 modules
|
||
var objectWithoutProperties = __webpack_require__(7375);
|
||
// EXTERNAL MODULE: external "react"
|
||
var external_react_ = __webpack_require__(9297);
|
||
// EXTERNAL MODULE: external "prop-types"
|
||
var external_prop_types_ = __webpack_require__(4229);
|
||
// EXTERNAL MODULE: external "react-dom"
|
||
var external_react_dom_ = __webpack_require__(2268);
|
||
// EXTERNAL MODULE: external "clsx"
|
||
var external_clsx_ = __webpack_require__(3536);
|
||
var external_clsx_default = /*#__PURE__*/__webpack_require__.n(external_clsx_);
|
||
// EXTERNAL MODULE: external "@material-ui/utils"
|
||
var utils_ = __webpack_require__(2958);
|
||
;// CONCATENATED MODULE: ./node_modules/@material-ui/core/esm/utils/setRef.js
|
||
// TODO v5: consider to make it private
|
||
function setRef(ref, value) {
|
||
if (typeof ref === 'function') {
|
||
ref(value);
|
||
} else if (ref) {
|
||
ref.current = value;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/@material-ui/core/esm/utils/useForkRef.js
|
||
|
||
|
||
function useForkRef(refA, refB) {
|
||
/**
|
||
* This will create a new function if the ref props change and are defined.
|
||
* This means react will call the old forkRef with `null` and the new forkRef
|
||
* with the ref. Cleanup naturally emerges from this behavior
|
||
*/
|
||
return external_react_.useMemo(function () {
|
||
if (refA == null && refB == null) {
|
||
return null;
|
||
}
|
||
|
||
return function (refValue) {
|
||
setRef(refA, refValue);
|
||
setRef(refB, refValue);
|
||
};
|
||
}, [refA, refB]);
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/@material-ui/core/esm/utils/useEventCallback.js
|
||
|
||
var useEnhancedEffect = typeof window !== 'undefined' ? external_react_.useLayoutEffect : external_react_.useEffect;
|
||
/**
|
||
* https://github.com/facebook/react/issues/14099#issuecomment-440013892
|
||
*
|
||
* @param {function} fn
|
||
*/
|
||
|
||
function useEventCallback(fn) {
|
||
var ref = external_react_.useRef(fn);
|
||
useEnhancedEffect(function () {
|
||
ref.current = fn;
|
||
});
|
||
return external_react_.useCallback(function () {
|
||
return (0, ref.current).apply(void 0, arguments);
|
||
}, []);
|
||
}
|
||
// EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/styles/withStyles.js
|
||
var withStyles = __webpack_require__(2543);
|
||
;// CONCATENATED MODULE: ./node_modules/@material-ui/core/esm/utils/useIsFocusVisible.js
|
||
// based on https://github.com/WICG/focus-visible/blob/v4.1.5/src/focus-visible.js
|
||
|
||
|
||
var hadKeyboardEvent = true;
|
||
var hadFocusVisibleRecently = false;
|
||
var hadFocusVisibleRecentlyTimeout = null;
|
||
var inputTypesWhitelist = {
|
||
text: true,
|
||
search: true,
|
||
url: true,
|
||
tel: true,
|
||
email: true,
|
||
password: true,
|
||
number: true,
|
||
date: true,
|
||
month: true,
|
||
week: true,
|
||
time: true,
|
||
datetime: true,
|
||
'datetime-local': true
|
||
};
|
||
/**
|
||
* Computes whether the given element should automatically trigger the
|
||
* `focus-visible` class being added, i.e. whether it should always match
|
||
* `:focus-visible` when focused.
|
||
* @param {Element} node
|
||
* @return {boolean}
|
||
*/
|
||
|
||
function focusTriggersKeyboardModality(node) {
|
||
var type = node.type,
|
||
tagName = node.tagName;
|
||
|
||
if (tagName === 'INPUT' && inputTypesWhitelist[type] && !node.readOnly) {
|
||
return true;
|
||
}
|
||
|
||
if (tagName === 'TEXTAREA' && !node.readOnly) {
|
||
return true;
|
||
}
|
||
|
||
if (node.isContentEditable) {
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
}
|
||
/**
|
||
* Keep track of our keyboard modality state with `hadKeyboardEvent`.
|
||
* If the most recent user interaction was via the keyboard;
|
||
* and the key press did not include a meta, alt/option, or control key;
|
||
* then the modality is keyboard. Otherwise, the modality is not keyboard.
|
||
* @param {KeyboardEvent} event
|
||
*/
|
||
|
||
|
||
function handleKeyDown(event) {
|
||
if (event.metaKey || event.altKey || event.ctrlKey) {
|
||
return;
|
||
}
|
||
|
||
hadKeyboardEvent = true;
|
||
}
|
||
/**
|
||
* If at any point a user clicks with a pointing device, ensure that we change
|
||
* the modality away from keyboard.
|
||
* This avoids the situation where a user presses a key on an already focused
|
||
* element, and then clicks on a different element, focusing it with a
|
||
* pointing device, while we still think we're in keyboard modality.
|
||
*/
|
||
|
||
|
||
function handlePointerDown() {
|
||
hadKeyboardEvent = false;
|
||
}
|
||
|
||
function handleVisibilityChange() {
|
||
if (this.visibilityState === 'hidden') {
|
||
// If the tab becomes active again, the browser will handle calling focus
|
||
// on the element (Safari actually calls it twice).
|
||
// If this tab change caused a blur on an element with focus-visible,
|
||
// re-apply the class when the user switches back to the tab.
|
||
if (hadFocusVisibleRecently) {
|
||
hadKeyboardEvent = true;
|
||
}
|
||
}
|
||
}
|
||
|
||
function prepare(doc) {
|
||
doc.addEventListener('keydown', handleKeyDown, true);
|
||
doc.addEventListener('mousedown', handlePointerDown, true);
|
||
doc.addEventListener('pointerdown', handlePointerDown, true);
|
||
doc.addEventListener('touchstart', handlePointerDown, true);
|
||
doc.addEventListener('visibilitychange', handleVisibilityChange, true);
|
||
}
|
||
|
||
function teardown(doc) {
|
||
doc.removeEventListener('keydown', handleKeyDown, true);
|
||
doc.removeEventListener('mousedown', handlePointerDown, true);
|
||
doc.removeEventListener('pointerdown', handlePointerDown, true);
|
||
doc.removeEventListener('touchstart', handlePointerDown, true);
|
||
doc.removeEventListener('visibilitychange', handleVisibilityChange, true);
|
||
}
|
||
|
||
function isFocusVisible(event) {
|
||
var target = event.target;
|
||
|
||
try {
|
||
return target.matches(':focus-visible');
|
||
} catch (error) {} // browsers not implementing :focus-visible will throw a SyntaxError
|
||
// we use our own heuristic for those browsers
|
||
// rethrow might be better if it's not the expected error but do we really
|
||
// want to crash if focus-visible malfunctioned?
|
||
// no need for validFocusTarget check. the user does that by attaching it to
|
||
// focusable events only
|
||
|
||
|
||
return hadKeyboardEvent || focusTriggersKeyboardModality(target);
|
||
}
|
||
/**
|
||
* Should be called if a blur event is fired on a focus-visible element
|
||
*/
|
||
|
||
|
||
function handleBlurVisible() {
|
||
// To detect a tab/window switch, we look for a blur event followed
|
||
// rapidly by a visibility change.
|
||
// If we don't see a visibility change within 100ms, it's probably a
|
||
// regular focus change.
|
||
hadFocusVisibleRecently = true;
|
||
window.clearTimeout(hadFocusVisibleRecentlyTimeout);
|
||
hadFocusVisibleRecentlyTimeout = window.setTimeout(function () {
|
||
hadFocusVisibleRecently = false;
|
||
}, 100);
|
||
}
|
||
|
||
function useIsFocusVisible() {
|
||
var ref = external_react_.useCallback(function (instance) {
|
||
var node = external_react_dom_.findDOMNode(instance);
|
||
|
||
if (node != null) {
|
||
prepare(node.ownerDocument);
|
||
}
|
||
}, []);
|
||
|
||
if (false) {}
|
||
|
||
return {
|
||
isFocusVisible: isFocusVisible,
|
||
onBlurVisible: handleBlurVisible,
|
||
ref: ref
|
||
};
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
|
||
function _arrayLikeToArray(arr, len) {
|
||
if (len == null || len > arr.length) len = arr.length;
|
||
|
||
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
||
arr2[i] = arr[i];
|
||
}
|
||
|
||
return arr2;
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
|
||
|
||
function _arrayWithoutHoles(arr) {
|
||
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
|
||
function _iterableToArray(iter) {
|
||
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
|
||
|
||
function _unsupportedIterableToArray(o, minLen) {
|
||
if (!o) return;
|
||
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
||
var n = Object.prototype.toString.call(o).slice(8, -1);
|
||
if (n === "Object" && o.constructor) n = o.constructor.name;
|
||
if (n === "Map" || n === "Set") return Array.from(o);
|
||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
|
||
function _nonIterableSpread() {
|
||
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
|
||
|
||
|
||
|
||
|
||
function _toConsumableArray(arr) {
|
||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
||
}
|
||
// EXTERNAL MODULE: external "react-transition-group"
|
||
var external_react_transition_group_ = __webpack_require__(3810);
|
||
;// CONCATENATED MODULE: ./node_modules/@material-ui/core/esm/ButtonBase/Ripple.js
|
||
|
||
|
||
|
||
|
||
var Ripple_useEnhancedEffect = typeof window === 'undefined' ? external_react_.useEffect : external_react_.useLayoutEffect;
|
||
/**
|
||
* @ignore - internal component.
|
||
*/
|
||
|
||
function Ripple(props) {
|
||
var classes = props.classes,
|
||
_props$pulsate = props.pulsate,
|
||
pulsate = _props$pulsate === void 0 ? false : _props$pulsate,
|
||
rippleX = props.rippleX,
|
||
rippleY = props.rippleY,
|
||
rippleSize = props.rippleSize,
|
||
inProp = props.in,
|
||
_props$onExited = props.onExited,
|
||
onExited = _props$onExited === void 0 ? function () {} : _props$onExited,
|
||
timeout = props.timeout;
|
||
|
||
var _React$useState = external_react_.useState(false),
|
||
leaving = _React$useState[0],
|
||
setLeaving = _React$useState[1];
|
||
|
||
var rippleClassName = external_clsx_default()(classes.ripple, classes.rippleVisible, pulsate && classes.ripplePulsate);
|
||
var rippleStyles = {
|
||
width: rippleSize,
|
||
height: rippleSize,
|
||
top: -(rippleSize / 2) + rippleY,
|
||
left: -(rippleSize / 2) + rippleX
|
||
};
|
||
var childClassName = external_clsx_default()(classes.child, leaving && classes.childLeaving, pulsate && classes.childPulsate);
|
||
var handleExited = useEventCallback(onExited); // Ripple is used for user feedback (e.g. click or press) so we want to apply styles with the highest priority
|
||
|
||
Ripple_useEnhancedEffect(function () {
|
||
if (!inProp) {
|
||
// react-transition-group#onExit
|
||
setLeaving(true); // react-transition-group#onExited
|
||
|
||
var timeoutId = setTimeout(handleExited, timeout);
|
||
return function () {
|
||
clearTimeout(timeoutId);
|
||
};
|
||
}
|
||
|
||
return undefined;
|
||
}, [handleExited, inProp, timeout]);
|
||
return /*#__PURE__*/external_react_.createElement("span", {
|
||
className: rippleClassName,
|
||
style: rippleStyles
|
||
}, /*#__PURE__*/external_react_.createElement("span", {
|
||
className: childClassName
|
||
}));
|
||
}
|
||
|
||
false ? 0 : void 0;
|
||
/* harmony default export */ var ButtonBase_Ripple = (Ripple);
|
||
;// CONCATENATED MODULE: ./node_modules/@material-ui/core/esm/ButtonBase/TouchRipple.js
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
var DURATION = 550;
|
||
var DELAY_RIPPLE = 80;
|
||
var styles = function styles(theme) {
|
||
return {
|
||
/* Styles applied to the root element. */
|
||
root: {
|
||
overflow: 'hidden',
|
||
pointerEvents: 'none',
|
||
position: 'absolute',
|
||
zIndex: 0,
|
||
top: 0,
|
||
right: 0,
|
||
bottom: 0,
|
||
left: 0,
|
||
borderRadius: 'inherit'
|
||
},
|
||
|
||
/* Styles applied to the internal `Ripple` components `ripple` class. */
|
||
ripple: {
|
||
opacity: 0,
|
||
position: 'absolute'
|
||
},
|
||
|
||
/* Styles applied to the internal `Ripple` components `rippleVisible` class. */
|
||
rippleVisible: {
|
||
opacity: 0.3,
|
||
transform: 'scale(1)',
|
||
animation: "$enter ".concat(DURATION, "ms ").concat(theme.transitions.easing.easeInOut)
|
||
},
|
||
|
||
/* Styles applied to the internal `Ripple` components `ripplePulsate` class. */
|
||
ripplePulsate: {
|
||
animationDuration: "".concat(theme.transitions.duration.shorter, "ms")
|
||
},
|
||
|
||
/* Styles applied to the internal `Ripple` components `child` class. */
|
||
child: {
|
||
opacity: 1,
|
||
display: 'block',
|
||
width: '100%',
|
||
height: '100%',
|
||
borderRadius: '50%',
|
||
backgroundColor: 'currentColor'
|
||
},
|
||
|
||
/* Styles applied to the internal `Ripple` components `childLeaving` class. */
|
||
childLeaving: {
|
||
opacity: 0,
|
||
animation: "$exit ".concat(DURATION, "ms ").concat(theme.transitions.easing.easeInOut)
|
||
},
|
||
|
||
/* Styles applied to the internal `Ripple` components `childPulsate` class. */
|
||
childPulsate: {
|
||
position: 'absolute',
|
||
left: 0,
|
||
top: 0,
|
||
animation: "$pulsate 2500ms ".concat(theme.transitions.easing.easeInOut, " 200ms infinite")
|
||
},
|
||
'@keyframes enter': {
|
||
'0%': {
|
||
transform: 'scale(0)',
|
||
opacity: 0.1
|
||
},
|
||
'100%': {
|
||
transform: 'scale(1)',
|
||
opacity: 0.3
|
||
}
|
||
},
|
||
'@keyframes exit': {
|
||
'0%': {
|
||
opacity: 1
|
||
},
|
||
'100%': {
|
||
opacity: 0
|
||
}
|
||
},
|
||
'@keyframes pulsate': {
|
||
'0%': {
|
||
transform: 'scale(1)'
|
||
},
|
||
'50%': {
|
||
transform: 'scale(0.92)'
|
||
},
|
||
'100%': {
|
||
transform: 'scale(1)'
|
||
}
|
||
}
|
||
};
|
||
};
|
||
/**
|
||
* @ignore - internal component.
|
||
*
|
||
* TODO v5: Make private
|
||
*/
|
||
|
||
var TouchRipple = /*#__PURE__*/external_react_.forwardRef(function TouchRipple(props, ref) {
|
||
var _props$center = props.center,
|
||
centerProp = _props$center === void 0 ? false : _props$center,
|
||
classes = props.classes,
|
||
className = props.className,
|
||
other = (0,objectWithoutProperties/* default */.Z)(props, ["center", "classes", "className"]);
|
||
|
||
var _React$useState = external_react_.useState([]),
|
||
ripples = _React$useState[0],
|
||
setRipples = _React$useState[1];
|
||
|
||
var nextKey = external_react_.useRef(0);
|
||
var rippleCallback = external_react_.useRef(null);
|
||
external_react_.useEffect(function () {
|
||
if (rippleCallback.current) {
|
||
rippleCallback.current();
|
||
rippleCallback.current = null;
|
||
}
|
||
}, [ripples]); // Used to filter out mouse emulated events on mobile.
|
||
|
||
var ignoringMouseDown = external_react_.useRef(false); // We use a timer in order to only show the ripples for touch "click" like events.
|
||
// We don't want to display the ripple for touch scroll events.
|
||
|
||
var startTimer = external_react_.useRef(null); // This is the hook called once the previous timeout is ready.
|
||
|
||
var startTimerCommit = external_react_.useRef(null);
|
||
var container = external_react_.useRef(null);
|
||
external_react_.useEffect(function () {
|
||
return function () {
|
||
clearTimeout(startTimer.current);
|
||
};
|
||
}, []);
|
||
var startCommit = external_react_.useCallback(function (params) {
|
||
var pulsate = params.pulsate,
|
||
rippleX = params.rippleX,
|
||
rippleY = params.rippleY,
|
||
rippleSize = params.rippleSize,
|
||
cb = params.cb;
|
||
setRipples(function (oldRipples) {
|
||
return [].concat(_toConsumableArray(oldRipples), [/*#__PURE__*/external_react_.createElement(ButtonBase_Ripple, {
|
||
key: nextKey.current,
|
||
classes: classes,
|
||
timeout: DURATION,
|
||
pulsate: pulsate,
|
||
rippleX: rippleX,
|
||
rippleY: rippleY,
|
||
rippleSize: rippleSize
|
||
})]);
|
||
});
|
||
nextKey.current += 1;
|
||
rippleCallback.current = cb;
|
||
}, [classes]);
|
||
var start = external_react_.useCallback(function () {
|
||
var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||
var cb = arguments.length > 2 ? arguments[2] : undefined;
|
||
var _options$pulsate = options.pulsate,
|
||
pulsate = _options$pulsate === void 0 ? false : _options$pulsate,
|
||
_options$center = options.center,
|
||
center = _options$center === void 0 ? centerProp || options.pulsate : _options$center,
|
||
_options$fakeElement = options.fakeElement,
|
||
fakeElement = _options$fakeElement === void 0 ? false : _options$fakeElement;
|
||
|
||
if (event.type === 'mousedown' && ignoringMouseDown.current) {
|
||
ignoringMouseDown.current = false;
|
||
return;
|
||
}
|
||
|
||
if (event.type === 'touchstart') {
|
||
ignoringMouseDown.current = true;
|
||
}
|
||
|
||
var element = fakeElement ? null : container.current;
|
||
var rect = element ? element.getBoundingClientRect() : {
|
||
width: 0,
|
||
height: 0,
|
||
left: 0,
|
||
top: 0
|
||
}; // Get the size of the ripple
|
||
|
||
var rippleX;
|
||
var rippleY;
|
||
var rippleSize;
|
||
|
||
if (center || event.clientX === 0 && event.clientY === 0 || !event.clientX && !event.touches) {
|
||
rippleX = Math.round(rect.width / 2);
|
||
rippleY = Math.round(rect.height / 2);
|
||
} else {
|
||
var _ref = event.touches ? event.touches[0] : event,
|
||
clientX = _ref.clientX,
|
||
clientY = _ref.clientY;
|
||
|
||
rippleX = Math.round(clientX - rect.left);
|
||
rippleY = Math.round(clientY - rect.top);
|
||
}
|
||
|
||
if (center) {
|
||
rippleSize = Math.sqrt((2 * Math.pow(rect.width, 2) + Math.pow(rect.height, 2)) / 3); // For some reason the animation is broken on Mobile Chrome if the size if even.
|
||
|
||
if (rippleSize % 2 === 0) {
|
||
rippleSize += 1;
|
||
}
|
||
} else {
|
||
var sizeX = Math.max(Math.abs((element ? element.clientWidth : 0) - rippleX), rippleX) * 2 + 2;
|
||
var sizeY = Math.max(Math.abs((element ? element.clientHeight : 0) - rippleY), rippleY) * 2 + 2;
|
||
rippleSize = Math.sqrt(Math.pow(sizeX, 2) + Math.pow(sizeY, 2));
|
||
} // Touche devices
|
||
|
||
|
||
if (event.touches) {
|
||
// check that this isn't another touchstart due to multitouch
|
||
// otherwise we will only clear a single timer when unmounting while two
|
||
// are running
|
||
if (startTimerCommit.current === null) {
|
||
// Prepare the ripple effect.
|
||
startTimerCommit.current = function () {
|
||
startCommit({
|
||
pulsate: pulsate,
|
||
rippleX: rippleX,
|
||
rippleY: rippleY,
|
||
rippleSize: rippleSize,
|
||
cb: cb
|
||
});
|
||
}; // Delay the execution of the ripple effect.
|
||
|
||
|
||
startTimer.current = setTimeout(function () {
|
||
if (startTimerCommit.current) {
|
||
startTimerCommit.current();
|
||
startTimerCommit.current = null;
|
||
}
|
||
}, DELAY_RIPPLE); // We have to make a tradeoff with this value.
|
||
}
|
||
} else {
|
||
startCommit({
|
||
pulsate: pulsate,
|
||
rippleX: rippleX,
|
||
rippleY: rippleY,
|
||
rippleSize: rippleSize,
|
||
cb: cb
|
||
});
|
||
}
|
||
}, [centerProp, startCommit]);
|
||
var pulsate = external_react_.useCallback(function () {
|
||
start({}, {
|
||
pulsate: true
|
||
});
|
||
}, [start]);
|
||
var stop = external_react_.useCallback(function (event, cb) {
|
||
clearTimeout(startTimer.current); // The touch interaction occurs too quickly.
|
||
// We still want to show ripple effect.
|
||
|
||
if (event.type === 'touchend' && startTimerCommit.current) {
|
||
event.persist();
|
||
startTimerCommit.current();
|
||
startTimerCommit.current = null;
|
||
startTimer.current = setTimeout(function () {
|
||
stop(event, cb);
|
||
});
|
||
return;
|
||
}
|
||
|
||
startTimerCommit.current = null;
|
||
setRipples(function (oldRipples) {
|
||
if (oldRipples.length > 0) {
|
||
return oldRipples.slice(1);
|
||
}
|
||
|
||
return oldRipples;
|
||
});
|
||
rippleCallback.current = cb;
|
||
}, []);
|
||
external_react_.useImperativeHandle(ref, function () {
|
||
return {
|
||
pulsate: pulsate,
|
||
start: start,
|
||
stop: stop
|
||
};
|
||
}, [pulsate, start, stop]);
|
||
return /*#__PURE__*/external_react_.createElement("span", (0,esm_extends/* default */.Z)({
|
||
className: external_clsx_default()(classes.root, className),
|
||
ref: container
|
||
}, other), /*#__PURE__*/external_react_.createElement(external_react_transition_group_.TransitionGroup, {
|
||
component: null,
|
||
exit: true
|
||
}, ripples));
|
||
});
|
||
false ? 0 : void 0;
|
||
/* harmony default export */ var ButtonBase_TouchRipple = ((0,withStyles/* default */.Z)(styles, {
|
||
flip: false,
|
||
name: 'MuiTouchRipple'
|
||
})( /*#__PURE__*/external_react_.memo(TouchRipple)));
|
||
;// CONCATENATED MODULE: ./node_modules/@material-ui/core/esm/ButtonBase/ButtonBase.js
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
var ButtonBase_styles = {
|
||
/* Styles applied to the root element. */
|
||
root: {
|
||
display: 'inline-flex',
|
||
alignItems: 'center',
|
||
justifyContent: 'center',
|
||
position: 'relative',
|
||
WebkitTapHighlightColor: 'transparent',
|
||
backgroundColor: 'transparent',
|
||
// Reset default value
|
||
// We disable the focus ring for mouse, touch and keyboard users.
|
||
outline: 0,
|
||
border: 0,
|
||
margin: 0,
|
||
// Remove the margin in Safari
|
||
borderRadius: 0,
|
||
padding: 0,
|
||
// Remove the padding in Firefox
|
||
cursor: 'pointer',
|
||
userSelect: 'none',
|
||
verticalAlign: 'middle',
|
||
'-moz-appearance': 'none',
|
||
// Reset
|
||
'-webkit-appearance': 'none',
|
||
// Reset
|
||
textDecoration: 'none',
|
||
// So we take precedent over the style of a native <a /> element.
|
||
color: 'inherit',
|
||
'&::-moz-focus-inner': {
|
||
borderStyle: 'none' // Remove Firefox dotted outline.
|
||
|
||
},
|
||
'&$disabled': {
|
||
pointerEvents: 'none',
|
||
// Disable link interactions
|
||
cursor: 'default'
|
||
},
|
||
'@media print': {
|
||
colorAdjust: 'exact'
|
||
}
|
||
},
|
||
|
||
/* Pseudo-class applied to the root element if `disabled={true}`. */
|
||
disabled: {},
|
||
|
||
/* Pseudo-class applied to the root element if keyboard focused. */
|
||
focusVisible: {}
|
||
};
|
||
/**
|
||
* `ButtonBase` contains as few styles as possible.
|
||
* It aims to be a simple building block for creating a button.
|
||
* It contains a load of style reset and some focus/ripple logic.
|
||
*/
|
||
|
||
var ButtonBase = /*#__PURE__*/external_react_.forwardRef(function ButtonBase(props, ref) {
|
||
var action = props.action,
|
||
buttonRefProp = props.buttonRef,
|
||
_props$centerRipple = props.centerRipple,
|
||
centerRipple = _props$centerRipple === void 0 ? false : _props$centerRipple,
|
||
children = props.children,
|
||
classes = props.classes,
|
||
className = props.className,
|
||
_props$component = props.component,
|
||
component = _props$component === void 0 ? 'button' : _props$component,
|
||
_props$disabled = props.disabled,
|
||
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
||
_props$disableRipple = props.disableRipple,
|
||
disableRipple = _props$disableRipple === void 0 ? false : _props$disableRipple,
|
||
_props$disableTouchRi = props.disableTouchRipple,
|
||
disableTouchRipple = _props$disableTouchRi === void 0 ? false : _props$disableTouchRi,
|
||
_props$focusRipple = props.focusRipple,
|
||
focusRipple = _props$focusRipple === void 0 ? false : _props$focusRipple,
|
||
focusVisibleClassName = props.focusVisibleClassName,
|
||
onBlur = props.onBlur,
|
||
onClick = props.onClick,
|
||
onFocus = props.onFocus,
|
||
onFocusVisible = props.onFocusVisible,
|
||
onKeyDown = props.onKeyDown,
|
||
onKeyUp = props.onKeyUp,
|
||
onMouseDown = props.onMouseDown,
|
||
onMouseLeave = props.onMouseLeave,
|
||
onMouseUp = props.onMouseUp,
|
||
onTouchEnd = props.onTouchEnd,
|
||
onTouchMove = props.onTouchMove,
|
||
onTouchStart = props.onTouchStart,
|
||
onDragLeave = props.onDragLeave,
|
||
_props$tabIndex = props.tabIndex,
|
||
tabIndex = _props$tabIndex === void 0 ? 0 : _props$tabIndex,
|
||
TouchRippleProps = props.TouchRippleProps,
|
||
_props$type = props.type,
|
||
type = _props$type === void 0 ? 'button' : _props$type,
|
||
other = (0,objectWithoutProperties/* default */.Z)(props, ["action", "buttonRef", "centerRipple", "children", "classes", "className", "component", "disabled", "disableRipple", "disableTouchRipple", "focusRipple", "focusVisibleClassName", "onBlur", "onClick", "onFocus", "onFocusVisible", "onKeyDown", "onKeyUp", "onMouseDown", "onMouseLeave", "onMouseUp", "onTouchEnd", "onTouchMove", "onTouchStart", "onDragLeave", "tabIndex", "TouchRippleProps", "type"]);
|
||
|
||
var buttonRef = external_react_.useRef(null);
|
||
|
||
function getButtonNode() {
|
||
// #StrictMode ready
|
||
return external_react_dom_.findDOMNode(buttonRef.current);
|
||
}
|
||
|
||
var rippleRef = external_react_.useRef(null);
|
||
|
||
var _React$useState = external_react_.useState(false),
|
||
focusVisible = _React$useState[0],
|
||
setFocusVisible = _React$useState[1];
|
||
|
||
if (disabled && focusVisible) {
|
||
setFocusVisible(false);
|
||
}
|
||
|
||
var _useIsFocusVisible = useIsFocusVisible(),
|
||
isFocusVisible = _useIsFocusVisible.isFocusVisible,
|
||
onBlurVisible = _useIsFocusVisible.onBlurVisible,
|
||
focusVisibleRef = _useIsFocusVisible.ref;
|
||
|
||
external_react_.useImperativeHandle(action, function () {
|
||
return {
|
||
focusVisible: function focusVisible() {
|
||
setFocusVisible(true);
|
||
buttonRef.current.focus();
|
||
}
|
||
};
|
||
}, []);
|
||
external_react_.useEffect(function () {
|
||
if (focusVisible && focusRipple && !disableRipple) {
|
||
rippleRef.current.pulsate();
|
||
}
|
||
}, [disableRipple, focusRipple, focusVisible]);
|
||
|
||
function useRippleHandler(rippleAction, eventCallback) {
|
||
var skipRippleAction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : disableTouchRipple;
|
||
return useEventCallback(function (event) {
|
||
if (eventCallback) {
|
||
eventCallback(event);
|
||
}
|
||
|
||
var ignore = skipRippleAction;
|
||
|
||
if (!ignore && rippleRef.current) {
|
||
rippleRef.current[rippleAction](event);
|
||
}
|
||
|
||
return true;
|
||
});
|
||
}
|
||
|
||
var handleMouseDown = useRippleHandler('start', onMouseDown);
|
||
var handleDragLeave = useRippleHandler('stop', onDragLeave);
|
||
var handleMouseUp = useRippleHandler('stop', onMouseUp);
|
||
var handleMouseLeave = useRippleHandler('stop', function (event) {
|
||
if (focusVisible) {
|
||
event.preventDefault();
|
||
}
|
||
|
||
if (onMouseLeave) {
|
||
onMouseLeave(event);
|
||
}
|
||
});
|
||
var handleTouchStart = useRippleHandler('start', onTouchStart);
|
||
var handleTouchEnd = useRippleHandler('stop', onTouchEnd);
|
||
var handleTouchMove = useRippleHandler('stop', onTouchMove);
|
||
var handleBlur = useRippleHandler('stop', function (event) {
|
||
if (focusVisible) {
|
||
onBlurVisible(event);
|
||
setFocusVisible(false);
|
||
}
|
||
|
||
if (onBlur) {
|
||
onBlur(event);
|
||
}
|
||
}, false);
|
||
var handleFocus = useEventCallback(function (event) {
|
||
// Fix for https://github.com/facebook/react/issues/7769
|
||
if (!buttonRef.current) {
|
||
buttonRef.current = event.currentTarget;
|
||
}
|
||
|
||
if (isFocusVisible(event)) {
|
||
setFocusVisible(true);
|
||
|
||
if (onFocusVisible) {
|
||
onFocusVisible(event);
|
||
}
|
||
}
|
||
|
||
if (onFocus) {
|
||
onFocus(event);
|
||
}
|
||
});
|
||
|
||
var isNonNativeButton = function isNonNativeButton() {
|
||
var button = getButtonNode();
|
||
return component && component !== 'button' && !(button.tagName === 'A' && button.href);
|
||
};
|
||
/**
|
||
* IE 11 shim for https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat
|
||
*/
|
||
|
||
|
||
var keydownRef = external_react_.useRef(false);
|
||
var handleKeyDown = useEventCallback(function (event) {
|
||
// Check if key is already down to avoid repeats being counted as multiple activations
|
||
if (focusRipple && !keydownRef.current && focusVisible && rippleRef.current && event.key === ' ') {
|
||
keydownRef.current = true;
|
||
event.persist();
|
||
rippleRef.current.stop(event, function () {
|
||
rippleRef.current.start(event);
|
||
});
|
||
}
|
||
|
||
if (event.target === event.currentTarget && isNonNativeButton() && event.key === ' ') {
|
||
event.preventDefault();
|
||
}
|
||
|
||
if (onKeyDown) {
|
||
onKeyDown(event);
|
||
} // Keyboard accessibility for non interactive elements
|
||
|
||
|
||
if (event.target === event.currentTarget && isNonNativeButton() && event.key === 'Enter' && !disabled) {
|
||
event.preventDefault();
|
||
|
||
if (onClick) {
|
||
onClick(event);
|
||
}
|
||
}
|
||
});
|
||
var handleKeyUp = useEventCallback(function (event) {
|
||
// calling preventDefault in keyUp on a <button> will not dispatch a click event if Space is pressed
|
||
// https://codesandbox.io/s/button-keyup-preventdefault-dn7f0
|
||
if (focusRipple && event.key === ' ' && rippleRef.current && focusVisible && !event.defaultPrevented) {
|
||
keydownRef.current = false;
|
||
event.persist();
|
||
rippleRef.current.stop(event, function () {
|
||
rippleRef.current.pulsate(event);
|
||
});
|
||
}
|
||
|
||
if (onKeyUp) {
|
||
onKeyUp(event);
|
||
} // Keyboard accessibility for non interactive elements
|
||
|
||
|
||
if (onClick && event.target === event.currentTarget && isNonNativeButton() && event.key === ' ' && !event.defaultPrevented) {
|
||
onClick(event);
|
||
}
|
||
});
|
||
var ComponentProp = component;
|
||
|
||
if (ComponentProp === 'button' && other.href) {
|
||
ComponentProp = 'a';
|
||
}
|
||
|
||
var buttonProps = {};
|
||
|
||
if (ComponentProp === 'button') {
|
||
buttonProps.type = type;
|
||
buttonProps.disabled = disabled;
|
||
} else {
|
||
if (ComponentProp !== 'a' || !other.href) {
|
||
buttonProps.role = 'button';
|
||
}
|
||
|
||
buttonProps['aria-disabled'] = disabled;
|
||
}
|
||
|
||
var handleUserRef = useForkRef(buttonRefProp, ref);
|
||
var handleOwnRef = useForkRef(focusVisibleRef, buttonRef);
|
||
var handleRef = useForkRef(handleUserRef, handleOwnRef);
|
||
|
||
var _React$useState2 = external_react_.useState(false),
|
||
mountedState = _React$useState2[0],
|
||
setMountedState = _React$useState2[1];
|
||
|
||
external_react_.useEffect(function () {
|
||
setMountedState(true);
|
||
}, []);
|
||
var enableTouchRipple = mountedState && !disableRipple && !disabled;
|
||
|
||
if (false) {}
|
||
|
||
return /*#__PURE__*/external_react_.createElement(ComponentProp, (0,esm_extends/* default */.Z)({
|
||
className: external_clsx_default()(classes.root, className, focusVisible && [classes.focusVisible, focusVisibleClassName], disabled && classes.disabled),
|
||
onBlur: handleBlur,
|
||
onClick: onClick,
|
||
onFocus: handleFocus,
|
||
onKeyDown: handleKeyDown,
|
||
onKeyUp: handleKeyUp,
|
||
onMouseDown: handleMouseDown,
|
||
onMouseLeave: handleMouseLeave,
|
||
onMouseUp: handleMouseUp,
|
||
onDragLeave: handleDragLeave,
|
||
onTouchEnd: handleTouchEnd,
|
||
onTouchMove: handleTouchMove,
|
||
onTouchStart: handleTouchStart,
|
||
ref: handleRef,
|
||
tabIndex: disabled ? -1 : tabIndex
|
||
}, buttonProps, other), children, enableTouchRipple ?
|
||
/*#__PURE__*/
|
||
|
||
/* TouchRipple is only needed client-side, x2 boost on the server. */
|
||
external_react_.createElement(ButtonBase_TouchRipple, (0,esm_extends/* default */.Z)({
|
||
ref: rippleRef,
|
||
center: centerRipple
|
||
}, TouchRippleProps)) : null);
|
||
});
|
||
false ? 0 : void 0;
|
||
/* harmony default export */ var ButtonBase_ButtonBase = ((0,withStyles/* default */.Z)(ButtonBase_styles, {
|
||
name: 'MuiButtonBase'
|
||
})(ButtonBase));
|
||
|
||
/***/ }),
|
||
|
||
/***/ 2318:
|
||
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
/* unused harmony export styles */
|
||
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2122);
|
||
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7375);
|
||
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9297);
|
||
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
||
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4229);
|
||
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
|
||
/* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3536);
|
||
/* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(clsx__WEBPACK_IMPORTED_MODULE_2__);
|
||
/* harmony import */ var _styles_withStyles__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(2543);
|
||
/* harmony import */ var _utils_capitalize__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3871);
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
var styles = function styles(theme) {
|
||
return {
|
||
/* Styles applied to the root element. */
|
||
root: {
|
||
margin: 0
|
||
},
|
||
|
||
/* Styles applied to the root element if `variant="body2"`. */
|
||
body2: theme.typography.body2,
|
||
|
||
/* Styles applied to the root element if `variant="body1"`. */
|
||
body1: theme.typography.body1,
|
||
|
||
/* Styles applied to the root element if `variant="caption"`. */
|
||
caption: theme.typography.caption,
|
||
|
||
/* Styles applied to the root element if `variant="button"`. */
|
||
button: theme.typography.button,
|
||
|
||
/* Styles applied to the root element if `variant="h1"`. */
|
||
h1: theme.typography.h1,
|
||
|
||
/* Styles applied to the root element if `variant="h2"`. */
|
||
h2: theme.typography.h2,
|
||
|
||
/* Styles applied to the root element if `variant="h3"`. */
|
||
h3: theme.typography.h3,
|
||
|
||
/* Styles applied to the root element if `variant="h4"`. */
|
||
h4: theme.typography.h4,
|
||
|
||
/* Styles applied to the root element if `variant="h5"`. */
|
||
h5: theme.typography.h5,
|
||
|
||
/* Styles applied to the root element if `variant="h6"`. */
|
||
h6: theme.typography.h6,
|
||
|
||
/* Styles applied to the root element if `variant="subtitle1"`. */
|
||
subtitle1: theme.typography.subtitle1,
|
||
|
||
/* Styles applied to the root element if `variant="subtitle2"`. */
|
||
subtitle2: theme.typography.subtitle2,
|
||
|
||
/* Styles applied to the root element if `variant="overline"`. */
|
||
overline: theme.typography.overline,
|
||
|
||
/* Styles applied to the root element if `variant="srOnly"`. Only accessible to screen readers. */
|
||
srOnly: {
|
||
position: 'absolute',
|
||
height: 1,
|
||
width: 1,
|
||
overflow: 'hidden'
|
||
},
|
||
|
||
/* Styles applied to the root element if `align="left"`. */
|
||
alignLeft: {
|
||
textAlign: 'left'
|
||
},
|
||
|
||
/* Styles applied to the root element if `align="center"`. */
|
||
alignCenter: {
|
||
textAlign: 'center'
|
||
},
|
||
|
||
/* Styles applied to the root element if `align="right"`. */
|
||
alignRight: {
|
||
textAlign: 'right'
|
||
},
|
||
|
||
/* Styles applied to the root element if `align="justify"`. */
|
||
alignJustify: {
|
||
textAlign: 'justify'
|
||
},
|
||
|
||
/* Styles applied to the root element if `nowrap={true}`. */
|
||
noWrap: {
|
||
overflow: 'hidden',
|
||
textOverflow: 'ellipsis',
|
||
whiteSpace: 'nowrap'
|
||
},
|
||
|
||
/* Styles applied to the root element if `gutterBottom={true}`. */
|
||
gutterBottom: {
|
||
marginBottom: '0.35em'
|
||
},
|
||
|
||
/* Styles applied to the root element if `paragraph={true}`. */
|
||
paragraph: {
|
||
marginBottom: 16
|
||
},
|
||
|
||
/* Styles applied to the root element if `color="inherit"`. */
|
||
colorInherit: {
|
||
color: 'inherit'
|
||
},
|
||
|
||
/* Styles applied to the root element if `color="primary"`. */
|
||
colorPrimary: {
|
||
color: theme.palette.primary.main
|
||
},
|
||
|
||
/* Styles applied to the root element if `color="secondary"`. */
|
||
colorSecondary: {
|
||
color: theme.palette.secondary.main
|
||
},
|
||
|
||
/* Styles applied to the root element if `color="textPrimary"`. */
|
||
colorTextPrimary: {
|
||
color: theme.palette.text.primary
|
||
},
|
||
|
||
/* Styles applied to the root element if `color="textSecondary"`. */
|
||
colorTextSecondary: {
|
||
color: theme.palette.text.secondary
|
||
},
|
||
|
||
/* Styles applied to the root element if `color="error"`. */
|
||
colorError: {
|
||
color: theme.palette.error.main
|
||
},
|
||
|
||
/* Styles applied to the root element if `display="inline"`. */
|
||
displayInline: {
|
||
display: 'inline'
|
||
},
|
||
|
||
/* Styles applied to the root element if `display="block"`. */
|
||
displayBlock: {
|
||
display: 'block'
|
||
}
|
||
};
|
||
};
|
||
var defaultVariantMapping = {
|
||
h1: 'h1',
|
||
h2: 'h2',
|
||
h3: 'h3',
|
||
h4: 'h4',
|
||
h5: 'h5',
|
||
h6: 'h6',
|
||
subtitle1: 'h6',
|
||
subtitle2: 'h6',
|
||
body1: 'p',
|
||
body2: 'p'
|
||
};
|
||
var Typography = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(function Typography(props, ref) {
|
||
var _props$align = props.align,
|
||
align = _props$align === void 0 ? 'inherit' : _props$align,
|
||
classes = props.classes,
|
||
className = props.className,
|
||
_props$color = props.color,
|
||
color = _props$color === void 0 ? 'initial' : _props$color,
|
||
component = props.component,
|
||
_props$display = props.display,
|
||
display = _props$display === void 0 ? 'initial' : _props$display,
|
||
_props$gutterBottom = props.gutterBottom,
|
||
gutterBottom = _props$gutterBottom === void 0 ? false : _props$gutterBottom,
|
||
_props$noWrap = props.noWrap,
|
||
noWrap = _props$noWrap === void 0 ? false : _props$noWrap,
|
||
_props$paragraph = props.paragraph,
|
||
paragraph = _props$paragraph === void 0 ? false : _props$paragraph,
|
||
_props$variant = props.variant,
|
||
variant = _props$variant === void 0 ? 'body1' : _props$variant,
|
||
_props$variantMapping = props.variantMapping,
|
||
variantMapping = _props$variantMapping === void 0 ? defaultVariantMapping : _props$variantMapping,
|
||
other = (0,_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_3__/* .default */ .Z)(props, ["align", "classes", "className", "color", "component", "display", "gutterBottom", "noWrap", "paragraph", "variant", "variantMapping"]);
|
||
|
||
var Component = component || (paragraph ? 'p' : variantMapping[variant] || defaultVariantMapping[variant]) || 'span';
|
||
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Component, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_4__/* .default */ .Z)({
|
||
className: clsx__WEBPACK_IMPORTED_MODULE_2___default()(classes.root, className, variant !== 'inherit' && classes[variant], color !== 'initial' && classes["color".concat((0,_utils_capitalize__WEBPACK_IMPORTED_MODULE_5__/* .default */ .Z)(color))], noWrap && classes.noWrap, gutterBottom && classes.gutterBottom, paragraph && classes.paragraph, align !== 'inherit' && classes["align".concat((0,_utils_capitalize__WEBPACK_IMPORTED_MODULE_5__/* .default */ .Z)(align))], display !== 'initial' && classes["display".concat((0,_utils_capitalize__WEBPACK_IMPORTED_MODULE_5__/* .default */ .Z)(display))]),
|
||
ref: ref
|
||
}, other));
|
||
});
|
||
false ? 0 : void 0;
|
||
/* harmony default export */ __webpack_exports__["Z"] = ((0,_styles_withStyles__WEBPACK_IMPORTED_MODULE_6__/* .default */ .Z)(styles, {
|
||
name: 'MuiTypography'
|
||
})(Typography));
|
||
|
||
/***/ }),
|
||
|
||
/***/ 2167:
|
||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
var __webpack_unused_export__;
|
||
|
||
|
||
var _interopRequireWildcard = __webpack_require__(9448);
|
||
|
||
__webpack_unused_export__ = true;
|
||
exports.default = void 0;
|
||
|
||
var _react = _interopRequireWildcard(__webpack_require__(9297));
|
||
|
||
var _router = __webpack_require__(9414);
|
||
|
||
var _router2 = __webpack_require__(4651);
|
||
|
||
var _useIntersection = __webpack_require__(7426);
|
||
|
||
const prefetched = {};
|
||
|
||
function prefetch(router, href, as, options) {
|
||
if (true) return;
|
||
if (!(0, _router.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
|
||
// We need to handle a prefetch error here since we may be
|
||
// loading with priority which can reject but we don't
|
||
// want to force navigation since this is only a prefetch
|
||
|
||
router.prefetch(href, as, options).catch(err => {
|
||
if (false) {}
|
||
});
|
||
const curLocale = options && typeof options.locale !== 'undefined' ? options.locale : router && router.locale; // Join on an invalid URI character
|
||
|
||
prefetched[href + '%' + as + (curLocale ? '%' + curLocale : '')] = true;
|
||
}
|
||
|
||
function isModifiedEvent(event) {
|
||
const {
|
||
target
|
||
} = event.currentTarget;
|
||
return target && target !== '_self' || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || // triggers resource download
|
||
event.nativeEvent && event.nativeEvent.which === 2;
|
||
}
|
||
|
||
function linkClicked(e, router, href, as, replace, shallow, scroll, locale) {
|
||
const {
|
||
nodeName
|
||
} = e.currentTarget;
|
||
|
||
if (nodeName === 'A' && (isModifiedEvent(e) || !(0, _router.isLocalURL)(href))) {
|
||
// ignore click for browser’s default behavior
|
||
return;
|
||
}
|
||
|
||
e.preventDefault(); // avoid scroll for urls with anchor refs
|
||
|
||
if (scroll == null && as.indexOf('#') >= 0) {
|
||
scroll = false;
|
||
} // replace state instead of push if prop is present
|
||
|
||
|
||
router[replace ? 'replace' : 'push'](href, as, {
|
||
shallow,
|
||
locale,
|
||
scroll
|
||
});
|
||
}
|
||
|
||
function Link(props) {
|
||
if (false) {}
|
||
|
||
const p = props.prefetch !== false;
|
||
const router = (0, _router2.useRouter)();
|
||
|
||
const {
|
||
href,
|
||
as
|
||
} = _react.default.useMemo(() => {
|
||
const [resolvedHref, resolvedAs] = (0, _router.resolveHref)(router, props.href, true);
|
||
return {
|
||
href: resolvedHref,
|
||
as: props.as ? (0, _router.resolveHref)(router, props.as) : resolvedAs || resolvedHref
|
||
};
|
||
}, [router, props.href, props.as]);
|
||
|
||
let {
|
||
children,
|
||
replace,
|
||
shallow,
|
||
scroll,
|
||
locale
|
||
} = props; // Deprecated. Warning shown by propType check. If the children provided is a string (<Link>example</Link>) we wrap it in an <a> tag
|
||
|
||
if (typeof children === 'string') {
|
||
children = /*#__PURE__*/_react.default.createElement("a", null, children);
|
||
} // This will return the first child, if multiple are provided it will throw an error
|
||
|
||
|
||
let child;
|
||
|
||
if (false) {} else {
|
||
child = _react.Children.only(children);
|
||
}
|
||
|
||
const childRef = child && typeof child === 'object' && child.ref;
|
||
const [setIntersectionRef, isVisible] = (0, _useIntersection.useIntersection)({
|
||
rootMargin: '200px'
|
||
});
|
||
|
||
const setRef = _react.default.useCallback(el => {
|
||
setIntersectionRef(el);
|
||
|
||
if (childRef) {
|
||
if (typeof childRef === 'function') childRef(el);else if (typeof childRef === 'object') {
|
||
childRef.current = el;
|
||
}
|
||
}
|
||
}, [childRef, setIntersectionRef]);
|
||
|
||
(0, _react.useEffect)(() => {
|
||
const shouldPrefetch = isVisible && p && (0, _router.isLocalURL)(href);
|
||
const curLocale = typeof locale !== 'undefined' ? locale : router && router.locale;
|
||
const isPrefetched = prefetched[href + '%' + as + (curLocale ? '%' + curLocale : '')];
|
||
|
||
if (shouldPrefetch && !isPrefetched) {
|
||
prefetch(router, href, as, {
|
||
locale: curLocale
|
||
});
|
||
}
|
||
}, [as, href, isVisible, locale, p, router]);
|
||
const childProps = {
|
||
ref: setRef,
|
||
onClick: e => {
|
||
if (child.props && typeof child.props.onClick === 'function') {
|
||
child.props.onClick(e);
|
||
}
|
||
|
||
if (!e.defaultPrevented) {
|
||
linkClicked(e, router, href, as, replace, shallow, scroll, locale);
|
||
}
|
||
}
|
||
};
|
||
|
||
childProps.onMouseEnter = e => {
|
||
if (!(0, _router.isLocalURL)(href)) return;
|
||
|
||
if (child.props && typeof child.props.onMouseEnter === 'function') {
|
||
child.props.onMouseEnter(e);
|
||
}
|
||
|
||
prefetch(router, href, as, {
|
||
priority: true
|
||
});
|
||
}; // If child is an <a> tag and doesn't have a href attribute, or if the 'passHref' property is
|
||
// defined, we specify the current 'href', so that repetition is not needed by the user
|
||
|
||
|
||
if (props.passHref || child.type === 'a' && !('href' in child.props)) {
|
||
const curLocale = typeof locale !== 'undefined' ? locale : router && router.locale; // we only render domain locales if we are currently on a domain locale
|
||
// so that locale links are still visitable in development/preview envs
|
||
|
||
const localeDomain = router && router.isLocaleDomain && (0, _router.getDomainLocale)(as, curLocale, router && router.locales, router && router.domainLocales);
|
||
childProps.href = localeDomain || (0, _router.addBasePath)((0, _router.addLocale)(as, curLocale, router && router.defaultLocale));
|
||
}
|
||
|
||
return /*#__PURE__*/_react.default.cloneElement(child, childProps);
|
||
}
|
||
|
||
var _default = Link;
|
||
exports.default = _default;
|
||
|
||
/***/ }),
|
||
|
||
/***/ 5965:
|
||
/***/ (function(__unused_webpack_module, exports) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.removePathTrailingSlash = removePathTrailingSlash;
|
||
exports.normalizePathTrailingSlash = void 0;
|
||
/**
|
||
* Removes the trailing slash of a path if there is one. Preserves the root path `/`.
|
||
*/
|
||
|
||
function removePathTrailingSlash(path) {
|
||
return path.endsWith('/') && path !== '/' ? path.slice(0, -1) : path;
|
||
}
|
||
/**
|
||
* Normalizes the trailing slash of a path according to the `trailingSlash` option
|
||
* in `next.config.js`.
|
||
*/
|
||
|
||
|
||
const normalizePathTrailingSlash = false ? 0 : removePathTrailingSlash;
|
||
exports.normalizePathTrailingSlash = normalizePathTrailingSlash;
|
||
|
||
/***/ }),
|
||
|
||
/***/ 3447:
|
||
/***/ (function(__unused_webpack_module, exports) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.cancelIdleCallback = exports.requestIdleCallback = void 0;
|
||
|
||
const requestIdleCallback = typeof self !== 'undefined' && self.requestIdleCallback || function (cb) {
|
||
let start = Date.now();
|
||
return setTimeout(function () {
|
||
cb({
|
||
didTimeout: false,
|
||
timeRemaining: function () {
|
||
return Math.max(0, 50 - (Date.now() - start));
|
||
}
|
||
});
|
||
}, 1);
|
||
};
|
||
|
||
exports.requestIdleCallback = requestIdleCallback;
|
||
|
||
const cancelIdleCallback = typeof self !== 'undefined' && self.cancelIdleCallback || function (id) {
|
||
return clearTimeout(id);
|
||
};
|
||
|
||
exports.cancelIdleCallback = cancelIdleCallback;
|
||
|
||
/***/ }),
|
||
|
||
/***/ 1392:
|
||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _interopRequireDefault = __webpack_require__(2426);
|
||
|
||
exports.__esModule = true;
|
||
exports.markAssetError = markAssetError;
|
||
exports.isAssetError = isAssetError;
|
||
exports.getClientBuildManifest = getClientBuildManifest;
|
||
exports.default = void 0;
|
||
|
||
var _getAssetPathFromRoute = _interopRequireDefault(__webpack_require__(2238));
|
||
|
||
var _requestIdleCallback = __webpack_require__(3447); // 3.8s was arbitrarily chosen as it's what https://web.dev/interactive
|
||
// considers as "Good" time-to-interactive. We must assume something went
|
||
// wrong beyond this point, and then fall-back to a full page transition to
|
||
// show the user something of value.
|
||
|
||
|
||
const MS_MAX_IDLE_DELAY = 3800;
|
||
|
||
function withFuture(key, map, generator) {
|
||
let entry = map.get(key);
|
||
|
||
if (entry) {
|
||
if ('future' in entry) {
|
||
return entry.future;
|
||
}
|
||
|
||
return Promise.resolve(entry);
|
||
}
|
||
|
||
let resolver;
|
||
const prom = new Promise(resolve => {
|
||
resolver = resolve;
|
||
});
|
||
map.set(key, entry = {
|
||
resolve: resolver,
|
||
future: prom
|
||
});
|
||
return generator ? // eslint-disable-next-line no-sequences
|
||
generator().then(value => (resolver(value), value)) : prom;
|
||
}
|
||
|
||
function hasPrefetch(link) {
|
||
try {
|
||
link = document.createElement('link');
|
||
return (// detect IE11 since it supports prefetch but isn't detected
|
||
// with relList.support
|
||
!!window.MSInputMethodContext && !!document.documentMode || link.relList.supports('prefetch')
|
||
);
|
||
} catch (_unused) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
const canPrefetch = hasPrefetch();
|
||
|
||
function prefetchViaDom(href, as, link) {
|
||
return new Promise((res, rej) => {
|
||
if (document.querySelector(`link[rel="prefetch"][href^="${href}"]`)) {
|
||
return res();
|
||
}
|
||
|
||
link = document.createElement('link'); // The order of property assignment here is intentional:
|
||
|
||
if (as) link.as = as;
|
||
link.rel = `prefetch`;
|
||
link.crossOrigin = undefined;
|
||
link.onload = res;
|
||
link.onerror = rej; // `href` should always be last:
|
||
|
||
link.href = href;
|
||
document.head.appendChild(link);
|
||
});
|
||
}
|
||
|
||
const ASSET_LOAD_ERROR = Symbol('ASSET_LOAD_ERROR'); // TODO: unexport
|
||
|
||
function markAssetError(err) {
|
||
return Object.defineProperty(err, ASSET_LOAD_ERROR, {});
|
||
}
|
||
|
||
function isAssetError(err) {
|
||
return err && ASSET_LOAD_ERROR in err;
|
||
}
|
||
|
||
function appendScript(src, script) {
|
||
return new Promise((resolve, reject) => {
|
||
script = document.createElement('script'); // The order of property assignment here is intentional.
|
||
// 1. Setup success/failure hooks in case the browser synchronously
|
||
// executes when `src` is set.
|
||
|
||
script.onload = resolve;
|
||
|
||
script.onerror = () => reject(markAssetError(new Error(`Failed to load script: ${src}`))); // 2. Configure the cross-origin attribute before setting `src` in case the
|
||
// browser begins to fetch.
|
||
|
||
|
||
script.crossOrigin = undefined; // 3. Finally, set the source and inject into the DOM in case the child
|
||
// must be appended for fetching to start.
|
||
|
||
script.src = src;
|
||
document.body.appendChild(script);
|
||
});
|
||
} // Resolve a promise that times out after given amount of milliseconds.
|
||
|
||
|
||
function resolvePromiseWithTimeout(p, ms, err) {
|
||
return new Promise((resolve, reject) => {
|
||
let cancelled = false;
|
||
p.then(r => {
|
||
// Resolved, cancel the timeout
|
||
cancelled = true;
|
||
resolve(r);
|
||
}).catch(reject);
|
||
(0, _requestIdleCallback.requestIdleCallback)(() => setTimeout(() => {
|
||
if (!cancelled) {
|
||
reject(err);
|
||
}
|
||
}, ms));
|
||
});
|
||
} // TODO: stop exporting or cache the failure
|
||
// It'd be best to stop exporting this. It's an implementation detail. We're
|
||
// only exporting it for backwards compatibilty with the `page-loader`.
|
||
// Only cache this response as a last resort if we cannot eliminate all other
|
||
// code branches that use the Build Manifest Callback and push them through
|
||
// the Route Loader interface.
|
||
|
||
|
||
function getClientBuildManifest() {
|
||
if (self.__BUILD_MANIFEST) {
|
||
return Promise.resolve(self.__BUILD_MANIFEST);
|
||
}
|
||
|
||
const onBuildManifest = new Promise(resolve => {
|
||
// Mandatory because this is not concurrent safe:
|
||
const cb = self.__BUILD_MANIFEST_CB;
|
||
|
||
self.__BUILD_MANIFEST_CB = () => {
|
||
resolve(self.__BUILD_MANIFEST);
|
||
cb && cb();
|
||
};
|
||
});
|
||
return resolvePromiseWithTimeout(onBuildManifest, MS_MAX_IDLE_DELAY, markAssetError(new Error('Failed to load client build manifest')));
|
||
}
|
||
|
||
function getFilesForRoute(assetPrefix, route) {
|
||
if (false) {}
|
||
|
||
return getClientBuildManifest().then(manifest => {
|
||
if (!(route in manifest)) {
|
||
throw markAssetError(new Error(`Failed to lookup route: ${route}`));
|
||
}
|
||
|
||
const allFiles = manifest[route].map(entry => assetPrefix + '/_next/' + encodeURI(entry));
|
||
return {
|
||
scripts: allFiles.filter(v => v.endsWith('.js')),
|
||
css: allFiles.filter(v => v.endsWith('.css'))
|
||
};
|
||
});
|
||
}
|
||
|
||
function createRouteLoader(assetPrefix) {
|
||
const entrypoints = new Map();
|
||
const loadedScripts = new Map();
|
||
const styleSheets = new Map();
|
||
const routes = new Map();
|
||
|
||
function maybeExecuteScript(src) {
|
||
let prom = loadedScripts.get(src);
|
||
|
||
if (prom) {
|
||
return prom;
|
||
} // Skip executing script if it's already in the DOM:
|
||
|
||
|
||
if (document.querySelector(`script[src^="${src}"]`)) {
|
||
return Promise.resolve();
|
||
}
|
||
|
||
loadedScripts.set(src, prom = appendScript(src));
|
||
return prom;
|
||
}
|
||
|
||
function fetchStyleSheet(href) {
|
||
let prom = styleSheets.get(href);
|
||
|
||
if (prom) {
|
||
return prom;
|
||
}
|
||
|
||
styleSheets.set(href, prom = fetch(href).then(res => {
|
||
if (!res.ok) {
|
||
throw new Error(`Failed to load stylesheet: ${href}`);
|
||
}
|
||
|
||
return res.text().then(text => ({
|
||
href: href,
|
||
content: text
|
||
}));
|
||
}).catch(err => {
|
||
throw markAssetError(err);
|
||
}));
|
||
return prom;
|
||
}
|
||
|
||
return {
|
||
whenEntrypoint(route) {
|
||
return withFuture(route, entrypoints);
|
||
},
|
||
|
||
onEntrypoint(route, execute) {
|
||
Promise.resolve(execute).then(fn => fn()).then(exports => ({
|
||
component: exports && exports.default || exports,
|
||
exports: exports
|
||
}), err => ({
|
||
error: err
|
||
})).then(input => {
|
||
const old = entrypoints.get(route);
|
||
entrypoints.set(route, input);
|
||
if (old && 'resolve' in old) old.resolve(input);
|
||
});
|
||
},
|
||
|
||
loadRoute(route, prefetch) {
|
||
return withFuture(route, routes, () => {
|
||
return resolvePromiseWithTimeout(getFilesForRoute(assetPrefix, route).then(({
|
||
scripts,
|
||
css
|
||
}) => {
|
||
return Promise.all([entrypoints.has(route) ? [] : Promise.all(scripts.map(maybeExecuteScript)), Promise.all(css.map(fetchStyleSheet))]);
|
||
}).then(res => {
|
||
return this.whenEntrypoint(route).then(entrypoint => ({
|
||
entrypoint,
|
||
styles: res[1]
|
||
}));
|
||
}), MS_MAX_IDLE_DELAY, markAssetError(new Error(`Route did not complete loading: ${route}`))).then(({
|
||
entrypoint,
|
||
styles
|
||
}) => {
|
||
const res = Object.assign({
|
||
styles: styles
|
||
}, entrypoint);
|
||
return 'error' in entrypoint ? entrypoint : res;
|
||
}).catch(err => {
|
||
if (prefetch) {
|
||
// we don't want to cache errors during prefetch
|
||
throw err;
|
||
}
|
||
|
||
return {
|
||
error: err
|
||
};
|
||
});
|
||
});
|
||
},
|
||
|
||
prefetch(route) {
|
||
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
|
||
// License: Apache 2.0
|
||
let cn;
|
||
|
||
if (cn = navigator.connection) {
|
||
// Don't prefetch if using 2G or if Save-Data is enabled.
|
||
if (cn.saveData || /2g/.test(cn.effectiveType)) return Promise.resolve();
|
||
}
|
||
|
||
return getFilesForRoute(assetPrefix, route).then(output => Promise.all(canPrefetch ? output.scripts.map(script => prefetchViaDom(script, 'script')) : [])).then(() => {
|
||
(0, _requestIdleCallback.requestIdleCallback)(() => this.loadRoute(route, true).catch(() => {}));
|
||
}).catch( // swallow prefetch errors
|
||
() => {});
|
||
}
|
||
|
||
};
|
||
}
|
||
|
||
var _default = createRouteLoader;
|
||
exports.default = _default;
|
||
|
||
/***/ }),
|
||
|
||
/***/ 4651:
|
||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _interopRequireWildcard = __webpack_require__(9448);
|
||
|
||
var _interopRequireDefault = __webpack_require__(2426);
|
||
|
||
exports.__esModule = true;
|
||
exports.useRouter = useRouter;
|
||
exports.makePublicRouterInstance = makePublicRouterInstance;
|
||
exports.createRouter = exports.withRouter = exports.default = void 0;
|
||
|
||
var _react = _interopRequireDefault(__webpack_require__(9297));
|
||
|
||
var _router2 = _interopRequireWildcard(__webpack_require__(9414));
|
||
|
||
exports.Router = _router2.default;
|
||
exports.NextRouter = _router2.NextRouter;
|
||
|
||
var _routerContext = __webpack_require__(8417);
|
||
|
||
var _withRouter = _interopRequireDefault(__webpack_require__(7413));
|
||
|
||
exports.withRouter = _withRouter.default;
|
||
/* global window */
|
||
|
||
const singletonRouter = {
|
||
router: null,
|
||
// holds the actual router instance
|
||
readyCallbacks: [],
|
||
|
||
ready(cb) {
|
||
if (this.router) return cb();
|
||
|
||
if (false) {}
|
||
}
|
||
|
||
}; // Create public properties and methods of the router in the singletonRouter
|
||
|
||
const urlPropertyFields = ['pathname', 'route', 'query', 'asPath', 'components', 'isFallback', 'basePath', 'locale', 'locales', 'defaultLocale', 'isReady', 'isPreview', 'isLocaleDomain'];
|
||
const routerEvents = ['routeChangeStart', 'beforeHistoryChange', 'routeChangeComplete', 'routeChangeError', 'hashChangeStart', 'hashChangeComplete'];
|
||
const coreMethodFields = ['push', 'replace', 'reload', 'back', 'prefetch', 'beforePopState']; // Events is a static property on the router, the router doesn't have to be initialized to use it
|
||
|
||
Object.defineProperty(singletonRouter, 'events', {
|
||
get() {
|
||
return _router2.default.events;
|
||
}
|
||
|
||
});
|
||
urlPropertyFields.forEach(field => {
|
||
// Here we need to use Object.defineProperty because we need to return
|
||
// the property assigned to the actual router
|
||
// The value might get changed as we change routes and this is the
|
||
// proper way to access it
|
||
Object.defineProperty(singletonRouter, field, {
|
||
get() {
|
||
const router = getRouter();
|
||
return router[field];
|
||
}
|
||
|
||
});
|
||
});
|
||
coreMethodFields.forEach(field => {
|
||
// We don't really know the types here, so we add them later instead
|
||
;
|
||
|
||
singletonRouter[field] = (...args) => {
|
||
const router = getRouter();
|
||
return router[field](...args);
|
||
};
|
||
});
|
||
routerEvents.forEach(event => {
|
||
singletonRouter.ready(() => {
|
||
_router2.default.events.on(event, (...args) => {
|
||
const eventField = `on${event.charAt(0).toUpperCase()}${event.substring(1)}`;
|
||
const _singletonRouter = singletonRouter;
|
||
|
||
if (_singletonRouter[eventField]) {
|
||
try {
|
||
_singletonRouter[eventField](...args);
|
||
} catch (err) {
|
||
console.error(`Error when running the Router event: ${eventField}`);
|
||
console.error(`${err.message}\n${err.stack}`);
|
||
}
|
||
}
|
||
});
|
||
});
|
||
});
|
||
|
||
function getRouter() {
|
||
if (!singletonRouter.router) {
|
||
const message = 'No router instance found.\n' + 'You should only use "next/router" on the client side of your app.\n';
|
||
throw new Error(message);
|
||
}
|
||
|
||
return singletonRouter.router;
|
||
} // Export the singletonRouter and this is the public API.
|
||
|
||
|
||
var _default = singletonRouter; // Reexport the withRoute HOC
|
||
|
||
exports.default = _default;
|
||
|
||
function useRouter() {
|
||
return _react.default.useContext(_routerContext.RouterContext);
|
||
} // INTERNAL APIS
|
||
// -------------
|
||
// (do not use following exports inside the app)
|
||
// Create a router and assign it as the singleton instance.
|
||
// This is used in client side when we are initilizing the app.
|
||
// This should **not** be used inside the server.
|
||
|
||
|
||
const createRouter = (...args) => {
|
||
singletonRouter.router = new _router2.default(...args);
|
||
singletonRouter.readyCallbacks.forEach(cb => cb());
|
||
singletonRouter.readyCallbacks = [];
|
||
return singletonRouter.router;
|
||
}; // This function is used to create the `withRouter` router instance
|
||
|
||
|
||
exports.createRouter = createRouter;
|
||
|
||
function makePublicRouterInstance(router) {
|
||
const _router = router;
|
||
const instance = {};
|
||
|
||
for (const property of urlPropertyFields) {
|
||
if (typeof _router[property] === 'object') {
|
||
instance[property] = Object.assign(Array.isArray(_router[property]) ? [] : {}, _router[property]); // makes sure query is not stateful
|
||
|
||
continue;
|
||
}
|
||
|
||
instance[property] = _router[property];
|
||
} // Events is a static property on the router, the router doesn't have to be initialized to use it
|
||
|
||
|
||
instance.events = _router2.default.events;
|
||
coreMethodFields.forEach(field => {
|
||
instance[field] = (...args) => {
|
||
return _router[field](...args);
|
||
};
|
||
});
|
||
return instance;
|
||
}
|
||
|
||
/***/ }),
|
||
|
||
/***/ 7426:
|
||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.useIntersection = useIntersection;
|
||
|
||
var _react = __webpack_require__(9297);
|
||
|
||
var _requestIdleCallback = __webpack_require__(3447);
|
||
|
||
const hasIntersectionObserver = typeof IntersectionObserver !== 'undefined';
|
||
|
||
function useIntersection({
|
||
rootMargin,
|
||
disabled
|
||
}) {
|
||
const isDisabled = disabled || !hasIntersectionObserver;
|
||
const unobserve = (0, _react.useRef)();
|
||
const [visible, setVisible] = (0, _react.useState)(false);
|
||
const setRef = (0, _react.useCallback)(el => {
|
||
if (unobserve.current) {
|
||
unobserve.current();
|
||
unobserve.current = undefined;
|
||
}
|
||
|
||
if (isDisabled || visible) return;
|
||
|
||
if (el && el.tagName) {
|
||
unobserve.current = observe(el, isVisible => isVisible && setVisible(isVisible), {
|
||
rootMargin
|
||
});
|
||
}
|
||
}, [isDisabled, rootMargin, visible]);
|
||
(0, _react.useEffect)(() => {
|
||
if (!hasIntersectionObserver) {
|
||
if (!visible) {
|
||
const idleCallback = (0, _requestIdleCallback.requestIdleCallback)(() => setVisible(true));
|
||
return () => (0, _requestIdleCallback.cancelIdleCallback)(idleCallback);
|
||
}
|
||
}
|
||
}, [visible]);
|
||
return [setRef, visible];
|
||
}
|
||
|
||
function observe(element, callback, options) {
|
||
const {
|
||
id,
|
||
observer,
|
||
elements
|
||
} = createObserver(options);
|
||
elements.set(element, callback);
|
||
observer.observe(element);
|
||
return function unobserve() {
|
||
elements.delete(element);
|
||
observer.unobserve(element); // Destroy observer when there's nothing left to watch:
|
||
|
||
if (elements.size === 0) {
|
||
observer.disconnect();
|
||
observers.delete(id);
|
||
}
|
||
};
|
||
}
|
||
|
||
const observers = new Map();
|
||
|
||
function createObserver(options) {
|
||
const id = options.rootMargin || '';
|
||
let instance = observers.get(id);
|
||
|
||
if (instance) {
|
||
return instance;
|
||
}
|
||
|
||
const elements = new Map();
|
||
const observer = new IntersectionObserver(entries => {
|
||
entries.forEach(entry => {
|
||
const callback = elements.get(entry.target);
|
||
const isVisible = entry.isIntersecting || entry.intersectionRatio > 0;
|
||
|
||
if (callback && isVisible) {
|
||
callback(isVisible);
|
||
}
|
||
});
|
||
}, options);
|
||
observers.set(id, instance = {
|
||
id,
|
||
observer,
|
||
elements
|
||
});
|
||
return instance;
|
||
}
|
||
|
||
/***/ }),
|
||
|
||
/***/ 7413:
|
||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _interopRequireDefault = __webpack_require__(2426);
|
||
|
||
exports.__esModule = true;
|
||
exports.default = withRouter;
|
||
|
||
var _react = _interopRequireDefault(__webpack_require__(9297));
|
||
|
||
var _router = __webpack_require__(4651);
|
||
|
||
function withRouter(ComposedComponent) {
|
||
function WithRouterWrapper(props) {
|
||
return /*#__PURE__*/_react.default.createElement(ComposedComponent, Object.assign({
|
||
router: (0, _router.useRouter)()
|
||
}, props));
|
||
}
|
||
|
||
WithRouterWrapper.getInitialProps = ComposedComponent.getInitialProps // This is needed to allow checking for custom getInitialProps in _app
|
||
;
|
||
WithRouterWrapper.origGetInitialProps = ComposedComponent.origGetInitialProps;
|
||
|
||
if (false) {}
|
||
|
||
return WithRouterWrapper;
|
||
}
|
||
|
||
/***/ }),
|
||
|
||
/***/ 6813:
|
||
/***/ (function(__unused_webpack_module, exports) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.normalizeLocalePath = normalizeLocalePath;
|
||
|
||
function normalizeLocalePath(pathname, locales) {
|
||
let detectedLocale; // first item will be empty string from splitting at first char
|
||
|
||
const pathnameParts = pathname.split('/');
|
||
(locales || []).some(locale => {
|
||
if (pathnameParts[1].toLowerCase() === locale.toLowerCase()) {
|
||
detectedLocale = locale;
|
||
pathnameParts.splice(1, 1);
|
||
pathname = pathnameParts.join('/') || '/';
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
});
|
||
return {
|
||
pathname,
|
||
detectedLocale
|
||
};
|
||
}
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8119:
|
||
/***/ (function(__unused_webpack_module, exports) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.default = mitt;
|
||
/*
|
||
MIT License
|
||
Copyright (c) Jason Miller (https://jasonformat.com/)
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||
*/
|
||
// This file is based on https://github.com/developit/mitt/blob/v1.1.3/src/index.js
|
||
// It's been edited for the needs of this script
|
||
// See the LICENSE at the top of the file
|
||
|
||
function mitt() {
|
||
const all = Object.create(null);
|
||
return {
|
||
on(type, handler) {
|
||
;
|
||
(all[type] || (all[type] = [])).push(handler);
|
||
},
|
||
|
||
off(type, handler) {
|
||
if (all[type]) {
|
||
all[type].splice(all[type].indexOf(handler) >>> 0, 1);
|
||
}
|
||
},
|
||
|
||
emit(type, ...evts) {
|
||
// eslint-disable-next-line array-callback-return
|
||
;
|
||
(all[type] || []).slice().map(handler => {
|
||
handler(...evts);
|
||
});
|
||
}
|
||
|
||
};
|
||
}
|
||
|
||
/***/ }),
|
||
|
||
/***/ 9414:
|
||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.getDomainLocale = getDomainLocale;
|
||
exports.addLocale = addLocale;
|
||
exports.delLocale = delLocale;
|
||
exports.hasBasePath = hasBasePath;
|
||
exports.addBasePath = addBasePath;
|
||
exports.delBasePath = delBasePath;
|
||
exports.isLocalURL = isLocalURL;
|
||
exports.interpolateAs = interpolateAs;
|
||
exports.resolveHref = resolveHref;
|
||
exports.default = void 0;
|
||
|
||
var _normalizeTrailingSlash = __webpack_require__(5965);
|
||
|
||
var _routeLoader = __webpack_require__(1392);
|
||
|
||
var _denormalizePagePath = __webpack_require__(9320);
|
||
|
||
var _normalizeLocalePath = __webpack_require__(6813);
|
||
|
||
var _mitt = _interopRequireDefault(__webpack_require__(8119));
|
||
|
||
var _utils = __webpack_require__(4755);
|
||
|
||
var _isDynamic = __webpack_require__(8073);
|
||
|
||
var _parseRelativeUrl = __webpack_require__(3900);
|
||
|
||
var _querystring = __webpack_require__(8187);
|
||
|
||
var _resolveRewrites = _interopRequireDefault(__webpack_require__(4453));
|
||
|
||
var _routeMatcher = __webpack_require__(8085);
|
||
|
||
var _routeRegex = __webpack_require__(4550);
|
||
|
||
function _interopRequireDefault(obj) {
|
||
return obj && obj.__esModule ? obj : {
|
||
default: obj
|
||
};
|
||
} // tslint:disable:no-console
|
||
|
||
|
||
let detectDomainLocale;
|
||
|
||
if (false) {}
|
||
|
||
const basePath = false || '';
|
||
|
||
function buildCancellationError() {
|
||
return Object.assign(new Error('Route Cancelled'), {
|
||
cancelled: true
|
||
});
|
||
}
|
||
|
||
function addPathPrefix(path, prefix) {
|
||
return prefix && path.startsWith('/') ? path === '/' ? (0, _normalizeTrailingSlash.normalizePathTrailingSlash)(prefix) : `${prefix}${pathNoQueryHash(path) === '/' ? path.substring(1) : path}` : path;
|
||
}
|
||
|
||
function getDomainLocale(path, locale, locales, domainLocales) {
|
||
if (false) {}
|
||
|
||
return false;
|
||
}
|
||
|
||
function addLocale(path, locale, defaultLocale) {
|
||
if (false) {}
|
||
|
||
return path;
|
||
}
|
||
|
||
function delLocale(path, locale) {
|
||
if (false) {}
|
||
|
||
return path;
|
||
}
|
||
|
||
function pathNoQueryHash(path) {
|
||
const queryIndex = path.indexOf('?');
|
||
const hashIndex = path.indexOf('#');
|
||
|
||
if (queryIndex > -1 || hashIndex > -1) {
|
||
path = path.substring(0, queryIndex > -1 ? queryIndex : hashIndex);
|
||
}
|
||
|
||
return path;
|
||
}
|
||
|
||
function hasBasePath(path) {
|
||
path = pathNoQueryHash(path);
|
||
return path === basePath || path.startsWith(basePath + '/');
|
||
}
|
||
|
||
function addBasePath(path) {
|
||
// we only add the basepath on relative urls
|
||
return addPathPrefix(path, basePath);
|
||
}
|
||
|
||
function delBasePath(path) {
|
||
path = path.slice(basePath.length);
|
||
if (!path.startsWith('/')) path = `/${path}`;
|
||
return path;
|
||
}
|
||
/**
|
||
* Detects whether a given url is routable by the Next.js router (browser only).
|
||
*/
|
||
|
||
|
||
function isLocalURL(url) {
|
||
// prevent a hydration mismatch on href for url with anchor refs
|
||
if (url.startsWith('/') || url.startsWith('#') || url.startsWith('?')) return true;
|
||
|
||
try {
|
||
// absolute urls can be local if they are on the same origin
|
||
const locationOrigin = (0, _utils.getLocationOrigin)();
|
||
const resolved = new URL(url, locationOrigin);
|
||
return resolved.origin === locationOrigin && hasBasePath(resolved.pathname);
|
||
} catch (_) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
function interpolateAs(route, asPathname, query) {
|
||
let interpolatedRoute = '';
|
||
const dynamicRegex = (0, _routeRegex.getRouteRegex)(route);
|
||
const dynamicGroups = dynamicRegex.groups;
|
||
const dynamicMatches = // Try to match the dynamic route against the asPath
|
||
(asPathname !== route ? (0, _routeMatcher.getRouteMatcher)(dynamicRegex)(asPathname) : '') || // Fall back to reading the values from the href
|
||
// TODO: should this take priority; also need to change in the router.
|
||
query;
|
||
interpolatedRoute = route;
|
||
const params = Object.keys(dynamicGroups);
|
||
|
||
if (!params.every(param => {
|
||
let value = dynamicMatches[param] || '';
|
||
const {
|
||
repeat,
|
||
optional
|
||
} = dynamicGroups[param]; // support single-level catch-all
|
||
// TODO: more robust handling for user-error (passing `/`)
|
||
|
||
let replaced = `[${repeat ? '...' : ''}${param}]`;
|
||
|
||
if (optional) {
|
||
replaced = `${!value ? '/' : ''}[${replaced}]`;
|
||
}
|
||
|
||
if (repeat && !Array.isArray(value)) value = [value];
|
||
return (optional || param in dynamicMatches) && ( // Interpolate group into data URL if present
|
||
interpolatedRoute = interpolatedRoute.replace(replaced, repeat ? value.map( // these values should be fully encoded instead of just
|
||
// path delimiter escaped since they are being inserted
|
||
// into the URL and we expect URL encoded segments
|
||
// when parsing dynamic route params
|
||
segment => encodeURIComponent(segment)).join('/') : encodeURIComponent(value)) || '/');
|
||
})) {
|
||
interpolatedRoute = ''; // did not satisfy all requirements
|
||
// n.b. We ignore this error because we handle warning for this case in
|
||
// development in the `<Link>` component directly.
|
||
}
|
||
|
||
return {
|
||
params,
|
||
result: interpolatedRoute
|
||
};
|
||
}
|
||
|
||
function omitParmsFromQuery(query, params) {
|
||
const filteredQuery = {};
|
||
Object.keys(query).forEach(key => {
|
||
if (!params.includes(key)) {
|
||
filteredQuery[key] = query[key];
|
||
}
|
||
});
|
||
return filteredQuery;
|
||
}
|
||
/**
|
||
* Resolves a given hyperlink with a certain router state (basePath not included).
|
||
* Preserves absolute urls.
|
||
*/
|
||
|
||
|
||
function resolveHref(router, href, resolveAs) {
|
||
// we use a dummy base url for relative urls
|
||
let base;
|
||
const urlAsString = typeof href === 'string' ? href : (0, _utils.formatWithValidation)(href);
|
||
|
||
try {
|
||
base = new URL(urlAsString.startsWith('#') ? router.asPath : router.pathname, 'http://n');
|
||
} catch (_) {
|
||
// fallback to / for invalid asPath values e.g. //
|
||
base = new URL('/', 'http://n');
|
||
} // Return because it cannot be routed by the Next.js router
|
||
|
||
|
||
if (!isLocalURL(urlAsString)) {
|
||
return resolveAs ? [urlAsString] : urlAsString;
|
||
}
|
||
|
||
try {
|
||
const finalUrl = new URL(urlAsString, base);
|
||
finalUrl.pathname = (0, _normalizeTrailingSlash.normalizePathTrailingSlash)(finalUrl.pathname);
|
||
let interpolatedAs = '';
|
||
|
||
if ((0, _isDynamic.isDynamicRoute)(finalUrl.pathname) && finalUrl.searchParams && resolveAs) {
|
||
const query = (0, _querystring.searchParamsToUrlQuery)(finalUrl.searchParams);
|
||
const {
|
||
result,
|
||
params
|
||
} = interpolateAs(finalUrl.pathname, finalUrl.pathname, query);
|
||
|
||
if (result) {
|
||
interpolatedAs = (0, _utils.formatWithValidation)({
|
||
pathname: result,
|
||
hash: finalUrl.hash,
|
||
query: omitParmsFromQuery(query, params)
|
||
});
|
||
}
|
||
} // if the origin didn't change, it means we received a relative href
|
||
|
||
|
||
const resolvedHref = finalUrl.origin === base.origin ? finalUrl.href.slice(finalUrl.origin.length) : finalUrl.href;
|
||
return resolveAs ? [resolvedHref, interpolatedAs || resolvedHref] : resolvedHref;
|
||
} catch (_) {
|
||
return resolveAs ? [urlAsString] : urlAsString;
|
||
}
|
||
}
|
||
|
||
function stripOrigin(url) {
|
||
const origin = (0, _utils.getLocationOrigin)();
|
||
return url.startsWith(origin) ? url.substring(origin.length) : url;
|
||
}
|
||
|
||
function prepareUrlAs(router, url, as) {
|
||
// If url and as provided as an object representation,
|
||
// we'll format them into the string version here.
|
||
let [resolvedHref, resolvedAs] = resolveHref(router, url, true);
|
||
const origin = (0, _utils.getLocationOrigin)();
|
||
const hrefHadOrigin = resolvedHref.startsWith(origin);
|
||
const asHadOrigin = resolvedAs && resolvedAs.startsWith(origin);
|
||
resolvedHref = stripOrigin(resolvedHref);
|
||
resolvedAs = resolvedAs ? stripOrigin(resolvedAs) : resolvedAs;
|
||
const preparedUrl = hrefHadOrigin ? resolvedHref : addBasePath(resolvedHref);
|
||
const preparedAs = as ? stripOrigin(resolveHref(router, as)) : resolvedAs || resolvedHref;
|
||
return {
|
||
url: preparedUrl,
|
||
as: asHadOrigin ? preparedAs : addBasePath(preparedAs)
|
||
};
|
||
}
|
||
|
||
function resolveDynamicRoute(pathname, pages) {
|
||
const cleanPathname = (0, _normalizeTrailingSlash.removePathTrailingSlash)((0, _denormalizePagePath.denormalizePagePath)(pathname));
|
||
|
||
if (cleanPathname === '/404' || cleanPathname === '/_error') {
|
||
return pathname;
|
||
} // handle resolving href for dynamic routes
|
||
|
||
|
||
if (!pages.includes(cleanPathname)) {
|
||
// eslint-disable-next-line array-callback-return
|
||
pages.some(page => {
|
||
if ((0, _isDynamic.isDynamicRoute)(page) && (0, _routeRegex.getRouteRegex)(page).re.test(cleanPathname)) {
|
||
pathname = page;
|
||
return true;
|
||
}
|
||
});
|
||
}
|
||
|
||
return (0, _normalizeTrailingSlash.removePathTrailingSlash)(pathname);
|
||
}
|
||
|
||
const manualScrollRestoration = (/* unused pure expression or super */ null && ( false && 0));
|
||
const SSG_DATA_NOT_FOUND = Symbol('SSG_DATA_NOT_FOUND');
|
||
|
||
function fetchRetry(url, attempts) {
|
||
return fetch(url, {
|
||
// Cookies are required to be present for Next.js' SSG "Preview Mode".
|
||
// Cookies may also be required for `getServerSideProps`.
|
||
//
|
||
// > `fetch` won’t send cookies, unless you set the credentials init
|
||
// > option.
|
||
// https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
|
||
//
|
||
// > For maximum browser compatibility when it comes to sending &
|
||
// > receiving cookies, always supply the `credentials: 'same-origin'`
|
||
// > option instead of relying on the default.
|
||
// https://github.com/github/fetch#caveats
|
||
credentials: 'same-origin'
|
||
}).then(res => {
|
||
if (!res.ok) {
|
||
if (attempts > 1 && res.status >= 500) {
|
||
return fetchRetry(url, attempts - 1);
|
||
}
|
||
|
||
if (res.status === 404) {
|
||
return res.json().then(data => {
|
||
if (data.notFound) {
|
||
return {
|
||
notFound: SSG_DATA_NOT_FOUND
|
||
};
|
||
}
|
||
|
||
throw new Error(`Failed to load static props`);
|
||
});
|
||
}
|
||
|
||
throw new Error(`Failed to load static props`);
|
||
}
|
||
|
||
return res.json();
|
||
});
|
||
}
|
||
|
||
function fetchNextData(dataHref, isServerRender) {
|
||
return fetchRetry(dataHref, isServerRender ? 3 : 1).catch(err => {
|
||
// We should only trigger a server-side transition if this was caused
|
||
// on a client-side transition. Otherwise, we'd get into an infinite
|
||
// loop.
|
||
if (!isServerRender) {
|
||
(0, _routeLoader.markAssetError)(err);
|
||
}
|
||
|
||
throw err;
|
||
});
|
||
}
|
||
|
||
class Router {
|
||
/**
|
||
* Map of all components loaded in `Router`
|
||
*/
|
||
// Static Data Cache
|
||
// In-flight Server Data Requests, for deduping
|
||
constructor(_pathname, _query, _as, {
|
||
initialProps,
|
||
pageLoader,
|
||
App,
|
||
wrapApp,
|
||
Component,
|
||
err,
|
||
subscription,
|
||
isFallback,
|
||
locale,
|
||
locales,
|
||
defaultLocale,
|
||
domainLocales,
|
||
isPreview
|
||
}) {
|
||
this.route = void 0;
|
||
this.pathname = void 0;
|
||
this.query = void 0;
|
||
this.asPath = void 0;
|
||
this.basePath = void 0;
|
||
this.components = void 0;
|
||
this.sdc = {};
|
||
this.sdr = {};
|
||
this.sub = void 0;
|
||
this.clc = void 0;
|
||
this.pageLoader = void 0;
|
||
this._bps = void 0;
|
||
this.events = void 0;
|
||
this._wrapApp = void 0;
|
||
this.isSsr = void 0;
|
||
this.isFallback = void 0;
|
||
this._inFlightRoute = void 0;
|
||
this._shallow = void 0;
|
||
this.locale = void 0;
|
||
this.locales = void 0;
|
||
this.defaultLocale = void 0;
|
||
this.domainLocales = void 0;
|
||
this.isReady = void 0;
|
||
this.isPreview = void 0;
|
||
this.isLocaleDomain = void 0;
|
||
this._idx = 0;
|
||
|
||
this.onPopState = e => {
|
||
const state = e.state;
|
||
|
||
if (!state) {
|
||
// We get state as undefined for two reasons.
|
||
// 1. With older safari (< 8) and older chrome (< 34)
|
||
// 2. When the URL changed with #
|
||
//
|
||
// In the both cases, we don't need to proceed and change the route.
|
||
// (as it's already changed)
|
||
// But we can simply replace the state with the new changes.
|
||
// Actually, for (1) we don't need to nothing. But it's hard to detect that event.
|
||
// So, doing the following for (1) does no harm.
|
||
const {
|
||
pathname,
|
||
query
|
||
} = this;
|
||
this.changeState('replaceState', (0, _utils.formatWithValidation)({
|
||
pathname: addBasePath(pathname),
|
||
query
|
||
}), (0, _utils.getURL)());
|
||
return;
|
||
}
|
||
|
||
if (!state.__N) {
|
||
return;
|
||
}
|
||
|
||
let forcedScroll;
|
||
const {
|
||
url,
|
||
as,
|
||
options,
|
||
idx
|
||
} = state;
|
||
|
||
if (false) {}
|
||
|
||
this._idx = idx;
|
||
const {
|
||
pathname
|
||
} = (0, _parseRelativeUrl.parseRelativeUrl)(url); // Make sure we don't re-render on initial load,
|
||
// can be caused by navigating back from an external site
|
||
|
||
if (this.isSsr && as === this.asPath && pathname === this.pathname) {
|
||
return;
|
||
} // If the downstream application returns falsy, return.
|
||
// They will then be responsible for handling the event.
|
||
|
||
|
||
if (this._bps && !this._bps(state)) {
|
||
return;
|
||
}
|
||
|
||
this.change('replaceState', url, as, Object.assign({}, options, {
|
||
shallow: options.shallow && this._shallow,
|
||
locale: options.locale || this.defaultLocale
|
||
}), forcedScroll);
|
||
}; // represents the current component key
|
||
|
||
|
||
this.route = (0, _normalizeTrailingSlash.removePathTrailingSlash)(_pathname); // set up the component cache (by route keys)
|
||
|
||
this.components = {}; // We should not keep the cache, if there's an error
|
||
// Otherwise, this cause issues when when going back and
|
||
// come again to the errored page.
|
||
|
||
if (_pathname !== '/_error') {
|
||
this.components[this.route] = {
|
||
Component,
|
||
initial: true,
|
||
props: initialProps,
|
||
err,
|
||
__N_SSG: initialProps && initialProps.__N_SSG,
|
||
__N_SSP: initialProps && initialProps.__N_SSP
|
||
};
|
||
}
|
||
|
||
this.components['/_app'] = {
|
||
Component: App,
|
||
styleSheets: [
|
||
/* /_app does not need its stylesheets managed */
|
||
]
|
||
}; // Backwards compat for Router.router.events
|
||
// TODO: Should be remove the following major version as it was never documented
|
||
|
||
this.events = Router.events;
|
||
this.pageLoader = pageLoader;
|
||
this.pathname = _pathname;
|
||
this.query = _query; // if auto prerendered and dynamic route wait to update asPath
|
||
// until after mount to prevent hydration mismatch
|
||
|
||
const autoExportDynamic = (0, _isDynamic.isDynamicRoute)(_pathname) && self.__NEXT_DATA__.autoExport;
|
||
|
||
this.asPath = autoExportDynamic ? _pathname : _as;
|
||
this.basePath = basePath;
|
||
this.sub = subscription;
|
||
this.clc = null;
|
||
this._wrapApp = wrapApp; // make sure to ignore extra popState in safari on navigating
|
||
// back from external site
|
||
|
||
this.isSsr = true;
|
||
this.isFallback = isFallback;
|
||
this.isReady = !!(self.__NEXT_DATA__.gssp || self.__NEXT_DATA__.gip || !autoExportDynamic && !self.location.search && !false);
|
||
this.isPreview = !!isPreview;
|
||
this.isLocaleDomain = false;
|
||
|
||
if (false) {}
|
||
|
||
if (false) {}
|
||
}
|
||
|
||
reload() {
|
||
window.location.reload();
|
||
}
|
||
/**
|
||
* Go back in history
|
||
*/
|
||
|
||
|
||
back() {
|
||
window.history.back();
|
||
}
|
||
/**
|
||
* Performs a `pushState` with arguments
|
||
* @param url of the route
|
||
* @param as masks `url` for the browser
|
||
* @param options object you can define `shallow` and other options
|
||
*/
|
||
|
||
|
||
push(url, as, options = {}) {
|
||
if (false) {}
|
||
|
||
;
|
||
({
|
||
url,
|
||
as
|
||
} = prepareUrlAs(this, url, as));
|
||
return this.change('pushState', url, as, options);
|
||
}
|
||
/**
|
||
* Performs a `replaceState` with arguments
|
||
* @param url of the route
|
||
* @param as masks `url` for the browser
|
||
* @param options object you can define `shallow` and other options
|
||
*/
|
||
|
||
|
||
replace(url, as, options = {}) {
|
||
;
|
||
({
|
||
url,
|
||
as
|
||
} = prepareUrlAs(this, url, as));
|
||
return this.change('replaceState', url, as, options);
|
||
}
|
||
|
||
async change(method, url, as, options, forcedScroll) {
|
||
if (!isLocalURL(url)) {
|
||
window.location.href = url;
|
||
return false;
|
||
}
|
||
|
||
const shouldResolveHref = url === as || options._h || options._shouldResolveHref; // for static pages with query params in the URL we delay
|
||
// marking the router ready until after the query is updated
|
||
|
||
if (options._h) {
|
||
this.isReady = true;
|
||
}
|
||
|
||
let localeChange = options.locale !== this.locale;
|
||
|
||
if (false) { var _this$locales; }
|
||
|
||
if (!options._h) {
|
||
this.isSsr = false;
|
||
} // marking route changes as a navigation start entry
|
||
|
||
|
||
if (_utils.ST) {
|
||
performance.mark('routeChange');
|
||
}
|
||
|
||
const {
|
||
shallow = false
|
||
} = options;
|
||
const routeProps = {
|
||
shallow
|
||
};
|
||
|
||
if (this._inFlightRoute) {
|
||
this.abortComponentLoad(this._inFlightRoute, routeProps);
|
||
}
|
||
|
||
as = addBasePath(addLocale(hasBasePath(as) ? delBasePath(as) : as, options.locale, this.defaultLocale));
|
||
const cleanedAs = delLocale(hasBasePath(as) ? delBasePath(as) : as, this.locale);
|
||
this._inFlightRoute = as; // If the url change is only related to a hash change
|
||
// We should not proceed. We should only change the state.
|
||
// WARNING: `_h` is an internal option for handing Next.js client-side
|
||
// hydration. Your app should _never_ use this property. It may change at
|
||
// any time without notice.
|
||
|
||
if (!options._h && this.onlyAHashChange(cleanedAs)) {
|
||
this.asPath = cleanedAs;
|
||
Router.events.emit('hashChangeStart', as, routeProps); // TODO: do we need the resolved href when only a hash change?
|
||
|
||
this.changeState(method, url, as, options);
|
||
this.scrollToHash(cleanedAs);
|
||
this.notify(this.components[this.route], null);
|
||
Router.events.emit('hashChangeComplete', as, routeProps);
|
||
return true;
|
||
}
|
||
|
||
let parsed = (0, _parseRelativeUrl.parseRelativeUrl)(url);
|
||
let {
|
||
pathname,
|
||
query
|
||
} = parsed; // The build manifest needs to be loaded before auto-static dynamic pages
|
||
// get their query parameters to allow ensuring they can be parsed properly
|
||
// when rewritten to
|
||
|
||
let pages, rewrites;
|
||
|
||
try {
|
||
pages = await this.pageLoader.getPageList();
|
||
({
|
||
__rewrites: rewrites
|
||
} = await (0, _routeLoader.getClientBuildManifest)());
|
||
} catch (err) {
|
||
// If we fail to resolve the page list or client-build manifest, we must
|
||
// do a server-side transition:
|
||
window.location.href = as;
|
||
return false;
|
||
} // If asked to change the current URL we should reload the current page
|
||
// (not location.reload() but reload getInitialProps and other Next.js stuffs)
|
||
// We also need to set the method = replaceState always
|
||
// as this should not go into the history (That's how browsers work)
|
||
// We should compare the new asPath to the current asPath, not the url
|
||
|
||
|
||
if (!this.urlIsNew(cleanedAs) && !localeChange) {
|
||
method = 'replaceState';
|
||
} // we need to resolve the as value using rewrites for dynamic SSG
|
||
// pages to allow building the data URL correctly
|
||
|
||
|
||
let resolvedAs = as; // url and as should always be prefixed with basePath by this
|
||
// point by either next/link or router.push/replace so strip the
|
||
// basePath from the pathname to match the pages dir 1-to-1
|
||
|
||
pathname = pathname ? (0, _normalizeTrailingSlash.removePathTrailingSlash)(delBasePath(pathname)) : pathname;
|
||
|
||
if (shouldResolveHref && pathname !== '/_error') {
|
||
;
|
||
options._shouldResolveHref = true;
|
||
|
||
if (false) {} else {
|
||
parsed.pathname = resolveDynamicRoute(pathname, pages);
|
||
|
||
if (parsed.pathname !== pathname) {
|
||
pathname = parsed.pathname;
|
||
parsed.pathname = addBasePath(pathname);
|
||
url = (0, _utils.formatWithValidation)(parsed);
|
||
}
|
||
}
|
||
}
|
||
|
||
const route = (0, _normalizeTrailingSlash.removePathTrailingSlash)(pathname);
|
||
|
||
if (!isLocalURL(as)) {
|
||
if (false) {}
|
||
|
||
window.location.href = as;
|
||
return false;
|
||
}
|
||
|
||
resolvedAs = delLocale(delBasePath(resolvedAs), this.locale);
|
||
|
||
if ((0, _isDynamic.isDynamicRoute)(route)) {
|
||
const parsedAs = (0, _parseRelativeUrl.parseRelativeUrl)(resolvedAs);
|
||
const asPathname = parsedAs.pathname;
|
||
const routeRegex = (0, _routeRegex.getRouteRegex)(route);
|
||
const routeMatch = (0, _routeMatcher.getRouteMatcher)(routeRegex)(asPathname);
|
||
const shouldInterpolate = route === asPathname;
|
||
const interpolatedAs = shouldInterpolate ? interpolateAs(route, asPathname, query) : {};
|
||
|
||
if (!routeMatch || shouldInterpolate && !interpolatedAs.result) {
|
||
const missingParams = Object.keys(routeRegex.groups).filter(param => !query[param]);
|
||
|
||
if (missingParams.length > 0) {
|
||
if (false) {}
|
||
|
||
throw new Error((shouldInterpolate ? `The provided \`href\` (${url}) value is missing query values (${missingParams.join(', ')}) to be interpolated properly. ` : `The provided \`as\` value (${asPathname}) is incompatible with the \`href\` value (${route}). `) + `Read more: https://nextjs.org/docs/messages/${shouldInterpolate ? 'href-interpolation-failed' : 'incompatible-href-as'}`);
|
||
}
|
||
} else if (shouldInterpolate) {
|
||
as = (0, _utils.formatWithValidation)(Object.assign({}, parsedAs, {
|
||
pathname: interpolatedAs.result,
|
||
query: omitParmsFromQuery(query, interpolatedAs.params)
|
||
}));
|
||
} else {
|
||
// Merge params into `query`, overwriting any specified in search
|
||
Object.assign(query, routeMatch);
|
||
}
|
||
}
|
||
|
||
Router.events.emit('routeChangeStart', as, routeProps);
|
||
|
||
try {
|
||
var _self$__NEXT_DATA__$p, _self$__NEXT_DATA__$p2, _options$scroll;
|
||
|
||
let routeInfo = await this.getRouteInfo(route, pathname, query, as, resolvedAs, routeProps);
|
||
let {
|
||
error,
|
||
props,
|
||
__N_SSG,
|
||
__N_SSP
|
||
} = routeInfo; // handle redirect on client-transition
|
||
|
||
if ((__N_SSG || __N_SSP) && props) {
|
||
if (props.pageProps && props.pageProps.__N_REDIRECT) {
|
||
const destination = props.pageProps.__N_REDIRECT; // check if destination is internal (resolves to a page) and attempt
|
||
// client-navigation if it is falling back to hard navigation if
|
||
// it's not
|
||
|
||
if (destination.startsWith('/')) {
|
||
const parsedHref = (0, _parseRelativeUrl.parseRelativeUrl)(destination);
|
||
parsedHref.pathname = resolveDynamicRoute(parsedHref.pathname, pages);
|
||
|
||
if (pages.includes(parsedHref.pathname)) {
|
||
const {
|
||
url: newUrl,
|
||
as: newAs
|
||
} = prepareUrlAs(this, destination, destination);
|
||
return this.change(method, newUrl, newAs, options);
|
||
}
|
||
}
|
||
|
||
window.location.href = destination;
|
||
return new Promise(() => {});
|
||
}
|
||
|
||
this.isPreview = !!props.__N_PREVIEW; // handle SSG data 404
|
||
|
||
if (props.notFound === SSG_DATA_NOT_FOUND) {
|
||
let notFoundRoute;
|
||
|
||
try {
|
||
await this.fetchComponent('/404');
|
||
notFoundRoute = '/404';
|
||
} catch (_) {
|
||
notFoundRoute = '/_error';
|
||
}
|
||
|
||
routeInfo = await this.getRouteInfo(notFoundRoute, notFoundRoute, query, as, resolvedAs, {
|
||
shallow: false
|
||
});
|
||
}
|
||
}
|
||
|
||
Router.events.emit('beforeHistoryChange', as, routeProps);
|
||
this.changeState(method, url, as, options);
|
||
|
||
if (false) {}
|
||
|
||
if (options._h && pathname === '/_error' && ((_self$__NEXT_DATA__$p = self.__NEXT_DATA__.props) == null ? void 0 : (_self$__NEXT_DATA__$p2 = _self$__NEXT_DATA__$p.pageProps) == null ? void 0 : _self$__NEXT_DATA__$p2.statusCode) === 500 && props != null && props.pageProps) {
|
||
// ensure statusCode is still correct for static 500 page
|
||
// when updating query information
|
||
props.pageProps.statusCode = 500;
|
||
} // shallow routing is only allowed for same page URL changes.
|
||
|
||
|
||
const isValidShallowRoute = options.shallow && this.route === route;
|
||
const shouldScroll = (_options$scroll = options.scroll) != null ? _options$scroll : !isValidShallowRoute;
|
||
const resetScroll = shouldScroll ? {
|
||
x: 0,
|
||
y: 0
|
||
} : null;
|
||
await this.set(route, pathname, query, cleanedAs, routeInfo, forcedScroll != null ? forcedScroll : resetScroll).catch(e => {
|
||
if (e.cancelled) error = error || e;else throw e;
|
||
});
|
||
|
||
if (error) {
|
||
Router.events.emit('routeChangeError', error, cleanedAs, routeProps);
|
||
throw error;
|
||
}
|
||
|
||
if (false) {}
|
||
|
||
Router.events.emit('routeChangeComplete', as, routeProps);
|
||
return true;
|
||
} catch (err) {
|
||
if (err.cancelled) {
|
||
return false;
|
||
}
|
||
|
||
throw err;
|
||
}
|
||
}
|
||
|
||
changeState(method, url, as, options = {}) {
|
||
if (false) {}
|
||
|
||
if (method !== 'pushState' || (0, _utils.getURL)() !== as) {
|
||
this._shallow = options.shallow;
|
||
window.history[method]({
|
||
url,
|
||
as,
|
||
options,
|
||
__N: true,
|
||
idx: this._idx = method !== 'pushState' ? this._idx : this._idx + 1
|
||
}, // Most browsers currently ignores this parameter, although they may use it in the future.
|
||
// Passing the empty string here should be safe against future changes to the method.
|
||
// https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState
|
||
'', as);
|
||
}
|
||
}
|
||
|
||
async handleRouteInfoError(err, pathname, query, as, routeProps, loadErrorFail) {
|
||
if (err.cancelled) {
|
||
// bubble up cancellation errors
|
||
throw err;
|
||
}
|
||
|
||
if ((0, _routeLoader.isAssetError)(err) || loadErrorFail) {
|
||
Router.events.emit('routeChangeError', err, as, routeProps); // If we can't load the page it could be one of following reasons
|
||
// 1. Page doesn't exists
|
||
// 2. Page does exist in a different zone
|
||
// 3. Internal error while loading the page
|
||
// So, doing a hard reload is the proper way to deal with this.
|
||
|
||
window.location.href = as; // Changing the URL doesn't block executing the current code path.
|
||
// So let's throw a cancellation error stop the routing logic.
|
||
|
||
throw buildCancellationError();
|
||
}
|
||
|
||
try {
|
||
let Component;
|
||
let styleSheets;
|
||
let props;
|
||
|
||
if (typeof Component === 'undefined' || typeof styleSheets === 'undefined') {
|
||
;
|
||
({
|
||
page: Component,
|
||
styleSheets
|
||
} = await this.fetchComponent('/_error'));
|
||
}
|
||
|
||
const routeInfo = {
|
||
props,
|
||
Component,
|
||
styleSheets,
|
||
err,
|
||
error: err
|
||
};
|
||
|
||
if (!routeInfo.props) {
|
||
try {
|
||
routeInfo.props = await this.getInitialProps(Component, {
|
||
err,
|
||
pathname,
|
||
query
|
||
});
|
||
} catch (gipErr) {
|
||
console.error('Error in error page `getInitialProps`: ', gipErr);
|
||
routeInfo.props = {};
|
||
}
|
||
}
|
||
|
||
return routeInfo;
|
||
} catch (routeInfoErr) {
|
||
return this.handleRouteInfoError(routeInfoErr, pathname, query, as, routeProps, true);
|
||
}
|
||
}
|
||
|
||
async getRouteInfo(route, pathname, query, as, resolvedAs, routeProps) {
|
||
try {
|
||
const existingRouteInfo = this.components[route];
|
||
|
||
if (routeProps.shallow && existingRouteInfo && this.route === route) {
|
||
return existingRouteInfo;
|
||
}
|
||
|
||
const cachedRouteInfo = existingRouteInfo && 'initial' in existingRouteInfo ? undefined : existingRouteInfo;
|
||
const routeInfo = cachedRouteInfo ? cachedRouteInfo : await this.fetchComponent(route).then(res => ({
|
||
Component: res.page,
|
||
styleSheets: res.styleSheets,
|
||
__N_SSG: res.mod.__N_SSG,
|
||
__N_SSP: res.mod.__N_SSP
|
||
}));
|
||
const {
|
||
Component,
|
||
__N_SSG,
|
||
__N_SSP
|
||
} = routeInfo;
|
||
|
||
if (false) {}
|
||
|
||
let dataHref;
|
||
|
||
if (__N_SSG || __N_SSP) {
|
||
dataHref = this.pageLoader.getDataHref((0, _utils.formatWithValidation)({
|
||
pathname,
|
||
query
|
||
}), resolvedAs, __N_SSG, this.locale);
|
||
}
|
||
|
||
const props = await this._getData(() => __N_SSG ? this._getStaticData(dataHref) : __N_SSP ? this._getServerData(dataHref) : this.getInitialProps(Component, // we provide AppTree later so this needs to be `any`
|
||
{
|
||
pathname,
|
||
query,
|
||
asPath: as,
|
||
locale: this.locale,
|
||
locales: this.locales,
|
||
defaultLocale: this.defaultLocale
|
||
}));
|
||
routeInfo.props = props;
|
||
this.components[route] = routeInfo;
|
||
return routeInfo;
|
||
} catch (err) {
|
||
return this.handleRouteInfoError(err, pathname, query, as, routeProps);
|
||
}
|
||
}
|
||
|
||
set(route, pathname, query, as, data, resetScroll) {
|
||
this.isFallback = false;
|
||
this.route = route;
|
||
this.pathname = pathname;
|
||
this.query = query;
|
||
this.asPath = as;
|
||
return this.notify(data, resetScroll);
|
||
}
|
||
/**
|
||
* Callback to execute before replacing router state
|
||
* @param cb callback to be executed
|
||
*/
|
||
|
||
|
||
beforePopState(cb) {
|
||
this._bps = cb;
|
||
}
|
||
|
||
onlyAHashChange(as) {
|
||
if (!this.asPath) return false;
|
||
const [oldUrlNoHash, oldHash] = this.asPath.split('#');
|
||
const [newUrlNoHash, newHash] = as.split('#'); // Makes sure we scroll to the provided hash if the url/hash are the same
|
||
|
||
if (newHash && oldUrlNoHash === newUrlNoHash && oldHash === newHash) {
|
||
return true;
|
||
} // If the urls are change, there's more than a hash change
|
||
|
||
|
||
if (oldUrlNoHash !== newUrlNoHash) {
|
||
return false;
|
||
} // If the hash has changed, then it's a hash only change.
|
||
// This check is necessary to handle both the enter and
|
||
// leave hash === '' cases. The identity case falls through
|
||
// and is treated as a next reload.
|
||
|
||
|
||
return oldHash !== newHash;
|
||
}
|
||
|
||
scrollToHash(as) {
|
||
const [, hash] = as.split('#'); // Scroll to top if the hash is just `#` with no value or `#top`
|
||
// To mirror browsers
|
||
|
||
if (hash === '' || hash === 'top') {
|
||
window.scrollTo(0, 0);
|
||
return;
|
||
} // First we check if the element by id is found
|
||
|
||
|
||
const idEl = document.getElementById(hash);
|
||
|
||
if (idEl) {
|
||
idEl.scrollIntoView();
|
||
return;
|
||
} // If there's no element with the id, we check the `name` property
|
||
// To mirror browsers
|
||
|
||
|
||
const nameEl = document.getElementsByName(hash)[0];
|
||
|
||
if (nameEl) {
|
||
nameEl.scrollIntoView();
|
||
}
|
||
}
|
||
|
||
urlIsNew(asPath) {
|
||
return this.asPath !== asPath;
|
||
}
|
||
/**
|
||
* Prefetch page code, you may wait for the data during page rendering.
|
||
* This feature only works in production!
|
||
* @param url the href of prefetched page
|
||
* @param asPath the as path of the prefetched page
|
||
*/
|
||
|
||
|
||
async prefetch(url, asPath = url, options = {}) {
|
||
let parsed = (0, _parseRelativeUrl.parseRelativeUrl)(url);
|
||
let {
|
||
pathname
|
||
} = parsed;
|
||
|
||
if (false) {}
|
||
|
||
const pages = await this.pageLoader.getPageList();
|
||
let resolvedAs = asPath;
|
||
|
||
if (false) {} else {
|
||
parsed.pathname = resolveDynamicRoute(parsed.pathname, pages);
|
||
|
||
if (parsed.pathname !== pathname) {
|
||
pathname = parsed.pathname;
|
||
parsed.pathname = pathname;
|
||
url = (0, _utils.formatWithValidation)(parsed);
|
||
}
|
||
}
|
||
|
||
const route = (0, _normalizeTrailingSlash.removePathTrailingSlash)(pathname); // Prefetch is not supported in development mode because it would trigger on-demand-entries
|
||
|
||
if (false) {}
|
||
|
||
await Promise.all([this.pageLoader._isSsg(route).then(isSsg => {
|
||
return isSsg ? this._getStaticData(this.pageLoader.getDataHref(url, resolvedAs, true, typeof options.locale !== 'undefined' ? options.locale : this.locale)) : false;
|
||
}), this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](route)]);
|
||
}
|
||
|
||
async fetchComponent(route) {
|
||
let cancelled = false;
|
||
|
||
const cancel = this.clc = () => {
|
||
cancelled = true;
|
||
};
|
||
|
||
const componentResult = await this.pageLoader.loadPage(route);
|
||
|
||
if (cancelled) {
|
||
const error = new Error(`Abort fetching component for route: "${route}"`);
|
||
error.cancelled = true;
|
||
throw error;
|
||
}
|
||
|
||
if (cancel === this.clc) {
|
||
this.clc = null;
|
||
}
|
||
|
||
return componentResult;
|
||
}
|
||
|
||
_getData(fn) {
|
||
let cancelled = false;
|
||
|
||
const cancel = () => {
|
||
cancelled = true;
|
||
};
|
||
|
||
this.clc = cancel;
|
||
return fn().then(data => {
|
||
if (cancel === this.clc) {
|
||
this.clc = null;
|
||
}
|
||
|
||
if (cancelled) {
|
||
const err = new Error('Loading initial props cancelled');
|
||
err.cancelled = true;
|
||
throw err;
|
||
}
|
||
|
||
return data;
|
||
});
|
||
}
|
||
|
||
_getStaticData(dataHref) {
|
||
const {
|
||
href: cacheKey
|
||
} = new URL(dataHref, window.location.href);
|
||
|
||
if ( true && !this.isPreview && this.sdc[cacheKey]) {
|
||
return Promise.resolve(this.sdc[cacheKey]);
|
||
}
|
||
|
||
return fetchNextData(dataHref, this.isSsr).then(data => {
|
||
this.sdc[cacheKey] = data;
|
||
return data;
|
||
});
|
||
}
|
||
|
||
_getServerData(dataHref) {
|
||
const {
|
||
href: resourceKey
|
||
} = new URL(dataHref, window.location.href);
|
||
|
||
if (this.sdr[resourceKey]) {
|
||
return this.sdr[resourceKey];
|
||
}
|
||
|
||
return this.sdr[resourceKey] = fetchNextData(dataHref, this.isSsr).then(data => {
|
||
delete this.sdr[resourceKey];
|
||
return data;
|
||
}).catch(err => {
|
||
delete this.sdr[resourceKey];
|
||
throw err;
|
||
});
|
||
}
|
||
|
||
getInitialProps(Component, ctx) {
|
||
const {
|
||
Component: App
|
||
} = this.components['/_app'];
|
||
|
||
const AppTree = this._wrapApp(App);
|
||
|
||
ctx.AppTree = AppTree;
|
||
return (0, _utils.loadGetInitialProps)(App, {
|
||
AppTree,
|
||
Component,
|
||
router: this,
|
||
ctx
|
||
});
|
||
}
|
||
|
||
abortComponentLoad(as, routeProps) {
|
||
if (this.clc) {
|
||
Router.events.emit('routeChangeError', buildCancellationError(), as, routeProps);
|
||
this.clc();
|
||
this.clc = null;
|
||
}
|
||
}
|
||
|
||
notify(data, resetScroll) {
|
||
return this.sub(data, this.components['/_app'].Component, resetScroll);
|
||
}
|
||
|
||
}
|
||
|
||
exports.default = Router;
|
||
Router.events = (0, _mitt.default)();
|
||
|
||
/***/ }),
|
||
|
||
/***/ 2960:
|
||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.formatUrl = formatUrl;
|
||
|
||
var querystring = _interopRequireWildcard(__webpack_require__(8187));
|
||
|
||
function _getRequireWildcardCache() {
|
||
if (typeof WeakMap !== "function") return null;
|
||
var cache = new WeakMap();
|
||
|
||
_getRequireWildcardCache = function () {
|
||
return cache;
|
||
};
|
||
|
||
return cache;
|
||
}
|
||
|
||
function _interopRequireWildcard(obj) {
|
||
if (obj && obj.__esModule) {
|
||
return obj;
|
||
}
|
||
|
||
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
||
return {
|
||
default: obj
|
||
};
|
||
}
|
||
|
||
var cache = _getRequireWildcardCache();
|
||
|
||
if (cache && cache.has(obj)) {
|
||
return cache.get(obj);
|
||
}
|
||
|
||
var newObj = {};
|
||
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||
|
||
for (var key in obj) {
|
||
if (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;
|
||
} // Format function modified from nodejs
|
||
// Copyright Joyent, Inc. and other Node contributors.
|
||
//
|
||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||
// copy of this software and associated documentation files (the
|
||
// "Software"), to deal in the Software without restriction, including
|
||
// without limitation the rights to use, copy, modify, merge, publish,
|
||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||
// persons to whom the Software is furnished to do so, subject to the
|
||
// following conditions:
|
||
//
|
||
// The above copyright notice and this permission notice shall be included
|
||
// in all copies or substantial portions of the Software.
|
||
//
|
||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||
|
||
|
||
const slashedProtocols = /https?|ftp|gopher|file/;
|
||
|
||
function formatUrl(urlObj) {
|
||
let {
|
||
auth,
|
||
hostname
|
||
} = urlObj;
|
||
let protocol = urlObj.protocol || '';
|
||
let pathname = urlObj.pathname || '';
|
||
let hash = urlObj.hash || '';
|
||
let query = urlObj.query || '';
|
||
let host = false;
|
||
auth = auth ? encodeURIComponent(auth).replace(/%3A/i, ':') + '@' : '';
|
||
|
||
if (urlObj.host) {
|
||
host = auth + urlObj.host;
|
||
} else if (hostname) {
|
||
host = auth + (~hostname.indexOf(':') ? `[${hostname}]` : hostname);
|
||
|
||
if (urlObj.port) {
|
||
host += ':' + urlObj.port;
|
||
}
|
||
}
|
||
|
||
if (query && typeof query === 'object') {
|
||
query = String(querystring.urlQueryToSearchParams(query));
|
||
}
|
||
|
||
let search = urlObj.search || query && `?${query}` || '';
|
||
if (protocol && protocol.substr(-1) !== ':') protocol += ':';
|
||
|
||
if (urlObj.slashes || (!protocol || slashedProtocols.test(protocol)) && host !== false) {
|
||
host = '//' + (host || '');
|
||
if (pathname && pathname[0] !== '/') pathname = '/' + pathname;
|
||
} else if (!host) {
|
||
host = '';
|
||
}
|
||
|
||
if (hash && hash[0] !== '#') hash = '#' + hash;
|
||
if (search && search[0] !== '?') search = '?' + search;
|
||
pathname = pathname.replace(/[?#]/g, encodeURIComponent);
|
||
search = search.replace('#', '%23');
|
||
return `${protocol}${host}${pathname}${search}${hash}`;
|
||
}
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8073:
|
||
/***/ (function(__unused_webpack_module, exports) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.isDynamicRoute = isDynamicRoute; // Identify /[param]/ in route string
|
||
|
||
const TEST_ROUTE = /\/\[[^/]+?\](?=\/|$)/;
|
||
|
||
function isDynamicRoute(route) {
|
||
return TEST_ROUTE.test(route);
|
||
}
|
||
|
||
/***/ }),
|
||
|
||
/***/ 3900:
|
||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.parseRelativeUrl = parseRelativeUrl;
|
||
|
||
var _utils = __webpack_require__(4755);
|
||
|
||
var _querystring = __webpack_require__(8187);
|
||
/**
|
||
* Parses path-relative urls (e.g. `/hello/world?foo=bar`). If url isn't path-relative
|
||
* (e.g. `./hello`) then at least base must be.
|
||
* Absolute urls are rejected with one exception, in the browser, absolute urls that are on
|
||
* the current origin will be parsed as relative
|
||
*/
|
||
|
||
|
||
function parseRelativeUrl(url, base) {
|
||
const globalBase = new URL( true ? 'http://n' : 0);
|
||
const resolvedBase = base ? new URL(base, globalBase) : globalBase;
|
||
const {
|
||
pathname,
|
||
searchParams,
|
||
search,
|
||
hash,
|
||
href,
|
||
origin
|
||
} = new URL(url, resolvedBase);
|
||
|
||
if (origin !== globalBase.origin) {
|
||
throw new Error(`invariant: invalid relative URL, router received ${url}`);
|
||
}
|
||
|
||
return {
|
||
pathname,
|
||
query: (0, _querystring.searchParamsToUrlQuery)(searchParams),
|
||
search,
|
||
hash,
|
||
href: href.slice(globalBase.origin.length)
|
||
};
|
||
}
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8187:
|
||
/***/ (function(__unused_webpack_module, exports) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.searchParamsToUrlQuery = searchParamsToUrlQuery;
|
||
exports.urlQueryToSearchParams = urlQueryToSearchParams;
|
||
exports.assign = assign;
|
||
|
||
function searchParamsToUrlQuery(searchParams) {
|
||
const query = {};
|
||
searchParams.forEach((value, key) => {
|
||
if (typeof query[key] === 'undefined') {
|
||
query[key] = value;
|
||
} else if (Array.isArray(query[key])) {
|
||
;
|
||
query[key].push(value);
|
||
} else {
|
||
query[key] = [query[key], value];
|
||
}
|
||
});
|
||
return query;
|
||
}
|
||
|
||
function stringifyUrlQueryParam(param) {
|
||
if (typeof param === 'string' || typeof param === 'number' && !isNaN(param) || typeof param === 'boolean') {
|
||
return String(param);
|
||
} else {
|
||
return '';
|
||
}
|
||
}
|
||
|
||
function urlQueryToSearchParams(urlQuery) {
|
||
const result = new URLSearchParams();
|
||
Object.entries(urlQuery).forEach(([key, value]) => {
|
||
if (Array.isArray(value)) {
|
||
value.forEach(item => result.append(key, stringifyUrlQueryParam(item)));
|
||
} else {
|
||
result.set(key, stringifyUrlQueryParam(value));
|
||
}
|
||
});
|
||
return result;
|
||
}
|
||
|
||
function assign(target, ...searchParamsList) {
|
||
searchParamsList.forEach(searchParams => {
|
||
Array.from(searchParams.keys()).forEach(key => target.delete(key));
|
||
searchParams.forEach((value, key) => target.append(key, value));
|
||
});
|
||
return target;
|
||
}
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8085:
|
||
/***/ (function(__unused_webpack_module, exports) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.getRouteMatcher = getRouteMatcher;
|
||
|
||
function getRouteMatcher(routeRegex) {
|
||
const {
|
||
re,
|
||
groups
|
||
} = routeRegex;
|
||
return pathname => {
|
||
const routeMatch = re.exec(pathname);
|
||
|
||
if (!routeMatch) {
|
||
return false;
|
||
}
|
||
|
||
const decode = param => {
|
||
try {
|
||
return decodeURIComponent(param);
|
||
} catch (_) {
|
||
const err = new Error('failed to decode param');
|
||
err.code = 'DECODE_FAILED';
|
||
throw err;
|
||
}
|
||
};
|
||
|
||
const params = {};
|
||
Object.keys(groups).forEach(slugName => {
|
||
const g = groups[slugName];
|
||
const m = routeMatch[g.pos];
|
||
|
||
if (m !== undefined) {
|
||
params[slugName] = ~m.indexOf('/') ? m.split('/').map(entry => decode(entry)) : g.repeat ? [decode(m)] : decode(m);
|
||
}
|
||
});
|
||
return params;
|
||
};
|
||
}
|
||
|
||
/***/ }),
|
||
|
||
/***/ 4550:
|
||
/***/ (function(__unused_webpack_module, exports) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.getRouteRegex = getRouteRegex; // this isn't importing the escape-string-regex module
|
||
// to reduce bytes
|
||
|
||
function escapeRegex(str) {
|
||
return str.replace(/[|\\{}()[\]^$+*?.-]/g, '\\$&');
|
||
}
|
||
|
||
function parseParameter(param) {
|
||
const optional = param.startsWith('[') && param.endsWith(']');
|
||
|
||
if (optional) {
|
||
param = param.slice(1, -1);
|
||
}
|
||
|
||
const repeat = param.startsWith('...');
|
||
|
||
if (repeat) {
|
||
param = param.slice(3);
|
||
}
|
||
|
||
return {
|
||
key: param,
|
||
repeat,
|
||
optional
|
||
};
|
||
}
|
||
|
||
function getRouteRegex(normalizedRoute) {
|
||
const segments = (normalizedRoute.replace(/\/$/, '') || '/').slice(1).split('/');
|
||
const groups = {};
|
||
let groupIndex = 1;
|
||
const parameterizedRoute = segments.map(segment => {
|
||
if (segment.startsWith('[') && segment.endsWith(']')) {
|
||
const {
|
||
key,
|
||
optional,
|
||
repeat
|
||
} = parseParameter(segment.slice(1, -1));
|
||
groups[key] = {
|
||
pos: groupIndex++,
|
||
repeat,
|
||
optional
|
||
};
|
||
return repeat ? optional ? '(?:/(.+?))?' : '/(.+?)' : '/([^/]+?)';
|
||
} else {
|
||
return `/${escapeRegex(segment)}`;
|
||
}
|
||
}).join(''); // dead code eliminate for browser since it's only needed
|
||
// while generating routes-manifest
|
||
|
||
if (true) {
|
||
let routeKeyCharCode = 97;
|
||
let routeKeyCharLength = 1; // builds a minimal routeKey using only a-z and minimal number of characters
|
||
|
||
const getSafeRouteKey = () => {
|
||
let routeKey = '';
|
||
|
||
for (let i = 0; i < routeKeyCharLength; i++) {
|
||
routeKey += String.fromCharCode(routeKeyCharCode);
|
||
routeKeyCharCode++;
|
||
|
||
if (routeKeyCharCode > 122) {
|
||
routeKeyCharLength++;
|
||
routeKeyCharCode = 97;
|
||
}
|
||
}
|
||
|
||
return routeKey;
|
||
};
|
||
|
||
const routeKeys = {};
|
||
let namedParameterizedRoute = segments.map(segment => {
|
||
if (segment.startsWith('[') && segment.endsWith(']')) {
|
||
const {
|
||
key,
|
||
optional,
|
||
repeat
|
||
} = parseParameter(segment.slice(1, -1)); // replace any non-word characters since they can break
|
||
// the named regex
|
||
|
||
let cleanedKey = key.replace(/\W/g, '');
|
||
let invalidKey = false; // check if the key is still invalid and fallback to using a known
|
||
// safe key
|
||
|
||
if (cleanedKey.length === 0 || cleanedKey.length > 30) {
|
||
invalidKey = true;
|
||
}
|
||
|
||
if (!isNaN(parseInt(cleanedKey.substr(0, 1)))) {
|
||
invalidKey = true;
|
||
}
|
||
|
||
if (invalidKey) {
|
||
cleanedKey = getSafeRouteKey();
|
||
}
|
||
|
||
routeKeys[cleanedKey] = key;
|
||
return repeat ? optional ? `(?:/(?<${cleanedKey}>.+?))?` : `/(?<${cleanedKey}>.+?)` : `/(?<${cleanedKey}>[^/]+?)`;
|
||
} else {
|
||
return `/${escapeRegex(segment)}`;
|
||
}
|
||
}).join('');
|
||
return {
|
||
re: new RegExp(`^${parameterizedRoute}(?:/)?$`),
|
||
groups,
|
||
routeKeys,
|
||
namedRegex: `^${namedParameterizedRoute}(?:/)?$`
|
||
};
|
||
}
|
||
|
||
return {
|
||
re: new RegExp(`^${parameterizedRoute}(?:/)?$`),
|
||
groups
|
||
};
|
||
}
|
||
|
||
/***/ }),
|
||
|
||
/***/ 4755:
|
||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.execOnce = execOnce;
|
||
exports.getLocationOrigin = getLocationOrigin;
|
||
exports.getURL = getURL;
|
||
exports.getDisplayName = getDisplayName;
|
||
exports.isResSent = isResSent;
|
||
exports.loadGetInitialProps = loadGetInitialProps;
|
||
exports.formatWithValidation = formatWithValidation;
|
||
exports.ST = exports.SP = exports.urlObjectKeys = void 0;
|
||
|
||
var _formatUrl = __webpack_require__(2960);
|
||
/**
|
||
* Utils
|
||
*/
|
||
|
||
|
||
function execOnce(fn) {
|
||
let used = false;
|
||
let result;
|
||
return (...args) => {
|
||
if (!used) {
|
||
used = true;
|
||
result = fn(...args);
|
||
}
|
||
|
||
return result;
|
||
};
|
||
}
|
||
|
||
function getLocationOrigin() {
|
||
const {
|
||
protocol,
|
||
hostname,
|
||
port
|
||
} = window.location;
|
||
return `${protocol}//${hostname}${port ? ':' + port : ''}`;
|
||
}
|
||
|
||
function getURL() {
|
||
const {
|
||
href
|
||
} = window.location;
|
||
const origin = getLocationOrigin();
|
||
return href.substring(origin.length);
|
||
}
|
||
|
||
function getDisplayName(Component) {
|
||
return typeof Component === 'string' ? Component : Component.displayName || Component.name || 'Unknown';
|
||
}
|
||
|
||
function isResSent(res) {
|
||
return res.finished || res.headersSent;
|
||
}
|
||
|
||
async function loadGetInitialProps(App, ctx) {
|
||
if (false) { var _App$prototype; } // when called from _app `ctx` is nested in `ctx`
|
||
|
||
|
||
const res = ctx.res || ctx.ctx && ctx.ctx.res;
|
||
|
||
if (!App.getInitialProps) {
|
||
if (ctx.ctx && ctx.Component) {
|
||
// @ts-ignore pageProps default
|
||
return {
|
||
pageProps: await loadGetInitialProps(ctx.Component, ctx.ctx)
|
||
};
|
||
}
|
||
|
||
return {};
|
||
}
|
||
|
||
const props = await App.getInitialProps(ctx);
|
||
|
||
if (res && isResSent(res)) {
|
||
return props;
|
||
}
|
||
|
||
if (!props) {
|
||
const message = `"${getDisplayName(App)}.getInitialProps()" should resolve to an object. But found "${props}" instead.`;
|
||
throw new Error(message);
|
||
}
|
||
|
||
if (false) {}
|
||
|
||
return props;
|
||
}
|
||
|
||
const urlObjectKeys = ['auth', 'hash', 'host', 'hostname', 'href', 'path', 'pathname', 'port', 'protocol', 'query', 'search', 'slashes'];
|
||
exports.urlObjectKeys = urlObjectKeys;
|
||
|
||
function formatWithValidation(url) {
|
||
if (false) {}
|
||
|
||
return (0, _formatUrl.formatUrl)(url);
|
||
}
|
||
|
||
const SP = typeof performance !== 'undefined';
|
||
exports.SP = SP;
|
||
const ST = SP && typeof performance.mark === 'function' && typeof performance.measure === 'function';
|
||
exports.ST = ST;
|
||
|
||
/***/ }),
|
||
|
||
/***/ 9320:
|
||
/***/ (function(__unused_webpack_module, exports) {
|
||
|
||
"use strict";
|
||
exports.__esModule=true;exports.normalizePathSep=normalizePathSep;exports.denormalizePagePath=denormalizePagePath;function normalizePathSep(path){return path.replace(/\\/g,'/');}function denormalizePagePath(page){page=normalizePathSep(page);if(page.startsWith('/index/')){page=page.slice(6);}else if(page==='/index'){page='/';}return page;}
|
||
//# sourceMappingURL=denormalize-page-path.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 1664:
|
||
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
||
|
||
module.exports = __webpack_require__(2167)
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 2426:
|
||
/***/ (function(module) {
|
||
|
||
function _interopRequireDefault(obj) {
|
||
return obj && obj.__esModule ? obj : {
|
||
"default": obj
|
||
};
|
||
}
|
||
|
||
module.exports = _interopRequireDefault;
|
||
|
||
/***/ }),
|
||
|
||
/***/ 9448:
|
||
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
||
|
||
var _typeof = __webpack_require__(7917);
|
||
|
||
function _getRequireWildcardCache() {
|
||
if (typeof WeakMap !== "function") return null;
|
||
var cache = new WeakMap();
|
||
|
||
_getRequireWildcardCache = function _getRequireWildcardCache() {
|
||
return cache;
|
||
};
|
||
|
||
return cache;
|
||
}
|
||
|
||
function _interopRequireWildcard(obj) {
|
||
if (obj && obj.__esModule) {
|
||
return obj;
|
||
}
|
||
|
||
if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
|
||
return {
|
||
"default": obj
|
||
};
|
||
}
|
||
|
||
var cache = _getRequireWildcardCache();
|
||
|
||
if (cache && cache.has(obj)) {
|
||
return cache.get(obj);
|
||
}
|
||
|
||
var newObj = {};
|
||
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||
|
||
for (var key in obj) {
|
||
if (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;
|
||
}
|
||
|
||
module.exports = _interopRequireWildcard;
|
||
|
||
/***/ }),
|
||
|
||
/***/ 7917:
|
||
/***/ (function(module) {
|
||
|
||
function _typeof(obj) {
|
||
"@babel/helpers - typeof";
|
||
|
||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
||
module.exports = _typeof = function _typeof(obj) {
|
||
return typeof obj;
|
||
};
|
||
} else {
|
||
module.exports = _typeof = function _typeof(obj) {
|
||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
||
};
|
||
}
|
||
|
||
return _typeof(obj);
|
||
}
|
||
|
||
module.exports = _typeof;
|
||
|
||
/***/ })
|
||
|
||
};
|
||
; |